@datasynx/agentic-crm 1.0.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.
Files changed (81) hide show
  1. package/README.md +8 -1
  2. package/dist/{ask-D8iYqDAr.js → ask-CDysGnRg.js} +2 -2
  3. package/dist/{ask-D8iYqDAr.js.map → ask-CDysGnRg.js.map} +1 -1
  4. package/dist/attachments-CX2GAtsw.cjs +517 -0
  5. package/dist/attachments-CX2GAtsw.cjs.map +1 -0
  6. package/dist/attachments-D207gXfN.js +514 -0
  7. package/dist/attachments-D207gXfN.js.map +1 -0
  8. package/dist/attachments-rLa96rOK.js +514 -0
  9. package/dist/attachments-rLa96rOK.js.map +1 -0
  10. package/dist/chunk-BfDYWZQ8.cjs +32 -0
  11. package/dist/chunk-BfDYWZQ8.cjs.map +1 -0
  12. package/dist/chunk-BhUZmQg5.js +32 -0
  13. package/dist/chunk-BhUZmQg5.js.map +1 -0
  14. package/dist/chunk-ChC83jai.js +2 -0
  15. package/dist/chunk-e_w8qqtP.js +32 -0
  16. package/dist/chunk-e_w8qqtP.js.map +1 -0
  17. package/dist/cli.js +16 -15
  18. package/dist/cli.js.map +1 -1
  19. package/dist/daemon/worker.js +3 -3
  20. package/dist/email-body-BFSRa0AW.cjs +42 -0
  21. package/dist/email-body-BFSRa0AW.cjs.map +1 -0
  22. package/dist/email-body-BOd7U-D2.js +42 -0
  23. package/dist/email-body-BOd7U-D2.js.map +1 -0
  24. package/dist/{gmail-sync-DueE6tl5.js → gmail-sync-B4Iu3AQb.js} +45 -15
  25. package/dist/gmail-sync-B4Iu3AQb.js.map +1 -0
  26. package/dist/{gmail-sync-GEy3oVvw.cjs → gmail-sync-BpSVESSe.cjs} +45 -15
  27. package/dist/gmail-sync-BpSVESSe.cjs.map +1 -0
  28. package/dist/{gmail-sync-C-NmibzS.js → gmail-sync-DIbrPnTK.js} +45 -15
  29. package/dist/gmail-sync-DIbrPnTK.js.map +1 -0
  30. package/dist/{gmail-webhook-handler-kGKpbY9h.js → gmail-webhook-handler-BzOFbvgh.js} +2 -2
  31. package/dist/{gmail-webhook-handler-kGKpbY9h.js.map → gmail-webhook-handler-BzOFbvgh.js.map} +1 -1
  32. package/dist/{gmail-webhook-handler-B26COilD.js → gmail-webhook-handler-CvSDW_Js.js} +1 -1
  33. package/dist/{google-drive-sync-D1n7WKZn.js → google-drive-sync-B_I1d54Y.js} +2 -2
  34. package/dist/{google-drive-sync-D1n7WKZn.js.map → google-drive-sync-B_I1d54Y.js.map} +1 -1
  35. package/dist/html-BaeOCZKE.js +36 -0
  36. package/dist/html-BaeOCZKE.js.map +1 -0
  37. package/dist/html-CmOku6jS.cjs +47 -0
  38. package/dist/html-CmOku6jS.cjs.map +1 -0
  39. package/dist/{import-hubspot-DB4n89jy.js → import-hubspot-CTId9IGV.js} +2 -2
  40. package/dist/{import-hubspot-DB4n89jy.js.map → import-hubspot-CTId9IGV.js.map} +1 -1
  41. package/dist/{index-pY7tYXwH.d.cts → index-BAutNcAT.d.cts} +13 -9
  42. package/dist/index-BAutNcAT.d.cts.map +1 -0
  43. package/dist/{index-B0IMMrp_.d.ts → index-FzDsNSSb.d.ts} +5 -1
  44. package/dist/index-FzDsNSSb.d.ts.map +1 -0
  45. package/dist/index.d.cts +13 -9
  46. package/dist/index.d.cts.map +1 -1
  47. package/dist/index.d.ts +5 -1
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/{interactions-writer-RJB8SWf2.js → interactions-writer-B2y-73lh.js} +1 -1
  50. package/dist/{interactions-writer-DbSyI2rt.js → interactions-writer-B8XAzdqR.js} +3 -2
  51. package/dist/interactions-writer-B8XAzdqR.js.map +1 -0
  52. package/dist/{interactions-writer-a2yzBd7T.cjs → interactions-writer-BRJNrefF.cjs} +3 -2
  53. package/dist/interactions-writer-BRJNrefF.cjs.map +1 -0
  54. package/dist/{interactions-writer-BZzUIgJd.js → interactions-writer-ZQcpFOh9.js} +3 -2
  55. package/dist/interactions-writer-ZQcpFOh9.js.map +1 -0
  56. package/dist/{knowledge-base-DHNc4hVj.js → knowledge-base--063Kpa3.js} +9 -7
  57. package/dist/{knowledge-base-DHNc4hVj.js.map → knowledge-base--063Kpa3.js.map} +1 -1
  58. package/dist/mcp.cjs +44 -22
  59. package/dist/mcp.cjs.map +1 -1
  60. package/dist/mcp.js +44 -22
  61. package/dist/mcp.js.map +1 -1
  62. package/dist/{microsoft-calendar-jIu9K5zX.js → microsoft-calendar-BgVR8GDv.js} +3 -3
  63. package/dist/{microsoft-calendar-jIu9K5zX.js.map → microsoft-calendar-BgVR8GDv.js.map} +1 -1
  64. package/dist/{microsoft-sync-R_r8HL-B.js → microsoft-sync-D30_XksI.js} +3 -3
  65. package/dist/{microsoft-sync-R_r8HL-B.js.map → microsoft-sync-D30_XksI.js.map} +1 -1
  66. package/dist/{nba-mTJ4yEqD.js → nba-DwdfM93s.js} +2 -2
  67. package/dist/{nba-mTJ4yEqD.js.map → nba-DwdfM93s.js.map} +1 -1
  68. package/dist/{server-DqSMYhSA.js → server-DoRPPOeR.js} +39 -19
  69. package/dist/server-DoRPPOeR.js.map +1 -0
  70. package/dist/{transcript-watcher-0mh2ZhmH.js → transcript-watcher-BoClrJAz.js} +2 -2
  71. package/dist/{transcript-watcher-0mh2ZhmH.js.map → transcript-watcher-BoClrJAz.js.map} +1 -1
  72. package/package.json +12 -1
  73. package/dist/gmail-sync-C-NmibzS.js.map +0 -1
  74. package/dist/gmail-sync-DueE6tl5.js.map +0 -1
  75. package/dist/gmail-sync-GEy3oVvw.cjs.map +0 -1
  76. package/dist/index-B0IMMrp_.d.ts.map +0 -1
  77. package/dist/index-pY7tYXwH.d.cts.map +0 -1
  78. package/dist/interactions-writer-BZzUIgJd.js.map +0 -1
  79. package/dist/interactions-writer-DbSyI2rt.js.map +0 -1
  80. package/dist/interactions-writer-a2yzBd7T.cjs.map +0 -1
  81. package/dist/server-DqSMYhSA.js.map +0 -1
