limixbot 0.3.51 → 0.3.53
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/dist/assets/{ActivityPanel-C74ksK5_.js → ActivityPanel-DIQkh4hc.js} +1 -1
- package/dist/assets/App-CxKkZhGV.js +243 -0
- package/dist/assets/{AppEventEditor-Derw3FHd.js → AppEventEditor-FVbe8Mvz.js} +1 -1
- package/dist/assets/BotSettingsDialog-BKWvg7df.js +16 -0
- package/dist/assets/{BrowserPanel-BUwH6i3q.js → BrowserPanel-CkiqrVEm.js} +2 -2
- package/dist/assets/{BrowserProfilesManager-LPWaNOTL.js → BrowserProfilesManager-C2OqwZn1.js} +1 -1
- package/dist/assets/CloudAddDialog-BH5eLBvi.js +1 -0
- package/dist/assets/ComputerFilesPane-iOrAAtHV.js +1 -0
- package/dist/assets/{ComputerPanel-BKSAp5BV.js → ComputerPanel-le89nav2.js} +2 -2
- package/dist/assets/{DataPanel-C8JFQXPW.js → DataPanel-CcOlPY1d.js} +1 -1
- package/dist/assets/{DesktopViewer-DFhYwHIq.js → DesktopViewer-Du64Zar0.js} +1 -1
- package/dist/assets/{FilesView-uvhFDVLX.js → FilesView-hGRu-0jv.js} +1 -1
- package/dist/assets/{GrokMoveDialog-DqtBggcO.js → GrokMoveDialog-Dy6gcobX.js} +1 -1
- package/dist/assets/{InspectorPanel-B9946G8k.js → InspectorPanel-BzC5WSUu.js} +2 -2
- package/dist/assets/{KeyboardShortcutsModal-3p8-Y0gj.js → KeyboardShortcutsModal-BtAZADk0.js} +1 -1
- package/dist/assets/{LimixChannelReview-BDF1Ho_G.js → LimixChannelReview-BFN0ep6x.js} +1 -1
- package/dist/assets/{LiveDesktop-csn9EgQr.js → LiveDesktop-IxdGhD-Q.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-CY-cK25P.js → LocalVmWorkspace-Gt1f31fp.js} +1 -1
- package/dist/assets/{MacLocalControl-tjDKmfaz.js → MacLocalControl-oEzEDSQg.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-C9270gON.js → MarkdownFilePreview-DJwfsd44.js} +1 -1
- package/dist/assets/{MenuMotion-CtV49YrJ.js → MenuMotion-DFWzLAOE.js} +1 -1
- package/dist/assets/{NewBotDialog-QR0H-5OX.js → NewBotDialog-D35bddr4.js} +1 -1
- package/dist/assets/{PhoneAppDialog-4jvBw2u6.js → PhoneAppDialog-KUYTOj7D.js} +1 -1
- package/dist/assets/PlacesRail-i-4ph-KR.js +1 -0
- package/dist/assets/{PluginsPanel-DHUbnE7N.js → PluginsPanel-CuagbyMf.js} +2 -2
- package/dist/assets/ProIntroduction-__lUgknC.js +1 -0
- package/dist/assets/{RemoteAgentSettingsPanel-Dllevm4e.js → RemoteAgentSettingsPanel-cEvDuPCS.js} +1 -1
- package/dist/assets/{RoomPanel-Bd_Xtwqu.js → RoomPanel-BD90s9Gm.js} +1 -1
- package/dist/assets/{RoutinesPage-QcfeQgTy.js → RoutinesPage-D9Iluc9-.js} +2 -2
- package/dist/assets/SettingsModal-9sV2Uiaz.js +19 -0
- package/dist/assets/{ShareTeamDialog-DMqi3pEn.js → ShareTeamDialog-DtorqFJu.js} +1 -1
- package/dist/assets/{SignedInSites-DayALoO-.js → SignedInSites-C25nZIiv.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-DMAGl5Yz.js → TeamLibraryPanel-DOdfbGyQ.js} +1 -1
- package/dist/assets/{TeamMapPage-MEkKU-EN.js → TeamMapPage-DMQdbBL9.js} +1 -1
- package/dist/assets/{TriggersPage-D3KTWX3z.js → TriggersPage-Yhbyd0Ek.js} +1 -1
- package/dist/assets/VisibilitySection-C2HwkrIB.js +22 -0
- package/dist/assets/{WebhookTrigger-DJlTvzBb.js → WebhookTrigger-BV_b2cuN.js} +1 -1
- package/dist/assets/{WorksOnGrid-CW82h_3C.js → WorksOnGrid-ag2h-J0c.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-DmWI1Mtg.js → abnfDiagram-YUKMZFIV-CAhmS2rs.js} +1 -1
- package/dist/assets/{activity-WfPBvs3Z.js → activity-Bi0tXcsw.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-rzc3-Q0w.js → architectureDiagram-47P4ROYG-B6w0Yu0g.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-VPDyKlQ7.js → blockDiagram-E7TT5TSB-BYtaJu6s.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-C9OGckku.js → c4Diagram-CRA5TL53-B_FsOyDV.js} +1 -1
- package/dist/assets/{calendar-days-W4JHp6-m.js → calendar-days-B8SfZLZO.js} +1 -1
- package/dist/assets/channel-DVwNbGUM.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-EpYkwMC8.js → chunk-2Q5K7J3B-BdKiuWEd.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-DyJEI8X6.js → chunk-5VM5RSS4-CgItQr02.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-CJvVxQ2I.js → chunk-7TKQ45FW-BFsWqiRT.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-s78zNrhy.js → chunk-AW2ZBBNX-Cnj5ddTo.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-CUPjaz9e.js → chunk-FVRAUYC3-BCqqreNP.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-BhuM2dxl.js → chunk-HTAEGDNF-BOE8LQps.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-DAj1UgJ8.js → chunk-JWPE2WC7-DhA4nyzx.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-BgfdtkJI.js → chunk-KQW6MTUR-DzXl5ZXS.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-Vak43p0S.js → chunk-XXDRQBXY-C6tPSut7.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-Cjvbs86l.js → classDiagram-v2-K4WV4PDN-DQW9NJQl.js} +1 -1
- package/dist/assets/{core-x2kyD7fr.js → core-wXrRNESU.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-BEekB3gO.js → cose-bilkent-JH36ORCC-6jNO5GSL.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-D3g3_jPk.js → cynefin-EF2NZ3EQ-mnQt4_3K.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-13xmjXZj.js → cynefinDiagram-3GCD6N5R-DoEMDFuf.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-CHAV8s2t.js → dagre-W4DXFKR2-DoKMCbtK.js} +1 -1
- package/dist/assets/de-C8GllVmL.js +8 -0
- package/dist/assets/{diagram-2UJZ2QOL-DgwdzZN7.js → diagram-2UJZ2QOL-dVwBPQ-y.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-DobmWwa_.js → diagram-OVF4WLC6-xIwVUznT.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-CWjTVc0N.js → diagram-PFPMY2P6-DAkRkPXu.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-CAruZkhk.js → diagram-UMYRVEAY-YE49n-np.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-Bcs89mQN.js → diagram-YEKJPTXX-DQkmy5qU.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-Dz-O18tl.js → diagram-ZIFT7M5P-u9Uj06_B.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-CJX4rMIs.js → ebnfDiagram-VR2GEFS7-DoxIDWDW.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-Byop6FtW.js → elk-IJKZMXRS-DPDeQQIg.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-ChpLnNCF.js → erDiagram-O2IAPWRE-BHdTvU5H.js} +1 -1
- package/dist/assets/{file-up-G3qWGpEB.js → file-up-BkYyRMzo.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-CWWhkNOE.js → flowDiagram-OXPTDLAJ-ChNmwKMG.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-DMXicWgq.js → ganttDiagram-R7TSEDQI-3Sx3AKf_.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-CpiCnPUQ.js → gitGraphDiagram-XJZIOB7I-C67fsohV.js} +1 -1
- package/dist/assets/{import-name-Dob2tT-n.js → import-name-CtM6o0iP.js} +1 -1
- package/dist/assets/{index-B7zM90O2.js → index-Bsx9nj0X.js} +1 -1
- package/dist/assets/index-CNJBUMXg.js +3 -0
- package/dist/assets/{infoDiagram-5W2HQ5XZ-BU9zbv9f.js → infoDiagram-5W2HQ5XZ-CBtxWn_a.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-KEjUVvmG.js → ishikawaDiagram-K3B6WC7H-B0368JQ8.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-DGU1V_40.js → journeyDiagram-COXZFDF6-BlyoIOJv.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-weJ2OFB2.js → kanban-definition-P3RFRI5V-Cn5CUDI2.js} +1 -1
- package/dist/assets/{mcp-servers-Cki_Gh83.js → mcp-servers-2qPA-IkI.js} +1 -1
- package/dist/assets/{mermaid.core-DhSRukyE.js → mermaid.core-BitzuZjJ.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-DKKO0DWj.js → mindmap-definition-LZFPQGKD-Jg9lbPrn.js} +1 -1
- package/dist/assets/{minimize-C16JX5N8.js → minimize-CIbeUlkc.js} +1 -1
- package/dist/assets/{monitor-Bben4nuu.js → monitor-CQgH3Q9j.js} +1 -1
- package/dist/assets/{new-bot-Cdx_YpVT.js → new-bot-B_VdIM0S.js} +2 -2
- package/dist/assets/org-library-Dh8-yJT-.js +1 -0
- package/dist/assets/{package-format-C4A5Q4UD.js → package-format-DjWXsBZ0.js} +2 -2
- package/dist/assets/{pegDiagram-BGZESJAR-CNNprTkt.js → pegDiagram-BGZESJAR-CnAlnJHt.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-pS8U8zdK.js → pieDiagram-CAPJLFHJ-DaL17-zU.js} +1 -1
- package/dist/assets/pt-br-DiNqB940.js +13 -0
- package/dist/assets/{quadrantDiagram-GDMTTRAM-CLk_fr2j.js → quadrantDiagram-GDMTTRAM-BJHzyXHs.js} +1 -1
- package/dist/assets/rail-BDfsZpav.js +1 -0
- package/dist/assets/{railroadDiagram-SM67HX2B-DH8VPMJG.js → railroadDiagram-SM67HX2B-Cw9re6eo.js} +1 -1
- package/dist/assets/{remote-desktop-panel-XKcfTfrc.js → remote-desktop-panel-BmTQ50TK.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-CoHRI7dx.js → requirementDiagram-X7JNWC4A-Cd7X7PJA.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-2zcVfvWw.js → sankeyDiagram-UM26HJRW-nufeOHip.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-B0d21eid.js → sequenceDiagram-ZO4K6R2Y-CMZoHw7j.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-CcYkvoh7.js → sizeCapture-INFHLROL-DPZOqMVW.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-B5EilR72.js → stateDiagram-v2-TBUQTH76-BpWOIyFw.js} +1 -1
- package/dist/assets/styles-BvB4UlHn.js +79 -0
- package/dist/assets/styles-Ce5Qc_2r.css +1 -0
- package/dist/assets/{swimlanes-N4OXWK64-xM7mNll9.js → swimlanes-N4OXWK64-BNx8ZaTX.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-BO73RuC_.js +8 -0
- package/dist/assets/{team-share-Bp69YR8I.js → team-share-CNY994iy.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-DM6SmhCQ.js → timeline-definition-YOQAKGHF-L78B2xWx.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-DiUdGN3G.js → usecaseDiagram-VIAY4XPW-gU5zWpPp.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-DrtmNBp4.js → vennDiagram-BLWOH2XV-pdiz8880.js} +1 -1
- package/dist/assets/vi-Cbg_srO_.js +15 -0
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-D7jihWm5.js → wardleyDiagram-YMQ3BMBF-F-D92MhK.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-BCk-D9Uj.js → xychartDiagram-TAQBALBS-DKMdsWWR.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/rail.html +5 -5
- package/dist-server/bot-box/box-check.js +10 -10
- package/dist-server/cloud-home-start.js +5 -5
- package/dist-server/container-mcp.js +2 -2
- package/dist-server/drivers/agents-proxy.js +128 -126
- package/dist-server/index.js +8241 -7922
- package/dist-server/mcp-gate.js +18 -17
- package/dist-server/openmausbot.js +1153 -1119
- package/dist-server/package.json +1 -1
- package/dist-server/pair-cli.js +1028 -997
- package/dist-server/server/activity.js +1 -0
- package/dist-server/server/agents-turn.js +2 -1
- package/dist-server/server/app-settings/host.js +187 -0
- package/dist-server/server/app-settings/picture-file.js +62 -0
- package/dist-server/server/app-settings/registry-bots.js +147 -0
- package/dist-server/server/app-settings/registry-config.js +190 -0
- package/dist-server/server/app-settings/registry-pictures.js +59 -0
- package/dist-server/server/app-settings/registry-window.js +35 -0
- package/dist-server/server/app-settings/registry.js +287 -0
- package/dist-server/server/attachments.js +16 -12
- package/dist-server/server/automation-reports.js +11 -1
- package/dist-server/server/bot-attachment.js +34 -10
- package/dist-server/server/bot-box/env.js +2 -2
- package/dist-server/server/bot-box/plan.js +1 -1
- package/dist-server/server/cloud-home-start.js +2 -0
- package/dist-server/server/config.js +1 -0
- package/dist-server/server/drivers/acp/client-path.js +39 -0
- package/dist-server/server/drivers/acp/core.js +9 -37
- package/dist-server/server/drivers/agents-app-settings-tool.js +22 -0
- package/dist-server/server/drivers/agents-call.js +8 -3
- package/dist-server/server/drivers/agents-catalog-profile.js +2 -1
- package/dist-server/server/drivers/agents-catalog.js +19 -2
- package/dist-server/server/drivers/agents-claude-defer.js +38 -0
- package/dist-server/server/drivers/agents-mcp-env.js +2 -2
- package/dist-server/server/drivers/agents-mcp.js +2 -1
- package/dist-server/server/drivers/agents-proxy.js +0 -1
- package/dist-server/server/drivers/agents-tool-groups.js +45 -0
- package/dist-server/server/drivers/antigravity-acp.js +6 -2
- package/dist-server/server/drivers/antigravity-skills.js +107 -0
- package/dist-server/server/drivers/antigravity.js +9 -1
- package/dist-server/server/drivers/claude-bot-settings.js +22 -1
- package/dist-server/server/drivers/claude-tool-search.js +20 -2
- package/dist-server/server/drivers/claude.js +12 -12
- package/dist-server/server/drivers/ollama-context.js +5 -2
- package/dist-server/server/drivers/openai-chat.js +10 -10
- package/dist-server/server/drivers/retry.js +3 -2
- package/dist-server/server/email/host.js +6 -2
- package/dist-server/server/engine-handshake.js +1 -0
- package/dist-server/server/generated-image.js +1 -1
- package/dist-server/server/host/bot-holds.js +76 -0
- package/dist-server/server/host/fill-login-turn.js +2 -2
- package/dist-server/server/host/handoff-limits.js +30 -0
- package/dist-server/server/host/limit-takeover.js +11 -0
- package/dist-server/server/host/peer-limit-resend.js +147 -0
- package/dist-server/server/host/skills-library.js +15 -1
- package/dist-server/server/host/trust-answers.js +42 -0
- package/dist-server/server/imported-skills.js +15 -4
- package/dist-server/server/index.js +109 -125
- package/dist-server/server/limit-poll.js +32 -0
- package/dist-server/server/limit-reset-owed.js +15 -0
- package/dist-server/server/limit-resets.js +33 -8
- package/dist-server/server/login-fill.js +37 -9
- package/dist-server/server/mcp-gate-config.js +28 -0
- package/dist-server/server/mcp-gate.js +8 -2
- package/dist-server/server/message-file.js +10 -1
- package/dist-server/server/quota-switch.js +7 -5
- package/dist-server/server/replies.js +1 -1
- package/dist-server/server/request-auth.js +7 -4
- package/dist-server/server/routes/app-settings.js +46 -0
- package/dist-server/server/routes/bot-holds.js +24 -0
- package/dist-server/server/routes/bot-patch.js +7 -0
- package/dist-server/server/routes/call-route.js +16 -0
- package/dist-server/server/routes/channels.js +45 -38
- package/dist-server/server/routes/custom-domain.js +36 -0
- package/dist-server/server/routes/sidebar-sections.js +1 -0
- package/dist-server/server/routes/threads.js +1 -1
- package/dist-server/server/routine-lines.js +25 -0
- package/dist-server/server/routines.js +9 -5
- package/dist-server/server/runtime/envelope.js +3 -0
- package/dist-server/server/runtime/store.js +1 -0
- package/dist-server/server/send-idempotency.js +43 -0
- package/dist-server/server/shared-computers.js +35 -6
- package/dist-server/server/themes/history.js +54 -0
- package/dist-server/server/themes/routes.js +136 -0
- package/dist-server/server/themes/store.js +266 -0
- package/dist-server/server/themes/tool.js +151 -0
- package/dist-server/server/tool-groups.js +12 -0
- package/dist-server/server/turn-continuation.js +6 -6
- package/dist-server/shared/app-settings.js +60 -0
- package/dist-server/shared/bot-limit.js +2 -0
- package/dist-server/shared/plain-preview.js +3 -2
- package/dist-server/shared/theme.js +240 -0
- package/dist-server/shared/tool-groups.js +27 -0
- package/dist-server/src/lib/composer-attachments.js +22 -6
- package/dist-server/vps-container-mcp.js +12 -12
- package/dist-server/workspace-backup.worker.js +2 -2
- package/package.json +1 -1
- package/dist/assets/App-BjHYb_ps.js +0 -243
- package/dist/assets/BotSettingsDialog-D8LUP9Jn.js +0 -16
- package/dist/assets/CloudAddDialog-BbmxUPbT.js +0 -1
- package/dist/assets/ComputerFilesPane-Df6Y0sr2.js +0 -1
- package/dist/assets/PlacesRail-COZEZH0n.js +0 -57
- package/dist/assets/ProIntroduction-Cc_7SVv1.js +0 -1
- package/dist/assets/SettingsModal-MzznkaJe.js +0 -19
- package/dist/assets/VisibilitySection-ajWCQrhN.js +0 -22
- package/dist/assets/channel-DAFePtOr.js +0 -1
- package/dist/assets/de-CJcRve_J.js +0 -8
- package/dist/assets/index-C2Sr_aMA.js +0 -2
- package/dist/assets/org-library-tRxkixxQ.js +0 -1
- package/dist/assets/pt-br-Dr9a700a.js +0 -13
- package/dist/assets/rail-CpM5o3ti.js +0 -1
- package/dist/assets/styles-Cbtcp5Re.js +0 -23
- package/dist/assets/styles-rYmbSF4Y.css +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-CnVwW_RC.js +0 -8
- package/dist/assets/vi-vTat5qyz.js +0 -15
- package/dist-server/server/limix-managed-grant.js +0 -110
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// When the limit clock (limit-resets.ts) reads plan usage again on its own, while an engine is held or a limit-reset
|
|
2
|
+
// automation waits. While turns run, every five minutes, as before. On a quiet home or a closed laptop nobody needs a
|
|
3
|
+
// fresher answer than that: it reads once just after each reset it knows of (so a hold ends, and a waiting automation
|
|
4
|
+
// is re-timed, on fresh usage) and otherwise once an hour, which still catches a limit that reset early. Someone who
|
|
5
|
+
// looks at the limits gets a read at once (LimitResetClock.ensureFresh), whatever this says.
|
|
6
|
+
import { AFTER_RESET_MS } from "../shared/limit-reset.js";
|
|
7
|
+
/** How fresh usage is kept while turns run, and how fresh a shown limit must be. */
|
|
8
|
+
export const LIMIT_POLL_MS = 5 * 60_000;
|
|
9
|
+
/** A turn event this recent counts as the home being in use. */
|
|
10
|
+
export const LIMIT_ACTIVE_MS = 15 * 60_000;
|
|
11
|
+
/** With nothing running, the most usage goes unread while something holds or waits. */
|
|
12
|
+
export const LIMIT_IDLE_POLL_MS = 60 * 60_000;
|
|
13
|
+
/** A known reset is read this long after its time, a minute after the automation waiting for it starts. A read that
|
|
14
|
+
* lands sooner (another window's, a person's, the first after a wake) leaves an automation still owed a run for this
|
|
15
|
+
* reset where it is too (limit-reset-owed.ts); the new window re-times it once that run was made. */
|
|
16
|
+
export const RESET_READ_AFTER_MS = AFTER_RESET_MS + 60_000;
|
|
17
|
+
/** After a failed read on a quiet home, the next comes this long later, doubled after each further failure, at most hourly. */
|
|
18
|
+
export function retryAfterFailureMs(failures) {
|
|
19
|
+
return Math.min(LIMIT_POLL_MS * 2 ** Math.max(0, failures - 1), LIMIT_IDLE_POLL_MS);
|
|
20
|
+
}
|
|
21
|
+
/** Whether the clock's minute tick reads usage now. Called only while an engine is held or an automation waits. */
|
|
22
|
+
export function limitReadDue({ now, checkedAt, lastTurnAt, resets, failures = 0 }) {
|
|
23
|
+
const age = now - checkedAt;
|
|
24
|
+
// The clock was set back past the last read: nothing measured from it holds, so read now and start again from there.
|
|
25
|
+
if (age < 0)
|
|
26
|
+
return true;
|
|
27
|
+
if (now - lastTurnAt < LIMIT_ACTIVE_MS)
|
|
28
|
+
return age >= LIMIT_POLL_MS - 1_000;
|
|
29
|
+
if (resets.some((reset) => checkedAt < reset + RESET_READ_AFTER_MS && reset + RESET_READ_AFTER_MS <= now))
|
|
30
|
+
return true;
|
|
31
|
+
return age >= (failures > 0 ? retryAfterFailureMs(failures) : LIMIT_IDLE_POLL_MS);
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// A limit-reset automation's run for a reset that already passed is owed: a usage read in the minute after that reset (the
|
|
2
|
+
// limit clock's own, another engine's, a person opening the limits, or the first one after a laptop wakes) already shows
|
|
3
|
+
// the next window's reset, or, for a Claude window that has not started again, only the weekly one. Re-timing the
|
|
4
|
+
// automation then would skip the run it waited for. routines.ts leaves such an automation alone until that run exists,
|
|
5
|
+
// and re-times it after.
|
|
6
|
+
import { AFTER_RESET_MS } from "../shared/limit-reset.js";
|
|
7
|
+
/** The reset this automation was timed for (`nextRunAt` less AFTER_RESET_MS) has passed, and its run has not been made. */
|
|
8
|
+
export function limitResetRunOwed(routine, runs, now) {
|
|
9
|
+
if (!routine.enabled || routine.schedule.type !== "limit_reset" || routine.nextRunAt === null)
|
|
10
|
+
return false;
|
|
11
|
+
if (routine.nextRunAt - now > AFTER_RESET_MS)
|
|
12
|
+
return false;
|
|
13
|
+
const due = routine.nextRunAt;
|
|
14
|
+
return !runs.some((run) => run.routineId === routine.id && run.scheduledFor === due);
|
|
15
|
+
}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import { NEAR_LIMIT_PERCENT } from "../shared/limit-reset.js";
|
|
6
6
|
import { writeFileAtomic } from "./atomic.js";
|
|
7
|
+
import { LIMIT_POLL_MS, limitReadDue } from "./limit-poll.js";
|
|
7
8
|
import { claudeHasExtraUsageRoom, loadPlanUsage } from "./plan-usage.js";
|
|
8
|
-
|
|
9
|
-
export const LIMIT_POLL_MS = 5 * 60_000;
|
|
9
|
+
export { LIMIT_POLL_MS };
|
|
10
10
|
/** A refusal's reset is kept a little past its time, so a run due right then still finds it. */
|
|
11
11
|
const REFUSAL_GRACE_MS = 10 * 60_000;
|
|
12
12
|
const SOON_AFTER_REFUSAL_MS = 5_000;
|
|
@@ -95,6 +95,10 @@ export class LimitResetClock {
|
|
|
95
95
|
heldAt = new Map();
|
|
96
96
|
turnEngines = new Map();
|
|
97
97
|
checkedAt = 0;
|
|
98
|
+
/** The last runtime event of any turn: while turns run, usage is kept five minutes fresh (limit-poll.ts). */
|
|
99
|
+
lastTurnAt = -Infinity;
|
|
100
|
+
/** Reads in a row that failed: a quiet home retries them sooner than its hourly read (limit-poll.ts). */
|
|
101
|
+
failures = 0;
|
|
98
102
|
loading = null;
|
|
99
103
|
timer = null;
|
|
100
104
|
soon = null;
|
|
@@ -146,6 +150,7 @@ export class LimitResetClock {
|
|
|
146
150
|
/** Every runtime event, with the engine its turn runs on when known: a refusal holds the engine, and a turn that
|
|
147
151
|
* works on it afterwards ends the hold, since the account plainly has room again (another model, plan or account). */
|
|
148
152
|
noteRuntimeEvent(engine, event) {
|
|
153
|
+
this.lastTurnAt = this.now();
|
|
149
154
|
if (event.type === "turn.started" && engine)
|
|
150
155
|
this.turnEngines.set(event.threadId, engine);
|
|
151
156
|
else if (event.type === "runtime.error") {
|
|
@@ -246,13 +251,19 @@ export class LimitResetClock {
|
|
|
246
251
|
const accounts = this.options.accounts();
|
|
247
252
|
this.loading = (async () => {
|
|
248
253
|
try {
|
|
249
|
-
if (accounts.length)
|
|
250
|
-
this.noteUsage(await this.load(accounts, force));
|
|
251
|
-
else
|
|
254
|
+
if (!accounts.length) {
|
|
252
255
|
this.checkedAt = this.now();
|
|
256
|
+
this.failures = 0;
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const report = await this.load(accounts, force);
|
|
260
|
+
// No account answered (offline, a laptop just woke): a quiet home tries again in minutes, not in an hour.
|
|
261
|
+
this.failures = report.providers.length && report.providers.every((row) => !row.ok) ? this.failures + 1 : 0;
|
|
262
|
+
this.noteUsage(report);
|
|
253
263
|
}
|
|
254
264
|
catch {
|
|
255
265
|
this.checkedAt = this.now();
|
|
266
|
+
this.failures += 1;
|
|
256
267
|
}
|
|
257
268
|
})().finally(() => {
|
|
258
269
|
this.loading = null;
|
|
@@ -262,11 +273,25 @@ export class LimitResetClock {
|
|
|
262
273
|
start() {
|
|
263
274
|
if (this.timer)
|
|
264
275
|
return;
|
|
265
|
-
// While an engine is held its usage is read
|
|
266
|
-
|
|
267
|
-
|
|
276
|
+
// While an engine is held its usage is read again too, so a limit that reset early ends the hold: every few minutes
|
|
277
|
+
// while turns run, else just after each known reset and hourly (limit-poll.ts), so a quiet home reads nothing more.
|
|
278
|
+
this.timer = setInterval(() => {
|
|
279
|
+
if (!this.holding() && !this.options.waiting?.())
|
|
280
|
+
return;
|
|
281
|
+
if (limitReadDue({ now: this.now(), checkedAt: this.checkedAt, lastTurnAt: this.lastTurnAt, resets: this.knownResets(), failures: this.failures }))
|
|
282
|
+
void this.refresh(false);
|
|
283
|
+
}, 60_000);
|
|
268
284
|
this.timer.unref?.();
|
|
269
285
|
}
|
|
286
|
+
/** Every reset time known now: the holds' and each usage window's. */
|
|
287
|
+
knownResets() {
|
|
288
|
+
const resets = [...this.refusals.values()];
|
|
289
|
+
for (const limit of this.usage.values())
|
|
290
|
+
for (const window of limit.windows ?? [])
|
|
291
|
+
if (window.resetsAt !== null)
|
|
292
|
+
resets.push(window.resetsAt);
|
|
293
|
+
return resets;
|
|
294
|
+
}
|
|
270
295
|
stop() {
|
|
271
296
|
if (this.timer)
|
|
272
297
|
clearInterval(this.timer);
|
|
@@ -16,15 +16,27 @@ const MARK = "data-omb-login";
|
|
|
16
16
|
// Shared by every page script: what a person could see, which fields this fill marked, a site's error line, a CAPTCHA.
|
|
17
17
|
const PAGE_HELPERS = `
|
|
18
18
|
const MARK = ${JSON.stringify(MARK)};
|
|
19
|
+
const queryAllDeep = (root, selector) => {
|
|
20
|
+
const found = Array.from(root.querySelectorAll(selector));
|
|
21
|
+
for (const host of root.querySelectorAll("*")) {
|
|
22
|
+
if (host.shadowRoot) found.push(...queryAllDeep(host.shadowRoot, selector));
|
|
23
|
+
}
|
|
24
|
+
return found;
|
|
25
|
+
};
|
|
26
|
+
const all = (selector) => queryAllDeep(document, selector);
|
|
27
|
+
const hostOf = (el) => {
|
|
28
|
+
const root = el.getRootNode ? el.getRootNode() : null;
|
|
29
|
+
return root && root.host ? root.host : null;
|
|
30
|
+
};
|
|
19
31
|
const visible = (el) => {
|
|
20
32
|
if (!(el instanceof Element) || !el.isConnected || el.getClientRects().length === 0) return false;
|
|
21
|
-
for (let node = el; node
|
|
33
|
+
for (let node = el; node; node = node.parentElement || hostOf(node)) {
|
|
22
34
|
const style = getComputedStyle(node);
|
|
23
35
|
if (style.display === "none" || style.visibility === "hidden" || style.visibility === "collapse" || style.opacity === "0") return false;
|
|
24
36
|
}
|
|
25
37
|
return true;
|
|
26
38
|
};
|
|
27
|
-
const marked = (prefix) =>
|
|
39
|
+
const marked = (prefix) => all("[" + MARK + "]").filter((el) => (el.getAttribute(MARK) || "").startsWith(prefix));
|
|
28
40
|
const secretField = (el) => /:(?:password|code\\d+)$/.test(el.getAttribute(MARK) || "");
|
|
29
41
|
const alertText = () => {
|
|
30
42
|
for (const el of document.querySelectorAll('[role="alert"], [aria-live="assertive"], [aria-live="polite"], .error, .alert, [class*="error" i]')) {
|
|
@@ -52,13 +64,20 @@ const PAGE_HELPERS = `
|
|
|
52
64
|
const FIND_FIELDS = `((nonce, step) => {
|
|
53
65
|
${PAGE_HELPERS}
|
|
54
66
|
const key = nonce + ":" + step + ":";
|
|
55
|
-
for (const old of
|
|
67
|
+
for (const old of all("[" + MARK + "]")) {
|
|
56
68
|
const owner = old.getAttribute(MARK) || "";
|
|
57
69
|
if (!owner.startsWith(nonce + ":") || owner.startsWith(key)) old.removeAttribute(MARK);
|
|
58
70
|
}
|
|
59
71
|
const usable = (el) => el instanceof HTMLInputElement && !el.disabled && !el.readOnly && el.type !== "hidden" && visible(el);
|
|
60
72
|
const tokens = (el) => (el.getAttribute("autocomplete") || "").toLowerCase().split(/\\s+/);
|
|
61
|
-
const hint = (el) =>
|
|
73
|
+
const hint = (el) => {
|
|
74
|
+
const host = hostOf(el);
|
|
75
|
+
const labels = el.labels ? Array.from(el.labels).map((label) => label.innerText || label.textContent || "").join(" ") : "";
|
|
76
|
+
return [el.name, el.id, el.getAttribute("aria-label"), el.placeholder, el.getAttribute("autocomplete"),
|
|
77
|
+
host && host.getAttribute("name"), host && host.getAttribute("id"), host && host.getAttribute("label"),
|
|
78
|
+
host && host.getAttribute("aria-label"), host && host.getAttribute("placeholder"), host && host.getAttribute("autocomplete"),
|
|
79
|
+
labels].join(" ").toLowerCase();
|
|
80
|
+
};
|
|
62
81
|
const plain = (el) => el.type === "text" || el.type === "email" || el.type === "tel";
|
|
63
82
|
// A strong hint makes even a password-type box a code box; a weak one
|
|
64
83
|
// ("verify", "code") only a plain one, so a sign-up form's "verify
|
|
@@ -69,7 +88,7 @@ const FIND_FIELDS = `((nonce, step) => {
|
|
|
69
88
|
const isCode = (el) => tokens(el).includes("one-time-code") ||
|
|
70
89
|
((plain(el) || el.type === "number" || el.type === "password") && STRONG.test(hint(el)) && !NOT_CODE.test(hint(el))) ||
|
|
71
90
|
((plain(el) || el.type === "number") && WEAK.test(hint(el)) && !NOT_CODE.test(hint(el)));
|
|
72
|
-
const inputs =
|
|
91
|
+
const inputs = all("input").filter(usable);
|
|
73
92
|
const codes = inputs.filter(isCode);
|
|
74
93
|
const rest = inputs.filter((el) => !codes.includes(el));
|
|
75
94
|
const passwords = rest.filter((el) => el.type === "password" && !tokens(el).includes("new-password"));
|
|
@@ -103,7 +122,12 @@ const FIND_FIELDS = `((nonce, step) => {
|
|
|
103
122
|
* and listens for the form being sent. */
|
|
104
123
|
const FOCUS_FIELD = `((nonce, key, mode, keep) => {
|
|
105
124
|
${PAGE_HELPERS}
|
|
106
|
-
const
|
|
125
|
+
const activeElement = () => {
|
|
126
|
+
let node = document.activeElement;
|
|
127
|
+
while (node && node.shadowRoot && node.shadowRoot.activeElement) node = node.shadowRoot.activeElement;
|
|
128
|
+
return node;
|
|
129
|
+
};
|
|
130
|
+
const el = all("[" + MARK + "=\\"" + key + "\\"]")[0] || null;
|
|
107
131
|
if (!(el instanceof HTMLInputElement)) return JSON.stringify({ href: location.href, focused: false, same: false });
|
|
108
132
|
if (mode === "type" && typeof keep === "string" && el.value === keep) return JSON.stringify({ href: location.href, focused: true, same: true });
|
|
109
133
|
if (mode === "submit" && !window["__ombLogin" + nonce]) {
|
|
@@ -119,7 +143,7 @@ const FOCUS_FIELD = `((nonce, key, mode, keep) => {
|
|
|
119
143
|
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
120
144
|
}
|
|
121
145
|
const busy = mode === "submit" && sending(marked(nonce + ":").filter((field) => field instanceof HTMLInputElement));
|
|
122
|
-
return JSON.stringify({ href: location.href, focused:
|
|
146
|
+
return JSON.stringify({ href: location.href, focused: activeElement() === el, same: false, busy });
|
|
123
147
|
})`;
|
|
124
148
|
const CHECK_FIELDS = `((key) => {
|
|
125
149
|
${PAGE_HELPERS}
|
|
@@ -132,14 +156,18 @@ const MARK_SUBMIT = `((key) => {
|
|
|
132
156
|
${PAGE_HELPERS}
|
|
133
157
|
const fields = marked(key).filter((el) => el instanceof HTMLInputElement);
|
|
134
158
|
const field = fields.find((el) => /:password$/.test(el.getAttribute(MARK) || "")) || fields[fields.length - 1];
|
|
135
|
-
const label = (el) =>
|
|
159
|
+
const label = (el) => {
|
|
160
|
+
const host = hostOf(el);
|
|
161
|
+
return (el.innerText || el.value || el.getAttribute("aria-label") || el.title ||
|
|
162
|
+
(host && (host.innerText || host.textContent || host.getAttribute("aria-label"))) || "").replace(/\\s+/g, " ").trim();
|
|
163
|
+
};
|
|
136
164
|
const NAMED = /^(?:sign ?in|log ?in|log ?on|sign ?on|continue|next|submit|verify|confirm)$/i;
|
|
137
165
|
const enabled = (el) => visible(el) && !el.disabled && el.getAttribute("aria-disabled") !== "true";
|
|
138
166
|
const inForm = field && field.form
|
|
139
167
|
? Array.from(field.form.querySelectorAll("button, input[type=submit], input[type=image]")).filter((el) => enabled(el) && (el.type === "submit" || el.type === "image"))
|
|
140
168
|
: [];
|
|
141
169
|
const control = inForm.find((el) => NAMED.test(label(el))) || inForm[0] ||
|
|
142
|
-
|
|
170
|
+
all('button, [role="button"], input[type=submit], input[type=button]').find((el) => enabled(el) && NAMED.test(label(el)));
|
|
143
171
|
if (!control) return JSON.stringify({ found: false });
|
|
144
172
|
control.setAttribute(MARK, key + "submit");
|
|
145
173
|
return JSON.stringify({ found: true });
|
|
@@ -42,6 +42,34 @@ export function customServerGate(name, owned, perServer, env) {
|
|
|
42
42
|
gateRemote: owned && hasOwnResultBudget(name, perServer),
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
+
/** Claude Code keeps an MCP result in the thread up to MAX_MCP_OUTPUT_TOKENS (25k by default) and saves a bigger one whole to
|
|
46
|
+
* a file the bot reads in parts. Above the browser's 32k-character budget (about 8k tokens), so harness results stay inline. */
|
|
47
|
+
export const UNGATED_MCP_OUTPUT_TOKENS = 10_000;
|
|
48
|
+
/** A bot server the gate leaves untrimmed (a URL server keeps its native connection) has the CLI save big results to a file
|
|
49
|
+
* instead of filling the thread. The limit is process-wide, so it stays unset when any untrimmed server asks for whole
|
|
50
|
+
* payloads (a limit of 0), and an explicit MAX_MCP_OUTPUT_TOKENS (the process's or the bot settings file's) wins. */
|
|
51
|
+
export function limitUngatedOutput(env, mounted, owned, perServer, configured) {
|
|
52
|
+
if (env.MAX_MCP_OUTPUT_TOKENS || configured !== undefined)
|
|
53
|
+
return;
|
|
54
|
+
let untrimmed = false;
|
|
55
|
+
for (const name of owned) {
|
|
56
|
+
const server = Object.hasOwn(mounted, name) ? mounted[name] : undefined;
|
|
57
|
+
if (!server)
|
|
58
|
+
continue;
|
|
59
|
+
// A gate trims on its own budget; one set to 0 passes whole payloads through, so it needs the limit unset too.
|
|
60
|
+
const gateBudget = server.env?.OMB_GATE_BUDGET;
|
|
61
|
+
if (gateBudget !== undefined) {
|
|
62
|
+
if (Number(gateBudget) <= 0)
|
|
63
|
+
return;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (serverResultBudget(name, perServer, env) <= 0)
|
|
67
|
+
return;
|
|
68
|
+
untrimmed = true;
|
|
69
|
+
}
|
|
70
|
+
if (untrimmed)
|
|
71
|
+
env.MAX_MCP_OUTPUT_TOKENS = String(UNGATED_MCP_OUTPUT_TOKENS);
|
|
72
|
+
}
|
|
45
73
|
export function spillDir(threadId) {
|
|
46
74
|
return join(DATA_DIR, "tool-results", threadId.replace(/[^A-Za-z0-9_-]/g, "-").slice(0, 80) || "thread");
|
|
47
75
|
}
|
|
@@ -192,8 +192,12 @@ function trimCallResult(result, tool) {
|
|
|
192
192
|
keptValue = outcome.value;
|
|
193
193
|
trimmed = true;
|
|
194
194
|
}
|
|
195
|
-
//
|
|
196
|
-
|
|
195
|
+
// Claude Code prefers structuredContent over text, hiding the shaping note. Without an outputSchema,
|
|
196
|
+
// omit it so the model sees the note; schema-declaring tools retain the structural trim.
|
|
197
|
+
if (trimmed && !outputSchemas.get(tool)) {
|
|
198
|
+
delete result.structuredContent;
|
|
199
|
+
}
|
|
200
|
+
else if (trimmed && result.structuredContent && typeof result.structuredContent === "object") {
|
|
197
201
|
if (structuredIsText && keptValue && typeof keptValue === "object") {
|
|
198
202
|
result.structuredContent = keptValue;
|
|
199
203
|
}
|
|
@@ -217,6 +221,7 @@ const observer = (() => {
|
|
|
217
221
|
}
|
|
218
222
|
})();
|
|
219
223
|
const appOnly = new Set();
|
|
224
|
+
const outputSchemas = new Map();
|
|
220
225
|
const spec = upstreamSpec();
|
|
221
226
|
if (SPILL_DIR)
|
|
222
227
|
sweepSpill(SPILL_DIR);
|
|
@@ -369,6 +374,7 @@ createInterface({ input: child.stdout }).on("line", (line) => {
|
|
|
369
374
|
for (const tool of result.tools) {
|
|
370
375
|
if (!isRecord(tool) || typeof tool.name !== "string")
|
|
371
376
|
continue;
|
|
377
|
+
outputSchemas.set(tool.name, tool.outputSchema !== undefined);
|
|
372
378
|
if (modelVisible(tool))
|
|
373
379
|
appOnly.delete(tool.name);
|
|
374
380
|
else
|
|
@@ -111,7 +111,7 @@ export function referencedFileName(href) {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
/** Lexical on purpose: `resolve` and `fileURLToPath` follow the runner OS, and `/C:/notes.md` is not `C:\\notes.md`. */
|
|
114
|
-
function referencedPathIdentity(href, allowForwardSlashUNC = true) {
|
|
114
|
+
export function referencedPathIdentity(href, allowForwardSlashUNC = true) {
|
|
115
115
|
const path = referencedPath(href, true, allowForwardSlashUNC);
|
|
116
116
|
if (/^[a-z]:[\\/]/i.test(path) || path.startsWith("\\\\") || path.startsWith("//")) {
|
|
117
117
|
return `windows:${win32.resolve(path)}`;
|
|
@@ -339,6 +339,15 @@ export function mimeFor(path) {
|
|
|
339
339
|
case ".odt": return "application/vnd.oasis.opendocument.text";
|
|
340
340
|
case ".ods": return "application/vnd.oasis.opendocument.spreadsheet";
|
|
341
341
|
case ".odp": return "application/vnd.oasis.opendocument.presentation";
|
|
342
|
+
// Archives are typed by name only and stay downloads: never previewed, never unpacked. foo.tar.gz is a .gz.
|
|
343
|
+
case ".zip": return "application/zip";
|
|
344
|
+
case ".rar": return "application/vnd.rar";
|
|
345
|
+
case ".7z": return "application/x-7z-compressed";
|
|
346
|
+
case ".tar": return "application/x-tar";
|
|
347
|
+
case ".gz": return "application/gzip";
|
|
348
|
+
case ".tgz": return "application/x-compressed-tar";
|
|
349
|
+
case ".bz2": return "application/x-bzip2";
|
|
350
|
+
case ".xz": return "application/x-xz";
|
|
342
351
|
default: return "application/octet-stream";
|
|
343
352
|
}
|
|
344
353
|
}
|
|
@@ -4,12 +4,16 @@
|
|
|
4
4
|
import { approvalModeFor, modelSwitchNeedsAsk } from "../shared/approval-mode.js";
|
|
5
5
|
import { recoveryCapabilityError } from "./automatic-recovery.js";
|
|
6
6
|
import { readyToRun, selectDefaultModelSelection } from "./default-model-selection.js";
|
|
7
|
-
import { classifyError } from "./drivers/retry.js";
|
|
8
7
|
import { PROBE_TIMEOUT_MS } from "./engine-install.js";
|
|
9
8
|
import { spokenLineFields } from "./live-call-record.js";
|
|
10
|
-
import {
|
|
9
|
+
import { takeoverRefusal } from "./host/limit-takeover.js";
|
|
11
10
|
export const NOT_NOW = "Not now";
|
|
12
11
|
const ENDED = new Set(["completed", "failed", "cancelled"]);
|
|
12
|
+
/** Why a failed turn stopped, when it was its AI's usage limit or a sign-out. A tool call's failure names the tool,
|
|
13
|
+
* never the engine's own limit, whatever its words. */
|
|
14
|
+
export function turnLimitScope(event, flags, cause) {
|
|
15
|
+
return takeoverRefusal(event.stopReason, cause, flags?.limit);
|
|
16
|
+
}
|
|
13
17
|
/** On unless OMB_QUOTA_SWITCH=0: a limited AI's work carries on with another AI by itself. Off, only the backups
|
|
14
18
|
* Automatic recovery names take over, as before. */
|
|
15
19
|
export function quotaSwitchEnabled(env = process.env) {
|
|
@@ -145,9 +149,7 @@ export function createQuotaSwitch(deps) {
|
|
|
145
149
|
const request = deps.request(threadId);
|
|
146
150
|
const flags = deps.turnStops.read?.(threadId, event.turnId)?.flags;
|
|
147
151
|
const cause = deps.turnStops.failureCause(event);
|
|
148
|
-
|
|
149
|
-
const scope = signedOutStop(event.stopReason, cause) ? "signed-out"
|
|
150
|
-
: flags?.limit ?? (event.stopReason !== "tool_error" && classifyError({ text: cause ?? "" }).reason === "quota" ? "engine" : undefined);
|
|
152
|
+
const scope = takeoverRefusal(event.stopReason, cause, flags?.limit);
|
|
151
153
|
if (!scope)
|
|
152
154
|
return null;
|
|
153
155
|
const thread = store.projectBotForTask(bot.id, threadId) ?? bot;
|
|
@@ -120,7 +120,7 @@ function promptWithApp(text, target) {
|
|
|
120
120
|
].join("\n");
|
|
121
121
|
}
|
|
122
122
|
const REACTION_MEANS = {
|
|
123
|
-
yes: "👍
|
|
123
|
+
yes: "👍 answers that message. If it asked them something or offered to do something, 👍 means yes, go ahead: this is their answer, continue without asking again. If it only told them something (an update, a result, a statement), 👍 means got it: an acknowledgement, not an instruction, so start no new work and reply in a few words at most.",
|
|
124
124
|
no: "👎 means no, not that. If that message asked them something, this is their answer: act on it without asking again. If it asked nothing, ask in one short sentence what to change.",
|
|
125
125
|
};
|
|
126
126
|
/** The quote is conversation data: it cannot grant tools or override the current system prompt. */
|
|
@@ -266,6 +266,9 @@ export const CLIENT_ALLOW = [
|
|
|
266
266
|
{ methods: ["GET"], path: /^\/api\/updates\/check$/ },
|
|
267
267
|
{ methods: ["POST"], path: /^\/api\/auth\/stream-ticket$/ },
|
|
268
268
|
{ methods: ["POST"], path: /^\/api\/auth\/logout$/ },
|
|
269
|
+
// A Team Cloud member's own themes: the route answers each person with theirs alone, and a limited session elsewhere with none.
|
|
270
|
+
{ methods: ["GET", "PUT", "PATCH", "POST", "DELETE"], path: /^\/api\/themes(?:\/[a-z0-9-]+(?:\/(?:duplicate|export))?)?$/ },
|
|
271
|
+
{ methods: ["GET", "HEAD"], path: /^\/api\/theme-assets\/[a-z0-9-]+\/[\w.-]+$/ },
|
|
269
272
|
// A Team Cloud member's own phone: the code carries their address and role, never more (routes/team-phone.ts).
|
|
270
273
|
{ methods: ["POST"], path: /^\/api\/team\/phone-pairing$/ },
|
|
271
274
|
// The phones those codes opened: a member lists and removes their own only (routes/team-phone.ts visiblePhones).
|
|
@@ -466,11 +469,11 @@ export function adminOnlyBotSetting(fields) {
|
|
|
466
469
|
export function botProfileSettings(fields) {
|
|
467
470
|
return Object.fromEntries(Object.entries(fields).filter(([key]) => BOT_PROFILE_SETTINGS.has(key)));
|
|
468
471
|
}
|
|
469
|
-
/** What a Team Cloud member who can edit a bot may change: its profile and model (as a bot they bring in),
|
|
470
|
-
*
|
|
471
|
-
* or whom it answers to or directs: those stay an admin's. */
|
|
472
|
+
/** What a Team Cloud member who can edit a bot may change: its profile and model (as a bot they bring in), which of the
|
|
473
|
+
* team's connected apps and MCP servers it uses, and which built-in tool groups it is shown. Never what it may do on its
|
|
474
|
+
* computer, where it runs, its department or whom it answers to or directs: those stay an admin's. */
|
|
472
475
|
const EDITOR_BOT_PATCH_FIELDS = new Set([
|
|
473
|
-
...BOT_PROFILE_SETTINGS, "threadId", "composio", "connectorTools", "connectorScopes", "mcpServers",
|
|
476
|
+
...BOT_PROFILE_SETTINGS, "threadId", "composio", "connectorTools", "connectorScopes", "mcpServers", "toolsOff",
|
|
474
477
|
]);
|
|
475
478
|
/** A member who can only view a bot marks it read, nothing else. */
|
|
476
479
|
const VIEWER_BOT_PATCH_FIELDS = new Set(["unread"]);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { isWindowPrefId, WINDOW_PREFS, windowPrefReportSchema } from "../../shared/app-settings.js";
|
|
2
|
+
import { PASS } from "./table.js";
|
|
3
|
+
export const INTERNAL_APP_SETTINGS_PATH = "/api/internal/app-settings";
|
|
4
|
+
export const WINDOW_PREFS_PATH = "/api/window-prefs";
|
|
5
|
+
/** Only dispatch inside the internal capability gate, with its guarded body reader; never in the global route table. */
|
|
6
|
+
export function createInternalAppSettingsRoutes(deps) {
|
|
7
|
+
return async ({ res, path, method, json }) => {
|
|
8
|
+
if (method !== "POST" || path !== INTERNAL_APP_SETTINGS_PATH)
|
|
9
|
+
return PASS;
|
|
10
|
+
const result = await deps.handle(await deps.readBody());
|
|
11
|
+
return json(res, result.status, result.body);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** The window's own preferences live in its localStorage or behind the desktop app's bridge. The window reports them
|
|
15
|
+
* here; the server keeps the last report and pushes a change back as a `window-pref` frame, which only an open window
|
|
16
|
+
* can apply. One the window never reported is one it can't change (a browser has no desktop bridge). */
|
|
17
|
+
export function createWindowPrefs(deps) {
|
|
18
|
+
const values = new Map();
|
|
19
|
+
const routes = async ({ req, res, path, method, auth, json, readBody }) => {
|
|
20
|
+
if (method !== "PUT" || path !== WINDOW_PREFS_PATH)
|
|
21
|
+
return PASS;
|
|
22
|
+
if (!deps.ownerOrAdmin(auth))
|
|
23
|
+
return json(res, 403, { error: "Only the owner's window reports its preferences." });
|
|
24
|
+
const parsed = windowPrefReportSchema.safeParse(await readBody(req));
|
|
25
|
+
if (!parsed.success)
|
|
26
|
+
return json(res, 400, { error: "values must be an object of preference id to value" });
|
|
27
|
+
for (const [id, value] of Object.entries(parsed.data.values)) {
|
|
28
|
+
if (isWindowPrefId(id) && WINDOW_PREFS[id].safeParse(value).success)
|
|
29
|
+
values.set(id, value);
|
|
30
|
+
}
|
|
31
|
+
return json(res, 200, { ok: true });
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
routes,
|
|
35
|
+
read: (id) => values.get(id),
|
|
36
|
+
write(id, value) {
|
|
37
|
+
if (!deps.windowOpen())
|
|
38
|
+
return "Open MausBot on this computer first; this setting lives in the app window.";
|
|
39
|
+
if (!values.has(id))
|
|
40
|
+
return "The open MausBot window can't change this here. It is changed in MausBot's desktop app on this computer.";
|
|
41
|
+
values.set(id, value);
|
|
42
|
+
deps.broadcast({ kind: "window-pref", id, value }, { adminOnly: true });
|
|
43
|
+
return null;
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PASS } from "./table.js";
|
|
3
|
+
const body = z.object({ kind: z.enum(["bot", "department"]), id: z.string().trim().min(1).max(200), paused: z.boolean() }).strict();
|
|
4
|
+
export function createBotHoldRoutes(deps) {
|
|
5
|
+
return async ({ req, res, path, method, auth, json, readBody }) => {
|
|
6
|
+
if (path !== "/api/paused")
|
|
7
|
+
return PASS;
|
|
8
|
+
if (method === "GET")
|
|
9
|
+
return void json(res, 200, { ...deps.holds.state(), heldBots: deps.holds.heldBots() });
|
|
10
|
+
if (method !== "POST")
|
|
11
|
+
return PASS;
|
|
12
|
+
const parsed = body.safeParse(await readBody(req, 4_096).catch(() => null));
|
|
13
|
+
if (!parsed.success)
|
|
14
|
+
return void json(res, 400, { error: "Send kind (bot or department), id and paused (true or false)." });
|
|
15
|
+
const { kind, id, paused } = parsed.data;
|
|
16
|
+
const name = deps.named(kind, id);
|
|
17
|
+
if (name === null)
|
|
18
|
+
return void json(res, 404, { error: kind === "bot" ? "No such bot." : "No such department." });
|
|
19
|
+
const { state, newlyHeld } = deps.holds.set(kind, id, paused);
|
|
20
|
+
const stopped = paused && newlyHeld.length ? await deps.stop(newlyHeld) : 0;
|
|
21
|
+
deps.audit({ kind, id, name, paused }, auth, req);
|
|
22
|
+
json(res, 200, { ...state, heldBots: deps.holds.heldBots(), stopped });
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -5,6 +5,7 @@ import { normalizeConnectorScopes } from "../../shared/connector-scopes.js";
|
|
|
5
5
|
import { normalizeOutboundPolicy } from "../../shared/outbound.js";
|
|
6
6
|
import { normalizePhoneApps } from "../../shared/phone-apps.js";
|
|
7
7
|
import { parseToolScope, toolScopeWidens } from "../../shared/tool-scope.js";
|
|
8
|
+
import { parseToolsOff, TOOL_GROUPS } from "../../shared/tool-groups.js";
|
|
8
9
|
import { isMausColor, MAUS_COLOR_NAMES } from "../../shared/wire.js";
|
|
9
10
|
import { validateBotCwd } from "../bot-cwd.js";
|
|
10
11
|
import { parseBotProfilePatch } from "../bot-profile.js";
|
|
@@ -257,6 +258,12 @@ export function createBotPatchRoutes(deps) {
|
|
|
257
258
|
return json(res, 400, { error: "xResearch must be true or false" });
|
|
258
259
|
patch.xResearch = body.xResearch;
|
|
259
260
|
}
|
|
261
|
+
if (body.toolsOff !== undefined) {
|
|
262
|
+
const toolsOff = body.toolsOff === null ? [] : parseToolsOff(body.toolsOff);
|
|
263
|
+
if (!toolsOff)
|
|
264
|
+
return json(res, 400, { error: `toolsOff must be a list of ${TOOL_GROUPS.join(", ")}` });
|
|
265
|
+
patch.toolsOff = toolsOff.length ? toolsOff : undefined;
|
|
266
|
+
}
|
|
260
267
|
if (body.memoryEnabled !== undefined) {
|
|
261
268
|
if (typeof body.memoryEnabled !== "boolean")
|
|
262
269
|
return json(res, 400, { error: "memoryEnabled must be true or false" });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PASS } from "./table.js";
|
|
2
|
+
/** Runs a route handler as the app's own window would call it, so a change made from a chat gets the same checks, side
|
|
3
|
+
* effects and broadcasts as Settings, and the caller reads the reply the route wrote. */
|
|
4
|
+
export async function callRoute(route, call) {
|
|
5
|
+
let reply = null;
|
|
6
|
+
const url = new URL(call.path, "http://127.0.0.1");
|
|
7
|
+
const res = { headersSent: false, writableEnded: false };
|
|
8
|
+
const out = await route({
|
|
9
|
+
req: { headers: { "content-type": "application/json" } }, res, url, path: url.pathname, method: call.method, auth: call.auth,
|
|
10
|
+
json: (_res, status, body) => { reply = { status, body: (body ?? {}) }; },
|
|
11
|
+
readBody: async () => call.body,
|
|
12
|
+
});
|
|
13
|
+
if (reply)
|
|
14
|
+
return reply;
|
|
15
|
+
return out === PASS ? { status: 404, body: { error: `no route for ${call.method} ${call.path}` } } : { status: 500, body: { error: "the route sent no reply" } };
|
|
16
|
+
}
|
|
@@ -8,7 +8,7 @@ import { messageTextRefusal } from "../message-text.js";
|
|
|
8
8
|
import { promptWithReply } from "../replies.js";
|
|
9
9
|
import { clientGroupPatchViolation, requestSource } from "../request-auth.js";
|
|
10
10
|
import { parseConversationTurnTimeout } from "../room-turn-timeout.js";
|
|
11
|
-
import { acceptedSendMatch, parseSendId, sendFingerprint } from "../send-idempotency.js";
|
|
11
|
+
import { acceptedSendMatch, parseSendId, parseStopId, sendFingerprint, StopReceipts } from "../send-idempotency.js";
|
|
12
12
|
import { assertWithinBudget } from "../spend.js";
|
|
13
13
|
import { extractSteerImages } from "../turn-images.js";
|
|
14
14
|
import { parseMentionPicks } from "../../shared/room-mentions.js";
|
|
@@ -23,6 +23,7 @@ export function createChannelRoutes(deps) {
|
|
|
23
23
|
const { store, cfg, broadcast, notificationListed, actorKey, threadStarters, phoneSecretSubmissions, sendSequencer, roomMemberContexts, skillReview, groupSpeakers, groupTurnOperations, lastReply, cloudThreadRefusal, messageSender, usageTriggerFor, publicGroupState, groupWithThread, updateChannel, groupIsWorking, groupThreadIsWorking, readCursor, pageSize, messagePage, resolveReplyTarget, runningTurnInstance, startGroupTurn, engineSteersImages, applyRoomHoldsFromMessage, cancelGroupTurnOperations, drainQueuedChannelSends, clearTurnDigestState, closeOpenApprovals, revokeInternalCapabilitiesForThread, stagedSkillCleanupsForThread, rejectDeletedThreadSkillStages, } = deps;
|
|
24
24
|
const owners = routeRunOwners(deps.runOwners, deps.runActor);
|
|
25
25
|
const DESKTOP_MANAGED = deps.desktopManaged;
|
|
26
|
+
const roomStops = new StopReceipts();
|
|
26
27
|
const deleteRefusal = (auth, groupId, threadId) => {
|
|
27
28
|
if (phoneSecretSubmissions.hasThread(threadId)) {
|
|
28
29
|
return { status: 409, error: "this task is securely saving a credential — try again when it finishes" };
|
|
@@ -532,45 +533,51 @@ export function createChannelRoutes(deps) {
|
|
|
532
533
|
if (body.threadId !== undefined && (typeof body.threadId !== "string" || !/^[\w-]+$/.test(body.threadId))) {
|
|
533
534
|
return json(res, 400, { error: "threadId must be a task id" });
|
|
534
535
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
if (
|
|
540
|
-
|
|
536
|
+
const stopId = parseStopId(body.stopId);
|
|
537
|
+
if (stopId === null)
|
|
538
|
+
return json(res, 400, { error: "stopId must be a client-generated id" });
|
|
539
|
+
const answer = await roomStops.run(stopId && `${group.id}:${stopId}`, async () => {
|
|
540
|
+
if (body.threadId !== undefined) {
|
|
541
|
+
const ownsThread = group.dm
|
|
542
|
+
? body.threadId === group.threadId
|
|
543
|
+
: Boolean(store.groupTaskByThread(group.id, body.threadId));
|
|
544
|
+
if (!ownsThread) {
|
|
545
|
+
return { status: 409, body: { error: "the channel switched tasks before it could be interrupted" } };
|
|
546
|
+
}
|
|
541
547
|
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
.
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
};
|
|
548
|
+
const activeOperations = [...(groupTurnOperations.get(group.id) ?? [])]
|
|
549
|
+
.filter((operation) => !operation.cancelled);
|
|
550
|
+
const targetThreadIds = body.threadId !== undefined
|
|
551
|
+
? [body.threadId]
|
|
552
|
+
: activeOperations.length > 0
|
|
553
|
+
? [...new Set(activeOperations.map((operation) => operation.threadId))]
|
|
554
|
+
: [group.threadId];
|
|
555
|
+
const interruptTargets = targetThreadIds.map((threadId) => {
|
|
556
|
+
const speaker = groupSpeakers.get(threadId);
|
|
557
|
+
const busy = speaker
|
|
558
|
+
? store.bot(speaker.botId)
|
|
559
|
+
: threadId === group.threadId && group.busyBotId
|
|
560
|
+
? store.bot(group.busyBotId)
|
|
561
|
+
: undefined;
|
|
562
|
+
return {
|
|
563
|
+
threadId,
|
|
564
|
+
instance: busy ? runningTurnInstance(busy, threadId) : undefined,
|
|
565
|
+
};
|
|
566
|
+
});
|
|
567
|
+
const refusal = targetThreadIds.map((threadId) => owners.stopRefusal(auth, threadId)).find(Boolean);
|
|
568
|
+
if (refusal)
|
|
569
|
+
return { status: 403, body: { error: refusal, code: "stop_not_yours" } };
|
|
570
|
+
// Abort every queued operation before the first provider round trip, so none begins while Stop awaits.
|
|
571
|
+
for (const { threadId } of interruptTargets)
|
|
572
|
+
cancelGroupTurnOperations(group.id, threadId);
|
|
573
|
+
for (const { threadId, instance } of interruptTargets) {
|
|
574
|
+
revokeInternalCapabilitiesForThread(threadId);
|
|
575
|
+
await instance?.adapter.interruptTurn(threadId).catch(() => { });
|
|
576
|
+
closeOpenApprovals(threadId);
|
|
577
|
+
}
|
|
578
|
+
return { status: 200, body: { ok: true } };
|
|
561
579
|
});
|
|
562
|
-
|
|
563
|
-
if (refusal)
|
|
564
|
-
return json(res, 403, { error: refusal, code: "stop_not_yours" });
|
|
565
|
-
// Abort every queued operation before the first provider round trip, so none begins while Stop awaits.
|
|
566
|
-
for (const { threadId } of interruptTargets)
|
|
567
|
-
cancelGroupTurnOperations(group.id, threadId);
|
|
568
|
-
for (const { threadId, instance } of interruptTargets) {
|
|
569
|
-
revokeInternalCapabilitiesForThread(threadId);
|
|
570
|
-
await instance?.adapter.interruptTurn(threadId).catch(() => { });
|
|
571
|
-
closeOpenApprovals(threadId);
|
|
572
|
-
}
|
|
573
|
-
return json(res, 200, { ok: true });
|
|
580
|
+
return json(res, answer.status, answer.body);
|
|
574
581
|
}
|
|
575
582
|
return PASS;
|
|
576
583
|
};
|