@rubytech/create-maxy-code 0.1.551 → 0.1.553
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/package.json +1 -1
- package/payload/platform/lib/routine-templates/dist/index.d.ts +15 -2
- package/payload/platform/lib/routine-templates/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/routine-templates/dist/index.js +25 -1
- package/payload/platform/lib/routine-templates/dist/index.js.map +1 -1
- package/payload/platform/lib/routine-templates/dist/roster.d.ts +76 -1
- package/payload/platform/lib/routine-templates/dist/roster.d.ts.map +1 -1
- package/payload/platform/lib/routine-templates/dist/roster.js +60 -3
- package/payload/platform/lib/routine-templates/dist/roster.js.map +1 -1
- package/payload/platform/lib/routine-templates/src/__tests__/roster.test.ts +93 -1
- package/payload/platform/lib/routine-templates/src/__tests__/seed.test.ts +74 -0
- package/payload/platform/lib/routine-templates/src/index.ts +25 -1
- package/payload/platform/lib/routine-templates/src/roster.ts +111 -2
- package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +11 -0
- package/payload/platform/plugins/scheduling/PLUGIN.md +54 -4
- package/payload/platform/plugins/scheduling/mcp/dist/index.js +113 -6
- package/payload/platform/plugins/scheduling/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/connector-freebusy.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/connector-freebusy.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/connector-freebusy.test.js +216 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/connector-freebusy.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/fires-per-day.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/fires-per-day.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/fires-per-day.test.js +44 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/fires-per-day.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/gate-audits.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/gate-audits.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/gate-audits.test.js +128 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/gate-audits.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/gate-classification.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/gate-classification.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/gate-classification.test.js +92 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/gate-classification.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/gate.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/gate.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/gate.test.js +135 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/gate.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/schedule-audit.test.js +210 -2
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/schedule-audit.test.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/update-summary.test.js +18 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/update-summary.test.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/connector-freebusy.d.ts +86 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/connector-freebusy.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/connector-freebusy.js +240 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/connector-freebusy.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/fires-per-day.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/fires-per-day.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/fires-per-day.js +47 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/fires-per-day.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/gate.d.ts +92 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/gate.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/gate.js +193 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/gate.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/routine-run.d.ts +8 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/routine-run.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/routine-run.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/schedule-audit.d.ts +152 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/schedule-audit.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/schedule-audit.js +472 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/schedule-audit.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/update-summary.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/update-summary.js +11 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/update-summary.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/gate-dispatch-wiring.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/gate-dispatch-wiring.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/gate-dispatch-wiring.test.js +146 -0
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/gate-dispatch-wiring.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.d.ts +27 -0
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js +18 -0
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js +146 -64
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-connector-busy-sync.test.js +84 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-connector-busy-sync.test.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-gate-waiver.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-gate-waiver.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-gate-waiver.test.js +200 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-gate-waiver.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-gate-write.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-gate-write.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-gate-write.test.js +238 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-gate-write.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-update-recurrence-record.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-update-recurrence-record.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-update-recurrence-record.test.js +208 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-update-recurrence-record.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/scheduling-gate.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/scheduling-gate.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/scheduling-gate.test.js +291 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/scheduling-gate.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-connector-busy-sync.d.ts +26 -2
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-connector-busy-sync.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-connector-busy-sync.js +51 -2
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-connector-busy-sync.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.d.ts +71 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.js +109 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-update.d.ts +3 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-update.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-update.js +124 -3
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-update.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/scheduling-gate.d.ts +148 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/scheduling-gate.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/scheduling-gate.js +410 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/scheduling-gate.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/package.json +1 -0
- package/payload/platform/plugins/workflows/skills/workflow-manager/SKILL.md +4 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +1 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-census.d.ts +51 -4
- package/payload/platform/services/claude-session-manager/dist/pty-census.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-census.js +60 -10
- package/payload/platform/services/claude-session-manager/dist/pty-census.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/slice-memory-policy.d.ts +64 -1
- package/payload/platform/services/claude-session-manager/dist/slice-memory-policy.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/slice-memory-policy.js +189 -6
- package/payload/platform/services/claude-session-manager/dist/slice-memory-policy.js.map +1 -1
- package/payload/server/public/activity.html +5 -5
- package/payload/server/public/agents.html +4 -4
- package/payload/server/public/assets/{AdminLoginScreens-Bjcs9ta9.js → AdminLoginScreens-Ca2QhL18.js} +1 -1
- package/payload/server/public/assets/AdminLoginScreens-Ca2QhL18.js.br +0 -0
- package/payload/server/public/assets/AdminLoginScreens-Ca2QhL18.js.gz +0 -0
- package/payload/server/public/assets/{AdminShell-DVBAMUCy.js → AdminShell-Dc5du5xX.js} +1 -1
- package/payload/server/public/assets/AdminShell-Dc5du5xX.js.br +0 -0
- package/payload/server/public/assets/AdminShell-Dc5du5xX.js.gz +0 -0
- package/payload/server/public/assets/{activity-C8E8-EwQ.js → activity-TSDKmIYb.js} +1 -1
- package/payload/server/public/assets/activity-TSDKmIYb.js.br +0 -0
- package/payload/server/public/assets/activity-TSDKmIYb.js.gz +0 -0
- package/payload/server/public/assets/{admin-CeWAlpRS.js → admin-Ba729Eyg.js} +1 -1
- package/payload/server/public/assets/admin-Ba729Eyg.js.br +0 -0
- package/payload/server/public/assets/admin-Ba729Eyg.js.gz +0 -0
- package/payload/server/public/assets/{agents-DuN92iFb.js → agents-9hlQHOS5.js} +1 -1
- package/payload/server/public/assets/agents-9hlQHOS5.js.br +0 -0
- package/payload/server/public/assets/agents-9hlQHOS5.js.gz +0 -0
- package/payload/server/public/assets/{browser-BxebdKbh.js → browser-BrqoCsqh.js} +1 -1
- package/payload/server/public/assets/browser-BrqoCsqh.js.br +0 -0
- package/payload/server/public/assets/browser-BrqoCsqh.js.gz +0 -0
- package/payload/server/public/assets/{calendar-BtFZQ5Np.js → calendar-DOObQ_m8.js} +1 -1
- package/payload/server/public/assets/calendar-DOObQ_m8.js.br +0 -0
- package/payload/server/public/assets/calendar-DOObQ_m8.js.gz +0 -0
- package/payload/server/public/assets/chat-Xaul2lLF.js +1 -0
- package/payload/server/public/assets/chat-Xaul2lLF.js.br +3 -0
- package/payload/server/public/assets/chat-Xaul2lLF.js.gz +0 -0
- package/payload/server/public/assets/chevron-left-BYH5vH4S.js +1 -0
- package/payload/server/public/assets/chevron-left-BYH5vH4S.js.br +0 -0
- package/payload/server/public/assets/chevron-right-XxQPHfNH.js +1 -0
- package/payload/server/public/assets/chevron-right-XxQPHfNH.js.br +0 -0
- package/payload/server/public/assets/clock-BNp2JTKh.js +1 -0
- package/payload/server/public/assets/clock-BNp2JTKh.js.br +0 -0
- package/payload/server/public/assets/clock-BNp2JTKh.js.gz +0 -0
- package/payload/server/public/assets/{copy-DCDHXq3O.js → copy-BkbgmpJo.js} +1 -1
- package/payload/server/public/assets/copy-BkbgmpJo.js.br +0 -0
- package/payload/server/public/assets/copy-BkbgmpJo.js.gz +0 -0
- package/payload/server/public/assets/data-yuHj8g0C.js +1 -0
- package/payload/server/public/assets/data-yuHj8g0C.js.br +3 -0
- package/payload/server/public/assets/data-yuHj8g0C.js.gz +0 -0
- package/payload/server/public/assets/{file-text-zQgEQWCF.js → file-text-DDCrqbWB.js} +1 -1
- package/payload/server/public/assets/file-text-DDCrqbWB.js.br +0 -0
- package/payload/server/public/assets/file-text-DDCrqbWB.js.gz +0 -0
- package/payload/server/public/assets/{graph-CFCEh_YI.js → graph-BKPdL5ph.js} +1 -1
- package/payload/server/public/assets/graph-BKPdL5ph.js.br +0 -0
- package/payload/server/public/assets/graph-BKPdL5ph.js.gz +0 -0
- package/payload/server/public/assets/{graph-labels-CA1UcDuS.js → graph-labels-B2PrHK6O.js} +1 -1
- package/payload/server/public/assets/graph-labels-B2PrHK6O.js.br +0 -0
- package/payload/server/public/assets/graph-labels-B2PrHK6O.js.gz +0 -0
- package/payload/server/public/assets/{operator-hFXPDc2X.js → operator-BVULmN09.js} +1 -1
- package/payload/server/public/assets/operator-BVULmN09.js.br +0 -0
- package/payload/server/public/assets/operator-BVULmN09.js.gz +0 -0
- package/payload/server/public/assets/{page-ne7I_r9L.js → page-BbzdSxuU.js} +1 -1
- package/payload/server/public/assets/page-BbzdSxuU.js.br +0 -0
- package/payload/server/public/assets/page-BbzdSxuU.js.gz +0 -0
- package/payload/server/public/assets/{page-C8jyPH_3.js → page-baQ9FQIg.js} +1 -1
- package/payload/server/public/assets/page-baQ9FQIg.js.br +0 -0
- package/payload/server/public/assets/page-baQ9FQIg.js.gz +0 -0
- package/payload/server/public/assets/play-3hlqzxLI.js +1 -0
- package/payload/server/public/assets/play-3hlqzxLI.js.br +0 -0
- package/payload/server/public/assets/play-3hlqzxLI.js.gz +0 -0
- package/payload/server/public/assets/{public-BgnqjAal.js → public-B_SEBxWy.js} +1 -1
- package/payload/server/public/assets/public-B_SEBxWy.js.br +0 -0
- package/payload/server/public/assets/public-B_SEBxWy.js.gz +0 -0
- package/payload/server/public/assets/{rotate-ccw-DfJWjXAg.js → rotate-ccw-DzXTXh3g.js} +1 -1
- package/payload/server/public/assets/rotate-ccw-DzXTXh3g.js.br +0 -0
- package/payload/server/public/assets/rotate-ccw-DzXTXh3g.js.gz +0 -0
- package/payload/server/public/assets/routines-BQzE0xzC.js +2 -0
- package/payload/server/public/assets/routines-BQzE0xzC.js.br +0 -0
- package/payload/server/public/assets/routines-BQzE0xzC.js.gz +0 -0
- package/payload/server/public/assets/{skills-D-6EbgfP.js → skills-yCZhYVIs.js} +1 -1
- package/payload/server/public/assets/skills-yCZhYVIs.js.br +0 -0
- package/payload/server/public/assets/skills-yCZhYVIs.js.gz +0 -0
- package/payload/server/public/assets/{tasks-DnN5Fyds.js → tasks-DxNFLsHv.js} +1 -1
- package/payload/server/public/assets/tasks-DxNFLsHv.js.br +0 -0
- package/payload/server/public/assets/tasks-DxNFLsHv.js.gz +0 -0
- package/payload/server/public/assets/{triangle-alert-eh9UOKDT.js → triangle-alert-CYwHTcvU.js} +1 -1
- package/payload/server/public/assets/triangle-alert-CYwHTcvU.js.br +0 -0
- package/payload/server/public/assets/triangle-alert-CYwHTcvU.js.gz +0 -0
- package/payload/server/public/assets/{useCopyFeedback-Bz9OJHBb.js → useCopyFeedback-BCRjKc-H.js} +1 -1
- package/payload/server/public/assets/useCopyFeedback-BCRjKc-H.js.br +0 -0
- package/payload/server/public/assets/useCopyFeedback-BCRjKc-H.js.gz +0 -0
- package/payload/server/public/assets/{useMediaQuery-CNxsjKZp.css → useMediaQuery-Vxpamxqq.css} +1 -1
- package/payload/server/public/assets/useMediaQuery-Vxpamxqq.css.br +0 -0
- package/payload/server/public/assets/{useMediaQuery-CNxsjKZp.css.gz → useMediaQuery-Vxpamxqq.css.gz} +0 -0
- package/payload/server/public/assets/{useVoiceRecorder-BaDpMYxX.js → useVoiceRecorder-BaAtMu9T.js} +1 -1
- package/payload/server/public/assets/useVoiceRecorder-BaAtMu9T.js.br +0 -0
- package/payload/server/public/assets/useVoiceRecorder-BaAtMu9T.js.gz +0 -0
- package/payload/server/public/assets/{wrench-BO-l46rF.js → wrench-iI-vx-g2.js} +1 -1
- package/payload/server/public/assets/wrench-iI-vx-g2.js.br +0 -0
- package/payload/server/public/assets/wrench-iI-vx-g2.js.gz +0 -0
- package/payload/server/public/browser.html +4 -4
- package/payload/server/public/calendar.html +8 -8
- package/payload/server/public/chat.html +13 -13
- package/payload/server/public/data.html +11 -11
- package/payload/server/public/graph.html +9 -9
- package/payload/server/public/index.html +14 -14
- package/payload/server/public/operator.html +14 -14
- package/payload/server/public/public.html +13 -13
- package/payload/server/public/routines.html +6 -6
- package/payload/server/public/skills.html +5 -5
- package/payload/server/public/tasks.html +6 -6
- package/payload/server/server.js +36 -5
- package/payload/server/public/assets/AdminLoginScreens-Bjcs9ta9.js.br +0 -0
- package/payload/server/public/assets/AdminLoginScreens-Bjcs9ta9.js.gz +0 -0
- package/payload/server/public/assets/AdminShell-DVBAMUCy.js.br +0 -0
- package/payload/server/public/assets/AdminShell-DVBAMUCy.js.gz +0 -0
- package/payload/server/public/assets/activity-C8E8-EwQ.js.br +0 -0
- package/payload/server/public/assets/activity-C8E8-EwQ.js.gz +0 -0
- package/payload/server/public/assets/admin-CeWAlpRS.js.br +0 -0
- package/payload/server/public/assets/admin-CeWAlpRS.js.gz +0 -0
- package/payload/server/public/assets/agents-DuN92iFb.js.br +0 -0
- package/payload/server/public/assets/agents-DuN92iFb.js.gz +0 -0
- package/payload/server/public/assets/browser-BxebdKbh.js.br +0 -0
- package/payload/server/public/assets/browser-BxebdKbh.js.gz +0 -0
- package/payload/server/public/assets/calendar-BtFZQ5Np.js.br +0 -0
- package/payload/server/public/assets/calendar-BtFZQ5Np.js.gz +0 -0
- package/payload/server/public/assets/chat-CGIwynaH.js +0 -1
- package/payload/server/public/assets/chat-CGIwynaH.js.br +0 -3
- package/payload/server/public/assets/chat-CGIwynaH.js.gz +0 -0
- package/payload/server/public/assets/chevron-left-DaNP1zDb.js +0 -1
- package/payload/server/public/assets/chevron-left-DaNP1zDb.js.br +0 -0
- package/payload/server/public/assets/chevron-right-BbbuTUnt.js +0 -1
- package/payload/server/public/assets/chevron-right-BbbuTUnt.js.br +0 -0
- package/payload/server/public/assets/clock-CfDdatjp.js +0 -1
- package/payload/server/public/assets/clock-CfDdatjp.js.br +0 -0
- package/payload/server/public/assets/clock-CfDdatjp.js.gz +0 -0
- package/payload/server/public/assets/copy-DCDHXq3O.js.br +0 -0
- package/payload/server/public/assets/copy-DCDHXq3O.js.gz +0 -0
- package/payload/server/public/assets/data-BchSWOju.js +0 -1
- package/payload/server/public/assets/data-BchSWOju.js.br +0 -1
- package/payload/server/public/assets/data-BchSWOju.js.gz +0 -0
- package/payload/server/public/assets/file-text-zQgEQWCF.js.br +0 -0
- package/payload/server/public/assets/file-text-zQgEQWCF.js.gz +0 -0
- package/payload/server/public/assets/graph-CFCEh_YI.js.br +0 -0
- package/payload/server/public/assets/graph-CFCEh_YI.js.gz +0 -0
- package/payload/server/public/assets/graph-labels-CA1UcDuS.js.br +0 -0
- package/payload/server/public/assets/graph-labels-CA1UcDuS.js.gz +0 -0
- package/payload/server/public/assets/operator-hFXPDc2X.js.br +0 -0
- package/payload/server/public/assets/operator-hFXPDc2X.js.gz +0 -0
- package/payload/server/public/assets/page-C8jyPH_3.js.br +0 -0
- package/payload/server/public/assets/page-C8jyPH_3.js.gz +0 -0
- package/payload/server/public/assets/page-ne7I_r9L.js.br +0 -0
- package/payload/server/public/assets/page-ne7I_r9L.js.gz +0 -0
- package/payload/server/public/assets/play-Ep0SZTbr.js +0 -1
- package/payload/server/public/assets/play-Ep0SZTbr.js.br +0 -0
- package/payload/server/public/assets/play-Ep0SZTbr.js.gz +0 -0
- package/payload/server/public/assets/public-BgnqjAal.js.br +0 -0
- package/payload/server/public/assets/public-BgnqjAal.js.gz +0 -0
- package/payload/server/public/assets/rotate-ccw-DfJWjXAg.js.br +0 -0
- package/payload/server/public/assets/rotate-ccw-DfJWjXAg.js.gz +0 -0
- package/payload/server/public/assets/routines-OGFXwTFO.js +0 -2
- package/payload/server/public/assets/routines-OGFXwTFO.js.br +0 -0
- package/payload/server/public/assets/routines-OGFXwTFO.js.gz +0 -0
- package/payload/server/public/assets/skills-D-6EbgfP.js.br +0 -0
- package/payload/server/public/assets/skills-D-6EbgfP.js.gz +0 -0
- package/payload/server/public/assets/tasks-DnN5Fyds.js.br +0 -0
- package/payload/server/public/assets/tasks-DnN5Fyds.js.gz +0 -0
- package/payload/server/public/assets/triangle-alert-eh9UOKDT.js.br +0 -0
- package/payload/server/public/assets/triangle-alert-eh9UOKDT.js.gz +0 -0
- package/payload/server/public/assets/useCopyFeedback-Bz9OJHBb.js.br +0 -0
- package/payload/server/public/assets/useCopyFeedback-Bz9OJHBb.js.gz +0 -0
- package/payload/server/public/assets/useMediaQuery-CNxsjKZp.css.br +0 -0
- package/payload/server/public/assets/useVoiceRecorder-BaDpMYxX.js.br +0 -0
- package/payload/server/public/assets/useVoiceRecorder-BaDpMYxX.js.gz +0 -0
- package/payload/server/public/assets/wrench-BO-l46rF.js.br +0 -0
- package/payload/server/public/assets/wrench-BO-l46rF.js.gz +0 -0
- /package/payload/server/public/assets/{useMediaQuery-_mMln3Fu.js → useMediaQuery-Baf4Huvv.js} +0 -0
- /package/payload/server/public/assets/{useMediaQuery-_mMln3Fu.js.br → useMediaQuery-Baf4Huvv.js.br} +0 -0
- /package/payload/server/public/assets/{useMediaQuery-_mMln3Fu.js.gz → useMediaQuery-Baf4Huvv.js.gz} +0 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type CalendarConnector } from "./connector-sync-provision.js";
|
|
2
|
+
export type ConnectorChoice = CalendarConnector | "none";
|
|
3
|
+
export interface ResolvedConnector {
|
|
4
|
+
connector: ConnectorChoice;
|
|
5
|
+
/** Named on the resolution log line when two connectors are authorised and one
|
|
6
|
+
* is unused. Null when there is nothing to skip. */
|
|
7
|
+
skipped: CalendarConnector | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The account's calendar connector, decided rather than chosen by a model.
|
|
11
|
+
*
|
|
12
|
+
* `detectCalendarConnectors` returns a sorted list, so google precedes m365 and
|
|
13
|
+
* the pick is deterministic. The stored `connector` is a single enum; an account
|
|
14
|
+
* holding both is real, and the skipped one is named on the resolution line so an
|
|
15
|
+
* ignored calendar is visible rather than silent.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveConnector(accountDir: string): ResolvedConnector;
|
|
18
|
+
/**
|
|
19
|
+
* The environment a provider MCP needs, assembled for the action rail.
|
|
20
|
+
*
|
|
21
|
+
* The heartbeat's cron line sets only `PLATFORM_ROOT`, `NEO4J_URI` and
|
|
22
|
+
* `MAXY_UI_INTERNAL_PORT` (create-maxy-code/src/cron-registration.ts), so a child
|
|
23
|
+
* spawned from it inherits none of the per-plugin credentials a session-manager
|
|
24
|
+
* spawn would stamp from the `PLUGIN.md` `mcp.env` block. They are read from
|
|
25
|
+
* `brand.json` instead, which is the same source those placeholders resolve from.
|
|
26
|
+
*
|
|
27
|
+
* A missing client id throws. Returning an env without one would let the provider
|
|
28
|
+
* boot, refuse the call for want of a vendor app, and be indistinguishable
|
|
29
|
+
* downstream from an account whose calendar is genuinely empty.
|
|
30
|
+
*/
|
|
31
|
+
export declare function providerEnv(platformRoot: string, accountId: string, connector: CalendarConnector): Record<string, string>;
|
|
32
|
+
export interface BusyInterval {
|
|
33
|
+
start: string;
|
|
34
|
+
end: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Calls one tool on one provider plugin and returns its parsed payload.
|
|
38
|
+
*
|
|
39
|
+
* Injected rather than imported so the read path is testable without spawning a
|
|
40
|
+
* child process; `spawnProviderCall` below is the real implementation.
|
|
41
|
+
*/
|
|
42
|
+
export type ProviderCall = (plugin: "google" | "outlook", tool: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
43
|
+
export interface ReadBusyOptions {
|
|
44
|
+
connector: CalendarConnector;
|
|
45
|
+
platformRoot: string;
|
|
46
|
+
accountId: string;
|
|
47
|
+
/** Window start, canonical UTC ISO. */
|
|
48
|
+
from: string;
|
|
49
|
+
/** Window end, canonical UTC ISO. */
|
|
50
|
+
to: string;
|
|
51
|
+
call: ProviderCall;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Graph returns `scheduleItems[].start.dateTime` with a sibling `timeZone` field
|
|
55
|
+
* that the outlook plugin's tool drops, so what arrives here carries no zone
|
|
56
|
+
* designator. The window is requested in UTC, so a zone-less instant is UTC and
|
|
57
|
+
* is stamped as such. A string already carrying `Z` or an offset is left alone —
|
|
58
|
+
* re-stamping it would move the interval.
|
|
59
|
+
*/
|
|
60
|
+
export declare function normaliseGraphInstant(dateTime: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* The account's busy intervals over the window, read from its own connector.
|
|
63
|
+
*
|
|
64
|
+
* Every failure throws. Returning `[]` on a failed read would clear the stored
|
|
65
|
+
* busy set and publish the operator's booked time as free, and a booking page
|
|
66
|
+
* serving its last successful write looks correct either way — so an empty list
|
|
67
|
+
* must only ever mean the calendar is genuinely free.
|
|
68
|
+
*/
|
|
69
|
+
export declare function readConnectorBusy(opts: ReadBusyOptions): Promise<BusyInterval[]>;
|
|
70
|
+
/**
|
|
71
|
+
* A `ProviderCall` that reaches the provider plugin's own MCP server.
|
|
72
|
+
*
|
|
73
|
+
* The transport is `callPluginTool`, the one Task 2378 extracted from
|
|
74
|
+
* `dispatchAction`. Sharing it rather than writing a second one is the point:
|
|
75
|
+
* this call is spawned from the same heartbeat, so it needs the same timeout,
|
|
76
|
+
* the same `ACCOUNT_ID` scoping, the same captured child stderr, and above all
|
|
77
|
+
* the same `PLATFORM_PORT` bridge — the cron line does not export that name and
|
|
78
|
+
* every plugin resolves its loopback base URL from it, so a transport without it
|
|
79
|
+
* throws on port resolution before the tool runs.
|
|
80
|
+
*
|
|
81
|
+
* It is a spawn rather than an import because no plugin in this tree imports
|
|
82
|
+
* another plugin's source, and because the provider owns the decryption of its
|
|
83
|
+
* own tokens.
|
|
84
|
+
*/
|
|
85
|
+
export declare function spawnProviderCall(platformRoot: string, accountId: string, connector: CalendarConnector): ProviderCall;
|
|
86
|
+
//# sourceMappingURL=connector-freebusy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-freebusy.d.ts","sourceRoot":"","sources":["../../src/lib/connector-freebusy.ts"],"names":[],"mappings":"AAiBA,OAAO,EAA4B,KAAK,iBAAiB,EAAE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C/B,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,iBAAiB,GAC3B,YAAY,CA4Bd"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task 2381 — reading the account's calendar free/busy without a model turn.
|
|
3
|
+
*
|
|
4
|
+
* The "Booking calendar connector sync" routine spawned a model every 30 minutes
|
|
5
|
+
* to do two mechanical things: work out which connector the account had
|
|
6
|
+
* authorised, and read 15 days of free/busy from it. Neither is a decision. This
|
|
7
|
+
* module does both deterministically so the routine can run on the headless
|
|
8
|
+
* `action` rail.
|
|
9
|
+
*
|
|
10
|
+
* The provider is reached by SPAWNING its own MCP server, not by importing it. No
|
|
11
|
+
* plugin in this tree imports another plugin's source (the only cross-boundary
|
|
12
|
+
* imports are built artifacts under `platform/lib`), the provider owns the
|
|
13
|
+
* decryption of its own tokens, and `dispatchAction` in `check-due-events.ts`
|
|
14
|
+
* already reaches plugins exactly this way.
|
|
15
|
+
*/
|
|
16
|
+
import { readFileSync } from "node:fs";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
import { detectCalendarConnectors } from "./connector-sync-provision.js";
|
|
19
|
+
import { callPluginTool } from "./gate.js";
|
|
20
|
+
/**
|
|
21
|
+
* The account's calendar connector, decided rather than chosen by a model.
|
|
22
|
+
*
|
|
23
|
+
* `detectCalendarConnectors` returns a sorted list, so google precedes m365 and
|
|
24
|
+
* the pick is deterministic. The stored `connector` is a single enum; an account
|
|
25
|
+
* holding both is real, and the skipped one is named on the resolution line so an
|
|
26
|
+
* ignored calendar is visible rather than silent.
|
|
27
|
+
*/
|
|
28
|
+
export function resolveConnector(accountDir) {
|
|
29
|
+
const found = detectCalendarConnectors(accountDir);
|
|
30
|
+
if (found.length === 0)
|
|
31
|
+
return { connector: "none", skipped: null };
|
|
32
|
+
return { connector: found[0], skipped: found[1] ?? null };
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The environment a provider MCP needs, assembled for the action rail.
|
|
36
|
+
*
|
|
37
|
+
* The heartbeat's cron line sets only `PLATFORM_ROOT`, `NEO4J_URI` and
|
|
38
|
+
* `MAXY_UI_INTERNAL_PORT` (create-maxy-code/src/cron-registration.ts), so a child
|
|
39
|
+
* spawned from it inherits none of the per-plugin credentials a session-manager
|
|
40
|
+
* spawn would stamp from the `PLUGIN.md` `mcp.env` block. They are read from
|
|
41
|
+
* `brand.json` instead, which is the same source those placeholders resolve from.
|
|
42
|
+
*
|
|
43
|
+
* A missing client id throws. Returning an env without one would let the provider
|
|
44
|
+
* boot, refuse the call for want of a vendor app, and be indistinguishable
|
|
45
|
+
* downstream from an account whose calendar is genuinely empty.
|
|
46
|
+
*/
|
|
47
|
+
export function providerEnv(platformRoot, accountId, connector) {
|
|
48
|
+
const brandPath = join(platformRoot, "config", "brand.json");
|
|
49
|
+
let brand;
|
|
50
|
+
try {
|
|
51
|
+
brand = JSON.parse(readFileSync(brandPath, "utf-8"));
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
throw new Error(`cannot read ${brandPath}: ${err.message}`);
|
|
55
|
+
}
|
|
56
|
+
const str = (v) => (typeof v === "string" ? v : "");
|
|
57
|
+
const env = { PLATFORM_ROOT: platformRoot, ACCOUNT_ID: accountId };
|
|
58
|
+
if (connector === "google") {
|
|
59
|
+
const id = str(brand.googleClientId);
|
|
60
|
+
const secret = str(brand.googleClientSecret);
|
|
61
|
+
if (!id || !secret) {
|
|
62
|
+
throw new Error("this brand ships no Google vendor app (client id and secret must both be present)");
|
|
63
|
+
}
|
|
64
|
+
env.GOOGLE_CLIENT_ID = id;
|
|
65
|
+
env.GOOGLE_CLIENT_SECRET = secret;
|
|
66
|
+
return env;
|
|
67
|
+
}
|
|
68
|
+
const id = str(brand.outlookClientId);
|
|
69
|
+
if (!id)
|
|
70
|
+
throw new Error("this brand ships no Outlook vendor app (outlookClientId is empty)");
|
|
71
|
+
env.OUTLOOK_CLIENT_ID = id;
|
|
72
|
+
env.OUTLOOK_TENANT_ID = str(brand.outlookTenantId) || "common";
|
|
73
|
+
return env;
|
|
74
|
+
}
|
|
75
|
+
function isInterval(v) {
|
|
76
|
+
const o = v;
|
|
77
|
+
return !!o && typeof o.start === "string" && typeof o.end === "string";
|
|
78
|
+
}
|
|
79
|
+
/** Google returns one busy list per requested calendar; with no `calendars`
|
|
80
|
+
* argument that is the account's primary calendar alone. Every list is
|
|
81
|
+
* flattened: the booking page blocks on any busy time, whichever calendar it
|
|
82
|
+
* came from. */
|
|
83
|
+
async function readGoogleBusy(opts) {
|
|
84
|
+
const raw = await opts.call("google", "google-calendar-freebusy", {
|
|
85
|
+
start: opts.from,
|
|
86
|
+
end: opts.to,
|
|
87
|
+
});
|
|
88
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
89
|
+
throw new Error(`unexpected google-calendar-freebusy payload: ${JSON.stringify(raw).slice(0, 200)}`);
|
|
90
|
+
}
|
|
91
|
+
const out = [];
|
|
92
|
+
for (const slots of Object.values(raw)) {
|
|
93
|
+
if (!Array.isArray(slots)) {
|
|
94
|
+
throw new Error("unexpected google-calendar-freebusy payload: calendar value is not an array");
|
|
95
|
+
}
|
|
96
|
+
for (const s of slots) {
|
|
97
|
+
if (!isInterval(s)) {
|
|
98
|
+
throw new Error("unexpected google-calendar-freebusy payload: busy entry has no start/end");
|
|
99
|
+
}
|
|
100
|
+
out.push({ start: s.start, end: s.end });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return out;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Graph returns `scheduleItems[].start.dateTime` with a sibling `timeZone` field
|
|
107
|
+
* that the outlook plugin's tool drops, so what arrives here carries no zone
|
|
108
|
+
* designator. The window is requested in UTC, so a zone-less instant is UTC and
|
|
109
|
+
* is stamped as such. A string already carrying `Z` or an offset is left alone —
|
|
110
|
+
* re-stamping it would move the interval.
|
|
111
|
+
*/
|
|
112
|
+
export function normaliseGraphInstant(dateTime) {
|
|
113
|
+
if (/(Z|[+-]\d{2}:?\d{2})$/.test(dateTime))
|
|
114
|
+
return dateTime;
|
|
115
|
+
return `${dateTime}Z`;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The one mailbox whose schedule this account's busy sync reads.
|
|
119
|
+
*
|
|
120
|
+
* The mailbox directory name under `secrets/outlook/mailboxes/` is a sanitised
|
|
121
|
+
* `graphUserId` and the address lives inside the encrypted token blob, so it
|
|
122
|
+
* cannot be read off disk by a process that is not the outlook plugin. Zero or
|
|
123
|
+
* two-or-more addressable mailboxes both throw, mirroring the outlook plugin's
|
|
124
|
+
* own sole-mailbox rule: guessing one would publish the wrong person's free time.
|
|
125
|
+
*/
|
|
126
|
+
async function resolveM365Address(opts) {
|
|
127
|
+
const raw = await opts.call("outlook", "outlook-mailbox-list", {});
|
|
128
|
+
const rows = raw?.mailboxes;
|
|
129
|
+
const addressable = (Array.isArray(rows) ? rows : [])
|
|
130
|
+
.filter((m) => m.status === "ok" && typeof m.mail === "string" && m.mail.length > 0)
|
|
131
|
+
.map((m) => m.mail);
|
|
132
|
+
if (addressable.length === 0) {
|
|
133
|
+
throw new Error("no addressable Outlook mailbox for this account; run outlook-account-register");
|
|
134
|
+
}
|
|
135
|
+
if (addressable.length > 1) {
|
|
136
|
+
throw new Error(`two or more Outlook mailboxes are addressable (${addressable.join(", ")}); the busy sync cannot choose between them`);
|
|
137
|
+
}
|
|
138
|
+
return addressable[0];
|
|
139
|
+
}
|
|
140
|
+
async function readM365Busy(opts) {
|
|
141
|
+
const address = await resolveM365Address(opts);
|
|
142
|
+
const raw = await opts.call("outlook", "outlook-calendar-freebusy", {
|
|
143
|
+
schedules: [address],
|
|
144
|
+
start: { dateTime: opts.from, timeZone: "UTC" },
|
|
145
|
+
end: { dateTime: opts.to, timeZone: "UTC" },
|
|
146
|
+
});
|
|
147
|
+
const availability = raw?.availability;
|
|
148
|
+
if (!Array.isArray(availability)) {
|
|
149
|
+
throw new Error(`unexpected outlook-calendar-freebusy payload: ${JSON.stringify(raw).slice(0, 200)}`);
|
|
150
|
+
}
|
|
151
|
+
const out = [];
|
|
152
|
+
let loggedRaw = false;
|
|
153
|
+
for (const entry of availability) {
|
|
154
|
+
// An address Graph could not resolve comes back with an error and an EMPTY
|
|
155
|
+
// busy list, which is byte-identical to a free calendar. Reading it as free
|
|
156
|
+
// would publish the operator's booked time as available.
|
|
157
|
+
if (entry.error) {
|
|
158
|
+
throw new Error(`Graph could not resolve the mailbox schedule: ${String(entry.error)}`);
|
|
159
|
+
}
|
|
160
|
+
for (const b of Array.isArray(entry.busy) ? entry.busy : []) {
|
|
161
|
+
if (!isInterval(b)) {
|
|
162
|
+
throw new Error("unexpected outlook-calendar-freebusy payload: busy entry has no start/end");
|
|
163
|
+
}
|
|
164
|
+
if (!loggedRaw) {
|
|
165
|
+
// One raw line per read. The UTC reading above is an assumption about a
|
|
166
|
+
// Graph response this tree holds no fixture for; the unparsed value makes
|
|
167
|
+
// a wrong assumption visible in the log rather than silently shifting
|
|
168
|
+
// every slot on the booking page by the account's offset.
|
|
169
|
+
console.error(`[connector-busy-sync] op=m365-raw-interval start=${JSON.stringify(b.start)} end=${JSON.stringify(b.end)}`);
|
|
170
|
+
loggedRaw = true;
|
|
171
|
+
}
|
|
172
|
+
out.push({ start: normaliseGraphInstant(b.start), end: normaliseGraphInstant(b.end) });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The account's busy intervals over the window, read from its own connector.
|
|
179
|
+
*
|
|
180
|
+
* Every failure throws. Returning `[]` on a failed read would clear the stored
|
|
181
|
+
* busy set and publish the operator's booked time as free, and a booking page
|
|
182
|
+
* serving its last successful write looks correct either way — so an empty list
|
|
183
|
+
* must only ever mean the calendar is genuinely free.
|
|
184
|
+
*/
|
|
185
|
+
export async function readConnectorBusy(opts) {
|
|
186
|
+
if (opts.connector === "google")
|
|
187
|
+
return readGoogleBusy(opts);
|
|
188
|
+
return readM365Busy(opts);
|
|
189
|
+
}
|
|
190
|
+
// ---------------------------------------------------------------------------
|
|
191
|
+
// The provider spawn
|
|
192
|
+
// ---------------------------------------------------------------------------
|
|
193
|
+
/**
|
|
194
|
+
* A `ProviderCall` that reaches the provider plugin's own MCP server.
|
|
195
|
+
*
|
|
196
|
+
* The transport is `callPluginTool`, the one Task 2378 extracted from
|
|
197
|
+
* `dispatchAction`. Sharing it rather than writing a second one is the point:
|
|
198
|
+
* this call is spawned from the same heartbeat, so it needs the same timeout,
|
|
199
|
+
* the same `ACCOUNT_ID` scoping, the same captured child stderr, and above all
|
|
200
|
+
* the same `PLATFORM_PORT` bridge — the cron line does not export that name and
|
|
201
|
+
* every plugin resolves its loopback base URL from it, so a transport without it
|
|
202
|
+
* throws on port resolution before the tool runs.
|
|
203
|
+
*
|
|
204
|
+
* It is a spawn rather than an import because no plugin in this tree imports
|
|
205
|
+
* another plugin's source, and because the provider owns the decryption of its
|
|
206
|
+
* own tokens.
|
|
207
|
+
*/
|
|
208
|
+
export function spawnProviderCall(platformRoot, accountId, connector) {
|
|
209
|
+
// Resolved once, outside the returned closure: a brand shipping no vendor app
|
|
210
|
+
// for this connector must fail before any child is spawned.
|
|
211
|
+
const credentials = providerEnv(platformRoot, accountId, connector);
|
|
212
|
+
return async (plugin, tool, args) => {
|
|
213
|
+
let call;
|
|
214
|
+
try {
|
|
215
|
+
call = await callPluginTool(plugin, tool, JSON.stringify(args), accountId, credentials);
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
// A transport failure carries the child's stderr, which is where a
|
|
219
|
+
// provider's own refusal reason (an expired refresh token, a missing
|
|
220
|
+
// vendor app) is written. Dropping it would leave `op=read-failed`
|
|
221
|
+
// reporting only that something went wrong.
|
|
222
|
+
const e = err;
|
|
223
|
+
const detail = e.childStderr ? `${e.message} — child stderr: ${e.childStderr.trim()}` : String(e.message);
|
|
224
|
+
throw new Error(`${tool} failed: ${detail}`);
|
|
225
|
+
}
|
|
226
|
+
const text = (Array.isArray(call.result.content) ? call.result.content : [])
|
|
227
|
+
.filter((c) => c.type === "text")
|
|
228
|
+
.map((c) => String(c.text))
|
|
229
|
+
.join("\n");
|
|
230
|
+
if (call.result.isError === true)
|
|
231
|
+
throw new Error(`${tool} returned an error: ${text}`);
|
|
232
|
+
try {
|
|
233
|
+
return JSON.parse(text);
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
throw new Error(`${tool} returned a non-JSON payload: ${text.slice(0, 200)}`);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=connector-freebusy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-freebusy.js","sourceRoot":"","sources":["../../src/lib/connector-freebusy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAA0B,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAAE,cAAc,EAAuB,MAAM,WAAW,CAAC;AAWhE;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAkB;IACjD,MAAM,KAAK,GAAG,wBAAwB,CAAC,UAAU,CAAC,CAAC;IACnD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACpE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;AAC5D,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CACzB,YAAoB,EACpB,SAAiB,EACjB,SAA4B;IAE5B,MAAM,SAAS,GAAG,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oot":"","sources":["../../src/lib/fires-per-day.ts"],"names":[],"mappings":"AAyBA,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,IAAI,GAAG,MAAM,CAwBhG"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import cronParser from "cron-parser";
|
|
2
|
+
const { parseExpression } = cronParser;
|
|
3
|
+
/**
|
|
4
|
+
* Task 2380 — how many times a cron fires on one calendar day, in the event's
|
|
5
|
+
* own timezone.
|
|
6
|
+
*
|
|
7
|
+
* The zone is not a detail. A rolling 24-hour window reports 24 for an hourly
|
|
8
|
+
* routine on every day of the year, including the two on which a British day is
|
|
9
|
+
* 23 or 25 hours long, so a cost figure built on it drifts twice a year and
|
|
10
|
+
* nothing says so. Here both day boundaries are themselves cron occurrences —
|
|
11
|
+
* `0 0 * * *` resolved in the same zone — so the window is the local day by
|
|
12
|
+
* construction and `cron-parser` does the clock-change arithmetic.
|
|
13
|
+
*
|
|
14
|
+
* `.prev()` is taken from one millisecond AFTER the reference so that a
|
|
15
|
+
* reference sitting exactly on local midnight yields that midnight rather than
|
|
16
|
+
* the previous day's.
|
|
17
|
+
*
|
|
18
|
+
* Throws when `recurrence` does not parse. Both callers catch: the tool reports
|
|
19
|
+
* `-` for the count, and the census names the row and drops it from the total.
|
|
20
|
+
*/
|
|
21
|
+
/** Runaway guard. A five-field cron tops out at 1,440 fires in a day. */
|
|
22
|
+
const MAX_OCCURRENCES = 100_000;
|
|
23
|
+
export function firesPerDay(recurrence, timezone, reference) {
|
|
24
|
+
const tz = timezone ?? undefined;
|
|
25
|
+
const start = parseExpression("0 0 * * *", {
|
|
26
|
+
currentDate: new Date(reference.getTime() + 1),
|
|
27
|
+
tz,
|
|
28
|
+
})
|
|
29
|
+
.prev()
|
|
30
|
+
.toDate();
|
|
31
|
+
const end = parseExpression("0 0 * * *", { currentDate: reference, tz }).next().toDate();
|
|
32
|
+
// One millisecond before the boundary, because `.next()` returns the first
|
|
33
|
+
// occurrence STRICTLY after `currentDate` and a routine firing at local
|
|
34
|
+
// midnight belongs to the day it opens.
|
|
35
|
+
const occurrences = parseExpression(recurrence, {
|
|
36
|
+
currentDate: new Date(start.getTime() - 1),
|
|
37
|
+
tz,
|
|
38
|
+
});
|
|
39
|
+
let count = 0;
|
|
40
|
+
for (let i = 0; i < MAX_OCCURRENCES; i++) {
|
|
41
|
+
if (occurrences.next().toDate() >= end)
|
|
42
|
+
break;
|
|
43
|
+
count++;
|
|
44
|
+
}
|
|
45
|
+
return count;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=fires-per-day.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fires-per-day.js","sourceRoot":"","sources":["../../src/lib/fires-per-day.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,MAAM,EAAE,eAAe,EAAE,GAAG,UAAU,CAAC;AAEvC;;;;;;;;;;;;;;;;;GAiBG;AAEH,yEAAyE;AACzE,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC,MAAM,UAAU,WAAW,CAAC,UAAkB,EAAE,QAAuB,EAAE,SAAe;IACtF,MAAM,EAAE,GAAG,QAAQ,IAAI,SAAS,CAAC;IACjC,MAAM,KAAK,GAAG,eAAe,CAAC,WAAW,EAAE;QACzC,WAAW,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC9C,EAAE;KACH,CAAC;SACC,IAAI,EAAE;SACN,MAAM,EAAE,CAAC;IACZ,MAAM,GAAG,GAAG,eAAe,CAAC,WAAW,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC;IAEzF,2EAA2E;IAC3E,wEAAwE;IACxE,wCAAwC;IACxC,MAAM,WAAW,GAAG,eAAe,CAAC,UAAU,EAAE;QAC9C,WAAW,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC1C,EAAE;KACH,CAAC,CAAC;IAEH,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,GAAG;YAAE,MAAM;QAC9C,KAAK,EAAE,CAAC;IACV,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { EventGate } from "../scripts/agent-turn-dispatch.js";
|
|
2
|
+
/**
|
|
3
|
+
* The 10-minute ceiling `dispatchAction` has always used. Re-exported here
|
|
4
|
+
* because `callPluginTool` now owns the timeout for both callers, so a gate and
|
|
5
|
+
* an action cannot drift apart on how long a plugin tool may run.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DISPATCH_TIMEOUT_MS = 600000;
|
|
8
|
+
/**
|
|
9
|
+
* A tool call's outcome, structurally typed rather than imported from the MCP
|
|
10
|
+
* SDK. The SDK ships dual ESM/CJS packages with conditional exports and the
|
|
11
|
+
* plugin workspaces pin their own copies, so importing its result type here
|
|
12
|
+
* would couple this module's compilation to the consumer's resolution mode —
|
|
13
|
+
* the same constraint `lib/mcp-eager/src/index.ts` records for `ZodRawShape`.
|
|
14
|
+
* Only three members are read anywhere in this plugin.
|
|
15
|
+
*/
|
|
16
|
+
export interface ToolCallResult {
|
|
17
|
+
isError?: boolean;
|
|
18
|
+
content?: unknown;
|
|
19
|
+
structuredContent?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
export interface PluginToolCall {
|
|
22
|
+
result: ToolCallResult;
|
|
23
|
+
/** Child stderr, capped at 4KB. Captured on every call, read on failure. */
|
|
24
|
+
childStderr: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A transport-level failure, distinct from a tool that ran and returned
|
|
28
|
+
* `isError`. `kind` separates the timeout from every other failure because the
|
|
29
|
+
* two are recorded differently: `dispatchAction` writes `timeout` rather than
|
|
30
|
+
* `error` to `lastDispatchResult`, and the gate's fail-open line names which of
|
|
31
|
+
* the two it was.
|
|
32
|
+
*/
|
|
33
|
+
export declare class PluginToolError extends Error {
|
|
34
|
+
readonly kind: "timeout" | "error";
|
|
35
|
+
readonly childStderr: string;
|
|
36
|
+
constructor(message: string, kind: "timeout" | "error", childStderr: string);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Spawn a plugin's MCP server over stdio, call one tool, close.
|
|
40
|
+
*
|
|
41
|
+
* Extracted from `dispatchAction` so the gate inherits the whole of its
|
|
42
|
+
* transport contract unchanged: the dispatch timeout, `ACCOUNT_ID` env scoping,
|
|
43
|
+
* and captured child stderr. Two callers sharing one body is the point — a gate
|
|
44
|
+
* that connected differently from an action would be a second transport to keep
|
|
45
|
+
* correct.
|
|
46
|
+
*
|
|
47
|
+
* Returns the raw result, including a result carrying `isError: true`. Deciding
|
|
48
|
+
* what an errored tool means belongs to the caller: an action treats it as a
|
|
49
|
+
* failed dispatch, a gate treats it as fail-open.
|
|
50
|
+
*/
|
|
51
|
+
export declare function callPluginTool(plugin: string, tool: string, args: string | null, accountId: string, extraEnv?: Record<string, string>): Promise<PluginToolCall>;
|
|
52
|
+
/**
|
|
53
|
+
* What the dispatcher does about this fire.
|
|
54
|
+
*
|
|
55
|
+
* `has-work` and every `fail-open` variant dispatch; only `no-work` skips. They
|
|
56
|
+
* are separate cases rather than one boolean because the log line differs and
|
|
57
|
+
* because a fail-open must never be readable as a gate that returned false —
|
|
58
|
+
* that confusion is exactly how a silently muted routine would be missed.
|
|
59
|
+
*/
|
|
60
|
+
export type GateVerdict = {
|
|
61
|
+
kind: "has-work";
|
|
62
|
+
} | {
|
|
63
|
+
kind: "no-work";
|
|
64
|
+
} | {
|
|
65
|
+
kind: "fail-open";
|
|
66
|
+
reason: "error" | "timeout" | "no-structured-result";
|
|
67
|
+
detail: string;
|
|
68
|
+
};
|
|
69
|
+
/** Injectable for tests; production passes `callPluginTool`. */
|
|
70
|
+
export type PluginToolCaller = (plugin: string, tool: string, args: string | null, accountId: string) => Promise<PluginToolCall>;
|
|
71
|
+
/**
|
|
72
|
+
* Evaluate one gate and say whether this fire reaches the model.
|
|
73
|
+
*
|
|
74
|
+
* Reads `structuredContent.hasWork` and nothing else. `content[]` is prose and
|
|
75
|
+
* is never consulted for control flow: parsing a third-party tool's wording to
|
|
76
|
+
* decide whether to spend a model turn is the failure mode the plugin doctrine
|
|
77
|
+
* names outright.
|
|
78
|
+
*
|
|
79
|
+
* Fails OPEN on every unreadable outcome — a throw, a timeout, an errored
|
|
80
|
+
* result, an absent `structuredContent`, a `hasWork` that is not a boolean.
|
|
81
|
+
* Failing closed would silently mute a routine and produce the Task 2313
|
|
82
|
+
* "looks live and delivers nothing" class with no alarm; failing open costs at
|
|
83
|
+
* worst the fires that were already happening before this task.
|
|
84
|
+
*
|
|
85
|
+
* Emits exactly one line, `op=evaluated` or `op=fail-open`, never both and never
|
|
86
|
+
* neither. `op=skipped` is the caller's, because only the caller knows the skip
|
|
87
|
+
* actually happened.
|
|
88
|
+
*
|
|
89
|
+
* Never throws — the sweep's contract. One broken gate must not abort the tick.
|
|
90
|
+
*/
|
|
91
|
+
export declare function evaluateGate(gate: EventGate, eventId: string, accountId: string, call?: PluginToolCaller): Promise<GateVerdict>;
|
|
92
|
+
//# sourceMappingURL=gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/lib/gate.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,SAAU,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IA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