@datasynx/agentic-crm 0.1.0 → 1.1.0
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/README.md +270 -669
- package/dist/{approvals-DpjxGHFp.js → approvals-CmDT2eUg.js} +7 -24
- package/dist/approvals-CmDT2eUg.js.map +1 -0
- package/dist/{ask-CID3jnuL.js → ask-CDysGnRg.js} +6 -6
- package/dist/{ask-CID3jnuL.js.map → ask-CDysGnRg.js.map} +1 -1
- package/dist/atomic-write-8yjqqLtS.js +29 -0
- package/dist/atomic-write-8yjqqLtS.js.map +1 -0
- package/dist/atomic-write-BYmF-ThH.cjs +37 -0
- package/dist/atomic-write-BYmF-ThH.cjs.map +1 -0
- package/dist/attachments-CX2GAtsw.cjs +517 -0
- package/dist/attachments-CX2GAtsw.cjs.map +1 -0
- package/dist/attachments-D207gXfN.js +514 -0
- package/dist/attachments-D207gXfN.js.map +1 -0
- package/dist/attachments-rLa96rOK.js +514 -0
- package/dist/attachments-rLa96rOK.js.map +1 -0
- package/dist/auth-B5DcjJ_6.js +2 -0
- package/dist/{auth-DFWwWcYD.js → auth-DDXZTwS0.js} +4 -13
- package/dist/auth-DDXZTwS0.js.map +1 -0
- package/dist/{autofill-Di_-SP7t.js → autofill-B9VtlR2j.js} +2 -2
- package/dist/{autofill-Di_-SP7t.js.map → autofill-B9VtlR2j.js.map} +1 -1
- package/dist/{backup-CeMk9z86.js → backup-CTlIxUdO.js} +5 -7
- package/dist/backup-CTlIxUdO.js.map +1 -0
- package/dist/backup-LFnC09oV.js +2 -0
- package/dist/chunk-BfDYWZQ8.cjs +32 -0
- package/dist/chunk-BfDYWZQ8.cjs.map +1 -0
- package/dist/chunk-BhUZmQg5.js +32 -0
- package/dist/chunk-BhUZmQg5.js.map +1 -0
- package/dist/chunk-ChC83jai.js +2 -0
- package/dist/chunk-e_w8qqtP.js +32 -0
- package/dist/chunk-e_w8qqtP.js.map +1 -0
- package/dist/{churn-C28IgnAj.js → churn-DN9WDGNM.js} +3 -3
- package/dist/{churn-C28IgnAj.js.map → churn-DN9WDGNM.js.map} +1 -1
- package/dist/cli.js +285 -186
- package/dist/cli.js.map +1 -1
- package/dist/{compliance-CKSBoQUe.js → compliance-Bc12Hn9a.js} +3 -3
- package/dist/{compliance-CKSBoQUe.js.map → compliance-Bc12Hn9a.js.map} +1 -1
- package/dist/{compliance-CujOqAKk.js → compliance-TqYQXhBj.js} +1 -1
- package/dist/{compliance-B1kk5-YS.js → compliance-kq0xHRw3.js} +3 -3
- package/dist/{compliance-B1kk5-YS.js.map → compliance-kq0xHRw3.js.map} +1 -1
- package/dist/{compliance-B91zNvCR.cjs → compliance-pAj9FcGI.cjs} +3 -3
- package/dist/{compliance-B91zNvCR.cjs.map → compliance-pAj9FcGI.cjs.map} +1 -1
- package/dist/{context-builder-BzWAp3Zs.js → context-builder-7Uab5-G4.js} +3 -2
- package/dist/context-builder-7Uab5-G4.js.map +1 -0
- package/dist/context-builder-hmOPvgso.js +2 -0
- package/dist/{custom-fields-CzNeD3_v.js → custom-fields-BMyz5Ruh.js} +1 -1
- package/dist/{custom-fields-Pl2t9xzp.js → custom-fields-GzpOHW_2.js} +4 -13
- package/dist/custom-fields-GzpOHW_2.js.map +1 -0
- package/dist/{custom-objects-CIFrmQ2V.js → custom-objects-BNy-ayR-.js} +1 -1
- package/dist/{custom-objects-BHgn1GEX.js → custom-objects-CxW1gHwJ.js} +10 -25
- package/dist/custom-objects-CxW1gHwJ.js.map +1 -0
- package/dist/{customer-dir-DIylZ8Q6.js → customer-dir-CkMMXhb0.js} +9 -4
- package/dist/customer-dir-CkMMXhb0.js.map +1 -0
- package/dist/daemon/worker.js +66 -40
- package/dist/daemon/worker.js.map +1 -1
- package/dist/doctor-C14-vnJ1.js +103 -0
- package/dist/doctor-C14-vnJ1.js.map +1 -0
- package/dist/email-body-BFSRa0AW.cjs +42 -0
- package/dist/email-body-BFSRa0AW.cjs.map +1 -0
- package/dist/email-body-BOd7U-D2.js +42 -0
- package/dist/email-body-BOd7U-D2.js.map +1 -0
- package/dist/{enrichment-3XvgGDfB.js → enrichment-CDFdWmvD.js} +3 -3
- package/dist/{enrichment-3XvgGDfB.js.map → enrichment-CDFdWmvD.js.map} +1 -1
- package/dist/{file-lock-B_zi7NQl.js → file-lock-CcHotQkZ.js} +3 -4
- package/dist/file-lock-CcHotQkZ.js.map +1 -0
- package/dist/{gmail-sync-DIaxInDT.js → gmail-sync-B4Iu3AQb.js} +56 -22
- package/dist/gmail-sync-B4Iu3AQb.js.map +1 -0
- package/dist/{gmail-sync-hHm9gaWd.cjs → gmail-sync-BpSVESSe.cjs} +55 -21
- package/dist/gmail-sync-BpSVESSe.cjs.map +1 -0
- package/dist/{gmail-sync-rQaVqKWd.js → gmail-sync-DIbrPnTK.js} +55 -21
- package/dist/gmail-sync-DIbrPnTK.js.map +1 -0
- package/dist/{gmail-webhook-handler-e5Od25FX.js → gmail-webhook-handler-BzOFbvgh.js} +4 -4
- package/dist/{gmail-webhook-handler-e5Od25FX.js.map → gmail-webhook-handler-BzOFbvgh.js.map} +1 -1
- package/dist/{gmail-webhook-handler-DS7OlRPX.js → gmail-webhook-handler-CvSDW_Js.js} +2 -2
- package/dist/{goal-engine-KpBftn4V.js → goal-engine-BbroPhqm.js} +10 -11
- package/dist/goal-engine-BbroPhqm.js.map +1 -0
- package/dist/{goal-engine-CUZSpERI.js → goal-engine-CfDAJTFt.js} +1 -1
- package/dist/{google-drive-sync-DEPcqFca.js → google-drive-sync-B_I1d54Y.js} +3 -3
- package/dist/{google-drive-sync-DEPcqFca.js.map → google-drive-sync-B_I1d54Y.js.map} +1 -1
- package/dist/html-BaeOCZKE.js +36 -0
- package/dist/html-BaeOCZKE.js.map +1 -0
- package/dist/html-CmOku6jS.cjs +47 -0
- package/dist/html-CmOku6jS.cjs.map +1 -0
- package/dist/{hygiene-DZqfYpFf.js → hygiene-DzQPnc6P.js} +3 -3
- package/dist/{hygiene-DZqfYpFf.js.map → hygiene-DzQPnc6P.js.map} +1 -1
- package/dist/identity-CB7j-Zr1.js +2 -0
- package/dist/{identity-CI6olMNm.js → identity-_uZ3Lbr2.js} +2 -2
- package/dist/{identity-CI6olMNm.js.map → identity-_uZ3Lbr2.js.map} +1 -1
- package/dist/{import-hubspot-BaK71U_K.js → import-hubspot-CTId9IGV.js} +51 -45
- package/dist/import-hubspot-CTId9IGV.js.map +1 -0
- package/dist/{index-YqwMd6aQ.d.cts → index-BAutNcAT.d.cts} +20 -12
- package/dist/index-BAutNcAT.d.cts.map +1 -0
- package/dist/{index-V8BFaH-b.d.ts → index-FzDsNSSb.d.ts} +12 -4
- package/dist/index-FzDsNSSb.d.ts.map +1 -0
- package/dist/index.cjs +19 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -12
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -21
- package/dist/index.js.map +1 -1
- package/dist/interactions-writer-B2y-73lh.js +2 -0
- package/dist/{interactions-writer-SLHnoEeE.js → interactions-writer-B8XAzdqR.js} +34 -4
- package/dist/interactions-writer-B8XAzdqR.js.map +1 -0
- package/dist/{interactions-writer-CrPStUll.cjs → interactions-writer-BRJNrefF.cjs} +7 -3
- package/dist/interactions-writer-BRJNrefF.cjs.map +1 -0
- package/dist/{interactions-writer-DO3KcSR3.js → interactions-writer-ZQcpFOh9.js} +7 -3
- package/dist/interactions-writer-ZQcpFOh9.js.map +1 -0
- package/dist/json-store-WWsFzXub.js +43 -0
- package/dist/json-store-WWsFzXub.js.map +1 -0
- package/dist/{knowledge-base-D0Fh40kc.js → knowledge-base--063Kpa3.js} +51 -22
- package/dist/knowledge-base--063Kpa3.js.map +1 -0
- package/dist/{lancedb-CCBbpulq.js → lancedb-CswQEE5K.js} +1 -1
- package/dist/{lancedb-rlvWoPwl.js → lancedb-CuHKNsNZ.js} +4 -3
- package/dist/lancedb-CuHKNsNZ.js.map +1 -0
- package/dist/{lead-model-BCFzyktm.js → lead-model-CEmx7te7.js} +6 -14
- package/dist/lead-model-CEmx7te7.js.map +1 -0
- package/dist/{llm-Z8RIYkpF.js → llm-BnSUBisu.js} +2 -2
- package/dist/{llm-Z8RIYkpF.js.map → llm-BnSUBisu.js.map} +1 -1
- package/dist/{llm-iijeXmgq.cjs → llm-CXycmEl9.cjs} +2 -2
- package/dist/{llm-iijeXmgq.cjs.map → llm-CXycmEl9.cjs.map} +1 -1
- package/dist/{llm-DEjWcqmW.js → llm-DSX1-wFu.js} +1 -1
- package/dist/{llm-DvzZqva0.js → llm-PZzgPphl.js} +3 -3
- package/dist/{llm-DvzZqva0.js.map → llm-PZzgPphl.js.map} +1 -1
- package/dist/logger-BkInaGoV.cjs +167 -0
- package/dist/logger-BkInaGoV.cjs.map +1 -0
- package/dist/logger-Dyl4VcLO.js +147 -0
- package/dist/logger-Dyl4VcLO.js.map +1 -0
- package/dist/logger-UaF5p9d1.js +147 -0
- package/dist/logger-UaF5p9d1.js.map +1 -0
- package/dist/logger-vKQS34w9.js +2 -0
- package/dist/mcp-CdTJWTJf.d.cts.map +1 -1
- package/dist/mcp-CdTJWTJf.d.ts.map +1 -1
- package/dist/mcp.cjs +365 -319
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts.map +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +365 -319
- package/dist/mcp.js.map +1 -1
- package/dist/{memory-Cy6-Tbyl.js → memory-D8hmgD9d.js} +1 -1
- package/dist/{memory-Bb6ky3kb.js → memory-Dzr9dXSM.js} +4 -11
- package/dist/memory-Dzr9dXSM.js.map +1 -0
- package/dist/{microsoft-calendar-B6MMtUQK.js → microsoft-calendar-BgVR8GDv.js} +4 -4
- package/dist/{microsoft-calendar-B6MMtUQK.js.map → microsoft-calendar-BgVR8GDv.js.map} +1 -1
- package/dist/{microsoft-sync-CpZVoSuq.js → microsoft-sync-D30_XksI.js} +5 -5
- package/dist/{microsoft-sync-CpZVoSuq.js.map → microsoft-sync-D30_XksI.js.map} +1 -1
- package/dist/{nba-3wanmJ0U.js → nba-DwdfM93s.js} +3 -3
- package/dist/{nba-3wanmJ0U.js.map → nba-DwdfM93s.js.map} +1 -1
- package/dist/{notification-dispatcher-0vYNngWe.js → notification-dispatcher-inpKyuBz.js} +7 -3
- package/dist/notification-dispatcher-inpKyuBz.js.map +1 -0
- package/dist/{pipeline-writer-BqBrYrQc.js → pipeline-writer-0LJ6Qkat.js} +1 -1
- package/dist/{pipeline-writer-N2omexxp.cjs → pipeline-writer-B1tRAhuD.cjs} +11 -3
- package/dist/pipeline-writer-B1tRAhuD.cjs.map +1 -0
- package/dist/{pipeline-writer-BvVquKIe.js → pipeline-writer-CIllfnZl.js} +5 -3
- package/dist/pipeline-writer-CIllfnZl.js.map +1 -0
- package/dist/{pipeline-writer-eufx_0o1.js → pipeline-writer-rDj-ni6q.js} +6 -4
- package/dist/pipeline-writer-rDj-ni6q.js.map +1 -0
- package/dist/{proactive-agent-BgQXw3ac.js → proactive-agent-B7u3Bj_l.js} +6 -6
- package/dist/{proactive-agent-BgQXw3ac.js.map → proactive-agent-B7u3Bj_l.js.map} +1 -1
- package/dist/{proactive-worker-BrLHNhjH.js → proactive-worker-1zkm6aJD.js} +7 -8
- package/dist/proactive-worker-1zkm6aJD.js.map +1 -0
- package/dist/{push-manager-CowY-0IK.js → push-manager-BXM-IHfP.js} +1 -1
- package/dist/{push-manager-CdqIIkuh.js → push-manager-C0ECQgva.js} +4 -4
- package/dist/push-manager-C0ECQgva.js.map +1 -0
- package/dist/{quote-generator-OhSFsi3x.js → quote-generator-ByUyIYtw.js} +1 -1
- package/dist/{quote-generator-BfwENXzg.js → quote-generator-CTdR8eEI.js} +5 -5
- package/dist/quote-generator-CTdR8eEI.js.map +1 -0
- package/dist/rbac-DzbyFhVH.js +2 -0
- package/dist/{rbac-CTIktZaC.js → rbac-msmBc_tK.js} +19 -12
- package/dist/rbac-msmBc_tK.js.map +1 -0
- package/dist/regex-Jt5DatPi.js +13 -0
- package/dist/regex-Jt5DatPi.js.map +1 -0
- package/dist/{relationship-health-odxEoQdJ.js → relationship-health-ZZNXR1RZ.js} +8 -16
- package/dist/relationship-health-ZZNXR1RZ.js.map +1 -0
- package/dist/{revenue-simulation-Bqf2DLVB.js → revenue-simulation-D8f_YkUY.js} +9 -19
- package/dist/revenue-simulation-D8f_YkUY.js.map +1 -0
- package/dist/{revenue-simulation-BJdRTEHc.js → revenue-simulation-njJZlTqm.js} +1 -1
- package/dist/safe-path-mpp0dKtO.js +18 -0
- package/dist/safe-path-mpp0dKtO.js.map +1 -0
- package/dist/{segments-BqcD5HIl.js → segments-DI3LOQNe.js} +5 -14
- package/dist/segments-DI3LOQNe.js.map +1 -0
- package/dist/sequence-engine-C6nnewHX.js +2 -0
- package/dist/{sequence-engine-J1lTW_in.js → sequence-engine-DNTVLq7o.js} +15 -8
- package/dist/sequence-engine-DNTVLq7o.js.map +1 -0
- package/dist/{sequence-store-DaaWr0Os.js → sequence-store-CmYb6s0g.js} +6 -5
- package/dist/sequence-store-CmYb6s0g.js.map +1 -0
- package/dist/{server-Dyva03K8.js → server-DoRPPOeR.js} +308 -230
- package/dist/server-DoRPPOeR.js.map +1 -0
- package/dist/{session-D9ub6Wl1.js → session-B6XaP83h.js} +3 -3
- package/dist/session-B6XaP83h.js.map +1 -0
- package/dist/{session-B9AilxOE.js → session-BgGDyP2C.js} +3 -3
- package/dist/session-BgGDyP2C.js.map +1 -0
- package/dist/session-Bp4zTh4l.js +2 -0
- package/dist/{session-D0qFkBla.cjs → session-Mm7GQbSH.cjs} +3 -3
- package/dist/session-Mm7GQbSH.cjs.map +1 -0
- package/dist/{session-store-C8tEvMPw.js → session-store-DWxJ5Pof.js} +79 -17
- package/dist/session-store-DWxJ5Pof.js.map +1 -0
- package/dist/{session-store-B0QZE8Bx.cjs → session-store-yfwnj0OC.cjs} +126 -16
- package/dist/session-store-yfwnj0OC.cjs.map +1 -0
- package/dist/{sla-engine-5IhTsBUR.js → sla-engine-CP2KiKDS.js} +1 -1
- package/dist/{sla-engine-BqX-7u-7.js → sla-engine-O-A1ntu_.js} +2 -2
- package/dist/{sla-engine-BqX-7u-7.js.map → sla-engine-O-A1ntu_.js.map} +1 -1
- package/dist/{sop-Vp0UPWFW.js → sop-BV7ICAFR.js} +4 -11
- package/dist/sop-BV7ICAFR.js.map +1 -0
- package/dist/{sop-DkhVChGy.js → sop-D33qTHUb.js} +1 -1
- package/dist/survey-engine-DKctGcLQ.js +2 -0
- package/dist/{survey-engine-DBjCYqCv.js → survey-engine-DngXBv47.js} +5 -4
- package/dist/survey-engine-DngXBv47.js.map +1 -0
- package/dist/{sync-state-CwLSt_1m.js → sync-state-BaA8LbTI.js} +1 -1
- package/dist/{sync-state-ChaLbamC.js → sync-state-DMZgzpez.js} +4 -12
- package/dist/sync-state-DMZgzpez.js.map +1 -0
- package/dist/{ticket-writer-CjqKeIRD.js → ticket-writer-DsfpeLGZ.js} +1 -1
- package/dist/{ticket-writer-j2oX_Wal.js → ticket-writer-a9on36Wb.js} +12 -24
- package/dist/ticket-writer-a9on36Wb.js.map +1 -0
- package/dist/{tone-Bdm5uaht.js → tone-C7bqK69y.js} +5 -12
- package/dist/tone-C7bqK69y.js.map +1 -0
- package/dist/{tone-DRKlZgPr.cjs → tone-Cmc7O2Fx.cjs} +3 -9
- package/dist/tone-Cmc7O2Fx.cjs.map +1 -0
- package/dist/{tone-vNb2DAAD.js → tone-mXSftvTn.js} +3 -8
- package/dist/tone-mXSftvTn.js.map +1 -0
- package/dist/{transcript-watcher-CL2QUygI.js → transcript-watcher-BoClrJAz.js} +18 -11
- package/dist/transcript-watcher-BoClrJAz.js.map +1 -0
- package/dist/unmatched-transcripts-C92zAoM4.js +2 -0
- package/dist/unmatched-transcripts-DC-VQ9YS.js +16 -0
- package/dist/unmatched-transcripts-DC-VQ9YS.js.map +1 -0
- package/dist/update-deal-CWy1eLJI.js +2 -0
- package/dist/{update-deal-DKC79skb.js → update-deal-DSzr_Aau.js} +3 -3
- package/dist/{update-deal-DKC79skb.js.map → update-deal-DSzr_Aau.js.map} +1 -1
- package/dist/{usage-D0-TYJkw.js → usage-BVlFlKW_.js} +8 -6
- package/dist/usage-BVlFlKW_.js.map +1 -0
- package/dist/usage-CClTf5e6.cjs.map +1 -1
- package/dist/usage-D0u9a-lV.js.map +1 -1
- package/dist/{vault-DXCg29W-.js → vault-CfwZdNzC.js} +3 -4
- package/dist/vault-CfwZdNzC.js.map +1 -0
- package/dist/{vault-C1D3zScD.js → vault-DxKP4_R2.js} +1 -1
- package/dist/{webhooks-Xn6zO6kd.cjs → webhooks-CwW-3kvG.cjs} +5 -19
- package/dist/webhooks-CwW-3kvG.cjs.map +1 -0
- package/dist/{webhooks-7EpA05Qr.js → webhooks-DXr1IoKn.js} +8 -21
- package/dist/webhooks-DXr1IoKn.js.map +1 -0
- package/dist/{webhooks-BO2UAnmn.js → webhooks-sWZ8CJtR.js} +5 -18
- package/dist/webhooks-sWZ8CJtR.js.map +1 -0
- package/package.json +22 -2
- package/dist/approvals-DpjxGHFp.js.map +0 -1
- package/dist/auth-CyFuu9X_.js +0 -2
- package/dist/auth-DFWwWcYD.js.map +0 -1
- package/dist/backup-CeMk9z86.js.map +0 -1
- package/dist/backup-f_hC7rBV.js +0 -2
- package/dist/context-builder-BzWAp3Zs.js.map +0 -1
- package/dist/context-builder-DlrRcqmJ.js +0 -2
- package/dist/custom-fields-Pl2t9xzp.js.map +0 -1
- package/dist/custom-objects-BHgn1GEX.js.map +0 -1
- package/dist/customer-dir-DIylZ8Q6.js.map +0 -1
- package/dist/file-lock-B_zi7NQl.js.map +0 -1
- package/dist/gmail-sync-DIaxInDT.js.map +0 -1
- package/dist/gmail-sync-hHm9gaWd.cjs.map +0 -1
- package/dist/gmail-sync-rQaVqKWd.js.map +0 -1
- package/dist/goal-engine-KpBftn4V.js.map +0 -1
- package/dist/identity-gyfWdrcX.js +0 -2
- package/dist/import-hubspot-BaK71U_K.js.map +0 -1
- package/dist/index-V8BFaH-b.d.ts.map +0 -1
- package/dist/index-YqwMd6aQ.d.cts.map +0 -1
- package/dist/interactions-writer-CrPStUll.cjs.map +0 -1
- package/dist/interactions-writer-DO3KcSR3.js.map +0 -1
- package/dist/interactions-writer-SLHnoEeE.js.map +0 -1
- package/dist/interactions-writer-dSPy1XfO.js +0 -2
- package/dist/knowledge-base-D0Fh40kc.js.map +0 -1
- package/dist/lancedb-rlvWoPwl.js.map +0 -1
- package/dist/lead-model-BCFzyktm.js.map +0 -1
- package/dist/memory-Bb6ky3kb.js.map +0 -1
- package/dist/notification-dispatcher-0vYNngWe.js.map +0 -1
- package/dist/pipeline-writer-BvVquKIe.js.map +0 -1
- package/dist/pipeline-writer-N2omexxp.cjs.map +0 -1
- package/dist/pipeline-writer-eufx_0o1.js.map +0 -1
- package/dist/proactive-worker-BrLHNhjH.js.map +0 -1
- package/dist/push-manager-CdqIIkuh.js.map +0 -1
- package/dist/quote-generator-BfwENXzg.js.map +0 -1
- package/dist/rbac-C7c8tcES.js +0 -2
- package/dist/rbac-CTIktZaC.js.map +0 -1
- package/dist/relationship-health-odxEoQdJ.js.map +0 -1
- package/dist/revenue-simulation-Bqf2DLVB.js.map +0 -1
- package/dist/segments-BqcD5HIl.js.map +0 -1
- package/dist/sequence-engine-CCTHEBgi.js +0 -2
- package/dist/sequence-engine-J1lTW_in.js.map +0 -1
- package/dist/sequence-store-DaaWr0Os.js.map +0 -1
- package/dist/server-Dyva03K8.js.map +0 -1
- package/dist/session-B9AilxOE.js.map +0 -1
- package/dist/session-D0qFkBla.cjs.map +0 -1
- package/dist/session-D9ub6Wl1.js.map +0 -1
- package/dist/session-mWHA71Lw.js +0 -2
- package/dist/session-store-B0QZE8Bx.cjs.map +0 -1
- package/dist/session-store-C8tEvMPw.js.map +0 -1
- package/dist/sop-Vp0UPWFW.js.map +0 -1
- package/dist/survey-engine-C06hcQt3.js +0 -2
- package/dist/survey-engine-DBjCYqCv.js.map +0 -1
- package/dist/sync-state-ChaLbamC.js.map +0 -1
- package/dist/ticket-writer-j2oX_Wal.js.map +0 -1
- package/dist/tone-Bdm5uaht.js.map +0 -1
- package/dist/tone-DRKlZgPr.cjs.map +0 -1
- package/dist/tone-vNb2DAAD.js.map +0 -1
- package/dist/transcript-watcher-CL2QUygI.js.map +0 -1
- package/dist/unmatched-transcripts-BsH5bhkU.js +0 -26
- package/dist/unmatched-transcripts-BsH5bhkU.js.map +0 -1
- package/dist/unmatched-transcripts-D0PrJ9iz.js +0 -2
- package/dist/update-deal-BNwPGaTV.js +0 -2
- package/dist/usage-D0-TYJkw.js.map +0 -1
- package/dist/vault-DXCg29W-.js.map +0 -1
- package/dist/webhooks-7EpA05Qr.js.map +0 -1
- package/dist/webhooks-BO2UAnmn.js.map +0 -1
- package/dist/webhooks-Xn6zO6kd.cjs.map +0 -1
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as readMainFacts, i as listCustomerSlugs, n as customerExists, o as writeMainFacts, r as ensureCustomerDir } from "./customer-dir-CkMMXhb0.js";
|
|
2
|
+
import { t as writeFileAtomic } from "./atomic-write-8yjqqLtS.js";
|
|
3
|
+
import { i as writeJsonFile } from "./json-store-WWsFzXub.js";
|
|
2
4
|
import { n as getSession } from "./session-store-CEa39Dxs.js";
|
|
3
|
-
import { a as searchKbSimple, n as getKbArticle, o as writeKbArticle, r as getKbMetaForExport, s as CAPABILITIES_TEXT } from "./knowledge-base
|
|
4
|
-
import { i as readBackupLog, n as listBackupsInDir, o as runBackup } from "./backup-
|
|
5
|
-
import { r as updateSlugSyncState, t as getLastGmailSync } from "./sync-state-
|
|
5
|
+
import { a as searchKbSimple, n as getKbArticle, o as writeKbArticle, r as getKbMetaForExport, s as CAPABILITIES_TEXT } from "./knowledge-base--063Kpa3.js";
|
|
6
|
+
import { i as readBackupLog, n as listBackupsInDir, o as runBackup } from "./backup-CTlIxUdO.js";
|
|
7
|
+
import { r as updateSlugSyncState, t as getLastGmailSync } from "./sync-state-DMZgzpez.js";
|
|
6
8
|
import { t as withFileQueue } from "./write-queue-IbsAjUnh.js";
|
|
7
|
-
import { n as
|
|
9
|
+
import { n as appendInteraction, r as formatInteractionEntry } from "./interactions-writer-B8XAzdqR.js";
|
|
8
10
|
import { i as writeAuditEntry, n as getActor, r as readAuditLog, t as filterAuditLog } from "./audit-log-DNMY9mUZ.js";
|
|
9
|
-
import { a as
|
|
10
|
-
import { f as getPipelineStages, i as buildSimulationInput, l as runSimulation, n as buildConfidenceMessage } from "./revenue-simulation-
|
|
11
|
-
import { t as readPipeline } from "./pipeline-writer-
|
|
12
|
-
import { a as
|
|
13
|
-
import { t as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { n as
|
|
18
|
-
import {
|
|
19
|
-
import { i as
|
|
20
|
-
import { i as
|
|
21
|
-
import { t as
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { n as
|
|
11
|
+
import { a as customerVisibility, n as canSeeCustomer, o as enforceRbac } from "./rbac-msmBc_tK.js";
|
|
12
|
+
import { f as getPipelineStages, i as buildSimulationInput, l as runSimulation, n as buildConfidenceMessage } from "./revenue-simulation-D8f_YkUY.js";
|
|
13
|
+
import { n as readPipelineSync, t as readPipeline } from "./pipeline-writer-CIllfnZl.js";
|
|
14
|
+
import { a as summarizeLogs, i as queryLogs, n as logger } from "./logger-Dyl4VcLO.js";
|
|
15
|
+
import { a as updateGraphFromInteraction, c as readGraph, i as writeHealth, n as readHealth, o as findPath, r as updateHealthFromInteraction, s as getStakeholders, t as computeCustomerHealth } from "./relationship-health-ZZNXR1RZ.js";
|
|
16
|
+
import { t as callLlm } from "./llm-PZzgPphl.js";
|
|
17
|
+
import { d as pursueGoal, i as getActiveGoals, p as readGoals } from "./goal-engine-BbroPhqm.js";
|
|
18
|
+
import { n as readSubscriptions, r as register, s as writeSubscriptions } from "./push-manager-C0ECQgva.js";
|
|
19
|
+
import { a as writeEnrollment, c as extractVariables, d as getTemplate, f as listTemplates, i as updateEnrollment, l as interpolate, n as listSequences, r as readEnrollments, s as buildVariablesFromCustomer, t as getSequence } from "./sequence-store-CmYb6s0g.js";
|
|
20
|
+
import { n as listQuotes, r as readQuote, t as generateQuote } from "./quote-generator-CTdR8eEI.js";
|
|
21
|
+
import { i as upsertTicket, n as nextTicketId, r as readTickets, t as listAllTickets } from "./ticket-writer-a9on36Wb.js";
|
|
22
|
+
import { i as loadSlaRules, t as calcSlaDue } from "./sla-engine-O-A1ntu_.js";
|
|
23
|
+
import { i as getSurvey, l as savePendingSurvey, n as calcNpsScore, o as loadSurveyResponses, r as generateSurveyToken, t as buildSurveyEmail } from "./survey-engine-DngXBv47.js";
|
|
24
|
+
import { t as buildContext } from "./context-builder-7Uab5-G4.js";
|
|
25
|
+
import { a as loadCustomObjects, i as listRecords, n as defineCustomObject, t as createRecord } from "./custom-objects-CxW1gHwJ.js";
|
|
26
|
+
import { r as searchKnowledge } from "./lancedb-CuHKNsNZ.js";
|
|
27
|
+
import { t as buildDailyBriefing } from "./proactive-agent-B7u3Bj_l.js";
|
|
28
|
+
import { a as protectedResourceMetadata, o as verifyBearer, r as isAuthRequired, s as wwwAuthenticateHeader } from "./auth-DDXZTwS0.js";
|
|
29
|
+
import { i as verifyGmailPubSubSignature, n as decodeGmailPubSubPayload, r as handleGmailPushEvent } from "./gmail-webhook-handler-BzOFbvgh.js";
|
|
30
|
+
import { n as registerUpdateDeal } from "./update-deal-DSzr_Aau.js";
|
|
28
31
|
import path from "path";
|
|
29
32
|
import fs from "fs";
|
|
30
33
|
import matter from "gray-matter";
|
|
@@ -251,7 +254,7 @@ function registerGetActiveSession(server) {
|
|
|
251
254
|
}
|
|
252
255
|
//#endregion
|
|
253
256
|
//#region src/mcp/tools/get-customer-context.ts
|
|
254
|
-
const DATA_DIR$
|
|
257
|
+
const DATA_DIR$51 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
255
258
|
function triggerOnQuerySync(dataDir, slug) {
|
|
256
259
|
const auth = getGmailAuth();
|
|
257
260
|
if (!auth) return;
|
|
@@ -264,7 +267,7 @@ function triggerOnQuerySync(dataDir, slug) {
|
|
|
264
267
|
const sources = JSON.parse(fs.readFileSync(sourcesPath, "utf-8"));
|
|
265
268
|
if (!sources.gmail?.enabled || !sources.gmail.query) return;
|
|
266
269
|
const query = sources.gmail.query;
|
|
267
|
-
import("./gmail-sync-
|
|
270
|
+
import("./gmail-sync-B4Iu3AQb.js").then(({ syncGmail }) => syncGmail({
|
|
268
271
|
slug,
|
|
269
272
|
dataDir,
|
|
270
273
|
auth,
|
|
@@ -272,7 +275,7 @@ function triggerOnQuerySync(dataDir, slug) {
|
|
|
272
275
|
}).then(() => updateSlugSyncState(dataDir, slug, { lastGmailSync: (/* @__PURE__ */ new Date()).toISOString() })).catch(() => {})).catch(() => {});
|
|
273
276
|
} catch {}
|
|
274
277
|
}
|
|
275
|
-
async function handleGetCustomerContext(input, dataDir = DATA_DIR$
|
|
278
|
+
async function handleGetCustomerContext(input, dataDir = DATA_DIR$51) {
|
|
276
279
|
const targetSlug = input.slug ?? getSession()?.customerSlug;
|
|
277
280
|
if (!targetSlug) return {
|
|
278
281
|
content: [{
|
|
@@ -324,8 +327,8 @@ Performance: <3 seconds. Token budget: <3000.`,
|
|
|
324
327
|
}
|
|
325
328
|
//#endregion
|
|
326
329
|
//#region src/mcp/tools/search-customer-knowledge.ts
|
|
327
|
-
const DATA_DIR$
|
|
328
|
-
async function handleSearchCustomerKnowledge(input, dataDir = DATA_DIR$
|
|
330
|
+
const DATA_DIR$50 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
331
|
+
async function handleSearchCustomerKnowledge(input, dataDir = DATA_DIR$50) {
|
|
329
332
|
const limit = input.limit ?? 5;
|
|
330
333
|
try {
|
|
331
334
|
const results = await searchKnowledge(dataDir, input.slug, input.query, limit);
|
|
@@ -373,14 +376,14 @@ If no results: returns empty array with a helpful sync suggestion.`,
|
|
|
373
376
|
}
|
|
374
377
|
//#endregion
|
|
375
378
|
//#region src/mcp/tools/list-customers.ts
|
|
376
|
-
const DATA_DIR$
|
|
379
|
+
const DATA_DIR$49 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
377
380
|
function extractLastInteractionDate(interactionsPath) {
|
|
378
381
|
if (!fs.existsSync(interactionsPath)) return void 0;
|
|
379
382
|
const content = fs.readFileSync(interactionsPath, "utf-8");
|
|
380
383
|
const match = /^## (\d{4}-\d{2}-\d{2})/m.exec(content);
|
|
381
384
|
return match ? match[1] : void 0;
|
|
382
385
|
}
|
|
383
|
-
async function handleListCustomers(input, dataDir = DATA_DIR$
|
|
386
|
+
async function handleListCustomers(input, dataDir = DATA_DIR$49) {
|
|
384
387
|
const customersDir = path.join(dataDir, "customers");
|
|
385
388
|
const customers = [];
|
|
386
389
|
if (!fs.existsSync(customersDir)) return { content: [{
|
|
@@ -388,6 +391,7 @@ async function handleListCustomers(input, dataDir = DATA_DIR$48) {
|
|
|
388
391
|
text: JSON.stringify([], null, 2)
|
|
389
392
|
}] };
|
|
390
393
|
const entries = fs.readdirSync(customersDir);
|
|
394
|
+
const canSee = customerVisibility(dataDir, process.env["DXCRM_ACTOR"] ?? "system");
|
|
391
395
|
for (const entry of entries) {
|
|
392
396
|
const customerDir = path.join(customersDir, entry);
|
|
393
397
|
try {
|
|
@@ -414,7 +418,7 @@ async function handleListCustomers(input, dataDir = DATA_DIR$48) {
|
|
|
414
418
|
const filterLower = input.filter.toLowerCase();
|
|
415
419
|
if (!(name.toLowerCase().includes(filterLower) || entry.toLowerCase().includes(filterLower) || stage.toLowerCase().includes(filterLower))) continue;
|
|
416
420
|
}
|
|
417
|
-
if (!
|
|
421
|
+
if (!canSee(entry)) continue;
|
|
418
422
|
customers.push(summary);
|
|
419
423
|
} catch {
|
|
420
424
|
continue;
|
|
@@ -440,8 +444,8 @@ Returns: Array of { slug, name, stage, lastInteraction?, dealValue? }`,
|
|
|
440
444
|
}
|
|
441
445
|
//#endregion
|
|
442
446
|
//#region src/mcp/tools/log-interaction.ts
|
|
443
|
-
const DATA_DIR$
|
|
444
|
-
async function handleLogInteraction(input, dataDir = DATA_DIR$
|
|
447
|
+
const DATA_DIR$48 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
448
|
+
async function handleLogInteraction(input, dataDir = DATA_DIR$48) {
|
|
445
449
|
const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
446
450
|
const interactionDate = input.date ?? today;
|
|
447
451
|
const sourceRef = input.source ?? `agent://log/${Date.now()}`;
|
|
@@ -471,7 +475,7 @@ async function handleLogInteraction(input, dataDir = DATA_DIR$47) {
|
|
|
471
475
|
raw.data.last_touchpoint = interactionDate;
|
|
472
476
|
let serialized = matter.stringify(raw.content, raw.data);
|
|
473
477
|
serialized = serialized.replace(/^(last_touchpoint:\s*)['"](\d{4}-\d{2}-\d{2})['"]/m, "$1$2");
|
|
474
|
-
|
|
478
|
+
writeFileAtomic(mainFactsPath, serialized);
|
|
475
479
|
} catch {}
|
|
476
480
|
writeAuditEntry(dataDir, {
|
|
477
481
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -546,12 +550,12 @@ Returns: { success: boolean, path: string, entry: string }`,
|
|
|
546
550
|
}
|
|
547
551
|
//#endregion
|
|
548
552
|
//#region src/mcp/tools/export-customer.ts
|
|
549
|
-
const DATA_DIR$
|
|
553
|
+
const DATA_DIR$47 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
550
554
|
function countInteractions(content) {
|
|
551
555
|
const matches = content.match(/^## \d{4}-\d{2}-\d{2}/gm);
|
|
552
556
|
return matches ? matches.length : 0;
|
|
553
557
|
}
|
|
554
|
-
async function handleExportCustomer(input, dataDir = DATA_DIR$
|
|
558
|
+
async function handleExportCustomer(input, dataDir = DATA_DIR$47) {
|
|
555
559
|
enforceRbac(dataDir, "export_customer");
|
|
556
560
|
const customerDir = path.join(dataDir, "customers", input.slug);
|
|
557
561
|
if (!fs.existsSync(customerDir)) return {
|
|
@@ -578,14 +582,27 @@ async function handleExportCustomer(input, dataDir = DATA_DIR$46) {
|
|
|
578
582
|
interactionsCount = countInteractions(interactionsContent);
|
|
579
583
|
}
|
|
580
584
|
const pipeline = await readPipeline(dataDir, input.slug);
|
|
585
|
+
const includeAttachmentContent = input.includeAttachmentContent ?? false;
|
|
581
586
|
const attachmentsDir = path.join(customerDir, "attachments");
|
|
582
587
|
const attachments = [];
|
|
588
|
+
const attachmentContents = {};
|
|
583
589
|
if (fs.existsSync(attachmentsDir)) try {
|
|
584
590
|
const files = fs.readdirSync(attachmentsDir);
|
|
585
591
|
for (const f of files) try {
|
|
586
|
-
if (fs.statSync(path.join(attachmentsDir, f)).isFile())
|
|
592
|
+
if (!fs.statSync(path.join(attachmentsDir, f)).isFile()) continue;
|
|
593
|
+
attachments.push(f);
|
|
594
|
+
if (includeAttachmentContent && f.endsWith(".md")) attachmentContents[f] = fs.readFileSync(path.join(attachmentsDir, f), "utf-8");
|
|
587
595
|
} catch {}
|
|
588
596
|
} catch {}
|
|
597
|
+
const attachmentContentSection = () => {
|
|
598
|
+
const entries = Object.entries(attachmentContents);
|
|
599
|
+
if (!includeAttachmentContent || entries.length === 0) return [];
|
|
600
|
+
return [
|
|
601
|
+
"",
|
|
602
|
+
`## Attachment Contents (${entries.length})`,
|
|
603
|
+
...entries.map(([name, content]) => `\n### ${name}\n\n${content.trim()}`)
|
|
604
|
+
];
|
|
605
|
+
};
|
|
589
606
|
if (format === "markdown") return { content: [{
|
|
590
607
|
type: "text",
|
|
591
608
|
text: [
|
|
@@ -604,7 +621,8 @@ async function handleExportCustomer(input, dataDir = DATA_DIR$46) {
|
|
|
604
621
|
pipeline.length > 0 ? pipeline.map((d) => `- **${d.name}** · ${d.stage}${d.value !== void 0 ? ` · €${d.value}` : ""}${d.close_date ? ` · close: ${d.close_date}` : ""}`).join("\n") : "(no deals)",
|
|
605
622
|
"",
|
|
606
623
|
`## Attachments (${attachments.length})`,
|
|
607
|
-
attachments.length > 0 ? attachments.map((f) => `- ${f}`).join("\n") : "(none)"
|
|
624
|
+
attachments.length > 0 ? attachments.map((f) => `- ${f}`).join("\n") : "(none)",
|
|
625
|
+
...attachmentContentSection()
|
|
608
626
|
].join("\n")
|
|
609
627
|
}] };
|
|
610
628
|
const exported = {
|
|
@@ -613,7 +631,8 @@ async function handleExportCustomer(input, dataDir = DATA_DIR$46) {
|
|
|
613
631
|
mainFacts,
|
|
614
632
|
interactionsCount,
|
|
615
633
|
pipeline,
|
|
616
|
-
attachments
|
|
634
|
+
attachments,
|
|
635
|
+
...includeAttachmentContent ? { attachmentContents } : {}
|
|
617
636
|
};
|
|
618
637
|
return { content: [{
|
|
619
638
|
type: "text",
|
|
@@ -623,29 +642,34 @@ async function handleExportCustomer(input, dataDir = DATA_DIR$46) {
|
|
|
623
642
|
function registerExportCustomer(server) {
|
|
624
643
|
server.registerTool("export_customer", {
|
|
625
644
|
title: "Export Customer",
|
|
626
|
-
description: `Export all customer data (main_facts + interactions
|
|
627
|
-
Useful for reporting, audits, or creating
|
|
645
|
+
description: `Export all customer data (main_facts + interactions + pipeline deals + attachments).
|
|
646
|
+
Useful for reporting, audits, handoffs, or creating a complete sendable bundle
|
|
647
|
+
of every conversation and document for a customer.
|
|
628
648
|
|
|
629
649
|
Args:
|
|
630
650
|
slug: Customer ID (e.g. "acme-corp")
|
|
631
651
|
format: Output format — "json" (default) or "markdown"
|
|
652
|
+
includeAttachmentContent: Inline the converted Markdown of every attachment
|
|
653
|
+
(default false). Use this to produce a single self-contained bundle.
|
|
632
654
|
|
|
633
655
|
Returns:
|
|
634
|
-
JSON: { slug, exportedAt, mainFacts, interactionsCount, pipeline }
|
|
635
|
-
Markdown: Formatted document with all sections`,
|
|
656
|
+
JSON: { slug, exportedAt, mainFacts, interactionsCount, pipeline, attachments[, attachmentContents] }
|
|
657
|
+
Markdown: Formatted document with all sections (and attachment contents when requested)`,
|
|
636
658
|
inputSchema: z.object({
|
|
637
659
|
slug: z.string().describe("Customer slug (e.g. 'acme-corp')"),
|
|
638
|
-
format: z.enum(["json", "markdown"]).optional().describe("Output format: 'json' (default) or 'markdown'")
|
|
660
|
+
format: z.enum(["json", "markdown"]).optional().describe("Output format: 'json' (default) or 'markdown'"),
|
|
661
|
+
includeAttachmentContent: z.boolean().optional().describe("Inline converted attachment Markdown into the export (default false)")
|
|
639
662
|
})
|
|
640
|
-
}, async ({ slug, format }) => handleExportCustomer({
|
|
663
|
+
}, async ({ slug, format, includeAttachmentContent }) => handleExportCustomer({
|
|
641
664
|
slug,
|
|
642
|
-
...format !== void 0 ? { format } : {}
|
|
665
|
+
...format !== void 0 ? { format } : {},
|
|
666
|
+
...includeAttachmentContent !== void 0 ? { includeAttachmentContent } : {}
|
|
643
667
|
}));
|
|
644
668
|
}
|
|
645
669
|
//#endregion
|
|
646
670
|
//#region src/mcp/tools/update-customer-facts.ts
|
|
647
|
-
const DATA_DIR$
|
|
648
|
-
async function handleUpdateCustomerFacts(input, dataDir = DATA_DIR$
|
|
671
|
+
const DATA_DIR$46 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
672
|
+
async function handleUpdateCustomerFacts(input, dataDir = DATA_DIR$46) {
|
|
649
673
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
650
674
|
try {
|
|
651
675
|
enforceRbac(dataDir, "update_customer_facts");
|
|
@@ -795,10 +819,36 @@ function scoreDeal(deal, signals) {
|
|
|
795
819
|
warnings
|
|
796
820
|
};
|
|
797
821
|
}
|
|
822
|
+
const MS_PER_DAY = 864e5;
|
|
823
|
+
/**
|
|
824
|
+
* Derive activity/close timing for a deal relative to `todayDate`. Centralizes
|
|
825
|
+
* the day-diff math that deal-room and deal-agent each computed identically.
|
|
826
|
+
* A blank/whitespace close_date yields `undefined` (not a NaN day count).
|
|
827
|
+
*/
|
|
828
|
+
function deriveDealTiming(deal, todayDate) {
|
|
829
|
+
const updatedDate = deal.updated ? new Date(deal.updated) : todayDate;
|
|
830
|
+
const daysSinceLastActivity = Math.floor((todayDate.getTime() - updatedDate.getTime()) / MS_PER_DAY);
|
|
831
|
+
const timing = {
|
|
832
|
+
daysSinceLastActivity,
|
|
833
|
+
daysInCurrentStage: daysSinceLastActivity
|
|
834
|
+
};
|
|
835
|
+
if (deal.close_date && deal.close_date.trim() !== "") timing.daysToClose = Math.floor((new Date(deal.close_date).getTime() - todayDate.getTime()) / MS_PER_DAY);
|
|
836
|
+
return timing;
|
|
837
|
+
}
|
|
838
|
+
/** Score a deal using timing derived from `todayDate` plus the deal's probability. */
|
|
839
|
+
function scoreDealForToday(deal, todayDate) {
|
|
840
|
+
const timing = deriveDealTiming(deal, todayDate);
|
|
841
|
+
return scoreDeal(deal, {
|
|
842
|
+
daysSinceLastActivity: timing.daysSinceLastActivity,
|
|
843
|
+
daysInCurrentStage: timing.daysInCurrentStage,
|
|
844
|
+
...timing.daysToClose !== void 0 ? { daysToClose: timing.daysToClose } : {},
|
|
845
|
+
...deal.probability !== void 0 ? { probability: deal.probability } : {}
|
|
846
|
+
});
|
|
847
|
+
}
|
|
798
848
|
//#endregion
|
|
799
849
|
//#region src/mcp/tools/get-deal-health.ts
|
|
800
|
-
const DATA_DIR$
|
|
801
|
-
async function handleGetDealHealth(input, dataDir = DATA_DIR$
|
|
850
|
+
const DATA_DIR$45 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
851
|
+
async function handleGetDealHealth(input, dataDir = DATA_DIR$45) {
|
|
802
852
|
try {
|
|
803
853
|
const deals = await readPipeline(dataDir, input.slug);
|
|
804
854
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -847,28 +897,13 @@ Returns: { slug, deals: [{ deal, stage, score, grade, signals, warnings }] }`,
|
|
|
847
897
|
}
|
|
848
898
|
//#endregion
|
|
849
899
|
//#region src/mcp/tools/get-pipeline-forecast.ts
|
|
850
|
-
const DATA_DIR$
|
|
851
|
-
async function handleGetPipelineForecast(input, dataDir = DATA_DIR$
|
|
900
|
+
const DATA_DIR$44 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
901
|
+
async function handleGetPipelineForecast(input, dataDir = DATA_DIR$44) {
|
|
852
902
|
try {
|
|
853
|
-
const
|
|
854
|
-
if (!fs.existsSync(customersDir)) return { content: [{
|
|
855
|
-
type: "text",
|
|
856
|
-
text: JSON.stringify({
|
|
857
|
-
deals: [],
|
|
858
|
-
totalWeightedValue: 0,
|
|
859
|
-
byStage: {}
|
|
860
|
-
}, null, 2)
|
|
861
|
-
}] };
|
|
862
|
-
const slugs = fs.readdirSync(customersDir).filter((d) => {
|
|
863
|
-
if (input.filter && !d.includes(input.filter)) return false;
|
|
864
|
-
return fs.statSync(path.join(customersDir, d)).isDirectory();
|
|
865
|
-
});
|
|
903
|
+
const slugs = listCustomerSlugs(dataDir).filter((d) => !input.filter || d.includes(input.filter));
|
|
866
904
|
const allDeals = [];
|
|
867
905
|
for (const slug of slugs) {
|
|
868
|
-
const
|
|
869
|
-
if (!fs.existsSync(pipelinePath)) continue;
|
|
870
|
-
const { readPipeline } = await import("./pipeline-writer-BqBrYrQc.js");
|
|
871
|
-
const deals = await readPipeline(dataDir, slug).catch(() => []);
|
|
906
|
+
const deals = readPipelineSync(dataDir, slug);
|
|
872
907
|
for (const deal of deals) {
|
|
873
908
|
if (deal.stage === "won" || deal.stage === "lost") continue;
|
|
874
909
|
const prob = deal.probability ?? 50;
|
|
@@ -924,13 +959,13 @@ Returns: { deals: [...], totalWeightedValue: number, byStage: { stage: { count,
|
|
|
924
959
|
}
|
|
925
960
|
//#endregion
|
|
926
961
|
//#region src/mcp/tools/summarize-meeting.ts
|
|
927
|
-
const DATA_DIR$
|
|
928
|
-
async function handleSummarizeMeeting(input, dataDir = DATA_DIR$
|
|
962
|
+
const DATA_DIR$43 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
963
|
+
async function handleSummarizeMeeting(input, dataDir = DATA_DIR$43) {
|
|
929
964
|
try {
|
|
930
965
|
let summary = input.transcript.slice(0, 400);
|
|
931
966
|
let nextSteps = [];
|
|
932
967
|
try {
|
|
933
|
-
const { callLlm } = await import("./llm-
|
|
968
|
+
const { callLlm } = await import("./llm-DSX1-wFu.js");
|
|
934
969
|
const response = await callLlm(`Summarize this meeting transcript in 3-5 sentences and extract action items.\n\nTranscript:\n${input.transcript.slice(0, 3e3)}\n\nRespond as JSON: { "summary": "...", "nextSteps": ["..."] }`);
|
|
935
970
|
const parsed = JSON.parse(response);
|
|
936
971
|
summary = parsed.summary ?? summary;
|
|
@@ -1000,8 +1035,8 @@ Returns: { success, summary, nextSteps, sourceRef }`,
|
|
|
1000
1035
|
}
|
|
1001
1036
|
//#endregion
|
|
1002
1037
|
//#region src/mcp/tools/get-pipeline-stages.ts
|
|
1003
|
-
const DATA_DIR$
|
|
1004
|
-
async function handleGetPipelineStages(_input, dataDir = DATA_DIR$
|
|
1038
|
+
const DATA_DIR$42 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
1039
|
+
async function handleGetPipelineStages(_input, dataDir = DATA_DIR$42) {
|
|
1005
1040
|
const stages = getPipelineStages(dataDir);
|
|
1006
1041
|
return { content: [{
|
|
1007
1042
|
type: "text",
|
|
@@ -1019,21 +1054,18 @@ function registerGetPipelineStages(server) {
|
|
|
1019
1054
|
//#region src/core/cross-customer.ts
|
|
1020
1055
|
async function searchAcrossCustomers(dataDir, query, limit = 5, excludeSlug) {
|
|
1021
1056
|
const slugs = listCustomerSlugs(dataDir).filter((d) => d !== excludeSlug);
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
const results = await searchKnowledge(dataDir, slug, query, 2);
|
|
1025
|
-
for (const r of results) allResults.push({
|
|
1057
|
+
return (await Promise.all(slugs.map(async (slug) => {
|
|
1058
|
+
return (await searchKnowledge(dataDir, slug, query, 2)).map((r) => ({
|
|
1026
1059
|
slug,
|
|
1027
1060
|
relevantContent: r.content.slice(0, 200),
|
|
1028
1061
|
score: r.score
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
|
-
return allResults.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
1062
|
+
}));
|
|
1063
|
+
}))).flat().sort((a, b) => b.score - a.score).slice(0, limit);
|
|
1032
1064
|
}
|
|
1033
1065
|
//#endregion
|
|
1034
1066
|
//#region src/mcp/tools/get-market-intelligence.ts
|
|
1035
|
-
const DATA_DIR$
|
|
1036
|
-
async function handleGetMarketIntelligence(input, dataDir = DATA_DIR$
|
|
1067
|
+
const DATA_DIR$41 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
1068
|
+
async function handleGetMarketIntelligence(input, dataDir = DATA_DIR$41) {
|
|
1037
1069
|
const excludeSlug = input.excludeCurrentCustomer ? input.slug : void 0;
|
|
1038
1070
|
const all = listCustomerSlugs(dataDir);
|
|
1039
1071
|
const totalCustomersSearched = excludeSlug ? all.filter((s) => s !== excludeSlug).length : all.length;
|
|
@@ -1064,7 +1096,7 @@ function registerGetMarketIntelligence(server) {
|
|
|
1064
1096
|
}
|
|
1065
1097
|
//#endregion
|
|
1066
1098
|
//#region src/mcp/tools/get-relationship-graph.ts
|
|
1067
|
-
const DATA_DIR$
|
|
1099
|
+
const DATA_DIR$40 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
1068
1100
|
function summarizeNode(n) {
|
|
1069
1101
|
return {
|
|
1070
1102
|
id: n.id,
|
|
@@ -1072,7 +1104,7 @@ function summarizeNode(n) {
|
|
|
1072
1104
|
email: n.properties["email"]
|
|
1073
1105
|
};
|
|
1074
1106
|
}
|
|
1075
|
-
async function handleGetRelationshipGraph(input, dataDir = DATA_DIR$
|
|
1107
|
+
async function handleGetRelationshipGraph(input, dataDir = DATA_DIR$40) {
|
|
1076
1108
|
try {
|
|
1077
1109
|
const graph = readGraph(dataDir, input.slug);
|
|
1078
1110
|
const stakeholders = getStakeholders(graph);
|
|
@@ -1140,9 +1172,9 @@ Returns: {
|
|
|
1140
1172
|
}
|
|
1141
1173
|
//#endregion
|
|
1142
1174
|
//#region src/mcp/tools/get-relationship-health.ts
|
|
1143
|
-
const DATA_DIR$
|
|
1175
|
+
const DATA_DIR$39 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
1144
1176
|
const MAX_HEALTH_AGE_MS = 3600 * 1e3;
|
|
1145
|
-
async function handleGetRelationshipHealth(input, dataDir = DATA_DIR$
|
|
1177
|
+
async function handleGetRelationshipHealth(input, dataDir = DATA_DIR$39) {
|
|
1146
1178
|
try {
|
|
1147
1179
|
let health = readHealth(dataDir, input.slug);
|
|
1148
1180
|
if (health === null || Date.now() - new Date(health.updatedAt).getTime() > MAX_HEALTH_AGE_MS) {
|
|
@@ -1222,8 +1254,7 @@ async function writePlaybook(dataDir, slug, playbook) {
|
|
|
1222
1254
|
const filePath = path.join(dir, `${playbook.name}.md`);
|
|
1223
1255
|
await withFileQueue(filePath, async () => {
|
|
1224
1256
|
fs.mkdirSync(dir, { recursive: true });
|
|
1225
|
-
|
|
1226
|
-
fs.writeFileSync(filePath, raw, "utf-8");
|
|
1257
|
+
writeFileAtomic(filePath, matter.stringify(playbook.content, playbook.frontmatter));
|
|
1227
1258
|
});
|
|
1228
1259
|
}
|
|
1229
1260
|
function toKebabCase(name) {
|
|
@@ -1425,11 +1456,10 @@ function writeAgentQueue(dataDir, slug, queue) {
|
|
|
1425
1456
|
const p = agentQueuePath(dataDir, slug);
|
|
1426
1457
|
const dir = path.dirname(p);
|
|
1427
1458
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
1428
|
-
|
|
1459
|
+
writeJsonFile(p, {
|
|
1429
1460
|
...queue,
|
|
1430
1461
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1431
|
-
};
|
|
1432
|
-
fs.writeFileSync(p, JSON.stringify(updated, null, 2), "utf-8");
|
|
1462
|
+
});
|
|
1433
1463
|
}
|
|
1434
1464
|
function makeActionId() {
|
|
1435
1465
|
return `da_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -1464,17 +1494,9 @@ async function observeDeal(dataDir, slug, dealName, today) {
|
|
|
1464
1494
|
const deal = (await readPipeline(dataDir, slug).catch(() => [])).find((d) => d.name.toLowerCase() === dealName.toLowerCase());
|
|
1465
1495
|
if (!deal) return null;
|
|
1466
1496
|
const todayDate = new Date(today);
|
|
1467
|
-
const
|
|
1468
|
-
const
|
|
1469
|
-
const
|
|
1470
|
-
const daysToClose = deal.close_date && deal.close_date.trim() !== "" ? Math.floor((new Date(deal.close_date).getTime() - todayDate.getTime()) / 864e5) : void 0;
|
|
1471
|
-
const dealHealthScore = scoreDeal(deal, {
|
|
1472
|
-
daysSinceLastActivity,
|
|
1473
|
-
daysInCurrentStage,
|
|
1474
|
-
...daysToClose !== void 0 ? { daysToClose } : {},
|
|
1475
|
-
...deal.probability !== void 0 ? { probability: deal.probability } : {}
|
|
1476
|
-
});
|
|
1477
|
-
const health = computeCustomerHealth(dataDir, slug, today);
|
|
1497
|
+
const { daysSinceLastActivity, daysInCurrentStage, daysToClose } = deriveDealTiming(deal, todayDate);
|
|
1498
|
+
const dealHealthScore = scoreDealForToday(deal, todayDate);
|
|
1499
|
+
const health = readHealth(dataDir, slug) ?? computeCustomerHealth(dataDir, slug, today);
|
|
1478
1500
|
const atRiskContacts = health.contacts.filter((c) => c.riskFlags.length > 0).map((c) => c.email ?? c.contactId);
|
|
1479
1501
|
const coldContacts = health.contacts.filter((c) => c.trend === "cold").map((c) => c.email ?? c.contactId);
|
|
1480
1502
|
const stakeholders = getStakeholders(readGraph(dataDir, slug));
|
|
@@ -1702,7 +1724,7 @@ async function executeAction(action, dataDir) {
|
|
|
1702
1724
|
if (!slug) return "skipped";
|
|
1703
1725
|
switch (action.type) {
|
|
1704
1726
|
case "log_interaction": {
|
|
1705
|
-
const { appendInteraction } = await import("./interactions-writer-
|
|
1727
|
+
const { appendInteraction } = await import("./interactions-writer-B2y-73lh.js");
|
|
1706
1728
|
await appendInteraction(dataDir, slug, {
|
|
1707
1729
|
date: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
1708
1730
|
type: action.payload["type"] ?? "Note",
|
|
@@ -1715,7 +1737,7 @@ async function executeAction(action, dataDir) {
|
|
|
1715
1737
|
return "executed";
|
|
1716
1738
|
}
|
|
1717
1739
|
case "schedule_meeting": {
|
|
1718
|
-
const { appendInteraction } = await import("./interactions-writer-
|
|
1740
|
+
const { appendInteraction } = await import("./interactions-writer-B2y-73lh.js");
|
|
1719
1741
|
await appendInteraction(dataDir, slug, {
|
|
1720
1742
|
date: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
1721
1743
|
type: "Note",
|
|
@@ -1728,7 +1750,7 @@ async function executeAction(action, dataDir) {
|
|
|
1728
1750
|
return "executed";
|
|
1729
1751
|
}
|
|
1730
1752
|
case "update_deal": {
|
|
1731
|
-
const { handleUpdateDeal } = await import("./update-deal-
|
|
1753
|
+
const { handleUpdateDeal } = await import("./update-deal-CWy1eLJI.js");
|
|
1732
1754
|
const payload = action.payload;
|
|
1733
1755
|
const validStage = VALID_STAGES.find((s) => s === payload.stage);
|
|
1734
1756
|
await handleUpdateDeal({
|
|
@@ -1821,8 +1843,8 @@ async function runDealAgent(config, dataDir, llmFn = callLlm) {
|
|
|
1821
1843
|
}
|
|
1822
1844
|
//#endregion
|
|
1823
1845
|
//#region src/mcp/tools/run-deal-agent.ts
|
|
1824
|
-
const DATA_DIR$
|
|
1825
|
-
async function handleRunDealAgent(input, dataDir = DATA_DIR$
|
|
1846
|
+
const DATA_DIR$38 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
1847
|
+
async function handleRunDealAgent(input, dataDir = DATA_DIR$38) {
|
|
1826
1848
|
try {
|
|
1827
1849
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
1828
1850
|
const result = await runDealAgent({
|
|
@@ -1889,8 +1911,8 @@ Returns: { assessment, riskLevel, plan[], actionsQueued[], actionsExecuted[], tr
|
|
|
1889
1911
|
}
|
|
1890
1912
|
//#endregion
|
|
1891
1913
|
//#region src/mcp/tools/approve-agent-action.ts
|
|
1892
|
-
const DATA_DIR$
|
|
1893
|
-
async function handleApproveAgentAction(input, dataDir = DATA_DIR$
|
|
1914
|
+
const DATA_DIR$37 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
1915
|
+
async function handleApproveAgentAction(input, dataDir = DATA_DIR$37) {
|
|
1894
1916
|
try {
|
|
1895
1917
|
const queue = readAgentQueue(dataDir, input.slug);
|
|
1896
1918
|
const idx = queue.pendingActions.findIndex((a) => a.actionId === input.actionId);
|
|
@@ -1967,8 +1989,8 @@ Returns: { success, actionId, status }`,
|
|
|
1967
1989
|
}
|
|
1968
1990
|
//#endregion
|
|
1969
1991
|
//#region src/mcp/tools/simulate-revenue.ts
|
|
1970
|
-
const DATA_DIR$
|
|
1971
|
-
async function handleSimulateRevenue(input, dataDir = DATA_DIR$
|
|
1992
|
+
const DATA_DIR$36 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
1993
|
+
async function handleSimulateRevenue(input, dataDir = DATA_DIR$36) {
|
|
1972
1994
|
try {
|
|
1973
1995
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
1974
1996
|
const horizon = input.horizon ?? "quarter";
|
|
@@ -2026,8 +2048,8 @@ Returns: { forecast: { p10, p50, p90, expected, stdDev, atRiskRevenue, byCloseMo
|
|
|
2026
2048
|
}
|
|
2027
2049
|
//#endregion
|
|
2028
2050
|
//#region src/mcp/tools/get-playbook.ts
|
|
2029
|
-
const DATA_DIR$
|
|
2030
|
-
async function handleGetPlaybook(input, dataDir = DATA_DIR$
|
|
2051
|
+
const DATA_DIR$35 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2052
|
+
async function handleGetPlaybook(input, dataDir = DATA_DIR$35) {
|
|
2031
2053
|
try {
|
|
2032
2054
|
const playbooks = listPlaybooks(dataDir, input.slug);
|
|
2033
2055
|
if (!(input.stage !== void 0 || input.value !== void 0 || input.healthScore !== void 0)) return { content: [{
|
|
@@ -2112,12 +2134,12 @@ Returns: { matches: [{ name, score, trigger, successRate, usedCount, content }],
|
|
|
2112
2134
|
...healthScore !== void 0 ? { healthScore } : {},
|
|
2113
2135
|
...daysSinceContact !== void 0 ? { daysSinceContact } : {},
|
|
2114
2136
|
...championPresent !== void 0 ? { championPresent } : {}
|
|
2115
|
-
}, DATA_DIR$
|
|
2137
|
+
}, DATA_DIR$35));
|
|
2116
2138
|
}
|
|
2117
2139
|
//#endregion
|
|
2118
2140
|
//#region src/mcp/tools/create-playbook.ts
|
|
2119
|
-
const DATA_DIR$
|
|
2120
|
-
async function handleCreatePlaybook(input, dataDir = DATA_DIR$
|
|
2141
|
+
const DATA_DIR$34 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2142
|
+
async function handleCreatePlaybook(input, dataDir = DATA_DIR$34) {
|
|
2121
2143
|
try {
|
|
2122
2144
|
const name = toKebabCase(input.name);
|
|
2123
2145
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
@@ -2190,12 +2212,12 @@ Returns: { success: true, playbook: { name, trigger, successRate, path } }`,
|
|
|
2190
2212
|
trigger,
|
|
2191
2213
|
content,
|
|
2192
2214
|
...successRate !== void 0 ? { successRate } : {}
|
|
2193
|
-
}, DATA_DIR$
|
|
2215
|
+
}, DATA_DIR$34));
|
|
2194
2216
|
}
|
|
2195
2217
|
//#endregion
|
|
2196
2218
|
//#region src/mcp/tools/list-playbooks.ts
|
|
2197
|
-
const DATA_DIR$
|
|
2198
|
-
async function handleListPlaybooks(input, dataDir = DATA_DIR$
|
|
2219
|
+
const DATA_DIR$33 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2220
|
+
async function handleListPlaybooks(input, dataDir = DATA_DIR$33) {
|
|
2199
2221
|
try {
|
|
2200
2222
|
const playbooks = listPlaybooks(dataDir, input.slug);
|
|
2201
2223
|
return { content: [{
|
|
@@ -2234,12 +2256,12 @@ Args:
|
|
|
2234
2256
|
|
|
2235
2257
|
Returns: { playbooks: [{ name, trigger, successRate, usedCount, lastUpdated }], count, slug }`,
|
|
2236
2258
|
inputSchema: z.object({ slug: z.string().describe("Customer ID") })
|
|
2237
|
-
}, async ({ slug }) => handleListPlaybooks({ slug }, DATA_DIR$
|
|
2259
|
+
}, async ({ slug }) => handleListPlaybooks({ slug }, DATA_DIR$33));
|
|
2238
2260
|
}
|
|
2239
2261
|
//#endregion
|
|
2240
2262
|
//#region src/mcp/tools/distill-playbook.ts
|
|
2241
|
-
const DATA_DIR$
|
|
2242
|
-
async function handleDistillPlaybook(input, dataDir = DATA_DIR$
|
|
2263
|
+
const DATA_DIR$32 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2264
|
+
async function handleDistillPlaybook(input, dataDir = DATA_DIR$32, llmFn = callLlm) {
|
|
2243
2265
|
try {
|
|
2244
2266
|
const result = await distillPlaybook(dataDir, input.slug, input.dealName, input.outcome, llmFn);
|
|
2245
2267
|
if (!result.ok) {
|
|
@@ -2298,12 +2320,12 @@ Returns: { success: true, playbook: { name, trigger, successRate, path }, reason
|
|
|
2298
2320
|
slug,
|
|
2299
2321
|
dealName,
|
|
2300
2322
|
outcome
|
|
2301
|
-
}, DATA_DIR$
|
|
2323
|
+
}, DATA_DIR$32));
|
|
2302
2324
|
}
|
|
2303
2325
|
//#endregion
|
|
2304
2326
|
//#region src/mcp/tools/pursue-goal.ts
|
|
2305
|
-
const DATA_DIR$
|
|
2306
|
-
async function handlePursueGoal(input, dataDir = DATA_DIR$
|
|
2327
|
+
const DATA_DIR$31 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2328
|
+
async function handlePursueGoal(input, dataDir = DATA_DIR$31, options = {}) {
|
|
2307
2329
|
try {
|
|
2308
2330
|
enforceRbac(dataDir, "pursue_goal");
|
|
2309
2331
|
const goal = await pursueGoal(dataDir, {
|
|
@@ -2366,12 +2388,12 @@ Returns: { goalId, description, target, deadline, decomposition: { analysis, cur
|
|
|
2366
2388
|
goal,
|
|
2367
2389
|
deadline,
|
|
2368
2390
|
...context !== void 0 ? { context } : {}
|
|
2369
|
-
}, DATA_DIR$
|
|
2391
|
+
}, DATA_DIR$31));
|
|
2370
2392
|
}
|
|
2371
2393
|
//#endregion
|
|
2372
2394
|
//#region src/mcp/tools/get-goal-status.ts
|
|
2373
|
-
const DATA_DIR$
|
|
2374
|
-
async function handleGetGoalStatus(input, dataDir = DATA_DIR$
|
|
2395
|
+
const DATA_DIR$30 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2396
|
+
async function handleGetGoalStatus(input, dataDir = DATA_DIR$30) {
|
|
2375
2397
|
try {
|
|
2376
2398
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
2377
2399
|
const allGoals = input.goalId ? readGoals(dataDir).filter((g) => g.id === input.goalId) : getActiveGoals(dataDir);
|
|
@@ -2430,17 +2452,17 @@ Args:
|
|
|
2430
2452
|
|
|
2431
2453
|
Returns: { goals: [{ id, description, target, progress, status, deadline, daysRemaining, subGoals }], activeCount, completedCount }`,
|
|
2432
2454
|
inputSchema: z.object({ goalId: z.string().optional().describe("Specific goal ID (omit for all active goals)") })
|
|
2433
|
-
}, async ({ goalId }) => handleGetGoalStatus({ ...goalId !== void 0 ? { goalId } : {} }, DATA_DIR$
|
|
2455
|
+
}, async ({ goalId }) => handleGetGoalStatus({ ...goalId !== void 0 ? { goalId } : {} }, DATA_DIR$30));
|
|
2434
2456
|
}
|
|
2435
2457
|
//#endregion
|
|
2436
2458
|
//#region src/mcp/tools/register-push-subscription.ts
|
|
2437
|
-
const DATA_DIR$
|
|
2459
|
+
const DATA_DIR$29 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2438
2460
|
const VALID_PROVIDERS = [
|
|
2439
2461
|
"gmail",
|
|
2440
2462
|
"microsoft-graph",
|
|
2441
2463
|
"slack"
|
|
2442
2464
|
];
|
|
2443
|
-
async function handleRegisterPushSubscription(input, dataDir = DATA_DIR$
|
|
2465
|
+
async function handleRegisterPushSubscription(input, dataDir = DATA_DIR$29) {
|
|
2444
2466
|
try {
|
|
2445
2467
|
if (!VALID_PROVIDERS.includes(input.provider)) return { content: [{
|
|
2446
2468
|
type: "text",
|
|
@@ -2526,12 +2548,12 @@ Returns: { subscriptionId, provider, slug, status, expiresAt, createdAt, warning
|
|
|
2526
2548
|
...microsoftResource !== void 0 ? { microsoftResource } : {},
|
|
2527
2549
|
...slackTeamId !== void 0 ? { slackTeamId } : {},
|
|
2528
2550
|
...slackChannelId !== void 0 ? { slackChannelId } : {}
|
|
2529
|
-
}, DATA_DIR$
|
|
2551
|
+
}, DATA_DIR$29));
|
|
2530
2552
|
}
|
|
2531
2553
|
//#endregion
|
|
2532
2554
|
//#region src/mcp/tools/get-push-status.ts
|
|
2533
|
-
const DATA_DIR$
|
|
2534
|
-
async function handleGetPushStatus(input, dataDir = DATA_DIR$
|
|
2555
|
+
const DATA_DIR$28 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2556
|
+
async function handleGetPushStatus(input, dataDir = DATA_DIR$28) {
|
|
2535
2557
|
try {
|
|
2536
2558
|
let subs = await readSubscriptions(dataDir);
|
|
2537
2559
|
if (input.slug) subs = subs.filter((s) => s.slug === input.slug);
|
|
@@ -2603,7 +2625,7 @@ Returns: { subscriptions: [{ id, provider, slug, status, expiresAt, expiresInHou
|
|
|
2603
2625
|
}, async ({ slug, provider }) => handleGetPushStatus({
|
|
2604
2626
|
...slug !== void 0 ? { slug } : {},
|
|
2605
2627
|
...provider !== void 0 ? { provider } : {}
|
|
2606
|
-
}, DATA_DIR$
|
|
2628
|
+
}, DATA_DIR$28));
|
|
2607
2629
|
}
|
|
2608
2630
|
//#endregion
|
|
2609
2631
|
//#region src/core/org-intelligence.ts
|
|
@@ -2669,8 +2691,8 @@ function deriveRecommendation(people, missingRoles) {
|
|
|
2669
2691
|
}
|
|
2670
2692
|
//#endregion
|
|
2671
2693
|
//#region src/mcp/tools/get-org-intelligence.ts
|
|
2672
|
-
const DATA_DIR$
|
|
2673
|
-
async function handleGetOrgIntelligence(input, dataDir = DATA_DIR$
|
|
2694
|
+
const DATA_DIR$27 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2695
|
+
async function handleGetOrgIntelligence(input, dataDir = DATA_DIR$27) {
|
|
2674
2696
|
try {
|
|
2675
2697
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
2676
2698
|
const map = buildStakeholderMap(dataDir, input.slug, today, input.dealName);
|
|
@@ -2721,15 +2743,7 @@ async function buildDealRoom(dataDir, slug, dealName, today) {
|
|
|
2721
2743
|
});
|
|
2722
2744
|
const todayDate = new Date(today);
|
|
2723
2745
|
const dealHealth = pipelineDeals.filter((d) => d.stage !== "won" && d.stage !== "lost").map((deal) => {
|
|
2724
|
-
const
|
|
2725
|
-
const daysSinceLastActivity = Math.floor((todayDate.getTime() - updatedDate.getTime()) / 864e5);
|
|
2726
|
-
const daysToClose = deal.close_date ? Math.floor((new Date(deal.close_date).getTime() - todayDate.getTime()) / 864e5) : void 0;
|
|
2727
|
-
const scored = scoreDeal(deal, {
|
|
2728
|
-
daysSinceLastActivity,
|
|
2729
|
-
daysInCurrentStage: daysSinceLastActivity,
|
|
2730
|
-
...daysToClose !== void 0 ? { daysToClose } : {},
|
|
2731
|
-
...deal.probability !== void 0 ? { probability: deal.probability } : {}
|
|
2732
|
-
});
|
|
2746
|
+
const scored = scoreDealForToday(deal, todayDate);
|
|
2733
2747
|
return {
|
|
2734
2748
|
deal: deal.name,
|
|
2735
2749
|
stage: deal.stage,
|
|
@@ -2811,8 +2825,8 @@ function buildExecutiveSummary(slug, dealName, stakeholders, overallHealth, sim,
|
|
|
2811
2825
|
}
|
|
2812
2826
|
//#endregion
|
|
2813
2827
|
//#region src/mcp/tools/open-deal-room.ts
|
|
2814
|
-
const DATA_DIR$
|
|
2815
|
-
async function handleOpenDealRoom(input, dataDir = DATA_DIR$
|
|
2828
|
+
const DATA_DIR$26 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2829
|
+
async function handleOpenDealRoom(input, dataDir = DATA_DIR$26) {
|
|
2816
2830
|
try {
|
|
2817
2831
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
2818
2832
|
const brief = await buildDealRoom(dataDir, input.slug, input.dealName, today);
|
|
@@ -2847,8 +2861,8 @@ Returns: { slug, dealName, generatedAt, stakeholders, relationshipHealth, dealHe
|
|
|
2847
2861
|
}
|
|
2848
2862
|
//#endregion
|
|
2849
2863
|
//#region src/mcp/tools/get-proactive-briefing.ts
|
|
2850
|
-
const DATA_DIR$
|
|
2851
|
-
async function handleGetProactiveBriefing(input, dataDir = DATA_DIR$
|
|
2864
|
+
const DATA_DIR$25 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2865
|
+
async function handleGetProactiveBriefing(input, dataDir = DATA_DIR$25) {
|
|
2852
2866
|
try {
|
|
2853
2867
|
const briefing = await buildDailyBriefing(dataDir, input.date ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10));
|
|
2854
2868
|
return { content: [{
|
|
@@ -2876,15 +2890,15 @@ Returns: { date, generatedAt, urgent: string[], opportunities: string[], forecas
|
|
|
2876
2890
|
}
|
|
2877
2891
|
//#endregion
|
|
2878
2892
|
//#region src/mcp/tools/list-email-templates.ts
|
|
2879
|
-
const DATA_DIR$
|
|
2880
|
-
async function handleListEmailTemplates(input, dataDir = DATA_DIR$
|
|
2893
|
+
const DATA_DIR$24 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2894
|
+
async function handleListEmailTemplates(input, dataDir = DATA_DIR$24) {
|
|
2881
2895
|
const summary = listTemplates(dataDir, input.category ? { category: input.category } : {}).map(({ body: _body, ...meta }) => meta);
|
|
2882
2896
|
return { content: [{
|
|
2883
2897
|
type: "text",
|
|
2884
2898
|
text: JSON.stringify(summary, null, 2)
|
|
2885
2899
|
}] };
|
|
2886
2900
|
}
|
|
2887
|
-
function registerListEmailTemplates(server, dataDir = DATA_DIR$
|
|
2901
|
+
function registerListEmailTemplates(server, dataDir = DATA_DIR$24) {
|
|
2888
2902
|
server.registerTool("list_email_templates", {
|
|
2889
2903
|
description: "List available email templates. Optionally filter by category (e.g. 'outreach', 'followup', 'support').",
|
|
2890
2904
|
inputSchema: z.object({ category: z.string().optional().describe("Filter by category") })
|
|
@@ -2892,8 +2906,8 @@ function registerListEmailTemplates(server, dataDir = DATA_DIR$23) {
|
|
|
2892
2906
|
}
|
|
2893
2907
|
//#endregion
|
|
2894
2908
|
//#region src/mcp/tools/get-email-template.ts
|
|
2895
|
-
const DATA_DIR$
|
|
2896
|
-
async function handleGetEmailTemplate(input, dataDir = DATA_DIR$
|
|
2909
|
+
const DATA_DIR$23 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2910
|
+
async function handleGetEmailTemplate(input, dataDir = DATA_DIR$23) {
|
|
2897
2911
|
const tmpl = getTemplate(dataDir, input.id);
|
|
2898
2912
|
if (!tmpl) return { content: [{
|
|
2899
2913
|
type: "text",
|
|
@@ -2909,7 +2923,7 @@ async function handleGetEmailTemplate(input, dataDir = DATA_DIR$22) {
|
|
|
2909
2923
|
}, null, 2)
|
|
2910
2924
|
}] };
|
|
2911
2925
|
}
|
|
2912
|
-
function registerGetEmailTemplate(server, dataDir = DATA_DIR$
|
|
2926
|
+
function registerGetEmailTemplate(server, dataDir = DATA_DIR$23) {
|
|
2913
2927
|
server.registerTool("get_email_template", {
|
|
2914
2928
|
description: "Get a specific email template by ID, including its body and detected variables.",
|
|
2915
2929
|
inputSchema: z.object({ id: z.string().describe("Template ID (e.g. 'enterprise-intro')") })
|
|
@@ -2917,8 +2931,8 @@ function registerGetEmailTemplate(server, dataDir = DATA_DIR$22) {
|
|
|
2917
2931
|
}
|
|
2918
2932
|
//#endregion
|
|
2919
2933
|
//#region src/mcp/tools/draft-email.ts
|
|
2920
|
-
const DATA_DIR$
|
|
2921
|
-
async function handleDraftEmail(input, dataDir = DATA_DIR$
|
|
2934
|
+
const DATA_DIR$22 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2935
|
+
async function handleDraftEmail(input, dataDir = DATA_DIR$22) {
|
|
2922
2936
|
const tmpl = getTemplate(dataDir, input.templateId);
|
|
2923
2937
|
if (!tmpl) return { content: [{
|
|
2924
2938
|
type: "text",
|
|
@@ -2932,17 +2946,17 @@ async function handleDraftEmail(input, dataDir = DATA_DIR$21) {
|
|
|
2932
2946
|
const interpolatedBody = interpolate(tmpl.body, vars);
|
|
2933
2947
|
let effectiveTone = input.tone;
|
|
2934
2948
|
if (!effectiveTone) {
|
|
2935
|
-
const { resolveTone, toneInstruction } = await import("./tone-
|
|
2949
|
+
const { resolveTone, toneInstruction } = await import("./tone-C7bqK69y.js");
|
|
2936
2950
|
const instr = toneInstruction(resolveTone(dataDir, input.slug));
|
|
2937
2951
|
if (instr) effectiveTone = instr;
|
|
2938
2952
|
}
|
|
2939
2953
|
let body = interpolatedBody;
|
|
2940
2954
|
let polished = false;
|
|
2941
2955
|
if (effectiveTone) try {
|
|
2942
|
-
const { callLlm } = await import("./llm-
|
|
2956
|
+
const { callLlm } = await import("./llm-DSX1-wFu.js");
|
|
2943
2957
|
const refined = await callLlm(`Rewrite the following email in a ${effectiveTone} tone. Keep the same language, preserve all names and facts, and do not invent details. Return ONLY the rewritten email body, no preamble.\n\n---\n${interpolatedBody}`);
|
|
2944
2958
|
if (refined && refined.trim()) {
|
|
2945
|
-
const { labelAiContent } = await import("./compliance-
|
|
2959
|
+
const { labelAiContent } = await import("./compliance-TqYQXhBj.js");
|
|
2946
2960
|
body = labelAiContent(refined.trim());
|
|
2947
2961
|
polished = true;
|
|
2948
2962
|
}
|
|
@@ -2962,7 +2976,7 @@ async function handleDraftEmail(input, dataDir = DATA_DIR$21) {
|
|
|
2962
2976
|
}, null, 2)
|
|
2963
2977
|
}] };
|
|
2964
2978
|
}
|
|
2965
|
-
function registerDraftEmail(server, dataDir = DATA_DIR$
|
|
2979
|
+
function registerDraftEmail(server, dataDir = DATA_DIR$22) {
|
|
2966
2980
|
server.registerTool("draft_email", {
|
|
2967
2981
|
description: `Draft a personalized email for a customer using a stored template.
|
|
2968
2982
|
Variables are auto-filled from the customer's main_facts.md. Override any variable manually.
|
|
@@ -2984,8 +2998,8 @@ Returns: { subject, body, to, tone, polished, resolvedVariables } — does NOT s
|
|
|
2984
2998
|
}
|
|
2985
2999
|
//#endregion
|
|
2986
3000
|
//#region src/mcp/tools/enroll-in-sequence.ts
|
|
2987
|
-
const DATA_DIR$
|
|
2988
|
-
async function handleEnrollInSequence(input, dataDir = DATA_DIR$
|
|
3001
|
+
const DATA_DIR$21 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3002
|
+
async function handleEnrollInSequence(input, dataDir = DATA_DIR$21) {
|
|
2989
3003
|
const sequence = getSequence(dataDir, input.sequenceId);
|
|
2990
3004
|
if (!sequence) return { content: [{
|
|
2991
3005
|
type: "text",
|
|
@@ -3017,7 +3031,7 @@ async function handleEnrollInSequence(input, dataDir = DATA_DIR$20) {
|
|
|
3017
3031
|
})
|
|
3018
3032
|
}] };
|
|
3019
3033
|
}
|
|
3020
|
-
function registerEnrollInSequence(server, dataDir = DATA_DIR$
|
|
3034
|
+
function registerEnrollInSequence(server, dataDir = DATA_DIR$21) {
|
|
3021
3035
|
server.registerTool("enroll_in_sequence", {
|
|
3022
3036
|
description: `Enroll a contact in an email sequence. Validates that the sequence and its first template exist.
|
|
3023
3037
|
Returns: { enrollmentId, sequenceName, totalSteps }`,
|
|
@@ -3034,8 +3048,8 @@ Returns: { enrollmentId, sequenceName, totalSteps }`,
|
|
|
3034
3048
|
}
|
|
3035
3049
|
//#endregion
|
|
3036
3050
|
//#region src/mcp/tools/list-sequence-enrollments.ts
|
|
3037
|
-
const DATA_DIR$
|
|
3038
|
-
async function handleListSequenceEnrollments(input, dataDir = DATA_DIR$
|
|
3051
|
+
const DATA_DIR$20 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3052
|
+
async function handleListSequenceEnrollments(input, dataDir = DATA_DIR$20) {
|
|
3039
3053
|
let enrollments = readEnrollments(dataDir);
|
|
3040
3054
|
if (input.slug !== void 0) enrollments = enrollments.filter((e) => e.slug === input.slug);
|
|
3041
3055
|
if (input.status !== void 0) enrollments = enrollments.filter((e) => e.status === input.status);
|
|
@@ -3044,7 +3058,7 @@ async function handleListSequenceEnrollments(input, dataDir = DATA_DIR$19) {
|
|
|
3044
3058
|
text: JSON.stringify({ enrollments }, null, 2)
|
|
3045
3059
|
}] };
|
|
3046
3060
|
}
|
|
3047
|
-
function registerListSequenceEnrollments(server, dataDir = DATA_DIR$
|
|
3061
|
+
function registerListSequenceEnrollments(server, dataDir = DATA_DIR$20) {
|
|
3048
3062
|
server.registerTool("list_sequence_enrollments", {
|
|
3049
3063
|
description: `List email sequence enrollments. Filter by customer slug or status.
|
|
3050
3064
|
Returns: { enrollments: SequenceEnrollment[] }`,
|
|
@@ -3063,8 +3077,8 @@ Returns: { enrollments: SequenceEnrollment[] }`,
|
|
|
3063
3077
|
}
|
|
3064
3078
|
//#endregion
|
|
3065
3079
|
//#region src/mcp/tools/unenroll-from-sequence.ts
|
|
3066
|
-
const DATA_DIR$
|
|
3067
|
-
async function handleUnenrollFromSequence(input, dataDir = DATA_DIR$
|
|
3080
|
+
const DATA_DIR$19 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3081
|
+
async function handleUnenrollFromSequence(input, dataDir = DATA_DIR$19) {
|
|
3068
3082
|
if (!await updateEnrollment(dataDir, input.enrollmentId, { status: "paused" })) return { content: [{
|
|
3069
3083
|
type: "text",
|
|
3070
3084
|
text: JSON.stringify({
|
|
@@ -3077,7 +3091,7 @@ async function handleUnenrollFromSequence(input, dataDir = DATA_DIR$18) {
|
|
|
3077
3091
|
text: JSON.stringify({ success: true })
|
|
3078
3092
|
}] };
|
|
3079
3093
|
}
|
|
3080
|
-
function registerUnenrollFromSequence(server, dataDir = DATA_DIR$
|
|
3094
|
+
function registerUnenrollFromSequence(server, dataDir = DATA_DIR$19) {
|
|
3081
3095
|
server.registerTool("unenroll_from_sequence", {
|
|
3082
3096
|
description: `Unenroll (pause) a contact from an email sequence. Sets status to "paused" (soft delete).
|
|
3083
3097
|
Returns: { success: boolean }`,
|
|
@@ -3086,8 +3100,8 @@ Returns: { success: boolean }`,
|
|
|
3086
3100
|
}
|
|
3087
3101
|
//#endregion
|
|
3088
3102
|
//#region src/mcp/tools/list-sequences.ts
|
|
3089
|
-
const DATA_DIR$
|
|
3090
|
-
async function handleListSequences(_input, dataDir = DATA_DIR$
|
|
3103
|
+
const DATA_DIR$18 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3104
|
+
async function handleListSequences(_input, dataDir = DATA_DIR$18) {
|
|
3091
3105
|
const sequences = listSequences(dataDir);
|
|
3092
3106
|
const enrollments = readEnrollments(dataDir);
|
|
3093
3107
|
const result = sequences.map((seq) => ({
|
|
@@ -3101,7 +3115,7 @@ async function handleListSequences(_input, dataDir = DATA_DIR$17) {
|
|
|
3101
3115
|
text: JSON.stringify({ sequences: result }, null, 2)
|
|
3102
3116
|
}] };
|
|
3103
3117
|
}
|
|
3104
|
-
function registerListSequences(server, dataDir = DATA_DIR$
|
|
3118
|
+
function registerListSequences(server, dataDir = DATA_DIR$18) {
|
|
3105
3119
|
server.registerTool("list_sequences", {
|
|
3106
3120
|
description: `List all email sequences with step count and enrollment count.
|
|
3107
3121
|
Returns: { sequences: Array<{ id, name, stepCount, enrollmentCount }> }`,
|
|
@@ -3110,8 +3124,8 @@ Returns: { sequences: Array<{ id, name, stepCount, enrollmentCount }> }`,
|
|
|
3110
3124
|
}
|
|
3111
3125
|
//#endregion
|
|
3112
3126
|
//#region src/mcp/tools/generate-quote.ts
|
|
3113
|
-
const DATA_DIR$
|
|
3114
|
-
async function handleGenerateQuote(input, dataDir = DATA_DIR$
|
|
3127
|
+
const DATA_DIR$17 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3128
|
+
async function handleGenerateQuote(input, dataDir = DATA_DIR$17) {
|
|
3115
3129
|
try {
|
|
3116
3130
|
const quote = await generateQuote(dataDir, input);
|
|
3117
3131
|
return { content: [{
|
|
@@ -3135,7 +3149,7 @@ async function handleGenerateQuote(input, dataDir = DATA_DIR$16) {
|
|
|
3135
3149
|
}] };
|
|
3136
3150
|
}
|
|
3137
3151
|
}
|
|
3138
|
-
function registerGenerateQuote(server, dataDir = DATA_DIR$
|
|
3152
|
+
function registerGenerateQuote(server, dataDir = DATA_DIR$17) {
|
|
3139
3153
|
server.registerTool("generate_quote", {
|
|
3140
3154
|
description: `Generate a professional HTML quote/offer for a customer deal.
|
|
3141
3155
|
Calculates subtotal, VAT, and total. Saves JSON + HTML to .agentic/quotes/.
|
|
@@ -3163,8 +3177,8 @@ Returns: { quoteNumber, htmlPath, total, currency, validUntil }`,
|
|
|
3163
3177
|
}
|
|
3164
3178
|
//#endregion
|
|
3165
3179
|
//#region src/mcp/tools/get-quote-status.ts
|
|
3166
|
-
const DATA_DIR$
|
|
3167
|
-
async function handleGetQuoteStatus(input, dataDir = DATA_DIR$
|
|
3180
|
+
const DATA_DIR$16 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3181
|
+
async function handleGetQuoteStatus(input, dataDir = DATA_DIR$16) {
|
|
3168
3182
|
if (input.quoteNumber) {
|
|
3169
3183
|
const quote = readQuote(dataDir, input.quoteNumber);
|
|
3170
3184
|
if (!quote) return { content: [{
|
|
@@ -3182,7 +3196,7 @@ async function handleGetQuoteStatus(input, dataDir = DATA_DIR$15) {
|
|
|
3182
3196
|
text: JSON.stringify({ quotes }, null, 2)
|
|
3183
3197
|
}] };
|
|
3184
3198
|
}
|
|
3185
|
-
function registerGetQuoteStatus(server, dataDir = DATA_DIR$
|
|
3199
|
+
function registerGetQuoteStatus(server, dataDir = DATA_DIR$16) {
|
|
3186
3200
|
server.registerTool("get_quote_status", {
|
|
3187
3201
|
description: `Get quote status and details. Filter by quoteNumber (single quote) or slug (all quotes for a customer).
|
|
3188
3202
|
Returns quote with status: draft | sent | viewed | accepted | declined`,
|
|
@@ -3197,7 +3211,7 @@ Returns quote with status: draft | sent | viewed | accepted | declined`,
|
|
|
3197
3211
|
}
|
|
3198
3212
|
//#endregion
|
|
3199
3213
|
//#region src/mcp/tools/get-booking-link.ts
|
|
3200
|
-
const DATA_DIR$
|
|
3214
|
+
const DATA_DIR$15 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3201
3215
|
function loadCalendlyConfig(dataDir) {
|
|
3202
3216
|
const p = path.join(dataDir, ".agentic", "integrations", "calendly.yaml");
|
|
3203
3217
|
if (!fs.existsSync(p)) return {};
|
|
@@ -3220,7 +3234,7 @@ function readCustomerFacts(dataDir, slug) {
|
|
|
3220
3234
|
...email ? { email } : {}
|
|
3221
3235
|
};
|
|
3222
3236
|
}
|
|
3223
|
-
async function handleGetBookingLink(input, dataDir = DATA_DIR$
|
|
3237
|
+
async function handleGetBookingLink(input, dataDir = DATA_DIR$15) {
|
|
3224
3238
|
const config = loadCalendlyConfig(dataDir);
|
|
3225
3239
|
const apiKey = config.apiKey ?? process.env["CALENDLY_API_KEY"] ?? "";
|
|
3226
3240
|
if (!apiKey) return { content: [{
|
|
@@ -3248,7 +3262,7 @@ async function handleGetBookingLink(input, dataDir = DATA_DIR$14) {
|
|
|
3248
3262
|
}] };
|
|
3249
3263
|
}
|
|
3250
3264
|
}
|
|
3251
|
-
function registerGetBookingLink(server, dataDir = DATA_DIR$
|
|
3265
|
+
function registerGetBookingLink(server, dataDir = DATA_DIR$15) {
|
|
3252
3266
|
server.registerTool("get_booking_link", {
|
|
3253
3267
|
description: `Get a Calendly booking link for a customer. Optionally pre-fills the customer's name/email.
|
|
3254
3268
|
Requires CALENDLY_API_KEY env var or .agentic/integrations/calendly.yaml config.
|
|
@@ -3266,8 +3280,8 @@ Returns: { bookingUrl, eventType, duration }`,
|
|
|
3266
3280
|
}
|
|
3267
3281
|
//#endregion
|
|
3268
3282
|
//#region src/mcp/tools/create-ticket.ts
|
|
3269
|
-
const DATA_DIR$
|
|
3270
|
-
async function handleCreateTicket(input, dataDir = DATA_DIR$
|
|
3283
|
+
const DATA_DIR$14 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3284
|
+
async function handleCreateTicket(input, dataDir = DATA_DIR$14) {
|
|
3271
3285
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
3272
3286
|
const rules = loadSlaRules(dataDir);
|
|
3273
3287
|
const priority = input.priority ?? "normal";
|
|
@@ -3289,7 +3303,7 @@ async function handleCreateTicket(input, dataDir = DATA_DIR$13) {
|
|
|
3289
3303
|
text: JSON.stringify({ ticket }, null, 2)
|
|
3290
3304
|
}] };
|
|
3291
3305
|
}
|
|
3292
|
-
function registerCreateTicket(server, dataDir = DATA_DIR$
|
|
3306
|
+
function registerCreateTicket(server, dataDir = DATA_DIR$14) {
|
|
3293
3307
|
server.registerTool("create_ticket", {
|
|
3294
3308
|
description: `Create a support ticket for a customer. Auto-calculates SLA due date based on priority.
|
|
3295
3309
|
Returns: { ticket } with id T-NNN, status=open, slaDue`,
|
|
@@ -3315,8 +3329,8 @@ Returns: { ticket } with id T-NNN, status=open, slaDue`,
|
|
|
3315
3329
|
}
|
|
3316
3330
|
//#endregion
|
|
3317
3331
|
//#region src/mcp/tools/update-ticket.ts
|
|
3318
|
-
const DATA_DIR$
|
|
3319
|
-
async function handleUpdateTicket(input, dataDir = DATA_DIR$
|
|
3332
|
+
const DATA_DIR$13 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3333
|
+
async function handleUpdateTicket(input, dataDir = DATA_DIR$13) {
|
|
3320
3334
|
const ticket = (await readTickets(dataDir, input.slug)).find((t) => t.id === input.ticketId);
|
|
3321
3335
|
if (!ticket) return { content: [{
|
|
3322
3336
|
type: "text",
|
|
@@ -3335,7 +3349,7 @@ async function handleUpdateTicket(input, dataDir = DATA_DIR$12) {
|
|
|
3335
3349
|
text: JSON.stringify({ ticket: updated }, null, 2)
|
|
3336
3350
|
}] };
|
|
3337
3351
|
}
|
|
3338
|
-
function registerUpdateTicket(server, dataDir = DATA_DIR$
|
|
3352
|
+
function registerUpdateTicket(server, dataDir = DATA_DIR$13) {
|
|
3339
3353
|
server.registerTool("update_ticket", {
|
|
3340
3354
|
description: `Update a ticket's status or assignee. Setting status=resolved auto-sets resolved date.
|
|
3341
3355
|
Returns: { ticket }`,
|
|
@@ -3360,8 +3374,8 @@ Returns: { ticket }`,
|
|
|
3360
3374
|
}
|
|
3361
3375
|
//#endregion
|
|
3362
3376
|
//#region src/mcp/tools/list-tickets.ts
|
|
3363
|
-
const DATA_DIR$
|
|
3364
|
-
async function handleListTickets(input, dataDir = DATA_DIR$
|
|
3377
|
+
const DATA_DIR$12 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3378
|
+
async function handleListTickets(input, dataDir = DATA_DIR$12) {
|
|
3365
3379
|
const results = await listAllTickets(dataDir, {
|
|
3366
3380
|
...input.slug !== void 0 ? { slug: input.slug } : {},
|
|
3367
3381
|
...input.status !== void 0 ? { status: input.status } : {},
|
|
@@ -3373,7 +3387,7 @@ async function handleListTickets(input, dataDir = DATA_DIR$11) {
|
|
|
3373
3387
|
text: JSON.stringify({ tickets: results }, null, 2)
|
|
3374
3388
|
}] };
|
|
3375
3389
|
}
|
|
3376
|
-
function registerListTickets(server, dataDir = DATA_DIR$
|
|
3390
|
+
function registerListTickets(server, dataDir = DATA_DIR$12) {
|
|
3377
3391
|
server.registerTool("list_tickets", {
|
|
3378
3392
|
description: `List support tickets. Filter by customer, status, priority, or assignee. Sorted by priority then date.
|
|
3379
3393
|
Returns: { tickets: Array<{ slug, ticket }> }`,
|
|
@@ -3403,8 +3417,8 @@ Returns: { tickets: Array<{ slug, ticket }> }`,
|
|
|
3403
3417
|
}
|
|
3404
3418
|
//#endregion
|
|
3405
3419
|
//#region src/mcp/tools/close-ticket.ts
|
|
3406
|
-
const DATA_DIR$
|
|
3407
|
-
async function handleCloseTicket(input, dataDir = DATA_DIR$
|
|
3420
|
+
const DATA_DIR$11 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3421
|
+
async function handleCloseTicket(input, dataDir = DATA_DIR$11) {
|
|
3408
3422
|
const ticket = (await readTickets(dataDir, input.slug)).find((t) => t.id === input.ticketId);
|
|
3409
3423
|
if (!ticket) return { content: [{
|
|
3410
3424
|
type: "text",
|
|
@@ -3431,7 +3445,7 @@ async function handleCloseTicket(input, dataDir = DATA_DIR$10) {
|
|
|
3431
3445
|
text: JSON.stringify({ ticket: updated }, null, 2)
|
|
3432
3446
|
}] };
|
|
3433
3447
|
}
|
|
3434
|
-
function registerCloseTicket(server, dataDir = DATA_DIR$
|
|
3448
|
+
function registerCloseTicket(server, dataDir = DATA_DIR$11) {
|
|
3435
3449
|
server.registerTool("close_ticket", {
|
|
3436
3450
|
description: `Close a support ticket. Optionally logs the resolution as an interaction.
|
|
3437
3451
|
Returns: { ticket } with status=closed`,
|
|
@@ -3448,8 +3462,8 @@ Returns: { ticket } with status=closed`,
|
|
|
3448
3462
|
}
|
|
3449
3463
|
//#endregion
|
|
3450
3464
|
//#region src/mcp/tools/send-nps-survey.ts
|
|
3451
|
-
const DATA_DIR$
|
|
3452
|
-
async function handleSendNpsSurvey(input, dataDir = DATA_DIR$
|
|
3465
|
+
const DATA_DIR$10 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3466
|
+
async function handleSendNpsSurvey(input, dataDir = DATA_DIR$10) {
|
|
3453
3467
|
const survey = getSurvey(dataDir, input.surveyId);
|
|
3454
3468
|
if (!survey) return { content: [{
|
|
3455
3469
|
type: "text",
|
|
@@ -3470,7 +3484,7 @@ async function handleSendNpsSurvey(input, dataDir = DATA_DIR$9) {
|
|
|
3470
3484
|
}, null, 2)
|
|
3471
3485
|
}] };
|
|
3472
3486
|
}
|
|
3473
|
-
function registerSendNpsSurvey(server, dataDir = DATA_DIR$
|
|
3487
|
+
function registerSendNpsSurvey(server, dataDir = DATA_DIR$10) {
|
|
3474
3488
|
server.registerTool("send_nps_survey", {
|
|
3475
3489
|
description: `Generate an NPS/CSAT survey email for a customer contact. Returns subject, HTML body, and a token-based response URL.
|
|
3476
3490
|
Does NOT send automatically — returns draft for review.
|
|
@@ -3490,8 +3504,8 @@ Returns: { token, subject, body, surveyUrl }`,
|
|
|
3490
3504
|
}
|
|
3491
3505
|
//#endregion
|
|
3492
3506
|
//#region src/mcp/tools/get-survey-results.ts
|
|
3493
|
-
const DATA_DIR$
|
|
3494
|
-
async function handleGetSurveyResults(input, dataDir = DATA_DIR$
|
|
3507
|
+
const DATA_DIR$9 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3508
|
+
async function handleGetSurveyResults(input, dataDir = DATA_DIR$9) {
|
|
3495
3509
|
const responses = loadSurveyResponses(dataDir, input.surveyId, input.slug);
|
|
3496
3510
|
const nps = calcNpsScore(responses);
|
|
3497
3511
|
const promoters = responses.filter((r) => r.score >= 9).length;
|
|
@@ -3517,7 +3531,7 @@ async function handleGetSurveyResults(input, dataDir = DATA_DIR$8) {
|
|
|
3517
3531
|
}, null, 2)
|
|
3518
3532
|
}] };
|
|
3519
3533
|
}
|
|
3520
|
-
function registerGetSurveyResults(server, dataDir = DATA_DIR$
|
|
3534
|
+
function registerGetSurveyResults(server, dataDir = DATA_DIR$9) {
|
|
3521
3535
|
server.registerTool("get_survey_results", {
|
|
3522
3536
|
description: `Get NPS/CSAT survey results with score breakdown. Calculates Net Promoter Score.
|
|
3523
3537
|
Returns: { npsScore, totalResponses, promoters, passives, detractors, responses[] }`,
|
|
@@ -3532,8 +3546,8 @@ Returns: { npsScore, totalResponses, promoters, passives, detractors, responses[
|
|
|
3532
3546
|
}
|
|
3533
3547
|
//#endregion
|
|
3534
3548
|
//#region src/mcp/tools/search-knowledge-base.ts
|
|
3535
|
-
const DATA_DIR$
|
|
3536
|
-
async function handleSearchKnowledgeBase(input, dataDir = DATA_DIR$
|
|
3549
|
+
const DATA_DIR$8 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3550
|
+
async function handleSearchKnowledgeBase(input, dataDir = DATA_DIR$8) {
|
|
3537
3551
|
const results = searchKbSimple(dataDir, input.query, { ...input.publicOnly ? { publicOnly: true } : {} });
|
|
3538
3552
|
const limited = (input.category ? results.filter((a) => a.category === input.category) : results).slice(0, input.limit ?? 10);
|
|
3539
3553
|
return { content: [{
|
|
@@ -3548,7 +3562,7 @@ async function handleSearchKnowledgeBase(input, dataDir = DATA_DIR$7) {
|
|
|
3548
3562
|
}, null, 2)
|
|
3549
3563
|
}] };
|
|
3550
3564
|
}
|
|
3551
|
-
function registerSearchKnowledgeBase(server, dataDir = DATA_DIR$
|
|
3565
|
+
function registerSearchKnowledgeBase(server, dataDir = DATA_DIR$8) {
|
|
3552
3566
|
server.registerTool("search_knowledge_base", {
|
|
3553
3567
|
description: `Search the knowledge base for articles. Text search on title, body, and tags.
|
|
3554
3568
|
Returns: { count, articles[] } with excerpts`,
|
|
@@ -3567,8 +3581,8 @@ Returns: { count, articles[] } with excerpts`,
|
|
|
3567
3581
|
}
|
|
3568
3582
|
//#endregion
|
|
3569
3583
|
//#region src/mcp/tools/create-kb-article.ts
|
|
3570
|
-
const DATA_DIR$
|
|
3571
|
-
async function handleCreateKbArticle(input, dataDir = DATA_DIR$
|
|
3584
|
+
const DATA_DIR$7 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3585
|
+
async function handleCreateKbArticle(input, dataDir = DATA_DIR$7) {
|
|
3572
3586
|
if (getKbArticle(dataDir, input.id)) return { content: [{
|
|
3573
3587
|
type: "text",
|
|
3574
3588
|
text: JSON.stringify({ error: `Article '${input.id}' already exists` })
|
|
@@ -3596,7 +3610,7 @@ async function handleCreateKbArticle(input, dataDir = DATA_DIR$6) {
|
|
|
3596
3610
|
}, null, 2)
|
|
3597
3611
|
}] };
|
|
3598
3612
|
}
|
|
3599
|
-
function registerCreateKbArticle(server, dataDir = DATA_DIR$
|
|
3613
|
+
function registerCreateKbArticle(server, dataDir = DATA_DIR$7) {
|
|
3600
3614
|
server.registerTool("create_kb_article", {
|
|
3601
3615
|
description: `Create a new knowledge base article. Articles are stored as Markdown files in .agentic/knowledge-base/.
|
|
3602
3616
|
Returns: { id, title, category, path }`,
|
|
@@ -3621,8 +3635,8 @@ Returns: { id, title, category, path }`,
|
|
|
3621
3635
|
}
|
|
3622
3636
|
//#endregion
|
|
3623
3637
|
//#region src/mcp/tools/backup-now.ts
|
|
3624
|
-
const DATA_DIR$
|
|
3625
|
-
async function handleBackupNow(input, dataDir = DATA_DIR$
|
|
3638
|
+
const DATA_DIR$6 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3639
|
+
async function handleBackupNow(input, dataDir = DATA_DIR$6) {
|
|
3626
3640
|
const zipPath = path.join(dataDir, `dxcrm-backup-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19)}.zip`);
|
|
3627
3641
|
const manifest = await runBackup(zipPath, dataDir, { ...input.remote ? { remote: input.remote } : {} }).catch(() => null);
|
|
3628
3642
|
if (!manifest) return { content: [{
|
|
@@ -3659,8 +3673,8 @@ function registerBackupNow(server) {
|
|
|
3659
3673
|
}
|
|
3660
3674
|
//#endregion
|
|
3661
3675
|
//#region src/mcp/tools/list-backups.ts
|
|
3662
|
-
const DATA_DIR$
|
|
3663
|
-
async function handleListBackups(input, dataDir = DATA_DIR$
|
|
3676
|
+
const DATA_DIR$5 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3677
|
+
async function handleListBackups(input, dataDir = DATA_DIR$5) {
|
|
3664
3678
|
const logEntries = readBackupLog(dataDir);
|
|
3665
3679
|
const fileEntries = listBackupsInDir(dataDir);
|
|
3666
3680
|
const entries = logEntries.length > 0 ? logEntries : fileEntries;
|
|
@@ -3694,8 +3708,8 @@ function registerListBackups(server) {
|
|
|
3694
3708
|
}
|
|
3695
3709
|
//#endregion
|
|
3696
3710
|
//#region src/mcp/tools/trigger-sync.ts
|
|
3697
|
-
const DATA_DIR$
|
|
3698
|
-
async function handleTriggerSync(input, dataDir = DATA_DIR$
|
|
3711
|
+
const DATA_DIR$4 = process.cwd();
|
|
3712
|
+
async function handleTriggerSync(input, dataDir = DATA_DIR$4) {
|
|
3699
3713
|
const auth = getGmailAuth();
|
|
3700
3714
|
if (!auth) return { content: [{
|
|
3701
3715
|
type: "text",
|
|
@@ -3730,7 +3744,7 @@ async function handleTriggerSync(input, dataDir = DATA_DIR$3) {
|
|
|
3730
3744
|
try {
|
|
3731
3745
|
const sources = JSON.parse(fs.readFileSync(sourcesPath, "utf-8"));
|
|
3732
3746
|
if (!sources.gmail?.enabled || !sources.gmail.query) continue;
|
|
3733
|
-
const { syncGmail } = await import("./gmail-sync-
|
|
3747
|
+
const { syncGmail } = await import("./gmail-sync-B4Iu3AQb.js");
|
|
3734
3748
|
const result = await syncGmail({
|
|
3735
3749
|
slug,
|
|
3736
3750
|
dataDir,
|
|
@@ -3789,8 +3803,8 @@ Returns: { success: boolean, synced: number, skipped: number, customers: [...],
|
|
|
3789
3803
|
}
|
|
3790
3804
|
//#endregion
|
|
3791
3805
|
//#region src/mcp/tools/get-audit-log.ts
|
|
3792
|
-
const DATA_DIR$
|
|
3793
|
-
async function handleGetAuditLog(input, dataDir = DATA_DIR$
|
|
3806
|
+
const DATA_DIR$3 = process.cwd();
|
|
3807
|
+
async function handleGetAuditLog(input, dataDir = DATA_DIR$3) {
|
|
3794
3808
|
const entries = readAuditLog(dataDir);
|
|
3795
3809
|
const filterOpts = { limit: input.limit ?? 50 };
|
|
3796
3810
|
if (input.slug !== void 0) filterOpts.slug = input.slug;
|
|
@@ -3831,6 +3845,69 @@ Returns: { total: number, returned: number, entries: [{timestamp, actor, tool, s
|
|
|
3831
3845
|
});
|
|
3832
3846
|
}
|
|
3833
3847
|
//#endregion
|
|
3848
|
+
//#region src/mcp/tools/get-logs.ts
|
|
3849
|
+
const DATA_DIR$2 = process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
3850
|
+
async function handleGetLogs(input, dataDir = DATA_DIR$2) {
|
|
3851
|
+
const query = {
|
|
3852
|
+
...input.level !== void 0 ? { level: input.level } : {},
|
|
3853
|
+
...input.component !== void 0 ? { component: input.component } : {},
|
|
3854
|
+
...input.since !== void 0 ? { since: input.since } : {},
|
|
3855
|
+
...input.contains !== void 0 ? { contains: input.contains } : {},
|
|
3856
|
+
limit: input.limit ?? 100
|
|
3857
|
+
};
|
|
3858
|
+
const payload = input.summary ? summarizeLogs(dataDir, query) : (() => {
|
|
3859
|
+
const entries = queryLogs(dataDir, query);
|
|
3860
|
+
return {
|
|
3861
|
+
returned: entries.length,
|
|
3862
|
+
entries
|
|
3863
|
+
};
|
|
3864
|
+
})();
|
|
3865
|
+
return { content: [{
|
|
3866
|
+
type: "text",
|
|
3867
|
+
text: JSON.stringify(payload, null, 2)
|
|
3868
|
+
}] };
|
|
3869
|
+
}
|
|
3870
|
+
function registerGetLogs(server) {
|
|
3871
|
+
server.registerTool("get_logs", {
|
|
3872
|
+
title: "Get Logs",
|
|
3873
|
+
description: `Read and analyze the structured application log (.agentic/logs.ndjson).
|
|
3874
|
+
Use to answer "what went wrong recently?", "show errors from gmail sync", or "summarize today's activity".
|
|
3875
|
+
|
|
3876
|
+
Args:
|
|
3877
|
+
level: Minimum level to include — debug | info | warn | error (optional)
|
|
3878
|
+
component: Filter by component, e.g. "gmail-sync", "lancedb" (optional)
|
|
3879
|
+
since: ISO timestamp; only entries at or after it (optional)
|
|
3880
|
+
contains: Case-insensitive substring of the message (optional)
|
|
3881
|
+
limit: Max entries to return (default 100, most recent)
|
|
3882
|
+
summary: When true, return aggregated counts (by level + component) and recent errors instead of raw entries
|
|
3883
|
+
|
|
3884
|
+
Returns (entries): { returned: number, entries: [{ts, level, component, message, context?}] }
|
|
3885
|
+
Returns (summary): { total, byLevel, byComponent, firstTs, lastTs, recentErrors }`,
|
|
3886
|
+
inputSchema: z.object({
|
|
3887
|
+
level: z.enum([
|
|
3888
|
+
"debug",
|
|
3889
|
+
"info",
|
|
3890
|
+
"warn",
|
|
3891
|
+
"error"
|
|
3892
|
+
]).optional().describe("Minimum level"),
|
|
3893
|
+
component: z.string().optional().describe("Filter by component"),
|
|
3894
|
+
since: z.string().optional().describe("ISO timestamp lower bound"),
|
|
3895
|
+
contains: z.string().optional().describe("Message substring filter"),
|
|
3896
|
+
limit: z.number().int().min(1).max(1e3).optional().describe("Max entries (default 100)"),
|
|
3897
|
+
summary: z.boolean().optional().describe("Return aggregated summary instead of entries")
|
|
3898
|
+
})
|
|
3899
|
+
}, async ({ level, component, since, contains, limit, summary }) => {
|
|
3900
|
+
const input = {};
|
|
3901
|
+
if (level !== void 0) input.level = level;
|
|
3902
|
+
if (component !== void 0) input.component = component;
|
|
3903
|
+
if (since !== void 0) input.since = since;
|
|
3904
|
+
if (contains !== void 0) input.contains = contains;
|
|
3905
|
+
if (limit !== void 0) input.limit = limit;
|
|
3906
|
+
if (summary !== void 0) input.summary = summary;
|
|
3907
|
+
return handleGetLogs(input);
|
|
3908
|
+
});
|
|
3909
|
+
}
|
|
3910
|
+
//#endregion
|
|
3834
3911
|
//#region src/mcp/prompts.ts
|
|
3835
3912
|
/**
|
|
3836
3913
|
* CRM playbook prompts exposed via MCP `prompts/list` + `prompts/get`.
|
|
@@ -3899,7 +3976,7 @@ function registerResources(server, dataDir = DATA_DIR$1) {
|
|
|
3899
3976
|
description: "LLM-ready briefing (main facts, recent interactions, pipeline) for a customer",
|
|
3900
3977
|
mimeType: "text/markdown"
|
|
3901
3978
|
}, async (uri, variables) => {
|
|
3902
|
-
const { buildContext } = await import("./context-builder-
|
|
3979
|
+
const { buildContext } = await import("./context-builder-hmOPvgso.js");
|
|
3903
3980
|
const text = await buildContext(dataDir, String(variables["slug"]));
|
|
3904
3981
|
return { contents: [{
|
|
3905
3982
|
uri: uri.href,
|
|
@@ -3912,7 +3989,7 @@ function registerResources(server, dataDir = DATA_DIR$1) {
|
|
|
3912
3989
|
description: "Open and closed deals for a customer",
|
|
3913
3990
|
mimeType: "application/json"
|
|
3914
3991
|
}, async (uri, variables) => {
|
|
3915
|
-
const { readPipeline } = await import("./pipeline-writer-
|
|
3992
|
+
const { readPipeline } = await import("./pipeline-writer-0LJ6Qkat.js");
|
|
3916
3993
|
const deals = await readPipeline(dataDir, String(variables["slug"]));
|
|
3917
3994
|
return { contents: [{
|
|
3918
3995
|
uri: uri.href,
|
|
@@ -3925,7 +4002,7 @@ function registerResources(server, dataDir = DATA_DIR$1) {
|
|
|
3925
4002
|
description: "Newest-first interaction history for a customer",
|
|
3926
4003
|
mimeType: "text/markdown"
|
|
3927
4004
|
}, async (uri, variables) => {
|
|
3928
|
-
const { readInteractions } = await import("./interactions-writer-
|
|
4005
|
+
const { readInteractions } = await import("./interactions-writer-B2y-73lh.js");
|
|
3929
4006
|
const text = await readInteractions(dataDir, String(variables["slug"]));
|
|
3930
4007
|
return { contents: [{
|
|
3931
4008
|
uri: uri.href,
|
|
@@ -3966,7 +4043,7 @@ function handleCreateRecord(input, dataDir = DATA_DIR) {
|
|
|
3966
4043
|
enforceRbac(dataDir, "create_record");
|
|
3967
4044
|
const res = createRecord(dataDir, input.object, input.values);
|
|
3968
4045
|
if (!res.ok) return json({ error: (res.errors ?? []).join("; ") });
|
|
3969
|
-
import("./webhooks-
|
|
4046
|
+
import("./webhooks-DXr1IoKn.js").then(({ emitEvent }) => emitEvent(dataDir, "record.created", {
|
|
3970
4047
|
object: input.object,
|
|
3971
4048
|
record: res.record
|
|
3972
4049
|
}));
|
|
@@ -4086,6 +4163,7 @@ function createMcpServer() {
|
|
|
4086
4163
|
registerListBackups(server);
|
|
4087
4164
|
registerTriggerSync(server);
|
|
4088
4165
|
registerGetAuditLog(server);
|
|
4166
|
+
registerGetLogs(server);
|
|
4089
4167
|
registerCustomObjectTools(server);
|
|
4090
4168
|
registerPrompts(server);
|
|
4091
4169
|
registerResources(server);
|
|
@@ -4096,7 +4174,7 @@ async function startStdio() {
|
|
|
4096
4174
|
const server = createMcpServer();
|
|
4097
4175
|
const transport = new StdioServerTransport();
|
|
4098
4176
|
await server.connect(transport);
|
|
4099
|
-
|
|
4177
|
+
logger.info("mcp-server", "running via stdio");
|
|
4100
4178
|
}
|
|
4101
4179
|
async function startHttp(port = 3847) {
|
|
4102
4180
|
await initOAuthFromDisk(process.cwd());
|
|
@@ -4136,7 +4214,7 @@ async function startHttp(port = 3847) {
|
|
|
4136
4214
|
});
|
|
4137
4215
|
app.get("/sessions", async (_req, res) => {
|
|
4138
4216
|
try {
|
|
4139
|
-
const { readAllSessions } = await import("./session-
|
|
4217
|
+
const { readAllSessions } = await import("./session-Bp4zTh4l.js");
|
|
4140
4218
|
const sessions = readAllSessions(dataDir);
|
|
4141
4219
|
res.json({ sessions });
|
|
4142
4220
|
} catch {
|
|
@@ -4248,7 +4326,7 @@ button{margin-top:12px;padding:12px 28px;background:#1a1a2e;color:#fff;border:no
|
|
|
4248
4326
|
res.status(400).send("<h2>Invalid score. Please use the link from your email.</h2>");
|
|
4249
4327
|
return;
|
|
4250
4328
|
}
|
|
4251
|
-
const { recordSurveyResponse } = await import("./survey-engine-
|
|
4329
|
+
const { recordSurveyResponse } = await import("./survey-engine-DKctGcLQ.js");
|
|
4252
4330
|
await recordSurveyResponse(dataDir, token, numScore).catch(() => null);
|
|
4253
4331
|
res.setHeader("content-type", "text/html");
|
|
4254
4332
|
res.send(surveyThankYouPage(numScore));
|
|
@@ -4264,24 +4342,24 @@ button{margin-top:12px;padding:12px 28px;background:#1a1a2e;color:#fff;border:no
|
|
|
4264
4342
|
res.status(400).send("<h2>Invalid score. Please go back and enter a number between 0 and 10.</h2>");
|
|
4265
4343
|
return;
|
|
4266
4344
|
}
|
|
4267
|
-
const { recordSurveyResponse } = await import("./survey-engine-
|
|
4345
|
+
const { recordSurveyResponse } = await import("./survey-engine-DKctGcLQ.js");
|
|
4268
4346
|
await recordSurveyResponse(dataDir, token, numScore, commentText || void 0).catch(() => null);
|
|
4269
4347
|
res.setHeader("content-type", "text/html");
|
|
4270
4348
|
res.send(surveyThankYouPage(numScore, commentText));
|
|
4271
4349
|
});
|
|
4272
4350
|
app.listen(port, () => {
|
|
4273
|
-
|
|
4351
|
+
logger.info("mcp-server", "running over http", { url: `http://0.0.0.0:${port}/mcp` });
|
|
4274
4352
|
});
|
|
4275
4353
|
}
|
|
4276
4354
|
if ((process.env["DXCRM_MCP_MODE"] ?? "stdio") === "http") startHttp(parseInt(process.env["DXCRM_MCP_PORT"] ?? "3847", 10)).catch((err) => {
|
|
4277
|
-
|
|
4355
|
+
logger.error("mcp-server", "fatal error", { error: err.message });
|
|
4278
4356
|
process.exit(1);
|
|
4279
4357
|
});
|
|
4280
4358
|
else startStdio().catch((err) => {
|
|
4281
|
-
|
|
4359
|
+
logger.error("mcp-server", "fatal error", { error: err.message });
|
|
4282
4360
|
process.exit(1);
|
|
4283
4361
|
});
|
|
4284
4362
|
//#endregion
|
|
4285
4363
|
export { startHttp, startStdio };
|
|
4286
4364
|
|
|
4287
|
-
//# sourceMappingURL=server-
|
|
4365
|
+
//# sourceMappingURL=server-DoRPPOeR.js.map
|