@datasynx/agentic-crm 1.7.0 → 1.8.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/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import { i as writeJsonFile } from "./json-store-WWsFzXub.js";
5
5
  import { a as warning, i as success, n as error, r as info, t as bold } from "./colors-BG07TZQz.js";
6
6
  import { n as getSession } from "./session-store-CEa39Dxs.js";
7
7
  import { i as sessionCommand, r as readAllSessions } from "./session-BgGDyP2C.js";
8
- import { a as searchKbSimple, i as listKbArticles, n as getKbArticle, o as writeKbArticle, s as CAPABILITIES_TEXT, t as deleteKbArticle } from "./knowledge-base-Cc0niBFf.js";
8
+ import { a as searchKbSimple, i as listKbArticles, n as getKbArticle, o as writeKbArticle, s as CAPABILITIES_TEXT, t as deleteKbArticle } from "./knowledge-base-Byo0zwM5.js";
9
9
  import { a as restoreCommand, t as backupCommand } from "./backup-CTlIxUdO.js";
10
10
  import { n as readSyncState } from "./sync-state-DMZgzpez.js";
11
11
  import { n as readUnmatched } from "./unmatched-transcripts-DC-VQ9YS.js";
@@ -242,14 +242,14 @@ mcpCommand.command("start").description("Start MCP server (stdio by default)").o
242
242
  if (opts.http) {
243
243
  const port = parseInt(opts.port, 10);
244
244
  console.error(info(`Starting MCP server in HTTP mode on port ${port}...`));
245
- const { startHttp } = await import("./server-BbInMUgp.js");
245
+ const { startHttp } = await import("./server-C0XkJQBo.js");
246
246
  await startHttp(port);
247
247
  } else {
248
- const { startStdio } = await import("./server-BbInMUgp.js");
248
+ const { startStdio } = await import("./server-C0XkJQBo.js");
249
249
  await startStdio();
250
250
  }
251
251
  });
252
- const TOOL_COUNT = 59;
252
+ const TOOL_COUNT = 60;
253
253
  /** Claude Code: CLAUDE.md in CRM dataDir */
254
254
  function buildClaudeMd(dataDir) {
255
255
  return `# DatasynxOpenCRM v2 — Agent Instructions (${TOOL_COUNT} MCP Tools)
@@ -378,6 +378,7 @@ It combines graph, health, revenue simulation, playbook, and org intelligence in
378
378
  - \`get_logs({ level?, component?, since?, contains?, limit?, summary? })\` — query/aggregate the structured application log
379
379
  - \`get_diagnostics({ fix? })\` — self-diagnostic health check (data integrity, temp files, log errors, backups)
380
380
  - \`get_pipeline_changes({ since?, days? })\` — pipeline time-travel: what changed (won/lost/moved/value) since a date
381
+ - \`get_pipeline_velocity({ stalledDays? })\` — stage dwell times, sales cycle, and stalled deals from snapshot history
381
382
 
382
383
  ### Custom Objects (Platform / metadata)
383
384
  - \`define_custom_object({ name, label?, fields })\` — define a runtime entity type with typed fields (no migration), admin
@@ -639,7 +640,8 @@ create_ticket · update_ticket · list_tickets · close_ticket ·
639
640
  send_nps_survey · get_survey_results ·
640
641
  search_knowledge_base · create_kb_article ·
641
642
  backup_now · list_backups ·
642
- trigger_sync · get_audit_log · get_logs · get_diagnostics · get_pipeline_changes ·
643
+ trigger_sync · get_audit_log · get_logs · get_diagnostics ·
644
+ get_pipeline_changes · get_pipeline_velocity ·
643
645
  define_custom_object · create_record · list_records · list_custom_objects
644
646
 
645
647
  ## Data: ${dataDir}`.trim();
@@ -3018,6 +3020,34 @@ pipelineCommand.command("changes").description("Show what changed in the pipelin
3018
3020
  for (const d of diff.added) console.log(` ${d.slug}/${d.name}`);
3019
3021
  }
3020
3022
  });
3023
+ pipelineCommand.command("velocity").description("Stage dwell times, sales cycle, and stalled deals from snapshot history").option("--stalled-days <n>", "Days in one stage before a deal counts as stalled (default 14)").action(async (opts) => {
3024
+ const { analyzeVelocity } = await import("./velocity-BtX1l5Gh.js");
3025
+ const analyzeOpts = {};
3026
+ if (opts.stalledDays !== void 0) {
3027
+ const n = parseInt(opts.stalledDays, 10);
3028
+ if (Number.isFinite(n) && n > 0) analyzeOpts.stalledDays = n;
3029
+ }
3030
+ const report = analyzeVelocity(dataDir$17(), analyzeOpts);
3031
+ if (report.snapshotCount === 0) {
3032
+ console.log(info("No snapshots yet. Run 'dxcrm pipeline snapshot' (or let the daemon take daily ones)."));
3033
+ return;
3034
+ }
3035
+ console.log(bold(`Pipeline velocity (${report.snapshotCount} snapshots, ${report.fromId} → ${report.toId})`));
3036
+ if (report.stageDurations.length) {
3037
+ console.log(info("\nAvg time in stage:"));
3038
+ for (const s of report.stageDurations) {
3039
+ const samples = `${s.samples} sample${s.samples === 1 ? "" : "s"}`;
3040
+ console.log(` ${s.stage.padEnd(14)} ${s.avgDays}d (${samples})`);
3041
+ }
3042
+ }
3043
+ const cycle = report.avgSalesCycleDays;
3044
+ const cycleStr = cycle === null ? "n/a (no won deals yet)" : `${cycle}d avg`;
3045
+ console.log(`\n ${"Sales cycle".padEnd(14)} ${cycleStr} over ${report.wonCount} won`);
3046
+ if (report.stalledDeals.length) {
3047
+ console.log(error(`\nStalled deals (> ${report.stalledThresholdDays}d in stage):`));
3048
+ for (const d of report.stalledDeals) console.log(` ${d.slug}/${d.name}: ${d.stage}, ${d.daysInStage}d €${d.value.toLocaleString()}`);
3049
+ } else console.log(success(`\nNo stalled deals (threshold ${report.stalledThresholdDays}d).`));
3050
+ });
3021
3051
  //#endregion
3022
3052
  //#region src/commands/rbac.ts
3023
3053
  const ROLES = [