@fleox-agent-crm/agentcrm 0.3.2 → 0.4.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 (39) hide show
  1. package/README.md +16 -16
  2. package/changelog.json +24 -0
  3. package/dist/admin/admin-files.json +7 -7
  4. package/dist/admin/assets/{chartsImpl-qlHW3VOv.js → chartsImpl-zjsXDhuy.js} +1 -1
  5. package/dist/admin/assets/firebase-C3h9mF8O.js +2 -0
  6. package/dist/admin/assets/{gitJson-wy2Tytfd.js → gitJson-nrOYgX0x.js} +1 -1
  7. package/dist/admin/assets/{index-BpaxrJx9.js → index-0ejjkW0z.js} +6 -6
  8. package/dist/admin/assets/{lucide-react.min-Djrg16BH.js → lucide-react.min-CI5dCsSm.js} +1 -1
  9. package/dist/admin/assets/{sdk-mu08RFtk.js → sdk-mepKXtVl.js} +135 -120
  10. package/dist/admin/index.html +1 -1
  11. package/dist/agent/agentcrm.mjs +29 -16
  12. package/dist/agent/chunks/api-BEl_EKwf.mjs +79 -0
  13. package/dist/agent/chunks/{firebase-BciZWdc6.mjs → firebase-Bknru2pE.mjs} +242 -63
  14. package/dist/agent/chunks/firebaseCache-sK4jA0ru.mjs +39 -0
  15. package/dist/agent/chunks/{firebaseRules-iori-s7U.mjs → firebaseRules-Jq85MBBN.mjs} +14 -3
  16. package/dist/agent/chunks/{hosting-Dnn1k3cV.mjs → hosting-C_UDyMkm.mjs} +1 -1
  17. package/dist/agent/chunks/{index-rut-KC39.mjs → index-DWecFbTi.mjs} +1 -1
  18. package/dist/agent/chunks/{install-BBTA4nMm.mjs → install-BLNflFes.mjs} +3 -3
  19. package/dist/agent/chunks/{sdk-CYgNyuoK.mjs → sdk-NYUHv7WG.mjs} +493 -214
  20. package/dist/version.json +1 -1
  21. package/package.json +1 -1
  22. package/plugin/.claude-plugin/plugin.json +1 -1
  23. package/plugin/skills/agentcrm-admin/SKILL.md +67 -67
  24. package/plugin/skills/agentcrm-admin/references/records.md +5 -5
  25. package/plugin/skills/agentcrm-admin/references/schema.md +19 -19
  26. package/plugin/skills/agentcrm-extensions/SKILL.md +8 -8
  27. package/plugin/skills/agentcrm-extensions/references/module-recipes.md +2 -2
  28. package/plugin/skills/agentcrm-extensions/references/testing.md +14 -14
  29. package/plugin/skills/agentcrm-extensions/references/theme-recipes.md +3 -3
  30. package/plugin/skills/agentcrm-install/SKILL.md +13 -13
  31. package/plugin/skills/agentcrm-install/references/firebase.md +1 -1
  32. package/plugin/skills/agentcrm-install/references/github.md +1 -1
  33. package/plugin/skills/agentcrm-install/references/mcp.md +2 -2
  34. package/plugin/skills/agentcrm-install/references/plans.md +1 -1
  35. package/plugin/skills/agentcrm-install/references/s3.md +1 -1
  36. package/plugin/skills/agentcrm-manage/SKILL.md +15 -15
  37. package/plugin/skills/agentcrm-sales/SKILL.md +18 -18
  38. package/dist/admin/assets/firebase-U38f5kc9.js +0 -2
  39. package/dist/agent/chunks/api-Dwb4xz1k.mjs +0 -27
