toolroll 0.9.134 → 0.9.135

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 (277) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/acp-check-repo-schema.js +52 -0
  3. package/dist/acp-check.js +1 -1
  4. package/dist/acp-client.js +3 -3
  5. package/dist/acp-inspect.js +2 -1
  6. package/dist/agent-detect.js +1 -1
  7. package/dist/agent-fence.js +4 -4
  8. package/dist/agent-thread/chat-turn.js +2 -2
  9. package/dist/agent-thread/direct-host.js +2 -2
  10. package/dist/agent-thread/fence.js +2 -2
  11. package/dist/agent-thread/git-workspace.js +2 -2
  12. package/dist/agent-thread/guards.js +1 -1
  13. package/dist/agent-thread/providers.js +1 -1
  14. package/dist/agent-thread/ship.js +2 -2
  15. package/dist/approval-decision.js +1 -0
  16. package/dist/approval-password.js +1 -1
  17. package/dist/approval-summary.js +1 -1
  18. package/dist/attest.js +1 -1
  19. package/dist/batch-checks.js +2 -2
  20. package/dist/boot-identity.js +1 -1
  21. package/dist/bounded-spawn.js +2 -2
  22. package/dist/browser/{chunk-agents-live-view.e97fbf607cb8075aad7a48664556d11ea41469785f82384b5171b76c524f71e2.js → chunk-agents-live-view.9f4367c89c6366769a567e729ac9181ccaa898bf3a168d3dc618f3cface887c7.js} +4 -4
  23. package/dist/browser/chunk-agents-live-view.9f4367c89c6366769a567e729ac9181ccaa898bf3a168d3dc618f3cface887c7.js.br +0 -0
  24. package/dist/browser/chunk-agents-live-view.9f4367c89c6366769a567e729ac9181ccaa898bf3a168d3dc618f3cface887c7.js.gz +0 -0
  25. package/dist/browser/chunk-bundle.ac5952c82c76e2efcdcf5a097c4fa235d6f1045dcc36d02ee921ff4be976a46a.js +2 -0
  26. package/dist/browser/chunk-bundle.ac5952c82c76e2efcdcf5a097c4fa235d6f1045dcc36d02ee921ff4be976a46a.js.br +0 -0
  27. package/dist/browser/chunk-bundle.ac5952c82c76e2efcdcf5a097c4fa235d6f1045dcc36d02ee921ff4be976a46a.js.gz +0 -0
  28. package/dist/browser/chunk-chat-parts.2a0b0b723508c5c48379f6a3d441f07a18c8b91ed64fd018962931c5ae43331e.js +4 -0
  29. package/dist/browser/chunk-chat-parts.2a0b0b723508c5c48379f6a3d441f07a18c8b91ed64fd018962931c5ae43331e.js.br +0 -0
  30. package/dist/browser/chunk-chat-parts.2a0b0b723508c5c48379f6a3d441f07a18c8b91ed64fd018962931c5ae43331e.js.gz +0 -0
  31. package/dist/browser/{chunk-core.64343d638685133eb96578bfb35bf560f329d0743ac5deda720ae27f5699c9d9.js → chunk-core.5490609e81c3a5f78da3e06b9795d71c287016ebc7fd02794b1122b474ebb07f.js} +12 -12
  32. package/dist/browser/chunk-core.5490609e81c3a5f78da3e06b9795d71c287016ebc7fd02794b1122b474ebb07f.js.br +0 -0
  33. package/dist/browser/chunk-core.5490609e81c3a5f78da3e06b9795d71c287016ebc7fd02794b1122b474ebb07f.js.gz +0 -0
  34. package/dist/browser/{chunk-flow-view.264e801af330461985aadcab42bc4ac4e036ba124394a7b5a100f2cd1edf89f0.js → chunk-flow-view.f5d74c7f072b739a7a0ed86ff35cafa7b8a041233372d1eeaab9eb941ddfc11e.js} +7 -7
  35. package/dist/browser/chunk-flow-view.f5d74c7f072b739a7a0ed86ff35cafa7b8a041233372d1eeaab9eb941ddfc11e.js.br +0 -0
  36. package/dist/browser/chunk-flow-view.f5d74c7f072b739a7a0ed86ff35cafa7b8a041233372d1eeaab9eb941ddfc11e.js.gz +0 -0
  37. package/dist/browser/chunk-flows-extra-view.01ebf93780b729363eda11ba21c764fe593bcd3e684aa833c9b86147f780fd41.js +4 -0
  38. package/dist/browser/chunk-flows-extra-view.01ebf93780b729363eda11ba21c764fe593bcd3e684aa833c9b86147f780fd41.js.br +0 -0
  39. package/dist/browser/chunk-flows-extra-view.01ebf93780b729363eda11ba21c764fe593bcd3e684aa833c9b86147f780fd41.js.gz +0 -0
  40. package/dist/browser/chunk-pages-bundle.e18059f0cb4fbb63e3698971d4c1830ad0945c3645235babc93010cd0b725c1d.js +6 -0
  41. package/dist/browser/chunk-pages-bundle.e18059f0cb4fbb63e3698971d4c1830ad0945c3645235babc93010cd0b725c1d.js.br +0 -0
  42. package/dist/browser/chunk-pages-bundle.e18059f0cb4fbb63e3698971d4c1830ad0945c3645235babc93010cd0b725c1d.js.gz +0 -0
  43. package/dist/browser/chunk-result-view.fc6a6494b316aa786807b7d17035c59defae1bfb0c03bf9c3795679b3a35dd77.js +2 -0
  44. package/dist/browser/chunk-result-view.fc6a6494b316aa786807b7d17035c59defae1bfb0c03bf9c3795679b3a35dd77.js.br +0 -0
  45. package/dist/browser/chunk-result-view.fc6a6494b316aa786807b7d17035c59defae1bfb0c03bf9c3795679b3a35dd77.js.gz +0 -0
  46. package/dist/browser/chunk-settings-view.6dd3a64ded7bd8c047650270918dfb455c9a514a5a40b84c7eb5f443f76fe66f.js +20 -0
  47. package/dist/browser/chunk-settings-view.6dd3a64ded7bd8c047650270918dfb455c9a514a5a40b84c7eb5f443f76fe66f.js.br +0 -0
  48. package/dist/browser/chunk-settings-view.6dd3a64ded7bd8c047650270918dfb455c9a514a5a40b84c7eb5f443f76fe66f.js.gz +0 -0
  49. package/dist/browser/{chunk-shared.85e1b9e0838ccc819e7b8368f80dd5240dda90f53ea2974a256a8fa4122ba2fb.js → chunk-shared.02c0b692de21a9bb80d1761aa887d8532431171945c02e663884c9f45b796753.js} +2 -2
  50. package/dist/browser/chunk-shared.02c0b692de21a9bb80d1761aa887d8532431171945c02e663884c9f45b796753.js.br +0 -0
  51. package/dist/browser/chunk-shared.02c0b692de21a9bb80d1761aa887d8532431171945c02e663884c9f45b796753.js.gz +0 -0
  52. package/dist/browser/chunk-shared.0874336833f8101a63b169d8c2e55ca0f281e43e65d4bd6604555c791ea9dd87.js +2 -0
  53. package/dist/browser/chunk-shared.0874336833f8101a63b169d8c2e55ca0f281e43e65d4bd6604555c791ea9dd87.js.br +0 -0
  54. package/dist/browser/chunk-shared.0874336833f8101a63b169d8c2e55ca0f281e43e65d4bd6604555c791ea9dd87.js.gz +0 -0
  55. package/dist/browser/chunk-shared.2413dd78f32995fbca67f51ac8c21baf4727cd64f185ea739aa2a058e569b0ed.js +2 -0
  56. package/dist/browser/chunk-shared.2413dd78f32995fbca67f51ac8c21baf4727cd64f185ea739aa2a058e569b0ed.js.br +0 -0
  57. package/dist/browser/chunk-shared.2413dd78f32995fbca67f51ac8c21baf4727cd64f185ea739aa2a058e569b0ed.js.gz +0 -0
  58. package/dist/browser/{chunk-shared.26f6cbfdeb9bcd63231f23dbf96cacb39b78324aeed2503e86109efa89fa27db.js → chunk-shared.26bb0114998968cccb7bae5f6ffa8979ddecfafd8bc18bb6985760f6bcc030e6.js} +3 -3
  59. package/dist/browser/chunk-shared.26bb0114998968cccb7bae5f6ffa8979ddecfafd8bc18bb6985760f6bcc030e6.js.br +0 -0
  60. package/dist/browser/chunk-shared.26bb0114998968cccb7bae5f6ffa8979ddecfafd8bc18bb6985760f6bcc030e6.js.gz +0 -0
  61. package/dist/browser/chunk-shared.6d0b8728b3e309886cfb6eaf596d3f20592939e521bb60bb090824f34da6b086.js +2 -0
  62. package/dist/browser/chunk-shared.6d0b8728b3e309886cfb6eaf596d3f20592939e521bb60bb090824f34da6b086.js.br +0 -0
  63. package/dist/browser/chunk-shared.6d0b8728b3e309886cfb6eaf596d3f20592939e521bb60bb090824f34da6b086.js.gz +0 -0
  64. package/dist/browser/chunk-shared.c3e5be1c5f441e94905a4bc2005d816d2a0b0e4108bae43e37ec274a911c6847.js +2 -0
  65. package/dist/browser/chunk-shared.c3e5be1c5f441e94905a4bc2005d816d2a0b0e4108bae43e37ec274a911c6847.js.br +0 -0
  66. package/dist/browser/chunk-shared.c3e5be1c5f441e94905a4bc2005d816d2a0b0e4108bae43e37ec274a911c6847.js.gz +0 -0
  67. package/dist/browser/chunk-shared.d1f25785c8c168cc75aa99c4be8ca56abfc5eafa3490f8817ff15e61cb901915.js +2 -0
  68. package/dist/browser/chunk-shared.d1f25785c8c168cc75aa99c4be8ca56abfc5eafa3490f8817ff15e61cb901915.js.br +0 -0
  69. package/dist/browser/chunk-shared.d1f25785c8c168cc75aa99c4be8ca56abfc5eafa3490f8817ff15e61cb901915.js.gz +0 -0
  70. package/dist/browser/{chunk-shared.5b47ca221b8b77b26ce8006f0569c981df2b905005cebe9fc54444d4906d436e.js → chunk-shared.fd5f2699d3b0017797e5b5e1e1d92eb98818740ebf20a95364bbb7deea0c8242.js} +3 -3
  71. package/dist/browser/chunk-shared.fd5f2699d3b0017797e5b5e1e1d92eb98818740ebf20a95364bbb7deea0c8242.js.br +0 -0
  72. package/dist/browser/chunk-shared.fd5f2699d3b0017797e5b5e1e1d92eb98818740ebf20a95364bbb7deea0c8242.js.gz +0 -0
  73. package/dist/browser/{chunk-sonner.160372eb4f9455847ca83e8ff5d983c6b3010ef0dc2eaf541e2eaceaac3b994c.js → chunk-sonner.2472e1da55de10b11dc002c80a840966061e817c47793f5e216f1af6c6dbedff.js} +1 -1
  74. package/dist/browser/chunk-sonner.2472e1da55de10b11dc002c80a840966061e817c47793f5e216f1af6c6dbedff.js.br +0 -0
  75. package/dist/browser/chunk-sonner.2472e1da55de10b11dc002c80a840966061e817c47793f5e216f1af6c6dbedff.js.gz +0 -0
  76. package/dist/browser/chunk-task-view.bbeddc793a5e8a6d1f66b6cc5f0ce1da18414137e85c49ccd07be0e20f61ac12.js +2 -0
  77. package/dist/browser/chunk-task-view.bbeddc793a5e8a6d1f66b6cc5f0ce1da18414137e85c49ccd07be0e20f61ac12.js.br +0 -0
  78. package/dist/browser/chunk-task-view.bbeddc793a5e8a6d1f66b6cc5f0ce1da18414137e85c49ccd07be0e20f61ac12.js.gz +0 -0
  79. package/dist/browser/chunk-team-chat.c3255a5a1d94e39d559c07438c4690543602b1552b2c2bf57b8791d7f989141d.js +2 -0
  80. package/dist/browser/chunk-team-chat.c3255a5a1d94e39d559c07438c4690543602b1552b2c2bf57b8791d7f989141d.js.br +0 -0
  81. package/dist/browser/chunk-team-chat.c3255a5a1d94e39d559c07438c4690543602b1552b2c2bf57b8791d7f989141d.js.gz +0 -0
  82. package/dist/browser/manifest.json +194 -194
  83. package/dist/browser/workspace.3043c4a6df23ed1c0c8be3fb816fa9410a2ab99053eb54476f22a1735c03ca97.css +4 -0
  84. package/dist/browser/workspace.3043c4a6df23ed1c0c8be3fb816fa9410a2ab99053eb54476f22a1735c03ca97.css.br +0 -0
  85. package/dist/browser/workspace.3043c4a6df23ed1c0c8be3fb816fa9410a2ab99053eb54476f22a1735c03ca97.css.gz +0 -0
  86. package/dist/browser/{workspace.efd01c3aaf8e07c4a64194e2bfbd7aee4f7fa515f2acebdfdd90af1badba8ce7.js → workspace.aebb60d4e5ef4509a80cfaccf0af5f7246867ec7531a1734dd8e28c59594950e.js} +4 -4
  87. package/dist/browser/workspace.aebb60d4e5ef4509a80cfaccf0af5f7246867ec7531a1734dd8e28c59594950e.js.br +0 -0
  88. package/dist/browser/workspace.aebb60d4e5ef4509a80cfaccf0af5f7246867ec7531a1734dd8e28c59594950e.js.gz +0 -0
  89. package/dist/browser-open.js +1 -1
  90. package/dist/build-review.js +2 -2
  91. package/dist/builder.js +21 -14
  92. package/dist/canvas-capture.js +2 -2
  93. package/dist/canvas-freshness.js +1 -1
  94. package/dist/central-recovery-stage.js +1 -1
  95. package/dist/chat-actions.js +3 -3
  96. package/dist/chat-decide.js +8 -4
  97. package/dist/cli-help.js +8 -7
  98. package/dist/cli.js +2 -2
  99. package/dist/companion/bonjour.js +1 -1
  100. package/dist/companion/daemon.js +1 -1
  101. package/dist/companion/passkey-gate.js +1 -1
  102. package/dist/companion/reads.js +1 -1
  103. package/dist/companion/store.js +1 -1
  104. package/dist/companion/webauthn.js +1 -1
  105. package/dist/companion/work.js +1 -1
  106. package/dist/container-state.js +2 -2
  107. package/dist/containment.js +2 -2
  108. package/dist/contracts/chat-actions.js +1 -1
  109. package/dist/contracts/console-api.js +1 -1
  110. package/dist/contracts/engine-api.js +1 -1
  111. package/dist/controller-supervisor.js +2 -2
  112. package/dist/credential-broker.js +1 -1
  113. package/dist/demo.js +2 -2
  114. package/dist/easy-start.js +1 -1
  115. package/dist/egress.js +1 -1
  116. package/dist/engine-handoff.js +1 -1
  117. package/dist/engine-reads.js +1 -1
  118. package/dist/evals.js +2 -2
  119. package/dist/exec.js +4 -4
  120. package/dist/fast-owner-schema.js +33 -0
  121. package/dist/fast-start.js +1 -1
  122. package/dist/flow-unattended.js +2 -2
  123. package/dist/github-import.js +1 -1
  124. package/dist/github-read.js +1 -1
  125. package/dist/install-mode.js +2 -3
  126. package/dist/invoke.js +9 -7
  127. package/dist/laptop-background.js +1 -1
  128. package/dist/lead-capabilities.js +1 -1
  129. package/dist/live-backup-change.js +2 -2
  130. package/dist/live-backup.js +2 -2
  131. package/dist/live-terminal.js +3 -3
  132. package/dist/local-checks.js +1 -1
  133. package/dist/local-landing.js +22 -3
  134. package/dist/local-owner.js +1 -1
  135. package/dist/machine-identity.js +1 -1
  136. package/dist/model-catalog.js +8 -5
  137. package/dist/model-choices.js +3 -3
  138. package/dist/model-routing.js +1 -1
  139. package/dist/models-cli.js +2 -2
  140. package/dist/names.js +1 -1
  141. package/dist/onboard.js +1 -1
  142. package/dist/operate-remote-arguments.js +1 -1
  143. package/dist/operate.js +33 -16
  144. package/dist/orphan-sweep.js +1 -1
  145. package/dist/owner-mode.js +4 -0
  146. package/dist/peek-cli.js +2 -2
  147. package/dist/phase-routing.js +1 -1
  148. package/dist/pi-build.js +1 -1
  149. package/dist/plane-review.js +1 -1
  150. package/dist/planner-source.js +2 -2
  151. package/dist/planner.js +1 -1
  152. package/dist/pre-run-phase.js +1 -1
  153. package/dist/presence-hold.js +1 -1
  154. package/dist/process-liveness.js +1 -1
  155. package/dist/process-tree.js +1 -1
  156. package/dist/project-tools.js +2 -2
  157. package/dist/prompt.js +1 -1
  158. package/dist/proposal.js +1 -1
  159. package/dist/protected-storage.js +2 -2
  160. package/dist/provider-home.js +1 -1
  161. package/dist/provider-limits.js +1 -1
  162. package/dist/provider.js +2 -2
  163. package/dist/public-access.js +1 -1
  164. package/dist/pull-request-flow.js +2 -2
  165. package/dist/read-executor.js +1 -1
  166. package/dist/release-adapters.js +2 -2
  167. package/dist/release-carry.js +3 -3
  168. package/dist/release-resume.js +2 -2
  169. package/dist/release-start.js +1 -0
  170. package/dist/result-follow-ups.js +2 -2
  171. package/dist/review-switch.js +1 -1
  172. package/dist/route-change.js +25 -3
  173. package/dist/run-closeout.js +2 -2
  174. package/dist/runner.js +1 -1
  175. package/dist/sandbox-launch.js +2 -2
  176. package/dist/sandbox-runtime.js +1 -1
  177. package/dist/scope.js +1 -1
  178. package/dist/scout-browser.js +1 -1
  179. package/dist/serve.js +3 -3
  180. package/dist/server/chat.js +1 -1
  181. package/dist/server/direct-chat.js +1 -1
  182. package/dist/server/engine-api.js +1 -1
  183. package/dist/server/http.js +1 -1
  184. package/dist/server/one-time-secret.js +1 -1
  185. package/dist/server/route-table.js +1 -1
  186. package/dist/server/runtime.js +1 -1
  187. package/dist/server/settings-phone.js +1 -1
  188. package/dist/server/settings-section-table.js +1 -1
  189. package/dist/server/settings-sections.js +1 -1
  190. package/dist/server/settings.js +2 -1
  191. package/dist/server/task-view-data.js +3 -3
  192. package/dist/server/task-views.js +1 -1
  193. package/dist/server/tasks.js +5 -5
  194. package/dist/server/terminals.js +1 -1
  195. package/dist/settings-data.js +1 -1
  196. package/dist/settings-proofs.js +1 -1
  197. package/dist/shared-deps.js +4 -4
  198. package/dist/sign-in-page.js +2 -2
  199. package/dist/ssr-workspace.js +88 -88
  200. package/dist/staged-runtimes.js +1 -1
  201. package/dist/status-probe.js +2 -2
  202. package/dist/stop-proof.js +2 -2
  203. package/dist/storage-sweep-child.js +2 -2
  204. package/dist/storage-sweep-process.js +1 -1
  205. package/dist/storage.js +2 -2
  206. package/dist/store-baseline.js +5 -33
  207. package/dist/store.js +19 -14
  208. package/dist/subscription-usage.js +3 -3
  209. package/dist/surface.js +1 -1
  210. package/dist/test-temp.js +1 -1
  211. package/dist/tool-broker.js +1 -1
  212. package/dist/toolroll-update.js +3 -3
  213. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  214. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  215. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  216. package/dist/tui/linux-x64/toolroll-tui +0 -0
  217. package/dist/tui-launch.js +1 -1
  218. package/dist/welcome-facts.js +1 -1
  219. package/package.json +1 -1
  220. package/dist/browser/chunk-agents-live-view.e97fbf607cb8075aad7a48664556d11ea41469785f82384b5171b76c524f71e2.js.br +0 -0
  221. package/dist/browser/chunk-agents-live-view.e97fbf607cb8075aad7a48664556d11ea41469785f82384b5171b76c524f71e2.js.gz +0 -0
  222. package/dist/browser/chunk-bundle.48f442a2868e9b77e9f54c5b77f1bba629ccd1615de8a2f62619b811783314f6.js +0 -2
  223. package/dist/browser/chunk-bundle.48f442a2868e9b77e9f54c5b77f1bba629ccd1615de8a2f62619b811783314f6.js.br +0 -0
  224. package/dist/browser/chunk-bundle.48f442a2868e9b77e9f54c5b77f1bba629ccd1615de8a2f62619b811783314f6.js.gz +0 -0
  225. package/dist/browser/chunk-chat-parts.1669e6985c5c0c11eea6792ea177ea4c9f7e7ebf27bd3b31742feb6a26d5b2a5.js +0 -4
  226. package/dist/browser/chunk-chat-parts.1669e6985c5c0c11eea6792ea177ea4c9f7e7ebf27bd3b31742feb6a26d5b2a5.js.br +0 -0
  227. package/dist/browser/chunk-chat-parts.1669e6985c5c0c11eea6792ea177ea4c9f7e7ebf27bd3b31742feb6a26d5b2a5.js.gz +0 -0
  228. package/dist/browser/chunk-core.64343d638685133eb96578bfb35bf560f329d0743ac5deda720ae27f5699c9d9.js.br +0 -0
  229. package/dist/browser/chunk-core.64343d638685133eb96578bfb35bf560f329d0743ac5deda720ae27f5699c9d9.js.gz +0 -0
  230. package/dist/browser/chunk-flow-view.264e801af330461985aadcab42bc4ac4e036ba124394a7b5a100f2cd1edf89f0.js.br +0 -0
  231. package/dist/browser/chunk-flow-view.264e801af330461985aadcab42bc4ac4e036ba124394a7b5a100f2cd1edf89f0.js.gz +0 -0
  232. package/dist/browser/chunk-flows-extra-view.6761503a97e1f17b474703ff5687a8682c54f9db1715e0a9762a979030a1b036.js +0 -4
  233. package/dist/browser/chunk-flows-extra-view.6761503a97e1f17b474703ff5687a8682c54f9db1715e0a9762a979030a1b036.js.br +0 -0
  234. package/dist/browser/chunk-flows-extra-view.6761503a97e1f17b474703ff5687a8682c54f9db1715e0a9762a979030a1b036.js.gz +0 -0
  235. package/dist/browser/chunk-pages-bundle.365da73d009e3ced30b55bca7107f548dc832f7a9f52926d3dcd68aa5596da11.js +0 -6
  236. package/dist/browser/chunk-pages-bundle.365da73d009e3ced30b55bca7107f548dc832f7a9f52926d3dcd68aa5596da11.js.br +0 -0
  237. package/dist/browser/chunk-pages-bundle.365da73d009e3ced30b55bca7107f548dc832f7a9f52926d3dcd68aa5596da11.js.gz +0 -0
  238. package/dist/browser/chunk-result-view.d4dc562a1a6a52a1497e25300d5f80c220952ceb5bb719ca32ef8dc1e74a4124.js +0 -2
  239. package/dist/browser/chunk-result-view.d4dc562a1a6a52a1497e25300d5f80c220952ceb5bb719ca32ef8dc1e74a4124.js.br +0 -0
  240. package/dist/browser/chunk-result-view.d4dc562a1a6a52a1497e25300d5f80c220952ceb5bb719ca32ef8dc1e74a4124.js.gz +0 -0
  241. package/dist/browser/chunk-settings-view.ff302e1c5faf5486c96e5fc96fa32492da4153e6e19997ce7b718adab21bf3b7.js +0 -20
  242. package/dist/browser/chunk-settings-view.ff302e1c5faf5486c96e5fc96fa32492da4153e6e19997ce7b718adab21bf3b7.js.br +0 -0
  243. package/dist/browser/chunk-settings-view.ff302e1c5faf5486c96e5fc96fa32492da4153e6e19997ce7b718adab21bf3b7.js.gz +0 -0
  244. package/dist/browser/chunk-shared.152678a803cfb6dee935162fbbbdb38d031d80f1d32ce48610f37bc1c8621e49.js +0 -2
  245. package/dist/browser/chunk-shared.152678a803cfb6dee935162fbbbdb38d031d80f1d32ce48610f37bc1c8621e49.js.br +0 -0
  246. package/dist/browser/chunk-shared.152678a803cfb6dee935162fbbbdb38d031d80f1d32ce48610f37bc1c8621e49.js.gz +0 -0
  247. package/dist/browser/chunk-shared.26f6cbfdeb9bcd63231f23dbf96cacb39b78324aeed2503e86109efa89fa27db.js.br +0 -0
  248. package/dist/browser/chunk-shared.26f6cbfdeb9bcd63231f23dbf96cacb39b78324aeed2503e86109efa89fa27db.js.gz +0 -0
  249. package/dist/browser/chunk-shared.4e21c6b33b9a525e63c360d20a1830f1a26c5021f5d218f2300f21ff840af27e.js +0 -2
  250. package/dist/browser/chunk-shared.4e21c6b33b9a525e63c360d20a1830f1a26c5021f5d218f2300f21ff840af27e.js.br +0 -0
  251. package/dist/browser/chunk-shared.4e21c6b33b9a525e63c360d20a1830f1a26c5021f5d218f2300f21ff840af27e.js.gz +0 -0
  252. package/dist/browser/chunk-shared.5b47ca221b8b77b26ce8006f0569c981df2b905005cebe9fc54444d4906d436e.js.br +0 -0
  253. package/dist/browser/chunk-shared.5b47ca221b8b77b26ce8006f0569c981df2b905005cebe9fc54444d4906d436e.js.gz +0 -0
  254. package/dist/browser/chunk-shared.85e1b9e0838ccc819e7b8368f80dd5240dda90f53ea2974a256a8fa4122ba2fb.js.br +0 -0
  255. package/dist/browser/chunk-shared.85e1b9e0838ccc819e7b8368f80dd5240dda90f53ea2974a256a8fa4122ba2fb.js.gz +0 -0
  256. package/dist/browser/chunk-shared.a326d625dea5cda744678a73b38c0cb2688721c9228e26d262279ecd5c2d7d11.js +0 -2
  257. package/dist/browser/chunk-shared.a326d625dea5cda744678a73b38c0cb2688721c9228e26d262279ecd5c2d7d11.js.br +0 -0
  258. package/dist/browser/chunk-shared.a326d625dea5cda744678a73b38c0cb2688721c9228e26d262279ecd5c2d7d11.js.gz +0 -0
  259. package/dist/browser/chunk-shared.e906e9c8c0859e000616dbc382f88597447f30205c92b7cb9a8e2351f3ef2722.js +0 -2
  260. package/dist/browser/chunk-shared.e906e9c8c0859e000616dbc382f88597447f30205c92b7cb9a8e2351f3ef2722.js.br +0 -0
  261. package/dist/browser/chunk-shared.e906e9c8c0859e000616dbc382f88597447f30205c92b7cb9a8e2351f3ef2722.js.gz +0 -0
  262. package/dist/browser/chunk-shared.f6354151d62439f2d78f5d17cf9bc44f35b4da37685beb77467d98dd9cc6f1e4.js +0 -2
  263. package/dist/browser/chunk-shared.f6354151d62439f2d78f5d17cf9bc44f35b4da37685beb77467d98dd9cc6f1e4.js.br +0 -0
  264. package/dist/browser/chunk-shared.f6354151d62439f2d78f5d17cf9bc44f35b4da37685beb77467d98dd9cc6f1e4.js.gz +0 -0
  265. package/dist/browser/chunk-sonner.160372eb4f9455847ca83e8ff5d983c6b3010ef0dc2eaf541e2eaceaac3b994c.js.br +0 -0
  266. package/dist/browser/chunk-sonner.160372eb4f9455847ca83e8ff5d983c6b3010ef0dc2eaf541e2eaceaac3b994c.js.gz +0 -0
  267. package/dist/browser/chunk-task-view.325b506afc26b25147b2e90cec5ad1392d50e6150a7fb33c81a996daa99bb05a.js +0 -2
  268. package/dist/browser/chunk-task-view.325b506afc26b25147b2e90cec5ad1392d50e6150a7fb33c81a996daa99bb05a.js.br +0 -0
  269. package/dist/browser/chunk-task-view.325b506afc26b25147b2e90cec5ad1392d50e6150a7fb33c81a996daa99bb05a.js.gz +0 -0
  270. package/dist/browser/chunk-team-chat.d560bcc5d819e63133d377b8a6f10f901356e680771f19d4fe1af044adfffb22.js +0 -2
  271. package/dist/browser/chunk-team-chat.d560bcc5d819e63133d377b8a6f10f901356e680771f19d4fe1af044adfffb22.js.br +0 -0
  272. package/dist/browser/chunk-team-chat.d560bcc5d819e63133d377b8a6f10f901356e680771f19d4fe1af044adfffb22.js.gz +0 -0
  273. package/dist/browser/workspace.ac1270b58f672fa920535348cc582f5fc68247b341d6fc8ec733b25336f2b9cc.css +0 -4
  274. package/dist/browser/workspace.ac1270b58f672fa920535348cc582f5fc68247b341d6fc8ec733b25336f2b9cc.css.br +0 -0
  275. package/dist/browser/workspace.ac1270b58f672fa920535348cc582f5fc68247b341d6fc8ec733b25336f2b9cc.css.gz +0 -0
  276. package/dist/browser/workspace.efd01c3aaf8e07c4a64194e2bfbd7aee4f7fa515f2acebdfdd90af1badba8ce7.js.br +0 -0
  277. package/dist/browser/workspace.efd01c3aaf8e07c4a64194e2bfbd7aee4f7fa515f2acebdfdd90af1badba8ce7.js.gz +0 -0
