@rubytech/create-maxy-code 0.1.557 → 0.1.559
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/plugins/admin/PLUGIN.md +2 -1
- package/payload/platform/plugins/admin/mcp/dist/content-producer-authoring-skills.d.ts +1 -1
- package/payload/platform/plugins/admin/mcp/dist/content-producer-authoring-skills.d.ts.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/content-producer-authoring-skills.js +7 -0
- package/payload/platform/plugins/admin/mcp/dist/content-producer-authoring-skills.js.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/index.js +20 -0
- package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/admin/mcp/dist/lib/roster-census.d.ts +14 -0
- package/payload/platform/plugins/admin/mcp/dist/lib/roster-census.d.ts.map +1 -0
- package/payload/platform/plugins/admin/mcp/dist/lib/roster-census.js +18 -0
- package/payload/platform/plugins/admin/mcp/dist/lib/roster-census.js.map +1 -0
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +43 -1
- package/payload/platform/plugins/admin/skills/video-production/SKILL.md +106 -0
- package/payload/platform/plugins/admin/skills/video-production/__tests__/registration.sh +54 -0
- package/payload/platform/plugins/admin/skills/video-production/references/reel-authoring.md +83 -0
- package/payload/platform/plugins/admin/skills/video-production/render.mjs +429 -0
- package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +17 -0
- package/payload/platform/plugins/docs/PLUGIN.md +1 -0
- package/payload/platform/plugins/docs/references/video-production.md +37 -0
- package/payload/platform/plugins/filesystem/mcp/dist/lib/result.d.ts +5 -1
- package/payload/platform/plugins/filesystem/mcp/dist/lib/result.d.ts.map +1 -1
- package/payload/platform/plugins/filesystem/mcp/dist/lib/result.js +4 -1
- package/payload/platform/plugins/filesystem/mcp/dist/lib/result.js.map +1 -1
- package/payload/platform/plugins/filesystem/mcp/dist/tools/file-read.d.ts.map +1 -1
- package/payload/platform/plugins/filesystem/mcp/dist/tools/file-read.js +2 -1
- package/payload/platform/plugins/filesystem/mcp/dist/tools/file-read.js.map +1 -1
- package/payload/platform/plugins/filesystem/mcp/dist/tools/file-write.d.ts.map +1 -1
- package/payload/platform/plugins/filesystem/mcp/dist/tools/file-write.js +2 -1
- package/payload/platform/plugins/filesystem/mcp/dist/tools/file-write.js.map +1 -1
- package/payload/platform/plugins/scheduling/PLUGIN.md +4 -2
- package/payload/platform/plugins/scheduling/mcp/dist/index.js +15 -3
- package/payload/platform/plugins/scheduling/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/schedule-audit.test.js +72 -0
- 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__/workflow-census.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/workflow-census.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/workflow-census.test.js +112 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/workflow-census.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/schedule-audit.d.ts +59 -6
- 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 +154 -18
- package/payload/platform/plugins/scheduling/mcp/dist/lib/schedule-audit.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js +17 -2
- 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-list-kind.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-list-kind.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-list-kind.test.js +25 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-list-kind.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-list.d.ts +15 -0
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-list.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-list.js +66 -46
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-list.js.map +1 -1
- package/payload/platform/plugins/storage-broker/mcp/dist/index.js +5 -2
- package/payload/platform/plugins/storage-broker/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/url-get/mcp/dist/index.js +13 -13
- package/payload/platform/plugins/url-get/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/workflows/PLUGIN.md +4 -1
- package/payload/platform/plugins/workflows/mcp/dist/__tests__/retry-delay.test.d.ts +2 -0
- package/payload/platform/plugins/workflows/mcp/dist/__tests__/retry-delay.test.d.ts.map +1 -0
- package/payload/platform/plugins/workflows/mcp/dist/__tests__/retry-delay.test.js +33 -0
- package/payload/platform/plugins/workflows/mcp/dist/__tests__/retry-delay.test.js.map +1 -0
- package/payload/platform/plugins/workflows/mcp/dist/index.js +1 -0
- package/payload/platform/plugins/workflows/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/lib/__tests__/step-resolver.test.d.ts +2 -0
- package/payload/platform/plugins/workflows/mcp/dist/lib/__tests__/step-resolver.test.d.ts.map +1 -0
- package/payload/platform/plugins/workflows/mcp/dist/lib/__tests__/step-resolver.test.js +42 -0
- package/payload/platform/plugins/workflows/mcp/dist/lib/__tests__/step-resolver.test.js.map +1 -0
- package/payload/platform/plugins/workflows/mcp/dist/lib/step-resolver.d.ts +23 -5
- package/payload/platform/plugins/workflows/mcp/dist/lib/step-resolver.d.ts.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/lib/step-resolver.js +20 -12
- package/payload/platform/plugins/workflows/mcp/dist/lib/step-resolver.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.d.ts +2 -0
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.d.ts.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.js +2 -0
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.d.ts +10 -0
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.d.ts.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.js +53 -7
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-update.d.ts.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-update.js +2 -0
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-update.js.map +1 -1
- package/payload/platform/scripts/__tests__/provision-honours-disabled-agents.test.sh +4 -3
- package/payload/platform/scripts/__tests__/provision-specialist-retirement.test.sh +115 -0
- package/payload/platform/scripts/lib/provision-account-dir.sh +88 -13
- package/payload/platform/scripts/logs-rotate.sh +6 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +48 -0
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-tee.d.ts +16 -0
- package/payload/platform/services/claude-session-manager/dist/pty-tee.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/pty-tee.js +84 -0
- package/payload/platform/services/claude-session-manager/dist/pty-tee.js.map +1 -0
- package/payload/platform/templates/specialists/agents/content-producer.md +8 -0
- package/payload/premium-plugins/writer-craft/agents/writer-craft--manuscript-reviewer.md +2 -0
- package/payload/server/public/activity.html +5 -5
- package/payload/server/public/agents.html +4 -4
- package/payload/server/public/assets/{AdminLoginScreens-DrF7rAcb.js → AdminLoginScreens-DLogIsJT.js} +1 -1
- package/payload/server/public/assets/AdminLoginScreens-DLogIsJT.js.br +0 -0
- package/payload/server/public/assets/AdminLoginScreens-DLogIsJT.js.gz +0 -0
- package/payload/server/public/assets/{AdminShell-BVKfxSgh.js → AdminShell-B67tPTyE.js} +1 -1
- package/payload/server/public/assets/AdminShell-B67tPTyE.js.br +0 -0
- package/payload/server/public/assets/AdminShell-B67tPTyE.js.gz +0 -0
- package/payload/server/public/assets/{activity-CBcvL5MZ.js → activity-AVJSFESV.js} +1 -1
- package/payload/server/public/assets/activity-AVJSFESV.js.br +0 -0
- package/payload/server/public/assets/activity-AVJSFESV.js.gz +0 -0
- package/payload/server/public/assets/{admin-CCB9k3GB.js → admin-eFgbld42.js} +1 -1
- package/payload/server/public/assets/admin-eFgbld42.js.br +0 -0
- package/payload/server/public/assets/admin-eFgbld42.js.gz +0 -0
- package/payload/server/public/assets/{agents-Dzx8Uxgz.js → agents-CoWLZMf7.js} +1 -1
- package/payload/server/public/assets/agents-CoWLZMf7.js.br +0 -0
- package/payload/server/public/assets/agents-CoWLZMf7.js.gz +0 -0
- package/payload/server/public/assets/{browser-B7EsGyVd.js → browser-C6K66_fw.js} +1 -1
- package/payload/server/public/assets/browser-C6K66_fw.js.br +0 -0
- package/payload/server/public/assets/browser-C6K66_fw.js.gz +0 -0
- package/payload/server/public/assets/{calendar-D4qD0upn.js → calendar-Dnw_cP4b.js} +1 -1
- package/payload/server/public/assets/calendar-Dnw_cP4b.js.br +0 -0
- package/payload/server/public/assets/calendar-Dnw_cP4b.js.gz +0 -0
- package/payload/server/public/assets/chat-Cm0fkpg1.js +1 -0
- package/payload/server/public/assets/chat-Cm0fkpg1.js.br +0 -0
- package/payload/server/public/assets/chat-Cm0fkpg1.js.gz +0 -0
- package/payload/server/public/assets/chevron-left-CjRH-BtF.js +1 -0
- package/payload/server/public/assets/chevron-left-CjRH-BtF.js.br +0 -0
- package/payload/server/public/assets/clock-wbYEt1kM.js +1 -0
- package/payload/server/public/assets/clock-wbYEt1kM.js.br +0 -0
- package/payload/server/public/assets/clock-wbYEt1kM.js.gz +0 -0
- package/payload/server/public/assets/{copy-CG2tAK16.js → copy-kuNM0Etw.js} +1 -1
- package/payload/server/public/assets/copy-kuNM0Etw.js.br +0 -0
- package/payload/server/public/assets/copy-kuNM0Etw.js.gz +0 -0
- package/payload/server/public/assets/data-c47T2NCd.js +1 -0
- package/payload/server/public/assets/data-c47T2NCd.js.br +1 -0
- package/payload/server/public/assets/data-c47T2NCd.js.gz +0 -0
- package/payload/server/public/assets/{file-text-47cIljhV.js → file-text-BWkobrcx.js} +1 -1
- package/payload/server/public/assets/file-text-BWkobrcx.js.br +0 -0
- package/payload/server/public/assets/file-text-BWkobrcx.js.gz +0 -0
- package/payload/server/public/assets/{graph-CDbi-eqF.js → graph-BGjTL5Vz.js} +1 -1
- package/payload/server/public/assets/graph-BGjTL5Vz.js.br +0 -0
- package/payload/server/public/assets/graph-BGjTL5Vz.js.gz +0 -0
- package/payload/server/public/assets/{graph-labels-Byp2RkVg.js → graph-labels-Dvc5Kw_r.js} +1 -1
- package/payload/server/public/assets/graph-labels-Dvc5Kw_r.js.br +0 -0
- package/payload/server/public/assets/graph-labels-Dvc5Kw_r.js.gz +0 -0
- package/payload/server/public/assets/{operator-B0oOVB8R.js → operator-CzBGv_he.js} +1 -1
- package/payload/server/public/assets/operator-CzBGv_he.js.br +0 -0
- package/payload/server/public/assets/operator-CzBGv_he.js.gz +0 -0
- package/payload/server/public/assets/{page-Dfce3YQd.js → page-BIY4Ku8Q.js} +1 -1
- package/payload/server/public/assets/page-BIY4Ku8Q.js.br +0 -0
- package/payload/server/public/assets/page-BIY4Ku8Q.js.gz +0 -0
- package/payload/server/public/assets/{page-DrbfHSQ9.js → page-DaySqamH.js} +1 -1
- package/payload/server/public/assets/page-DaySqamH.js.br +0 -0
- package/payload/server/public/assets/page-DaySqamH.js.gz +0 -0
- package/payload/server/public/assets/play-C8RA52_i.js +1 -0
- package/payload/server/public/assets/play-C8RA52_i.js.br +0 -0
- package/payload/server/public/assets/play-C8RA52_i.js.gz +0 -0
- package/payload/server/public/assets/{public-DJwMfl-4.js → public-pwDSvhBv.js} +1 -1
- package/payload/server/public/assets/public-pwDSvhBv.js.br +0 -0
- package/payload/server/public/assets/public-pwDSvhBv.js.gz +0 -0
- package/payload/server/public/assets/{rotate-ccw-Dbj7NrEB.js → rotate-ccw-B6s7tkEt.js} +1 -1
- package/payload/server/public/assets/rotate-ccw-B6s7tkEt.js.br +0 -0
- package/payload/server/public/assets/rotate-ccw-B6s7tkEt.js.gz +0 -0
- package/payload/server/public/assets/routines-CFlyRdYg.js +2 -0
- package/payload/server/public/assets/routines-CFlyRdYg.js.br +0 -0
- package/payload/server/public/assets/routines-CFlyRdYg.js.gz +0 -0
- package/payload/server/public/assets/{skills-EtKyNK_3.js → skills-C45kfL_Q.js} +1 -1
- package/payload/server/public/assets/skills-C45kfL_Q.js.br +0 -0
- package/payload/server/public/assets/skills-C45kfL_Q.js.gz +0 -0
- package/payload/server/public/assets/{tasks-U0poqfi9.js → tasks-BwoCTCu5.js} +1 -1
- package/payload/server/public/assets/tasks-BwoCTCu5.js.br +0 -0
- package/payload/server/public/assets/tasks-BwoCTCu5.js.gz +0 -0
- package/payload/server/public/assets/{triangle-alert-D7zwttJW.js → triangle-alert-B3bthSzx.js} +1 -1
- package/payload/server/public/assets/triangle-alert-B3bthSzx.js.br +0 -0
- package/payload/server/public/assets/triangle-alert-B3bthSzx.js.gz +0 -0
- package/payload/server/public/assets/{useCopyFeedback-Ae_va0Ps.js → useCopyFeedback-BzJAkFEb.js} +1 -1
- package/payload/server/public/assets/useCopyFeedback-BzJAkFEb.js.br +0 -0
- package/payload/server/public/assets/useCopyFeedback-BzJAkFEb.js.gz +0 -0
- package/payload/server/public/assets/{useMediaQuery-HRgPNA8l.css → useMediaQuery-DW_xRrMl.css} +1 -1
- package/payload/server/public/assets/useMediaQuery-DW_xRrMl.css.br +0 -0
- package/payload/server/public/assets/{useMediaQuery-HRgPNA8l.css.gz → useMediaQuery-DW_xRrMl.css.gz} +0 -0
- package/payload/server/public/assets/useVoiceRecorder-_qI_BAOo.js +2 -0
- package/payload/server/public/assets/useVoiceRecorder-_qI_BAOo.js.br +0 -0
- package/payload/server/public/assets/useVoiceRecorder-_qI_BAOo.js.gz +0 -0
- package/payload/server/public/assets/{wrench-BmXV4Tmh.js → wrench-Bqux9jaw.js} +1 -1
- package/payload/server/public/assets/wrench-Bqux9jaw.js.br +0 -0
- package/payload/server/public/assets/wrench-Bqux9jaw.js.gz +0 -0
- package/payload/server/public/browser.html +4 -4
- package/payload/server/public/calendar.html +7 -7
- 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 +13 -13
- package/payload/server/public/operator.html +14 -14
- package/payload/server/public/public.html +13 -13
- package/payload/server/public/routines.html +7 -7
- package/payload/server/public/skills.html +5 -5
- package/payload/server/public/tasks.html +6 -6
- package/payload/server/server.js +262 -85
- package/payload/server/public/assets/AdminLoginScreens-DrF7rAcb.js.br +0 -0
- package/payload/server/public/assets/AdminLoginScreens-DrF7rAcb.js.gz +0 -0
- package/payload/server/public/assets/AdminShell-BVKfxSgh.js.br +0 -0
- package/payload/server/public/assets/AdminShell-BVKfxSgh.js.gz +0 -0
- package/payload/server/public/assets/activity-CBcvL5MZ.js.br +0 -0
- package/payload/server/public/assets/activity-CBcvL5MZ.js.gz +0 -0
- package/payload/server/public/assets/admin-CCB9k3GB.js.br +0 -0
- package/payload/server/public/assets/admin-CCB9k3GB.js.gz +0 -0
- package/payload/server/public/assets/agents-Dzx8Uxgz.js.br +0 -0
- package/payload/server/public/assets/agents-Dzx8Uxgz.js.gz +0 -0
- package/payload/server/public/assets/browser-B7EsGyVd.js.br +0 -0
- package/payload/server/public/assets/browser-B7EsGyVd.js.gz +0 -0
- package/payload/server/public/assets/calendar-D4qD0upn.js.br +0 -0
- package/payload/server/public/assets/calendar-D4qD0upn.js.gz +0 -0
- package/payload/server/public/assets/chat-BgOUm7r1.js +0 -1
- package/payload/server/public/assets/chat-BgOUm7r1.js.br +0 -0
- package/payload/server/public/assets/chat-BgOUm7r1.js.gz +0 -0
- package/payload/server/public/assets/chevron-left-CGsW9Vsp.js +0 -1
- package/payload/server/public/assets/chevron-left-CGsW9Vsp.js.br +0 -0
- package/payload/server/public/assets/clock-B_xWWLQW.js +0 -1
- package/payload/server/public/assets/clock-B_xWWLQW.js.br +0 -0
- package/payload/server/public/assets/clock-B_xWWLQW.js.gz +0 -0
- package/payload/server/public/assets/copy-CG2tAK16.js.br +0 -0
- package/payload/server/public/assets/copy-CG2tAK16.js.gz +0 -0
- package/payload/server/public/assets/data-YEC6LkxI.js +0 -1
- package/payload/server/public/assets/data-YEC6LkxI.js.br +0 -0
- package/payload/server/public/assets/data-YEC6LkxI.js.gz +0 -0
- package/payload/server/public/assets/file-text-47cIljhV.js.br +0 -0
- package/payload/server/public/assets/file-text-47cIljhV.js.gz +0 -0
- package/payload/server/public/assets/graph-CDbi-eqF.js.br +0 -0
- package/payload/server/public/assets/graph-CDbi-eqF.js.gz +0 -0
- package/payload/server/public/assets/graph-labels-Byp2RkVg.js.br +0 -0
- package/payload/server/public/assets/graph-labels-Byp2RkVg.js.gz +0 -0
- package/payload/server/public/assets/operator-B0oOVB8R.js.br +0 -0
- package/payload/server/public/assets/operator-B0oOVB8R.js.gz +0 -0
- package/payload/server/public/assets/page-Dfce3YQd.js.br +0 -0
- package/payload/server/public/assets/page-Dfce3YQd.js.gz +0 -0
- package/payload/server/public/assets/page-DrbfHSQ9.js.br +0 -0
- package/payload/server/public/assets/page-DrbfHSQ9.js.gz +0 -0
- package/payload/server/public/assets/play-Bankj0zU.js +0 -1
- package/payload/server/public/assets/play-Bankj0zU.js.br +0 -0
- package/payload/server/public/assets/play-Bankj0zU.js.gz +0 -0
- package/payload/server/public/assets/public-DJwMfl-4.js.br +0 -0
- package/payload/server/public/assets/public-DJwMfl-4.js.gz +0 -0
- package/payload/server/public/assets/rotate-ccw-Dbj7NrEB.js.br +0 -0
- package/payload/server/public/assets/rotate-ccw-Dbj7NrEB.js.gz +0 -0
- package/payload/server/public/assets/routines-CdqGJwyD.js +0 -2
- package/payload/server/public/assets/routines-CdqGJwyD.js.br +0 -0
- package/payload/server/public/assets/routines-CdqGJwyD.js.gz +0 -0
- package/payload/server/public/assets/skills-EtKyNK_3.js.br +0 -0
- package/payload/server/public/assets/skills-EtKyNK_3.js.gz +0 -0
- package/payload/server/public/assets/tasks-U0poqfi9.js.br +0 -0
- package/payload/server/public/assets/tasks-U0poqfi9.js.gz +0 -0
- package/payload/server/public/assets/triangle-alert-D7zwttJW.js.br +0 -0
- package/payload/server/public/assets/triangle-alert-D7zwttJW.js.gz +0 -0
- package/payload/server/public/assets/useCopyFeedback-Ae_va0Ps.js.br +0 -4
- package/payload/server/public/assets/useCopyFeedback-Ae_va0Ps.js.gz +0 -0
- package/payload/server/public/assets/useMediaQuery-HRgPNA8l.css.br +0 -0
- package/payload/server/public/assets/useVoiceRecorder-9qVOHhkb.js +0 -2
- package/payload/server/public/assets/useVoiceRecorder-9qVOHhkb.js.br +0 -0
- package/payload/server/public/assets/useVoiceRecorder-9qVOHhkb.js.gz +0 -0
- package/payload/server/public/assets/wrench-BmXV4Tmh.js.br +0 -0
- package/payload/server/public/assets/wrench-BmXV4Tmh.js.gz +0 -0
- /package/payload/server/public/assets/{useMediaQuery-DIm6yGOl.js → useMediaQuery-DJ6XeNN7.js} +0 -0
- /package/payload/server/public/assets/{useMediaQuery-DIm6yGOl.js.br → useMediaQuery-DJ6XeNN7.js.br} +0 -0
- /package/payload/server/public/assets/{useMediaQuery-DIm6yGOl.js.gz → useMediaQuery-DJ6XeNN7.js.gz} +0 -0
package/payload/server/server.js
CHANGED
|
@@ -1839,7 +1839,7 @@ var require_dist6 = __commonJS({
|
|
|
1839
1839
|
import { readFileSync as readFileSync48, existsSync as existsSync52, watchFile, readdirSync as readdirSync30, statSync as statSync28 } from "fs";
|
|
1840
1840
|
import { spawn as spawn3 } from "child_process";
|
|
1841
1841
|
import { createHash as createHash7 } from "crypto";
|
|
1842
|
-
import { resolve as resolve45, join as join57, basename as
|
|
1842
|
+
import { resolve as resolve45, join as join57, basename as basename17 } from "path";
|
|
1843
1843
|
import { homedir as homedir4 } from "os";
|
|
1844
1844
|
|
|
1845
1845
|
// server/lib/route-cache-watchers.ts
|
|
@@ -2954,6 +2954,27 @@ function alignToRow(path, rawFrom, fileEnd) {
|
|
|
2954
2954
|
if (nl === -1) return { from: rawFrom, aligned: false };
|
|
2955
2955
|
return { from: rawFrom + nl + 1, aligned: true };
|
|
2956
2956
|
}
|
|
2957
|
+
function backfillRangeStart(path, to, budget = TAIL_WINDOW_BYTES) {
|
|
2958
|
+
const rawFrom = Math.max(0, to - budget);
|
|
2959
|
+
if (rawFrom <= 0) return { from: 0, aligned: true };
|
|
2960
|
+
const span = Math.min(rawFrom, ALIGN_SCAN_MAX_BYTES);
|
|
2961
|
+
const start = rawFrom - span;
|
|
2962
|
+
let buf;
|
|
2963
|
+
try {
|
|
2964
|
+
buf = Buffer.alloc(span);
|
|
2965
|
+
const fd = openSync(path, "r");
|
|
2966
|
+
try {
|
|
2967
|
+
readSync(fd, buf, 0, span, start);
|
|
2968
|
+
} finally {
|
|
2969
|
+
closeSync(fd);
|
|
2970
|
+
}
|
|
2971
|
+
} catch {
|
|
2972
|
+
return { from: rawFrom, aligned: false };
|
|
2973
|
+
}
|
|
2974
|
+
const nl = buf.lastIndexOf(10);
|
|
2975
|
+
if (nl === -1) return start === 0 ? { from: 0, aligned: true } : { from: rawFrom, aligned: false };
|
|
2976
|
+
return { from: start + nl + 1, aligned: true };
|
|
2977
|
+
}
|
|
2957
2978
|
|
|
2958
2979
|
// server/lib/turn-ctx-seed.ts
|
|
2959
2980
|
import { openSync as openSync2, readSync as readSync2, closeSync as closeSync2 } from "fs";
|
|
@@ -3008,12 +3029,12 @@ function addBounded(set, id) {
|
|
|
3008
3029
|
}
|
|
3009
3030
|
set.add(id);
|
|
3010
3031
|
}
|
|
3011
|
-
function noteWindowedOpen(
|
|
3032
|
+
function noteWindowedOpen(transcriptId, windowed) {
|
|
3012
3033
|
if (!windowed) return;
|
|
3013
|
-
addBounded(windowedOpens,
|
|
3034
|
+
addBounded(windowedOpens, transcriptId);
|
|
3014
3035
|
}
|
|
3015
|
-
function noteBackfill(
|
|
3016
|
-
addBounded(sawBackfill,
|
|
3036
|
+
function noteBackfill(transcriptId) {
|
|
3037
|
+
addBounded(sawBackfill, transcriptId);
|
|
3017
3038
|
}
|
|
3018
3039
|
function censusSnapshot() {
|
|
3019
3040
|
let withBackfill = 0;
|
|
@@ -3041,6 +3062,14 @@ function fixtureBody() {
|
|
|
3041
3062
|
message: { role: "assistant", content: [{ type: "text", text: `audit-${i}-${"x".repeat(400)}` }] }
|
|
3042
3063
|
})
|
|
3043
3064
|
);
|
|
3065
|
+
if (i === Math.floor(FIXTURE_ROWS / 2)) {
|
|
3066
|
+
rows.push(
|
|
3067
|
+
JSON.stringify({
|
|
3068
|
+
type: "assistant",
|
|
3069
|
+
message: { role: "assistant", content: [{ type: "text", text: `audit-fat-${"F".repeat(FIXTURE_BUDGET * 2)}` }] }
|
|
3070
|
+
})
|
|
3071
|
+
);
|
|
3072
|
+
}
|
|
3044
3073
|
}
|
|
3045
3074
|
return rows.join("\n") + "\n";
|
|
3046
3075
|
}
|
|
@@ -3063,14 +3092,17 @@ function runReaderWindowAudit() {
|
|
|
3063
3092
|
const older = [];
|
|
3064
3093
|
let before = windowFrom;
|
|
3065
3094
|
let guard = 0;
|
|
3095
|
+
let walkTerminated = true;
|
|
3066
3096
|
while (before > 0) {
|
|
3067
|
-
const
|
|
3068
|
-
const { from } = alignToRow(path, rawFrom, before);
|
|
3097
|
+
const { from } = backfillRangeStart(path, before, FIXTURE_BUDGET);
|
|
3069
3098
|
const ctx = {};
|
|
3070
3099
|
if (from > 0) seedTurnCtx(path, from, ctx);
|
|
3071
3100
|
older.unshift(...parseTranscript(readRange(path, from, before).toString("utf8").split("\n"), /* @__PURE__ */ new Map(), ctx));
|
|
3072
3101
|
before = from;
|
|
3073
|
-
if (++guard > 1e3)
|
|
3102
|
+
if (++guard > 1e3) {
|
|
3103
|
+
walkTerminated = false;
|
|
3104
|
+
break;
|
|
3105
|
+
}
|
|
3074
3106
|
}
|
|
3075
3107
|
const assembled = older.concat(windowTurns);
|
|
3076
3108
|
const assembledKeys = assembled.map(key);
|
|
@@ -3080,7 +3112,7 @@ function runReaderWindowAudit() {
|
|
|
3080
3112
|
const gaps = fullKeys.filter((k) => !assembledSet.has(k)).length;
|
|
3081
3113
|
const ordered = assembledKeys.length === fullKeys.length && assembledKeys.every((k, i) => k === fullKeys[i]);
|
|
3082
3114
|
console.log(
|
|
3083
|
-
`${TAG3} op=window-continuity fixture=synthetic full=${full.length} assembled=${assembled.length} duplicates=${duplicates} gaps=${gaps} ordered=${ordered}`
|
|
3115
|
+
`${TAG3} op=window-continuity fixture=synthetic full=${full.length} assembled=${assembled.length} duplicates=${duplicates} gaps=${gaps} ordered=${ordered} walkTerminated=${walkTerminated}`
|
|
3084
3116
|
);
|
|
3085
3117
|
const windowRef = parseTranscript(readRange(path, windowFrom, fileEnd).toString("utf8").split("\n"));
|
|
3086
3118
|
const mismatched = windowTurns.reduce(
|
|
@@ -3090,8 +3122,8 @@ function runReaderWindowAudit() {
|
|
|
3090
3122
|
console.log(
|
|
3091
3123
|
`${TAG3} op=window-kinds fixture=synthetic windowTurns=${windowTurns.length} mismatched=${mismatched}`
|
|
3092
3124
|
);
|
|
3093
|
-
const ok2 = duplicates === 0 && gaps === 0 && ordered && mismatched === 0;
|
|
3094
|
-
return `continuity=${ok2 ? "ok" : "FAILED"} full=${full.length} assembled=${assembled.length} reach=${census.withBackfill}/${census.windowed}`;
|
|
3125
|
+
const ok2 = duplicates === 0 && gaps === 0 && ordered && walkTerminated && mismatched === 0;
|
|
3126
|
+
return `continuity=${ok2 ? "ok" : "FAILED"} full=${full.length} assembled=${assembled.length} walk=${walkTerminated ? "ok" : "STUCK"} reach=${census.withBackfill}/${census.windowed}`;
|
|
3095
3127
|
} catch (err) {
|
|
3096
3128
|
const reason = err instanceof Error ? err.message : String(err);
|
|
3097
3129
|
console.error(`${TAG3} op=audit-failed reason=${reason.slice(0, 120)}`);
|
|
@@ -4581,11 +4613,11 @@ function findExistingJsonlForSessionId(claudeConfigDir2, sessionId) {
|
|
|
4581
4613
|
} catch {
|
|
4582
4614
|
return null;
|
|
4583
4615
|
}
|
|
4584
|
-
const
|
|
4616
|
+
const basename18 = `${sessionId}.jsonl`;
|
|
4585
4617
|
for (const slug of slugs) {
|
|
4586
|
-
const live = join8(projectsRoot, slug,
|
|
4618
|
+
const live = join8(projectsRoot, slug, basename18);
|
|
4587
4619
|
if (existsSync3(live)) return live;
|
|
4588
|
-
const archived = join8(projectsRoot, slug, "archive",
|
|
4620
|
+
const archived = join8(projectsRoot, slug, "archive", basename18);
|
|
4589
4621
|
if (existsSync3(archived)) return archived;
|
|
4590
4622
|
}
|
|
4591
4623
|
return null;
|
|
@@ -4783,6 +4815,7 @@ async function resolveOperatorNamesBySender(users, admins, senderIds) {
|
|
|
4783
4815
|
|
|
4784
4816
|
// server/routes/admin/sidebar-sessions.ts
|
|
4785
4817
|
var SESSION_ID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.jsonl$/i;
|
|
4818
|
+
var SIDECAR_META_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.meta\.json$/i;
|
|
4786
4819
|
function lastAssistantModel(body) {
|
|
4787
4820
|
const lines = body.split("\n");
|
|
4788
4821
|
for (let i = lines.length - 1; i >= 0; i--) {
|
|
@@ -4835,7 +4868,7 @@ function findSessionProjectDir(sessionId) {
|
|
|
4835
4868
|
const jsonlPath = findExistingJsonlForSessionId(cfg, sessionId);
|
|
4836
4869
|
return jsonlPath ? dirname(jsonlPath) : null;
|
|
4837
4870
|
}
|
|
4838
|
-
function enumerateJsonlsWithSkips(projectsRoot) {
|
|
4871
|
+
function enumerateJsonlsWithSkips(projectsRoot, fileRe = SESSION_ID_RE) {
|
|
4839
4872
|
const out = [];
|
|
4840
4873
|
let skipped = 0;
|
|
4841
4874
|
let slugs;
|
|
@@ -4857,7 +4890,7 @@ function enumerateJsonlsWithSkips(projectsRoot) {
|
|
|
4857
4890
|
continue;
|
|
4858
4891
|
}
|
|
4859
4892
|
for (const entry of entries2) {
|
|
4860
|
-
if (entry.isFile() &&
|
|
4893
|
+
if (entry.isFile() && fileRe.test(entry.name)) {
|
|
4861
4894
|
out.push({ path: join10(slugDir, entry.name), isSubagent: false, archived: false });
|
|
4862
4895
|
} else if (entry.isDirectory() && entry.name === "subagents") {
|
|
4863
4896
|
const subDir = join10(slugDir, entry.name);
|
|
@@ -4871,7 +4904,7 @@ function enumerateJsonlsWithSkips(projectsRoot) {
|
|
|
4871
4904
|
continue;
|
|
4872
4905
|
}
|
|
4873
4906
|
for (const sub of subEntries) {
|
|
4874
|
-
if (sub.isFile() &&
|
|
4907
|
+
if (sub.isFile() && fileRe.test(sub.name)) {
|
|
4875
4908
|
out.push({ path: join10(subDir, sub.name), isSubagent: true, archived: false });
|
|
4876
4909
|
}
|
|
4877
4910
|
}
|
|
@@ -4887,7 +4920,7 @@ function enumerateJsonlsWithSkips(projectsRoot) {
|
|
|
4887
4920
|
continue;
|
|
4888
4921
|
}
|
|
4889
4922
|
for (const arc of archiveEntries) {
|
|
4890
|
-
if (arc.isFile() &&
|
|
4923
|
+
if (arc.isFile() && fileRe.test(arc.name)) {
|
|
4891
4924
|
out.push({ path: join10(archiveDir, arc.name), isSubagent: false, archived: true });
|
|
4892
4925
|
}
|
|
4893
4926
|
}
|
|
@@ -4899,6 +4932,9 @@ function enumerateJsonlsWithSkips(projectsRoot) {
|
|
|
4899
4932
|
function enumerateJsonls(projectsRoot) {
|
|
4900
4933
|
return enumerateJsonlsWithSkips(projectsRoot).files;
|
|
4901
4934
|
}
|
|
4935
|
+
function enumerateSessionSidecars(projectsRoot) {
|
|
4936
|
+
return enumerateJsonlsWithSkips(projectsRoot, SIDECAR_META_RE).files;
|
|
4937
|
+
}
|
|
4902
4938
|
async function fetchLiveSessions() {
|
|
4903
4939
|
const out = /* @__PURE__ */ new Map();
|
|
4904
4940
|
let port2;
|
|
@@ -8994,23 +9030,23 @@ async function objectGate(c, action) {
|
|
|
8994
9030
|
if (err instanceof Error && err.name === "BodyLimitError") throw err;
|
|
8995
9031
|
return { ok: false, res: c.json({ error: "invalid-json" }, 400) };
|
|
8996
9032
|
}
|
|
8997
|
-
const
|
|
8998
|
-
if (!
|
|
9033
|
+
const bucket2 = body.bucket;
|
|
9034
|
+
if (!bucket2 || typeof bucket2 !== "string") {
|
|
8999
9035
|
return { ok: false, res: c.json({ error: "bucket-required" }, 400) };
|
|
9000
9036
|
}
|
|
9001
9037
|
const session = getSession();
|
|
9002
9038
|
let owner;
|
|
9003
9039
|
try {
|
|
9004
|
-
owner = await resolveOwner(session, "r2",
|
|
9040
|
+
owner = await resolveOwner(session, "r2", bucket2);
|
|
9005
9041
|
} catch (err) {
|
|
9006
9042
|
return { ok: false, res: c.json({ error: String(err) }, 500) };
|
|
9007
9043
|
} finally {
|
|
9008
9044
|
await session.close();
|
|
9009
9045
|
}
|
|
9010
9046
|
const decision = authorizeAccess({ caller: account, owner, action });
|
|
9011
|
-
log(action, "r2", account,
|
|
9047
|
+
log(action, "r2", account, bucket2, owner, decision.allow ? "allow" : "deny");
|
|
9012
9048
|
if (!decision.allow) return { ok: false, res: c.json({ error: decision.reason }, 403) };
|
|
9013
|
-
return { ok: true, bucket, body };
|
|
9049
|
+
return { ok: true, bucket: bucket2, body };
|
|
9014
9050
|
}
|
|
9015
9051
|
function readKey(body) {
|
|
9016
9052
|
const key2 = body.key;
|
|
@@ -9308,8 +9344,8 @@ function readSharedStoreNames(platformRootDir) {
|
|
|
9308
9344
|
if (m) env[m[1]] = m[2].trim();
|
|
9309
9345
|
}
|
|
9310
9346
|
const dbName = env.DATA_PORTAL_DB_NAME;
|
|
9311
|
-
const
|
|
9312
|
-
return dbName &&
|
|
9347
|
+
const bucket2 = env.DATA_PORTAL_BUCKET;
|
|
9348
|
+
return dbName && bucket2 ? { dbName, bucket: bucket2 } : null;
|
|
9313
9349
|
}
|
|
9314
9350
|
function resolveStorageModel(cfg, shared, onDisagree) {
|
|
9315
9351
|
const labelled = cfg.storageModel === "shared" ? "shared" : "dedicated";
|
|
@@ -10651,8 +10687,7 @@ app5.get("/store-backfill", requireAdminSession, (c) => {
|
|
|
10651
10687
|
console.log(`[wa-reader] op=store-backfill remoteJid=${remoteJid} from=0 to=0 turns=0 bytes=0 reachedStart=true`);
|
|
10652
10688
|
return c.json({ turns: [], from: 0, reachedStart: true });
|
|
10653
10689
|
}
|
|
10654
|
-
const
|
|
10655
|
-
const { from, aligned } = alignToRow(file, rawFrom, to);
|
|
10690
|
+
const { from, aligned } = backfillRangeStart(file, to, TAIL_WINDOW_BYTES);
|
|
10656
10691
|
const records = [];
|
|
10657
10692
|
const reactionRecords = [];
|
|
10658
10693
|
let reactionScanBytes = 0;
|
|
@@ -10708,6 +10743,7 @@ app5.get("/store-backfill", requireAdminSession, (c) => {
|
|
|
10708
10743
|
const fold = foldReactions(reactionRecords);
|
|
10709
10744
|
const turns = records.map((m) => toTurn(m, fold.get(m.msgKeyId)));
|
|
10710
10745
|
const reachedStart = from === 0;
|
|
10746
|
+
noteBackfill(remoteJid.slice(0, 12));
|
|
10711
10747
|
console.log(
|
|
10712
10748
|
`[wa-reader] op=store-backfill remoteJid=${remoteJid} from=${from} to=${to} turns=${turns.length} bytes=${to - from} aligned=${aligned} reactionScanBytes=${reactionScanBytes} quoteResolved=${q2.found.size} quoteMissing=${wanted.size - q2.found.size} quoteCapped=${q2.capped} reachedStart=${reachedStart}`
|
|
10713
10749
|
);
|
|
@@ -10775,6 +10811,7 @@ data: ${JSON.stringify(payload)}
|
|
|
10775
10811
|
if (offset === 0) {
|
|
10776
10812
|
const rawFrom = tailWindowStart(fileEnd0, TAIL_WINDOW_BYTES);
|
|
10777
10813
|
const { from: alignedFrom, aligned } = alignToRow(file, rawFrom, fileEnd0);
|
|
10814
|
+
noteWindowedOpen(remoteJid.slice(0, 12), alignedFrom > 0);
|
|
10778
10815
|
controller.enqueue(
|
|
10779
10816
|
encoder.encode(`event: window
|
|
10780
10817
|
data: ${JSON.stringify({ from: alignedFrom, fileEnd: fileEnd0 })}
|
|
@@ -11409,7 +11446,7 @@ data: ${JSON.stringify({ from: alignedFrom, fileEnd: fileEnd0 })}
|
|
|
11409
11446
|
|
|
11410
11447
|
`)
|
|
11411
11448
|
);
|
|
11412
|
-
noteWindowedOpen(
|
|
11449
|
+
noteWindowedOpen(sessionId.slice(0, 8), windowed);
|
|
11413
11450
|
try {
|
|
11414
11451
|
const { buf, end } = readFrom(jsonlPath, alignedFrom);
|
|
11415
11452
|
offset = end;
|
|
@@ -11524,8 +11561,7 @@ app6.get("/backfill", requireAdminSession, (c) => {
|
|
|
11524
11561
|
console.log(`[wa-stream] op=backfill conn=${connId} from=0 to=0 turns=0 bytes=0 reachedStart=true`);
|
|
11525
11562
|
return c.json({ turns: [], from: 0, reachedStart: true });
|
|
11526
11563
|
}
|
|
11527
|
-
const
|
|
11528
|
-
const { from, aligned } = alignToRow(jsonlPath, rawFrom, to);
|
|
11564
|
+
const { from, aligned } = backfillRangeStart(jsonlPath, to, TAIL_WINDOW_BYTES);
|
|
11529
11565
|
const turnCtx = {};
|
|
11530
11566
|
if (from > 0) seedTurnCtx(jsonlPath, from, turnCtx);
|
|
11531
11567
|
let turns;
|
|
@@ -11539,7 +11575,7 @@ app6.get("/backfill", requireAdminSession, (c) => {
|
|
|
11539
11575
|
return c.json({ error: "read-failed" }, 500);
|
|
11540
11576
|
}
|
|
11541
11577
|
const reachedStart = from === 0;
|
|
11542
|
-
noteBackfill(
|
|
11578
|
+
noteBackfill(sessionId.slice(0, 8));
|
|
11543
11579
|
console.log(
|
|
11544
11580
|
`[wa-stream] op=backfill conn=${connId} from=${from} to=${to} turns=${turns.length} bytes=${to - from} aligned=${aligned} reachedStart=${reachedStart}`
|
|
11545
11581
|
);
|
|
@@ -12207,8 +12243,7 @@ app8.get("/backfill", (c) => {
|
|
|
12207
12243
|
console.log(`${TAG19} op=backfill key=${senderShort} from=0 to=0 turns=0 bytes=0 reachedStart=true`);
|
|
12208
12244
|
return c.json({ turns: [], from: 0, reachedStart: true });
|
|
12209
12245
|
}
|
|
12210
|
-
const
|
|
12211
|
-
const { from, aligned } = alignToRow(jsonlPath, rawFrom, to);
|
|
12246
|
+
const { from, aligned } = backfillRangeStart(jsonlPath, to, TAIL_WINDOW_BYTES);
|
|
12212
12247
|
const turnCtx = {};
|
|
12213
12248
|
if (from > 0) seedTurnCtx(jsonlPath, from, turnCtx);
|
|
12214
12249
|
let turns;
|
|
@@ -12226,6 +12261,7 @@ app8.get("/backfill", (c) => {
|
|
|
12226
12261
|
return c.json({ error: "read-failed" }, 500);
|
|
12227
12262
|
}
|
|
12228
12263
|
const reachedStart = from === 0;
|
|
12264
|
+
noteBackfill(sessionId.slice(0, 8));
|
|
12229
12265
|
console.log(
|
|
12230
12266
|
`${TAG19} op=backfill key=${senderShort} from=${from} to=${to} turns=${turns.length} bytes=${to - from} dropped=${dropped} aligned=${aligned} reachedStart=${reachedStart}`
|
|
12231
12267
|
);
|
|
@@ -12288,6 +12324,7 @@ data: ${JSON.stringify(turn)}
|
|
|
12288
12324
|
console.log(
|
|
12289
12325
|
`${TAG19} op=window key=${senderShort} fileBytes=${fileEnd0} budget=${TAIL_WINDOW_BYTES} rawFrom=${rawFrom} alignedFrom=${alignedFrom} aligned=${aligned} source=${windowed ? "windowed" : "full"}`
|
|
12290
12326
|
);
|
|
12327
|
+
noteWindowedOpen(sessionId.slice(0, 8), windowed);
|
|
12291
12328
|
const backlogCtx = {};
|
|
12292
12329
|
if (windowed) {
|
|
12293
12330
|
const seed = seedTurnCtx(jsonlPath, alignedFrom, backlogCtx);
|
|
@@ -19150,7 +19187,7 @@ app25.post("/upload", requireAdminSession, async (c) => {
|
|
|
19150
19187
|
const tmpPath = resolve24(tmpDir, `${uid}.part`);
|
|
19151
19188
|
const out = createWriteStream2(tmpPath);
|
|
19152
19189
|
const t0 = Date.now();
|
|
19153
|
-
let
|
|
19190
|
+
let received2 = 0;
|
|
19154
19191
|
let lastLogged = 0;
|
|
19155
19192
|
const LOG_EVERY = 64 * 1024 * 1024;
|
|
19156
19193
|
let writeError = null;
|
|
@@ -19175,9 +19212,9 @@ app25.post("/upload", requireAdminSession, async (c) => {
|
|
|
19175
19212
|
const { done, value } = await reader.read();
|
|
19176
19213
|
if (done) break;
|
|
19177
19214
|
if (!value) continue;
|
|
19178
|
-
|
|
19179
|
-
if (
|
|
19180
|
-
console.error(`[data-upload] op=reject-size uid=${uid} received=${
|
|
19215
|
+
received2 += value.byteLength;
|
|
19216
|
+
if (received2 > ceiling) {
|
|
19217
|
+
console.error(`[data-upload] op=reject-size uid=${uid} received=${received2} ceiling=${ceiling}`);
|
|
19181
19218
|
await reader.cancel().catch(() => {
|
|
19182
19219
|
});
|
|
19183
19220
|
await cleanup();
|
|
@@ -19199,9 +19236,9 @@ app25.post("/upload", requireAdminSession, async (c) => {
|
|
|
19199
19236
|
out.once("error", onErr);
|
|
19200
19237
|
});
|
|
19201
19238
|
}
|
|
19202
|
-
if (
|
|
19203
|
-
lastLogged =
|
|
19204
|
-
console.error(`[data-upload] op=streaming uid=${uid} received=${
|
|
19239
|
+
if (received2 - lastLogged >= LOG_EVERY) {
|
|
19240
|
+
lastLogged = received2;
|
|
19241
|
+
console.error(`[data-upload] op=streaming uid=${uid} received=${received2}`);
|
|
19205
19242
|
}
|
|
19206
19243
|
}
|
|
19207
19244
|
await new Promise((res, rej) => {
|
|
@@ -19217,7 +19254,7 @@ app25.post("/upload", requireAdminSession, async (c) => {
|
|
|
19217
19254
|
return c.json({ error: message }, 500);
|
|
19218
19255
|
}
|
|
19219
19256
|
const relativeDest = `${destRel}/${finalName}`;
|
|
19220
|
-
console.error(`[data-upload] op=committed uid=${uid} path="${relativeDest}" bytes=${
|
|
19257
|
+
console.error(`[data-upload] op=committed uid=${uid} path="${relativeDest}" bytes=${received2} token=${token} rel="${relpath ?? ""}" ms=${Date.now() - t0}`);
|
|
19221
19258
|
void indexFile(accountId, relativeDest).catch((err) => {
|
|
19222
19259
|
console.error(`[data-upload] op=index-failed uid=${uid} dest="${relativeDest}" err="${err instanceof Error ? err.message : String(err)}"`);
|
|
19223
19260
|
});
|
|
@@ -19225,7 +19262,7 @@ app25.post("/upload", requireAdminSession, async (c) => {
|
|
|
19225
19262
|
return c.json({
|
|
19226
19263
|
path: relativeDest,
|
|
19227
19264
|
filename: finalName,
|
|
19228
|
-
sizeBytes:
|
|
19265
|
+
sizeBytes: received2,
|
|
19229
19266
|
mimeType
|
|
19230
19267
|
});
|
|
19231
19268
|
});
|
|
@@ -24497,7 +24534,7 @@ function readChannelAdmins(accountDir, channel) {
|
|
|
24497
24534
|
return { adminPhones, accountManagers };
|
|
24498
24535
|
}
|
|
24499
24536
|
const tg = config.telegram ?? {};
|
|
24500
|
-
const
|
|
24537
|
+
const byBot2 = [];
|
|
24501
24538
|
const seen = /* @__PURE__ */ new Set();
|
|
24502
24539
|
const adminUsers = [];
|
|
24503
24540
|
if (Array.isArray(tg.bots)) {
|
|
@@ -24506,7 +24543,7 @@ function readChannelAdmins(accountDir, channel) {
|
|
|
24506
24543
|
const b = raw;
|
|
24507
24544
|
if (b.role !== "admin" || typeof b.id !== "string" || b.id.length === 0) continue;
|
|
24508
24545
|
const users = Array.isArray(b.adminUsers) ? b.adminUsers.filter((u) => typeof u === "number") : [];
|
|
24509
|
-
|
|
24546
|
+
byBot2.push({ botId: b.id, adminUsers: users });
|
|
24510
24547
|
for (const u of users) {
|
|
24511
24548
|
if (seen.has(u)) continue;
|
|
24512
24549
|
seen.add(u);
|
|
@@ -24514,7 +24551,7 @@ function readChannelAdmins(accountDir, channel) {
|
|
|
24514
24551
|
}
|
|
24515
24552
|
}
|
|
24516
24553
|
}
|
|
24517
|
-
return { adminUsers, byBot };
|
|
24554
|
+
return { adminUsers, byBot: byBot2 };
|
|
24518
24555
|
}
|
|
24519
24556
|
function registeredAccountForDestination(houseDir, houseAccountId, destination) {
|
|
24520
24557
|
const { adminPhones, accountManagers } = readChannelAdmins(houseDir, "whatsapp");
|
|
@@ -24573,8 +24610,8 @@ function listDispatchDestinations(input) {
|
|
|
24573
24610
|
admins.push({ channel: "whatsapp", destination: phone, label: "House admin" });
|
|
24574
24611
|
}
|
|
24575
24612
|
}
|
|
24576
|
-
const { byBot } = readChannelAdmins(resolve31(accountsDir, accountId), "telegram");
|
|
24577
|
-
const telegram =
|
|
24613
|
+
const { byBot: byBot2 } = readChannelAdmins(resolve31(accountsDir, accountId), "telegram");
|
|
24614
|
+
const telegram = byBot2.flatMap((b) => b.adminUsers.map((id) => ({ botId: b.botId, id }))).sort((a, b) => a.id - b.id || a.botId.localeCompare(b.botId)).map(({ botId, id }) => ({
|
|
24578
24615
|
channel: "telegram",
|
|
24579
24616
|
destination: String(id),
|
|
24580
24617
|
label: "Telegram admin",
|
|
@@ -24734,16 +24771,33 @@ app51.get("/", requireAdminSession, async (c) => {
|
|
|
24734
24771
|
}
|
|
24735
24772
|
const session = getSession();
|
|
24736
24773
|
try {
|
|
24774
|
+
const since = since24h();
|
|
24737
24775
|
const res = await session.run(
|
|
24738
24776
|
`MATCH (e:Event {accountId: $accountId})
|
|
24739
24777
|
WHERE ${AUTOMATION_WHERE}
|
|
24740
24778
|
RETURN ${ROUTINE_COLS}
|
|
24741
24779
|
ORDER BY e.nextRun`,
|
|
24742
|
-
{ accountId, since
|
|
24780
|
+
{ accountId, since }
|
|
24743
24781
|
);
|
|
24744
24782
|
const routines = res.records.map(mapRoutine);
|
|
24745
|
-
|
|
24746
|
-
|
|
24783
|
+
let workflowRuns24h = null;
|
|
24784
|
+
try {
|
|
24785
|
+
const wf = await session.run(
|
|
24786
|
+
`MATCH (r:WorkflowRun)-[:RUN_OF]->(w:Workflow {accountId: $accountId})
|
|
24787
|
+
WHERE r.accountId = $accountId AND r.startedAt >= $since
|
|
24788
|
+
AND (NOT r:Trashed AND r.deletedAt IS NULL)
|
|
24789
|
+
AND (NOT w:Trashed AND w.deletedAt IS NULL)
|
|
24790
|
+
RETURN count(r) AS runs24h`,
|
|
24791
|
+
{ accountId, since }
|
|
24792
|
+
);
|
|
24793
|
+
const raw = wf.records[0].get("runs24h");
|
|
24794
|
+
workflowRuns24h = typeof raw === "object" && raw !== null && "toNumber" in raw ? raw.toNumber() : Number(raw);
|
|
24795
|
+
} catch (err) {
|
|
24796
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
24797
|
+
console.error(`[admin:routines] op=workflow-runs-fail accountId=${accountId.slice(0, 8)} err="${message}"`);
|
|
24798
|
+
}
|
|
24799
|
+
console.log(`[admin:routines] op=list accountId=${accountId.slice(0, 8)} count=${routines.length} workflowRuns24h=${workflowRuns24h ?? "unknown"}`);
|
|
24800
|
+
return c.json({ routines, workflowRuns24h });
|
|
24747
24801
|
} catch (err) {
|
|
24748
24802
|
const message = err instanceof Error ? err.message : String(err);
|
|
24749
24803
|
console.error(`[admin:routines] op=list-fail err="${message}"`);
|
|
@@ -31572,15 +31626,20 @@ var InboundHub3 = class {
|
|
|
31572
31626
|
return count;
|
|
31573
31627
|
}
|
|
31574
31628
|
/** The channel server confirmed it received (emitted) a drained message. The
|
|
31575
|
-
* message has reached the agent; drop it from in-flight. Returns
|
|
31576
|
-
*
|
|
31629
|
+
* message has reached the agent; drop it from in-flight. Returns the payload
|
|
31630
|
+
* that was dropped, or null when no in-flight message matched.
|
|
31631
|
+
*
|
|
31632
|
+
* Task 2408 — the payload rather than a bare boolean, because this is the one
|
|
31633
|
+
* point holding both the message id and the message. The delivered-versus-
|
|
31634
|
+
* answered census must skip a `source: 'schedule'` inbound, whose turn ends
|
|
31635
|
+
* deliberately silent, and the ack site is where that fact is still in hand. */
|
|
31577
31636
|
ack(key2, messageId) {
|
|
31578
31637
|
const s = this.keys.get(key2);
|
|
31579
|
-
if (!s) return
|
|
31638
|
+
if (!s) return null;
|
|
31580
31639
|
const i = s.inFlight.findIndex((e) => e.payload.messageId === messageId);
|
|
31581
|
-
if (i < 0) return
|
|
31582
|
-
s.inFlight.splice(i, 1);
|
|
31583
|
-
return
|
|
31640
|
+
if (i < 0) return null;
|
|
31641
|
+
const [dropped] = s.inFlight.splice(i, 1);
|
|
31642
|
+
return dropped.payload;
|
|
31584
31643
|
}
|
|
31585
31644
|
/** A key's channel server disconnected (session ended/restarting).
|
|
31586
31645
|
* Subsequent messages queue again until re-attach + ready, so nothing is lost
|
|
@@ -31726,6 +31785,87 @@ function createTelegramChannelRoutes(deps) {
|
|
|
31726
31785
|
return app77;
|
|
31727
31786
|
}
|
|
31728
31787
|
|
|
31788
|
+
// app/lib/telegram/gateway/telegram-inbound-census.ts
|
|
31789
|
+
var ANSWER_THRESHOLD_MS = 3e4;
|
|
31790
|
+
var GAP_NAME_LIMIT = 10;
|
|
31791
|
+
var received = 0;
|
|
31792
|
+
var answered2 = 0;
|
|
31793
|
+
var outstanding = /* @__PURE__ */ new Map();
|
|
31794
|
+
function noteReceived(key2, botId, messageId, now) {
|
|
31795
|
+
received += 1;
|
|
31796
|
+
const list = outstanding.get(key2);
|
|
31797
|
+
if (list) list.push({ messageId, botId, receivedAt: now });
|
|
31798
|
+
else outstanding.set(key2, [{ messageId, botId, receivedAt: now }]);
|
|
31799
|
+
}
|
|
31800
|
+
function noteAnswered2(key2) {
|
|
31801
|
+
const list = outstanding.get(key2);
|
|
31802
|
+
if (!list || list.length === 0) return;
|
|
31803
|
+
list.shift();
|
|
31804
|
+
if (list.length === 0) outstanding.delete(key2);
|
|
31805
|
+
answered2 += 1;
|
|
31806
|
+
}
|
|
31807
|
+
function readTelegramInboundCensus(now) {
|
|
31808
|
+
const gaps = [];
|
|
31809
|
+
for (const [key2, list] of outstanding) {
|
|
31810
|
+
for (const o of list) {
|
|
31811
|
+
const ageMs2 = now - o.receivedAt;
|
|
31812
|
+
if (ageMs2 > ANSWER_THRESHOLD_MS) gaps.push({ messageId: o.messageId, botId: o.botId, key: key2, ageMs: ageMs2 });
|
|
31813
|
+
}
|
|
31814
|
+
}
|
|
31815
|
+
gaps.sort((a, b) => b.ageMs - a.ageMs);
|
|
31816
|
+
return { received, answered: answered2, gaps };
|
|
31817
|
+
}
|
|
31818
|
+
function buildTelegramNotifyReconcileLines(input) {
|
|
31819
|
+
const named = input.gaps.slice(0, GAP_NAME_LIMIT);
|
|
31820
|
+
const lines = [
|
|
31821
|
+
`[telegram-native] op=telegram-notify-reconcile received=${input.received} answered=${input.answered} answerGap=${input.gaps.length} named=${named.length}`
|
|
31822
|
+
];
|
|
31823
|
+
for (const g of named) {
|
|
31824
|
+
lines.push(
|
|
31825
|
+
`[telegram-native] op=telegram-answer-gap messageId=${g.messageId} botId=${g.botId} key=${g.key} ageMs=${g.ageMs}`
|
|
31826
|
+
);
|
|
31827
|
+
}
|
|
31828
|
+
return lines;
|
|
31829
|
+
}
|
|
31830
|
+
function runTelegramNotifyReconcile(now) {
|
|
31831
|
+
for (const line of buildTelegramNotifyReconcileLines(readTelegramInboundCensus(now))) console.error(line);
|
|
31832
|
+
}
|
|
31833
|
+
|
|
31834
|
+
// app/lib/telegram/gateway/telegram-spawn-census.ts
|
|
31835
|
+
var byBot = /* @__PURE__ */ new Map();
|
|
31836
|
+
function bucket(botId) {
|
|
31837
|
+
let c = byBot.get(botId);
|
|
31838
|
+
if (!c) {
|
|
31839
|
+
c = { attempted: 0, ok: 0, failed: 0 };
|
|
31840
|
+
byBot.set(botId, c);
|
|
31841
|
+
}
|
|
31842
|
+
return c;
|
|
31843
|
+
}
|
|
31844
|
+
function noteSpawnAttempt2(botId) {
|
|
31845
|
+
bucket(botId).attempted += 1;
|
|
31846
|
+
}
|
|
31847
|
+
function noteSpawnOk2(botId) {
|
|
31848
|
+
bucket(botId).ok += 1;
|
|
31849
|
+
}
|
|
31850
|
+
function noteSpawnFailed2(botId) {
|
|
31851
|
+
bucket(botId).failed += 1;
|
|
31852
|
+
}
|
|
31853
|
+
function readTelegramSpawnCensus(botId) {
|
|
31854
|
+
const c = byBot.get(botId) ?? { attempted: 0, ok: 0, failed: 0 };
|
|
31855
|
+
return { ...c, spawnGap: Math.max(0, c.attempted - (c.ok + c.failed)) };
|
|
31856
|
+
}
|
|
31857
|
+
function buildTelegramSpawnCensusLines(input) {
|
|
31858
|
+
return [...new Set(input.botIds)].map((botId) => {
|
|
31859
|
+
const c = input.countsFor(botId);
|
|
31860
|
+
return `[telegram-native] op=telegram-spawn-census botId=${botId} attempted=${c.attempted} ok=${c.ok} failed=${c.failed} spawnGap=${c.spawnGap}`;
|
|
31861
|
+
});
|
|
31862
|
+
}
|
|
31863
|
+
function runTelegramSpawnCensus(botIds) {
|
|
31864
|
+
for (const line of buildTelegramSpawnCensusLines({ botIds, countsFor: readTelegramSpawnCensus })) {
|
|
31865
|
+
console.error(line);
|
|
31866
|
+
}
|
|
31867
|
+
}
|
|
31868
|
+
|
|
31729
31869
|
// app/lib/telegram/gateway/telegram-gateway.ts
|
|
31730
31870
|
var QUEUED_THRESHOLD_MS3 = 3e4;
|
|
31731
31871
|
var ACK_THRESHOLD_MS3 = 3e4;
|
|
@@ -31748,9 +31888,12 @@ var TelegramGateway = class {
|
|
|
31748
31888
|
if (count > 0) console.error(`[telegram-native] op=drained key=${key2} count=${count}`);
|
|
31749
31889
|
},
|
|
31750
31890
|
onReceived: (key2, messageId) => {
|
|
31751
|
-
const
|
|
31891
|
+
const acked = this.hub.ack(key2, messageId);
|
|
31892
|
+
if (acked !== null && (acked.source ?? "user") === "user") {
|
|
31893
|
+
noteReceived(key2, parseTelegramChannelKey(key2)?.botId ?? "unknown", messageId, Date.now());
|
|
31894
|
+
}
|
|
31752
31895
|
console.error(
|
|
31753
|
-
`[telegram-native] op=channel-received key=${key2} messageId=${messageId}${
|
|
31896
|
+
`[telegram-native] op=channel-received key=${key2} messageId=${messageId}${acked !== null ? "" : " note=unknown"}`
|
|
31754
31897
|
);
|
|
31755
31898
|
}
|
|
31756
31899
|
});
|
|
@@ -31842,6 +31985,7 @@ var TelegramGateway = class {
|
|
|
31842
31985
|
if (!hadSubscriber && !this.spawning.has(key2)) {
|
|
31843
31986
|
this.spawning.add(key2);
|
|
31844
31987
|
console.error(`[telegram-native] op=spawn-trigger key=${key2} botId=${input.botId} role=${input.role}`);
|
|
31988
|
+
noteSpawnAttempt2(input.botId);
|
|
31845
31989
|
try {
|
|
31846
31990
|
await this.deps.ensureChannelSession({
|
|
31847
31991
|
accountId: input.accountId,
|
|
@@ -31866,6 +32010,7 @@ var TelegramGateway = class {
|
|
|
31866
32010
|
const reply = this.replies.get(key2);
|
|
31867
32011
|
if (!reply) throw new Error(`telegram-gateway: no reply route for key ${key2}`);
|
|
31868
32012
|
await reply(text);
|
|
32013
|
+
noteAnswered2(key2);
|
|
31869
32014
|
}
|
|
31870
32015
|
};
|
|
31871
32016
|
|
|
@@ -31932,11 +32077,13 @@ function buildTelegramEnsureSession(deps) {
|
|
|
31932
32077
|
console.error(
|
|
31933
32078
|
`[telegram-native] op=spawn-failed botId=${input.botId} key=${req.channelKey} role=public agent=${input.agentSlug} error=${result2.error} status=${result2.status}`
|
|
31934
32079
|
);
|
|
32080
|
+
noteSpawnFailed2(input.botId);
|
|
31935
32081
|
return;
|
|
31936
32082
|
}
|
|
31937
32083
|
console.error(
|
|
31938
32084
|
`${TAG51} op=spawn botId=${input.botId} sessionId=${result2.sessionId} targetAccountId=${input.accountId} role=public`
|
|
31939
32085
|
);
|
|
32086
|
+
noteSpawnOk2(input.botId);
|
|
31940
32087
|
return;
|
|
31941
32088
|
}
|
|
31942
32089
|
const result = await deps.managerRcSpawn(req);
|
|
@@ -31944,11 +32091,13 @@ function buildTelegramEnsureSession(deps) {
|
|
|
31944
32091
|
console.error(
|
|
31945
32092
|
`[telegram-native] op=spawn-failed botId=${input.botId} key=${req.channelKey} role=admin error=${result.error} status=${result.status}`
|
|
31946
32093
|
);
|
|
32094
|
+
noteSpawnFailed2(input.botId);
|
|
31947
32095
|
return;
|
|
31948
32096
|
}
|
|
31949
32097
|
console.error(
|
|
31950
32098
|
`${TAG51} op=spawn botId=${input.botId} sessionId=${req.sessionId} targetAccountId=${input.accountId} role=admin`
|
|
31951
32099
|
);
|
|
32100
|
+
noteSpawnOk2(input.botId);
|
|
31952
32101
|
deps.followers.get(req.channelKey)?.abort();
|
|
31953
32102
|
let ac;
|
|
31954
32103
|
ac = deps.startFileFollower({
|
|
@@ -32402,7 +32551,7 @@ function runPublicAddressCollisionAudit(deps) {
|
|
|
32402
32551
|
|
|
32403
32552
|
// server/telegram-audit.ts
|
|
32404
32553
|
import { statSync as statSync26 } from "fs";
|
|
32405
|
-
import {
|
|
32554
|
+
import { join as join55 } from "path";
|
|
32406
32555
|
function buildTelegramAuditLines(input) {
|
|
32407
32556
|
const lines = [];
|
|
32408
32557
|
const entries2 = input.accounts.flatMap(
|
|
@@ -32429,22 +32578,30 @@ function buildTelegramAuditLines(input) {
|
|
|
32429
32578
|
if (!known.has(botId)) lines.push(`[telegram-audit] op=secret-orphan botId=${botId} side=file`);
|
|
32430
32579
|
}
|
|
32431
32580
|
for (const { accountId, entry } of entries2) {
|
|
32432
|
-
const last = input.
|
|
32433
|
-
const
|
|
32581
|
+
const last = input.lastActivityByBot(entry.id);
|
|
32582
|
+
const spawnAge = last === null ? "never" : String(input.now - last.spawnMs);
|
|
32583
|
+
const turnAge = last === null || last.turnMs === null ? "never" : String(input.now - last.turnMs);
|
|
32434
32584
|
const agent = entry.role === "admin" ? "admin" : entry.agent;
|
|
32435
32585
|
const secretFile = input.secretFileExists(entry.id) ? "present" : "absent";
|
|
32436
32586
|
lines.push(
|
|
32437
|
-
`[telegram-audit] op=configured botId=${entry.id} accountId=${accountId} agent=${agent} secretFile=${secretFile}
|
|
32587
|
+
`[telegram-audit] op=configured botId=${entry.id} accountId=${accountId} agent=${agent} secretFile=${secretFile} lastSpawnAgeMs=${spawnAge} lastTurnAgeMs=${turnAge}`
|
|
32438
32588
|
);
|
|
32439
32589
|
}
|
|
32440
32590
|
return lines;
|
|
32441
32591
|
}
|
|
32442
32592
|
function newestTelegramSessionByBot() {
|
|
32443
32593
|
const out = /* @__PURE__ */ new Map();
|
|
32444
|
-
for (const { botId,
|
|
32594
|
+
for (const { botId, spawnMs, turnMs } of walkTelegramSidecars()) {
|
|
32445
32595
|
if (botId === null) continue;
|
|
32446
32596
|
const prev = out.get(botId);
|
|
32447
|
-
if (prev === void 0
|
|
32597
|
+
if (prev === void 0) {
|
|
32598
|
+
out.set(botId, { spawnMs, turnMs });
|
|
32599
|
+
continue;
|
|
32600
|
+
}
|
|
32601
|
+
out.set(botId, {
|
|
32602
|
+
spawnMs: Math.max(prev.spawnMs, spawnMs),
|
|
32603
|
+
turnMs: prev.turnMs === null ? turnMs : turnMs === null ? prev.turnMs : Math.max(prev.turnMs, turnMs)
|
|
32604
|
+
});
|
|
32448
32605
|
}
|
|
32449
32606
|
return out;
|
|
32450
32607
|
}
|
|
@@ -32459,27 +32616,33 @@ function* walkTelegramSidecars() {
|
|
|
32459
32616
|
const cfg = claudeConfigDir();
|
|
32460
32617
|
if (!cfg) return;
|
|
32461
32618
|
const projectsRoot = join55(cfg, "projects");
|
|
32462
|
-
for (const { path } of
|
|
32463
|
-
const
|
|
32464
|
-
const meta = readSidecarMeta(join55(dirname17(path), `${sessionId}.meta.json`));
|
|
32619
|
+
for (const { path } of enumerateSessionSidecars(projectsRoot)) {
|
|
32620
|
+
const meta = readSidecarMeta(path);
|
|
32465
32621
|
if (meta.channel !== "telegram" || !meta.accountId) continue;
|
|
32466
|
-
let
|
|
32622
|
+
let spawnMs;
|
|
32467
32623
|
try {
|
|
32468
|
-
|
|
32624
|
+
spawnMs = statSync26(path).mtimeMs;
|
|
32469
32625
|
} catch {
|
|
32470
32626
|
continue;
|
|
32471
32627
|
}
|
|
32628
|
+
let turnMs;
|
|
32629
|
+
try {
|
|
32630
|
+
turnMs = statSync26(path.replace(/\.meta\.json$/, ".jsonl")).mtimeMs;
|
|
32631
|
+
} catch {
|
|
32632
|
+
turnMs = null;
|
|
32633
|
+
}
|
|
32472
32634
|
yield {
|
|
32473
32635
|
accountId: meta.accountId,
|
|
32474
32636
|
botId: parseTelegramChannelKey(meta.senderId ?? "")?.botId ?? null,
|
|
32475
|
-
|
|
32637
|
+
spawnMs,
|
|
32638
|
+
turnMs
|
|
32476
32639
|
};
|
|
32477
32640
|
}
|
|
32478
32641
|
}
|
|
32479
32642
|
|
|
32480
32643
|
// server/telegram-migrate.ts
|
|
32481
32644
|
import { readFileSync as readFileSync45, writeFileSync as writeFileSync18, existsSync as existsSync49, renameSync as renameSync11, mkdirSync as mkdirSync10 } from "fs";
|
|
32482
|
-
import { dirname as
|
|
32645
|
+
import { dirname as dirname17, join as join56 } from "path";
|
|
32483
32646
|
function migrateTelegramTwoSlot(input) {
|
|
32484
32647
|
const out = [];
|
|
32485
32648
|
for (const account of input.accounts) {
|
|
@@ -32540,7 +32703,7 @@ function migrateTelegramTwoSlot(input) {
|
|
|
32540
32703
|
}
|
|
32541
32704
|
function moveSecret(from, to) {
|
|
32542
32705
|
if (!existsSync49(from)) return;
|
|
32543
|
-
mkdirSync10(
|
|
32706
|
+
mkdirSync10(dirname17(to), { recursive: true, mode: 448 });
|
|
32544
32707
|
renameSync11(from, to);
|
|
32545
32708
|
}
|
|
32546
32709
|
|
|
@@ -32555,19 +32718,19 @@ function backfillMisfiledRecords(params) {
|
|
|
32555
32718
|
for (const m of messages) {
|
|
32556
32719
|
const key2 = connectionKeyFromMessageId(m.messageId);
|
|
32557
32720
|
if (!key2 || key2 === houseAccountId || !isTargetAccount(key2)) continue;
|
|
32558
|
-
let
|
|
32559
|
-
if (!
|
|
32560
|
-
|
|
32561
|
-
byTarget.set(key2,
|
|
32721
|
+
let bucket2 = byTarget.get(key2);
|
|
32722
|
+
if (!bucket2) {
|
|
32723
|
+
bucket2 = { messageIds: /* @__PURE__ */ new Set(), msgKeyIds: /* @__PURE__ */ new Set() };
|
|
32724
|
+
byTarget.set(key2, bucket2);
|
|
32562
32725
|
}
|
|
32563
|
-
|
|
32564
|
-
|
|
32726
|
+
bucket2.messageIds.add(m.messageId);
|
|
32727
|
+
bucket2.msgKeyIds.add(m.msgKeyId);
|
|
32565
32728
|
}
|
|
32566
32729
|
if (byTarget.size === 0) continue;
|
|
32567
32730
|
const reactionTargets = new Set(readReactions(houseAccountId, remoteJid).map((r) => r.targetMsgKeyId));
|
|
32568
|
-
for (const [target,
|
|
32569
|
-
const carried = new Set([...
|
|
32570
|
-
const out = moveRecordsBetweenStores(houseAccountId, target, remoteJid,
|
|
32731
|
+
for (const [target, bucket2] of byTarget) {
|
|
32732
|
+
const carried = new Set([...bucket2.msgKeyIds].filter((k) => reactionTargets.has(k)));
|
|
32733
|
+
const out = moveRecordsBetweenStores(houseAccountId, target, remoteJid, bucket2.messageIds, carried);
|
|
32571
32734
|
movedRecords += out.movedRecords;
|
|
32572
32735
|
movedReactions += out.movedReactions;
|
|
32573
32736
|
}
|
|
@@ -32665,8 +32828,8 @@ function pubkeyPath(brand) {
|
|
|
32665
32828
|
}
|
|
32666
32829
|
var memo = null;
|
|
32667
32830
|
function memoKey(mtimeMs, account) {
|
|
32668
|
-
const
|
|
32669
|
-
return `${mtimeMs}:${
|
|
32831
|
+
const bucket2 = Math.floor(Date.now() / 6e4);
|
|
32832
|
+
return `${mtimeMs}:${bucket2}:${account.accountId}:${account.customerEmail ?? ""}`;
|
|
32670
32833
|
}
|
|
32671
32834
|
var VALID_TIERS = /* @__PURE__ */ new Set(["solo", "family", "pro", "max"]);
|
|
32672
32835
|
function resolveEntitlement(brand, account) {
|
|
@@ -34388,10 +34551,24 @@ console.log(`${BRAND.productName} listening on http://${hostname}:${port}`);
|
|
|
34388
34551
|
secretFileExists: (botId) => existsSync52(secretPath(botId)),
|
|
34389
34552
|
agentActive: isActiveAgentSlug,
|
|
34390
34553
|
secretFilesOnDisk,
|
|
34391
|
-
|
|
34554
|
+
lastActivityByBot: (botId) => lastByBot.get(botId) ?? null,
|
|
34392
34555
|
now: Date.now()
|
|
34393
34556
|
});
|
|
34394
34557
|
for (const line of lines) console.error(line);
|
|
34558
|
+
try {
|
|
34559
|
+
runTelegramNotifyReconcile(Date.now());
|
|
34560
|
+
} catch (err) {
|
|
34561
|
+
console.error(
|
|
34562
|
+
`[telegram-native] op=telegram-notify-reconcile-rejected detail=${err instanceof Error ? err.message : String(err)}`
|
|
34563
|
+
);
|
|
34564
|
+
}
|
|
34565
|
+
try {
|
|
34566
|
+
runTelegramSpawnCensus(accounts.flatMap((a) => listBotEntries(a.telegram).map((e) => e.id)));
|
|
34567
|
+
} catch (err) {
|
|
34568
|
+
console.error(
|
|
34569
|
+
`[telegram-native] op=telegram-spawn-census-rejected detail=${err instanceof Error ? err.message : String(err)}`
|
|
34570
|
+
);
|
|
34571
|
+
}
|
|
34395
34572
|
};
|
|
34396
34573
|
registerLoop({
|
|
34397
34574
|
name: "telegram-audit",
|
|
@@ -34887,7 +35064,7 @@ try {
|
|
|
34887
35064
|
} catch (err) {
|
|
34888
35065
|
console.error(`[graph-health] account-enumeration unavailable reason=${err instanceof Error ? err.message : String(err)}`);
|
|
34889
35066
|
}
|
|
34890
|
-
var configDirForWhatsApp =
|
|
35067
|
+
var configDirForWhatsApp = basename17(MAXY_DIR) || ".maxy";
|
|
34891
35068
|
var bootAccount = resolveAccount();
|
|
34892
35069
|
if (bootAccount) {
|
|
34893
35070
|
migrateRemovedConfigKeys(bootAccount.accountDir);
|