toolroll 0.9.140 → 0.9.142
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.
- package/CHANGELOG.md +26 -0
- package/dist/attest.js +1 -1
- package/dist/browser/{chunk-agents-live-view.9f4367c89c6366769a567e729ac9181ccaa898bf3a168d3dc618f3cface887c7.js → chunk-agents-live-view.1b1c797cec2734229d36186796ae378527a7b5f7aa936897671a6c1f3a8cb19a.js} +5 -5
- package/dist/browser/chunk-agents-live-view.1b1c797cec2734229d36186796ae378527a7b5f7aa936897671a6c1f3a8cb19a.js.br +0 -0
- package/dist/browser/chunk-agents-live-view.1b1c797cec2734229d36186796ae378527a7b5f7aa936897671a6c1f3a8cb19a.js.gz +0 -0
- package/dist/browser/chunk-bundle.089b2471028b3dcf578cb4363ea4757738b28eda5459e6194f92707364033cd7.js +2 -0
- package/dist/browser/chunk-bundle.089b2471028b3dcf578cb4363ea4757738b28eda5459e6194f92707364033cd7.js.br +0 -0
- package/dist/browser/chunk-bundle.089b2471028b3dcf578cb4363ea4757738b28eda5459e6194f92707364033cd7.js.gz +0 -0
- package/dist/browser/chunk-chat-parts.51c73684050c98bc25724e417e4180981c14590934bb37fd9a1617942a7d32d3.js +4 -0
- package/dist/browser/chunk-chat-parts.51c73684050c98bc25724e417e4180981c14590934bb37fd9a1617942a7d32d3.js.br +0 -0
- package/dist/browser/chunk-chat-parts.51c73684050c98bc25724e417e4180981c14590934bb37fd9a1617942a7d32d3.js.gz +0 -0
- package/dist/browser/{chunk-core.5490609e81c3a5f78da3e06b9795d71c287016ebc7fd02794b1122b474ebb07f.js → chunk-core.6128decfe528d89de1445dc1ec36e9f13dabd76eba61d13310fc1302db2252eb.js} +11 -11
- package/dist/browser/chunk-core.6128decfe528d89de1445dc1ec36e9f13dabd76eba61d13310fc1302db2252eb.js.br +0 -0
- package/dist/browser/chunk-core.6128decfe528d89de1445dc1ec36e9f13dabd76eba61d13310fc1302db2252eb.js.gz +0 -0
- package/dist/browser/{chunk-flow-view.f5d74c7f072b739a7a0ed86ff35cafa7b8a041233372d1eeaab9eb941ddfc11e.js → chunk-flow-view.f9a4db9db350a9311ce5b11e9358c6e7de4ad9b3cd7a1f058e6c78eedee6dec6.js} +1 -1
- package/dist/browser/chunk-flow-view.f9a4db9db350a9311ce5b11e9358c6e7de4ad9b3cd7a1f058e6c78eedee6dec6.js.br +0 -0
- package/dist/browser/chunk-flow-view.f9a4db9db350a9311ce5b11e9358c6e7de4ad9b3cd7a1f058e6c78eedee6dec6.js.gz +0 -0
- package/dist/browser/{chunk-flows-extra-view.01ebf93780b729363eda11ba21c764fe593bcd3e684aa833c9b86147f780fd41.js → chunk-flows-extra-view.3151cd05656fd35f80588863c323b4799b6b1f0060243ec8bc9b5da94d8d6052.js} +1 -1
- package/dist/browser/chunk-flows-extra-view.3151cd05656fd35f80588863c323b4799b6b1f0060243ec8bc9b5da94d8d6052.js.br +0 -0
- package/dist/browser/chunk-flows-extra-view.3151cd05656fd35f80588863c323b4799b6b1f0060243ec8bc9b5da94d8d6052.js.gz +0 -0
- package/dist/browser/chunk-more-views.70ab484b8f1f1ebc31c3c27061a88c86607d86bb9bc34d277b57f3f4fa0ce291.js +2 -0
- package/dist/browser/chunk-more-views.70ab484b8f1f1ebc31c3c27061a88c86607d86bb9bc34d277b57f3f4fa0ce291.js.br +0 -0
- package/dist/browser/chunk-more-views.70ab484b8f1f1ebc31c3c27061a88c86607d86bb9bc34d277b57f3f4fa0ce291.js.gz +0 -0
- package/dist/browser/{chunk-pages-bundle.e18059f0cb4fbb63e3698971d4c1830ad0945c3645235babc93010cd0b725c1d.js → chunk-pages-bundle.3b596e7529dfb499a536353c9095d0b9a8255e5b7f782211c22aced869905bb0.js} +1 -1
- package/dist/browser/chunk-pages-bundle.3b596e7529dfb499a536353c9095d0b9a8255e5b7f782211c22aced869905bb0.js.br +0 -0
- package/dist/browser/chunk-pages-bundle.3b596e7529dfb499a536353c9095d0b9a8255e5b7f782211c22aced869905bb0.js.gz +0 -0
- package/dist/browser/chunk-result-view.f319cf5973ad4c9e7e495e00e77070ec242da669f87f848d52878e223ba87343.js +2 -0
- package/dist/browser/chunk-result-view.f319cf5973ad4c9e7e495e00e77070ec242da669f87f848d52878e223ba87343.js.br +0 -0
- package/dist/browser/chunk-result-view.f319cf5973ad4c9e7e495e00e77070ec242da669f87f848d52878e223ba87343.js.gz +0 -0
- package/dist/browser/chunk-settings-view.653e09ec0c7cce54c68ae7e968cc015c774fb6fa6e1493fd9f5423281d1e24fe.js +20 -0
- package/dist/browser/chunk-settings-view.653e09ec0c7cce54c68ae7e968cc015c774fb6fa6e1493fd9f5423281d1e24fe.js.br +0 -0
- package/dist/browser/chunk-settings-view.653e09ec0c7cce54c68ae7e968cc015c774fb6fa6e1493fd9f5423281d1e24fe.js.gz +0 -0
- package/dist/browser/chunk-shared.0c0231ce259937612ec120a251373e6b63f68c37fa031567570a9cfd6d6b2eef.js +2 -0
- package/dist/browser/chunk-shared.0c0231ce259937612ec120a251373e6b63f68c37fa031567570a9cfd6d6b2eef.js.br +0 -0
- package/dist/browser/chunk-shared.0c0231ce259937612ec120a251373e6b63f68c37fa031567570a9cfd6d6b2eef.js.gz +0 -0
- package/dist/browser/{chunk-shared.02c0b692de21a9bb80d1761aa887d8532431171945c02e663884c9f45b796753.js → chunk-shared.1bdbb9b057d17e95221becb4ed515b546d671390e4a817a6e72a799480fe14ad.js} +1 -1
- package/dist/browser/chunk-shared.1bdbb9b057d17e95221becb4ed515b546d671390e4a817a6e72a799480fe14ad.js.br +0 -0
- package/dist/browser/chunk-shared.1bdbb9b057d17e95221becb4ed515b546d671390e4a817a6e72a799480fe14ad.js.gz +0 -0
- package/dist/browser/{chunk-shared.c3e5be1c5f441e94905a4bc2005d816d2a0b0e4108bae43e37ec274a911c6847.js → chunk-shared.2d678087d03dcf2430b5bf48656220dbff5fb622188004aae7a76e0e5e5d18f8.js} +1 -1
- package/dist/browser/chunk-shared.2d678087d03dcf2430b5bf48656220dbff5fb622188004aae7a76e0e5e5d18f8.js.br +0 -0
- package/dist/browser/chunk-shared.2d678087d03dcf2430b5bf48656220dbff5fb622188004aae7a76e0e5e5d18f8.js.gz +0 -0
- package/dist/browser/{chunk-shared.6d0b8728b3e309886cfb6eaf596d3f20592939e521bb60bb090824f34da6b086.js → chunk-shared.66f18526381931b1ff69c090bad48c408a035a0d256bcff19b19b51ea988612a.js} +1 -1
- package/dist/browser/chunk-shared.66f18526381931b1ff69c090bad48c408a035a0d256bcff19b19b51ea988612a.js.br +0 -0
- package/dist/browser/chunk-shared.66f18526381931b1ff69c090bad48c408a035a0d256bcff19b19b51ea988612a.js.gz +0 -0
- package/dist/browser/{chunk-shared.0874336833f8101a63b169d8c2e55ca0f281e43e65d4bd6604555c791ea9dd87.js → chunk-shared.782659379fb982a9c2606c051bb711fd0fe38a547b8b4f4620cf2d14a832df25.js} +1 -1
- package/dist/browser/chunk-shared.782659379fb982a9c2606c051bb711fd0fe38a547b8b4f4620cf2d14a832df25.js.br +0 -0
- package/dist/browser/chunk-shared.782659379fb982a9c2606c051bb711fd0fe38a547b8b4f4620cf2d14a832df25.js.gz +0 -0
- package/dist/browser/{chunk-shared.d1f25785c8c168cc75aa99c4be8ca56abfc5eafa3490f8817ff15e61cb901915.js → chunk-shared.8940b7334ec79bcd25cb8e2d41958eecfe71d31340cf8de3c3d99f813cd126af.js} +1 -1
- package/dist/browser/chunk-shared.8940b7334ec79bcd25cb8e2d41958eecfe71d31340cf8de3c3d99f813cd126af.js.br +0 -0
- package/dist/browser/chunk-shared.8940b7334ec79bcd25cb8e2d41958eecfe71d31340cf8de3c3d99f813cd126af.js.gz +0 -0
- package/dist/browser/{chunk-shared.26bb0114998968cccb7bae5f6ffa8979ddecfafd8bc18bb6985760f6bcc030e6.js → chunk-shared.a7e4c6f386cee4623300b0d1b471260a09e05f6e236d56c7814dffc06088fb5c.js} +1 -1
- package/dist/browser/chunk-shared.a7e4c6f386cee4623300b0d1b471260a09e05f6e236d56c7814dffc06088fb5c.js.br +0 -0
- package/dist/browser/chunk-shared.a7e4c6f386cee4623300b0d1b471260a09e05f6e236d56c7814dffc06088fb5c.js.gz +0 -0
- package/dist/browser/{chunk-shared.fd5f2699d3b0017797e5b5e1e1d92eb98818740ebf20a95364bbb7deea0c8242.js → chunk-shared.c9025f6af91453ae8672099cb32126c5967384f769d10c662908e35c31b62478.js} +3 -3
- package/dist/browser/chunk-shared.c9025f6af91453ae8672099cb32126c5967384f769d10c662908e35c31b62478.js.br +0 -0
- package/dist/browser/chunk-shared.c9025f6af91453ae8672099cb32126c5967384f769d10c662908e35c31b62478.js.gz +0 -0
- package/dist/browser/{chunk-sonner.2472e1da55de10b11dc002c80a840966061e817c47793f5e216f1af6c6dbedff.js → chunk-sonner.76904479204cc1375093ccf9b2d60309bf4fb25e41bd0f0523b254404d9a4a11.js} +1 -1
- package/dist/browser/chunk-sonner.76904479204cc1375093ccf9b2d60309bf4fb25e41bd0f0523b254404d9a4a11.js.br +0 -0
- package/dist/browser/chunk-sonner.76904479204cc1375093ccf9b2d60309bf4fb25e41bd0f0523b254404d9a4a11.js.gz +0 -0
- package/dist/browser/chunk-task-view.6fcf84b20eddbbedc54103ca36c5c245ce6e7ccbb161ae0bef4b27027064b771.js +2 -0
- package/dist/browser/chunk-task-view.6fcf84b20eddbbedc54103ca36c5c245ce6e7ccbb161ae0bef4b27027064b771.js.br +0 -0
- package/dist/browser/chunk-task-view.6fcf84b20eddbbedc54103ca36c5c245ce6e7ccbb161ae0bef4b27027064b771.js.gz +0 -0
- package/dist/browser/chunk-team-chat.4cea27fe351f9ce5344da7c4b87240da49394496c12dc95f9e0de0590bb0d720.js +2 -0
- package/dist/browser/chunk-team-chat.4cea27fe351f9ce5344da7c4b87240da49394496c12dc95f9e0de0590bb0d720.js.br +0 -0
- package/dist/browser/chunk-team-chat.4cea27fe351f9ce5344da7c4b87240da49394496c12dc95f9e0de0590bb0d720.js.gz +0 -0
- package/dist/browser/manifest.json +204 -189
- package/dist/browser/{workspace.aebb60d4e5ef4509a80cfaccf0af5f7246867ec7531a1734dd8e28c59594950e.js → workspace.1bd4819cccc49c2c8208df3c1d31e13d3df426ecea80e734ac284cea47b49459.js} +2 -2
- package/dist/browser/workspace.1bd4819cccc49c2c8208df3c1d31e13d3df426ecea80e734ac284cea47b49459.js.br +0 -0
- package/dist/browser/workspace.1bd4819cccc49c2c8208df3c1d31e13d3df426ecea80e734ac284cea47b49459.js.gz +0 -0
- package/dist/browser-lazy-parts.js +1 -1
- package/dist/build-review.js +3 -2
- package/dist/builder.js +4 -3
- package/dist/chat-actions.js +2 -2
- package/dist/code-map-acts.js +1 -1
- package/dist/code-map-admission.js +2 -2
- package/dist/code-map-cli.js +2 -2
- package/dist/companion/push.js +3 -3
- package/dist/contracts/chat-actions.js +1 -1
- package/dist/contracts/console-api.js +1 -1
- package/dist/dispose.js +1 -1
- package/dist/lead-contract.js +1 -1
- package/dist/lead-doors.js +2 -2
- package/dist/local-owner.js +1 -1
- package/dist/operate.js +22 -13
- package/dist/owner-mode.js +2 -2
- package/dist/planner.js +1 -1
- package/dist/project-knowledge.js +1 -1
- package/dist/push-line.js +1 -0
- package/dist/push.js +1 -1
- package/dist/review-switch.js +1 -1
- package/dist/runner.js +2 -2
- package/dist/server/pages-assets.js +2 -2
- package/dist/server/route-table.js +1 -1
- package/dist/server/settings.js +2 -2
- package/dist/server/task-view-data.js +2 -2
- package/dist/server/task-views.js +1 -1
- package/dist/sqlite-telemetry.js +1 -1
- package/dist/ssr-workspace.js +86 -86
- package/dist/store.js +2 -2
- package/dist/surface.js +1 -1
- package/dist/toolroll-update.js +2 -2
- package/dist/work-reads.js +1 -1
- package/package.json +1 -1
- package/dist/browser/chunk-agents-live-view.9f4367c89c6366769a567e729ac9181ccaa898bf3a168d3dc618f3cface887c7.js.br +0 -0
- package/dist/browser/chunk-agents-live-view.9f4367c89c6366769a567e729ac9181ccaa898bf3a168d3dc618f3cface887c7.js.gz +0 -0
- package/dist/browser/chunk-bundle.ac5952c82c76e2efcdcf5a097c4fa235d6f1045dcc36d02ee921ff4be976a46a.js +0 -2
- package/dist/browser/chunk-bundle.ac5952c82c76e2efcdcf5a097c4fa235d6f1045dcc36d02ee921ff4be976a46a.js.br +0 -0
- package/dist/browser/chunk-bundle.ac5952c82c76e2efcdcf5a097c4fa235d6f1045dcc36d02ee921ff4be976a46a.js.gz +0 -0
- package/dist/browser/chunk-chat-parts.2a0b0b723508c5c48379f6a3d441f07a18c8b91ed64fd018962931c5ae43331e.js +0 -4
- package/dist/browser/chunk-chat-parts.2a0b0b723508c5c48379f6a3d441f07a18c8b91ed64fd018962931c5ae43331e.js.br +0 -0
- package/dist/browser/chunk-chat-parts.2a0b0b723508c5c48379f6a3d441f07a18c8b91ed64fd018962931c5ae43331e.js.gz +0 -0
- package/dist/browser/chunk-core.5490609e81c3a5f78da3e06b9795d71c287016ebc7fd02794b1122b474ebb07f.js.br +0 -0
- package/dist/browser/chunk-core.5490609e81c3a5f78da3e06b9795d71c287016ebc7fd02794b1122b474ebb07f.js.gz +0 -0
- package/dist/browser/chunk-flow-view.f5d74c7f072b739a7a0ed86ff35cafa7b8a041233372d1eeaab9eb941ddfc11e.js.br +0 -0
- package/dist/browser/chunk-flow-view.f5d74c7f072b739a7a0ed86ff35cafa7b8a041233372d1eeaab9eb941ddfc11e.js.gz +0 -0
- package/dist/browser/chunk-flows-extra-view.01ebf93780b729363eda11ba21c764fe593bcd3e684aa833c9b86147f780fd41.js.br +0 -0
- package/dist/browser/chunk-flows-extra-view.01ebf93780b729363eda11ba21c764fe593bcd3e684aa833c9b86147f780fd41.js.gz +0 -0
- package/dist/browser/chunk-pages-bundle.e18059f0cb4fbb63e3698971d4c1830ad0945c3645235babc93010cd0b725c1d.js.br +0 -0
- package/dist/browser/chunk-pages-bundle.e18059f0cb4fbb63e3698971d4c1830ad0945c3645235babc93010cd0b725c1d.js.gz +0 -0
- package/dist/browser/chunk-result-view.fc6a6494b316aa786807b7d17035c59defae1bfb0c03bf9c3795679b3a35dd77.js +0 -2
- package/dist/browser/chunk-result-view.fc6a6494b316aa786807b7d17035c59defae1bfb0c03bf9c3795679b3a35dd77.js.br +0 -0
- package/dist/browser/chunk-result-view.fc6a6494b316aa786807b7d17035c59defae1bfb0c03bf9c3795679b3a35dd77.js.gz +0 -0
- package/dist/browser/chunk-settings-view.6dd3a64ded7bd8c047650270918dfb455c9a514a5a40b84c7eb5f443f76fe66f.js +0 -20
- package/dist/browser/chunk-settings-view.6dd3a64ded7bd8c047650270918dfb455c9a514a5a40b84c7eb5f443f76fe66f.js.br +0 -0
- package/dist/browser/chunk-settings-view.6dd3a64ded7bd8c047650270918dfb455c9a514a5a40b84c7eb5f443f76fe66f.js.gz +0 -0
- package/dist/browser/chunk-shared.02c0b692de21a9bb80d1761aa887d8532431171945c02e663884c9f45b796753.js.br +0 -0
- package/dist/browser/chunk-shared.02c0b692de21a9bb80d1761aa887d8532431171945c02e663884c9f45b796753.js.gz +0 -0
- package/dist/browser/chunk-shared.0874336833f8101a63b169d8c2e55ca0f281e43e65d4bd6604555c791ea9dd87.js.br +0 -0
- package/dist/browser/chunk-shared.0874336833f8101a63b169d8c2e55ca0f281e43e65d4bd6604555c791ea9dd87.js.gz +0 -0
- package/dist/browser/chunk-shared.2413dd78f32995fbca67f51ac8c21baf4727cd64f185ea739aa2a058e569b0ed.js +0 -2
- package/dist/browser/chunk-shared.2413dd78f32995fbca67f51ac8c21baf4727cd64f185ea739aa2a058e569b0ed.js.br +0 -0
- package/dist/browser/chunk-shared.2413dd78f32995fbca67f51ac8c21baf4727cd64f185ea739aa2a058e569b0ed.js.gz +0 -0
- package/dist/browser/chunk-shared.26bb0114998968cccb7bae5f6ffa8979ddecfafd8bc18bb6985760f6bcc030e6.js.br +0 -0
- package/dist/browser/chunk-shared.26bb0114998968cccb7bae5f6ffa8979ddecfafd8bc18bb6985760f6bcc030e6.js.gz +0 -0
- package/dist/browser/chunk-shared.6d0b8728b3e309886cfb6eaf596d3f20592939e521bb60bb090824f34da6b086.js.br +0 -0
- package/dist/browser/chunk-shared.6d0b8728b3e309886cfb6eaf596d3f20592939e521bb60bb090824f34da6b086.js.gz +0 -0
- package/dist/browser/chunk-shared.c3e5be1c5f441e94905a4bc2005d816d2a0b0e4108bae43e37ec274a911c6847.js.br +0 -0
- package/dist/browser/chunk-shared.c3e5be1c5f441e94905a4bc2005d816d2a0b0e4108bae43e37ec274a911c6847.js.gz +0 -0
- package/dist/browser/chunk-shared.d1f25785c8c168cc75aa99c4be8ca56abfc5eafa3490f8817ff15e61cb901915.js.br +0 -0
- package/dist/browser/chunk-shared.d1f25785c8c168cc75aa99c4be8ca56abfc5eafa3490f8817ff15e61cb901915.js.gz +0 -0
- package/dist/browser/chunk-shared.fd5f2699d3b0017797e5b5e1e1d92eb98818740ebf20a95364bbb7deea0c8242.js.br +0 -0
- package/dist/browser/chunk-shared.fd5f2699d3b0017797e5b5e1e1d92eb98818740ebf20a95364bbb7deea0c8242.js.gz +0 -0
- package/dist/browser/chunk-sonner.2472e1da55de10b11dc002c80a840966061e817c47793f5e216f1af6c6dbedff.js.br +0 -0
- package/dist/browser/chunk-sonner.2472e1da55de10b11dc002c80a840966061e817c47793f5e216f1af6c6dbedff.js.gz +0 -0
- package/dist/browser/chunk-task-view.bbeddc793a5e8a6d1f66b6cc5f0ce1da18414137e85c49ccd07be0e20f61ac12.js +0 -2
- package/dist/browser/chunk-task-view.bbeddc793a5e8a6d1f66b6cc5f0ce1da18414137e85c49ccd07be0e20f61ac12.js.br +0 -0
- package/dist/browser/chunk-task-view.bbeddc793a5e8a6d1f66b6cc5f0ce1da18414137e85c49ccd07be0e20f61ac12.js.gz +0 -0
- package/dist/browser/chunk-team-chat.c3255a5a1d94e39d559c07438c4690543602b1552b2c2bf57b8791d7f989141d.js +0 -2
- package/dist/browser/chunk-team-chat.c3255a5a1d94e39d559c07438c4690543602b1552b2c2bf57b8791d7f989141d.js.br +0 -0
- package/dist/browser/chunk-team-chat.c3255a5a1d94e39d559c07438c4690543602b1552b2c2bf57b8791d7f989141d.js.gz +0 -0
- package/dist/browser/workspace.aebb60d4e5ef4509a80cfaccf0af5f7246867ec7531a1734dd8e28c59594950e.js.br +0 -0
- package/dist/browser/workspace.aebb60d4e5ef4509a80cfaccf0af5f7246867ec7531a1734dd8e28c59594950e.js.gz +0 -0
package/dist/store.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{CHECK_RECOVERY_HELD,readCheckRecoveryHoldsForTaskRef}from"./check-recovery-hold.js";import{verifyResultImage}from"./chat-evidence.js";import{parseFeedbackImage}from"./result-review.js";import{agentSaidTail}from"./agent-said.js";import{mintSecret}from"./secret-mint.js";import{WRITES_DEFAULT}from"./writes-mode.js";import{checkAccessOf,widerThan}from"./check-access.js";import{PROJECT_SANDBOX_DEFAULT,sandboxOf}from"./project-sandbox.js";import{FAST_PROJECT_NETWORK_DEFAULT,networkFromValue,PROJECT_NETWORK_DEFAULT,projectNetworkFromValue,runNetworkFromValue}from"./egress.js";import{ownerMode}from"./owner-mode.js";import{fullAccessProfile,isAcpProvider}from"./acp-agents.js";import{piBillingOf}from"./pi-build.js";import{ACP_CONFORMANCE_VERSION,launchFromJson}from"./acp-attest.js";import{reclaimDatabase}from"./database-reclaim.js";import{adoptPluginBundles,pluginBundlesShapeProblem,V197_STEPS}from"./plugin-bundles-schema.js";import{acpCheckRepoShapeProblem,adoptAcpCheckRepo,V198_STEPS}from"./acp-check-repo-schema.js";import{adoptFastOwner,fastOwnerShapeProblem,V199_STEPS}from"./fast-owner-schema.js";import{BASELINE_SCHEMA,BASELINE_SCHEMA_VERSION}from"./store-baseline.js";import{codeMapRemoteChanged,forgetCodeMap}from"./code-map-store.js";import{readStamps,stampDigest,stampRefusal}from"./check-stamp.js";import{LEAD_FAILURE_DETAILS,LEAD_ROUTES}from"./lead-latency-schema.js";import{V190_DROPPED_INDEXES,V190_INDEXES,V190_STEPS}from"./query-index-schema.js";import{V177_SCHEMA,V177_OBJECTS,WORKSPACE_ID_PATTERN,RECOVERY_GENERATION_PATTERN}from"./workspace-identity-schema.js";import{adoptChatAttachments,adoptCompanionPushTokens,adoptPhoneVia,chatAttachmentShapeProblem,companionChatShapeProblem,companionPasskeyShapeProblem,companionPushTokensShapeProblem,companionShapeProblem,phoneViaShapeProblem,V191_STEPS,V192_STEPS,V194_STEPS}from"./companion/schema.js";import{triggerApnsWithdrawalsForStore}from"./companion/push.js";import{adoptPhoneApprovals,phoneApprovalsShapeProblem,V193_STEPS}from"./phone-approvals-schema.js";import{acpProvidersShapeProblem,adoptAcpProviders,V195_STEPS}from"./acp-providers-schema.js";import{adoptDirectChatSpend,adoptEveryAgent,directChatSpendShapeProblem,everyAgentShapeProblem,importPiThreads,removeImportedPiSidecar,V196_STEPS}from"./every-agent-schema.js";import{endThreadAuthorityFor}from"./agent-thread/custody.js";import{relayCancel}from"./agent-thread/guards.js";import{endLapsedFlexible}from"./agent-thread/guards.js";import{refArchived,taskArchived,taskCancelled}from"./task-archive.js";export{refArchived,taskArchived}from"./task-archive.js";import{CHAT_PROVIDERS,CHAT_TABLES}from"./contracts/chat-tables.js";import"./chat-core.js";import{ChatMessages,TELEGRAM_HOLD_REASONS,TELEGRAM_SKIPPED_ELSEWHERE,TELEGRAM_SKIPPED_OTHER_CHAT,TELEGRAM_SKIPPED_QUIET,TELEGRAM_UNSETTLED}from"./chat-messages.js";import{isLifecycleNotification,isTelegramProgressNotification,LIFECYCLE_KEY_PREFIX,LIFECYCLE_KINDS,proposalTaskOf,readNotification}from"./notification-rows.js";import{ServerTelemetry}from"./server-telemetry.js";import{instrumentDatabase,measureWriteWait}from"./sqlite-telemetry.js";import{tuneConnection}from"./db-tuning.js";import{trackWorkspaceWrites}from"./workspace-revision.js";import{parseStoreColumn,readStoreColumn,readStoreStringifiedList,readStoreTextList}from"./contracts/store-json.js";import{assessmentFromSavedEvidence,verificationEvidence}from"./verification-evidence.js";import{queueLearning}from"./project-learning.js";import{closeRunQuestions,mintAttemptKey,watchedPing}from"./agent-board.js";import{validateTaskText}from"./task-text.js";import{flowDefinitionForStore,flowDefinitionFromStore}from"./flows.js";import{cardOutputsForStore,cardOutputsFromStore}from"./contracts/stage-output.js";import{chatControlHref,chatResultHref}from"./chat-controls.js";import{actorLabel,currentActor}from"./actor.js";import{scanForSecrets}from"./evidence.js";import{LIVE_ACTIVITY_KINDS}from"./live.js";import{hashSecret,mintLeadToken,parseCredential,secretMatches,tokenPurpose,tokenRotationProblem}from"./api-tokens.js";import{admitTrialRun,bumpModelsGeneration,forgetProjectRoutes,liveEarnedRules,liveTrialFor,noteExposureCancelled,noteExposureFiled,noteExposureSealed,releaseTrialPlaces,reserveTrialPlace,ruleHoldOf,settleTrialPlaces,trialSealProblem,writeRunCohort}from"./route-store.js";import{createHash,randomBytes,randomUUID,timingSafeEqual}from"node:crypto";import{existsSync,mkdirSync,statSync,unlinkSync}from"node:fs";import{createRequire}from"node:module";import{execFileSync}from"node:child_process";import{dirname}from"node:path";import{hostname}from"node:os";import{ownedProcessCount,runOwnerTag}from"./exec.js";import{worktreeProcessOccupancy}from"./worktree.js";import{processMayBeAlive}from"./process-liveness.js";import{currentBootId,provenDeadByBootChange}from"./boot-identity.js";import{currentMachineId,isThisMachine,liveHostAliases,rememberHostAliases,thisMachine}from"./machine-identity.js";import{containerEmptiness}from"./container-state.js";import{hasDisguisedText,hasForbiddenControls,validateNote}from"./decision.js";import{ACTIVITY_ONLY_KINDS}from"./needs-you.js";import{parseReviewContext,reviewContextCustodyProblem}from"./review-context.js";import{foldReview,manualReviewOnly}from"./proof.js";import{hashPassword,liveReleaseOf}from"./scope.js";import{declareNewInstallSolo}from"./install-mode.js";import{currentLocalOwner,LOCAL_MODE_CONFINES,LOCAL_OWNER_LAPSED,localModeOn,localOwnerInFlight,localOwnerStandsNow}from"./local-owner.js";import{nightlyDebtHold}from"./nightly-github.js";import{releaseCiHoldOf,releaseCiRunningOf}from"./release-ci-hold.js";import{APPROVAL_BASES,approvalOf,machineActing,personProof,proofDetailOf,quarantinedAuthor,sealOriginOf,digestOf,canonicalProfileJson,chainFromJson,liveChainFromJson,CHAIN_DIGEST_VERSION,LIVE_CHAIN_VERSION,profileDigestOf,profileFromJson,scopeAuthorityOf,routeParityProblem,parseAcceptanceCriteria,exactAcceptance,exactStringList,exactSafeIntegerOrNull}from"./scope.js";import{resolveScopeProfile,resolveRouteCandidates,exactPinOf,routeOfTask,agentChoicesFor}from"./agentconfig.js";import{bindRunToWalk,chainForFiling,chainJsonOf,chainSealProblem,fallbackStampProblem}from"./fallback.js";import{canonicalOverridesJson,canonicalRouteJson,isRiskLevel,isTaskSize,headroomFrom,makesNoPlan,legOf,overridesFromJson,phaseOfRole,recommendRoute,routeDigestOf,routeFromJson,routeProblems,routeStampProblem,ROUTE_ERA,PROVIDER_ID_LIST}from"./phase-routing.js";import{readAuthModeStrict}from"./keys.js";import{modeDigestOf,modeTermsFromJson}from"./modes.js";import{readVerifiedArtifact}from"./evidence.js";import"./provider.js";import{authenticate as runnerAuthenticate}from"./runner.js";import{stampNewProjectLevel}from"./check-levels.js";import{parseCheckProgressSnapshot}from"./check-progress.js";import{authorityStandsSql}from"./approval-authority.js";import{clearRetryEpisode,settleVanished}from"./vanished-retry.js";import{issueImported}from"./task-source.js";import{releasePolicyDigest,serializeReleaseCheckPurpose,storedReleaseCheckPurpose,storedReleaseTerms,readReleaseTerms}from"./contracts/release-terms.js";import{normalizeProjectAccess,projectAccessAllows,readProjectAccess}from"./project-access.js";import{recordActionWhole}from"./action-ledger.js";import{endUnattendedGrants}from"./flow-unattended.js";import{flowChanged}from"./flow-changed.js";import{agentRefusal,approvalRefusal,policyParts,readPolicy,underCeiling,sessionCeilingRefusal}from"./policy.js";import{reviewSwitchWords}from"./review-switch.js";import{billingOf,budgetStates,canPrice,claudeMachineBilling,countsToward,filersOf,monthOf,priceWork,seenBilling as seenBillingOf,spendItems,subagentFilers,usd}from"./spend.js";import{DEFAULT_PERIODS,periodWords}from"./retention.js";import{DEFAULT_CLEANUP,DEFAULT_IDLE,cleanupWords,idleWords}from"./storage.js";import{inReadOnlyRequest}from"./read-only-request.js";import{IN_RANGE,safeWhole,sealLedger,verifyLedgerChain}from"./ledger-chain.js";import{NO_RULES,filerFor,isProtectedWork,protectedChanges,rulesWords}from"./approval-policy.js";import{configBase,envValue,namedPath,headWithin,withoutLeadTokenEnv}from"./names.js";import{chatTurnAmountOf,combineReportedModels,providerTurnsOf,reportedCostUsdOf,reportedModelOf,runAmountOf}from"./reported-usage.js";import{usageOf}from"./run-efficiency.js";import{endedInterrupted,wasInterrupted}from"./run-ending.js";import{YOUIYOUX_FILED_VIA}from"./contracts/youiyoux-request.js";import{cardShowsScope,cardTermsDigest,shownTermsDigest}from"./chat-terms.js";import{markedRunningSql,moveTask}from"./task-moves.js";const STORE_MONEY_METHODS=Object.freeze(["recordUsage","settleRunSpend","fixRunBilling","finalizeChatTurn"]),builtinDefineProperty=Object.defineProperty,builtinGetOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,builtinFreeze=Object.freeze,builtinIsFrozen=Object.isFrozen,SEALED_MONEY_METHODS=Object.create(null);function budgetName(scope,key){return scope==="installation"?"everything":`${scope} ${key}`}export function leadTimeoutNotice(keptProposals,unknownCost=!1){return[unknownCost?"The reply took too long and was stopped, and its cost isn't known yet, so chat is paused.":"The reply took too long and was stopped.",keptProposals?"What it proposed is below.":null,unknownCost?"Confirm the cost on the Chat page to turn chat back on.":"Send your message again, or ask for less at once."].filter(part=>part!==null).join(" ")}export function leadTurnKeepsProposals(turn){return turn!==null&&(turn.state==="answered"||turn.state==="failed"&&(turn.failureReason==="timeout"||turn.failureReason==="crashed"))}const SECURITY_KINDS=new Set(["secret-detected","security-release"]),SPENT_KINDS=new Set(["attempts-exhausted","plan-attempts-exhausted"]);export function stopFactOf(store,runId){if(typeof store.stopQuiescenceFact=="function")return store.stopQuiescenceFact(runId);const problem=store.stopQuiescenceProblem(runId);if(problem===null)return null;const kind=/still open|does not exist/.test(problem)?"open":/another host/.test(problem)?"elsewhere":/may still be running|still has|held by|has not finished|still has members/.test(problem)?"alive":/cannot be proven|could not be established|incomplete native/.test(problem)?"unknown":"unprovable";return{run:Number(/run #(\d+)/.exec(problem)?.[1]??runId),kind,problem}}export const LEAD_ASK_OTHER="Something else",LEAD_ASK_TTL_MS=7*864e5,LEAD_FOLLOW_MESSAGE="Automatic crew update: inspect the saved results or decisions and tell me what needs attention. Do not rerun work.",DEFAULT_BACKUP_SETTINGS={enabled:!0,everyHours:24,keep:7,folder:null};export function backupSettingsWords(settings){return settings.enabled?`every ${settings.everyHours===1?"hour":`${settings.everyHours} hours`}, keep ${settings.keep}, ${settings.folder??"the default folder"}`:`off, keep ${settings.keep}, ${settings.folder??"the default folder"}`}const isCheckExitCode=value=>value===null||Number.isSafeInteger(value)&&Number(value)>=0&&Number(value)<=2147483647;export function checkSuitesOf(value){try{const read=readStoreColumn("run_check.suites_json",value??"[]");return read.ok?read.value.filter(one=>{if(one===null||typeof one!="object")return!1;const row=one;return typeof row.name=="string"&&row.name.trim()!==""&&row.name.length<=80&&["passed","failed","not-run"].includes(String(row.status))&&isCheckExitCode(row.exitCode)}).slice(0,8):[]}catch{return[]}}const REGISTERED_AT_FILING="again, as it was filed";export const SCHEMA_VERSION=199,MIN_COMPAT_SCHEMA_VERSION=190,UPDATE_SAFE_MIGRATIONS=Object.freeze([191,192,193,194,195,196,197,198,199]);export{V190_STEPS,V191_STEPS,V192_STEPS,V193_STEPS,V194_STEPS,V195_STEPS,V196_STEPS,V197_STEPS,V198_STEPS,V199_STEPS};export const V149_TABLES=Object.freeze(["check_result","check_fact","local_observation","ci_flaky_observation","ci_pairing_rejected","learning_watch","lesson_note_tally","lesson_note","memory_use","memory_tidy_proposal","decision_merge"]),V149_REPO_TABLES=Object.freeze(["check_fact","local_observation","ci_flaky_observation","learning_watch","lesson_note","memory_use","memory_tidy_proposal"]);const V178_INDEX="action_ledger_action",V178_SCHEMA="CREATE INDEX IF NOT EXISTS action_ledger_action ON action_ledger(action, id) WHERE action = 'checks recovery held';";export function updateSafeSchema(version){if(version===null||!Number.isSafeInteger(version)||version<=0||version>SCHEMA_VERSION)return!1;for(let next=version+1;next<=SCHEMA_VERSION;next++)if(!UPDATE_SAFE_MIGRATIONS.includes(next))return!1;return!0}const stringList=raw=>{try{const value=JSON.parse(String(raw));return Array.isArray(value)&&value.every(one=>typeof one=="string")?value:[]}catch{return[]}};export const BUILT_IN="built-in",LEAD_THREAD={kind:"lead"};function readLeadMessageRow(row){return{id:Number(row.id),thread:Number(row.thread),turn:optNum(row.turn),role:String(row.role),text:String(row.text),activity:optStr(row.activity),createdAt:String(row.created_at),...Number(row.pending??0)===1?{pending:!0}:{}}}function readSubagentMemory(row){return{id:Number(row.id),subagent:Number(row.subagent),text:String(row.text),source:String(row.source),card:optNum(row.card),createdBy:String(row.created_by),createdAt:String(row.created_at),updatedBy:String(row.updated_by),updatedAt:String(row.updated_at),usedAt:optStr(row.used_at)}}function readSubagentSuggestion(row){const parsed=(column,key,fallback)=>{const read=readStoreColumn(column,row[key]);return read.ok?read.value:fallback};return{id:Number(row.id),subagent:Number(row.subagent),tool:String(row.tool),action:String(row.action),rule:parsed("subagent_suggestion.rule_json","rule_json",{use:"ask"}),was:parsed("subagent_suggestion.was_json","was_json",{use:"ask"}),evidence:parsed("subagent_suggestion.evidence_json","evidence_json",[]),said:String(row.said),state:String(row.state),decidedBy:optStr(row.decided_by),decidedAt:optStr(row.decided_at),createdAt:String(row.created_at)}}function readSubagentCall(row){const text=key=>row[key]===null||row[key]===void 0?null:String(row[key]),read=readStoreColumn("subagent_call.input_json",row.input_json),input=read.ok?read.value:{};return{id:Number(row.id),subagent:Number(row.subagent),card:Number(row.card),entry:Number(row.entry),tool:String(row.tool),action:String(row.action),input,rule:String(row.rule),why:String(row.why),state:String(row.state),result:text("result"),decidedBy:text("decided_by"),decidedAt:text("decided_at"),createdAt:String(row.created_at),doneAt:text("done_at"),undoOf:optNum(row.undo_of),undoneBy:text("undone_by"),undoneAt:text("undone_at")}}function readSubagentGrant(row){const parsed=(column,key,fallback)=>{const read=readStoreColumn(column,row[key]);return read.ok?read.value:fallback};return{subagent:Number(row.subagent),tool:String(row.tool),actions:parsed("subagent_tool.actions_json","actions_json",[]),rules:parsed("subagent_tool.rules_json","rules_json",{}),listedAt:optStr(row.listed_at),updatedBy:String(row.updated_by),updatedAt:String(row.updated_at)}}function readSubagentRow(row){return{id:Number(row.id),repo:String(row.repo),handle:String(row.handle),state:String(row.state),version:Number(row.version),soul:String(row.soul),model:optStr(row.model),codexBackupModel:typeof row.codex_backup_model=="string"?row.codex_backup_model:null,authorityGeneration:Number(row.authority_generation??0),dailyTurns:Number(row.daily_turns),manager:String(row.manager),createdBy:String(row.created_by),createdAt:String(row.created_at),updatedBy:String(row.updated_by),updatedAt:String(row.updated_at),summaryAt:optStr(row.summary_at),deskFlow:optNum(row.desk_flow),weeklyAt:optStr(row.weekly_at)}}function readSubagentQuestion(row){const text=key=>row[key]===null||row[key]===void 0?null:String(row[key]);return{id:Number(row.id),subagent:Number(row.subagent),card:Number(row.card),entry:Number(row.entry),question:String(row.question),options:parseStoreColumn("subagent_question.options_json",row.options_json),askedOf:String(row.asked_of),state:String(row.state),choice:text("choice"),answer:text("answer"),answeredBy:text("answered_by"),answeredVia:text("answered_via"),answeredAt:text("answered_at"),createdAt:String(row.created_at),toolCall:optNum(row.tool_call),suggestion:optNum(row.suggestion)}}function readFlowRow(row){return{id:Number(row.id),repo:String(row.repo),name:String(row.name),definitionJson:flowDefinitionFromStore(String(row.definition_json)),revision:Number(row.revision),state:String(row.state),createdBy:String(row.created_by),createdAt:String(row.created_at),updatedBy:String(row.updated_by),updatedAt:String(row.updated_at),owner:row.owner===null||row.owner===void 0?String(row.created_by):String(row.owner)}}function readFlowScriptRow(row){return{id:Number(row.id),repo:String(row.repo),name:String(row.name),about:String(row.about),body:String(row.body),timeoutMinutes:Number(row.timeout_minutes),version:Number(row.version),digest:String(row.digest),savedBy:String(row.saved_by),savedAt:String(row.saved_at),language:row.language==="python"||row.language==="node"?row.language:"shell",file:optStr(row.file),held:optStr(row.held)}}function readFlowStepRunRow(row){const optional=key=>row[key]===null||row[key]===void 0?null:String(row[key]),number=key=>row[key]===null||row[key]===void 0?null:Number(row[key]);return{card:Number(row.card),entry:Number(row.entry),stage:String(row.stage),kind:String(row.kind),script:optional("script"),scriptVersion:number("script_version"),state:String(row.state),attempts:Number(row.attempts),nextAt:optional("next_at"),startedAt:String(row.started_at),finishedAt:optional("finished_at"),durationMs:number("duration_ms"),exitCode:number("exit_code"),result:optional("result"),log:optional("log"),decisionJson:optional("decision_json")}}function readFlowCardRow(row){const{outputs,attached}=cardOutputsFromStore(String(row.outputs_json??"{}")),optional=key=>row[key]===null||row[key]===void 0?null:String(row[key]);return{id:Number(row.id),flow:Number(row.flow),title:String(row.title),description:optional("description"),stage:String(row.stage),entry:Number(row.entry),state:String(row.state),task:optional("task"),primaryTask:optional("primary_task"),note:optional("note"),waiting:optional("waiting"),outputs,attached,createdBy:String(row.created_by),createdAt:String(row.created_at),updatedAt:String(row.updated_at),source:readFlowCardSource(row.source_json),owner:optional("owner"),createdKind:row.created_kind==="automation"?"automation":"person"}}function readFlowCardSource(value){if(typeof value!="string")return null;const read=readStoreColumn("flow_card.source_json",value);if(!read.ok)return null;try{const parsed=read.value,mail=parsed.mail!==null&&typeof parsed.mail=="object"?parsed.mail:null,chat=parsed.chat!==null&&typeof parsed.chat=="object"?parsed.chat:null,external=parsed.external!==null&&typeof parsed.external=="object"?parsed.external:null;return{kind:String(parsed.kind??""),label:parsed.label,url:typeof parsed.url=="string"?parsed.url:null,...mail===null||typeof mail.from!="string"?{}:{mail:{id:typeof mail.id=="string"?mail.id:null,references:Array.isArray(mail.references)?mail.references.filter(one=>typeof one=="string"):[],subject:typeof mail.subject=="string"?mail.subject:"",from:mail.from}},...chat===null||typeof chat.app!="string"||typeof chat.chat!="string"||typeof chat.thread!="string"||typeof chat.binding!="number"?{}:{chat:{app:chat.app,installation:String(chat.installation??""),chat:chat.chat,conversation:typeof chat.conversation=="string"?chat.conversation:chat.chat,thread:chat.thread,binding:chat.binding}},...typeof parsed.verified=="string"?{verified:parsed.verified}:{},...external===null?{}:{external:{id:typeof external.id=="string"?external.id:null,url:typeof external.url=="string"?external.url:null}},...typeof parsed.receipt=="string"?{receipt:parsed.receipt}:{}}}catch{return null}}function readFlowTriggerRow(row){const optional=key=>row[key]===null||row[key]===void 0?null:String(row[key]);return{id:Number(row.id),flow:Number(row.flow),kind:String(row.kind),configJson:String(row.config_json),state:String(row.state),hookHash:optional("hook_hash"),cursor:optional("cursor"),nextAt:optional("next_at"),lastAt:optional("last_at"),lastOutcome:optional("last_outcome"),failures:Number(row.failures??0),createdBy:String(row.created_by),createdAt:String(row.created_at),updatedAt:String(row.updated_at),hookCredential:row.hook_credential===null||row.hook_credential===void 0?"legacy":String(row.hook_credential),droppedCount:Number(row.dropped_count??0),droppedSince:optional("dropped_since")}}function readFlowReceipt(row){const card=optNum(row.card),state=row.state===null||row.state===void 0?card===null?"skipped":"accepted":String(row.state),optional=key=>row[key]===null||row[key]===void 0?null:String(row[key]);return{state,card,note:optional("note"),at:String(row.at),acceptedAt:optional("accepted_at"),itemJson:optional("item_json")}}export function parseCapabilityKey(key){const split=key.indexOf(":");if(split<=0||split===key.length-1)return null;const kind=key.slice(0,split);return["env","cli","mcp","ci","other"].includes(kind)?{kind,name:key.slice(split+1)}:null}function lifecycleWords(value,cap){if(scanForSecrets(value).length>0||/\b\d{5,}:[A-Za-z0-9_-]{20,}\b/.test(value))return"[sensitive text hidden]";const text=value.replace(/(?:[A-Za-z]:[\\/]|\\\\)[^\s"'<>]+/g,"[path]").replace(/(^|[\s"'`(<[=:,])\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+/g,"$1[path]").replace(/\b[0-9a-f]{32,}\b/gi,"[digest]").replace(/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2060-\u206f]/g," ").replace(/\s+/g," ").trim();return text.length<=cap?text:`${text.slice(0,cap-1).replace(/[\uD800-\uDBFF]$/,"")}…`}const LIFECYCLE_PHASE_WORDS={"agent-running":{subject:"agent working",body:"The agent is working in its own checkout. Nothing is finished yet."},"validating-handoff":{subject:"checking the handoff",body:"The agent finished its turn; what it handed back is being checked."},"capturing-evidence":{subject:"saving its files",body:"The diff, checks and report are being saved."},committing:{subject:"committing",body:"The work is being committed on the task branch."},"verifying-proof":{subject:"checking the report",body:"The report is being checked against the approved requirements."},"correcting-proof":{subject:"correcting the report",body:"The report didn't match the saved result; one short correction turn is running."}};function cancellationWords(reason){if(reason===null||reason.trim()==="")return"Cancelled by an operator.";const words=lifecycleWords(reason,120);return`Cancelled by an operator: ${words}${/[.!?…]$/.test(words)?"":"."}`}const LIFECYCLE_REVIEW_WORDS={verified:{subject:"checks verified",body:"Every requirement was checked against the saved result."},refuted:{subject:"the report doesn't match the result",body:"The reviewer found something that contradicts the saved result. It is not accepted as done."},attested:{subject:"only the agent's own checks",body:"The result rests on checks the agent reported, not checked independently."},short:{subject:"a requirement isn't shown",body:"Something a requirement needs is missing from the saved result."},none:{subject:"comments only",body:"The reviewer left comments; no acceptance judgement was recorded."}},LIFECYCLE_HOLD_WORDS={operator:"an operator's hold",decision:"an unanswered question",incident:"an unresolved incident",backoff:"its retry backoff",revision:"a plan revision awaiting approval",stop:"a stopped attempt that has not been resumed"};export const RESULT_SCREENSHOTS=["off","first","all"],RESULT_SHOTS_KIND="result-screenshots",FLOW_SHOTS_KIND="flow-screenshots",QUIET_GROUP_MS=6e4;export function isDigestTime(value){return/^(?:[01][0-9]|2[0-3]):[0-5][0-9]$/.test(value)}export const RUN_PHASES=["agent-running","validating-handoff","capturing-evidence","committing","verifying-proof","correcting-proof"],DEFAULT_ACTOR="operator";export class RunAdmissionRefused extends Error{constructor(message){super(message),this.name="RunAdmissionRefused"}}export function databasePath(env,home){const isolated=envValue(env,"DB");return isolated!==void 0&&isolated!==""?isolated:namedPath(configBase(env,home),["orders.db"])}export const CONCURRENT_WRITER_WAIT_MS=15e3,BRIEF_WRITER_WAIT_MS=500;const briefBudgets=new WeakMap;function waitForConcurrentWriter(db,waitMs=CONCURRENT_WRITER_WAIT_MS){db.exec(`PRAGMA busy_timeout = ${waitMs}`)}const WRITE_WAIT_SLICE_MS=100;export function isDatabaseBusy(error){const code=error?.errcode;return typeof code=="number"&&(code&255)===5}function beginWriteWithin(db,budgetMs,restoreMs=CONCURRENT_WRITER_WAIT_MS){measureWriteWait(db,()=>beginWriteAttempt(db,budgetMs,restoreMs))}function beginWriteAttempt(db,budgetMs,restoreMs=CONCURRENT_WRITER_WAIT_MS){const deadline=performance.now()+budgetMs;db.exec(`PRAGMA busy_timeout = ${WRITE_WAIT_SLICE_MS}`);try{for(;;)try{db.exec("BEGIN IMMEDIATE");return}catch(error){if(!isDatabaseBusy(error)||performance.now()>=deadline)throw error}}finally{waitForConcurrentWriter(db,restoreMs)}}export function openStore(file,options={}){const connect=options.connect??defaultConnect;file!==":memory:"&&mkdirSync(dirname(file),{recursive:!0,mode:448});const db=connect(file);try{return waitForConcurrentWriter(db),initializeStore(db,file,options)}catch(error){try{db.close()}catch{}throw error}}function compactSettledRunProcesses(db,now,only=null){const runs=dbMapAll(db,"SELECT p.run FROM run_process p JOIN run r ON r.id = p.run WHERE r.outcome IS NOT NULL AND r.finished_at IS NOT NULL AND (? IS NULL OR p.run = ?) GROUP BY p.run HAVING COUNT(*) = COUNT(p.exited_at)",row=>Number(row.run),only,only);if(runs.length===0)return 0;const summarize=db.prepare(`INSERT INTO run_process_summary (run, witnesses, process_groups, first_observed_at, last_observed_at, last_exited_at, settled_at) SELECT run, COUNT(*), SUM(process_group), MIN(observed_at),
|
|
1
|
+
import{CHECK_RECOVERY_HELD,readCheckRecoveryHoldsForTaskRef}from"./check-recovery-hold.js";import{verifyResultImage}from"./chat-evidence.js";import{parseFeedbackImage}from"./result-review.js";import{agentSaidTail}from"./agent-said.js";import{mintSecret}from"./secret-mint.js";import{WRITES_DEFAULT}from"./writes-mode.js";import{checkAccessOf,widerThan}from"./check-access.js";import{PROJECT_SANDBOX_DEFAULT,sandboxOf}from"./project-sandbox.js";import{FAST_PROJECT_NETWORK_DEFAULT,networkFromValue,PROJECT_NETWORK_DEFAULT,projectNetworkFromValue,runNetworkFromValue}from"./egress.js";import{ownerMode}from"./owner-mode.js";import{fullAccessProfile,isAcpProvider}from"./acp-agents.js";import{piBillingOf}from"./pi-build.js";import{ACP_CONFORMANCE_VERSION,launchFromJson}from"./acp-attest.js";import{reclaimDatabase}from"./database-reclaim.js";import{adoptPluginBundles,pluginBundlesShapeProblem,V197_STEPS}from"./plugin-bundles-schema.js";import{acpCheckRepoShapeProblem,adoptAcpCheckRepo,V198_STEPS}from"./acp-check-repo-schema.js";import{adoptFastOwner,fastOwnerShapeProblem,V199_STEPS}from"./fast-owner-schema.js";import{BASELINE_SCHEMA,BASELINE_SCHEMA_VERSION}from"./store-baseline.js";import{codeMapRemoteChanged,forgetCodeMap}from"./code-map-store.js";import{readStamps,stampDigest,stampRefusal}from"./check-stamp.js";import{LEAD_FAILURE_DETAILS,LEAD_ROUTES}from"./lead-latency-schema.js";import{V190_DROPPED_INDEXES,V190_INDEXES,V190_STEPS}from"./query-index-schema.js";import{V177_SCHEMA,V177_OBJECTS,WORKSPACE_ID_PATTERN,RECOVERY_GENERATION_PATTERN}from"./workspace-identity-schema.js";import{adoptChatAttachments,adoptCompanionPushTokens,adoptPhoneVia,chatAttachmentShapeProblem,companionChatShapeProblem,companionPasskeyShapeProblem,companionPushTokensShapeProblem,companionShapeProblem,phoneViaShapeProblem,V191_STEPS,V192_STEPS,V194_STEPS}from"./companion/schema.js";import{triggerApnsWithdrawalsForStore}from"./companion/push.js";import{adoptPhoneApprovals,phoneApprovalsShapeProblem,V193_STEPS}from"./phone-approvals-schema.js";import{acpProvidersShapeProblem,adoptAcpProviders,V195_STEPS}from"./acp-providers-schema.js";import{adoptDirectChatSpend,adoptEveryAgent,directChatSpendShapeProblem,everyAgentShapeProblem,importPiThreads,removeImportedPiSidecar,V196_STEPS}from"./every-agent-schema.js";import{endThreadAuthorityFor}from"./agent-thread/custody.js";import{relayCancel}from"./agent-thread/guards.js";import{endLapsedFlexible}from"./agent-thread/guards.js";import{refArchived,taskArchived,taskCancelled}from"./task-archive.js";export{refArchived,taskArchived}from"./task-archive.js";import{CHAT_PROVIDERS,CHAT_TABLES}from"./contracts/chat-tables.js";import"./chat-core.js";import{ChatMessages,TELEGRAM_HOLD_REASONS,TELEGRAM_SKIPPED_ELSEWHERE,TELEGRAM_SKIPPED_OTHER_CHAT,TELEGRAM_SKIPPED_QUIET,TELEGRAM_UNSETTLED}from"./chat-messages.js";import{isLifecycleNotification,isTelegramProgressNotification,LIFECYCLE_KEY_PREFIX,LIFECYCLE_KINDS,proposalTaskOf,readNotification}from"./notification-rows.js";import{ServerTelemetry}from"./server-telemetry.js";import{instrumentDatabase,measureWriteWait,throughRequestReads}from"./sqlite-telemetry.js";import{tuneConnection}from"./db-tuning.js";import{trackWorkspaceWrites}from"./workspace-revision.js";import{parseStoreColumn,readStoreColumn,readStoreStringifiedList,readStoreTextList}from"./contracts/store-json.js";import{assessmentFromSavedEvidence,verificationEvidence}from"./verification-evidence.js";import{queueLearning}from"./project-learning.js";import{closeRunQuestions,mintAttemptKey,watchedPing}from"./agent-board.js";import{validateTaskText}from"./task-text.js";import{flowDefinitionForStore,flowDefinitionFromStore}from"./flows.js";import{cardOutputsForStore,cardOutputsFromStore}from"./contracts/stage-output.js";import{chatControlHref,chatResultHref}from"./chat-controls.js";import{actorLabel,currentActor}from"./actor.js";import{scanForSecrets}from"./evidence.js";import{LIVE_ACTIVITY_KINDS}from"./live.js";import{hashSecret,mintLeadToken,parseCredential,secretMatches,tokenPurpose,tokenRotationProblem}from"./api-tokens.js";import{admitTrialRun,bumpModelsGeneration,forgetProjectRoutes,liveEarnedRules,liveTrialFor,noteExposureCancelled,noteExposureFiled,noteExposureSealed,releaseTrialPlaces,reserveTrialPlace,ruleHoldOf,settleTrialPlaces,trialSealProblem,writeRunCohort}from"./route-store.js";import{createHash,randomBytes,randomUUID,timingSafeEqual}from"node:crypto";import{existsSync,mkdirSync,statSync,unlinkSync}from"node:fs";import{createRequire}from"node:module";import{execFileSync}from"node:child_process";import{dirname}from"node:path";import{hostname}from"node:os";import{ownedProcessCount,runOwnerTag}from"./exec.js";import{worktreeProcessOccupancy}from"./worktree.js";import{processMayBeAlive}from"./process-liveness.js";import{currentBootId,provenDeadByBootChange}from"./boot-identity.js";import{currentMachineId,isThisMachine,liveHostAliases,rememberHostAliases,thisMachine}from"./machine-identity.js";import{containerEmptiness}from"./container-state.js";import{hasDisguisedText,hasForbiddenControls,validateNote}from"./decision.js";import{ACTIVITY_ONLY_KINDS}from"./needs-you.js";import{parseReviewContext,reviewContextCustodyProblem}from"./review-context.js";import{foldReview,manualReviewOnly}from"./proof.js";import{hashPassword,liveReleaseOf}from"./scope.js";import{declareNewInstallSolo}from"./install-mode.js";import{currentLocalOwner,LOCAL_MODE_CONFINES,LOCAL_OWNER_LAPSED,localModeOn,localOwnerInFlight,localOwnerStandsNow}from"./local-owner.js";import{nightlyDebtHold}from"./nightly-github.js";import{releaseCiHoldOf,releaseCiRunningOf}from"./release-ci-hold.js";import{APPROVAL_BASES,approvalOf,machineActing,personProof,proofDetailOf,quarantinedAuthor,sealOriginOf,digestOf,canonicalProfileJson,chainFromJson,liveChainFromJson,CHAIN_DIGEST_VERSION,LIVE_CHAIN_VERSION,profileDigestOf,profileFromJson,scopeAuthorityOf,routeParityProblem,parseAcceptanceCriteria,exactAcceptance,exactStringList,exactSafeIntegerOrNull}from"./scope.js";import{resolveScopeProfile,resolveRouteCandidates,exactPinOf,routeOfTask,agentChoicesFor}from"./agentconfig.js";import{bindRunToWalk,chainForFiling,chainJsonOf,chainSealProblem,fallbackStampProblem}from"./fallback.js";import{canonicalOverridesJson,canonicalRouteJson,isRiskLevel,isTaskSize,headroomFrom,makesNoPlan,legOf,overridesFromJson,phaseOfRole,recommendRoute,routeDigestOf,routeFromJson,routeProblems,routeStampProblem,ROUTE_ERA,PROVIDER_ID_LIST}from"./phase-routing.js";import{readAuthModeStrict}from"./keys.js";import{modeDigestOf,modeTermsFromJson}from"./modes.js";import{readVerifiedArtifact}from"./evidence.js";import"./provider.js";import{authenticate as runnerAuthenticate}from"./runner.js";import{stampNewProjectLevel}from"./check-levels.js";import{parseCheckProgressSnapshot}from"./check-progress.js";import{authorityStandsSql}from"./approval-authority.js";import{clearRetryEpisode,settleVanished}from"./vanished-retry.js";import{issueImported}from"./task-source.js";import{releasePolicyDigest,serializeReleaseCheckPurpose,storedReleaseCheckPurpose,storedReleaseTerms,readReleaseTerms}from"./contracts/release-terms.js";import{normalizeProjectAccess,projectAccessAllows,readProjectAccess}from"./project-access.js";import{recordActionWhole}from"./action-ledger.js";import{endUnattendedGrants}from"./flow-unattended.js";import{flowChanged}from"./flow-changed.js";import{agentRefusal,approvalRefusal,policyParts,readPolicy,underCeiling,sessionCeilingRefusal}from"./policy.js";import{reviewSwitchWords}from"./review-switch.js";import{billingOf,budgetStates,canPrice,claudeMachineBilling,countsToward,filersOf,monthOf,priceWork,seenBilling as seenBillingOf,spendItems,subagentFilers,usd}from"./spend.js";import{DEFAULT_PERIODS,periodWords}from"./retention.js";import{DEFAULT_CLEANUP,DEFAULT_IDLE,cleanupWords,idleWords}from"./storage.js";import{inReadOnlyRequest}from"./read-only-request.js";import{IN_RANGE,safeWhole,sealLedger,verifyLedgerChain}from"./ledger-chain.js";import{NO_RULES,filerFor,isProtectedWork,protectedChanges,rulesWords}from"./approval-policy.js";import{configBase,envValue,namedPath,headWithin,withoutLeadTokenEnv}from"./names.js";import{chatTurnAmountOf,combineReportedModels,providerTurnsOf,reportedCostUsdOf,reportedModelOf,runAmountOf}from"./reported-usage.js";import{usageOf}from"./run-efficiency.js";import{endedInterrupted,wasInterrupted}from"./run-ending.js";import{YOUIYOUX_FILED_VIA}from"./contracts/youiyoux-request.js";import{cardShowsScope,cardTermsDigest,shownTermsDigest}from"./chat-terms.js";import{markedRunningSql,moveTask}from"./task-moves.js";const STORE_MONEY_METHODS=Object.freeze(["recordUsage","settleRunSpend","fixRunBilling","finalizeChatTurn"]),builtinDefineProperty=Object.defineProperty,builtinGetOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,builtinFreeze=Object.freeze,builtinIsFrozen=Object.isFrozen,SEALED_MONEY_METHODS=Object.create(null);function budgetName(scope,key){return scope==="installation"?"everything":`${scope} ${key}`}export function leadTimeoutNotice(keptProposals,unknownCost=!1){return[unknownCost?"The reply took too long and was stopped, and its cost isn't known yet, so chat is paused.":"The reply took too long and was stopped.",keptProposals?"What it proposed is below.":null,unknownCost?"Confirm the cost on the Chat page to turn chat back on.":"Send your message again, or ask for less at once."].filter(part=>part!==null).join(" ")}export function leadTurnKeepsProposals(turn){return turn!==null&&(turn.state==="answered"||turn.state==="failed"&&(turn.failureReason==="timeout"||turn.failureReason==="crashed"))}const SECURITY_KINDS=new Set(["secret-detected","security-release"]),SPENT_KINDS=new Set(["attempts-exhausted","plan-attempts-exhausted"]);export function stopFactOf(store,runId){if(typeof store.stopQuiescenceFact=="function")return store.stopQuiescenceFact(runId);const problem=store.stopQuiescenceProblem(runId);if(problem===null)return null;const kind=/still open|does not exist/.test(problem)?"open":/another host/.test(problem)?"elsewhere":/may still be running|still has|held by|has not finished|still has members/.test(problem)?"alive":/cannot be proven|could not be established|incomplete native/.test(problem)?"unknown":"unprovable";return{run:Number(/run #(\d+)/.exec(problem)?.[1]??runId),kind,problem}}export const LEAD_ASK_OTHER="Something else",LEAD_ASK_TTL_MS=7*864e5,LEAD_FOLLOW_MESSAGE="Automatic crew update: inspect the saved results or decisions and tell me what needs attention. Do not rerun work.",DEFAULT_BACKUP_SETTINGS={enabled:!0,everyHours:24,keep:7,folder:null};export function backupSettingsWords(settings){return settings.enabled?`every ${settings.everyHours===1?"hour":`${settings.everyHours} hours`}, keep ${settings.keep}, ${settings.folder??"the default folder"}`:`off, keep ${settings.keep}, ${settings.folder??"the default folder"}`}const isCheckExitCode=value=>value===null||Number.isSafeInteger(value)&&Number(value)>=0&&Number(value)<=2147483647;export function checkSuitesOf(value){try{const read=readStoreColumn("run_check.suites_json",value??"[]");return read.ok?read.value.filter(one=>{if(one===null||typeof one!="object")return!1;const row=one;return typeof row.name=="string"&&row.name.trim()!==""&&row.name.length<=80&&["passed","failed","not-run"].includes(String(row.status))&&isCheckExitCode(row.exitCode)}).slice(0,8):[]}catch{return[]}}const REGISTERED_AT_FILING="again, as it was filed";export const SCHEMA_VERSION=199,MIN_COMPAT_SCHEMA_VERSION=190,UPDATE_SAFE_MIGRATIONS=Object.freeze([191,192,193,194,195,196,197,198,199]);export{V190_STEPS,V191_STEPS,V192_STEPS,V193_STEPS,V194_STEPS,V195_STEPS,V196_STEPS,V197_STEPS,V198_STEPS,V199_STEPS};export const V149_TABLES=Object.freeze(["check_result","check_fact","local_observation","ci_flaky_observation","ci_pairing_rejected","learning_watch","lesson_note_tally","lesson_note","memory_use","memory_tidy_proposal","decision_merge"]),V149_REPO_TABLES=Object.freeze(["check_fact","local_observation","ci_flaky_observation","learning_watch","lesson_note","memory_use","memory_tidy_proposal"]);const V178_INDEX="action_ledger_action",V178_SCHEMA="CREATE INDEX IF NOT EXISTS action_ledger_action ON action_ledger(action, id) WHERE action = 'checks recovery held';";export function updateSafeSchema(version){if(version===null||!Number.isSafeInteger(version)||version<=0||version>SCHEMA_VERSION)return!1;for(let next=version+1;next<=SCHEMA_VERSION;next++)if(!UPDATE_SAFE_MIGRATIONS.includes(next))return!1;return!0}const stringList=raw=>{try{const value=JSON.parse(String(raw));return Array.isArray(value)&&value.every(one=>typeof one=="string")?value:[]}catch{return[]}};export const BUILT_IN="built-in",LEAD_THREAD={kind:"lead"};function readLeadMessageRow(row){return{id:Number(row.id),thread:Number(row.thread),turn:optNum(row.turn),role:String(row.role),text:String(row.text),activity:optStr(row.activity),createdAt:String(row.created_at),...Number(row.pending??0)===1?{pending:!0}:{}}}function readSubagentMemory(row){return{id:Number(row.id),subagent:Number(row.subagent),text:String(row.text),source:String(row.source),card:optNum(row.card),createdBy:String(row.created_by),createdAt:String(row.created_at),updatedBy:String(row.updated_by),updatedAt:String(row.updated_at),usedAt:optStr(row.used_at)}}function readSubagentSuggestion(row){const parsed=(column,key,fallback)=>{const read=readStoreColumn(column,row[key]);return read.ok?read.value:fallback};return{id:Number(row.id),subagent:Number(row.subagent),tool:String(row.tool),action:String(row.action),rule:parsed("subagent_suggestion.rule_json","rule_json",{use:"ask"}),was:parsed("subagent_suggestion.was_json","was_json",{use:"ask"}),evidence:parsed("subagent_suggestion.evidence_json","evidence_json",[]),said:String(row.said),state:String(row.state),decidedBy:optStr(row.decided_by),decidedAt:optStr(row.decided_at),createdAt:String(row.created_at)}}function readSubagentCall(row){const text=key=>row[key]===null||row[key]===void 0?null:String(row[key]),read=readStoreColumn("subagent_call.input_json",row.input_json),input=read.ok?read.value:{};return{id:Number(row.id),subagent:Number(row.subagent),card:Number(row.card),entry:Number(row.entry),tool:String(row.tool),action:String(row.action),input,rule:String(row.rule),why:String(row.why),state:String(row.state),result:text("result"),decidedBy:text("decided_by"),decidedAt:text("decided_at"),createdAt:String(row.created_at),doneAt:text("done_at"),undoOf:optNum(row.undo_of),undoneBy:text("undone_by"),undoneAt:text("undone_at")}}function readSubagentGrant(row){const parsed=(column,key,fallback)=>{const read=readStoreColumn(column,row[key]);return read.ok?read.value:fallback};return{subagent:Number(row.subagent),tool:String(row.tool),actions:parsed("subagent_tool.actions_json","actions_json",[]),rules:parsed("subagent_tool.rules_json","rules_json",{}),listedAt:optStr(row.listed_at),updatedBy:String(row.updated_by),updatedAt:String(row.updated_at)}}function readSubagentRow(row){return{id:Number(row.id),repo:String(row.repo),handle:String(row.handle),state:String(row.state),version:Number(row.version),soul:String(row.soul),model:optStr(row.model),codexBackupModel:typeof row.codex_backup_model=="string"?row.codex_backup_model:null,authorityGeneration:Number(row.authority_generation??0),dailyTurns:Number(row.daily_turns),manager:String(row.manager),createdBy:String(row.created_by),createdAt:String(row.created_at),updatedBy:String(row.updated_by),updatedAt:String(row.updated_at),summaryAt:optStr(row.summary_at),deskFlow:optNum(row.desk_flow),weeklyAt:optStr(row.weekly_at)}}function readSubagentQuestion(row){const text=key=>row[key]===null||row[key]===void 0?null:String(row[key]);return{id:Number(row.id),subagent:Number(row.subagent),card:Number(row.card),entry:Number(row.entry),question:String(row.question),options:parseStoreColumn("subagent_question.options_json",row.options_json),askedOf:String(row.asked_of),state:String(row.state),choice:text("choice"),answer:text("answer"),answeredBy:text("answered_by"),answeredVia:text("answered_via"),answeredAt:text("answered_at"),createdAt:String(row.created_at),toolCall:optNum(row.tool_call),suggestion:optNum(row.suggestion)}}function readFlowRow(row){return{id:Number(row.id),repo:String(row.repo),name:String(row.name),definitionJson:flowDefinitionFromStore(String(row.definition_json)),revision:Number(row.revision),state:String(row.state),createdBy:String(row.created_by),createdAt:String(row.created_at),updatedBy:String(row.updated_by),updatedAt:String(row.updated_at),owner:row.owner===null||row.owner===void 0?String(row.created_by):String(row.owner)}}function readFlowScriptRow(row){return{id:Number(row.id),repo:String(row.repo),name:String(row.name),about:String(row.about),body:String(row.body),timeoutMinutes:Number(row.timeout_minutes),version:Number(row.version),digest:String(row.digest),savedBy:String(row.saved_by),savedAt:String(row.saved_at),language:row.language==="python"||row.language==="node"?row.language:"shell",file:optStr(row.file),held:optStr(row.held)}}function readFlowStepRunRow(row){const optional=key=>row[key]===null||row[key]===void 0?null:String(row[key]),number=key=>row[key]===null||row[key]===void 0?null:Number(row[key]);return{card:Number(row.card),entry:Number(row.entry),stage:String(row.stage),kind:String(row.kind),script:optional("script"),scriptVersion:number("script_version"),state:String(row.state),attempts:Number(row.attempts),nextAt:optional("next_at"),startedAt:String(row.started_at),finishedAt:optional("finished_at"),durationMs:number("duration_ms"),exitCode:number("exit_code"),result:optional("result"),log:optional("log"),decisionJson:optional("decision_json")}}function readFlowCardRow(row){const{outputs,attached}=cardOutputsFromStore(String(row.outputs_json??"{}")),optional=key=>row[key]===null||row[key]===void 0?null:String(row[key]);return{id:Number(row.id),flow:Number(row.flow),title:String(row.title),description:optional("description"),stage:String(row.stage),entry:Number(row.entry),state:String(row.state),task:optional("task"),primaryTask:optional("primary_task"),note:optional("note"),waiting:optional("waiting"),outputs,attached,createdBy:String(row.created_by),createdAt:String(row.created_at),updatedAt:String(row.updated_at),source:readFlowCardSource(row.source_json),owner:optional("owner"),createdKind:row.created_kind==="automation"?"automation":"person"}}function readFlowCardSource(value){if(typeof value!="string")return null;const read=readStoreColumn("flow_card.source_json",value);if(!read.ok)return null;try{const parsed=read.value,mail=parsed.mail!==null&&typeof parsed.mail=="object"?parsed.mail:null,chat=parsed.chat!==null&&typeof parsed.chat=="object"?parsed.chat:null,external=parsed.external!==null&&typeof parsed.external=="object"?parsed.external:null;return{kind:String(parsed.kind??""),label:parsed.label,url:typeof parsed.url=="string"?parsed.url:null,...mail===null||typeof mail.from!="string"?{}:{mail:{id:typeof mail.id=="string"?mail.id:null,references:Array.isArray(mail.references)?mail.references.filter(one=>typeof one=="string"):[],subject:typeof mail.subject=="string"?mail.subject:"",from:mail.from}},...chat===null||typeof chat.app!="string"||typeof chat.chat!="string"||typeof chat.thread!="string"||typeof chat.binding!="number"?{}:{chat:{app:chat.app,installation:String(chat.installation??""),chat:chat.chat,conversation:typeof chat.conversation=="string"?chat.conversation:chat.chat,thread:chat.thread,binding:chat.binding}},...typeof parsed.verified=="string"?{verified:parsed.verified}:{},...external===null?{}:{external:{id:typeof external.id=="string"?external.id:null,url:typeof external.url=="string"?external.url:null}},...typeof parsed.receipt=="string"?{receipt:parsed.receipt}:{}}}catch{return null}}function readFlowTriggerRow(row){const optional=key=>row[key]===null||row[key]===void 0?null:String(row[key]);return{id:Number(row.id),flow:Number(row.flow),kind:String(row.kind),configJson:String(row.config_json),state:String(row.state),hookHash:optional("hook_hash"),cursor:optional("cursor"),nextAt:optional("next_at"),lastAt:optional("last_at"),lastOutcome:optional("last_outcome"),failures:Number(row.failures??0),createdBy:String(row.created_by),createdAt:String(row.created_at),updatedAt:String(row.updated_at),hookCredential:row.hook_credential===null||row.hook_credential===void 0?"legacy":String(row.hook_credential),droppedCount:Number(row.dropped_count??0),droppedSince:optional("dropped_since")}}function readFlowReceipt(row){const card=optNum(row.card),state=row.state===null||row.state===void 0?card===null?"skipped":"accepted":String(row.state),optional=key=>row[key]===null||row[key]===void 0?null:String(row[key]);return{state,card,note:optional("note"),at:String(row.at),acceptedAt:optional("accepted_at"),itemJson:optional("item_json")}}export function parseCapabilityKey(key){const split=key.indexOf(":");if(split<=0||split===key.length-1)return null;const kind=key.slice(0,split);return["env","cli","mcp","ci","other"].includes(kind)?{kind,name:key.slice(split+1)}:null}function lifecycleWords(value,cap){if(scanForSecrets(value).length>0||/\b\d{5,}:[A-Za-z0-9_-]{20,}\b/.test(value))return"[sensitive text hidden]";const text=value.replace(/(?:[A-Za-z]:[\\/]|\\\\)[^\s"'<>]+/g,"[path]").replace(/(^|[\s"'`(<[=:,])\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+/g,"$1[path]").replace(/\b[0-9a-f]{32,}\b/gi,"[digest]").replace(/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2060-\u206f]/g," ").replace(/\s+/g," ").trim();return text.length<=cap?text:`${text.slice(0,cap-1).replace(/[\uD800-\uDBFF]$/,"")}…`}const LIFECYCLE_PHASE_WORDS={"agent-running":{subject:"agent working",body:"The agent is working in its own checkout. Nothing is finished yet."},"validating-handoff":{subject:"checking the handoff",body:"The agent finished its turn; what it handed back is being checked."},"capturing-evidence":{subject:"saving its files",body:"The diff, checks and report are being saved."},committing:{subject:"committing",body:"The work is being committed on the task branch."},"verifying-proof":{subject:"checking the report",body:"The report is being checked against the approved requirements."},"correcting-proof":{subject:"correcting the report",body:"The report didn't match the saved result; one short correction turn is running."}};function cancellationWords(reason){if(reason===null||reason.trim()==="")return"Cancelled by an operator.";const words=lifecycleWords(reason,120);return`Cancelled by an operator: ${words}${/[.!?…]$/.test(words)?"":"."}`}const LIFECYCLE_REVIEW_WORDS={verified:{subject:"checks verified",body:"Every requirement was checked against the saved result."},refuted:{subject:"the report doesn't match the result",body:"The reviewer found something that contradicts the saved result. It is not accepted as done."},attested:{subject:"only the agent's own checks",body:"The result rests on checks the agent reported, not checked independently."},short:{subject:"a requirement isn't shown",body:"Something a requirement needs is missing from the saved result."},none:{subject:"comments only",body:"The reviewer left comments; no acceptance judgement was recorded."}},LIFECYCLE_HOLD_WORDS={operator:"an operator's hold",decision:"an unanswered question",incident:"an unresolved incident",backoff:"its retry backoff",revision:"a plan revision awaiting approval",stop:"a stopped attempt that has not been resumed"};export const RESULT_SCREENSHOTS=["off","first","all"],RESULT_SHOTS_KIND="result-screenshots",FLOW_SHOTS_KIND="flow-screenshots",QUIET_GROUP_MS=6e4;export function isDigestTime(value){return/^(?:[01][0-9]|2[0-3]):[0-5][0-9]$/.test(value)}export const RUN_PHASES=["agent-running","validating-handoff","capturing-evidence","committing","verifying-proof","correcting-proof"],DEFAULT_ACTOR="operator";export class RunAdmissionRefused extends Error{constructor(message){super(message),this.name="RunAdmissionRefused"}}export function databasePath(env,home){const isolated=envValue(env,"DB");return isolated!==void 0&&isolated!==""?isolated:namedPath(configBase(env,home),["orders.db"])}export const CONCURRENT_WRITER_WAIT_MS=15e3,BRIEF_WRITER_WAIT_MS=500;const briefBudgets=new WeakMap;function waitForConcurrentWriter(db,waitMs=CONCURRENT_WRITER_WAIT_MS){db.exec(`PRAGMA busy_timeout = ${waitMs}`)}const WRITE_WAIT_SLICE_MS=100;export function isDatabaseBusy(error){const code=error?.errcode;return typeof code=="number"&&(code&255)===5}function beginWriteWithin(db,budgetMs,restoreMs=CONCURRENT_WRITER_WAIT_MS){measureWriteWait(db,()=>beginWriteAttempt(db,budgetMs,restoreMs))}function beginWriteAttempt(db,budgetMs,restoreMs=CONCURRENT_WRITER_WAIT_MS){const deadline=performance.now()+budgetMs;db.exec(`PRAGMA busy_timeout = ${WRITE_WAIT_SLICE_MS}`);try{for(;;)try{db.exec("BEGIN IMMEDIATE");return}catch(error){if(!isDatabaseBusy(error)||performance.now()>=deadline)throw error}}finally{waitForConcurrentWriter(db,restoreMs)}}export function openStore(file,options={}){const connect=options.connect??defaultConnect;file!==":memory:"&&mkdirSync(dirname(file),{recursive:!0,mode:448});const db=connect(file);try{return waitForConcurrentWriter(db),initializeStore(db,file,options)}catch(error){try{db.close()}catch{}throw error}}function compactSettledRunProcesses(db,now,only=null){const runs=dbMapAll(db,"SELECT p.run FROM run_process p JOIN run r ON r.id = p.run WHERE r.outcome IS NOT NULL AND r.finished_at IS NOT NULL AND (? IS NULL OR p.run = ?) GROUP BY p.run HAVING COUNT(*) = COUNT(p.exited_at)",row=>Number(row.run),only,only);if(runs.length===0)return 0;const summarize=db.prepare(`INSERT INTO run_process_summary (run, witnesses, process_groups, first_observed_at, last_observed_at, last_exited_at, settled_at) SELECT run, COUNT(*), SUM(process_group), MIN(observed_at),
|
|
2
2
|
MAX(observed_at), MAX(exited_at), ? FROM run_process WHERE run = ? GROUP BY run ON CONFLICT (run) DO UPDATE SET witnesses = witnesses + excluded.witnesses, process_groups = process_groups +
|
|
3
3
|
excluded.process_groups, first_observed_at = MIN(first_observed_at, excluded.first_observed_at), last_observed_at = MAX(last_observed_at, excluded.last_observed_at), last_exited_at =
|
|
4
4
|
MAX(last_exited_at, excluded.last_exited_at), settled_at = excluded.settled_at`),remove=db.prepare("DELETE FROM run_process WHERE run = ? AND exited_at IS NOT NULL");let removed=0;for(const run of runs)summarize.run(now.toISOString(),run),removed+=Number(remove.run(run).changes);return removed}const TEAM_TABLES=["team_lead","team_lead_project","team_lead_member","team_conversation","team_participant","team_message","team_read","team_follow","team_mate_session","team_task_owner","team_event","team_request"];function initializeStore(db,file,options={}){const read=schemaVersionPreflight(db,file);if(read!==null&&Math.abs(read)<MIN_COMPAT_SCHEMA_VERSION)throw new Error(olderThanBaseline(file,read));if(read!==null){const identityProblem=workspaceIdentityShapeProblem(db);if(identityProblem!==null)throw new Error(`${file}: refusing to open — ${identityProblem}, though the schema says v${read}`);const indexProblem=checkRecoveryIndexShapeProblem(db,!0);if(indexProblem!==null)throw new Error(`${file}: refusing to open — ${indexProblem}, though the schema says v${read}`)}if(read===null)return createBaseline(db,file,options.createdBy),db.exec("PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON;"),new Store(db);const requiredTables=[[["service_cursor"],"service progress is missing; refusing to silently reset worker cursors"],[TEAM_TABLES,"team history is missing; refusing to recreate membership or queued work"],[CHAT_TABLES,"chat history is missing; refusing to recreate pairings and receipts"],[["plan_authorization"],"plan authorization metadata is missing; refusing to recreate authority"],[["workflow_recipe","workflow_preview"],"workflow recipe metadata is missing; refusing to recreate launch history"],[["learning_capture","learning_policy","project_lesson","learning_event","learning_snapshot"],"learning history is missing; refusing to recreate authority"],[["project_knowledge","knowledge_change","knowledge_snapshot"],"project knowledge history is missing; refusing to recreate it"],[["notification_delivery"],"Telegram delivery history is missing; refusing to recreate receipts"],[["lead_turn_evidence"],"Telegram image history is missing; refusing to recreate it"],[["skill_package","skill_owner","project_skill_change","skill_snapshot","skill_test"],"saved skills are missing; refusing to recreate them"]];for(const[tables,msg]of requiredTables)if(!tables.every(t=>tableExists(db,t)))throw new Error(`${file}: ${msg}`);for(const table of["approver","invite"])if(!hasColumn(db,table,"projects_json"))throw new Error(`${file}: project access metadata is missing from ${table}; refusing to widen access`);for(const col of["provenance_scope","project","task_ref","task_id","source_run"])if(!hasColumn(db,"notification",col))throw new Error(`${file}: notification provenance is missing; refusing to recreate authority`);const proposalDdl=dbOne(db,"SELECT sql FROM sqlite_master WHERE type='table' AND name='lead_proposal'")?.sql;if(typeof proposalDdl!="string"||canonicalDdl(proposalDdl)!==canonicalDdl(LEAD_PROPOSAL_DDL("lead_proposal")))throw new Error(`${file}: shared action history has an unknown shape; refusing to recreate it`);if(read===SCHEMA_VERSION){const missing=companionShapeProblem(db)??companionPasskeyShapeProblem(db)??companionChatShapeProblem(db)??queryIndexShapeProblem(db)??chatAttachmentShapeProblem(db)??phoneViaShapeProblem(db)??phoneApprovalsShapeProblem(db)??companionPushTokensShapeProblem(db)??everyAgentShapeProblem(db)??directChatSpendShapeProblem(db)??pluginBundlesShapeProblem(db)??acpCheckRepoShapeProblem(db)??fastOwnerShapeProblem(db);if(missing!==null)throw new Error(`${file}: refusing to open — ${missing}, though the schema says v${SCHEMA_VERSION}`);return db.exec("PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON;"),removeImportedPiSidecar(db,file),new Store(db)}const preProblem=companionShapeProblem(db)??companionPasskeyShapeProblem(db)??companionChatShapeProblem(db)??queryIndexShapeProblem(db);if(preProblem!==null)throw new Error(`${file}: refusing to open — ${preProblem}, though the schema says v${read}`);if(read>0&&Number(dbRun(db,"UPDATE schema_version SET version = ? WHERE version = ?",-read,read).changes)!==1)throw new Error(`${file}: refusing to open — the schema version moved from v${read} between the preflight and the epoch stamp (another process is migrating it); this build speaks schema v${SCHEMA_VERSION} and alters nothing it cannot name`);const step=options.migrationStep??(()=>{});step("epoch");const runStep=(name,adopt,check,disableFk=!1)=>{disableFk&&db.exec("PRAGMA foreign_keys = OFF");try{db.exec("BEGIN IMMEDIATE");try{adopt(db);const damaged=check(db);if(damaged!==null)throw new Error(`${file}: refusing to open — ${damaged}`);step(name),db.exec("COMMIT")}catch(error){throw db.exec("ROLLBACK"),error instanceof Error&&!error.message.startsWith(`${file}:`)&&/unknown shape|missing/.test(error.message)?new Error(`${file}: refusing to open — ${error.message}`):error}}finally{disableFk&&db.exec("PRAGMA foreign_keys = ON")}};runStep("chat-attachments",adoptChatAttachments,chatAttachmentShapeProblem),runStep("phone-via",adoptPhoneVia,phoneViaShapeProblem,!0),runStep("phone-approvals",adoptPhoneApprovals,phoneApprovalsShapeProblem),runStep("companion-push-tokens",adoptCompanionPushTokens,companionPushTokensShapeProblem);const pastV195=d=>everyAgentShapeProblem(d)===null;runStep("acp-providers",d=>{pastV195(d)||adoptAcpProviders(d)},d=>pastV195(d)?null:acpProvidersShapeProblem(d),!0),runStep("direct-chat-spend",adoptDirectChatSpend,directChatSpendShapeProblem),runStep("every-agent",adoptEveryAgent,everyAgentShapeProblem,!0),runStep("pi-threads",d=>importPiThreads(d,file),everyAgentShapeProblem),runStep("plugin-bundles",adoptPluginBundles,pluginBundlesShapeProblem,!0),runStep("acp-check-repo",adoptAcpCheckRepo,acpCheckRepoShapeProblem,!0),runStep("fast-owner",adoptFastOwner,fastOwnerShapeProblem,!0),reclaimDatabase(db,"migration");const expectedMarker=read<0?read:-read;if(Number(dbRun(db,"UPDATE schema_version SET version = ? WHERE version = ?",SCHEMA_VERSION,expectedMarker).changes)!==1)throw new Error(`${file}: refusing to open — the epoch sentinel ${expectedMarker} moved under this migration (another process is migrating it); this build speaks schema v${SCHEMA_VERSION} and alters nothing it cannot name`);return db.exec("PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON;"),removeImportedPiSidecar(db,file),new Store(db)}function olderThanBaseline(file,version){const what=version<0?`an upgrade from schema v${-version} stopped partway`:`it is schema v${version}`;return`${file}: refusing to open — ${what}, older than v${MIN_COMPAT_SCHEMA_VERSION} (Toolroll 0.9.131), and this build cannot upgrade it; update through v0.9.131 first, then open it with this build`}function createBaseline(db,file,createdBy){db.exec("BEGIN IMMEDIATE");try{if(Number(dbOne(db,"SELECT COUNT(*) AS n FROM sqlite_master")?.n)!==0)throw new Error(`${file}: refusing to open — a schema version appeared under this fresh open (another process is creating it); this build speaks schema v${SCHEMA_VERSION} and alters nothing it cannot name`);db.exec(BASELINE_SCHEMA),dbRun(db,"INSERT INTO direct_chat_pi_import (outcome, file_sha256, threads, at) VALUES ('created', NULL, 0, ?)",new Date().toISOString()),dbRun(db,"INSERT INTO schema_version (version) VALUES (?)",BASELINE_SCHEMA_VERSION);const installedAt=new Date().toISOString();dbRun(db,"INSERT INTO installation_fact (key, value, created_at) VALUES ('installed-at', ?, ?)",installedAt,installedAt),createdBy==="laptop"&&dbRun(db,"INSERT INTO installation_fact (key, value, created_at) VALUES ('created-by', 'laptop', ?)",installedAt),dbRun(db,"INSERT INTO workspace_identity (singleton, workspace_id, recovery_generation, created_at) VALUES (1, ?, ?, ?)",randomUUID(),randomBytes(16).toString("hex"),installedAt),db.exec("COMMIT")}catch(error){throw db.exec("ROLLBACK"),error}return BASELINE_SCHEMA_VERSION}export function readSchemaVersion(db){const refuse=problem=>({ok:!1,problem});if(dbOne(db,"SELECT 1 AS hit FROM sqlite_master WHERE type = 'table' AND name = 'schema_version'")===void 0){const anything=dbOne(db,"SELECT COUNT(*) AS n FROM sqlite_master");if(Number(anything?.n??0)>0)return refuse("the file carries tables but no schema_version table — it is not a fresh database, and not one this build shaped");for(const[pragma,word]of[["user_version","user version"],["application_id","application id"],["schema_version","schema cookie"]]){const row=dbOne(db,`PRAGMA ${pragma}`),value=row===void 0?void 0:row[pragma];if(value===void 0)return refuse(`the file's ${word} cannot be read — it is not a fresh database`);if(String(value)!=="0")return refuse(`the file carries no schema_version table but a persisted ${word} of ${String(value)} — it is not a fresh database, and not one this build shaped`)}const pages=dbOne(db,"PRAGMA page_count"),pageCount=pages===void 0?void 0:pages.page_count;return pageCount===void 0?refuse("the file's page count cannot be read — it is not a fresh database"):String(pageCount)!=="0"?refuse(`the file carries no schema_version table but ${String(pageCount)} persisted page(s) — it is not a fresh database, and not one this build shaped`):{ok:!0,version:null}}const rows=dbAll(db,"SELECT typeof(version) AS kind, CAST(version AS TEXT) AS text FROM schema_version");if(rows.length!==1)return refuse(rows.length===0?"schema_version carries no row":`schema_version carries ${rows.length} rows, not one`);const kind=String(rows[0]?.kind),text=String(rows[0]?.text),version=/^-?\d+$/.test(text)?Number(text):Number.NaN;if(kind!=="integer"||!Number.isSafeInteger(version)||String(version)!==text)return refuse(`schema_version is ${kind==="text"?JSON.stringify(text):text} (${kind}), not a safe integer`);const magnitude=Math.abs(version);return magnitude===0?refuse("schema_version is 0, which no build ever wrote"):magnitude>SCHEMA_VERSION?refuse(`it is schema v${magnitude}, written by a newer build`):version===-SCHEMA_VERSION?refuse(`schema_version is ${version}, a mid-flight marker no build ever wrote (an upgrade never begins at v${SCHEMA_VERSION}, the version it upgrades to)`):{ok:!0,version}}export function schemaVersionPreflight(db,file){const read=readSchemaVersion(db);if(!read.ok)throw new Error(`${file}: refusing to open — ${read.problem}; this build speaks schema v${SCHEMA_VERSION} and alters nothing it cannot name`);return read.version}export function openStoreNoMigrate(file,options={}){const connect=options.connect??defaultConnect;if(file===":memory:"||!existsSync(file))return{ok:!1,reason:"missing",message:`${file} does not exist — run \`toolroll\` once to create it`};const db=connect(file);waitForConcurrentWriter(db),db.exec("PRAGMA foreign_keys = ON");let read;try{read=readSchemaVersion(db)}catch(error){read={ok:!1,problem:`the schema version cannot be read (${error instanceof Error?error.message:String(error)})`}}if(!read.ok)return db.close(),{ok:!1,reason:"version",message:`${file}: ${read.problem} — open it with the CLI or console first`};const seen=read.version;if(seen===null){db.close();try{statSync(file).size===0&&unlinkSync(file)}catch{}return{ok:!1,reason:"version",message:`${file}: it carries no schema version — open it with the CLI or console first`}}if(seen!==SCHEMA_VERSION){db.close();const said=seen===null?"it carries no schema version":seen<0?`a migration is mid-flight (epoch ${-seen})`:`it is schema v${seen} and this build speaks v${SCHEMA_VERSION}`;return{ok:!1,reason:"version",message:`${file}: ${said} — open it with the CLI or console first`}}return{ok:!0,store:new Store(db)}}export const REVIEW_ROOT_ATTEMPTS=3;function reviewRequestOriginOf(row){return String(row.basis)==="mode"||String(row.origin??"operator")==="automatic"?"automatic":"operator"}export const LEGACY_NOTIFICATION_DESTINATION="legacy:single-destination";function readApiToken(row){const text=key=>row[key]==null?null:String(row[key]);return{id:String(row.id),account:String(row.account),name:String(row.name),access:row.access==="act"?"act":"read",createdAt:String(row.created_at),createdBy:String(row.created_by),expiresAt:String(row.expires_at),lastUsedAt:text("last_used_at"),revokedAt:text("revoked_at"),revokedBy:text("revoked_by"),purpose:tokenPurpose(row.purpose),projects:tokenProjectsOf(row.projects_json),replaces:text("replaces"),replacedBy:text("replaced_by"),overlapUntil:text("overlap_until")}}function tokenProjectsOf(value){if(value==null)return null;try{const parsed=JSON.parse(String(value));return Array.isArray(parsed)&&parsed.every(one=>typeof one=="string")?parsed:[]}catch{return[]}}function readWebSession(row){return{idHash:String(row.id_hash),account:String(row.account),csrf:String(row.csrf),role:row.role==="viewer"?"viewer":"approver",generation:Number(row.generation),createdAt:Number(row.created_at),lastSeen:Number(row.last_seen),project:optStr(row.project),projectRevision:Number(row.project_revision),ssoAt:optNum(row.sso_at),agent:optStr(row.agent),address:optStr(row.address),authority:row.authority==="full"?"full":"local-owner",localGeneration:optNum(row.local_generation),keyEpoch:optStr(row.key_epoch),keyHash:optStr(row.key_hash)}}const LEAD_PROPOSAL_DDL=name=>`CREATE TABLE ${name} ( id INTEGER PRIMARY KEY AUTOINCREMENT, thread INTEGER NOT NULL REFERENCES lead_thread(id) ON DELETE CASCADE, turn INTEGER NOT NULL, kind
|
|
@@ -74,7 +74,7 @@ import{CHECK_RECOVERY_HELD,readCheckRecoveryHoldsForTaskRef}from"./check-recover
|
|
|
74
74
|
WHERE task_id = ?`,now.toISOString(),by,basis===void 0?"password":basis.kind,basis===void 0?null:basis.modeDigest,taskId);if(changed.changes>0&&terms.ok&&terms.terms!==null&&basis?.kind!=="auto-check"){const releaseProof=basis?.kind==="auto-green"?{kind:"auto-green",modeDigest:basis.modeDigest,candidate:String(working.candidate)}:{kind:"passkey",witness:passkeyWitness};if(openReleaseAuthority(this,{taskId,digest:String(working.digest),terms:terms.terms,by,now,proof:releaseProof})===null)throw new ReleaseSealRefused}if(changed.changes>0){this.bumpWake(),this.sealProjectTools(taskId,String(working.digest),now);const ref=this.getOne("SELECT id FROM task_ref WHERE backend = ? AND external_id = ?",BUILT_IN,taskId);ref!==void 0&&((basis===void 0||basis.kind==="chat")&&(this.noteTaskAct(Number(ref.id),"approved",now),clearRetryEpisode(this,Number(ref.id)),this.runSql("UPDATE task_ref SET fast_start_until = NULL WHERE id = ? AND fast_start_until IS NOT NULL",Number(ref.id))),this.runSql("DELETE FROM hold WHERE owner_kind = 'backoff' AND owner_id = ?",`stale:${Number(ref.id)}`),noteExposureSealed(this,Number(ref.id),{selection:sealedSelection,model:legOf(authority.route,"build").model},now),this.runSql("DELETE FROM hold WHERE owner_kind = 'backoff' AND owner_id = ?",`rule-off:${Number(ref.id)}`),this.runSql("UPDATE notification SET resolved_at = ? WHERE dedupe_key LIKE ? AND resolved_at IS NULL",now.toISOString(),`stale-approval:${Number(ref.id)}:%`),this.runSql("UPDATE notification SET resolved_at = ? WHERE kind = 'release-ready' AND task_ref = ? AND resolved_at IS NULL",now.toISOString(),Number(ref.id)),(working.approved_at==null?null:working.approved_digest)!==working.digest&&this.noteLifecycle({taskRef:Number(ref.id),kind:"scope-approved",identity:`t${Number(ref.id)}`,subject:"Plan approved",body:basis===void 0?`Approved by ${lifecycleWords(by,40)}. A connected builder can take it next.`:basis.kind==="chat"?`Approved by ${lifecycleWords(by,40)} in chat. A connected builder can take it next.`:basis.kind==="grant"?"Approved automatically: its flow runs on its own. A connected builder can take it next.":basis.kind==="schedule"?"Approved by its standing order. A connected builder can take it next.":basis.kind==="auto-check"?"Checking automatically: it approves itself once CI and the release check pass.":basis.kind==="auto-green"?"Approved automatically: CI and the release check passed.":"Approved automatically under the operating mode. A connected builder can take it next.",link:chatControlHref("task",taskId)},now))}return changed.changes>0})===!0;return this.db.isTransaction===!0?seal():this.transact(seal)}scopeSealed(taskId){return this.getOne("SELECT 1 AS hit FROM task_scope WHERE task_id = ? AND approved_at IS NOT NULL AND approved_digest = digest",taskId)!==void 0}getScope(taskId){return this.mapOne("SELECT * FROM task_scope WHERE task_id = ?",row=>sealedAs(this,readScope(row)),taskId)}modeApprovalLive(taskRef,now){if(this.getOne(`SELECT 1 AS dead FROM task_scope JOIN task_ref ON task_ref.id = ? AND task_ref.backend = 'built-in' AND task_scope.task_id = task_ref.external_id WHERE task_scope.approved_at IS NOT NULL AND NOT ${authorityStandsSql("task_scope","task_ref.repo","?")}`,taskRef,now.toISOString(),now.toISOString(),now.toISOString(),now.toISOString())!==void 0)return!1;const external=this.getOne("SELECT external_id FROM task_ref WHERE id = ? AND backend = 'built-in'",taskRef);if(external===void 0)return!0;const live=liveReleaseOf(this,String(external.external_id),"dispatch",now);return!live.applies||live.ok}saveApprover(name,credentialHash,now,mutation={}){this.once(mutation,"saveApprover",()=>(this.transact(()=>{this.db.prepare(`INSERT INTO approver (name, credential_hash, added_at, generation) VALUES (?, ?, ?, 1)
|
|
75
75
|
ON CONFLICT (name) DO UPDATE SET credential_hash = excluded.credential_hash,
|
|
76
76
|
added_at = excluded.added_at,
|
|
77
|
-
generation = approver.generation + 1`).run(name,credentialHash,now.toISOString()),this.revokeDerivedAuthority(name,"credential-rotation",now),relayCancel({person:name})}),null))}accountOf(name){const row=this.
|
|
77
|
+
generation = approver.generation + 1`).run(name,credentialHash,now.toISOString()),this.revokeDerivedAuthority(name,"credential-rotation",now),relayCancel({person:name})}),null))}accountOf(name){const row=throughRequestReads(this).handle.prepare("SELECT credential_hash, password_set, role, generation, revoked_at, projects_json FROM approver WHERE name = ?").get(name);return row===void 0?null:{projects:readProjectAccess(row.projects_json),credentialHash:String(row.credential_hash),passwordSet:Number(row.password_set)===1,role:String(row.role)==="viewer"?"viewer":"approver",generation:Number(row.generation),revokedAt:row.revoked_at===null||row.revoked_at===void 0?null:String(row.revoked_at)}}activeMode(repo,now){const row=this.getOne("SELECT operating_mode.* FROM operating_mode JOIN approver ON approver.name = operating_mode.signed_by AND approver.revoked_at IS NULL AND approver.role = 'approver' WHERE operating_mode.repo = ? AND operating_mode.revoked_at IS NULL",repo);return row===void 0?null:Date.parse(String(row.absolute_expiry))<=now.getTime()?(inReadOnlyRequest()||this.closeExpiredMode(Number(row.id),String(row.repo),now),null):{id:Number(row.id),name:String(row.name),termsJson:String(row.terms_json),digest:String(row.digest),signedBy:String(row.signed_by),absoluteExpiry:String(row.absolute_expiry)}}closeExpiredModes(now){const rows=this.getAll("SELECT operating_mode.id, operating_mode.repo, operating_mode.absolute_expiry FROM operating_mode JOIN approver ON approver.name = operating_mode.signed_by AND approver.revoked_at IS NULL AND approver.role = 'approver' WHERE operating_mode.revoked_at IS NULL");let closed=0;for(const row of rows)Date.parse(String(row.absolute_expiry))>now.getTime()||(this.closeExpiredMode(Number(row.id),String(row.repo),now),closed++);return closed}closeExpiredMode(id,repo,now){this.transact(()=>{const closed=this.runSql("UPDATE operating_mode SET revoked_at = ?, revoked_by = ?, revoke_reason = 'expired' WHERE id = ? AND revoked_at IS NULL",now.toISOString(),"the-clock",id);Number(closed.changes)===1&&(this.runSql("INSERT INTO operating_mode_event (mode, kind, actor, at) VALUES (?, 'expired-closed', 'the-clock', ?)",id,now.toISOString()),this.reconcileIntentsForMode(repo,null,now))})}signMode(spec,now){return this.transact(()=>{if(spec.publication==="automerge"&&!this.hasMergeCapableGrant(spec.repo,now))throw new Error("automerge needs a merge-capable publication grant — grant one, then sign");const previous=this.getOne("SELECT id FROM operating_mode WHERE repo = ? AND revoked_at IS NULL",spec.repo),renewal=previous!==void 0;renewal&&this.runSql("UPDATE operating_mode SET revoked_at = ?, revoked_by = ?, revoke_reason = 'renewed' WHERE id = ?",now.toISOString(),spec.signedBy,Number(previous.id));const inserted=this.runSql("INSERT INTO operating_mode (repo, name, terms_json, digest, signed_by, signed_at, absolute_expiry) VALUES (?, ?, ?, ?, ?, ?, ?)",spec.repo,spec.name,spec.termsJson,spec.digest,spec.signedBy,now.toISOString(),spec.absoluteExpiry),id=Number(inserted.lastInsertRowid);return this.runSql("INSERT INTO operating_mode_event (mode, kind, actor, at) VALUES (?, ?, ?, ?)",id,renewal?"renewed":"signed",spec.signedBy,now.toISOString()),this.recordAction({at:now.toISOString(),actor:spec.signedBy,repo:spec.repo,taskId:null,runId:null,source:"policy",action:`operating mode ${renewal?"renewed":"signed"}: ${spec.name}`,outcome:renewal?"renewed":"signed",detail:`until ${spec.absoluteExpiry.slice(0,16).replace("T"," ")} UTC · ${spec.publication==="automerge"?"merges automatically":"notifies on results"}`}),this.reconcileIntentsForMode(spec.repo,{digest:spec.digest,publication:spec.publication},now),id})}revokeMode(repo,by,reason,now){return this.transact(()=>{const row=this.getOne("SELECT id FROM operating_mode WHERE repo = ? AND revoked_at IS NULL",repo);return row===void 0?!1:(this.runSql("UPDATE operating_mode SET revoked_at = ?, revoked_by = ?, revoke_reason = ? WHERE id = ?",now.toISOString(),by,reason,Number(row.id)),this.runSql("INSERT INTO operating_mode_event (mode, kind, actor, at) VALUES (?, 'revoked', ?, ?)",Number(row.id),by,now.toISOString()),this.recordAction({at:now.toISOString(),actor:by,repo,taskId:null,runId:null,source:"policy",action:"operating mode revoked",outcome:"revoked",detail:reason}),this.reconcileIntentsForMode(repo,null,now),!0)})}withdrawGrantApprovals(digest,now){const demotable=`WHERE approval_basis = 'grant' AND approved_at IS NOT NULL AND mode_digest = ? AND EXISTS (SELECT 1 FROM task_ref JOIN task ON task.id = task_ref.external_id WHERE task_ref.backend = 'built-in'
|
|
78
78
|
AND task_ref.external_id = task_scope.task_id AND task.state = 'queued') AND NOT EXISTS (SELECT 1 FROM claim JOIN task_ref tr ON tr.id = claim.task_ref WHERE tr.backend = 'built-in' AND
|
|
79
79
|
tr.external_id = task_scope.task_id AND claim.released_at IS NULL AND claim.expires_at > ?)`,demoted=this.mapAll(`SELECT task_id FROM task_scope ${demotable}`,row=>String(row.task_id),digest,now.toISOString());withdrawApproval(this,{where:demotable,args:[digest,now.toISOString()]},{basisAfter:"password",clearRoute:!1,clearModeDigest:!0}),this.runSql("DELETE FROM plan_authorization WHERE basis = 'grant' AND mode_digest = ?",digest);for(const taskId of demoted){const ref=this.lookupRef(taskId);ref!==null&&this.noteLifecycle({taskRef:ref.id,kind:"approval-withdrawn",identity:`t${ref.id}`,subject:"Approval needs renewing",body:"Its flow no longer runs on its own. Approve it before it runs.",link:chatControlHref("approval",taskId)},now)}}reconcileIntentsForMode(repo,newMode,now){const demotable=`WHERE approval_basis = 'mode' AND approved_at IS NOT NULL AND (? IS NULL OR mode_digest <> ?) AND EXISTS (SELECT 1 FROM task_ref JOIN task ON task.id = task_ref.external_id WHERE
|
|
80
80
|
task_ref.backend = 'built-in' AND task_ref.external_id = task_scope.task_id AND task_ref.repo = ? AND task.state = 'queued') AND NOT EXISTS (SELECT 1 FROM claim JOIN task_ref tr ON tr.id =
|
package/dist/surface.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{KNOWLEDGE_DESCRIPTORS}from"./knowledge-cli.js";import{MEMORY_DESCRIPTORS}from"./memory-cli.js";import{CARD_DESCRIPTOR}from"./card-cli.js";import{FLAKY_DESCRIPTORS}from"./flaky-cli.js";import{MODELS_DESCRIPTORS}from"./models-cli.js";import{MAP_DESCRIPTORS}from"./code-map-cli.js";import{FLOWS_DESCRIPTORS}from"./flows-cli.js";import{commandEntries}from"./contracts/cli.js";export const SURFACE_NOTES={authority:"documentation is not permission; legacy entries remain advisory",flags:"flags are intended per command and may use a global parser vocabulary",reasons:"curated, not exhaustive — the runtime `reason` field is the truth; ignore tokens you do not recognize",database:"local database commands wait up to 15 seconds for another writer; an exhausted wait returns database-busy and names the selected file"},SURFACE_SCHEMA_VERSION=1;const jsonFlag={name:"json",takesValue:!1,meaning:"answer with one machine envelope on stdout"},keyFlag={name:"key",takesValue:!0,meaning:"idempotency key — retry with the same key to get the first answer back"},dbFlag={name:"db",takesValue:!0,meaning:"path to the database file (defaults to the installation's)"},repoFlag={name:"repo",takesValue:!0,meaning:"which repository (repeatable where a command watches several)"},operator=(invocation,synopsis)=>({invocation,synopsis,audience:"operator",agentMayInvoke:!1,mutation:"unkeyed"}),operatorRead=(invocation,synopsis)=>({invocation,synopsis,audience:"operator",agentMayInvoke:!1,mutation:"none"}),GUIDE_ROWS=[{invocation:"",envelopeCommand:"scan",synopsis:"report what is in flight (the no-verb default; scans below the working directory or the connected repositories)",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"path",required:!1,meaning:"directories to scan instead of the connected set"}],flags:[jsonFlag,{name:"all",takesValue:!1,meaning:"ignore connected repos; scan everything discoverable"},{name:"local",takesValue:!1,meaning:"branches only — no network"}]},{invocation:"pulls",synopsis:"report what is waiting on a person",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag]},{invocation:"graph",synopsis:"report which work graph is already here",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag]},{invocation:"repos",synopsis:"list connected repositories",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag]},operator("proposals","what coordinators proposed over the MCP gateway — list, confirm <id> [--yes], dismiss <id>; confirming runs the plane's own door under your password"),operator("chat","talk to your lead: one conversation across every project; --say sends one message; --follow enables crew updates and --no-follow pauses them; proposals keep their approval requirements"),{invocation:"repos add",synopsis:"add a project: a Git repository, in the console at once; the lead adds with its token; --remote records or replaces its trusted remote",audience:"agent",agentMayInvoke:!0,mutation:"unkeyed",positionals:[{name:"path",required:!1,meaning:"the repository (default: the one you are in)"}],flags:[jsonFlag,{name:"token",takesValue:!0,meaning:"the lead token (or TOOLROLL_LEAD_TOKEN)"},{name:"remote",takesValue:!0,meaning:"an HTTPS or SSH URL without credentials whose main may complete landed work; replaces a different recorded one (owner or an instance operator's lead only)"}],notableReasons:["not-git","unavailable","refused","locked"]},{invocation:"repos remove",synopsis:"remove a project from the console and the builder; its tasks and results stay saved",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"path",required:!0,meaning:"the repository"}],flags:[jsonFlag,{name:"token",takesValue:!0,meaning:"the lead token (or TOOLROLL_LEAD_TOKEN)"}],notableReasons:["refused","locked"]},operator("repos add-from-github","preview, clone from GitHub, and connect - the console onboarding ceremony as a CLI verb"),{invocation:"contract",synopsis:"the machine contract: envelope version + capability tokens; --commands dumps this guide",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,{name:"commands",takesValue:!1,meaning:"dump the declared command guide"}]},...["list","install","update","rollback","remove","validate"].map(verb=>({invocation:`plugin ${verb}`,synopsis:{list:"list installed plug-ins",install:"install skills from a GitHub URL or folder",update:"update GitHub plug-ins or reload local folders",rollback:"restore a plug-in's previous version",remove:"remove a plug-in from the active library",validate:"validate a local folder without installing it"}[verb],audience:verb==="list"||verb==="validate"?"agent":"operator",agentMayInvoke:verb==="list"||verb==="validate",mutation:verb==="list"||verb==="validate"?"none":"unkeyed",flags:[jsonFlag,dbFlag],...verb==="list"?{}:{positionals:[{name:verb==="install"?"github-url|folder":verb==="validate"?"folder":"id",required:verb!=="update",meaning:"plug-in source or installed id"}]}})),{invocation:"skills list",synopsis:"name the guides this exact binary serves",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag]},{invocation:"skills get",synopsis:"print one guide's markdown (raw on stdout; --json wraps it)",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"name",required:!0,meaning:"a guide name from `skills list`"}],flags:[jsonFlag],notableReasons:["unknown-skill","usage"]},{invocation:"skills install",synopsis:"install or refresh this binary's Toolroll guides for Claude Code; without --claude-code, write the repository-local Agent Skills entry",audience:"operator",agentMayInvoke:!1,mutation:"identity-idempotent",flags:[jsonFlag,{name:"claude-code",takesValue:!1,meaning:"install the user-level Claude Code skill"},{name:"dir",takesValue:!0,meaning:"skill directory (default: ~/.claude/skills/toolroll)"},{name:"yes",takesValue:!1,meaning:"write the previewed files"},{name:"repo",takesValue:!0,meaning:"repository for the existing project-local install"},{name:"write-context",takesValue:!1,meaning:"also add the managed AGENTS.md block for a project-local install"}],notableReasons:["unconfirmed","foreign-file","usage"]},operator("link","put toolroll on PATH"),operator("unlink","take it off PATH"),operator("update","update to the latest release: verified provenance, drained work, backup, rehearsal, health check, automatic restore; --rollback undoes it"),{invocation:"release",synopsis:"release Toolroll itself from a branch: gate the exact commit, wait for the owner's approval, check, complete, deploy, merge, tag, publish, Homebrew; rerun to resume",audience:"operator",agentMayInvoke:!1,mutation:"unkeyed",positionals:[{name:"branch",required:!0,meaning:"the pushed branch with an open pull request"}],flags:[jsonFlag,{name:"repo",takesValue:!0,meaning:"the gate checkout the release check runs in (default: this checkout)"},{name:"new",takesValue:!1,meaning:"release a new commit on the branch, setting the earlier unfinished release aside"},{name:"limit",takesValue:!0,meaning:"<step>=<minutes>: one waiting step's time limit"},{name:"tap",takesValue:!0,meaning:"the Homebrew tap, owner/name"},{name:"release-gate",takesValue:!0,meaning:"<id>: show why an update pause left before a deployment's swap is safe to lift"},{name:"yes",takesValue:!1,meaning:"with --release-gate: lift that one pause once it is proved; with --recover-deploy: recover"},{name:"recover-deploy",takesValue:!1,meaning:"put back a deployment that stopped half way: stop only its own proved leftovers, restart the previous service, lift the pause"},{name:"stage",takesValue:!0,meaning:"with --recover-deploy: the deployment's staging folder"}],notableReasons:["usage","ambiguous","drift","timeout","check-failed","ci-failed","tree-mismatch","conflict","mixed-runtime","gate-held","after-swap"]},operator("demo","a seeded throwaway sandbox"),...KNOWLEDGE_DESCRIPTORS.map(spec=>({invocation:`knowledge ${spec.action}`,synopsis:spec.synopsis,audience:"audience"in spec?spec.audience:"agent",agentMayInvoke:!("audience"in spec),mutation:spec.mutation,flags:spec.flags,...spec.takesQuery?{positionals:[{name:"query",required:!0,meaning:"search text or source file for impact"}]}:{}})),...MEMORY_DESCRIPTORS.map(spec=>({invocation:`memory ${spec.action}`,synopsis:spec.synopsis,audience:"audience"in spec?spec.audience:"agent",agentMayInvoke:!("audience"in spec),mutation:spec.mutation,flags:spec.flags,...spec.takesQuery?{positionals:[{name:"query",required:!0,meaning:"search text, a decision id, or the decision sentence"}]}:{}})),{invocation:CARD_DESCRIPTOR.invocation,synopsis:CARD_DESCRIPTOR.synopsis,audience:"agent",agentMayInvoke:!0,mutation:"none",flags:CARD_DESCRIPTOR.flags,positionals:[{name:"source",required:!0,meaning:"which data to show"}]},{invocation:"card list",synopsis:"list registered declarative TUI panels (~/.toolroll/panels.toml) and their live card previews (read only)",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,{name:"list",takesValue:!1,meaning:"list registered declarative panels"}]},{invocation:"card remove",synopsis:"remove a declarative TUI panel from ~/.toolroll/panels.toml by id",audience:"operator",agentMayInvoke:!1,mutation:"identity-idempotent",positionals:[{name:"id",required:!0,meaning:"panel id slug to remove"}],flags:[jsonFlag,{name:"remove",takesValue:!0,meaning:"panel id slug to remove"}]},...FLAKY_DESCRIPTORS.map(spec=>({invocation:`flaky ${spec.action}`,synopsis:spec.synopsis,audience:"agent",agentMayInvoke:!0,mutation:spec.mutation,flags:spec.flags,...spec.takesQuery?{positionals:[{name:"identity",required:!0,meaning:"a row's key from flaky list"}]}:{}})),...FLOWS_DESCRIPTORS.map(spec=>({invocation:`flows ${spec.action}`,synopsis:spec.synopsis,audience:"audience"in spec?spec.audience:"agent",agentMayInvoke:!("audience"in spec),mutation:spec.mutation,flags:spec.flags,..."positionals"in spec?{positionals:spec.positionals.map(name=>({name,required:!0,meaning:name==="flow"?"a flow id from flows list":name==="card"?"a card id from flows show":name==="on|off"?"on signs the grant, off revokes it":"a trigger id from flows show, or for trigger add its settings as JSON, a JSON file, or -"}))}:{}})),...MAP_DESCRIPTORS.map(spec=>({invocation:spec.action===""?"map":`map ${spec.action}`,synopsis:spec.synopsis,audience:"audience"in spec?spec.audience:"agent",agentMayInvoke:!("audience"in spec),mutation:spec.mutation,flags:spec.flags,...spec.positional===null?{}:{positionals:[{name:"target",required:!0,meaning:spec.positional}]}})),...MODELS_DESCRIPTORS.map(spec=>({invocation:`models ${spec.action}`,synopsis:spec.synopsis,audience:"agent",agentMayInvoke:!0,mutation:spec.mutation,flags:spec.flags,...spec.takesQuery?{positionals:[{name:"target",required:!0,meaning:"positional"in spec?spec.positional:"the CLI to update, or on/off"}]}:{}})),{invocation:"status",synopsis:"running work, queued reasons, results to review, the latest release check and plan windows",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"health",synopsis:"recent server latency, event-loop delay, SQLite writes and live streams from the saved connection; instance operators only",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,{name:"profile",takesValue:!0,meaning:"saved server connection"}]},{invocation:"integrations",synopsis:"every integration as Connected, Not set up or Broken, with its last success and error, what uses it and what to do; --saved skips new checks; never a secret",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,{name:"saved",takesValue:!1,meaning:"show the last checks without checking again"}]},{invocation:"ready",synopsis:"what could be dispatched right now (rows carry reservedFor)",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"brief",synopsis:"the lead's catch-up from the local database; --history selects the older operational report",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"gaps",synopsis:"requirement gaps blocking dispatch",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,repoFlag]},{invocation:"grants",synopsis:"list authority grants",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"audit",synopsis:"what people did on this server with their API tokens, newest first: when, who, which token, from the CLI (api) or an agent (mcp), the command or tool, the project and the outcome (ok, refused, error); an approver sees everyone in their projects, anyone else only themselves",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,{name:"person",takesValue:!0,meaning:"only this person's actions"},{name:"token",takesValue:!0,meaning:"only actions with the token of this name (on the server's own machine)"},{name:"token-name",takesValue:!0,meaning:"the same, where --token would be a credential (remotely)"},{name:"source",takesValue:!0,meaning:"api (the CLI) or mcp (an agent)"},{name:"since",takesValue:!0,meaning:"only the last N days, as Nd (7d)"},{name:"limit",takesValue:!0,meaning:"actions per page (default 20, at most 100)"},{name:"cursor",takesValue:!0,meaning:"the nextCursor of the previous page"}]},{invocation:"sync",synopsis:"refresh external-tracker mirrors and deliver write-backs — safe to run; fails closed",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",flags:[jsonFlag,dbFlag,repoFlag],notableReasons:["no-op","external"]},{invocation:"task add",synopsis:"queue work",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"title",required:!0,meaning:"one line of what to do"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"goal",takesValue:!0,meaning:"what to accomplish; also the manual-review acceptance criterion"},{name:"body",takesValue:!0,meaning:"alias for --goal"},{name:"plan",takesValue:!1,meaning:"request a plan before coding"},{name:"just-code",takesValue:!1,meaning:"skip planning"},{name:"backend",takesValue:!0,meaning:"external tracker (title only)"},{name:"id",takesValue:!0,meaning:"choose the task id"},{name:"repo",takesValue:!0,meaning:"which repository the task belongs to"},{name:"report",takesValue:!1,meaning:"a scout task: the deliverable is a report, never a branch"},{name:"replaces",takesValue:!0,meaning:'the task this one replaces: it is cancelled and reads "Replaced by <id>"'},{name:"token",takesValue:!0,meaning:"a lead token: filed as the lead, so it pings nobody"},{name:"checks",takesValue:!0,meaning:`quick|full|off: this task's checks, overriding the project's level ("skip the tests" is off)`}],notableReasons:["duplicate","usage","unknown-task","unauthenticated"]},{invocation:"task new",synopsis:"start a small task at a terminal: shows the exact terms, then Build now? is your approval",audience:"operator",agentMayInvoke:!1,mutation:"unkeyed",positionals:[{name:"words",required:!1,meaning:"what should change"}],flags:[dbFlag,{name:"repo",takesValue:!0,meaning:"the project"},{name:"as",takesValue:!0,meaning:"the approver"},{name:"token",takesValue:!0,meaning:"their password"},{name:"from",takesValue:!0,meaning:"a github.com issue or pull request of this project: quoted, then filed for your approval"},{name:"preview",takesValue:!1,meaning:"the terminal UI's own: the exact terms, nothing started"},{name:"build",takesValue:!0,meaning:"the terminal UI's own: Build on those terms"},{name:"digest",takesValue:!0,meaning:"the terms the person read"}],notableReasons:["person-only","usage"]},{invocation:"task keep",synopsis:"a fast start that grew: propose a plan for its exact commit, for you to approve",audience:"operator",agentMayInvoke:!1,mutation:"unkeyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"as",takesValue:!0,meaning:"the approver"},{name:"token",takesValue:!0,meaning:"their password"}],notableReasons:["usage","refused"]},{invocation:"task ask",synopsis:"hand a task to a person: one message saying why, and the task is theirs",audience:"agent",agentMayInvoke:!0,mutation:"unkeyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"person",takesValue:!0,meaning:"who to ask (someone who can see the task's project)"},{name:"why",takesValue:!0,meaning:"what they need to do, one line"},{name:"token",takesValue:!0,meaning:"the lead token (or TOOLROLL_LEAD_TOKEN)"}],notableReasons:["unknown-task","unknown-person","unplaced","unauthenticated"]},{invocation:"task checks",synopsis:"run checks on the task's latest result, on its exact commit, now; a pass upgrades its status and a failure stays visible",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"task",required:!0,meaning:"any version of the task"}],flags:[jsonFlag,dbFlag,{name:"level",takesValue:!0,meaning:"quick (default) or full"}],notableReasons:["no-result","no-check","checks-failed"]},{invocation:"task ship",synopsis:"the task's pull request checks as last observed for its head: each check's state and how long it took",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"task",required:!0,meaning:"any version of the task"}],flags:[jsonFlag,dbFlag],notableReasons:["unknown-task","no-pull-request"]},{invocation:"task ready",synopsis:"Can I merge? The task's checklist from Toolroll's records, each blocker with the act that clears it (Run checks, Retry, Ask the agent to fix)",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"task",required:!0,meaning:"any version of the task"}],flags:[jsonFlag,dbFlag],notableReasons:["unknown-task"]},{invocation:"task add-tests",synopsis:"file a small task to write tests for the task's latest change; it waits for approval like any task",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"task",required:!0,meaning:"any version of the task"}],flags:[jsonFlag,dbFlag],notableReasons:["no-result"]},{invocation:"task list",synopsis:"a page of saved task status",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,{name:"state",takesValue:!0,meaning:"queued|running|done|failed|cancelled"},{name:"view",takesValue:!0,meaning:"all|needs-you|running|completed|archived"},{name:"limit",takesValue:!0,meaning:"page size, 1–100; default 40"},{name:"cursor",takesValue:!0,meaning:"nextCursor from the previous response"},{name:"repo",takesValue:!0,meaning:"filter to one project"}]},{invocation:"task show",synopsis:"one task in full",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag],notableReasons:["unknown-task"]},{invocation:"check-progress",synopsis:"current or final approved check progress",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"run",required:!0,meaning:"the build run"}],flags:[jsonFlag,dbFlag],notableReasons:["unknown-run","no-progress"]},{invocation:"task wait",synopsis:"wait for the current attempt to finish or need a person",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"timeout",takesValue:!0,meaning:"stop waiting after this many seconds"}],notableReasons:["unknown-task","timeout","failed","needs-person"]},{invocation:"project show",synopsis:"show the saved local project and optional credential-file reference",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"project use",synopsis:"select an exact saved checkout; grants no project or execution authority",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"path",required:!0,meaning:"exact saved project checkout path"}],flags:[jsonFlag,dbFlag,{name:"token-file",takesValue:!0,meaning:"optional existing scoped coordinator credential file; saves only its path"}]},...["complete","revise"].map(action=>({invocation:`task ${action}`,synopsis:action==="complete"?"mark the exact inspected result complete; checks and permissions remain unchanged":"request a same-task revision using explicit feedback; existing approval terms apply",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"task",required:!0,meaning:"task or assignment id"}],flags:[jsonFlag,dbFlag,{name:"token-env",takesValue:!0,meaning:"scoped coordinator credential environment variable"},{name:"token-file",takesValue:!0,meaning:"scoped coordinator credential file; defaults to selected project reference"},...action==="complete"?[{name:"digest",takesValue:!0,meaning:"exact receipt from assignment show; required for JSON or scoped agents"},{name:"pull-request",takesValue:!1,meaning:"also open the result's pull request from that commit, as the console's Complete does; an approver's sign-in (--as/--token), never a scoped credential; refuses with pull-requests-off and the setup command"},{name:"run",takesValue:!0,meaning:"the terminal's local owner: the exact build of the result read; required there with --digest"},{name:"checked",takesValue:!1,meaning:"the terminal's local owner: you checked the result yourself; required when it owes your own check"},{name:"reason",takesValue:!0,meaning:"the terminal's local owner: why you accept a result whose requirement isn't shown; required for an exception"}]:[{name:"feedback",takesValue:!0,meaning:"specific requested change"},{name:"run",takesValue:!0,meaning:"exact result run; defaults to current result"},{name:"source",takesValue:!0,meaning:"exact scope digest; defaults to current terms"},{name:"key",takesValue:!0,meaning:"32 hexadecimal characters for exact replay; defaults to a stable feedback identity"}]]})),{invocation:"task merge",synopsis:"merge the task's pull request once its checks pass — the console's Merge, behind the approver's password; the project's method (squash by default), branch deleted, recorded in the ledger",audience:"operator",agentMayInvoke:!1,mutation:"identity-idempotent",positionals:[{name:"task",required:!0,meaning:"any version of the task"}],flags:[jsonFlag,dbFlag,{name:"as",takesValue:!0,meaning:"the approver merging"},{name:"token",takesValue:!0,meaning:"their password"},{name:"anyway",takesValue:!1,meaning:"merge a Quick or Off result without waiting for its full check"}],notableReasons:["usage","not-an-approver","full-checks"]},...["show","updates","claim","check","brief","inbox","ack"].map(action=>({invocation:`assignment ${action}`,synopsis:action==="show"?"read the root, current work, owner and exact receipt":action==="updates"?"read the history of handoffs sent to people after a cursor; delivers nothing — receive updates with assignment inbox":action==="claim"?`record lead ownership; with the lead token the task reads "<the lead's name> is on it" and leaves Needs you until done, handed over, or 2 hours idle; grants no approval or execution authority`:action==="brief"?"catch up from current assignments and project knowledge in the local database":action==="inbox"?"receive or replay a saved batch of lead status updates":action==="ack"?"acknowledge delivery of an inbox batch; leaves task completion unchanged":"acknowledge the exact ready receipt as its lead; accepts no proof and deploys nothing",audience:"agent",agentMayInvoke:!0,mutation:action==="claim"||action==="check"||action==="inbox"||action==="ack"?"identity-idempotent":"none",...["show","claim","check"].includes(action)?{positionals:[{name:"task",required:!0,meaning:"any task in the assignment's existing correction chain"}]}:{},flags:[jsonFlag,dbFlag,{name:"token-env",takesValue:!0,meaning:"explicit environment variable containing a coordinator token; required for claim/check/inbox/ack unless token-file is used"},{name:"token-file",takesValue:!0,meaning:"explicit coordinator token file; cannot be combined with token-env"},...action==="updates"?[{name:"after",takesValue:!0,meaning:"last processed admitted update cursor; defaults to 0"},{name:"limit",takesValue:!0,meaning:"page size from 1 to 100; defaults to 50"}]:[],...action==="check"?[{name:"digest",takesValue:!0,meaning:"exact current receipt digest from assignment show"}]:[],...action==="brief"?[{name:"repo",takesValue:!0,meaning:"project to include within the credential's access"},{name:"limit",takesValue:!0,meaning:"assignment count from 1 to 25; defaults to 10"}]:[],...action==="inbox"||action==="ack"?[{name:"consumer",takesValue:!0,meaning:"stable lowercase name for this lead's delivery cursor"}]:[],...action==="inbox"?[{name:"limit",takesValue:!0,meaning:"batch size from 1 to 100; defaults to 10"}]:[],...action==="ack"?[{name:"batch",takesValue:!0,meaning:"exact batch ID returned by assignment inbox"}]:[]]})),operator("task state","set a task's state by hand — an operator correction, not a workflow step (--replaced-by <id> with cancelled)"),operator("lead token","mint the lead's credential behind your password (--revoke ends it): its own work pings nobody"),{invocation:"lead say",synopsis:"as the lead: one short message in its person's chat under the lead's name (Settings → Lead); several within two minutes are one message",audience:"agent",agentMayInvoke:!0,mutation:"unkeyed",positionals:[{name:"text",required:!0,meaning:"one short line in plain words"}],flags:[jsonFlag,dbFlag,{name:"task",takesValue:!0,meaning:"the task it is about"},{name:"token",takesValue:!0,meaning:"the lead token (or TOOLROLL_LEAD_TOKEN)"}],notableReasons:["usage","unknown-task","unauthenticated"]},{invocation:"task block",synopsis:"make one task wait for another",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the waiting task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"on",takesValue:!0,meaning:"the blocker's id"}],notableReasons:["unknown-task"]},{invocation:"task unblock",synopsis:"stop waiting",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the waiting task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"on",takesValue:!0,meaning:"the blocker's id"}],notableReasons:["unknown-task"]},{invocation:"task next",synopsis:"move a task to the front of ITS queue (scheduling only; approval still required)",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"undo",takesValue:!1,meaning:"back to filing order"}],notableReasons:["unknown-task","claimed"]},operator("task steer","one credentialed note for the task's agent — a running Claude build gets it in seconds, another running build reads it when it next checks for notes, otherwise the next attempt does; --now pauses the running Claude build first; steering speaks with the operator's voice"),{invocation:"task log",synopsis:"tail a task's live or finished agent output (--follow, --sub, --lines)",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"follow",takesValue:!1,meaning:"stream appended output while running"},{name:"sub",takesValue:!1,meaning:"read subagent helper output"},{name:"lines",takesValue:!0,meaning:"maximum trailing lines to display"}],notableReasons:["unknown-task","usage"]},{invocation:"task send",synopsis:"send a live message or steering note directly to a task's agent",audience:"operator",agentMayInvoke:!1,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"},{name:"note",required:!0,meaning:"message for the agent"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"note",takesValue:!0,meaning:"message text (optional if given positionally)"}],notableReasons:["unknown-task","task-finished","usage"]},{invocation:"task handoff",synopsis:"hand a task's live worktree and compact Handoff Packet to another coding agent",audience:"operator",agentMayInvoke:!1,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"to",takesValue:!0,meaning:"target agent provider (claude, codex, gemini, ...)"},{name:"model",takesValue:!0,meaning:"optional target model id"},{name:"note",takesValue:!0,meaning:"handoff instructions for the receiving agent"}],notableReasons:["unknown-task","invalid-agent","task-finished","usage"]},{invocation:"task attach",synopsis:"attach to a task's active run, worktree status, and live output stream",audience:"operator",agentMayInvoke:!1,mutation:"none",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"lines",takesValue:!0,meaning:"initial trailing lines to display"}],notableReasons:["unknown-task","usage"]},operator("task pause","stop a running Claude build's current turn and keep the build (--run <id> names the attempt): its next note continues it; never a stop"),operator("task continue","resume a paused Claude build where it stopped, without a note (--run <id> names the attempt)"),{invocation:"task assign",synopsis:"reserve a task for one worker, or return it to the shared queue",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"runner",takesValue:!0,meaning:"the worker to reserve for"},{name:"anyone",takesValue:!1,meaning:"back to the shared queue"}],notableReasons:["unknown-task","claimed"]},{invocation:"task scope",synopsis:"state what success is; approval binds to this exact statement",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"goal",takesValue:!0,meaning:"what success is"},{name:"acceptance",takesValue:!0,meaning:"required: <statement>|<evidence,kinds> (check,screenshot,changed-path,manual-review); separate criteria with semicolons"},{name:"not",takesValue:!0,meaning:"explicitly out of scope"},{name:"touches",takesValue:!0,meaning:"comma-separated paths this may change"},{name:"budget-usd",takesValue:!0,meaning:"spend ceiling for the build"}],notableReasons:["unknown-task"]},{invocation:"task plan",synopsis:"ask for a plan document (a planning session drafts; a person approves)",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"provider",takesValue:!0,meaning:"pin which provider plans THIS task (plan phase only)"},{name:"model",takesValue:!0,meaning:"the pinned plan model, riding --provider"},{name:"digest",takesValue:!0,meaning:"the terminal's local owner: the exact planning source read; required there, and --provider/--model are refused"},{name:"incident",takesValue:!0,meaning:"the terminal's local owner: plan again after this planning incident (the plan failed its checks)"}],notableReasons:["unknown-task"]},{invocation:"task hold",synopsis:"park a task with a reason",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"reason",takesValue:!0,meaning:"why it waits"},{name:"until",takesValue:!0,meaning:"ISO time to resurface"}],notableReasons:["unknown-task","held"]},{invocation:"task unhold",synopsis:"release a hold",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag],notableReasons:["unknown-task","not-yours"]},{invocation:"task require",synopsis:"name the capabilities a task needs before dispatch",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"require",takesValue:!0,meaning:"comma-separated capability keys"}],notableReasons:["unknown-task"]},operator("task approve","the yes — nothing builds without one; binds to the scope digest"),operator("task requeue","exit a stall: incidents resolved, strikes cleared, queued again"),operator("task regate","explicitly rerun the approved check on the last exact commit — no agent or automatic retry"),{invocation:"task review",synopsis:"read a task's compact result packet with --brief, or a run's automatic findings without it",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"id",required:!0,meaning:"task id with --brief; run id otherwise"}],flags:[jsonFlag,dbFlag,{name:"brief",takesValue:!1,meaning:"saved conclusion, changed files, checks, findings, screenshots, plan and next actions; missing fields say not recorded"},{name:"run",takesValue:!0,meaning:"with --brief, select an exact finished attempt instead of the latest"},{name:"all",takesValue:!1,meaning:"include LOW findings within the compact packet's limit; extra findings are counted"},{name:"token",takesValue:!0,meaning:"the lead token (or TOOLROLL_LEAD_TOKEN)"}],notableReasons:["usage","unauthenticated","not-found"]},{...operator("task accept",`accept a result: --finish (or --digest <receipt>) is exactly task complete's completion of the exact receipt; --despite "<reason>" records an acceptance with limitations and never completes; a bare call refuses`),positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"finish",takesValue:!1,meaning:"accept the result and finish the task: task complete's exact-receipt completion; --json and scoped agents pass --digest"},{name:"digest",takesValue:!0,meaning:"the exact receipt from assignment show; accepts and finishes exactly that result"},{name:"despite",takesValue:!0,meaning:"accept with this reason, without finishing; never combines with --finish or --digest (--note is its alias)"}],notableReasons:["usage","unknown-task","no-run","not-ready"]},{...operator("task land","put accepted work on the project's own branch when it has no pull requests: bare shows exactly what lands where; --yes --key <preview-key> lands it as one new commit on top; --undo reverts that commit with a new one"),positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"into",takesValue:!0,meaning:"land on this branch instead of the recorded one (the yes records it)"},{name:"undo",takesValue:!1,meaning:"revert the landing with a new commit on the branch"},{name:"yes",takesValue:!1,meaning:"land it; needs --key"},{name:"key",takesValue:!0,meaning:"the key the bare call showed: what lands is what you read"}],notableReasons:["usage","not-complete","checks","dirty","moved","occupied","stale"]},operator("task repair","inspect or approve a repair draft; --yes starts the repair a failed check is waiting for, under the normal plan approval"),operatorRead("task handover","where a task stands, from Toolroll's records: revision, decisions, rejected approaches, open findings, checks and the next action"),operator("task before-after","before-and-after evidence: read it, save a failing result, or rerun the same check on the latest commit with no agent"),operator("task failing-first","ask a bug fix's next attempt to write a failing test first (on|off); shown in the result as the agent's report"),operatorRead("finding list","findings still waiting on someone, or every finding of --task <id>"),operatorRead("finding show","one finding: its text, evidence and how it stands"),operator("finding send","send a finding to the task that owns the code; the owner must accept it or reject it with a reason"),operator("finding resend","send an answered finding back, one more round; past the limit it goes to a person"),operator("finding close","a person's decision on a finding"),operatorRead("captures list","what providers said when attempts failed, the ones mentioning limits first; nothing routes on these"),operatorRead("captures show","one saved provider failure"),operatorRead("captures export","one saved provider failure as a fixture"),operator("captures mark","a person's reading of a capture: exhausted or not-exhausted"),operator("task route","which configured agents plan, build and repair this task; phase and size changes require renewed approval"),operator("task reopen","resume external work its tracker closed and has been SEEN open again"),operator("task stop","stop ONE exact live attempt (--run <id>): durable before any process is signalled, answers 'stopping' until its own processes are established gone; work, branch, and evidence preserved; no strike, no retry"),{...operator("task archive","put tasks away (a person's act): out of every list, count and nudge, history and approvals kept; nothing claims, approves or dispatches them until restored"),positionals:[{name:"id",required:!0,meaning:"one or more tasks (any version: the whole family goes)"}],flags:[jsonFlag,dbFlag,{name:"reason",takesValue:!0,meaning:"why, shown on the task page"}],notableReasons:["unknown-task","not-an-approver"]},{...operator("task restore","bring put-away tasks back exactly as they were (a person's act)"),positionals:[{name:"id",required:!0,meaning:"one or more put-away tasks"}],flags:[jsonFlag,dbFlag],notableReasons:["unknown-task","not-an-approver"]},{...operator("task tidy","Put away old tasks: --preview lists what would go and why (read-only), --apply --digest <d> puts away exactly that list (a person's act)"),flags:[jsonFlag,dbFlag,{name:"preview",takesValue:!1,meaning:"show the list and the digest; changes nothing"},{name:"apply",takesValue:!1,meaning:"put away exactly the previewed list (needs --digest)"},{name:"digest",takesValue:!0,meaning:"the digest --preview printed"},{name:"days",takesValue:!0,meaning:"also finished tasks untouched this many days (1–365, default 14)"},{name:"except",takesValue:!0,meaning:"comma-separated tasks from the list to leave out"}],notableReasons:["usage","not-an-approver","empty"]},operator("run settle","have Toolroll check again whether a finished run stopped: it looks at this computer's processes itself, stops only leftovers proven the run's, and settles the run when none is left (nobody vouches; --why is ignored)"),operator("task resume","resume the exact stopped attempt (--run <id>): refuses until it is quiescent, lifts only that stop's hold, approves nothing — the next pass re-proves the scope and inherits the draft with fresh proof"),{invocation:"claim",synopsis:"take one ready, approved task; answers with a lease",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"runner",takesValue:!0,meaning:"your registered worker name"},{name:"token",takesValue:!0,meaning:"the worker's token"},{name:"ttl",takesValue:!0,meaning:"lease seconds"}],notableReasons:["held","fenced","unapproved","reserved","external","claimed","not-ready","closed"]},{invocation:"heartbeat",synopsis:"still working; extends the lease",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"lease",required:!0,meaning:"the lease id"}],flags:[jsonFlag,dbFlag],notableReasons:["not-leased","fenced","closed"]},{invocation:"worker release",synopsis:"done with it; fenced if superseded",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"lease",required:!0,meaning:"the lease id"}],flags:[jsonFlag,dbFlag],notableReasons:["not-leased","fenced"]},{invocation:"reap",synopsis:"release every lease that ran out",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",flags:[jsonFlag,dbFlag]},{invocation:"tick",synopsis:"one unattended pass: claim, build in a leased worktree, commit to a branch — never pushes",audience:"agent",agentMayInvoke:!0,mutation:"unkeyed",flags:[jsonFlag,dbFlag,repoFlag,{name:"runner",takesValue:!0,meaning:"your registered worker name"},{name:"token",takesValue:!0,meaning:"the worker's token"},{name:"max",takesValue:!0,meaning:"tasks this pass (default 1)"},{name:"base",takesValue:!0,meaning:"base ref for first attempts"}],notableReasons:["empty","fenced"]},{invocation:"build",synopsis:"build one claimed task directly (the piece tick automates)",audience:"agent",agentMayInvoke:!0,mutation:"unkeyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,repoFlag],notableReasons:["not-leased","unapproved"]},{invocation:"reconcile",synopsis:"recover what the last stretch left behind — safe to repeat",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",flags:[jsonFlag,dbFlag,repoFlag]},{invocation:"runner list",synopsis:"registered workers",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"coordinator list",synopsis:"MCP filing credentials and their limits",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"approver list",synopsis:"who can say yes (names only)",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"cap list",synopsis:"recorded capabilities",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,repoFlag]},{invocation:"outbox list",synopsis:"queued notifications",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"incident list",synopsis:"open incidents",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"config show",synopsis:"phase and spend configuration",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,repoFlag]},{invocation:"setup show",synopsis:"installation setup",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"verify show",synopsis:"the repository's check level, its approved full and quick commands, and a suggested quick command",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,repoFlag]},{invocation:"intake show",synopsis:"intake configuration",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"providers",synopsis:"which agent providers this binary can drive, and their transports; --report records this machine's readiness under its runner",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,{name:"report",takesValue:!1,meaning:"record readiness observations under --runner"},{name:"runner",takesValue:!0,meaning:"the registered worker name reporting"},{name:"token",takesValue:!0,meaning:"that worker's token"}]},{invocation:"template list",synopsis:"work templates: tasks and scheduled flows",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"template show",synopsis:"one template",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"name",required:!0,meaning:"the template"}],flags:[jsonFlag,dbFlag]},{invocation:"webhook status",synopsis:"connected messaging services",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"publish status",synopsis:"publication and merge-grant state",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},operator("approver add","mint the credential that lets a person say yes"),operator("runner register","register a worker bound to its repositories; its token is shown once"),operator("runner retire","retire a worker"),operator("runner bind","replace which repositories a worker may build in"),operator("runner capacity","set how many tasks a worker runs at once; running work carries on, the new number applies at the next claim"),operator("project checks","show or set a project's batch checks (--batch on|off, off by default): results that finish within 10 minutes share one full check on a temporary batch commit; nothing is merged into a real branch"),operator("project check-access","show or set how far a project's checks reach: sandboxed (the default), with model and GitHub sign-ins, or not sandboxed; an instance operator widens it with a password typed now"),operator("project concurrency","set how many of a project's tasks build at once (default 2, never past the worker's capacity); running work carries on"),operator("coordinator mint","mint the MCP filing credential — repo-bound, rate-limited, token shown once"),operator("coordinator revoke","revoke an MCP filing credential"),operator("mcp","serve the MCP gateway over stdio — the coordinator credential is the only key it accepts"),operator("cap add","record a capability"),operator("outbox deliver","deliver queued notifications"),operator("peek","watch live agents in the terminal — one pane per open run; --tmux opens a window per run"),operator("incident resolve","resolve an incident"),operator("decide","read and ANSWER parked decisions — answering is a person's act"),operatorRead("keys status","which provider API keys are stored — never the values"),operator("keys set","store a provider's API key as a private file — piped or --key-file, never on the command line"),operator("keys clear","remove a stored provider key (kept only as a fallback; a subscription-mode provider is unaffected)"),operatorRead("keys verify","check a stored key against its provider live — spends no tokens"),operator("keys auth","choose subscription vs API key for a provider (subscription is the default; the key is kept as fallback)"),operatorRead("people list","everyone who can sign in, their standing, and the open invites"),operator("people invite","mint a single-use sign-in link for one person — their powers are pinned when you mint, never after"),operator("people projects","set a person's project access — selected project, all projects, or no projects"),operator("people revoke","end a person's access — their sessions, invites, and signed modes end with them; history stays"),operator("tokens create","make one of your API tokens: --name, --access read|act, --days 30|90|365, optional --projects a,b; your password at the prompt or --password-stdin; the token is shown once"),operatorRead("tokens list","your API tokens: name, access, projects, made, last used, expiry — never a secret; your password at the prompt or --password-stdin"),operator("tokens revoke","end one of your API tokens now, by name or id; your password at the prompt or --password-stdin"),operator("tokens rotate","replace one of your API tokens on the same terms; the old one works 10 more minutes (--overlap), then stops; the new one is shown once"),operatorRead("mode show","the repository's operating mode, in full — or 'locked' when none is signed"),operator("mode set","sign a per-repository operating mode (password ceremony; standard or hands-off, always expiring)"),operator("publish merge","say yes to ONE waiting merge — it fires only when CI is seen green on the exact commit you authorized"),operator("publish refire","recover a merge whose issued call went silent — re-enters the full merge road, never auto-retried"),operatorRead("review show","whether a project's finished builds get one automatic review"),operator("review on","one automatic review of each finished build whose check passes; only HIGH findings send it back, once"),operator("review off","finished builds go straight to the person, unreviewed"),operatorRead("chat-approval show","whether your own taps in your paired chat approve plans and merges: all projects and each project's own setting"),operator("chat-approval on","let your paired chat approve plans and merges in all your projects or one (--repo); lasting, with limits; previews until --yes"),operator("chat-approval off","stop approving from chat for all your projects or one (--repo); one step"),operator("mode revoke","revoke a repository's mode — one click, every act it covered falls back to its own ceremony"),operator("config set","set phase or spend configuration"),operator("config clear","clear phase or spend configuration"),operatorRead("thread list","your own interactive agent threads: each one's title, project and where it stands"),operatorRead("thread show","one of your threads: its latest turn, its end and its Ship, in Toolroll's words"),operator("thread end","end one of your threads for good (its agent stops; its work can still be shipped for a week)"),operator("thread remove","remove one of your threads' working copy (refused while its agent may run or a Ship is open)"),operator("thread ship","ship one of your threads' committed work: shows its terms, asks, then takes your password typed now"),operator("thread save","save one of your threads' committed work as the branch toolroll/code-<id> in its project (no pull request, no merge); says the git merge that puts it on your branch"),operator("setup clear","clear installation setup"),operator("verify set",'approve the one shell command the plane re-runs after every future commit (--quick "<cmd>" approves the fast check Quick runs); --self-heal binds one approved-setup replay when a required project executable is missing'),operator("verify clear","revoke a repository's approved verification command; --level quick revokes only the quick command"),operator("verify level","set a project's checks after each build: quick (the approved quick command), full, or off — an approver's act, in the ledger"),operator("intake grant","grant an intake source"),operator("intake run","run intake now"),operator("intake preview","preview what intake would file"),operator("intake pr-comments","intake review comments from a pull request"),operator("intake clear","clear intake configuration"),operator("webhook primary","choose which service receives alerts"),operator("bridge","the Telegram bridge (pairing, tokens, the follower)"),operator("enroll","grant a repository authority (backends, dispatch) — its own explicit yes"),operator("revoke","take an authority grant back"),operator("publish","the publication pass: push built branches, open pull requests, sweep merges"),operator("publish grant","grant publication or auto-merge authority"),operator("publish revoke","take a publication grant back"),operator("publish unblock","lift a repair's merge hold"),operator("publish rearm","re-arm a refused merge after fixing the named cause"),operator("serve","the operations console (HTTP)"),operatorRead("serve check-public","is this server ready on its --public-url? checks the URL, --allow-host, the console on --port, the certificate, HSTS and the proxy, and names each problem; sends no credentials"),operator("watch","the unattended loop, kept running"),operator("up","console + worker + browser, one command"),operator("onboard","add this repository, report signed-in agents, install or --remove the operator skill (--yes), offer the starter flows (--starter <ids>), and print the handoff"),operator("daemon","install the loop under the OS service manager"),operator("background on","keep this computer's Toolroll running: a login item that starts `up --laptop` when you log in; hands over from the `up` this terminal runs and puts everything back if the service doesn't answer (--port)"),operator("background off","stop running in the background: unloads and removes only Toolroll's own login item"),operatorRead("background show","whether Toolroll runs in the background here, whether it is running now, and any other service on this database"),operator("stop","stop this computer's Toolroll after its running work is saved: the background service (until the next login), or the `up` running in a terminal"),operator("open","open this computer's Toolroll at a terminal, signed in: the terminal UI, or the browser with --web (starts it first when it isn't running); never prints a sign-in link"),{...operatorRead("welcome","the three steps to a first result (agent, project, first task) as the console's welcome shows them; at a terminal it walks them one at a time"),flags:[jsonFlag,dbFlag]},{...operator("welcome sample","add the sample project (a tiny repository with one function and its test) in your projects folder, as this computer's password-free owner at a terminal: the console welcome's Try a sample project; takes no folder or name"),flags:[jsonFlag,dbFlag]},operator("password set","set this computer's first password, typed twice at your own terminal (never a flag, file or environment variable); every session signs in again and local mode stays on"),operator("password reset","reset a forgotten password at the computer running Toolroll, typed twice at your own terminal (the one approver, or --as <name>); every session of that account ends and a saved first password that no longer works is removed. Anyone who can run commands as you on this computer can do this, as they could read the saved file"),{...operatorRead("doctor","check that Toolroll's service holds no key, token or password a build could read; names what it finds and the steps to fix it, never a value, and changes nothing"),flags:[jsonFlag]}],REMOTE_NO=["plugin list","plugin install","plugin update","plugin rollback","plugin remove","plugin validate","task new","task keep","","pulls","graph","repos","repos add","repos remove","repos add-from-github","contract","skills list","skills get","skills install","link","unlink","update","release","demo","chat","project show","project use","brief","lead token","lead say","health","assignment show","assignment updates","assignment claim","assignment check","assignment brief","assignment inbox","assignment ack","claim","heartbeat","worker release","reap","tick","build","reconcile","runner register","runner retire","runner bind","runner capacity","coordinator mint","coordinator revoke","mcp","outbox deliver","peek","serve","serve check-public","watch","up","onboard","daemon","background on","background off","background show","stop","open","welcome","welcome sample","password set","password reset","doctor","bridge","setup show","setup clear","providers","keys status","keys set","keys clear","keys verify","keys auth","models check","models update","models watch","models results","models suggestions","models accept","models dismiss","models turn-off","models keep","models try","models stop","map on","map off","map holdout end","map report","thread list","thread show","thread end","thread remove","thread ship","thread save","publish","publish status","publish merge","publish refire","publish unblock","publish rearm","publish grant","publish revoke","enroll","revoke","flows import","flows trigger check","flows script save","flows browser","memory propose","card list","card remove"],REMOTE_FOLLOW_THROUGH=["task handover","task before-after","task failing-first","finding list","finding show","finding send","finding resend","finding close","captures list","captures show","captures export","captures mark"],REMOTE_STEP_UP=["proposals","decide","task regate","task approve","task accept","task merge","run settle","task archive","task restore","task tidy","task land","knowledge apply","memory decide","memory retire","memory apply","memory tidy","memory restore","memory unmerge","flows card approve","flows card send-back","flows script approve","flows unattended","approver list","approver add","people list","people invite","people projects","people revoke","tokens create","tokens list","tokens revoke","tokens rotate","mode show","mode set","mode revoke","chat-approval on","review on","review off","config set","config clear","verify set","verify clear","verify level","project checks","project check-access","project concurrency","intake grant","intake clear","webhook primary"],REMOTE_YES=["status","integrations","ready","gaps","grants","sync","audit","task add","task ask","task checks","task ship","task ready","task add-tests","task list","task show","check-progress","task wait","task complete","task revise","task state","task block","task unblock","task next","task steer","task pause","task continue","task assign","task scope","task plan","task hold","task unhold","task require","task requeue","task review","task repair","task route","task reopen","task stop","task resume","task log","task send","task handoff","task attach","runner list","coordinator list","cap list","cap add","outbox list","incident list","incident resolve","config show","verify show","intake show","intake run","intake preview","intake pr-comments","template list","template show","webhook status","review show","chat-approval show","chat-approval off","knowledge search","knowledge impact","knowledge refresh","map","map area","map file","map search","map refresh","memory search","memory decisions","memory show","memory review","memory status","flaky list","flaky show","card","flows list","flows show","flows export","flows create","flows edit","flows trigger add","flows trigger pause","flows trigger resume","flows trigger remove","flows card add","flows archive","models status","models list"];export const REMOTE_POLICY=new Map([...REMOTE_NO.map(invocation=>[invocation,"no"]),...REMOTE_FOLLOW_THROUGH.map(invocation=>[invocation,"no"]),...REMOTE_STEP_UP.map(invocation=>[invocation,"step-up"]),...REMOTE_YES.map(invocation=>[invocation,"yes"])]),REMOTE_POLICY_COUNT=REMOTE_NO.length+REMOTE_FOLLOW_THROUGH.length+REMOTE_STEP_UP.length+REMOTE_YES.length;const LOCAL_ALLOW={"plugin list":"read","plugin validate":"read","plugin install":"skill-library","plugin update":"skill-library","plugin rollback":"skill-library","plugin remove":"skill-library",pulls:"read",graph:"read",repos:"read",map:"read","map area":"read","map file":"read","map search":"read",status:"read",ready:"read",gaps:"read",contract:"read","skills list":"read","skills get":"read","flaky list":"read","flaky show":"read",card:"read","memory review":"read","memory status":"read","memory decisions":"read","memory show":"read","memory apply":"memory-review","memory tidy":"memory-review","memory restore":"memory-review","memory unmerge":"memory-review","task list":"read","task show":"read","task state":"read","task wait":"read","check-progress":"read","review show":"read",welcome:"read","task add":"file-task","task new":"build-now",chat:"lead-send","task steer":"lead-send","task approve":"approve-plan",decide:"answer-question","task stop":"stop-run","task pause":"pause-run","task hold":"pause-run","task resume":"resume-run","task continue":"resume-run","task unhold":"resume-run","task complete":"complete-task","task accept":"complete-task","task land":"land-task","task plan":"request-plan","task requeue":"retry-build","task revise":"request-revision","task archive":"archive-task","task restore":"archive-task","repos add":"add-project","welcome sample":"add-project","models suggestions":"read","models turn-off":"routing-turn-off","models dismiss":"dismiss-suggestion","models stop":"trial-stop","map on":"code-map-switch","map off":"code-map-switch","task send":"lead-send","task handoff":"change-task-agents","config set":"change-models","config clear":"change-models"};export const LOCAL_POLICY=new Map(GUIDE_ROWS.map(row=>[row.invocation,Object.prototype.hasOwnProperty.call(LOCAL_ALLOW,row.invocation)?{local:"allow",act:LOCAL_ALLOW[row.invocation]}:{local:"deny"}])),LOCAL_ALLOWED_INVOCATIONS=Object.keys(LOCAL_ALLOW),COMMAND_ENTRIES=commandEntries(GUIDE_ROWS.map(row=>({...row,remote:REMOTE_POLICY.get(row.invocation)??"no"}))),GUIDE_INVOCATIONS=GUIDE_ROWS.map(row=>row.invocation),COMMAND_GUIDE=COMMAND_ENTRIES.map(entry=>entry.guide);
|
|
1
|
+
import{KNOWLEDGE_DESCRIPTORS}from"./knowledge-cli.js";import{MEMORY_DESCRIPTORS}from"./memory-cli.js";import{CARD_DESCRIPTOR}from"./card-cli.js";import{FLAKY_DESCRIPTORS}from"./flaky-cli.js";import{MODELS_DESCRIPTORS}from"./models-cli.js";import{MAP_DESCRIPTORS}from"./code-map-cli.js";import{FLOWS_DESCRIPTORS}from"./flows-cli.js";import{commandEntries}from"./contracts/cli.js";export const SURFACE_NOTES={authority:"documentation is not permission; legacy entries remain advisory",flags:"flags are intended per command and may use a global parser vocabulary",reasons:"curated, not exhaustive — the runtime `reason` field is the truth; ignore tokens you do not recognize",database:"local database commands wait up to 15 seconds for another writer; an exhausted wait returns database-busy and names the selected file"},SURFACE_SCHEMA_VERSION=1;const jsonFlag={name:"json",takesValue:!1,meaning:"answer with one machine envelope on stdout"},keyFlag={name:"key",takesValue:!0,meaning:"idempotency key — retry with the same key to get the first answer back"},dbFlag={name:"db",takesValue:!0,meaning:"path to the database file (defaults to the installation's)"},repoFlag={name:"repo",takesValue:!0,meaning:"which repository (repeatable where a command watches several)"},operator=(invocation,synopsis)=>({invocation,synopsis,audience:"operator",agentMayInvoke:!1,mutation:"unkeyed"}),operatorRead=(invocation,synopsis)=>({invocation,synopsis,audience:"operator",agentMayInvoke:!1,mutation:"none"}),GUIDE_ROWS=[{invocation:"",envelopeCommand:"scan",synopsis:"report what is in flight (the no-verb default; scans below the working directory or the connected repositories)",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"path",required:!1,meaning:"directories to scan instead of the connected set"}],flags:[jsonFlag,{name:"all",takesValue:!1,meaning:"ignore connected repos; scan everything discoverable"},{name:"local",takesValue:!1,meaning:"branches only — no network"}]},{invocation:"pulls",synopsis:"report what is waiting on a person",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag]},{invocation:"graph",synopsis:"report which work graph is already here",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag]},{invocation:"repos",synopsis:"list connected repositories",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag]},operator("proposals","what coordinators proposed over the MCP gateway — list, confirm <id> [--yes], dismiss <id>; confirming runs the plane's own door under your password"),operator("chat","talk to your lead: one conversation across every project; --say sends one message; --follow enables crew updates and --no-follow pauses them; proposals keep their approval requirements"),{invocation:"repos add",synopsis:"add a project: a Git repository, in the console at once; the lead adds with its token; --remote records or replaces its trusted remote",audience:"agent",agentMayInvoke:!0,mutation:"unkeyed",positionals:[{name:"path",required:!1,meaning:"the repository (default: the one you are in)"}],flags:[jsonFlag,{name:"token",takesValue:!0,meaning:"the lead token (or TOOLROLL_LEAD_TOKEN)"},{name:"remote",takesValue:!0,meaning:"an HTTPS or SSH URL without credentials whose main may complete landed work; replaces a different recorded one (owner or an instance operator's lead only)"}],notableReasons:["not-git","unavailable","refused","locked"]},{invocation:"repos remove",synopsis:"remove a project from the console and the builder; its tasks and results stay saved",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"path",required:!0,meaning:"the repository"}],flags:[jsonFlag,{name:"token",takesValue:!0,meaning:"the lead token (or TOOLROLL_LEAD_TOKEN)"}],notableReasons:["refused","locked"]},operator("repos add-from-github","preview, clone from GitHub, and connect - the console onboarding ceremony as a CLI verb"),{invocation:"contract",synopsis:"the machine contract: envelope version + capability tokens; --commands dumps this guide",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,{name:"commands",takesValue:!1,meaning:"dump the declared command guide"}]},...["list","install","update","rollback","remove","validate"].map(verb=>({invocation:`plugin ${verb}`,synopsis:{list:"list installed plug-ins",install:"install skills from a GitHub URL or folder",update:"update GitHub plug-ins or reload local folders",rollback:"restore a plug-in's previous version",remove:"remove a plug-in from the active library",validate:"validate a local folder without installing it"}[verb],audience:verb==="list"||verb==="validate"?"agent":"operator",agentMayInvoke:verb==="list"||verb==="validate",mutation:verb==="list"||verb==="validate"?"none":"unkeyed",flags:[jsonFlag,dbFlag],...verb==="list"?{}:{positionals:[{name:verb==="install"?"github-url|folder":verb==="validate"?"folder":"id",required:verb!=="update",meaning:"plug-in source or installed id"}]}})),{invocation:"skills list",synopsis:"name the guides this exact binary serves",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag]},{invocation:"skills get",synopsis:"print one guide's markdown (raw on stdout; --json wraps it)",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"name",required:!0,meaning:"a guide name from `skills list`"}],flags:[jsonFlag],notableReasons:["unknown-skill","usage"]},{invocation:"skills install",synopsis:"install or refresh this binary's Toolroll guides for Claude Code; without --claude-code, write the repository-local Agent Skills entry",audience:"operator",agentMayInvoke:!1,mutation:"identity-idempotent",flags:[jsonFlag,{name:"claude-code",takesValue:!1,meaning:"install the user-level Claude Code skill"},{name:"dir",takesValue:!0,meaning:"skill directory (default: ~/.claude/skills/toolroll)"},{name:"yes",takesValue:!1,meaning:"write the previewed files"},{name:"repo",takesValue:!0,meaning:"repository for the existing project-local install"},{name:"write-context",takesValue:!1,meaning:"also add the managed AGENTS.md block for a project-local install"}],notableReasons:["unconfirmed","foreign-file","usage"]},operator("link","put toolroll on PATH"),operator("unlink","take it off PATH"),operator("update","update to the latest release: verified provenance, drained work, backup, rehearsal, health check, automatic restore; --rollback undoes it"),{invocation:"release",synopsis:"release Toolroll itself from a branch: gate the exact commit, wait for the owner's approval, check, complete, deploy, merge, tag, publish, Homebrew; rerun to resume",audience:"operator",agentMayInvoke:!1,mutation:"unkeyed",positionals:[{name:"branch",required:!0,meaning:"the pushed branch with an open pull request"}],flags:[jsonFlag,{name:"repo",takesValue:!0,meaning:"the gate checkout the release check runs in (default: this checkout)"},{name:"new",takesValue:!1,meaning:"release a new commit on the branch, setting the earlier unfinished release aside"},{name:"limit",takesValue:!0,meaning:"<step>=<minutes>: one waiting step's time limit"},{name:"tap",takesValue:!0,meaning:"the Homebrew tap, owner/name"},{name:"release-gate",takesValue:!0,meaning:"<id>: show why an update pause left before a deployment's swap is safe to lift"},{name:"yes",takesValue:!1,meaning:"with --release-gate: lift that one pause once it is proved; with --recover-deploy: recover"},{name:"recover-deploy",takesValue:!1,meaning:"put back a deployment that stopped half way: stop only its own proved leftovers, restart the previous service, lift the pause"},{name:"stage",takesValue:!0,meaning:"with --recover-deploy: the deployment's staging folder"}],notableReasons:["usage","ambiguous","drift","timeout","check-failed","ci-failed","tree-mismatch","conflict","mixed-runtime","gate-held","after-swap"]},operator("demo","a seeded throwaway sandbox"),...KNOWLEDGE_DESCRIPTORS.map(spec=>({invocation:`knowledge ${spec.action}`,synopsis:spec.synopsis,audience:"audience"in spec?spec.audience:"agent",agentMayInvoke:!("audience"in spec),mutation:spec.mutation,flags:spec.flags,...spec.takesQuery?{positionals:[{name:"query",required:!0,meaning:"search text or source file for impact"}]}:{}})),...MEMORY_DESCRIPTORS.map(spec=>({invocation:`memory ${spec.action}`,synopsis:spec.synopsis,audience:"audience"in spec?spec.audience:"agent",agentMayInvoke:!("audience"in spec),mutation:spec.mutation,flags:spec.flags,...spec.takesQuery?{positionals:[{name:"query",required:!0,meaning:"search text, a decision id, or the decision sentence"}]}:{}})),{invocation:CARD_DESCRIPTOR.invocation,synopsis:CARD_DESCRIPTOR.synopsis,audience:"agent",agentMayInvoke:!0,mutation:"none",flags:CARD_DESCRIPTOR.flags,positionals:[{name:"source",required:!0,meaning:"which data to show"}]},{invocation:"card list",synopsis:"list registered declarative TUI panels (~/.toolroll/panels.toml) and their live card previews (read only)",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,{name:"list",takesValue:!1,meaning:"list registered declarative panels"}]},{invocation:"card remove",synopsis:"remove a declarative TUI panel from ~/.toolroll/panels.toml by id",audience:"operator",agentMayInvoke:!1,mutation:"identity-idempotent",positionals:[{name:"id",required:!0,meaning:"panel id slug to remove"}],flags:[jsonFlag,{name:"remove",takesValue:!0,meaning:"panel id slug to remove"}]},...FLAKY_DESCRIPTORS.map(spec=>({invocation:`flaky ${spec.action}`,synopsis:spec.synopsis,audience:"agent",agentMayInvoke:!0,mutation:spec.mutation,flags:spec.flags,...spec.takesQuery?{positionals:[{name:"identity",required:!0,meaning:"a row's key from flaky list"}]}:{}})),...FLOWS_DESCRIPTORS.map(spec=>({invocation:`flows ${spec.action}`,synopsis:spec.synopsis,audience:"audience"in spec?spec.audience:"agent",agentMayInvoke:!("audience"in spec),mutation:spec.mutation,flags:spec.flags,..."positionals"in spec?{positionals:spec.positionals.map(name=>({name,required:!0,meaning:name==="flow"?"a flow id from flows list":name==="card"?"a card id from flows show":name==="on|off"?"on signs the grant, off revokes it":"a trigger id from flows show, or for trigger add its settings as JSON, a JSON file, or -"}))}:{}})),...MAP_DESCRIPTORS.map(spec=>({invocation:spec.action===""?"map":`map ${spec.action}`,synopsis:spec.synopsis,audience:"audience"in spec?spec.audience:"agent",agentMayInvoke:!("audience"in spec),mutation:spec.mutation,flags:spec.flags,...spec.positional===null?{}:{positionals:[{name:"target",required:!0,meaning:spec.positional}]}})),...MODELS_DESCRIPTORS.map(spec=>({invocation:`models ${spec.action}`,synopsis:spec.synopsis,audience:"agent",agentMayInvoke:!0,mutation:spec.mutation,flags:spec.flags,...spec.takesQuery?{positionals:[{name:"target",required:!0,meaning:"positional"in spec?spec.positional:"the CLI to update, or on/off"}]}:{}})),{invocation:"status",synopsis:"running work, queued reasons, results to review, the latest release check and plan windows",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"health",synopsis:"recent server latency, event-loop delay, SQLite writes and live streams from the saved connection; instance operators only",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,{name:"profile",takesValue:!0,meaning:"saved server connection"}]},{invocation:"integrations",synopsis:"every integration as Connected, Not set up or Broken, with its last success and error, what uses it and what to do; --saved skips new checks; never a secret",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,{name:"saved",takesValue:!1,meaning:"show the last checks without checking again"}]},{invocation:"ready",synopsis:"what could be dispatched right now (rows carry reservedFor)",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"brief",synopsis:"the lead's catch-up from the local database; --history selects the older operational report",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"gaps",synopsis:"requirement gaps blocking dispatch",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,repoFlag]},{invocation:"grants",synopsis:"list authority grants",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"audit",synopsis:"what people did on this server with their API tokens, newest first: when, who, which token, from the CLI (api) or an agent (mcp), the command or tool, the project and the outcome (ok, refused, error); an approver sees everyone in their projects, anyone else only themselves",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,{name:"person",takesValue:!0,meaning:"only this person's actions"},{name:"token",takesValue:!0,meaning:"only actions with the token of this name (on the server's own machine)"},{name:"token-name",takesValue:!0,meaning:"the same, where --token would be a credential (remotely)"},{name:"source",takesValue:!0,meaning:"api (the CLI) or mcp (an agent)"},{name:"since",takesValue:!0,meaning:"only the last N days, as Nd (7d)"},{name:"limit",takesValue:!0,meaning:"actions per page (default 20, at most 100)"},{name:"cursor",takesValue:!0,meaning:"the nextCursor of the previous page"}]},{invocation:"sync",synopsis:"refresh external-tracker mirrors and deliver write-backs — safe to run; fails closed",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",flags:[jsonFlag,dbFlag,repoFlag],notableReasons:["no-op","external"]},{invocation:"task add",synopsis:"queue work",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"title",required:!0,meaning:"one line of what to do"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"goal",takesValue:!0,meaning:"what to accomplish; also the manual-review acceptance criterion"},{name:"body",takesValue:!0,meaning:"alias for --goal"},{name:"plan",takesValue:!1,meaning:"request a plan before coding"},{name:"just-code",takesValue:!1,meaning:"skip planning"},{name:"backend",takesValue:!0,meaning:"external tracker (title only)"},{name:"id",takesValue:!0,meaning:"choose the task id"},{name:"repo",takesValue:!0,meaning:"which repository the task belongs to"},{name:"report",takesValue:!1,meaning:"a scout task: the deliverable is a report, never a branch"},{name:"replaces",takesValue:!0,meaning:'the task this one replaces: it is cancelled and reads "Replaced by <id>"'},{name:"token",takesValue:!0,meaning:"a lead token: filed as the lead, so it pings nobody"},{name:"checks",takesValue:!0,meaning:`quick|full|off: this task's checks, overriding the project's level ("skip the tests" is off)`}],notableReasons:["duplicate","usage","unknown-task","unauthenticated"]},{invocation:"task new",synopsis:"start a small task at a terminal: shows the exact terms, then Build now? is your approval",audience:"operator",agentMayInvoke:!1,mutation:"unkeyed",positionals:[{name:"words",required:!1,meaning:"what should change"}],flags:[dbFlag,{name:"repo",takesValue:!0,meaning:"the project"},{name:"as",takesValue:!0,meaning:"the approver"},{name:"token",takesValue:!0,meaning:"their password"},{name:"from",takesValue:!0,meaning:"a github.com issue or pull request of this project: quoted, then filed for your approval"},{name:"preview",takesValue:!1,meaning:"the terminal UI's own: the exact terms, nothing started"},{name:"build",takesValue:!0,meaning:"the terminal UI's own: Build on those terms"},{name:"digest",takesValue:!0,meaning:"the terms the person read"}],notableReasons:["person-only","usage"]},{invocation:"task keep",synopsis:"a fast start that grew: propose a plan for its exact commit, for you to approve",audience:"operator",agentMayInvoke:!1,mutation:"unkeyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"as",takesValue:!0,meaning:"the approver"},{name:"token",takesValue:!0,meaning:"their password"}],notableReasons:["usage","refused"]},{invocation:"task ask",synopsis:"hand a task to a person: one message saying why, and the task is theirs",audience:"agent",agentMayInvoke:!0,mutation:"unkeyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"person",takesValue:!0,meaning:"who to ask (someone who can see the task's project)"},{name:"why",takesValue:!0,meaning:"what they need to do, one line"},{name:"token",takesValue:!0,meaning:"the lead token (or TOOLROLL_LEAD_TOKEN)"}],notableReasons:["unknown-task","unknown-person","unplaced","unauthenticated"]},{invocation:"task checks",synopsis:"run checks on the task's latest result, on its exact commit, now; a pass upgrades its status and a failure stays visible",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"task",required:!0,meaning:"any version of the task"}],flags:[jsonFlag,dbFlag,{name:"level",takesValue:!0,meaning:"quick (default) or full"}],notableReasons:["no-result","no-check","checks-failed"]},{invocation:"task ship",synopsis:"the task's pull request checks as last observed for its head: each check's state and how long it took",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"task",required:!0,meaning:"any version of the task"}],flags:[jsonFlag,dbFlag],notableReasons:["unknown-task","no-pull-request"]},{invocation:"task ready",synopsis:"Can I merge? The task's checklist from Toolroll's records, each blocker with the act that clears it (Run checks, Retry, Ask the agent to fix)",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"task",required:!0,meaning:"any version of the task"}],flags:[jsonFlag,dbFlag],notableReasons:["unknown-task"]},{invocation:"task add-tests",synopsis:"file a small task to write tests for the task's latest change; it waits for approval like any task",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"task",required:!0,meaning:"any version of the task"}],flags:[jsonFlag,dbFlag],notableReasons:["no-result"]},{invocation:"task list",synopsis:"a page of saved task status",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,{name:"state",takesValue:!0,meaning:"queued|running|done|failed|cancelled"},{name:"view",takesValue:!0,meaning:"all|needs-you|running|completed|archived"},{name:"limit",takesValue:!0,meaning:"page size, 1–100; default 40"},{name:"cursor",takesValue:!0,meaning:"nextCursor from the previous response"},{name:"repo",takesValue:!0,meaning:"filter to one project"}]},{invocation:"task show",synopsis:"one task in full",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag],notableReasons:["unknown-task"]},{invocation:"check-progress",synopsis:"current or final approved check progress",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"run",required:!0,meaning:"the build run"}],flags:[jsonFlag,dbFlag],notableReasons:["unknown-run","no-progress"]},{invocation:"task wait",synopsis:"wait for the current attempt to finish or need a person",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"timeout",takesValue:!0,meaning:"stop waiting after this many seconds"}],notableReasons:["unknown-task","timeout","failed","needs-person"]},{invocation:"project show",synopsis:"show the saved local project and optional credential-file reference",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"project use",synopsis:"select an exact saved checkout; grants no project or execution authority",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"path",required:!0,meaning:"exact saved project checkout path"}],flags:[jsonFlag,dbFlag,{name:"token-file",takesValue:!0,meaning:"optional existing scoped coordinator credential file; saves only its path"}]},...["complete","revise"].map(action=>({invocation:`task ${action}`,synopsis:action==="complete"?"mark the exact inspected result complete; checks and permissions remain unchanged":"request a same-task revision using explicit feedback; existing approval terms apply",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"task",required:!0,meaning:"task or assignment id"}],flags:[jsonFlag,dbFlag,{name:"token-env",takesValue:!0,meaning:"scoped coordinator credential environment variable"},{name:"token-file",takesValue:!0,meaning:"scoped coordinator credential file; defaults to selected project reference"},...action==="complete"?[{name:"digest",takesValue:!0,meaning:"exact receipt from assignment show; required for JSON or scoped agents"},{name:"pull-request",takesValue:!1,meaning:"also open the result's pull request from that commit, as the console's Complete does; an approver's sign-in (--as/--token), never a scoped credential; refuses with pull-requests-off and the setup command"},{name:"run",takesValue:!0,meaning:"the terminal's local owner: the exact build of the result read; required there with --digest"},{name:"checked",takesValue:!1,meaning:"the terminal's local owner: you checked the result yourself; required when it owes your own check"},{name:"reason",takesValue:!0,meaning:"the terminal's local owner: why you accept a result whose requirement isn't shown; required for an exception"}]:[{name:"feedback",takesValue:!0,meaning:"specific requested change"},{name:"run",takesValue:!0,meaning:"exact result run; defaults to current result"},{name:"source",takesValue:!0,meaning:"exact scope digest; defaults to current terms"},{name:"key",takesValue:!0,meaning:"32 hexadecimal characters for exact replay; defaults to a stable feedback identity"}]]})),{invocation:"task merge",synopsis:"merge the task's pull request once its checks pass — the console's Merge, behind the approver's password; the project's method (squash by default), branch deleted, recorded in the ledger",audience:"operator",agentMayInvoke:!1,mutation:"identity-idempotent",positionals:[{name:"task",required:!0,meaning:"any version of the task"}],flags:[jsonFlag,dbFlag,{name:"as",takesValue:!0,meaning:"the approver merging"},{name:"token",takesValue:!0,meaning:"their password"},{name:"anyway",takesValue:!1,meaning:"merge a Quick or Off result without waiting for its full check"}],notableReasons:["usage","not-an-approver","full-checks"]},...["show","updates","claim","check","brief","inbox","ack"].map(action=>({invocation:`assignment ${action}`,synopsis:action==="show"?"read the root, current work, owner and exact receipt":action==="updates"?"read the history of handoffs sent to people after a cursor; delivers nothing — receive updates with assignment inbox":action==="claim"?`record lead ownership; with the lead token the task reads "<the lead's name> is on it" and leaves Needs you until done, handed over, or 2 hours idle; grants no approval or execution authority`:action==="brief"?"catch up from current assignments and project knowledge in the local database":action==="inbox"?"receive or replay a saved batch of lead status updates":action==="ack"?"acknowledge delivery of an inbox batch; leaves task completion unchanged":"acknowledge the exact ready receipt as its lead; accepts no proof and deploys nothing",audience:"agent",agentMayInvoke:!0,mutation:action==="claim"||action==="check"||action==="inbox"||action==="ack"?"identity-idempotent":"none",...["show","claim","check"].includes(action)?{positionals:[{name:"task",required:!0,meaning:"any task in the assignment's existing correction chain"}]}:{},flags:[jsonFlag,dbFlag,{name:"token-env",takesValue:!0,meaning:"explicit environment variable containing a coordinator token; required for claim/check/inbox/ack unless token-file is used"},{name:"token-file",takesValue:!0,meaning:"explicit coordinator token file; cannot be combined with token-env"},...action==="updates"?[{name:"after",takesValue:!0,meaning:"last processed admitted update cursor; defaults to 0"},{name:"limit",takesValue:!0,meaning:"page size from 1 to 100; defaults to 50"}]:[],...action==="check"?[{name:"digest",takesValue:!0,meaning:"exact current receipt digest from assignment show"}]:[],...action==="brief"?[{name:"repo",takesValue:!0,meaning:"project to include within the credential's access"},{name:"limit",takesValue:!0,meaning:"assignment count from 1 to 25; defaults to 10"}]:[],...action==="inbox"||action==="ack"?[{name:"consumer",takesValue:!0,meaning:"stable lowercase name for this lead's delivery cursor"}]:[],...action==="inbox"?[{name:"limit",takesValue:!0,meaning:"batch size from 1 to 100; defaults to 10"}]:[],...action==="ack"?[{name:"batch",takesValue:!0,meaning:"exact batch ID returned by assignment inbox"}]:[]]})),operator("task state","set a task's state by hand — an operator correction, not a workflow step (--replaced-by <id> with cancelled)"),operator("lead token","mint the lead's credential behind your password (--revoke ends it): its own work pings nobody"),{invocation:"lead say",synopsis:"as the lead: one short message in its person's chat under the lead's name (Settings → Lead); several within two minutes are one message",audience:"agent",agentMayInvoke:!0,mutation:"unkeyed",positionals:[{name:"text",required:!0,meaning:"one short line in plain words"}],flags:[jsonFlag,dbFlag,{name:"task",takesValue:!0,meaning:"the task it is about"},{name:"token",takesValue:!0,meaning:"the lead token (or TOOLROLL_LEAD_TOKEN)"}],notableReasons:["usage","unknown-task","unauthenticated"]},{invocation:"task block",synopsis:"make one task wait for another",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the waiting task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"on",takesValue:!0,meaning:"the blocker's id"}],notableReasons:["unknown-task"]},{invocation:"task unblock",synopsis:"stop waiting",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the waiting task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"on",takesValue:!0,meaning:"the blocker's id"}],notableReasons:["unknown-task"]},{invocation:"task next",synopsis:"move a task to the front of ITS queue (scheduling only; approval still required)",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"undo",takesValue:!1,meaning:"back to filing order"}],notableReasons:["unknown-task","claimed"]},operator("task steer","one credentialed note for the task's agent — a running Claude build gets it in seconds, another running build reads it when it next checks for notes, otherwise the next attempt does; --now pauses the running Claude build first; steering speaks with the operator's voice"),{invocation:"task log",synopsis:"tail a task's live or finished agent output (--follow, --sub, --lines)",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"follow",takesValue:!1,meaning:"stream appended output while running"},{name:"sub",takesValue:!1,meaning:"read subagent helper output"},{name:"lines",takesValue:!0,meaning:"maximum trailing lines to display"}],notableReasons:["unknown-task","usage"]},{invocation:"task send",synopsis:"send a live message or steering note directly to a task's agent",audience:"operator",agentMayInvoke:!1,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"},{name:"note",required:!0,meaning:"message for the agent"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"note",takesValue:!0,meaning:"message text (optional if given positionally)"}],notableReasons:["unknown-task","task-finished","usage"]},{invocation:"task handoff",synopsis:"hand a task's live worktree and compact Handoff Packet to another coding agent",audience:"operator",agentMayInvoke:!1,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"to",takesValue:!0,meaning:"target agent provider (claude, codex, gemini, ...)"},{name:"model",takesValue:!0,meaning:"optional target model id"},{name:"note",takesValue:!0,meaning:"handoff instructions for the receiving agent"}],notableReasons:["unknown-task","invalid-agent","task-finished","usage"]},{invocation:"task attach",synopsis:"attach to a task's active run, worktree status, and live output stream",audience:"operator",agentMayInvoke:!1,mutation:"none",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"lines",takesValue:!0,meaning:"initial trailing lines to display"}],notableReasons:["unknown-task","usage"]},operator("task pause","stop a running Claude build's current turn and keep the build (--run <id> names the attempt): its next note continues it; never a stop"),operator("task continue","resume a paused Claude build where it stopped, without a note (--run <id> names the attempt)"),{invocation:"task assign",synopsis:"reserve a task for one worker, or return it to the shared queue",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"runner",takesValue:!0,meaning:"the worker to reserve for"},{name:"anyone",takesValue:!1,meaning:"back to the shared queue"}],notableReasons:["unknown-task","claimed"]},{invocation:"task scope",synopsis:"state what success is; approval binds to this exact statement",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"goal",takesValue:!0,meaning:"what success is"},{name:"acceptance",takesValue:!0,meaning:"required: <statement>|<evidence,kinds> (check,screenshot,changed-path,manual-review); separate criteria with semicolons"},{name:"not",takesValue:!0,meaning:"explicitly out of scope"},{name:"touches",takesValue:!0,meaning:"comma-separated paths this may change"},{name:"budget-usd",takesValue:!0,meaning:"spend ceiling for the build"}],notableReasons:["unknown-task"]},{invocation:"task plan",synopsis:"ask for a plan document (a planning session drafts; a person approves)",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"provider",takesValue:!0,meaning:"pin which provider plans THIS task (plan phase only)"},{name:"model",takesValue:!0,meaning:"the pinned plan model, riding --provider"},{name:"digest",takesValue:!0,meaning:"the terminal's local owner: the exact planning source read; required there, and --provider/--model are refused"},{name:"incident",takesValue:!0,meaning:"the terminal's local owner: plan again after this planning incident (the plan failed its checks)"}],notableReasons:["unknown-task"]},{invocation:"task hold",synopsis:"park a task with a reason",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"reason",takesValue:!0,meaning:"why it waits"},{name:"until",takesValue:!0,meaning:"ISO time to resurface"}],notableReasons:["unknown-task","held"]},{invocation:"task unhold",synopsis:"release a hold",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag],notableReasons:["unknown-task","not-yours"]},{invocation:"task require",synopsis:"name the capabilities a task needs before dispatch",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"require",takesValue:!0,meaning:"comma-separated capability keys"}],notableReasons:["unknown-task"]},operator("task approve","the yes — nothing builds without one; binds to the scope digest"),operator("task requeue","exit a stall: incidents resolved, strikes cleared, queued again"),operator("task regate","explicitly rerun the approved check on the last exact commit — no agent or automatic retry"),{invocation:"task review",synopsis:"read a task's compact result packet with --brief, or a run's automatic findings without it",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"id",required:!0,meaning:"task id with --brief; run id otherwise"}],flags:[jsonFlag,dbFlag,{name:"brief",takesValue:!1,meaning:"saved conclusion, changed files, checks, findings, screenshots, plan and next actions; missing fields say not recorded"},{name:"run",takesValue:!0,meaning:"with --brief, select an exact finished attempt instead of the latest"},{name:"all",takesValue:!1,meaning:"include LOW findings within the compact packet's limit; extra findings are counted"},{name:"token",takesValue:!0,meaning:"the lead token (or TOOLROLL_LEAD_TOKEN)"}],notableReasons:["usage","unauthenticated","not-found"]},{...operator("task accept",`accept a result: --finish (or --digest <receipt>) is exactly task complete's completion of the exact receipt; --despite "<reason>" records an acceptance with limitations and never completes; a bare call refuses`),positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"finish",takesValue:!1,meaning:"accept the result and finish the task: task complete's exact-receipt completion; --json and scoped agents pass --digest"},{name:"digest",takesValue:!0,meaning:"the exact receipt from assignment show; accepts and finishes exactly that result"},{name:"despite",takesValue:!0,meaning:"accept with this reason, without finishing; never combines with --finish or --digest (--note is its alias)"}],notableReasons:["usage","unknown-task","no-run","not-ready"]},{...operator("task land","put accepted work on the project's own branch when it has no pull requests: bare shows exactly what lands where; --yes --key <preview-key> lands it as one new commit on top; --undo reverts that commit with a new one"),positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,{name:"into",takesValue:!0,meaning:"land on this branch instead of the recorded one (the yes records it)"},{name:"undo",takesValue:!1,meaning:"revert the landing with a new commit on the branch"},{name:"yes",takesValue:!1,meaning:"land it; needs --key"},{name:"key",takesValue:!0,meaning:"the key the bare call showed: what lands is what you read"}],notableReasons:["usage","not-complete","checks","dirty","moved","occupied","stale"]},operator("task repair","inspect or approve a repair draft; --yes starts the repair a failed check is waiting for, under the normal plan approval"),operatorRead("task handover","where a task stands, from Toolroll's records: revision, decisions, rejected approaches, open findings, checks and the next action"),operator("task before-after","before-and-after evidence: read it, save a failing result, or rerun the same check on the latest commit with no agent"),operator("task failing-first","ask a bug fix's next attempt to write a failing test first (on|off); shown in the result as the agent's report"),operatorRead("finding list","findings still waiting on someone, or every finding of --task <id>"),operatorRead("finding show","one finding: its text, evidence and how it stands"),operator("finding send","send a finding to the task that owns the code; the owner must accept it or reject it with a reason"),operator("finding resend","send an answered finding back, one more round; past the limit it goes to a person"),operator("finding close","a person's decision on a finding"),operatorRead("captures list","what providers said when attempts failed, the ones mentioning limits first; nothing routes on these"),operatorRead("captures show","one saved provider failure"),operatorRead("captures export","one saved provider failure as a fixture"),operator("captures mark","a person's reading of a capture: exhausted or not-exhausted"),operator("task route","which configured agents plan, build and repair this task; phase and size changes require renewed approval"),operator("task reopen","resume external work its tracker closed and has been SEEN open again"),operator("task stop","stop ONE exact live attempt (--run <id>): durable before any process is signalled, answers 'stopping' until its own processes are established gone; work, branch, and evidence preserved; no strike, no retry"),{...operator("task archive","put tasks away (a person's act): out of every list, count and nudge, history and approvals kept; nothing claims, approves or dispatches them until restored"),positionals:[{name:"id",required:!0,meaning:"one or more tasks (any version: the whole family goes)"}],flags:[jsonFlag,dbFlag,{name:"reason",takesValue:!0,meaning:"why, shown on the task page"}],notableReasons:["unknown-task","not-an-approver"]},{...operator("task restore","bring put-away tasks back exactly as they were (a person's act)"),positionals:[{name:"id",required:!0,meaning:"one or more put-away tasks"}],flags:[jsonFlag,dbFlag],notableReasons:["unknown-task","not-an-approver"]},{...operator("task tidy","Put away old tasks: --preview lists what would go and why (read-only), --apply --digest <d> puts away exactly that list (a person's act)"),flags:[jsonFlag,dbFlag,{name:"preview",takesValue:!1,meaning:"show the list and the digest; changes nothing"},{name:"apply",takesValue:!1,meaning:"put away exactly the previewed list (needs --digest)"},{name:"digest",takesValue:!0,meaning:"the digest --preview printed"},{name:"days",takesValue:!0,meaning:"also finished tasks untouched this many days (1–365, default 14)"},{name:"except",takesValue:!0,meaning:"comma-separated tasks from the list to leave out"}],notableReasons:["usage","not-an-approver","empty"]},operator("run settle","have Toolroll check again whether a finished run stopped: it looks at this computer's processes itself, stops only leftovers proven the run's, and settles the run when none is left (nobody vouches; --why is ignored)"),operator("task resume","resume the exact stopped attempt (--run <id>): refuses until it is quiescent, lifts only that stop's hold, approves nothing — the next pass re-proves the scope and inherits the draft with fresh proof"),{invocation:"claim",synopsis:"take one ready, approved task; answers with a lease",audience:"agent",agentMayInvoke:!0,mutation:"keyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,keyFlag,{name:"runner",takesValue:!0,meaning:"your registered worker name"},{name:"token",takesValue:!0,meaning:"the worker's token"},{name:"ttl",takesValue:!0,meaning:"lease seconds"}],notableReasons:["held","fenced","unapproved","reserved","external","claimed","not-ready","closed"]},{invocation:"heartbeat",synopsis:"still working; extends the lease",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"lease",required:!0,meaning:"the lease id"}],flags:[jsonFlag,dbFlag],notableReasons:["not-leased","fenced","closed"]},{invocation:"worker release",synopsis:"done with it; fenced if superseded",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",positionals:[{name:"lease",required:!0,meaning:"the lease id"}],flags:[jsonFlag,dbFlag],notableReasons:["not-leased","fenced"]},{invocation:"reap",synopsis:"release every lease that ran out",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",flags:[jsonFlag,dbFlag]},{invocation:"tick",synopsis:"one unattended pass: claim, build in a leased worktree, commit to a branch — never pushes",audience:"agent",agentMayInvoke:!0,mutation:"unkeyed",flags:[jsonFlag,dbFlag,repoFlag,{name:"runner",takesValue:!0,meaning:"your registered worker name"},{name:"token",takesValue:!0,meaning:"the worker's token"},{name:"max",takesValue:!0,meaning:"tasks this pass (default 1)"},{name:"base",takesValue:!0,meaning:"base ref for first attempts"}],notableReasons:["empty","fenced"]},{invocation:"build",synopsis:"build one claimed task directly (the piece tick automates)",audience:"agent",agentMayInvoke:!0,mutation:"unkeyed",positionals:[{name:"id",required:!0,meaning:"the task"}],flags:[jsonFlag,dbFlag,repoFlag],notableReasons:["not-leased","unapproved"]},{invocation:"reconcile",synopsis:"recover what the last stretch left behind — safe to repeat",audience:"agent",agentMayInvoke:!0,mutation:"identity-idempotent",flags:[jsonFlag,dbFlag,repoFlag]},{invocation:"runner list",synopsis:"registered workers",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"coordinator list",synopsis:"MCP filing credentials and their limits",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"approver list",synopsis:"who can say yes (names only)",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"cap list",synopsis:"recorded capabilities",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,repoFlag]},{invocation:"outbox list",synopsis:"queued notifications",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"incident list",synopsis:"open incidents",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"config show",synopsis:"phase and spend configuration",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,repoFlag]},{invocation:"setup show",synopsis:"installation setup",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"verify show",synopsis:"the repository's check level, its approved full and quick commands, and a suggested quick command",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag,repoFlag]},{invocation:"intake show",synopsis:"intake configuration",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"providers",synopsis:"which agent providers this binary can drive, and their transports; --report records this machine's readiness under its runner",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,{name:"report",takesValue:!1,meaning:"record readiness observations under --runner"},{name:"runner",takesValue:!0,meaning:"the registered worker name reporting"},{name:"token",takesValue:!0,meaning:"that worker's token"}]},{invocation:"template list",synopsis:"work templates: tasks and scheduled flows",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"template show",synopsis:"one template",audience:"agent",agentMayInvoke:!0,mutation:"none",positionals:[{name:"name",required:!0,meaning:"the template"}],flags:[jsonFlag,dbFlag]},{invocation:"webhook status",synopsis:"connected messaging services",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},{invocation:"publish status",synopsis:"publication and merge-grant state",audience:"agent",agentMayInvoke:!0,mutation:"none",flags:[jsonFlag,dbFlag]},operator("approver add","mint the credential that lets a person say yes"),operator("runner register","register a worker bound to its repositories; its token is shown once"),operator("runner retire","retire a worker"),operator("runner bind","replace which repositories a worker may build in"),operator("runner capacity","set how many tasks a worker runs at once; running work carries on, the new number applies at the next claim"),operator("project checks","show or set a project's batch checks (--batch on|off, off by default): results that finish within 10 minutes share one full check on a temporary batch commit; nothing is merged into a real branch"),operator("project check-access","show or set how far a project's checks reach: sandboxed (the default), with model and GitHub sign-ins, or not sandboxed; an instance operator widens it with a password typed now"),operator("project concurrency","set how many of a project's tasks build at once (default 2, never past the worker's capacity); running work carries on"),operator("coordinator mint","mint the MCP filing credential — repo-bound, rate-limited, token shown once"),operator("coordinator revoke","revoke an MCP filing credential"),operator("mcp","serve the MCP gateway over stdio — the coordinator credential is the only key it accepts"),operator("cap add","record a capability"),operator("outbox deliver","deliver queued notifications"),operator("peek","watch live agents in the terminal — one pane per open run; --tmux opens a window per run"),operator("incident resolve","resolve an incident"),operator("decide","read and ANSWER parked decisions — answering is a person's act"),operatorRead("keys status","which provider API keys are stored — never the values"),operator("keys set","store a provider's API key as a private file — piped or --key-file, never on the command line"),operator("keys clear","remove a stored provider key (kept only as a fallback; a subscription-mode provider is unaffected)"),operatorRead("keys verify","check a stored key against its provider live — spends no tokens"),operator("keys auth","choose subscription vs API key for a provider (subscription is the default; the key is kept as fallback)"),operatorRead("people list","everyone who can sign in, their standing, and the open invites"),operator("people invite","mint a single-use sign-in link for one person — their powers are pinned when you mint, never after"),operator("people projects","set a person's project access — selected project, all projects, or no projects"),operator("people revoke","end a person's access — their sessions, invites, and signed modes end with them; history stays"),operator("tokens create","make one of your API tokens: --name, --access read|act, --days 30|90|365, optional --projects a,b; your password at the prompt or --password-stdin; the token is shown once"),operatorRead("tokens list","your API tokens: name, access, projects, made, last used, expiry — never a secret; your password at the prompt or --password-stdin"),operator("tokens revoke","end one of your API tokens now, by name or id; your password at the prompt or --password-stdin"),operator("tokens rotate","replace one of your API tokens on the same terms; the old one works 10 more minutes (--overlap), then stops; the new one is shown once"),operatorRead("mode show","the repository's operating mode, in full — or 'locked' when none is signed"),operator("mode set","sign a per-repository operating mode (password ceremony; standard or hands-off, always expiring)"),operator("publish merge","say yes to ONE waiting merge — it fires only when CI is seen green on the exact commit you authorized"),operator("publish refire","recover a merge whose issued call went silent — re-enters the full merge road, never auto-retried"),operatorRead("review show","whether a project's finished builds get one automatic review"),operator("review on","one automatic review of each finished build whose check passes; only HIGH findings send it back, once"),operator("review off","finished builds go straight to the person, unreviewed"),operatorRead("chat-approval show","whether your own taps in your paired chat approve plans and merges: all projects and each project's own setting"),operator("chat-approval on","let your paired chat approve plans and merges in all your projects or one (--repo); lasting, with limits; previews until --yes"),operator("chat-approval off","stop approving from chat for all your projects or one (--repo); one step"),operator("mode revoke","revoke a repository's mode — one click, every act it covered falls back to its own ceremony"),operator("config set","set phase or spend configuration"),operator("config clear","clear phase or spend configuration"),operatorRead("thread list","your own interactive agent threads: each one's title, project and where it stands"),operatorRead("thread show","one of your threads: its latest turn, its end and its Ship, in Toolroll's words"),operator("thread end","end one of your threads for good (its agent stops; its work can still be shipped for a week)"),operator("thread remove","remove one of your threads' working copy (refused while its agent may run or a Ship is open)"),operator("thread ship","ship one of your threads' committed work: shows its terms, asks, then takes your password typed now"),operator("thread save","save one of your threads' committed work as the branch toolroll/code-<id> in its project (no pull request, no merge); says the git merge that puts it on your branch"),operator("setup clear","clear installation setup"),operator("verify set",'approve the one shell command the plane re-runs after every future commit (--quick "<cmd>" approves the fast check Quick runs); --self-heal binds one approved-setup replay when a required project executable is missing'),operator("verify clear","revoke a repository's approved verification command; --level quick revokes only the quick command"),operator("verify level","set a project's checks after each build: quick (the approved quick command), full, or off — an approver's act, in the ledger"),operator("intake grant","grant an intake source"),operator("intake run","run intake now"),operator("intake preview","preview what intake would file"),operator("intake pr-comments","intake review comments from a pull request"),operator("intake clear","clear intake configuration"),operator("webhook primary","choose which service receives alerts"),operator("bridge","the Telegram bridge (pairing, tokens, the follower)"),operator("enroll","grant a repository authority (backends, dispatch) — its own explicit yes"),operator("revoke","take an authority grant back"),operator("publish","the publication pass: push built branches, open pull requests, sweep merges"),operator("publish grant","grant publication or auto-merge authority"),operator("publish revoke","take a publication grant back"),operator("publish unblock","lift a repair's merge hold"),operator("publish rearm","re-arm a refused merge after fixing the named cause"),operator("serve","the operations console (HTTP)"),operatorRead("serve check-public","is this server ready on its --public-url? checks the URL, --allow-host, the console on --port, the certificate, HSTS and the proxy, and names each problem; sends no credentials"),operator("watch","the unattended loop, kept running"),operator("up","console + worker + browser, one command"),operator("onboard","add this repository, report signed-in agents, install or --remove the operator skill (--yes), offer the starter flows (--starter <ids>), and print the handoff"),operator("daemon","install the loop under the OS service manager"),operator("background on","keep this computer's Toolroll running: a login item that starts `up --laptop` when you log in; hands over from the `up` this terminal runs and puts everything back if the service doesn't answer (--port)"),operator("background off","stop running in the background: unloads and removes only Toolroll's own login item"),operatorRead("background show","whether Toolroll runs in the background here, whether it is running now, and any other service on this database"),operator("stop","stop this computer's Toolroll after its running work is saved: the background service (until the next login), or the `up` running in a terminal"),operator("open","open this computer's Toolroll at a terminal, signed in: the terminal UI, or the browser with --web (starts it first when it isn't running); never prints a sign-in link"),{...operatorRead("welcome","the three steps to a first result (agent, project, first task) as the console's welcome shows them; at a terminal it walks them one at a time"),flags:[jsonFlag,dbFlag]},{...operator("welcome sample","add the sample project (a tiny repository with one function and its test) in your projects folder, as this computer's password-free owner at a terminal: the console welcome's Try a sample project; takes no folder or name"),flags:[jsonFlag,dbFlag]},operator("password set","set this computer's first password, typed twice at your own terminal (never a flag, file or environment variable); every session signs in again and local mode stays on"),operator("password reset","reset a forgotten password at the computer running Toolroll, typed twice at your own terminal (the one approver, or --as <name>); every session of that account ends and a saved first password that no longer works is removed. Anyone who can run commands as you on this computer can do this, as they could read the saved file"),{...operatorRead("doctor","check that Toolroll's service holds no key, token or password a build could read; names what it finds and the steps to fix it, never a value, and changes nothing"),flags:[jsonFlag]}],REMOTE_NO=["plugin list","plugin install","plugin update","plugin rollback","plugin remove","plugin validate","task new","task keep","","pulls","graph","repos","repos add","repos remove","repos add-from-github","contract","skills list","skills get","skills install","link","unlink","update","release","demo","chat","project show","project use","brief","lead token","lead say","health","assignment show","assignment updates","assignment claim","assignment check","assignment brief","assignment inbox","assignment ack","claim","heartbeat","worker release","reap","tick","build","reconcile","runner register","runner retire","runner bind","runner capacity","coordinator mint","coordinator revoke","mcp","outbox deliver","peek","serve","serve check-public","watch","up","onboard","daemon","background on","background off","background show","stop","open","welcome","welcome sample","password set","password reset","doctor","bridge","setup show","setup clear","providers","keys status","keys set","keys clear","keys verify","keys auth","models check","models update","models watch","models results","models suggestions","models accept","models dismiss","models turn-off","models keep","models try","models stop","map on","map off","map report","thread list","thread show","thread end","thread remove","thread ship","thread save","publish","publish status","publish merge","publish refire","publish unblock","publish rearm","publish grant","publish revoke","enroll","revoke","flows import","flows trigger check","flows script save","flows browser","memory propose","card list","card remove"],REMOTE_FOLLOW_THROUGH=["task handover","task before-after","task failing-first","finding list","finding show","finding send","finding resend","finding close","captures list","captures show","captures export","captures mark"],REMOTE_STEP_UP=["proposals","decide","task regate","task approve","task accept","task merge","run settle","task archive","task restore","task tidy","task land","knowledge apply","memory decide","memory retire","memory apply","memory tidy","memory restore","memory unmerge","flows card approve","flows card send-back","flows script approve","flows unattended","approver list","approver add","people list","people invite","people projects","people revoke","tokens create","tokens list","tokens revoke","tokens rotate","mode show","mode set","mode revoke","chat-approval on","review on","review off","config set","config clear","verify set","verify clear","verify level","project checks","project check-access","project concurrency","intake grant","intake clear","webhook primary"],REMOTE_YES=["status","integrations","ready","gaps","grants","sync","audit","task add","task ask","task checks","task ship","task ready","task add-tests","task list","task show","check-progress","task wait","task complete","task revise","task state","task block","task unblock","task next","task steer","task pause","task continue","task assign","task scope","task plan","task hold","task unhold","task require","task requeue","task review","task repair","task route","task reopen","task stop","task resume","task log","task send","task handoff","task attach","runner list","coordinator list","cap list","cap add","outbox list","incident list","incident resolve","config show","verify show","intake show","intake run","intake preview","intake pr-comments","template list","template show","webhook status","review show","chat-approval show","chat-approval off","knowledge search","knowledge impact","knowledge refresh","map","map area","map file","map search","map refresh","memory search","memory decisions","memory show","memory review","memory status","flaky list","flaky show","card","flows list","flows show","flows export","flows create","flows edit","flows trigger add","flows trigger pause","flows trigger resume","flows trigger remove","flows card add","flows archive","models status","models list"];export const REMOTE_POLICY=new Map([...REMOTE_NO.map(invocation=>[invocation,"no"]),...REMOTE_FOLLOW_THROUGH.map(invocation=>[invocation,"no"]),...REMOTE_STEP_UP.map(invocation=>[invocation,"step-up"]),...REMOTE_YES.map(invocation=>[invocation,"yes"])]),REMOTE_POLICY_COUNT=REMOTE_NO.length+REMOTE_FOLLOW_THROUGH.length+REMOTE_STEP_UP.length+REMOTE_YES.length;const LOCAL_ALLOW={"plugin list":"read","plugin validate":"read","plugin install":"skill-library","plugin update":"skill-library","plugin rollback":"skill-library","plugin remove":"skill-library",pulls:"read",graph:"read",repos:"read",map:"read","map area":"read","map file":"read","map search":"read",status:"read",ready:"read",gaps:"read",contract:"read","skills list":"read","skills get":"read","flaky list":"read","flaky show":"read",card:"read","memory review":"read","memory status":"read","memory decisions":"read","memory show":"read","memory apply":"memory-review","memory tidy":"memory-review","memory restore":"memory-review","memory unmerge":"memory-review","task list":"read","task show":"read","task state":"read","task wait":"read","check-progress":"read","review show":"read",welcome:"read","task add":"file-task","task new":"build-now",chat:"lead-send","task steer":"lead-send","task approve":"approve-plan",decide:"answer-question","task stop":"stop-run","task pause":"pause-run","task hold":"pause-run","task resume":"resume-run","task continue":"resume-run","task unhold":"resume-run","task complete":"complete-task","task accept":"complete-task","task land":"land-task","task plan":"request-plan","task requeue":"retry-build","task revise":"request-revision","task archive":"archive-task","task restore":"archive-task","repos add":"add-project","welcome sample":"add-project","models suggestions":"read","models turn-off":"routing-turn-off","models dismiss":"dismiss-suggestion","models stop":"trial-stop","map on":"code-map-switch","map off":"code-map-switch","task send":"lead-send","task handoff":"change-task-agents","config set":"change-models","config clear":"change-models"};export const LOCAL_POLICY=new Map(GUIDE_ROWS.map(row=>[row.invocation,Object.prototype.hasOwnProperty.call(LOCAL_ALLOW,row.invocation)?{local:"allow",act:LOCAL_ALLOW[row.invocation]}:{local:"deny"}])),LOCAL_ALLOWED_INVOCATIONS=Object.keys(LOCAL_ALLOW),COMMAND_ENTRIES=commandEntries(GUIDE_ROWS.map(row=>({...row,remote:REMOTE_POLICY.get(row.invocation)??"no"}))),GUIDE_INVOCATIONS=GUIDE_ROWS.map(row=>row.invocation),COMMAND_GUIDE=COMMAND_ENTRIES.map(entry=>entry.guide);
|