@@ -0,0 +1,39 @@
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 { existsSync, rmSync } from "node:fs";
8
+ import { w as writeJsonFile, h as readJsonFile, i as homePath } from "../agentcrm.mjs";
9
+ import "node:util";
10
+ import "node:path";
11
+ import "node:url";
12
+ import "node:crypto";
13
+ import "node:os";
14
+ import "node:child_process";
15
+ import "node:http";
16
+ function cacheFile(key) {
17
+ return homePath("cache", `firebase-${key.replace(/[^a-z0-9._-]+/gi, "_")}.json`);
18
+ }
19
+ function fileFirebaseCache() {
20
+ return {
21
+ async read(key) {
22
+ try {
23
+ return readJsonFile(cacheFile(key), null);
24
+ } catch {
25
+ return null;
26
+ }
27
+ },
28
+ async write(key, state) {
29
+ writeJsonFile(cacheFile(key), state, 384);
30
+ },
31
+ async clear(key) {
32
+ const f = cacheFile(key);
33
+ if (existsSync(f)) rmSync(f, { force: true });
34
+ }
35
+ };
36
+ }
37
+ export {
38
+ fileFirebaseCache
39
+ };
@@ -124,7 +124,7 @@ function buildFirestoreRules(input) {
124
124
  " // Nobody changes their own role / email / disabled flag.",
125
125
  " allow update: if (isAdmin() && validRole(request.resource.data.role))",
126
126
  " || (isActive() && request.auth.uid == uid",
127
- " && request.resource.data.diff(resource.data).affectedKeys().hasOnly(['name', 'avatarUrl', 'updatedAt']));",
127
+ " && request.resource.data.diff(resource.data).affectedKeys().hasOnly(['name', 'avatarUrl', 'updatedAt', '_ts']));",
128
128
  " allow delete: if isAdmin();",
129
129
  " }",
130
130
  "",
@@ -152,7 +152,7 @@ function buildFirestoreRules(input) {
152
152
  " allow read: if isActive();",
153
153
  " allow create, delete: if isAdmin();",
154
154
  " allow update: if isAdmin()",
155
- " || (isMember() && request.resource.data.diff(resource.data).affectedKeys().hasOnly(['lastRunAt', 'updatedAt']));",
155
+ " || (isMember() && request.resource.data.diff(resource.data).affectedKeys().hasOnly(['lastRunAt', 'updatedAt', '_ts']));",
156
156
  " }",
157
157
  "",
158
158
  " match /automationRuns/{id} {",
@@ -180,6 +180,17 @@ function buildFirestoreRules(input) {
180
180
  " allow write: if isAdmin();",
181
181
  " }",
182
182
  "",
183
+ " // Tombstones of deleted documents, so cached copies drop them on the",
184
+ " // next incremental read (src/data/firebase/api.ts, withChangeTracking).",
185
+ " // Written in the same batch as the delete, which the rules above judge.",
186
+ " match /deletions/{id} {",
187
+ " allow read: if isActive();",
188
+ " allow create, update: if isMember()",
189
+ " && request.resource.data.keys().hasOnly(['collection', 'id', '_ts'])",
190
+ " && request.resource.data._ts == request.time;",
191
+ " allow delete: if isAdmin();",
192
+ " }",
193
+ "",
183
194
  " // ─── inbox/{id}: public lead-form submissions ──────────────────────",
184
195
  " function validSubmission(d) {",
185
196
  " return d.keys().hasAll(['formId', 'data', 'createdAt'])",
@@ -213,7 +224,7 @@ function buildFirestoreRules(input) {
213
224
  );
214
225
  return lines.join("\n");
215
226
  }
216
- [...MEMBER_WRITE, "views", "automations", "automationRuns", "files", ...ADMIN_WRITE, "users"];
227
+ [...MEMBER_WRITE, "views", "automations", "automationRuns", "files", ...ADMIN_WRITE, "users", "deletions"];
217
228
  export {
218
229
  INBOX_LIMITS,
219
230
  buildFirestoreRules,
@@ -8,7 +8,7 @@ import { statSync, rmSync, existsSync, unlinkSync, readFileSync, mkdirSync, writ
8
8
  import { resolve, dirname, sep, join, relative } from "node:path";
9
9
  import { buildConfigJsSource } from "./runtimeConfig-CCOFg1RM.mjs";
10
10
  import { a as createGitPagesConnector, b as createS3Connector } from "./s3-Dz50-NuA.mjs";
11
- import { C as CliError, r as readVersionInfo, j as distRoot } from "../agentcrm.mjs";
11
+ import { C as CliError, r as readVersionInfo, l as distRoot } from "../agentcrm.mjs";
12
12
  import { pathToFileURL } from "node:url";
13
13
  import "./index-BM8qeGOb.mjs";
14
14
  import "./http-Bk9ICb7I.mjs";
@@ -126,7 +126,7 @@ registerBackend("journal", (config, opts) => {
126
126
  store.identity = async () => (await missingJournalAccess(cfg.connectorId, settings)).length ? null : identity();
127
127
  return store;
128
128
  });
129
- registerBackend("firebase", async (config, opts) => (await import("./firebase-BciZWdc6.mjs")).createFirebaseStore(config, opts));
129
+ registerBackend("firebase", async (config, opts) => (await import("./firebase-Bknru2pE.mjs")).createFirebaseStore(config, opts));
130
130
  registerBackend("git-json", async (config, opts) => (await import("./gitJson-fjr8mcHe.mjs")).createGitJsonStore(config, opts));
131
131
  async function createDataStore(config, opts = {}) {
132
132
  const factory = getBackendFactory(config.backend);
@@ -8,8 +8,8 @@ import { generatePassphrase } from "./index-CWrrF1wl.mjs";
8
8
  import { r as resolveGitPagesToken, c as createRemoteGitTransport } from "./s3-Dz50-NuA.mjs";
9
9
  import { i as instantiateStorageConnector } from "./registry-DijAKZ24.mjs";
10
10
  import { S as StorageError, s as subscribeToToasts } from "./http-Bk9ICb7I.mjs";
11
- import { s as setCredential, h as openStore, i as installBrowserEnv } from "../agentcrm.mjs";
12
- import { adminOps, applyOps, buildConnector } from "./hosting-Dnn1k3cV.mjs";
11
+ import { s as setCredential, j as openStore, k as installBrowserEnv } from "../agentcrm.mjs";
12
+ import { adminOps, applyOps, buildConnector } from "./hosting-C_UDyMkm.mjs";
13
13
  import "./index-BM8qeGOb.mjs";
14
14
  import "./runtimeConfig-CCOFg1RM.mjs";
15
15
  import "./encoding-C9MzdP95.mjs";
@@ -134,7 +134,7 @@ async function checkPlan(plan) {
134
134
  const runtime = plan.runtime;
135
135
  try {
136
136
  installBrowserEnv();
137
- const { firebaseApiFor, checkFirebaseAccess } = await import("./firebase-BciZWdc6.mjs");
137
+ const { firebaseApiFor, checkFirebaseAccess } = await import("./firebase-Bknru2pE.mjs");
138
138
  data = await checkFirebaseAccess(await firebaseApiFor(runtime), plan.backendSecrets, runtime.firebase.projectId ?? "");
139
139
  } catch (err) {
140
140
  data = { ok: false, detail: err.message, existing: false };