@mulmoclaude/core 1.12.0 → 1.13.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 (68) hide show
  1. package/assets/helps/error-recovery.md +98 -0
  2. package/dist/collection/core/project.d.ts +11 -0
  3. package/dist/collection/index.cjs +3 -2
  4. package/dist/collection/index.js +3 -3
  5. package/dist/collection/registry/server/index.cjs +3 -3
  6. package/dist/collection/registry/server/index.js +3 -3
  7. package/dist/collection/server/index.cjs +2 -2
  8. package/dist/collection/server/index.js +2 -2
  9. package/dist/collection-watchers/index.cjs +3 -3
  10. package/dist/collection-watchers/index.js +3 -3
  11. package/dist/{discovery-B4CZvrXR.js → discovery-D-ZJ6a6z.js} +39 -18
  12. package/dist/discovery-D-ZJ6a6z.js.map +1 -0
  13. package/dist/{discovery-NRy3tyUA.cjs → discovery-DAoMnBYM.cjs} +39 -18
  14. package/dist/discovery-DAoMnBYM.cjs.map +1 -0
  15. package/dist/{dist-pWpC-b04.cjs → dist-21pMsI1a.cjs} +45 -1
  16. package/dist/{dist-pWpC-b04.cjs.map → dist-21pMsI1a.cjs.map} +1 -1
  17. package/dist/{dist-Cwk0e12G.js → dist-DP1FTGnO.js} +16 -2
  18. package/dist/{dist-Cwk0e12G.js.map → dist-DP1FTGnO.js.map} +1 -1
  19. package/dist/feeds/server/engine.d.ts +27 -0
  20. package/dist/feeds/server/index.cjs +72 -7
  21. package/dist/feeds/server/index.cjs.map +1 -1
  22. package/dist/feeds/server/index.d.ts +1 -1
  23. package/dist/feeds/server/index.js +71 -8
  24. package/dist/feeds/server/index.js.map +1 -1
  25. package/dist/google/calendarStateLock.d.ts +23 -0
  26. package/dist/google/collectionProjection.d.ts +0 -8
  27. package/dist/google/collectionSync.d.ts +80 -10
  28. package/dist/google/index.cjs +310 -67
  29. package/dist/google/index.cjs.map +1 -1
  30. package/dist/google/index.d.ts +4 -2
  31. package/dist/google/index.js +304 -69
  32. package/dist/google/index.js.map +1 -1
  33. package/dist/notifier/index.cjs +1 -1
  34. package/dist/notifier/index.js +1 -1
  35. package/dist/notifier/store.d.ts +4 -4
  36. package/dist/{notifier-tMsAXyXp.cjs → notifier-C3IhYxqh.cjs} +39 -25
  37. package/dist/notifier-C3IhYxqh.cjs.map +1 -0
  38. package/dist/{notifier-BdA5qzhe.js → notifier-CMFlw74b.js} +39 -25
  39. package/dist/notifier-CMFlw74b.js.map +1 -0
  40. package/dist/project-B9NSyr6L.js +28 -0
  41. package/dist/project-B9NSyr6L.js.map +1 -0
  42. package/dist/project-CCtT_fQr.cjs +39 -0
  43. package/dist/project-CCtT_fQr.cjs.map +1 -0
  44. package/dist/remote-host/server/index.cjs +1 -1
  45. package/dist/remote-host/server/index.js +1 -1
  46. package/dist/remote-view/index.cjs +1 -1
  47. package/dist/remote-view/index.js +1 -1
  48. package/dist/scheduler/index.cjs +1 -1
  49. package/dist/scheduler/index.js +1 -1
  50. package/dist/{server-7U-3DE2e.cjs → server-B_b0bLSW.cjs} +3 -3
  51. package/dist/{server-7U-3DE2e.cjs.map → server-B_b0bLSW.cjs.map} +1 -1
  52. package/dist/{server-DdyIvFhz.js → server-Ci_A3chZ.js} +3 -3
  53. package/dist/{server-DdyIvFhz.js.map → server-Ci_A3chZ.js.map} +1 -1
  54. package/dist/utils/index.cjs +1 -1
  55. package/dist/utils/index.js +1 -1
  56. package/dist/whisper/index.cjs +1 -1
  57. package/dist/whisper/index.js +1 -1
  58. package/dist/wiki/index.cjs +1 -1
  59. package/dist/wiki/index.js +1 -1
  60. package/package.json +1 -1
  61. package/dist/discovery-B4CZvrXR.js.map +0 -1
  62. package/dist/discovery-NRy3tyUA.cjs.map +0 -1
  63. package/dist/notifier-BdA5qzhe.js.map +0 -1
  64. package/dist/notifier-tMsAXyXp.cjs.map +0 -1
  65. package/dist/project-BWI5w_BT.cjs +0 -17
  66. package/dist/project-BWI5w_BT.cjs.map +0 -1
  67. package/dist/project-bU98ycsy.js +0 -12
  68. package/dist/project-bU98ycsy.js.map +0 -1
@@ -3,10 +3,24 @@
3
3
  function isRecord(value) {
4
4
  return typeof value === "object" && value !== null && !Array.isArray(value);
5
5
  }
6
+ /** An array of unknowns. Prefer this over a bare `Array.isArray` in typed code:
7
+ * `Array.isArray(x: unknown)` narrows to `any[]`, silently reintroducing
8
+ * `any`, whereas this keeps the element type `unknown`. */
9
+ function isUnknownArray(value) {
10
+ return Array.isArray(value);
11
+ }
12
+ /** Error-like object with a `code` property (e.g. Node.js fs errors). */
13
+ function isErrorWithCode(value) {
14
+ return isRecord(value) && typeof value.code === "string";
15
+ }
6
16
  /** Check that a record has a specific key with a string value. */
7
17
  function hasStringProp(value, key) {
8
18
  return isRecord(value) && typeof value[key] === "string";
9
19
  }