package/dist/mcp.js CHANGED
@@ -2,7 +2,7 @@ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
2
  import { A as writeMainFacts, C as writeJsonArray, D as ensureCustomerDir, E as customerExists, M as isSafePathSegment, O as listCustomerSlugs, S as readJsonFile, T as assertSafeSlug, a as customerVisibility, d as readAuditLog, f as writeAuditEntry, h as runBackup, i as canSeeCustomer, j as assertSafePathSegment, k as readMainFacts, l as filterAuditLog, m as readBackupLog, n as getSession, o as enforceRbac, p as listBackupsInDir, u as getActor, w as writeJsonFile, x as readJsonArray } from "./session-store-DWxJ5Pof.js";
3
3
  import { t as writeFileAtomic } from "./atomic-write-8yjqqLtS.js";
4
4
  import { t as withFileQueue } from "./write-queue-IbsAjUnh.js";
5
- import { n as formatInteractionEntry, t as appendInteraction } from "./interactions-writer-BZzUIgJd.js";
5
+ import { n as formatInteractionEntry, t as appendInteraction } from "./interactions-writer-ZQcpFOh9.js";
6
6
  import { n as queryLogs, r as summarizeLogs, t as logger } from "./logger-UaF5p9d1.js";
7
7
  import { i as upsertDeal, n as readPipeline, r as readPipelineSync } from "./pipeline-writer-rDj-ni6q.js";
