@mulmoclaude/core 1.12.0 → 1.14.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 (117) hide show
  1. package/assets/helps/error-recovery.md +110 -1
  2. package/dist/{calendarGrid-CaS9er8i.cjs → calendarGrid-BQYqOCnF.cjs} +8 -9
  3. package/dist/{calendarGrid-CaS9er8i.cjs.map → calendarGrid-BQYqOCnF.cjs.map} +1 -1
  4. package/dist/{calendarGrid-CrGxeCOG.js → calendarGrid-DivcNKkX.js} +8 -9
  5. package/dist/{calendarGrid-CrGxeCOG.js.map → calendarGrid-DivcNKkX.js.map} +1 -1
  6. package/dist/collection/core/project.d.ts +11 -0
  7. package/dist/collection/core/schemaZ.d.ts +4 -4
  8. package/dist/collection/index.cjs +5 -4
  9. package/dist/collection/index.js +5 -5
  10. package/dist/collection/registry/server/index.cjs +3 -3
  11. package/dist/collection/registry/server/index.cjs.map +1 -1
  12. package/dist/collection/registry/server/index.js +3 -3
  13. package/dist/collection/registry/server/index.js.map +1 -1
  14. package/dist/collection/server/csvQuery.d.ts +7 -2
  15. package/dist/collection/server/csvStore.d.ts +2 -1
  16. package/dist/collection/server/index.cjs +3 -3
  17. package/dist/collection/server/index.js +3 -3
  18. package/dist/collection-watchers/index.cjs +10 -25
  19. package/dist/collection-watchers/index.cjs.map +1 -1
  20. package/dist/collection-watchers/index.js +10 -25
  21. package/dist/collection-watchers/index.js.map +1 -1
  22. package/dist/{discovery-NRy3tyUA.cjs → discovery-CRDx6TS4.cjs} +88 -47
  23. package/dist/discovery-CRDx6TS4.cjs.map +1 -0
  24. package/dist/{discovery-B4CZvrXR.js → discovery-D6p4ITNR.js} +88 -47
  25. package/dist/discovery-D6p4ITNR.js.map +1 -0
  26. package/dist/{dist-pWpC-b04.cjs → dist-CsgSfWwR.cjs} +66 -1
  27. package/dist/{dist-pWpC-b04.cjs.map → dist-CsgSfWwR.cjs.map} +1 -1
  28. package/dist/{dist-Cwk0e12G.js → dist-D8zokgGo.js} +25 -2
  29. package/dist/{dist-Cwk0e12G.js.map → dist-D8zokgGo.js.map} +1 -1
  30. package/dist/feeds/index.cjs +2 -2
  31. package/dist/feeds/index.js +2 -2
  32. package/dist/feeds/server/engine.d.ts +27 -0
  33. package/dist/feeds/server/index.cjs +97 -26
  34. package/dist/feeds/server/index.cjs.map +1 -1
  35. package/dist/feeds/server/index.d.ts +1 -1
  36. package/dist/feeds/server/index.js +96 -27
  37. package/dist/feeds/server/index.js.map +1 -1
  38. package/dist/google/calendar.d.ts +23 -9
  39. package/dist/google/calendarStateLock.d.ts +23 -0
  40. package/dist/google/collectionProjection.d.ts +0 -8
  41. package/dist/google/collectionPush.d.ts +13 -8
  42. package/dist/google/collectionSync.d.ts +80 -10
  43. package/dist/google/index.cjs +366 -98
  44. package/dist/google/index.cjs.map +1 -1
  45. package/dist/google/index.d.ts +6 -4
  46. package/dist/google/index.js +357 -99
  47. package/dist/google/index.js.map +1 -1
  48. package/dist/{ingestTypes-D1GQdG8e.cjs → ingestTypes-C7IJSqv4.cjs} +2 -2
  49. package/dist/{ingestTypes-D1GQdG8e.cjs.map → ingestTypes-C7IJSqv4.cjs.map} +1 -1
  50. package/dist/{ingestTypes-XReG-li7.js → ingestTypes-DmtDLRmt.js} +2 -2
  51. package/dist/{ingestTypes-XReG-li7.js.map → ingestTypes-DmtDLRmt.js.map} +1 -1
  52. package/dist/notifier/index.cjs +1 -1
  53. package/dist/notifier/index.js +1 -1
  54. package/dist/notifier/store.d.ts +4 -4
  55. package/dist/{notifier-BdA5qzhe.js → notifier-Dxh8mEFh.js} +39 -25
  56. package/dist/notifier-Dxh8mEFh.js.map +1 -0
  57. package/dist/{notifier-tMsAXyXp.cjs → notifier-Wc4M24Bi.cjs} +39 -25
  58. package/dist/notifier-Wc4M24Bi.cjs.map +1 -0
  59. package/dist/plugin-vue/index.cjs +4 -2
  60. package/dist/plugin-vue/index.cjs.map +1 -1
  61. package/dist/plugin-vue/index.js +4 -2
  62. package/dist/plugin-vue/index.js.map +1 -1
  63. package/dist/project-B0j_Vf_Q.js +33 -0
  64. package/dist/project-B0j_Vf_Q.js.map +1 -0
  65. package/dist/project-C1ep9pvo.cjs +44 -0
  66. package/dist/project-C1ep9pvo.cjs.map +1 -0
  67. package/dist/{promptSafety-FD8cQn3e.cjs → promptSafety-B52GvaJc.cjs} +99 -85
  68. package/dist/promptSafety-B52GvaJc.cjs.map +1 -0
  69. package/dist/{promptSafety-C--op_6a.js → promptSafety-DJgaDjM4.js} +99 -85
  70. package/dist/promptSafety-DJgaDjM4.js.map +1 -0
  71. package/dist/remote-host/index.cjs +2 -1
  72. package/dist/remote-host/index.d.ts +10 -0
  73. package/dist/remote-host/index.js +2 -2
  74. package/dist/remote-host/server/index.cjs +2 -2
  75. package/dist/remote-host/server/index.cjs.map +1 -1
  76. package/dist/remote-host/server/index.js +2 -2
  77. package/dist/remote-host/server/index.js.map +1 -1
  78. package/dist/{remote-host-DkDVxNim.cjs → remote-host-CtQjagPt.cjs} +53 -1
  79. package/dist/remote-host-CtQjagPt.cjs.map +1 -0
  80. package/dist/remote-host-Dba4lF3Z.js +82 -0
  81. package/dist/remote-host-Dba4lF3Z.js.map +1 -0
  82. package/dist/remote-view/index.cjs +6 -4
  83. package/dist/remote-view/index.cjs.map +1 -1
  84. package/dist/remote-view/index.js +6 -4
  85. package/dist/remote-view/index.js.map +1 -1
  86. package/dist/scheduler/index.cjs +1 -1
  87. package/dist/scheduler/index.js +1 -1
  88. package/dist/{server-DdyIvFhz.js → server-D6EUf3BF.js} +46 -27
  89. package/dist/server-D6EUf3BF.js.map +1 -0
  90. package/dist/{server-7U-3DE2e.cjs → server-D7_oRbTJ.cjs} +46 -27
  91. package/dist/server-D7_oRbTJ.cjs.map +1 -0
  92. package/dist/utils/index.cjs +1 -1
  93. package/dist/utils/index.js +1 -1
  94. package/dist/whisper/index.cjs +2 -6
  95. package/dist/whisper/index.cjs.map +1 -1
  96. package/dist/whisper/index.js +2 -6
  97. package/dist/whisper/index.js.map +1 -1
  98. package/dist/wiki/index.cjs +2 -2
  99. package/dist/wiki/index.cjs.map +1 -1
  100. package/dist/wiki/index.js +2 -2
  101. package/dist/wiki/index.js.map +1 -1
  102. package/package.json +2 -2
  103. package/dist/discovery-B4CZvrXR.js.map +0 -1
  104. package/dist/discovery-NRy3tyUA.cjs.map +0 -1
  105. package/dist/notifier-BdA5qzhe.js.map +0 -1
  106. package/dist/notifier-tMsAXyXp.cjs.map +0 -1
  107. package/dist/project-BWI5w_BT.cjs +0 -17
  108. package/dist/project-BWI5w_BT.cjs.map +0 -1
  109. package/dist/project-bU98ycsy.js +0 -12
  110. package/dist/project-bU98ycsy.js.map +0 -1
  111. package/dist/promptSafety-C--op_6a.js.map +0 -1
  112. package/dist/promptSafety-FD8cQn3e.cjs.map +0 -1
  113. package/dist/remote-host-D_BRFHcI.js +0 -36
  114. package/dist/remote-host-D_BRFHcI.js.map +0 -1
  115. package/dist/remote-host-DkDVxNim.cjs.map +0 -1
  116. package/dist/server-7U-3DE2e.cjs.map +0 -1
  117. package/dist/server-DdyIvFhz.js.map +0 -1