20
+ /** Check that a record has a specific key with a number value. */
21
+ function hasNumberProp(value, key) {
22
+ return isRecord(value) && typeof value[key] === "number";
23
+ }
10
24
  /** Normalise an unknown thrown value into a human-readable string. Isomorphic
11
25
  * (host, bridges, plugins, Vue) — this is the single home for the helper that
12
26
  * #2217 could only consolidate for server code, since `@mulmoclaude/core/utils`
@@ -57,5 +71,35 @@ Object.defineProperty(exports, "escapeHtml", {
57
71
  return escapeHtml;
58
72
  }
59
73
  });
74
+ Object.defineProperty(exports, "hasNumberProp", {
75
+ enumerable: true,
76
+ get: function() {
77
+ return hasNumberProp;
78
+ }
79
+ });
80
+ Object.defineProperty(exports, "hasStringProp", {
81
+ enumerable: true,
82
+ get: function() {
83
+ return hasStringProp;
84
+ }
85
+ });
86
+ Object.defineProperty(exports, "isErrorWithCode", {
87
+ enumerable: true,
88
+ get: function() {
89
+ return isErrorWithCode;
90
+ }
91
+ });
92
+ Object.defineProperty(exports, "isRecord", {
93
+ enumerable: true,
94
+ get: function() {
95
+ return isRecord;
96
+ }
97
+ });
98
+ Object.defineProperty(exports, "isUnknownArray", {
99
+ enumerable: true,
100
+ get: function() {
101
+ return isUnknownArray;
102
+ }
103
+ });
60
104
 
61
- //# sourceMappingURL=dist-pWpC-b04.cjs.map
105
+ //# sourceMappingURL=dist-21pMsI1a.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dist-pWpC-b04.cjs","names":[],"sources":["../../common/dist/index.js"],"sourcesContent":["// General-purpose runtime type guards, shared across the MulmoClaude host,\n// bridges, and plugins. This is a leaf package — pure and dependency-free — so\n// any tier can import it without creating an uphill edge.\n//\n// These originated as `server/utils/types.ts` (#504), which centralised 40+\n// hand-written inline `typeof x === \"object\"` checks. They are promoted here so\n// the same guards stop being re-hand-written in every bridge and plugin too.\n/** Narrow `unknown` to a plain object (not null, not array). */\nexport function isRecord(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n/** Narrow `unknown` to any object (not null, arrays allowed).\n * Use `isRecord` when you need to access string keys. */\nexport function isObj(value) {\n return typeof value === \"object\" && value !== null;\n}\n/** Non-empty string after trimming whitespace. */\nexport function isNonEmptyString(value) {\n return typeof value === \"string\" && value.trim().length > 0;\n}\n/** Record whose values are all strings. */\nexport function isStringRecord(value) {\n if (!isRecord(value))\n return false;\n return Object.values(value).every((val) => typeof val === \"string\");\n}\n/** String array (every element is a string). */\nexport function isStringArray(value) {\n return Array.isArray(value) && value.every((val) => typeof val === \"string\");\n}\n/** An array of unknowns. Prefer this over a bare `Array.isArray` in typed code:\n * `Array.isArray(x: unknown)` narrows to `any[]`, silently reintroducing\n * `any`, whereas this keeps the element type `unknown`. */\nexport function isUnknownArray(value) {\n return Array.isArray(value);\n}\n/** Error-like object with a `code` property (e.g. Node.js fs errors). */\nexport function isErrorWithCode(value) {\n return isRecord(value) && typeof value.code === \"string\";\n}\n/** Check that a record has a specific key with a string value. */\nexport function hasStringProp(value, key) {\n return isRecord(value) && typeof value[key] === \"string\";\n}\n/** Check that a record has a specific key with a number value. */\nexport function hasNumberProp(value, key) {\n return isRecord(value) && typeof value[key] === \"number\";\n}\n/** Split a comma-separated env value into trimmed, non-empty entries.\n * `lowercase` folds case for identifiers compared case-insensitively\n * (JIDs, email addresses, hex pubkeys). Absent/empty input → empty list. */\nexport function parseCsvList(raw, opts) {\n return (raw ?? \"\")\n .split(\",\")\n .map((entry) => (opts?.lowercase ? entry.trim().toLowerCase() : entry.trim()))\n .filter(Boolean);\n}\n/** A comma-separated env value as a Set — the canonical allowlist shape,\n * where an empty set is the \"allow all\" sentinel (`set.size === 0`). */\nexport function parseCsvSet(raw, opts) {\n return new Set(parseCsvList(raw, opts));\n}\n/** Normalise an unknown thrown value into a human-readable string. Isomorphic\n * (host, bridges, plugins, Vue) — this is the single home for the helper that\n * #2217 could only consolidate for server code, since `@mulmoclaude/core/utils`\n * is server-only.\n *\n * A non-Error object with a non-empty string `details` (gRPC convention) or\n * `message` field surfaces that field — `details` wins — instead of the\n * `[object Object]` a bare `String(err)` would print; an empty-string field\n * falls through. `fallback` covers the error-boundary idiom where a thrown\n * non-Error should read as a descriptive message rather than `String(err)`\n * noise; omit it in logging contexts where `String(err)` is fine. */\nexport function errorMessage(err, fallback) {\n if (err instanceof Error)\n return err.message;\n if (hasStringProp(err, \"details\") && err.details)\n return err.details;\n if (hasStringProp(err, \"message\") && err.message)\n return err.message;\n if (fallback !== undefined)\n return fallback;\n return String(err);\n}\n/** `Date` → `YYYY-MM-DD` in UTC — for dates that must not shift with the\n * host's local timezone (tool-trace search dirs, API date keys). Isomorphic\n * single source (#2480): the host re-exports it from `server/utils/date.ts`,\n * x-plugin imports it directly. The `@receptron/task-scheduler` copy stays\n * local on purpose — that leaf package is published independently and kept\n * dependency-free. Wall-clock questions use the host's `toLocalIsoDate`. */\nexport function toUtcIsoDate(timestamp) {\n const year = timestamp.getUTCFullYear();\n const month = String(timestamp.getUTCMonth() + 1).padStart(2, \"0\");\n const day = String(timestamp.getUTCDate()).padStart(2, \"0\");\n return `${year}-${month}-${day}`;\n}\n// A Map, not an object literal: `{}[char]` reads through the prototype chain,\n// so a future caller widening the regex would silently get `[object Object]`\n// for keys like `constructor`.\nconst HTML_ESCAPES = new Map([\n [\"&\", \"&amp;\"],\n [\"<\", \"&lt;\"],\n [\">\", \"&gt;\"],\n ['\"', \"&quot;\"],\n [\"'\", \"&#39;\"],\n]);\n/** HTML-escape text destined for markup or an attribute value — the fixed\n * five-character map, nothing more. Lives here rather than in\n * `@mulmoclaude/core/wiki` (#2483) because `@mulmoclaude/markdown-utils` is a\n * leaf that core depends on and so cannot import back up; core/wiki\n * re-exports this, keeping its consumers' import path unchanged.\n *\n * Escaping `&` first is what makes a single pass safe — the entities this\n * introduces contain none of the other four characters, so nothing is\n * double-escaped. Not a sanitiser: it neither strips tags nor validates URLs. */\nexport function escapeHtml(value) {\n return value.replace(/[&<>\"']/g, (char) => HTML_ESCAPES.get(char) ?? char);\n}\nexport { scanEnvOptions, snakeToLowerCamel } from \"./envScan.js\";\n"],"mappings":";;AAQA,SAAgB,SAAS,OAAO;CAC5B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC9E;;AA+BA,SAAgB,cAAc,OAAO,KAAK;CACtC,OAAO,SAAS,KAAK,KAAK,OAAO,MAAM,SAAS;AACpD;;;;;;;;;;;;AA8BA,SAAgB,aAAa,KAAK,UAAU;CACxC,IAAI,eAAe,OACf,OAAO,IAAI;CACf,IAAI,cAAc,KAAK,SAAS,KAAK,IAAI,SACrC,OAAO,IAAI;CACf,IAAI,cAAc,KAAK,SAAS,KAAK,IAAI,SACrC,OAAO,IAAI;CACf,IAAI,aAAa,KAAA,GACb,OAAO;CACX,OAAO,OAAO,GAAG;AACrB;AAgBA,IAAM,+BAAe,IAAI,IAAI;CACzB,CAAC,KAAK,OAAO;CACb,CAAC,KAAK,MAAM;CACZ,CAAC,KAAK,MAAM;CACZ,CAAC,MAAK,QAAQ;CACd,CAAC,KAAK,OAAO;AACjB,CAAC;;;;;;;;;;AAUD,SAAgB,WAAW,OAAO;CAC9B,OAAO,MAAM,QAAQ,aAAa,SAAS,aAAa,IAAI,IAAI,KAAK,IAAI;AAC7E"}
1
+ {"version":3,"file":"dist-21pMsI1a.cjs","names":[],"sources":["../../common/dist/index.js"],"sourcesContent":["// General-purpose runtime type guards, shared across the MulmoClaude host,\n// bridges, and plugins. This is a leaf package — pure and dependency-free — so\n// any tier can import it without creating an uphill edge.\n//\n// These originated as `server/utils/types.ts` (#504), which centralised 40+\n// hand-written inline `typeof x === \"object\"` checks. They are promoted here so\n// the same guards stop being re-hand-written in every bridge and plugin too.\n/** Narrow `unknown` to a plain object (not null, not array). */\nexport function isRecord(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n/** Narrow `unknown` to any object (not null, arrays allowed).\n * Use `isRecord` when you need to access string keys. */\nexport function isObj(value) {\n return typeof value === \"object\" && value !== null;\n}\n/** Non-empty string after trimming whitespace. */\nexport function isNonEmptyString(value) {\n return typeof value === \"string\" && value.trim().length > 0;\n}\n/** Record whose values are all strings. */\nexport function isStringRecord(value) {\n if (!isRecord(value))\n return false;\n return Object.values(value).every((val) => typeof val === \"string\");\n}\n/** String array (every element is a string). */\nexport function isStringArray(value) {\n return Array.isArray(value) && value.every((val) => typeof val === \"string\");\n}\n/** An array of unknowns. Prefer this over a bare `Array.isArray` in typed code:\n * `Array.isArray(x: unknown)` narrows to `any[]`, silently reintroducing\n * `any`, whereas this keeps the element type `unknown`. */\nexport function isUnknownArray(value) {\n return Array.isArray(value);\n}\n/** Error-like object with a `code` property (e.g. Node.js fs errors). */\nexport function isErrorWithCode(value) {\n return isRecord(value) && typeof value.code === \"string\";\n}\n/** Check that a record has a specific key with a string value. */\nexport function hasStringProp(value, key) {\n return isRecord(value) && typeof value[key] === \"string\";\n}\n/** Check that a record has a specific key with a number value. */\nexport function hasNumberProp(value, key) {\n return isRecord(value) && typeof value[key] === \"number\";\n}\n/** Split a comma-separated env value into trimmed, non-empty entries.\n * `lowercase` folds case for identifiers compared case-insensitively\n * (JIDs, email addresses, hex pubkeys). Absent/empty input → empty list. */\nexport function parseCsvList(raw, opts) {\n return (raw ?? \"\")\n .split(\",\")\n .map((entry) => (opts?.lowercase ? entry.trim().toLowerCase() : entry.trim()))\n .filter(Boolean);\n}\n/** A comma-separated env value as a Set — the canonical allowlist shape,\n * where an empty set is the \"allow all\" sentinel (`set.size === 0`). */\nexport function parseCsvSet(raw, opts) {\n return new Set(parseCsvList(raw, opts));\n}\n/** Normalise an unknown thrown value into a human-readable string. Isomorphic\n * (host, bridges, plugins, Vue) — this is the single home for the helper that\n * #2217 could only consolidate for server code, since `@mulmoclaude/core/utils`\n * is server-only.\n *\n * A non-Error object with a non-empty string `details` (gRPC convention) or\n * `message` field surfaces that field — `details` wins — instead of the\n * `[object Object]` a bare `String(err)` would print; an empty-string field\n * falls through. `fallback` covers the error-boundary idiom where a thrown\n * non-Error should read as a descriptive message rather than `String(err)`\n * noise; omit it in logging contexts where `String(err)` is fine. */\nexport function errorMessage(err, fallback) {\n if (err instanceof Error)\n return err.message;\n if (hasStringProp(err, \"details\") && err.details)\n return err.details;\n if (hasStringProp(err, \"message\") && err.message)\n return err.message;\n if (fallback !== undefined)\n return fallback;\n return String(err);\n}\n/** `Date` → `YYYY-MM-DD` in UTC — for dates that must not shift with the\n * host's local timezone (tool-trace search dirs, API date keys). Isomorphic\n * single source (#2480): the host re-exports it from `server/utils/date.ts`,\n * x-plugin imports it directly. The `@receptron/task-scheduler` copy stays\n * local on purpose — that leaf package is published independently and kept\n * dependency-free. Wall-clock questions use the host's `toLocalIsoDate`. */\nexport function toUtcIsoDate(timestamp) {\n const year = timestamp.getUTCFullYear();\n const month = String(timestamp.getUTCMonth() + 1).padStart(2, \"0\");\n const day = String(timestamp.getUTCDate()).padStart(2, \"0\");\n return `${year}-${month}-${day}`;\n}\n// A Map, not an object literal: `{}[char]` reads through the prototype chain,\n// so a future caller widening the regex would silently get `[object Object]`\n// for keys like `constructor`.\nconst HTML_ESCAPES = new Map([\n [\"&\", \"&amp;\"],\n [\"<\", \"&lt;\"],\n [\">\", \"&gt;\"],\n ['\"', \"&quot;\"],\n [\"'\", \"&#39;\"],\n]);\n/** HTML-escape text destined for markup or an attribute value — the fixed\n * five-character map, nothing more. Lives here rather than in\n * `@mulmoclaude/core/wiki` (#2483) because `@mulmoclaude/markdown-utils` is a\n * leaf that core depends on and so cannot import back up; core/wiki\n * re-exports this, keeping its consumers' import path unchanged.\n *\n * Escaping `&` first is what makes a single pass safe — the entities this\n * introduces contain none of the other four characters, so nothing is\n * double-escaped. Not a sanitiser: it neither strips tags nor validates URLs. */\nexport function escapeHtml(value) {\n return value.replace(/[&<>\"']/g, (char) => HTML_ESCAPES.get(char) ?? char);\n}\nexport { scanEnvOptions, snakeToLowerCamel } from \"./envScan.js\";\n"],"mappings":";;AAQA,SAAgB,SAAS,OAAO;CAC5B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC9E;;;;AAuBA,SAAgB,eAAe,OAAO;CAClC,OAAO,MAAM,QAAQ,KAAK;AAC9B;;AAEA,SAAgB,gBAAgB,OAAO;CACnC,OAAO,SAAS,KAAK,KAAK,OAAO,MAAM,SAAS;AACpD;;AAEA,SAAgB,cAAc,OAAO,KAAK;CACtC,OAAO,SAAS,KAAK,KAAK,OAAO,MAAM,SAAS;AACpD;;AAEA,SAAgB,cAAc,OAAO,KAAK;CACtC,OAAO,SAAS,KAAK,KAAK,OAAO,MAAM,SAAS;AACpD;;;;;;;;;;;;AA0BA,SAAgB,aAAa,KAAK,UAAU;CACxC,IAAI,eAAe,OACf,OAAO,IAAI;CACf,IAAI,cAAc,KAAK,SAAS,KAAK,IAAI,SACrC,OAAO,IAAI;CACf,IAAI,cAAc,KAAK,SAAS,KAAK,IAAI,SACrC,OAAO,IAAI;CACf,IAAI,aAAa,KAAA,GACb,OAAO;CACX,OAAO,OAAO,GAAG;AACrB;AAgBA,IAAM,+BAAe,IAAI,IAAI;CACzB,CAAC,KAAK,OAAO;CACb,CAAC,KAAK,MAAM;CACZ,CAAC,KAAK,MAAM;CACZ,CAAC,MAAK,QAAQ;CACd,CAAC,KAAK,OAAO;AACjB,CAAC;;;;;;;;;;AAUD,SAAgB,WAAW,OAAO;CAC9B,OAAO,MAAM,QAAQ,aAAa,SAAS,aAAa,IAAI,IAAI,KAAK,IAAI;AAC7E"}
@@ -3,10 +3,24 @@
3
3
  function isRecord(value) {
4
4
  return typeof value === "object" && value !== null && !Array.isArray(value);
5
5
  }