8
8
  import { i as guardIsoDate, t as callLlm } from "./llm-BnSUBisu.js";
@@ -398,7 +398,7 @@ Config: \`.agentic/rbac.json\` | Actor: \`DXCRM_ACTOR\` env var
398
398
  | log_interaction | Write a new interaction entry (call, email, meeting, note) — immediately searchable | rep+ |
399
399
  | update_deal | Create or update a deal in pipeline.md — upserts by deal name | rep+ |
400
400
  | update_customer_facts | Update fields in customer profile (domain, contact, stage, tags) | admin |
401
- | export_customer | Export all customer data as JSON or Markdown | admin |
401
+ | export_customer | Export all customer data (incl. attachment contents) as JSON or Markdown | admin |
402
402
  | get_deal_health | Score deal health 0–100 (A–F grade) based on activity, velocity, close date, probability | any |
403
403
  | get_pipeline_forecast | Aggregate weighted pipeline revenue across all customers grouped by stage | any |
404
404
  | get_pipeline_stages | List all configured pipeline stages (defaults: lead, qualified, proposal, negotiation, won, lost) | any |
@@ -532,12 +532,14 @@ RBAC: admin
532
532
  - Input: slug (required) + any combination of the optional fields
533
533
  - Returns: { success: boolean, facts: object }
534
534
 
535
- ### export_customer({ slug, format? })
536
- Export all customer data (main_facts + interactions count + pipeline + attachments list).
535
+ ### export_customer({ slug, format?, includeAttachmentContent? })
536
+ Export all customer data (main_facts + interactions + pipeline + attachments).
537
+ Set includeAttachmentContent to inline every attachment's converted Markdown —
538
+ a single sendable bundle of all conversations and documents for the customer.
537
539
  RBAC: admin
538
- - Input: { slug: string, format?: "json" | "markdown" (default "json") }
539
- - Returns (JSON): { slug, exportedAt, mainFacts, interactionsCount, pipeline, attachments }
540
- - Returns (Markdown): Formatted document with all sections
540
+ - Input: { slug: string, format?: "json" | "markdown" (default "json"), includeAttachmentContent?: boolean (default false) }
541
+ - Returns (JSON): { slug, exportedAt, mainFacts, interactionsCount, pipeline, attachments[, attachmentContents] }
542
+ - Returns (Markdown): Formatted document with all sections (and attachment contents when requested)
541
543
 
542
544
  ### get_deal_health({ slug })
543
545
  Score the health of all deals for a customer based on activity recency, stage velocity,
@@ -1432,7 +1434,7 @@ function triggerOnQuerySync(dataDir, slug) {
1432
1434
  const sources = JSON.parse(fs.readFileSync(sourcesPath, "utf-8"));
1433
1435
  if (!sources.gmail?.enabled || !sources.gmail.query) return;
1434
1436
  const query = sources.gmail.query;
1435
- import("./gmail-sync-C-NmibzS.js").then(({ syncGmail }) => syncGmail({
1437
+ import("./gmail-sync-DIbrPnTK.js").then(({ syncGmail }) => syncGmail({
1436
1438
  slug,
1437
1439
  dataDir,
1438
1440
  auth,
@@ -2371,14 +2373,27 @@ async function handleExportCustomer(input, dataDir = DATA_DIR$47) {
2371
2373
  interactionsCount = countInteractions(interactionsContent);
2372
2374
  }
2373
2375
  const pipeline = await readPipeline(dataDir, input.slug);
2376
+ const includeAttachmentContent = input.includeAttachmentContent ?? false;
2374
2377
  const attachmentsDir = path.join(customerDir, "attachments");
2375
2378
  const attachments = [];
2379
+ const attachmentContents = {};
2376
2380
  if (fs.existsSync(attachmentsDir)) try {
2377
2381
  const files = fs.readdirSync(attachmentsDir);
2378
2382
  for (const f of files) try {
2379
- if (fs.statSync(path.join(attachmentsDir, f)).isFile()) attachments.push(f);
2383
+ if (!fs.statSync(path.join(attachmentsDir, f)).isFile()) continue;
2384
+ attachments.push(f);
2385
+ if (includeAttachmentContent && f.endsWith(".md")) attachmentContents[f] = fs.readFileSync(path.join(attachmentsDir, f), "utf-8");
2380
2386
  } catch {}
2381
2387
  } catch {}
2388
+ const attachmentContentSection = () => {
2389
+ const entries = Object.entries(attachmentContents);
2390
+ if (!includeAttachmentContent || entries.length === 0) return [];
2391
+ return [
2392
+ "",
2393
+ `## Attachment Contents (${entries.length})`,
2394
+ ...entries.map(([name, content]) => `\n### ${name}\n\n${content.trim()}`)
2395
+ ];
2396
+ };
2382
2397
  if (format === "markdown") return { content: [{
2383
2398
  type: "text",
2384
2399
  text: [
@@ -2397,7 +2412,8 @@ async function handleExportCustomer(input, dataDir = DATA_DIR$47) {
2397
2412
  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)",
2398
2413
  "",
2399
2414
  `## Attachments (${attachments.length})`,
2400
- attachments.length > 0 ? attachments.map((f) => `- ${f}`).join("\n") : "(none)"
2415
+ attachments.length > 0 ? attachments.map((f) => `- ${f}`).join("\n") : "(none)",
2416
+ ...attachmentContentSection()
2401
2417
  ].join("\n")
2402
2418
  }] };