@@ -1,10 +1,10 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-D6vf50IK.cjs");
2
- const require_dist = require("./dist-pWpC-b04.cjs");
2
+ const require_dist = require("./dist-CsgSfWwR.cjs");
3
3
  const require_atomic = require("./atomic-C_7YpMiM.cjs");
4
4
  const require_relPath = require("./relPath-CgGi4-Nv.cjs");
5
- const require_calendarGrid = require("./calendarGrid-CaS9er8i.cjs");
6
- const require_promptSafety = require("./promptSafety-FD8cQn3e.cjs");
7
- const require_discovery = require("./discovery-NRy3tyUA.cjs");
5
+ const require_calendarGrid = require("./calendarGrid-BQYqOCnF.cjs");
6
+ const require_promptSafety = require("./promptSafety-B52GvaJc.cjs");
7
+ const require_discovery = require("./discovery-CRDx6TS4.cjs");
8
8
  const require_feeds_paths = require("./feeds/paths.cjs");
9
9
  const require_skill_bridge_index = require("./skill-bridge/index.cjs");
10
10
  let node_path = require("node:path");
@@ -46,8 +46,8 @@ async function readSourceAwareFile(collection, relPath, opts) {
46
46
  try {
47
47
  return await (0, node_fs_promises.readFile)(resolved, "utf-8");
48
48
  } catch (err) {
49
- const { code } = err;
50
- if (code !== "ENOENT" && code !== "ENOTDIR") throw err;
49
+ if (!require_dist.isErrorWithCode(err)) throw err;
50
+ if (err.code !== "ENOENT" && err.code !== "ENOTDIR") throw err;
51
51
  }
52
52
  }
