@wirecat/cli-core 3.1.0-dev → 3.2.0-dev
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 +102 -0
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/bundle/{agent-RMLBQXJF-CuqJBQqf.js → agent-J75WGZEV-K_l-bQ-h.js} +5 -5
- package/dist/bundle/{all-profiles-3GEKS7PR-Bi_zb5_-.js → all-profiles-3GEKS7PR-BohqgNvP.js} +6 -6
- package/dist/bundle/{anthropic-EVM6I7MZ-BWI01JgC.js → anthropic-EVM6I7MZ-CqB3j7dB.js} +2 -2
- package/dist/bundle/{app-server-76XGUZHU-__6SrMhc.js → app-server-5BL62GAL-Osw_tMej.js} +20 -15
- package/dist/bundle/{bun-AWMVU72K-COHrAYHA.js → bun-AWMVU72K-Bk0oN5Sm.js} +2 -2
- package/dist/bundle/{bun-sqlite-CYFVVXXR-r_kJOwku.js → bun-sqlite-CYFVVXXR-4iGlaI9X.js} +3 -3
- package/dist/bundle/{chunk-4ZM6SE7G-DNDxhi8l.js → chunk-4HGRFFTO-fNvELOjI.js} +330 -56
- package/dist/bundle/{chunk-6G6TIMKP-CoVYG_I3.js → chunk-6G6TIMKP-Byea1UGV.js} +4 -4
- package/dist/bundle/{chunk-M5CHOMME-BIcASmVb.js → chunk-6OLVBOBX-Ch2rblZk.js} +17 -11
- package/dist/bundle/{chunk-CCFBHR4O-DAuKd8rI.js → chunk-CCFBHR4O-Bhxq5eaI.js} +1 -1
- package/dist/bundle/{chunk-DDXCCEI4-CHLrblc1.js → chunk-DDXCCEI4-CBg_l4Ro.js} +2 -2
- package/dist/bundle/{chunk-DZPIGAKP-nrRAPNTz.js → chunk-DZPIGAKP-BZy6DShN.js} +1 -1
- package/dist/bundle/{chunk-ERNCGLKE-4JdU74o6.js → chunk-ERNCGLKE-D3HStkJC.js} +1 -1
- package/dist/bundle/{chunk-GBNNGOIB-DVUFOYzA.js → chunk-GBNNGOIB-DS3rusdH.js} +5 -5
- package/dist/bundle/{chunk-GJTANPFI-5L6Owk-H.js → chunk-GJTANPFI-DlUMnFUQ.js} +3 -3
- package/dist/bundle/{chunk-6ZUQA7OL-ofpF0AvH.js → chunk-GRGGW52W-Fkw6omOx.js} +5 -5
- package/dist/bundle/{chunk-KSUALCA7-DB6cYuSU.js → chunk-KSUALCA7-SMNQ85c6.js} +1 -1
- package/dist/bundle/{chunk-LBVI4Z2X-COUoJmWU.js → chunk-LBVI4Z2X-D9_8iC1S.js} +1 -1
- package/dist/bundle/{chunk-M23BPYSL-ChiHsEsy.js → chunk-M23BPYSL-ByTcRixP.js} +3 -3
- package/dist/bundle/{chunk-Z3ZVBBWR-whNBW-iH.js → chunk-M4KMNZN6-CBeUwDlF.js} +2 -2
- package/dist/bundle/{chunk-NG7F5L7N-BKCEXGxy.js → chunk-NG7F5L7N-Ch_ERSNz.js} +1 -1
- package/dist/bundle/{chunk-NX2VS2ER-DS6Urg3e.js → chunk-NX2VS2ER-CWN0zXqZ.js} +1 -1
- package/dist/bundle/{chunk-O2HOOK7X-Dboq6vxP.js → chunk-O2HOOK7X-Dyw_Dcql.js} +4 -4
- package/dist/bundle/{chunk-PSD6373C-wlicX185.js → chunk-PSD6373C-DgL0rhKe.js} +1 -1
- package/dist/bundle/{chunk-RTCT4N7Y-Dn-lP1zF.js → chunk-RTCT4N7Y-BEZ3cJ5d.js} +1 -1
- package/dist/bundle/{chunk-S34BE7ZC-p6NeYmqQ.js → chunk-S34BE7ZC-BO0yaVoX.js} +1 -1
- package/dist/bundle/{chunk-E6KETVFF-wOOXf4op.js → chunk-SRAGL5LI-CKhhwRrx.js} +5 -5
- package/dist/bundle/{chunk-T6V6LFHT-Dwv7XUuC.js → chunk-T6V6LFHT-BazTZ25Y.js} +1 -1
- package/dist/bundle/{chunk-ACWFPMZF-DkR70AOW.js → chunk-TFRAD7RO-BVAK9frq.js} +50 -4
- package/dist/bundle/{chunk-UH2H3OLE-R_6H5D7o.js → chunk-UH2H3OLE-QNxQo07O.js} +1 -1
- package/dist/bundle/{chunk-UQJGYQ56-CANeLx5l.js → chunk-UQJGYQ56-PoYTv6WX.js} +1 -1
- package/dist/bundle/{chunk-VKZDPPVI-d7RS_QOW.js → chunk-VKZDPPVI-BOmnhxVJ.js} +2 -2
- package/dist/bundle/{chunk-UNGNJ255-CtLEiDap.js → chunk-W3AAOYWE-Cyx1kZsd.js} +7 -7
- package/dist/bundle/{chunk-WXEJSLMO-DbSxVCq9.js → chunk-WXEJSLMO-DCjDRcYe.js} +8 -8
- package/dist/bundle/{chunk-XW3IHFDH-CjmXc8aI.js → chunk-XW3IHFDH-CA9Bby7o.js} +1 -1
- package/dist/bundle/{chunk-YHBBPJW6-jAof9asy.js → chunk-YHBBPJW6-DKIU2gC4.js} +2 -2
- package/dist/bundle/{chunk-YITG2CE5-Bg4SA8X1.js → chunk-YITG2CE5-o18mzaka.js} +1 -1
- package/dist/bundle/{chunk-ZMRSCVFX-Dwxb-Yg1.js → chunk-ZMRSCVFX-uhwzmZUP.js} +1 -1
- package/dist/bundle/chunks.json +83 -83
- package/dist/bundle/{command-contract-4X4JDKH7-BsU8tW9N.js → command-contract-DHFUF6RM-Bnc6nJSk.js} +2 -2
- package/dist/bundle/{command-server-entry-3JEJBUK5-CF-VyCRd.js → command-server-entry-UQSMAHYK-DzjTaTCZ.js} +2 -2
- package/dist/bundle/{decode-KVUA3TLF-Ds0C1R9U.js → decode-KVUA3TLF-BoJfgCpS.js} +2 -2
- package/dist/bundle/{dist-TPSNLFVO-D1tJd0aB.js → dist-TPSNLFVO-55jBf4N-.js} +2 -2
- package/dist/bundle/documents.js +5 -5
- package/dist/bundle/{echarts-6Q4CQ2DC-BvZMDYNl.js → echarts-6Q4CQ2DC-w9WhKUJu.js} +1 -1
- package/dist/bundle/{embed-JGGK2WKR-h5ppwooq.js → embed-JGGK2WKR-Cl3meWl4.js} +2 -2
- package/dist/bundle/{embedder-5SIVKVWO-D4yt4YCy.js → embedder-5SIVKVWO-DJEa9hBn.js} +2 -2
- package/dist/bundle/{first-run-FFHXPGFC-CyHZ4KM3.js → first-run-BT3X33BP-JikrW5_w.js} +2 -2
- package/dist/bundle/{first-screen-2NGQNWIN-BkvwnUdE.js → first-screen-KGQQK446-D2MchUuo.js} +2 -2
- package/dist/bundle/{hast-util-from-html-WLAUHN53-BfAYjYKc.js → hast-util-from-html-WLAUHN53-BOWgHBLv.js} +4 -4
- package/dist/bundle/{hast-util-to-html-PJC36XDP-C8DGIyzU.js → hast-util-to-html-PJC36XDP-QwbM5c4F.js} +5 -5
- package/dist/bundle/{hast-util-to-mdast-ZQ5OFYUM-9p6MJEBi.js → hast-util-to-mdast-ZQ5OFYUM-BidjUANu.js} +6 -6
- package/dist/bundle/{index-BOgkxLir.js → index-CTvUjqLX.js} +331 -345
- package/dist/bundle/index.js +66 -66
- package/dist/bundle/install-IPXFNLYZ-BGKW94IA.js +5 -0
- package/dist/bundle/{instructions-NHSD6EUE-BfefgySD.js → instructions-34FSWDC6-BR7mbjJH.js} +2 -2
- package/dist/bundle/mail.js +3 -3
- package/dist/bundle/{mcp-server-5FM4GA2C-CNWjKPAi.js → mcp-server-5FM4GA2C-B4Sqou0Z.js} +2 -2
- package/dist/bundle/mcp.js +12 -12
- package/dist/bundle/{mdast-util-from-markdown-Y7N3XA5A-ZkhTz5VO.js → mdast-util-from-markdown-Y7N3XA5A-CBCtetYX.js} +8 -8
- package/dist/bundle/{mdast-util-gfm-52PMOHWQ-gfhFQVZ5.js → mdast-util-gfm-52PMOHWQ-Bv-Hkixb.js} +12 -12
- package/dist/bundle/{mdast-util-to-hast-4MTEM3TB-Bomsq1EU.js → mdast-util-to-hast-4MTEM3TB-40gSN0gV.js} +6 -6
- package/dist/bundle/mdast-util-to-markdown-UGCOLDXA-DnYraMQX.js +12 -0
- package/dist/bundle/{meeting-combined-G3OVTNM6-CFHWFlT-.js → meeting-combined-G3OVTNM6-C4Jdctiy.js} +2 -2
- package/dist/bundle/{meeting-model-RINL42I5-Bab4crMQ.js → meeting-model-RINL42I5-BLAAT6mv.js} +2 -2
- package/dist/bundle/meeting-semantic-I7AZQTEI-DQ19wjn5.js +5 -0
- package/dist/bundle/{micromark-extension-gfm-FRHRNOIW-81l4O6kr.js → micromark-extension-gfm-FRHRNOIW-BvJCT_wq.js} +6 -6
- package/dist/bundle/{node-ZIYT5JOL-WfCpdwZ2.js → node-ZIYT5JOL-DoWqiI0I.js} +2 -2
- package/dist/bundle/{node-sqlite-VFGFD4MA-CrKdzJgw.js → node-sqlite-VFGFD4MA-QH9swjUN.js} +3 -3
- package/dist/bundle/notes-search-2Q3C65PA-D2HqYyaY.js +5 -0
- package/dist/bundle/oauth-TVUNW3GM-uN6u_RWy.js +7 -0
- package/dist/bundle/{open-36SZHLGF-kGan0BjP.js → open-36SZHLGF-CPBs6fdy.js} +1 -1
- package/dist/bundle/{openai-Z2WIZ6AC-D-aH-As-.js → openai-Z2WIZ6AC-CcEngcFj.js} +2 -2
- package/dist/bundle/preload.js +1 -1
- package/dist/bundle/{process-KJQOPRSP-C6W_P1_I.js → process-KJQOPRSP-BNqvUqBZ.js} +2 -2
- package/dist/bundle/{prompt-S2W33X57-BEDbCA8B.js → prompt-S2W33X57-BiF1939t.js} +2 -2
- package/dist/bundle/{recognize-NBWDLXLD-B2LTlDUy.js → recognize-NBWDLXLD-BCqQ8iG1.js} +2 -2
- package/dist/bundle/{remote-O54ANXYL-DOEubnhV.js → remote-O54ANXYL-BixLG9XM.js} +2 -2
- package/dist/bundle/{rerank-HTCSXPM6-CVIU4cUa.js → rerank-HTCSXPM6-FGYUs2VW.js} +2 -2
- package/dist/bundle/serve-7KRXCBBZ-EVSG16Mc.js +8 -0
- package/dist/bundle/server-BFD6QUV7-OmgCCeuX.js +11 -0
- package/dist/bundle/server-G7VWUBA2-C3Gq_HlM.js +12 -0
- package/dist/bundle/{sqlite-runtime-KC3NKKRB-DYslMC-g.js → sqlite-runtime-KC3NKKRB-y_O8PNsQ.js} +1 -1
- package/dist/bundle/{start-Dtq56YXe.js → start-CqQGB7xI.js} +5 -5
- package/dist/bundle/start.js +1 -1
- package/dist/bundle/state-3CFS2SAC-CYYQ103I.js +5 -0
- package/dist/bundle/store-BSVRVKTV-Uot4OGm0.js +5 -0
- package/dist/bundle/{store-6CM2A3HP-CtnMVUVK.js → store-LGAEGNFF-BzNIKnoK.js} +2 -2
- package/dist/bundle/{store-maintenance-command-WYO5PN4V-B0wefBHZ.js → store-maintenance-command-Z27R7URJ-CoJCYGVq.js} +2 -2
- package/dist/bundle/surface-ZEEHYD5Q-DRIV3XG3.js +8 -0
- package/dist/bundle/testing.js +8 -8
- package/dist/cli/app-doctor-command.d.ts +187 -1
- package/dist/cli/app-doctor-command.d.ts.map +1 -1
- package/dist/cli/app-doctor-command.js +3 -2
- package/dist/cli/app-doctor-command.js.map +1 -1
- package/dist/cli/app-mcp-command.d.ts +187 -2
- package/dist/cli/app-mcp-command.d.ts.map +1 -1
- package/dist/cli/app-mcp-command.js +3 -2
- package/dist/cli/app-mcp-command.js.map +1 -1
- package/dist/cli/built-commands.d.ts +10 -0
- package/dist/cli/built-commands.d.ts.map +1 -0
- package/dist/cli/built-commands.js +33 -0
- package/dist/cli/built-commands.js.map +1 -0
- package/dist/cli/commands-command.d.ts.map +1 -1
- package/dist/cli/commands-command.js +3 -2
- package/dist/cli/commands-command.js.map +1 -1
- package/dist/cli/complete-command.d.ts +187 -2
- package/dist/cli/complete-command.d.ts.map +1 -1
- package/dist/cli/complete-command.js +3 -2
- package/dist/cli/complete-command.js.map +1 -1
- package/dist/cli/config-command.d.ts +189 -3
- package/dist/cli/config-command.d.ts.map +1 -1
- package/dist/cli/config-command.js +3 -2
- package/dist/cli/config-command.js.map +1 -1
- package/dist/cli/context.d.ts +8 -0
- package/dist/cli/context.d.ts.map +1 -1
- package/dist/cli/context.js +39 -2
- package/dist/cli/context.js.map +1 -1
- package/dist/cli/documents/words.d.ts +1 -1
- package/dist/cli/dry-run-guard.d.ts.map +1 -1
- package/dist/cli/dry-run-guard.js +6 -28
- package/dist/cli/dry-run-guard.js.map +1 -1
- package/dist/cli/first-run.js +1 -1
- package/dist/cli/first-run.js.map +1 -1
- package/dist/cli/guide.d.ts.map +1 -1
- package/dist/cli/guide.js +3 -2
- package/dist/cli/guide.js.map +1 -1
- package/dist/cli/messenger/archive-commands.d.ts.map +1 -1
- package/dist/cli/messenger/archive-commands.js +3 -2
- package/dist/cli/messenger/archive-commands.js.map +1 -1
- package/dist/cli/messenger/complete-command.d.ts +187 -2
- package/dist/cli/messenger/complete-command.d.ts.map +1 -1
- package/dist/cli/messenger/complete-command.js +3 -2
- package/dist/cli/messenger/complete-command.js.map +1 -1
- package/dist/cli/messenger/doctor-command.d.ts.map +1 -1
- package/dist/cli/messenger/doctor-command.js +3 -2
- package/dist/cli/messenger/doctor-command.js.map +1 -1
- package/dist/cli/messenger/flood-command.d.ts.map +1 -1
- package/dist/cli/messenger/flood-command.js +3 -2
- package/dist/cli/messenger/flood-command.js.map +1 -1
- package/dist/cli/messenger/mcp-command.d.ts.map +1 -1
- package/dist/cli/messenger/mcp-command.js +3 -2
- package/dist/cli/messenger/mcp-command.js.map +1 -1
- package/dist/cli/messenger/metadata-command.d.ts.map +1 -1
- package/dist/cli/messenger/metadata-command.js +3 -2
- package/dist/cli/messenger/metadata-command.js.map +1 -1
- package/dist/cli/messenger/models-command.d.ts.map +1 -1
- package/dist/cli/messenger/models-command.js +3 -2
- package/dist/cli/messenger/models-command.js.map +1 -1
- package/dist/cli/messenger/server-command.d.ts +1 -1
- package/dist/cli/messenger/server-command.d.ts.map +1 -1
- package/dist/cli/messenger/server-command.js +3 -2
- package/dist/cli/messenger/server-command.js.map +1 -1
- package/dist/cli/messenger/session-commands.d.ts.map +1 -1
- package/dist/cli/messenger/session-commands.js +3 -2
- package/dist/cli/messenger/session-commands.js.map +1 -1
- package/dist/cli/messenger/store-maintenance-command.d.ts.map +1 -1
- package/dist/cli/messenger/store-maintenance-command.js +11 -5
- package/dist/cli/messenger/store-maintenance-command.js.map +1 -1
- package/dist/cli/model-catalogue-command.d.ts.map +1 -1
- package/dist/cli/model-catalogue-command.js +3 -2
- package/dist/cli/model-catalogue-command.js.map +1 -1
- package/dist/cli/oauth-session.d.ts.map +1 -1
- package/dist/cli/oauth-session.js +3 -2
- package/dist/cli/oauth-session.js.map +1 -1
- package/dist/cli/runs/command.d.ts.map +1 -1
- package/dist/cli/runs/command.js +3 -2
- package/dist/cli/runs/command.js.map +1 -1
- package/dist/cli/schedule/schedule-command.d.ts +1 -1
- package/dist/cli/schedule/schedule-command.d.ts.map +1 -1
- package/dist/cli/schedule/schedule-command.js +5 -3
- package/dist/cli/schedule/schedule-command.js.map +1 -1
- package/dist/cli/setup-command.d.ts.map +1 -1
- package/dist/cli/setup-command.js +3 -2
- package/dist/cli/setup-command.js.map +1 -1
- package/dist/cli/skill-command.d.ts.map +1 -1
- package/dist/cli/skill-command.js +3 -2
- package/dist/cli/skill-command.js.map +1 -1
- package/dist/cli/store-info.d.ts.map +1 -1
- package/dist/cli/store-info.js +5 -4
- package/dist/cli/store-info.js.map +1 -1
- package/dist/cli/token-session.d.ts.map +1 -1
- package/dist/cli/token-session.js +2 -1
- package/dist/cli/token-session.js.map +1 -1
- package/dist/cli/upgrade-command.d.ts.map +1 -1
- package/dist/cli/upgrade-command.js +4 -5
- package/dist/cli/upgrade-command.js.map +1 -1
- package/dist/cli/upkeep.d.ts +8 -0
- package/dist/cli/upkeep.d.ts.map +1 -0
- package/dist/cli/upkeep.js +11 -0
- package/dist/cli/upkeep.js.map +1 -0
- package/dist/entities/attachment.d.ts +0 -8
- package/dist/entities/attachment.d.ts.map +1 -1
- package/dist/entities/attachment.js +22 -20
- package/dist/entities/attachment.js.map +1 -1
- package/dist/entities/chat.d.ts +0 -4
- package/dist/entities/chat.d.ts.map +1 -1
- package/dist/entities/chat.js +6 -10
- package/dist/entities/chat.js.map +1 -1
- package/dist/entities/contact.d.ts +0 -7
- package/dist/entities/contact.d.ts.map +1 -1
- package/dist/entities/contact.js +9 -16
- package/dist/entities/contact.js.map +1 -1
- package/dist/entities/deal.d.ts +0 -36
- package/dist/entities/deal.d.ts.map +1 -1
- package/dist/entities/deal.js +22 -48
- package/dist/entities/deal.js.map +1 -1
- package/dist/entities/document.d.ts +0 -2
- package/dist/entities/document.d.ts.map +1 -1
- package/dist/entities/document.js +3 -5
- package/dist/entities/document.js.map +1 -1
- package/dist/entities/fields.d.ts +5 -1
- package/dist/entities/fields.d.ts.map +1 -1
- package/dist/entities/fields.js +6 -2
- package/dist/entities/fields.js.map +1 -1
- package/dist/entities/hit.d.ts +0 -18
- package/dist/entities/hit.d.ts.map +1 -1
- package/dist/entities/hit.js +19 -37
- package/dist/entities/hit.js.map +1 -1
- package/dist/entities/index.d.ts +0 -1
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +2 -3
- package/dist/entities/index.js.map +1 -1
- package/dist/entities/message.d.ts +2 -34
- package/dist/entities/message.d.ts.map +1 -1
- package/dist/entities/message.js +35 -67
- package/dist/entities/message.js.map +1 -1
- package/dist/entities/task.d.ts +0 -19
- package/dist/entities/task.d.ts.map +1 -1
- package/dist/entities/task.js +18 -35
- package/dist/entities/task.js.map +1 -1
- package/dist/mcp/agent.d.ts +3 -0
- package/dist/mcp/agent.d.ts.map +1 -1
- package/dist/mcp/agent.js +48 -1
- package/dist/mcp/agent.js.map +1 -1
- package/dist/mcp/app-server.d.ts.map +1 -1
- package/dist/mcp/app-server.js +8 -5
- package/dist/mcp/app-server.js.map +1 -1
- package/dist/mcp/bot/instructions.js +1 -1
- package/dist/mcp/bot/instructions.js.map +1 -1
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +4 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/instructions.js +4 -4
- package/dist/mcp/instructions.js.map +1 -1
- package/dist/mcp/lean.d.ts +9 -0
- package/dist/mcp/lean.d.ts.map +1 -0
- package/dist/mcp/lean.js +7 -0
- package/dist/mcp/lean.js.map +1 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +6 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/surface.d.ts +51 -2
- package/dist/mcp/surface.d.ts.map +1 -1
- package/dist/mcp/surface.js +379 -52
- package/dist/mcp/surface.js.map +1 -1
- package/dist/mcp/tool.d.ts +9 -1
- package/dist/mcp/tool.d.ts.map +1 -1
- package/dist/mcp/tool.js +20 -6
- package/dist/mcp/tool.js.map +1 -1
- package/dist/output-detail.d.ts +8 -0
- package/dist/output-detail.d.ts.map +1 -1
- package/dist/output-detail.js +55 -0
- package/dist/output-detail.js.map +1 -1
- package/dist/services/package-upgrade.d.ts.map +1 -1
- package/dist/services/package-upgrade.js +3 -1
- package/dist/services/package-upgrade.js.map +1 -1
- package/dist/store/compatibility.d.ts +2 -0
- package/dist/store/compatibility.d.ts.map +1 -1
- package/dist/store/compatibility.js +12 -0
- package/dist/store/compatibility.js.map +1 -1
- package/dist/store/migrations.d.ts +3 -3
- package/dist/store/migrations.js +3 -3
- package/dist/store/sqlite/clients.d.ts +6 -0
- package/dist/store/sqlite/clients.d.ts.map +1 -1
- package/dist/store/sqlite/clients.js +6 -4
- package/dist/store/sqlite/clients.js.map +1 -1
- package/dist/store/sqlite/manifest.d.ts +4 -0
- package/dist/store/sqlite/manifest.d.ts.map +1 -1
- package/dist/store/sqlite/manifest.js.map +1 -1
- package/package.json +1 -1
- package/skills/link-conversations/SKILL.md +1 -1
- package/src/cli/app-doctor-command.ts +41 -42
- package/src/cli/app-mcp-command.ts +55 -52
- package/src/cli/built-commands.ts +32 -0
- package/src/cli/commands-command.ts +3 -2
- package/src/cli/complete-command.ts +53 -48
- package/src/cli/config-command.ts +180 -177
- package/src/cli/context.ts +44 -2
- package/src/cli/dry-run-guard.ts +11 -23
- package/src/cli/first-run.ts +1 -1
- package/src/cli/guide.ts +3 -2
- package/src/cli/messenger/archive-commands.ts +3 -2
- package/src/cli/messenger/complete-command.ts +30 -30
- package/src/cli/messenger/doctor-command.ts +3 -2
- package/src/cli/messenger/flood-command.ts +3 -2
- package/src/cli/messenger/mcp-command.ts +3 -2
- package/src/cli/messenger/metadata-command.ts +3 -2
- package/src/cli/messenger/models-command.ts +3 -2
- package/src/cli/messenger/server-command.ts +3 -2
- package/src/cli/messenger/session-commands.ts +3 -2
- package/src/cli/messenger/store-maintenance-command.ts +18 -12
- package/src/cli/model-catalogue-command.ts +3 -2
- package/src/cli/oauth-session.ts +3 -2
- package/src/cli/runs/command.ts +3 -2
- package/src/cli/schedule/schedule-command.ts +412 -410
- package/src/cli/setup-command.ts +3 -2
- package/src/cli/skill-command.ts +3 -2
- package/src/cli/store-info.ts +21 -16
- package/src/cli/token-session.ts +3 -2
- package/src/cli/upgrade-command.ts +59 -62
- package/src/cli/upkeep.ts +15 -0
- package/src/entities/attachment.ts +44 -30
- package/src/entities/chat.ts +9 -10
- package/src/entities/contact.ts +20 -21
- package/src/entities/deal.ts +66 -53
- package/src/entities/document.ts +3 -5
- package/src/entities/fields.ts +11 -2
- package/src/entities/hit.ts +52 -37
- package/src/entities/index.ts +2 -3
- package/src/entities/message.ts +101 -80
- package/src/entities/task.ts +37 -38
- package/src/mcp/agent.ts +51 -1
- package/src/mcp/app-server.ts +8 -5
- package/src/mcp/bot/instructions.ts +1 -1
- package/src/mcp/index.ts +4 -0
- package/src/mcp/instructions.ts +4 -4
- package/src/mcp/lean.ts +8 -0
- package/src/mcp/server.ts +6 -2
- package/src/mcp/surface.ts +436 -64
- package/src/mcp/tool.ts +27 -4
- package/src/output-detail.ts +61 -0
- package/src/services/package-upgrade.ts +3 -1
- package/src/store/compatibility.ts +12 -0
- package/src/store/migrations.ts +3 -3
- package/src/store/sqlite/clients.ts +17 -6
- package/src/store/sqlite/manifest.ts +4 -0
- package/dist/bundle/install-IPXFNLYZ-BSWiztYR.js +0 -5
- package/dist/bundle/mdast-util-to-markdown-UGCOLDXA-7D6EJn9r.js +0 -12
- package/dist/bundle/meeting-semantic-I7AZQTEI-BgZ3ZzQB.js +0 -5
- package/dist/bundle/notes-search-2Q3C65PA-CWKHboCy.js +0 -5
- package/dist/bundle/oauth-TVUNW3GM-BqlyhUfp.js +0 -7
- package/dist/bundle/serve-7KRXCBBZ-BO9BKhWL.js +0 -8
- package/dist/bundle/server-PIT6UZRZ-C6I-VrDd.js +0 -11
- package/dist/bundle/server-ZL4FMEHH-DP1oYgCn.js +0 -12
- package/dist/bundle/state-3CFS2SAC-xptBCfut.js +0 -5
- package/dist/bundle/store-ASWYHJ4Q-C7EFfvzB.js +0 -5
- package/dist/bundle/surface-DDH4HGT3-CBZnEqH_.js +0 -8
|
@@ -55,6 +55,7 @@ import { listQuery, typedQuery, withQuery } from "../list-query.js"
|
|
|
55
55
|
import { SCHEDULE_HARNESSES_QUERY, SCHEDULES_QUERY, scheduleFilter } from "../messenger/list-result-queries.js"
|
|
56
56
|
import type { DeclaredSetting } from "../setting-defaults.js"
|
|
57
57
|
import { lineOf } from "../steps.js"
|
|
58
|
+
import { upkeepCommand } from "../upkeep.js"
|
|
58
59
|
import { agentStart, guardSchedule, sealOf } from "./agent-start.js"
|
|
59
60
|
import {
|
|
60
61
|
AGENT_MODELS,
|
|
@@ -591,439 +592,440 @@ export const runScheduleNow = async (
|
|
|
591
592
|
* (macOS) or Task Scheduler (Windows). Every timer runs `schedule exec <file>`; the schedule file holds
|
|
592
593
|
* the rest, so what runs and with which variables is the same on all three.
|
|
593
594
|
*/
|
|
594
|
-
export const scheduleCommandFor = (
|
|
595
|
-
app,
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
const agentClis = [app, ...agentRuns]
|
|
603
|
-
const messenger = app.messenger !== false
|
|
604
|
-
const commandExample = messenger ? "messages list <chat> --limit 50" : "doctor"
|
|
605
|
-
const command = new Command("schedule").description(
|
|
606
|
-
`run a ${app.command} command or an agent later or on a timer (systemd, launchd, Task Scheduler); an agent cannot send`,
|
|
607
|
-
)
|
|
595
|
+
export const scheduleCommandFor = upkeepCommand(
|
|
596
|
+
({ app, context: contextOf, newMail, agentInput, limits: configured, agentRuns = [] }: ScheduleHost): Command => {
|
|
597
|
+
const agentClis = [app, ...agentRuns]
|
|
598
|
+
const messenger = app.messenger !== false
|
|
599
|
+
const commandExample = messenger ? "messages list <chat> --limit 50" : "doctor"
|
|
600
|
+
const command = new Command("schedule").description(
|
|
601
|
+
`run a ${app.command} command or an agent later or on a timer (systemd, launchd, Task Scheduler); an agent cannot send`,
|
|
602
|
+
)
|
|
608
603
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
604
|
+
const prepare = (self: Command, resolving: { needsProfile?: boolean } = {}) => {
|
|
605
|
+
const context = contextOf(self, resolving)
|
|
606
|
+
const system = environmentOf<BaseEnvironment & { system?: ServerSystem }>(self).system ?? thisMachine()
|
|
607
|
+
const site: ScheduleSite = {
|
|
608
|
+
app,
|
|
609
|
+
system,
|
|
610
|
+
env: context.env,
|
|
611
|
+
profile: context.profile,
|
|
612
|
+
agentRuns,
|
|
613
|
+
limits: configured?.(self) ?? {},
|
|
614
|
+
}
|
|
615
|
+
const state = scheduleState(site)
|
|
616
|
+
const say = (value: object, lines: string[]) => renderAnswer(self, context, itemOf(value), () => lines.join("\n"))
|
|
617
|
+
const timer = () => timerFor(app, system, context.env)
|
|
618
|
+
const environment = () => scheduleEnvironment(site)
|
|
619
|
+
const save = async (schedule: Schedule) => {
|
|
620
|
+
const { file, timer: where, replaced } = await writeSchedule(site, schedule)
|
|
621
|
+
say(scheduleAnswer(schedule, { file, timer: where, replaced }), [
|
|
622
|
+
`${replaced ? "Replaced" : "Added"} ${schedule.name}: ${describeWhen(schedule.when)}${schedule.paused ? ", paused" : ""}.`,
|
|
623
|
+
`It runs: ${schedule.kind === "agent" ? shown(schedule.argv) : `${app.command} ${shown(schedule.argv)}`}`,
|
|
624
|
+
`Output: ${join(dirname(file), "runs")} · now: ${lineOf(self, `schedule run ${schedule.name}`)} · stop: ${lineOf(self, `schedule remove ${schedule.name}`)}`,
|
|
625
|
+
])
|
|
626
|
+
}
|
|
627
|
+
return { context, system, state, say, timer, environment, save, site }
|
|
631
628
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
maxCostPerDayUsd: costed ? limitsOf(self, schedule).maxCostPerDay : null,
|
|
629
|
+
/**
|
|
630
|
+
* Why a run does not start now, or nothing: an agent whose runs reached the day's cost cap waits for tomorrow, and
|
|
631
|
+
* one gated on mail waits for mail past its holder's mark — on its timer, until enough of it waits.
|
|
632
|
+
*/
|
|
633
|
+
/** A schedule's own limits, else the config file's, else the defaults. */
|
|
634
|
+
const limitsOf = (self: Command, schedule: Schedule) => ({
|
|
635
|
+
...SCHEDULE_DEFAULTS,
|
|
636
|
+
...given(configured?.(self) ?? {}),
|
|
637
|
+
...given({
|
|
638
|
+
mailWaitMinutes: schedule.mailWaitMinutes,
|
|
639
|
+
mailBatch: schedule.mailBatch,
|
|
640
|
+
maxCostPerDay: schedule.maxCostPerDay,
|
|
641
|
+
}),
|
|
642
|
+
})
|
|
643
|
+
/** An agent that reports no cost answers null for what it spent and for its caps: unknown, not $0 and not capped. */
|
|
644
|
+
const agentCostsOf = (self: Command, state: string, schedule: Schedule) => {
|
|
645
|
+
const harness =
|
|
646
|
+
schedule.agent && isHarness(schedule.agent.harness) ? schedule.agent.harness : harnessOfArgv(schedule.argv)
|
|
647
|
+
const costed = harness !== null && reportsCost(harness)
|
|
648
|
+
return {
|
|
649
|
+
harness,
|
|
650
|
+
reportsCost: costed,
|
|
651
|
+
spentTodayUsd: costed ? spentToday(scheduleFile(state, schedule.name)) : null,
|
|
652
|
+
maxCostUsd: costed ? runCapOf(schedule.argv) : null,
|
|
653
|
+
maxCostPerDayUsd: costed ? limitsOf(self, schedule).maxCostPerDay : null,
|
|
654
|
+
}
|
|
659
655
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
{
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
656
|
+
const waits = async (
|
|
657
|
+
self: Command,
|
|
658
|
+
file: string,
|
|
659
|
+
{ timed }: { timed: boolean },
|
|
660
|
+
): Promise<{ why: string; reason: SkipReason } | undefined> => {
|
|
661
|
+
if (!existsSync(file)) return undefined
|
|
662
|
+
const schedule = readSchedule(file)
|
|
663
|
+
const { mailWaitMinutes, mailBatch, maxCostPerDay } = limitsOf(self, schedule)
|
|
664
|
+
const capped = dayCapReached(file, schedule, maxCostPerDay)
|
|
665
|
+
if (capped) return capped
|
|
666
|
+
const holder = schedule.onNewMail
|
|
667
|
+
if (holder === undefined || !newMail) return undefined
|
|
668
|
+
const waiting = await newMail(self, holder)
|
|
669
|
+
if (waiting.unmarked) return undefined
|
|
670
|
+
if (waiting.emails === 0) {
|
|
671
|
+
const why = `no mail stored past ${holder}'s mark`
|
|
672
|
+
recordSkip(file, why, SKIP_REASONS.mailNone)
|
|
673
|
+
return { why, reason: SKIP_REASONS.mailNone }
|
|
674
|
+
}
|
|
675
|
+
const waited = waiting.oldestStoredAt === null ? 0 : Date.now() - waiting.oldestStoredAt
|
|
676
|
+
if (!timed || waiting.emails >= mailBatch || waited >= mailWaitMinutes * 60_000) return undefined
|
|
677
|
+
const why =
|
|
678
|
+
`${waiting.emails} email(s) wait past ${holder}'s mark; it starts at ${mailBatch}, ` +
|
|
679
|
+
`or once the oldest has waited ${mailWaitMinutes}m`
|
|
680
|
+
recordSkip(file, why, SKIP_REASONS.mailBelowThreshold)
|
|
681
|
+
return { why, reason: SKIP_REASONS.mailBelowThreshold }
|
|
679
682
|
}
|
|
680
|
-
const waited = waiting.oldestStoredAt === null ? 0 : Date.now() - waiting.oldestStoredAt
|
|
681
|
-
if (!timed || waiting.emails >= mailBatch || waited >= mailWaitMinutes * 60_000) return undefined
|
|
682
|
-
const why =
|
|
683
|
-
`${waiting.emails} email(s) wait past ${holder}'s mark; it starts at ${mailBatch}, ` +
|
|
684
|
-
`or once the oldest has waited ${mailWaitMinutes}m`
|
|
685
|
-
recordSkip(file, why, SKIP_REASONS.mailBelowThreshold)
|
|
686
|
-
return { why, reason: SKIP_REASONS.mailBelowThreshold }
|
|
687
|
-
}
|
|
688
683
|
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
)
|
|
700
|
-
.description(
|
|
701
|
-
`run ${app.command} <args…> on a timer — reads save what they read, so this is how ${messenger ? "a chat's history fills the store" : "the store stays current"}`,
|
|
684
|
+
withWhen(
|
|
685
|
+
grantsAuthority(
|
|
686
|
+
annotate(command.command("command"), {
|
|
687
|
+
literal_after_dashes: true,
|
|
688
|
+
effects: LOCAL_WRITE,
|
|
689
|
+
examples: [
|
|
690
|
+
`${app.command} personal schedule command health --every 1h -- doctor`,
|
|
691
|
+
`${app.command} personal schedule command morning-check --at 08:00 -- doctor`,
|
|
692
|
+
],
|
|
693
|
+
}),
|
|
702
694
|
)
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
695
|
+
.description(
|
|
696
|
+
`run ${app.command} <args…> on a timer — reads save what they read, so this is how ${messenger ? "a chat's history fills the store" : "the store stays current"}`,
|
|
697
|
+
)
|
|
698
|
+
.argument("<name>", "lowercase letters, digits and dashes")
|
|
699
|
+
.argument("<args...>", `the ${app.command} command after its name, e.g. -- ${commandExample}`),
|
|
700
|
+
).action(async function (this: Command, name: string, args: string[]) {
|
|
701
|
+
const { environment, save } = prepare(this)
|
|
702
|
+
if (args[0] === "schedule") throw new CliError("validation_error", "a schedule cannot run schedule")
|
|
703
|
+
await save({
|
|
704
|
+
name: scheduleName(name),
|
|
705
|
+
kind: "command",
|
|
706
|
+
argv: args,
|
|
707
|
+
when: whenOf(this.opts<WhenOptions>(), COMMAND_MINIMUM_MINUTES),
|
|
708
|
+
environment: environment(),
|
|
709
|
+
createdAt: new Date().toISOString(),
|
|
710
|
+
...deliveryOf(this.opts<WhenOptions>()),
|
|
711
|
+
})
|
|
716
712
|
})
|
|
717
|
-
})
|
|
718
713
|
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
)
|
|
730
|
-
.description(
|
|
731
|
-
`start an agent (${HARNESSES.join(", ")}) with a prompt on a timer; it runs with ${agentClis.map((one) => `${one.envPrefix}_READ_ONLY=1`).join(" and ")}, so it reads and drafts and cannot send, and its own limits hold it to these CLIs' commands; an agent with no such limit is refused (\`schedule agents list\` says which) — its answer is kept and you are notified`,
|
|
732
|
-
)
|
|
733
|
-
.argument("<name>", "lowercase letters, digits and dashes")
|
|
734
|
-
.addArgument(new Argument("<harness>", "the agent to start").choices(HARNESSES))
|
|
735
|
-
.argument("<prompt>", `what to do, e.g. "${promptExample(app)}"`)
|
|
736
|
-
.option(
|
|
737
|
-
"--model <model>",
|
|
738
|
-
`the model it runs on: an alias such as sonnet, or a model id; "" for the agent's own default (default sonnet for claude, the agent's own for the others, or the config file's)`,
|
|
714
|
+
withWhen(
|
|
715
|
+
grantsAuthority(
|
|
716
|
+
annotate(command.command("agent"), {
|
|
717
|
+
effects: LOCAL_WRITE,
|
|
718
|
+
examples: [
|
|
719
|
+
`${app.command} personal schedule agent review claude "review what came in overnight and draft replies" --at 08:30`,
|
|
720
|
+
`${app.command} personal schedule agent triage gemini "list what needs an answer today" --every 2h`,
|
|
721
|
+
`${app.command} personal schedule agent weekly claude "review the week's open threads" --at 09:00 --model opus`,
|
|
722
|
+
],
|
|
723
|
+
}),
|
|
739
724
|
)
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
725
|
+
.description(
|
|
726
|
+
`start an agent (${HARNESSES.join(", ")}) with a prompt on a timer; it runs with ${agentClis.map((one) => `${one.envPrefix}_READ_ONLY=1`).join(" and ")}, so it reads and drafts and cannot send, and its own limits hold it to these CLIs' commands; an agent with no such limit is refused (\`schedule agents list\` says which) — its answer is kept and you are notified`,
|
|
727
|
+
)
|
|
728
|
+
.argument("<name>", "lowercase letters, digits and dashes")
|
|
729
|
+
.addArgument(new Argument("<harness>", "the agent to start").choices(HARNESSES))
|
|
730
|
+
.argument("<prompt>", `what to do, e.g. "${promptExample(app)}"`)
|
|
731
|
+
.option(
|
|
732
|
+
"--model <model>",
|
|
733
|
+
`the model it runs on: an alias such as sonnet, or a model id; "" for the agent's own default (default sonnet for claude, the agent's own for the others, or the config file's)`,
|
|
734
|
+
)
|
|
735
|
+
.addOption(
|
|
736
|
+
new Option("--max-cost <usd>", "claude only: stop a run that costs more than this, in US dollars").argParser(
|
|
737
|
+
Number,
|
|
738
|
+
),
|
|
739
|
+
)
|
|
740
|
+
.option(
|
|
741
|
+
"--allow-dangerous",
|
|
742
|
+
"start an agent its own limits cannot hold to these CLIs' commands, where `schedule agents list` says allowed_with_ack: it may then run any program inside its sandbox",
|
|
743
|
+
)
|
|
744
|
+
.addOption(
|
|
745
|
+
new Option(
|
|
746
|
+
"--max-cost-per-day <usd>",
|
|
747
|
+
`${COSTED} only, as the others report no cost: start no run for the rest of the day once its runs cost this much, in US dollars; 0 for no cap (default ${SCHEDULE_DEFAULTS.maxCostPerDay}, or the config file's)`,
|
|
748
|
+
).argParser(Number),
|
|
743
749
|
),
|
|
750
|
+
).action(async function (this: Command, name: string, harness: Harness, prompt: string) {
|
|
751
|
+
const { site, save } = prepare(this)
|
|
752
|
+
const options = this.opts<
|
|
753
|
+
WhenOptions & {
|
|
754
|
+
model?: string
|
|
755
|
+
maxCost?: number
|
|
756
|
+
maxCostPerDay?: number
|
|
757
|
+
onNewMail?: string
|
|
758
|
+
mailWait?: string
|
|
759
|
+
mailBatch?: string
|
|
760
|
+
allowDangerous?: boolean
|
|
761
|
+
}
|
|
762
|
+
>()
|
|
763
|
+
if (options.onNewMail !== undefined && !HOLDER.test(options.onNewMail))
|
|
764
|
+
throw new CliError("validation_error", `--on-new-mail takes a holder: lower-case letters, digits and dashes`)
|
|
765
|
+
if ((options.mailWait !== undefined || options.mailBatch !== undefined) && options.onNewMail === undefined)
|
|
766
|
+
throw new CliError("validation_error", "--mail-wait and --mail-batch shape a run gated by --on-new-mail")
|
|
767
|
+
if (
|
|
768
|
+
options.maxCostPerDay !== undefined &&
|
|
769
|
+
!(Number.isFinite(options.maxCostPerDay) && options.maxCostPerDay >= 0)
|
|
744
770
|
)
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
if (options.maxCostPerDay !== undefined && !(Number.isFinite(options.maxCostPerDay) && options.maxCostPerDay >= 0))
|
|
773
|
-
throw new CliError("validation_error", "--max-cost-per-day takes US dollars, 0 or more")
|
|
774
|
-
if (!reportsCost(harness) && (options.maxCost || options.maxCostPerDay))
|
|
775
|
-
throw new CliError(
|
|
776
|
-
"validation_error",
|
|
777
|
-
`${harness} reports no cost, so --max-cost and --max-cost-per-day cannot stop it; leave them out (${COSTED} reports one)`,
|
|
778
|
-
{ reason: "agent.cost-unknown" },
|
|
771
|
+
throw new CliError("validation_error", "--max-cost-per-day takes US dollars, 0 or more")
|
|
772
|
+
if (!reportsCost(harness) && (options.maxCost || options.maxCostPerDay))
|
|
773
|
+
throw new CliError(
|
|
774
|
+
"validation_error",
|
|
775
|
+
`${harness} reports no cost, so --max-cost and --max-cost-per-day cannot stop it; leave them out (${COSTED} reports one)`,
|
|
776
|
+
{ reason: "agent.cost-unknown" },
|
|
777
|
+
)
|
|
778
|
+
const mailBatch = options.mailBatch === undefined ? undefined : Number(options.mailBatch)
|
|
779
|
+
if (mailBatch !== undefined && !(Number.isSafeInteger(mailBatch) && mailBatch >= 1))
|
|
780
|
+
throw new CliError("validation_error", "--mail-batch takes a count of emails, 1 or more")
|
|
781
|
+
const mailWaitMinutes =
|
|
782
|
+
options.mailWait === undefined ? undefined : Math.ceil(parseDuration(options.mailWait, "--mail-wait") / 60_000)
|
|
783
|
+
await save(
|
|
784
|
+
agentSchedule(site, {
|
|
785
|
+
name,
|
|
786
|
+
harness,
|
|
787
|
+
prompt,
|
|
788
|
+
when: whenOf(options, options.onNewMail ? GATED_AGENT_MINIMUM_MINUTES : AGENT_MINIMUM_MINUTES),
|
|
789
|
+
...(options.model === undefined ? {} : { model: options.model }),
|
|
790
|
+
...(options.maxCost ? { maxCost: options.maxCost } : {}),
|
|
791
|
+
...(options.maxCostPerDay === undefined ? {} : { maxCostPerDay: options.maxCostPerDay }),
|
|
792
|
+
...(options.allowDangerous ? { allowDangerous: true } : {}),
|
|
793
|
+
...(options.onNewMail ? { onNewMail: options.onNewMail } : {}),
|
|
794
|
+
...(mailWaitMinutes === undefined ? {} : { mailWaitMinutes }),
|
|
795
|
+
...(mailBatch === undefined ? {} : { mailBatch }),
|
|
796
|
+
...deliveryOf(options),
|
|
797
|
+
}),
|
|
779
798
|
)
|
|
780
|
-
|
|
781
|
-
if (
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
+
})
|
|
800
|
+
if (newMail)
|
|
801
|
+
command.commands
|
|
802
|
+
.find((one) => one.name() === "agent")
|
|
803
|
+
?.option(
|
|
804
|
+
"--on-new-mail <holder>",
|
|
805
|
+
`run only when mail is stored past this holder's mark — after a sync brought new mail; may check every ${GATED_AGENT_MINIMUM_MINUTES}m`,
|
|
806
|
+
)
|
|
807
|
+
.option(
|
|
808
|
+
"--mail-wait <duration>",
|
|
809
|
+
`with --on-new-mail: start once the oldest waiting email has waited this long (default ${SCHEDULE_DEFAULTS.mailWaitMinutes}m, or the config file's)`,
|
|
810
|
+
)
|
|
811
|
+
.option(
|
|
812
|
+
"--mail-batch <n>",
|
|
813
|
+
`with --on-new-mail: or once this many emails wait (default ${SCHEDULE_DEFAULTS.mailBatch}, or the config file's)`,
|
|
814
|
+
)
|
|
815
|
+
|
|
816
|
+
withQuery(
|
|
817
|
+
annotate(command.command("list"), {
|
|
818
|
+
effects: LOCAL_READ,
|
|
819
|
+
examples: [`${app.command} personal schedule list`, `${app.command} personal schedule list kind:agent`],
|
|
799
820
|
}),
|
|
821
|
+
SCHEDULES_QUERY,
|
|
800
822
|
)
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
kind === "agent" ? `agent ${harness ?? "unknown"}` : kind,
|
|
854
|
-
paused ? `${when}, paused` : when,
|
|
855
|
-
`notify ${notify}`,
|
|
856
|
-
...(deliverTo ? [`to ${deliverTo.join(", ")}`] : []),
|
|
857
|
-
last
|
|
858
|
-
? `last ${last.at.slice(0, 16).replace("T", " ")} exit ${last.exitCode}` +
|
|
859
|
-
(last.failures
|
|
860
|
-
? ` — failing since ${(last.failingSince ?? last.at).slice(0, 16).replace("T", " ")}, ` +
|
|
861
|
-
`${last.failures} in a row${last.reason ? `: ${last.reason}` : ""} — ${last.output}`
|
|
862
|
-
: "")
|
|
863
|
-
: "not run yet",
|
|
864
|
-
...(spentTodayUsd
|
|
865
|
-
? [`today ${usd(spentTodayUsd)}${maxCostPerDayUsd ? ` of ${usd(maxCostPerDayUsd)}` : ""}`]
|
|
866
|
-
: []),
|
|
867
|
-
...(last?.skipped
|
|
868
|
-
? [`skipped ${last.skipped.at.slice(0, 16).replace("T", " ")}: ${last.skipped.why}`]
|
|
869
|
-
: []),
|
|
870
|
-
...(last?.deliveries ?? [])
|
|
871
|
-
.filter((one) => !one.ok)
|
|
872
|
-
.map((one) => `not delivered to ${one.to}: ${one.reason}${one.error ? ` (${one.error})` : ""}`),
|
|
873
|
-
].join(" "),
|
|
874
|
-
)
|
|
875
|
-
.join("\n")
|
|
823
|
+
.description("the schedules, when they run and how their last run went")
|
|
824
|
+
.action(function (this: Command, words: string[]) {
|
|
825
|
+
const filter = scheduleFilter(words)
|
|
826
|
+
const { context, state } = prepare(this)
|
|
827
|
+
const rows = listSchedules(state, filter).map((schedule) => ({
|
|
828
|
+
name: schedule.name,
|
|
829
|
+
kind: schedule.kind,
|
|
830
|
+
when: describeWhen(schedule.when),
|
|
831
|
+
...(schedule.paused ? { paused: true } : {}),
|
|
832
|
+
notify: notifyOf(schedule),
|
|
833
|
+
...(schedule.to?.length ? { deliverTo: schedule.to } : {}),
|
|
834
|
+
last: lastRun(scheduleFile(state, schedule.name)) ?? null,
|
|
835
|
+
...(schedule.kind === "agent" ? agentCostsOf(this, state, schedule) : {}),
|
|
836
|
+
}))
|
|
837
|
+
const answer = listOf("schedule list", {
|
|
838
|
+
items: rows.map((row) => snakeKeys(row)),
|
|
839
|
+
limit: Math.max(1, rows.length),
|
|
840
|
+
has_more: false,
|
|
841
|
+
})
|
|
842
|
+
renderAnswer(this, context, answer, () => {
|
|
843
|
+
if (rows.length === 0) {
|
|
844
|
+
context.renderer.note(`no schedules — \`${lineOf(this, "schedule command|agent")}\` adds one`)
|
|
845
|
+
return ""
|
|
846
|
+
}
|
|
847
|
+
return rows
|
|
848
|
+
.map(({ name, kind, harness, when, paused, notify, deliverTo, last, spentTodayUsd, maxCostPerDayUsd }) =>
|
|
849
|
+
[
|
|
850
|
+
name,
|
|
851
|
+
kind === "agent" ? `agent ${harness ?? "unknown"}` : kind,
|
|
852
|
+
paused ? `${when}, paused` : when,
|
|
853
|
+
`notify ${notify}`,
|
|
854
|
+
...(deliverTo ? [`to ${deliverTo.join(", ")}`] : []),
|
|
855
|
+
last
|
|
856
|
+
? `last ${last.at.slice(0, 16).replace("T", " ")} exit ${last.exitCode}` +
|
|
857
|
+
(last.failures
|
|
858
|
+
? ` — failing since ${(last.failingSince ?? last.at).slice(0, 16).replace("T", " ")}, ` +
|
|
859
|
+
`${last.failures} in a row${last.reason ? `: ${last.reason}` : ""} — ${last.output}`
|
|
860
|
+
: "")
|
|
861
|
+
: "not run yet",
|
|
862
|
+
...(spentTodayUsd
|
|
863
|
+
? [`today ${usd(spentTodayUsd)}${maxCostPerDayUsd ? ` of ${usd(maxCostPerDayUsd)}` : ""}`]
|
|
864
|
+
: []),
|
|
865
|
+
...(last?.skipped
|
|
866
|
+
? [`skipped ${last.skipped.at.slice(0, 16).replace("T", " ")}: ${last.skipped.why}`]
|
|
867
|
+
: []),
|
|
868
|
+
...(last?.deliveries ?? [])
|
|
869
|
+
.filter((one) => !one.ok)
|
|
870
|
+
.map((one) => `not delivered to ${one.to}: ${one.reason}${one.error ? ` (${one.error})` : ""}`),
|
|
871
|
+
].join(" "),
|
|
872
|
+
)
|
|
873
|
+
.join("\n")
|
|
874
|
+
})
|
|
876
875
|
})
|
|
877
|
-
})
|
|
878
876
|
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
877
|
+
withQuery(
|
|
878
|
+
annotate(command.command("agents").description("the coding agents an agent schedule may start").command("list"), {
|
|
879
|
+
effects: LOCAL_READ,
|
|
880
|
+
examples: [`${app.command} schedule agents list`, `${app.command} schedule agents list --json`],
|
|
881
|
+
}),
|
|
882
|
+
SCHEDULE_HARNESSES_QUERY,
|
|
883
|
+
)
|
|
884
|
+
.description("the agents a schedule may start, and which are on PATH here")
|
|
885
|
+
.action(function (this: Command, words: string[]) {
|
|
886
|
+
listQuery(typedQuery(words), SCHEDULE_HARNESSES_QUERY, "schedule agents list")
|
|
887
|
+
const { context, system } = prepare(this, { needsProfile: false })
|
|
888
|
+
const rows = harnessesOn(context.env, system.platform)
|
|
889
|
+
const answer = listOf("schedule agents list", {
|
|
890
|
+
items: rows.map((row) => snakeKeys(row)),
|
|
891
|
+
limit: rows.length,
|
|
892
|
+
has_more: false,
|
|
893
|
+
})
|
|
894
|
+
renderAnswer(this, context, answer, () =>
|
|
895
|
+
rows
|
|
896
|
+
.map(({ id, name, installed, path, reportsCost }) =>
|
|
897
|
+
[id, name, installed ? path : "not on PATH", reportsCost ? "reports cost" : "cost unknown"].join(" "),
|
|
898
|
+
)
|
|
899
|
+
.join("\n"),
|
|
900
|
+
)
|
|
895
901
|
})
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
)
|
|
901
|
-
.join("\n"),
|
|
902
|
-
)
|
|
902
|
+
|
|
903
|
+
annotate(command.command("run"), {
|
|
904
|
+
effects: REMOTE_WRITE,
|
|
905
|
+
examples: [`${app.command} personal schedule run health`],
|
|
903
906
|
})
|
|
907
|
+
.description("run a schedule now, as its timer would, and wait for it; a paused one runs too")
|
|
908
|
+
.argument("<name>", "the schedule's name, as `schedule list` shows it")
|
|
909
|
+
.option("--no-notify", "keep the result here: send it along none of its routes")
|
|
910
|
+
.option(
|
|
911
|
+
"--deliver-to <route>",
|
|
912
|
+
"send it along only this one of its own routes; repeat it for more",
|
|
913
|
+
(route: string, routes: string[] = []) => [...routes, routeText(parseRoute(route))],
|
|
914
|
+
)
|
|
915
|
+
.action(async function (this: Command, name: string, given: { notify: boolean; deliverTo?: string[] }) {
|
|
916
|
+
const { state, say, site } = prepare(this)
|
|
917
|
+
const file = scheduleFile(state, scheduleName(name))
|
|
918
|
+
const routes = given.notify ? given.deliverTo : []
|
|
919
|
+
if (!given.notify && given.deliverTo)
|
|
920
|
+
throw new CliError(
|
|
921
|
+
"validation_error",
|
|
922
|
+
"--no-notify sends nothing; leave out --deliver-to, or leave out --no-notify",
|
|
923
|
+
)
|
|
924
|
+
const skip = await waits(this, file, { timed: false })
|
|
925
|
+
if (skip !== undefined) {
|
|
926
|
+
return say({ name, skipped: true, why: skip.why, reason: skip.reason }, [`${name}: skipped — ${skip.why}`])
|
|
927
|
+
}
|
|
928
|
+
const last = await runScheduleNow(this, site, file, {
|
|
929
|
+
...(agentInput ? { agentInput } : {}),
|
|
930
|
+
...(routes ? { routes } : {}),
|
|
931
|
+
})
|
|
932
|
+
if (!("exitCode" in last)) {
|
|
933
|
+
const { why, reason } = last.skipped
|
|
934
|
+
return say({ name, skipped: true, why, reason }, [`${name}: skipped — ${why}`])
|
|
935
|
+
}
|
|
936
|
+
say(snakeKeys({ name, ...last }) as object, [`${name}: exit ${last.exitCode} — ${last.output}`])
|
|
937
|
+
if (last.exitCode !== 0) setExitCode(this, 1)
|
|
938
|
+
})
|
|
904
939
|
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
.argument("<name>", "the schedule's name, as `schedule list` shows it")
|
|
911
|
-
.option("--no-notify", "keep the result here: send it along none of its routes")
|
|
912
|
-
.option(
|
|
913
|
-
"--deliver-to <route>",
|
|
914
|
-
"send it along only this one of its own routes; repeat it for more",
|
|
915
|
-
(route: string, routes: string[] = []) => [...routes, routeText(parseRoute(route))],
|
|
940
|
+
grantsAuthority(
|
|
941
|
+
annotate(command.command("remove"), {
|
|
942
|
+
effects: LOCAL_WRITE,
|
|
943
|
+
examples: [`${app.command} personal schedule remove health`],
|
|
944
|
+
}),
|
|
916
945
|
)
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
)
|
|
926
|
-
const skip = await waits(this, file, { timed: false })
|
|
927
|
-
if (skip !== undefined) {
|
|
928
|
-
return say({ name, skipped: true, why: skip.why, reason: skip.reason }, [`${name}: skipped — ${skip.why}`])
|
|
929
|
-
}
|
|
930
|
-
const last = await runScheduleNow(this, site, file, {
|
|
931
|
-
...(agentInput ? { agentInput } : {}),
|
|
932
|
-
...(routes ? { routes } : {}),
|
|
946
|
+
.description("stop a schedule and remove its timer; its past output stays")
|
|
947
|
+
.argument("<name>", "the schedule's name, as `schedule list` shows it")
|
|
948
|
+
.action(async function (this: Command, name: string) {
|
|
949
|
+
const { state, say, site } = prepare(this)
|
|
950
|
+
if (!existsSync(scheduleFile(state, scheduleName(name))))
|
|
951
|
+
throw new CliError("not_found", `no schedule ${name} — \`${lineOf(this, "schedule list")}\``)
|
|
952
|
+
await removeSchedule(site, name)
|
|
953
|
+
say({ name, removed: true }, [`Removed ${name}.`])
|
|
933
954
|
})
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
955
|
+
|
|
956
|
+
const setPaused = (paused: boolean) =>
|
|
957
|
+
async function (this: Command, name: string) {
|
|
958
|
+
const { state, say, site } = prepare(this)
|
|
959
|
+
const file = scheduleFile(state, scheduleName(name))
|
|
960
|
+
if (!existsSync(file))
|
|
961
|
+
throw new CliError("not_found", `no schedule ${name} — \`${lineOf(this, "schedule list")}\``)
|
|
962
|
+
const { schedule, timer } = await pauseSchedule(site, name, paused)
|
|
963
|
+
say({ name, paused, timer }, [
|
|
964
|
+
paused
|
|
965
|
+
? `Paused ${name}: no timer starts it; ${lineOf(this, `schedule run ${name}`)} still does.`
|
|
966
|
+
: `Resumed ${name}: ${describeWhen(schedule.when)}.`,
|
|
967
|
+
])
|
|
937
968
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
969
|
+
grantsAuthority(
|
|
970
|
+
annotate(command.command("pause"), {
|
|
971
|
+
effects: LOCAL_WRITE,
|
|
972
|
+
examples: [`${app.command} personal schedule pause health`],
|
|
973
|
+
}),
|
|
974
|
+
)
|
|
975
|
+
.description("take a schedule off its timer and keep it; run runs it, resume puts it back")
|
|
976
|
+
.argument("<name>", "the schedule's name, as `schedule list` shows it")
|
|
977
|
+
.action(setPaused(true))
|
|
978
|
+
grantsAuthority(
|
|
979
|
+
annotate(command.command("resume"), {
|
|
980
|
+
effects: LOCAL_WRITE,
|
|
981
|
+
examples: [`${app.command} personal schedule resume health`],
|
|
982
|
+
}),
|
|
983
|
+
)
|
|
984
|
+
.description("put a paused schedule back on its timer")
|
|
985
|
+
.argument("<name>", "the schedule's name, as `schedule list` shows it")
|
|
986
|
+
.action(setPaused(false))
|
|
941
987
|
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
)
|
|
948
|
-
.description("stop a schedule and remove its timer; its past output stays")
|
|
949
|
-
.argument("<name>", "the schedule's name, as `schedule list` shows it")
|
|
950
|
-
.action(async function (this: Command, name: string) {
|
|
951
|
-
const { state, say, site } = prepare(this)
|
|
952
|
-
if (!existsSync(scheduleFile(state, scheduleName(name))))
|
|
953
|
-
throw new CliError("not_found", `no schedule ${name} — \`${lineOf(this, "schedule list")}\``)
|
|
954
|
-
await removeSchedule(site, name)
|
|
955
|
-
say({ name, removed: true }, [`Removed ${name}.`])
|
|
988
|
+
annotate(command.command("exec"), {
|
|
989
|
+
effects: REMOTE_WRITE,
|
|
990
|
+
// An agent runs a saved schedule by its name with `schedule run`, never a file it names.
|
|
991
|
+
mcp: false,
|
|
992
|
+
examples: [`${app.command} schedule exec ~/.local/share/${app.appName}/schedules/health/schedule.json`],
|
|
956
993
|
})
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
if (!existsSync(file))
|
|
963
|
-
throw new CliError("not_found", `no schedule ${name} — \`${lineOf(this, "schedule list")}\``)
|
|
964
|
-
const { schedule, timer } = await pauseSchedule(site, name, paused)
|
|
965
|
-
say({ name, paused, timer }, [
|
|
966
|
-
paused
|
|
967
|
-
? `Paused ${name}: no timer starts it; ${lineOf(this, `schedule run ${name}`)} still does.`
|
|
968
|
-
: `Resumed ${name}: ${describeWhen(schedule.when)}.`,
|
|
969
|
-
])
|
|
970
|
-
}
|
|
971
|
-
grantsAuthority(
|
|
972
|
-
annotate(command.command("pause"), {
|
|
973
|
-
effects: LOCAL_WRITE,
|
|
974
|
-
examples: [`${app.command} personal schedule pause health`],
|
|
975
|
-
}),
|
|
976
|
-
)
|
|
977
|
-
.description("take a schedule off its timer and keep it; run runs it, resume puts it back")
|
|
978
|
-
.argument("<name>", "the schedule's name, as `schedule list` shows it")
|
|
979
|
-
.action(setPaused(true))
|
|
980
|
-
grantsAuthority(
|
|
981
|
-
annotate(command.command("resume"), {
|
|
982
|
-
effects: LOCAL_WRITE,
|
|
983
|
-
examples: [`${app.command} personal schedule resume health`],
|
|
984
|
-
}),
|
|
985
|
-
)
|
|
986
|
-
.description("put a paused schedule back on its timer")
|
|
987
|
-
.argument("<name>", "the schedule's name, as `schedule list` shows it")
|
|
988
|
-
.action(setPaused(false))
|
|
989
|
-
|
|
990
|
-
annotate(command.command("exec"), {
|
|
991
|
-
effects: REMOTE_WRITE,
|
|
992
|
-
// An agent runs a saved schedule by its name with `schedule run`, never a file it names.
|
|
993
|
-
mcp: false,
|
|
994
|
-
examples: [`${app.command} schedule exec ~/.local/share/${app.appName}/schedules/health/schedule.json`],
|
|
995
|
-
})
|
|
996
|
-
.description("what a timer runs, given the schedule's file; to run one by hand, use run")
|
|
997
|
-
.argument("<file>", "the schedule's schedule.json in the state folder, as the timer passes it")
|
|
998
|
-
.argument("[seal]", "the file's SHA-256 as it was saved, which the timer passes; a file that differs does not run")
|
|
999
|
-
.action(async function (this: Command, file: string, seal: string | undefined) {
|
|
1000
|
-
// A timer starts it with no profile named; the schedule's own environment carries the profile.
|
|
1001
|
-
const { context, system, timer } = prepare(this, { needsProfile: false })
|
|
1002
|
-
const folder = realPathOf(schedulesDir(scheduleState({ app, env: context.env })))
|
|
1003
|
-
const real = realPathOf(file)
|
|
1004
|
-
if (real === folder || !inside(real, folder))
|
|
1005
|
-
throw new CliError("permission_error", `schedule exec runs only a schedule saved in ${folder}, not ${file}`, {
|
|
1006
|
-
reason: "schedule.outside-folder",
|
|
1007
|
-
})
|
|
1008
|
-
// A timer left behind by a pause that could not remove it must not run the schedule.
|
|
1009
|
-
if (existsSync(file) && readSchedule(file).paused) return
|
|
1010
|
-
const checked = guardSchedule(file, { app, env: context.env, platform: system.platform, agentRuns }, { seal })
|
|
1011
|
-
if ((await waits(this, file, { timed: true })) !== undefined) return
|
|
1012
|
-
const last = await untilChildEnds(this, (signal) =>
|
|
1013
|
-
runSchedule(app, system, context.env, file, {
|
|
1014
|
-
...(checked ? { schedule: checked } : {}),
|
|
1015
|
-
timer: timer(),
|
|
1016
|
-
agentRuns,
|
|
1017
|
-
ownerLanguage: ownerLanguageOf,
|
|
1018
|
-
reportTemplates: reportTemplatesOf,
|
|
1019
|
-
...(agentInput ? { agentInput } : {}),
|
|
1020
|
-
untilUnlocked: true,
|
|
1021
|
-
skipRepeatedInput: true,
|
|
1022
|
-
...(signal ? { signal } : {}),
|
|
1023
|
-
}),
|
|
994
|
+
.description("what a timer runs, given the schedule's file; to run one by hand, use run")
|
|
995
|
+
.argument("<file>", "the schedule's schedule.json in the state folder, as the timer passes it")
|
|
996
|
+
.argument(
|
|
997
|
+
"[seal]",
|
|
998
|
+
"the file's SHA-256 as it was saved, which the timer passes; a file that differs does not run",
|
|
1024
999
|
)
|
|
1025
|
-
|
|
1026
|
-
|
|
1000
|
+
.action(async function (this: Command, file: string, seal: string | undefined) {
|
|
1001
|
+
// A timer starts it with no profile named; the schedule's own environment carries the profile.
|
|
1002
|
+
const { context, system, timer } = prepare(this, { needsProfile: false })
|
|
1003
|
+
const folder = realPathOf(schedulesDir(scheduleState({ app, env: context.env })))
|
|
1004
|
+
const real = realPathOf(file)
|
|
1005
|
+
if (real === folder || !inside(real, folder))
|
|
1006
|
+
throw new CliError("permission_error", `schedule exec runs only a schedule saved in ${folder}, not ${file}`, {
|
|
1007
|
+
reason: "schedule.outside-folder",
|
|
1008
|
+
})
|
|
1009
|
+
// A timer left behind by a pause that could not remove it must not run the schedule.
|
|
1010
|
+
if (existsSync(file) && readSchedule(file).paused) return
|
|
1011
|
+
const checked = guardSchedule(file, { app, env: context.env, platform: system.platform, agentRuns }, { seal })
|
|
1012
|
+
if ((await waits(this, file, { timed: true })) !== undefined) return
|
|
1013
|
+
const last = await untilChildEnds(this, (signal) =>
|
|
1014
|
+
runSchedule(app, system, context.env, file, {
|
|
1015
|
+
...(checked ? { schedule: checked } : {}),
|
|
1016
|
+
timer: timer(),
|
|
1017
|
+
agentRuns,
|
|
1018
|
+
ownerLanguage: ownerLanguageOf,
|
|
1019
|
+
reportTemplates: reportTemplatesOf,
|
|
1020
|
+
...(agentInput ? { agentInput } : {}),
|
|
1021
|
+
untilUnlocked: true,
|
|
1022
|
+
skipRepeatedInput: true,
|
|
1023
|
+
...(signal ? { signal } : {}),
|
|
1024
|
+
}),
|
|
1025
|
+
)
|
|
1026
|
+
if (last.exitCode !== 0) setExitCode(this, 1)
|
|
1027
|
+
})
|
|
1027
1028
|
|
|
1028
|
-
|
|
1029
|
-
}
|
|
1029
|
+
return command
|
|
1030
|
+
},
|
|
1031
|
+
)
|