@mulmoclaude/core 0.26.0 → 0.28.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 (92) hide show
  1. package/assets/helps/error-recovery.md +55 -0
  2. package/assets/helps/wiki.md +47 -2
  3. package/dist/collection/core/errorMessage.d.ts +1 -4
  4. package/dist/collection/core/ontologyGraph.d.ts +58 -0
  5. package/dist/collection/core/uiTypes.d.ts +7 -0
  6. package/dist/collection/index.cjs +84 -13
  7. package/dist/collection/index.cjs.map +1 -1
  8. package/dist/collection/index.d.ts +1 -0
  9. package/dist/collection/index.js +77 -7
  10. package/dist/collection/index.js.map +1 -1
  11. package/dist/collection/registry/server/index.cjs +8 -7
  12. package/dist/collection/registry/server/index.cjs.map +1 -1
  13. package/dist/collection/registry/server/index.js +3 -2
  14. package/dist/collection/registry/server/index.js.map +1 -1
  15. package/dist/collection/server/csvStore.d.ts +0 -5
  16. package/dist/collection/server/index.cjs +3 -3
  17. package/dist/collection/server/index.js +3 -3
  18. package/dist/collection/server/ontology.d.ts +2 -24
  19. package/dist/collection/server/util.d.ts +1 -2
  20. package/dist/collection-watchers/index.cjs +5 -4
  21. package/dist/collection-watchers/index.cjs.map +1 -1
  22. package/dist/collection-watchers/index.js +4 -3
  23. package/dist/collection-watchers/index.js.map +1 -1
  24. package/dist/{discovery-cwtfyDxl.cjs → discovery-BKovdRpZ.cjs} +20 -8
  25. package/dist/discovery-BKovdRpZ.cjs.map +1 -0
  26. package/dist/{discovery-QUi_7aNG.js → discovery-BVdCgBFN.js} +20 -8
  27. package/dist/discovery-BVdCgBFN.js.map +1 -0
  28. package/dist/errors-7P5eMOSX.cjs +30 -0
  29. package/dist/errors-7P5eMOSX.cjs.map +1 -0
  30. package/dist/errors-eid6Mes3.js +19 -0
  31. package/dist/errors-eid6Mes3.js.map +1 -0
  32. package/dist/feeds/index.cjs +2 -2
  33. package/dist/feeds/index.js +2 -2
  34. package/dist/feeds/server/index.cjs +4 -4
  35. package/dist/feeds/server/index.js +4 -4
  36. package/dist/google/index.cjs +8 -18
  37. package/dist/google/index.cjs.map +1 -1
  38. package/dist/google/index.js +3 -13
  39. package/dist/google/index.js.map +1 -1
  40. package/dist/google/util.d.ts +2 -4
  41. package/dist/{ids-P2T89Gou.js → ids-D1M1T6KJ.js} +26 -3
  42. package/dist/ids-D1M1T6KJ.js.map +1 -0
  43. package/dist/{ids-Dl9Ij63K.cjs → ids-DWmHjm17.cjs} +37 -2
  44. package/dist/ids-DWmHjm17.cjs.map +1 -0
  45. package/dist/{ingestTypes-C-IQB4nw.js → ingestTypes-Ci4eOgv-.js} +2 -2
  46. package/dist/{ingestTypes-C-IQB4nw.js.map → ingestTypes-Ci4eOgv-.js.map} +1 -1
  47. package/dist/{ingestTypes-DZpAC3N_.cjs → ingestTypes-DbuQNuK6.cjs} +2 -2
  48. package/dist/{ingestTypes-DZpAC3N_.cjs.map → ingestTypes-DbuQNuK6.cjs.map} +1 -1
  49. package/dist/{promptSafety-BOc1B3im.cjs → promptSafety-BFt2g_wn.cjs} +6 -40
  50. package/dist/promptSafety-BFt2g_wn.cjs.map +1 -0
  51. package/dist/{promptSafety-B5KPkaNY.js → promptSafety-cZIeiZtB.js} +4 -26
  52. package/dist/promptSafety-cZIeiZtB.js.map +1 -0
  53. package/dist/remote-host/server/index.cjs +4 -4
  54. package/dist/remote-host/server/index.cjs.map +1 -1
  55. package/dist/remote-host/server/index.js +1 -1
  56. package/dist/scheduler/index.cjs +2 -4
  57. package/dist/scheduler/index.cjs.map +1 -1
  58. package/dist/scheduler/index.js +1 -3
  59. package/dist/scheduler/index.js.map +1 -1
  60. package/dist/{server-CNLZZONa.js → server-B8mvfZSF.js} +28 -18
  61. package/dist/server-B8mvfZSF.js.map +1 -0
  62. package/dist/{server-B7mtx4Cd.cjs → server-rRQkNBvO.cjs} +28 -24
  63. package/dist/server-rRQkNBvO.cjs.map +1 -0
  64. package/dist/text-CaAh9ZSO.cjs +27 -0
  65. package/dist/text-CaAh9ZSO.cjs.map +1 -0
  66. package/dist/text-CjDbP2O1.js +22 -0
  67. package/dist/text-CjDbP2O1.js.map +1 -0
  68. package/dist/utils/errors.d.ts +2 -0
  69. package/dist/utils/index.cjs +6 -0
  70. package/dist/utils/index.d.ts +2 -0
  71. package/dist/utils/index.js +3 -0
  72. package/dist/utils/text.d.ts +12 -0
  73. package/dist/whisper/index.cjs +7 -9
  74. package/dist/whisper/index.cjs.map +1 -1
  75. package/dist/whisper/index.js +1 -3
  76. package/dist/whisper/index.js.map +1 -1
  77. package/dist/whisper/internal.d.ts +1 -1
  78. package/dist/workspace-setup/index.js +12 -3
  79. package/dist/workspace-setup/index.js.map +1 -1
  80. package/package.json +7 -1
  81. package/dist/discovery-QUi_7aNG.js.map +0 -1
  82. package/dist/discovery-cwtfyDxl.cjs.map +0 -1
  83. package/dist/errorMessage--LvXe_Jx.cjs +0 -16
  84. package/dist/errorMessage--LvXe_Jx.cjs.map +0 -1
  85. package/dist/errorMessage-DIdhheHk.js +0 -11
  86. package/dist/errorMessage-DIdhheHk.js.map +0 -1
  87. package/dist/ids-Dl9Ij63K.cjs.map +0 -1
  88. package/dist/ids-P2T89Gou.js.map +0 -1
  89. package/dist/promptSafety-B5KPkaNY.js.map +0 -1
  90. package/dist/promptSafety-BOc1B3im.cjs.map +0 -1
  91. package/dist/server-B7mtx4Cd.cjs.map +0 -1
  92. package/dist/server-CNLZZONa.js.map +0 -1