2403
2419
  const exported = {
@@ -2406,7 +2422,8 @@ async function handleExportCustomer(input, dataDir = DATA_DIR$47) {
2406
2422
  mainFacts,
2407
2423
  interactionsCount,
2408
2424
  pipeline,
2409
- attachments
2425
+ attachments,
2426
+ ...includeAttachmentContent ? { attachmentContents } : {}
2410
2427
  };
2411
2428
  return { content: [{
2412
2429
  type: "text",
@@ -2416,23 +2433,28 @@ async function handleExportCustomer(input, dataDir = DATA_DIR$47) {
2416
2433
  function registerExportCustomer(server) {
2417
2434
  server.registerTool("export_customer", {
2418
2435
  title: "Export Customer",
2419
- description: `Export all customer data (main_facts + interactions count + pipeline deals).
2420
- Useful for reporting, audits, or creating backups.
2436
+ description: `Export all customer data (main_facts + interactions + pipeline deals + attachments).
2437
+ Useful for reporting, audits, handoffs, or creating a complete sendable bundle
2438
+ of every conversation and document for a customer.
2421
2439
 
2422
2440
  Args:
2423
2441
  slug: Customer ID (e.g. "acme-corp")
2424
2442
  format: Output format — "json" (default) or "markdown"
2443
+ includeAttachmentContent: Inline the converted Markdown of every attachment
2444
+ (default false). Use this to produce a single self-contained bundle.
2425
2445
 
2426
2446
  Returns:
2427
- JSON: { slug, exportedAt, mainFacts, interactionsCount, pipeline }
2428
- Markdown: Formatted document with all sections`,
2447
+ JSON: { slug, exportedAt, mainFacts, interactionsCount, pipeline, attachments[, attachmentContents] }
2448
+ Markdown: Formatted document with all sections (and attachment contents when requested)`,
2429
2449
  inputSchema: z.object({
2430
2450
  slug: z.string().describe("Customer slug (e.g. 'acme-corp')"),
2431
- format: z.enum(["json", "markdown"]).optional().describe("Output format: 'json' (default) or 'markdown'")
2451
+ format: z.enum(["json", "markdown"]).optional().describe("Output format: 'json' (default) or 'markdown'"),
2452
+ includeAttachmentContent: z.boolean().optional().describe("Inline converted attachment Markdown into the export (default false)")
2432
2453
  })
2433
- }, async ({ slug, format }) => handleExportCustomer({
2454
+ }, async ({ slug, format, includeAttachmentContent }) => handleExportCustomer({
2434
2455
  slug,
2435
- ...format !== void 0 ? { format } : {}
2456
+ ...format !== void 0 ? { format } : {},
2457
+ ...includeAttachmentContent !== void 0 ? { includeAttachmentContent } : {}
2436
2458
  }));
2437
2459
  }
2438
2460
  //#endregion
@@ -3541,7 +3563,7 @@ async function executeAction(action, dataDir) {
3541
3563
  if (!slug) return "skipped";
3542
3564
  switch (action.type) {
3543
3565
  case "log_interaction": {
3544
- const { appendInteraction } = await import("./interactions-writer-BZzUIgJd.js").then((n) => n.r);
3566
+ const { appendInteraction } = await import("./interactions-writer-ZQcpFOh9.js").then((n) => n.r);
3545
3567
  await appendInteraction(dataDir, slug, {
3546
3568
  date: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
3547
3569
  type: action.payload["type"] ?? "Note",
@@ -3554,7 +3576,7 @@ async function executeAction(action, dataDir) {
3554
3576
  return "executed";
3555
3577
  }
3556
3578
  case "schedule_meeting": {
3557
- const { appendInteraction } = await import("./interactions-writer-BZzUIgJd.js").then((n) => n.r);
3579
+ const { appendInteraction } = await import("./interactions-writer-ZQcpFOh9.js").then((n) => n.r);
3558
3580
  await appendInteraction(dataDir, slug, {
3559
3581
  date: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
3560
3582
  type: "Note",
@@ -6691,7 +6713,7 @@ async function handleTriggerSync(input, dataDir = DATA_DIR$4) {
6691
6713
  try {
6692
6714
  const sources = JSON.parse(fs.readFileSync(sourcesPath, "utf-8"));
6693
6715
  if (!sources.gmail?.enabled || !sources.gmail.query) continue;
6694
- const { syncGmail } = await import("./gmail-sync-C-NmibzS.js");
6716
+ const { syncGmail } = await import("./gmail-sync-DIbrPnTK.js");
6695
6717
  const result = await syncGmail({
6696
6718
  slug,
6697
6719
  dataDir,
@@ -6949,7 +6971,7 @@ function registerResources(server, dataDir = DATA_DIR$1) {
6949
6971
  description: "Newest-first interaction history for a customer",
6950
6972
  mimeType: "text/markdown"
6951
6973
  }, async (uri, variables) => {
6952
- const { readInteractions } = await import("./interactions-writer-BZzUIgJd.js").then((n) => n.r);
6974
+ const { readInteractions } = await import("./interactions-writer-ZQcpFOh9.js").then((n) => n.r);
6953
6975
  const text = await readInteractions(dataDir, String(variables["slug"]));
6954
6976
  return { contents: [{
6955
6977
  uri: uri.href,