@fleox-agent-crm/agentcrm 0.0.0-stage → 0.3.1
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/LICENSE +143 -0
- package/README.md +223 -2
- package/changelog.json +76 -0
- package/dist/admin/admin-files.json +26 -0
- package/dist/admin/assets/chartsImpl-B45AAqnr.js +91 -0
- package/dist/admin/assets/firebase-C1x_l9P9.js +2 -0
- package/dist/admin/assets/gitJson-CAUSxl8d.js +3 -0
- package/dist/admin/assets/index-ChFauO8y.js +1181 -0
- package/dist/admin/assets/index-TcjySLVg.css +1 -0
- package/dist/admin/assets/index.esm-BFc7vwnl.js +400 -0
- package/dist/admin/assets/index.esm-CtEQZRb1.js +1651 -0
- package/dist/admin/assets/index.esm-Dum0J07z.js +16 -0
- package/dist/admin/assets/index.esm2017-EOzKbpUS.js +390 -0
- package/dist/admin/assets/lucide-react.min--rznIkmQ.js +6 -0
- package/dist/admin/assets/sdk-DgzLACmL.js +1717 -0
- package/dist/admin/config.js +3 -0
- package/dist/admin/favicon.svg +1 -0
- package/dist/admin/index.html +139 -0
- package/dist/admin/runtime/agentcrm-runtime.js +104 -0
- package/dist/admin/runtime/lucide-react.js +791 -0
- package/dist/admin/runtime/react-dom-client.js +17 -0
- package/dist/admin/runtime/react-dom.js +20 -0
- package/dist/admin/runtime/react-i18next.js +19 -0
- package/dist/admin/runtime/react-jsx-runtime.js +17 -0
- package/dist/admin/runtime/react.js +22 -0
- package/dist/agent/agentcrm.mjs +4057 -0
- package/dist/agent/chunks/_commonjsHelpers-ClciMIcB.mjs +14 -0
- package/dist/agent/chunks/activities-Cj_SIOay.mjs +227 -0
- package/dist/agent/chunks/api-Cz0Ubj-B.mjs +98 -0
- package/dist/agent/chunks/appearance-BloHbiLA.mjs +174 -0
- package/dist/agent/chunks/automations-DwWruxmu.mjs +698 -0
- package/dist/agent/chunks/backup-W3CjgkAJ.mjs +116 -0
- package/dist/agent/chunks/batch-CVETiJj5.mjs +142 -0
- package/dist/agent/chunks/compact-BGHI92tm.mjs +69 -0
- package/dist/agent/chunks/context-CxFfqS4D.mjs +65 -0
- package/dist/agent/chunks/core-Dy7vY9H6.mjs +255 -0
- package/dist/agent/chunks/dedupe-BepmsaHv.mjs +123 -0
- package/dist/agent/chunks/encoding-C9MzdP95.mjs +36 -0
- package/dist/agent/chunks/exportCsv-C6e6XEmB.mjs +130 -0
- package/dist/agent/chunks/extCheck-GgHG1dYB.mjs +200 -0
- package/dist/agent/chunks/extPackage-DuZ6GZhp.mjs +115 -0
- package/dist/agent/chunks/extScaffold-Aqyjf1nr.mjs +320 -0
- package/dist/agent/chunks/extensionActions-D2HtpQz4.mjs +48 -0
- package/dist/agent/chunks/extensions-Bp72uZ9a.mjs +164 -0
- package/dist/agent/chunks/featureRegistry-DSsZbhrh.mjs +149 -0
- package/dist/agent/chunks/fields-B0bitgmr.mjs +476 -0
- package/dist/agent/chunks/files-CjsPJSR6.mjs +158 -0
- package/dist/agent/chunks/files-D1daDgY0.mjs +367 -0
- package/dist/agent/chunks/firebase-DxGVQV9E.mjs +454 -0
- package/dist/agent/chunks/firebaseRules-iori-s7U.mjs +221 -0
- package/dist/agent/chunks/forms-BfuWaQjA.mjs +847 -0
- package/dist/agent/chunks/gitJson-fjr8mcHe.mjs +528 -0
- package/dist/agent/chunks/hosting-Bme7LxPc.mjs +144 -0
- package/dist/agent/chunks/http-Bk9ICb7I.mjs +127 -0
- package/dist/agent/chunks/ids-CvnmrMJX.mjs +59 -0
- package/dist/agent/chunks/ids-u-noYcy5.mjs +14 -0
- package/dist/agent/chunks/importCsv-LVmMTaWU.mjs +334 -0
- package/dist/agent/chunks/index-B-4W0-P4.mjs +535 -0
- package/dist/agent/chunks/index-BM8qeGOb.mjs +2489 -0
- package/dist/agent/chunks/index-Bnmav-Oh.mjs +311 -0
- package/dist/agent/chunks/index-CRkw3_iF.mjs +147 -0
- package/dist/agent/chunks/index-CWrrF1wl.mjs +111 -0
- package/dist/agent/chunks/index-DUSdTBkz.mjs +2988 -0
- package/dist/agent/chunks/index-RCmo-uld.mjs +26 -0
- package/dist/agent/chunks/index-w03ReRs4.mjs +9780 -0
- package/dist/agent/chunks/install-CbpD_7gd.mjs +188 -0
- package/dist/agent/chunks/jsx-runtime-Ca2uwGDr.mjs +76 -0
- package/dist/agent/chunks/loader-MPD9iAvh.mjs +184 -0
- package/dist/agent/chunks/lucide-react.min-Bt3gtepY.mjs +64 -0
- package/dist/agent/chunks/memory-WNR3VHUJ.mjs +56 -0
- package/dist/agent/chunks/migrate-CsClnnN8.mjs +182 -0
- package/dist/agent/chunks/modules-clWdE-K2.mjs +202 -0
- package/dist/agent/chunks/nodeImport-ylfRDvqt.mjs +38 -0
- package/dist/agent/chunks/package-B7mI6HGi.mjs +194 -0
- package/dist/agent/chunks/papaparse-Df7i1dHr.mjs +1309 -0
- package/dist/agent/chunks/pipelines-BAKpPk1w.mjs +234 -0
- package/dist/agent/chunks/plan-BmTat6-T.mjs +254 -0
- package/dist/agent/chunks/pluginRegistry-DyHtlkcr.mjs +83 -0
- package/dist/agent/chunks/query-C5nJB_3C.mjs +192 -0
- package/dist/agent/chunks/records-DcHFelq5.mjs +2195 -0
- package/dist/agent/chunks/registry-COfJrSmg.mjs +182 -0
- package/dist/agent/chunks/registry-DijAKZ24.mjs +431 -0
- package/dist/agent/chunks/relations-B9TynBmA.mjs +191 -0
- package/dist/agent/chunks/reports-BACHGccj.mjs +189 -0
- package/dist/agent/chunks/runtime-C0Xf0Axi.mjs +14873 -0
- package/dist/agent/chunks/runtimeConfig-CCOFg1RM.mjs +250 -0
- package/dist/agent/chunks/s3-Dz50-NuA.mjs +903 -0
- package/dist/agent/chunks/schema-C4lSslXv.mjs +373 -0
- package/dist/agent/chunks/schema-DnLj8dUO.mjs +213 -0
- package/dist/agent/chunks/sdk-whvfg786.mjs +43644 -0
- package/dist/agent/chunks/seed-6MRmQQBR.mjs +541 -0
- package/dist/agent/chunks/server-DC3t8r30.mjs +242 -0
- package/dist/agent/chunks/settings-Di8nzNEL.mjs +111 -0
- package/dist/agent/chunks/standardObjects-CheqfDqa.mjs +243 -0
- package/dist/agent/chunks/stats-BfuLWhVV.mjs +51 -0
- package/dist/agent/chunks/store-5gqRSKXg.mjs +122 -0
- package/dist/agent/chunks/themes-DPZFv3yc.mjs +43 -0
- package/dist/agent/chunks/tools-iSH-yMpl.mjs +884 -0
- package/dist/agent/chunks/types-BOy9PUl7.mjs +44 -0
- package/dist/agent/chunks/users-DI1BvS0f.mjs +107 -0
- package/dist/agent/chunks/utils-DmI8FtXP.mjs +83 -0
- package/dist/agent/chunks/views-DH1n9Lrt.mjs +109 -0
- package/dist/version.json +7 -0
- package/package.json +97 -4
- package/plugin/.claude-plugin/plugin.json +17 -0
- package/plugin/skills/agentcrm-admin/SKILL.md +191 -0
- package/plugin/skills/agentcrm-admin/references/appearance.md +26 -0
- package/plugin/skills/agentcrm-admin/references/import.md +16 -0
- package/plugin/skills/agentcrm-admin/references/records.md +30 -0
- package/plugin/skills/agentcrm-admin/references/schema.md +59 -0
- package/plugin/skills/agentcrm-extensions/SKILL.md +93 -0
- package/plugin/skills/agentcrm-extensions/references/module-recipes.md +213 -0
- package/plugin/skills/agentcrm-extensions/references/runtime-api.md +41 -0
- package/plugin/skills/agentcrm-extensions/references/testing.md +78 -0
- package/plugin/skills/agentcrm-extensions/references/theme-recipes.md +65 -0
- package/plugin/skills/agentcrm-install/SKILL.md +116 -0
- package/plugin/skills/agentcrm-install/references/firebase.md +18 -0
- package/plugin/skills/agentcrm-install/references/github.md +20 -0
- package/plugin/skills/agentcrm-install/references/mcp.md +17 -0
- package/plugin/skills/agentcrm-install/references/plans.md +45 -0
- package/plugin/skills/agentcrm-install/references/s3.md +24 -0
- package/plugin/skills/agentcrm-manage/SKILL.md +108 -0
- package/plugin/skills/agentcrm-manage/references/cron.md +11 -0
- package/plugin/skills/agentcrm-manage/references/doctor.md +18 -0
- package/plugin/skills/agentcrm-sales/SKILL.md +92 -0
- package/plugin/skills/agentcrm-sales/references/enrichment.md +13 -0
- package/plugin/skills/agentcrm-sales/references/playbooks.md +29 -0
- package/plugin/skills/agentcrm-sales/references/weekly-report.md +27 -0
- package/types/agentcrm-runtime.d.ts +894 -0
|
@@ -0,0 +1,250 @@
|
|
|
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
|
+
const FIREBASE_SIGN_IN_METHODS = ["password", "google"];
|
|
8
|
+
function nonEmpty(s) {
|
|
9
|
+
return typeof s === "string" && s.trim().length > 0;
|
|
10
|
+
}
|
|
11
|
+
function isObject(v) {
|
|
12
|
+
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
13
|
+
}
|
|
14
|
+
function parseRuntimeConfig(raw) {
|
|
15
|
+
if (!isObject(raw)) return null;
|
|
16
|
+
const name = nonEmpty(raw.name) ? raw.name : void 0;
|
|
17
|
+
const withName = (c) => name ? { ...c, name } : c;
|
|
18
|
+
switch (raw.backend) {
|
|
19
|
+
case "local":
|
|
20
|
+
return withName({ backend: "local" });
|
|
21
|
+
case "journal": {
|
|
22
|
+
const j = raw.journal;
|
|
23
|
+
if (!isObject(j) || !nonEmpty(j.connectorId) || !isObject(j.settings)) return null;
|
|
24
|
+
return withName({
|
|
25
|
+
backend: "journal",
|
|
26
|
+
journal: {
|
|
27
|
+
connectorId: j.connectorId,
|
|
28
|
+
settings: j.settings,
|
|
29
|
+
root: typeof j.root === "string" ? j.root.replace(/^\/+|\/+$/g, "") : "",
|
|
30
|
+
encrypted: j.encrypted !== false
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
case "git-json": {
|
|
35
|
+
const g = raw.git;
|
|
36
|
+
if (!isObject(g)) return null;
|
|
37
|
+
const provider = g.provider;
|
|
38
|
+
if (provider !== "github" && provider !== "gitlab" && provider !== "local") return null;
|
|
39
|
+
if (provider === "github" && !(nonEmpty(g.owner) && nonEmpty(g.repo))) return null;
|
|
40
|
+
if (provider === "gitlab" && !nonEmpty(g.project)) return null;
|
|
41
|
+
if (provider !== "local" && !nonEmpty(g.branch)) return null;
|
|
42
|
+
return withName({
|
|
43
|
+
backend: "git-json",
|
|
44
|
+
git: {
|
|
45
|
+
provider,
|
|
46
|
+
...nonEmpty(g.owner) ? { owner: g.owner } : {},
|
|
47
|
+
...nonEmpty(g.repo) ? { repo: g.repo } : {},
|
|
48
|
+
...nonEmpty(g.project) ? { project: g.project } : {},
|
|
49
|
+
branch: nonEmpty(g.branch) ? g.branch : "main",
|
|
50
|
+
...nonEmpty(g.apiBaseUrl) ? { apiBaseUrl: g.apiBaseUrl } : {},
|
|
51
|
+
dir: typeof g.dir === "string" ? g.dir.replace(/^\/+|\/+$/g, "") : ""
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
case "firebase": {
|
|
56
|
+
const fb = raw.firebase;
|
|
57
|
+
if (!isObject(fb) || !nonEmpty(fb.apiKey) || !nonEmpty(fb.projectId)) return null;
|
|
58
|
+
const methods = Array.isArray(raw.signInMethods) ? raw.signInMethods.filter((m) => FIREBASE_SIGN_IN_METHODS.includes(m)) : [];
|
|
59
|
+
return withName({
|
|
60
|
+
backend: "firebase",
|
|
61
|
+
firebase: fb,
|
|
62
|
+
...methods.length ? { signInMethods: methods } : {}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
default:
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const LOCAL_RUNTIME_CONFIG_KEY = "agentcrm.runtimeConfig";
|
|
70
|
+
function storage() {
|
|
71
|
+
try {
|
|
72
|
+
return typeof localStorage !== "undefined" ? localStorage : null;
|
|
73
|
+
} catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function readFromLocalStorage() {
|
|
78
|
+
try {
|
|
79
|
+
const raw = storage()?.getItem(LOCAL_RUNTIME_CONFIG_KEY);
|
|
80
|
+
return raw ? JSON.parse(raw) : null;
|
|
81
|
+
} catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
let cached;
|
|
86
|
+
let override;
|
|
87
|
+
function getRuntimeConfig() {
|
|
88
|
+
if (override !== void 0) return override;
|
|
89
|
+
if (cached !== void 0) return cached;
|
|
90
|
+
const fromScript = typeof window !== "undefined" ? window.__AGENTCRM_CONFIG__ : void 0;
|
|
91
|
+
cached = parseRuntimeConfig(fromScript) ?? parseRuntimeConfig(readFromLocalStorage());
|
|
92
|
+
return cached;
|
|
93
|
+
}
|
|
94
|
+
function setRuntimeConfigOverride(config) {
|
|
95
|
+
override = config;
|
|
96
|
+
}
|
|
97
|
+
function resetRuntimeConfigCache() {
|
|
98
|
+
cached = void 0;
|
|
99
|
+
}
|
|
100
|
+
function saveLocalRuntimeConfig(config) {
|
|
101
|
+
try {
|
|
102
|
+
const s = storage();
|
|
103
|
+
if (config) s?.setItem(LOCAL_RUNTIME_CONFIG_KEY, JSON.stringify(stripSecrets(config)));
|
|
104
|
+
else s?.removeItem(LOCAL_RUNTIME_CONFIG_KEY);
|
|
105
|
+
} catch {
|
|
106
|
+
}
|
|
107
|
+
cached = void 0;
|
|
108
|
+
}
|
|
109
|
+
function getBackendKind() {
|
|
110
|
+
return getRuntimeConfig()?.backend ?? null;
|
|
111
|
+
}
|
|
112
|
+
const SECRET_SETTING_KEYS = /* @__PURE__ */ new Set([
|
|
113
|
+
"token",
|
|
114
|
+
"secretAccessKey",
|
|
115
|
+
"accessKeyId",
|
|
116
|
+
"password",
|
|
117
|
+
"passphrase",
|
|
118
|
+
"apiToken",
|
|
119
|
+
"clientSecret",
|
|
120
|
+
"refreshToken"
|
|
121
|
+
]);
|
|
122
|
+
function splitSecretSettings(settings) {
|
|
123
|
+
const publicSettings = {};
|
|
124
|
+
const secrets = {};
|
|
125
|
+
for (const [k, v] of Object.entries(settings)) {
|
|
126
|
+
if (SECRET_SETTING_KEYS.has(k)) {
|
|
127
|
+
if (v !== "" && v != null) secrets[k] = v;
|
|
128
|
+
} else {
|
|
129
|
+
publicSettings[k] = v;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return { publicSettings, secrets };
|
|
133
|
+
}
|
|
134
|
+
function stripSecrets(config) {
|
|
135
|
+
if (config.backend !== "journal") return config;
|
|
136
|
+
return { ...config, journal: { ...config.journal, settings: splitSecretSettings(config.journal.settings).publicSettings } };
|
|
137
|
+
}
|
|
138
|
+
function buildConfigJsSource(config) {
|
|
139
|
+
const banner = "// Generated by AgentCRM setup. Do not edit by hand — re-run the setup\n// (or `agentcrm install`) to update. Contains no secrets.\n";
|
|
140
|
+
const clean = stripSecrets(parseRuntimeConfig(config) ?? config);
|
|
141
|
+
return `${banner}window.__AGENTCRM_CONFIG__ = ${JSON.stringify(clean, null, 2)};
|
|
142
|
+
`;
|
|
143
|
+
}
|
|
144
|
+
const SECRET_PREFIX = "agentcrm.secrets:";
|
|
145
|
+
function datasetId(config) {
|
|
146
|
+
switch (config.backend) {
|
|
147
|
+
case "local":
|
|
148
|
+
return "local";
|
|
149
|
+
case "journal": {
|
|
150
|
+
const s = config.journal.settings;
|
|
151
|
+
const where = [s.endpoint, s.bucket, s.prefix, s.owner, s.repo, s.project, s.branch, s.dir, s.handleKey].filter((v) => typeof v === "string" && v).join("/");
|
|
152
|
+
return `journal:${config.journal.connectorId}:${where}:${config.journal.root}`;
|
|
153
|
+
}
|
|
154
|
+
case "git-json":
|
|
155
|
+
return `git:${gitRepoId(config.git)}:${config.git.dir}`;
|
|
156
|
+
case "firebase":
|
|
157
|
+
return `firebase:${config.firebase.projectId}`;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function gitRepoId(git) {
|
|
161
|
+
if (git.provider === "github") return `github:${git.owner}/${git.repo}`;
|
|
162
|
+
if (git.provider === "gitlab") return `gitlab:${git.project}`;
|
|
163
|
+
return "local";
|
|
164
|
+
}
|
|
165
|
+
function getSecret(key) {
|
|
166
|
+
try {
|
|
167
|
+
return storage()?.getItem(SECRET_PREFIX + key) ?? null;
|
|
168
|
+
} catch {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function setSecret(key, value) {
|
|
173
|
+
try {
|
|
174
|
+
const s = storage();
|
|
175
|
+
if (value) s?.setItem(SECRET_PREFIX + key, value);
|
|
176
|
+
else s?.removeItem(SECRET_PREFIX + key);
|
|
177
|
+
} catch {
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function getSecretJson(key) {
|
|
181
|
+
const raw = getSecret(key);
|
|
182
|
+
if (!raw) return null;
|
|
183
|
+
try {
|
|
184
|
+
return JSON.parse(raw);
|
|
185
|
+
} catch {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function setSecretJson(key, value) {
|
|
190
|
+
setSecret(key, value && Object.keys(value).length ? JSON.stringify(value) : null);
|
|
191
|
+
}
|
|
192
|
+
function getConnectorSecrets(config) {
|
|
193
|
+
return getSecretJson(`connector:${datasetId(config)}`) ?? {};
|
|
194
|
+
}
|
|
195
|
+
function setConnectorSecrets(config, secrets) {
|
|
196
|
+
setSecretJson(`connector:${datasetId(config)}`, secrets);
|
|
197
|
+
}
|
|
198
|
+
function getPassphrase(config) {
|
|
199
|
+
return getSecret(`passphrase:${datasetId(config)}`);
|
|
200
|
+
}
|
|
201
|
+
function setPassphrase(config, passphrase) {
|
|
202
|
+
setSecret(`passphrase:${datasetId(config)}`, passphrase);
|
|
203
|
+
}
|
|
204
|
+
function getHostingSecrets(config) {
|
|
205
|
+
return getSecretJson(`hosting:${datasetId(config)}`) ?? {};
|
|
206
|
+
}
|
|
207
|
+
function setHostingSecrets(config, secrets) {
|
|
208
|
+
setSecretJson(`hosting:${datasetId(config)}`, secrets);
|
|
209
|
+
}
|
|
210
|
+
function getGitToken(git) {
|
|
211
|
+
return getSecret(`gitToken:${gitRepoId(git)}`);
|
|
212
|
+
}
|
|
213
|
+
function setGitToken(git, token) {
|
|
214
|
+
setSecret(`gitToken:${gitRepoId(git)}`, token?.trim() || null);
|
|
215
|
+
}
|
|
216
|
+
function forgetSecrets(config) {
|
|
217
|
+
setConnectorSecrets(config, null);
|
|
218
|
+
setHostingSecrets(config, null);
|
|
219
|
+
setPassphrase(config, null);
|
|
220
|
+
if (config.backend === "git-json") setGitToken(config.git, null);
|
|
221
|
+
}
|
|
222
|
+
export {
|
|
223
|
+
FIREBASE_SIGN_IN_METHODS,
|
|
224
|
+
LOCAL_RUNTIME_CONFIG_KEY,
|
|
225
|
+
SECRET_PREFIX,
|
|
226
|
+
SECRET_SETTING_KEYS,
|
|
227
|
+
buildConfigJsSource,
|
|
228
|
+
datasetId,
|
|
229
|
+
forgetSecrets,
|
|
230
|
+
getBackendKind,
|
|
231
|
+
getConnectorSecrets,
|
|
232
|
+
getGitToken,
|
|
233
|
+
getHostingSecrets,
|
|
234
|
+
getPassphrase,
|
|
235
|
+
getRuntimeConfig,
|
|
236
|
+
getSecret,
|
|
237
|
+
getSecretJson,
|
|
238
|
+
gitRepoId,
|
|
239
|
+
parseRuntimeConfig,
|
|
240
|
+
resetRuntimeConfigCache,
|
|
241
|
+
saveLocalRuntimeConfig,
|
|
242
|
+
setConnectorSecrets,
|
|
243
|
+
setGitToken,
|
|
244
|
+
setHostingSecrets,
|
|
245
|
+
setPassphrase,
|
|
246
|
+
setRuntimeConfigOverride,
|
|
247
|
+
setSecret,
|
|
248
|
+
setSecretJson,
|
|
249
|
+
splitSecretSettings
|
|
250
|
+
};
|