@@ -0,0 +1,30 @@
1
+ //#region src/utils/errors.ts
2
+ function errorMessage(err, fallback) {
3
+ if (err instanceof Error) return err.message;
4
+ if (err !== null && typeof err === "object") {
5
+ const obj = err;
6
+ if (typeof obj.details === "string" && obj.details) return obj.details;
7
+ if (typeof obj.message === "string" && obj.message) return obj.message;
8
+ }
9
+ if (fallback !== void 0) return fallback;
10
+ return String(err);
11
+ }
12
+ function toError(err, fallback) {
13
+ if (err instanceof Error) return err;
14
+ return new Error(fallback ?? errorMessage(err));
15
+ }
16
+ //#endregion
17
+ Object.defineProperty(exports, "errorMessage", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return errorMessage;
21
+ }
22
+ });
23
+ Object.defineProperty(exports, "toError", {
24
+ enumerable: true,
25
+ get: function() {
26
+ return toError;
27
+ }
28
+ });
29
+
30
+ //# sourceMappingURL=errors-7P5eMOSX.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-7P5eMOSX.cjs","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. Browser-safe: pure string work, no node imports.\n\n// Non-Error objects with a `details` (gRPC convention) or `message` string\n// field have that field surfaced — without this they stringify to\n// `[object Object]`.\n//\n// `fallback` covers the route-handler idiom where a throw of a plain non-Error\n// value should surface as a descriptive message (\"rebuild failed\") rather than\n// `String(err)` noise. Pass one at error-response boundaries; omit it for\n// logging contexts where `String(err)` is fine.\nexport function errorMessage(err: unknown, fallback?: string): string {\n if (err instanceof Error) return err.message;\n if (err !== null && typeof err === \"object\") {\n const obj = err as { details?: unknown; message?: unknown };\n if (typeof obj.details === \"string\" && obj.details) return obj.details;\n if (typeof obj.message === \"string\" && obj.message) return obj.message;\n }\n if (fallback !== undefined) return fallback;\n return String(err);\n}\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":";AAeA,SAAgB,aAAa,KAAc,UAA2B;CACpE,IAAI,eAAe,OAAO,OAAO,IAAI;CACrC,IAAI,QAAQ,QAAQ,OAAO,QAAQ,UAAU;EAC3C,MAAM,MAAM;EACZ,IAAI,OAAO,IAAI,YAAY,YAAY,IAAI,SAAS,OAAO,IAAI;EAC/D,IAAI,OAAO,IAAI,YAAY,YAAY,IAAI,SAAS,OAAO,IAAI;CACjE;CACA,IAAI,aAAa,KAAA,GAAW,OAAO;CACnC,OAAO,OAAO,GAAG;AACnB;AASA,SAAgB,QAAQ,KAAc,UAA0B;CAC9D,IAAI,eAAe,OAAO,OAAO;CACjC,OAAO,IAAI,MAAM,YAAY,aAAa,GAAG,CAAC;AAChD"}
@@ -0,0 +1,19 @@
1
+ //#region src/utils/errors.ts
2
+ function errorMessage(err, fallback) {
3
+ if (err instanceof Error) return err.message;
4
+ if (err !== null && typeof err === "object") {
5
+ const obj = err;
6
+ if (typeof obj.details === "string" && obj.details) return obj.details;
7
+ if (typeof obj.message === "string" && obj.message) return obj.message;
8
+ }
9
+ if (fallback !== void 0) return fallback;
10
+ return String(err);
11
+ }
12
+ function toError(err, fallback) {
13
+ if (err instanceof Error) return err;
14
+ return new Error(fallback ?? errorMessage(err));
15
+ }
16
+ //#endregion
17
+ export { toError as n, errorMessage as t };
18
+
19
+ //# sourceMappingURL=errors-eid6Mes3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-eid6Mes3.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. Browser-safe: pure string work, no node imports.\n\n// Non-Error objects with a `details` (gRPC convention) or `message` string\n// field have that field surfaced — without this they stringify to\n// `[object Object]`.\n//\n// `fallback` covers the route-handler idiom where a throw of a plain non-Error\n// value should surface as a descriptive message (\"rebuild failed\") rather than\n// `String(err)` noise. Pass one at error-response boundaries; omit it for\n// logging contexts where `String(err)` is fine.\nexport function errorMessage(err: unknown, fallback?: string): string {\n if (err instanceof Error) return err.message;\n if (err !== null && typeof err === \"object\") {\n const obj = err as { details?: unknown; message?: unknown };\n if (typeof obj.details === \"string\" && obj.details) return obj.details;\n if (typeof obj.message === \"string\" && obj.message) return obj.message;\n }\n if (fallback !== undefined) return fallback;\n return String(err);\n}\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":";AAeA,SAAgB,aAAa,KAAc,UAA2B;CACpE,IAAI,eAAe,OAAO,OAAO,IAAI;CACrC,IAAI,QAAQ,QAAQ,OAAO,QAAQ,UAAU;EAC3C,MAAM,MAAM;EACZ,IAAI,OAAO,IAAI,YAAY,YAAY,IAAI,SAAS,OAAO,IAAI;EAC/D,IAAI,OAAO,IAAI,YAAY,YAAY,IAAI,SAAS,OAAO,IAAI;CACjE;CACA,IAAI,aAAa,KAAA,GAAW,OAAO;CACnC,OAAO,OAAO,GAAG;AACnB;AASA,SAAgB,QAAQ,KAAc,UAA0B;CAC9D,IAAI,eAAe,OAAO,OAAO;CACjC,OAAO,IAAI,MAAM,YAAY,aAAa,GAAG,CAAC;AAChD"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_ids = require("../ids-Dl9Ij63K.cjs");
3
- const require_ingestTypes = require("../ingestTypes-DZpAC3N_.cjs");
2
+ const require_ids = require("../ids-DWmHjm17.cjs");
3
+ const require_ingestTypes = require("../ingestTypes-DbuQNuK6.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_ids.FEED_SCHEDULES;
@@ -1,3 +1,3 @@
1
- import { c as INGEST_KINDS, s as FEED_SCHEDULES } from "../ids-P2T89Gou.js";
2
- import { n as DEFAULT_FEED_MAX_ITEMS, r as isFeedSchedule, t as AGENT_INGEST_KIND } from "../ingestTypes-C-IQB4nw.js";
1
+ import { c as INGEST_KINDS, s as FEED_SCHEDULES } from "../ids-D1M1T6KJ.js";
2
+ import { n as DEFAULT_FEED_MAX_ITEMS, r as isFeedSchedule, t as AGENT_INGEST_KIND } from "../ingestTypes-Ci4eOgv-.js";
3
3
  export { AGENT_INGEST_KIND, DEFAULT_FEED_MAX_ITEMS, FEED_SCHEDULES, INGEST_KINDS, isFeedSchedule };
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("../../rolldown-runtime-D6vf50IK.cjs");
3
- const require_ids = require("../../ids-Dl9Ij63K.cjs");
4
- const require_discovery = require("../../discovery-cwtfyDxl.cjs");
5
- require("../../server-B7mtx4Cd.cjs");
6
- const require_ingestTypes = require("../../ingestTypes-DZpAC3N_.cjs");
3
+ const require_ids = require("../../ids-DWmHjm17.cjs");
4
+ const require_discovery = require("../../discovery-BKovdRpZ.cjs");
5
+ require("../../server-rRQkNBvO.cjs");
6
+ const require_ingestTypes = require("../../ingestTypes-DbuQNuK6.cjs");
7
7
  const require_feeds_paths = require("../paths.cjs");
8
8
  const require_notifier = require("../../notifier-bS8IEeLA.cjs");
9
9
  let node_path = require("node:path");
@@ -1,7 +1,7 @@
1
- import { c as INGEST_KINDS, s as FEED_SCHEDULES } from "../../ids-P2T89Gou.js";
2
- import { G as resolveDataDir, J as safeSlugName, L as readSkillTemplate, M as listItems, N as promptPathsFor, O as buildCollectionActionSeedPrompt, n as discoverCollections, u as storeFor } from "../../discovery-QUi_7aNG.js";
3
- import "../../server-CNLZZONa.js";
4
- import { n as DEFAULT_FEED_MAX_ITEMS, r as isFeedSchedule, t as AGENT_INGEST_KIND } from "../../ingestTypes-C-IQB4nw.js";
1
+ import { c as INGEST_KINDS, s as FEED_SCHEDULES } from "../../ids-D1M1T6KJ.js";
2
+ import { G as resolveDataDir, J as safeSlugName, L as readSkillTemplate, M as listItems, N as promptPathsFor, O as buildCollectionActionSeedPrompt, n as discoverCollections, u as storeFor } from "../../discovery-BVdCgBFN.js";
3
+ import "../../server-B8mvfZSF.js";
4
+ import { n as DEFAULT_FEED_MAX_ITEMS, r as isFeedSchedule, t as AGENT_INGEST_KIND } from "../../ingestTypes-Ci4eOgv-.js";
5
5
  import { FEEDS_DIR, feedDir, feedStatePath, feedsRoot, ingestStateDir, ingestStatePath } from "../paths.js";
6
6
  import { d as publish, n as clear } from "../../notifier-ChpY0XrY.js";
7
7
  import path from "node:path";
@@ -1,6 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("../rolldown-runtime-D6vf50IK.cjs");
3
- const require_discovery = require("../discovery-cwtfyDxl.cjs");
3
+ const require_errors = require("../errors-7P5eMOSX.cjs");
4
+ const require_text = require("../text-CaAh9ZSO.cjs");
5
+ const require_discovery = require("../discovery-BKovdRpZ.cjs");
4
6
  let node_path = require("node:path");
5
7
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
6
8
  let node_fs = require("node:fs");
@@ -65,21 +67,9 @@ function googleSecretsDir(home) {
65
67
  //#region src/google/util.ts
66
68
  var ONE_SECOND_MS = 1e3;
67
69
  var ONE_MINUTE_MS = 6e4;
68
- function errorMessage(err, fallback = "unknown error") {
69
- if (err instanceof Error) return err.message || fallback;
70
- const text = String(err);
71
- return text === "" || text === "[object Object]" ? fallback : text;
72
- }
73
70
  function isRecord(value) {
74
71
  return typeof value === "object" && value !== null && !Array.isArray(value);
75
72
  }
76
- /** Clip a string to at most `max` chars; the ellipsis is included in the
77
- * budget so output never exceeds `max`. */
78
- function truncate(text, max, ellipsis = "…") {
79
- if (max <= 0) return "";
80
- if (text.length <= max) return text;
81
- return `${text.slice(0, Math.max(0, max - ellipsis.length))}${ellipsis}`;
82
- }
83
73
  //#endregion
84
74
  //#region src/google/clientSecret.ts
85
75
  var isNonEmptyString = (value) => typeof value === "string" && value !== "";
@@ -282,7 +272,7 @@ var brokerFetch = async (url, init = {}) => {
282
272
  headers: { "Content-Type": "application/json" }
283
273
  });
284
274
  } catch (err) {
285
- throw new Error(`Google sign-in service unreachable — check the network connection and retry (${errorMessage(err)})`);
275
+ throw new Error(`Google sign-in service unreachable — check the network connection and retry (${require_errors.errorMessage(err)})`);
286
276
  }
