@fleox-agent-crm/agentcrm 0.0.0-stage → 0.3.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 (129) hide show
  1. package/LICENSE +143 -0
  2. package/README.md +223 -2
  3. package/changelog.json +57 -0
  4. package/dist/admin/admin-files.json +26 -0
  5. package/dist/admin/assets/chartsImpl-CE2akJat.js +91 -0
  6. package/dist/admin/assets/firebase-BHSUggRo.js +2 -0
  7. package/dist/admin/assets/gitJson-BulGh2KV.js +3 -0
  8. package/dist/admin/assets/index-DidVVK7L.js +1181 -0
  9. package/dist/admin/assets/index-hMXwHSvN.css +1 -0
  10. package/dist/admin/assets/index.esm-BFc7vwnl.js +400 -0
  11. package/dist/admin/assets/index.esm-CtEQZRb1.js +1651 -0
  12. package/dist/admin/assets/index.esm-Dum0J07z.js +16 -0
  13. package/dist/admin/assets/index.esm2017-EOzKbpUS.js +390 -0
  14. package/dist/admin/assets/lucide-react.min-DEDlHCPj.js +6 -0
  15. package/dist/admin/assets/sdk-CnrLnlRo.js +1717 -0
  16. package/dist/admin/config.js +3 -0
  17. package/dist/admin/favicon.svg +1 -0
  18. package/dist/admin/index.html +139 -0
  19. package/dist/admin/runtime/agentcrm-runtime.js +104 -0
  20. package/dist/admin/runtime/lucide-react.js +791 -0
  21. package/dist/admin/runtime/react-dom-client.js +17 -0
  22. package/dist/admin/runtime/react-dom.js +20 -0
  23. package/dist/admin/runtime/react-i18next.js +19 -0
  24. package/dist/admin/runtime/react-jsx-runtime.js +17 -0
  25. package/dist/admin/runtime/react.js +22 -0
  26. package/dist/agent/agentcrm.mjs +3932 -0
  27. package/dist/agent/chunks/_commonjsHelpers-ClciMIcB.mjs +14 -0
  28. package/dist/agent/chunks/activities-Cj_SIOay.mjs +227 -0
  29. package/dist/agent/chunks/api-B6OqNVWp.mjs +97 -0
  30. package/dist/agent/chunks/appearance-BaShelzt.mjs +174 -0
  31. package/dist/agent/chunks/automations-BWrvLqP6.mjs +698 -0
  32. package/dist/agent/chunks/backup-ClSmxmFZ.mjs +103 -0
  33. package/dist/agent/chunks/batch-CVETiJj5.mjs +142 -0
  34. package/dist/agent/chunks/compact-CsFPaAAq.mjs +69 -0
  35. package/dist/agent/chunks/context-CxFfqS4D.mjs +65 -0
  36. package/dist/agent/chunks/core-Dy7vY9H6.mjs +255 -0
  37. package/dist/agent/chunks/dedupe-BepmsaHv.mjs +123 -0
  38. package/dist/agent/chunks/encoding-C9MzdP95.mjs +36 -0
  39. package/dist/agent/chunks/exportCsv-B5hRvkNm.mjs +95 -0
  40. package/dist/agent/chunks/extCheck--7lmVvl7.mjs +193 -0
  41. package/dist/agent/chunks/extPackage-BGl5Oqs8.mjs +115 -0
  42. package/dist/agent/chunks/extScaffold-DqxI7R1e.mjs +320 -0
  43. package/dist/agent/chunks/extensionActions-D2HtpQz4.mjs +48 -0
  44. package/dist/agent/chunks/extensions-BP1k60md.mjs +151 -0
  45. package/dist/agent/chunks/featureRegistry-C9nbVShp.mjs +149 -0
  46. package/dist/agent/chunks/fields-B0bitgmr.mjs +476 -0
  47. package/dist/agent/chunks/files-CjsPJSR6.mjs +158 -0
  48. package/dist/agent/chunks/files-q8Xu5bft.mjs +367 -0
  49. package/dist/agent/chunks/firebase-DxGVQV9E.mjs +454 -0
  50. package/dist/agent/chunks/firebaseRules-iori-s7U.mjs +221 -0
  51. package/dist/agent/chunks/forms-BKU5F9WF.mjs +847 -0
  52. package/dist/agent/chunks/gitJson-fjr8mcHe.mjs +528 -0
  53. package/dist/agent/chunks/hosting-Bme7LxPc.mjs +144 -0
  54. package/dist/agent/chunks/http-Bk9ICb7I.mjs +127 -0
  55. package/dist/agent/chunks/ids-CvnmrMJX.mjs +59 -0
  56. package/dist/agent/chunks/ids-u-noYcy5.mjs +14 -0
  57. package/dist/agent/chunks/importCsv-DmE_sBch.mjs +334 -0
  58. package/dist/agent/chunks/index-B-4W0-P4.mjs +535 -0
  59. package/dist/agent/chunks/index-BM8qeGOb.mjs +2489 -0
  60. package/dist/agent/chunks/index-Bnmav-Oh.mjs +311 -0
  61. package/dist/agent/chunks/index-CRkw3_iF.mjs +147 -0
  62. package/dist/agent/chunks/index-CWrrF1wl.mjs +111 -0
  63. package/dist/agent/chunks/index-DUSdTBkz.mjs +2988 -0
  64. package/dist/agent/chunks/index-RCmo-uld.mjs +26 -0
  65. package/dist/agent/chunks/index-w03ReRs4.mjs +9780 -0
  66. package/dist/agent/chunks/install-CpHoUFtL.mjs +188 -0
  67. package/dist/agent/chunks/jsx-runtime-Ca2uwGDr.mjs +76 -0
  68. package/dist/agent/chunks/loader-C9nm3iwx.mjs +184 -0
  69. package/dist/agent/chunks/lucide-react.min-Bt3gtepY.mjs +64 -0
  70. package/dist/agent/chunks/memory-WNR3VHUJ.mjs +56 -0
  71. package/dist/agent/chunks/migrate-CsClnnN8.mjs +182 -0
  72. package/dist/agent/chunks/modules-CqdVQVJb.mjs +177 -0
  73. package/dist/agent/chunks/nodeImport-BPCt5uMu.mjs +38 -0
  74. package/dist/agent/chunks/package-DWbn3t2R.mjs +194 -0
  75. package/dist/agent/chunks/papaparse-DjBYnQM2.mjs +1285 -0
  76. package/dist/agent/chunks/pipelines-DCdRBNBV.mjs +234 -0
  77. package/dist/agent/chunks/plan-C0TBrU92.mjs +254 -0
  78. package/dist/agent/chunks/pluginRegistry-DyHtlkcr.mjs +83 -0
  79. package/dist/agent/chunks/query-C5nJB_3C.mjs +192 -0
  80. package/dist/agent/chunks/records-DoqiT9xR.mjs +2191 -0
  81. package/dist/agent/chunks/registry-Ceexawxl.mjs +182 -0
  82. package/dist/agent/chunks/registry-DijAKZ24.mjs +431 -0
  83. package/dist/agent/chunks/relations-B9TynBmA.mjs +191 -0
  84. package/dist/agent/chunks/reports-BB59N6ke.mjs +189 -0
  85. package/dist/agent/chunks/runtime-DHo7ZEEO.mjs +14852 -0
  86. package/dist/agent/chunks/runtimeConfig-CCOFg1RM.mjs +250 -0
  87. package/dist/agent/chunks/s3-Dz50-NuA.mjs +903 -0
  88. package/dist/agent/chunks/schema-7-4-qtSS.mjs +203 -0
  89. package/dist/agent/chunks/schema-DlHt2PxI.mjs +367 -0
  90. package/dist/agent/chunks/sdk-whvfg786.mjs +43644 -0
  91. package/dist/agent/chunks/seed-CugPGYZL.mjs +523 -0
  92. package/dist/agent/chunks/server-ISwlDRCN.mjs +242 -0
  93. package/dist/agent/chunks/settings-BtvR_jdm.mjs +76 -0
  94. package/dist/agent/chunks/standardObjects-CheqfDqa.mjs +243 -0
  95. package/dist/agent/chunks/stats-CfeJssSS.mjs +51 -0
  96. package/dist/agent/chunks/store-5gqRSKXg.mjs +122 -0
  97. package/dist/agent/chunks/themes-DPZFv3yc.mjs +43 -0
  98. package/dist/agent/chunks/tools-Bew8lxKx.mjs +844 -0
  99. package/dist/agent/chunks/types-BOy9PUl7.mjs +44 -0
  100. package/dist/agent/chunks/users-DI1BvS0f.mjs +107 -0
  101. package/dist/agent/chunks/utils-DmI8FtXP.mjs +83 -0
  102. package/dist/agent/chunks/views-fO_BM5U_.mjs +109 -0
  103. package/dist/version.json +7 -0
  104. package/package.json +97 -4
  105. package/plugin/.claude-plugin/plugin.json +17 -0
  106. package/plugin/skills/agentcrm-admin/SKILL.md +191 -0
  107. package/plugin/skills/agentcrm-admin/references/appearance.md +26 -0
  108. package/plugin/skills/agentcrm-admin/references/import.md +16 -0
  109. package/plugin/skills/agentcrm-admin/references/records.md +30 -0
  110. package/plugin/skills/agentcrm-admin/references/schema.md +59 -0
  111. package/plugin/skills/agentcrm-extensions/SKILL.md +93 -0
  112. package/plugin/skills/agentcrm-extensions/references/module-recipes.md +213 -0
  113. package/plugin/skills/agentcrm-extensions/references/runtime-api.md +41 -0
  114. package/plugin/skills/agentcrm-extensions/references/testing.md +76 -0
  115. package/plugin/skills/agentcrm-extensions/references/theme-recipes.md +65 -0
  116. package/plugin/skills/agentcrm-install/SKILL.md +116 -0
  117. package/plugin/skills/agentcrm-install/references/firebase.md +18 -0
  118. package/plugin/skills/agentcrm-install/references/github.md +20 -0
  119. package/plugin/skills/agentcrm-install/references/mcp.md +17 -0
  120. package/plugin/skills/agentcrm-install/references/plans.md +45 -0
  121. package/plugin/skills/agentcrm-install/references/s3.md +24 -0
  122. package/plugin/skills/agentcrm-manage/SKILL.md +108 -0
  123. package/plugin/skills/agentcrm-manage/references/cron.md +11 -0
  124. package/plugin/skills/agentcrm-manage/references/doctor.md +18 -0
  125. package/plugin/skills/agentcrm-sales/SKILL.md +92 -0
  126. package/plugin/skills/agentcrm-sales/references/enrichment.md +13 -0
  127. package/plugin/skills/agentcrm-sales/references/playbooks.md +29 -0
  128. package/plugin/skills/agentcrm-sales/references/weekly-report.md +27 -0
  129. package/types/agentcrm-runtime.d.ts +894 -0