6
+ /** An array of unknowns. Prefer this over a bare `Array.isArray` in typed code:
7
+ * `Array.isArray(x: unknown)` narrows to `any[]`, silently reintroducing
8
+ * `any`, whereas this keeps the element type `unknown`. */
9
+ function isUnknownArray(value) {
10
+ return Array.isArray(value);
11
+ }
12
+ /** Error-like object with a `code` property (e.g. Node.js fs errors). */
13
+ function isErrorWithCode(value) {
14
+ return isRecord(value) && typeof value.code === "string";
15
+ }
6
16
  /** Check that a record has a specific key with a string value. */
7
17
  function hasStringProp(value, key) {
8
18
  return isRecord(value) && typeof value[key] === "string";
9
19
  }
20
+ /** Check that a record has a specific key with a number value. */
21
+ function hasNumberProp(value, key) {
22
+ return isRecord(value) && typeof value[key] === "number";
23
+ }
10
24
  /** Normalise an unknown thrown value into a human-readable string. Isomorphic
11
25
  * (host, bridges, plugins, Vue) — this is the single home for the helper that
12
26
  * #2217 could only consolidate for server code, since `@mulmoclaude/core/utils`
@@ -45,6 +59,6 @@ function escapeHtml(value) {
45
59
  return value.replace(/[&<>"']/g, (char) => HTML_ESCAPES.get(char) ?? char);
46
60
  }
47
61
  //#endregion
48
- export { escapeHtml as n, errorMessage as t };
62
+ export { isErrorWithCode as a, hasStringProp as i, escapeHtml as n, isRecord as o, hasNumberProp as r, isUnknownArray as s, errorMessage as t };
49
63
 
50
- //# sourceMappingURL=dist-Cwk0e12G.js.map
64
+ //# sourceMappingURL=dist-DP1FTGnO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dist-Cwk0e12G.js","names":[],"sources":["../../common/dist/index.js"],"sourcesContent":["// General-purpose runtime type guards, shared across the MulmoClaude host,\n// bridges, and plugins. This is a leaf package — pure and dependency-free — so\n// any tier can import it without creating an uphill edge.\n//\n// These originated as `server/utils/types.ts` (#504), which centralised 40+\n// hand-written inline `typeof x === \"object\"` checks. They are promoted here so\n// the same guards stop being re-hand-written in every bridge and plugin too.\n/** Narrow `unknown` to a plain object (not null, not array). */\nexport function isRecord(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n/** Narrow `unknown` to any object (not null, arrays allowed).\n * Use `isRecord` when you need to access string keys. */\nexport function isObj(value) {\n return typeof value === \"object\" && value !== null;\n}\n/** Non-empty string after trimming whitespace. */\nexport function isNonEmptyString(value) {\n return typeof value === \"string\" && value.trim().length > 0;\n}\n/** Record whose values are all strings. */\nexport function isStringRecord(value) {\n if (!isRecord(value))\n return false;\n return Object.values(value).every((val) => typeof val === \"string\");\n}\n/** String array (every element is a string). */\nexport function isStringArray(value) {\n return Array.isArray(value) && value.every((val) => typeof val === \"string\");\n}\n/** An array of unknowns. Prefer this over a bare `Array.isArray` in typed code:\n * `Array.isArray(x: unknown)` narrows to `any[]`, silently reintroducing\n * `any`, whereas this keeps the element type `unknown`. */\nexport function isUnknownArray(value) {\n return Array.isArray(value);\n}\n/** Error-like object with a `code` property (e.g. Node.js fs errors). */\nexport function isErrorWithCode(value) {\n return isRecord(value) && typeof value.code === \"string\";\n}\n/** Check that a record has a specific key with a string value. */\nexport function hasStringProp(value, key) {\n return isRecord(value) && typeof value[key] === \"string\";\n}\n/** Check that a record has a specific key with a number value. */\nexport function hasNumberProp(value, key) {\n return isRecord(value) && typeof value[key] === \"number\";\n}\n/** Split a comma-separated env value into trimmed, non-empty entries.\n * `lowercase` folds case for identifiers compared case-insensitively\n * (JIDs, email addresses, hex pubkeys). Absent/empty input → empty list. */\nexport function parseCsvList(raw, opts) {\n return (raw ?? \"\")\n .split(\",\")\n .map((entry) => (opts?.lowercase ? entry.trim().toLowerCase() : entry.trim()))\n .filter(Boolean);\n}\n/** A comma-separated env value as a Set — the canonical allowlist shape,\n * where an empty set is the \"allow all\" sentinel (`set.size === 0`). */\nexport function parseCsvSet(raw, opts) {\n return new Set(parseCsvList(raw, opts));\n}\n/** Normalise an unknown thrown value into a human-readable string. Isomorphic\n * (host, bridges, plugins, Vue) — this is the single home for the helper that\n * #2217 could only consolidate for server code, since `@mulmoclaude/core/utils`\n * is server-only.\n *\n * A non-Error object with a non-empty string `details` (gRPC convention) or\n * `message` field surfaces that field — `details` wins — instead of the\n * `[object Object]` a bare `String(err)` would print; an empty-string field\n * falls through. `fallback` covers the error-boundary idiom where a thrown\n * non-Error should read as a descriptive message rather than `String(err)`\n * noise; omit it in logging contexts where `String(err)` is fine. */\nexport function errorMessage(err, fallback) {\n if (err instanceof Error)\n return err.message;\n if (hasStringProp(err, \"details\") && err.details)\n return err.details;\n if (hasStringProp(err, \"message\") && err.message)\n return err.message;\n if (fallback !== undefined)\n return fallback;\n return String(err);\n}\n/** `Date` → `YYYY-MM-DD` in UTC — for dates that must not shift with the\n * host's local timezone (tool-trace search dirs, API date keys). Isomorphic\n * single source (#2480): the host re-exports it from `server/utils/date.ts`,\n * x-plugin imports it directly. The `@receptron/task-scheduler` copy stays\n * local on purpose — that leaf package is published independently and kept\n * dependency-free. Wall-clock questions use the host's `toLocalIsoDate`. */\nexport function toUtcIsoDate(timestamp) {\n const year = timestamp.getUTCFullYear();\n const month = String(timestamp.getUTCMonth() + 1).padStart(2, \"0\");\n const day = String(timestamp.getUTCDate()).padStart(2, \"0\");\n return `${year}-${month}-${day}`;\n}\n// A Map, not an object literal: `{}[char]` reads through the prototype chain,\n// so a future caller widening the regex would silently get `[object Object]`\n// for keys like `constructor`.\nconst HTML_ESCAPES = new Map([\n [\"&\", \"&amp;\"],\n [\"<\", \"&lt;\"],\n [\">\", \"&gt;\"],\n ['\"', \"&quot;\"],\n [\"'\", \"&#39;\"],\n]);\n/** HTML-escape text destined for markup or an attribute value — the fixed\n * five-character map, nothing more. Lives here rather than in\n * `@mulmoclaude/core/wiki` (#2483) because `@mulmoclaude/markdown-utils` is a\n * leaf that core depends on and so cannot import back up; core/wiki\n * re-exports this, keeping its consumers' import path unchanged.\n *\n * Escaping `&` first is what makes a single pass safe — the entities this\n * introduces contain none of the other four characters, so nothing is\n * double-escaped. Not a sanitiser: it neither strips tags nor validates URLs. */\nexport function escapeHtml(value) {\n return value.replace(/[&<>\"']/g, (char) => HTML_ESCAPES.get(char) ?? char);\n}\nexport { scanEnvOptions, snakeToLowerCamel } from \"./envScan.js\";\n"],"mappings":";;AAQA,SAAgB,SAAS,OAAO;CAC5B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC9E;;AA+BA,SAAgB,cAAc,OAAO,KAAK;CACtC,OAAO,SAAS,KAAK,KAAK,OAAO,MAAM,SAAS;AACpD;;;;;;;;;;;;AA8BA,SAAgB,aAAa,KAAK,UAAU;CACxC,IAAI,eAAe,OACf,OAAO,IAAI;CACf,IAAI,cAAc,KAAK,SAAS,KAAK,IAAI,SACrC,OAAO,IAAI;CACf,IAAI,cAAc,KAAK,SAAS,KAAK,IAAI,SACrC,OAAO,IAAI;CACf,IAAI,aAAa,KAAA,GACb,OAAO;CACX,OAAO,OAAO,GAAG;AACrB;AAgBA,IAAM,+BAAe,IAAI,IAAI;CACzB,CAAC,KAAK,OAAO;CACb,CAAC,KAAK,MAAM;CACZ,CAAC,KAAK,MAAM;CACZ,CAAC,MAAK,QAAQ;CACd,CAAC,KAAK,OAAO;AACjB,CAAC;;;;;;;;;;AAUD,SAAgB,WAAW,OAAO;CAC9B,OAAO,MAAM,QAAQ,aAAa,SAAS,aAAa,IAAI,IAAI,KAAK,IAAI;AAC7E"}
1
+ {"version":3,"file":"dist-DP1FTGnO.js","names":[],"sources":["../../common/dist/index.js"],"sourcesContent":["// General-purpose runtime type guards, shared across the MulmoClaude host,\n// bridges, and plugins. This is a leaf package — pure and dependency-free — so\n// any tier can import it without creating an uphill edge.\n//\n// These originated as `server/utils/types.ts` (#504), which centralised 40+\n// hand-written inline `typeof x === \"object\"` checks. They are promoted here so\n// the same guards stop being re-hand-written in every bridge and plugin too.\n/** Narrow `unknown` to a plain object (not null, not array). */\nexport function isRecord(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n/** Narrow `unknown` to any object (not null, arrays allowed).\n * Use `isRecord` when you need to access string keys. */\nexport function isObj(value) {\n return typeof value === \"object\" && value !== null;\n}\n/** Non-empty string after trimming whitespace. */\nexport function isNonEmptyString(value) {\n return typeof value === \"string\" && value.trim().length > 0;\n}\n/** Record whose values are all strings. */\nexport function isStringRecord(value) {\n if (!isRecord(value))\n return false;\n return Object.values(value).every((val) => typeof val === \"string\");\n}\n/** String array (every element is a string). */\nexport function isStringArray(value) {\n return Array.isArray(value) && value.every((val) => typeof val === \"string\");\n}\n/** An array of unknowns. Prefer this over a bare `Array.isArray` in typed code:\n * `Array.isArray(x: unknown)` narrows to `any[]`, silently reintroducing\n * `any`, whereas this keeps the element type `unknown`. */\nexport function isUnknownArray(value) {\n return Array.isArray(value);\n}\n/** Error-like object with a `code` property (e.g. Node.js fs errors). */\nexport function isErrorWithCode(value) {\n return isRecord(value) && typeof value.code === \"string\";\n}\n/** Check that a record has a specific key with a string value. */\nexport function hasStringProp(value, key) {\n return isRecord(value) && typeof value[key] === \"string\";\n}\n/** Check that a record has a specific key with a number value. */\nexport function hasNumberProp(value, key) {\n return isRecord(value) && typeof value[key] === \"number\";\n}\n/** Split a comma-separated env value into trimmed, non-empty entries.\n * `lowercase` folds case for identifiers compared case-insensitively\n * (JIDs, email addresses, hex pubkeys). Absent/empty input → empty list. */\nexport function parseCsvList(raw, opts) {\n return (raw ?? \"\")\n .split(\",\")\n .map((entry) => (opts?.lowercase ? entry.trim().toLowerCase() : entry.trim()))\n .filter(Boolean);\n}\n/** A comma-separated env value as a Set — the canonical allowlist shape,\n * where an empty set is the \"allow all\" sentinel (`set.size === 0`). */\nexport function parseCsvSet(raw, opts) {\n return new Set(parseCsvList(raw, opts));\n}\n/** Normalise an unknown thrown value into a human-readable string. Isomorphic\n * (host, bridges, plugins, Vue) — this is the single home for the helper that\n * #2217 could only consolidate for server code, since `@mulmoclaude/core/utils`\n * is server-only.\n *\n * A non-Error object with a non-empty string `details` (gRPC convention) or\n * `message` field surfaces that field — `details` wins — instead of the\n * `[object Object]` a bare `String(err)` would print; an empty-string field\n * falls through. `fallback` covers the error-boundary idiom where a thrown\n * non-Error should read as a descriptive message rather than `String(err)`\n * noise; omit it in logging contexts where `String(err)` is fine. */\nexport function errorMessage(err, fallback) {\n if (err instanceof Error)\n return err.message;\n if (hasStringProp(err, \"details\") && err.details)\n return err.details;\n if (hasStringProp(err, \"message\") && err.message)\n return err.message;\n if (fallback !== undefined)\n return fallback;\n return String(err);\n}\n/** `Date` → `YYYY-MM-DD` in UTC — for dates that must not shift with the\n * host's local timezone (tool-trace search dirs, API date keys). Isomorphic\n * single source (#2480): the host re-exports it from `server/utils/date.ts`,\n * x-plugin imports it directly. The `@receptron/task-scheduler` copy stays\n * local on purpose — that leaf package is published independently and kept\n * dependency-free. Wall-clock questions use the host's `toLocalIsoDate`. */\nexport function toUtcIsoDate(timestamp) {\n const year = timestamp.getUTCFullYear();\n const month = String(timestamp.getUTCMonth() + 1).padStart(2, \"0\");\n const day = String(timestamp.getUTCDate()).padStart(2, \"0\");\n return `${year}-${month}-${day}`;\n}\n// A Map, not an object literal: `{}[char]` reads through the prototype chain,\n// so a future caller widening the regex would silently get `[object Object]`\n// for keys like `constructor`.\nconst HTML_ESCAPES = new Map([\n [\"&\", \"&amp;\"],\n [\"<\", \"&lt;\"],\n [\">\", \"&gt;\"],\n ['\"', \"&quot;\"],\n [\"'\", \"&#39;\"],\n]);\n/** HTML-escape text destined for markup or an attribute value — the fixed\n * five-character map, nothing more. Lives here rather than in\n * `@mulmoclaude/core/wiki` (#2483) because `@mulmoclaude/markdown-utils` is a\n * leaf that core depends on and so cannot import back up; core/wiki\n * re-exports this, keeping its consumers' import path unchanged.\n *\n * Escaping `&` first is what makes a single pass safe — the entities this\n * introduces contain none of the other four characters, so nothing is\n * double-escaped. Not a sanitiser: it neither strips tags nor validates URLs. */\nexport function escapeHtml(value) {\n return value.replace(/[&<>\"']/g, (char) => HTML_ESCAPES.get(char) ?? char);\n}\nexport { scanEnvOptions, snakeToLowerCamel } from \"./envScan.js\";\n"],"mappings":";;AAQA,SAAgB,SAAS,OAAO;CAC5B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC9E;;;;AAuBA,SAAgB,eAAe,OAAO;CAClC,OAAO,MAAM,QAAQ,KAAK;AAC9B;;AAEA,SAAgB,gBAAgB,OAAO;CACnC,OAAO,SAAS,KAAK,KAAK,OAAO,MAAM,SAAS;AACpD;;AAEA,SAAgB,cAAc,OAAO,KAAK;CACtC,OAAO,SAAS,KAAK,KAAK,OAAO,MAAM,SAAS;AACpD;;AAEA,SAAgB,cAAc,OAAO,KAAK;CACtC,OAAO,SAAS,KAAK,KAAK,OAAO,MAAM,SAAS;AACpD;;;;;;;;;;;;AA0BA,SAAgB,aAAa,KAAK,UAAU;CACxC,IAAI,eAAe,OACf,OAAO,IAAI;CACf,IAAI,cAAc,KAAK,SAAS,KAAK,IAAI,SACrC,OAAO,IAAI;CACf,IAAI,cAAc,KAAK,SAAS,KAAK,IAAI,SACrC,OAAO,IAAI;CACf,IAAI,aAAa,KAAA,GACb,OAAO;CACX,OAAO,OAAO,GAAG;AACrB;AAgBA,IAAM,+BAAe,IAAI,IAAI;CACzB,CAAC,KAAK,OAAO;CACb,CAAC,KAAK,MAAM;CACZ,CAAC,KAAK,MAAM;CACZ,CAAC,MAAK,QAAQ;CACd,CAAC,KAAK,OAAO;AACjB,CAAC;;;;;;;;;;AAUD,SAAgB,WAAW,OAAO;CAC9B,OAAO,MAAM,QAAQ,aAAa,SAAS,aAAa,IAAI,IAAI,KAAK,IAAI;AAC7E"}
@@ -1,6 +1,33 @@
1
1
  import { LoadedCollection } from '../../collection/server/index.js';
