@datasynx/agentic-crm 1.5.0 → 1.6.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 +66 -11
- package/dist/cli.js.map +1 -1
- package/dist/daemon/worker.js +16 -0
- package/dist/daemon/worker.js.map +1 -1
- package/dist/{index-FzDsNSSb.d.ts → index-BBAlKZg6.d.ts} +3 -3
- package/dist/{index-FzDsNSSb.d.ts.map → index-BBAlKZg6.d.ts.map} +1 -1
- package/dist/{index-B5_QnkG8.d.cts → index-DNHsURo5.d.cts} +14 -14
- package/dist/index-DNHsURo5.d.cts.map +1 -0
- package/dist/index.d.cts +14 -14
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/{knowledge-base-Bx2PKQR2.js → knowledge-base-Cc0niBFf.js} +2 -1
- package/dist/knowledge-base-Cc0niBFf.js.map +1 -0
- package/dist/mcp-CdTJWTJf.d.cts.map +1 -1
- package/dist/mcp-CdTJWTJf.d.ts.map +1 -1
- package/dist/mcp.cjs +289 -130
- 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 +289 -130
- package/dist/mcp.js.map +1 -1
- package/dist/{server-uqXUhF4H.js → server-BbInMUgp.js} +172 -130
- package/dist/server-BbInMUgp.js.map +1 -0
- package/dist/snapshots-B6aOhoXs.js +2 -0
- package/dist/snapshots-CQSOaIMs.js +161 -0
- package/dist/snapshots-CQSOaIMs.js.map +1 -0
- package/package.json +2 -2
- package/dist/index-B5_QnkG8.d.cts.map +0 -1
- package/dist/knowledge-base-Bx2PKQR2.js.map +0 -1
- package/dist/server-uqXUhF4H.js.map +0 -1
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-
|
|
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";
|
|
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";
|
|
@@ -241,14 +241,14 @@ mcpCommand.command("start").description("Start MCP server (stdio by default)").o
|
|
|
241
241
|
if (opts.http) {
|
|
242
242
|
const port = parseInt(opts.port, 10);
|
|
243
243
|
console.error(info(`Starting MCP server in HTTP mode on port ${port}...`));
|
|
244
|
-
const { startHttp } = await import("./server-
|
|
244
|
+
const { startHttp } = await import("./server-BbInMUgp.js");
|
|
245
245
|
await startHttp(port);
|
|
246
246
|
} else {
|
|
247
|
-
const { startStdio } = await import("./server-
|
|
247
|
+
const { startStdio } = await import("./server-BbInMUgp.js");
|
|
248
248
|
await startStdio();
|
|
249
249
|
}
|
|
250
250
|
});
|
|
251
|
-
const TOOL_COUNT =
|
|
251
|
+
const TOOL_COUNT = 59;
|
|
252
252
|
/** Claude Code: CLAUDE.md in CRM dataDir */
|
|
253
253
|
function buildClaudeMd(dataDir) {
|
|
254
254
|
return `# DatasynxOpenCRM v2 — Agent Instructions (${TOOL_COUNT} MCP Tools)
|
|
@@ -376,6 +376,7 @@ It combines graph, health, revenue simulation, playbook, and org intelligence in
|
|
|
376
376
|
- \`get_audit_log({ slug?, actor?, limit? })\` — read append-only audit log of all write operations
|
|
377
377
|
- \`get_logs({ level?, component?, since?, contains?, limit?, summary? })\` — query/aggregate the structured application log
|
|
378
378
|
- \`get_diagnostics({ fix? })\` — self-diagnostic health check (data integrity, temp files, log errors, backups)
|
|
379
|
+
- \`get_pipeline_changes({ since?, days? })\` — pipeline time-travel: what changed (won/lost/moved/value) since a date
|
|
379
380
|
|
|
380
381
|
### Custom Objects (Platform / metadata)
|
|
381
382
|
- \`define_custom_object({ name, label?, fields })\` — define a runtime entity type with typed fields (no migration), admin
|
|
@@ -637,7 +638,7 @@ create_ticket · update_ticket · list_tickets · close_ticket ·
|
|
|
637
638
|
send_nps_survey · get_survey_results ·
|
|
638
639
|
search_knowledge_base · create_kb_article ·
|
|
639
640
|
backup_now · list_backups ·
|
|
640
|
-
trigger_sync · get_audit_log · get_logs · get_diagnostics ·
|
|
641
|
+
trigger_sync · get_audit_log · get_logs · get_diagnostics · get_pipeline_changes ·
|
|
641
642
|
define_custom_object · create_record · list_records · list_custom_objects
|
|
642
643
|
|
|
643
644
|
## Data: ${dataDir}`.trim();
|
|
@@ -2902,14 +2903,14 @@ function buildQuery(opts) {
|
|
|
2902
2903
|
limit: opts.limit ?? 50
|
|
2903
2904
|
};
|
|
2904
2905
|
}
|
|
2905
|
-
function dataDir$
|
|
2906
|
+
function dataDir$19() {
|
|
2906
2907
|
return process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2907
2908
|
}
|
|
2908
2909
|
const logsCommand = new Command("logs").description("View and analyze the structured application log").option("--level <level>", "Minimum level: debug | info | warn | error").option("--component <name>", "Filter by component (e.g. gmail-sync, lancedb)").option("--since <iso>", "Only entries at or after this ISO timestamp").option("--contains <text>", "Filter by message substring").option("--limit <n>", "Max entries to show (default: 50)", parseInt).option("--summary", "Show aggregated counts (by level + component) instead of entries").action(async (opts) => {
|
|
2909
2910
|
const query = buildQuery(opts);
|
|
2910
2911
|
if (opts.summary) {
|
|
2911
2912
|
const { summarizeLogs } = await import("./logger-vKQS34w9.js");
|
|
2912
|
-
const s = summarizeLogs(dataDir$
|
|
2913
|
+
const s = summarizeLogs(dataDir$19(), query);
|
|
2913
2914
|
console.log(bold(`Logs — ${s.total} entr${s.total === 1 ? "y" : "ies"}`));
|
|
2914
2915
|
if (s.firstTs) console.log(info(` ${s.firstTs} → ${s.lastTs}`));
|
|
2915
2916
|
console.log(" By level:");
|
|
@@ -2926,7 +2927,7 @@ const logsCommand = new Command("logs").description("View and analyze the struct
|
|
|
2926
2927
|
return;
|
|
2927
2928
|
}
|
|
2928
2929
|
const { queryLogs } = await import("./logger-vKQS34w9.js");
|
|
2929
|
-
const entries = queryLogs(dataDir$
|
|
2930
|
+
const entries = queryLogs(dataDir$19(), query);
|
|
2930
2931
|
if (entries.length === 0) {
|
|
2931
2932
|
console.log(success("No matching log entries."));
|
|
2932
2933
|
return;
|
|
@@ -2938,7 +2939,7 @@ const logsCommand = new Command("logs").description("View and analyze the struct
|
|
|
2938
2939
|
});
|
|
2939
2940
|
//#endregion
|
|
2940
2941
|
//#region src/commands/doctor.ts
|
|
2941
|
-
function dataDir$
|
|
2942
|
+
function dataDir$18() {
|
|
2942
2943
|
return process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2943
2944
|
}
|
|
2944
2945
|
function icon(status) {
|
|
@@ -2949,10 +2950,10 @@ function icon(status) {
|
|
|
2949
2950
|
const doctorCommand = new Command("doctor").description("Run self-diagnostics: data integrity, temp files, log errors, backup freshness").option("--fix", "Clean up safely-fixable issues (orphaned temp files)").action(async (opts) => {
|
|
2950
2951
|
const { runDiagnostics, cleanupTempFiles } = await import("./doctor-CYDaNmFn.js");
|
|
2951
2952
|
if (opts.fix) {
|
|
2952
|
-
const removed = cleanupTempFiles(dataDir$
|
|
2953
|
+
const removed = cleanupTempFiles(dataDir$18());
|
|
2953
2954
|
console.log(removed.length > 0 ? success(`Removed ${removed.length} orphaned temp file(s).`) : warning("Nothing to fix."));
|
|
2954
2955
|
}
|
|
2955
|
-
const report = await runDiagnostics(dataDir$
|
|
2956
|
+
const report = await runDiagnostics(dataDir$18());
|
|
2956
2957
|
console.log(bold("dxcrm doctor"));
|
|
2957
2958
|
for (const c of report.checks) console.log(` ${icon(c.status)} ${c.name.padEnd(16)} ${c.detail}`);
|
|
2958
2959
|
if (report.ok) {
|
|
@@ -2964,6 +2965,59 @@ const doctorCommand = new Command("doctor").description("Run self-diagnostics: d
|
|
|
2964
2965
|
}
|
|
2965
2966
|
});
|
|
2966
2967
|
//#endregion
|
|
2968
|
+
//#region src/commands/pipeline.ts
|
|
2969
|
+
function dataDir$17() {
|
|
2970
|
+
return process.env["DXCRM_DATA_DIR"] ?? process.cwd();
|
|
2971
|
+
}
|
|
2972
|
+
function daysAgoIso(days) {
|
|
2973
|
+
return (/* @__PURE__ */ new Date(Date.now() - days * 864e5)).toISOString().slice(0, 10);
|
|
2974
|
+
}
|
|
2975
|
+
const pipelineCommand = new Command("pipeline").description("Pipeline time-travel: daily snapshots and 'what changed?' diffs");
|
|
2976
|
+
pipelineCommand.command("snapshot").description("Capture a snapshot of the current pipeline across all customers").action(async () => {
|
|
2977
|
+
const { takeSnapshot } = await import("./snapshots-B6aOhoXs.js");
|
|
2978
|
+
const snap = takeSnapshot(dataDir$17());
|
|
2979
|
+
console.log(success(`Snapshot ${snap.id} taken — ${snap.deals.length} deal(s).`));
|
|
2980
|
+
});
|
|
2981
|
+
pipelineCommand.command("list").description("List available pipeline snapshots").action(async () => {
|
|
2982
|
+
const { listSnapshots } = await import("./snapshots-B6aOhoXs.js");
|
|
2983
|
+
const snaps = listSnapshots(dataDir$17());
|
|
2984
|
+
if (snaps.length === 0) {
|
|
2985
|
+
console.log(info("No snapshots yet. Run 'dxcrm pipeline snapshot' (or let the daemon take daily ones)."));
|
|
2986
|
+
return;
|
|
2987
|
+
}
|
|
2988
|
+
for (const s of snaps) console.log(`${s.id} ${String(s.dealCount).padStart(4)} deals open €${s.openValue.toLocaleString()}`);
|
|
2989
|
+
});
|
|
2990
|
+
pipelineCommand.command("changes").description("Show what changed in the pipeline since a date (default: 7 days ago)").option("--since <YYYY-MM-DD>", "Baseline date (default: 7 days ago)").action(async (opts) => {
|
|
2991
|
+
const since = opts.since ?? daysAgoIso(7);
|
|
2992
|
+
const { diffAgainstNow } = await import("./snapshots-B6aOhoXs.js");
|
|
2993
|
+
const diff = diffAgainstNow(dataDir$17(), since);
|
|
2994
|
+
if (!diff) {
|
|
2995
|
+
console.log(warning(`No snapshot at or before ${since}. Take snapshots first (or wait for the daemon).`));
|
|
2996
|
+
return;
|
|
2997
|
+
}
|
|
2998
|
+
console.log(bold(`Pipeline changes since ${diff.fromId}`));
|
|
2999
|
+
const line = (label, n) => ` ${label.padEnd(16)} ${n}`;
|
|
3000
|
+
console.log(success(line("Won", diff.won.length)));
|
|
3001
|
+
console.log(error(line("Lost", diff.lost.length)));
|
|
3002
|
+
console.log(line("New deals", diff.added.length));
|
|
3003
|
+
console.log(line("Removed", diff.removed.length));
|
|
3004
|
+
console.log(line("Stage moves", diff.advanced.length));
|
|
3005
|
+
console.log(line("Value changes", diff.valueChanged.length));
|
|
3006
|
+
const delta = diff.openValueDelta;
|
|
3007
|
+
const deltaStr = `${delta >= 0 ? "+" : ""}€${delta.toLocaleString()}`;
|
|
3008
|
+
console.log(` ${"Open value".padEnd(16)} €${diff.openValueAfter.toLocaleString()} (${delta >= 0 ? success(deltaStr) : error(deltaStr)})`);
|
|
3009
|
+
if (diff.won.length) console.log(success(`\nWon: ${diff.won.map((d) => d.name).join(", ")}`));
|
|
3010
|
+
if (diff.lost.length) console.log(error(`Lost: ${diff.lost.map((d) => d.name).join(", ")}`));
|
|
3011
|
+
if (diff.advanced.length) {
|
|
3012
|
+
console.log(info("\nStage moves:"));
|
|
3013
|
+
for (const m of diff.advanced) console.log(` ${m.slug}/${m.name}: ${m.from} → ${m.to}`);
|
|
3014
|
+
}
|
|
3015
|
+
if (diff.added.length) {
|
|
3016
|
+
console.log(info("\nNew deals:"));
|
|
3017
|
+
for (const d of diff.added) console.log(` ${d.slug}/${d.name}`);
|
|
3018
|
+
}
|
|
3019
|
+
});
|
|
3020
|
+
//#endregion
|
|
2967
3021
|
//#region src/commands/rbac.ts
|
|
2968
3022
|
const ROLES = [
|
|
2969
3023
|
"admin",
|
|
@@ -4612,6 +4666,7 @@ const ALL_COMMANDS = [
|
|
|
4612
4666
|
auditCommand,
|
|
4613
4667
|
logsCommand,
|
|
4614
4668
|
doctorCommand,
|
|
4669
|
+
pipelineCommand,
|
|
4615
4670
|
rbacCommand,
|
|
4616
4671
|
gdprCommand,
|
|
4617
4672
|
securityReportCommand,
|