toolroll 0.9.133 → 0.9.134
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 +29 -0
- package/dist/acp-agents.js +1 -1
- package/dist/acp-client.js +2 -2
- package/dist/acp-providers-schema.js +1 -1
- package/dist/agent-detect.js +1 -1
- package/dist/agent-fence.js +4 -4
- package/dist/agent-handoff.js +11 -0
- package/dist/agent-thread/acp-chat.js +1 -0
- package/dist/agent-thread/acp-turn.js +4 -0
- package/dist/agent-thread/chat-credential.js +1 -0
- package/dist/agent-thread/chat-home.js +1 -0
- package/dist/agent-thread/chat-spend.js +7 -0
- package/dist/agent-thread/chat-tools.js +1 -0
- package/dist/agent-thread/chat-turn.js +4 -0
- package/dist/agent-thread/custody.js +1 -1
- package/dist/agent-thread/direct-host.js +13 -8
- package/dist/agent-thread/fence.js +1 -1
- package/dist/agent-thread/gemini-chat.js +1 -0
- package/dist/agent-thread/git-workspace.js +2 -2
- package/dist/agent-thread/guards.js +1 -1
- package/dist/agent-thread/openrouter-chat.js +1 -0
- package/dist/agent-thread/providers.js +3 -3
- package/dist/agent-thread/ship.js +1 -1
- package/dist/agentconfig.js +1 -1
- package/dist/agents-live.js +2 -2
- package/dist/assignment.js +1 -1
- package/dist/brief-fence.js +3 -1
- package/dist/browser/{chunk-agents-live-view.6fd2938ef96a85a4127cddb99dbc700b3201c58351d9f07dbcd8a2f7d7dfef22.js → chunk-agents-live-view.e97fbf607cb8075aad7a48664556d11ea41469785f82384b5171b76c524f71e2.js} +5 -5
- package/dist/browser/chunk-agents-live-view.e97fbf607cb8075aad7a48664556d11ea41469785f82384b5171b76c524f71e2.js.br +0 -0
- package/dist/browser/chunk-agents-live-view.e97fbf607cb8075aad7a48664556d11ea41469785f82384b5171b76c524f71e2.js.gz +0 -0
- package/dist/browser/chunk-bundle.48f442a2868e9b77e9f54c5b77f1bba629ccd1615de8a2f62619b811783314f6.js +2 -0
- package/dist/browser/chunk-bundle.48f442a2868e9b77e9f54c5b77f1bba629ccd1615de8a2f62619b811783314f6.js.br +0 -0
- package/dist/browser/chunk-bundle.48f442a2868e9b77e9f54c5b77f1bba629ccd1615de8a2f62619b811783314f6.js.gz +0 -0
- package/dist/browser/chunk-chat-parts.1669e6985c5c0c11eea6792ea177ea4c9f7e7ebf27bd3b31742feb6a26d5b2a5.js +4 -0
- package/dist/browser/chunk-chat-parts.1669e6985c5c0c11eea6792ea177ea4c9f7e7ebf27bd3b31742feb6a26d5b2a5.js.br +0 -0
- package/dist/browser/chunk-chat-parts.1669e6985c5c0c11eea6792ea177ea4c9f7e7ebf27bd3b31742feb6a26d5b2a5.js.gz +0 -0
- package/dist/browser/chunk-core.64343d638685133eb96578bfb35bf560f329d0743ac5deda720ae27f5699c9d9.js +116 -0
- package/dist/browser/chunk-core.64343d638685133eb96578bfb35bf560f329d0743ac5deda720ae27f5699c9d9.js.br +0 -0
- package/dist/browser/chunk-core.64343d638685133eb96578bfb35bf560f329d0743ac5deda720ae27f5699c9d9.js.gz +0 -0
- package/dist/browser/{chunk-flow-view.71a0a3360292445ab70d67253bb9003163bbb7b1b03f14d1892cca83debd9b2c.js → chunk-flow-view.264e801af330461985aadcab42bc4ac4e036ba124394a7b5a100f2cd1edf89f0.js} +6 -6
- package/dist/browser/chunk-flow-view.264e801af330461985aadcab42bc4ac4e036ba124394a7b5a100f2cd1edf89f0.js.br +0 -0
- package/dist/browser/chunk-flow-view.264e801af330461985aadcab42bc4ac4e036ba124394a7b5a100f2cd1edf89f0.js.gz +0 -0
- package/dist/browser/chunk-flows-extra-view.6761503a97e1f17b474703ff5687a8682c54f9db1715e0a9762a979030a1b036.js +4 -0
- package/dist/browser/chunk-flows-extra-view.6761503a97e1f17b474703ff5687a8682c54f9db1715e0a9762a979030a1b036.js.br +0 -0
- package/dist/browser/chunk-flows-extra-view.6761503a97e1f17b474703ff5687a8682c54f9db1715e0a9762a979030a1b036.js.gz +0 -0
- package/dist/browser/chunk-pages-bundle.365da73d009e3ced30b55bca7107f548dc832f7a9f52926d3dcd68aa5596da11.js +6 -0
- package/dist/browser/chunk-pages-bundle.365da73d009e3ced30b55bca7107f548dc832f7a9f52926d3dcd68aa5596da11.js.br +0 -0
- package/dist/browser/chunk-pages-bundle.365da73d009e3ced30b55bca7107f548dc832f7a9f52926d3dcd68aa5596da11.js.gz +0 -0
- package/dist/browser/chunk-result-view.d4dc562a1a6a52a1497e25300d5f80c220952ceb5bb719ca32ef8dc1e74a4124.js +2 -0
- package/dist/browser/chunk-result-view.d4dc562a1a6a52a1497e25300d5f80c220952ceb5bb719ca32ef8dc1e74a4124.js.br +0 -0
- package/dist/browser/chunk-result-view.d4dc562a1a6a52a1497e25300d5f80c220952ceb5bb719ca32ef8dc1e74a4124.js.gz +0 -0
- package/dist/browser/chunk-settings-view.ff302e1c5faf5486c96e5fc96fa32492da4153e6e19997ce7b718adab21bf3b7.js +20 -0
- package/dist/browser/chunk-settings-view.ff302e1c5faf5486c96e5fc96fa32492da4153e6e19997ce7b718adab21bf3b7.js.br +0 -0
- package/dist/browser/chunk-settings-view.ff302e1c5faf5486c96e5fc96fa32492da4153e6e19997ce7b718adab21bf3b7.js.gz +0 -0
- package/dist/browser/chunk-shared.152678a803cfb6dee935162fbbbdb38d031d80f1d32ce48610f37bc1c8621e49.js +2 -0
- package/dist/browser/chunk-shared.152678a803cfb6dee935162fbbbdb38d031d80f1d32ce48610f37bc1c8621e49.js.br +0 -0
- package/dist/browser/chunk-shared.152678a803cfb6dee935162fbbbdb38d031d80f1d32ce48610f37bc1c8621e49.js.gz +0 -0
- package/dist/browser/chunk-shared.26f6cbfdeb9bcd63231f23dbf96cacb39b78324aeed2503e86109efa89fa27db.js +5 -0
- package/dist/browser/chunk-shared.26f6cbfdeb9bcd63231f23dbf96cacb39b78324aeed2503e86109efa89fa27db.js.br +0 -0
- package/dist/browser/chunk-shared.26f6cbfdeb9bcd63231f23dbf96cacb39b78324aeed2503e86109efa89fa27db.js.gz +0 -0
- package/dist/browser/chunk-shared.4e21c6b33b9a525e63c360d20a1830f1a26c5021f5d218f2300f21ff840af27e.js +2 -0
- package/dist/browser/chunk-shared.4e21c6b33b9a525e63c360d20a1830f1a26c5021f5d218f2300f21ff840af27e.js.br +0 -0
- package/dist/browser/chunk-shared.4e21c6b33b9a525e63c360d20a1830f1a26c5021f5d218f2300f21ff840af27e.js.gz +0 -0
- package/dist/browser/chunk-shared.5b47ca221b8b77b26ce8006f0569c981df2b905005cebe9fc54444d4906d436e.js +4 -0
- package/dist/browser/chunk-shared.5b47ca221b8b77b26ce8006f0569c981df2b905005cebe9fc54444d4906d436e.js.br +0 -0
- package/dist/browser/chunk-shared.5b47ca221b8b77b26ce8006f0569c981df2b905005cebe9fc54444d4906d436e.js.gz +0 -0
- package/dist/browser/chunk-shared.85e1b9e0838ccc819e7b8368f80dd5240dda90f53ea2974a256a8fa4122ba2fb.js +3 -0
- package/dist/browser/chunk-shared.85e1b9e0838ccc819e7b8368f80dd5240dda90f53ea2974a256a8fa4122ba2fb.js.br +0 -0
- package/dist/browser/chunk-shared.85e1b9e0838ccc819e7b8368f80dd5240dda90f53ea2974a256a8fa4122ba2fb.js.gz +0 -0
- package/dist/browser/chunk-shared.a326d625dea5cda744678a73b38c0cb2688721c9228e26d262279ecd5c2d7d11.js +2 -0
- package/dist/browser/chunk-shared.a326d625dea5cda744678a73b38c0cb2688721c9228e26d262279ecd5c2d7d11.js.br +0 -0
- package/dist/browser/chunk-shared.a326d625dea5cda744678a73b38c0cb2688721c9228e26d262279ecd5c2d7d11.js.gz +0 -0
- package/dist/browser/chunk-shared.e906e9c8c0859e000616dbc382f88597447f30205c92b7cb9a8e2351f3ef2722.js +2 -0
- package/dist/browser/chunk-shared.e906e9c8c0859e000616dbc382f88597447f30205c92b7cb9a8e2351f3ef2722.js.br +0 -0
- package/dist/browser/chunk-shared.e906e9c8c0859e000616dbc382f88597447f30205c92b7cb9a8e2351f3ef2722.js.gz +0 -0
- package/dist/browser/chunk-shared.f6354151d62439f2d78f5d17cf9bc44f35b4da37685beb77467d98dd9cc6f1e4.js +2 -0
- package/dist/browser/chunk-shared.f6354151d62439f2d78f5d17cf9bc44f35b4da37685beb77467d98dd9cc6f1e4.js.br +0 -0
- package/dist/browser/chunk-shared.f6354151d62439f2d78f5d17cf9bc44f35b4da37685beb77467d98dd9cc6f1e4.js.gz +0 -0
- package/dist/browser/{chunk-sonner.da05d41088ec46a49ef6b86f4afa71fccd5462f1befa713ca930aa231e35349b.js → chunk-sonner.160372eb4f9455847ca83e8ff5d983c6b3010ef0dc2eaf541e2eaceaac3b994c.js} +1 -1
- package/dist/browser/chunk-sonner.160372eb4f9455847ca83e8ff5d983c6b3010ef0dc2eaf541e2eaceaac3b994c.js.br +0 -0
- package/dist/browser/chunk-sonner.160372eb4f9455847ca83e8ff5d983c6b3010ef0dc2eaf541e2eaceaac3b994c.js.gz +0 -0
- package/dist/browser/chunk-task-view.325b506afc26b25147b2e90cec5ad1392d50e6150a7fb33c81a996daa99bb05a.js +2 -0
- package/dist/browser/chunk-task-view.325b506afc26b25147b2e90cec5ad1392d50e6150a7fb33c81a996daa99bb05a.js.br +0 -0
- package/dist/browser/chunk-task-view.325b506afc26b25147b2e90cec5ad1392d50e6150a7fb33c81a996daa99bb05a.js.gz +0 -0
- package/dist/browser/chunk-team-chat.d560bcc5d819e63133d377b8a6f10f901356e680771f19d4fe1af044adfffb22.js +2 -0
- package/dist/browser/chunk-team-chat.d560bcc5d819e63133d377b8a6f10f901356e680771f19d4fe1af044adfffb22.js.br +0 -0
- package/dist/browser/chunk-team-chat.d560bcc5d819e63133d377b8a6f10f901356e680771f19d4fe1af044adfffb22.js.gz +0 -0
- package/dist/browser/manifest.json +202 -202
- package/dist/browser/{terminal.1ab49cbf9b9363f0f520b85e4125d40a302dffc10489e77b04ff1c620831eefe.js → terminal.18295f7cbf70d84b5564f3784b9630bec594fc558a7bf0303e34cde9b027eff9.js} +1 -1
- package/dist/browser/terminal.18295f7cbf70d84b5564f3784b9630bec594fc558a7bf0303e34cde9b027eff9.js.br +0 -0
- package/dist/browser/{terminal.1ab49cbf9b9363f0f520b85e4125d40a302dffc10489e77b04ff1c620831eefe.js.gz → terminal.18295f7cbf70d84b5564f3784b9630bec594fc558a7bf0303e34cde9b027eff9.js.gz} +0 -0
- package/dist/browser/workspace.ac1270b58f672fa920535348cc582f5fc68247b341d6fc8ec733b25336f2b9cc.css +4 -0
- package/dist/browser/workspace.ac1270b58f672fa920535348cc582f5fc68247b341d6fc8ec733b25336f2b9cc.css.br +0 -0
- package/dist/browser/workspace.ac1270b58f672fa920535348cc582f5fc68247b341d6fc8ec733b25336f2b9cc.css.gz +0 -0
- package/dist/browser/{workspace.d6a38fe66b5ee0b74d8ea4b026148c285f664732511bc528c934309bbad1e5e4.js → workspace.efd01c3aaf8e07c4a64194e2bfbd7aee4f7fa515f2acebdfdd90af1badba8ce7.js} +2 -2
- package/dist/browser/workspace.efd01c3aaf8e07c4a64194e2bfbd7aee4f7fa515f2acebdfdd90af1badba8ce7.js.br +0 -0
- package/dist/browser/workspace.efd01c3aaf8e07c4a64194e2bfbd7aee4f7fa515f2acebdfdd90af1badba8ce7.js.gz +0 -0
- package/dist/build-review.js +1 -1
- package/dist/builder-revision.js +4 -0
- package/dist/builder.js +19 -12
- package/dist/central-recovery-stage.js +1 -1
- package/dist/chat-actions.js +11 -7
- package/dist/chat-channel.js +1 -1
- package/dist/chat-review.js +1 -1
- package/dist/chat-terms.js +2 -2
- package/dist/check-levels.js +1 -1
- package/dist/cli-help.js +140 -12
- package/dist/cli.js +4 -3
- package/dist/contracts/chat-actions.js +1 -1
- package/dist/contracts/console-api.js +1 -1
- package/dist/contracts/engine-api.js +1 -1
- package/dist/contracts/lead-tools.js +1 -1
- package/dist/contracts/project-memory.js +1 -1
- package/dist/contracts/provider.js +1 -1
- package/dist/converse.js +1 -1
- package/dist/decision.js +1 -1
- package/dist/dispatch.js +2 -2
- package/dist/dispose.js +1 -1
- package/dist/easy-start.js +2 -2
- package/dist/egress.js +1 -1
- package/dist/engine-chat.js +1 -1
- package/dist/engine-reads.js +3 -3
- package/dist/every-agent-schema.js +105 -0
- package/dist/evidence-pack.js +1 -1
- package/dist/evidence.js +1 -1
- package/dist/exec.js +3 -2
- package/dist/fallback.js +1 -1
- package/dist/git-identity.js +2 -2
- package/dist/handoff-relay.js +2 -0
- package/dist/invoke.js +2 -2
- package/dist/keys.js +1 -1
- package/dist/lead-capabilities.js +1 -1
- package/dist/lead-cli.js +2 -2
- package/dist/lead-contract.js +1 -1
- package/dist/lead-debrief.js +7 -0
- package/dist/lead-doors.js +1 -1
- package/dist/lead-tools.js +5 -5
- package/dist/lead.js +2 -2
- package/dist/live-records.js +3 -3
- package/dist/live-terminal.js +1 -1
- package/dist/local-owner-acts.js +2 -2
- package/dist/local-owner.js +1 -1
- package/dist/machine-identity.js +1 -1
- package/dist/memory-pass.js +3 -3
- package/dist/model-catalog.js +2 -2
- package/dist/model-choices.js +1 -1
- package/dist/needs-you.js +1 -1
- package/dist/openrouter-key.js +2 -0
- package/dist/operate-commands.js +1 -1
- package/dist/operate-remote-arguments.js +1 -1
- package/dist/operate-remote.js +1 -1
- package/dist/operate.js +22 -12
- package/dist/panels.js +6 -0
- package/dist/phase-routing.js +1 -1
- package/dist/pi-build.js +4 -0
- package/dist/pi-rpc.js +10 -0
- package/dist/pi-tools-extension.js +4 -0
- package/dist/plan-login.js +2 -2
- package/dist/plane-review.js +1 -1
- package/dist/planner.js +2 -2
- package/dist/plugin-bundle-source.js +1 -0
- package/dist/plugin-bundles-schema.js +43 -0
- package/dist/policy.js +1 -1
- package/dist/pre-run-phase.js +2 -0
- package/dist/project-knowledge.js +2 -2
- package/dist/project-learning.js +6 -5
- package/dist/project-memory.js +1 -1
- package/dist/project-skills.js +1 -1
- package/dist/project-tools.js +2 -2
- package/dist/prompt.js +1 -1
- package/dist/provider-auth.js +1 -1
- package/dist/provider-connection.js +2 -2
- package/dist/provider-home.js +1 -1
- package/dist/provider-limits.js +1 -1
- package/dist/provider.js +2 -2
- package/dist/reported-usage.js +1 -1
- package/dist/repository-context.js +1 -1
- package/dist/result-follow-ups.js +2 -2
- package/dist/result-projection.js +1 -1
- package/dist/route-change.js +1 -1
- package/dist/runner.js +2 -2
- package/dist/scope.js +1 -1
- package/dist/scout.js +2 -2
- package/dist/serve.js +3 -3
- package/dist/server/chat-projection.js +1 -1
- package/dist/server/chat.js +3 -3
- package/dist/server/direct-chat.js +1 -1
- package/dist/server/engine-api.js +1 -1
- package/dist/server/handoff.js +1 -0
- package/dist/server/live.js +1 -1
- package/dist/server/merge-ready-view.js +1 -1
- package/dist/server/panels.js +1 -0
- package/dist/server/people-tokens.js +1 -1
- package/dist/server/route-table.js +1 -1
- package/dist/server/send-back-build.js +1 -1
- package/dist/server/settings.js +2 -2
- package/dist/server/task-overview.js +1 -0
- package/dist/server/task-view-data.js +1 -1
- package/dist/server/task-views.js +1 -1
- package/dist/server/tasks.js +5 -5
- package/dist/server/terminals.js +1 -1
- package/dist/settings-data.js +1 -1
- package/dist/settings-proofs.js +1 -1
- package/dist/setup-guide.js +1 -1
- package/dist/skill-library.js +13 -22
- package/dist/skills-manifest.js +1 -1
- package/dist/spend-report.js +2 -1
- package/dist/spend.js +6 -4
- package/dist/ssr-workspace.js +83 -83
- package/dist/store-baseline.js +13 -47
- package/dist/store.js +9 -9
- package/dist/structured-json.js +1 -0
- package/dist/structured-output.js +1 -1
- package/dist/subscription-chat.js +16 -4
- package/dist/subscription-usage.js +3 -4
- package/dist/surface.js +1 -1
- package/dist/task-outcome-cli.js +5 -2
- package/dist/task-overview.js +1 -0
- package/dist/task-review-brief.js +1 -1
- package/dist/task-status.js +1 -1
- package/dist/teardown-git.js +4 -4
- package/dist/text-limits.js +1 -1
- package/dist/trusted-path.js +1 -1
- package/dist/tui/darwin-arm64/toolroll-tui +0 -0
- package/dist/tui/darwin-x64/toolroll-tui +0 -0
- package/dist/tui/linux-arm64/toolroll-tui +0 -0
- package/dist/tui/linux-x64/toolroll-tui +0 -0
- package/dist/tui-contract.js +1 -1
- package/dist/tui-launch.js +2 -1
- package/dist/verification-evidence.js +1 -1
- package/dist/welcome-facts.js +1 -1
- package/dist/work-index.js +13 -5
- package/package.json +2 -1
- package/dist/browser/chunk-agents-live-view.6fd2938ef96a85a4127cddb99dbc700b3201c58351d9f07dbcd8a2f7d7dfef22.js.br +0 -0
- package/dist/browser/chunk-agents-live-view.6fd2938ef96a85a4127cddb99dbc700b3201c58351d9f07dbcd8a2f7d7dfef22.js.gz +0 -0
- package/dist/browser/chunk-bundle.77cfd5ccd851cf1fb8597d1d0eb12fc30913417f13b699d5b8ac61a4116274ef.js +0 -2
- package/dist/browser/chunk-bundle.77cfd5ccd851cf1fb8597d1d0eb12fc30913417f13b699d5b8ac61a4116274ef.js.br +0 -0
- package/dist/browser/chunk-bundle.77cfd5ccd851cf1fb8597d1d0eb12fc30913417f13b699d5b8ac61a4116274ef.js.gz +0 -0
- package/dist/browser/chunk-chat-parts.0e3997ddbeed8305b18353060e93f2a330d95ccb23b960f182dee211d205bb13.js +0 -4
- package/dist/browser/chunk-chat-parts.0e3997ddbeed8305b18353060e93f2a330d95ccb23b960f182dee211d205bb13.js.br +0 -0
- package/dist/browser/chunk-chat-parts.0e3997ddbeed8305b18353060e93f2a330d95ccb23b960f182dee211d205bb13.js.gz +0 -0
- package/dist/browser/chunk-core.23e919124df20f363902dc6e256d2408e103af285ebffbf0059fad7369c6ee8f.js +0 -116
- package/dist/browser/chunk-core.23e919124df20f363902dc6e256d2408e103af285ebffbf0059fad7369c6ee8f.js.br +0 -0
- package/dist/browser/chunk-core.23e919124df20f363902dc6e256d2408e103af285ebffbf0059fad7369c6ee8f.js.gz +0 -0
- package/dist/browser/chunk-flow-view.71a0a3360292445ab70d67253bb9003163bbb7b1b03f14d1892cca83debd9b2c.js.br +0 -0
- package/dist/browser/chunk-flow-view.71a0a3360292445ab70d67253bb9003163bbb7b1b03f14d1892cca83debd9b2c.js.gz +0 -0
- package/dist/browser/chunk-flows-extra-view.ebf20d864bea14592b61ce628afc066997e1f0a566abbfe6fc91f4db47245696.js +0 -4
- package/dist/browser/chunk-flows-extra-view.ebf20d864bea14592b61ce628afc066997e1f0a566abbfe6fc91f4db47245696.js.br +0 -0
- package/dist/browser/chunk-flows-extra-view.ebf20d864bea14592b61ce628afc066997e1f0a566abbfe6fc91f4db47245696.js.gz +0 -0
- package/dist/browser/chunk-pages-bundle.2fbb3d6de09f521a8ded75bd48b567d60bbfde351cae3492179714d76fc91ee5.js +0 -6
- package/dist/browser/chunk-pages-bundle.2fbb3d6de09f521a8ded75bd48b567d60bbfde351cae3492179714d76fc91ee5.js.br +0 -0
- package/dist/browser/chunk-pages-bundle.2fbb3d6de09f521a8ded75bd48b567d60bbfde351cae3492179714d76fc91ee5.js.gz +0 -0
- package/dist/browser/chunk-result-view.7527d4ed9c70c023b63821c87f8db00c374fddd8674f984cc7c03fae050e6ff0.js +0 -2
- package/dist/browser/chunk-result-view.7527d4ed9c70c023b63821c87f8db00c374fddd8674f984cc7c03fae050e6ff0.js.br +0 -0
- package/dist/browser/chunk-result-view.7527d4ed9c70c023b63821c87f8db00c374fddd8674f984cc7c03fae050e6ff0.js.gz +0 -0
- package/dist/browser/chunk-settings-view.129efb77f2d459e2254d17ab338dac474d14b86383fe024798dc61b9460d169c.js +0 -20
- package/dist/browser/chunk-settings-view.129efb77f2d459e2254d17ab338dac474d14b86383fe024798dc61b9460d169c.js.br +0 -0
- package/dist/browser/chunk-settings-view.129efb77f2d459e2254d17ab338dac474d14b86383fe024798dc61b9460d169c.js.gz +0 -0
- package/dist/browser/chunk-shared.01f5db9cab3e903447bac5a6484cbae518232a074542c5128a0ce8cac9fe5e7d.js +0 -3
- package/dist/browser/chunk-shared.01f5db9cab3e903447bac5a6484cbae518232a074542c5128a0ce8cac9fe5e7d.js.br +0 -0
- package/dist/browser/chunk-shared.01f5db9cab3e903447bac5a6484cbae518232a074542c5128a0ce8cac9fe5e7d.js.gz +0 -0
- package/dist/browser/chunk-shared.1cf4e4820f8c03a04d548d8b21b6169eda3354229b4feccdeb95534b3cc2ed09.js +0 -2
- package/dist/browser/chunk-shared.1cf4e4820f8c03a04d548d8b21b6169eda3354229b4feccdeb95534b3cc2ed09.js.br +0 -0
- package/dist/browser/chunk-shared.1cf4e4820f8c03a04d548d8b21b6169eda3354229b4feccdeb95534b3cc2ed09.js.gz +0 -0
- package/dist/browser/chunk-shared.408770b5e547bce6c67ad743638b8ef16381b092d71fc1a2b2b801cad9bd900f.js +0 -5
- package/dist/browser/chunk-shared.408770b5e547bce6c67ad743638b8ef16381b092d71fc1a2b2b801cad9bd900f.js.br +0 -0
- package/dist/browser/chunk-shared.408770b5e547bce6c67ad743638b8ef16381b092d71fc1a2b2b801cad9bd900f.js.gz +0 -0
- package/dist/browser/chunk-shared.47c9cc79ee85c5d6ebb9759b9d7f261ddd7aee78c7f70f2bc559d5b97444936d.js +0 -2
- package/dist/browser/chunk-shared.47c9cc79ee85c5d6ebb9759b9d7f261ddd7aee78c7f70f2bc559d5b97444936d.js.br +0 -0
- package/dist/browser/chunk-shared.47c9cc79ee85c5d6ebb9759b9d7f261ddd7aee78c7f70f2bc559d5b97444936d.js.gz +0 -0
- package/dist/browser/chunk-shared.60b718ab56ab520275f68f0378efa38941dc2d739c1284f842a19e6a25456e7d.js +0 -2
- package/dist/browser/chunk-shared.60b718ab56ab520275f68f0378efa38941dc2d739c1284f842a19e6a25456e7d.js.br +0 -0
- package/dist/browser/chunk-shared.60b718ab56ab520275f68f0378efa38941dc2d739c1284f842a19e6a25456e7d.js.gz +0 -0
- package/dist/browser/chunk-shared.9974523cbe568c3669da1b1a266aa7de741e2edcce3e4a943e73242c61324004.js +0 -2
- package/dist/browser/chunk-shared.9974523cbe568c3669da1b1a266aa7de741e2edcce3e4a943e73242c61324004.js.br +0 -0
- package/dist/browser/chunk-shared.9974523cbe568c3669da1b1a266aa7de741e2edcce3e4a943e73242c61324004.js.gz +0 -0
- package/dist/browser/chunk-shared.b536969256589ccff71a29b37eff95fccfd5a8f4fa4138ff503cb0e8fb10b4d0.js +0 -2
- package/dist/browser/chunk-shared.b536969256589ccff71a29b37eff95fccfd5a8f4fa4138ff503cb0e8fb10b4d0.js.br +0 -0
- package/dist/browser/chunk-shared.b536969256589ccff71a29b37eff95fccfd5a8f4fa4138ff503cb0e8fb10b4d0.js.gz +0 -0
- package/dist/browser/chunk-shared.cbc3fd4e985ceccf27c731d77030830edbf96dd0197424584ebb202eb6993ebd.js +0 -4
- package/dist/browser/chunk-shared.cbc3fd4e985ceccf27c731d77030830edbf96dd0197424584ebb202eb6993ebd.js.br +0 -0
- package/dist/browser/chunk-shared.cbc3fd4e985ceccf27c731d77030830edbf96dd0197424584ebb202eb6993ebd.js.gz +0 -0
- package/dist/browser/chunk-sonner.da05d41088ec46a49ef6b86f4afa71fccd5462f1befa713ca930aa231e35349b.js.br +0 -0
- package/dist/browser/chunk-sonner.da05d41088ec46a49ef6b86f4afa71fccd5462f1befa713ca930aa231e35349b.js.gz +0 -0
- package/dist/browser/chunk-task-view.9b9f418a71547aeea43a8acb26e8d48d486463b71b940eb72f3856038e27fa90.js +0 -2
- package/dist/browser/chunk-task-view.9b9f418a71547aeea43a8acb26e8d48d486463b71b940eb72f3856038e27fa90.js.br +0 -0
- package/dist/browser/chunk-task-view.9b9f418a71547aeea43a8acb26e8d48d486463b71b940eb72f3856038e27fa90.js.gz +0 -0
- package/dist/browser/chunk-team-chat.2be52f36796d5cd7ca8ea47a2aeb68c550625150ccc4186805bdecd87747138c.js +0 -2
- package/dist/browser/chunk-team-chat.2be52f36796d5cd7ca8ea47a2aeb68c550625150ccc4186805bdecd87747138c.js.br +0 -0
- package/dist/browser/chunk-team-chat.2be52f36796d5cd7ca8ea47a2aeb68c550625150ccc4186805bdecd87747138c.js.gz +0 -0
- package/dist/browser/terminal.1ab49cbf9b9363f0f520b85e4125d40a302dffc10489e77b04ff1c620831eefe.js.br +0 -0
- package/dist/browser/workspace.d6a38fe66b5ee0b74d8ea4b026148c285f664732511bc528c934309bbad1e5e4.js.br +0 -0
- package/dist/browser/workspace.d6a38fe66b5ee0b74d8ea4b026148c285f664732511bc528c934309bbad1e5e4.js.gz +0 -0
- package/dist/browser/workspace.d818fa094b8793160991ca784f4897c6d1862c02fbcbeebae637d8b855ab03d5.css +0 -4
- package/dist/browser/workspace.d818fa094b8793160991ca784f4897c6d1862c02fbcbeebae637d8b855ab03d5.css.br +0 -0
- package/dist/browser/workspace.d818fa094b8793160991ca784f4897c6d1862c02fbcbeebae637d8b855ab03d5.css.gz +0 -0
package/dist/chat-channel.js
CHANGED
|
@@ -13,7 +13,7 @@ Confirm?`}export function armedQuestion(proposal){return(proposal.kind==="action
|
|
|
13
13
|
`),buttons:!1}}export function phoneProposalLink(store,proposal,repos,channel=null){return fitsPhone(proposalPreview(store,proposal,repos,"telegram"))?proposalLink(store,proposal,repos,channel):LEAD_CHAT_LINK}export function confirmedLink(store,outcome,proposal,repos){return outcome.ok&&proposal.kind==="action"&&typeof outcome.href=="string"&&FLOW_HREF.test(outcome.href)?{label:"Open the flow",path:outcome.href}:!outcome.ok||outcome.taskId===null?null:proposal.kind==="action"&&(proposal.payload.operation==="skill_test"||proposal.payload.operation==="task_start")||proposal.kind==="task"||proposal.kind==="scope"||proposal.kind==="agents"||proposal.kind==="task_action"&&proposal.payload.operation==="resume"||proposal.kind==="review"&&proposal.payload.operation==="revise"?taskLink(store,outcome.taskId,repos):null}function lines(text,cap){return phoneText(text,cap).split(`
|
|
14
14
|
`).map(line=>`| ${line}`)}export function proposalPreview(store,proposal,repos,channel=null){const payload=proposal.payload,t=(key,cap=200)=>typeof payload[key]=="string"?phoneText(payload[key],cap):"",task=t("task",64),taskName=t("taskTitle",120)||task,repoLabel=(()=>{const id=t("repoId",8),path=/^r[0-9]+$/.test(id)?repos[Number(id.slice(1))-1]:void 0;return path===void 0?id:projectLabel(path)})(),phone=channel==="telegram",card=(headline,body=[],consequence=null,last=null)=>({text:(phone?[headline,...consequence===null?[]:[consequence],...body.length===0?[]:["",...body],"","Nothing changes until you confirm.",...last===null?[]:[last]]:[headline,...body,...consequence===null?[]:["",consequence],"","Confirm or Dismiss below. Nothing changes until you confirm."]).join(`
|
|
15
15
|
`),buttons:!0}),lasting=phone?" ⚠ can't be undone":" — IRREVERSIBLE",handoff=(headline,body=[])=>({text:[headline,...body,"",HANDOFF].join(`
|
|
16
|
-
`),buttons:!1});switch(proposal.kind){case"action":{const action=sharedActionPayload(payload);return action?channel!==null&&sharedActionAllowsChallenge(action,channel)?card(phoneText(action.title,200),action.terms.map(term=>phoneText(term,APPROVAL_TERM_CHARS)),"Confirm asks once more before anything is recorded.",action.operation==="task_start"&&channel==="telegram"?TYPED_START_LINE:null):sharedActionNeedsReview(action)?handoff(phoneText(action.title,200),["Review the full details and confirm this exact action."]):card(phoneText(action.title,200),action.terms.map(term=>phoneText(term,1200))):handoff("This action is unavailable.")}case"task":return card(`Create task in ${repoLabel||"the project"}: ${t("title",120)}`,[`Goal: ${t("goal",600)}`,...t("not")===""?[]:[`Not: ${t("not",300)}`],...payload.report===!0?["A scout task: it delivers a report, never a branch."]:[]],payload.report===!0?"Confirm files it; a scout needs no approval.":"Confirm files it. You still approve its scope before work starts.");case"next":return card(`Move ${taskName} to the front of its queue (now ${String(payload.position??"?")} of ${String(payload.of??"?")}).`);case"reserve":return card(payload.worker===null?`Release ${taskName} to the shared queue.`:`Reserve ${taskName} for ${t("worker",80)}.`);case"hold":return card(`Hold ${taskName}: ${t("reason",300)}`,[],"The task waits until the hold is released.");case"unhold":return card(`Release ${taskName} from its hold.`);case"steer":return payload.mode==="pause"?card(`Pause ${taskName}.`,[],"Its current turn stops and the build keeps running; its next note continues it."):payload.mode==="resume"?card(`Resume ${taskName}.`,[],"It goes on where it stopped. No note is sent."):payload.mode==="pause-and-steer"?card(`Pause ${taskName}, then send its agent:`,lines(t("note",1e3),1e3),"Its current turn stops first. Scope stays the same."):typeof payload.questionKey=="string"?card(`Reply to ${taskName}'s agent about "${t("questionKey",40)}":`,lines(t("note",1e3),1e3),"The running agent reads it when it next checks for notes, and the question closes. Scope stays the same."):card(`Guidance for ${taskName}'s agent:`,lines(t("note",1e3),1e3),"A running agent reads it when it next checks for notes; otherwise the next attempt does. Scope stays the same.");case"repair":{const blocker=t("blockerTitle",120)||t("blocker",64),operation=t("operation",16),headline=operation==="retry"?`Queue ${blocker} again; ${taskName} follows when it finishes.`:operation==="unlink"?`Let ${taskName} continue without ${blocker}.`:`Make ${taskName} wait for ${t("replacementTitle",120)||t("replacement",64)} instead of ${blocker}.`;return card(headline)}case"agents":{const parts=[...t("risk")===""?[]:[`risk ${t("risk",32)}`],...t("role")===""?[]:[payload.clear===!0?`${t("role",32)}: back to the recommendation`:`${t("role",32)}: ${t("provider",40)} ${t("model",80)}`]];return card(`Change agents for ${taskName}: ${parts.join("; ")}`,[],"Changing agents or risk needs renewed approval before work starts.")}case"scope":return card(`Rewrite the scope of ${taskName}:`,[`Goal: ${t("goal",600)}`,...t("not")===""?[]:[`Not: ${t("not",300)}`]],"After confirming, the new scope still needs your approval before work starts.");case"answer":{const id=typeof payload.decision=="number"?payload.decision:null,decision=id===null?null:store.getDecision(id);if(decision?.supersededReason!=null)return{text:closedQuestionWords(decision.supersededReason),buttons:!1,closed:!0};const pick=t("option",64),irreversible=payload.reversible===!1,body=decision===null?["(the decision is gone)"]:[`Q: ${phoneText(decision.question,400)}`,...decision.options.map(one=>`${one.id===pick?"→":" "} ${phoneText(one.label,120)}${one.reversible?"":lasting}${one.id===decision.recommendation?" (the builder recommends this)":""}: ${phoneText(one.consequence,300)}`),...t("rationale")===""?[]:[`Why: ${t("rationale",300)}`]];return card(`Answer decision #${String(id??"?")} on ${taskName} with "${t("optionLabel",120)||pick}"`,body,irreversible?phone?"⚠ This choice can't be undone. Confirming asks you once more.":"⚠ This choice is irreversible. Confirming asks you once more.":null)}case"task_action":{const operation=payload.operation,action=isChatTaskAction(operation)?CHAT_TASK_ACTIONS[operation]:null,dependency=t("dependencyTitle",120)||t("dependency",64);return action===null?handoff(`An unavailable action was proposed for ${taskName}.`):card(`${action.label}: ${taskName}${dependency===""?"":` · ${dependency}`}`,[action.detail],null)}case"review":{const revise=payload.operation==="revise",snapshot=payload.snapshot,selected=Array.isArray(payload.notes)?payload.notes:[],saved=(snapshot?.notes??[]).filter(one=>selected.includes(one.id)),note=t("note",LIMITS.note),image=parseFeedbackImage(payload.image),path=t("path",300);return card(`${revise?"Request changes to":"Save feedback on"} result #${String(payload.run??"?")} of ${taskName}`,[...note===""?[]:[`Your feedback${path===""?"":` (${path}${typeof payload.line=="number"?`:${payload.line}`:""})`}:`,...image?[`Screenshot ${image.artifact} · result #${image.run}`]:[],...lines(note,LIMITS.note)],...saved.length===0?[]:["Saved notes included:",...saved.map(one=>`• ${one.image?`Screenshot ${one.image.artifact} · result #${one.image.run}: `:""}${one.path===null?"":`${phoneText(one.path,120)}${one.line===null?"":`:${one.line}`}: `}${phoneText(one.note,LIMITS.note)}`)]],revise?"Creates a revision of the same task. Its approval follows your settings.":"Saves feedback; no work starts.")}case"cancel":return handoff(`Cancel ${taskName}: ${t("reason",300)}`,["Cancelling is armed on the task itself, never from a card."]);case"control":{if(isCardProposal(proposal))return handoff(cardPlainOf(proposal));const control=payload.control,label=isChatControl(control)?CHAT_CONTROLS[control].label:"A console control";return handoff(`${label}${taskName===""?"":` for ${taskName}`}`,["This opens an existing control; nothing changes from here."])}default:return handoff("This kind of proposal cannot be confirmed from the phone.")}}export function proposalOutcomeText(proposal){const outcome=proposal.outcome,said=outcome!==null&&typeof outcome.said=="string"?phoneText(outcome.said,600):"",via=outcome!==null&&typeof outcome.via=="string"?` (from ${outcome.via})`:"";switch(proposal.state){case"confirmed":return`✓ Done${via}${said===""?"":`: ${said}`}`;case"refused":return`✗ Not done${via}${said===""?"":`: ${said}`}`;case"dismissed":return"Dismissed.";case"expired":return"This card expired.";case"confirming":return"Being confirmed elsewhere right now.";default:return"Still waiting for your confirmation."}}export const CHAT_ACTION_PARITY={get_brief:{support:"direct",how:"Reads current tasks, decisions, results and project knowledge from the local database through the shared engine, within the enrolled projects.",gap:"Dedicated Telegram and Slack journeys for this tool and live channel rendering remain unverified."},get_project_activity:{support:"direct",how:"Reads the project's Ready backlog, finished-to-decision elapsed time, explicit revisions and recorded cost for completed families in an accessible enrolled project through the shared engine.",gap:"Dedicated Telegram and Slack journeys for this tool and live channel rendering remain unverified."},get_project_context:{support:"direct",how:"Reads bounded source excerpts or advisory import impact in an accessible enrolled project through the shared engine, with source-search fallback when its index is unavailable.",gap:"Index refresh uses the local CLI. Dedicated Telegram and Slack journeys for this tool and live channel rendering remain unverified."},get_code_map:{support:"direct",how:"Reads the project's generated code map through the shared reader, one labelled answer at most 6 KB, paging one pinned version.",gap:null},refresh_code_map:{support:"direct",how:"Queues a check of the project's main, as Check now does on the page.",gap:null},get_action_status:{support:"direct",how:"Reads the exact saved shared action and its outcome, including completion through secure review.",gap:null},get_actions:{support:"direct",how:"Lists the shared action catalogue and required inputs.",gap:null},propose_action:{support:"direct",how:"Prepares exact shared skill, knowledge, approval, acceptance, cancel and resume actions (the separate review request was removed on 2026-09-21). Short ordinary changes confirm here; protected or long changes use one secure review and record the result on the same proposal.",gap:"Secure review requires a working HTTPS console connection. Real transport verification is required."},recap:{support:"direct",how:"Read by the model during a phone turn over the enrolled ceiling.",gap:null},find_tools:{support:"direct",how:"Searches the lead's own other tools by what it wants to do; what it finds is offered to it from its next step in the same reply. Same on every channel: the shared engine runs it.",gap:null},list_repos:{support:"direct",how:"Read during a turn; projects are r1..rN in enrollment order, as on the console.",gap:null},get_skills:{support:"direct",how:"Reads the same project skill library, saved selections and enabled versions as the console. Use propose_action for changes and tests.",gap:"Skill import and long content require secure review. Folder and GitHub import still use the project Skills screen."},get_project_knowledge:{support:"direct",how:"Read during a turn.",gap:null},get_flaky_tests:{support:"direct",how:"Read during a turn: a project's tests with mixed outcomes, each with the task that would fix it. Fixing one is an ordinary task card.",gap:null},get_models:{support:"direct",how:"Read during a turn: default agents with the exact model each runs, CLI versions and new models. Changes use the labelled Settings → Models page.",gap:null},get_diff:{support:"direct",how:"Read during a turn: the exact result's changed files, then one file's diff, so a requested change names the right file and line.",gap:null},get_check_log:{support:"direct",how:"Read during a turn: the end of the exact result's check log, a page of it, or the lines matching a search.",gap:null},get_project_tools:{support:"direct",how:"Read during a turn: a project's tools, the common tools list and servers found on the computer. Adding one is a secure-review card; secrets are set only on the console's Tools page.",gap:null},get_task_conversation:{support:"direct",how:"Read during a turn: what the person and the lead said in one task's own chat, including what was confirmed there.",gap:null},get_attachment:{support:"direct",how:"Read during a turn: a file the person attached to a message in this conversation (from the iPhone), its text 32 KB at a time; a PDF's own text decoded.",gap:"Attaching files is on the iPhone app; a chat app's own attachments aren't read."},get_flows:{support:"direct",how:"Read during a turn: a person's flows, each one's steps in order and its cards — where each card is, what it waits on, whether it needs them, its owner and its discussion.",gap:null},get_subagents:{support:"direct",how:"Read during a turn: the project's subagents, their soul files, the zones they work, what they did today and the questions they're waiting on.",gap:null},propose_subagent:{support:"direct",how:"Asks a subagent to do something for you (the lead delegates; its answer comes back here), adds one from a template or a soul file, changes one section of its soul file (or the whole short file), pauses, resumes or removes it, passes it a note, or answers its question for the person asked, through the shared confirm door.",gap:"Soul files longer than one message are edited on the console's subagent page; the phone changes one section at a time."},get_flow_insights:{support:"direct",how:"Read during a turn: where each flow's cards pass, fail or are sent back, how long they wait, how its scripts did, and a run's log.",gap:null},propose_flow:{support:"direct",how:"Creates or changes a flow, adds, moves, approves, sends back or cancels its cards, comments on them (@name pings that person), sets their owner, follows them, saves the project's scripts, and adds, pauses or removes its triggers, through the shared confirm door; a long drawing opens the secure review. Work a card files is an ordinary task under the usual approvals.",gap:"The flow canvas itself is on the console; the phone confirms cards but draws nothing. Webhook addresses and the Linear key are set on the console's Triggers panel."},commit_to:{support:"direct",how:"Records what the lead promised to follow up on (a task, attempt, check or time; 7 days at most). The follow pass says one line when it is met, in the shared conversation and on the chat the promise was made on.",gap:null},release_commitment:{support:"direct",how:"Stops following up on one of the person's open promises, with the reason.",gap:null},remember:{support:"direct",how:"Proposes a correction or lasting preference as a decision, project instruction or about-you card, through the shared confirm door; an about-you card shows the line it replaces.",gap:null},manage_standing_directions:{support:"direct",how:"Runs during a turn: lists Standing Directions, or adds one turned off, in the same store Settings → Standing directions edits, where the person turns it on, off or removes it; a project direction names one of the person's admitted projects.",gap:null},get_person:{support:"direct",how:"Read during a turn: one person, subagent or team chat in full, with their open tasks.",gap:null},get_integrations:{support:"direct",how:"Read during a turn: which chat apps, email, GitHub, project tools and monitoring are Connected, Not set up or Broken, as Settings → Integrations shows them.",gap:null},get_capabilities:{support:"direct",how:"Read during a turn: which agents are signed in, which workers are online, which tools and skills work, which integrations are connected and what checks the project runs, each with its next step and settings link.",gap:null},ask_owner:{support:"direct",how:"One question with 2-4 options and Something else, drawn as buttons under the reply; the tapped option is sent as the person's next message.",gap:null},search_project_memory:{support:"direct",how:"Read during a turn: one search over decisions, references, lessons and the conversations the person may read.",gap:null},list_tasks:{support:"direct",how:"Read during a turn.",gap:null},tidy_preview:{support:"direct",how:"Read during a turn: what Put away old tasks would put away now and why. Only a person puts tasks away, on the console or with the CLI command it names.",gap:null},get_task:{support:"direct",how:"Read during a turn; a reply to a result message pins the exact execution.",gap:null},get_agents:{support:"direct",how:"Read during a turn.",gap:null},list_decisions:{support:"direct",how:"Read during a turn.",gap:null},get_decision:{support:"direct",how:"Read during a turn.",gap:null},queue:{support:"direct",how:"Read during a turn.",gap:null},get_result:{support:"direct",how:"Read during a turn; the phone card shows the verification verdict, never a local link.",gap:"Secure remote evidence links are not delivered to the phone; a result's screenshots travel through get_result_images."},get_result_images:{support:"direct",how:"Read during a turn; every verified original PNG/JPEG the turn selected (at most 8 per reply, the rest by offset or image id) is sent as a document with a short safe caption after the reply, re-verified before each upload, and a reply to an image binds that exact task and run.",gap:"An image whose record or bytes fail verification, or one Telegram refuses, is named in the chat rather than sent, through the same durable retried part; the operator opens the exact result in the console. Fixture proof only, no physical-phone rendering."},get_controls:{support:"direct",how:"Read during a turn.",gap:null},get_acceptance_evidence:{support:"direct",how:"Shared read-only acceptance packet: exact result, criterion states, gate, reviewer findings, caveats and recorded human acceptance. Screenshot files use get_result_images; marking complete is a propose_action result_accept confirmed behind the phone's own yes/cancel challenge or on the signed-in console.",gap:"A physical-phone completion has not been exercised."},offer_approval:{support:"direct",how:"Pushes the plan's or flow card's own decision card to the owner's paired chat: Approve arms Yes and Cancel, and only the owner's Yes decides, through sealScopeApproval (as a chat-origin approval) or decideFlowCard. Outside the owner's chat-approval setting or a decision's rules it answers why, and the lead opens the console control.",gap:"A flow card's Send back, Edit and a Person chooses step act from the pushed card; a plan's Send back stays in the console. Fixture proof only, no physical-phone rendering."},get_findings:{support:"direct",how:"Read during a turn; a finding's words are shown as untrusted text.",gap:null},show_card:{support:"direct",how:"A card of Toolroll's own records. Telegram shows it as one message: key facts as lines, tables and charts as monospaced text, its links as url buttons.",gap:"A chart is bars of text on Telegram, with every number written out."},show_control:{support:"handoff",how:"The card names the control and the task, with one url button to that exact console control when a trusted https console-url is configured; the button opens the signed-in console and acts on nothing.",gap:"Incomplete phone action: the control itself runs in the console, after sign-in."},propose_task:{support:"direct",how:"Card with Confirm/Dismiss through confirmLeadProposal (filed as a lead proposal, via telegram). The confirmed card links Review & start for the filed task while its scope waits; under a signed automatic mode it says the scope is approved and links the task.",gap:"Under manual approval the plan then needs the person's own yes, on its card."},propose_start:{support:"direct",how:"A protected shared action (task_start): Start work arms Yes and Cancel, and the person's own Yes files and approves one small task under the fast start rules (fastStartBuild), or a typed yes as a reply to the card or as the very next message. When Toolroll can't start it right away it is an ordinary task card.",gap:"Terms too long for one message open the review page, in the signed-in console."},propose_sweep:{support:"direct",how:"A protected shared action (sweep_file): the card lists every item, the shared rules and the success test; confirming files them all and approves each scope.",gap:"Terms too long for one message open the review page, in the signed-in console."},get_sweep:{support:"direct",how:"Reads a sweep's table (each item's state, verdict and result) from the local database through the shared engine.",gap:null},propose_sweep_cancel:{support:"direct",how:"An ordinary shared action (sweep_cancel_rest): Confirm cancels every item not yet ready; finished results stay.",gap:null},propose_scope:{support:"direct",how:"Confirm rewrites the scope through the shared door; the confirmed card links Review & start for the exact task.",gap:"Approving the rewritten scope is a separate yes, on its own card."},propose_next:{support:"direct",how:"Confirm through the shared door with the queue revision it saw.",gap:null},propose_reserve:{support:"direct",how:"Confirm through the shared door.",gap:null},propose_agents:{support:"direct",how:"Confirm through the shared route-edit door; when the change stales the approval, the confirmed card links Review & start for the exact task.",gap:"Renewed approval after the route change happens in the console."},propose_hold:{support:"direct",how:"Confirm through the shared door.",gap:null},propose_unhold:{support:"direct",how:"Confirm through the shared door.",gap:null},propose_steer:{support:"direct",how:"Confirm through the shared door; the guidance is shown verbatim on the card.",gap:null},propose_dependency_repair:{support:"direct",how:"Confirm retry/unlink/replace through the shared door with both projects re-checked.",gap:null},propose_task_action:{support:"direct",how:"stop, retry, plan, wait_for and stop_waiting confirm through the shared door (a stop is audited via telegram); resume, on a person's own tap, lifts the stop.",gap:null},propose_answer:{support:"direct",how:"Confirm answers through the shared door, audited via telegram; an irreversible option arms a second tap first.",gap:null},propose_review:{support:"direct",how:"note saves feedback; revise creates the same-family revision through the shared result service, honouring automatic approval settings; the confirmed card links Review & start for the revision while it waits, or the task once approved.",gap:"Under manual approval the revision is approved in the console, reached from the card's button; under a signed automatic-approval mode it runs unattended."},propose_cancel:{support:"handoff",how:"The door refuses cancel from any card; the card links the exact task's Cancel control when a trusted https console-url is configured, and the cancel is armed there.",gap:"Incomplete phone action: no phone path to cancel by design; the button only opens the task."},toolroll_view_read:{support:"missing",how:"Refused on the phone by design: the workbench's look is the person's own conversation in the console on this computer (view-tools.ts); the tool answers in words and nothing is read or written.",gap:"No phone path by design: restyle from the console on this computer, or edit tui.toml."},toolroll_view_set:{support:"missing",how:"Refused on the phone by design: the workbench's look is the person's own conversation in the console on this computer (view-tools.ts); the tool answers in words and nothing is read or written.",gap:"No phone path by design: restyle from the console on this computer, or edit tui.toml."},list_direct_chats:{support:"direct",how:"Read during a turn: lists active Direct Chat threads in admitted projects with model, effort, status, and token usage.",gap:null},get_direct_chat:{support:"direct",how:"Read during a turn: reads one Direct Chat's full turn transcript, tool history, and token usage from SQLite.",gap:null},get_direct_chat_diff:{support:"direct",how:"Read during a turn: inspects a Direct Chat's changed files, bounded patch, and Ship readiness.",gap:null},manage_direct_chat:{support:"missing",how:"Refused on the phone by design: instant Direct Chat controls require the owner's local solo console session on this computer.",gap:"No phone path by design: stop, rename, switch model, or archive Direct Chats from the local Mac app or console."},get_usage_limits:{support:"direct",how:"Read during a turn: reports live Claude, Codex, and Gemini subscription windows and monthly spend budgets.",gap:null},get_recent_updates:{support:"direct",how:"Read during a turn: aggregates Ready results, completions, failures, updated Direct Chats, open decisions, and recent actions.",gap:null},propose_direct_chat:{support:"handoff",how:"Drafts a confirmation card to start, reply to, or promote a Direct Chat; promote files a Task on confirm while start and reply execute only on the local solo console.",gap:"Incomplete phone action: starting or replying to a local Direct Chat clone runs in the local console or Mac app."},propose_report_followups:{support:"direct",how:"Batch-drafts standard Task confirmation cards from a verified Scout Report's follow-up recommendations through the shared door.",gap:null},shared_browser:{support:"missing",how:"Refused on the phone by design: the Shared Browser is driven only from the person's own conversation in the console on this computer; a phone turn has no browser to drive, so the tool answers in words and nothing opens.",gap:"No phone path by design: open the Shared Browser from the Mac app (⌘⇧B) or the console on this computer, and sign in there when it asks for a takeover."}};export function parityGaps(){return LEAD_TOOL_SCHEMAS.map(tool=>tool.name).filter(name=>CHAT_ACTION_PARITY[name]===void 0)}export function handoffCardText(text,note){return note===null?text:`${text}
|
|
16
|
+
`),buttons:!1});switch(proposal.kind){case"action":{const action=sharedActionPayload(payload);return action?channel!==null&&sharedActionAllowsChallenge(action,channel)?card(phoneText(action.title,200),action.terms.map(term=>phoneText(term,APPROVAL_TERM_CHARS)),"Confirm asks once more before anything is recorded.",action.operation==="task_start"&&channel==="telegram"?TYPED_START_LINE:null):sharedActionNeedsReview(action)?handoff(phoneText(action.title,200),["Review the full details and confirm this exact action."]):card(phoneText(action.title,200),action.terms.map(term=>phoneText(term,1200))):handoff("This action is unavailable.")}case"task":return card(`Create task in ${repoLabel||"the project"}: ${t("title",120)}`,[`Goal: ${t("goal",600)}`,...t("not")===""?[]:[`Not: ${t("not",300)}`],...payload.report===!0?["A scout task: it delivers a report, never a branch."]:[]],payload.report===!0?"Confirm files it; a scout needs no approval.":"Confirm files it. You still approve its scope before work starts.");case"next":return card(`Move ${taskName} to the front of its queue (now ${String(payload.position??"?")} of ${String(payload.of??"?")}).`);case"reserve":return card(payload.worker===null?`Release ${taskName} to the shared queue.`:`Reserve ${taskName} for ${t("worker",80)}.`);case"hold":return card(`Hold ${taskName}: ${t("reason",300)}`,[],"The task waits until the hold is released.");case"unhold":return card(`Release ${taskName} from its hold.`);case"steer":return payload.mode==="pause"?card(`Pause ${taskName}.`,[],"Its current turn stops and the build keeps running; its next note continues it."):payload.mode==="resume"?card(`Resume ${taskName}.`,[],"It goes on where it stopped. No note is sent."):payload.mode==="pause-and-steer"?card(`Pause ${taskName}, then send its agent:`,lines(t("note",1e3),1e3),"Its current turn stops first. Scope stays the same."):typeof payload.questionKey=="string"?card(`Reply to ${taskName}'s agent about "${t("questionKey",40)}":`,lines(t("note",1e3),1e3),"The running agent reads it when it next checks for notes, and the question closes. Scope stays the same."):card(`Guidance for ${taskName}'s agent:`,lines(t("note",1e3),1e3),"A running agent reads it when it next checks for notes; otherwise the next attempt does. Scope stays the same.");case"repair":{const blocker=t("blockerTitle",120)||t("blocker",64),operation=t("operation",16),headline=operation==="retry"?`Queue ${blocker} again; ${taskName} follows when it finishes.`:operation==="unlink"?`Let ${taskName} continue without ${blocker}.`:`Make ${taskName} wait for ${t("replacementTitle",120)||t("replacement",64)} instead of ${blocker}.`;return card(headline)}case"agents":{const parts=[...t("risk")===""?[]:[`risk ${t("risk",32)}`],...t("role")===""?[]:[payload.clear===!0?`${t("role",32)}: back to the recommendation`:`${t("role",32)}: ${t("provider",40)} ${t("model",80)}`]];return card(`Change agents for ${taskName}: ${parts.join("; ")}`,[],"Changing agents or risk needs renewed approval before work starts.")}case"scope":return card(`Rewrite the scope of ${taskName}:`,[`Goal: ${t("goal",600)}`,...t("not")===""?[]:[`Not: ${t("not",300)}`]],"After confirming, the new scope still needs your approval before work starts.");case"answer":{const id=typeof payload.decision=="number"?payload.decision:null,decision=id===null?null:store.getDecision(id);if(decision?.supersededReason!=null)return{text:closedQuestionWords(decision.supersededReason),buttons:!1,closed:!0};const pick=t("option",64),irreversible=payload.reversible===!1,body=decision===null?["(the decision is gone)"]:[`Q: ${phoneText(decision.question,400)}`,...decision.options.map(one=>`${one.id===pick?"→":" "} ${phoneText(one.label,120)}${one.reversible?"":lasting}${one.id===decision.recommendation?" (the builder recommends this)":""}: ${phoneText(one.consequence,300)}`),...t("rationale")===""?[]:[`Why: ${t("rationale",300)}`]];return card(`Answer decision #${String(id??"?")} on ${taskName} with "${t("optionLabel",120)||pick}"`,body,irreversible?phone?"⚠ This choice can't be undone. Confirming asks you once more.":"⚠ This choice is irreversible. Confirming asks you once more.":null)}case"task_action":{const operation=payload.operation,action=isChatTaskAction(operation)?CHAT_TASK_ACTIONS[operation]:null,dependency=t("dependencyTitle",120)||t("dependency",64);return action===null?handoff(`An unavailable action was proposed for ${taskName}.`):card(`${action.label}: ${taskName}${dependency===""?"":` · ${dependency}`}`,[action.detail],null)}case"review":{const revise=payload.operation==="revise",snapshot=payload.snapshot,selected=Array.isArray(payload.notes)?payload.notes:[],saved=(snapshot?.notes??[]).filter(one=>selected.includes(one.id)),note=t("note",LIMITS.note),image=parseFeedbackImage(payload.image),path=t("path",300);return card(`${revise?"Request changes to":"Save feedback on"} result #${String(payload.run??"?")} of ${taskName}`,[...note===""?[]:[`Your feedback${path===""?"":` (${path}${typeof payload.line=="number"?`:${payload.line}`:""})`}:`,...image?[`Screenshot ${image.artifact} · result #${image.run}`]:[],...lines(note,LIMITS.note)],...saved.length===0?[]:["Saved notes included:",...saved.map(one=>`• ${one.image?`Screenshot ${one.image.artifact} · result #${one.image.run}: `:""}${one.path===null?"":`${phoneText(one.path,120)}${one.line===null?"":`:${one.line}`}: `}${phoneText(one.note,LIMITS.note)}`)]],revise?"Creates a revision of the same task. Its approval follows your settings.":"Saves feedback; no work starts.")}case"cancel":return handoff(`Cancel ${taskName}: ${t("reason",300)}`,["Cancelling is armed on the task itself, never from a card."]);case"control":{if(isCardProposal(proposal))return handoff(cardPlainOf(proposal));const control=payload.control,label=isChatControl(control)?CHAT_CONTROLS[control].label:"A console control";return handoff(`${label}${taskName===""?"":` for ${taskName}`}`,["This opens an existing control; nothing changes from here."])}default:return handoff("This kind of proposal cannot be confirmed from the phone.")}}export function proposalOutcomeText(proposal){const outcome=proposal.outcome,said=outcome!==null&&typeof outcome.said=="string"?phoneText(outcome.said,600):"",via=outcome!==null&&typeof outcome.via=="string"?` (from ${outcome.via})`:"";switch(proposal.state){case"confirmed":return`✓ Done${via}${said===""?"":`: ${said}`}`;case"refused":return`✗ Not done${via}${said===""?"":`: ${said}`}`;case"dismissed":return"Dismissed.";case"expired":return"This card expired.";case"confirming":return"Being confirmed elsewhere right now.";default:return"Still waiting for your confirmation."}}export const CHAT_ACTION_PARITY={get_brief:{support:"direct",how:"Reads current tasks, decisions, results and project knowledge from the local database through the shared engine, within the enrolled projects.",gap:"Dedicated Telegram and Slack journeys for this tool and live channel rendering remain unverified."},get_project_activity:{support:"direct",how:"Reads the project's Ready backlog, finished-to-decision elapsed time, explicit revisions and recorded cost for completed families in an accessible enrolled project through the shared engine.",gap:"Dedicated Telegram and Slack journeys for this tool and live channel rendering remain unverified."},get_project_context:{support:"direct",how:"Reads bounded source excerpts or advisory import impact in an accessible enrolled project through the shared engine, with source-search fallback when its index is unavailable.",gap:"Index refresh uses the local CLI. Dedicated Telegram and Slack journeys for this tool and live channel rendering remain unverified."},get_code_map:{support:"direct",how:"Reads the project's generated code map through the shared reader, one labelled answer at most 6 KB, paging one pinned version.",gap:null},refresh_code_map:{support:"direct",how:"Queues a check of the project's main, as Check now does on the page.",gap:null},get_action_status:{support:"direct",how:"Reads the exact saved shared action and its outcome, including completion through secure review.",gap:null},get_actions:{support:"direct",how:"Lists the shared action catalogue and required inputs.",gap:null},propose_action:{support:"direct",how:"Prepares exact shared skill, knowledge, approval, acceptance, cancel and resume actions (the separate review request was removed on 2026-09-21). Short ordinary changes confirm here; protected or long changes use one secure review and record the result on the same proposal.",gap:"Secure review requires a working HTTPS console connection. Real transport verification is required."},recap:{support:"direct",how:"Read by the model during a phone turn over the enrolled ceiling.",gap:null},find_tools:{support:"direct",how:"Searches the lead's own other tools by what it wants to do; what it finds is offered to it from its next step in the same reply. Same on every channel: the shared engine runs it.",gap:null},list_repos:{support:"direct",how:"Read during a turn; projects are r1..rN in enrollment order, as on the console.",gap:null},get_skills:{support:"direct",how:"Reads the same project skill library, saved selections and enabled versions as the console. Use propose_action for changes and tests.",gap:"Skill import and long content require secure review. Folder and GitHub import still use the project Skills screen."},get_project_knowledge:{support:"direct",how:"Read during a turn.",gap:null},get_flaky_tests:{support:"direct",how:"Read during a turn: a project's tests with mixed outcomes, each with the task that would fix it. Fixing one is an ordinary task card.",gap:null},get_models:{support:"direct",how:"Read during a turn: default agents with the exact model each runs, CLI versions and new models. Changes use the labelled Settings → Models page.",gap:null},get_diff:{support:"direct",how:"Read during a turn: the exact result's changed files, then one file's diff, so a requested change names the right file and line.",gap:null},get_check_log:{support:"direct",how:"Read during a turn: the end of the exact result's check log, a page of it, or the lines matching a search.",gap:null},get_project_tools:{support:"direct",how:"Read during a turn: a project's tools, the common tools list and servers found on the computer. Adding one is a secure-review card; secrets are set only on the console's Tools page.",gap:null},get_task_conversation:{support:"direct",how:"Read during a turn: what the person and the lead said in one task's own chat, including what was confirmed there.",gap:null},get_attachment:{support:"direct",how:"Read during a turn: a file the person attached to a message in this conversation (from the iPhone), its text 32 KB at a time; a PDF's own text decoded.",gap:"Attaching files is on the iPhone app; a chat app's own attachments aren't read."},get_flows:{support:"direct",how:"Read during a turn: a person's flows, each one's steps in order and its cards — where each card is, what it waits on, whether it needs them, its owner and its discussion.",gap:null},get_subagents:{support:"direct",how:"Read during a turn: the project's subagents, their soul files, the zones they work, what they did today and the questions they're waiting on.",gap:null},propose_subagent:{support:"direct",how:"Asks a subagent to do something for you (the lead delegates; its answer comes back here), adds one from a template or a soul file, changes one section of its soul file (or the whole short file), pauses, resumes or removes it, passes it a note, or answers its question for the person asked, through the shared confirm door.",gap:"Soul files longer than one message are edited on the console's subagent page; the phone changes one section at a time."},get_flow_insights:{support:"direct",how:"Read during a turn: where each flow's cards pass, fail or are sent back, how long they wait, how its scripts did, and a run's log.",gap:null},propose_flow:{support:"direct",how:"Creates or changes a flow, adds, moves, approves, sends back or cancels its cards, comments on them (@name pings that person), sets their owner, follows them, saves the project's scripts, and adds, pauses or removes its triggers, through the shared confirm door; a long drawing opens the secure review. Work a card files is an ordinary task under the usual approvals.",gap:"The flow canvas itself is on the console; the phone confirms cards but draws nothing. Webhook addresses and the Linear key are set on the console's Triggers panel."},commit_to:{support:"direct",how:"Records what the lead promised to follow up on (a task, attempt, check or time; 7 days at most). The follow pass says one line when it is met, in the shared conversation and on the chat the promise was made on.",gap:null},release_commitment:{support:"direct",how:"Stops following up on one of the person's open promises, with the reason.",gap:null},remember:{support:"direct",how:"Proposes a correction or lasting preference as a decision, project instruction or about-you card, through the shared confirm door; an about-you card shows the line it replaces.",gap:null},manage_standing_directions:{support:"direct",how:"Runs during a turn: lists Standing Directions, or adds one turned off, in the same store Settings → Standing directions edits, where the person turns it on, off or removes it; a project direction names one of the person's admitted projects.",gap:null},get_person:{support:"direct",how:"Read during a turn: one person, subagent or team chat in full, with their open tasks.",gap:null},get_integrations:{support:"direct",how:"Read during a turn: which chat apps, email, GitHub, project tools and monitoring are Connected, Not set up or Broken, as Settings → Integrations shows them.",gap:null},get_capabilities:{support:"direct",how:"Read during a turn: which agents are signed in, which workers are online, which tools and skills work, which integrations are connected and what checks the project runs, each with its next step and settings link.",gap:null},ask_owner:{support:"direct",how:"One question with 2-4 options and Something else, drawn as buttons under the reply; the tapped option is sent as the person's next message.",gap:null},search_project_memory:{support:"direct",how:"Read during a turn: one search over decisions, references, lessons and the conversations the person may read.",gap:null},list_tasks:{support:"direct",how:"Read during a turn.",gap:null},tidy_preview:{support:"direct",how:"Read during a turn: what Put away old tasks would put away now and why. Only a person puts tasks away, on the console or with the CLI command it names.",gap:null},get_task:{support:"direct",how:"Read during a turn; a reply to a result message pins the exact execution.",gap:null},get_agents:{support:"direct",how:"Read during a turn.",gap:null},list_decisions:{support:"direct",how:"Read during a turn.",gap:null},get_decision:{support:"direct",how:"Read during a turn.",gap:null},queue:{support:"direct",how:"Read during a turn.",gap:null},get_result:{support:"direct",how:"Read during a turn; the phone card shows the verification verdict, never a local link.",gap:"Secure remote evidence links are not delivered to the phone; a result's screenshots travel through get_result_images."},get_result_images:{support:"direct",how:"Read during a turn; every verified original PNG/JPEG the turn selected (at most 8 per reply, the rest by offset or image id) is sent as a document with a short safe caption after the reply, re-verified before each upload, and a reply to an image binds that exact task and run.",gap:"An image whose record or bytes fail verification, or one Telegram refuses, is named in the chat rather than sent, through the same durable retried part; the operator opens the exact result in the console. Fixture proof only, no physical-phone rendering."},get_controls:{support:"direct",how:"Read during a turn.",gap:null},get_acceptance_evidence:{support:"direct",how:"Shared read-only acceptance packet: exact result, criterion states, gate, reviewer findings, caveats and recorded human acceptance. Screenshot files use get_result_images; marking complete is a propose_action result_accept confirmed behind the phone's own yes/cancel challenge or on the signed-in console.",gap:"A physical-phone completion has not been exercised."},offer_approval:{support:"direct",how:"Pushes the plan's or flow card's own decision card to the owner's paired chat: Approve arms Yes and Cancel, and only the owner's Yes decides, through sealScopeApproval (as a chat-origin approval) or decideFlowCard. Outside the owner's chat-approval setting or a decision's rules it answers why, and the lead opens the console control.",gap:"A flow card's Send back, Edit and a Person chooses step act from the pushed card; a plan's Send back stays in the console. Fixture proof only, no physical-phone rendering."},get_findings:{support:"direct",how:"Read during a turn; a finding's words are shown as untrusted text.",gap:null},show_card:{support:"direct",how:"A card of Toolroll's own records. Telegram shows it as one message: key facts as lines, tables and charts as monospaced text, its links as url buttons.",gap:"A chart is bars of text on Telegram, with every number written out."},show_control:{support:"handoff",how:"The card names the control and the task, with one url button to that exact console control when a trusted https console-url is configured; the button opens the signed-in console and acts on nothing.",gap:"Incomplete phone action: the control itself runs in the console, after sign-in."},propose_task:{support:"direct",how:"Card with Confirm/Dismiss through confirmLeadProposal (filed as a lead proposal, via telegram). The confirmed card links Review & start for the filed task while its scope waits; under a signed automatic mode it says the scope is approved and links the task.",gap:"Under manual approval the plan then needs the person's own yes, on its card."},propose_start:{support:"direct",how:"A protected shared action (task_start): Start work arms Yes and Cancel, and the person's own Yes files and approves one small task under the fast start rules (fastStartBuild), or a typed yes as a reply to the card or as the very next message. When Toolroll can't start it right away it is an ordinary task card.",gap:"Terms too long for one message open the review page, in the signed-in console."},propose_sweep:{support:"direct",how:"A protected shared action (sweep_file): the card lists every item, the shared rules and the success test; confirming files them all and approves each scope.",gap:"Terms too long for one message open the review page, in the signed-in console."},get_sweep:{support:"direct",how:"Reads a sweep's table (each item's state, verdict and result) from the local database through the shared engine.",gap:null},propose_sweep_cancel:{support:"direct",how:"An ordinary shared action (sweep_cancel_rest): Confirm cancels every item not yet ready; finished results stay.",gap:null},propose_scope:{support:"direct",how:"Confirm rewrites the scope through the shared door; the confirmed card links Review & start for the exact task.",gap:"Approving the rewritten scope is a separate yes, on its own card."},propose_next:{support:"direct",how:"Confirm through the shared door with the queue revision it saw.",gap:null},propose_reserve:{support:"direct",how:"Confirm through the shared door.",gap:null},propose_agents:{support:"direct",how:"Confirm through the shared route-edit door; when the change stales the approval, the confirmed card links Review & start for the exact task.",gap:"Renewed approval after the route change happens in the console."},propose_hold:{support:"direct",how:"Confirm through the shared door.",gap:null},propose_unhold:{support:"direct",how:"Confirm through the shared door.",gap:null},propose_steer:{support:"direct",how:"Confirm through the shared door; the guidance is shown verbatim on the card.",gap:null},propose_dependency_repair:{support:"direct",how:"Confirm retry/unlink/replace through the shared door with both projects re-checked.",gap:null},propose_task_action:{support:"direct",how:"stop, retry, plan, wait_for and stop_waiting confirm through the shared door (a stop is audited via telegram); resume, on a person's own tap, lifts the stop.",gap:null},propose_answer:{support:"direct",how:"Confirm answers through the shared door, audited via telegram; an irreversible option arms a second tap first.",gap:null},propose_review:{support:"direct",how:"note saves feedback; revise creates the same-family revision through the shared result service, honouring automatic approval settings; the confirmed card links Review & start for the revision while it waits, or the task once approved.",gap:"Under manual approval the revision is approved in the console, reached from the card's button; under a signed automatic-approval mode it runs unattended."},propose_cancel:{support:"handoff",how:"The door refuses cancel from any card; the card links the exact task's Cancel control when a trusted https console-url is configured, and the cancel is armed there.",gap:"Incomplete phone action: no phone path to cancel by design; the button only opens the task."},toolroll_view_read:{support:"missing",how:"Refused on the phone by design: the workbench's look is the person's own conversation in the console on this computer (view-tools.ts); the tool answers in words and nothing is read or written.",gap:"No phone path by design: restyle from the console on this computer, or edit tui.toml."},toolroll_view_set:{support:"missing",how:"Refused on the phone by design: the workbench's look is the person's own conversation in the console on this computer (view-tools.ts); the tool answers in words and nothing is read or written.",gap:"No phone path by design: restyle from the console on this computer, or edit tui.toml."},list_direct_chats:{support:"direct",how:"Read during a turn: lists active Direct Chat threads in admitted projects with model, effort, status, and token usage.",gap:null},get_direct_chat:{support:"direct",how:"Read during a turn: reads one Direct Chat's full turn transcript, tool history, and token usage from SQLite.",gap:null},get_direct_chat_diff:{support:"direct",how:"Read during a turn: inspects a Direct Chat's changed files, bounded patch, and Ship readiness.",gap:null},manage_direct_chat:{support:"missing",how:"Refused on the phone by design: instant Direct Chat controls require the owner's local solo console session on this computer.",gap:"No phone path by design: stop, rename, switch model, or archive Direct Chats from the local Mac app or console."},get_usage_limits:{support:"direct",how:"Read during a turn: reports live Claude, Codex, and Gemini subscription windows and monthly spend budgets.",gap:null},get_recent_updates:{support:"direct",how:"Read during a turn: aggregates Ready results, completions, failures, updated Direct Chats, open decisions, and recent actions.",gap:null},propose_direct_chat:{support:"handoff",how:"Drafts a confirmation card to start, reply to, or promote a Direct Chat; promote files a Task on confirm while start and reply execute only on the local solo console.",gap:"Incomplete phone action: starting or replying to a local Direct Chat clone runs in the local console or Mac app."},propose_report_followups:{support:"direct",how:"Batch-drafts standard Task confirmation cards from a verified Scout Report's follow-up recommendations through the shared door.",gap:null},shared_browser:{support:"missing",how:"Refused on the phone by design: the Shared Browser is driven only from the person's own conversation in the console on this computer; a phone turn has no browser to drive, so the tool answers in words and nothing opens.",gap:"No phone path by design: open the Shared Browser from the Mac app (⌘⇧B) or the console on this computer, and sign in there when it asks for a takeover."},handoff_task:{support:"direct",how:"Drafts a hand-off card for an existing task through the shared confirm door; confirming moves its live branch and worktree, uncommitted changes and a bounded Handoff Packet included, to the chosen agent.",gap:null},orchestrate_workflow:{support:"direct",how:"Drafts one card for a 2 to 8 stage workflow, each stage naming its agent, through the shared confirm door; confirming files every stage as a task routed to its agent (a sequential stage waits on the one before), and building still follows the approval policy.",gap:null}};export function parityGaps(){return LEAD_TOOL_SCHEMAS.map(tool=>tool.name).filter(name=>CHAT_ACTION_PARITY[name]===void 0)}export function handoffCardText(text,note){return note===null?text:`${text}
|
|
17
17
|
|
|
18
18
|
${note}`}export function confirmedCardText(store,outcome,proposal,note){const said=phoneText(outcome.said,600);if(!outcome.ok)return`✗ Not done: ${said}`;const taskId=outcome.taskId,resume=proposal.kind==="task_action"&&proposal.payload.operation==="resume",revise=proposal.kind==="review"&&proposal.payload.operation==="revise";if(!(proposal.kind==="task"||proposal.kind==="scope"||proposal.kind==="agents"||resume||revise)||taskId===null)return`✓ ${said}`;const state=approvalState(store,taskId),approval=state==="waiting",words=proposal.kind==="task"&&state==="approved"?`${said.split(/ — |\. /)[0]} — approved under your automatic approval settings; nothing more is needed from you.`:revise&&state==="approved"?"Revision created under your automatic approval settings.":said,next=resume&&said.startsWith("Resume requested")?"Nothing has resumed yet: finish it on the task.":approval&¬e!==null?"Approve it in Toolroll on the computer.":"",setup=(approval||resume)&¬e!==null?note:"";return[`✓ ${words}`,...[next,setup].filter(one=>one!=="")].join(`
|
|
19
19
|
|
package/dist/chat-review.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{selectResultImages}from"./chat-evidence.js";import{readVerifiedArtifact}from"./evidence.js";import{hasForbiddenControls,validateNote}from"./decision.js";import{parseFeedbackImage,isRevisionFeedback,revisionSourceOf}from"./result-review.js";import{createResultRevision,feedbackImageProblem}from"./result-actions.js";export function readChatResult(store,who,evidenceRoot,task,run){const ref=store.lookupRef(task);if(ref?.repo==null||!who.repos.includes(ref.repo))return{ok:!1,message:"That task is not in your projects."};const family=store.taskFamilyOf(task,who.repos,!1);if(family===null||family.problem!==null)return{ok:!1,message:"This task's revision history needs repair."};const found=run===void 0?store.runsFor(ref.id).find(one=>(one.role==="builder"||one.role==="repair")&&one.outcome!==null):store.getRun(run);if(found==null||found.taskRef!==ref.id||found.outcome===null)return{ok:!1,message:"There is no finished result for that version yet."};const artifact=store.artifactsFor(found.id).find(one=>one.kind==="terminal-diff");if(artifact===void 0||evidenceRoot===void 0)return{ok:!1,message:"The saved changes are unavailable. Feedback has not been added."};if(!readVerifiedArtifact(evidenceRoot,artifact).ok)return{ok:!1,message:"The saved changes could not be verified. Restore the result before adding feedback."};const images=selectResultImages(store,who,evidenceRoot,task,found.id);return{ok:!0,snapshot:{task,root:family.root.id,execution:family.current.id,run:found.id,artifact:artifact.id,sha:artifact.sha256,source:revisionSourceOf(store.getScope(task)?.digest??null),title:store.getTask(task)?.title??task,images:images.ok?images.selection.images.map(one=>({run:found.id,artifact:one.artifact,sha256:one.sha256})):[],notes:store.liveDiffComments(found.id).filter(isRevisionFeedback).map(one=>({id:one.id,note:one.note,path:one.path,line:one.line,image:one.image??null}))}}}export function reviewInputProblem(note,path,line){if(note!==null){const valid=validateNote(note);if(!valid.ok)return valid.problem}return path!==null&&(path.length>300||path.trim()===""||hasForbiddenControls(path))?"Choose a valid file path.":line!==null&&(path===null||!Number.isInteger(line)||line<1||line>1e6)?"Choose a file and a valid line number.":note===null&&(path!==null||line!==null)?"Write a note before attaching it to a file.":null}export function applyChatReview(store,who,evidenceRoot,request,now,allowMode,origin){try{return store.transact(()=>store.savepoint(()=>{const fail=message=>{throw new ReviewRefusal(message)},{snapshot:saw,operation,note,path,line,notes}=request,problem=reviewInputProblem(note,path,line);if(problem!==null)return fail(problem);const current=readChatResult(store,who,evidenceRoot,saw.task,saw.run);if(!current.ok)return fail(current.message);const live=current.snapshot;if(live.execution!==saw.execution||live.source!==saw.source||live.artifact!==saw.artifact||live.sha!==saw.sha)return fail("This result changed. Review it again before confirming.");if(operation==="revise"&&saw.execution!==saw.task)return fail("A newer revision is current. Review that version before requesting changes.");if(!Array.isArray(notes)||new Set(notes).size!==notes.length||notes.some(id=>!saw.notes.some(n=>n.id===id)||!live.notes.some(n=>n.id===id)))return fail("Some feedback changed or was already used. Review it again.");if(operation==="note"&&(note===null||notes.length>0))return fail("A saved note needs feedback text and cannot consume other notes.");const image=parseFeedbackImage(request.image);if(image===!1||image!==null&¬e===null)return fail("Choose a screenshot and write its feedback again.");const imageProblem=feedbackImageProblem(store,evidenceRoot,live.run,image);if(imageProblem!==null)return fail(imageProblem);const batch=[...notes].sort((a,b)=>a-b);if(note!==null){const id=store.addDiffComment({artifactId:live.artifact,runId:live.run,path,line,note,author:who.name,image},now);if(id===null)return fail("The note could not be saved.");batch.push(id)}if(operation==="note")return{ok:!0,taskId:live.root,run:live.run,said:"Feedback saved. No work started."};if(batch.length===0)return fail("Add feedback or select saved notes before requesting changes.");const result=createResultRevision(store,evidenceRoot,{run:live.run,batch:batch.join(","),source:live.source,actor:who.name,repos:who.repos,allowMode,origin},now);if(!result.ok)return fail(result.message);const scope=store.getScope(result.id),approved=scope?.approvedDigest!=null&&scope.approvedDigest===scope.digest,planning=store.lookupRef(result.id)?.plan==="requested";return{ok:!0,taskId:result.id,run:live.run,said:approved?"Revision created under your automatic approval settings.":planning?"Revision created. Updating the plan with your notes; you'll approve it next.":"Revision created. Review and approve it to start."}}))}catch(error){if(error instanceof ReviewRefusal)return{ok:!1,message:error.message};throw error}}class ReviewRefusal extends Error{}
|
|
1
|
+
import{revisionApproval}from"./server/send-back-build.js";import{selectResultImages}from"./chat-evidence.js";import{readVerifiedArtifact}from"./evidence.js";import{hasForbiddenControls,validateNote}from"./decision.js";import{parseFeedbackImage,isRevisionFeedback,revisionSourceOf}from"./result-review.js";import{createResultRevision,feedbackImageProblem}from"./result-actions.js";export function readChatResult(store,who,evidenceRoot,task,run){const ref=store.lookupRef(task);if(ref?.repo==null||!who.repos.includes(ref.repo))return{ok:!1,message:"That task is not in your projects."};const family=store.taskFamilyOf(task,who.repos,!1);if(family===null||family.problem!==null)return{ok:!1,message:"This task's revision history needs repair."};const found=run===void 0?store.runsFor(ref.id).find(one=>(one.role==="builder"||one.role==="repair")&&one.outcome!==null):store.getRun(run);if(found==null||found.taskRef!==ref.id||found.outcome===null)return{ok:!1,message:"There is no finished result for that version yet."};const artifact=store.artifactsFor(found.id).find(one=>one.kind==="terminal-diff");if(artifact===void 0||evidenceRoot===void 0)return{ok:!1,message:"The saved changes are unavailable. Feedback has not been added."};if(!readVerifiedArtifact(evidenceRoot,artifact).ok)return{ok:!1,message:"The saved changes could not be verified. Restore the result before adding feedback."};const images=selectResultImages(store,who,evidenceRoot,task,found.id);return{ok:!0,snapshot:{task,root:family.root.id,execution:family.current.id,run:found.id,artifact:artifact.id,sha:artifact.sha256,source:revisionSourceOf(store.getScope(task)?.digest??null),title:store.getTask(task)?.title??task,images:images.ok?images.selection.images.map(one=>({run:found.id,artifact:one.artifact,sha256:one.sha256})):[],notes:store.liveDiffComments(found.id).filter(isRevisionFeedback).map(one=>({id:one.id,note:one.note,path:one.path,line:one.line,image:one.image??null}))}}}export function reviewInputProblem(note,path,line){if(note!==null){const valid=validateNote(note);if(!valid.ok)return valid.problem}return path!==null&&(path.length>300||path.trim()===""||hasForbiddenControls(path))?"Choose a valid file path.":line!==null&&(path===null||!Number.isInteger(line)||line<1||line>1e6)?"Choose a file and a valid line number.":note===null&&(path!==null||line!==null)?"Write a note before attaching it to a file.":null}export function applyChatReview(store,who,evidenceRoot,request,now,allowMode,origin){try{return store.transact(()=>store.savepoint(()=>{const fail=message=>{throw new ReviewRefusal(message)},{snapshot:saw,operation,note,path,line,notes}=request,problem=reviewInputProblem(note,path,line);if(problem!==null)return fail(problem);const current=readChatResult(store,who,evidenceRoot,saw.task,saw.run);if(!current.ok)return fail(current.message);const live=current.snapshot;if(live.execution!==saw.execution||live.source!==saw.source||live.artifact!==saw.artifact||live.sha!==saw.sha)return fail("This result changed. Review it again before confirming.");if(operation==="revise"&&saw.execution!==saw.task)return fail("A newer revision is current. Review that version before requesting changes.");if(!Array.isArray(notes)||new Set(notes).size!==notes.length||notes.some(id=>!saw.notes.some(n=>n.id===id)||!live.notes.some(n=>n.id===id)))return fail("Some feedback changed or was already used. Review it again.");if(operation==="note"&&(note===null||notes.length>0))return fail("A saved note needs feedback text and cannot consume other notes.");const image=parseFeedbackImage(request.image);if(image===!1||image!==null&¬e===null)return fail("Choose a screenshot and write its feedback again.");const imageProblem=feedbackImageProblem(store,evidenceRoot,live.run,image);if(imageProblem!==null)return fail(imageProblem);const batch=[...notes].sort((a,b)=>a-b);if(note!==null){const id=store.addDiffComment({artifactId:live.artifact,runId:live.run,path,line,note,author:who.name,image},now);if(id===null)return fail("The note could not be saved.");batch.push(id)}if(operation==="note")return{ok:!0,taskId:live.root,run:live.run,said:"Feedback saved. No work started."};if(batch.length===0)return fail("Add feedback or select saved notes before requesting changes.");const approveNow=request.approveNow===!0&&origin==="person"?revisionApproval(store,who.name,now):void 0,result=createResultRevision(store,evidenceRoot,{...approveNow===void 0?{}:{approveNow,currentResult:()=>{const current2=readChatResult(store,who,evidenceRoot,saw.task);return current2.ok&¤t2.snapshot.execution===saw.execution&¤t2.snapshot.run===saw.run?null:"A newer result is current. Review it before sending back."}},run:live.run,batch:batch.join(","),source:live.source,actor:who.name,repos:who.repos,allowMode,origin},now);if(!result.ok)return fail(result.message);const scope=store.getScope(result.id),approved=scope?.approvedDigest!=null&&scope.approvedDigest===scope.digest,planning=store.lookupRef(result.id)?.plan==="requested";return{ok:!0,taskId:result.id,run:live.run,said:approved?scope?.approvalBasis==="mode"?"Revision created under your automatic approval settings.":"Revision created and approved. It builds next.":planning?"Revision created. Updating the plan with your notes; you'll approve it next.":"Revision created. Review and approve it to start."}}))}catch(error){if(error instanceof ReviewRefusal)return{ok:!1,message:error.message};throw error}}class ReviewRefusal extends Error{}
|
package/dist/chat-terms.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createHash}from"node:crypto";import{
|
|
2
|
-
`)}export function shownTermsDigest(scope){return createHash("sha256").update(JSON.stringify({v:1,scope:scope.digest,shown:scopeTermsText(scope)})).digest("hex")}export function cardTermsDigest(terms){return createHash("sha256").update(JSON.stringify({v:2,shown:terms})).digest("hex")}export function cardShowsScope(scope,terms){if(!terms.includes(scopeTermsText(scope)))return!1;const profile=scope.profile;if(profile==null)return!0;const access=profile.checkAccess,mach=sandboxTermsWords(profile).mach;return(access===void 0||terms.includes(checkAccessWords(access)))&&(mach===null||terms.includes(mach))}export function scopeFullAccess(profile){return profile==null?!1:profile.provider==="claude"?profile.permissionArgv==="bypassPermissions":profile.provider==="gemini"?profile.approvalArgv==="yolo":
|
|
1
|
+
import{createHash}from"node:crypto";import{fullAccessProfile}from"./acp-agents.js";import{checkAccessWords}from"./check-access.js";import{sandboxTermsWords}from"./project-sandbox.js";import{chainTermsLines}from"./scope.js";export function permissionPlainWords(profile){if(profile==null)return null;const full="full access, nothing asks first";return profile.provider==="claude"?profile.permissionArgv==="bypassPermissions"?full:profile.permissionArgv==="auto"?"file edits and routine commands; anything risky stops":"file edits only; commands are refused":profile.provider==="gemini"?profile.approvalArgv==="yolo"?full:"file edits only; other tools are refused":fullAccessProfile(profile)?"full access inside the OS fence, nothing asks first":profile.sandboxMode==="danger-full-access"?full:"file edits and commands inside the project only"}const money=micro=>`$${(micro/1e6).toFixed(2)}`;export function scopeTermsText(scope){const allows=[permissionPlainWords(scope.profile)??"agent permissions not known",scope.budgetMicrousd===null?"no attempt limit":`up to ${money(scope.budgetMicrousd)} per attempt`];return["Goal:",scope.goal,"","Not this:",scope.outOfScope??"Nothing excluded.","",`Files: ${scope.touches.length===0?"any file (no file list)":scope.touches.join(", ")}`,"","Done when:",...scope.acceptance.length===0?["You decide when you review the result."]:scope.acceptance.map(one=>`• ${one.statement} (${one.evidence.join(", ")})`),"",`Starting allows: ${allows.join(" · ")}`,...(chain=>chain.length===0?[]:["","Fallback agents:",...chain])(chainTermsLines(scope))].join(`
|
|
2
|
+
`)}export function shownTermsDigest(scope){return createHash("sha256").update(JSON.stringify({v:1,scope:scope.digest,shown:scopeTermsText(scope)})).digest("hex")}export function cardTermsDigest(terms){return createHash("sha256").update(JSON.stringify({v:2,shown:terms})).digest("hex")}export function cardShowsScope(scope,terms){if(!terms.includes(scopeTermsText(scope)))return!1;const profile=scope.profile;if(profile==null)return!0;const access=profile.checkAccess,mach=sandboxTermsWords(profile).mach;return(access===void 0||terms.includes(checkAccessWords(access)))&&(mach===null||terms.includes(mach))}export function scopeFullAccess(profile){return profile==null?!1:profile.provider==="claude"?profile.permissionArgv==="bypassPermissions":profile.provider==="gemini"?profile.approvalArgv==="yolo":fullAccessProfile(profile)?!0:profile.sandboxMode==="danger-full-access"}export function chatLimitProblem(scope,limits,yours){if(scopeFullAccess(scope.profile)&&!limits.fullAccess)return`This plan asks for more access than ${yours} allows.`;const cap=limits.capMicrousd;return cap!==null&&(scope.budgetMicrousd===null||scope.budgetMicrousd>cap)?`This plan has ${scope.budgetMicrousd===null?"no attempt limit":`a ${money(scope.budgetMicrousd)} attempt limit`}, more than ${yours==="your mode"?"your mode's":"your chat approval limit of"} ${money(cap)}.`:null}export function shownAsWritten(text,channel){switch(channel){case"telegram":case"discord":return!0;case"slack":return!/:[\p{L}\p{N}_+'-]+:/u.test(text);case"teams":return!1}}
|
package/dist/check-levels.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync,readFileSync}from"node:fs";import{join}from"node:path";import{folderAnswers}from"./folder-gate.js";import{approvalOf}from"./scope.js";export const CHECK_LEVELS=["quick","full","off"],isCheckLevel=value=>typeof value=="string"&&CHECK_LEVELS.includes(value),CHECK_LEVEL_WORDS={quick:"Quick",full:"Full",off:"Off"},CHECK_LEVEL_HINTS={quick:"A fast check while building: typecheck and the tests near the change.",full:"The project's full check after every build.",off:"No check. Results are Ready, and say no check ran."};const PROJECT_LEVEL_ACTION="check level changed";export const TASK_LEVEL_ACTION="task checks chosen",RUN_LEVEL_ACTION="checks used",quickVerifyKey=repo=>`quick:${repo}`;export function liveQuickCommand(store,repo){return store.liveVerifyCommand(quickVerifyKey(repo))}export function projectCheckSet(store,repo){return store.liveVerifyCommand(repo)!==null||liveQuickCommand(store,repo)!==null}export const repoClause=repo=>repo===null?["repo IS NULL",[]]:["repo = ?",[repo]];export function repoOfRun(store,runId){const run=store.getRun(runId);return run===null?null:store.refById(run.taskRef)?.repo??null}function newest(store,sql,...params){const row=store.handle.prepare(sql).get(...params);return row===void 0?null:{actor:String(row.actor),at:String(row.at),outcome:String(row.outcome)}}export function projectCheckLevel(store,repo){const row=newest(store,"SELECT actor, at, outcome FROM action_ledger WHERE repo = ? AND task_id IS NULL AND action = ? ORDER BY id DESC LIMIT 1",repo,PROJECT_LEVEL_ACTION);return row===null||!isCheckLevel(row.outcome)?{level:"full",setBy:null,at:null}:{level:row.outcome,setBy:row.actor,at:row.at}}export function setProjectCheckLevel(store,repo,level,by,now){const before=projectCheckLevel(store,repo);return before.level===level&&before.setBy!==null?{changed:!1,before:before.level}:(store.recordAction({at:now.toISOString(),actor:by,repo,taskId:null,runId:null,action:PROJECT_LEVEL_ACTION,outcome:level,source:"policy",detail:`${CHECK_LEVEL_WORDS[before.level]} → ${CHECK_LEVEL_WORDS[level]}`}),{changed:before.level!==level,before:before.level})}export function stampNewProjectLevel(store,repo,now){return newest(store,"SELECT actor, at, outcome FROM action_ledger WHERE repo = ? AND task_id IS NULL AND action = ? LIMIT 1",repo,PROJECT_LEVEL_ACTION)!==null||store.handle.prepare("SELECT 1 FROM verify_command WHERE repo = ? LIMIT 1").get(repo)!==void 0?!1:(store.recordAction({at:now.toISOString(),actor:"system",repo,taskId:null,runId:null,action:PROJECT_LEVEL_ACTION,outcome:"quick",source:"policy",detail:"New project → Quick"}),!0)}export function taskCheckLevel(store,taskId){let id=taskId;for(let depth=0;id!==null&&depth<64;depth++){const ref=store.lookupRef(id),[where,params]=repoClause(ref?.repo??null),row=newest(store,`SELECT actor, at, outcome FROM action_ledger WHERE ${where} AND task_id = ? AND action = ? ORDER BY id DESC LIMIT 1`,...params,id,TASK_LEVEL_ACTION);if(row!==null&&isCheckLevel(row.outcome))return row.outcome;id=ref?.revisionOf??null}return null}export function setTaskCheckLevel(store,taskId,level,by,now){const ref=store.lookupRef(taskId);return ref===null?{ok:!1,message:`No task ${taskId}.`}:approvalOf(store.getScope(taskId)).approved?{ok:!1,message:"This task's plan is already approved, so its checks are fixed. File a new task to change them."}:taskCheckLevel(store,taskId)===level?{ok:!0}:(store.recordAction({at:now.toISOString(),actor:by,repo:ref.repo,taskId,runId:null,action:TASK_LEVEL_ACTION,outcome:level,source:"request",detail:`Checks for this task: ${CHECK_LEVEL_WORDS[level]}`}),{ok:!0})}export function effectiveCheckLevel(store,repo,taskId){const own=taskId===null?null:taskCheckLevel(store,taskId);return own!==null?{level:own,from:"task"}:{level:repo===null?"full":projectCheckLevel(store,repo).level,from:"project"}}export function checkCommandFor(store,repo,level){if(level==="off")return{level:"off",command:null};if(level==="quick"){const quick=liveQuickCommand(store,repo);if(quick!==null)return{level:"quick",command:quick}}return{level:"full",command:store.liveVerifyCommand(repo)}}export function requiredCheckCommandFor(store,repo,taskId,level){return repo===null?null:checkCommandFor(store,repo,level??effectiveCheckLevel(store,repo,taskId).level).command}export function recordRunCheckLevel(store,run,level,from,now){store.recordAction({at:now.toISOString(),actor:"system",repo:run.repo,taskId:run.taskId,runId:run.id,action:RUN_LEVEL_ACTION,outcome:level,source:"work",detail:`${CHECK_LEVEL_WORDS[level]} checks (${from==="task"?"this task's choice":"project setting"})`})}export function runCheckLevel(store,runId){const[where,params]=repoClause(repoOfRun(store,runId)),row=newest(store,`SELECT actor, at, outcome FROM action_ledger WHERE ${where} AND run_id = ? AND action = ? ORDER BY id DESC LIMIT 1`,...params,runId,RUN_LEVEL_ACTION);return row!==null&&isCheckLevel(row.outcome)?row.outcome:null}export function suggestQuickCommand(repo){if(!folderAnswers(repo))return null;const file=join(repo,"package.json");if(!existsSync(file))return null;let scripts={},deps={};try{const parsed=JSON.parse(readFileSync(file,"utf8"));scripts=parsed.scripts??{},deps={...parsed.dependencies,...parsed.devDependencies}}catch{return null}const has=name=>typeof scripts[name]=="string",runner=existsSync(join(repo,"pnpm-lock.yaml"))?"pnpm":existsSync(join(repo,"yarn.lock"))?"yarn":"npm",run=name=>runner==="npm"?`npm run ${name}`:`${runner} ${name}`;if(has("check:quick"))return run("check:quick");const exec=runner==="npm"?"npx":`${runner} exec`,typecheck=["typecheck","type-check","check-types","tsc"].find(has)??null,changed=
|
|
1
|
+
import{existsSync,readFileSync}from"node:fs";import{join}from"node:path";import{folderAnswers}from"./folder-gate.js";import{approvalOf}from"./scope.js";export const CHECK_LEVELS=["quick","full","off"],isCheckLevel=value=>typeof value=="string"&&CHECK_LEVELS.includes(value),CHECK_LEVEL_WORDS={quick:"Quick",full:"Full",off:"Off"},CHECK_LEVEL_HINTS={quick:"A fast check while building: typecheck and the tests near the change.",full:"The project's full check after every build.",off:"No check. Results are Ready, and say no check ran."};const PROJECT_LEVEL_ACTION="check level changed";export const TASK_LEVEL_ACTION="task checks chosen",RUN_LEVEL_ACTION="checks used",quickVerifyKey=repo=>`quick:${repo}`;export function liveQuickCommand(store,repo){return store.liveVerifyCommand(quickVerifyKey(repo))}export function projectCheckSet(store,repo){return store.liveVerifyCommand(repo)!==null||liveQuickCommand(store,repo)!==null}export const repoClause=repo=>repo===null?["repo IS NULL",[]]:["repo = ?",[repo]];export function repoOfRun(store,runId){const run=store.getRun(runId);return run===null?null:store.refById(run.taskRef)?.repo??null}function newest(store,sql,...params){const row=store.handle.prepare(sql).get(...params);return row===void 0?null:{actor:String(row.actor),at:String(row.at),outcome:String(row.outcome)}}export function projectCheckLevel(store,repo){const row=newest(store,"SELECT actor, at, outcome FROM action_ledger WHERE repo = ? AND task_id IS NULL AND action = ? ORDER BY id DESC LIMIT 1",repo,PROJECT_LEVEL_ACTION);return row===null||!isCheckLevel(row.outcome)?{level:"full",setBy:null,at:null}:{level:row.outcome,setBy:row.actor,at:row.at}}export function setProjectCheckLevel(store,repo,level,by,now){const before=projectCheckLevel(store,repo);return before.level===level&&before.setBy!==null?{changed:!1,before:before.level}:(store.recordAction({at:now.toISOString(),actor:by,repo,taskId:null,runId:null,action:PROJECT_LEVEL_ACTION,outcome:level,source:"policy",detail:`${CHECK_LEVEL_WORDS[before.level]} → ${CHECK_LEVEL_WORDS[level]}`}),{changed:before.level!==level,before:before.level})}export function stampNewProjectLevel(store,repo,now){return newest(store,"SELECT actor, at, outcome FROM action_ledger WHERE repo = ? AND task_id IS NULL AND action = ? LIMIT 1",repo,PROJECT_LEVEL_ACTION)!==null||store.handle.prepare("SELECT 1 FROM verify_command WHERE repo = ? LIMIT 1").get(repo)!==void 0?!1:(store.recordAction({at:now.toISOString(),actor:"system",repo,taskId:null,runId:null,action:PROJECT_LEVEL_ACTION,outcome:"quick",source:"policy",detail:"New project → Quick"}),!0)}export function taskCheckLevel(store,taskId){let id=taskId;for(let depth=0;id!==null&&depth<64;depth++){const ref=store.lookupRef(id),[where,params]=repoClause(ref?.repo??null),row=newest(store,`SELECT actor, at, outcome FROM action_ledger WHERE ${where} AND task_id = ? AND action = ? ORDER BY id DESC LIMIT 1`,...params,id,TASK_LEVEL_ACTION);if(row!==null&&isCheckLevel(row.outcome))return row.outcome;id=ref?.revisionOf??null}return null}export function setTaskCheckLevel(store,taskId,level,by,now){const ref=store.lookupRef(taskId);return ref===null?{ok:!1,message:`No task ${taskId}.`}:approvalOf(store.getScope(taskId)).approved?{ok:!1,message:"This task's plan is already approved, so its checks are fixed. File a new task to change them."}:taskCheckLevel(store,taskId)===level?{ok:!0}:(store.recordAction({at:now.toISOString(),actor:by,repo:ref.repo,taskId,runId:null,action:TASK_LEVEL_ACTION,outcome:level,source:"request",detail:`Checks for this task: ${CHECK_LEVEL_WORDS[level]}`}),{ok:!0})}export function effectiveCheckLevel(store,repo,taskId){const own=taskId===null?null:taskCheckLevel(store,taskId);return own!==null?{level:own,from:"task"}:{level:repo===null?"full":projectCheckLevel(store,repo).level,from:"project"}}export function checkCommandFor(store,repo,level){if(level==="off")return{level:"off",command:null};if(level==="quick"){const quick=liveQuickCommand(store,repo);if(quick!==null)return{level:"quick",command:quick}}return{level:"full",command:store.liveVerifyCommand(repo)}}export function requiredCheckCommandFor(store,repo,taskId,level){return repo===null?null:checkCommandFor(store,repo,level??effectiveCheckLevel(store,repo,taskId).level).command}export function recordRunCheckLevel(store,run,level,from,now){store.recordAction({at:now.toISOString(),actor:"system",repo:run.repo,taskId:run.taskId,runId:run.id,action:RUN_LEVEL_ACTION,outcome:level,source:"work",detail:`${CHECK_LEVEL_WORDS[level]} checks (${from==="task"?"this task's choice":"project setting"})`})}export function runCheckLevel(store,runId){const[where,params]=repoClause(repoOfRun(store,runId)),row=newest(store,`SELECT actor, at, outcome FROM action_ledger WHERE ${where} AND run_id = ? AND action = ? ORDER BY id DESC LIMIT 1`,...params,runId,RUN_LEVEL_ACTION);return row!==null&&isCheckLevel(row.outcome)?row.outcome:null}export function suggestQuickCommand(repo){if(!folderAnswers(repo))return null;const file=join(repo,"package.json");if(!existsSync(file))return null;let scripts={},deps={};try{const parsed=JSON.parse(readFileSync(file,"utf8"));scripts=parsed.scripts??{},deps={...parsed.dependencies,...parsed.devDependencies}}catch{return null}const has=name=>typeof scripts[name]=="string",runner=existsSync(join(repo,"pnpm-lock.yaml"))?"pnpm":existsSync(join(repo,"yarn.lock"))?"yarn":"npm",run=name=>runner==="npm"?`npm run ${name}`:`${runner} ${name}`;if(has("check:quick"))return run("check:quick");const exec=runner==="npm"?"npx":`${runner} exec`,typecheck=["typecheck","type-check","check-types","tsc"].find(has)??null,changed='$(git diff --name-only "${TOOLROLL_TASK_BASE}" --)',tests="vitest"in deps?`${exec} vitest related --run ${changed}`:"jest"in deps?`${exec} jest --findRelatedTests --passWithNoTests ${changed}`:null,parts=[typecheck===null?null:run(typecheck),tests].filter(one=>one!==null);return parts.length>0?(tests===null?"":': "${TOOLROLL_TASK_BASE:?Toolroll task base is required}" && ')+parts.join(" && "):has("lint")?run("lint"):null}export function checkLevelFromWords(text){const said=text.toLowerCase().replace(/[’']/g,"'");return/\b(skip|without|no|don't run|do not run|turn off|switch off)\b[^.!?\n]{0,20}\b(the )?(tests|checks)\b/.test(said)||/\b(tests|checks) off\b/.test(said)?"off":/\b(full|all the|every|complete)\s+(test|check)s?\b/.test(said)?"full":/\bquick\s+(test|check)s?\b/.test(said)?"quick":null}
|
package/dist/cli-help.js
CHANGED
|
@@ -1,15 +1,97 @@
|
|
|
1
|
-
import{DEFAULT_MAX_DEPTH}from"./scan.js";export const HELP=`Toolroll
|
|
1
|
+
import{DEFAULT_MAX_DEPTH}from"./scan.js";export const HELP=`Toolroll: local-first workbench for coding agents.
|
|
2
2
|
|
|
3
|
-
toolroll
|
|
4
|
-
|
|
5
|
-
toolroll
|
|
6
|
-
toolroll
|
|
7
|
-
toolroll task
|
|
8
|
-
|
|
9
|
-
toolroll task
|
|
10
|
-
toolroll update
|
|
3
|
+
toolroll open the terminal workbench (--web: browser)
|
|
4
|
+
toolroll demo try sample tasks with no model calls or cost
|
|
5
|
+
toolroll repos add <folder> connect a local repository
|
|
6
|
+
toolroll task add "<change>" --repo . queue a task from the shell
|
|
7
|
+
toolroll task show <id> state, diff summary, checks, and next step
|
|
8
|
+
toolroll task log <id> [-f] tail a task's live output (--sub: subagents)
|
|
9
|
+
toolroll task handoff <id> --to <ag> hand a task's worktree to another coding agent
|
|
10
|
+
toolroll update update to the latest release
|
|
11
|
+
Workbench keys: n new task · a accept · r send back · A agents · H handoff · g goto · ? all keys
|
|
12
|
+
More: toolroll <command> --help (task, repos, config, models, view, card, handoff) · toolroll internals`,REPOS_HELP=`toolroll repos: manage connected local repositories
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
toolroll repos list connected repositories
|
|
15
|
+
toolroll repos add <folder> [--remote <url>]
|
|
16
|
+
connect a local git repository
|
|
17
|
+
toolroll repos remove <folder> disconnect a repository (tasks and results stay)
|
|
18
|
+
toolroll repos add-from-github <owner/name> --root <dir> [--yes]
|
|
19
|
+
preview, then clone and connect a GitHub repo
|
|
20
|
+
|
|
21
|
+
Options
|
|
22
|
+
--json emit a machine-readable JSON envelope
|
|
23
|
+
--token <t> pass a lead token when adding from an agent
|
|
24
|
+
-h, --help show this`,FLOWS_HELP=`toolroll flows: inspect and manage automated workflows
|
|
25
|
+
|
|
26
|
+
toolroll flows list [--repo <path>] list saved flows
|
|
27
|
+
toolroll flows show <id> show stages, triggers, scripts, and active cards
|
|
28
|
+
toolroll flows create --repo <path> ... preview or create a flow (--yes to apply)
|
|
29
|
+
toolroll flows edit <id> ... preview or edit a flow (--yes to apply)
|
|
30
|
+
toolroll flows trigger add|pause|resume|remove ...
|
|
31
|
+
manage a flow's triggers
|
|
32
|
+
toolroll flows script save|approve ... manage flow script zones
|
|
33
|
+
toolroll flows card add|move|approve|send-back|cancel ...
|
|
34
|
+
manage cards moving through a flow
|
|
35
|
+
toolroll flows archive <id> archive a flow
|
|
36
|
+
|
|
37
|
+
Options
|
|
38
|
+
--json emit a machine-readable JSON envelope
|
|
39
|
+
--yes apply a previewed change
|
|
40
|
+
-h, --help show this`,VIEW_HELP=`toolroll view: customize the terminal workbench look
|
|
41
|
+
|
|
42
|
+
toolroll view show current theme, density, and saved themes
|
|
43
|
+
toolroll view theme set <name> switch to a built-in or saved theme
|
|
44
|
+
toolroll view reset restore defaults (keeps tui.toml.bak)
|
|
45
|
+
|
|
46
|
+
Built-in themes: terminal, light, dark, high-contrast
|
|
47
|
+
Options: -h, --help`,LEAD_HELP=`toolroll lead: configure and speak as the Lead coordinator
|
|
48
|
+
|
|
49
|
+
toolroll lead token [--revoke] mint or revoke your Lead agent credential
|
|
50
|
+
toolroll lead say "<text>" [--task <id>] post one short Lead update to chat
|
|
51
|
+
|
|
52
|
+
The Lead coordinator can run on any ready provider (Claude, Codex, Gemini, Grok,
|
|
53
|
+
OpenRouter, or Anthropic) via Settings -> Lead or POST /engine/lead/provider.
|
|
54
|
+
|
|
55
|
+
Options
|
|
56
|
+
--json emit a machine-readable JSON envelope
|
|
57
|
+
-h, --help show this`,CARD_HELP=`toolroll card: read live workspace data cards and declarative TUI panels
|
|
58
|
+
|
|
59
|
+
Built-in workspace cards
|
|
60
|
+
toolroll card <source> [--repo <path>] [--days <n>] [--limit <n>] [--json]
|
|
61
|
+
|
|
62
|
+
Declarative TUI panels (~/.toolroll/panels.toml, read-only)
|
|
63
|
+
toolroll card list [--json] list registered panels and live card previews
|
|
64
|
+
toolroll card --list [--json] same as \`toolroll card list\`
|
|
65
|
+
toolroll card <path.json> [--id <slug>] [--title "<title>"] [--json]
|
|
66
|
+
validate JSON, preview card, and register panel
|
|
67
|
+
toolroll card remove <id> [--json] remove a panel by id (or --remove <id>)
|
|
68
|
+
|
|
69
|
+
Built-in sources
|
|
70
|
+
tasks, results, flows, spend, projects, builders, mode,
|
|
71
|
+
integrations, providers, findings, handover
|
|
72
|
+
|
|
73
|
+
Options
|
|
74
|
+
--id <slug> panel id ([a-z0-9_-]{1,48}) when registering a panel
|
|
75
|
+
--title "<text>" display title when registering a panel
|
|
76
|
+
--list list registered declarative panels
|
|
77
|
+
--remove <id> remove a registered panel by id
|
|
78
|
+
--json emit a machine-readable JSON envelope
|
|
79
|
+
-h, --help show this`,HANDOFF_HELP=`toolroll handoff: pull/push remote worktrees or hand off tasks between agents
|
|
80
|
+
|
|
81
|
+
Remote worktree sync (central <-> local)
|
|
82
|
+
toolroll handoff pull <task> [--repo <dir>] [--profile <name>]
|
|
83
|
+
open a central task in an isolated local worktree
|
|
84
|
+
toolroll handoff push [<task>] [--note "<summary>"] [--profile <name>]
|
|
85
|
+
upload your local diff back as a revision candidate
|
|
86
|
+
toolroll handoff rebase [<task>] [--push] rebase your handoff worktree onto central head
|
|
87
|
+
toolroll handoff status [<task>] show local diff and central check/PR state
|
|
88
|
+
toolroll handoff clean [<task>] [--force] remove an isolated local handoff worktree
|
|
89
|
+
|
|
90
|
+
Agent-to-agent task handoff (local worktree preserved)
|
|
91
|
+
toolroll task handoff <id> --to <agent> [--model <m>] [--note "<text>"] [--json]
|
|
92
|
+
transfer a task's live worktree to another agent
|
|
93
|
+
|
|
94
|
+
Options: -h, --help`,SCAN_HELP=`toolroll scan [path...] — report what is in flight below a folder
|
|
13
95
|
|
|
14
96
|
toolroll scan [path...] report what is in flight (also bare \`toolroll\` outside a repository)
|
|
15
97
|
toolroll [path...] the same report for the paths given
|
|
@@ -75,7 +157,7 @@ Projects
|
|
|
75
157
|
toolroll repos add-from-github <owner/name> --root <dir>
|
|
76
158
|
preview, then clone and connect (--yes)
|
|
77
159
|
|
|
78
|
-
Chat and the lead
|
|
160
|
+
Chat and the lead (\`toolroll lead --help\`, \`toolroll flows --help\`: every command of each)
|
|
79
161
|
toolroll chat --as <you> --token <t>
|
|
80
162
|
talk to your lead: one conversation across every
|
|
81
163
|
project; it proposes, you confirm (--say "…" for one turn)
|
|
@@ -135,4 +217,50 @@ Machine
|
|
|
135
217
|
open in VS Code on the device you browse from)
|
|
136
218
|
toolroll watch / daemon install run only the builder
|
|
137
219
|
toolroll doctor check that Toolroll's service holds no key a build could read
|
|
138
|
-
toolroll reconcile recover what the last stretch left behind
|
|
220
|
+
toolroll reconcile recover what the last stretch left behind`,CONFIG_HELP=`toolroll config: which agent and model plan, build and review
|
|
221
|
+
|
|
222
|
+
toolroll config show [--repo <path>] which agent and model each role uses
|
|
223
|
+
toolroll config set <phase> --provider <p> [--model <m>] [--repo <path>]
|
|
224
|
+
choose the planner, builder or repairer
|
|
225
|
+
(phase: plan | build | repair; --repo: one project)
|
|
226
|
+
toolroll config set <phase> --tier strong --provider <p> --model <m>
|
|
227
|
+
the agent large or risky tasks use
|
|
228
|
+
toolroll config set build --tier light --provider <p> --model <m>
|
|
229
|
+
the agent small tasks build on, with no plan
|
|
230
|
+
toolroll config set <plan|build> [--tier light|strong] --also --provider <p> --model <m>
|
|
231
|
+
a second agent for the same size of task;
|
|
232
|
+
each task runs on the one with more room
|
|
233
|
+
toolroll config clear <phase> [--tier light|strong] [--also] [--repo <path>]
|
|
234
|
+
go back to the default
|
|
235
|
+
toolroll config set chat --provider <p> [--model <m>]
|
|
236
|
+
the agent the lead and chat run on
|
|
237
|
+
toolroll config set task-sizing on|off size each new task with a quick model call
|
|
238
|
+
toolroll config set flexible on|off interactive agent threads (beta)
|
|
239
|
+
toolroll config unconfined-agents [allow|refuse]
|
|
240
|
+
whether builds run where this computer can't confine them
|
|
241
|
+
|
|
242
|
+
Providers: claude, codex, gemini, openrouter. Settings -> Models in the browser
|
|
243
|
+
changes the same choices.
|
|
244
|
+
|
|
245
|
+
Options
|
|
246
|
+
--as <you> --token <t> who is changing it, and their password
|
|
247
|
+
--json emit a machine-readable JSON envelope
|
|
248
|
+
-h, --help show this`,MODELS_HELP=`toolroll models: the models each agent can run, and the agent CLIs
|
|
249
|
+
|
|
250
|
+
toolroll models installed CLI versions, updates and new models
|
|
251
|
+
toolroll models list --provider <p> models a provider can run, newest first, with prices
|
|
252
|
+
toolroll models check fetch the model lists and check CLI versions now
|
|
253
|
+
toolroll models update claude|codex|gemini update one CLI while no work is running
|
|
254
|
+
toolroll models watch on|off the check every 6 hours, and its messages
|
|
255
|
+
toolroll models results [--repo <path>] which model built each finished task
|
|
256
|
+
toolroll models suggestions [--repo <path>] cheaper models a project's results suggest
|
|
257
|
+
toolroll models accept|dismiss|try <id> --repo <path>
|
|
258
|
+
act on a suggestion
|
|
259
|
+
toolroll models turn-off|keep <rule> turn an earned rule off, or keep a paused one
|
|
260
|
+
toolroll models stop <trial> stop a trial
|
|
261
|
+
|
|
262
|
+
To choose which model plans, builds and reviews: \`toolroll config --help\`.
|
|
263
|
+
|
|
264
|
+
Options
|
|
265
|
+
--json emit a machine-readable JSON envelope
|
|
266
|
+
-h, --help show this`;
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{existsSync,lstatSync,realpathSync,unlinkSync,writeFileSync}from"node:fs";import{homedir}from"node:os";import{basename,delimiter,dirname,join,resolve}from"node:path";import{fileURLToPath,pathToFileURL}from"node:url";import{configPath,loadRepos}from"./repos.js";import{addedWords,admitProject,commandLineActor,consoleRunning,proveProjectRoot,registryBeside,releaseProject}from"./project-admission.js";import{envValue}from"./names.js";import{CAPABILITIES,ENVELOPE_VERSION,capturedEnvelope,onEnvelopeCaptured,resetCapturedEnvelope}from"./envelope.js";import{checkedEnvelopeJson as envelopeJson}from"./contracts/cli.js";import{applyClaudeCodeInstall,applyInstall,contextBlock,defaultClaudeCodeSkillDir,planClaudeCodeInstall,planInstall}from"./skills.js";import{GUIDES,guideNamed}from"./guides.js";import{parseGithubRepo,previewGithubRepo,cloneGithubRepo,isLargeRepo}from"./onboard.js";import{run as execRun}from"./exec.js";import{isBareInvocation,runQuickStart}from"./quick-start.js";import{easyStartApplies,easyStartArgs}from"./easy-start-args.js";import{underAgent}from"./prompt.js";import{COMMAND_GUIDE,SURFACE_NOTES,SURFACE_SCHEMA_VERSION}from"./surface.js";import{centralProfile,hasCentralProfile,maybeRunConnectCommand,probeTerminalConnection,saveCentralBinding}from"./connect-cli.js";import{removedCommand,removedMessage}from"./deprecations.js";import{maybeRunRemoteCommand}from"./remote-exec.js";import{discover,inspectAll}from"./discover.js";import{readPulls}from"./pulls.js";import{detectGraphs,chooseBackend,setupOptions,LABELS as GRAPH_LABELS}from"./graph.js";import{openStore,openStoreReadOnly,databasePath}from"./store.js";import{renderReport,renderPulls,renderGraph}from"./render.js";import{DEFAULT_MAX_DEPTH}from"./scan.js";import{HELP,INTERNALS_HELP,SCAN_HELP}from"./cli-help.js";import{withTaskAlias}from"./task-aliases.js";import{OPERATE_COMMANDS}from"./operate-commands.js";import{quickAnswer}from"./cli-fast.js";import{BIN_NAME,chooseTarget,planLink,applyLink,planUnlink,applyUnlink}from"./link.js";const USAGE_EXIT=2;async function runOperate(command,argv,write,options){return(await import("./operate.js")).runOperate(command,argv,write,options)}export{HELP};export function parseArgs(argv){const roots=[],rawRoots=[],options={roots:[],rawRoots:[],rootsGiven:!1,maxDepth:DEFAULT_MAX_DEPTH,json:!1,includeHidden:!1,all:!1,dirty:!1,local:!1,help:!1};for(let index=0;index<argv.length;index++){const argument=argv[index];if(argument==="--json")options.json=!0;else if(argument==="--hidden")options.includeHidden=!0;else if(argument==="--all")options.all=!0;else if(argument==="--dirty")options.dirty=!0;else if(argument==="--local")options.local=!0;else if(argument==="--help"||argument==="-h")options.help=!0;else if(argument==="--depth"){const depth=Number(argv[++index]);if(!Number.isInteger(depth)||depth<0)return{error:"--depth needs a whole number, for example `--depth 8`"};options.maxDepth=depth}else{if(argument.startsWith("-"))return{error:`unknown option ${argument} — try \`toolroll --help\``};roots.push(resolve(argument)),rawRoots.push(argument)}}return{options:{...options,roots:roots.length>0?roots:[process.cwd()],rawRoots,rootsGiven:roots.length>0}}}export{OPERATE_COMMANDS};export function extractOutputFlag(argv){const args=[];let outputFile;for(let i=0;i<argv.length;i+=1){const arg=argv[i];if(arg==="-o"||arg==="--output"){const value=argv[i+1];if(value===void 0||value.startsWith("-"))return{error:`${arg} takes a file path`};outputFile=value,i+=1;continue}args.push(arg)}return{args,...outputFile===void 0?{}:{outputFile}}}export async function main(argv,write=line=>console.log(line),mainOptions={}){const quick=quickAnswer(argv);if(quick!==null)return write(quick),0;const extracted=extractOutputFlag(argv);if("error"in extracted)return write(extracted.error),USAGE_EXIT;const{args,outputFile}=extracted;if(outputFile!==void 0&&!args.includes("--json"))return write("-o requires --json — the output file receives the machine envelope"),USAGE_EXIT;if(outputFile!==void 0&&args.find(one=>!one.startsWith("-"))==="tokens")return write("-o isn't used with tokens: a new token is shown once, never saved to a file"),USAGE_EXIT;resetCapturedEnvelope();const firstWord=args.find(one=>!one.startsWith("-")),earlyFlush=outputFile!==void 0&&(firstWord==="serve"||firstWord==="up");let earlyFlushProblem=null;if(earlyFlush&&outputFile!==void 0){try{const existing=lstatSync(outputFile,{throwIfNoEntry:!1});if(existing!==void 0){if(!existing.isFile())return write(`-o refuses ${outputFile}: not a regular file`),USAGE_EXIT;unlinkSync(outputFile)}writeFileSync(outputFile,"",{mode:384,flag:"wx"})}catch(error){return write(`-o could not prepare ${outputFile}: ${String(error.message??error)}`),USAGE_EXIT}onEnvelopeCaptured(body=>{try{writeFileSync(outputFile,`${body}
|
|
2
|
+
import{existsSync,lstatSync,realpathSync,unlinkSync,writeFileSync}from"node:fs";import{homedir}from"node:os";import{basename,delimiter,dirname,join,resolve}from"node:path";import{fileURLToPath,pathToFileURL}from"node:url";import{configPath,loadRepos}from"./repos.js";import{addedWords,admitProject,commandLineActor,consoleRunning,proveProjectRoot,registryBeside,releaseProject}from"./project-admission.js";import{envValue}from"./names.js";import{CAPABILITIES,ENVELOPE_VERSION,capturedEnvelope,onEnvelopeCaptured,resetCapturedEnvelope}from"./envelope.js";import{checkedEnvelopeJson as envelopeJson}from"./contracts/cli.js";import{applyClaudeCodeInstall,applyInstall,contextBlock,defaultClaudeCodeSkillDir,planClaudeCodeInstall,planInstall}from"./skills.js";import{GUIDES,guideNamed}from"./guides.js";import{parseGithubRepo,previewGithubRepo,cloneGithubRepo,isLargeRepo}from"./onboard.js";import{run as execRun}from"./exec.js";import{isBareInvocation,runQuickStart}from"./quick-start.js";import{easyStartApplies,easyStartArgs}from"./easy-start-args.js";import{underAgent}from"./prompt.js";import{COMMAND_GUIDE,SURFACE_NOTES,SURFACE_SCHEMA_VERSION}from"./surface.js";import{centralProfile,hasCentralProfile,maybeRunConnectCommand,probeTerminalConnection,saveCentralBinding}from"./connect-cli.js";import{removedCommand,removedMessage}from"./deprecations.js";import{maybeRunRemoteCommand}from"./remote-exec.js";import{discover,inspectAll}from"./discover.js";import{readPulls}from"./pulls.js";import{detectGraphs,chooseBackend,setupOptions,LABELS as GRAPH_LABELS}from"./graph.js";import{openStore,openStoreReadOnly,databasePath}from"./store.js";import{renderReport,renderPulls,renderGraph}from"./render.js";import{DEFAULT_MAX_DEPTH}from"./scan.js";import{CARD_HELP,CONFIG_HELP,FLOWS_HELP,HANDOFF_HELP,HELP,INTERNALS_HELP,LEAD_HELP,MODELS_HELP,REPOS_HELP,SCAN_HELP,VIEW_HELP}from"./cli-help.js";import{withTaskAlias}from"./task-aliases.js";import{OPERATE_COMMANDS}from"./operate-commands.js";import{quickAnswer}from"./cli-fast.js";import{BIN_NAME,chooseTarget,planLink,applyLink,planUnlink,applyUnlink}from"./link.js";const USAGE_EXIT=2;async function runOperate(command,argv,write,options){return(await import("./operate.js")).runOperate(command,argv,write,options)}export{HELP};export function parseArgs(argv){const roots=[],rawRoots=[],options={roots:[],rawRoots:[],rootsGiven:!1,maxDepth:DEFAULT_MAX_DEPTH,json:!1,includeHidden:!1,all:!1,dirty:!1,local:!1,help:!1};for(let index=0;index<argv.length;index++){const argument=argv[index];if(argument==="--json")options.json=!0;else if(argument==="--hidden")options.includeHidden=!0;else if(argument==="--all")options.all=!0;else if(argument==="--dirty")options.dirty=!0;else if(argument==="--local")options.local=!0;else if(argument==="--help"||argument==="-h")options.help=!0;else if(argument==="--depth"){const depth=Number(argv[++index]);if(!Number.isInteger(depth)||depth<0)return{error:"--depth needs a whole number, for example `--depth 8`"};options.maxDepth=depth}else{if(argument.startsWith("-"))return{error:`unknown option ${argument} — try \`toolroll --help\``};roots.push(resolve(argument)),rawRoots.push(argument)}}return{options:{...options,roots:roots.length>0?roots:[process.cwd()],rawRoots,rootsGiven:roots.length>0}}}export{OPERATE_COMMANDS};export function extractOutputFlag(argv){const args=[];let outputFile;for(let i=0;i<argv.length;i+=1){const arg=argv[i];if(arg==="-o"||arg==="--output"){const value=argv[i+1];if(value===void 0||value.startsWith("-"))return{error:`${arg} takes a file path`};outputFile=value,i+=1;continue}args.push(arg)}return{args,...outputFile===void 0?{}:{outputFile}}}export async function main(argv,write=line=>console.log(line),mainOptions={}){if(argv[0]==="internal"&&argv[1]==="acp-turn")return(await import("./agent-thread/acp-turn.js")).runAcpTurnCommand(argv.slice(2));if(argv[0]==="internal"&&argv[1]==="chat-turn")return(await import("./agent-thread/chat-turn.js")).runChatTurnCommand(argv.slice(2));const quick=quickAnswer(argv);if(quick!==null)return write(quick),0;const extracted=extractOutputFlag(argv);if("error"in extracted)return write(extracted.error),USAGE_EXIT;const{args,outputFile}=extracted;if(outputFile!==void 0&&!args.includes("--json"))return write("-o requires --json — the output file receives the machine envelope"),USAGE_EXIT;if(outputFile!==void 0&&args.find(one=>!one.startsWith("-"))==="tokens")return write("-o isn't used with tokens: a new token is shown once, never saved to a file"),USAGE_EXIT;resetCapturedEnvelope();const firstWord=args.find(one=>!one.startsWith("-")),earlyFlush=outputFile!==void 0&&(firstWord==="serve"||firstWord==="up");let earlyFlushProblem=null;if(earlyFlush&&outputFile!==void 0){try{const existing=lstatSync(outputFile,{throwIfNoEntry:!1});if(existing!==void 0){if(!existing.isFile())return write(`-o refuses ${outputFile}: not a regular file`),USAGE_EXIT;unlinkSync(outputFile)}writeFileSync(outputFile,"",{mode:384,flag:"wx"})}catch(error){return write(`-o could not prepare ${outputFile}: ${String(error.message??error)}`),USAGE_EXIT}onEnvelopeCaptured(body=>{try{writeFileSync(outputFile,`${body}
|
|
3
3
|
`,{mode:384})}catch(error){earlyFlushProblem=String(error.message??error)}})}let code;try{code=await dispatch(args,write,mainOptions)}finally{earlyFlush&&onEnvelopeCaptured(null)}if(earlyFlushProblem!==null)return process.stderr.write(`-o could not write ${outputFile}: ${earlyFlushProblem}
|
|
4
4
|
`),code===0?1:code;if(outputFile!==void 0&&!earlyFlush){const captured=capturedEnvelope();if(captured!==null)try{const existing=lstatSync(outputFile,{throwIfNoEntry:!1});if(existing!==void 0){if(!existing.isFile())return write(`-o refuses ${outputFile}: not a regular file`),USAGE_EXIT;unlinkSync(outputFile)}writeFileSync(outputFile,`${captured}
|
|
5
|
-
`,{mode:384,flag:"wx"})}catch(error){return write(`-o could not write ${outputFile}: ${String(error.message??error)}`),1}}return code}export const ROUTINES_MOVED="Routines are now scheduled flows: see `toolroll flows list` (your routines were moved there).";function routinesMoved(argv,write){return write(argv.includes("--json")?envelopeJson({ok:!0,command:"routine",message:ROUTINES_MOVED}):ROUTINES_MOVED),0}async function dispatch(argv,write,mainOptions){if(argv=withTaskAlias(argv),argv[0]==="routine")return routinesMoved(argv,write);const connectOptions=mainOptions.connect??mainOptions.remote,removed=removedCommand(argv,()=>hasCentralProfile(connectOptions??{}));if(removed!==null){const message=removedMessage(removed.named,removed.kind);return write(argv.includes("--json")?envelopeJson({ok:!1,command:removed.named,reason:"removed",message}):message),2}if(argv[0]==="health")return(await import("./health-cli.js")).runHealthCommand(argv.slice(1),write,mainOptions.connect??mainOptions.remote);if(argv[0]==="internals"&&argv.slice(1).every(arg=>arg==="--help"||arg==="-h"))return write(INTERNALS_HELP),0;if(argv[0]==="doctor")return(await import("./doctor.js")).runDoctorCommand(argv.slice(1),write);const central=await maybeRunRemoteCommand(argv,mainOptions.remote??mainOptions.connect);if(typeof central=="number")return central;central!==null&&(argv=central.local);const connected=await maybeRunConnectCommand(argv,write,mainOptions.connect);if(connected!==null)return connected;if(argv[0]==="handoff"){const{maybeRunHandoffCommand}=await import("./handoff-cli.js"),handoffCode=await maybeRunHandoffCommand(argv,write,connectOptions??{});if(handoffCode!==null)return handoffCode}if(argv[0]==="--remote")return runRemoteTuiCommand(argv.slice(1),write,connectOptions??{});(argv[0]==="chat"||argv[0]==="brief")&&argv.includes("--local")&&(argv=argv.filter(arg=>arg!=="--local"));const[first,...rest]=argv;if(first==="help")return write(HELP),0;if(first==="link"||first==="unlink")return runLinkCommand(first,rest,write,mainOptions.binSource);if(first==="update")return(await import("./toolroll-update-cli.js")).runUpdateCommand(rest,write,mainOptions.update);if(first==="release"&&rest[0]==="approve")return runOperate("release",rest,write,mainOptions.operate??{});if(first==="release"){const{runReleaseCommand}=await import("./release-cli.js");return runReleaseCommand(rest,write,{releaseLease:lease=>runOperate("worker",["release",...lease],write,mainOptions.operate??{}),...mainOptions.release})}if(first==="contract")return runContractCommand(rest,write);if(first==="demo")return runDemoCommand(rest,write,mainOptions.demo);if(first==="skills")return runSkillsCommand(rest,write);if(first==="repos")return runReposCommand(rest,write,mainOptions.onboard);if(first==="pulls")return runPullsCommand(rest,write);if(first==="view")return(await import("./view-tools.js")).runViewCommand(rest,write,mainOptions.viewRunner);if(first==="
|
|
5
|
+
`,{mode:384,flag:"wx"})}catch(error){return write(`-o could not write ${outputFile}: ${String(error.message??error)}`),1}}return code}export const ROUTINES_MOVED="Routines are now scheduled flows: see `toolroll flows list` (your routines were moved there).";function routinesMoved(argv,write){return write(argv.includes("--json")?envelopeJson({ok:!0,command:"routine",message:ROUTINES_MOVED}):ROUTINES_MOVED),0}async function dispatch(argv,write,mainOptions){if(argv=withTaskAlias(argv),argv[0]==="routine")return routinesMoved(argv,write);const connectOptions=mainOptions.connect??mainOptions.remote,removed=removedCommand(argv,()=>hasCentralProfile(connectOptions??{}));if(removed!==null){const message=removedMessage(removed.named,removed.kind);return write(argv.includes("--json")?envelopeJson({ok:!1,command:removed.named,reason:"removed",message}):message),2}if(argv[0]==="health")return(await import("./health-cli.js")).runHealthCommand(argv.slice(1),write,mainOptions.connect??mainOptions.remote);if(argv[0]==="internals"&&argv.slice(1).every(arg=>arg==="--help"||arg==="-h"))return write(INTERNALS_HELP),0;if(argv[0]==="doctor")return(await import("./doctor.js")).runDoctorCommand(argv.slice(1),write);const central=await maybeRunRemoteCommand(argv,mainOptions.remote??mainOptions.connect);if(typeof central=="number")return central;central!==null&&(argv=central.local);const connected=await maybeRunConnectCommand(argv,write,mainOptions.connect);if(connected!==null)return connected;if(argv[0]==="handoff"){if(argv.slice(1).includes("--help")||argv.slice(1).includes("-h"))return write(HANDOFF_HELP),0;const{maybeRunHandoffCommand}=await import("./handoff-cli.js"),handoffCode=await maybeRunHandoffCommand(argv,write,connectOptions??{});if(handoffCode!==null)return handoffCode}if(argv[0]==="--remote")return runRemoteTuiCommand(argv.slice(1),write,connectOptions??{});(argv[0]==="chat"||argv[0]==="brief")&&argv.includes("--local")&&(argv=argv.filter(arg=>arg!=="--local"));const[first,...rest]=argv;if(first==="help")return write(HELP),0;if(first==="link"||first==="unlink")return runLinkCommand(first,rest,write,mainOptions.binSource);if(first==="update")return(await import("./toolroll-update-cli.js")).runUpdateCommand(rest,write,mainOptions.update);if(first==="release"&&rest[0]==="approve")return runOperate("release",rest,write,mainOptions.operate??{});if(first==="release"){const{runReleaseCommand}=await import("./release-cli.js");return runReleaseCommand(rest,write,{releaseLease:lease=>runOperate("worker",["release",...lease],write,mainOptions.operate??{}),...mainOptions.release})}if(first==="contract")return runContractCommand(rest,write);if(first==="demo")return runDemoCommand(rest,write,mainOptions.demo);if(first==="skills")return runSkillsCommand(rest,write);if(first==="repos")return rest.includes("--help")||rest.includes("-h")?(write(REPOS_HELP),0):runReposCommand(rest,write,mainOptions.onboard);if(first==="pulls")return runPullsCommand(rest,write);if(first==="view")return rest.includes("--help")||rest.includes("-h")?(write(VIEW_HELP),0):(await import("./view-tools.js")).runViewCommand(rest,write,mainOptions.viewRunner);if(first==="flows"&&(rest.includes("--help")||rest.includes("-h"))&&!rest.includes("--json"))return write(FLOWS_HELP),0;if(first==="lead"&&(rest.includes("--help")||rest.includes("-h"))&&!rest.includes("--json"))return write(LEAD_HELP),0;if(first==="card"&&(rest.includes("--help")||rest.includes("-h"))&&!rest.includes("--json"))return write(CARD_HELP),0;if((first==="config"||first==="models")&&(rest.includes("--help")||rest.includes("-h"))&&!rest.includes("--json"))return write(first==="config"?CONFIG_HELP:MODELS_HELP),0;if(first==="card"&&!rest.includes("--help")&&!rest.includes("-h")){const[{CARD_SOURCES},{CARD_PANEL_VALUE_FLAGS,isPanelCardCliInvocation,runPanelCardCommand},{parseOperateArgs}]=await Promise.all([import("./card-catalog.js"),import("./panels.js"),import("./operate.js")]),parsed2=parseOperateArgs(rest,CARD_PANEL_VALUE_FLAGS);if(!("error"in parsed2)&&isPanelCardCliInvocation(parsed2.positional,parsed2.flags,CARD_SOURCES)){const json=parsed2.flags.has("json"),registered=await loadRepos(configPath(process.env,homedir())).catch(()=>({error:"unreadable"})),repos2="error"in registered?[]:registered.repos;return runPanelCardCommand(parsed2.positional,parsed2.flags,{json,now:mainOptions.operate?.now??new Date,repos:repos2,ok:(result,lines)=>(write(json?envelopeJson({ok:!0,command:"card",...result}):lines().join(`
|
|
6
|
+
`)),0),no:(reason,message)=>(write(json?envelopeJson({ok:!1,command:"card",reason,message}):message),reason==="usage"?2:3)})}}if(first==="graph")return runGraphCommand(rest,write);if(first!==void 0&&OPERATE_COMMANDS.has(first))return runOperate(first,rest,write,mainOptions.operate??{});const startArgs=easyStartArgs(argv);if(startArgs!==null){const terminal=mainOptions.easyStart?.terminal??(process.stdin.isTTY===!0&&process.stdout.isTTY===!0),agent=terminal&&(mainOptions.easyStart?.underAgent??underAgent(process.env));if(easyStartApplies(argv,{stdin:terminal,stdout:terminal,agent})){const databaseFile=mainOptions.operate?.databaseFile??databasePath(process.env,homedir()),easy=await import("./easy-start.js"),seams=easy.defaultEasyStartSeams({databaseFile,write,build:(await import("./monitoring.js")).packageVersion(),...mainOptions.operate===void 0?{}:{operate:mainOptions.operate},admit:repo=>runReposCommand(["add",repo],write,mainOptions.onboard),...startArgs.screenReader===!0?{screenReader:!0}:{},...startArgs.tuiBinary===void 0?{}:{tuiBinary:startArgs.tuiBinary}});return easy.runEasyStart("start",startArgs,{...seams,...mainOptions.easyStart?.seams})}if(startArgs.tuiBinary!==void 0)return write(agent?"Toolroll detected a coding-agent session. Open the workbench launcher yourself from a fresh terminal session.":"The workbench needs interactive input and output. Run the launcher in a terminal window."),USAGE_EXIT}const scanNamed=first==="scan";if(scanNamed)argv=rest;else if(isBareInvocation(argv)){const databaseFile=mainOptions.operate?.databaseFile??databasePath(process.env,homedir()),started=await runQuickStart(argv,write,{databaseFile,cwd:process.cwd(),env:process.env,terminal:process.stdout.isTTY===!0,build:(await import("./monitoring.js")).packageVersion(),findRepo:async cwd=>{const top=await execRun("git",["rev-parse","--show-toplevel"],{cwd,timeoutMs:1e4});return top.code===0?top.stdout.trim():null},enrolled:async repo=>{const loaded=await loadRepos(registryBeside(databaseFile));return!("error"in loaded)&&loaded.repos.includes(repo)},admit:repo=>runReposCommand(["add",repo],write,mainOptions.onboard),startUp:()=>runOperate("up",[],write,mainOptions.operate??{}),setUp:async()=>{const mode=(await import("./easy-start.js")).localModeRead(databaseFile);return mode==="on"||mode==="off"},openBrowser:async url=>{(await import("./operate.js")).openBrowser(url)},...mainOptions.quickStart});if(started!==null)return started}const parsed=parseArgs(argv);if("error"in parsed)return write(parsed.error),USAGE_EXIT;const{options}=parsed;if(options.help)return write(scanNamed?SCAN_HELP:HELP),0;const now=new Date,enrolled=await loadRepos(configFile());if("error"in enrolled)return write(enrolled.error),1;if(!options.all&&!options.rootsGiven&&enrolled.repos.length>0)return reportEnrolled(enrolled.repos,options,now,write);const{present,missing}=partitionRoots(options.roots,existsSync);if(present.length===0)return write(options.json?renderMissingJson(options.roots,missing,now):describeMissing(missing,options.rawRoots,options.roots)),USAGE_EXIT;missing.length>0&&!options.json&&(write(describeMissing(missing,options.rawRoots,options.roots)),write(""));const repos=await discover(present,{scan:{maxDepth:options.maxDepth,includeHidden:options.includeHidden},dirty:options.dirty}),remote=await maybeReadRemote(repos,options),output=options.json?renderJson(repos,present,missing,now,remote):renderReport(repos,{now,roots:present,...remote===void 0?{}:{remote}});return write(output),0}async function maybeReadRemote(repos,options){if(options.local)return;const{readRemote}=await import("./remote.js");return readRemote(repos.map(repo=>({path:repo.path,remoteUrl:repo.remoteUrl})))}function configFile(){return configPath(process.env,homedir())}async function reportEnrolled(repos,options,now,write){const{present,missing}=partitionRoots(repos,existsSync),snapshots=await inspectAll(present,{dirty:options.dirty}),remote=await maybeReadRemote(snapshots,options);if(options.json)return write(renderJson(snapshots,present,missing,now,remote)),0;if(missing.length>0){for(const repo of missing)write(`${repo} is enrolled but is no longer there.`);write(`Drop it with \`toolroll repos remove ${missing[0]}\`.`),write("")}return write(renderReport(snapshots,{now,roots:present,...remote===void 0?{}:{remote}})),0}export function partitionRoots(roots,exists){return{present:roots.filter(exists),missing:roots.filter(root=>!exists(root))}}function describeMissing(missing,rawRoots=[],roots=[]){const rawOf=new Map;roots.forEach((resolved,index)=>{const raw=rawRoots[index];raw!==void 0&&rawOf.set(resolved,raw)});const bareWord=raw=>raw!==void 0&&!/[/\\~]/.test(raw)&&!raw.startsWith(".");return missing.map(root=>bareWord(rawOf.get(root))?`${root} does not exist — if you meant a command, \`toolroll --help\` and \`toolroll internals\` list them; to scan a folder, give a path that exists.`:`${root} does not exist — check the path.`).join(`
|
|
6
7
|
`)}function renderMissingJson(roots,missingRoots,now){return envelopeJson({ok:!1,command:"scan",reason:"no-repositories",message:"none of the given paths exist — nothing was scanned",scannedAt:now.toISOString(),roots,missingRoots,remoteRead:!1,repos:[]})}async function runReposCommand(argv,write,onboard){const tokenAt=argv.findIndex(argument=>argument==="--token"||argument.startsWith("--token=")),tokenInline=tokenAt!==-1&&argv[tokenAt]!=="--token",tokenFlag=tokenAt===-1?void 0:tokenInline?argv[tokenAt].slice(8):argv[tokenAt+1],json=argv.includes("--json"),bare=argv.filter((argument,index)=>argument!=="--json"&&(tokenAt===-1||index!==tokenAt&&(tokenInline||index!==tokenAt+1))),remoteAt=bare.indexOf("--remote"),remoteUrl=remoteAt===-1?void 0:bare[remoteAt+1],[action,...paths]=bare.filter((_,i)=>remoteAt===-1||i!==remoteAt&&i!==remoteAt+1);if(remoteAt!==-1&&(action!=="add"||bare.filter(v=>v==="--remote").length!==1||remoteUrl===void 0||remoteUrl.startsWith("-")||paths.length>1)){const message="Use repos add <project> --remote <url> for one project.";return write(json?envelopeJson({ok:!1,command:"repos",reason:"usage",message}):message),USAGE_EXIT}const databaseFile=databasePath(process.env,homedir()),file=registryBeside(databaseFile);if(tokenAt!==-1&&(tokenFlag===void 0||tokenFlag===""||!tokenInline&&["--json","--remote","--token"].includes(tokenFlag))){const message="--token needs the lead token";return write(json?envelopeJson({ok:!1,command:`repos ${action??""}`.trim(),reason:"usage",message}):message),USAGE_EXIT}const envLead=envValue(process.env,"LEAD_TOKEN"),leadToken=tokenFlag??(envLead===void 0||envLead===""?void 0:envLead);if(action==="add-from-github")return addFromGithubCommand(bare.slice(1),json,write,{databaseFile,registryFile:file,...leadToken===void 0?{}:{leadToken}},onboard);const loaded=await loadRepos(file);if("error"in loaded)return write(json?envelopeJson({ok:!1,command:"repos",reason:"unreadable",message:loaded.error}):loaded.error),1;if(action===void 0){const store=openStore(databaseFile);try{const projects=loaded.repos.map(repo=>({repo,remoteUrl:store.projectRemote(repo)}));return json?(write(envelopeJson({ok:!0,command:"repos",count:loaded.repos.length,repos:loaded.repos,projects,file})),0):listRepos(loaded.repos,file,write,new Map(projects.map(p=>[p.repo,p.remoteUrl])))}finally{store.close()}}if(action!=="add"&&action!=="remove"){const message=`unknown command \`repos ${action}\` — try \`repos\`, \`repos add\`, \`repos remove\`, or \`repos add-from-github <owner/name>\``;return write(json?envelopeJson({ok:!1,command:"repos",reason:"usage",message}):message),USAGE_EXIT}const targets=(paths.length>0?paths:[process.cwd()]).map(path=>resolve(path)),lines=[],said={},say=json?line=>lines.push(line):write,code=await withAdmission({databaseFile,registryFile:file,...leadToken===void 0?{}:{leadToken}},say,said,admission=>action==="add"?addToRepos(admission,targets,say,said,remoteUrl):removeFromRepos(admission,targets,say,said));return json&&write(envelopeJson({ok:code===0,command:`repos ${action}`,...code===0?{}:{reason:said.reason??"usage"},message:lines.join(" "),targets,...said.projects===void 0?{}:{projects:said.projects}})),code}async function withAdmission(where,write,said,body){let store;try{store=openStore(where.databaseFile)}catch(error){return said.reason="database",write(`Toolroll's database couldn't be opened (${String(error.message??error)}). Nothing changed.`),1}try{const actor=commandLineActor(store,{databaseFile:where.databaseFile,...where.leadToken===void 0?{}:{leadToken:where.leadToken}});return"ok"in actor?(said.reason="refused",write(actor.message),3):await body({store,registryFile:where.registryFile,actor})}finally{store.close()}}function listRepos(repos,file,write,remotes){if(repos.length===0)return write("No repositories connected. Toolroll reports on everything it can find."),write(""),write("Connect the ones you actually work in:"),write(" toolroll repos add ~/code/thing"),write(" toolroll repos add # the repo you are standing in"),0;write(`${repos.length===1?"1 repository":`${repos.length} repositories`} connected:`);for(const repo of repos)write(` ${repo}${existsSync(repo)?"":" (missing)"}`),write(` Recorded remote: ${remotes.get(repo)??"None"}`);return write(""),write(" toolroll repos add <path> add another; it is in the console at once"),write(" toolroll repos remove <path> take one out of the console; its tasks stay"),write(" toolroll repos add-from-github <owner/name> --root <dir> clone from GitHub and connect"),write(" toolroll --all report everything, ignoring this list"),write(` ${file}`),0}function admissionExit(reason){return reason==="not-git"||reason==="unavailable"?USAGE_EXIT:1}async function addToRepos(admission,targets,write,said,remoteUrl){let refused=!1;for(const path of targets){const proved=await proveProjectRoot(path);proved.ok||(write(proved.message),said.reason??=proved.reason,refused=!0)}if(refused)return USAGE_EXIT;const now=new Date,running=consoleRunning(admission.store,now),projects=[];for(const path of targets){const admitted=await admitProject(admission.store,{registryFile:admission.registryFile,path,actor:admission.actor,now,captureOrigin:!0,...remoteUrl===void 0?{}:{remoteUrl}});if(!admitted.ok)return said.reason=admitted.reason,said.projects=projects,write(admitted.message),admissionExit(admitted.reason);projects.push({repo:admitted.repo,name:admitted.name,added:admitted.added,remoteUrl:admitted.remote.url}),write(addedWords(admitted.name,admitted.added,running)),admitted.remote.url!==null&&write(`Remote: ${admitted.remote.url}`)}return said.projects=projects,0}async function removeFromRepos(admission,targets,write,said){const now=new Date,projects=[];for(const path of targets){const released=await releaseProject(admission.store,{registryFile:admission.registryFile,path,actor:admission.actor,now});if(!released.ok)return said.reason=released.reason,said.projects=projects,write(released.message),admissionExit(released.reason);projects.push({repo:released.repo,name:released.name,removed:released.removed}),write(released.removed?`Removed ${released.name}; it is no longer in the console. Its tasks and results stay saved.`:`${released.name} isn't added, so nothing changed.`)}return said.projects=projects,0}async function addFromGithubCommand(argv,json,write,where,onboard){const command="repos add-from-github",answer=(reason,message,code2,extra={})=>(write(json?envelopeJson({ok:!1,command,reason,message,...extra}):message),code2),usage="`toolroll repos add-from-github <owner/name | github.com link> --root <dir> [--large-ok] [--yes] [--json]`";let spec,rootGiven,yes=!1,largeOk=!1;for(let index=0;index<argv.length;index++){const argument=argv[index];if(!argument.startsWith("-")){if(spec!==void 0)return answer("usage","one repository at a time",USAGE_EXIT);spec=argument;continue}if(argument==="--yes"){yes=!0;continue}if(argument==="--large-ok"){largeOk=!0;continue}if(argument==="--root"){const value=argv[index+1];if(value===void 0||value.startsWith("-"))return answer("usage","--root needs a directory",USAGE_EXIT);rootGiven=value,index+=1;continue}return argument==="-h"||argument==="--help"?answer("usage",usage,USAGE_EXIT):answer("usage",`unknown option ${argument} for \`repos add-from-github\``,USAGE_EXIT)}if(spec===void 0)return answer("usage",usage,USAGE_EXIT);const shape=parseGithubRepo(spec);if(!shape.ok)return answer("usage",shape.problem,USAGE_EXIT);if(rootGiven===void 0)return answer("usage","--root <dir> names where the clone lands (an existing directory)",USAGE_EXIT);let root;try{root=realpathSync(resolve(rootGiven))}catch{return answer("usage",`--root ${rootGiven} does not exist`,USAGE_EXIT)}if(!lstatSync(root).isDirectory())return answer("usage",`--root ${rootGiven} is not a directory`,USAGE_EXIT);if(process.platform==="win32")return answer("platform","adding from GitHub is not supported on Windows yet — the clone's process tree cannot be proven dead there",1);const previewed=await(onboard?.preview??previewGithubRepo)(shape.owner,shape.name);if(!previewed.ok)return answer(previewed.reason,previewed.message,1);const reparsed=parseGithubRepo(previewed.preview.nameWithOwner);if(!reparsed.ok)return answer("malformed","GitHub named a repository shape this command refuses — nothing was written",1);const target=join(root,reparsed.name);if(dirname(target)!==root)return answer("usage","the target escaped its root — refused; nothing was written",USAGE_EXIT);const diskUsageKib=typeof previewed.preview.diskUsageKib=="number"&&Number.isFinite(previewed.preview.diskUsageKib)&&previewed.preview.diskUsageKib>=0?previewed.preview.diskUsageKib:null,large=isLargeRepo({...previewed.preview,diskUsageKib}),size=diskUsageKib===null?"size unknown":`${Math.max(1,Math.round(diskUsageKib/1024))} MiB`;if(!yes)return json?(write(envelopeJson({ok:!1,command,reason:"unconfirmed",preview:{nameWithOwner:previewed.preview.nameWithOwner,visibility:previewed.preview.visibility,diskUsageKib,large,target}})),3):(write("Would clone, exactly:"),write(` ${previewed.preview.nameWithOwner} (${previewed.preview.visibility} · ${size}${large?" — LARGE or unknown; --large-ok will be required":""})`),write(` into ${target}, then connect it`),write(""),write("Nothing was written. Re-run with --yes to apply."),3);if(large&&!largeOk)return answer("large",`${previewed.preview.nameWithOwner} is large or of unknown size (${size}) — add --large-ok to clone it anyway; nothing was written`,3);const said={},problems=[],allowed=await withAdmission(where,line=>problems.push(line),said,async()=>0);if(allowed!==0)return answer(said.reason??"refused",problems.join(" "),allowed);const cloned=await(onboard?.clone??cloneGithubRepo)(previewed.preview.nameWithOwner,root,async cwd=>{const proof=await execRun("git",["rev-parse","--show-toplevel"],{cwd,timeoutMs:15e3});return{code:proof.code,stdout:proof.stdout}});if(!cloned.ok)return answer(cloned.reason,cloned.message,1);if(cloned.target!==target)return answer("malformed","the clone answered with a different path than the preview promised — refused; nothing was connected",1);let words="";const code=await withAdmission(where,line=>problems.push(line),said,async admission=>{const now=new Date,admitted=await admitProject(admission.store,{registryFile:admission.registryFile,path:cloned.target,actor:admission.actor,now});return admitted.ok?(words=addedWords(admitted.name,admitted.added,consoleRunning(admission.store,now)),0):(said.reason=admitted.reason,problems.push(`${cloned.target} is cloned but not added — ${admitted.message} Add it with \`repos add ${cloned.target}\`.`),1)});return code!==0?answer(said.reason??"failed",problems.join(" "),code):json?(write(envelopeJson({ok:!0,command,target:cloned.target,nameWithOwner:previewed.preview.nameWithOwner})),0):(write(`Cloned ${previewed.preview.nameWithOwner} into ${cloned.target}.`),write(words),write("Large-file objects were not downloaded — run `git lfs pull` in the repository when you need them."),0)}async function runPullsCommand(argv,write){const json=argv.includes("--json"),unknown=argv.find(argument=>argument.startsWith("-")&&argument!=="--json");if(unknown!==void 0)return write(`unknown option ${unknown} — \`pulls\` takes paths and --json`),USAGE_EXIT;const named=argv.filter(argument=>!argument.startsWith("-")).map(path=>resolve(path)),targets=named.length>0?named:await defaultPullTargets(write);if(targets===null)return 1;const{present,missing}=partitionRoots(targets,existsSync);if(present.length===0)return write(json?envelopeJson({ok:!1,command:"pulls",reason:"no-repositories",message:describeMissing(missing),groups:[]}):describeMissing(missing)),USAGE_EXIT;const groups=await Promise.all(present.map(async path=>{const read=await readPulls(path);return{repo:basename(path),pulls:read.pulls,problems:read.problems}}));return write(json?envelopeJson({ok:!0,command:"pulls",count:groups.length,groups}):renderPulls(groups,{now:new Date})),0}async function runGraphCommand(argv,write){const json=argv.includes("--json"),unknown=argv.find(argument=>argument.startsWith("-")&&argument!=="--json");if(unknown!==void 0)return write(`unknown option ${unknown} — \`graph\` takes paths and --json`),USAGE_EXIT;const named=argv.filter(argument=>!argument.startsWith("-")).map(path=>resolve(path)),targets=named.length>0?named:await defaultPullTargets(write);if(targets===null)return 1;const{present,missing}=partitionRoots(targets,existsSync);if(present.length===0)return write(json?envelopeJson({ok:!1,command:"graph",reason:"no-repositories",message:describeMissing(missing),detections:[]}):describeMissing(missing)),USAGE_EXIT;const detections=await detectGraphs(present),enrolled=enrolledBackend(present),envelope={detections,choice:chooseBackend(detections,enrolled===void 0?{}:{enrolled}),setup:setupOptions()};return write(json?envelopeJson({ok:!0,command:"graph",...envelope}):renderGraph(detections,enrolled===void 0?{}:{enrolled})),0}function enrolledBackend(repos){const store=openStoreReadOnly(databasePath(process.env,homedir()));if(store!==null)try{const wanted=new Set(repos),grant=store.listGrants().find(one=>wanted.has(one.repo));return grant!==void 0&&isBackendKind(grant.backend)?grant.backend:void 0}catch{return}finally{store.close()}}function isBackendKind(name){return Object.prototype.hasOwnProperty.call(GRAPH_LABELS,name)}async function defaultPullTargets(write){const enrolled=await loadRepos(configFile());return"error"in enrolled?(write(enrolled.error),null):enrolled.repos.length>0?enrolled.repos:[process.cwd()]}export function parseLinkArgs(argv){const args={yes:!1};for(let index=0;index<argv.length;index++){const argument=argv[index];if(argument==="--yes"||argument==="-y")args.yes=!0;else if(argument==="--to"){const dir=argv[++index];if(dir===void 0)return{error:"--to needs a directory"};args.to=dir}else return{error:`unknown option ${argument} — try \`toolroll --help\``}}return{args}}async function runLinkCommand(command,argv,write,binSource){const parsed=parseLinkArgs(argv);if("error"in parsed)return write(parsed.error),USAGE_EXIT;const{to,yes}=parsed.args,choice=chooseTarget({pathEntries:(process.env.PATH??"").split(delimiter).filter(Boolean),home:homedir(),...to===void 0?{}:{override:to}});if(command==="unlink")return runUnlink(choice.dir,yes,write);const resolved=binSource===void 0?resolveBinSource():{source:binSource};return"error"in resolved?(write(resolved.error),USAGE_EXIT):runLink(resolved.source,choice,yes,write)}function resolveBinSource(){const here=fileURLToPath(import.meta.url),source=here.endsWith(".ts")?resolve(dirname(here),"..","dist","cli.js"):here;return existsSync(source)?{source}:{error:"Run `npm run build` first — there is no built command to link to yet."}}async function runLink(source,choice,yes,write){const plan=await planLink(source,choice.dir);if(plan.action==="conflict")return write(`${plan.target}: ${plan.reason}.`),write("Remove it yourself if you want it gone, or use --to <dir> to link elsewhere."),1;if(plan.action==="already")return write(`Already linked: ${plan.target} → ${plan.source}`),0;if(write(plan.action==="replace"?`Will replace ${plan.target}`:`Will create ${plan.target}`),write(` → ${plan.source}`),plan.action==="replace"&&write(` (it currently points at ${plan.current})`),!yes)return write(""),write("Nothing has been written. Re-run with --yes to do it."),0;try{await applyLink(plan)}catch(error){return write(error instanceof Error?error.message:String(error)),1}return write(""),write(`Linked. \`${BIN_NAME}\` is now a command.`),choice.onPath||(write(""),write(`${choice.dir} is not on your PATH. ${describePathFix(choice.dir)}`)),0}function describePathFix(dir){return process.platform==="win32"?["Add it for this session:",` $env:PATH = "${dir}${delimiter}$env:PATH"`,"or permanently, for your user only:",` setx PATH "${dir}${delimiter}%PATH%"`].join(`
|
|
7
8
|
`):["Add this to your shell profile:",` export PATH="${dir}${delimiter}$PATH"`].join(`
|
|
8
9
|
`)}async function runUnlink(dir,yes,write){const plan=await planUnlink(dir);return plan.action==="absent"?(write(`Nothing to remove: ${plan.target} does not exist.`),0):plan.action==="foreign"?(write(`${plan.target}: ${plan.reason}. Leaving it alone.`),1):(write(`Will remove ${plan.target} → ${plan.current}`),yes?(await applyUnlink(plan),write(""),write("Removed."),0):(write(""),write("Nothing has been removed. Re-run with --yes to do it."),0))}export const SKILLS_ACTIONS=["install","list","get"],SKILLS_FLAGS={install:{json:"flag",yes:"flag","claude-code":"flag",dir:"value","write-context":"flag",repo:"value"},list:{json:"flag"},get:{json:"flag"}};function runSkillsCommand(argv,write){const json=argv.includes("--json"),action=argv.find(argument=>!argument.startsWith("-")),usage=message=>(write(json?envelopeJson({ok:!1,command:action===void 0?"skills":`skills ${action}`,reason:"usage",message}):message),USAGE_EXIT);if(action===void 0||!SKILLS_ACTIONS.includes(action))return usage("`toolroll skills install --claude-code [--dir <path>] [--yes]` · `skills install [--repo <path>] [--write-context] [--yes]` · `skills list` · `skills get <name>` — all take --json");const allowed=SKILLS_FLAGS[action],positionals=[];for(let index=0;index<argv.length;index++){const argument=argv[index];if(!argument.startsWith("-")){positionals.push(argument);continue}const name=argument.replace(/^--?/,"");if(name==="h"||name==="help")return usage(`\`toolroll skills ${action}\` — flags: ${Object.keys(allowed).map(one=>`--${one}`).join(" ")}`);const arity=allowed[name];if(arity===void 0)return usage(`unknown option --${name} for \`skills ${action}\``);if(arity==="value"){const value=argv[index+1];if(value===void 0||value.startsWith("-"))return usage(`--${name} needs a value`);index+=1}}if(action==="list"){if(positionals.length>1)return usage("`skills list` takes no arguments");if(json)return write(envelopeJson({ok:!0,command:"skills list",guides:GUIDES.map(one=>({name:one.name,title:one.title,oneLiner:one.oneLiner}))})),0;write("Guides this exact binary serves — `toolroll skills get <name>`:");for(const guide of GUIDES)write(` ${guide.name.padEnd(14)} ${guide.oneLiner}`);return 0}if(action==="get"){const name=positionals[1];if(name===void 0||positionals.length>2)return usage("`toolroll skills get <name>` — one guide name from `skills list`");const guide=guideNamed(name);return guide===null?(write(json?envelopeJson({ok:!1,command:"skills get",reason:"unknown-skill",message:`no guide named ${name} — the guides are: ${GUIDES.map(one=>one.name).join(", ")}`}):`no guide named ${name} — the guides are: ${GUIDES.map(one=>one.name).join(", ")}`),3):json?(write(envelopeJson({ok:!0,command:"skills get",name:guide.name,title:guide.title,content:guide.content})),0):(write(guide.content),0)}const claudeCode=argv.includes("--claude-code"),confirmed=argv.includes("--yes");if(positionals.length>1)return usage("`skills install` takes no arguments beyond its flags");if(claudeCode){if(argv.includes("--repo")||argv.includes("--write-context"))return usage("--claude-code uses --dir, not --repo or --write-context");const dirAt=argv.indexOf("--dir"),directory=dirAt===-1?defaultClaudeCodeSkillDir():resolve(argv[dirAt+1]),plan2=planClaudeCodeInstall(directory);if(!confirmed){const message=plan2.files.some(file=>file.action==="refuse-foreign")?"Nothing was written. Move the existing file you want to keep, or choose another --dir.":"Nothing was written. Re-run with --yes to install the Claude Code skill.";if(json)return write(envelopeJson({ok:!1,command:"skills install",reason:"unconfirmed",message,plan:plan2})),3;write(`Would install the Claude Code skill in ${plan2.directory}:`);for(const file of plan2.files){const action2=file.action==="refuse-foreign"?"REFUSED — this file was not written by the installer":file.action;write(` ${file.path} (${action2})`)}for(const path of plan2.legacyFiles)write(` ${path} (remove — replaced by the new copy)`);return write(""),write(message),3}const result2=applyClaudeCodeInstall(directory);if(!result2.ok)return write(json?envelopeJson({ok:!1,command:"skills install",reason:result2.reason,message:result2.message,plan:result2.plan}):result2.message),1;if(json)return write(envelopeJson({ok:!0,command:"skills install",target:"claude-code",wrote:result2.wrote,plan:result2.plan})),0;for(const file of result2.wrote)write(`wrote ${file}`);for(const path of result2.plan.legacyFiles)write(`removed ${path}`);return write("Claude Code will use the refreshed Toolroll guides in its next session."),0}if(argv.includes("--dir"))return usage("--dir belongs with --claude-code");const repoAt=argv.indexOf("--repo"),repo=repoAt!==-1?resolve(argv[repoAt+1]):process.cwd(),writeContext=argv.includes("--write-context");if(!existsSync(join(repo,".git")))return write(json?envelopeJson({ok:!1,command:"skills install",reason:"not-a-repo",message:`${repo} has no .git — name the repository with --repo`}):`${repo} has no .git — name the repository with --repo`),USAGE_EXIT;const plan=planInstall(repo,writeContext);if(!confirmed){if(json)return write(envelopeJson({ok:!1,command:"skills install",reason:"unconfirmed",plan})),3;if(write("Would write, exactly:"),write(` ${plan.skillPath} (${plan.skillAction==="refuse-foreign"?"REFUSED — a skill this installer did not write is already there":plan.skillAction})`),plan.legacySkillPath!==null&&write(` ${plan.legacySkillPath} (remove — replaced by the new copy)`),plan.contextPath!==null)write(` ${plan.contextPath} (${plan.contextAction} — only the marked block is ever touched)`);else{write(" AGENTS.md untouched — add --write-context to install the managed block, or paste it yourself:"),write("");for(const line of contextBlock().split(`
|
|
@@ -10,4 +11,4 @@ import{existsSync,lstatSync,realpathSync,unlinkSync,writeFileSync}from"node:fs";
|
|
|
10
11
|
|
|
11
12
|
A throwaway sandbox: a scripted lead in Chat, sample projects and flows mid-flight. It never calls a model, spends or reaches outside; Ctrl-C removes it unless --keep.`),0;if(!Number.isInteger(port)||port<0||port>65535)return write(json?envelopeJson({ok:!1,command:"demo",reason:"usage",message:DEMO_USAGE}):DEMO_USAGE),2;const hostIndex=argv.indexOf("--host"),host=hostIndex===-1?"127.0.0.1":argv[hostIndex+1]??"",allowIndex=argv.indexOf("--allow-host"),allowedHosts=allowIndex===-1?[]:(argv[allowIndex+1]??"").split(",").map(one=>one.trim()).filter(one=>one!=="");if(host===""||host.startsWith("--")||allowIndex!==-1&&allowedHosts.length===0)return write(json?envelopeJson({ok:!1,command:"demo",reason:"usage",message:DEMO_USAGE}):DEMO_USAGE),2;const{createDemoSandbox}=await import("./demo.js"),{createDecisionServer}=await import("./serve.js"),now=new Date,{sandbox,store,seed,evidenceRoot,passwordFile,lead}=createDemoSandbox(now),server=createDecisionServer({store,evidenceRoot,clock:()=>new Date,repos:seed.repos,demoLead:lead,backgroundChecks:!0,...allowedHosts.length===0?{}:{allowedHosts}});await new Promise((ready,failed)=>{server.once("error",failed),server.listen(port,host,ready)});const address=server.address(),boundPort=typeof address=="object"&&address!==null?address.port:port,url=allowedHosts.length>0?`http://${allowedHosts[0]}`:`http://127.0.0.1:${boundPort}`,terminal=seams.terminal??(process.stdin.isTTY===!0&&process.stdout.isTTY===!0),demoSignIn=await import("./demo-sign-in.js"),signInPage=await import("./sign-in-page.js"),canOpen=signInPage.platformOpener()!==null,{SIGN_IN_LINK_MS}=await import("./server/session.js"),linkExpiresAt=Date.now()+SIGN_IN_LINK_MS,signIn=canOpen?demoSignIn.demoSignInLink(server,seed.login.name,{stdin:terminal,stdout:terminal,agent:seams.underAgent??underAgent(process.env),json}):null;let removePage=()=>{},opened=!1;if(signIn!==null){const page=await signInPage.openSignInLink(signIn,{parent:sandbox,spent:signInPage.ledgerSpent(store,"one-time link",seed.login.name),expiresAt:linkExpiresAt,...seams.opener===void 0?{}:{opener:seams.opener}});removePage=page.stop,opened=page.opened}if(json?write(envelopeJson({ok:!0,command:"demo",url,sandbox,login:{name:seed.login.name,passwordFile},keep})):(write("Demo sandbox is up. Chat answers from a script: no model, no key, no cost, nothing leaves this machine."),write(""),write(` open ${url}`),write(` login ${seed.login.name} / ${seed.login.password}`),write(` sandbox ${sandbox}`),write(""),opened?(write("Opened in your browser, signed in."),write("")):signIn!==null&&(write("Your browser didn't open: go to the address above and sign in with the login above."),write("")),write('Open Chat and ask for a change, like "fix the flaky refund test".'),write("For your own project, run `toolroll` in its folder."),write(""),write(keep?"Ctrl-C stops the server; the sandbox is KEPT. It stays a demo forever — every spending command refuses it.":"Ctrl-C stops the server and deletes the sandbox. --keep preserves it (still fenced from spending).")),await new Promise(done=>{const stop=()=>{process.off("SIGINT",stop),process.off("SIGTERM",stop),done()};process.on("SIGINT",stop),process.on("SIGTERM",stop),seams.stop?.then(stop)}),removePage(),lead.stop(),await new Promise(closed=>server.close(()=>closed())),store.close(),keep)json||(write(`Sandbox kept at ${sandbox} — reopen it any time: toolroll serve --db ${join(sandbox,"orders.db")}`),write("For your own project, run `toolroll` in its folder."));else{const{rmSync}=await import("node:fs");rmSync(sandbox,{recursive:!0,force:!0,maxRetries:10,retryDelay:50}),json||write("Sandbox deleted.")}return 0}export const CONTRACT_FLAGS=["json","commands"];function runContractCommand(argv,write){const json=argv.includes("--json");for(const argument of argv){const bad=message=>(write(json?envelopeJson({ok:!1,command:"contract",reason:"usage",message}):message),USAGE_EXIT);if(!argument.startsWith("-"))return bad(`\`toolroll contract\` takes no arguments — flags: ${CONTRACT_FLAGS.map(one=>`--${one}`).join(" ")}`);const name=argument.replace(/^--?/,"");if(name==="h"||name==="help")return bad("`toolroll contract [--commands] [--json]`");if(!CONTRACT_FLAGS.includes(name))return bad(`unknown option ${argument} for \`contract\``)}if(argv.includes("--commands")){if(json)return write(envelopeJson({ok:!0,command:"contract",schemaVersion:SURFACE_SCHEMA_VERSION,notes:SURFACE_NOTES,commands:COMMAND_GUIDE})),0;write(`toolroll declared command guide — schema v${SURFACE_SCHEMA_VERSION}`),write(""),write(`authority: ${SURFACE_NOTES.authority}`),write(`flags: ${SURFACE_NOTES.flags}`),write(`reasons: ${SURFACE_NOTES.reasons}`),write("");const agentRows=COMMAND_GUIDE.filter(row=>row.agentMayInvoke),operatorRows=COMMAND_GUIDE.filter(row=>!row.agentMayInvoke);write("Agent surface:");for(const row of agentRows){const name=row.invocation===""?"(no verb)":row.invocation;write(` ${name.padEnd(18)} ${row.synopsis} [${row.mutation}]`);for(const flag of row.flags??[])write(` --${flag.name}${flag.takesValue?" <value>":""} ${flag.meaning}`);row.notableReasons!==void 0&&row.notableReasons.length>0&&write(` reasons: ${row.notableReasons.join(", ")}`)}write(""),write("Operator ceremonies and infrastructure — an agent must not invoke"),write("these, even when credentials are within reach; the credential IS the"),write("person:");for(const row of operatorRows)write(` ${row.invocation.padEnd(18)} ${row.synopsis}`);return 0}if(json)return write(envelopeJson({ok:!0,command:"contract",capabilities:[...CAPABILITIES]})),0;write(`toolroll machine contract — envelope v${ENVELOPE_VERSION}`),write(""),write("Every --json answer is one envelope on stdout: { envelopeVersion, ok,"),write("command, ... } — failures add a stable `reason` token and a human"),write("`message`. Consumers must ignore keys and capabilities they do not"),write("recognize."),write(""),write("Capabilities:");for(const capability of CAPABILITIES)write(` ${capability}`);return write(""),write("`contract --commands` dumps the declared command guide."),0}function renderJson(repos,roots,missingRoots,now,remote){const withRemote=repos.map(repo=>{const state=remote?.get(repo.path);return{...repo,pulls:state?.pulls??[],issues:state?.issues??[],pullsRead:state?.pullsRead??!1,issuesRead:state?.issuesRead??!1,remoteSkipped:state?.skipped??!1,remoteProblems:state?.problems??[]}});return envelopeJson({ok:!0,command:"scan",scannedAt:now.toISOString(),roots,missingRoots,remoteRead:remote!==void 0,repos:withRemote})}export function isDirectInvocation(moduleUrl,entry,toRealPath=realpathSync){if(entry===void 0)return!1;try{return moduleUrl===pathToFileURL(toRealPath(entry)).href}catch{return!1}}function hushExperimentalSqlite(){const original=process.emitWarning.bind(process);process.emitWarning=((warning,...rest)=>{const type=typeof rest[0]=="string"?rest[0]:rest[0]?.type,text=warning instanceof Error?warning.message:String(warning);type==="ExperimentalWarning"&&text.includes("SQLite")||original(warning,...rest)})}async function runRemoteTuiCommand(argv,write,connectOptions){let profileName,devBinary=null;for(let i=0;i<argv.length;i+=1){const arg=argv[i];if(arg==="--help"||arg==="-h")return write(`toolroll --remote [--profile <name>]
|
|
12
13
|
Open the terminal workbench connected to your saved central Toolroll server.
|
|
13
|
-
Connect first with: toolroll connect <https://origin> --browser`),0;if(arg==="--profile"||arg==="--tui-binary"){const next=argv[++i];if(!next||next.startsWith("--"))return write(`${arg} needs a value.`),2;arg==="--profile"?profileName=next:devBinary=next;continue}return write(`Unknown option for --remote: ${arg}`),2}let profile;try{profile=centralProfile(connectOptions,profileName)}catch(error){return write(error instanceof Error?error.message:"Could not read saved remote profile."),2}if(profile===null)return write("No central server connected yet. Run: toolroll connect <https://origin> --browser"),2;if(!profile.apiToken)return write("Remote terminal mode requires an API token (so_...). Reconnect with --token-stdin or --token-file."),2;if(!profile.origin.startsWith("https://"))return write("Remote terminal mode requires an HTTPS origin (for example over Tailscale HTTPS)."),2;let workspaceId=profile.workspaceId,recoveryGeneration=profile.recoveryGeneration;if(workspaceId===void 0||recoveryGeneration===void 0){const probed=await probeTerminalConnection(profile,connectOptions);if(probed===null)return write(`Could not verify ${profile.origin}/engine/connection with your saved API token.`),1;workspaceId=probed.workspace.id,recoveryGeneration=probed.workspace.recoveryGeneration,saveCentralBinding(connectOptions,profile.name,{workspaceId,recoveryGeneration,label:probed.workspace.label})}const{engineContractDigest}=await import("./contracts/engine-api.js"),{
|
|
14
|
+
Connect first with: toolroll connect <https://origin> --browser`),0;if(arg==="--profile"||arg==="--tui-binary"){const next=argv[++i];if(!next||next.startsWith("--"))return write(`${arg} needs a value.`),2;arg==="--profile"?profileName=next:devBinary=next;continue}return write(`Unknown option for --remote: ${arg}`),2}let profile;try{profile=centralProfile(connectOptions,profileName)}catch(error){return write(error instanceof Error?error.message:"Could not read saved remote profile."),2}if(profile===null)return write("No central server connected yet. Run: toolroll connect <https://origin> --browser"),2;if(!profile.apiToken)return write("Remote terminal mode requires an API token (so_...). Reconnect with --token-stdin or --token-file."),2;if(!profile.origin.startsWith("https://"))return write("Remote terminal mode requires an HTTPS origin (for example over Tailscale HTTPS)."),2;let workspaceId=profile.workspaceId,recoveryGeneration=profile.recoveryGeneration;if(workspaceId===void 0||recoveryGeneration===void 0){const probed=await probeTerminalConnection(profile,connectOptions);if(probed===null)return write(`Could not verify ${profile.origin}/engine/connection with your saved API token.`),1;workspaceId=probed.workspace.id,recoveryGeneration=probed.workspace.recoveryGeneration,saveCentralBinding(connectOptions,profile.name,{workspaceId,recoveryGeneration,label:probed.workspace.label})}const{engineContractDigest}=await import("./contracts/engine-api.js"),{chooseOrRebuildTuiBinary,formatCentralBootstrapPayload,runTuiBinary}=await import("./tui-launch.js"),chosen=await chooseOrRebuildTuiBinary({env:process.env,screenReader:!1,platform:process.platform,arch:process.arch,contract:engineContractDigest(),devBinary,write});if(!chosen.ok)return write(`Could not start the terminal workbench: ${chosen.why}.`),1;const payload=formatCentralBootstrapPayload({origin:profile.origin,workspaceId,recoveryGeneration,account:profile.account,token:profile.token}),origin=profile.origin,openUrl=async path=>{const target=new URL(path,origin).href;return(await import("./operate.js")).openBrowser(target)?`Opened ${target} in your browser.`:`Open ${target} in a browser.`},ended=await runTuiBinary({binary:chosen.binary,identity:chosen.identity,link:payload,project:null,session:{owned:()=>!1,openBrowser:async page=>openUrl(page?.startsWith("/t/")===!0&&/^\/t\/[A-Za-z0-9_-][A-Za-z0-9_.-]{0,127}$/.test(page)?page:page==="projects"?"/projects":page==="lead-providers"?"/settings/lead#lead-config":"/"),list:async()=>[],detail:async()=>null,decide:async()=>({ok:!1,words:"Approvals open in your browser."}),addTask:async()=>({ok:!1,words:"Handled by remote CLI."}),steer:async()=>({ok:!1,words:"Handled by remote CLI."}),revise:async()=>({ok:!1,words:"Handled by remote CLI."}),complete:async()=>({ok:!1,words:"Handled by remote CLI."}),stop:async()=>({ok:!1,words:"Handled by remote CLI."})}});return ended==="central-unavailable"||ended==="changed"?1:0}export async function runCliProcess(argv){hushExperimentalSqlite(),process.exitCode=await main(argv)}isDirectInvocation(import.meta.url,process.argv[1])&&(hushExperimentalSqlite(),main(process.argv.slice(2)).then(code=>{process.exitCode=code}));
|