@rubytech/create-maxy-code 0.1.296 → 0.1.298
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/models/dist/index.d.ts +7 -0
- package/payload/platform/lib/models/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/models/dist/index.js +16 -1
- package/payload/platform/lib/models/dist/index.js.map +1 -1
- package/payload/platform/lib/models/src/index.ts +16 -0
- package/payload/platform/plugins/admin/.claude-plugin/plugin.json +5 -1
- package/payload/platform/plugins/admin/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/admin/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +4 -14
- package/payload/platform/plugins/aeo/.claude-plugin/plugin.json +5 -1
- package/payload/platform/plugins/aeo/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/aeo/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/browser/.claude-plugin/plugin.json +5 -1
- package/payload/platform/plugins/browser/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/browser/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/contacts/.claude-plugin/plugin.json +5 -1
- package/payload/platform/plugins/contacts/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/contacts/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/docs/references/admin-ui.md +1 -1
- package/payload/platform/plugins/docs/references/getting-started.md +1 -1
- package/payload/platform/plugins/docs/references/platform.md +1 -11
- package/payload/platform/plugins/email/.claude-plugin/plugin.json +6 -2
- package/payload/platform/plugins/email/PLUGIN.md +14 -2
- package/payload/platform/plugins/email/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/email/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft-edit.test.d.ts +2 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft-edit.test.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft-edit.test.js +71 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft-edit.test.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft-send.test.d.ts +2 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft-send.test.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft-send.test.js +95 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft-send.test.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft.test.d.ts +2 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft.test.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft.test.js +129 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft.test.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-setup.test.js +58 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/email-setup.test.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/__tests__/imap-drafts.test.d.ts +2 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/imap-drafts.test.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/imap-drafts.test.js +165 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/imap-drafts.test.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/imap-probe.test.d.ts +2 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/imap-probe.test.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/imap-probe.test.js +69 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/imap-probe.test.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/mail-options.test.d.ts +2 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/mail-options.test.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/mail-options.test.js +46 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/mail-options.test.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/send-raw.test.d.ts +2 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/send-raw.test.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/send-raw.test.js +38 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/send-raw.test.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/setup-probe.test.d.ts +2 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/setup-probe.test.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/setup-probe.test.js +56 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/setup-probe.test.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/smtp-probe.test.d.ts +2 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/smtp-probe.test.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/smtp-probe.test.js +46 -0
- package/payload/platform/plugins/email/mcp/dist/__tests__/smtp-probe.test.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/index.js +118 -0
- package/payload/platform/plugins/email/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/compose.d.ts +47 -0
- package/payload/platform/plugins/email/mcp/dist/lib/compose.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/lib/compose.js +75 -0
- package/payload/platform/plugins/email/mcp/dist/lib/compose.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/lib/imap.d.ts +53 -3
- package/payload/platform/plugins/email/mcp/dist/lib/imap.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/imap.js +179 -5
- package/payload/platform/plugins/email/mcp/dist/lib/imap.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/setup-probe.d.ts +42 -0
- package/payload/platform/plugins/email/mcp/dist/lib/setup-probe.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/lib/setup-probe.js +72 -0
- package/payload/platform/plugins/email/mcp/dist/lib/setup-probe.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/lib/smtp.d.ts +34 -6
- package/payload/platform/plugins/email/mcp/dist/lib/smtp.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/smtp.js +62 -20
- package/payload/platform/plugins/email/mcp/dist/lib/smtp.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/scripts/send-transactional.js +1 -2
- package/payload/platform/plugins/email/mcp/dist/scripts/send-transactional.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-draft-edit.d.ts +9 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-draft-edit.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-draft-edit.js +23 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-draft-edit.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-draft-send.d.ts +8 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-draft-send.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-draft-send.js +52 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-draft-send.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-draft.d.ts +7 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-draft.d.ts.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-draft.js +17 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-draft.js.map +1 -0
- package/payload/platform/plugins/email/mcp/dist/tools/email-reply.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-reply.js +1 -8
- package/payload/platform/plugins/email/mcp/dist/tools/email-reply.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-send.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-send.js +2 -8
- package/payload/platform/plugins/email/mcp/dist/tools/email-send.js.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-setup.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-setup.js +25 -3
- package/payload/platform/plugins/email/mcp/dist/tools/email-setup.js.map +1 -1
- package/payload/platform/plugins/email/references/email-reference.md +15 -0
- package/payload/platform/plugins/email/skills/email-composition/SKILL.md +26 -4
- package/payload/platform/plugins/memory/.claude-plugin/plugin.json +5 -1
- package/payload/platform/plugins/memory/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/memory/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/outlook/.claude-plugin/plugin.json +5 -1
- package/payload/platform/plugins/outlook/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/outlook/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/replicate/.claude-plugin/plugin.json +5 -1
- package/payload/platform/plugins/replicate/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/replicate/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/scheduling/.claude-plugin/plugin.json +5 -1
- package/payload/platform/plugins/scheduling/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/scheduling/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/telegram/.claude-plugin/plugin.json +5 -1
- package/payload/platform/plugins/telegram/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/telegram/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/url-get/.claude-plugin/plugin.json +5 -1
- package/payload/platform/plugins/url-get/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/url-get/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/whatsapp/.claude-plugin/plugin.json +5 -1
- package/payload/platform/plugins/whatsapp/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/whatsapp/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/work/.claude-plugin/plugin.json +5 -1
- package/payload/platform/plugins/work/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/work/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/platform/plugins/workflows/.claude-plugin/plugin.json +5 -1
- package/payload/platform/plugins/workflows/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/platform/plugins/workflows/lib/mcp-spawn-tee/package.json +3 -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 +3 -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/http-server.js +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/rc-daemon.d.ts +13 -0
- package/payload/platform/services/claude-session-manager/dist/rc-daemon.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/rc-daemon.js +71 -1
- package/payload/platform/services/claude-session-manager/dist/rc-daemon.js.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/jsonl-watch.d.ts +10 -0
- package/payload/platform/services/whatsapp-channel/dist/jsonl-watch.d.ts.map +1 -0
- package/payload/platform/services/whatsapp-channel/dist/jsonl-watch.js +70 -0
- package/payload/platform/services/whatsapp-channel/dist/jsonl-watch.js.map +1 -0
- package/payload/platform/services/whatsapp-channel/dist/server.d.ts +6 -1
- package/payload/platform/services/whatsapp-channel/dist/server.d.ts.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/server.js +38 -1
- package/payload/platform/services/whatsapp-channel/dist/server.js.map +1 -1
- package/payload/platform/templates/specialists/agents/personal-assistant.md +1 -1
- package/payload/premium-plugins/writer-craft/.claude-plugin/plugin.json +5 -1
- package/payload/premium-plugins/writer-craft/lib/mcp-spawn-tee/index.js +159 -0
- package/payload/premium-plugins/writer-craft/lib/mcp-spawn-tee/package.json +3 -0
- package/payload/server/public/assets/AdminShell-BnhxfX97.js +1 -0
- package/payload/server/public/assets/{Checkbox-DTrIyIFP.js → Checkbox-CVPUf_7I.js} +1 -1
- package/payload/server/public/assets/{Transcript-C3aDVJ-n.js → Transcript-FYmq-mL1.js} +1 -1
- package/payload/server/public/assets/{admin-DVdyV-Q6.js → admin-CF8K3hqE.js} +1 -1
- package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-DR9W0q1P.js → architectureDiagram-Q4EWVU46-IVt2X8Dk.js} +1 -1
- package/payload/server/public/assets/audio-attachment-mime-DaInZ9sa.js +1 -0
- package/payload/server/public/assets/{blockDiagram-DXYQGD6D-C3uwaI7p.js → blockDiagram-DXYQGD6D-CQDngnsc.js} +1 -1
- package/payload/server/public/assets/browser-D_hZgtfv.js +1 -0
- package/payload/server/public/assets/{c4Diagram-AHTNJAMY-C8hmUDdd.js → c4Diagram-AHTNJAMY-BjV_YA-L.js} +1 -1
- package/payload/server/public/assets/channel-gFnUr8f4.js +1 -0
- package/payload/server/public/assets/chat-COcrNTJi.js +1 -0
- package/payload/server/public/assets/{chunk-336JU56O-BRCubMCb.js → chunk-336JU56O-B0yBhSVq.js} +2 -2
- package/payload/server/public/assets/{chunk-426QAEUC-BNINkVsL.js → chunk-426QAEUC-BCmWl6vi.js} +1 -1
- package/payload/server/public/assets/{chunk-4TB4RGXK-DSMj_AZh.js → chunk-4TB4RGXK-BImQYhPF.js} +1 -1
- package/payload/server/public/assets/{chunk-5FUZZQ4R-6DNGaUkf.js → chunk-5FUZZQ4R-DrDSHQZv.js} +1 -1
- package/payload/server/public/assets/{chunk-5PVQY5BW-DPhkkS4p.js → chunk-5PVQY5BW-CKX_LIok.js} +1 -1
- package/payload/server/public/assets/{chunk-EDXVE4YY-BjWSqn7_.js → chunk-EDXVE4YY-D1zHB217.js} +1 -1
- package/payload/server/public/assets/{chunk-ENJZ2VHE-BX1ZnU4A.js → chunk-ENJZ2VHE-SFpdtszU.js} +1 -1
- package/payload/server/public/assets/{chunk-ICPOFSXX-DvYSWH7x.js → chunk-ICPOFSXX-cYdq7RKF.js} +1 -1
- package/payload/server/public/assets/{chunk-OYMX7WX6-7_m3mEOK.js → chunk-OYMX7WX6-B7JLCext.js} +1 -1
- package/payload/server/public/assets/{chunk-U2HBQHQK-Bl1a895I.js → chunk-U2HBQHQK-DWCeFwem.js} +1 -1
- package/payload/server/public/assets/{chunk-X2U36JSP-WkSpBPYx.js → chunk-X2U36JSP-DGnHsoJ3.js} +1 -1
- package/payload/server/public/assets/{chunk-YZCP3GAM-DpWRmPUo.js → chunk-YZCP3GAM-sg4lGGJV.js} +1 -1
- package/payload/server/public/assets/{chunk-ZZ45TVLE-D9Dgmeso.js → chunk-ZZ45TVLE-DtUoGmKE.js} +1 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-C_wlfUTz.js +1 -0
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-Ltv5s3OY.js +1 -0
- package/payload/server/public/assets/clone-D0XoXc_v.js +1 -0
- package/payload/server/public/assets/{dagre-PrVfCcSt.js → dagre-Dfj_jbTe.js} +1 -1
- package/payload/server/public/assets/{dagre-KV5264BT-DPq3dcLH.js → dagre-KV5264BT-Bd1VlhUJ.js} +1 -1
- package/payload/server/public/assets/data-DkbQI40a.js +1 -0
- package/payload/server/public/assets/{diagram-5BDNPKRD-DoszElKb.js → diagram-5BDNPKRD-Dqqyk8GE.js} +1 -1
- package/payload/server/public/assets/{diagram-G4DWMVQ6-BRuqosix.js → diagram-G4DWMVQ6-Xk3WKR_U.js} +1 -1
- package/payload/server/public/assets/{diagram-MMDJMWI5-CpigG1d_.js → diagram-MMDJMWI5-CAdGL9U7.js} +1 -1
- package/payload/server/public/assets/{diagram-TYMM5635-BS0eYiq9.js → diagram-TYMM5635-DY1iYQVY.js} +1 -1
- package/payload/server/public/assets/{erDiagram-SMLLAGMA-VEQyXCFl.js → erDiagram-SMLLAGMA-BJ5HYKeb.js} +1 -1
- package/payload/server/public/assets/{file-download-C3pBZjt9.js → file-download-BYJN3Kgm.js} +1 -1
- package/payload/server/public/assets/{flowDiagram-DWJPFMVM-2NYMfqHX.js → flowDiagram-DWJPFMVM-B-q6x5Q_.js} +1 -1
- package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-AAAa2sqE.js → ganttDiagram-T4ZO3ILL-DbjwY_bG.js} +1 -1
- package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-d8NUAIz5.js → gitGraphDiagram-UUTBAWPF-C3bLrOmb.js} +1 -1
- package/payload/server/public/assets/{graph-Bx9_2qbJ.js → graph-DmikPM4A.js} +2 -2
- package/payload/server/public/assets/{graph-labels-Cc1nU1_f.js → graph-labels-CtG6ckdG.js} +1 -1
- package/payload/server/public/assets/{graphlib-DUlqr2mr.js → graphlib-BlOjhixq.js} +1 -1
- package/payload/server/public/assets/{infoDiagram-42DDH7IO-D4dh4-0g.js → infoDiagram-42DDH7IO-BpaHbiXO.js} +1 -1
- package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-DPTmm2IE.js → ishikawaDiagram-UXIWVN3A-B_DzwK8l.js} +1 -1
- package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-B85vjqkE.js → journeyDiagram-VCZTEJTY-COzTF-qc.js} +1 -1
- package/payload/server/public/assets/{jsx-runtime-D3PZpOAF.css → jsx-runtime-BjFkEGXb.css} +1 -1
- package/payload/server/public/assets/{kanban-definition-6JOO6SKY-C2Lfb5Xh.js → kanban-definition-6JOO6SKY-C2cOIZU6.js} +1 -1
- package/payload/server/public/assets/{line-CODKFpwO.js → line-Bwa6aUYZ.js} +1 -1
- package/payload/server/public/assets/{mermaid-parser.core-DYdFZnXH.js → mermaid-parser.core-BFAF0BAk.js} +1 -1
- package/payload/server/public/assets/{mermaid.core-Bamjzahu.js → mermaid.core-CMOXmawT.js} +3 -3
- package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-CLK90bKJ.js → mindmap-definition-QFDTVHPH-bu0QLO17.js} +1 -1
- package/payload/server/public/assets/{pieDiagram-DEJITSTG-DEsnxhqP.js → pieDiagram-DEJITSTG-DQUe6W2Z.js} +1 -1
- package/payload/server/public/assets/{public-BFMu-jux.js → public-CSEIGhb4.js} +5 -5
- package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-uIP9V2jZ.js → quadrantDiagram-34T5L4WZ-ChhcwVRA.js} +1 -1
- package/payload/server/public/assets/{requirementDiagram-MS252O5E-CVS6t5tv.js → requirementDiagram-MS252O5E-DwQXqTA9.js} +1 -1
- package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-BIsmtyZA.js → sankeyDiagram-XADWPNL6-zYqdptBM.js} +1 -1
- package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-Cu8TfQiW.js → sequenceDiagram-FGHM5R23-x2g84gb4.js} +1 -1
- package/payload/server/public/assets/{stateDiagram-FHFEXIEX-ax4vYGft.js → stateDiagram-FHFEXIEX-CeUrqs2P.js} +1 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-B27DBP9X.js +1 -0
- package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-3l7ojkMA.js → timeline-definition-GMOUNBTQ-CL-c9XN5.js} +1 -1
- package/payload/server/public/assets/{useSelectionMode-C_EBRd2k.js → useSelectionMode-C1_ky4B6.js} +1 -1
- package/payload/server/public/assets/{vennDiagram-DHZGUBPP-C_sv0qMD.js → vennDiagram-DHZGUBPP-By2HBDYr.js} +1 -1
- package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-C7u4IHMB.js → wardleyDiagram-NUSXRM2D-iahvFvIS.js} +1 -1
- package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-A-uLXr1a.js → xychartDiagram-5P7HB3ND-33qqdRhI.js} +1 -1
- package/payload/server/public/browser.html +6 -6
- package/payload/server/public/chat.html +8 -8
- package/payload/server/public/data.html +5 -5
- package/payload/server/public/graph.html +8 -8
- package/payload/server/public/index.html +8 -8
- package/payload/server/public/public.html +6 -6
- package/payload/server/public/whatsapp-wallpaper.webp +0 -0
- package/payload/server/server.js +17 -9
- package/payload/server/public/assets/AdminShell-DDieHnzi.js +0 -1
- package/payload/server/public/assets/audio-attachment-mime-DGEfApkA.js +0 -1
- package/payload/server/public/assets/browser-DrJReVEG.js +0 -1
- package/payload/server/public/assets/channel-drVqp11B.js +0 -1
- package/payload/server/public/assets/chat-rJYaCD6C.js +0 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-Dplkw_pj.js +0 -1
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-sJXv1Ihp.js +0 -1
- package/payload/server/public/assets/clone-Q_B6oO0c.js +0 -1
- package/payload/server/public/assets/data-CYyR2m_B.js +0 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-BRv1By5g.js +0 -1
- /package/payload/server/public/assets/{jsx-runtime-5auA0FEj.js → jsx-runtime-UQ0Z6nwN.js} +0 -0
|
@@ -3,6 +3,7 @@ import { writeConfig, writePassword, removeConfig, checkAddressBinding, writeBin
|
|
|
3
3
|
import { describeProvider } from "../lib/providers.js";
|
|
4
4
|
import * as imap from "../lib/imap.js";
|
|
5
5
|
import * as smtp from "../lib/smtp.js";
|
|
6
|
+
import { newProbeToken } from "../lib/setup-probe.js";
|
|
6
7
|
/**
|
|
7
8
|
* Task 432 — operator-initiated ingestion replaces the background poll.
|
|
8
9
|
* Strips any pre-existing email-fetch crontab line written by an older
|
|
@@ -37,6 +38,12 @@ function stripStaleEmailFetchCron() {
|
|
|
37
38
|
}
|
|
38
39
|
export async function emailSetup(params) {
|
|
39
40
|
const { email, password, accountId } = params;
|
|
41
|
+
// Setup-probe lifeline: one token correlates every line this call emits,
|
|
42
|
+
// including the acquired/released census inside the probe helpers. A
|
|
43
|
+
// lifeline that stops mid-sequence names the failing step.
|
|
44
|
+
const token = newProbeToken();
|
|
45
|
+
process.stderr.write(`[email] setup-probe op=request token=${token} domain=${email.split("@")[1] ?? "unknown"}\n`);
|
|
46
|
+
const logResult = (outcome) => process.stderr.write(`[email] setup-probe op=result token=${token} outcome=${outcome}\n`);
|
|
40
47
|
// Resolve the provider once (static map → MX fallback). This runs regardless
|
|
41
48
|
// of supplied hosts, because a Microsoft address must be refused even when the
|
|
42
49
|
// operator hand-enters office365 hosts: the email-plugin IMAP path is dead
|
|
@@ -45,6 +52,7 @@ export async function emailSetup(params) {
|
|
|
45
52
|
const info = await describeProvider(email);
|
|
46
53
|
if (info.status === "redirect") {
|
|
47
54
|
process.stderr.write(`[email] setup-redirect domain=${info.domain} target=${info.plugin} reason=ms-basic-auth-retired\n`);
|
|
55
|
+
logResult("fail");
|
|
48
56
|
return {
|
|
49
57
|
success: false,
|
|
50
58
|
message: `${email} is a Microsoft (Outlook.com / Microsoft 365) address. ${info.reason} Do not retry email-setup for this address — run ${info.registerTool} on the ${info.plugin} plugin to connect it.`,
|
|
@@ -71,6 +79,7 @@ export async function emailSetup(params) {
|
|
|
71
79
|
};
|
|
72
80
|
// Reject if hosts are still empty (unknown provider, user didn't provide)
|
|
73
81
|
if (!config.imapHost) {
|
|
82
|
+
logResult("fail");
|
|
74
83
|
return {
|
|
75
84
|
success: false,
|
|
76
85
|
message: `Cannot infer IMAP host for ${email}. Provide imapHost and smtpHost explicitly.`,
|
|
@@ -78,6 +87,7 @@ export async function emailSetup(params) {
|
|
|
78
87
|
};
|
|
79
88
|
}
|
|
80
89
|
if (!config.smtpHost) {
|
|
90
|
+
logResult("fail");
|
|
81
91
|
return {
|
|
82
92
|
success: false,
|
|
83
93
|
message: `Cannot infer SMTP host for ${email}. Provide smtpHost explicitly.`,
|
|
@@ -88,6 +98,7 @@ export async function emailSetup(params) {
|
|
|
88
98
|
const agentSlug = params.agentSlug ?? "admin";
|
|
89
99
|
const conflicting = await checkAddressBinding(agentAddress, agentSlug);
|
|
90
100
|
if (conflicting) {
|
|
101
|
+
logResult("fail");
|
|
91
102
|
return {
|
|
92
103
|
success: false,
|
|
93
104
|
message: `Email address ${agentAddress} is already bound to agent "${conflicting}". Each email address can only be used by one agent.`,
|
|
@@ -95,25 +106,33 @@ export async function emailSetup(params) {
|
|
|
95
106
|
}
|
|
96
107
|
// Warn about likely misconfigured port/security combinations
|
|
97
108
|
if (config.imapPort === 993 && config.imapSecurity === "starttls") {
|
|
109
|
+
logResult("fail");
|
|
98
110
|
return {
|
|
99
111
|
success: false,
|
|
100
112
|
message: "Port 993 uses implicit TLS, not STARTTLS. Use imapSecurity: 'tls' with port 993, or port 143 with 'starttls'.",
|
|
101
113
|
};
|
|
102
114
|
}
|
|
103
115
|
if (config.smtpPort === 465 && config.smtpSecurity === "starttls") {
|
|
116
|
+
logResult("fail");
|
|
104
117
|
return {
|
|
105
118
|
success: false,
|
|
106
119
|
message: "Port 465 uses implicit TLS, not STARTTLS. Use smtpSecurity: 'tls' with port 465, or port 587 with 'starttls'.",
|
|
107
120
|
};
|
|
108
121
|
}
|
|
109
122
|
// Test IMAP connectivity
|
|
110
|
-
const
|
|
123
|
+
const tImap = Date.now();
|
|
124
|
+
const imapError = await imap.testConnection(config, password, token);
|
|
125
|
+
process.stderr.write(`[email] setup-probe op=probe-imap token=${token} ms=${Date.now() - tImap}\n`);
|
|
111
126
|
if (imapError) {
|
|
127
|
+
logResult("fail");
|
|
112
128
|
return { success: false, message: imapError, providerNotes };
|
|
113
129
|
}
|
|
114
130
|
// Test SMTP connectivity
|
|
115
|
-
const
|
|
131
|
+
const tSmtp = Date.now();
|
|
132
|
+
const smtpError = await smtp.testConnection(config, password, token);
|
|
133
|
+
process.stderr.write(`[email] setup-probe op=probe-smtp token=${token} ms=${Date.now() - tSmtp}\n`);
|
|
116
134
|
if (smtpError) {
|
|
135
|
+
logResult("fail");
|
|
117
136
|
return { success: false, message: smtpError, providerNotes };
|
|
118
137
|
}
|
|
119
138
|
// Both tests passed — persist credentials
|
|
@@ -122,6 +141,7 @@ export async function emailSetup(params) {
|
|
|
122
141
|
await writeConfig(accountId, config);
|
|
123
142
|
}
|
|
124
143
|
catch (err) {
|
|
144
|
+
logResult("fail");
|
|
125
145
|
return {
|
|
126
146
|
success: false,
|
|
127
147
|
message: `IMAP and SMTP connections verified, but failed to store config: ${err instanceof Error ? err.message : String(err)}`,
|
|
@@ -136,6 +156,7 @@ export async function emailSetup(params) {
|
|
|
136
156
|
await removeConfig(accountId);
|
|
137
157
|
}
|
|
138
158
|
catch { /* rollback failed — next setup will MERGE over it */ }
|
|
159
|
+
logResult("fail");
|
|
139
160
|
return {
|
|
140
161
|
success: false,
|
|
141
162
|
message: `IMAP and SMTP connections verified, but failed to store password file: ${err instanceof Error ? err.message : String(err)}`,
|
|
@@ -157,7 +178,7 @@ export async function emailSetup(params) {
|
|
|
157
178
|
// Get inbox count as a confirmation signal
|
|
158
179
|
let inboxCount;
|
|
159
180
|
try {
|
|
160
|
-
inboxCount = await imap.getInboxCount(config, password);
|
|
181
|
+
inboxCount = await imap.getInboxCount(config, password, token);
|
|
161
182
|
}
|
|
162
183
|
catch {
|
|
163
184
|
// Non-fatal — setup still succeeded
|
|
@@ -170,6 +191,7 @@ export async function emailSetup(params) {
|
|
|
170
191
|
const cronNote = cronStripped
|
|
171
192
|
? ` Removed a stale background-fetch crontab line from an earlier setup.`
|
|
172
193
|
: "";
|
|
194
|
+
logResult("ok");
|
|
173
195
|
return {
|
|
174
196
|
success: true,
|
|
175
197
|
message: `Email configured successfully for ${email}.${aliasNote} IMAP and SMTP connections verified.${inboxCount !== undefined ? ` Inbox has ${inboxCount} messages.` : ""}${bindingNote}${ingestNote}${cronNote}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-setup.js","sourceRoot":"","sources":["../../src/tools/email-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EACL,WAAW,EAAE,aAAa,EAAE,YAAY,EACxC,mBAAmB,EAAE,kBAAkB,GACxC,MAAM,uBAAuB,CAAC;AAC/B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uEAAuE;QACzE,CAAC,CAAC,EAAE,CAAC;IACP,SAAS,CAAC,IAAI,CAAC,CAAC;IAChB,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,qCAAqC,KAAK,IAAI,SAAS,uCAAuC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,UAAU,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,EAAE;QACnN,UAAU;QACV,aAAa;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -156,6 +156,21 @@ The previous Haiku classifier was removed in Task 424; the auto-respond binary t
|
|
|
156
156
|
- Email nodes have `scope: "admin"` — never visible to public agents
|
|
157
157
|
- Inbound messages enter the graph only when the operator approves them by eye via `email-ingest`
|
|
158
158
|
|
|
159
|
+
## Setup-Probe Hardening and Observability
|
|
160
|
+
|
|
161
|
+
No `email-setup` execution path — success, credential failure, unreachable host, slow host, or a late socket event minutes after the tool returned — may terminate the email MCP server-host process. Containment has two layers, both in `lib/setup-probe.ts`:
|
|
162
|
+
|
|
163
|
+
- **Per-resource.** Every IMAP client and SMTP transport created by a connection probe (`email-setup`, `email-status`) carries a persistent `'error'` listener for the object's full lifetime, and is closed on every path — including the failure path, where the IMAP client was previously abandoned half-connected. A late socket event is logged and contained instead of crashing the process via Node's unhandled-`'error'` rule.
|
|
164
|
+
- **Process-level last resort.** `uncaughtException`/`unhandledRejection` handlers contain only errors attributable to a probe (stack references `imapflow`/`nodemailer`, or a probe is still open). Any other escaped error preserves the previous behaviour: dump and exit 1. Containment is always logged loudly — it never hides the defect.
|
|
165
|
+
|
|
166
|
+
Log lines (all on stderr, prefix `[email] setup-probe`, correlated by one per-call `token=`):
|
|
167
|
+
|
|
168
|
+
- `op=request domain=<d>` → `op=probe-imap ms=<t>` → `op=probe-smtp ms=<t>` → `op=result outcome=<ok|fail>` — the setup lifeline; a lifeline that stops mid-sequence names the failing step.
|
|
169
|
+
- `op=acquired` / `op=released source=<imap|smtp> socketCount=<n>` — the socket census; a count not returning to baseline is the leak signature.
|
|
170
|
+
- `op=late-event source=<imap|smtp|process> err=<msg> contained=true` — a contained late event; on a live box this line is the evidence trail for the crash-mechanism investigation.
|
|
171
|
+
|
|
172
|
+
Diagnostic path: `grep -E '\[email\] setup-probe' ~/.<brand>/logs/mcp-email-*.log`, cross-referenced with `[mcp-helper] op=exit server=email` in `server.log` for the same window.
|
|
173
|
+
|
|
159
174
|
## OTP Integration
|
|
160
175
|
|
|
161
176
|
Other skills call `email-otp-extract` during service authentication (Anthropic OAuth, Cloudflare setup) with:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: email-composition
|
|
3
|
-
description: "Conversational wrapper around the email plugin tools. Activate when the operator asks to reply to an email, draft a new email, follow up on a thread, or triage outstanding inbox items (e.g. 'reply to Sarah about X', 'email Joel about Y', 'what's outstanding in my inbox'). Orchestrates `email-graph-query`, `email-search`, `email-read`, `email-send`, `email-reply`. Every send is operator-approved — never auto-sends."
|
|
3
|
+
description: "Conversational wrapper around the email plugin tools. Activate when the operator asks to reply to an email, draft a new email, follow up on a thread, or triage outstanding inbox items (e.g. 'reply to Sarah about X', 'email Joel about Y', 'what's outstanding in my inbox'). Orchestrates `email-graph-query`, `email-search`, `email-read`, `email-send`, `email-reply`, `email-draft`, `email-draft-edit`, `email-draft-send`. Every send is operator-approved — never auto-sends. When the operator wants the email left unsent for their own review, the approved draft is saved via email-draft (and revised later via email-draft-edit), never dispatched until an explicit send."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Email composition
|
|
@@ -97,6 +97,8 @@ Every operator edit on the draft (before final approval) is downstream feedback
|
|
|
97
97
|
|
|
98
98
|
### 8. Send
|
|
99
99
|
|
|
100
|
+
If the operator asked for a draft rather than a send, follow "Flow — save to Drafts instead of sending" — call `email-draft`, not `email-reply`/`email-send`.
|
|
101
|
+
|
|
100
102
|
On **explicit** approval, call `email-reply` with:
|
|
101
103
|
|
|
102
104
|
- `messageId` — the parent message ID from step 1. This is the threading anchor; `email-reply` populates `In-Reply-To` and `References` from it so the reply lands inside the existing thread, not as a new conversation.
|
|
@@ -118,6 +120,23 @@ Same as the reply flow with two differences:
|
|
|
118
120
|
|
|
119
121
|
Multi-recipient drafting: if the operator names a single person, use that address. If the operator names a group ("email the team", "everyone from yesterday's viewings"), ask which addresses to include — list candidates if you can resolve them from the graph, otherwise ask the operator to enumerate. Do not invent recipients.
|
|
120
122
|
|
|
123
|
+
## Flow — save to Drafts instead of sending
|
|
124
|
+
|
|
125
|
+
When the operator's stated outcome is a reviewable, unsent email — signalled by intent like "draft it", "leave it in drafts", "don't send yet", "the same as last time but leave it in the draft box", "let me review before sending" — the approval step changes target: the approved draft goes to `email-draft`, not `email-send`/`email-reply`. Everything upstream (thread identification, voice conditioning, the present-and-edit loop) is identical.
|
|
126
|
+
|
|
127
|
+
The outcome that matters: nothing is dispatched, and the operator finds the message in their mailbox's Drafts folder. Confirm by quoting the `email-draft` success line (it names the Drafts folder and the APPEND UID). If the server advertises no Drafts folder, `email-draft` fails naming the mailbox — surface that verbatim; do not fall back to sending.
|
|
128
|
+
|
|
129
|
+
A draft-intent request is still human-in-the-loop: present the draft and run the edit loop before saving, exactly as for a send. For a threaded draft-reply (a draft that should land inside an existing thread when the operator sends it by hand), pass the parent `messageId` to `email-draft`; it stamps `In-Reply-To`/`References` and a `Re:` subject from the parent, exactly like `email-reply`. The subject is taken from the thread, so do not pass one.
|
|
130
|
+
|
|
131
|
+
## Flow — revise or send a stored draft
|
|
132
|
+
|
|
133
|
+
A saved draft carries a Drafts UID (the `email-draft` / `email-draft-edit` confirmation line names it). Use that UID to revise or send the draft later.
|
|
134
|
+
|
|
135
|
+
- **Revise** ("change the draft I have", "update that draft", "fix the second paragraph in the draft"): run the present-and-edit loop on the new content, then call `email-draft-edit` with `targetUid` set to the draft's UID and the full revised fields (same shape as `email-draft`, plus `messageId` if it is a threaded draft). The tool appends the replacement before deleting the old copy, so the draft is never lost mid-revision. Confirm by quoting the success line — it names the folder and the old and new UIDs. Nothing is sent. Emit narration `[email-composition] draft-edited targetUid=<old> newUid=<new>`.
|
|
136
|
+
- **Send** ("send the draft", "send draft <uid>", "go ahead and send the one in drafts"): on **explicit** approval, call `email-draft-send` with the draft's `uid`. Recipients come from the draft's own To/Cc/Bcc headers. The draft leaves the Drafts folder only after SMTP accepts; quote the success line (sent recipients, Message-ID, removal confirmation). If it errors, surface the error verbatim and leave the draft in place — do not retry silently. Emit narration `[email-composition] draft-sent uid=<uid>`.
|
|
137
|
+
|
|
138
|
+
Sending a stored draft is a real send: human-in-the-loop, on explicit operator approval, exactly like `email-reply`/`email-send`.
|
|
139
|
+
|
|
121
140
|
## Flow — triage variant
|
|
122
141
|
|
|
123
142
|
When the operator asks "what's outstanding in my inbox" / "anything I need to deal with" / "what's unread":
|
|
@@ -155,7 +174,7 @@ Hard boundaries — never offer these in this skill, even if asked:
|
|
|
155
174
|
- **List broadcasts** — bulk sends to managed subscriber lists. Not this skill.
|
|
156
175
|
- **Inbox auto-categorisation / labelling** — triage is on demand only.
|
|
157
176
|
- **Calendar follow-up auto-writes** — if a reply confirms a meeting, mention it and let the operator decide whether to write a calendar entry separately.
|
|
158
|
-
- **New MCP tools** — this skill orchestrates the existing
|
|
177
|
+
- **New MCP tools** — this skill orchestrates the existing email tools (`email-graph-query`, `email-search`, `email-read`, `email-send`, `email-reply`, `email-draft`, `email-draft-edit`, `email-draft-send`). Nothing else.
|
|
159
178
|
|
|
160
179
|
## Observability
|
|
161
180
|
|
|
@@ -167,6 +186,9 @@ The skill emits narration at each major step so a session log makes the full dra
|
|
|
167
186
|
| Multiple matches | `[email-composition] ambiguous-thread candidates=<n>` |
|
|
168
187
|
| Draft shown | `[email-composition] draft-presented recipient=<addr> subjectPrefix="<first-60-chars>"` |
|
|
169
188
|
| Send approved | `[email-composition] send-confirmed` |
|
|
189
|
+
| Draft saved (unsent) | `[email-composition] draft-saved folder=<drafts-folder> uid=<uid>` |
|
|
190
|
+
| Draft revised | `[email-composition] draft-edited targetUid=<old> newUid=<new>` |
|
|
191
|
+
| Draft sent from Drafts | `[email-composition] draft-sent uid=<uid>` |
|
|
170
192
|
| Send abandoned | `[email-composition] send-aborted reason=<why>` |
|
|
171
193
|
| Triage list returned | `[email-composition] triage-returned n=<count>` |
|
|
172
194
|
|
|
@@ -175,12 +197,12 @@ The underlying `[email-send]` / `[email-reply]` / `[email-search]` / `[email-gra
|
|
|
175
197
|
Diagnostic on Pi:
|
|
176
198
|
|
|
177
199
|
```
|
|
178
|
-
grep -E '\[email-(composition|reply|send|search|graph-query|read)\]' <session-log>
|
|
200
|
+
grep -E '\[email-(composition|reply|send|draft|search|graph-query|read)\]' <session-log>
|
|
179
201
|
```
|
|
180
202
|
|
|
181
203
|
returns the full chain for any thread.
|
|
182
204
|
|
|
183
205
|
## Dependencies
|
|
184
206
|
|
|
185
|
-
- **Required:** `email` plugin (`email-graph-query`, `email-search`, `email-read`, `email-send`, `email-reply`).
|
|
207
|
+
- **Required:** `email` plugin (`email-graph-query`, `email-search`, `email-read`, `email-send`, `email-reply`, `email-draft`, `email-draft-edit`, `email-draft-send`).
|
|
186
208
|
- **Optional:** `voice-mirror` plugin. If installed, drafts use the operator's style-card and edits are captured as feedback. If absent, drafts fall back to a neutral British business register.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* MCP spawn-tee — parent-side stderr capture + lifecycle observability.
|
|
5
|
+
*
|
|
6
|
+
* Claude Code spawns each MCP server itself; the platform never holds a
|
|
7
|
+
* ChildProcess handle. This wrapper sits between Claude Code and the real
|
|
8
|
+
* MCP server: Claude Code runs `node <this> <real-entry>`, and the wrapper
|
|
9
|
+
* spawns the real entry with `stdio:['inherit','inherit','pipe']` so stdin
|
|
10
|
+
* and stdout (the JSON-RPC channel) pass through byte-identical. Only stderr
|
|
11
|
+
* is intercepted, and only for logging.
|
|
12
|
+
*
|
|
13
|
+
* Because the wrapper IS the helper's parent, it observes the helper's true
|
|
14
|
+
* exit code, signal, and lifetime for every death mode — including a SIGKILL
|
|
15
|
+
* or a transport-layer crash that an in-process handler would miss.
|
|
16
|
+
*
|
|
17
|
+
* Claude Code CLI → wrapper (this file) → child = node <real-entry>
|
|
18
|
+
* child stdin/stdout : inherited (Claude Code pipe, untouched)
|
|
19
|
+
* child stderr : piped → per-date log + per-session log + passthrough
|
|
20
|
+
*
|
|
21
|
+
* Destinations (Task 706):
|
|
22
|
+
* - `${LOG_DIR}/mcp-<name>-stderr-<date>.log` — per-date raw (back-compat;
|
|
23
|
+
* the in-process mcp-stderr-tee and the [mcp-init-error] probe read it).
|
|
24
|
+
* - `${LOG_DIR}/mcp-<name>-<SESSION_ID>.log` — per-session raw + lifecycle
|
|
25
|
+
* lines; wrapper-only, so it never mixes the enumeration copy with the
|
|
26
|
+
* live copy. Authoritative sink. Absent when SESSION_ID is unset
|
|
27
|
+
* (enumeration spawn) — then the per-date file is the fallback.
|
|
28
|
+
* - `server.log` via the loopback log-ingest route — best-effort mirror of
|
|
29
|
+
* the [mcp-helper] lifecycle lines. A dropped POST loses nothing because
|
|
30
|
+
* the per-session file already holds the line (written synchronously).
|
|
31
|
+
*
|
|
32
|
+
* Lifecycle lines, correlation key `session=<id8> server=<name>`:
|
|
33
|
+
* [mcp-helper] op=spawn ... pid= entry=
|
|
34
|
+
* [mcp-helper] op=boot ... head=<first stderr bytes>
|
|
35
|
+
* [mcp-helper] op=exit ... code= signal= lifetimeMs= stderr-tail= (always)
|
|
36
|
+
*
|
|
37
|
+
* The wrapper never writes to fd 1 (stdout) — that is the JSON-RPC channel.
|
|
38
|
+
* SIGTERM/SIGINT are forwarded to the child so a Claude Code shutdown does
|
|
39
|
+
* not orphan it; the child exit code/signal is propagated verbatim.
|
|
40
|
+
*/
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
const node_child_process_1 = require("node:child_process");
|
|
43
|
+
const node_fs_1 = require("node:fs");
|
|
44
|
+
const node_path_1 = require("node:path");
|
|
45
|
+
const SERVER_NAME = process.env.MCP_SPAWN_TEE_NAME ?? "unknown";
|
|
46
|
+
const LOG_DIR = process.env.LOG_DIR;
|
|
47
|
+
const SESSION_ID = process.env.SESSION_ID;
|
|
48
|
+
const PLATFORM_PORT = process.env.PLATFORM_PORT;
|
|
49
|
+
const ENTRY = process.argv[2];
|
|
50
|
+
const SESSION_ID8 = SESSION_ID ? SESSION_ID.slice(0, 8) : "—";
|
|
51
|
+
const spawnStamp = Date.now();
|
|
52
|
+
// Per-session raw + lifecycle log (Task 706). Wrapper-only. Empty SESSION_ID
|
|
53
|
+
// (enumeration spawn) → undefined, and the per-date file is the fallback.
|
|
54
|
+
const perSessionPath = LOG_DIR && SESSION_ID
|
|
55
|
+
? (0, node_path_1.resolve)(LOG_DIR, `mcp-${SERVER_NAME}-${SESSION_ID}.log`)
|
|
56
|
+
: undefined;
|
|
57
|
+
const perDatePath = LOG_DIR
|
|
58
|
+
? (0, node_path_1.resolve)(LOG_DIR, `mcp-${SERVER_NAME}-stderr-${new Date(spawnStamp).toISOString().slice(0, 10)}.log`)
|
|
59
|
+
: undefined;
|
|
60
|
+
// Rolling tail of child stderr for op=exit. Capped so a chatty child cannot
|
|
61
|
+
// grow the buffer without bound.
|
|
62
|
+
const TAIL_CAP = 2048;
|
|
63
|
+
let stderrTail = "";
|
|
64
|
+
let bootEmitted = false;
|
|
65
|
+
function appendSafe(path, data) {
|
|
66
|
+
if (!path || !LOG_DIR)
|
|
67
|
+
return;
|
|
68
|
+
try {
|
|
69
|
+
(0, node_fs_1.mkdirSync)(LOG_DIR, { recursive: true });
|
|
70
|
+
(0, node_fs_1.appendFileSync)(path, data);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
/* unwritable destination — never mask primary output */
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Best-effort mirror of a lifecycle line to server.log via the loopback
|
|
77
|
+
// log-ingest route. Fire-and-forget: the per-session file is authoritative,
|
|
78
|
+
// so a dropped POST (unreachable port, process exiting) loses nothing.
|
|
79
|
+
function postToServerLog(suffix, level) {
|
|
80
|
+
if (!PLATFORM_PORT)
|
|
81
|
+
return;
|
|
82
|
+
try {
|
|
83
|
+
const ctrl = new AbortController();
|
|
84
|
+
const t = setTimeout(() => ctrl.abort(), 500);
|
|
85
|
+
t.unref?.(); // never let the abort timer keep the wrapper's event loop alive
|
|
86
|
+
void fetch(`http://127.0.0.1:${PLATFORM_PORT}/api/admin/log-ingest`, {
|
|
87
|
+
method: "POST",
|
|
88
|
+
headers: { "content-type": "application/json" },
|
|
89
|
+
body: JSON.stringify({ tag: "mcp-helper", level, line: suffix }),
|
|
90
|
+
signal: ctrl.signal,
|
|
91
|
+
}).then(() => clearTimeout(t)).catch(() => clearTimeout(t));
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
/* fetch threw synchronously — best-effort only */
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Emit one [mcp-helper] lifecycle line: authoritative per-session file (sync,
|
|
98
|
+
// survives process.exit), the wrapper's own stderr (journald / Claude Code
|
|
99
|
+
// visibility), and a best-effort server.log mirror. `suffix` is the line body
|
|
100
|
+
// after the tag and carries no newline (the log-ingest route rejects newlines).
|
|
101
|
+
function emitLifecycle(suffix, level) {
|
|
102
|
+
const line = `[mcp-helper] ${suffix}\n`;
|
|
103
|
+
appendSafe(perSessionPath, line);
|
|
104
|
+
try {
|
|
105
|
+
process.stderr.write(line);
|
|
106
|
+
}
|
|
107
|
+
catch { /* stderr closed */ }
|
|
108
|
+
postToServerLog(suffix, level);
|
|
109
|
+
}
|
|
110
|
+
if (!ENTRY) {
|
|
111
|
+
emitLifecycle(`op=error session=${SESSION_ID8} server=${SERVER_NAME} reason="no entry given (argv[2] missing)"`, "error");
|
|
112
|
+
process.exit(2);
|
|
113
|
+
}
|
|
114
|
+
const child = (0, node_child_process_1.spawn)(process.execPath, [ENTRY], {
|
|
115
|
+
stdio: ["inherit", "inherit", "pipe"],
|
|
116
|
+
env: process.env,
|
|
117
|
+
});
|
|
118
|
+
emitLifecycle(`op=spawn session=${SESSION_ID8} server=${SERVER_NAME} pid=${child.pid ?? -1} entry=${ENTRY}`, "info");
|
|
119
|
+
child.on("error", (err) => {
|
|
120
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
121
|
+
emitLifecycle(`op=error session=${SESSION_ID8} server=${SERVER_NAME} reason=${JSON.stringify(`spawn error: ${msg}`)}`, "error");
|
|
122
|
+
process.exit(127);
|
|
123
|
+
});
|
|
124
|
+
if (child.stderr) {
|
|
125
|
+
child.stderr.on("data", (chunk) => {
|
|
126
|
+
appendSafe(perDatePath, chunk); // per-date raw (back-compat)
|
|
127
|
+
appendSafe(perSessionPath, chunk); // per-session raw (Task 706)
|
|
128
|
+
try {
|
|
129
|
+
process.stderr.write(chunk);
|
|
130
|
+
}
|
|
131
|
+
catch { /* stderr closed */ } // passthrough
|
|
132
|
+
stderrTail = (stderrTail + chunk.toString("utf8")).slice(-TAIL_CAP);
|
|
133
|
+
if (!bootEmitted) {
|
|
134
|
+
bootEmitted = true;
|
|
135
|
+
const head = chunk.toString("utf8").split("\n")[0].slice(0, 200);
|
|
136
|
+
emitLifecycle(`op=boot session=${SESSION_ID8} server=${SERVER_NAME} head=${JSON.stringify(head)}`, "info");
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
const forward = (signal) => { if (!child.killed)
|
|
141
|
+
child.kill(signal); };
|
|
142
|
+
process.on("SIGTERM", () => forward("SIGTERM"));
|
|
143
|
+
process.on("SIGINT", () => forward("SIGINT"));
|
|
144
|
+
// Signal → number, so a signal-killed child propagates as 128+signum (the
|
|
145
|
+
// shell convention). `code` is null on a signal exit, so `128 + (code ?? 0)`
|
|
146
|
+
// would collapse every signal to 128 and lose the signal identity in the
|
|
147
|
+
// wrapper's own exit status.
|
|
148
|
+
const SIGNUM = { SIGHUP: 1, SIGINT: 2, SIGQUIT: 3, SIGKILL: 9, SIGTERM: 15 };
|
|
149
|
+
child.on("exit", (code, signal) => {
|
|
150
|
+
const lifetimeMs = Date.now() - spawnStamp;
|
|
151
|
+
const tail = stderrTail.slice(-200);
|
|
152
|
+
const level = signal || (code ?? 0) !== 0 ? "error" : "info";
|
|
153
|
+
emitLifecycle(`op=exit session=${SESSION_ID8} server=${SERVER_NAME} pid=${child.pid ?? -1} ` +
|
|
154
|
+
`code=${code ?? "—"} signal=${signal ?? "—"} lifetimeMs=${lifetimeMs} stderr-tail=${JSON.stringify(tail)}`, level);
|
|
155
|
+
if (signal)
|
|
156
|
+
process.exit(128 + (SIGNUM[signal] ?? 0));
|
|
157
|
+
process.exit(code ?? 0);
|
|
158
|
+
});
|
|
159
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* MCP spawn-tee — parent-side stderr capture + lifecycle observability.
|
|
5
|
+
*
|
|
6
|
+
* Claude Code spawns each MCP server itself; the platform never holds a
|
|
7
|
+
* ChildProcess handle. This wrapper sits between Claude Code and the real
|
|
8
|
+
* MCP server: Claude Code runs `node <this> <real-entry>`, and the wrapper
|
|
9
|
+
* spawns the real entry with `stdio:['inherit','inherit','pipe']` so stdin
|
|
10
|
+
* and stdout (the JSON-RPC channel) pass through byte-identical. Only stderr
|
|
11
|
+
* is intercepted, and only for logging.
|
|
12
|
+
*
|
|
13
|
+
* Because the wrapper IS the helper's parent, it observes the helper's true
|
|
14
|
+
* exit code, signal, and lifetime for every death mode — including a SIGKILL
|
|
15
|
+
* or a transport-layer crash that an in-process handler would miss.
|
|
16
|
+
*
|
|
17
|
+
* Claude Code CLI → wrapper (this file) → child = node <real-entry>
|
|
18
|
+
* child stdin/stdout : inherited (Claude Code pipe, untouched)
|
|
19
|
+
* child stderr : piped → per-date log + per-session log + passthrough
|
|
20
|
+
*
|
|
21
|
+
* Destinations (Task 706):
|
|
22
|
+
* - `${LOG_DIR}/mcp-<name>-stderr-<date>.log` — per-date raw (back-compat;
|
|
23
|
+
* the in-process mcp-stderr-tee and the [mcp-init-error] probe read it).
|
|
24
|
+
* - `${LOG_DIR}/mcp-<name>-<SESSION_ID>.log` — per-session raw + lifecycle
|
|
25
|
+
* lines; wrapper-only, so it never mixes the enumeration copy with the
|
|
26
|
+
* live copy. Authoritative sink. Absent when SESSION_ID is unset
|
|
27
|
+
* (enumeration spawn) — then the per-date file is the fallback.
|
|
28
|
+
* - `server.log` via the loopback log-ingest route — best-effort mirror of
|
|
29
|
+
* the [mcp-helper] lifecycle lines. A dropped POST loses nothing because
|
|
30
|
+
* the per-session file already holds the line (written synchronously).
|
|
31
|
+
*
|
|
32
|
+
* Lifecycle lines, correlation key `session=<id8> server=<name>`:
|
|
33
|
+
* [mcp-helper] op=spawn ... pid= entry=
|
|
34
|
+
* [mcp-helper] op=boot ... head=<first stderr bytes>
|
|
35
|
+
* [mcp-helper] op=exit ... code= signal= lifetimeMs= stderr-tail= (always)
|
|
36
|
+
*
|
|
37
|
+
* The wrapper never writes to fd 1 (stdout) — that is the JSON-RPC channel.
|
|
38
|
+
* SIGTERM/SIGINT are forwarded to the child so a Claude Code shutdown does
|
|
39
|
+
* not orphan it; the child exit code/signal is propagated verbatim.
|
|
40
|
+
*/
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
const node_child_process_1 = require("node:child_process");
|
|
43
|
+
const node_fs_1 = require("node:fs");
|
|
44
|
+
const node_path_1 = require("node:path");
|
|
45
|
+
const SERVER_NAME = process.env.MCP_SPAWN_TEE_NAME ?? "unknown";
|
|
46
|
+
const LOG_DIR = process.env.LOG_DIR;
|
|
47
|
+
const SESSION_ID = process.env.SESSION_ID;
|
|
48
|
+
const PLATFORM_PORT = process.env.PLATFORM_PORT;
|
|
49
|
+
const ENTRY = process.argv[2];
|
|
50
|
+
const SESSION_ID8 = SESSION_ID ? SESSION_ID.slice(0, 8) : "—";
|
|
51
|
+
const spawnStamp = Date.now();
|
|
52
|
+
// Per-session raw + lifecycle log (Task 706). Wrapper-only. Empty SESSION_ID
|
|
53
|
+
// (enumeration spawn) → undefined, and the per-date file is the fallback.
|
|
54
|
+
const perSessionPath = LOG_DIR && SESSION_ID
|
|
55
|
+
? (0, node_path_1.resolve)(LOG_DIR, `mcp-${SERVER_NAME}-${SESSION_ID}.log`)
|
|
56
|
+
: undefined;
|
|
57
|
+
const perDatePath = LOG_DIR
|
|
58
|
+
? (0, node_path_1.resolve)(LOG_DIR, `mcp-${SERVER_NAME}-stderr-${new Date(spawnStamp).toISOString().slice(0, 10)}.log`)
|
|
59
|
+
: undefined;
|
|
60
|
+
// Rolling tail of child stderr for op=exit. Capped so a chatty child cannot
|
|
61
|
+
// grow the buffer without bound.
|
|
62
|
+
const TAIL_CAP = 2048;
|
|
63
|
+
let stderrTail = "";
|
|
64
|
+
let bootEmitted = false;
|
|
65
|
+
function appendSafe(path, data) {
|
|
66
|
+
if (!path || !LOG_DIR)
|
|
67
|
+
return;
|
|
68
|
+
try {
|
|
69
|
+
(0, node_fs_1.mkdirSync)(LOG_DIR, { recursive: true });
|
|
70
|
+
(0, node_fs_1.appendFileSync)(path, data);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
/* unwritable destination — never mask primary output */
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Best-effort mirror of a lifecycle line to server.log via the loopback
|
|
77
|
+
// log-ingest route. Fire-and-forget: the per-session file is authoritative,
|
|
78
|
+
// so a dropped POST (unreachable port, process exiting) loses nothing.
|
|
79
|
+
function postToServerLog(suffix, level) {
|
|
80
|
+
if (!PLATFORM_PORT)
|
|
81
|
+
return;
|
|
82
|
+
try {
|
|
83
|
+
const ctrl = new AbortController();
|
|
84
|
+
const t = setTimeout(() => ctrl.abort(), 500);
|
|
85
|
+
t.unref?.(); // never let the abort timer keep the wrapper's event loop alive
|
|
86
|
+
void fetch(`http://127.0.0.1:${PLATFORM_PORT}/api/admin/log-ingest`, {
|
|
87
|
+
method: "POST",
|
|
88
|
+
headers: { "content-type": "application/json" },
|
|
89
|
+
body: JSON.stringify({ tag: "mcp-helper", level, line: suffix }),
|
|
90
|
+
signal: ctrl.signal,
|
|
91
|
+
}).then(() => clearTimeout(t)).catch(() => clearTimeout(t));
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
/* fetch threw synchronously — best-effort only */
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Emit one [mcp-helper] lifecycle line: authoritative per-session file (sync,
|
|
98
|
+
// survives process.exit), the wrapper's own stderr (journald / Claude Code
|
|
99
|
+
// visibility), and a best-effort server.log mirror. `suffix` is the line body
|
|
100
|
+
// after the tag and carries no newline (the log-ingest route rejects newlines).
|
|
101
|
+
function emitLifecycle(suffix, level) {
|
|
102
|
+
const line = `[mcp-helper] ${suffix}\n`;
|
|
103
|
+
appendSafe(perSessionPath, line);
|
|
104
|
+
try {
|
|
105
|
+
process.stderr.write(line);
|
|
106
|
+
}
|
|
107
|
+
catch { /* stderr closed */ }
|
|
108
|
+
postToServerLog(suffix, level);
|
|
109
|
+
}
|
|
110
|
+
if (!ENTRY) {
|
|
111
|
+
emitLifecycle(`op=error session=${SESSION_ID8} server=${SERVER_NAME} reason="no entry given (argv[2] missing)"`, "error");
|
|
112
|
+
process.exit(2);
|
|
113
|
+
}
|
|
114
|
+
const child = (0, node_child_process_1.spawn)(process.execPath, [ENTRY], {
|
|
115
|
+
stdio: ["inherit", "inherit", "pipe"],
|
|
116
|
+
env: process.env,
|
|
117
|
+
});
|
|
118
|
+
emitLifecycle(`op=spawn session=${SESSION_ID8} server=${SERVER_NAME} pid=${child.pid ?? -1} entry=${ENTRY}`, "info");
|
|
119
|
+
child.on("error", (err) => {
|
|
120
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
121
|
+
emitLifecycle(`op=error session=${SESSION_ID8} server=${SERVER_NAME} reason=${JSON.stringify(`spawn error: ${msg}`)}`, "error");
|
|
122
|
+
process.exit(127);
|
|
123
|
+
});
|
|
124
|
+
if (child.stderr) {
|
|
125
|
+
child.stderr.on("data", (chunk) => {
|
|
126
|
+
appendSafe(perDatePath, chunk); // per-date raw (back-compat)
|
|
127
|
+
appendSafe(perSessionPath, chunk); // per-session raw (Task 706)
|
|
128
|
+
try {
|
|
129
|
+
process.stderr.write(chunk);
|
|
130
|
+
}
|
|
131
|
+
catch { /* stderr closed */ } // passthrough
|
|
132
|
+
stderrTail = (stderrTail + chunk.toString("utf8")).slice(-TAIL_CAP);
|
|
133
|
+
if (!bootEmitted) {
|
|
134
|
+
bootEmitted = true;
|
|
135
|
+
const head = chunk.toString("utf8").split("\n")[0].slice(0, 200);
|
|
136
|
+
emitLifecycle(`op=boot session=${SESSION_ID8} server=${SERVER_NAME} head=${JSON.stringify(head)}`, "info");
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
const forward = (signal) => { if (!child.killed)
|
|
141
|
+
child.kill(signal); };
|
|
142
|
+
process.on("SIGTERM", () => forward("SIGTERM"));
|
|
143
|
+
process.on("SIGINT", () => forward("SIGINT"));
|
|
144
|
+
// Signal → number, so a signal-killed child propagates as 128+signum (the
|
|
145
|
+
// shell convention). `code` is null on a signal exit, so `128 + (code ?? 0)`
|
|
146
|
+
// would collapse every signal to 128 and lose the signal identity in the
|
|
147
|
+
// wrapper's own exit status.
|
|
148
|
+
const SIGNUM = { SIGHUP: 1, SIGINT: 2, SIGQUIT: 3, SIGKILL: 9, SIGTERM: 15 };
|
|
149
|
+
child.on("exit", (code, signal) => {
|
|
150
|
+
const lifetimeMs = Date.now() - spawnStamp;
|
|
151
|
+
const tail = stderrTail.slice(-200);
|
|
152
|
+
const level = signal || (code ?? 0) !== 0 ? "error" : "info";
|
|
153
|
+
emitLifecycle(`op=exit session=${SESSION_ID8} server=${SERVER_NAME} pid=${child.pid ?? -1} ` +
|
|
154
|
+
`code=${code ?? "—"} signal=${signal ?? "—"} lifetimeMs=${lifetimeMs} stderr-tail=${JSON.stringify(tail)}`, level);
|
|
155
|
+
if (signal)
|
|
156
|
+
process.exit(128 + (SIGNUM[signal] ?? 0));
|
|
157
|
+
process.exit(code ?? 0);
|
|
158
|
+
});
|
|
159
|
+
//# sourceMappingURL=index.js.map
|