@@ -0,0 +1,192 @@
1
+ import { createRequire as __acrmRequire } from "node:module";
2
+ import { fileURLToPath as __acrmPath } from "node:url";
3
+ import { dirname as __acrmDirname } from "node:path";
4
+ const require2 = __acrmRequire(import.meta.url);
5
+ const __filename = __acrmPath(import.meta.url);
6
+ const __dirname = __acrmDirname(__filename);
7
+ import { comparableValue, dateValueToMs, parseNumber, isEmptyFieldValue, findOption, parseDateValue, formatFieldValue } from "./fields-B0bitgmr.mjs";
8
+ const DAY = 864e5;
9
+ const SYSTEM_FIELDS = {
10
+ id: { id: "id", label: "ID", type: "text", system: true },
11
+ ownerId: { id: "ownerId", label: "Owner", type: "user", system: true },
12
+ createdBy: { id: "createdBy", label: "Created by", type: "user", system: true },
13
+ updatedBy: { id: "updatedBy", label: "Updated by", type: "user", system: true },
14
+ createdAt: { id: "createdAt", label: "Created", type: "datetime", system: true },
15
+ updatedAt: { id: "updatedAt", label: "Updated", type: "datetime", system: true }
16
+ };
17
+ function resolveField(object, fieldId) {
18
+ return object.fields.find((f) => f.id === fieldId) ?? SYSTEM_FIELDS[fieldId];
19
+ }
20
+ function getRecordValue(record, fieldId) {
21
+ if (fieldId in SYSTEM_FIELDS) return record[fieldId];
22
+ return record.fields[fieldId];
23
+ }
24
+ function asArray(v) {
25
+ return Array.isArray(v) ? v : v === void 0 || v === null ? [] : [v];
26
+ }
27
+ function resolveDateArg(value, now) {
28
+ if (value === "now") return now;
29
+ if (value === "today") {
30
+ const d = new Date(now);
31
+ return new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
32
+ }
33
+ if (typeof value === "string") {
34
+ const rel = /^([+-]?\d+)d$/.exec(value.trim());
35
+ if (rel) return now + Number(rel[1]) * DAY;
36
+ const iso = parseDateValue(value);
37
+ if (iso && /^\d{4}-\d{2}-\d{2}$/.test(value.trim())) return dateValueToMs(iso);
38
+ }
39
+ return dateValueToMs(value);
40
+ }
41
+ function sameDay(a, b) {
42
+ const da = new Date(a);
43
+ const db = new Date(b);
44
+ return da.getFullYear() === db.getFullYear() && da.getMonth() === db.getMonth() && da.getDate() === db.getDate();
45
+ }
46
+ function textOf(field, value, ctx) {
47
+ return formatFieldValue(field, value, ctx).toLowerCase();
48
+ }
49
+ function normalizeOperand(field, operand) {
50
+ if ((field.type === "select" || field.type === "multiSelect") && operand !== void 0 && operand !== null) {
51
+ return findOption(field, operand)?.id ?? String(operand);
52
+ }
53
+ return operand;
54
+ }
55
+ function equals(field, stored, operand, ctx) {
56
+ const op = normalizeOperand(field, operand);
57
+ switch (field.type) {
58
+ case "number":
59
+ case "currency":
60
+ case "percent":
61
+ case "rating": {
62
+ const a = typeof stored === "number" ? stored : parseNumber(stored);
63
+ const b = parseNumber(op);
64
+ return a !== null && b !== null && a === b;
65
+ }
66
+ case "boolean":
67
+ return Boolean(stored) === (op === true || op === "true" || op === 1 || op === "1" || op === "yes");
68
+ case "date":
69
+ case "datetime": {
70
+ const a = dateValueToMs(stored);
71
+ const b = resolveDateArg(op, ctx.now ?? Date.now());
72
+ return a !== null && b !== null && sameDay(a, b);
73
+ }
74
+ case "multiSelect":
75
+ case "tags":
76
+ return asArray(stored).some((v) => String(v).toLowerCase() === String(op).toLowerCase());
77
+ case "relation":
78
+ return asArray(stored).some((v) => String(v) === String(op));
79
+ case "select":
80
+ case "user":
81
+ return stored !== void 0 && stored !== null && String(stored) === String(op);
82
+ default:
83
+ return typeof stored === "string" && typeof op !== "object" && stored.trim().toLowerCase() === String(op ?? "").trim().toLowerCase();
84
+ }
85
+ }
86
+ function contains(field, stored, operand, ctx) {
87
+ const needle = String(operand ?? "").trim().toLowerCase();
88
+ if (!needle) return true;
89
+ if (field.type === "relation") {
90
+ const target = field.relation?.object ?? "";
91
+ return asArray(stored).some((id) => {
92
+ const label = ctx.recordLabel?.(target, String(id)) ?? String(id);
93
+ return label.toLowerCase().includes(needle);
94
+ });
95
+ }
96
+ return textOf(field, stored, ctx).includes(needle);
97
+ }
98
+ function compareNum(field, stored, operand, ctx) {
99
+ const isDate = field.type === "date" || field.type === "datetime";
100
+ const a = isDate ? dateValueToMs(stored) : typeof stored === "number" ? stored : parseNumber(stored);
101
+ const b = isDate ? resolveDateArg(operand, ctx.now ?? Date.now()) : parseNumber(operand);
102
+ return a === null || b === null ? null : [a, b];
103
+ }
104
+ function matchesFilter(record, filter, ctx) {
105
+ const field = resolveField(ctx.object, filter.field);
106
+ if (!field) return true;
107
+ const stored = getRecordValue(record, filter.field);
108
+ const value = filter.value;
109
+ switch (filter.op) {
110
+ case "eq":
111
+ return equals(field, stored, value, ctx);
112
+ case "neq":
113
+ return !equals(field, stored, value, ctx);
114
+ case "contains":
115
+ return contains(field, stored, value, ctx);
116
+ case "notContains":
117
+ return !contains(field, stored, value, ctx);
118
+ case "empty":
119
+ return isEmptyFieldValue(field, stored);
120
+ case "notEmpty":
121
+ return !isEmptyFieldValue(field, stored);
122
+ case "gt":
123
+ case "gte":
124
+ case "lt":
125
+ case "lte":
126
+ case "before":
127
+ case "after": {
128
+ const pair = compareNum(field, stored, value, ctx);
129
+ if (!pair) return false;
130
+ const [a, b] = pair;
131
+ if (filter.op === "gt" || filter.op === "after") return a > b;
132
+ if (filter.op === "gte") return a >= b;
133
+ if (filter.op === "lt" || filter.op === "before") return a < b;
134
+ return a <= b;
135
+ }
136
+ case "in":
137
+ case "notIn": {
138
+ const set = asArray(value).map((v) => String(normalizeOperand(field, v)));
139
+ const hit = asArray(stored).some((v) => set.includes(String(v)));
140
+ return filter.op === "in" ? hit : !hit;
141
+ }
142
+ case "withinDays": {
143
+ const ms = dateValueToMs(stored);
144
+ const days = parseNumber(value);
145
+ if (ms === null || days === null) return false;
146
+ const now = ctx.now ?? Date.now();
147
+ return days >= 0 ? ms >= now - DAY && ms <= now + days * DAY : ms >= now + days * DAY && ms <= now;
148
+ }
149
+ default:
150
+ return true;
151
+ }
152
+ }
153
+ function applyFilters(records, filters, ctx) {
154
+ if (!filters?.length) return records;
155
+ return records.filter((r) => filters.every((f) => matchesFilter(r, f, ctx)));
156
+ }
157
+ function applySorts(records, sorts, ctx) {
158
+ if (!sorts?.length) return records;
159
+ const keyed = records.map((r) => ({
160
+ r,
161
+ keys: sorts.map((s) => comparableValue(resolveField(ctx.object, s.field), getRecordValue(r, s.field), ctx))
162
+ }));
163
+ keyed.sort((a, b) => {
164
+ for (let i = 0; i < sorts.length; i++) {
165
+ const x = a.keys[i];
166
+ const y = b.keys[i];
167
+ if (x === null && y === null) continue;
168
+ if (x === null) return 1;
169
+ if (y === null) return -1;
170
+ let c;
171
+ if (typeof x === "number" && typeof y === "number") c = x - y;
172
+ else c = String(x).localeCompare(String(y), void 0, { numeric: true, sensitivity: "base" });
173
+ if (c !== 0) return sorts[i].dir === "desc" ? -c : c;
174
+ }
175
+ return a.r.id < b.r.id ? -1 : a.r.id > b.r.id ? 1 : 0;
176
+ });
177
+ return keyed.map((k) => k.r);
178
+ }
179
+ function paginate(items, req = {}) {
180
+ const offset = Math.max(0, Math.floor(req.offset ?? 0));
181
+ const limit = req.limit === void 0 ? items.length : Math.max(0, Math.floor(req.limit));
182
+ const slice = items.slice(offset, offset + limit);
183
+ return { items: slice, total: items.length, offset, limit, hasMore: offset + slice.length < items.length };
184
+ }
185
+ export {
186
+ applySorts as a,
187
+ applyFilters as b,
188
+ getRecordValue as g,
189
+ matchesFilter as m,
190
+ paginate as p,
191
+ resolveField as r
192
+ };