2
+ import { CollectionItem } from '../../collection/index.js';
3
+ import { IngestSpec } from '../ingestTypes.js';
2
4
  import { RefreshResult } from './refreshResult.js';
3
5
  export type { RefreshResult } from './refreshResult.js';
6
+ /** Fields the feed itself produces: what it actually returned this run, the
7
+ * declared map's targets, and the primary key the retriever derives. Anything
8
+ * else on a record got there some other way — the user.
9
+ *
10
+ * Both sources, because neither alone is enough. The in-tree retrievers project
11
+ * through `map`, so it describes them exactly — but `registerRetriever` lets a
12
+ * host add one that returns whatever it likes, and only the observed keys catch
13
+ * that. Conversely a run that fetched nothing has no keys to observe, and only
14
+ * `map` keeps the cap working through it. */
15
+ export declare const ingestedFields: (items: readonly CollectionItem[], mappedTargets: readonly string[], primaryKey: string) => ReadonlySet<string>;
16
+ /** The collection fields a declarative `map` names. Read as `unknown` and
17
+ * narrowed here rather than through the zod-derived union, whose `map` does not
18
+ * survive the `kind` narrowing well enough to index safely. Only the keys are
19
+ * wanted, so the value type never has to be reconstructed. */
20
+ export declare function mappedTargetsOf(ingest: IngestSpec | undefined): string[];
21
+ /** Whether a record carries content the feed did not put there.
22
+ *
23
+ * Only a NON-EMPTY value counts. A record saved through the UI can carry every
24
+ * declared field as an empty string, and treating those as local content would
25
+ * make every touched record un-prunable — the cap would quietly stop working.
26
+ *
27
+ * An edit to a MAPPED field deliberately does not count: a feed is
28
+ * one-directional, so the next refresh writes over it by design. The local
29
+ * COLUMN is the durable half, and the half worth protecting. */
30
+ export declare function hasLocalContent(item: CollectionItem, ingested: ReadonlySet<string>): boolean;
4
31
  /** Fetch one feed now, upsert its records, then enforce the maxItems cap.
5
32
  * Failure-isolated: returns an errors array rather than throwing. */