53
53
  return null;
@@ -59,7 +59,7 @@ var EMPTY_I18N = {
59
59
  };
60
60
  function pickLocaleBlock(parsed, locale) {
61
61
  const block = parsed[locale];
62
- if (!block || typeof block !== "object" || Array.isArray(block)) return null;
62
+ if (!require_dist.isRecord(block)) return null;
63
63
  const entries = Object.entries(block).filter((entry) => typeof entry[1] === "string");
64
64
  return Object.fromEntries(entries);
65
65
  }
@@ -79,7 +79,7 @@ async function readCustomViewI18n(collection, i18nFile, locale, opts = {}) {
79
79
  } catch {
80
80
  return EMPTY_I18N;
81
81
  }
82
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return EMPTY_I18N;
82
+ if (!require_dist.isRecord(parsed)) return EMPTY_I18N;
83
83
  const obj = parsed;
84
84
  const primary = pickLocaleBlock(obj, locale);
85
85
  if (primary !== null && Object.keys(primary).length > 0) return {
@@ -266,7 +266,7 @@ async function runQueryOverRows(rows, query) {
266
266
  return (await require_discovery.queryCsv(sql, [jsonlPath, ...params])).map((row) => Object.fromEntries(Object.entries(row).map(([key, value]) => [key, require_discovery.normalizeCsvValue(value)])));
267
267
  } finally {
268
268
  await (0, node_fs_promises.unlink)(jsonlPath).catch((err) => {
269
- if (err.code !== "ENOENT") require_discovery.log.warn("collections", "temp JSONL cleanup failed", {
269
+ if (!require_dist.isErrorWithCode(err) || err.code !== "ENOENT") require_discovery.log.warn("collections", "temp JSONL cleanup failed", {
270
270
  path: jsonlPath,
271
271
  error: String(err)
272
272
  });
@@ -409,7 +409,7 @@ function strictTableProblem(key, spec, value) {
409
409
  if (!Array.isArray(value)) return `'${key}' = '${String(value)}' is not an array of rows (a 'table' field stores an array of row objects)`;
410
410
  for (let index = 0; index < value.length; index++) {
411
411
  const row = value[index];
412
- if (!row || typeof row !== "object" || Array.isArray(row)) return `'${key}' row ${index + 1} is not an object`;
412
+ if (!require_dist.isRecord(row)) return `'${key}' row ${index + 1} is not an object`;
413
413
  for (const [subKey, subSpec] of Object.entries(spec.of)) {
414
414
  const subValue = row[subKey];
415
415
  const problem = enforcedProblem(subKey, subSpec, subValue) ?? (isEmptyValue(subValue) ? null : strictTypeProblem(subKey, subSpec, subValue));
@@ -483,7 +483,7 @@ async function listRecordFilenames(dataDir, workspaceRoot) {
483
483
  try {
484
484
  return await (0, node_fs_promises.readdir)(dataDir);
485
485
  } catch (err) {
486
- if (err.code === "ENOENT") return [];
486
+ if (require_dist.isErrorWithCode(err) && err.code === "ENOENT") return [];
487
487
  throw err;
488
488
  }
489
489
  }
@@ -557,7 +557,7 @@ async function inspectRecord(fullPath, name, schema) {
557
557
  problem: `invalid JSON (${err instanceof Error ? err.message : String(err)}) — SKIPPED, won't appear. Usual cause: an unescaped " inside a string value; use 「」/『』 or write \\" instead.`
558
558
  };
559
559
  }
560
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {
560
+ if (!require_dist.isRecord(parsed)) return {
561
561
  file: name,
562
562
  problem: "not a JSON object — skipped, won't appear"
563
563
  };
@@ -1217,8 +1217,8 @@ async function fileExists(target) {
1217
1217
  await (0, node_fs_promises.stat)(target);
1218
1218
  return true;
1219
1219
  } catch (err) {
1220
- const { code } = err;
1221
- if (code === "ENOENT" || code === "ENOTDIR") return false;
1220
+ if (!require_dist.isErrorWithCode(err)) throw err;
1221
+ if (err.code === "ENOENT" || err.code === "ENOTDIR") return false;
1222
1222
  throw err;
1223
1223
  }
1224
1224
  }
@@ -1254,7 +1254,7 @@ async function unlinkIfPresent(target) {
1254
1254
  try {
1255
1255
  await (0, node_fs_promises.unlink)(target);
1256
1256
  } catch (err) {
1257
- if (err.code !== "ENOENT") throw err;
1257
+ if (!require_dist.isErrorWithCode(err) || err.code !== "ENOENT") throw err;
1258
1258
  }
1259
1259
  }
1260
1260
  /** Re-read the canonical schema.json, drop the `views[]` entry, and write the
@@ -1265,8 +1265,11 @@ async function removeViewFromSchemas(collection, viewId, workspaceRoot, safeSlug
1265
1265
  const base = await canonicalBase(collection, workspaceRoot, safeSlug);
1266
1266
  const canonical = node_path.default.join(base, require_discovery.SCHEMA_FILE);
1267
1267
  const parsed = JSON.parse(await (0, node_fs_promises.readFile)(canonical, "utf-8"));
1268
- if (Array.isArray(parsed.views)) parsed.views = parsed.views.filter((entry) => entry?.id !== viewId);
1269
- const serialized = `${JSON.stringify(parsed, null, 2)}\n`;
1268
+ const next = require_dist.isRecord(parsed) && require_dist.isUnknownArray(parsed.views) ? {
1269
+ ...parsed,
1270
+ views: parsed.views.filter((entry) => !require_dist.isRecord(entry) || entry.id !== viewId)
1271
+ } : parsed;
1272
+ const serialized = `${JSON.stringify(next, null, 2)}\n`;
1270
1273
  for (const target of await schemaWriteTargets(collection, workspaceRoot, safeSlug)) await require_atomic.writeFileAtomic(target, serialized);
1271
1274
  }
1272
1275
  /** Delete one custom view from `collection`: unlink its HTML file and drop it
@@ -1477,7 +1480,7 @@ function unknownCollection(slug) {
1477
1480
  }
1478
1481
  function optionalStringArray(value, name) {
1479
1482
  if (value === void 0) return { ok: true };
1480
- if (!Array.isArray(value) || !value.every((entry) => typeof entry === "string" && entry.length > 0)) return {
1483
+ if (!require_dist.isStringArray(value) || !value.every((entry) => entry.length > 0)) return {
1481
1484
  ok: false,
1482
1485
  error: `manageCollection: \`${name}\` must be an array of non-empty strings when present.`
1483
1486
  };
@@ -1528,11 +1531,12 @@ async function loadRequestedItems(collection, ids, deps) {
1528
1531
  };
1529
1532
  }
1530
1533
  async function handleGetItems(collection, args, deps) {
1531
- const { items, missing } = await loadRequestedItems(collection, args.ids, deps);
1532
- if (!args.ids && !args.fields && items.length > 200) return `manageCollection: refused — '${collection.slug}' has ${items.length} records, over the unselective limit of 200. Pass \`ids\` for specific records or \`fields\` to project only the columns you need.`;
1534
+ const { ids, fields } = args;
1535
+ const { items, missing } = await loadRequestedItems(collection, ids, deps);
1536
+ if (!ids && !fields && items.length > 200) return `manageCollection: refused — '${collection.slug}' has ${items.length} records, over the unselective limit of 200. Pass \`ids\` for specific records or \`fields\` to project only the columns you need.`;
1533
1537
  const enriched = await enrichItems(collection, items, deps);
1534
- const projected = args.fields ? enriched.map((item) => projectFields(item, args.fields, collection.schema.primaryKey)) : enriched;
1535
- const warning = !args.ids || missing.length > 0 ? await recordIssuesWarning(collection, deps) : void 0;
1538
+ const projected = fields ? enriched.map((item) => projectFields(item, fields, collection.schema.primaryKey)) : enriched;
1539
+ const warning = !ids || missing.length > 0 ? await recordIssuesWarning(collection, deps) : void 0;
1536
1540
  return JSON.stringify({
1537
1541
  collection: collection.slug,
1538
1542
  count: projected.length,
@@ -1687,17 +1691,32 @@ async function deleteOneItem(removeItem, itemId) {
1687
1691
  }
1688
1692
  function parseDeleteIds(args) {
1689
1693
  const { ids } = args;
1690
- if (!(Array.isArray(ids) && ids.length > 0 && ids.every((entry) => typeof entry === "string" && entry.trim().length > 0))) return "manageCollection: `ids` is required for deleteItems — a non-empty array of record ids.";
1694
+ if (!(require_dist.isStringArray(ids) && ids.length > 0 && ids.every((entry) => entry.trim().length > 0))) return "manageCollection: `ids` is required for deleteItems — a non-empty array of record ids.";
1691
1695
  return ids;
1692
1696
  }
1697
+ var PUT_MODES = [
1698
+ "upsert",
1699
+ "create",
1700
+ "merge"
1701
+ ];
1702
+ /** The requested write mode, defaulting when absent, or null when the caller
1703
+ * named a mode that doesn't exist. */
1704
+ function parsePutMode(mode) {
1705
+ if (mode === void 0) return "upsert";
1706
+ return PUT_MODES.find((candidate) => candidate === mode) ?? null;
1707
+ }
1708
+ function isRecordArray(value) {
1709
+ return require_dist.isUnknownArray(value) && value.every(require_dist.isRecord);
1710
+ }
1693
1711
  function parsePutItems(args, slug) {
1694
1712
  const { items, mode } = args;
1695
- if (!(Array.isArray(items) && items.length > 0 && items.every((entry) => Boolean(entry) && typeof entry === "object" && !Array.isArray(entry)))) return "manageCollection: `items` is required for putItems — a non-empty array of record objects.";
1696
- if (mode !== void 0 && mode !== "upsert" && mode !== "create" && mode !== "merge") return "manageCollection: `mode` must be \"upsert\" (default), \"create\", or \"merge\".";
1713
+ if (!isRecordArray(items) || items.length === 0) return "manageCollection: `items` is required for putItems — a non-empty array of record objects.";
1714
+ const putMode = parsePutMode(mode);
1715
+ if (putMode === null) return "manageCollection: `mode` must be \"upsert\" (default), \"create\", or \"merge\".";
1697
1716
  return {
1698
1717
  slug,
1699
1718
  items,
1700
- mode: mode ?? "upsert"
1719
+ mode: putMode
1701
1720
  };
1702
1721
  }
1703
1722
  /** The machine-readable workspace ontology: every collection with its
@@ -2133,4 +2152,4 @@ Object.defineProperty(exports, "validateRecordObject", {
2133
2152
  }
2134
2153
  });
2135
2154
 
2136
- //# sourceMappingURL=server-7U-3DE2e.cjs.map
2155
+ //# sourceMappingURL=server-D7_oRbTJ.cjs.map