@@ -0,0 +1,20 @@
1
+ /*! Third-party notices: /assets/THIRD_PARTY_NOTICES.txt */
2
+ import{p4$a as as}from"./chunk-core.5490609e81c3a5f78da3e06b9795d71c287016ebc7fd02794b1122b474ebb07f.js";import{p1$$ as Ot,p1$$a as is,p1$$b as qt,p1$A as ks,p1$Aa as Et,p1$Ab as Ut,p1$B as ws,p1$Ba as Wt,p1$Bb as Dt,p1$C as ys,p1$Ca as Ht,p1$Cb as Bt,p1$D as $s,p1$Da as Vt,p1$Db as Gt,p1$E as Ns,p1$Ea as Yt,p1$Eb as Kt,p1$F as ye,p1$Fa as _t,p1$Fb as zt,p1$G as Ss,p1$Ga as Jt,p1$Gb as Qt,p1$H as Cs,p1$Ha as Xt,p1$Hb as ls,p1$I as _e,p1$Ia as Zt,p1$Ib as ea,p1$J as sa,p1$Ja as na,p1$Jb as ta,p1$K as aa,p1$Ka as ia,p1$Kb as la,p1$L as ra,p1$La as oa,p1$Lb as da,p1$M as ca,p1$Ma as ha,p1$Mb as Ts,p1$N as pa,p1$Na as ua,p1$Nb as ma,p1$O as ga,p1$Oa as ja,p1$Ob as xa,p1$P as fa,p1$Pa as ba,p1$Pb as va,p1$Q as ka,p1$Qa as wa,p1$Qb as ya,p1$R as $a,p1$Ra as Na,p1$Rb as Sa,p1$S as Ca,p1$Sa as Ta,p1$Sb as Aa,p1$T as Fa,p1$Ta as Pa,p1$Tb as Ra,p1$U as Ia,p1$Ua as Ma,p1$Ub as H,p1$V as As,p1$Va as La,p1$Vb as ze,p1$W as Oa,p1$Wa as qa,p1$Wb as Ea,p1$X as Ua,p1$Xa as Wa,p1$Xb as We,p1$Y as Da,p1$Ya as rs,p1$Yb as Ha,p1$Z as Ba,p1$Za as Fs,p1$Zb as Va,p1$_ as Ga,p1$_a as De,p1$_b as Ya,p1$a as Ka,p1$aa as _a,p1$ab as Ps,p1$ac as za,p1$b as Ja,p1$ba as Qa,p1$bb as Je,p1$bc as Xa,p1$c as Za,p1$ca as ei,p1$cb as C,p1$cc as si,p1$d as ni,p1$da as ti,p1$db as z,p1$dc as ai,p1$e as ii,p1$ea as li,p1$eb as ne,p1$ec as ri,p1$f as oi,p1$fa as di,p1$fb as ci,p1$fc as hi,p1$g as pi,p1$ga as ui,p1$gb as mi,p1$gc as gi,p1$h as ji,p1$ha as xi,p1$hb as fi,p1$hc as bi,p1$i as vi,p1$ia as ki,p1$ib as wi,p1$ic as yi,p1$j as ke,p1$ja as $i,p1$jb as Ni,p1$jc as Si,p1$k as le,p1$ka as Ci,p1$kb as Rs,p1$kc as Ti,p1$l as je,p1$la as Ai,p1$lb as ge,p1$lc as Fi,p1$m as Pi,p1$ma as Ri,p1$mb as Me,p1$mc as Ii,p1$n as Mi,p1$na as Li,p1$nb as v,p1$nc as Oi,p1$o as qi,p1$oa as Ei,p1$ob as Ve,p1$p as Ui,p1$pa as Wi,p1$pb as A,p1$q as Di,p1$qa as Hi,p1$qb as xe,p1$r as Bi,p1$ra as Vi,p1$rb as X,p1$s as Gi,p1$sa as Yi,p1$sb as Le,p1$t as Ki,p1$ta as _i,p1$tb as h,p1$u as zi,p1$ua as Ji,p1$ub as os,p1$v as Qi,p1$va as Is,p1$vb as q,p1$w as Xi,p1$wa as Ms,p1$wb as Zi,p1$x as el,p1$xa as sl,p1$xb as nl,p1$y as Ls,p1$ya as tl,p1$yb as al,p1$z as Os,p1$za as il,p1$zb as ll}from"./chunk-core.5490609e81c3a5f78da3e06b9795d71c287016ebc7fd02794b1122b474ebb07f.js";import{p2$a as dl,p2$b as ue,p2$c as Ce,p2$d as cl,p2$e as Te}from"./chunk-core.5490609e81c3a5f78da3e06b9795d71c287016ebc7fd02794b1122b474ebb07f.js";var ml=ue(Ce(),1),gl=ue(Ce(),1),ce=ue(Ce(),1),c=ue(Te(),1);function cn(e,n){return n instanceof HTMLButtonElement&&n.form===e&&n.hasAttribute("formaction")?new URL(HTMLButtonElement.prototype.getAttribute.call(n,"formaction")??"",window.location.href).href:new URL(HTMLFormElement.prototype.getAttribute.call(e,"action")??"",window.location.href).href}function _({children:e,className:n,...t}){return(0,c.jsx)("code",{className:n?`k-mono ${n}`:"k-mono",...t,children:e})}function u({id:e,title:n,state:t,lead:a,right:i,tabIndex:g,children:d}){return(0,c.jsxs)("section",{className:"k-ssec",id:e,"data-section":e,tabIndex:g,"aria-labelledby":`${e}-h`,children:[(0,c.jsxs)("div",{className:"k-ssec-h",children:[(0,c.jsxs)("h2",{className:"k-ssec-t",id:`${e}-h`,children:[n,t?(0,c.jsx)("span",{className:"k-ssec-state",children:t}):null]}),i??null,a?(0,c.jsx)("p",{className:"k-ssec-lead",children:a}):null]}),(0,c.jsx)("div",{className:"k-ssec-b",children:d})]})}function B({title:e,sub:n,when:t,action:a,children:i,...g}){return(0,c.jsxs)("div",{...g,className:g.className?`k-srec ${g.className}`:"k-srec",children:[(0,c.jsxs)("div",{className:"k-srec-m",children:[(0,c.jsx)("div",{className:"k-srec-t",children:e}),n?(0,c.jsx)("div",{className:"k-srec-s",children:n}):null,t?(0,c.jsx)("div",{className:"k-srec-w",children:t}):null]}),a?(0,c.jsx)("div",{className:"k-srec-a",children:a}):null,i?(0,c.jsx)("div",{className:"k-srec-more",children:i}):null]})}function G({action:e,fields:n,acts:t,...a}){let i=(0,c.jsx)(C,{sm:!0,type:"submit",...a});return(0,c.jsx)(K,{action:e,hiddenFields:n,children:t?(0,c.jsx)(A,{children:i}):i})}function K({hiddenFields:e,children:n,...t}){return(0,c.jsxs)(_e,{...t,children:[e?Object.entries(e).map(([a,i])=>(0,c.jsx)("input",{type:"hidden",name:a,value:i},a)):null,n]})}function Qs({name:e,legend:n,initial:t,items:a}){let[i,g]=(0,ce.useState)(t);return(0,c.jsx)(Ve,{name:e,legend:n,current:i,items:a,onChange:g})}function he({said:e,problem:n}){return n?(0,c.jsx)(X,{children:n}):e?(0,c.jsx)(Le,{children:e}):null}function Ae({action:e,projects:n,chosen:t,evenOne:a=!1}){return n.length<(a?1:2)?null:(0,c.jsxs)("form",{method:"get",action:e,className:"k-acts k-picker",children:[(0,c.jsx)(ge,{name:"repo","aria-label":"Project",defaultValue:t,items:n.map(i=>[i.repo,i.name])}),(0,c.jsx)(C,{sm:!0,type:"submit",label:"Show"})]})}function gs({field:e}){if(e.kind==="note")return(0,c.jsxs)(h,{children:[e.text,e.code?(0,c.jsxs)(c.Fragment,{children:[" ",(0,c.jsx)(_,{children:e.code})]}):null]});if(e.kind==="facts")return(0,c.jsx)(xe,{rows:e.rows.map(n=>[n.label,n.mono?(0,c.jsx)(_,{children:n.value}):n.value])});if(e.kind==="secret"){let n=(0,c.jsx)("input",{className:"k-input",id:e.id,type:"password",name:e.name,required:e.required,placeholder:e.placeholder,autoComplete:"off","data-so-secret":"","data-1p-ignore":"","data-lpignore":"true","data-bwignore":"","data-form-type":"other","aria-label":e.label});return(0,c.jsx)(v,{label:e.label,hint:e.hint??void 0,variant:e.layout??"",children:n})}return e.kind==="status"?e.state==="failing"?(0,c.jsxs)("p",{className:"k-notice",role:"alert","data-monitoring":e.sink,"data-state":e.state,children:[(0,c.jsx)(Je,{name:"alert",small:!0}),(0,c.jsx)("span",{children:e.text})]}):(0,c.jsx)("p",{className:"k-note","data-monitoring":e.sink,"data-state":e.state,children:e.text}):e.kind==="row"?(0,c.jsx)(v,{label:e.label,hint:e.hint??void 0,variant:e.layout??"",children:null}):e.kind==="disclose"?(0,c.jsx)(q,{summary:e.label,children:e.fields.map((n,t)=>(0,c.jsx)(gs,{field:n},t))}):e.kind==="segment"?(0,c.jsx)(v,{label:e.label,hint:e.hint??void 0,children:(0,c.jsx)("div",{className:"k-seg",role:"group","aria-label":e.label,children:e.items.map(([n,t])=>(0,c.jsx)("button",{type:"submit",name:e.name,value:n,"aria-pressed":String(e.current===n),children:t},n))})}):e.kind==="color"?(0,c.jsx)(v,{label:e.label,hint:e.hint??void 0,children:(0,c.jsx)("input",{type:"color",name:e.name,defaultValue:e.value,"aria-label":e.ariaLabel,style:{width:"40px",height:"36px",padding:"2px",border:"1px solid var(--so-input-line)",borderRadius:"8px",background:"var(--so-paper)",cursor:"pointer"}})}):e.kind==="input"?(0,c.jsx)(v,{label:e.label,hint:e.hint??void 0,variant:e.layout??"",children:(0,c.jsx)(le,{id:e.id,name:e.name,type:e.type??"text",defaultValue:e.value,placeholder:e.placeholder,required:e.required,pattern:e.pattern,spellCheck:e.spellCheck,autoComplete:e.autoComplete,min:e.min,max:e.max,step:e.step,"aria-label":e.ariaLabel??e.label})}):e.kind==="textarea"?(0,c.jsx)(v,{label:e.label,hint:e.hint??void 0,variant:e.layout??"wide",children:(0,c.jsx)(je,{id:e.id,name:e.name,defaultValue:e.value,placeholder:e.placeholder,rows:e.rows,required:e.required,className:e.mono?"k-mono":void 0,"aria-label":e.label})}):e.kind==="select"?(0,c.jsx)(v,{label:e.label,hint:e.hint??void 0,variant:e.layout??"",children:(0,c.jsx)(ge,{id:e.id,name:e.name,"aria-label":e.label,defaultValue:e.current,items:e.items})}):e.kind==="switch"?(0,c.jsx)(v,{label:e.label,hint:e.hint??void 0,variant:e.layout??"inline",children:(0,c.jsx)(Me,{id:e.id,name:e.name,label:e.switchLabel??e.label,defaultChecked:e.on,value:e.value})}):e.kind==="radios"?(0,c.jsx)(v,{label:e.legend,hint:e.hint??void 0,variant:e.layout??"wide",children:(0,c.jsx)(Qs,{name:e.name,legend:e.legend,initial:e.current,items:e.items})}):(0,c.jsx)(v,{label:e.label,hint:e.hint??void 0,variant:e.layout??"wide",children:(0,c.jsx)("div",{className:"k-sopts",children:e.items.map(n=>(0,c.jsxs)("label",{className:"k-sopt",children:[(0,c.jsx)("input",{type:"checkbox",name:e.name,value:n.value,defaultChecked:n.checked}),(0,c.jsxs)("span",{children:[(0,c.jsx)("b",{children:n.label}),n.sub?(0,c.jsxs)("span",{className:"k-note",children:[" ",n.sub]}):null]})]},n.value))})})}function hn(e){return Ls.find(n=>n.id===e)}var Ze=e=>(e??"").replace(/\s+/g," ").trim(),pn=e=>{let n=Ze(e);return n===""?n:`${n.charAt(0).toUpperCase()}${n.slice(1)}${/[.!?]$/.test(n)?"":"."}`},ds=e=>`${pn(e)} Your edits are still here.`;function qs(e){let n=new Map;for(let[t,a]of e)n.set(t,[...n.get(t)??[],a]);return n}function cs(e,n,t=null){let a;try{a=t?new FormData(e,t):new FormData(e)}catch{a=new FormData(e)}let i=[];return a.forEach((g,d)=>{d!==n&&typeof g=="string"&&i.push([d,g])}),i}function un(e,n){let t=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements")?.get?.call(e),a=[];for(let i of Array.from(t??[]))!i.name||i.type==="hidden"||i.type==="submit"||i.type==="button"||i.name===n||a.includes(i.name)||a.push(i.name);return a}function mn(e){try{let n=new DOMParser().parseFromString(e,"text/html").querySelector(".k-notice[role=alert] span, .problem, .k-notice[role=alert], [role=alert]"),t=Ze(n?.textContent);return t===""?null:t.slice(0,400)}catch{return null}}function S({form:e,children:n}){let t=Is(),[a,i]=(0,ce.useState)(""),[g,d]=(0,ce.useState)(!1),[p,k]=(0,ce.useState)(!1),[w,P]=(0,ce.useState)(e.problem??null),[M,Q]=(0,ce.useState)(()=>!!(e.id&&Ms(t).get("unconfirmed")===e.id)),[j,f]=(0,ce.useState)(!1),[E,L]=(0,ce.useState)(null),R=(0,ce.useRef)(null),se=(0,ce.useRef)(null),de=(0,ce.useRef)(!1),x=(0,ce.useRef)(!1),J=(0,ce.useRef)(!1),b=(0,ce.useContext)(Os),U=(0,ce.useContext)(ks),T=(0,ce.useContext)(ws),Y=(0,ce.useContext)(ys),O=e.proof?hn(e.proof):void 0,F=e.save===void 0?{label:"Save",variant:"primary"}:e.save,y=e.id,W=O?.field??null;if((0,ce.useEffect)(()=>{P(e.problem??null)},[e.problem]),(0,ce.useEffect)(()=>{f(!0);let $=R.current;if(!$)return;se.current=qs(cs($,W)),y&&new URLSearchParams(window.location.search).get("unconfirmed")===y&&Q(!0);let I=()=>{J.current=!1,x.current=!1,k(!1)};return window.addEventListener("pageshow",I),()=>window.removeEventListener("pageshow",I)},[y,W]),(0,ce.useEffect)(()=>{if(!e.gate||!g)return;let $=I=>{J.current||I.preventDefault()};return window.addEventListener("beforeunload",$),()=>window.removeEventListener("beforeunload",$)},[e.gate,g]),!e.proof||!O)return(0,c.jsxs)(K,{action:e.action,id:y,hiddenFields:e.hidden,children:[e.fields.map(($,I)=>(0,c.jsx)(gs,{field:$},I)),n,e.note?(0,c.jsx)(h,{children:e.note}):null,F||e.extraButtons&&e.extraButtons.length>0?(0,c.jsxs)(A,{children:[F?(0,c.jsx)(C,{type:"submit",...F.variant?{variant:F.variant}:{},...F.sm?{sm:F.sm}:{},label:F.label}):null,e.extraButtons?.map(($,I)=>(0,c.jsx)(C,{type:"submit",formAction:$.formaction,...$.variant?{variant:$.variant}:{},...$.sm?{sm:$.sm}:{},label:$.label},I))]}):null]});let Z=()=>{let $=R.current;if(!$||!e.gate||!se.current)return;let I=qs(cs($,W)),ae=un($,W).some(pe=>JSON.stringify(se.current.get(pe)??[])!==JSON.stringify(I.get(pe)??[]));d(ae)},we=$=>{if(!e.proofWhen)return!0;let[I,ae]=e.proofWhen;return $.some(([pe,be])=>pe===I&&be===ae)},fe=()=>O.field===null||O.proof==="none"||Ns(O,U)||O.proof==="step-up"&&b?!1:Y!==void 0?!0:!$s(O)&&T!==void 0?!T.fresh:!0,Se=()=>{let $=new URL(window.location.href);for(let ae of["said","problem","unconfirmed"])$.searchParams.delete(ae);y&&$.searchParams.set("unconfirmed",y);let I=R.current?.closest("section[id]")?.id;return`${$.pathname}${$.search}${I?`#${I}`:""}`},Ie=$=>{let I=R.current;if(I){e.download||(J.current=!0),de.current=!0;try{$ instanceof HTMLButtonElement&&$.form===I?I.requestSubmit($):I.requestSubmit()}finally{de.current=!1}e.download&&(J.current=!1,x.current=!1,k(!1),i(""))}},Ee=async($,I,ae)=>{let pe=R.current;if(!pe)return;k(!0);let be=cn(pe,ae),ve=new URLSearchParams;for(let[ts,dn]of[...$,...I])ve.append(ts,dn);let D;try{D=await fetch(be,{method:"POST",body:ve,credentials:"same-origin",redirect:"follow",headers:We({accept:"text/html"})})}catch{J.current=!0,window.location.assign(y?Se():window.location.href);return}let oe=new URL(D.url||be,window.location.href);if(oe.origin!==window.location.origin||oe.pathname==="/login"){J.current=!0,window.location.assign(y?Se():window.location.href);return}let Ke=oe.searchParams.get("problem");if(Ke){x.current=!1,k(!1),i(""),P(ds(Ke));return}if(!D.redirected&&D.status>=400&&D.status<500){let ts=mn(await D.text().catch(()=>""));x.current=!1,k(!1),i(""),P(ds(ts??`Toolroll refused this (${D.status}). Nothing changed`));return}if(!D.ok){J.current=!0,window.location.assign(y?Se():window.location.href);return}let ns=oe.pathname===window.location.pathname,Ue=pe.closest("section[id]")?.id;J.current=!0;let vs=`${oe.pathname}${oe.search}${ns&&Ue?`#${Ue}`:""}`;D.redirected&&`${oe.pathname}${oe.search}`!=`${window.location.pathname}${window.location.search}`?window.location.assign(vs):(D.redirected&&window.history.replaceState(window.history.state,"",vs),window.location.reload())},Fe=($,I,ae)=>{x.current=!0;let pe=R.current;if(e.native||e.download){if(e.download||k(!0),pe?.hasAttribute("data-k-prepare")){let be=!1,ve=D=>{be||(be=!0,D===null?Ie(ae):(x.current=!1,k(!1),i(""),P(ds(D))))};pe.dispatchEvent(new CustomEvent("k-prepare",{detail:{done:ve}}));return}Ie(ae);return}Ee($,I,ae)},V=($,I)=>{if(P(null),Q(!1),I instanceof HTMLButtonElement&&I.hasAttribute("formaction")){Fe($,[],I);return}if(we($)&&fe()){let ae=I??R.current?.querySelector("[data-k-save]")??null;x.current=!0,L({kind:"proof",snapshot:$,submitter:I,trigger:ae});return}Fe($,O.field?[[O.field,""]]:[],I)},He=$=>{if(de.current||($.preventDefault(),x.current))return;let I=R.current;if(!I)return;let ae=$.nativeEvent.submitter??null;if(e.gate&&!g&&!(ae instanceof HTMLButtonElement&&ae.hasAttribute("formaction")))return;let pe=cs(I,W,ae);if(!e.download){let be=Array.from(document.querySelectorAll("form.k-sform[data-k-gate][data-dirty]")).filter(ve=>ve!==I).map(ve=>Ze(ve.closest("section")?.querySelector("h2, h3")?.childNodes[0]?.textContent)||"another section");if(be.length>0){let ve=[...new Set(be)],D=ae??I.querySelector("[data-k-save]")??null;x.current=!0,L({kind:"discard",snapshot:pe,submitter:ae,trigger:D,others:ve});return}}V(pe,ae)},Be=()=>{if(!E||E.kind!=="proof")return;let $=document.getElementById(`${y||"k-sform"}-pop`)?.querySelector('input[type="password"]');if($&&$.value===""){$.setCustomValidity("Enter your password."),$.reportValidity(),$.focus();return}let{snapshot:I,submitter:ae}=E;L(null),Fe(I,O.field?[[O.field,a]]:[],ae)},r=F?F.label:"Save",me=`${y||"k-sform"}-pop`;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(K,{ref:R,action:e.action,id:y,className:"k-sform",hiddenFields:e.hidden,"data-k-sform":e.proof,"data-k-gate":e.gate?"1":void 0,"data-dirty":e.gate&&g?"":void 0,"data-k-native":e.native?"1":void 0,"data-k-download":e.download?"1":void 0,"data-k-proof-when":e.proofWhen?`${e.proofWhen[0]}=${e.proofWhen[1]}`:void 0,"data-k-confirm":e.confirm,onInput:()=>{P(null),Z()},onChange:()=>{P(null),Z()},onSubmit:He,children:[e.fields.map(($,I)=>(0,c.jsx)(gs,{field:$},I)),n,(0,c.jsx)("div",{className:"k-sproof","data-k-proof":"",children:(0,c.jsx)(ye,{proof:e.proof,value:a,onChange:i,optional:e.proofWhen!==void 0,askedElsewhere:j,...y?{id:`${y}-proof`}:{}})}),e.note?(0,c.jsx)(h,{children:e.note}):null,(0,c.jsxs)("div",{className:"k-ssave",children:[(0,c.jsx)("span",{className:"k-ssave-said","aria-live":"polite",children:e.said??""}),F?(0,c.jsx)(C,{type:"submit",...F.variant?{variant:F.variant}:{},...F.sm?{sm:F.sm}:{},busy:p?"Saving…":!1,"data-k-save":"",label:F.label}):null,e.extraButtons?.map(($,I)=>(0,c.jsx)(C,{type:"submit",formAction:$.formaction,...$.variant?{variant:$.variant}:{},...$.sm?{sm:$.sm}:{},label:$.label},I))]}),(0,c.jsx)("div",{className:"k-ssave-err",id:y?`${y}-err`:void 0,children:w?(0,c.jsx)("p",{className:"k-notice",role:"alert",children:(0,c.jsx)("span",{children:w})}):M?(0,c.jsx)("p",{className:"k-notice info",role:"status",children:"Couldn’t confirm whether this saved. This page shows what is stored now; check it before saving again."}):null})]}),E?.kind==="discard"?(0,c.jsxs)(ls,{id:`${y||"k-sform"}-discard`,kind:"popover",title:"Unsaved changes",trigger:E.trigger,onClose:()=>{x.current=!1,L(null)},children:[(0,c.jsxs)("p",{children:["You have unsaved changes in"," ",E.others&&E.others.length>1?`${E.others.slice(0,-1).join(", ")} and ${E.others.at(-1)}`:E.others?.[0],". Saving this will discard them."]}),(0,c.jsxs)(A,{children:[(0,c.jsx)(C,{variant:"primary","data-k-discard":"",label:"Save this anyway",onClick:()=>{let{snapshot:$,submitter:I}=E;x.current=!1,L(null),V($,I)}}),(0,c.jsx)(C,{variant:"ghost","data-k-close":"",label:"Cancel"})]})]}):null,E?.kind==="proof"?(0,c.jsxs)(ls,{id:me,kind:"popover",title:"Confirm with your password",trigger:E.trigger,onClose:()=>{x.current=!1,i(""),L(null)},children:[(0,c.jsx)("p",{className:"k-pop-terms",children:Ze(e.confirm)||O.action}),(0,c.jsx)("div",{className:"k-sproof",onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),Be())},children:(0,c.jsx)(ye,{proof:e.proof,value:a,onChange:i,autoFocus:!0,id:`${y||"k-sform"}-pop-proof`})}),(0,c.jsxs)(A,{children:[(0,c.jsx)(C,{variant:"primary","data-k-sconfirm":"",label:r,onClick:Be}),(0,c.jsx)(C,{variant:"ghost","data-k-close":"",label:"Cancel"})]})]}):null]})}function js({items:e}){return(0,c.jsx)(c.Fragment,{children:e.map((n,t)=>n.type==="note"?(0,c.jsxs)(h,{children:[n.text,n.code?(0,c.jsxs)(c.Fragment,{children:[" ",(0,c.jsx)(_,{children:n.code})]}):null,n.suffix?` ${n.suffix}`:null]},t):n.type==="notice"?(0,c.jsx)(X,{children:n.text},t):n.type==="info"?(0,c.jsx)(Le,{children:n.text},t):n.type==="paragraph"?(0,c.jsx)("p",{className:n.mono?"k-mono":void 0,children:n.parts?n.parts.map((a,i)=>a.bold?(0,c.jsx)("strong",{children:a.text},i):a.text):n.text},t):n.type==="links"?(0,c.jsx)("div",{className:"k-slinks",children:n.links.map(a=>(0,c.jsxs)("a",{className:"k-slink",href:a.href,children:[(0,c.jsxs)("span",{className:"k-slink-body",children:[(0,c.jsx)("span",{className:"k-slink-t",children:a.label}),a.sub?(0,c.jsx)("span",{className:"k-slink-s",children:a.sub}):null]}),(0,c.jsx)("span",{className:"k-slink-arr",children:"›"})]},a.href))},t):n.type==="facts"?(0,c.jsx)(xe,{rows:n.rows.map(a=>[a.label,a.mono?(0,c.jsx)(_,{children:a.value}):a.value])},t):n.type==="records"?n.records.length===0?n.emptyText?(0,c.jsx)(h,{children:n.emptyText},t):null:(0,c.jsx)("div",{className:"k-srecs",children:n.records.map((a,i)=>(0,c.jsx)(B,{...a.backupState?{"data-backup-state":a.backupState}:{},title:(0,c.jsxs)(c.Fragment,{children:[a.mono?(0,c.jsx)("span",{className:"k-mono",children:a.title}):a.title," ",a.badge?(0,c.jsx)(ne,{word:a.badge,tone:a.badgeTone==="ok"?"done":a.badgeTone==="bad"?"failed":""}):null]}),sub:a.sub,when:a.when,action:(0,c.jsxs)(c.Fragment,{children:[a.links?.map(g=>(0,c.jsx)(z,{href:g.href,variant:g.variant==="danger"?"outline":g.variant??"outline",sm:!0,label:g.label},g.href)),a.form?(0,c.jsx)(S,{form:a.form}):null]})},i))},t):n.type==="form"?(0,c.jsx)(S,{form:n.form},t):n.type==="disclose"?(0,c.jsx)(q,{summary:n.label,...n.open!==void 0?{open:n.open}:{},children:(0,c.jsx)(js,{items:n.items})},t):n.type==="actions"?(0,c.jsx)(A,{children:n.actions.map((a,i)=>a.href?(0,c.jsx)(z,{href:a.href,variant:a.variant==="danger"?"outline":a.variant??"outline",...a.sm!==void 0?{sm:a.sm}:{},label:a.label},i):a.form?(0,c.jsx)(S,{form:a.form},i):null)},t):n.type==="bullets"?(0,c.jsxs)("div",{children:[n.title?(0,c.jsx)("p",{className:"k-note",children:(0,c.jsx)("strong",{children:n.title})}):null,(0,c.jsx)("ul",{children:n.items.map((a,i)=>(0,c.jsx)("li",{children:a},i))})]},t):n.type==="code-line"?(0,c.jsx)(v,{label:n.label,hint:n.hint,variant:"wide",children:(0,c.jsx)("code",{className:"k-scode",children:n.code})},t):(0,c.jsxs)("div",{children:[n.title?(0,c.jsx)("p",{className:"k-note",children:n.title}):null,(0,c.jsx)("pre",{className:"k-mono",children:n.code})]},t))})}function gn({section:e,asked:n=!1}){return(0,c.jsx)(u,{id:e.id,title:e.title,state:e.state,lead:e.lead,tabIndex:n?-1:void 0,right:e.right===void 0?void 0:(0,c.jsx)("span",{id:e.right.id,children:(0,c.jsx)(js,{items:e.right.items})}),children:(0,c.jsx)(js,{items:e.items})})}var m=ue(Te(),1);function xs(e){return e?"Can manage and approve":"Can view"}function jn({view:e}){return(0,m.jsxs)(H,{group:"access",title:"People",lead:"Who can see and approve work in this Toolroll.",back:"/settings/access",children:[(0,m.jsx)(he,{said:e.said,problem:e.problem}),(0,m.jsx)(u,{id:"people",title:"People",state:` · ${e.people.filter(n=>n.revoked===null).length}`,children:(0,m.jsx)("div",{className:"k-srecs",children:e.people.map((n,t)=>{let a=`person-${t}`,i={id:`${a}-access`,proof:"people-projects",action:"/people/projects",gate:!0,hidden:{name:n.name},save:{label:"Save access"},confirm:`Change ${n.name}’s projects`,note:"Changing access signs this person out and ends their sessions and modes. Work they approved stays recorded.",fields:[{kind:"select",name:"access",label:"Projects",hint:"With all projects, someone who can manage and approve also manages this Toolroll.",current:n.projects===null?"all":"selected",items:[["selected","Only the projects ticked below"],["all","All projects"]]},...e.projects.length===0?[{kind:"note",text:"Add a project before giving access to some projects only."}]:[{kind:"checkboxes",name:"projects",label:"Projects",items:e.projects.map(k=>({value:k.repo,label:k.name,checked:n.projects!==null&&n.projects.includes(k.repo)}))}]]},g=n.you?null:{id:`${a}-remove`,proof:"people-close",action:"/people/revoke",hidden:{name:n.name},save:{label:`Remove ${n.name}`,variant:"danger"},confirm:`Remove ${n.name}’s sign-in`,note:"Ends their access and everything it signed. History stays.",fields:[]},d=n.threadSignIn?{id:`${a}-thread-sign-in`,proof:"flexible-sign-in-clear",action:"/settings/flexible-sign-in-clear",hidden:{person:n.name},save:{label:"Remove their Claude sign-in for threads",variant:"outline"},confirm:`Remove ${n.name}’s Claude sign-in for threads`,note:"Their threads can't reach Claude until they add one again. Toolroll never shows or sets anyone's sign-in.",fields:[]}:null,p=e.operator&&n.revoked===null;return(0,m.jsx)(B,{"data-person":n.name,title:(0,m.jsxs)(m.Fragment,{children:[n.name,n.you?(0,m.jsx)("span",{className:"k-muted",children:" (you)"}):null," ",n.revoked!==null?(0,m.jsx)(ne,{word:"Removed"}):null]}),sub:n.revoked??`${xs(n.approver)} · ${n.projectNames}`,when:n.seen,action:(0,m.jsx)(z,{href:n.activity,variant:"ghost",sm:!0,label:"Activity"}),children:p||e.operator?(0,m.jsxs)(q,{summary:`Edit ${n.name}`,children:[(0,m.jsx)(h,{children:n.acts.length===0?"No recorded acts yet.":`Recent: ${n.acts.slice(0,3).join(" · ")}`}),p?(0,m.jsx)(S,{form:i}):null,p&&g?(0,m.jsx)(S,{form:g}):null,p&&d?(0,m.jsx)(S,{form:d}):null]}):null},n.name)})})}),e.operator?(0,m.jsxs)(u,{id:"invites",title:"Invites",children:[e.invites.length===0?(0,m.jsx)(h,{children:"No open invites."}):(0,m.jsx)("div",{className:"k-srecs",children:e.invites.map(n=>(0,m.jsx)(B,{title:xs(n.role==="approver"),sub:`${n.projects} · from ${n.from}${n.attempts>0?` · ${n.attempts} failed attempt${n.attempts===1?"":"s"}`:""}`,when:`Expires ${n.expires}`,action:(0,m.jsx)(S,{form:{id:`invite-${n.id}-cancel`,proof:"people-close",action:"/people/invite-revoke",hidden:{id:String(n.id)},save:{label:"Cancel invite",variant:"outline",sm:!0},confirm:"Cancel this invite",fields:[]}})},n.id))}),(0,m.jsx)(q,{summary:"Invite someone",open:e.invites.length===0,children:(0,m.jsx)(S,{form:{id:"invite-form",proof:"people-invite",action:"/people/invite",native:!0,save:{label:"Create invite link"},confirm:"Invite someone",note:"The link works once, for one person, and expires in 72 hours. An invite creates a new way in, so it always asks for your password.",fields:[{kind:"radios",name:"role",legend:"They can",current:"viewer",items:[{value:"viewer",label:"Can view",text:"Read work in their projects."},{value:"approver",label:"Can manage and approve",text:"Create, manage and approve work in their projects."}]},{kind:"select",name:"access",label:"Projects",hint:"With all projects, someone who can manage and approve also manages this Toolroll.",current:e.openProject===null?"all":"selected",items:[["selected","Only the projects ticked below"],["all","All projects"]]},...e.projects.length===0?[{kind:"note",text:"Add a project before giving access to some projects only."}]:[{kind:"checkboxes",name:"projects",label:"Projects",items:e.projects.map(n=>({value:n.repo,label:n.name,checked:e.openProject===n.repo}))}]]}})})]}):null,e.filers.length>0?(0,m.jsxs)(u,{id:"agent-filers",title:"Agent filers",lead:"Agents that can propose tasks. You approve what runs.",children:[(0,m.jsx)("div",{className:"k-srecs",children:e.filers.map(n=>(0,m.jsx)(B,{title:(0,m.jsx)("span",{className:"k-mono",children:n.name}),sub:n.words},n.name))}),(0,m.jsxs)(h,{children:["To revoke one, run ",(0,m.jsx)(_,{children:"toolroll coordinator revoke <cid> --as you"})," on this computer."]})]}):null]})}function xn({ownAccess:e}){return(0,m.jsx)(H,{group:"access",title:"Your access",sub:!0,back:"/settings/access",children:(0,m.jsxs)(u,{id:"your-access",title:`${e.name} · ${xs(e.approver)}`,lead:e.approver?"You can create, manage and approve work in these projects.":"You can read work in these projects.",children:[(0,m.jsx)("div",{className:"k-srecs",children:e.projects.map(n=>(0,m.jsx)(B,{title:n},n))}),(0,m.jsx)(h,{children:"An instance operator manages invites and project access."}),(0,m.jsx)(A,{children:(0,m.jsx)(z,{href:e.activity,sm:!0,label:"Your activity"})})]})})}function fn({audit:e}){return(0,m.jsxs)(H,{group:"access",title:e.name,lead:"API tokens and remote activity",sub:!0,back:e.backHref,children:[(0,m.jsx)(u,{id:"person-tokens",title:`API tokens (${e.tokens.length})`,children:e.tokens.length===0?(0,m.jsx)(h,{children:"No API tokens."}):(0,m.jsx)("div",{className:"k-srecs",children:e.tokens.map(n=>(0,m.jsx)(B,{title:(0,m.jsxs)(m.Fragment,{children:[n.name," ",n.revoked?(0,m.jsx)(ne,{word:"Revoked",tone:"failed"}):(0,m.jsx)(ne,{word:n.access})]}),sub:`Expires ${n.expires}${n.revoked?` · ${n.revoked}`:""}`,action:(0,m.jsx)(z,{href:`/people?person=${encodeURIComponent(e.name)}&token-name=${encodeURIComponent(n.name)}`,variant:"ghost",sm:!0,label:"Filter activity"})},n.id))})}),(0,m.jsxs)(u,{id:"person-events",title:"Remote activity",lead:e.tokenFilter?`Filtered by token: ${e.tokenFilter}`:void 0,children:[e.events.length===0?(0,m.jsx)(h,{children:"No remote actions recorded."}):(0,m.jsx)("div",{className:"k-srecs",children:e.events.map((n,t)=>(0,m.jsx)(B,{title:(0,m.jsxs)(m.Fragment,{children:[n.action," ",(0,m.jsx)(ne,{word:n.outcome,tone:n.outcome==="ok"?"done":n.outcome==="refused"||n.outcome==="error"?"failed":""})]}),sub:`${n.detail}${n.project?` · ${n.project}`:""}`,when:n.at},t))}),e.nextCursor?(0,m.jsx)(A,{children:(0,m.jsx)(z,{href:`/people?person=${encodeURIComponent(e.name)}${e.tokenFilter?`&token-name=${encodeURIComponent(e.tokenFilter)}`:""}&before=${encodeURIComponent(e.nextCursor)}`,variant:"outline",sm:!0,label:"Older activity"})}):null]})]})}function bn({view:e}){return e.mode==="own-access"&&e.ownAccess?(0,m.jsx)(xn,{ownAccess:e.ownAccess}):e.mode==="person-audit"&&e.audit?(0,m.jsx)(fn,{audit:e.audit}):e.list?(0,m.jsx)(jn,{view:e.list}):(0,m.jsx)(H,{group:"access",title:"People",children:(0,m.jsx)(h,{children:"No people data."})})}function vn({data:e,said:n,problem:t}){let a=(i,g,d="outline")=>(0,m.jsx)(S,{form:{action:"/settings/sessions",hidden:{...i,...e.everyone?{everyone:"1"}:{}},save:{label:g,variant:d,sm:!0},fields:[]}});return(0,m.jsxs)(H,{group:"access",title:"Sessions and tokens",sub:!0,back:"/settings/access",children:[(0,m.jsx)(he,{said:n,problem:t}),(0,m.jsxs)(u,{id:"signed-in",title:(0,m.jsxs)(m.Fragment,{children:["Signed in",e.canSeeEveryone?(0,m.jsxs)(m.Fragment,{children:[" ",(0,m.jsx)(z,{href:e.everyone?"/settings/sessions":"/settings/sessions?everyone=1",variant:"ghost",sm:!0,label:e.everyone?"Show only mine":"Show everyone’s"})]}):null]}),children:[e.sessions.length===0?(0,m.jsx)(h,{children:"No one else is signed in."}):e.sessions.map(i=>(0,m.jsx)(B,{"data-session":i.idShort,title:(0,m.jsxs)(m.Fragment,{children:[e.everyone?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("b",{children:i.account})," · "]}):null,i.device,i.here?(0,m.jsxs)(m.Fragment,{children:[" ",(0,m.jsx)(ne,{word:"This browser"})]}):null]}),sub:i.sub,when:i.when,action:i.here?void 0:a({action:"end-session",session:i.idHash},"Sign out")},i.idHash)),e.others>0&&!e.everyone?(0,m.jsx)(A,{children:a({action:"end-others"},`Sign out everywhere else (${e.others})`)}):null]}),(0,m.jsxs)(u,{id:"api-tokens",title:"API tokens",lead:(0,m.jsxs)(m.Fragment,{children:["For scripts and CI: send ",(0,m.jsx)(_,{children:"Authorization: Bearer <token>"}),". A token can’t approve anything."]}),children:[e.tokens.length===0?(0,m.jsx)(h,{children:"No API tokens."}):e.tokens.map(i=>(0,m.jsx)(B,{"data-token":i.id,title:(0,m.jsxs)(m.Fragment,{children:[e.everyone?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("b",{children:i.account})," · "]}):null,i.name]}),sub:i.sub,when:i.when,action:a({action:"revoke-token",token:i.id},"Revoke","danger")},i.id)),e.everyone?null:(0,m.jsx)(q,{summary:"New API token",open:e.tokens.length===0,children:(0,m.jsxs)(S,{form:{id:"token-form",proof:"sessions-token",action:"/settings/sessions",native:!0,hidden:{action:"create-token"},save:{label:"Make the token"},confirm:"Make an API token",fields:[]},children:[(0,m.jsx)(v,{label:"Name",hint:"So you can tell it apart later.",children:(0,m.jsx)(le,{id:"token-name",name:"name",maxLength:60,required:!0,placeholder:"for example: CI",autoComplete:"off"})}),(0,m.jsx)(v,{label:"It can",children:(0,m.jsx)(ge,{id:"token-access",name:"access","aria-label":"It can",defaultValue:"read",items:[["read","Read (tasks, results, the ledger)"],["act","Act as you (file and manage work; never approve)"]]})}),(0,m.jsx)(v,{label:"Expires in",children:(0,m.jsx)(ge,{id:"token-days",name:"days","aria-label":"Expires in",defaultValue:"90",items:e.daysChoices.map(i=>[String(i),`${i} days`])})}),(0,m.jsx)(h,{children:"Making a token is a new way in, so it always asks for your password. The token is shown once, on the next page."})]})})]}),e.requestLimits?(0,m.jsxs)(u,{id:"request-limits",title:"Request limits",lead:"How many requests each API token may make. A token over its limit is refused until the minute or day resets, and nothing it asked for runs.",children:[(0,m.jsx)(S,{form:{id:"limits-everyone",proof:"request-limits",action:"/settings/request-limits",gate:!0,hidden:{target:"*",action:"save"},save:{label:"Save limits"},confirm:"Change request limits for everyone's tokens",fields:[{kind:"input",id:"limits-read",name:"read-per-minute",label:"Read tokens, a minute",hint:`Default ${e.requestLimits.defaults.read.toLocaleString("en-US")}.`,type:"number",value:e.requestLimits.everyone.readPerMinute===null?"":String(e.requestLimits.everyone.readPerMinute),placeholder:String(e.requestLimits.defaults.read),min:1,max:e.requestLimits.maxPerMinute,step:"1"},{kind:"input",id:"limits-act",name:"act-per-minute",label:"Act tokens, a minute",hint:`Default ${e.requestLimits.defaults.act.toLocaleString("en-US")}.`,type:"number",value:e.requestLimits.everyone.actPerMinute===null?"":String(e.requestLimits.everyone.actPerMinute),placeholder:String(e.requestLimits.defaults.act),min:1,max:e.requestLimits.maxPerMinute,step:"1"},{kind:"input",id:"limits-day",name:"per-day",label:"Each token, a day",hint:`Default ${e.requestLimits.defaults.day.toLocaleString("en-US")}.`,type:"number",value:e.requestLimits.everyone.perDay===null?"":String(e.requestLimits.everyone.perDay),placeholder:String(e.requestLimits.defaults.day),min:1,max:e.requestLimits.maxPerDay,step:"1"}]}}),(0,m.jsx)(S,{form:{id:"limits-everyone-clear",proof:"request-limits",action:"/settings/request-limits",hidden:{target:"*",action:"clear"},save:{label:"Use defaults for everyone",variant:"outline"},confirm:"Put everyone's tokens back on the default limits",fields:[]}}),e.requestLimits.liveTokens.length>0?(0,m.jsx)(q,{summary:"Limits for one token",children:(0,m.jsxs)(S,{form:{id:"limits-one",proof:"request-limits",action:"/settings/request-limits",save:{label:"Save limits"},confirm:"Change one token's request limits",fields:[{kind:"select",id:"limits-target",name:"target",label:"Token",current:e.requestLimits.liveTokens[0]?.id??"",layout:"wide",items:e.requestLimits.liveTokens.map(i=>[i.id,i.label])},{kind:"input",id:"limits-one-minute",name:"per-minute",label:"A minute",hint:"Blank uses everyone's.",type:"number",value:"",placeholder:"Everyone's",min:1,max:e.requestLimits.maxPerMinute,step:"1"},{kind:"input",id:"limits-one-day",name:"per-day",label:"A day",hint:"Blank uses everyone's.",type:"number",value:"",placeholder:"Everyone's",min:1,max:e.requestLimits.maxPerDay,step:"1"}]},children:[(0,m.jsx)("input",{type:"hidden",name:"action",value:"save"}),(0,m.jsx)(A,{children:(0,m.jsx)(C,{sm:!0,type:"submit",name:"action",value:"clear",label:"Use everyone's limits"})})]})}):null,(0,m.jsx)(h,{children:"Only an instance operator sees and changes these."})]}):null]})}var fs=ue(Ce(),1);function kn(e){let n=["17:00","18:00","19:00","20:00","21:00","22:00"],t=e===null||n.includes(e)?n:[...n,e].sort();return[["off","Off"],...t.map(a=>[a,`At ${a}`])]}function Xs(e){return e==="strict"?"Strict / release":"Default"}var wn=[["off","Off"],["first","First one"],["all","Up to 4"]],yn=e=>is.find(([,n])=>n===e)?.[0]??"Settings",$n=e=>e==="hub"?"Settings":yn(e);function Zs(e){let n=[];return e.workers!==null&&e.approver&&!e.workers.some(t=>t.tone==="ok")&&n.push({group:"computers",title:e.workers.length===0?"Nothing is taking work":"Nothing is taking work right now",text:"Approved work waits until a computer builds it. Run toolroll up on the computer with your projects.",action:["Start taking work",As]}),e.telegram.failing&&n.push({group:"alerts",title:"Telegram isn’t delivering",text:e.telegram.delivery??"Alerts to your phone are failing.",action:["Open Telegram","/settings/telegram"]}),e.backup?.failed&&n.push({group:"system",title:"The last backup failed",text:e.backup.words,action:["Open backups","/settings/backups"]}),n}function en(e){let n={};for(let t of e)n[t.group]=(n[t.group]??0)+1;return n}var Nn=e=>Object.fromEntries(Object.keys(e).map(n=>[n,!0])),sn=e=>e.hardStop&&e.percent>=90,Ne=e=>e>0&&e<1e4?"<$0.01":`$${(e/1e6).toFixed(e!==0&&Math.abs(e)<1e7?2:0)}`,$e=ue(Ce(),1),ie=ue(Te(),1),hs=500;function nn({projects:e=[],initialDirections:n}){let t=(0,$e.useContext)(Cs),[a,i]=(0,$e.useState)(()=>n?[...n]:[]),[g,d]=(0,$e.useState)(n===void 0),[p,k]=(0,$e.useState)(null),[w,P]=(0,$e.useState)(!1),[M,Q]=(0,$e.useState)("global"),[j,f]=(0,$e.useState)(""),[E,L]=(0,$e.useState)(null),[R,se]=(0,$e.useState)(null),de=(0,$e.useCallback)(async()=>{d(!0);try{let T=await fetch("/api/directions",{method:"GET",credentials:"same-origin",headers:{accept:"application/json"}});if(!T.ok){L("Could not load standing directions.");return}let Y=await T.json();i(Array.isArray(Y.directions)?Y.directions:[]),L(null)}catch{L("Could not load standing directions.")}finally{d(!1)}},[]);(0,$e.useEffect)(()=>{n===void 0&&typeof window<"u"&&de()},[n,de]);let x=async T=>{T.preventDefault();let Y=j.trim();if(!(Y===""||Y.length>hs)){P(!0),L(null),se(null);try{let O=await fetch("/api/directions",{method:"POST",credentials:"same-origin",headers:We({"content-type":"application/json",accept:"application/json",...t?{"x-csrf-token":t}:{}}),body:JSON.stringify({scope:M,text:Y,...t?{csrf:t}:{}})}),F=await O.json().catch(()=>({}));if(!O.ok||!F.direction){L(F.error??"Could not save standing direction.");return}i(y=>[...y,F.direction]),f(""),se("Standing direction saved.")}catch{L("Could not save standing direction.")}finally{P(!1)}}},J=async T=>{k(T.id),L(null),se(null);try{let Y=await fetch(`/api/directions/${encodeURIComponent(T.id)}`,{method:"PATCH",credentials:"same-origin",headers:We({"content-type":"application/json",accept:"application/json",...t?{"x-csrf-token":t}:{}}),body:JSON.stringify({enabled:!T.enabled,...t?{csrf:t}:{}})}),O=await Y.json().catch(()=>({}));if(!Y.ok||!O.direction){L(O.error??"Could not update standing direction.");return}i(F=>F.map(y=>y.id===T.id?O.direction:y))}catch{L("Could not update standing direction.")}finally{k(null)}},b=async T=>{k(T.id),L(null),se(null);try{let Y=await fetch(`/api/directions/${encodeURIComponent(T.id)}`,{method:"DELETE",credentials:"same-origin",headers:We({"content-type":"application/json",accept:"application/json",...t?{"x-csrf-token":t}:{}}),body:JSON.stringify(t?{csrf:t}:{})});if(!Y.ok){let O=await Y.json().catch(()=>({}));L(O.error??"Could not delete standing direction.");return}i(O=>O.filter(F=>F.id!==T.id))}catch{L("Could not delete standing direction.")}finally{k(null)}},U=Array.from(new Set(["global",...e.filter(T=>T.trim()!=="")]));return(0,ie.jsxs)(u,{id:"standing-directions",title:"Standing directions",lead:"Plain-English rules injected whole into Lead chat and every worker build, plan, and review — never truncated or filtered out.",children:[(0,ie.jsx)(he,{said:R,problem:E}),(0,ie.jsxs)("form",{onSubmit:T=>{x(T)},className:"k-form","data-standing-directions-form":"",children:[(0,ie.jsxs)("div",{className:"k-row",children:[(0,ie.jsx)("label",{className:"k-label",htmlFor:"standing-direction-scope",children:"Scope"}),(0,ie.jsx)("select",{id:"standing-direction-scope",className:"k-select",value:M,onChange:T=>Q(T.target.value),disabled:w,children:U.map(T=>(0,ie.jsx)("option",{value:T,children:T==="global"?"Global (all projects)":T},T))})]}),(0,ie.jsxs)("div",{className:"k-row",children:[(0,ie.jsxs)("label",{className:"k-label",htmlFor:"standing-direction-text",children:["Rule (",j.trim().length,"/",hs,")"]}),(0,ie.jsx)("textarea",{id:"standing-direction-text",className:"k-textarea",rows:2,maxLength:hs,placeholder:"e.g. Never push straight to main; follow Toolroll's Signal palette.",value:j,onChange:T=>f(T.target.value),disabled:w})]}),(0,ie.jsx)(A,{children:(0,ie.jsx)(C,{variant:"primary",type:"submit",label:w?"Saving…":"Add direction",disabled:w||j.trim()===""})})]}),g?(0,ie.jsx)(h,{children:"Loading standing directions…"}):a.length===0?(0,ie.jsx)(h,{children:"No standing directions yet. Add one above, or tell Lead “Always remember: …” in chat."}):(0,ie.jsx)("div",{className:"k-srecs","data-standing-directions-list":"",children:a.map(T=>{let Y=p===T.id;return(0,ie.jsx)(B,{"data-direction-id":T.id,title:(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)("span",{children:T.text})," ",(0,ie.jsx)(ne,{word:T.scope==="global"?"Global":T.scope,tone:T.enabled?"done":""})," ",T.enabled?null:(0,ie.jsx)(ne,{word:"Off"})]}),sub:T.source==="lead"?"Saved by Lead":"Saved by you",action:(0,ie.jsxs)(A,{children:[(0,ie.jsx)(C,{sm:!0,variant:"ghost",type:"button",label:T.enabled?"Turn off":"Turn on",disabled:Y,onClick:()=>{J(T)}}),(0,ie.jsx)(C,{sm:!0,variant:"danger",type:"button",label:"Delete",disabled:Y,onClick:()=>{b(T)}})]})},T.id)})})]})}var l=ue(Te(),1),bs=[["telegram","Telegram"],["slack","Slack"],["discord","Discord"],["teams","Teams"]];function Es(e){return e.length>1?`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`:e[0]??""}function qe(e){return e.advanced===void 0||e.advanced.on}function Sn(e){return e.local?.owner===!0&&!e.local.passwordSet}function Cn(e){return e==="light"?"Light":e==="dark"?"Dark":"Match this device"}function Tn(e){let n=e.providers?.find(t=>t.connection!==null&&t.tone==="ok")??e.providers?.find(t=>t.tone==="ok");return n?`${n.name}: ${n.words}`:e.providers===null?"Models, chat and tools":"No agent signed in yet"}function An(e){if(e.workers===null)return"Connect a builder: the computer that does the work";let n=e.workers.filter(t=>t.tone==="ok").length;return n===0?"Nothing is taking work yet":`${De(n,"computer","computers")} taking work`}function Fn(e){let n=e.messaging?.configured??[];if(n.length===0)return"No chat app yet: alerts stay in Toolroll";let t=e.messaging?.channel??(n.length===1?n[0]:null);return[t?`${(a=>bs.find(([i])=>i===a)?.[1]??a)(t)}: alerts go here`:"Several chat apps: choose one",e.telegram.failing?"Telegram is failing":null].filter(Boolean).join(" · ")}function Pn(e){return[e.permission?`New tasks: ${e.permission.mode==="bypassPermissions"?"Full access":"Auto"}`:null,e.quality?`${Xs(e.quality.mode)} quality`:null,"Who approves, and what runs without asking"].filter(Boolean).join(" · ")}function tn(e){return[(e.people===null?null:[e.people.approvers.length?`${Es(e.people.approvers)} can manage and approve`:"",e.people.viewers.length?`${Es(e.people.viewers)} can view`:""].filter(Boolean).join(" · "))||"Who can get in",e.passwordless===null||Sn(e)?null:e.passwordless?"Passwordless on":"Passwordless off"].filter(Boolean).join(" · ")}function Rn(e){let n=e.updates?.latest,t=e.updates===null?e.version===null?null:`Toolroll ${e.version}`:n!==null&&n?.newer?`Toolroll ${e.updates.current} · ${n.version} is available`:`Toolroll ${e.updates.current}`;return[e.backup?.failed?"The last backup failed":null,t,"backups, storage, retention, monitoring"].filter(Boolean).join(" · ")}function te({href:e,title:n,status:t,icon:a,needs:i=0}){return(0,l.jsxs)("a",{className:"k-slink",href:e,children:[a?(0,l.jsx)("span",{className:"k-slink-ico","aria-hidden":"true",children:(0,l.jsx)(Je,{name:a})}):null,(0,l.jsxs)("span",{className:"k-slink-body",children:[(0,l.jsxs)("span",{className:"k-slink-t",children:[n,i>0?(0,l.jsx)("span",{className:"k-count",children:i}):null]}),(0,l.jsx)("span",{className:"k-slink-s",children:t})]}),(0,l.jsx)("span",{className:"k-slink-arr","aria-hidden":"true",children:"›"})]})}function Re({label:e,children:n}){return(0,l.jsx)("nav",{className:"k-slinks","aria-label":e??"Settings links",children:n})}function Us({facts:e,flags:n}){(0,fs.useEffect)(()=>{let d=window.location.hash.slice(1);if(!d)return;let p=decodeURIComponent(d);if(Object.prototype.hasOwnProperty.call(as,p)){let k=as[p];k&&window.location.replace(k)}},[]);let t=Zs(e),a=en(t),i={general:[`Theme: ${Cn(e.theme).toLowerCase()}`,e.version===null?null:`Toolroll ${e.version}`,`advanced features ${qe(e)?"on":"off"}`].filter(Boolean).join(" · "),agents:Tn(e),computers:An(e),alerts:Fn(e),approval:Pn(e),projects:e.projects.length===0?"No projects yet":`${De(e.projects.length,"project","projects")} · network, checks, pull requests and tools for each`,access:tn(e),spend:"Monthly limits and the spend report",system:Rn(e)},g=is.filter(([,d])=>d!=="spend"||e.operator).filter(([,d])=>d!=="system"||e.operator||e.approver).filter(([,d])=>d!=="spend"||qe(e));return(0,l.jsxs)(H,{group:"hub",title:"Settings",flags:n,children:[(0,l.jsx)(he,{said:e.said,problem:e.problem}),(0,l.jsx)(Ts,{items:t.map((d,p)=>({title:d.title,text:d.text,action:(0,l.jsx)(z,{href:d.action[1],variant:p===0?"primary":"outline",label:d.action[0]})}))}),e.local?.owner===!0&&!e.local.passwordSet?(0,l.jsx)(u,{id:"set-password",title:"Let agents work on their own",lead:"Agents can work on their own, merge and release only after you set a password.",children:(0,l.jsx)(A,{children:(0,l.jsx)(z,{href:"/password/set?next=%2Fsettings",sm:!0,label:"Set a password"})})}):null,(0,l.jsx)(Re,{label:"Settings groups",children:g.map(([d,p,k])=>(0,l.jsx)(te,{href:k,title:d,status:i[p]??"",icon:Ps[p],needs:a[p]??0},p))})]})}function In({one:e}){let n=e.tone==="ok"?"done":e.tone==="warn"?"failed":"";return(0,l.jsx)(B,{"data-provider":e.provider,title:(0,l.jsxs)(l.Fragment,{children:[e.name," ",(0,l.jsx)(ne,{word:e.words,tone:n})]}),sub:e.connection===null?e.usage:`${e.connection.words}${e.connection.facts?` · ${e.connection.facts}`:""}`,children:(0,l.jsxs)(q,{summary:`Manage ${e.name}`,children:[(0,l.jsx)(S,{form:{id:`provider-${e.provider}`,proof:"provider-key",action:"/settings/provider-key",gate:!0,hidden:{provider:e.provider},save:{label:`Save ${e.name}`},fields:[...e.subscriptionCapable?[{kind:"select",name:"auth-mode",label:"How it’s paid",hint:`${e.usage} · ${e.envName}`,current:e.mode,items:[["subscription",`${e.name} subscription`],["api-key","API key"]]}]:[{kind:"note",text:`${e.usage} · ${e.envName}`}],{kind:"secret",id:`key-${e.provider}`,name:"value",label:`${e.name} API key`,hint:"Stored privately on this computer and never shown again.",placeholder:e.set?"Paste to replace the stored key":"Paste a key"}],extraButtons:e.connection!==null?[{label:"Check again",formaction:"/settings/connection/check",variant:"ghost",sm:!0}]:void 0}}),e.set?(0,l.jsx)(S,{form:{id:`provider-${e.provider}-clear`,proof:"provider-key-clear",action:"/settings/provider-key-clear",hidden:{provider:e.provider},save:{label:"Remove key",variant:"danger"},note:"Runs that use this API key stop until you add one again.",fields:[]}}):null]})})}function Mn({facts:e,flags:n}){return(0,l.jsxs)(H,{group:"agents",title:"Agents and models",lead:"Which agent does the work, how it’s paid for, and which model plans, builds and reviews.",flags:n,children:[(0,l.jsx)(he,{said:e.said,problem:e.problem}),e.providers!==null?(0,l.jsxs)(u,{id:"providers",title:"How agents are paid for",lead:"A plan first; an API key is used when the agent is set to it, or for agents without a plan. Keys stay on this computer.",children:[(0,l.jsx)("div",{className:"k-srecs",children:e.providers.map(t=>(0,l.jsx)(In,{one:t},t.provider))}),(0,l.jsx)(h,{children:(0,l.jsx)("a",{className:"k-link",href:"/control",children:"Set up a project’s builder"})})]}):null,e.workers!==null?(0,l.jsx)("div",{id:"workers",children:(0,l.jsx)(Re,{label:"Computers",children:(0,l.jsx)(te,{href:"/settings/computers?section=builders",title:"Computers that build",status:"In Settings → Computers"})})}):null,(0,l.jsxs)(Re,{label:"In this group",children:[(0,l.jsx)(te,{href:"/settings/models",title:"Models",status:"Which model plans, builds and reviews"}),(0,l.jsx)(te,{href:"/settings/lead",title:"Chat",status:"The assistant you chat with"}),qe(e)?(0,l.jsx)(te,{href:"/settings/lead/subagents",title:"Subagents",status:"Helpers the lead looks after"}):null,(0,l.jsx)(te,{href:"/settings/tools",title:"Tools",status:"What builds can use, per project"}),(0,l.jsx)(te,{href:"/settings/skills",title:"Plug-ins",status:"Reusable instructions for agents"}),(0,l.jsx)(te,{href:"/settings/knowledge",title:"Knowledge",status:"What agents know about each project"}),qe(e)?(0,l.jsx)(te,{href:"/settings/learning",title:"Learning",status:"Lessons kept from finished work"}):null]}),(0,l.jsx)(nn,{projects:e.projects.map(t=>t.name)})]})}function Ln(e){let[n,t]=(0,fs.useState)("");return(0,fs.useEffect)(()=>{if(!e||!("serviceWorker"in navigator)||!("PushManager"in window))return;let a=document.createElement("link");a.rel="manifest",a.href="/manifest.webmanifest",document.head.appendChild(a),navigator.serviceWorker.register("/sw.js",{scope:"/"}).catch(()=>{});let i=async p=>{try{if(await Notification.requestPermission()!=="granted"){let L="Notifications are blocked for this site in the browser settings.";return t(L),L}let k=await(await fetch("/push/key")).json(),w=await navigator.serviceWorker.ready,P=Uint8Array.from(atob(k.key.replace(/-/g,"+").replace(/_/g,"/")),L=>L.charCodeAt(0)),M=await w.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:P}),Q=M.toJSON(),j=p.querySelector("[name=endpoint]"),f=p.querySelector("[name=p256dh]"),E=p.querySelector("[name=auth]");return j&&(j.value=M.endpoint),f&&(f.value=(Q.keys?.p256dh??"").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")),E&&(E.value=(Q.keys?.auth??"").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")),null}catch{let k="Couldn’t subscribe: the browser said no.";return t(k),k}},g=document.getElementById("push-form");if(!g)return;g.setAttribute("data-k-prepare","");let d=p=>{let k=p;i(g).then(w=>k.detail.done(w))};return g.addEventListener("k-prepare",d),()=>{g.removeEventListener("k-prepare",d),a.remove()}},[e]),n}function On({email:e}){let n=e.google.connected,t=n!==null?`${n}, through Google`:e.set?`From ${e.from} through ${e.host}${e.imapHost===""?"":` · reads ${e.imapHost}`}`:"Not set up";return(0,l.jsx)(u,{id:"email",title:"Email",state:` · ${t}`,lead:"Send email steps send from this account, and Email inbox triggers read it.",children:n!==null?(0,l.jsxs)(K,{action:"/settings/google/disconnect",children:[(0,l.jsxs)(h,{children:["Signed in with Google as ",(0,l.jsx)("b",{children:n}),". Mail is sent and read through it."]}),(0,l.jsxs)(A,{children:[(0,l.jsx)(C,{sm:!0,type:"submit",formAction:"/settings/email-test",label:"Send a test email"}),(0,l.jsx)(C,{sm:!0,type:"submit",formAction:"/settings/email-read-test",label:"Check the inbox"}),(0,l.jsx)(C,{sm:!0,variant:"ghost",type:"submit",label:"Disconnect Google"})]})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(q,{summary:e.set?"Change the mail server":"Set up a mail server",open:!e.set&&e.google.clientId==="",children:[(0,l.jsx)(S,{form:{id:"email-form",proof:"email",action:"/settings/email",gate:!0,save:{label:"Save email"},fields:[{kind:"note",text:"For Gmail: smtp.gmail.com, port 587, your address, and an app password. To read mail too, add imap.gmail.com."},{kind:"input",id:"email-host",name:"host",label:"Mail server",value:e.host,placeholder:"smtp.gmail.com",required:!0},{kind:"input",id:"email-port",name:"port",type:"number",label:"Port",value:String(e.port),min:1,max:65535,required:!0},{kind:"input",id:"email-from",name:"from",type:"email",label:"Send from",value:e.from,placeholder:"you@example.com",required:!0},{kind:"input",id:"email-user",name:"user",label:"Username",hint:"Usually the same address.",value:e.user},{kind:"secret",id:"email-password",name:"password",label:"Mail server password",hint:e.set?"Leave empty to keep the saved one.":"An app password."},{kind:"switch",id:"email-secure",name:"secure",label:"Use SSL from the start",hint:"Port 465.",switchLabel:"SSL",on:e.secure},{kind:"input",id:"email-imap",name:"imapHost",label:"Read mail from",hint:"Optional.",value:e.imapHost,placeholder:"imap.gmail.com"},{kind:"input",id:"email-imap-port",name:"imapPort",type:"number",label:"Reading port",value:String(e.imapPort),min:1,max:65535}]}}),e.set?(0,l.jsx)(K,{action:"/settings/email-test",children:(0,l.jsxs)(A,{children:[(0,l.jsx)(C,{sm:!0,type:"submit",label:"Send a test email"}),e.imapHost!==""?(0,l.jsx)(C,{sm:!0,type:"submit",formAction:"/settings/email-read-test",label:"Check the inbox"}):null]})}):null]}),(0,l.jsxs)(q,{summary:"Or sign in with a Google account",open:e.google.clientId!==""&&!e.set,children:[(0,l.jsxs)("ol",{className:"k-note",children:[(0,l.jsx)("li",{children:"In Google Cloud Console, make an OAuth client of type Web application, and set the consent screen to In production (while it’s in Testing, Google ends the connection after 7 days)."}),e.google.redirect===null?(0,l.jsx)("li",{children:"Open these settings on this computer (localhost) or at your https address to see the redirect address to add."}):(0,l.jsxs)("li",{children:["Add this as an authorized redirect address:"," ",(0,l.jsx)(_,{"data-google-redirect":"",children:e.google.redirect})]}),(0,l.jsx)("li",{children:"Paste the client ID and secret here, then connect. Google warns that it hasn’t verified the app: it’s your own, so continue."})]}),(0,l.jsx)(S,{form:{id:"google-form",proof:"google",action:"/settings/google",native:!0,save:{label:"Connect Google"},fields:[{kind:"input",id:"google-id",name:"clientId",label:"Client ID",value:e.google.clientId,placeholder:"….apps.googleusercontent.com",required:!0},{kind:"secret",id:"google-secret",name:"clientSecret",label:"Client secret",hint:e.google.clientId!==""?"Leave empty to keep the saved one.":null}]}})]})]})})}function qn({facts:e,flags:n}){let t=Ln(e.push?.available===!0),a=e.messaging?.configured??[],i=e.messaging?.channel??(a.length===1?a[0]:null),g=d=>bs.find(([p])=>p===d)?.[1]??d;return(0,l.jsxs)(H,{group:"alerts",title:"Chat apps and alerts",lead:"What reaches you, where, and how.",flags:n,children:[(0,l.jsx)(he,{said:e.said,problem:e.problem}),e.messaging?.legacyWarning?(0,l.jsxs)(h,{children:["Legacy webhooks are deprecated. Connect"," ",(0,l.jsx)("a",{className:"k-link",href:"/settings/slack",children:"Slack"})," ","or"," ",(0,l.jsx)("a",{className:"k-link",href:"/settings/discord",children:"Discord"})," ","instead."]}):null,(0,l.jsx)(u,{id:"chat-apps",title:"Chat apps",lead:"Get alerts on your phone and answer from it. Each app has its own steps.",children:(0,l.jsx)(Re,{label:"Chat apps",children:bs.map(([d,p])=>(0,l.jsx)(te,{href:`/settings/${d}`,title:p,needs:d==="telegram"&&e.telegram.failing?1:0,status:e.messaging===null?"Set up":a.includes(d)?d==="telegram"&&e.telegram.failing?"Has a problem":i===d&&!e.messaging.implicit?"Alerts go here":"Connected":"Not set up"},d))})}),e.chat!==null?(0,l.jsxs)(u,{id:"notifications",title:"What reaches you",children:[(0,l.jsx)(S,{form:{id:"reach-form",proof:"notifications",action:"/settings/notifications",gate:!0,fields:[{kind:"radios",name:"mode",legend:"Chat messages",current:e.chat.mode,items:[{value:"quiet",label:"Only when I’m needed",text:"One message per task, updated as it moves."},{value:"all",label:"Every step",text:"A new message for each update."}]},{kind:"select",name:"digest",label:"Evening digest",hint:"One message: what finished, what waits, what failed.",current:e.chat.digestAt??"off",items:kn(e.chat.digestAt)},{kind:"select",name:"screenshots",label:"Screenshots with results",current:e.chat.screenshots??"off",items:wn}]}}),e.chat.projects&&e.chat.projects.length>0?(0,l.jsxs)(l.Fragment,{children:[e.chat.projects.map(d=>{let p=d.repo.replace(/[^a-z0-9]+/gi,"-");return(0,l.jsx)(S,{form:{id:`mute-${p}`,proof:"notifications-mute",action:"/settings/notifications/mute",gate:!0,hidden:{repo:d.repo},fields:[{kind:"switch",id:`pings-${p}`,name:"pings",label:d.name,hint:d.muted?"Muted: no pings":"Pings on",switchLabel:"Pings",on:!d.muted}]}},d.repo)}),(0,l.jsx)(h,{children:"Muted projects still show in Work and the evening digest."})]}):null]}):null,e.messaging!==null&&(e.messaging.configured.length>=2||e.messaging.implicit)?(0,l.jsxs)(u,{id:"alert-service",title:"Where alerts go",lead:"Alerts go through one app, so you are never notified twice. Telegram still takes taps and replies when another app sends alerts.",children:[e.messaging.implicit?(0,l.jsx)(h,{children:"Several are connected and none was chosen. Pick one."}):null,(0,l.jsx)(S,{form:{id:"messaging-form",proof:"messaging",action:"/settings/messaging",gate:!0,fields:[{kind:"radios",name:"primary",legend:"Where alerts go",current:e.messaging.channel??"",items:e.messaging.configured.map(d=>({value:d,label:g(d),text:d==="telegram"?"Answer buttons and replies":"Messages with links; acting stays here"}))}]}})]}):null,e.digest!==null?(0,l.jsx)(u,{id:"telegram-digest",title:"Telegram digest",lead:"Bundle routine updates. Anything that needs you still arrives at once.",children:(0,l.jsx)(S,{form:{id:"digest-form",proof:"telegram-digest",action:"/settings/telegram-digest",gate:!0,said:e.digest.held,fields:[{kind:"select",name:"every",label:"Send a digest",current:e.digest.every,items:[["off","Off: send each update"],["30","Every 30 minutes"],["60","Every hour"],["240","Every 4 hours"],["720","Every 12 hours"],["1440","Once a day"]]}]}})}):null,e.push!==null?(0,l.jsxs)(u,{id:"this-device",title:"This device",lead:"A notification when something needs you. On iPhone, add this app to your Home Screen first.",children:[e.push.devices.length>0?(0,l.jsx)("div",{className:"k-srecs",children:e.push.devices.map(d=>(0,l.jsx)(B,{title:d.words,sub:d.state==="ok"?void 0:d.state==="failing"?"Failing":"Expired",action:d.removable?(0,l.jsx)(G,{action:"/push/remove",fields:{id:String(d.id)},variant:"ghost",label:`Remove ${d.words.split(" · ")[0]??"device"}`}):void 0},d.id))}):null,e.push.available?(0,l.jsx)(S,{form:{id:"push-form",proof:"push-subscribe",action:"/push/subscribe",hidden:{endpoint:"",p256dh:"",auth:""},save:{label:"Get alerts on this device",variant:"outline"},native:!0,confirm:"Get alerts on this device",fields:[]},children:(0,l.jsx)("p",{className:"k-note",id:"push-state","aria-live":"polite",children:t})}):(0,l.jsx)(h,{children:"Alerts need a secure (https) address for this app."})]}):null,e.phone!==null?(0,l.jsxs)(u,{id:"phone",title:"Toolroll in your phone's browser",children:[(0,l.jsxs)("p",{className:"k-note",children:["Open Toolroll itself in your phone's browser, over your own private network. Or use the"," ",(0,l.jsx)("a",{className:"k-link",href:"/settings/phone",children:"Toolroll iPhone app"}),"."]}),(0,l.jsx)("p",{className:"k-note","data-phone-tailnet":"",children:e.phone.tailnet===null?(0,l.jsxs)(l.Fragment,{children:["Install"," ",(0,l.jsx)("a",{className:"k-link",href:"https://tailscale.com/download",children:"Tailscale"})," ","on this computer and your phone, then reload this page for the address."]}):e.phone.tailnet.restart===null?(0,l.jsxs)(l.Fragment,{children:["On your phone, open ",(0,l.jsx)(_,{children:e.phone.tailnet.address})," and sign in."]}):(0,l.jsxs)(l.Fragment,{children:["Start Toolroll with ",(0,l.jsx)(_,{children:e.phone.tailnet.restart}),", then on your phone open ",(0,l.jsx)(_,{children:e.phone.tailnet.address})," and sign in."]})})]}):null,e.email!==null?(0,l.jsx)(On,{email:e.email}):null,e.approver&&e.browser&&e.installation?(0,l.jsxs)(u,{id:"telegram-token",title:"Telegram bot token",state:` · ${e.telegram.state}`,children:[(0,l.jsxs)(h,{children:["Current: ",e.telegram.current]}),e.telegram.delivery!==null?(0,l.jsx)("p",{className:"k-note","data-telegram-delivery":"",children:e.telegram.delivery}):null,(0,l.jsx)(S,{form:{id:"telegram-token-form",proof:"telegram-token",action:"/settings/telegram-token",gate:!0,save:{label:"Save token"},fields:[{kind:"secret",id:"telegram-token-field",name:"token",label:"Token from @BotFather",hint:"Stored privately on this computer. Then pair your phone on the Telegram page."}]}}),(0,l.jsxs)(h,{children:["In Telegram, send ",(0,l.jsx)(_,{children:"/status"}),", ",(0,l.jsx)(_,{children:"/task <id>"})," or"," ",(0,l.jsx)(_,{children:"/help"}),"; these use no AI model."]})]}):null]})}function En({facts:e,flags:n}){return(0,l.jsxs)(H,{group:"projects",title:"Projects",lead:"Each project has its own network, writes, checks, pull requests and tools.",flags:n,children:[(0,l.jsx)(he,{said:e.said,problem:e.problem}),e.projectsFolder&&e.projectsFolder.folders.length>0?(0,l.jsx)(u,{id:"projects-folder",title:e.projectsFolder.folders.length===1?"Projects folder":"Projects folders",lead:"Toolroll can add any git repository inside it.",children:e.projectsFolder.folders.map(t=>(0,l.jsx)(v,{label:"Folder",variant:"inline",children:(0,l.jsx)("span",{className:"k-mono",children:t.shown})},t.path))}):null,e.projects.length===0?(0,l.jsx)(u,{id:"projects",title:"Projects",children:(0,l.jsxs)(h,{children:["No projects yet."," ",(0,l.jsx)("a",{className:"k-link",href:"/projects",children:"Add one on Projects"}),"."]})}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Re,{label:"Projects",children:e.projects.map(t=>(0,l.jsx)(te,{href:`/settings/project?repo=${encodeURIComponent(t.repo)}`,title:t.name,status:(0,l.jsx)("span",{className:"k-mono",children:t.repo})},t.repo))}),(0,l.jsxs)(Re,{label:"For each project",children:[(0,l.jsx)(te,{href:"/settings/checks",title:"Checks",status:"What runs after each build"}),(0,l.jsx)(te,{href:"/settings/pull-requests",title:"Pull requests",status:"How finished work reaches GitHub"}),(0,l.jsx)(te,{href:"/settings/tools",title:"Tools",status:"What builds can use"}),(0,l.jsx)(te,{href:"/control",title:"Builder setup",status:"Agent, model and preparation command"})]})]})]})}function Un({facts:e,flags:n}){let t=e.people;return(0,l.jsxs)(H,{group:"access",title:"People and sign-in",lead:"Who can get in, how they sign in, and the ways in they hold.",flags:n,children:[(0,l.jsx)(he,{said:e.said,problem:e.problem}),(0,l.jsxs)(Re,{label:"People and sign-in",children:[(0,l.jsx)(te,{href:"/people",title:"People",status:t===null?"Your own access":[tn({...e,passwordless:null}),t.invites===0?"no open invites":De(t.invites,"open invite","open invites")].join(" · ")}),(0,l.jsx)(te,{href:"/settings/sessions",title:"Sessions and tokens",status:`${De(e.access.sessions,"session","sessions")} signed in · ${De(e.access.tokens,"API token","API tokens")}`}),e.approver?(0,l.jsx)(te,{href:"/settings/phone",title:"Phone",status:"The Toolroll iPhone app: pair, rename and remove phones"}):null,e.operator&&(qe(e)||e.sso!==null)?(0,l.jsx)(te,{href:"/settings/sign-in",title:"Sign-in with a provider",status:e.sso===null?"Not set up: everyone uses a password":`People sign in with ${e.sso}`}):null,e.operator&&(qe(e)||e.passwordless===!0)?(0,l.jsx)(te,{href:"/settings/passwordless",title:"Passwordless",status:e.passwordless?"On: most approvals need no password":"Off: approvals ask for your password"}):null,e.local?.canTurnOff===!0?(0,l.jsx)("div",{id:"local-mode",children:(0,l.jsx)(te,{href:"/settings/general?section=local-mode",title:"Local mode",status:"On · in General"})}):null]})]})}function Wn({updates:e}){let n=e.latest,t=n!==null&&n.newer?n:null,a=t?`${t.version} is available`:e.check.on?n===null?"Not checked yet":"Up to date":"Checks are off";return(0,l.jsxs)(u,{id:"updates",title:"Updates",state:` · ${a}`,children:[(0,l.jsx)(v,{label:"This version",hint:t?.security?"The newer version has security fixes.":void 0,variant:"inline",children:(0,l.jsx)("span",{className:"k-mono",children:e.current})}),t!==null?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(h,{children:"Run this on this computer, then restart Toolroll:"}),(0,l.jsx)(_,{children:e.updateCommand}),(0,l.jsx)(A,{children:(0,l.jsx)(z,{sm:!0,variant:"ghost",href:t.url,label:"Release notes"})}),t.notes!==""?(0,l.jsx)(q,{summary:`What’s new in ${t.version}`,children:(0,l.jsx)("pre",{className:"k-scode",children:t.notes})}):null]}):null,e.check.canManage&&!e.check.byEnv?(0,l.jsx)(K,{action:"/settings/updates/checks",hiddenFields:{check:e.check.on?"off":"on"},children:(0,l.jsx)(v,{label:"Check once a day",hint:"One anonymous request to npm and GitHub. Nothing about you is sent.",variant:"inline",children:(0,l.jsx)(C,{sm:!0,type:"submit",label:e.check.on?"Turn off":"Turn on"})})}):e.check.byEnv?(0,l.jsx)(h,{children:"Daily checks are off by TOOLROLL_NO_UPDATE_CHECK."}):null,e.workers.map(i=>(0,l.jsx)(v,{label:i.name,hint:i.older?"Older than this computer":void 0,variant:"inline",children:(0,l.jsx)("span",{className:"k-mono",children:i.version??"Version not reported"})},i.name))]})}function Dn({facts:e,flags:n}){return(0,l.jsxs)(H,{group:"system",title:$n("system"),lead:"This Toolroll’s version, backups, storage and what leaves this computer.",flags:n,children:[(0,l.jsx)(he,{said:e.said,problem:e.problem}),e.updates!==null?(0,l.jsx)(Wn,{updates:e.updates}):null,(0,l.jsx)(Re,{label:"In this group",children:e.operator?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(te,{href:"/settings/updates",title:"Updates",status:e.updates===null?"Toolroll’s own version":`Toolroll ${e.updates.current}`}),(0,l.jsx)(te,{href:"/settings/backups",title:"Backups",status:e.backup?.words??"When and where the database is copied",needs:e.backup?.failed?1:0}),(0,l.jsx)(te,{href:"/settings/storage",title:"Storage",status:"Task folders on this computer, and cleaning them up"}),(0,l.jsx)(te,{href:"/settings/retention",title:"Retention",status:"How long run logs and chats are kept"}),qe(e)?(0,l.jsx)(te,{href:"/settings/monitoring",title:"Monitoring",status:"Send the audit stream and traces to your own systems"}):null,(0,l.jsx)(te,{href:"/settings/data",title:"Data export",status:"Everything except secrets, as one download"}),(0,l.jsx)(te,{href:"/settings/integrations",title:"Integrations",status:"Which connected services work"})]}):(0,l.jsx)(te,{href:"/settings/integrations",title:"Integrations",status:"Which connected services work"})})]})}function Hn({group:e,facts:n}){let t=Nn(en(Zs(n)));switch(e){case"hub":return(0,l.jsx)(Us,{facts:n,flags:t});case"agents":return(0,l.jsx)(Mn,{facts:n,flags:t});case"alerts":return(0,l.jsx)(qn,{facts:n,flags:t});case"projects":return(0,l.jsx)(En,{facts:n,flags:t});case"access":return(0,l.jsx)(Un,{facts:n,flags:t});case"system":return(0,l.jsx)(Dn,{facts:n,flags:t});case"approval":return(0,l.jsx)(Us,{facts:n,flags:t})}}var Bn=ue(Ce(),1),o=ue(Te(),1),Vn="observed, not a promise",Ws={builder:"Builds",repair:"Repairs",planner:"Plans",reviewer:"Reviews",scout:"Scouting",lead:"Lead chat",chat:"Chat",subagent:"Subagents",flow:"Flows",evals:"Evals"},Gn=["Sizing a new task (Claude or OpenRouter)","Memory checks that read finished chat sessions","Coding sessions in Code","A flow draft that failed","A Sort step that failed before saving its answer"],Ds=e=>e.split("/").filter(Boolean).pop()??e,Yn=e=>`$${(e/1e6).toFixed(e!==0&&Math.abs(e)<1e7?2:0)}`,es=(e,n,t=`${n}s`)=>`${e} ${e===1?n:t}`,Ge=(e,n="long")=>new Intl.DateTimeFormat("en-US",{month:n,year:"numeric",timeZone:"UTC"}).format(new Date(`${e}-01T00:00:00.000Z`)),Kn=e=>e.usageCount===0?"—":e.usageMicrousd>0?`${Ne(e.usageMicrousd)}${e.usageUnreported>0?` + ${e.usageUnreported} not reported`:""}`:"not reported",_n=e=>{let n=e.estimatedMicrousd>0?`${Ne(e.estimatedMicrousd)} estimated`:"";return e.unknown>0?`${e.unknown}${n===""?"":` · ${n}`}`:n===""?"—":n},Hs=e=>e.apiMicrousd>0?Ne(e.apiMicrousd):"—";function Pe({id:e,title:n,state:t="",children:a,...i}){return(0,o.jsxs)("section",{className:"k-sec spend-sec","aria-labelledby":`spend-${e}`,...i,children:[(0,o.jsx)("div",{className:"k-secthead",children:(0,o.jsxs)("h3",{id:`spend-${e}`,children:[n,t?(0,o.jsxs)(o.Fragment,{children:[" ",(0,o.jsxs)("small",{children:["· ",t]})]}):null]})}),a]})}function Qe({head:e,lines:n,name:t,max:a,top:i=12,detail:g=()=>""}){let d=Math.max(a,1e6),p=n.reduce((k,w)=>k+w.apiMicrousd,0);return(0,o.jsxs)("div",{className:"spend-bars",role:"table","aria-label":e,children:[(0,o.jsxs)("div",{className:"spend-bar h",role:"row",children:[(0,o.jsx)("span",{role:"columnheader",children:e}),(0,o.jsx)("span",{role:"columnheader"}),(0,o.jsx)("span",{className:"spend-bar-v",role:"columnheader",children:"API dollars"})]}),n.slice(0,i).map(k=>{let w=[g(k),k.usageCount>0?`plan usage ${Kn(k)}`:"",k.unknown>0||k.estimatedMicrousd>0?`unknown ${_n(k)}`:""].filter(Boolean).join(" · "),P=k.apiMicrousd>0?Math.max(0,Math.min(100,k.apiMicrousd/d*100)):0;return(0,o.jsxs)("div",{className:"spend-bar",role:"row",children:[(0,o.jsxs)("span",{className:"spend-bar-n",role:"cell",children:[t(k.key),w===""?null:(0,o.jsx)("small",{"data-amount-kind":k.usageCount>0?"subscription":"unknown",children:w})]}),(0,o.jsx)("span",{className:"spend-lane",role:"cell","aria-hidden":"true",children:k.apiMicrousd>0?(0,o.jsx)("i",{style:{width:`${P.toFixed(1)}%`},title:Hs(k)}):null}),(0,o.jsx)("span",{className:"spend-bar-v",role:"cell","data-amount-kind":"api",children:Hs(k)})]},k.key)}),(0,o.jsxs)("div",{className:"spend-bar tot",role:"row",children:[(0,o.jsx)("span",{role:"cell",children:"Total"}),(0,o.jsx)("span",{role:"cell"}),(0,o.jsx)("span",{className:"spend-bar-v",role:"cell",children:p>0?Ne(p):"—"})]})]})}var an=(e,n,t)=>`/spend?${n===t?"":`month=${n}&`}edit=${encodeURIComponent(e)}`,ln=e=>`limit-${e.replace(/[^a-z0-9]+/gi,"-").replace(/^-|-$/g,"").slice(0,60)||"new"}`,zn=/^\d+$/;function rn({row:e,edit:n,view:t,targets:a}){let i=ln(n.target),g=t.facts??{passwordless:!1,remembered:!1},d=n.usd??(e?.budget?String(Math.round(e.budget.limitMicrousd/1e6)):""),p=n.stop??e?.budget?.hardStop??!0,[k,w]=(0,Bn.useState)(n.fieldError??null),P=t.month===t.current?"/spend":`/spend?month=${t.month}`;return(0,o.jsxs)(_e,{action:"/spend/budget",className:"spend-edit",id:i,"data-spend-limit":"",noValidate:!0,onSubmit:M=>{if(M.nativeEvent.submitter?.hasAttribute("data-spend-remove"))return;let Q=M.currentTarget.querySelector("[data-spend-usd]");if(Q===null)return;let j=Q.value.replace(/[$,\s]/g,"");if(zn.test(j)&&+j>=1&&+j<=1e7){w(null),Q.value=j;return}M.preventDefault(),w("Use a whole number of dollars, at least $1, like 40. Nothing changed."),Q.focus()},children:[e!==null?(0,o.jsx)("input",{type:"hidden",name:"target",value:e.target}):null,e===null&&a!==void 0?(0,o.jsx)(ke,{label:"For",children:({id:M})=>(0,o.jsx)("span",{className:"k-selw wide",children:(0,o.jsx)("select",{className:"k-sel",id:M,name:"target",required:!0,defaultValue:n.target,children:["People","Subagents"].map(Q=>{let j=a.filter(f=>f.group===Q);return j.length===0?null:(0,o.jsx)("optgroup",{label:Q,children:j.map(f=>(0,o.jsx)("option",{value:f.value,children:f.label},f.value))},Q)})})})}):null,(0,o.jsxs)("div",{className:"spend-edit-row",children:[(0,o.jsx)(ke,{label:"Monthly limit (US dollars)",error:k,children:({id:M,describedBy:Q,invalid:j})=>(0,o.jsx)(le,{id:M,name:"usd",defaultValue:d,inputMode:"numeric",autoComplete:"off","data-spend-usd":"",autoFocus:!0,"aria-invalid":j||void 0,"aria-describedby":Q||void 0})}),(0,o.jsx)("div",{className:"k-checks",children:(0,o.jsxs)("label",{children:[(0,o.jsx)("input",{type:"checkbox",name:"stop",value:"1",defaultChecked:p}),"Pause new API work at the limit"]})})]}),(0,o.jsx)(h,{children:`Unchecked means alerts only. Plan usage never counts toward a limit. ${Fs("step-up",g)}`}),rs("step-up",g)==="password"?(0,o.jsx)(ke,{label:"Your password",children:({id:M})=>(0,o.jsx)(le,{id:M,name:"password",type:"password",autoComplete:"current-password",required:!0})}):null,(0,o.jsxs)(A,{children:[(0,o.jsx)(C,{variant:"primary",type:"submit",docked:!0,name:"action",value:"save",label:"Save limit"}),e?.budget?(0,o.jsx)(C,{variant:"ghost",type:"submit",name:"action",value:"remove",formNoValidate:!0,"data-spend-remove":"",label:"Remove limit"}):null,(0,o.jsx)(z,{variant:"ghost",href:P,label:"Cancel"})]}),n.problem?(0,o.jsx)(X,{children:n.problem}):null]})}function Jn({row:e,view:n,current:t,open:a}){let i=e.budget,g=i!==null&&sn(i),d=i!==null&&i.spentMicrousd>=i.limitMicrousd,p=i===null?"No limit.":d&&i.hardStop?"Used up: new API work waits until next month or a higher limit.":`${i.hardStop?"Pauses new API work at the limit.":"Alerts only."}${i.unpriced>0?` ${es(i.unpriced,"piece")} of work without a price.`:""}`,k=i===null?`${Ne(e.spentMicrousd)} so far`:`${Ne(i.spentMicrousd)} of ${Yn(i.limitMicrousd)} · ${i.percent}%`;return(0,o.jsxs)("div",{className:"spend-lim",...i===null?{}:{"data-budget":String(i.id)},children:[(0,o.jsxs)("div",{className:"spend-lim-h",children:[(0,o.jsxs)("span",{className:"spend-lim-l",children:[(0,o.jsxs)("span",{className:"spend-lim-t",children:[e.label,g?(0,o.jsx)(ne,{word:"Needs you",tone:"needs"}):null]}),(0,o.jsx)("span",{className:"spend-lim-x",children:p})]}),(0,o.jsx)("span",{className:"spend-fig",children:k}),(0,o.jsx)("span",{className:"spend-lim-a",children:a!==null?null:(0,o.jsx)(z,{sm:!0,href:an(e.target,n.month,t),label:i===null?"Set a limit":"Edit limit"})})]}),i===null?null:(0,o.jsx)("span",{className:`spend-meter${d?" over":""}`,role:"meter","aria-valuemin":0,"aria-valuemax":i.limitMicrousd,"aria-valuenow":i.spentMicrousd,"aria-label":`${e.label}: ${k}`,children:(0,o.jsx)("i",{style:{width:`${Math.min(100,Math.max(0,i.percent))}%`}})}),a===null?null:(0,o.jsx)(rn,{row:e,edit:a,view:n,targets:void 0})]})}var Qn=e=>e==="small"?"Small tasks":"Routine tasks",ss=e=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}).format(new Date(e)),Xn={active:"live",trialling:"live",paused:"needs"},ps=e=>e.charAt(0).toUpperCase()+e.slice(1);function Bs({label:e,side:n,words:t}){return(0,o.jsxs)("div",{className:"spend-rr-s",role:"group","aria-label":`${e}: ${n.name}`,"data-side":e.toLowerCase(),children:[(0,o.jsxs)("span",{className:"spend-rr-k",children:[e," · ",n.name," · ",ss(n.from)," to ",ss(n.to)]}),(0,o.jsxs)("span",{className:"spend-rr-v","data-amount-kind":"api","data-microusd":n.medianApiMicrousd??"",children:[t.median," ",(0,o.jsx)("small",{children:"median API dollars a task"})]}),(0,o.jsxs)("ul",{className:"spend-rr-p",children:[(0,o.jsx)("li",{"data-priced":n.apiPriced,"data-results":n.results,children:t.parts[0]}),(0,o.jsx)("li",{"data-amount-kind":"subscription",children:ps(t.parts[1])}),(0,o.jsx)("li",{"data-amount-kind":"unknown",children:ps(t.parts[2])}),(0,o.jsx)("li",{children:ps(t.parts[3])})]})]})}function Zn({row:e}){let n=e.kind==="suggestion",t=`${e.cheaper.name} instead of ${e.configured.name}${e.kind==="trial"?" (a trial)":n?" (suggested, not in use)":""}`,a=`/settings/models?scope=${encodeURIComponent(e.repo)}#models-suggested`;return(0,o.jsxs)("article",{className:"spend-rr","data-savings-row":"","data-kind":e.kind,"data-state":e.state,"data-enough":e.enough?"yes":"no",children:[(0,o.jsxs)("div",{className:"spend-rr-h",children:[(0,o.jsxs)("span",{className:"spend-rr-t",children:[e.project," · ",Qn(e.size)]}),(0,o.jsx)(ne,{word:e.status,tone:Xn[e.state]??""})]}),(0,o.jsx)("span",{className:"spend-rr-x",children:t}),(0,o.jsxs)("div",{className:"spend-rr-g",children:[(0,o.jsx)(Bs,{label:n?"Configured":"Before",side:e.configured,words:e.sides.configured}),(0,o.jsx)(Bs,{label:n?"Suggested":"After",side:e.cheaper,words:e.sides.cheaper})]}),e.enough?null:(0,o.jsx)("p",{className:"k-note","data-not-enough":"",children:e.notEnough}),(0,o.jsx)("p",{className:"k-note","data-prices":"",children:e.pricesLine}),(0,o.jsx)("span",{children:(0,o.jsx)("a",{className:"k-link",href:a,children:n?"Review in Models settings":"Open Models settings"})})]})}function et({savings:e}){let n=`${Vn} · 90 days a side`;return"error"in e?(0,o.jsx)(Pe,{id:"savings",title:"Suggestions and rules",state:n,"data-savings":"error",children:(0,o.jsx)(X,{children:"Suggestions and rules can't be read right now. Nothing else on this page is affected."})}):e.rows.length===0?(0,o.jsx)(Pe,{id:"savings",title:"Suggestions and rules",state:n,"data-savings":"empty",children:(0,o.jsx)(os,{title:"No suggestions or rules yet.",text:"When a cheaper model does as well on a project's small or routine tasks, its suggestion shows here, and once it's in use, what it cost before and after."})}):(0,o.jsxs)(Pe,{id:"savings",title:"Suggestions and rules",state:n,"data-savings":"rows",children:[(0,o.jsxs)("p",{className:"k-note",children:["Median API dollars a task, including revision and repair runs. Plan usage and unknown cost are counted apart, never added in. A median shows once each side has ",e.minPriced," results priced in API dollars."]}),e.staleSince===null?null:(0,o.jsxs)("p",{className:"k-note","data-savings-stale":"",children:["Some results were last checked on ",ss(e.staleSince),"; they update while Toolroll runs."]}),e.rows.map(t=>(0,o.jsx)(Zn,{row:t},`${t.kind}-${t.id}`))]})}function st({view:e}){let n=e.chatCharges??[],t=e.facts??{passwordless:!1,remembered:!1},a=rs("step-up",t)==="password";return(0,o.jsxs)(Pe,{id:"chat-charges",title:"Chat charges to accept",state:es(n.length,"charge"),"data-chat-charges":"",children:[(0,o.jsx)("p",{className:"k-note",children:"These chats ended before Toolroll could see what they cost, so chats on that key wait until you accept the charge. Each counts at what it set aside."}),n.map(i=>(0,o.jsxs)(_e,{action:"/spend/chat-charge",className:"spend-lim","data-chat-charge":i.turn,children:[(0,o.jsx)("input",{type:"hidden",name:"turn",value:i.turn}),(0,o.jsxs)("div",{className:"spend-lim-h",children:[(0,o.jsxs)("span",{className:"spend-lim-l",children:[(0,o.jsxs)("span",{className:"spend-lim-t",children:[i.source,(0,o.jsx)(ne,{word:"Needs you",tone:"needs"})]}),(0,o.jsx)("span",{className:"spend-lim-x",children:`${i.person}’s chat · ended ${ss(i.endedAt)}`})]}),(0,o.jsx)("span",{className:"spend-fig",children:i.amount}),(0,o.jsx)("span",{className:"spend-lim-a",children:(0,o.jsx)(C,{sm:!0,type:"submit",label:"Accept charge"})})]}),a?(0,o.jsx)(ke,{label:"Your password",children:({id:g})=>(0,o.jsx)(le,{id:g,name:"password",type:"password",autoComplete:"current-password",required:!0})}):null]},i.turn))]})}function nt({view:e,said:n,problem:t}){let a=e.current??e.month,i=e.edit??null,g=e.limitRows,d=x=>i!==null&&i.target===x.target?i:null,p=e.targets??[],k=i!==null&&!g.some(x=>x.target===i.target)&&p.length>0?i:null,{totals:w}=e.report,P=w.usageCount===0?"None":w.usageMicrousd>0?Ne(w.usageMicrousd):"Not reported",M=w.usageCount===0?"No plan usage recorded":w.usageMicrousd>0?`of usage at API prices${w.usageUnreported>0?` · ${es(w.usageUnreported,"piece")} of work not reported`:""}`:`${es(w.usageCount,"piece")} of work`,Q=w.unknown===0?"None":String(w.unknown),j=[w.unknown>0?`${w.unknown===1?"piece":"pieces"} of work with billing not proved or cost not recorded`:"Nothing with an unknown cost",...w.estimatedMicrousd>0?[`counted as ${Ne(w.estimatedMicrousd)} (estimated)`]:[]].join(" · "),f=Ge(e.month,"long"),E=[{key:e.previous,label:Ge(e.previous,"short"),href:`/spend?month=${e.previous}`},{key:e.month,label:Ge(e.month,"short"),href:`/spend?month=${e.month}`},...e.next===null?[]:[{key:e.next,label:Ge(e.next,"short"),href:`/spend?month=${e.next}`}]],L=e.report.byProject.length===0&&e.report.byModel.length===0&&w.unknown===0&&w.usageCount===0,R=Math.max(0,...e.report.byProject.map(x=>x.apiMicrousd),...e.report.byModel.map(x=>x.apiMicrousd)),se=e.report.topRuns,de=i!==null&&(g.some(x=>x.target===i.target)||k!==null);return(0,o.jsxs)(H,{group:"spend",title:"Spend",lead:"What agents cost, by project and by model, with the limits that stop them. Dates are UTC months.",flags:{spend:g.some(x=>x.budget!==null&&sn(x.budget))},children:[(0,o.jsxs)("div",{className:"spend",children:[(e.chatCharges??[]).length===0?null:(0,o.jsx)(st,{view:e}),e.budgets===null?null:(0,o.jsxs)(Pe,{id:"limits",title:"Monthly limits",state:Ge(a,"long").split(" ")[0],children:[t?(0,o.jsx)(X,{children:t}):n?(0,o.jsx)("p",{className:"k-note",role:"status",children:n}):null,g.map(x=>(0,o.jsx)(Jn,{row:x,view:e,current:a,open:d(x)},x.target)),p.length===0?null:(0,o.jsxs)("div",{className:"spend-lim",children:[(0,o.jsxs)("div",{className:"spend-lim-h",children:[(0,o.jsxs)("span",{className:"spend-lim-l",children:[(0,o.jsx)("span",{className:"spend-lim-t",children:"A person or a subagent"}),(0,o.jsx)("span",{className:"spend-lim-x",children:"A limit for one person’s or one subagent’s work."})]}),(0,o.jsx)("span",{}),(0,o.jsx)("span",{className:"spend-lim-a",children:k===null?(0,o.jsx)(z,{sm:!0,href:an("new",e.month,a),label:"Add a limit"}):null})]}),k===null?null:(0,o.jsx)(rn,{row:null,edit:k,view:e,targets:p})]})]}),(0,o.jsxs)("div",{className:"spend-month",children:[(0,o.jsx)(Rs,{label:"Month",current:e.month,items:E}),(0,o.jsx)(z,{variant:"ghost",sm:!0,href:`/spend?month=${e.month}&format=csv`,download:"",label:"Download CSV"})]}),(0,o.jsxs)("section",{className:"spend-sum","aria-label":f,children:[(0,o.jsxs)("div",{"data-amount-kind":"api","data-microusd":w.apiMicrousd,children:[(0,o.jsxs)("span",{className:"spend-sum-k",children:["API dollars · ",f,e.month===a?" so far":""]}),(0,o.jsx)("span",{className:"spend-sum-v",children:Ne(w.apiMicrousd)}),(0,o.jsx)("span",{className:"spend-sum-x",children:"Recorded charges to API keys"})]}),(0,o.jsxs)("div",{"data-amount-kind":"subscription","data-microusd":w.usageMicrousd,"data-unreported":w.usageUnreported,children:[(0,o.jsx)("span",{className:"spend-sum-k",children:"Plan usage"}),(0,o.jsx)("span",{className:"spend-sum-v",children:P}),(0,o.jsx)("span",{className:"spend-sum-x",children:M})]}),(0,o.jsxs)("div",{"data-amount-kind":"unknown","data-count":w.unknown,"data-estimated-microusd":w.estimatedMicrousd,children:[(0,o.jsx)("span",{className:"spend-sum-k",children:"Unknown"}),(0,o.jsx)("span",{className:"spend-sum-v",children:Q}),(0,o.jsx)("span",{className:"spend-sum-x",children:j})]})]}),L?(0,o.jsx)(os,{title:`Nothing spent in ${f}.`}):(0,o.jsxs)(o.Fragment,{children:[e.report.byProject.length===0?null:(0,o.jsx)(Pe,{id:"by-project",title:"By project",children:(0,o.jsx)(Qe,{head:"Project",lines:e.report.byProject,name:Ds,max:R})}),e.report.byModel.length===0?null:(0,o.jsx)(Pe,{id:"by-model",title:"By model",children:(0,o.jsx)(Qe,{head:"Model",lines:e.report.byModel,name:x=>x,max:R,detail:x=>x.chosen.length===0?"":`chosen as ${x.chosen.join(", ")}`})}),e.report.byRole.length===0&&e.report.byPerson.length===0&&se.length===0?null:(0,o.jsxs)(q,{summary:"By role, by person and the costliest runs",children:[e.report.byRole.length===0?null:(0,o.jsx)(Qe,{head:"Role",lines:e.report.byRole,name:x=>Ws[x]??x,max:R}),e.report.byPerson.length===0?null:(0,o.jsx)(Qe,{head:"Person",lines:e.report.byPerson,name:x=>x,max:R}),se.length===0?null:(0,o.jsx)("div",{className:"spend-runs",children:se.map(x=>(0,o.jsxs)("div",{className:"spend-run","data-run":x.runId,children:[(0,o.jsxs)("span",{children:[(0,o.jsx)("a",{className:"k-link",href:`/t/${encodeURIComponent(x.taskId)}`,children:x.taskId})," · ",(0,o.jsxs)("a",{className:"k-link",href:`/r/${x.runId}`,children:[Ws[x.role]," ",x.runId]})]}),(0,o.jsx)("span",{className:"k-num",children:Ne(x.microusd)}),(0,o.jsxs)("small",{children:[x.project===null?"":`${Ds(x.project)} · `,(0,o.jsxs)("span",{className:"k-mono",children:[x.provider," · ",x.model]})]})]},x.runId))})]})]}),e.windows===null||e.windows.tiles.length===0?null:(0,o.jsx)(Pe,{id:"windows",title:"Plan windows",children:(0,o.jsx)("div",{className:"spend-wins",children:e.windows.tiles.map(x=>(0,o.jsxs)("div",{className:`spend-win ${x.tone}`,"data-limit":x.key,...x.title===null?{}:{title:x.title},children:[(0,o.jsxs)("div",{className:"spend-win-h",children:[(0,o.jsxs)("b",{children:[x.name," ",x.window]}),(0,o.jsxs)("span",{className:"k-num",children:[x.value,x.unit]})]}),(0,o.jsx)("span",{className:"spend-meter",role:"meter","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(x.percent),"aria-label":`${x.name} ${x.window}: ${x.value}${x.unit}`,children:(0,o.jsx)("i",{style:{width:`${Math.min(100,Math.max(0,x.percent))}%`}})}),(0,o.jsx)("span",{className:"k-note",children:x.detail})]},x.key))})}),e.savings==null?null:(0,o.jsx)(et,{savings:e.savings}),(0,o.jsxs)("p",{className:"k-note","data-not-counted":"",children:["Not counted here: ",Gn.map(x=>x.charAt(0).toLowerCase()+x.slice(1)).join("; "),". Evals never count toward a limit."]})]}),de?(0,o.jsx)(ze,{children:(0,o.jsx)(C,{variant:"primary",type:"submit",form:ln(i.target),name:"action",value:"save",label:"Save limit"})}):null]})}var ee=ue(Ce(),1),tt="OAUTH_ACCESS_TOKEN",on=e=>e.transport==="http"&&e.bearer===tt,Oe=ue(Ce(),1),N=ue(Te(),1);function at({skill:e}){return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(xe,{rows:[["Source",(0,N.jsxs)(N.Fragment,{children:[e.source," · ",(0,N.jsx)(_,{children:e.sha.slice(0,10)})]})],["Size",e.size]]}),(0,N.jsx)("pre",{className:"k-scode",children:e.skillMd}),(0,N.jsx)(q,{summary:"Package files",children:(0,N.jsx)("ul",{className:"k-note",children:e.files.map(n=>(0,N.jsx)("li",{className:"k-mono",children:n},n))})})]})}function Vs({skill:e,data:n,base:t}){let a=n.canManage,i=n.draft.sha===e.sha;return(0,N.jsxs)(B,{id:`skill-${e.sha}`,title:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("span",{children:e.name}),(0,N.jsx)(ne,{word:e.status.word,tone:e.status.tone})]}),sub:e.description,children:[e.requirements?(0,N.jsx)(h,{children:`Requires: ${e.requirements}. Availability is checked when the agent tests or uses it.`}):null,e.warnings.map(g=>(0,N.jsx)(h,{children:g},g)),(0,N.jsxs)(q,{summary:"Review skill",open:n.focus===e.sha,children:[(0,N.jsx)(at,{skill:e}),a?(0,N.jsxs)(K,{action:"/settings/skills/change",hiddenFields:{...t,action:e.enabled?"disable":"enable",sha:e.sha},children:[e.replaced?(0,N.jsx)(h,{children:"Replaces the enabled version of this skill for new tasks."}):null,(0,N.jsx)(A,{children:(0,N.jsx)(C,{sm:!0,type:"submit",label:e.enabled?"Disable skill":"Enable skill"})})]}):null]}),a?(0,N.jsx)(q,{summary:"Test skill",open:i,children:(0,N.jsxs)(K,{action:"/settings/skills/change",hiddenFields:{...t,action:"test",sha:e.sha,nonce:e.nonce},children:[(0,N.jsx)(h,{children:`${n.agent}. Runs the sample as a report task through the normal approval: it reads the project, and a report that changes a file fails with nothing kept.`}),(0,N.jsx)(v,{label:"Sample request",hint:"The report shows what worked and what needs tools or permission. Enabled status alone does not prove use.",variant:"top",children:(0,N.jsx)(je,{id:`skill-sample-${e.sha.slice(0,12)}`,name:"sample",rows:3,defaultValue:i?n.draft.sample??"":"",required:!0,maxLength:800,placeholder:"Review this project’s home page and suggest three clearer button labels.","aria-label":"Sample request"})}),(0,N.jsx)(A,{children:(0,N.jsx)(C,{sm:!0,type:"submit",label:"Create test"})})]})}):null]})}var us={files:64,total:1048576,each:262144};function it({base:e,draft:n,open:t}){let[a,i]=(0,Oe.useState)(n.method??"paste"),[g,d]=(0,Oe.useState)(null),[p,k]=(0,Oe.useState)(!1),w=(0,Oe.useRef)(!1),P=(0,Oe.useRef)(null),M=(0,Oe.useRef)(null),Q=async j=>{if(a!=="folder")return;if(w.current){w.current=!1;return}j.preventDefault();let f=j.currentTarget;d(null),k(!0);try{let E=Array.from(P.current?.files??[]);if(E.length===0||E.length>us.files||E.reduce((R,se)=>R+se.size,0)>us.total||E.some(R=>R.size>us.each))throw new Error("Choose one skill folder with up to 64 files and 1 MB total.");let L=[];for(let R of E){let se=R.webkitRelativePath.split("/");se.shift();let de=new Uint8Array(await R.arrayBuffer()),x="";for(let J of de)x+=String.fromCharCode(J);L.push({path:se.join("/"),base64:btoa(x)})}M.current&&(M.current.value=JSON.stringify(L)),w.current=!0,k(!1),f.requestSubmit()}catch(E){d(E instanceof Error&&E.message?E.message:"The folder could not be read. Select it again."),k(!1)}};return(0,N.jsx)(q,{summary:"Add a skill",open:t,children:(0,N.jsxs)(K,{action:"/settings/skills/import",hiddenFields:e,"data-skill-import":"",onSubmit:j=>{Q(j)},children:[(0,N.jsx)(v,{label:"Add from",children:(0,N.jsx)(ge,{id:"skill-method",name:"method","aria-label":"Add from","data-skill-method":"",value:a,onChange:j=>i(j.target.value),items:[["paste","Paste SKILL.md"],["github","GitHub folder"],["folder","Local folder"]]})}),(0,N.jsx)("div",{"data-skill-input":"paste",hidden:a!=="paste",children:(0,N.jsx)(v,{label:"SKILL.md",variant:"top",children:(0,N.jsx)(je,{id:"skill-content",name:"content",rows:8,defaultValue:n.content??"",maxLength:24576,disabled:a!=="paste",placeholder:`---
3
+ name: design-review
4
+ description: Review interface copy and layout.
5
+ ---
6
+ Write your instructions here.`,"aria-label":"SKILL.md"})})}),(0,N.jsx)("div",{"data-skill-input":"github",hidden:a!=="github",children:(0,N.jsx)(v,{label:"Public GitHub folder",variant:"wide",children:(0,N.jsx)(le,{id:"skill-url",name:"url",type:"url",defaultValue:n.url??"",disabled:a!=="github",placeholder:"https://github.com/owner/repo/tree/main/skills/review","aria-label":"Public GitHub folder"})})}),(0,N.jsxs)("div",{"data-skill-input":"folder",hidden:a!=="folder",children:[(0,N.jsx)(v,{label:"Skill folder",hint:"Choose the folder containing SKILL.md. Up to 64 files, 1 MB total.",children:(0,N.jsx)("input",{ref:P,className:"k-input",id:"skill-folder",type:"file",multiple:!0,"data-skill-folder":"","aria-label":"Skill folder",disabled:a!=="folder",webkitdirectory:""})}),(0,N.jsx)("input",{ref:M,type:"hidden",name:"files",defaultValue:""})]}),(0,N.jsx)(h,{children:"Added to your library first. Review its source and requirements before enabling it."}),g===null?null:(0,N.jsx)("p",{className:"k-err","data-skill-error":"",role:"alert",children:g}),(0,N.jsx)(A,{children:(0,N.jsx)(C,{variant:"outline",type:"submit",label:"Add to library",disabled:p})})]})})}function lt({data:e}){let[n,t]=(0,Oe.useState)("");if(e.problem!==null)return(0,N.jsx)(X,{children:e.problem});let a={repo:e.repo,identity:e.identity,revision:String(e.revision)},i=n.trim().toLowerCase(),g=e.groups.filter(d=>i===""||d.query.toLowerCase().includes(i));return(0,N.jsxs)(u,{id:"library",title:"Library",lead:`${e.active?`${e.active} skill${e.active===1?"":"s"} reach${e.active===1?"es":""} new tasks in this project.`:"No skills reach new tasks in this project."} Active tasks keep their saved versions.`,children:[e.canManage?(0,N.jsx)(it,{base:a,draft:e.draft,open:!!e.draft.method}):null,e.groups.length>5?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(v,{label:"Search library",variant:"wide",children:(0,N.jsx)(le,{id:"skill-search",name:"skill-search",type:"search","data-skill-search":"",placeholder:"Name or description","aria-label":"Search library",value:n,onChange:d=>t(d.target.value)})}),g.length===0?(0,N.jsx)("p",{className:"k-note","data-skill-no-matches":"",children:"No matching skills."}):null]}):null,e.groups.length===0?(0,N.jsx)(h,{children:"Your library is empty. Add a skill to review and enable it here."}):e.groups.map(d=>(0,N.jsxs)("div",{"data-skill-group":"","data-skill-query":d.query,hidden:!g.includes(d),children:[(0,N.jsx)(Vs,{skill:d.primary,data:e,base:a}),d.older.length?(0,N.jsx)(q,{summary:`Other versions (${d.older.length})`,children:d.older.map(p=>(0,N.jsx)(Vs,{skill:p,data:e,base:a},p.sha))}):null]},d.name)),e.history.length?(0,N.jsx)(q,{summary:"Change history",children:e.history.map(d=>(0,N.jsx)(B,{title:`Selection ${d.revision}`,sub:d.enabled,when:`${d.actor} · ${d.at}`,action:e.canManage&&!d.current?(0,N.jsx)(G,{action:"/settings/skills/change",fields:{...a,action:"restore",restore:String(d.revision)},label:"Restore selection"}):(0,N.jsx)(h,{children:"Current selection"})},d.revision))}):null]})}var s=ue(Te(),1);function rt({view:e}){let n=e.askedSection?e.jump.find(t=>t.id===e.askedSection):void 0;return(0,s.jsxs)(H,{group:e.group,title:e.title,...e.lead!==void 0?{lead:e.lead}:{},sub:e.back!==void 0,...e.back!==void 0?{back:e.back}:{},children:[(0,s.jsx)(he,{said:e.said,problem:e.problem}),e.extraNotice?(0,s.jsx)(X,{children:e.extraNotice}):null,n?(0,s.jsx)("p",{className:"k-note",children:(0,s.jsxs)("a",{className:"k-link",href:`#${n.id}`,children:["Jump to ",n.title]})}):null,e.jump.length>1?(0,s.jsx)("nav",{className:"k-sjump","aria-label":"Sections",children:e.jump.map(t=>(0,s.jsxs)("a",{className:`k-sjump-item${e.askedSection===t.id?" is-active":""}`,href:`#${t.id}`,children:[(0,s.jsx)("span",{children:t.title}),t.state?(0,s.jsx)("span",{className:"k-muted",children:t.state}):null]},t.id))}):null,e.sections.map(t=>(0,s.jsx)(gn,{section:t,asked:e.askedSection===t.id},t.id))]})}function ot({view:e}){let[n,t]=(0,ee.useState)("standard");return(0,s.jsxs)(H,{group:"approval",title:"Operating mode",lead:"A signed, time-limited mode that lets more run without asking. It ends on its own. Scope changes, agent questions and requested revisions still wait for you.",sub:!0,back:"/settings/approval",children:[(0,s.jsx)(he,{said:e.said,problem:e.problem}),(0,s.jsx)(u,{id:"mode-now",title:"Now",children:e.live===null?(0,s.jsx)(v,{label:"Locked",hint:"No mode is signed: every plan and merge waits for a person. That is the default.",variant:"inline",children:(0,s.jsx)("span",{className:"k-muted",children:"No mode signed"})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"k-srecs",children:(0,s.jsx)(B,{title:(0,s.jsxs)(s.Fragment,{children:[e.name," ",(0,s.jsx)(ne,{word:e.live.name==="hands-off"?"Hands-off":"Standard",tone:"done"})]}),sub:`Signed by ${e.live.signedBy} · ends ${e.live.until}`,action:e.approver?(0,s.jsx)(G,{action:"/mode/revoke",label:"End this mode now"}):void 0})}),(0,s.jsx)("ul",{className:"k-note",children:e.live.words.map((a,i)=>(0,s.jsx)("li",{children:a},i))}),e.approver?(0,s.jsx)(h,{children:"Ending it is one click: every act it covered goes back to asking a person."}):null]})}),e.approver?(0,s.jsx)(u,{id:"mode-sign",title:e.live===null?`Sign a mode for ${e.name}`:`Replace it with a new mode for ${e.name}`,lead:"Choose what may run without asking. The next page shows every term in words, and your password signs exactly those.",children:(0,s.jsxs)(K,{action:"/mode/confirm",children:[(0,s.jsx)(v,{label:"Preset",variant:"wide",children:(0,s.jsx)(Ve,{name:"name",legend:"Preset",current:n,onChange:t,items:[{value:"standard",label:"Standard",text:"Approvals stay with you."},{value:"hands-off",label:"Hands-off",text:"Tasks you file approve themselves and run with full permissions."}]})}),(0,s.jsx)(v,{label:"Lasts",hint:`Days, from now: 1 to ${e.maxDays}.`,children:(0,s.jsx)(le,{id:"mode-days",name:"days",type:"number",defaultValue:"1",min:1,max:e.maxDays,"aria-label":"Lasts, in days"})}),(0,s.jsx)(v,{label:"Merges",hint:e.hasMergeGrant?void 0:"Merging by itself needs a merge grant on the project first.",children:(0,s.jsx)(ge,{name:"publication","aria-label":"Merges",defaultValue:"notify",items:[["notify","Wait for me"],...e.hasMergeGrant?[["automerge","Merge when CI passes on the exact commit"]]:[]]})}),(0,s.jsx)(v,{label:"Tasks I file",children:(0,s.jsx)(ge,{name:"auto-approve","aria-label":"Tasks I file",defaultValue:"",items:[["","The preset’s choice"],["1","Approve them as I file them"],["0","Wait for their own approval"]]})}),(0,s.jsx)(v,{label:"Plans",hint:"Needs tasks to approve as you file them. Changed scope and open questions still wait for you.",children:(0,s.jsx)(ge,{name:"plan-auto","aria-label":"Plans",defaultValue:"0",items:[["0","Wait for a person"],["1","Approve plans that keep what I filed"]]})}),(0,s.jsx)(v,{label:"Approving from a chat app",hint:"Plans that widen permissions, go past the attempt limit or touch protected paths still open Toolroll.",children:(0,s.jsx)(ge,{name:"chat-approve","aria-label":"Approving from a chat app",defaultValue:"",items:[["","Here, with my password"],["1","In my paired chat app, two taps"]]})}),(0,s.jsx)(v,{label:"Failed checks",hint:"A repair stays inside the plan you approved. When it can't, or the tries run out, it comes to you.",children:(0,s.jsx)(ge,{name:"repair-auto","aria-label":"Failed checks",defaultValue:"",items:[["","Wait for me to start a repair"],["1","Repair them, up to 2 tries"]]})}),(0,s.jsx)(A,{children:(0,s.jsx)(C,{variant:"primary",type:"submit",label:"Review the terms"})})]})}):(0,s.jsx)(h,{children:"An approver of this project signs its operating mode."})]})}function dt({view:e}){return(0,s.jsxs)(H,{group:"approval",title:`Sign the ${e.modeName} mode`,sub:!0,back:"/mode",children:[(0,s.jsx)(u,{id:"mode-terms",title:`What you sign for ${e.projectName}`,children:(0,s.jsx)("ul",{className:"k-ssec-lead",children:e.words.map((n,t)=>(0,s.jsx)("li",{children:n},t))})}),(0,s.jsx)(S,{form:{id:"mode-sign-form",proof:e.proof,action:"/mode/sign",native:!0,hidden:e.hiddenFields,save:{label:"Sign it"},confirm:`Sign the ${e.modeName} mode for ${e.projectName}`,fields:[]}}),(0,s.jsx)(h,{children:(0,s.jsx)("a",{className:"k-link",href:"/mode",children:"Back, and sign nothing"})})]})}function ct({view:e}){if(e.sub==="connection"&&e.connection){let t=e.connection;return(0,s.jsxs)(H,{group:"projects",title:"Connections",lead:t.summary,sub:!0,back:"/control",children:[(0,s.jsx)(u,{id:"providers",title:"Agents",children:(0,s.jsx)("div",{className:"k-srecs",children:t.providers.map(a=>(0,s.jsx)(B,{title:(0,s.jsxs)(s.Fragment,{children:[a.name," ",(0,s.jsx)(ne,{word:a.status})]}),sub:a.detail},a.id))})}),(0,s.jsx)(u,{id:"runners",title:"Builders",children:t.runners.length===0?(0,s.jsx)(h,{children:"No builders connected yet."}):(0,s.jsx)("div",{className:"k-srecs",children:t.runners.map(a=>(0,s.jsx)(B,{title:(0,s.jsxs)(s.Fragment,{children:[a.name," ",(0,s.jsx)(ne,{word:a.state})]}),sub:a.detail},a.name))})})]})}if(e.sub==="instructions-preview"&&e.instructionsPreview){let t=e.instructionsPreview;return(0,s.jsx)(H,{group:"projects",title:"Review agent instructions",sub:!0,back:"/control",children:(0,s.jsxs)(u,{id:"instructions-preview",title:t.skillPath,children:[(0,s.jsx)("pre",{className:"recap",children:t.content}),(0,s.jsx)(S,{form:{id:"instructions-approve-form",proof:"project-instructions",action:"/control/instructions-approve",native:!0,hidden:{repo:t.repo,nonce:t.nonce,fingerprint:t.fingerprint},save:{label:"Add these instructions"},confirm:"Add agent instructions",fields:[]}})]})})}if(e.sub==="setup-preview"&&e.setupPreview){let t=e.setupPreview;return(0,s.jsx)(H,{group:"projects",title:"Approve project setup",sub:!0,back:"/control",children:(0,s.jsxs)(u,{id:"setup-preview",title:"What changes",children:[(0,s.jsx)(xe,{rows:[["Provider",t.inputs.provider],["Model",t.inputs.model||"(preset default)"],["Check command",(0,s.jsx)(_,{children:t.inputs.command||"(none)"})],["Timeout (seconds)",t.inputs.seconds||"(default)"]]}),t.models?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h,{children:t.models.label}),(0,s.jsx)(xe,{rows:t.models.rows.map(a=>[a.role,(0,s.jsx)(_,{children:a.model})])})]}):null,(0,s.jsx)(S,{form:{id:"setup-approve-form",proof:"project-setup",action:"/control/setup-approve",native:!0,hidden:{repo:t.repo,nonce:t.nonce,fingerprint:t.fingerprint,provider:t.inputs.provider,model:t.inputs.model,command:t.inputs.command,seconds:t.inputs.seconds},save:{label:"Approve setup"},confirm:"Approve project setup",fields:[]}})]})})}let n=e.setup;return(0,s.jsxs)(H,{group:"projects",title:"Builder setup",lead:`Agent, model and preparation command for ${n.repoName}.`,sub:!0,back:"/settings/projects",children:[(0,s.jsx)(Ae,{action:"/control",projects:n.projects,chosen:n.repo}),n.connectionDetail?(0,s.jsx)(u,{id:"control-connection",title:"Connection",state:(0,s.jsx)(ne,{word:n.connectionState==="connected"?"Connected":n.connectionState==="unchecked"?"Not checked":n.connectionState??"Not checked",...n.connectionState==="connected"?{tone:"done"}:{}}),lead:n.connectionDetail,children:(0,s.jsx)(G,{action:"/settings/connection/check",fields:{provider:n.provider,return:`/control?provider=${encodeURIComponent(n.provider)}`},label:"Check again",acts:!0})}):null,(0,s.jsx)(u,{id:"control-setup",title:"Builder settings",children:(0,s.jsxs)(K,{action:"/control/setup-preview",hiddenFields:{repo:n.repo},children:[(0,s.jsx)(v,{label:"Agent",children:(0,s.jsx)(ge,{name:"provider","aria-label":"Agent",defaultValue:n.provider,items:n.providers})}),(0,s.jsx)(v,{label:"Model",children:(0,s.jsx)(le,{id:"control-model",name:"model",defaultValue:n.model})}),(0,s.jsx)(v,{label:"Check command",children:(0,s.jsx)(le,{id:"control-cmd",name:"command",defaultValue:n.command})}),(0,s.jsx)(v,{label:"Timeout (seconds)",children:(0,s.jsx)(le,{id:"control-sec",name:"seconds",type:"number",defaultValue:n.seconds})}),(0,s.jsxs)(A,{children:[(0,s.jsx)(C,{variant:"primary",type:"submit",label:"Review changes"}),(0,s.jsx)(z,{href:"/control/connection",variant:"ghost",label:"Check connections"})]})]})}),(0,s.jsxs)(u,{id:"control-instructions",title:"Agent instructions",children:[(0,s.jsx)(h,{children:n.instructionsInstalled?"Repository instructions are installed.":n.instructionsNote??"Add Toolroll workflow instructions to this repository."}),(0,s.jsx)(G,{action:"/control/instructions-preview",fields:{repo:n.repo},variant:"outline",label:"Preview instructions",acts:!0})]})]})}function ht({view:e,projects:n,repo:t,providerKeys:a,openrouter:i,advancedOn:g,said:d,problem:p}){let[k,w]=(0,ee.useState)(""),[P,M]=(0,ee.useState)(""),[Q,j]=(0,ee.useState)(""),[f,E]=(0,ee.useState)(""),[L,R]=(0,ee.useState)(""),[se,de]=(0,ee.useState)(""),[x,J]=(0,ee.useState)({}),[b,U]=(0,ee.useState)({}),[T,Y]=(0,ee.useState)(e.preview?.hidden.preset??e.presets.find(r=>r.inUse)?.name??""),O=k.trim().toLowerCase(),F=e.canManage,y=`/settings/models${e.scope.value==="installation"?"":`?scope=${encodeURIComponent(e.scope.value)}`}`,W=e.scope.value==="installation"?"":`&scope=${encodeURIComponent(e.scope.value)}`,Z=e.preview,we=F&&Z!==null&&Z.rows.length>0,fe=e.inUse===null?"a custom set":e.inUse,Se=e.roles.filter(r=>!r.tier),Ie=e.roles.filter(r=>r.tier),Ee="__custom__",Fe=r=>{if(!F)return(0,s.jsx)(v,{label:r.label,children:(0,s.jsx)("span",{children:r.words})},r.key);let me=r.current===""?"clear":r.current,$=x[r.key]??me,I=$.endsWith(`|${Ee}`),ae=I?$.slice(0,-(Ee.length+1)):null,pe=b[r.key]??"",be=r.groups.some(D=>D.options.some(oe=>`${D.provider}|${oe.value}`===r.current)),ve=r.groups.map(D=>{let oe=O!==""&&`${D.label} ${D.provider}`.toLowerCase().includes(O),Ke=D.options.filter(Ue=>O===""||oe||`${D.provider}|${Ue.value}`===$?!0:`${Ue.label} ${Ue.value} ${D.label} ${D.provider}`.toLowerCase().includes(O)),ns=O===""||oe||$===`${D.provider}|${Ee}`;return{...D,options:Ke,showCustom:ns}}).filter(D=>D.options.length>0||D.showCustom);return(0,s.jsx)(v,{label:r.label,hint:r.current===""?r.words:null,children:(0,s.jsxs)("div",{className:"models-role-ctl",children:[(0,s.jsx)("span",{className:"k-selw wide",children:(0,s.jsxs)("select",{className:"k-sel",id:`role-${r.key}`,...I?{}:{name:r.key},"aria-label":r.label,value:$,onChange:D=>J(oe=>({...oe,[r.key]:D.target.value})),children:[(0,s.jsx)("option",{value:"clear",children:r.unset}),!be&&r.current!==""?(0,s.jsxs)("option",{value:r.current,children:[r.words," · current"]}):null,ve.map(D=>(0,s.jsxs)("optgroup",{label:D.label,children:[D.options.map(oe=>(0,s.jsx)("option",{value:`${D.provider}|${oe.value}`,children:oe.label},`${D.provider}|${oe.value}`)),D.showCustom?(0,s.jsx)("option",{value:`${D.provider}|${Ee}`,children:D.options.length===0?"Enter model id…":"Other model…"}):null]},D.provider))]})}),I&&ae!==null?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("input",{type:"hidden",name:r.key,value:`${ae}|${pe.trim()}`}),(0,s.jsx)(le,{id:`role-${r.key}-custom`,"aria-label":`${r.label} model id`,placeholder:ae==="antigravity"?"Model id (e.g. gemini-4-neon)":"Exact model id",value:pe,onChange:D=>U(oe=>({...oe,[r.key]:D.target.value}))})]}):null]})},r.key)},V=e.suggested,He=r=>`/settings/models?scope=${encodeURIComponent(r)}`,Be=V?V.offers.length+(V.trialOffers??[]).length:0;return(0,s.jsxs)(H,{group:"agents",title:"Models",lead:"Which model plans, builds and reviews.",sub:!0,back:"/settings/agents",children:[(0,s.jsxs)("div",{className:"models",children:[(p??e.problem)!==null?(0,s.jsx)(X,{children:p??e.problem}):(d??e.said)!==null?(0,s.jsx)("p",{className:"k-note",role:"status",children:d??e.said}):null,(0,s.jsx)(Ae,{action:"/settings/models",projects:n,chosen:t,evenOne:!0}),F&&Z!==null?Z.rows.length===0?(0,s.jsxs)(u,{id:"preview",title:Z.title,children:[(0,s.jsx)("p",{className:"k-note",role:"status",children:"Already in use. Nothing would change."}),(0,s.jsx)(A,{children:(0,s.jsx)(z,{sm:!0,href:y,label:"Back"})})]}):(0,s.jsx)("div",{className:"models-diff",children:(0,s.jsxs)(u,{id:"preview",title:Z.title,children:[(0,s.jsx)(xe,{rows:Z.rows.map(r=>[r.role,(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(_,{children:r.before})," → ",(0,s.jsx)(_,{children:r.after}),r.notes.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"k-note",children:r.notes.join(" ")})]}):null]})])}),(0,s.jsxs)(K,{id:"models-apply",className:"models-editor",action:"/settings/models/apply",hiddenFields:Z.hidden,children:[(0,s.jsx)(h,{children:"Tasks filed from now on use these."}),(0,s.jsx)(ye,{proof:"models-apply",id:"models-apply-pw",value:P,onChange:M}),(0,s.jsxs)(A,{children:[(0,s.jsx)(C,{variant:"primary",docked:!0,type:"submit",label:`Apply ${Z.rows.length} change${Z.rows.length===1?"":"s"}`}),(0,s.jsx)(z,{variant:"ghost",href:y,label:"Cancel"})]})]})]})}):null,(0,s.jsxs)(u,{id:"choice",title:"Models for new tasks",state:`in use: ${fe}${e.scope.value==="installation"?"":` · ${e.scope.label}`}`,children:[e.scope.options.length>=2?(0,s.jsx)(v,{label:"Settings for",hint:"A project can follow these or choose its own.",children:(0,s.jsxs)("form",{method:"get",action:"/settings/models",className:"models-scope",children:[(0,s.jsx)("span",{className:"k-selw wide",children:(0,s.jsx)("select",{className:"k-sel",id:"models-scope",name:"scope","aria-label":"Settings for",defaultValue:e.scope.value,children:e.scope.options.map(r=>(0,s.jsx)("option",{value:r.value,children:r.label},r.value))})}),(0,s.jsx)(C,{sm:!0,type:"submit",label:"Show"})]})}):null,e.unresolved!==null?(0,s.jsx)(X,{children:`New tasks can't be filed here yet: ${e.unresolved}`}):null,F&&e.reroutable!==void 0&&!e.reroutable.fast&&e.reroutable.count>0?(()=>{let r=e.reroutable,me=r.replanCount;return(0,s.jsxs)(K,{id:"models-reroute",className:"models-editor",action:"/settings/models/apply",hiddenFields:{scope:e.scope.value,reroute:"1"},children:[(0,s.jsx)(Le,{children:`${r.count} waiting task${r.count===1?"":"s"} still use earlier models. Moving ${r.count===1?"it":"them"} to ${r.agentLabel} needs your approval again${me>0?` and re-plans ${me} drafted plan${me===1?"":"s"}`:""}.`}),(0,s.jsx)(ye,{proof:"models-apply",id:"models-reroute-pw",value:Q,onChange:j}),(0,s.jsx)(A,{children:(0,s.jsx)(C,{type:"submit",label:`Re-route ${r.count} task${r.count===1?"":"s"}`})})]})})():null,F?(0,s.jsxs)("form",{method:"get",action:"/settings/models",className:"models-presets",id:"models-preset",children:[e.scope.value!=="installation"?(0,s.jsx)("input",{type:"hidden",name:"scope",value:e.scope.value}):null,(0,s.jsx)(Ve,{name:"preset",legend:"Preset",current:T,onChange:Y,items:e.presets.map(r=>({value:r.name,label:r.label,text:`${r.words}${r.recommended?" Recommended.":""}${r.inUse?" In use.":""}`}))}),(0,s.jsx)(A,{children:(0,s.jsx)(C,{variant:we||T===""?"outline":"primary",docked:!we&&T!=="",type:"submit",label:"Review changes"})})]}):(0,s.jsx)(xe,{rows:e.presets.map(r=>[r.label,`${r.words}${r.inUse?" In use.":""}`])}),e.newer.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"k-grp",children:"Newer models"}),e.newer.map(r=>(0,s.jsx)(v,{label:r.name,hint:`Newer than ${r.from}, used by ${r.roles}.`,variant:"inline",children:F?(0,s.jsx)(z,{sm:!0,href:`/settings/models?switch=${encodeURIComponent(r.from)}&to=${encodeURIComponent(r.to)}${W}`,label:"Switch to it"}):null},`${r.from}->${r.to}`))]}):null,(0,s.jsxs)(q,{summary:"Model for each role",children:[(0,s.jsx)(ke,{label:"Filter models",children:r=>(0,s.jsx)(le,{id:r.id,name:"filter",placeholder:"Filter by model name or provider…",value:k,onChange:me=>w(me.target.value)})}),F?(0,s.jsxs)(K,{action:"/settings/models/agent",className:"models-editor",hiddenFields:{scope:e.scope.value,digest:e.scope.digest},children:[Se.map(Fe),Ie.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"k-grp",children:"By task size"}),Ie.map(Fe)]}):null,(0,s.jsx)(h,{children:e.reroutable?.fast?"Waiting tasks move to these models and need your approval again. Running and claimed tasks keep theirs.":"Waiting, running and claimed tasks keep the models they were filed with until you re-route them."}),(0,s.jsx)(ye,{proof:"models-agent",id:"models-agent-pw",value:f,onChange:E}),(0,s.jsx)(A,{children:(0,s.jsx)(C,{type:"submit",label:"Save models"})})]}):(0,s.jsxs)("div",{className:"models-editor",children:[Se.map(Fe),Ie.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"k-grp",children:"By task size"}),Ie.map(Fe)]}):null]})]}),(0,s.jsx)(q,{summary:"How tasks are sized",children:(0,s.jsxs)("div",{className:"models-sizing",children:[(0,s.jsxs)("p",{children:["Each task is sized once, when it is filed. ",e.sizing.classifier," If it doesn't answer within 5 seconds, the size comes from the description."]}),(0,s.jsx)(xe,{rows:[["Small",`${e.sizing.small}. Built by the builder for small tasks, with no plan.`],["Routine",`${e.sizing.routine}. Planned and built by the planner and builder for routine tasks.`],["Large or risky",`Large: ${e.sizing.large}. Risky: ${e.sizing.risky} Planned and built by the large or risky models.`]]}),(0,s.jsx)("p",{children:e.routing}),(0,s.jsx)("p",{children:"Changing a model never re-sizes a task, and running or claimed tasks keep their sealed route. One exception: an older build review saved without its own route uses the reviewer set here now."}),e.waiting.length>0?(0,s.jsxs)("p",{children:[e.waiting.length," plan",e.waiting.length===1?"":"s"," waiting for approval keep the models they were filed with:"," ",e.waiting.map((r,me)=>(0,s.jsxs)(ee.default.Fragment,{children:[me>0?", ":null,(0,s.jsx)("a",{className:"k-link",href:`/t/${encodeURIComponent(r.taskId)}`,children:r.title})]},r.taskId)),"."]}):null]})})]}),V!==void 0?(0,s.jsxs)(u,{id:"suggested",title:"Suggested",state:Be===0?void 0:`${Be} to review`,children:[V.review!==null?"stale"in V.review?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(X,{children:"This suggestion is out of date: its results, a price or Models changed since. Nothing was saved."}),(0,s.jsx)(A,{children:(0,s.jsx)(z,{sm:!0,href:`${He(V.review.repo)}#models-suggested`,label:"Back"})})]}):(0,s.jsxs)("div",{className:"models-diff",children:[(0,s.jsx)(xe,{rows:[["Change",V.review.title],["Evidence",Gs(V.review.evidence)],["Prices",V.review.prices],["Switches back",Gs(V.review.terms)]]}),F?(0,s.jsxs)(K,{action:"/settings/models/accept",className:"models-editor",hiddenFields:{scope:V.review.repo,id:V.review.id},children:[(0,s.jsx)(h,{children:"Every task is still approved, and keeps the model it was approved with."}),(0,s.jsx)(ye,{proof:"models-rules",id:"models-accept-pw",value:L,onChange:R}),(0,s.jsxs)(A,{children:[(0,s.jsx)(C,{variant:"primary",type:"submit",label:V.review.save}),(0,s.jsx)(z,{variant:"ghost",href:`${He(V.review.repo)}#models-suggested`,label:"Cancel"})]})]}):null]}):null,V.offers.length===0&&V.rules.length===0&&(V.trialOffers??[]).length===0&&(V.trials??[]).length===0&&V.review===null?(0,s.jsx)(h,{children:V.repo===null?"No suggestions yet. Choose a project above to see its own.":"No suggestions yet. When a cheaper model's results on this project's small or routine tasks match the configured model's, it's suggested here."}):null,V.offers.map(r=>(0,s.jsx)(v,{label:V.repo===null?`${r.title} · ${r.project}`:r.title,hint:r.words,variant:"top",children:F?(0,s.jsxs)(A,{children:[(0,s.jsx)(z,{sm:!0,href:`${He(r.repo)}&suggestion=${encodeURIComponent(r.id)}#models-suggested`,label:"Review change"}),(0,s.jsx)(G,{action:"/settings/models/not-now",fields:{scope:r.repo,id:r.id},variant:"ghost",label:"Not now"})]}):null},r.id)),(V.trialOffers??[]).map(r=>(0,s.jsx)(v,{label:V.repo===null?`${r.title} · ${r.project}`:r.title,hint:r.words,variant:"top",children:F?(0,s.jsxs)(A,{children:[(0,s.jsxs)(K,{action:"/settings/models/try",hiddenFields:{scope:r.repo,id:r.id},children:[(0,s.jsx)(ye,{proof:"models-rules",value:L,onChange:R}),(0,s.jsx)(C,{sm:!0,type:"submit",label:r.save})]}),(0,s.jsx)(G,{action:"/settings/models/not-now",fields:{scope:r.repo,id:r.id},variant:"ghost",label:"Not now"})]}):null},r.id)),V.rules.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"k-grp",children:"Rules in use"}),V.rules.map(r=>(0,s.jsx)(v,{label:V.repo===null?`${r.title} · ${r.project}`:r.title,hint:r.words,variant:"top",children:!F||r.state==="ended"?null:r.state==="paused"?(0,s.jsxs)(A,{children:[(0,s.jsxs)(K,{action:"/settings/models/keep",hiddenFields:{scope:r.repo,rule:String(r.id)},children:[(0,s.jsx)(ye,{proof:"models-rules",value:L,onChange:R}),(0,s.jsx)(C,{sm:!0,type:"submit",label:"Keep"})]}),(0,s.jsx)(G,{action:"/settings/models/turn-off",fields:{scope:r.repo,rule:String(r.id)},variant:"ghost",label:"Drop"})]}):(0,s.jsx)(G,{action:"/settings/models/turn-off",fields:{scope:r.repo,rule:String(r.id)},label:"Turn off"})},r.id))]}):null,(V.trials??[]).length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"k-grp",children:"Trials"}),(V.trials??[]).map(r=>(0,s.jsx)(v,{label:V.repo===null?`${r.title} · ${r.project}`:r.title,hint:r.words,variant:"top",children:!F||!r.live?null:(0,s.jsx)(G,{action:"/settings/models/stop",fields:{scope:r.repo,rule:String(r.id)},label:"Stop"})},r.id))]}):null,V.suggest!==null&&V.repo!==null?(0,s.jsx)(v,{label:"Suggest cheaper models",hint:V.suggest.on?"On. When a cheaper model does as well on this project's small or routine tasks, it's suggested here. Nothing changes until you accept it.":"Off. No new suggestions for this project.",variant:"inline",children:F?V.suggest.on?(0,s.jsx)(G,{action:"/settings/models/suggest-off",fields:{scope:V.repo},label:"Turn off"}):(0,s.jsxs)(K,{action:"/settings/models/suggest-on",hiddenFields:{scope:V.repo},children:[(0,s.jsx)(ye,{proof:"models-rules",id:"models-suggest-pw",value:se,onChange:de}),(0,s.jsx)(C,{sm:!0,type:"submit",label:"Turn on"})]}):null}):null]}):null,e.recent.length>0?(0,s.jsx)(u,{id:"recent",title:"Recent work",children:e.recent.map((r,me)=>(0,s.jsx)(v,{label:r.role,hint:r.ranOn==="not reported"?`Set to ${r.chosen} · actual model not reported`:`Set to ${r.chosen} → ran on ${r.ranOn}`,variant:"inline",children:(0,s.jsx)("a",{className:"k-link k-mono",href:`/t/${encodeURIComponent(r.taskId)}`,children:r.taskId})},`${r.taskId}-${me}`))}):null,e.acpCheck?(0,s.jsx)(pt,{acpCheck:e.acpCheck,csrf:e.csrf,canManage:F,defaultRepo:e.scope.value!=="installation"?e.scope.value:e.acpCheck.projects[0]?.repo??""}):null,(0,s.jsxs)(u,{id:"tools",title:"AI tools on this computer",children:[e.runtimes.length===0?(0,s.jsx)(h,{children:"No Claude, Codex or Gemini CLI found on this computer yet."}):e.runtimes.map(r=>{let me=r.installed===null?"Version unknown":r.behind?`${r.installed} · ${r.latest} available`:`${r.installed} · up to date`;return(0,s.jsx)(v,{label:r.name,hint:r.problem===null?me:`${me} · ${r.problem}`,variant:"inline",children:F&&r.behind&&r.updateCommand!==null?(0,s.jsx)(G,{action:"/settings/models/update",fields:{tool:r.tool},label:`Update ${r.name}`}):r.behind?(0,s.jsx)("span",{className:"k-note",children:"Update it the way you installed it"}):null},r.tool)}),F?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v,{label:"Check for new versions",hint:`Checked ${e.watch.checkedAt??"never"}.`,variant:"inline",children:(0,s.jsx)(G,{action:"/settings/models/check",label:"Check now"})}),(0,s.jsx)(v,{label:"Automatic checks",hint:`${e.watch.enabled?"On":"Off"}. Every 6 hours, with a message when a new model or CLI update appears. Uses public lists and sends nothing about you or your projects.`,variant:"inline",children:(0,s.jsx)(G,{action:"/settings/models/watch",fields:{enabled:e.watch.enabled?"0":"1"},label:e.watch.enabled?"Turn off":"Turn on"})})]}):(0,s.jsxs)(h,{children:["Checked ",e.watch.checkedAt??"never","."]})]}),e.fresh.length>0?(0,s.jsx)(u,{id:"new",title:"New models",children:e.fresh.map(r=>(0,s.jsx)(v,{label:r.name,hint:`${r.inputUsd===null&&r.outputUsd===null?"price not listed":`$${r.inputUsd??0} / $${r.outputUsd??0} per 1M tokens`}${r.releasedAt===null?"":` · released ${r.releasedAt.slice(0,10)}`}`,variant:"inline",children:(0,s.jsx)(ne,{word:"New"})},r.id))}):null,e.chat!==null?(0,s.jsx)(v,{label:"Chat",hint:e.chat.words,variant:"inline",children:(0,s.jsx)(z,{sm:!0,variant:"ghost",href:"/settings/lead",label:"Change"})}):null,g&&a.length>0?(0,s.jsx)(u,{id:"models-providers",title:"Provider status",children:(0,s.jsx)("div",{className:"k-srecs",children:a.map(r=>(0,s.jsx)(B,{title:(0,s.jsxs)(s.Fragment,{children:[r.name," ",(0,s.jsx)(ne,{word:r.statusWords,tone:r.statusTone==="ok"?"done":r.statusTone==="bad"?"failed":""})]}),sub:r.detail},r.provider))})}):null,i&&i.configured?(0,s.jsxs)(u,{id:"openrouter-models",title:"OpenRouter models",children:[i.note?(0,s.jsx)(h,{children:i.note}):null,(0,s.jsx)("div",{className:"k-srecs",children:i.models.filter(r=>O===""?!0:`${r.label} ${r.id}`.toLowerCase().includes(O)).map(r=>(0,s.jsx)(B,{title:(0,s.jsxs)(s.Fragment,{children:[r.label," ",i.pinnedModel===r.id?(0,s.jsx)(ne,{word:"Active",tone:"done"}):null]}),sub:`${r.id} · ${r.context} · ${r.price}`},r.id))})]}):null]}),F&&we?(0,s.jsx)(ze,{children:(0,s.jsx)(C,{variant:"primary",type:"submit",form:"models-apply",label:`Apply ${Z.rows.length} change${Z.rows.length===1?"":"s"}`})}):F&&!we?(0,s.jsx)(ze,{children:(0,s.jsx)(C,{variant:"primary",type:"submit",form:"models-preset",label:"Review changes"})}):null]})}function pt({acpCheck:e,csrf:n,canManage:t,defaultRepo:a}){let i=e.agents.find(y=>y.id==="antigravity")??e.agents[0],[g,d]=(0,ee.useState)(i?.id??"antigravity"),[p,k]=(0,ee.useState)(i?.defaultModel??""),[w,P]=(0,ee.useState)(e.runners[0]??""),[M,Q]=(0,ee.useState)(a),[j,f]=(0,ee.useState)(i?.billing??"subscription"),[E,L]=(0,ee.useState)(""),[R,se]=(0,ee.useState)(!1),[de,x]=(0,ee.useState)(null),[J,b]=(0,ee.useState)(null),[U,T]=(0,ee.useState)(null),Y=e.agents.find(y=>y.id===g)??i,O=y=>{d(y);let W=e.agents.find(Z=>Z.id===y);W&&(k(W.defaultModel),f(W.billing)),b(null),T(null)},F=async y=>{let W=y??j;y!==void 0&&f(y),se(!0),x(null),b(null),T(null);try{let Z=new URLSearchParams({csrf:n,provider:g,model:p.trim(),billing:W,...w!==""?{runner:w}:{},...M!==""?{repo:M}:{},...e.needsPassword?{password:E}:{}}),we=await fetch("/engine/agents/attest",{method:"POST",credentials:"same-origin",headers:We({"content-type":"application/x-www-form-urlencoded",accept:"application/json"}),body:Z.toString()}),fe=await we.json();if(we.ok&&fe.ok){let Se=fe.billing==="subscription"?"Subscription":"Metered";x(`Check #${fe.id} queued for ${Y?.name??g} · ${p.trim()} (${Se}).`),L("")}else b(fe.error??"Check agent could not start."),T(fe.recovery??null)}catch{b("Could not reach Toolroll to start Check agent.")}finally{se(!1)}};return(0,s.jsxs)(u,{id:"check-agent",title:"Check agent",lead:"Verify an agent on this computer and declare how its model is billed.",children:[de!==null?(0,s.jsx)(Le,{children:de}):null,J!==null?(0,s.jsxs)("div",{className:"k-form","data-check-agent-error":"",children:[(0,s.jsx)(X,{children:J}),U!==null?(0,s.jsxs)(A,{children:[U.switchBilling==="subscription"?(0,s.jsx)(C,{sm:!0,type:"button",label:"Switch to Subscription and check",busy:R?"Checking…":!1,disabled:R,onClick:()=>{F("subscription")}}):null,(0,s.jsx)(z,{sm:!0,variant:"ghost",href:U.spendHref,label:"Open Spend"})]}):null]}):null,t?e.runners.length===0?(0,s.jsx)(h,{children:"No computer is connected to run checks yet."}):(0,s.jsxs)("form",{className:"k-form","data-check-agent-form":"",onSubmit:y=>{y.preventDefault(),F()},children:[(0,s.jsx)(ke,{label:"Agent",children:({id:y})=>(0,s.jsx)(ge,{id:y,name:"provider",wide:!0,value:g,onChange:W=>O(W.target.value),items:e.agents.map(W=>[W.id,W.name])})}),(0,s.jsx)(ke,{label:"Model",...Y&&Y.models.length>0?{hint:`Known models: ${Y.models.slice(0,4).join(", ")}`}:{},children:({id:y})=>(0,s.jsx)(le,{id:y,name:"model",value:p,onChange:W=>k(W.target.value),required:!0,placeholder:"gemini-4-neon",autoCapitalize:"none",spellCheck:!1})}),e.runners.length>1?(0,s.jsx)(ke,{label:"Computer",children:({id:y})=>(0,s.jsx)(ge,{id:y,name:"runner",wide:!0,value:w,onChange:W=>P(W.target.value),items:e.runners.map(W=>[W,W])})}):null,e.projects.length>0?(0,s.jsx)(ke,{label:"Project network",children:({id:y})=>(0,s.jsx)(ge,{id:y,name:"repo",wide:!0,value:M,onChange:W=>Q(W.target.value),items:e.projects.map(W=>[W.repo,W.name])})}):null,(0,s.jsx)(Ve,{name:"billing",legend:"Billing",current:j,onChange:y=>f(y==="metered"?"metered":"subscription"),items:[{value:"subscription",label:"Subscription",text:"Included in your plan. No dollar cap needed."},{value:"metered",label:"Metered",text:"Billed by usage under your Spend caps."}]}),e.needsPassword?(0,s.jsx)(ke,{label:"Password",children:({id:y})=>(0,s.jsx)(le,{id:y,name:"password",type:"password",value:E,onChange:W=>L(W.target.value),required:!0,autoComplete:"current-password"})}):null,(0,s.jsx)(A,{children:(0,s.jsx)(C,{type:"submit",label:"Check agent",busy:R?"Checking…":!1,disabled:R||p.trim()===""})})]}):null,e.recent.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"k-grp",children:"Recent checks"}),e.recent.map(y=>(0,s.jsx)(v,{label:`${y.name} · ${y.model}`,hint:y.result??`${y.runner} · ${y.state}`,variant:"inline",children:(0,s.jsxs)(A,{children:[(0,s.jsx)(ne,{word:y.state==="passed"?"Passed":y.state==="failed"?"Failed":y.state==="running"?"Running":"Queued",tone:y.state==="passed"?"done":y.state==="failed"?"failed":y.state==="running"?"live":""}),y.budgetRefusal?(0,s.jsx)(z,{sm:!0,variant:"ghost",href:"/spend",label:"Open Spend"}):null]})},y.id))]}):null]})}var Gs=e=>e.map((n,t)=>(0,s.jsxs)(ee.default.Fragment,{children:[t>0?(0,s.jsx)("br",{}):null,(0,s.jsx)("span",{children:n})]},t)),Ye=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");function Ys(e){return e.transport==="http"?`${e.url}${e.bearer===null?"":` (signs in with ${e.bearer})`}`:[e.command,...e.args].map(n=>/^[A-Za-z0-9@%+=:,./_-]+$/.test(n??"")?n:JSON.stringify(n)).join(" ")}function ut(e,n){let t=e.spec.secrets.filter(a=>!a.optional&&!n.includes(a.name)).map(a=>a.name);return t.length>0?{ready:!1,words:`Needs ${t.join(", ")}`}:e.lastTest===null?{ready:!0,words:"Not tested yet"}:e.lastTest.ok?{ready:!0,words:`Working · ${e.lastTest.tools.length} tool${e.lastTest.tools.length===1?"":"s"}`}:{ready:!1,words:"Last test failed"}}function mt(e,n){let t=(n.includes("OAUTH_REFRESH_TOKEN")||n.includes("OAUTH_ACCESS_TOKEN"))&&n.includes("OAUTH_CLIENT_ID");return e.secrets.every(a=>a.optional&&!n.includes(a.name))?{mode:"no-key",words:"No key needed",detail:null}:on(e)&&t?{mode:"run-token",words:"Short-lived token per run",detail:"Each run gets its own access token when it starts, revoked or left to expire when it ends. The refresh token stays with Toolroll."}:e.secrets.some(a=>!a.optional&&!n.includes(a.name))?null:{mode:"held-key",words:"Key held by Toolroll",detail:"Runs reach this tool through Toolroll, which adds the key. The key never enters a build."}}function gt({view:e,projects:n,canManage:t=!0,said:a,problem:i}){let g=t,d={repo:e.repo,shown:e.repo},p=` to ${e.project}`,k=e.storage===void 0||e.storage.filesOnly?"Secrets stay on this computer":e.storage.words.replace(/\.$/,""),w=g&&e.connections.length>0,P=w&&e.wanted!==null&&e.connections.some(j=>j.id===e.wanted)&&!!i,M=[...e.connections.filter(j=>j.id===e.wanted),...e.connections.filter(j=>j.id!==e.wanted)],Q=e.connections.filter(j=>j.state==="connected").flatMap(j=>(e.others??[]).filter(f=>f.open.includes(j.id)).map(f=>({conn:j,other:f})));return(0,s.jsxs)(H,{group:"projects",title:"Tools",lead:`What builds can use in ${e.project}.`,sub:!0,back:"/settings/projects",children:[P?null:(0,s.jsx)(he,{said:a,problem:i}),(0,s.jsx)(Ae,{action:"/settings/tools",projects:n,chosen:e.repo,evenOne:!0}),(0,s.jsxs)(u,{id:"tools",title:`Tools in ${e.project}`,lead:`Builds in ${e.project} use exactly these tools. MCP servers set up elsewhere on this computer aren't used.`,children:[e.storage?.problem!==void 0?(0,s.jsx)(X,{children:e.storage.problem}):null,e.tools.length===0?(0,s.jsx)(h,{children:"No tools yet. Builds in this project get none."}):(0,s.jsx)("div",{className:"k-srecs",children:e.tools.map(j=>{let{tool:f,secretsSet:E}=j,L=ut(f,E),R=mt(f.spec,E),se=e.connections.find(J=>J.id===f.name&&J.state==="connected")?.research??null,de=f.lastTest?.ok?`${f.lastTest.at.slice(0,16).replace("T"," ")} UTC: ${f.lastTest.tools.join(", ")||"it lists no tools"}`:null,x=Ys(f.spec);return(0,s.jsx)(B,{id:`tool-${f.name}`,"data-ready":String(L.ready),title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{children:f.name})," ",(0,s.jsx)(ne,{word:L.words,tone:L.ready?"done":""})]}),sub:(0,s.jsxs)(s.Fragment,{children:[f.spec.about,R===null?null:(0,s.jsxs)(s.Fragment,{children:[" · ",(0,s.jsx)("span",{"data-credential":R.mode,children:R.words})]})]}),action:g?(0,s.jsx)(G,{action:"/settings/tools/change",fields:{...d,action:"test",name:f.name},"aria-label":`Test ${f.name} in ${e.project}`,label:"Test"}):null,children:(0,s.jsxs)(s.Fragment,{children:[f.lastTest!==null&&!f.lastTest.ok?(0,s.jsx)(X,{children:f.lastTest.problem??"The last test failed."}):null,se!==null?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Le,{children:se}),g?(0,s.jsx)(S,{form:{id:`reconnect-${Ye(f.name)}`,proof:"tools-connect",action:"/settings/tools/connect",native:!0,hidden:{...d,service:f.name,access:"read"},save:{label:"Reconnect read-only",variant:"outline"},confirm:`Reconnect ${f.name} read-only for ${e.project}`,fields:[]}}):null]}):null,g&&!on(f.spec)?f.spec.secrets.map(J=>{let b=E.includes(J.name),U=`secret-${Ye(f.name)}-${Ye(J.name)}`;return(0,s.jsx)(q,{summary:b?`Replace ${J.name}`:`Set ${J.name}${J.optional?" (optional)":""}`,children:(0,s.jsx)(S,{form:{id:U,proof:"tools-change",action:"/settings/tools/change",gate:!0,hidden:{...d,action:"secret",name:f.name,secret:J.name},save:{label:`Save ${J.name}`},confirm:`Set ${J.name} for ${f.name} in ${e.project}`,fields:[]},children:(0,s.jsx)(v,{label:J.name,hint:"Stored privately on this computer and never shown again.",children:(0,s.jsx)(le,{id:`${U}-value`,type:"password",name:"value",autoComplete:"off",spellCheck:!1,autoCapitalize:"none","data-so-secret":"","data-1p-ignore":"","data-lpignore":"true","data-bwignore":"","data-form-type":"other",required:!0,"aria-label":J.name})})})},J.name)}):null,(0,s.jsx)(q,{summary:"Details",children:(0,s.jsx)(xe,{rows:[...R?.detail==null?[]:[["Keys",R.detail]],["Starts",(0,s.jsx)(_,{children:x})],["Added",`From ${f.source} · by ${f.createdBy}`],...de===null?[]:[["Last test",de]]]})}),g?(0,s.jsx)(G,{action:"/settings/tools/change",fields:{...d,action:"remove",name:f.name},variant:"danger",label:`Remove from ${e.project}`,acts:!0}):null]})},f.name)})}),(0,s.jsxs)("ul",{className:"k-note",children:[(0,s.jsx)("li",{children:"Adding or removing a tool takes it away from every build right away."}),(0,s.jsxs)("li",{children:[k,", are never shown again, and go only to the tool that needs them."]}),(0,s.jsx)("li",{children:"Reviewers and the lead chat never get tools. Gemini builds don't use tools yet."})]})]}),w?(0,s.jsx)(u,{id:"connect",title:`Connect${p}`,lead:"Sign in on the service's own page. Toolroll asks for your password once you pick one.",children:(0,s.jsx)("div",{className:"k-srecs",children:M.map(j=>{let f=j.state==="connected";if(j.state==="taken")return(0,s.jsx)(B,{id:`connect-${j.id}`,"data-state":j.state,title:j.label,sub:"Added another way"},j.id);let E=f?j.local?"Connect again":"Sign in again":"Connect",L=f&&!j.local?`Sign in to ${j.label} again for ${e.project}`:`Connect ${j.label}${p}`;return(0,s.jsx)(B,{id:`connect-${j.id}`,"data-state":j.state,title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{children:j.label})," ",f?(0,s.jsx)(ne,{word:"Connected",tone:"done"}):null]}),sub:f?"":j.about,action:(0,s.jsx)(S,{form:{id:`connect-${j.id}-form`,proof:"tools-connect",action:"/settings/tools/connect",native:!0,hidden:{...d,...e.kit===null?{}:{kit:e.kit},service:j.id},save:{label:E,variant:j.id===e.wanted?"primary":"outline"},confirm:L,fields:[]}}),children:j.id===e.wanted&&P?(0,s.jsxs)("p",{className:"k-notice",id:"connect-problem",role:"alert",tabIndex:-1,autoFocus:!0,children:[(0,s.jsx)(Je,{name:"alert",small:!0}),(0,s.jsx)("span",{children:i})]}):null},j.id)})})}):null,w&&Q.length>0?(0,s.jsx)(u,{id:"connect-elsewhere",title:"Also connect to another project",lead:"Signs in again for that project. Tokens are never copied between projects.",children:Q.map(({conn:j,other:f})=>(0,s.jsx)(S,{form:{id:`also-${Ye(j.id)}-${Ye(f.project)}`,proof:"tools-connect",action:"/settings/tools/connect",native:!0,hidden:{...d,...e.kit===null?{}:{kit:e.kit},also:`${j.id}:${f.repo}`},save:{label:`Also connect ${j.label} to ${f.project}`,variant:"outline"},confirm:`Connect ${j.label} to ${f.project}`,fields:[]}},`${j.id}:${f.repo}`))}):null,g?(0,s.jsxs)(u,{id:"add",title:"Add a tool",children:[e.catalog.length>0?(0,s.jsx)(S,{form:{id:"tools-add-catalog",proof:"tools-change",action:"/settings/tools/change",hidden:{...d,action:"add-catalog"},save:{label:`Add${p}`,variant:"outline"},confirm:`Add a tool${p}`,fields:[{kind:"select",id:"tools-catalog",name:"catalog",label:"Common tools",current:e.catalog[0]?.name??"",layout:"wide",items:e.catalog.map(j=>[j.name,`${j.label}: ${j.about}`])}]}}):null,(0,s.jsx)(q,{summary:"Add your own",children:(0,s.jsx)(S,{form:{id:"tools-add-custom",proof:"tools-change",action:"/settings/tools/change",hidden:{...d,action:"add-custom"},save:{label:`Add${p}`,variant:"outline"},confirm:`Add your own tool${p}`,fields:[{kind:"input",id:"tools-custom-name",name:"name",label:"Name",hint:"Lowercase letters, numbers, - and _.",placeholder:"for example: postgres",required:!0},{kind:"select",id:"tools-custom-transport",name:"transport",label:"It runs as",current:"stdio",items:[["stdio","A program on this computer"],["http","A web address"]]},{kind:"input",id:"tools-custom-target",name:"target",label:"Command or address",placeholder:"npx -y some-mcp-server@1.2.3, or https://…",required:!0,layout:"wide"},{kind:"input",id:"tools-custom-secrets",name:"secrets",label:"Secrets it needs",hint:"Names, comma separated. For a web address, the first one is sent as its sign-in token. Set each value after adding.",placeholder:"for example: DATABASE_URL"}]}})})]}):null,g&&e.found.length>0?(0,s.jsx)(u,{id:"found",title:"Found on this computer",state:` · ${e.found.length}`,lead:"MCP servers your other apps use. Adding one copies its settings, and any secrets it has, into this project.",children:(0,s.jsx)(S,{form:{id:"tools-import",proof:"tools-change",action:"/settings/tools/change",hidden:{...d,action:"import"},save:{label:`Add selected${p}`,variant:"outline"},confirm:`Add tools found on this computer${p}`,fields:[]},children:(0,s.jsxs)("fieldset",{className:"k-sopts",children:[(0,s.jsx)("legend",{className:"k-sr",children:"Found on this computer"}),e.found.map(j=>(0,s.jsxs)("label",{className:"k-sopt",children:[(0,s.jsx)("input",{type:"checkbox",name:"import",value:j.spec.name}),(0,s.jsxs)("span",{children:[(0,s.jsx)("b",{children:j.spec.name}),(0,s.jsxs)("span",{children:[j.source," · ",(0,s.jsx)(_,{children:Ys(j.spec)}),j.spec.secrets.length===0?"":` · brings ${j.spec.secrets.map(f=>f.name).join(", ")}`]})]})]},j.spec.name))]})})}):null]})}var Xe="Project deletion is on hold after recovery. Earlier check execution is unverified.",Ks="Tasks scoped from now on use this; tasks already approved keep what they were approved with.",_s="Flexible: people here can start interactive agent threads right away, without a plan approved first. A thread's changes reach the project only when you Ship them and the project's checks pass.",ms={supervised:"Supervised",auto:"Auto",full:"Full access"},zs=["supervised","auto","full"],Js={"sign-ins":"This project's checks can read your Claude, Codex and GitHub sign-ins, even where the project hides your home folder's files from builds. Its tests could use or send those credentials anywhere its network setting allows. Only choose this for projects you trust.",unsandboxed:"This project's checks get your full access to this machine and to Toolroll itself, including its database and every sign-in. Only for a project whose checks must create sandboxes themselves, such as Toolroll's own."};function jt(e){let n=(t,a,i=`${a}s`)=>`${t} ${t===1?a:i}`;return[n(e.tasks,"task"),...e.versions>0?[n(e.versions,"version")]:[],n(e.runs,"run"),...e.evidence>0?[n(e.evidence,"evidence file")]:[],...e.checkouts>0?[n(e.checkouts,"checkout")]:[],...e.branches?[n(e.branches,"branch","branches")]:[],...e.chats>0?[n(e.chats,"chat")]:[],...e.flows>0?[`${n(e.flows,"flow")} with ${n(e.cards,"card")}`]:[],...e.subagents>0?[n(e.subagents,"subagent")]:[],...e.budgets>0?[n(e.budgets,"budget")]:[],...e.settings>0?[n(e.settings,"setting")]:[]].join(", ")}function xt({mode:e="main",deleteProblem:n=null,view:t,projects:a,networkRequest:i,canRemove:g,advancedOn:d=!0,sandboxEngineWords:p="Anthropic's sandbox-runtime",fallbackLines:k=[],flexibleSummary:w=null,missingSignInHosts:P=[],said:M,problem:Q}){if(e==="delete-confirm"){let b=t.holdings,U=(Y,O,F=`${O}s`)=>`${Y} ${Y===1?O:F}`,T=[`${U(b.tasks,"task")}${b.versions>0?` and ${U(b.versions,"version")}`:""}, with ${U(b.runs,"run")} and their evidence`,"The checkouts and branches Toolroll made",...b.chats>0?[U(b.chats,"chat")]:[],...b.flows>0?[`${U(b.flows,"flow")} and ${U(b.cards,"card")}`]:[],...b.subagents>0?[U(b.subagents,"subagent")]:[],"Its budgets, settings and knowledge"];return(0,s.jsxs)(H,{group:"projects",title:t.name,lead:t.repo,sub:!0,back:`/settings/project?repo=${encodeURIComponent(t.repo)}`,children:[(0,s.jsxs)("h2",{className:"k-same",children:["Delete ",t.name,"?"]}),n!==null?(0,s.jsx)(X,{children:n}):null,(0,s.jsxs)(u,{id:"delete",title:"This removes",children:[(0,s.jsx)("ul",{className:"k-note",children:T.map((Y,O)=>(0,s.jsx)("li",{children:Y},O))}),(0,s.jsxs)(h,{children:["The repository at ",(0,s.jsx)(_,{children:t.repo})," and its own branches stay. The ledger keeps its history. There's no undo."]}),(0,s.jsx)(S,{form:{id:"delete-form",proof:"project-delete",action:"/settings/project/delete",native:!0,hidden:{repo:t.repo,name:t.name,step:"delete"},save:{label:"Delete project",variant:"danger"},confirm:`Delete ${t.name}`,fields:[]},children:(0,s.jsx)(A,{children:(0,s.jsx)(z,{sm:!0,variant:"ghost",href:`/settings/project?repo=${encodeURIComponent(t.repo)}`,label:"Cancel"})})})]})]})}let j=t.canDelete&&t.running.includes(Xe)&&Q===Xe,f=t.network?.setting??(i?{mode:i.mode,loopback:i.loopback,hosts:[...i.hosts]}:null),E=t.network?.canChange??i?.canChange??!1,L=t.network?.requests?.map(b=>({id:b.id,repo:b.repo,requester:b.requester,why:b.why,digest:b.digest,words:b.words,termsJson:JSON.stringify({id:b.id,repo:b.repo,change:b.change,before:b.before,after:b.after,digest:b.digest,words:b.words})}))??i?.pending??[],R=t.checkAccess,se={sandboxed:"Sandboxed","sign-ins":"Sandboxed, with model and GitHub sign-ins",unsandboxed:"Not sandboxed"},de={sandboxed:null,"sign-ins":"Checks can read your Claude, Codex and GitHub sign-ins.",unsandboxed:"Checks run with your full access to this machine and to Toolroll."},x=()=>{if(!R)return null;let b=R.setting,U=R.signInsUnavailable??null,T=U!==null&&b==="sign-ins"?"sandboxed":b,Y=P,O=R.unconfinedHere===!0,F=O?"unsandboxed":T,y=f?.mode==="open",W=(Z,we,fe)=>{let Se=(Z===T||R.canWiden||Z==="sandboxed")&&!(Z==="sign-ins"&&U!==null);return(0,s.jsxs)("label",{className:"k-opt",children:[(0,s.jsx)("input",{type:"radio",name:"level",value:Z,defaultChecked:T===Z,disabled:!Se}),(0,s.jsxs)("span",{children:[(0,s.jsx)("b",{children:se[Z]}),(0,s.jsx)("span",{children:we}),fe!==null?(0,s.jsx)("span",{"data-check-access-warning":Z,children:fe}):null]})]},Z)};return(0,s.jsxs)(u,{id:"check-access",title:"Check access",state:` · ${se[F]}`,lead:O?void 0:de[T]??void 0,children:[O?(0,s.jsxs)(s.Fragment,{children:[b!=="unsandboxed"?(0,s.jsxs)("p",{className:"k-note","data-saved-level":"",children:["Saved as ",se[b],"."]}):null,(0,s.jsx)("p",{className:"k-note","data-unconfined-here":"",children:"This machine can't sandbox checks, so they run without a sandbox whatever is chosen here."})]}):(0,s.jsxs)(s.Fragment,{children:[T!==b?(0,s.jsx)("p",{className:"k-note","data-sign-ins-unavailable":"",children:"Saved with model and GitHub sign-ins, but checks run sandboxed: sign-ins can't be shared with checks safely yet."}):null,Y.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{className:"k-note","data-sign-in-hosts":"",children:[Y.length," sign-in ",Y.length===1?"host isn't":"hosts aren't"," allowed yet ·"," ",(0,s.jsx)("a",{className:"k-link",href:"#network",children:"Add them"})]}),(0,s.jsx)(q,{summary:"Show hosts",children:(0,s.jsx)("p",{className:"k-note k-mono",children:Y.join(", ")})})]}):null]}),R.changed!==null?(0,s.jsxs)(h,{children:["Changed by ",R.changed.by,","," ",new Date(R.changed.at).toLocaleDateString("en-GB",{day:"numeric",month:"short",timeZone:"UTC"})]}):null,R.canNarrow||R.canWiden?(0,s.jsx)(q,{summary:"Change",children:(0,s.jsxs)(S,{form:{id:"check-access-form",proof:R.canWiden?"project-check-access-widen":"project-check-access",action:"/settings/project/check-access",gate:!0,hidden:{repo:t.repo},fields:[]},children:[(0,s.jsx)(v,{label:"How far checks reach",variant:"wide",children:(0,s.jsxs)("fieldset",{className:"k-radios",children:[(0,s.jsx)("legend",{className:"k-sr",children:"Check access"}),W("sandboxed","Reads your home folder, as in Anthropic's sandbox runtime, except the folders this project hides (Home folder, above). Never Toolroll's folders or other tasks' work.",null),U!==null?W("sign-ins",U,null):W("sign-ins",`Also reads the files your Claude, Codex and GitHub sign-ins are kept in, on this project's network (${y?"any host":f===null||f.hosts.length===0?"registries only":`registries and ${f.hosts.length} ${f.hosts.length===1?"host":"hosts"}`}).`,Js["sign-ins"]),W("unsandboxed","For projects whose checks create sandboxes themselves, such as Toolroll's own.",Js.unsandboxed)]})}),y&&U===null?(0,s.jsxs)("label",{className:"k-opt",children:[(0,s.jsx)("input",{type:"checkbox",name:"confirm-open",value:"yes"}),(0,s.jsxs)("span",{children:[(0,s.jsx)("b",{children:"The network is open"}),(0,s.jsx)("span",{children:"With sign-ins, checks could send them to any host."})]})]}):null,(0,s.jsxs)(h,{children:[R.canWiden?"":"Only an instance operator can widen this. ","Flow script steps always run sandboxed. Tasks already approved keep their level."]})]})}):null]})},J=()=>{let b=t.flexible;if(!b)return null;let U=b.standing,T=U.state==="on"?U.terms:"terms"in b.proposal?b.proposal.terms:null,Y=(w?.termsLines??[]).length>0?(0,s.jsx)("ul",{className:"k-note",children:w.termsLines.map((y,W)=>(0,s.jsx)("li",{children:y},W))}):null,O=y=>"problem"in b.proposal?(0,s.jsx)(h,{children:b.proposal.problem}):(0,s.jsxs)(S,{form:{id:"flexible-on",proof:"project-flexible",action:"/settings/project/flexible",native:!0,hidden:{repo:t.repo,action:"enable",digest:b.proposal.digest},save:{label:y},confirm:"Turn on Flexible",fields:[]},children:[Y,(0,s.jsx)(h,{children:"Turning this on asks for your password, every time."})]}),F=y=>{let W=y===null?[]:zs.slice(0,zs.indexOf(y));return(0,s.jsxs)(s.Fragment,{children:[W.length>0?(0,s.jsxs)(K,{action:"/settings/project/flexible",hiddenFields:{repo:t.repo,action:"lower"},children:[(0,s.jsx)(v,{label:"Highest level",variant:"inline",children:(0,s.jsx)(ge,{id:"flexible-max",name:"max",sm:!0,defaultValue:W[W.length-1],items:W.map(Z=>[Z,ms[Z]??Z])})}),(0,s.jsx)(A,{children:(0,s.jsx)(C,{sm:!0,type:"submit",label:"Lower"})})]}):null,(0,s.jsx)(G,{action:"/settings/project/flexible",fields:{repo:t.repo,action:"off"},label:"Turn off Flexible",acts:!0})]})};return U.state==="secure"?(0,s.jsx)(u,{id:"flexible",title:"How work starts",state:" · Secure",lead:`Work is planned and approved before it starts. ${_s}`,children:b.canChange?(0,s.jsx)(q,{summary:"Turn on Flexible",children:O("Turn on Flexible")}):(0,s.jsx)(h,{children:"An approver for this project can change this."})}):U.state==="unreadable"?(0,s.jsxs)(u,{id:"flexible",title:"How work starts",state:" · Unavailable",children:[(0,s.jsx)(X,{children:"This project's Flexible terms can't be read, so they allow nothing."}),b.canChange?F(null):(0,s.jsx)(h,{children:"An approver for this project can change this."})]}):U.state==="lapsed"?(0,s.jsxs)(u,{id:"flexible",title:"How work starts",state:" · Flexible terms ended",children:[(0,s.jsx)(X,{children:`${w?.lapseWords??"Flexible terms ended."} No new Flexible threads start.`}),b.canChange?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(q,{summary:"Turn on again",children:O("Turn on again")}),F(null)]}):(0,s.jsx)(h,{children:"An approver for this project can change this."})]}):(0,s.jsxs)(u,{id:"flexible",title:"How work starts",state:` · Flexible, up to ${ms[U.terms.max]??U.terms.max}`,lead:`${_s} Threads start at ${ms[U.terms.default]??U.terms.default}. Turned on by ${U.signedBy}.`,children:[(0,s.jsx)(q,{summary:"Terms",children:Y}),b.canChange?F(T?.max??null):(0,s.jsx)(h,{children:"An approver for this project can change this."})]})};return(0,s.jsxs)(H,{group:"projects",title:t.name,lead:t.repo,sub:!0,back:"/settings/projects",children:[(0,s.jsx)(he,{said:M,problem:j?null:Q}),(0,s.jsx)(Ae,{action:"/settings/project",projects:a,chosen:t.repo}),(0,s.jsxs)(u,{id:"project",title:t.name,lead:(0,s.jsx)(_,{children:t.repo}),children:[(0,s.jsxs)(h,{children:["Toolroll holds ",jt(t.holdings)," for this project."]}),(0,s.jsx)(v,{label:"Recorded remote",hint:t.remoteUrl?null:"None. Landed work waits for your review.",variant:t.remoteUrl?"wide":"inline",children:t.remoteUrl?(0,s.jsx)(_,{children:t.remoteUrl}):null}),(0,s.jsxs)(q,{summary:"Change remote",children:[(0,s.jsx)(h,{children:"An owner or instance operator can run:"}),(0,s.jsx)("code",{className:"k-codeline",children:"toolroll repos add <project> --remote <url>"})]})]}),J(),t.builds?(0,s.jsx)(u,{id:"builds-at-once",title:"Builds at once",state:t.builds.canChange?void 0:` · Up to ${t.builds.setting}`,children:t.builds.canChange?(0,s.jsx)(K,{action:"/settings/project/concurrency",hiddenFields:{repo:t.repo},children:(0,s.jsxs)(v,{label:"Builds at once",hint:`${t.builds.building} building now.${t.builds.capacity!==null&&t.builds.capacity<t.builds.setting?` Its builder runs ${t.builds.capacity} at once, so ${t.builds.capacity} for now.`:""}`,variant:"inline",children:[(0,s.jsx)(le,{id:"builds-at-once-n",name:"concurrency",type:"number",defaultValue:String(t.builds.setting),min:1,max:64,step:"1",inputMode:"numeric","aria-label":"Builds at once"}),(0,s.jsx)(C,{sm:!0,type:"submit",label:"Save"})]})}):(0,s.jsxs)(h,{children:[t.builds.building," building now.",t.builds.capacity!==null&&t.builds.capacity<t.builds.setting?` Its builder runs ${t.builds.capacity} at once, so ${t.builds.capacity} for now.`:""]})}):null,t.access?(0,s.jsxs)(u,{id:"build-access",title:"Build access",lead:"problem"in t.access?void 0:(()=>{let b=t.access.tools.filter(U=>U.loads);return b.length===0?"Builds work in their task's folder, with no extra tools.":(0,s.jsxs)(s.Fragment,{children:["Builds work in their task's folder, with ",b.length===1?"one tool":`${b.length} tools`,":"," ",b.map((U,T)=>(0,s.jsxs)(ee.default.Fragment,{children:[T>0?", ":null,(0,s.jsx)(_,{children:U.name})]},U.name)),"."]})})(),children:["problem"in t.access?(0,s.jsx)(X,{children:t.access.problem}):null,(0,s.jsx)(q,{summary:"Details",children:(0,s.jsxs)("ul",{className:"k-note",children:[(0,s.jsx)("li",{children:"Your other projects, keys and sign-in files are out of reach."}),(0,s.jsx)("li",{children:"Your own Claude and Codex hooks, plugins and MCP servers don't load."}),(0,s.jsx)("li",{children:"Builds sign in with your existing Claude or Codex login."}),"tools"in t.access?t.access.tools.map(b=>(0,s.jsxs)("li",{children:[(0,s.jsx)(_,{children:b.name})," · ",b.words]},b.name)):null]})}),(0,s.jsx)(A,{children:(0,s.jsx)(z,{sm:!0,href:`/settings/tools?repo=${encodeURIComponent(t.repo)}`,label:"Manage tools"})})]}):null,f?(0,s.jsxs)(u,{id:"network",title:"Network",state:f.mode==="open"?" · Open":void 0,lead:f.mode==="open"?"Builds may reach any host.":(0,s.jsxs)(s.Fragment,{children:["Builds reach their agent's provider and the package registries this project uses",f.hosts.length>0?(0,s.jsxs)(s.Fragment,{children:[", and ",(0,s.jsx)(_,{children:f.hosts.join(", ")})]}):null,". Everything else is refused."]}),children:[E&&L.length>0?L.map(b=>(0,s.jsxs)("div",{"data-agent-request":b.id,"data-agent-request-digest":b.digest,"data-agent-request-terms":b.termsJson,children:[(0,s.jsxs)("p",{className:"k-note",children:[(0,s.jsxs)("b",{children:[b.requester," asks:"]})," ",b.words.join(" · ")]}),b.why!==""?(0,s.jsxs)(h,{children:["Why: ",b.why]}):null,(0,s.jsx)(S,{form:{id:`network-request-${b.id}`,proof:"project-network",action:"/settings/project/network",hidden:{repo:b.repo,request:b.id,digest:b.digest},save:{label:"Approve"},fields:[]}})]},b.id)):null,(0,s.jsx)(h,{children:f.loopback==="any"?"On a Mac, builds may reach this Mac's local services: test servers, and anything else listening here.":"On a Mac, builds reach no local services. A project whose tests start a local server needs them on."}),(0,s.jsx)(h,{children:"Codex's own command sandbox runs offline unless the network is Open with Full access; use Worktree setup to install dependencies before a Codex build starts."}),E?(0,s.jsx)(q,{summary:"Change",children:(0,s.jsxs)(S,{form:{id:"network-form",proof:"project-network",action:"/settings/project/network",gate:!0,hidden:{repo:t.repo},fields:[]},children:[(0,s.jsx)(v,{label:"This Mac's local services",hint:"Local test servers work, and so does anything else listening on this Mac (a local database, a dev proxy). Linux builds always have local services of their own.",variant:"inline",children:(0,s.jsx)(Me,{id:"network-local",name:"local",label:"Allowed",defaultChecked:f.loopback==="any",value:"any","aria-label":"Builds may reach this Mac's local services"})}),(0,s.jsx)(v,{label:"Other hosts builds may reach",hint:"One per line.",variant:"top",children:(0,s.jsx)(je,{id:"network-hosts",name:"hosts",defaultValue:f.hosts.join(`
7
+ `),rows:3,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,placeholder:`api.stripe.com
8
+ *.example.com`,"aria-label":"Other hosts builds may reach"})}),(0,s.jsx)(v,{label:"Open",hint:"Builds may reach any host.",variant:"inline",children:(0,s.jsx)(Me,{id:"network-open",name:"mode",label:"Open",defaultChecked:f.mode==="open",value:"open","aria-label":"Open: builds may reach any host"})}),(0,s.jsx)(h,{children:"Idle tasks in this project then wait for your Approve to use the change; a running task keeps its network."})]})}):(0,s.jsx)(h,{children:"An approver for this project can change this."})]}):null,t.fallback&&(d||t.fallback.setting!==null)?(0,s.jsxs)(u,{id:"fallback",title:"Fallback agents",state:t.fallback.setting===null?void 0:` · ${t.fallback.setting.entries.length}`,lead:t.fallback.setting===null?"When an agent runs out of its plan, the task stops.":"When an agent runs out of its plan, the work moves to the next agent here.",children:[k.map((b,U)=>(0,s.jsx)(h,{children:b},U)),t.fallback.canChange?(0,s.jsx)(q,{summary:"Change",children:(0,s.jsxs)(S,{form:{id:"fallback-form",proof:"project-fallback",action:"/settings/project/fallback",gate:!0,hidden:{repo:t.repo},fields:[]},children:[(0,s.jsx)(v,{label:"Agents, in order",hint:"One per line: provider:model:plan or provider:model:api-key. Empty turns this off.",variant:"top",children:(0,s.jsx)(je,{id:"fallback-agents",name:"agents",defaultValue:t.fallback.setting===null?"":t.fallback.setting.entries.map(b=>`${b.provider}:${b.model}:${b.authMode==="subscription"?"plan":"api-key"}`).join(`
9
+ `),rows:3,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"codex:gpt-5.6:plan","aria-label":"Fallback agents, in order"})}),(0,s.jsx)(v,{label:"Paid fallback",hint:"An agent on an API key spends money. It runs only while this is on.",variant:"inline",children:(0,s.jsx)(Me,{id:"fallback-paid",name:"paid",label:"Allowed",defaultChecked:t.fallback.setting?.paidGrant!=null,value:"on","aria-label":"Allow paid fallback agents to spend"})}),(0,s.jsx)(h,{children:"Tasks scoped from now on use this; tasks already approved keep the chain they were approved with."})]})}):(0,s.jsx)(h,{children:"An approver for this project can change this."})]}):null,t.writes?(0,s.jsx)(u,{id:"writes",title:"Where builds write",state:t.writes.setting==="workspace"?" · Only their workspace":" · Anywhere",lead:t.writes.setting==="workspace"?"Builds write only their own checkout, its caches and its temp folder. Your shell profile, login items, agent settings and the repository's Git config and hooks stay as they are.":"Builds may write anywhere outside Toolroll's own folders, your credentials and other projects.",children:t.writes.canChange?(0,s.jsx)(q,{summary:"Change",children:(0,s.jsx)(S,{form:{id:"writes-form",proof:"project-writes",action:"/settings/project/writes",gate:!0,hidden:{repo:t.repo},fields:[{kind:"radios",name:"writes",legend:"Where builds write",current:t.writes.setting,layout:"wide",items:[{value:"workspace",label:"Only their workspace (recommended)",text:"The checkout and its Git data, the project's own package caches, the build's temp folder, and what its agent needs to keep its session."},{value:"anywhere",label:"Anywhere outside Toolroll's fenced folders",text:"For a project whose tools must write elsewhere in your home folder or the shared temp folder. Credentials, Toolroll's own folders and other projects stay fenced."}]}]},children:(0,s.jsx)(h,{children:Ks})})}):(0,s.jsx)(h,{children:"An approver for this project can change this."})}):null,t.sandbox?(0,s.jsxs)(u,{id:"sandbox",title:"Home folder",lead:t.sandbox.setting.readDeny.length===0?"Builds and checks can read your home folder, as in Anthropic's sandbox runtime. Toolroll's own folders stay out of reach; other tasks' work is read, never written.":`Builds and checks can read your home folder except ${t.sandbox.setting.readDeny.length===1?t.sandbox.setting.readDeny[0]:`${t.sandbox.setting.readDeny.length} paths`}.`,children:[t.sandbox.setting.machLookup.length>0?(0,s.jsxs)(h,{children:[t.sandbox.setting.machLookup.length," macOS"," ",t.sandbox.setting.machLookup.length===1?"service":"services"," allowed"]}):null,(0,s.jsxs)("p",{className:"k-note","data-sandbox-engine":"",children:["Builds, checks and flows run in ",p,"."]}),t.sandbox.canChange?(0,s.jsx)(q,{summary:"Change",children:(0,s.jsxs)(S,{form:{id:"sandbox-form",proof:"project-sandbox",action:"/settings/project/sandbox",gate:!0,hidden:{repo:t.repo},fields:[]},children:[(0,s.jsx)(v,{label:"Paths builds can't read",hint:"One per line: ~/… or a full path.",variant:"top",children:(0,s.jsx)(je,{id:"sandbox-read-deny",name:"read-deny",defaultValue:t.sandbox.setting.readDeny.join(`
10
+ `),rows:4,placeholder:`~/.ssh
11
+ ~/.aws`,"aria-label":"Paths builds can't read"})}),(0,s.jsx)(q,{summary:"Advanced",children:(0,s.jsx)(v,{label:"macOS services builds may also use",variant:"top",children:(0,s.jsx)(je,{id:"sandbox-mach",name:"mach",defaultValue:t.sandbox.setting.machLookup.join(`
12
+ `),rows:2,"aria-label":"macOS services builds may also use"})})}),(0,s.jsx)(h,{children:Ks})]})}):(0,s.jsx)(h,{children:"An approver for this project can change this."})]}):null,x(),t.liveView&&(d||t.liveView.commands)?(0,s.jsx)(u,{id:"live-view",title:"Live view",state:(0,s.jsxs)("span",{"data-live-view-setting":t.liveView.commands?"commands":"base",children:[" · ",t.liveView.commands?"Commands shown":"Commands hidden"]}),lead:t.liveView.commands?"Commands and their output show in the live view of this project's agents. Secrets are hidden where they're recognised, which isn't guaranteed.":"Commands are hidden in the live view. You see which files an agent reads and edits, but not the commands it runs or their output.",children:t.liveView.canChange?t.liveView.commands?(0,s.jsxs)(K,{action:"/settings/project/live-view",hiddenFields:{repo:t.repo,act:"off"},children:[(0,s.jsx)(h,{children:"From the next run."}),(0,s.jsx)(A,{children:(0,s.jsx)(C,{sm:!0,type:"submit",label:"Hide commands"})})]}):(0,s.jsx)(S,{form:{id:"live-view-form",proof:"project-live-view",action:"/settings/project/live-view",hidden:{repo:t.repo,act:"on",nonce:t.liveView.nonce??""},save:{label:"Show commands",variant:"outline"},confirm:"Show this project's commands in the live view",fields:[]},children:(0,s.jsx)(h,{children:"Output can include secrets the filter misses. Turn this on only where you're happy for anyone who can see this project to read it. From the next run."})}):(0,s.jsx)(h,{children:"An approver for this project can change this."})}):null,t.codeMap?(0,s.jsxs)(u,{id:"code-map",title:"Code map",lead:t.codeMap.on?"Toolroll makes a map of main and gives it to builds.":"Off. No new maps are made, and builds get none.",children:[(0,s.jsx)("p",{children:(0,s.jsx)("a",{className:"k-link",href:t.codeMap.href,children:"Open code map"})}),(0,s.jsx)(G,{action:"/settings/project/code-map",fields:{repo:t.repo,on:t.codeMap.on?"0":"1"},label:t.codeMap.on?"Turn off":"Turn on",acts:!0}),t.codeMap.enrollUntil!==null?(0,s.jsx)(v,{label:"Holdout",hint:`About half of new builds run without the map until ${t.codeMap.enrollUntil.slice(0,10)}, to measure whether it helps.`,variant:"inline",children:t.codeMap.canEndHoldout?(0,s.jsx)(G,{action:"/settings/project/code-map/holdout",fields:{repo:t.repo},label:"End holdout"}):null}):null]}):null,t.canDelete||g?(0,s.jsxs)(u,{id:"remove",title:"Remove or delete",children:[(0,s.jsx)(v,{label:"Remove from Toolroll",hint:"Its tasks and results stay saved. Add it again to bring it back.",variant:"inline",children:(0,s.jsx)(G,{action:"/projects/remove",fields:{repo:t.repo},label:"Remove from Toolroll"})}),t.canDelete?(0,s.jsx)(q,{summary:"Delete project",open:!!Q,children:t.running.includes(Xe)?(0,s.jsx)(X,{children:Xe}):t.running.length>0?(0,s.jsx)(X,{children:`Its work is running: ${t.running.join(", ")}. Stop it before deleting the project.`}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(h,{children:["Removes everything Toolroll holds for ",t.name,". The repository and its own branches stay. There's no undo."]}),(0,s.jsxs)(K,{action:"/settings/project/delete",hiddenFields:{repo:t.repo},children:[(0,s.jsx)(v,{label:`Type ${t.name} to continue`,children:(0,s.jsx)(le,{id:"delete-name",name:"name",autoComplete:"off",autoCapitalize:"off",spellCheck:!1,required:!0,"aria-label":`Type ${t.name} to continue`})}),(0,s.jsx)(A,{children:(0,s.jsx)(C,{sm:!0,variant:"danger",type:"submit",label:"Continue"})})]})]})}):null]}):(0,s.jsx)(h,{children:"An instance operator can remove or delete a project."})]})}function ft({title:e,lead:n,action:t,projects:a}){return(0,s.jsx)(H,{group:"projects",title:e,lead:n,sub:!0,children:(0,s.jsx)(u,{id:"choose-project",title:"Choose a project",children:(0,s.jsx)(Ae,{action:t,projects:a,chosen:"",evenOne:!0})})})}function bt({rules:e,said:n,problem:t}){let a=e.rules.updatedBy===null?"":` · changed by ${e.rules.updatedBy} on ${(e.rules.updatedAt??"").slice(0,10)}`;if(!e.canChange)return(0,s.jsxs)(u,{id:"rules",title:`Approval rules · ${e.name}`,state:a,children:[(0,s.jsx)(h,{children:e.summary}),(0,s.jsx)(h,{children:"An instance operator sets these."})]});let i=e.rules.protectProject?"project":e.rules.protectedPaths.length>0?"paths":"none";return(0,s.jsx)(u,{id:"rules",title:`Approval rules · ${e.name}`,state:a,lead:e.summary,children:(0,s.jsxs)(S,{form:{id:"rules-form",proof:"approval",action:"/settings/approval",gate:!0,hidden:{repo:e.repo},confirm:"Change approval rules",said:n,problem:t,fields:[]},children:[(0,s.jsx)(v,{label:"Someone other than the requester",hint:"The person who filed a task, or asked for a revision, can’t approve it. Operating modes stop approving their signer’s own filings here.",variant:"inline",children:(0,s.jsx)(Me,{id:"rules-not-requester",name:"not_requester",label:"Required",defaultChecked:e.rules.notRequester,value:"1","aria-label":"Someone other than the requester"})}),(0,s.jsx)(v,{label:"Protected work",hint:"Changes here always wait for two people, never a subagent or an operating mode.",variant:"wide",children:(0,s.jsx)(Qs,{name:"protect",legend:"Protected work",initial:i,items:[{value:"none",label:"Nothing protected",text:"One approval is enough."},{value:"project",label:"The whole project",text:"Every task needs two different people to approve the same scope."},{value:"paths",label:"Only these paths",text:"Tasks that touch them, or don’t say what they touch, need two people."}]})}),(0,s.jsx)(v,{label:"Protected paths",hint:"One per line. Used when “Only these paths” is chosen.",variant:"top",children:(0,s.jsx)(je,{id:"rules-paths",name:"paths",defaultValue:e.rules.protectedPaths.join(`
13
+ `),rows:3,spellCheck:!1,placeholder:`infra/**
14
+ migrations/**`,"aria-label":"Protected paths"})}),e.approvers<2?(0,s.jsx)(h,{children:`Only ${e.approvers===1?"one person":"no one"} can approve on this project, so protected work would wait for a second approver. Add one in People first.`}):null]})})}function vt({release:e}){let n=e.setBy===null?"":` · changed by ${e.setBy} on ${(e.at??"").slice(0,10)}`,t=e.auto?"Releases approve themselves once the pull request’s CI and the release check pass on the exact commit. Anything red still asks you.":"Every release waits for your approval.";return e.canChange?(0,s.jsxs)(u,{id:"release-approval",title:"Releases",state:n,lead:t,children:[(0,s.jsx)(S,{form:{id:"release-form",proof:"release-approval",action:"/settings/release-approval",gate:!0,hidden:{repo:e.repo},proofWhen:["action","auto"],confirm:"Approve releases automatically",fields:[{kind:"radios",name:"action",legend:"Releases",hint:"Turning this on asks for your password, every time, even in Fast mode.",current:e.auto?"auto":"ask",items:[{value:"ask",label:"Ask me",text:"A release deploys only after you approve it with your passkey."},{value:"auto",label:"Approve automatically when checks pass",text:"You’re told when a release approves itself. A failed check, red CI or a CI failure after the deploy still stops and asks you."}]}]}}),(0,s.jsx)(K,{action:"/release/start",hiddenFields:{repo:e.repo},className:"k-form","data-release-start-form":"",children:(0,s.jsx)(A,{children:(0,s.jsx)(C,{sm:!0,variant:"outline",type:"submit",label:"Start release"})})})]}):(0,s.jsxs)(u,{id:"release-approval",title:"Releases",state:n,children:[(0,s.jsx)(h,{children:t}),(0,s.jsx)(h,{children:"An approver of this project sets this."})]})}function kt({facts:e,projects:n,chosen:t,rules:a,release:i,mode:g,advanced:d,said:p,problem:k}){return(0,s.jsxs)(H,{group:"approval",title:"Approvals and safety",lead:"How much runs without asking, and who approves the rest.",children:[(0,s.jsx)(he,{said:e.said,problem:e.problem}),e.permission!==null||e.quality!==null?(0,s.jsxs)(u,{id:"defaults",title:"Defaults for new tasks",lead:"Approved tasks keep their own setting.",children:[e.permission!==null?e.permission.canManage?(0,s.jsx)(S,{form:{id:"permission-form",proof:"permission-default",action:"/settings/permission-default",gate:!0,proofWhen:["permission-mode","bypassPermissions"],said:e.permission.changed,confirm:"Start new tasks with Full access",fields:[{kind:"radios",name:"permission-mode",legend:"Unattended permissions",hint:"Full access lets builds run any command without asking. Choosing it asks for your password.",current:e.permission.mode,items:[{value:"auto",label:"Auto",text:"Asks before risky actions."},{value:"bypassPermissions",label:"Full access",text:"Never asks and can change files anywhere on this computer. Trusted repositories only."}]}]}}):(0,s.jsx)(v,{label:"Unattended permissions",hint:"An approver can change this.",variant:"inline",children:(0,s.jsx)("span",{children:e.permission.mode==="bypassPermissions"?"Full access":"Auto"})}):null,e.quality!==null?e.quality.canManage?(0,s.jsx)(S,{form:{id:"quality-form",proof:"quality-default",action:"/settings/quality-default",gate:!0,said:e.quality.changed,fields:[{kind:"radios",name:"quality-mode",legend:"Quality",hint:"Publishing and deploying still need their own approval.",current:e.quality.mode,items:[{value:"default",label:"Default",text:"Everyday agents and the repository check."},{value:"strict",label:"Strict / release",text:"Strongest agents. Release approval stays separate."}]}]}}):(0,s.jsx)(v,{label:"Quality",hint:"An approver can change this.",variant:"inline",children:(0,s.jsx)("span",{children:Xs(e.quality.mode)})}):null]}):null,t===""?(0,s.jsx)(u,{id:"rules",title:"Approval rules",children:(0,s.jsx)(h,{children:"Add a project to set its approval rules."})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Ae,{action:"/settings/approval",projects:n,chosen:t}),(0,s.jsx)(bt,{rules:a,said:p,problem:k}),i!==null?(0,s.jsx)(vt,{release:i}):null]}),(0,s.jsxs)(h,{children:[(0,s.jsx)("b",{children:"Which setting wins:"})," protected work and policy limits always apply; then a project’s operating mode; then these defaults."]}),(0,s.jsxs)("nav",{className:"k-slinks","aria-label":"In this group",children:[d===void 0||d.on||d.modeActive?(0,s.jsxs)("a",{className:"k-slink",href:"/mode",children:[(0,s.jsxs)("span",{className:"k-slink-body",children:[(0,s.jsx)("span",{className:"k-slink-t",children:"Operating mode"}),(0,s.jsx)("span",{className:"k-slink-s",children:g})]}),(0,s.jsx)("span",{className:"k-slink-arr",children:"›"})]}):null,d===void 0||d.on||(d.policy??null)!==null?(0,s.jsxs)("a",{className:"k-slink",href:"/settings/policy",children:[(0,s.jsxs)("span",{className:"k-slink-body",children:[(0,s.jsx)("span",{className:"k-slink-t",children:"Policy"}),(0,s.jsx)("span",{className:"k-slink-s",children:d?.policy??"Limits no task can go past, whatever its mode or approver"})]}),(0,s.jsx)("span",{className:"k-slink-arr",children:"›"})]}):null,(0,s.jsxs)("a",{className:"k-slink",href:"/caps",children:[(0,s.jsxs)("span",{className:"k-slink-body",children:[(0,s.jsx)("span",{className:"k-slink-t",children:"Requirements"}),(0,s.jsx)("span",{className:"k-slink-s",children:"What builders are missing for waiting work"})]}),(0,s.jsx)("span",{className:"k-slink-arr",children:"›"})]}),(0,s.jsxs)("a",{className:"k-slink",href:"/settings/projects",children:[(0,s.jsxs)("span",{className:"k-slink-body",children:[(0,s.jsx)("span",{className:"k-slink-t",children:"Network, writes and sandbox"}),(0,s.jsx)("span",{className:"k-slink-s",children:"Set for each project"})]}),(0,s.jsx)("span",{className:"k-slink-arr",children:"›"})]})]})]})}function wt({view:e,said:n,problem:t}){let[a,i]=(0,ee.useState)(e.journal),[g,d]=(0,ee.useState)(e.running);(0,ee.useEffect)(()=>{if(!e.active&&!g)return;let w=!1,P=setInterval(()=>{fetch("/settings/updates?format=status").then(M=>M.ok?M.json():null).then(M=>{w||!M||(M.journal!==void 0&&i(M.journal),M.running!==void 0&&d(M.running),M.done&&clearInterval(P))}).catch(()=>{})},1500);return()=>{w=!0,clearInterval(P)}},[e.active,g]);let p="version"in e.latest&&e.latest.version!==e.current?e.latest.version:null,k="version"in e.latest?p!==null?`Toolroll ${e.latest.version} is available`:e.latest.version:"problem"in e.latest?e.latest.problem:"off"in e.latest?"Update checks are off.":"Not checked for a newer release yet.";return(0,s.jsxs)(H,{group:"system",title:"Updates",lead:`Installed Toolroll ${e.current} (${e.method}).`,sub:!0,back:"/settings/system",children:[(0,s.jsx)(he,{said:n,problem:t}),e.waiting?(0,s.jsxs)(X,{children:[e.waiting.short," ",e.waiting.words]}):null,e.drift?(0,s.jsx)("div",{"data-runtime-drift":"",children:(0,s.jsx)(Le,{children:e.drift.message?e.drift.message.split("`").map((w,P)=>P%2===1?(0,s.jsx)(_,{children:w},P):w):(0,s.jsxs)(s.Fragment,{children:["Toolroll ",e.drift.installed," is installed on disk, while ",e.drift.running," is running. Restart Toolroll to switch."]})})}):null,(0,s.jsxs)(u,{id:"updates-status",title:"Version",children:[(0,s.jsx)(xe,{rows:[["Installed",(0,s.jsx)(_,{children:e.current})],["Latest",k],["Install method",e.method]]}),(0,s.jsxs)(A,{children:[(0,s.jsx)(G,{action:"/settings/updates/check",label:"Check now"}),e.rollbackTo?(0,s.jsx)(S,{form:{id:"updates-rollback-form",proof:"updates",action:"/settings/updates",hidden:{version:e.rollbackTo},save:{label:`Roll back to ${e.rollbackTo}`,variant:"outline",sm:!0},confirm:`Roll back to ${e.rollbackTo}`,fields:[]}}):null]})]}),p!==null&&!e.active?(0,s.jsx)(u,{id:"updates-available",title:`Toolroll ${p} is available`,children:(0,s.jsx)(S,{form:{id:"updates-install-form",proof:"updates",action:"/settings/updates",hidden:{version:p},fields:[{kind:"radios",name:"when",legend:"When to update",current:"now",items:[{value:"now",label:"Now"},{value:"when-idle",label:"When idle"},{value:"tonight",label:"Tonight (03:00)"}]}],save:{label:"Update now",variant:"primary"}}})}):null,a?(0,s.jsxs)(u,{id:"update-live",title:`Update progress (${a.phase})`,children:[a.error?(0,s.jsx)(X,{children:a.error}):null,(0,s.jsx)("div",{className:"k-srecs",children:a.steps.map((w,P)=>(0,s.jsx)(B,{title:(0,s.jsxs)(s.Fragment,{children:[w.name," ",(0,s.jsx)(ne,{word:w.state,tone:w.state==="done"?"done":w.state==="failed"?"failed":""})]}),sub:w.detail??void 0},P))})]}):null,e.whatsNew?(0,s.jsxs)(u,{id:"updates-notes",title:`What’s new in ${e.whatsNew.version}`,children:[(0,s.jsx)("ul",{children:e.whatsNew.notes.map((w,P)=>(0,s.jsx)("li",{children:w},P))}),(0,s.jsx)(A,{children:(0,s.jsx)(G,{action:"/settings/updates/seen",label:"Dismiss"})})]}):null]})}function yt({state:e}){if(e.mode==="result"&&e.result)return(0,s.jsxs)(H,{group:"agents",title:e.result.title,sub:!0,back:e.result.backHref,children:[(0,s.jsx)("p",{children:e.result.text}),(0,s.jsx)(A,{children:(0,s.jsx)(z,{href:e.result.backHref,label:e.result.backLabel})})]});if(e.mode==="history"&&e.history){let t=e.history;return(0,s.jsxs)(H,{group:"agents",title:"Knowledge history",lead:t.repoName,sub:!0,back:`/settings/knowledge?repo=${encodeURIComponent(t.repo)}`,children:[t.selected?(0,s.jsxs)(u,{id:"knowledge-revision",title:`Revision ${t.selected.revision}`,children:[(0,s.jsx)("pre",{className:"recap",children:t.selected.instructions}),(0,s.jsx)(K,{action:"/settings/knowledge/change",hiddenFields:{repo:t.repo,action:"restore",identity:"",revision:String(t.selected.revision),restore:String(t.selected.revision)},children:(0,s.jsx)(A,{children:(0,s.jsx)(C,{variant:"primary",type:"submit",label:`Restore version ${t.selected.revision}`})})})]}):null,(0,s.jsx)(u,{id:"knowledge-versions",title:"Saved revisions",children:t.versions.length===0?(0,s.jsx)(h,{children:"No revisions recorded yet."}):(0,s.jsx)("div",{className:"k-srecs",children:t.versions.map(a=>(0,s.jsx)(B,{title:`Revision ${a.revision}`,sub:`${a.summary} · by ${a.actor}`,when:a.at,action:(0,s.jsx)(G,{action:"/settings/knowledge/change",fields:{repo:t.repo,action:"restore",identity:"",revision:String(a.revision),restore:String(a.revision)},variant:"outline",label:"Restore"})},a.revision))})})]})}let n=e.view;return(0,s.jsxs)(H,{group:"agents",title:"Knowledge",lead:`What agents know about ${n.repoName}.`,sub:!0,back:"/settings/agents",children:[e.said&&!e.problem?(0,s.jsx)("p",{role:"status",children:e.said}):(0,s.jsx)(he,{said:e.said,problem:e.problem}),e.errorMessage?(0,s.jsx)(X,{children:e.errorMessage}):null,(0,s.jsx)(Ae,{action:"/settings/knowledge",projects:e.projects,chosen:n.repo}),n.stale?(0,s.jsxs)(u,{id:"knowledge-stale",title:"Saved knowledge",children:[(0,s.jsx)("p",{className:"k-notice info",role:"status",children:"This project's saved knowledge is from before a change; review and apply it."}),n.stale.instructions?(0,s.jsx)("pre",{className:"recap",children:n.stale.instructions}):null,(0,s.jsx)(K,{action:"/settings/knowledge/change",hiddenFields:{repo:n.repo,action:"apply",identity:n.identity,revision:String(n.revision)},children:(0,s.jsx)(A,{children:(0,s.jsx)(C,{variant:"primary",type:"submit",label:"Apply saved knowledge"})})})]}):null,n.stale?null:(0,s.jsxs)(u,{id:"instructions",title:"Instructions",lead:"What every task in this project reads first.",children:[(0,s.jsx)("pre",{className:"k-scode",children:n.instructions||"No project instructions yet."}),(0,s.jsx)(q,{summary:n.instructions?"Edit instructions":"Add instructions",open:e.draft?.instructions!==void 0,children:(0,s.jsxs)(K,{action:"/settings/knowledge/change",hiddenFields:{repo:n.repo,action:"instructions",identity:n.identity,revision:String(n.revision)},children:[(0,s.jsx)(je,{id:"knowledge-instructions",name:"instructions",defaultValue:e.draft?.instructions??n.instructions,rows:5,"aria-label":"Project instructions",maxLength:4e3,placeholder:"Goals, preferences, and what good work looks like…"}),(0,s.jsxs)(A,{children:[(0,s.jsx)(C,{sm:!0,type:"submit",label:"Save instructions"}),n.versionsCount>0?(0,s.jsx)(z,{href:`/settings/knowledge?repo=${encodeURIComponent(n.repo)}&history=1`,variant:"ghost",label:`History (${n.versionsCount})`}):null]})]})})]}),(0,s.jsxs)(u,{id:"knowledge-index",title:"Relevant code",state:` · ${n.indexStatus}`,children:[(0,s.jsxs)("form",{method:"get",action:"/settings/knowledge",className:"k-acts k-picker",role:"search",children:[(0,s.jsx)("input",{type:"hidden",name:"repo",value:n.repo}),(0,s.jsxs)("label",{className:"k-frow",children:[(0,s.jsx)("span",{className:"k-flabel",children:"Find code"}),(0,s.jsx)("input",{className:"k-inp",name:"q",type:"search",defaultValue:n.searchQuery??"",maxLength:1e3,placeholder:"A feature, file or symbol"})]}),(0,s.jsx)(C,{sm:!0,type:"submit",label:"Search"})]}),n.searchResult?(0,s.jsxs)("div",{className:"k-stack",children:[(0,s.jsxs)(h,{children:[n.searchResult.engine==="typescript-ast"?"Code relationships":"Source search",n.searchResult.mode==="impact"?" · possible change impact":""]}),n.searchResult.excerpts.length>0?n.searchResult.excerpts.map((t,a)=>(0,s.jsxs)("details",{children:[(0,s.jsxs)("summary",{children:[t.file,":",t.line,t.symbol?` · ${t.symbol}`:""]}),(0,s.jsx)("p",{className:"k-note",children:t.reason}),(0,s.jsx)("pre",{className:"k-scode",children:t.text}),(0,s.jsx)("a",{className:"k-link",href:`/settings/knowledge?repo=${encodeURIComponent(n.repo)}&mode=impact&q=${encodeURIComponent(t.file)}`,children:"What this may affect"})]},`${t.file}:${t.line}:${a}`)):(0,s.jsx)(h,{children:"No matching source was found in this bounded search."}),n.searchResult.relationships.length>0?(0,s.jsxs)("details",{children:[(0,s.jsx)("summary",{children:"Related files"}),(0,s.jsx)("ul",{children:n.searchResult.relationships.map((t,a)=>(0,s.jsxs)("li",{children:[t.from," → ",t.to," · ",t.kind]},`${t.from}:${t.to}:${a}`))})]}):null,(0,s.jsxs)("details",{children:[(0,s.jsx)("summary",{children:"Context details"}),(0,s.jsxs)("p",{children:[n.searchResult.status,n.searchResult.head?` · checkout ${n.searchResult.head.slice(0,8)}`:""]}),n.searchResult.warnings.map((t,a)=>(0,s.jsx)("p",{children:t},a))]})]}):null,n.indexDetail?(0,s.jsx)(h,{children:n.indexDetail}):null,(0,s.jsx)(G,{action:"/settings/knowledge/refresh",fields:{repo:n.repo},variant:"outline",label:"Refresh code index",acts:!0})]}),(0,s.jsxs)(u,{id:"knowledge-decisions",title:`Decisions (${n.decisions.length})`,children:[n.decisions.length>0?(0,s.jsx)("div",{className:"k-srecs",children:n.decisions.map(t=>(0,s.jsx)(B,{title:t.claim,sub:`${t.why} · ${t.source}`,when:t.at,action:t.retiredAt===null?(0,s.jsx)(G,{action:"/settings/knowledge/decision",fields:{repo:n.repo,action:"retire",decision:String(t.id),reason:"retired"},variant:"ghost",label:"Retire"}):(0,s.jsx)(ne,{word:"Retired"})},t.id))}):(0,s.jsx)(h,{children:"No recorded decisions yet."}),(0,s.jsx)(q,{summary:"Record a decision",children:(0,s.jsxs)(K,{action:"/settings/knowledge/decision",hiddenFields:{repo:n.repo,action:"record"},children:[(0,s.jsx)(v,{label:"Decision",children:(0,s.jsx)(le,{id:"decision-claim",name:"claim",defaultValue:e.draft?.claim??"",required:!0})}),(0,s.jsx)(v,{label:"Why",children:(0,s.jsx)(je,{id:"decision-why",name:"why",defaultValue:e.draft?.why??""})}),(0,s.jsx)(A,{children:(0,s.jsx)(C,{type:"submit",label:"Record decision"})})]})})]})]})}function $t({state:e}){if(e.errorMessage||!e.view)return(0,s.jsxs)(H,{group:"agents",title:"Learning",sub:!0,back:"/settings/agents",children:[(0,s.jsx)(X,{children:e.errorMessage??"Learning is unavailable."}),e.reloadHref?(0,s.jsx)(A,{children:(0,s.jsx)(z,{href:e.reloadHref,label:"Reload Learning"})}):null]});let n=e.view;return(0,s.jsxs)(H,{group:"agents",title:"Learning",lead:`Lessons kept from finished work in ${n.repoName}.`,sub:!0,back:"/settings/agents",children:[(0,s.jsx)(he,{said:e.said,problem:e.problem}),(0,s.jsx)(Ae,{action:"/settings/learning",projects:e.projects,chosen:n.repo}),(0,s.jsx)(u,{id:"learning-lessons",title:`Lessons (${n.lessons.length})`,children:n.lessons.length===0?(0,s.jsx)(h,{children:"No lessons recorded for this project yet."}):(0,s.jsx)("div",{className:"k-srecs",children:n.lessons.map(t=>(0,s.jsx)(B,{title:(0,s.jsxs)(s.Fragment,{children:[t.title," ",(0,s.jsx)(ne,{word:t.state,tone:t.state==="active"?"done":""})]}),sub:t.kind==="system"?`System suggestion · No change applied · ${t.rule} · ${t.evidence}`:`${t.rule} · ${t.evidence}`,action:t.kind==="system"?null:(0,s.jsx)(G,{action:"/settings/learning/change",fields:{repo:n.repo,action:t.state==="active"?"disable":"adopt",identity:n.identity,revision:String(n.revision),lesson:String(t.id),version:String(t.version),sha:t.sha},variant:"outline",label:t.state==="active"?"Disable":"Adopt"})},`${t.id}-${t.version}`))})})]})}function Nt(){let[e,n]=(0,ee.useState)("");return(0,s.jsx)(u,{id:"lead-openrouter-key",title:"OpenRouter key",lead:"Two different OpenRouter keys are saved. Toolroll uses the one in Settings → Agents until you choose.",children:(0,s.jsxs)(K,{action:"/settings/openrouter-key/keep","data-openrouter-key-keep":"",children:[(0,s.jsx)(ye,{proof:"openrouter-key-keep",id:"openrouter-key-keep-pw",value:e,onChange:n}),(0,s.jsxs)(A,{children:[(0,s.jsx)(C,{type:"submit",name:"keep",value:"stored",label:"Keep the Agents key"}),(0,s.jsx)(C,{variant:"ghost",type:"submit",name:"keep",value:"lead",label:"Keep the lead’s key"})]})]})})}function St({data:e,said:n,problem:t}){let a=e.current,i=e.facts.returnTo,g=d=>e.saved===d?(0,s.jsx)("span",{className:"k-ssave-said",role:"status",children:"Saved."}):null;return(0,s.jsxs)(H,{group:"agents",title:e.subagentMode?"Subagents":"Lead",sub:!0,back:"/settings/agents",children:[t?(0,s.jsx)(X,{children:t.charAt(0).toUpperCase()+t.slice(1)}):n?(0,s.jsx)("p",{className:"k-notice info",role:"status",children:n}):null,e.subagentMode?null:a===null?e.signedIn!==null?(0,s.jsx)(u,{id:"lead-runs",title:"What runs the lead",lead:"The lead is off.",children:(0,s.jsx)(K,{action:"/settings/lead/on",hiddenFields:{return:e.facts.returnTo},children:(0,s.jsx)(A,{children:(0,s.jsx)(C,{variant:"primary",type:"submit",label:`Use your ${e.signedIn} sign-in`})})})}):(0,s.jsxs)(u,{id:"lead-runs",title:"What runs the lead",lead:"The lead is off. Sign in an agent on this computer to turn it on:",children:[(0,s.jsx)(_,{children:e.command}),(0,s.jsx)(G,{action:"/lead/check",fields:{return:e.facts.returnTo},label:"Check again",acts:!0})]}):e.words!==null?(0,s.jsx)(u,{id:"lead-runs",title:"What runs the lead",lead:`The lead uses ${e.words}.`,children:(0,s.jsx)(h,{children:`${a.model==="default"?"Its default model":`Model ${a.model}`} · up to ${a.dailyTurns} turns a day · no dollar spend. Every action it proposes waits for you to confirm it.`})}):(0,s.jsx)(u,{id:"lead-runs",title:"What runs the lead",lead:`The lead uses the ${a.provider==="anthropic-api"?"Anthropic":"OpenRouter"} API with ${a.model}.`,children:(0,s.jsx)(h,{children:`Up to ${Ne(a.weeklyCeilingMicrousd)} a week · up to ${a.dailyTurns} turns a day.`})}),e.openrouterConflict===!0&&!e.subagentMode?(0,s.jsx)(Nt,{}):null,e.identity!==void 0?(0,s.jsx)(u,{id:"lead-identity",title:"Name and persona",children:(0,s.jsxs)(K,{action:"/settings/lead/identity","data-lead-identity":"",children:[(0,s.jsx)(v,{label:"Name your lead",children:(0,s.jsx)(le,{id:"lead-name",name:"name",defaultValue:e.identity.name,maxLength:40,autoComplete:"off",required:!0,"aria-label":"Name your lead"})}),(0,s.jsx)(v,{label:"Persona",hint:"How it talks to you.",variant:"top",children:(0,s.jsx)(je,{id:"lead-persona",name:"persona",rows:4,defaultValue:e.identity.persona,maxLength:600,"aria-label":"Persona"})}),(0,s.jsxs)("div",{className:"k-ssave",children:[g("1"),(0,s.jsx)(C,{sm:!0,type:"submit",label:"Save"})]})]})}):null,e.about!==void 0?(0,s.jsx)(u,{id:"lead-about",title:"What your lead knows about you",children:(0,s.jsxs)(K,{action:"/settings/lead/about","data-lead-about":"",children:[(0,s.jsx)(v,{label:"About you",hint:"One per line, up to 20. Used in every project and every chat.",variant:"top",children:(0,s.jsx)(je,{id:"lead-about-text",name:"about",rows:Math.min(10,Math.max(4,e.about.length+1)),defaultValue:e.about.join(`
15
+ `),maxLength:4e3,placeholder:`Keep copy terse.
16
+ I test changes myself.`,"aria-label":"What your lead knows about you"})}),(0,s.jsxs)("div",{className:"k-ssave",children:[g("about"),(0,s.jsx)(C,{sm:!0,type:"submit",label:"Save"})]})]})}):null,e.quick!==void 0&&a!==null?(0,s.jsx)(u,{id:"lead-quick",title:"Quick answers",lead:a.provider==="claude-subscription"?`Short questions about what's going on, like "what's running?", are answered by ${e.quick.model}, a faster model. Anything that asks for a change still goes to the lead's main model.`:"Short questions about what's going on can go to a faster model. This works only when the lead uses the Anthropic membership.",children:e.quick.canChange?(0,s.jsxs)(K,{action:"/settings/lead/quick","data-lead-quick":"",children:[(0,s.jsx)(Me,{id:"lead-quick",name:"enabled",label:"Quick answers use a faster model",defaultChecked:e.quick.on}),(0,s.jsxs)("div",{className:"k-ssave",children:[g("quick"),(0,s.jsx)(C,{sm:!0,type:"submit",label:"Save"})]})]}):(0,s.jsx)(h,{children:e.quick.on?"On.":"Off."})}):null,(e.promises?.length??0)>0?(0,s.jsx)(u,{id:"lead-promises",title:"Promises",lead:"What the lead said it would follow up on. Each is reported once, then dropped after 7 days.",children:e.promises.map(d=>(0,s.jsx)(B,{"data-promise":d.id,title:d.what,sub:`${d.when.charAt(0).toUpperCase()+d.when.slice(1)}${d.until===void 0?"":` · until ${new Date(d.until).toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:"UTC"})}`}`,action:(0,s.jsx)(G,{action:"/settings/lead/promise/cancel",fields:{return:i,promise:String(d.id)},label:"Cancel"})},d.id))}):null,(0,s.jsx)(u,{id:"subagents",title:"Subagents",right:(0,s.jsx)(z,{sm:!0,href:"/settings/lead/subagents?add=1#add","data-add-subagent":"",label:"Add subagent"}),children:e.subagents.length===0?(0,s.jsx)(h,{children:"None yet. Your lead can ask one for help once it's here."}):(0,s.jsx)("div",{className:"k-slinks",children:e.subagents.map(d=>(0,s.jsxs)("a",{className:"k-slink noico",href:`/settings/lead/subagents/${d.id}`,children:[(0,s.jsxs)("span",{className:"k-sl",children:[(0,s.jsx)("span",{className:"k-sl-t",children:(0,s.jsx)("span",{children:d.name})}),(0,s.jsx)("span",{className:"k-sl-h",children:`${d.role}${d.status==="Paused"?" · Paused":""}`})]}),(0,s.jsx)("span",{className:"k-slink-r"}),(0,s.jsx)("span",{className:"k-chev","aria-hidden":"true"})]},d.id))})}),e.subagentMode?null:(0,s.jsx)(nn,{}),(0,s.jsxs)(q,{summary:"Advanced",children:[(0,s.jsx)(u,{id:"lead-config",title:"Model and limits",lead:e.subscription?"The membership provider runs without repository tools, in a temporary directory. Only Toolroll can turn an action it proposes into a confirmation card.":"Changing these always asks for your password, typed.",children:(0,s.jsx)(S,{form:{id:"lead-config-form",proof:"lead-config",action:"/chat/config",gate:a!==null,hidden:{return:e.facts.returnTo},save:{label:a===null?"Turn the lead on":"Save"},confirm:a===null?"Turn the lead on":"Change the lead's model and limits",fields:[{kind:"select",id:"lead-provider",name:"provider",label:"Provider",current:a?.provider??"claude-subscription",items:[["codex-subscription","Codex membership (signed-in CLI)"],["claude-subscription","Anthropic membership (signed-in CLI)"],["anthropic-api","Anthropic API (direct)"],["openrouter-api","OpenRouter API (direct)"]]},{kind:"input",id:"lead-model",name:"model",label:"Model",hint:"Use default for your membership's current model. A direct API model needs a pinned price.",value:a?.model??"default"},{kind:"input",id:"lead-weekly",name:"weekly-usd",label:"Weekly ceiling",hint:"Direct API only, in dollars. Leave blank when choosing a membership.",value:a===null||e.subscription?"":(a.weeklyCeilingMicrousd/1e6).toFixed(2)},{kind:"input",id:"lead-turns",name:"daily-turns",label:"Daily turns",hint:"50 when left blank.",value:a===null?"":String(a.dailyTurns)},{kind:"secret",id:"lead-own-key",name:"key",label:"The lead's own key",hint:`Direct API only. Leave empty to keep the one you have. ${e.keyWords}.`,placeholder:"Paste a key"}]}})}),(0,s.jsx)(u,{id:"lead-key",title:"The lead's own key",lead:"A direct API key the lead uses instead of a membership. A pasted key is kept in a file only this account can read, never in the database, and never shown again. ANTHROPIC_API_KEY or OPENROUTER_API_KEY in the environment always wins.",children:e.facts.keyFacts.map(d=>(0,s.jsx)(B,{title:d.provider,sub:d.state==="none"?"No key yet":d.state==="environment"?"From the environment":`stored ${d.tail??""}`.trim(),action:d.state!=="stored"?void 0:(0,s.jsx)(S,{form:{id:`lead-forget-${d.provider}`,proof:"lead-config",action:"/chat/config",hidden:{return:i,"forget-key":d.provider},save:{label:"Forget",variant:"danger"},confirm:`Forget the lead's own ${d.provider} key`,fields:[]}})},d.provider))}),a!==null?(0,s.jsx)(u,{id:"lead-off",title:"Turn the lead off",children:(0,s.jsx)(S,{form:{id:"lead-off-form",proof:"lead-config",action:"/chat/config",hidden:{return:i,off:"1"},save:{label:"Turn the lead off",variant:"danger"},confirm:"Turn the lead off",note:"The lead stops answering until you turn it on again.",fields:[]}})}):null]})]})}function Ct({data:e,said:n,problem:t}){return(0,s.jsxs)(H,{group:"alerts",title:e.title,lead:e.lead,sub:!0,back:"/settings/alerts",children:[(0,s.jsx)(he,{said:n,problem:t}),(0,s.jsxs)(u,{id:`${e.app}-connection`,title:"Connection",state:` · ${e.statusLine}`,children:[e.credentialsSummary?(0,s.jsx)(h,{children:e.credentialsSummary}):null,e.setupInstructions.length>0?(0,s.jsx)("ol",{className:"k-note",children:e.setupInstructions.map((a,i)=>(0,s.jsx)("li",{children:a},i))}):null,e.manifestHref?(0,s.jsx)(A,{children:(0,s.jsx)(z,{href:e.manifestHref,variant:"outline",sm:!0,label:"Download Slack app manifest"})}):null,e.webhookUrl?(0,s.jsx)(xe,{rows:[["Webhook URL",(0,s.jsx)(_,{children:e.webhookUrl})]]}):null,e.webhookInstructions.map((a,i)=>(0,s.jsx)(h,{children:a},i)),e.setupForm?(0,s.jsx)(S,{form:e.setupForm}):null,e.disconnectForm?(0,s.jsx)(S,{form:e.disconnectForm}):null]}),(0,s.jsxs)(u,{id:`${e.app}-pairing`,title:"Your pairing",children:[e.app==="telegram"?(0,s.jsx)(h,{children:e.unpairForm!==null?"Your phone is paired.":"Your phone is not paired."}):e.paired.length===0?(0,s.jsx)(h,{children:"No account paired yet."}):null,e.paired.length>0?(0,s.jsx)("div",{className:"k-srecs",children:e.paired.map((a,i)=>(0,s.jsx)(B,{title:a.label,when:a.when},i))}):null,e.pairForm?(0,s.jsx)(S,{form:e.pairForm}):null,e.unpairForm?(0,s.jsx)(S,{form:e.unpairForm}):null,e.alertsForm&&!e.isPrimary?(0,s.jsx)(S,{form:e.alertsForm}):null,e.retryForm&&e.retryForm.pendingCount>0?(0,s.jsxs)("div",{"data-unsent-replies":"",children:[(0,s.jsxs)(X,{children:["A reply hasn't reached your phone",e.retryForm.details&&e.retryForm.details.length>0?`: ${e.retryForm.details.join(" · ")}`:"."]}),(0,s.jsx)(G,{action:e.retryForm.action,variant:"outline",label:`Retry ${e.retryForm.pendingCount} unsent replies`,acts:!0})]}):null,e.notes.map((a,i)=>(0,s.jsx)(h,{children:a},i))]})]})}function Tt({view:e}){return(0,s.jsx)(H,{group:"alerts",title:`Approve from chat in ${e.where}`,sub:!0,back:"/settings",children:(0,s.jsxs)(u,{id:"chat-approval-confirm",title:"Confirm chat approvals",children:[(0,s.jsxs)(K,{action:"/settings/chat-approval/save",className:"card approve-form",hiddenFields:{nonce:e.nonce,digest:e.digest,scope:e.scope,"full-access":e.fullAccess,"cap-usd":e.capUsd},children:[(0,s.jsx)("p",{children:"Your own taps in your paired chat approve plans and merges until you turn this off. It doesn't expire."}),(0,s.jsxs)("p",{className:"recap",children:["Limits: ",e.limitsWords,"."]}),(0,s.jsx)("p",{className:"recap",children:"Plans written for you, protected paths, two-person rules and your organisation's policy still open in Toolroll."}),(0,s.jsx)(Ss,{kind:"typed-password",field:"token",fastAct:"chat-approval",children:(0,s.jsx)(ke,{label:"Your password",children:n=>(0,s.jsx)("input",{id:n.id,"aria-describedby":n.describedBy||void 0,type:"password",name:"token",autoComplete:"current-password",required:!0,className:"k-input"})})}),(0,s.jsx)("div",{className:"sticky-actions",children:(0,s.jsx)(C,{variant:"primary",type:"submit",label:"Turn on"})})]}),(0,s.jsx)(h,{children:(0,s.jsx)("a",{className:"k-link",href:"/settings",children:"Back"})})]})})}function At({state:e}){if(e.mode==="error")return(0,s.jsxs)(H,{group:"agents",title:"Plug-ins",sub:!0,back:"/settings/skills",children:[(0,s.jsx)(X,{children:e.errorText??"Could not update plug-ins."}),(0,s.jsx)(A,{children:(0,s.jsx)(z,{href:"/settings/skills",label:"Back to Plug-ins"})})]});if(e.mode==="revise"&&e.revise){let t=e.revise;return(0,s.jsxs)(H,{group:"agents",title:`Revise ${t.name}`,sub:!0,back:t.backHref,children:[t.note?(0,s.jsx)(h,{children:t.note}):null,(0,s.jsxs)(K,{action:"/settings/skills/revise",hiddenFields:{name:t.name,sha:t.sha,...e.repo?{repo:e.repo}:{}},children:[(0,s.jsx)(v,{label:"SKILL.md",variant:"wide",children:(0,s.jsx)(je,{id:"skill-revise-content",name:"content",defaultValue:t.content,rows:18,className:"k-mono"})}),(0,s.jsxs)(A,{children:[(0,s.jsx)(C,{variant:"primary",type:"submit",label:"Save revision"}),(0,s.jsx)(z,{href:t.backHref,variant:"ghost",label:"Cancel"})]})]})]})}let n=e.library;return(0,s.jsxs)(H,{group:"agents",title:"Plug-ins",lead:e.projectName?`Global skills and overrides for ${e.projectName}.`:"Reusable instructions for agents.",sub:!0,back:"/settings/agents",children:[(0,s.jsx)(he,{said:e.said,problem:e.problem}),(0,s.jsx)(Ae,{action:"/settings/skills",projects:e.projects,chosen:e.repo??"",evenOne:!0}),e.canManageLibrary?(0,s.jsx)(u,{id:"plugin-install",title:"Install a plug-in",children:(0,s.jsxs)(K,{action:"/settings/skills/library",hiddenFields:{action:"import-bundle",...e.repo?{repo:e.repo}:{}},children:[(0,s.jsx)(v,{label:"GitHub URL or folder",hint:"Only skills are installed. Other plug-in components stay inactive.",variant:"wide",children:(0,s.jsx)(le,{id:"bundle-url",name:"url",type:"text",defaultValue:e.bundleUrl??"",required:!0,placeholder:"https://github.com/owner/repo","aria-label":"GitHub URL or folder"})}),(0,s.jsx)(q,{summary:"Automatic updates",children:(0,s.jsx)("div",{className:"k-checks",children:(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"checkbox",name:"autoUpdate",value:"1",defaultChecked:!0})," ","Update clean skills daily"]})})}),(0,s.jsx)(A,{children:(0,s.jsx)(C,{variant:"primary",type:"submit",label:"Install plug-in"})})]})}):null,n.bundles.length>0?(0,s.jsx)(u,{id:"skill-bundles",title:"Installed plug-ins",children:(0,s.jsx)("div",{className:"k-srecs",children:n.bundles.map(t=>(0,s.jsxs)(B,{title:`${t.repoLabel}${t.version?` · ${t.version}`:""}`,sub:`${t.skillCount} skill${t.skillCount===1?"":"s"}${t.description?` · ${t.description}`:""}`,children:[t.ignoredParts.length?(0,s.jsxs)(h,{children:[t.ignoredParts.map(a=>({hooks:"Hooks",agents:"Subagents",commands:"Commands",mcp:"Tool servers"})[a]).join(", ")," in this plug-in don't run in Toolroll."]}):null,t.heldUpdate?(0,s.jsxs)(X,{children:["Update held · ",(0,s.jsx)(_,{children:t.heldUpdate.commit.slice(0,12)}),". ",t.heldUpdate.reasons.join("; ")]}):null,t.heldUpdate&&e.canManageLibrary?(0,s.jsxs)(A,{children:[(0,s.jsx)(G,{action:"/settings/skills/library",fields:{repo:e.repo??"",revision:String(n.revision),pin:t.pinnedCommit,action:"apply-held",bundle:t.id,held:t.heldUpdate.commit},variant:"outline",label:"Apply held update"}),(0,s.jsx)(G,{action:"/settings/skills/library",fields:{repo:e.repo??"",revision:String(n.revision),pin:t.pinnedCommit,action:"dismiss-held",bundle:t.id},variant:"ghost",label:"Dismiss update"})]}):null,(0,s.jsxs)(q,{summary:"Source and actions",children:[(0,s.jsx)(xe,{rows:[["Source",t.sourceKind==="github"?(0,s.jsx)("a",{href:t.url,rel:"noreferrer",children:t.url}):t.url],[t.sourceKind==="github"?"Commit":"Content",(0,s.jsx)(_,{children:t.pinnedCommit.slice(0,12)})]]}),e.canManageLibrary?(0,s.jsxs)(A,{children:[(0,s.jsx)(G,{action:"/settings/skills/library",fields:{repo:e.repo??"",revision:String(n.revision),pin:t.pinnedCommit,action:"sweep-bundle",bundle:t.id},variant:"outline",label:t.sourceKind==="local"?"Reload":"Update"}),t.previousCommit?(0,s.jsx)(G,{action:"/settings/skills/library",fields:{repo:e.repo??"",revision:String(n.revision),pin:t.pinnedCommit,action:"rollback-bundle",bundle:t.id},variant:"outline",label:"Roll back"}):null,(0,s.jsx)(G,{action:"/settings/skills/library",fields:{repo:e.repo??"",revision:String(n.revision),pin:t.pinnedCommit,action:"bundle-auto-update",bundle:t.id,autoUpdate:t.autoUpdate?"0":"1"},variant:"outline",label:t.autoUpdate?"Pause auto-update":"Enable auto-update"}),(0,s.jsx)(G,{action:"/settings/skills/library",fields:{repo:e.repo??"",revision:String(n.revision),pin:t.pinnedCommit,action:"remove-bundle",bundle:t.id},variant:"outline",label:"Remove"})]}):null]})]},t.id))})}):null,(0,s.jsx)(q,{summary:`Skills (${n.skills.length})`,children:(0,s.jsxs)("div",{id:"skills-library",children:[n.skills.length===0?(0,s.jsx)(h,{children:"No skills in the global library yet."}):(0,s.jsx)("div",{className:"k-srecs",children:n.skills.map(t=>(0,s.jsx)(B,{title:(0,s.jsxs)(s.Fragment,{children:[t.name," ",(0,s.jsx)(ne,{word:t.enabled?"Enabled":"Disabled",tone:t.enabled?"done":""})]}),sub:`${t.description} · ${t.source}`,action:e.canManageLibrary?(0,s.jsx)(G,{action:"/settings/skills/library",fields:{revision:String(n.revision),repo:e.repo??"",action:t.enabled?"disable-skill":"enable-skill",sha:t.sha,...e.repo?{repo:e.repo}:{}},variant:"outline",label:t.enabled?"Disable":"Enable"}):null},t.sha))}),e.canManageLibrary?(0,s.jsx)(q,{summary:"Add a single skill to all projects",children:(0,s.jsxs)(K,{action:"/settings/skills/library",hiddenFields:{action:"import-skill",method:"paste",repo:e.repo??"",revision:String(n.revision)},children:[(0,s.jsx)(v,{label:"SKILL.md",hint:"Added to the global library and enabled across all projects unless opted out.",variant:"top",children:(0,s.jsx)(je,{id:"global-skill-content",name:"content",rows:6,required:!0,maxLength:24576,placeholder:`---
17
+ name: code-review
18
+ description: Review changes for clarity and bugs.
19
+ ---
20
+ Write your instructions here.`,"aria-label":"Global SKILL.md"})}),(0,s.jsx)(A,{children:(0,s.jsx)(C,{sm:!0,type:"submit",label:"Add to global library"})})]})}):null]})}),e.canManageLibrary&&n.localSync.length>0?(0,s.jsx)(u,{id:"skill-local-sync",title:"Local tool sync",children:(0,s.jsx)("div",{className:"k-srecs",children:n.localSync.map(t=>(0,s.jsx)(B,{title:t.label,sub:`${t.targetDir}${t.lastSynced?` · synced ${t.lastSynced}`:""}`,action:e.canManageLibrary?(0,s.jsx)(G,{action:"/settings/skills/library",fields:{revision:String(n.revision),repo:e.repo??"",action:"local-sync",tool:t.tool,enabled:t.enabled?"0":"1",...e.repo?{repo:e.repo}:{}},variant:"outline",label:t.enabled?"Turn off":"Turn on"}):null},t.tool))})}):null,e.projectSkills==null?(0,s.jsx)("p",{children:"Add a project to manage project-specific skills."}):(0,s.jsx)(lt,{data:e.projectSkills})]})}function Ft({data:e,said:n,problem:t}){let[a,i]=(0,ee.useState)(e.pair?.live??null);(0,ee.useEffect)(()=>{let p=e.pair?.live;if(!p)return;let k=!1,w=setInterval(()=>{fetch(`/settings/phone/pairings/${encodeURIComponent(p.pairSessionId)}`,{credentials:"same-origin",cache:"no-store",headers:{accept:"application/json"}}).then(P=>P.status===404?(window.location.replace("/settings/phone#phone-pair"),null):P.ok?P.json():null).then(P=>{if(!(k||!P||!P.status)){if(!["awaiting_scan","awaiting_ready","awaiting_confirm","confirming","finishing"].includes(P.status)){window.location.replace("/settings/phone#phone-pair");return}i(M=>M?{...M,status:P.status,confirmCode:P.confirmCode??null,deviceName:P.deviceName??null}:null)}}).catch(()=>{})},1e3);return()=>{k=!0,clearInterval(w)}},[e.pair?.live?.pairSessionId]),(0,ee.useEffect)(()=>{if(!e.passkeys.lastStepSaid)return;let p=setInterval(()=>{window.location.reload()},3e3);return()=>clearInterval(p)},[e.passkeys.lastStepSaid]);let g=a?.confirmCode??"",d=g.split("-").map(p=>p.split("").join(" ")).join(", ");return(0,s.jsxs)(H,{group:"access",title:"Phone",lead:"The Toolroll iPhone app: what needs you, in your pocket.",sub:!0,back:"/settings/access",children:[(0,s.jsx)(he,{said:n,problem:t}),(0,s.jsxs)(u,{id:"phone-access",title:"iPhone app",state:e.on?" · On":" · Off",lead:e.on?"Your paired iPhone can see what needs you, read plans, steps and changes, watch agents work, and approve with a passkey.":"Let the Toolroll iPhone app see your work. Nothing is shared until you pair a phone.",children:[(0,s.jsxs)(h,{children:["The iPhone app isn't on the App Store yet."," ",(0,s.jsx)("a",{className:"k-link",href:e.notOnStoreUrl,children:"How to install it"})]}),e.passworded?(0,s.jsxs)(s.Fragment,{children:[e.accessProblems.map((p,k)=>(0,s.jsx)(X,{children:p},k)),e.hostedApprovalStaleText?(0,s.jsx)(X,{children:e.hostedApprovalStaleText}):null,e.directSummary?(0,s.jsx)(B,{title:e.directSummary.title,sub:e.directSummary.failed?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(X,{children:["Phones can't connect to ",e.thisMac," directly."," ",e.directSummary.failed.what,": ",e.directSummary.failed.error,"."]}),e.directSummary.failed.portCommand?(0,s.jsxs)(h,{children:[e.directSummary.failed.hostedWorks?"Connecting from anywhere still works. To connect directly, quit":"Quit"," ","the app using that port, or start Toolroll with"," ",(0,s.jsx)(_,{children:e.directSummary.failed.portCommand}),"."]}):e.directSummary.failed.hostedWorks?(0,s.jsx)(h,{children:"Connecting from anywhere still works."}):null]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{children:"Direct, no relay: on the same Wi-Fi, or anywhere over Tailscale when your phone has it too."}),e.directSummary.addresses&&e.directSummary.addresses.length>0?(0,s.jsx)("ul",{className:"k-phone-addrs",children:e.directSummary.addresses.map((p,k)=>(0,s.jsxs)("li",{children:[(0,s.jsx)("span",{className:"k-phone-addr-k",children:p.label}),(0,s.jsx)(_,{children:p.address})]},k))}):e.directSummary.noAddressText?(0,s.jsx)(h,{children:e.directSummary.noAddressText}):null,e.directSummary.tailscaleNotFound?(0,s.jsxs)("span",{className:"k-phone-line",children:["Tailscale: not found on ",e.thisMac,". Optional —"," ",(0,s.jsx)("a",{className:"k-link",href:"https://tailscale.com/download",children:"get Tailscale"})," ","to connect directly from anywhere."]}):null,(0,s.jsx)("span",{className:"k-phone-line",children:e.directSummary.firewallText})]})}):null,e.hostedSummary?(0,s.jsx)(B,{title:"Anywhere else",sub:e.hostedSummary.offText?e.hostedSummary.offText:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{children:["Through ",(0,s.jsx)(_,{children:e.hostedSummary.host}),", ",e.hostedSummary.runBy,". End-to-end encrypted: the relay sees when your phone and ",e.thisMac," ","connect, never what they send. ",e.hostedSummary.statusWords]}),e.hostedSummary.superseded?(0,s.jsx)(X,{children:"Another Toolroll with this workspace's keys is connected to the relay. Phones connecting from anywhere reach that one; stop it, or turn off connecting from anywhere on one of them."}):null]})}):null,e.operator?e.on?(0,s.jsxs)(s.Fragment,{children:[e.hostedHost!==null?(0,s.jsx)(S,{form:{id:"phone-hosted-form",proof:e.hostedEnabled?"phone-access-off":"phone-access",action:"/settings/phone/access",native:!0,hidden:{act:e.hostedEnabled?"hosted-off":"hosted-on"},save:{label:e.hostedEnabled?"Stop connecting from anywhere":`Connect from anywhere through ${e.hostedHost}`,variant:"outline"},confirm:e.hostedEnabled?"Stop connecting from anywhere":"Connect from anywhere",fields:[]}}):null,(0,s.jsx)(S,{form:{id:"phone-access-form",proof:"phone-access-off",action:"/settings/phone/access",native:!0,hidden:{act:"off"},save:{label:"Turn off phone access",variant:"danger"},confirm:"Turn off phone access",note:"Paired phones stay paired but can't connect until you turn it back on.",fields:[]}})]}):(0,s.jsx)(S,{form:{id:"phone-access-form",proof:"phone-access",action:"/settings/phone/access",native:!0,hidden:{act:"on"},save:{label:"Turn on phone access",variant:"primary"},confirm:"Turn on phone access",note:`Your phone connects straight to ${e.thisMac} on the same Wi-Fi (or over Tailscale).`,fields:e.hostedHost?[{kind:"checkboxes",name:"hosted",label:"Relay",items:[{value:"1",label:`Also connect from anywhere through ${e.hostedHost}`,checked:!0,sub:`Through ${e.hostedHost}, ${e.hostedHost==="relay.toolroll.dev"?"run by Toolroll":"the relay this Toolroll is set up to use (TOOLROLL_RELAY_URL)"}. It's end-to-end encrypted: the relay sees when your phone and ${e.thisMac} connect, never what they send, and it can't act for you.`}]}]:[{kind:"note",text:`Connecting from anywhere is off on ${e.thisMac} (TOOLROLL_RELAY_URL=off).`}]}}):(0,s.jsx)(h,{children:e.on?"Whoever runs this Toolroll turned phone access on.":"Ask whoever runs this Toolroll to turn on phone access."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"k-notice info",children:"Set a password to pair a phone. Pairing and removing phones ask for it, so only you can do them."}),(0,s.jsx)(A,{children:(0,s.jsx)(z,{variant:"primary",sm:!0,href:"/password/set?next=%2Fsettings%2Fphone",label:"Set a password"})})]})]}),e.pair?(0,s.jsx)(u,{id:"phone-pair",title:"Pair an iPhone",children:a?(()=>{let p=a.status==="awaiting_confirm"?"code":a.status==="confirming"?"confirming":a.status==="finishing"?"finishing":"waiting";return(0,s.jsxs)("div",{id:"phone-pairing",className:"k-phone-pairing","data-pairing":a.pairSessionId,"data-left-ms":String(a.leftMs),"data-shown":p,children:[p!=="code"?(0,s.jsx)("noscript",{children:(0,s.jsx)("meta",{httpEquiv:"refresh",content:"5"})}):null,(0,s.jsxs)("div",{"data-view":"waiting",hidden:p!=="waiting",children:[(0,s.jsx)("p",{className:"k-phone-wait",role:"status",children:a.status==="awaiting_ready"?"Waiting for your iPhone…":"Waiting for your iPhone to scan the code…"}),(0,s.jsx)(h,{children:"The QR code is shown only once. If you closed it before scanning, cancel and pair again."}),(0,s.jsx)(A,{children:(0,s.jsx)(G,{action:"/settings/phone/cancel",fields:{pairing:a.pairSessionId},variant:"outline",label:"Cancel"})})]}),(0,s.jsxs)("div",{"data-view":"code",hidden:p!=="code",children:[(0,s.jsx)(h,{"data-phone-device":"",children:a.deviceName&&a.deviceName.trim()!==""&&a.deviceName!=="iPhone"?`“${a.deviceName}” should be showing this code:`:"Your iPhone should be showing this code:"}),(0,s.jsxs)("p",{className:"k-phone-code",children:[(0,s.jsx)("span",{"aria-hidden":"true","data-phone-code":"",children:g}),(0,s.jsx)("span",{className:"k-sr","data-phone-code-spoken":"",children:d})]}),(0,s.jsx)(h,{children:"Only confirm if your iPhone shows exactly this code. If it doesn't, cancel: someone else may have scanned your QR code."}),(0,s.jsxs)(A,{children:[(0,s.jsx)(G,{action:"/settings/phone/confirm",fields:{pairing:a.pairSessionId,...a.setsUpApprovals?{setup:"1"}:{}},variant:"primary",label:"Codes match — pair"}),(0,s.jsx)(G,{action:"/settings/phone/cancel",fields:{pairing:a.pairSessionId},variant:"outline",label:"Cancel"})]}),a.setsUpApprovals?(0,s.jsx)(h,{children:"Confirming also lets this iPhone set up its passkey for approvals in the next 5 minutes."}):null]}),(0,s.jsx)("div",{"data-view":"confirming",hidden:p!=="confirming",children:(0,s.jsx)("p",{className:"k-phone-wait",role:"status",children:"Saving the pairing…"})}),(0,s.jsxs)("div",{"data-view":"finishing",hidden:p!=="finishing",children:[(0,s.jsx)("p",{className:"k-phone-wait",role:"status",children:"Finishing on the iPhone…"}),(0,s.jsx)(h,{children:"Keep the Toolroll app open until it says it's paired."})]})]})})():(0,s.jsxs)(s.Fragment,{children:[e.pair.outcome?e.pair.outcome.tone==="info"?(0,s.jsx)("p",{className:"k-notice info",children:e.pair.outcome.text}):(0,s.jsx)(X,{children:e.pair.outcome.text}):null,e.pair.lastStepWait?(0,s.jsx)("div",{id:"phone-passkey-wait",children:(0,s.jsx)("p",{className:"k-notice info",children:"Last step: on your iPhone, confirm with Face ID or your passcode to turn on approvals."})}):null,e.pair.reachable?(0,s.jsx)(S,{form:{id:"phone-pair-form",proof:"phone-pair",action:"/settings/phone/pair",native:!0,save:{label:"Pair an iPhone",variant:"primary"},confirm:"Pair an iPhone with Toolroll",note:"You'll get a QR code to scan with the Toolroll app. It works once, for 5 minutes.",fields:[]}}):e.pair.whyNotReachable?(0,s.jsx)(h,{children:e.pair.whyNotReachable}):null]})}):null,e.devices.showSection?(0,s.jsxs)(u,{id:"phone-devices",title:"Your phones",state:e.devices.current.length===0?" · None":` · ${e.devices.current.length}`,children:[e.devices.current.length===0?(0,s.jsx)(h,{children:"No phones are paired."}):(0,s.jsx)("div",{className:"k-srecs",children:e.devices.current.map(p=>(0,s.jsxs)(B,{"data-phone":p.deviceId,"data-phone-state":p.state,title:p.name,sub:p.sub,children:[(0,s.jsx)(q,{summary:"Rename",children:(0,s.jsxs)(K,{action:"/settings/phone/rename",hiddenFields:{device:p.deviceId},children:[(0,s.jsx)(v,{label:`New name for ${p.name}`,children:(0,s.jsx)(le,{name:"name",defaultValue:p.name,maxLength:48,required:!0,autoComplete:"off",spellCheck:!1})}),(0,s.jsx)(A,{children:(0,s.jsx)(C,{type:"submit",variant:"outline",sm:!0,label:"Save name"})})]})}),(0,s.jsx)(S,{form:{id:`phone-approvals-${p.deviceId}`,proof:"phone-approvals",action:"/settings/phone/approvals",hidden:{device:p.deviceId},native:!0,save:{label:"Save",variant:"outline"},confirm:`Change approvals on ${p.name}`,fields:[{kind:"select",name:"minutes",label:`Approvals on ${p.name}`,current:String(p.minutes),items:p.minuteChoices}]}}),(0,s.jsx)(S,{form:{id:`phone-remove-${p.deviceId}`,proof:"phone-remove",action:"/settings/phone/remove",hidden:{device:p.deviceId},save:{label:"Remove",variant:"danger"},confirm:`Remove ${p.name}`,fields:[]}})]},p.deviceId))}),e.devices.retired.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{className:"k-phone-sub",children:"Removed or signed out in the last 30 days"}),(0,s.jsx)("div",{className:"k-srecs",children:e.devices.retired.map(p=>(0,s.jsx)(B,{"data-phone":p.deviceId,"data-phone-state":"retired",title:(0,s.jsx)("span",{className:"k-muted",children:p.name}),sub:p.sub},p.deviceId))})]}):null]}):null,e.passkeys.showSection?(0,s.jsxs)(u,{id:"phone-passkeys",title:"Passkey approvals",state:` · ${e.passkeys.stateText}`,lead:"Approve plans, accept results, land and ship from your paired iPhone. Each one is confirmed with a passkey and checked on this Mac.",children:[e.passkeys.enrollmentOpen?e.passkeys.active.length===0?e.passkeys.lastStepSaid?null:(0,s.jsx)("div",{id:"phone-passkey-wait",children:(0,s.jsx)("p",{className:"k-notice info",children:"Last step: on your iPhone, confirm with Face ID or your passcode to turn on approvals."})}):(0,s.jsx)("p",{className:"k-notice info",children:"Set up is open for 5 minutes. On your paired iPhone, open Settings → Passkey approvals and tap Add another passkey."}):e.passkeys.canEnable?(0,s.jsx)(S,{form:{id:"phone-passkey-enable-form",proof:"phone-passkey-enable",action:"/settings/phone/passkey/enable",native:!0,save:{label:e.passkeys.enableLabel,variant:"outline"},confirm:"Set up a passkey on iPhone",note:"Gives your paired iPhone 5 minutes to register a passkey for this workspace.",fields:[]}}):null,e.passkeys.active.length===0?(0,s.jsx)(h,{children:"No passkeys registered yet."}):(0,s.jsx)("div",{className:"k-srecs",children:e.passkeys.active.map(p=>(0,s.jsx)(B,{"data-passkey":p.credentialId,title:p.label,sub:p.sub,children:(0,s.jsx)(S,{form:{id:`passkey-revoke-${p.credentialId.slice(0,12)}`,proof:"phone-passkey-revoke",action:"/settings/phone/passkey/revoke",hidden:{credential:p.credentialId},save:{label:"Revoke passkey",variant:"danger"},confirm:`Revoke passkey ${p.label}`,fields:[]}})},p.credentialId))}),e.operator?(0,s.jsx)(B,{title:"Passkey prompt",sub:e.passkeys.promptText,children:(0,s.jsx)(S,{form:{id:"phone-passkey-window-form",proof:"phone-passkey-window",action:"/settings/phone/passkey/window",native:!0,save:{label:"Save",variant:"outline"},confirm:"Change the passkey prompt",note:"Shipping, landing, protected work and exceptions always ask. Opening the app and confirming with your passkey unlocks approvals for this window.",fields:[{kind:"select",name:"window",label:"Passkey prompt",current:String(e.passkeys.windowMinutes),items:e.passkeys.windowChoices}]}})}):(0,s.jsx)(B,{title:"Passkey prompt",sub:`${e.passkeys.promptText} · Whoever runs this Toolroll sets this.`,children:(0,s.jsx)(h,{children:"Shipping, landing, protected work and exceptions always ask. Opening the app and confirming with your passkey unlocks approvals for this window."})})]}):null]})}function Pt({data:e}){return e.noProject?(0,s.jsx)(H,{group:"approval",title:"Requirements",sub:!0,back:"/settings/approval",children:(0,s.jsxs)(h,{children:["Open a project to see its requirements:"," ",(0,s.jsx)("a",{className:"k-link",href:"/projects",children:"Projects"}),"."]})}):(0,s.jsxs)(H,{group:"approval",title:"Requirements",lead:"Tools and credentials builds need. Each is checked on the builder before any build spends money; values never leave your computer.",sub:!0,back:"/settings/approval",children:[(0,s.jsx)(u,{id:"recorded",title:"Recorded",children:e.recorded.length===0?(0,s.jsx)(h,{children:"Nothing recorded."}):(0,s.jsx)("div",{className:"k-srecs",children:e.recorded.map((n,t)=>(0,s.jsx)(B,{title:(0,s.jsx)("span",{className:"k-mono",children:n.key}),sub:n.detail},t))})}),(0,s.jsx)(u,{id:"missing",title:"Missing",lead:"Ranked by what filling them frees.",children:e.missing.length===0?(0,s.jsx)(h,{children:"Nothing missing. Everything recorded is verified."}):(0,s.jsx)("div",{className:"k-srecs",children:e.missing.map((n,t)=>(0,s.jsx)(B,{title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"k-mono",children:n.key})," ",(0,s.jsx)(ne,{word:n.state})]}),sub:n.sub,children:(0,s.jsx)(q,{summary:"How to check and fill",children:(0,s.jsx)(xe,{rows:[["Check",(0,s.jsx)(_,{children:n.verify})],["How to fill it",n.instructions]]})})},t))})}),(0,s.jsx)(h,{children:"Read-only here: the checks are shell commands you wrote, and a web button that runs them would need its own security review."})]})}var re=ue(Te(),1);function jl({view:e}){switch(e.kind){case"settings-home":return(0,re.jsx)(Hn,{group:e.group,facts:e.facts});case"settings-area":return(0,re.jsx)(rt,{view:e});case"settings-spend":return(0,re.jsx)(nt,{view:e.view,said:e.said,problem:e.problem});case"settings-mode":return(0,re.jsx)(ot,{view:e.view});case"settings-mode-confirm":return(0,re.jsx)(dt,{view:e});case"settings-control":return(0,re.jsx)(ct,{view:e});case"settings-models":return(0,re.jsx)(ht,{view:e.view,projects:e.projects,repo:e.repo,providerKeys:e.providerKeys,openrouter:e.openrouter,advancedOn:e.advancedOn,said:e.said,problem:e.problem});case"settings-tools":return(0,re.jsx)(gt,{view:e.view,projects:e.projects,canManage:e.canManage??!0,said:e.said,problem:e.problem});case"settings-project":return(0,re.jsx)(xt,{mode:e.mode,deleteProblem:e.deleteProblem,view:e.view,projects:e.projects,networkRequest:e.networkRequest,canRemove:e.canRemove,advancedOn:e.advancedOn,sandboxEngineWords:e.sandboxEngineWords,fallbackLines:e.fallbackLines,flexibleSummary:e.flexibleSummary,missingSignInHosts:e.missingSignInHosts,said:e.said,problem:e.problem});case"settings-project-picker":return(0,re.jsx)(ft,{title:e.title,lead:e.lead,action:e.action,projects:e.projects});case"settings-approval":return(0,re.jsx)(kt,{facts:e.facts,projects:e.projects,chosen:e.chosen,rules:e.rules,release:e.release,mode:e.mode,advanced:e.advanced,said:e.said,problem:e.problem});case"settings-updates":return(0,re.jsx)(wt,{view:e.view,said:e.said,problem:e.problem});case"settings-knowledge":return(0,re.jsx)(yt,{state:e});case"settings-learning":return(0,re.jsx)($t,{state:e});case"settings-lead":return(0,re.jsx)(St,{data:e.data,said:e.said,problem:e.problem});case"settings-chat-app":return(0,re.jsx)(Ct,{data:e.data,said:e.said,problem:e.problem});case"settings-chat-approval":return(0,re.jsx)(Tt,{view:e});case"settings-skills":return(0,re.jsx)(At,{state:e});case"settings-phone":return(0,re.jsx)(Ft,{data:e.data,said:e.said,problem:e.problem});case"settings-sessions":return(0,re.jsx)(vn,{data:e.data,said:e.said,problem:e.problem});case"people":return(0,re.jsx)(bn,{view:e});case"caps":return(0,re.jsx)(Pt,{data:e.data})}}export{Pt as CapsView,bn as PeopleView,vn as SessionsView,jl as SettingsView,nn as StandingDirectionsSection};