Phase 2 part 1: the CRM bridge to EspoCRM through Hermes

Supermarket queues CRM work in crm_actions and never writes to EspoCRM
itself. A Hermes cron job (supermarket-crm, set up by `supermarket
hermes`) runs every 15 minutes behind a monitor script that prints
Supermarket's crm-state file, so unchanged state skips the AI run. Hermes
calls the new MCP tools crm_pending_actions, crm_report_result and
crm_ingest, creating each record through the Core's MCP hub unless a
match exists, and copying Leads, Accounts and Contacts back every 6 hours
for duplicate checks. Schema 5 adds crm_actions and crm_records.

Prospects -> CRM queue shows the queue, a test Lead, sync, Retry and
Cancel. When an action fails with a connection error, the page checks
EspoCRM from this computer and says whether the CRM is down or the hub
can't reach it, with a note to send to the Core's maintainer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 16:28:46 -07:00
co-authored by Claude Opus 5.5
parent 5feb6a16d4
commit 1dc5476d43
15 changed files with 1586 additions and 30 deletions
+6 -1
View File
@@ -99,11 +99,16 @@ func (c *Core) Services() []Service {
return []Service{
{"Gitea", "https://gitea." + c.Domain},
{"Plausible", "https://plausible." + c.Domain},
{"EspoCRM", "https://espocrm." + c.Domain},
{"EspoCRM", c.EspoCRMURL()},
{"MCP hub", c.MCPHubURL()},
}
}
// EspoCRMURL is EspoCRM's usual address on the Core.
func (c *Core) EspoCRMURL() string {
return "https://espocrm." + c.Domain
}
// MCPHubURL is the Core MCP hub's SSE endpoint for this user, which Hermes
// connects to.
func (c *Core) MCPHubURL() string {