287
277
  if (!response.ok) throw new Error(`Google sign-in service returned HTTP ${response.status}`);
288
278
  try {
@@ -424,7 +414,7 @@ async function unlinkGoogle(home, revokeFetch = fetchWithTimeout) {
424
414
  });
425
415
  if (!response.ok) log.warn("google", "token revoke returned non-ok", { status: response.status });
426
416
  } catch (err) {
427
- log.warn("google", "token revoke failed, deleting local tokens anyway", { error: errorMessage(err) });
417
+ log.warn("google", "token revoke failed, deleting local tokens anyway", { error: require_errors.errorMessage(err) });
428
418
  }
429
419
  await deleteGoogleTokens(home);
430
420
  }
@@ -575,7 +565,7 @@ var createGoogleAuthFlow = (authorize) => {
575
565
  signal: controller.signal
576
566
  }).then(() => log.info("google", "authorize flow completed")).catch((err) => {
577
567
  if (!controller.signal.aborted) {
578
- lastError = errorMessage(err);
568
+ lastError = require_errors.errorMessage(err);
579
569
  log.warn("google", "authorize flow failed", { error: lastError });
580
570
  }
581
571
  reject(err instanceof Error ? err : new Error(String(err)));
@@ -627,7 +617,7 @@ var isGoogleApiError = (value) => value instanceof GoogleApiError;
627
617
  /** 403 usually means the API is not enabled for the user's Cloud project —
628
618
  * name the API so the agent's recovery guidance can be specific. */
629
619
  var googleApiError = (apiLabel, status, body) => {
630
- return new GoogleApiError(status, `${apiLabel}: HTTP ${status}${status === HTTP_FORBIDDEN ? ` (is the ${apiLabel} enabled for the Cloud project?)` : ""}${body ? ` — ${truncate(body, ERROR_BODY_MAX_CHARS)}` : ""}`);
620
+ return new GoogleApiError(status, `${apiLabel}: HTTP ${status}${status === HTTP_FORBIDDEN ? ` (is the ${apiLabel} enabled for the Cloud project?)` : ""}${body ? ` — ${require_text.truncate(body, ERROR_BODY_MAX_CHARS)}` : ""}`);
631
621
  };
632
622
  async function googleRequest(apiLabel, accessToken, url, init = {}) {
633
623
  const { contentType = "application/json", expectText = false, ...rest } = init;
@@ -640,7 +630,7 @@ async function googleRequest(apiLabel, accessToken, url, init = {}) {
640
630
  }
641
631
  });
642
632
  if (!response.ok) {
643
- const body = await response.text().catch((err) => errorMessage(err));
633
+ const body = await response.text().catch((err) => require_errors.errorMessage(err));
644
634
  throw googleApiError(apiLabel, response.status, body);
645
635
  }
646
636
  if (expectText) return await response.text();