@mulmoclaude/core 5.12.1 → 5.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.
- package/assets/helps/presenthtml.md +18 -0
- package/dist/artifacts/paths.cjs +1 -2
- package/dist/artifacts/paths.js +1 -2
- package/dist/collection/firestore.cjs +1 -2
- package/dist/collection/firestore.js +1 -2
- package/dist/collection/index.cjs +18 -30
- package/dist/collection/index.cjs.map +1 -1
- package/dist/collection/index.js +18 -30
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/paths.cjs +1 -1
- package/dist/collection/paths.js +1 -1
- package/dist/collection/registry/index.cjs +1 -1
- package/dist/collection/registry/index.js +1 -1
- package/dist/collection/registry/server/index.cjs +17 -26
- package/dist/collection/registry/server/index.cjs.map +1 -1
- package/dist/collection/registry/server/index.js +16 -25
- package/dist/collection/registry/server/index.js.map +1 -1
- package/dist/collection/server/index.cjs +5 -5
- package/dist/collection/server/index.js +5 -5
- package/dist/collection-watchers/index.cjs +10 -14
- package/dist/collection-watchers/index.cjs.map +1 -1
- package/dist/collection-watchers/index.js +10 -14
- package/dist/collection-watchers/index.js.map +1 -1
- package/dist/{discovery-DgZRmO7F.cjs → discovery-CYIV1J5l.cjs} +25 -42
- package/dist/{discovery-DgZRmO7F.cjs.map → discovery-CYIV1J5l.cjs.map} +1 -1
- package/dist/{discovery-CbwHtcwk.js → discovery-duLlygnJ.js} +24 -41
- package/dist/{discovery-CbwHtcwk.js.map → discovery-duLlygnJ.js.map} +1 -1
- package/dist/{dist-BZ62pKuU.cjs → dist-734JaRYi.cjs} +2 -4
- package/dist/{dist-BZ62pKuU.cjs.map → dist-734JaRYi.cjs.map} +1 -1
- package/dist/{dist-MFUV9FYo.js → dist-BmO4oSQy.js} +2 -4
- package/dist/{dist-MFUV9FYo.js.map → dist-BmO4oSQy.js.map} +1 -1
- package/dist/errorMessage-D0kR547_.cjs +1 -0
- package/dist/errorMessage-TpKxrmeo.js +1 -0
- package/dist/{errors-zTAsW7dS.js → errors-0QwjDxsv.js} +3 -4
- package/dist/{errors-zTAsW7dS.js.map → errors-0QwjDxsv.js.map} +1 -1
- package/dist/{errors-B0xloJ3E.cjs → errors-B9mCEVG9.cjs} +3 -4
- package/dist/{errors-B0xloJ3E.cjs.map → errors-B9mCEVG9.cjs.map} +1 -1
- package/dist/feeds/index.cjs +2 -2
- package/dist/feeds/index.js +2 -2
- package/dist/feeds/paths.cjs +2 -3
- package/dist/feeds/paths.js +1 -2
- package/dist/feeds/server/index.cjs +23 -37
- package/dist/feeds/server/index.cjs.map +1 -1
- package/dist/feeds/server/index.js +22 -36
- package/dist/feeds/server/index.js.map +1 -1
- package/dist/file-change/index.cjs +2 -3
- package/dist/file-change/index.js +1 -2
- package/dist/files/index.cjs +136 -11
- package/dist/files/index.cjs.map +1 -1
- package/dist/files/index.d.ts +1 -0
- package/dist/files/index.js +132 -12
- package/dist/files/index.js.map +1 -1
- package/dist/files/verified.d.ts +28 -0
- package/dist/global-config/index.cjs +3 -5
- package/dist/global-config/index.cjs.map +1 -1
- package/dist/global-config/index.js +3 -5
- package/dist/global-config/index.js.map +1 -1
- package/dist/google/index.cjs +38 -67
- package/dist/google/index.cjs.map +1 -1
- package/dist/google/index.js +37 -66
- package/dist/google/index.js.map +1 -1
- package/dist/{graph-CURotEkH.cjs → graph-BvVMZfDV.cjs} +6 -11
- package/dist/{graph-CURotEkH.cjs.map → graph-BvVMZfDV.cjs.map} +1 -1
- package/dist/{graph-DBxSOx3v.js → graph-DBbzemby.js} +6 -11
- package/dist/{graph-DBxSOx3v.js.map → graph-DBbzemby.js.map} +1 -1
- package/dist/{iconGlyph-fSBp6k4J.cjs → iconGlyph-CFOiFsmq.cjs} +2 -3
- package/dist/{iconGlyph-fSBp6k4J.cjs.map → iconGlyph-CFOiFsmq.cjs.map} +1 -1
- package/dist/{iconGlyph-D8JeNg7R.js → iconGlyph-D9h__VaM.js} +2 -3
- package/dist/{iconGlyph-D8JeNg7R.js.map → iconGlyph-D9h__VaM.js.map} +1 -1
- package/dist/{ingestTypes-DS9HiR2I.cjs → ingestTypes-CLDvn7kw.cjs} +3 -4
- package/dist/{ingestTypes-DS9HiR2I.cjs.map → ingestTypes-CLDvn7kw.cjs.map} +1 -1
- package/dist/{ingestTypes-Bs31Xt5c.js → ingestTypes-DuXuSBSn.js} +3 -4
- package/dist/{ingestTypes-Bs31Xt5c.js.map → ingestTypes-DuXuSBSn.js.map} +1 -1
- package/dist/{itemId-CVrNibwT.cjs → itemId-D2XAQ8RU.cjs} +9 -17
- package/dist/{itemId-CVrNibwT.cjs.map → itemId-D2XAQ8RU.cjs.map} +1 -1
- package/dist/{itemId-C9s-Jd5s.js → itemId-D_pSpa3U.js} +9 -17
- package/dist/{itemId-C9s-Jd5s.js.map → itemId-D_pSpa3U.js.map} +1 -1
- package/dist/{listen-N_8XdKz_.cjs → listen-OmfLDX1l.cjs} +3 -4
- package/dist/{listen-N_8XdKz_.cjs.map → listen-OmfLDX1l.cjs.map} +1 -1
- package/dist/{listen-DUlzSOzX.js → listen-uiEnXcW9.js} +3 -4
- package/dist/{listen-DUlzSOzX.js.map → listen-uiEnXcW9.js.map} +1 -1
- package/dist/notifier/index.cjs +1 -1
- package/dist/notifier/index.js +1 -1
- package/dist/{notifier-CiemUClt.cjs → notifier-CRTk34EC.cjs} +6 -10
- package/dist/{notifier-CiemUClt.cjs.map → notifier-CRTk34EC.cjs.map} +1 -1
- package/dist/{notifier-dgkC-h80.js → notifier-htdf4ekH.js} +6 -10
- package/dist/{notifier-dgkC-h80.js.map → notifier-htdf4ekH.js.map} +1 -1
- package/dist/{paths-CkJxNZ7T.js → paths-BMQNHdaJ.js} +2 -3
- package/dist/{paths-CkJxNZ7T.js.map → paths-BMQNHdaJ.js.map} +1 -1
- package/dist/{paths-C8-jxR0s.cjs → paths-DUHAueEv.cjs} +2 -3
- package/dist/{paths-C8-jxR0s.cjs.map → paths-DUHAueEv.cjs.map} +1 -1
- package/dist/plugin-vue/i18n.cjs +1 -2
- package/dist/plugin-vue/i18n.js +1 -2
- package/dist/plugin-vue/index.cjs +9 -17
- package/dist/plugin-vue/index.cjs.map +1 -1
- package/dist/plugin-vue/index.js +9 -17
- package/dist/plugin-vue/index.js.map +1 -1
- package/dist/{project-C1ep9pvo.cjs → project-DDTIVEMU.cjs} +2 -3
- package/dist/{project-C1ep9pvo.cjs.map → project-DDTIVEMU.cjs.map} +1 -1
- package/dist/{project-B0j_Vf_Q.js → project-mU6-xLfy.js} +2 -3
- package/dist/{project-B0j_Vf_Q.js.map → project-mU6-xLfy.js.map} +1 -1
- package/dist/prompt-files/index.cjs +4 -6
- package/dist/prompt-files/index.cjs.map +1 -1
- package/dist/prompt-files/index.js +3 -5
- package/dist/prompt-files/index.js.map +1 -1
- package/dist/{promptSafety-DFaOnOWN.js → promptSafety-B8LECAkY.js} +14 -25
- package/dist/{promptSafety-DFaOnOWN.js.map → promptSafety-B8LECAkY.js.map} +1 -1
- package/dist/{promptSafety-yET9jLep.cjs → promptSafety-CjxafW2b.cjs} +14 -25
- package/dist/{promptSafety-yET9jLep.cjs.map → promptSafety-CjxafW2b.cjs.map} +1 -1
- package/dist/{relPath-DW8MC8VO.js → relPath-BkKmqiiF.js} +2 -3
- package/dist/{relPath-DW8MC8VO.js.map → relPath-BkKmqiiF.js.map} +1 -1
- package/dist/{relPath-CTAjGdCL.cjs → relPath-CZiP2S_a.cjs} +3 -4
- package/dist/{relPath-CTAjGdCL.cjs.map → relPath-CZiP2S_a.cjs.map} +1 -1
- package/dist/remote-host/index.cjs +1 -1
- package/dist/remote-host/index.js +1 -1
- package/dist/remote-host/server/index.cjs +14 -25
- package/dist/remote-host/server/index.cjs.map +1 -1
- package/dist/remote-host/server/index.js +14 -25
- package/dist/remote-host/server/index.js.map +1 -1
- package/dist/{remote-host-CR5W9uj4.cjs → remote-host-BW_eH-Nu.cjs} +4 -6
- package/dist/{remote-host-CR5W9uj4.cjs.map → remote-host-BW_eH-Nu.cjs.map} +1 -1
- package/dist/{remote-host-9NNAvUhU.js → remote-host-CSeDNbE6.js} +4 -6
- package/dist/{remote-host-9NNAvUhU.js.map → remote-host-CSeDNbE6.js.map} +1 -1
- package/dist/remote-view/index.cjs +3 -4
- package/dist/remote-view/index.js +3 -4
- package/dist/{rolldown-runtime-VH7oDXx4.cjs → rolldown-runtime-CmQyd0Gu.cjs} +1 -2
- package/dist/{root-BvwBUcol.cjs → root-9lRFeXbm.cjs} +10 -6
- package/dist/{root-BvwBUcol.cjs.map → root-9lRFeXbm.cjs.map} +1 -1
- package/dist/{root-BcS4-Kge.js → root-CqxPNSyK.js} +4 -6
- package/dist/{root-BcS4-Kge.js.map → root-CqxPNSyK.js.map} +1 -1
- package/dist/scheduler/index.cjs +6 -9
- package/dist/scheduler/index.cjs.map +1 -1
- package/dist/scheduler/index.js +5 -8
- package/dist/scheduler/index.js.map +1 -1
- package/dist/{server-CJek9Y3Q.cjs → server-ByKWGQn2.cjs} +25 -41
- package/dist/{server-CJek9Y3Q.cjs.map → server-ByKWGQn2.cjs.map} +1 -1
- package/dist/{server-BtbbQqBY.js → server-CA-alqqN.js} +24 -40
- package/dist/{server-BtbbQqBY.js.map → server-CA-alqqN.js.map} +1 -1
- package/dist/skill-bridge/index.cjs +3 -4
- package/dist/skill-bridge/index.js +2 -3
- package/dist/{slug-BpjumQfe.js → slug-D24AYqCZ.js} +2 -3
- package/dist/{slug-BpjumQfe.js.map → slug-D24AYqCZ.js.map} +1 -1
- package/dist/{slug-JxgB0ru9.cjs → slug-DVkuPjIv.cjs} +2 -3
- package/dist/{slug-JxgB0ru9.cjs.map → slug-DVkuPjIv.cjs.map} +1 -1
- package/dist/{templatePath-27vUZowm.cjs → templatePath-BIh7wqgS.cjs} +2 -3
- package/dist/{templatePath-27vUZowm.cjs.map → templatePath-BIh7wqgS.cjs.map} +1 -1
- package/dist/{templatePath-k_WNbL_Q.js → templatePath-CB3wtVpe.js} +2 -3
- package/dist/{templatePath-k_WNbL_Q.js.map → templatePath-CB3wtVpe.js.map} +1 -1
- package/dist/{text-CjDbP2O1.js → text-BQAuwKVj.js} +2 -3
- package/dist/{text-CjDbP2O1.js.map → text-BQAuwKVj.js.map} +1 -1
- package/dist/{text-CaAh9ZSO.cjs → text-BQiyo5R9.cjs} +2 -3
- package/dist/{text-CaAh9ZSO.cjs.map → text-BQiyo5R9.cjs.map} +1 -1
- package/dist/translation/client.cjs +1 -2
- package/dist/translation/client.js +1 -2
- package/dist/{types-BKVZrtyc.js → types-BLCZTGW2.js} +4 -7
- package/dist/{types-BKVZrtyc.js.map → types-BLCZTGW2.js.map} +1 -1
- package/dist/{types-CNqkLT4M.cjs → types-DPycxnDf.cjs} +4 -7
- package/dist/{types-CNqkLT4M.cjs.map → types-DPycxnDf.cjs.map} +1 -1
- package/dist/utils/fetch.cjs +0 -1
- package/dist/utils/fetch.js +0 -1
- package/dist/utils/index.cjs +3 -3
- package/dist/utils/index.js +3 -3
- package/dist/whisper/client.cjs +2 -4
- package/dist/whisper/client.cjs.map +1 -1
- package/dist/whisper/client.js +2 -4
- package/dist/whisper/client.js.map +1 -1
- package/dist/whisper/index.cjs +9 -15
- package/dist/whisper/index.cjs.map +1 -1
- package/dist/whisper/index.js +8 -14
- package/dist/whisper/index.js.map +1 -1
- package/dist/wiki/index.cjs +5 -7
- package/dist/wiki/index.cjs.map +1 -1
- package/dist/wiki/index.js +5 -7
- package/dist/wiki/index.js.map +1 -1
- package/dist/wiki/paths.cjs +3 -4
- package/dist/wiki/paths.js +2 -3
- package/dist/wiki/server/index.cjs +7 -11
- package/dist/wiki/server/index.cjs.map +1 -1
- package/dist/wiki/server/index.js +6 -10
- package/dist/wiki/server/index.js.map +1 -1
- package/dist/workspace-setup/index.js +4 -9
- package/dist/workspace-setup/index.js.map +1 -1
- package/dist/workspace-setup/slug.js +1 -2
- package/package.json +2 -2
- package/dist/errorMessage-OEQzRwsi.cjs +0 -1
- package/dist/errorMessage-VEiXHRnX.js +0 -1
|
@@ -2,8 +2,7 @@ Object.freeze({
|
|
|
2
2
|
min: 0,
|
|
3
3
|
max: 65535
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
//#region ../common/dist/index.js
|
|
5
|
+
// ../common/dist/index.js
|
|
7
6
|
/** Narrow `unknown` to a plain object (not null, not array). */
|
|
8
7
|
function isRecord(value) {
|
|
9
8
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -76,7 +75,6 @@ var HTML_ESCAPES = /* @__PURE__ */ new Map([
|
|
|
76
75
|
function escapeHtml(value) {
|
|
77
76
|
return value.replace(/[&<>"']/g, (char) => HTML_ESCAPES.get(char) ?? char);
|
|
78
77
|
}
|
|
79
|
-
//#endregion
|
|
80
78
|
Object.defineProperty(exports, "errorMessage", {
|
|
81
79
|
enumerable: true,
|
|
82
80
|
get: function() {
|
|
@@ -138,4 +136,4 @@ Object.defineProperty(exports, "isUnknownArray", {
|
|
|
138
136
|
}
|
|
139
137
|
});
|
|
140
138
|
|
|
141
|
-
//# sourceMappingURL=dist-
|
|
139
|
+
//# sourceMappingURL=dist-734JaRYi.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dist-BZ62pKuU.cjs","names":[],"sources":["../../common/dist/envCoerce.js","../../common/dist/index.js"],"sourcesContent":["// Env-var type coercion for ports and other integer settings.\n//\n// It started inside `server/system/env.ts` (#504-era), moved to\n// `server/utils/envCoerce.ts` when #2650 needed the SAME rule for `yarn dev`'s\n// Vite proxy — the proxy has to resolve `PORT` exactly as the backend does, or\n// the two point at different servers — and moved here when #3084 needed it for\n// the messaging bridges too. A second opinion about \"is this a port\" is that\n// bug one level down, so there is exactly one copy and every tier imports it.\n/**\n * `Number()`-based integer coercion with an optional range, falling back when the\n * value is absent, empty, non-integer, or out of range.\n *\n * `Number()` — not `parseInt` — on purpose: it is what the server has always used,\n * so `0x1f`, `1e3`, `+3100` and `3100.0` coerce exactly as they did, and a\n * whitespace-only value coerces to 0. Anything stricter here would silently\n * disagree with the backend.\n */\nexport function asInt(value, fallback, opts = {}) {\n if (value === undefined || value === \"\")\n return fallback;\n const parsed = Number(value);\n if (!Number.isInteger(parsed))\n return fallback;\n if (opts.min !== undefined && parsed < opts.min)\n return fallback;\n if (opts.max !== undefined && parsed > opts.max)\n return fallback;\n return parsed;\n}\n/** The port range the backend accepts, so both sides bound the value identically.\n * `min: 0` is deliberate — 0 asks the OS for an ephemeral port.\n *\n * `Required<IntRange>`, not `IntRange`: both bounds are always present here, and\n * saying so lets a caller compare against them (`port <= PORT_RANGE.max`) without\n * a non-null assertion. Still assignable wherever an `IntRange` is expected. */\nexport const PORT_RANGE = Object.freeze({ min: 0, max: 65_535 });\n","// 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/** Absent, or a string — an optional string field. */\nexport function isOptionalString(value) {\n return value === undefined || typeof value === \"string\";\n}\n/** Absent, or a boolean — an optional boolean field. */\nexport function isOptionalBoolean(value) {\n return value === undefined || typeof value === \"boolean\";\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 [\"&\", \"&\"],\n [\"<\", \"<\"],\n [\">\", \">\"],\n ['\"', \""\"],\n [\"'\", \"'\"],\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}\n/** Split a JWS compact serialization into its three segments, or `null` when the\n * token isn't well-formed. Pure string work, so the Node bridges and the\n * Cloudflare Workers relay — which decode the segments differently (`Buffer` vs\n * `atob`) — can still share this one guard.\n *\n * A JWS compact serialization is EXACTLY three segments. Both a short token and\n * a longer one (a five-segment JWE, or an attacker appending `.junk`) are\n * rejected outright — never parsed from their first three segments, which would\n * let the signed input disagree with the token. */\nexport function splitJwtSegments(token) {\n const [headerSegment, payloadSegment, signatureSegment, ...extraSegments] = token.split(\".\");\n if (headerSegment === undefined || payloadSegment === undefined || signatureSegment === undefined)\n return null;\n if (extraSegments.length > 0)\n return null;\n return { headerSegment, payloadSegment, signatureSegment };\n}\nexport { scanEnvOptions, snakeToLowerCamel } from \"./envScan.js\";\nexport { asInt, PORT_RANGE } from \"./envCoerce.js\";\n"],"mappings":"AAmC0B,OAAO,OAAO;CAAE,KAAK;CAAG,KAAK;AAAO,CAAC;;;;AC3B/D,SAAgB,SAAS,OAAO;CAC5B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC9E;;;AAGA,SAAgB,MAAM,OAAO;CACzB,OAAO,OAAO,UAAU,YAAY,UAAU;AAClD;;AAYA,SAAgB,cAAc,OAAO;CACjC,OAAO,MAAM,QAAQ,KAAK,KAAK,MAAM,OAAO,QAAQ,OAAO,QAAQ,QAAQ;AAC/E;;AAEA,SAAgB,iBAAiB,OAAO;CACpC,OAAO,UAAU,KAAA,KAAa,OAAO,UAAU;AACnD;;;;AAQA,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
|
+
{"version":3,"file":"dist-734JaRYi.cjs","names":[],"sources":["../../common/dist/envCoerce.js","../../common/dist/index.js"],"sourcesContent":["// Env-var type coercion for ports and other integer settings.\n//\n// It started inside `server/system/env.ts` (#504-era), moved to\n// `server/utils/envCoerce.ts` when #2650 needed the SAME rule for `yarn dev`'s\n// Vite proxy — the proxy has to resolve `PORT` exactly as the backend does, or\n// the two point at different servers — and moved here when #3084 needed it for\n// the messaging bridges too. A second opinion about \"is this a port\" is that\n// bug one level down, so there is exactly one copy and every tier imports it.\n/**\n * `Number()`-based integer coercion with an optional range, falling back when the\n * value is absent, empty, non-integer, or out of range.\n *\n * `Number()` — not `parseInt` — on purpose: it is what the server has always used,\n * so `0x1f`, `1e3`, `+3100` and `3100.0` coerce exactly as they did, and a\n * whitespace-only value coerces to 0. Anything stricter here would silently\n * disagree with the backend.\n */\nexport function asInt(value, fallback, opts = {}) {\n if (value === undefined || value === \"\")\n return fallback;\n const parsed = Number(value);\n if (!Number.isInteger(parsed))\n return fallback;\n if (opts.min !== undefined && parsed < opts.min)\n return fallback;\n if (opts.max !== undefined && parsed > opts.max)\n return fallback;\n return parsed;\n}\n/** The port range the backend accepts, so both sides bound the value identically.\n * `min: 0` is deliberate — 0 asks the OS for an ephemeral port.\n *\n * `Required<IntRange>`, not `IntRange`: both bounds are always present here, and\n * saying so lets a caller compare against them (`port <= PORT_RANGE.max`) without\n * a non-null assertion. Still assignable wherever an `IntRange` is expected. */\nexport const PORT_RANGE = Object.freeze({ min: 0, max: 65_535 });\n","// 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/** Absent, or a string — an optional string field. */\nexport function isOptionalString(value) {\n return value === undefined || typeof value === \"string\";\n}\n/** Absent, or a boolean — an optional boolean field. */\nexport function isOptionalBoolean(value) {\n return value === undefined || typeof value === \"boolean\";\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 [\"&\", \"&\"],\n [\"<\", \"<\"],\n [\">\", \">\"],\n ['\"', \""\"],\n [\"'\", \"'\"],\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}\n/** Split a JWS compact serialization into its three segments, or `null` when the\n * token isn't well-formed. Pure string work, so the Node bridges and the\n * Cloudflare Workers relay — which decode the segments differently (`Buffer` vs\n * `atob`) — can still share this one guard.\n *\n * A JWS compact serialization is EXACTLY three segments. Both a short token and\n * a longer one (a five-segment JWE, or an attacker appending `.junk`) are\n * rejected outright — never parsed from their first three segments, which would\n * let the signed input disagree with the token. */\nexport function splitJwtSegments(token) {\n const [headerSegment, payloadSegment, signatureSegment, ...extraSegments] = token.split(\".\");\n if (headerSegment === undefined || payloadSegment === undefined || signatureSegment === undefined)\n return null;\n if (extraSegments.length > 0)\n return null;\n return { headerSegment, payloadSegment, signatureSegment };\n}\nexport { scanEnvOptions, snakeToLowerCamel } from \"./envScan.js\";\nexport { asInt, PORT_RANGE } from \"./envCoerce.js\";\n"],"mappings":"AAmC0B,OAAO,OAAO;CAAE,KAAK;CAAG,KAAK;AAAO,CAAC;;;AC3B/D,SAAgB,SAAS,OAAO;CAC5B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC9E;;;AAGA,SAAgB,MAAM,OAAO;CACzB,OAAO,OAAO,UAAU,YAAY,UAAU;AAClD;;AAYA,SAAgB,cAAc,OAAO;CACjC,OAAO,MAAM,QAAQ,KAAK,KAAK,MAAM,OAAO,QAAQ,OAAO,QAAQ,QAAQ;AAC/E;;AAEA,SAAgB,iBAAiB,OAAO;CACpC,OAAO,UAAU,KAAA,KAAa,OAAO,UAAU;AACnD;;;;AAQA,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"}
|
|
@@ -2,8 +2,7 @@ Object.freeze({
|
|
|
2
2
|
min: 0,
|
|
3
3
|
max: 65535
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
//#region ../common/dist/index.js
|
|
5
|
+
// ../common/dist/index.js
|
|
7
6
|
/** Narrow `unknown` to a plain object (not null, not array). */
|
|
8
7
|
function isRecord(value) {
|
|
9
8
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -76,7 +75,6 @@ var HTML_ESCAPES = /* @__PURE__ */ new Map([
|
|
|
76
75
|
function escapeHtml(value) {
|
|
77
76
|
return value.replace(/[&<>"']/g, (char) => HTML_ESCAPES.get(char) ?? char);
|
|
78
77
|
}
|
|
79
|
-
//#endregion
|
|
80
78
|
export { isErrorWithCode as a, isRecord as c, hasStringProp as i, isStringArray as l, escapeHtml as n, isObj as o, hasNumberProp as r, isOptionalString as s, errorMessage as t, isUnknownArray as u };
|
|
81
79
|
|
|
82
|
-
//# sourceMappingURL=dist-
|
|
80
|
+
//# sourceMappingURL=dist-BmO4oSQy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dist-MFUV9FYo.js","names":[],"sources":["../../common/dist/envCoerce.js","../../common/dist/index.js"],"sourcesContent":["// Env-var type coercion for ports and other integer settings.\n//\n// It started inside `server/system/env.ts` (#504-era), moved to\n// `server/utils/envCoerce.ts` when #2650 needed the SAME rule for `yarn dev`'s\n// Vite proxy — the proxy has to resolve `PORT` exactly as the backend does, or\n// the two point at different servers — and moved here when #3084 needed it for\n// the messaging bridges too. A second opinion about \"is this a port\" is that\n// bug one level down, so there is exactly one copy and every tier imports it.\n/**\n * `Number()`-based integer coercion with an optional range, falling back when the\n * value is absent, empty, non-integer, or out of range.\n *\n * `Number()` — not `parseInt` — on purpose: it is what the server has always used,\n * so `0x1f`, `1e3`, `+3100` and `3100.0` coerce exactly as they did, and a\n * whitespace-only value coerces to 0. Anything stricter here would silently\n * disagree with the backend.\n */\nexport function asInt(value, fallback, opts = {}) {\n if (value === undefined || value === \"\")\n return fallback;\n const parsed = Number(value);\n if (!Number.isInteger(parsed))\n return fallback;\n if (opts.min !== undefined && parsed < opts.min)\n return fallback;\n if (opts.max !== undefined && parsed > opts.max)\n return fallback;\n return parsed;\n}\n/** The port range the backend accepts, so both sides bound the value identically.\n * `min: 0` is deliberate — 0 asks the OS for an ephemeral port.\n *\n * `Required<IntRange>`, not `IntRange`: both bounds are always present here, and\n * saying so lets a caller compare against them (`port <= PORT_RANGE.max`) without\n * a non-null assertion. Still assignable wherever an `IntRange` is expected. */\nexport const PORT_RANGE = Object.freeze({ min: 0, max: 65_535 });\n","// 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/** Absent, or a string — an optional string field. */\nexport function isOptionalString(value) {\n return value === undefined || typeof value === \"string\";\n}\n/** Absent, or a boolean — an optional boolean field. */\nexport function isOptionalBoolean(value) {\n return value === undefined || typeof value === \"boolean\";\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 [\"&\", \"&\"],\n [\"<\", \"<\"],\n [\">\", \">\"],\n ['\"', \""\"],\n [\"'\", \"'\"],\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}\n/** Split a JWS compact serialization into its three segments, or `null` when the\n * token isn't well-formed. Pure string work, so the Node bridges and the\n * Cloudflare Workers relay — which decode the segments differently (`Buffer` vs\n * `atob`) — can still share this one guard.\n *\n * A JWS compact serialization is EXACTLY three segments. Both a short token and\n * a longer one (a five-segment JWE, or an attacker appending `.junk`) are\n * rejected outright — never parsed from their first three segments, which would\n * let the signed input disagree with the token. */\nexport function splitJwtSegments(token) {\n const [headerSegment, payloadSegment, signatureSegment, ...extraSegments] = token.split(\".\");\n if (headerSegment === undefined || payloadSegment === undefined || signatureSegment === undefined)\n return null;\n if (extraSegments.length > 0)\n return null;\n return { headerSegment, payloadSegment, signatureSegment };\n}\nexport { scanEnvOptions, snakeToLowerCamel } from \"./envScan.js\";\nexport { asInt, PORT_RANGE } from \"./envCoerce.js\";\n"],"mappings":"AAmC0B,OAAO,OAAO;CAAE,KAAK;CAAG,KAAK;AAAO,CAAC;;;;AC3B/D,SAAgB,SAAS,OAAO;CAC5B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC9E;;;AAGA,SAAgB,MAAM,OAAO;CACzB,OAAO,OAAO,UAAU,YAAY,UAAU;AAClD;;AAYA,SAAgB,cAAc,OAAO;CACjC,OAAO,MAAM,QAAQ,KAAK,KAAK,MAAM,OAAO,QAAQ,OAAO,QAAQ,QAAQ;AAC/E;;AAEA,SAAgB,iBAAiB,OAAO;CACpC,OAAO,UAAU,KAAA,KAAa,OAAO,UAAU;AACnD;;;;AAQA,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
|
+
{"version":3,"file":"dist-BmO4oSQy.js","names":[],"sources":["../../common/dist/envCoerce.js","../../common/dist/index.js"],"sourcesContent":["// Env-var type coercion for ports and other integer settings.\n//\n// It started inside `server/system/env.ts` (#504-era), moved to\n// `server/utils/envCoerce.ts` when #2650 needed the SAME rule for `yarn dev`'s\n// Vite proxy — the proxy has to resolve `PORT` exactly as the backend does, or\n// the two point at different servers — and moved here when #3084 needed it for\n// the messaging bridges too. A second opinion about \"is this a port\" is that\n// bug one level down, so there is exactly one copy and every tier imports it.\n/**\n * `Number()`-based integer coercion with an optional range, falling back when the\n * value is absent, empty, non-integer, or out of range.\n *\n * `Number()` — not `parseInt` — on purpose: it is what the server has always used,\n * so `0x1f`, `1e3`, `+3100` and `3100.0` coerce exactly as they did, and a\n * whitespace-only value coerces to 0. Anything stricter here would silently\n * disagree with the backend.\n */\nexport function asInt(value, fallback, opts = {}) {\n if (value === undefined || value === \"\")\n return fallback;\n const parsed = Number(value);\n if (!Number.isInteger(parsed))\n return fallback;\n if (opts.min !== undefined && parsed < opts.min)\n return fallback;\n if (opts.max !== undefined && parsed > opts.max)\n return fallback;\n return parsed;\n}\n/** The port range the backend accepts, so both sides bound the value identically.\n * `min: 0` is deliberate — 0 asks the OS for an ephemeral port.\n *\n * `Required<IntRange>`, not `IntRange`: both bounds are always present here, and\n * saying so lets a caller compare against them (`port <= PORT_RANGE.max`) without\n * a non-null assertion. Still assignable wherever an `IntRange` is expected. */\nexport const PORT_RANGE = Object.freeze({ min: 0, max: 65_535 });\n","// 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/** Absent, or a string — an optional string field. */\nexport function isOptionalString(value) {\n return value === undefined || typeof value === \"string\";\n}\n/** Absent, or a boolean — an optional boolean field. */\nexport function isOptionalBoolean(value) {\n return value === undefined || typeof value === \"boolean\";\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 [\"&\", \"&\"],\n [\"<\", \"<\"],\n [\">\", \">\"],\n ['\"', \""\"],\n [\"'\", \"'\"],\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}\n/** Split a JWS compact serialization into its three segments, or `null` when the\n * token isn't well-formed. Pure string work, so the Node bridges and the\n * Cloudflare Workers relay — which decode the segments differently (`Buffer` vs\n * `atob`) — can still share this one guard.\n *\n * A JWS compact serialization is EXACTLY three segments. Both a short token and\n * a longer one (a five-segment JWE, or an attacker appending `.junk`) are\n * rejected outright — never parsed from their first three segments, which would\n * let the signed input disagree with the token. */\nexport function splitJwtSegments(token) {\n const [headerSegment, payloadSegment, signatureSegment, ...extraSegments] = token.split(\".\");\n if (headerSegment === undefined || payloadSegment === undefined || signatureSegment === undefined)\n return null;\n if (extraSegments.length > 0)\n return null;\n return { headerSegment, payloadSegment, signatureSegment };\n}\nexport { scanEnvOptions, snakeToLowerCamel } from \"./envScan.js\";\nexport { asInt, PORT_RANGE } from \"./envCoerce.js\";\n"],"mappings":"AAmC0B,OAAO,OAAO;CAAE,KAAK;CAAG,KAAK;AAAO,CAAC;;;AC3B/D,SAAgB,SAAS,OAAO;CAC5B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC9E;;;AAGA,SAAgB,MAAM,OAAO;CACzB,OAAO,OAAO,UAAU,YAAY,UAAU;AAClD;;AAYA,SAAgB,cAAc,OAAO;CACjC,OAAO,MAAM,QAAQ,KAAK,KAAK,MAAM,OAAO,QAAQ,OAAO,QAAQ,QAAQ;AAC/E;;AAEA,SAAgB,iBAAiB,OAAO;CACpC,OAAO,UAAU,KAAA,KAAa,OAAO,UAAU;AACnD;;;;AAQA,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require("./errors-B9mCEVG9.cjs");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./errors-0QwjDxsv.js";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { t as errorMessage } from "./dist-
|
|
2
|
-
|
|
1
|
+
import { t as errorMessage } from "./dist-BmO4oSQy.js";
|
|
2
|
+
// src/utils/errors.ts
|
|
3
3
|
function toError(err, fallback) {
|
|
4
4
|
if (err instanceof Error) return err;
|
|
5
5
|
return new Error(fallback ?? errorMessage(err));
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { toError as t };
|
|
9
8
|
|
|
10
|
-
//# sourceMappingURL=errors-
|
|
9
|
+
//# sourceMappingURL=errors-0QwjDxsv.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-
|
|
1
|
+
{"version":3,"file":"errors-0QwjDxsv.js","names":[],"sources":["../src/utils/errors.ts"],"sourcesContent":["// Canonical error helpers for the whole monorepo. Host (`server/`, `src/`)\n// re-exports these rather than keeping its own copy — before #2217 the same\n// function existed 14 times across 4 behaviours, and the two that mattered\n// disagreed on gRPC-shaped errors: `{ code, details, metadata }` surfaced as\n// \"quota exceeded\" through the host copy and as \"[object Object]\" through the\n// core ones.\n//\n// `errorMessage` itself now lives in `@mulmoclaude/common` (browser-safe leaf,\n// zero deps) so the Vue plugin surfaces can share the one implementation\n// instead of hand-copying it — `@mulmoclaude/core/utils` is server-only and\n// unreachable from browser code. This module keeps the same import surface so\n// no core/host consumer of `errorMessage` breaks.\nimport { errorMessage } from \"@mulmoclaude/common\";\n\nexport { errorMessage };\n\n// Coerce an unknown caught value into an Error, preserving the original if it\n// already was one. Use in error boundaries / Promise rejections / event-handler\n// onerror callbacks where the downstream API wants an Error object.\n//\n// `fallback` is the message used when coercing a non-Error value — pass a\n// descriptive string for cases where `String(err)` would just produce noise\n// (e.g. `<img>.onerror` hands you an Event, not the underlying load failure).\nexport function toError(err: unknown, fallback?: string): Error {\n if (err instanceof Error) return err;\n return new Error(fallback ?? errorMessage(err));\n}\n"],"mappings":";;AAuBA,SAAgB,QAAQ,KAAc,UAA0B;CAC9D,IAAI,eAAe,OAAO,OAAO;CACjC,OAAO,IAAI,MAAM,YAAY,aAAa,GAAG,CAAC;AAChD"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
const require_dist = require("./dist-
|
|
2
|
-
|
|
1
|
+
const require_dist = require("./dist-734JaRYi.cjs");
|
|
2
|
+
// src/utils/errors.ts
|
|
3
3
|
function toError(err, fallback) {
|
|
4
4
|
if (err instanceof Error) return err;
|
|
5
5
|
return new Error(fallback ?? require_dist.errorMessage(err));
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
Object.defineProperty(exports, "toError", {
|
|
9
8
|
enumerable: true,
|
|
10
9
|
get: function() {
|
|
@@ -12,4 +11,4 @@ Object.defineProperty(exports, "toError", {
|
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
13
|
|
|
15
|
-
//# sourceMappingURL=errors-
|
|
14
|
+
//# sourceMappingURL=errors-B9mCEVG9.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-
|
|
1
|
+
{"version":3,"file":"errors-B9mCEVG9.cjs","names":["errorMessage"],"sources":["../src/utils/errors.ts"],"sourcesContent":["// Canonical error helpers for the whole monorepo. Host (`server/`, `src/`)\n// re-exports these rather than keeping its own copy — before #2217 the same\n// function existed 14 times across 4 behaviours, and the two that mattered\n// disagreed on gRPC-shaped errors: `{ code, details, metadata }` surfaced as\n// \"quota exceeded\" through the host copy and as \"[object Object]\" through the\n// core ones.\n//\n// `errorMessage` itself now lives in `@mulmoclaude/common` (browser-safe leaf,\n// zero deps) so the Vue plugin surfaces can share the one implementation\n// instead of hand-copying it — `@mulmoclaude/core/utils` is server-only and\n// unreachable from browser code. This module keeps the same import surface so\n// no core/host consumer of `errorMessage` breaks.\nimport { errorMessage } from \"@mulmoclaude/common\";\n\nexport { errorMessage };\n\n// Coerce an unknown caught value into an Error, preserving the original if it\n// already was one. Use in error boundaries / Promise rejections / event-handler\n// onerror callbacks where the downstream API wants an Error object.\n//\n// `fallback` is the message used when coercing a non-Error value — pass a\n// descriptive string for cases where `String(err)` would just produce noise\n// (e.g. `<img>.onerror` hands you an Event, not the underlying load failure).\nexport function toError(err: unknown, fallback?: string): Error {\n if (err instanceof Error) return err;\n return new Error(fallback ?? errorMessage(err));\n}\n"],"mappings":";;AAuBA,SAAgB,QAAQ,KAAc,UAA0B;CAC9D,IAAI,eAAe,OAAO,OAAO;CACjC,OAAO,IAAI,MAAM,YAAYA,aAAAA,aAAa,GAAG,CAAC;AAChD"}
|
package/dist/feeds/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_itemId = require("../itemId-
|
|
3
|
-
const require_ingestTypes = require("../ingestTypes-
|
|
2
|
+
const require_itemId = require("../itemId-D2XAQ8RU.cjs");
|
|
3
|
+
const require_ingestTypes = require("../ingestTypes-CLDvn7kw.cjs");
|
|
4
4
|
exports.AGENT_INGEST_KIND = require_ingestTypes.AGENT_INGEST_KIND;
|
|
5
5
|
exports.DEFAULT_FEED_MAX_ITEMS = require_ingestTypes.DEFAULT_FEED_MAX_ITEMS;
|
|
6
6
|
exports.FEED_SCHEDULES = require_itemId.FEED_SCHEDULES;
|
package/dist/feeds/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { J as INGEST_KINDS, q as FEED_SCHEDULES } from "../itemId-
|
|
2
|
-
import { n as DEFAULT_FEED_MAX_ITEMS, r as isFeedSchedule, t as AGENT_INGEST_KIND } from "../ingestTypes-
|
|
1
|
+
import { J as INGEST_KINDS, q as FEED_SCHEDULES } from "../itemId-D_pSpa3U.js";
|
|
2
|
+
import { n as DEFAULT_FEED_MAX_ITEMS, r as isFeedSchedule, t as AGENT_INGEST_KIND } from "../ingestTypes-DuXuSBSn.js";
|
|
3
3
|
export { AGENT_INGEST_KIND, DEFAULT_FEED_MAX_ITEMS, FEED_SCHEDULES, INGEST_KINDS, isFeedSchedule };
|
package/dist/feeds/paths.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("../rolldown-runtime-
|
|
2
|
+
const require_rolldown_runtime = require("../rolldown-runtime-CmQyd0Gu.cjs");
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
5
|
-
|
|
5
|
+
// src/feeds/paths.ts
|
|
6
6
|
var FEEDS_DIR = "feeds";
|
|
7
7
|
var FEED_STATE_FILE = "_state.json";
|
|
8
8
|
/** Where retrieval state for NON-feed collections with an `ingest` block
|
|
@@ -35,7 +35,6 @@ function ingestStateDir(workspaceRoot) {
|
|
|
35
35
|
function ingestStatePath(slug, workspaceRoot) {
|
|
36
36
|
return node_path.default.join(ingestStateDir(workspaceRoot), `${slug}.json`);
|
|
37
37
|
}
|
|
38
|
-
//#endregion
|
|
39
38
|
exports.FEEDS_DIR = FEEDS_DIR;
|
|
40
39
|
exports.FEED_STATE_FILE = FEED_STATE_FILE;
|
|
41
40
|
exports.INGEST_STATE_DIR = INGEST_STATE_DIR;
|
package/dist/feeds/paths.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
|
|
2
|
+
// src/feeds/paths.ts
|
|
3
3
|
var FEEDS_DIR = "feeds";
|
|
4
4
|
var FEED_STATE_FILE = "_state.json";
|
|
5
5
|
/** Where retrieval state for NON-feed collections with an `ingest` block
|
|
@@ -32,7 +32,6 @@ function ingestStateDir(workspaceRoot) {
|
|
|
32
32
|
function ingestStatePath(slug, workspaceRoot) {
|
|
33
33
|
return path.join(ingestStateDir(workspaceRoot), `${slug}.json`);
|
|
34
34
|
}
|
|
35
|
-
//#endregion
|
|
36
35
|
export { FEEDS_DIR, FEED_STATE_FILE, INGEST_STATE_DIR, feedDir, feedStatePath, feedsRoot, ingestStateDir, ingestStatePath };
|
|
37
36
|
|
|
38
37
|
//# sourceMappingURL=paths.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("../../rolldown-runtime-
|
|
3
|
-
const require_dist = require("../../dist-
|
|
4
|
-
const require_root = require("../../root-
|
|
5
|
-
const require_itemId = require("../../itemId-
|
|
6
|
-
const require_project = require("../../project-
|
|
7
|
-
const require_discovery = require("../../discovery-
|
|
8
|
-
const require_server = require("../../server-
|
|
2
|
+
const require_rolldown_runtime = require("../../rolldown-runtime-CmQyd0Gu.cjs");
|
|
3
|
+
const require_dist = require("../../dist-734JaRYi.cjs");
|
|
4
|
+
const require_root = require("../../root-9lRFeXbm.cjs");
|
|
5
|
+
const require_itemId = require("../../itemId-D2XAQ8RU.cjs");
|
|
6
|
+
const require_project = require("../../project-DDTIVEMU.cjs");
|
|
7
|
+
const require_discovery = require("../../discovery-CYIV1J5l.cjs");
|
|
8
|
+
const require_server = require("../../server-ByKWGQn2.cjs");
|
|
9
9
|
const require_feeds_paths = require("../paths.cjs");
|
|
10
|
-
const require_ingestTypes = require("../../ingestTypes-
|
|
11
|
-
const require_notifier = require("../../notifier-
|
|
10
|
+
const require_ingestTypes = require("../../ingestTypes-CLDvn7kw.cjs");
|
|
11
|
+
const require_notifier = require("../../notifier-CRTk34EC.cjs");
|
|
12
12
|
let node_path = require("node:path");
|
|
13
13
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
14
14
|
let node_crypto = require("node:crypto");
|
|
@@ -17,7 +17,7 @@ let node_dns_promises = require("node:dns/promises");
|
|
|
17
17
|
let node_net = require("node:net");
|
|
18
18
|
let fast_xml_parser = require("fast-xml-parser");
|
|
19
19
|
let _receptron_task_scheduler = require("@receptron/task-scheduler");
|
|
20
|
-
|
|
20
|
+
// src/feeds/server/host.ts
|
|
21
21
|
var hostSlot = require_discovery.createHostSlot("@mulmoclaude/core/feeds: configureFeedsHost()");
|
|
22
22
|
/** Wire the feeds engine to a host. Call once at startup, before any refresh. */
|
|
23
23
|
function configureFeedsHost(host) {
|
|
@@ -35,8 +35,7 @@ function resetFeedsHostForTesting() {
|
|
|
35
35
|
* reaching for `requireFeedsHost().log`. Non-critical: calls before the host
|
|
36
36
|
* is wired are dropped (not thrown), matching the collection/google seams. */
|
|
37
37
|
var log = require_discovery.createForwardingLogger(() => hostSlot.peek()?.log ?? null);
|
|
38
|
-
|
|
39
|
-
//#region src/feeds/server/registry.ts
|
|
38
|
+
// src/feeds/server/registry.ts
|
|
40
39
|
/** Every registered feed, as a discovered collection (carrying its
|
|
41
40
|
* validated schema, `ingest`, and resolved `dataDir`). */
|
|
42
41
|
async function listFeeds(workspaceRoot = requireFeedsHost().workspaceRoot) {
|
|
@@ -74,8 +73,7 @@ async function removeFeed(workspaceRoot, slug) {
|
|
|
74
73
|
return false;
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
|
-
|
|
78
|
-
//#region src/feeds/server/retrievers/index.ts
|
|
76
|
+
// src/feeds/server/retrievers/index.ts
|
|
79
77
|
var registry = /* @__PURE__ */ new Map();
|
|
80
78
|
function registerRetriever(kind, retriever) {
|
|
81
79
|
registry.set(kind, retriever);
|
|
@@ -83,8 +81,7 @@ function registerRetriever(kind, retriever) {
|
|
|
83
81
|
function getRetriever(kind) {
|
|
84
82
|
return registry.get(kind);
|
|
85
83
|
}
|
|
86
|
-
|
|
87
|
-
//#region ../common/dist/ssrf.js
|
|
84
|
+
// ../common/dist/ssrf.js
|
|
88
85
|
var ALLOWED_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
89
86
|
var BLOCKED_HOSTNAMES = /* @__PURE__ */ new Set([
|
|
90
87
|
"localhost",
|
|
@@ -201,8 +198,7 @@ function parseSafeUrlShape(raw) {
|
|
|
201
198
|
if (isBlockedIp(hostname)) return null;
|
|
202
199
|
return url;
|
|
203
200
|
}
|
|
204
|
-
|
|
205
|
-
//#region src/feeds/server/fetch/httpClient.ts
|
|
201
|
+
// src/feeds/server/fetch/httpClient.ts
|
|
206
202
|
var ONE_SECOND_MS = 1e3;
|
|
207
203
|
/** Identifies the bot to site operators. */
|
|
208
204
|
var FEED_USER_AGENT = "MulmoClaude-FeedBot/1.0 (+https://github.com/receptron/mulmoclaude)";
|
|
@@ -272,8 +268,7 @@ async function fetchJson(url, timeoutMs = DEFAULT_FEED_TIMEOUT_MS) {
|
|
|
272
268
|
if (!response.ok) throw new Error(`HTTP ${response.status} ${response.statusText} fetching ${url}`);
|
|
273
269
|
return response.json();
|
|
274
270
|
}
|
|
275
|
-
|
|
276
|
-
//#region src/feeds/server/fetch/rssParser.ts
|
|
271
|
+
// src/feeds/server/fetch/rssParser.ts
|
|
277
272
|
function isRecord(value) {
|
|
278
273
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
279
274
|
}
|
|
@@ -361,8 +356,7 @@ function readStringFromArray(array) {
|
|
|
361
356
|
function stripBom(text) {
|
|
362
357
|
return text.charCodeAt(0) === 65279 ? text.slice(1) : text;
|
|
363
358
|
}
|
|
364
|
-
|
|
365
|
-
//#region src/feeds/server/pathResolver.ts
|
|
359
|
+
// src/feeds/server/pathResolver.ts
|
|
366
360
|
var BRACKET_RE = /\[(\d*)\]/g;
|
|
367
361
|
/** Split one dot-segment (`results[0]`, `hourly[]`, `name`) into tokens.
|
|
368
362
|
* An empty `[]` is an array-identity marker and emits no token — the
|
|
@@ -410,8 +404,7 @@ function getItemsArray(root, itemsAt) {
|
|
|
410
404
|
const value = getByPath(root, itemsAt);
|
|
411
405
|
return Array.isArray(value) ? value : [];
|
|
412
406
|
}
|
|
413
|
-
|
|
414
|
-
//#region src/feeds/server/projectItem.ts
|
|
407
|
+
// src/feeds/server/projectItem.ts
|
|
415
408
|
function asKeyString(value) {
|
|
416
409
|
if (typeof value === "string" && value.trim().length > 0) return value.trim();
|
|
417
410
|
if (typeof value === "number" && Number.isFinite(value)) return String(value);
|
|
@@ -474,8 +467,7 @@ function projectRecord(rawItem, ingest, schema) {
|
|
|
474
467
|
record[schema.primaryKey] = toSafeId(naturalKey(record, rawItem, ingest, schema));
|
|
475
468
|
return record;
|
|
476
469
|
}
|
|
477
|
-
|
|
478
|
-
//#region src/feeds/server/retrievers/rss.ts
|
|
470
|
+
// src/feeds/server/retrievers/rss.ts
|
|
479
471
|
var retrieveRss = async (ingest, schema) => {
|
|
480
472
|
const feed = parseFeed(await fetchText(ingest.url));
|
|
481
473
|
if (!feed) return {
|
|
@@ -489,8 +481,7 @@ var retrieveRss = async (ingest, schema) => {
|
|
|
489
481
|
};
|
|
490
482
|
registerRetriever("rss", retrieveRss);
|
|
491
483
|
registerRetriever("atom", retrieveRss);
|
|
492
|
-
|
|
493
|
-
//#region src/feeds/server/retrievers/httpJson.ts
|
|
484
|
+
// src/feeds/server/retrievers/httpJson.ts
|
|
494
485
|
var retrieveHttpJson = async (ingest, schema) => {
|
|
495
486
|
return {
|
|
496
487
|
items: getItemsArray(await fetchJson(ingest.url), ingest.itemsAt).map((raw) => projectRecord(raw, ingest, schema)),
|
|
@@ -498,8 +489,7 @@ var retrieveHttpJson = async (ingest, schema) => {
|
|
|
498
489
|
};
|
|
499
490
|
};
|
|
500
491
|
registerRetriever("http-json", retrieveHttpJson);
|
|
501
|
-
|
|
502
|
-
//#region src/feeds/server/state.ts
|
|
492
|
+
// src/feeds/server/state.ts
|
|
503
493
|
/** Resolve the on-disk state file for a collection, branching on source. */
|
|
504
494
|
function stateFilePath(target, workspaceRoot) {
|
|
505
495
|
return target.source === "feed" ? require_feeds_paths.feedStatePath(target.slug, workspaceRoot) : require_feeds_paths.ingestStatePath(target.slug, workspaceRoot);
|
|
@@ -553,8 +543,7 @@ async function writeFeedState(workspaceRoot, target, state) {
|
|
|
553
543
|
await (0, node_fs_promises.mkdir)(node_path.default.dirname(file), { recursive: true });
|
|
554
544
|
await requireFeedsHost().writeFileAtomic(file, `${JSON.stringify(state, null, 2)}\n`);
|
|
555
545
|
}
|
|
556
|
-
|
|
557
|
-
//#region src/feeds/server/agentIngest.ts
|
|
546
|
+
// src/feeds/server/agentIngest.ts
|
|
558
547
|
/** The injected worker launcher, or null if the host was never configured.
|
|
559
548
|
* Read non-throwingly so the failure-isolated contract holds (an unconfigured
|
|
560
549
|
* host becomes an `errors` entry, not a thrown exception). */
|
|
@@ -686,8 +675,7 @@ async function onWorkerSuccess(state, collection) {
|
|
|
686
675
|
delete next.failureBellId;
|
|
687
676
|
return next;
|
|
688
677
|
}
|
|
689
|
-
|
|
690
|
-
//#region src/feeds/server/engine.ts
|
|
678
|
+
// src/feeds/server/engine.ts
|
|
691
679
|
var ONE_HOUR_MS = 36e5;
|
|
692
680
|
var ONE_DAY_MS = 864e5;
|
|
693
681
|
/** A feed's retrieval config, or undefined. `CollectionSchema.ingest` and the
|
|
@@ -946,8 +934,7 @@ async function refreshDue(workspaceRoot = requireFeedsHost().workspaceRoot) {
|
|
|
946
934
|
}
|
|
947
935
|
return results;
|
|
948
936
|
}
|
|
949
|
-
|
|
950
|
-
//#region src/feeds/server/scheduledRefresh.ts
|
|
937
|
+
// src/feeds/server/scheduledRefresh.ts
|
|
951
938
|
var FEED_REFRESH_TASK_ID = "system:feed-refresh";
|
|
952
939
|
/** The task id for a given root. Root-less (the configured workspace) keeps the
|
|
953
940
|
* bare, historical id, so a single-workspace host's persisted scheduler state
|
|
@@ -995,7 +982,6 @@ function feedRefreshTaskDef(opts) {
|
|
|
995
982
|
run: () => refreshDue(root).then(() => {})
|
|
996
983
|
};
|
|
997
984
|
}
|
|
998
|
-
//#endregion
|
|
999
985
|
exports.AGENT_INGEST_KIND = require_ingestTypes.AGENT_INGEST_KIND;
|
|
1000
986
|
exports.DEFAULT_FEED_MAX_ITEMS = require_ingestTypes.DEFAULT_FEED_MAX_ITEMS;
|
|
1001
987
|
exports.DEFAULT_FEED_REFRESH_INTERVAL_MS = DEFAULT_FEED_REFRESH_INTERVAL_MS;
|