6
33
  export declare function refreshOne(workspaceRoot: string, feed: LoadedCollection, opts?: {
@@ -1,11 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("../../rolldown-runtime-D6vf50IK.cjs");
3
3
  const require_calendarGrid = require("../../calendarGrid-CaS9er8i.cjs");
4
- const require_discovery = require("../../discovery-NRy3tyUA.cjs");
5
- const require_server = require("../../server-7U-3DE2e.cjs");
4
+ const require_project = require("../../project-CCtT_fQr.cjs");
5
+ const require_discovery = require("../../discovery-DAoMnBYM.cjs");
6
+ const require_server = require("../../server-B_b0bLSW.cjs");
6
7
  const require_feeds_paths = require("../paths.cjs");
7
8
  const require_ingestTypes = require("../../ingestTypes-D1GQdG8e.cjs");
8
- const require_notifier = require("../../notifier-tMsAXyXp.cjs");
9
+ const require_notifier = require("../../notifier-C3IhYxqh.cjs");
9
10
  let node_path = require("node:path");
10
11
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
11
12
  let node_crypto = require("node:crypto");
@@ -702,6 +703,60 @@ function writableFeedStore(workspaceRoot, feed) {
702
703
  delete: remove
703
704
  };
704
705
  }
706
+ /** Fields the feed itself produces: what it actually returned this run, the
707
+ * declared map's targets, and the primary key the retriever derives. Anything
708
+ * else on a record got there some other way — the user.
709
+ *
710
+ * Both sources, because neither alone is enough. The in-tree retrievers project
711
+ * through `map`, so it describes them exactly — but `registerRetriever` lets a
712
+ * host add one that returns whatever it likes, and only the observed keys catch
713
+ * that. Conversely a run that fetched nothing has no keys to observe, and only
714
+ * `map` keeps the cap working through it. */
715
+ var ingestedFields = (items, mappedTargets, primaryKey) => /* @__PURE__ */ new Set([
716
+ primaryKey,
717
+ ...mappedTargets,
718
+ ...items.flatMap((item) => Object.keys(item))
719
+ ]);
720
+ /** The collection fields a declarative `map` names. Read as `unknown` and
721
+ * narrowed here rather than through the zod-derived union, whose `map` does not
722
+ * survive the `kind` narrowing well enough to index safely. Only the keys are
723
+ * wanted, so the value type never has to be reconstructed. */
724
+ function mappedTargetsOf(ingest) {
725
+ const map = ingest === void 0 || ingest.kind === "agent" ? void 0 : ingest.map;
726
+ return typeof map === "object" && map !== null ? Object.keys(map) : [];
727
+ }
728
+ /** Whether a record carries content the feed did not put there.
729
+ *
730
+ * Only a NON-EMPTY value counts. A record saved through the UI can carry every
731
+ * declared field as an empty string, and treating those as local content would
732
+ * make every touched record un-prunable — the cap would quietly stop working.
733
+ *
734
+ * An edit to a MAPPED field deliberately does not count: a feed is
735
+ * one-directional, so the next refresh writes over it by design. The local
736
+ * COLUMN is the durable half, and the half worth protecting. */
737
+ function hasLocalContent(item, ingested) {
738
+ return Object.entries(item).some(([field, value]) => !ingested.has(field) && value !== void 0 && value !== null && value !== "");
739
+ }
740
+ /** The stored record, or null when it cannot be read.
741
+ *
742
+ * `readItem` answers null for a MISSING record but THROWS on unparsable JSON
743
+ * or an IO error. Letting that escape would fail the whole refresh over one bad
744
+ * file — and write nothing at all, since the loop aborts partway. Before the
745
+ * merge landed, the ingest simply overwrote such a file and the feed healed
746
+ * itself; treating "unreadable" as "absent" keeps that. (Observed during Claude
747
+ * review; both review bots were rate-limited on this PR.) */
748
+ async function readableRecord(store, feed, itemId) {
749
+ try {
750
+ return await store.read(itemId);
751
+ } catch (error) {
752
+ log.warn("feeds", "unreadable feed record — the retrieved item will replace it", {
753
+ slug: feed.slug,
754
+ itemId,
755
+ error: String(error)
756
+ });
757
+ return null;
758
+ }
759
+ }
705
760
  async function upsertItems(workspaceRoot, feed, items) {
706
761
  const store = writableFeedStore(workspaceRoot, feed);
707
762
  if (!store) return 0;
@@ -709,7 +764,7 @@ async function upsertItems(workspaceRoot, feed, items) {
709
764
  for (const item of items) {
710
765
  const itemId = item[feed.schema.primaryKey];
711
766
  if (typeof itemId !== "string" || itemId.length === 0) continue;
712
- const result = await store.write(itemId, item);
767
+ const result = await store.write(itemId, require_project.mergeIntoExisting(await readableRecord(store, feed, itemId), item));
713
768
  if (result.kind === "ok") written += 1;
714
769
  else log.warn("feeds", "feed item write skipped", {
715
770
  slug: feed.slug,
@@ -733,7 +788,7 @@ function recordTime(item, field) {
733
788
  /** Enforce `ingest.maxItems` (default 100): keep the newest N records by
734
789
  * the schema's date field, delete the rest. No-op when the cap is 0/absent
735
790
  * of a date field, or when under the cap. Returns the number deleted. */
736
- async function pruneFeed(workspaceRoot, feed) {
791
+ async function pruneFeed(workspaceRoot, feed, fetched) {
737
792
  const ingest = feedIngest(feed.schema);
738
793
  const cap = (ingest && ingest.kind !== "agent" ? ingest.maxItems : void 0) ?? 100;
739
794
  if (cap <= 0) return 0;
@@ -746,7 +801,15 @@ async function pruneFeed(workspaceRoot, feed) {
746
801
  if (!store) return 0;
747
802
  const items = await store.list();
748
803
  if (items.length <= cap) return 0;
749
- const stale = [...items].sort((left, right) => recordTime(right, dateField) - recordTime(left, dateField)).slice(cap);
804
+ const ingested = ingestedFields(fetched, mappedTargetsOf(ingest), feed.schema.primaryKey);
805
+ const aged = [...items].sort((left, right) => recordTime(right, dateField) - recordTime(left, dateField)).slice(cap);
806
+ const stale = aged.filter((item) => !hasLocalContent(item, ingested));
807
+ const kept = aged.length - stale.length;
808
+ if (kept > 0) log.info("feeds", "keeping aged-out records that carry local content", {
809
+ slug: feed.slug,
810
+ kept,
811
+ cap
812
+ });
750
813
  let removed = 0;
751
814
  for (const item of stale) {
752
815
  const itemId = item[feed.schema.primaryKey];
@@ -789,7 +852,7 @@ async function refreshOne(workspaceRoot, feed, opts) {
789
852
  cursor: result.cursor,
790
853
  consecutiveFailures: 0
791
854
  });
792
- const removed = await pruneFeed(workspaceRoot, feed);
855
+ const removed = await pruneFeed(workspaceRoot, feed, result.items);
793
856
  log.info("feeds", "feed refreshed", {
794
857
  slug,
795
858
  written,
@@ -919,8 +982,10 @@ exports.feedDir = require_feeds_paths.feedDir;
919
982
  exports.feedRefreshTaskDef = feedRefreshTaskDef;
920
983
  exports.feedStatePath = require_feeds_paths.feedStatePath;
921
984
  exports.feedsRoot = require_feeds_paths.feedsRoot;
985
+ exports.hasLocalContent = hasLocalContent;
922
986
  exports.ingestStateDir = require_feeds_paths.ingestStateDir;
923
987
  exports.ingestStatePath = require_feeds_paths.ingestStatePath;
988
+ exports.ingestedFields = ingestedFields;
924
989
  exports.isFeedSchedule = require_ingestTypes.isFeedSchedule;
925
990
  exports.listFeeds = listFeeds;
926
991
  exports.readFeedState = readFeedState;