@mulmoclaude/core 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/assets/helps/error-recovery.md +12 -1
  2. package/dist/{calendarGrid-CaS9er8i.cjs → calendarGrid-BQYqOCnF.cjs} +8 -9
  3. package/dist/{calendarGrid-CaS9er8i.cjs.map → calendarGrid-BQYqOCnF.cjs.map} +1 -1
  4. package/dist/{calendarGrid-CrGxeCOG.js → calendarGrid-DivcNKkX.js} +8 -9
  5. package/dist/{calendarGrid-CrGxeCOG.js.map → calendarGrid-DivcNKkX.js.map} +1 -1
  6. package/dist/collection/core/schemaZ.d.ts +4 -4
  7. package/dist/collection/index.cjs +4 -4
  8. package/dist/collection/index.js +4 -4
  9. package/dist/collection/registry/server/index.cjs +3 -3
  10. package/dist/collection/registry/server/index.cjs.map +1 -1
  11. package/dist/collection/registry/server/index.js +3 -3
  12. package/dist/collection/registry/server/index.js.map +1 -1
  13. package/dist/collection/server/csvQuery.d.ts +7 -2
  14. package/dist/collection/server/csvStore.d.ts +2 -1
  15. package/dist/collection/server/index.cjs +3 -3
  16. package/dist/collection/server/index.js +3 -3
  17. package/dist/collection-watchers/index.cjs +10 -25
  18. package/dist/collection-watchers/index.cjs.map +1 -1
  19. package/dist/collection-watchers/index.js +10 -25
  20. package/dist/collection-watchers/index.js.map +1 -1
  21. package/dist/{discovery-DAoMnBYM.cjs → discovery-CRDx6TS4.cjs} +52 -32
  22. package/dist/discovery-CRDx6TS4.cjs.map +1 -0
  23. package/dist/{discovery-D-ZJ6a6z.js → discovery-D6p4ITNR.js} +52 -32
  24. package/dist/discovery-D6p4ITNR.js.map +1 -0
  25. package/dist/{dist-21pMsI1a.cjs → dist-CsgSfWwR.cjs} +22 -1
  26. package/dist/{dist-21pMsI1a.cjs.map → dist-CsgSfWwR.cjs.map} +1 -1
  27. package/dist/{dist-DP1FTGnO.js → dist-D8zokgGo.js} +11 -2
  28. package/dist/{dist-DP1FTGnO.js.map → dist-D8zokgGo.js.map} +1 -1
  29. package/dist/feeds/index.cjs +2 -2
  30. package/dist/feeds/index.js +2 -2
  31. package/dist/feeds/server/index.cjs +29 -23
  32. package/dist/feeds/server/index.cjs.map +1 -1
  33. package/dist/feeds/server/index.js +29 -23
  34. package/dist/feeds/server/index.js.map +1 -1
  35. package/dist/google/calendar.d.ts +23 -9
  36. package/dist/google/collectionPush.d.ts +13 -8
  37. package/dist/google/index.cjs +62 -37
  38. package/dist/google/index.cjs.map +1 -1
  39. package/dist/google/index.d.ts +2 -2
  40. package/dist/google/index.js +60 -37
  41. package/dist/google/index.js.map +1 -1
  42. package/dist/{ingestTypes-D1GQdG8e.cjs → ingestTypes-C7IJSqv4.cjs} +2 -2
  43. package/dist/{ingestTypes-D1GQdG8e.cjs.map → ingestTypes-C7IJSqv4.cjs.map} +1 -1
  44. package/dist/{ingestTypes-XReG-li7.js → ingestTypes-DmtDLRmt.js} +2 -2
  45. package/dist/{ingestTypes-XReG-li7.js.map → ingestTypes-DmtDLRmt.js.map} +1 -1
  46. package/dist/notifier/index.cjs +1 -1
  47. package/dist/notifier/index.js +1 -1
  48. package/dist/{notifier-CMFlw74b.js → notifier-Dxh8mEFh.js} +2 -2
  49. package/dist/{notifier-CMFlw74b.js.map → notifier-Dxh8mEFh.js.map} +1 -1
  50. package/dist/{notifier-C3IhYxqh.cjs → notifier-Wc4M24Bi.cjs} +2 -2
  51. package/dist/{notifier-C3IhYxqh.cjs.map → notifier-Wc4M24Bi.cjs.map} +1 -1
  52. package/dist/plugin-vue/index.cjs +4 -2
  53. package/dist/plugin-vue/index.cjs.map +1 -1
  54. package/dist/plugin-vue/index.js +4 -2
  55. package/dist/plugin-vue/index.js.map +1 -1
  56. package/dist/{project-B9NSyr6L.js → project-B0j_Vf_Q.js} +7 -2
  57. package/dist/project-B0j_Vf_Q.js.map +1 -0
  58. package/dist/{project-CCtT_fQr.cjs → project-C1ep9pvo.cjs} +7 -2
  59. package/dist/project-C1ep9pvo.cjs.map +1 -0
  60. package/dist/{promptSafety-FD8cQn3e.cjs → promptSafety-B52GvaJc.cjs} +99 -85
  61. package/dist/promptSafety-B52GvaJc.cjs.map +1 -0
  62. package/dist/{promptSafety-C--op_6a.js → promptSafety-DJgaDjM4.js} +99 -85
  63. package/dist/promptSafety-DJgaDjM4.js.map +1 -0
  64. package/dist/remote-host/index.cjs +2 -1
  65. package/dist/remote-host/index.d.ts +10 -0
  66. package/dist/remote-host/index.js +2 -2
  67. package/dist/remote-host/server/index.cjs +2 -2
  68. package/dist/remote-host/server/index.cjs.map +1 -1
  69. package/dist/remote-host/server/index.js +2 -2
  70. package/dist/remote-host/server/index.js.map +1 -1
  71. package/dist/{remote-host-DkDVxNim.cjs → remote-host-CtQjagPt.cjs} +53 -1
  72. package/dist/remote-host-CtQjagPt.cjs.map +1 -0
  73. package/dist/remote-host-Dba4lF3Z.js +82 -0
  74. package/dist/remote-host-Dba4lF3Z.js.map +1 -0
  75. package/dist/remote-view/index.cjs +6 -4
  76. package/dist/remote-view/index.cjs.map +1 -1
  77. package/dist/remote-view/index.js +6 -4
  78. package/dist/remote-view/index.js.map +1 -1
  79. package/dist/scheduler/index.cjs +1 -1
  80. package/dist/scheduler/index.js +1 -1
  81. package/dist/{server-Ci_A3chZ.js → server-D6EUf3BF.js} +46 -27
  82. package/dist/server-D6EUf3BF.js.map +1 -0
  83. package/dist/{server-B_b0bLSW.cjs → server-D7_oRbTJ.cjs} +46 -27
  84. package/dist/server-D7_oRbTJ.cjs.map +1 -0
  85. package/dist/utils/index.cjs +1 -1
  86. package/dist/utils/index.js +1 -1
  87. package/dist/whisper/index.cjs +2 -6
  88. package/dist/whisper/index.cjs.map +1 -1
  89. package/dist/whisper/index.js +2 -6
  90. package/dist/whisper/index.js.map +1 -1
  91. package/dist/wiki/index.cjs +2 -2
  92. package/dist/wiki/index.cjs.map +1 -1
  93. package/dist/wiki/index.js +2 -2
  94. package/dist/wiki/index.js.map +1 -1
  95. package/package.json +2 -2
  96. package/dist/discovery-D-ZJ6a6z.js.map +0 -1
  97. package/dist/discovery-DAoMnBYM.cjs.map +0 -1
  98. package/dist/project-B9NSyr6L.js.map +0 -1
  99. package/dist/project-CCtT_fQr.cjs.map +0 -1
  100. package/dist/promptSafety-C--op_6a.js.map +0 -1
  101. package/dist/promptSafety-FD8cQn3e.cjs.map +0 -1
  102. package/dist/remote-host-D_BRFHcI.js +0 -36
  103. package/dist/remote-host-D_BRFHcI.js.map +0 -1
  104. package/dist/remote-host-DkDVxNim.cjs.map +0 -1
  105. package/dist/server-B_b0bLSW.cjs.map +0 -1
  106. package/dist/server-Ci_A3chZ.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { a as isErrorWithCode, o as isRecord, r as hasNumberProp } from "./dist-DP1FTGnO.js";
1
+ import { a as isErrorWithCode, l as isUnknownArray, r as hasNumberProp, s as isRecord } from "./dist-D8zokgGo.js";
2
2
  import { t as writeFileAtomic } from "./atomic-DPpdrJzO.js";
3
- import { A as fieldTextOrNull, C as FEED_SCHEDULES, D as isReadOnlySchema, O as storageKindFor, S as COMPUTED_TYPES, g as SAFE_SLUG_PATTERN, h as SAFE_RECORD_ID_PATTERN, k as fieldText, v as isSafeRecordId, w as INGEST_KINDS, x as AGENT_INGEST_KIND, y as isSafeSlug } from "./calendarGrid-CrGxeCOG.js";
4
- import { n as projectRecordFields } from "./project-B9NSyr6L.js";
3
+ import { A as fieldTextOrNull, C as FEED_SCHEDULES, D as isReadOnlySchema, O as storageKindFor, S as COMPUTED_TYPES, g as SAFE_SLUG_PATTERN, h as SAFE_RECORD_ID_PATTERN, k as fieldText, v as isSafeRecordId, w as INGEST_KINDS, x as AGENT_INGEST_KIND, y as isSafeSlug } from "./calendarGrid-DivcNKkX.js";
4
+ import { n as projectRecordFields } from "./project-B0j_Vf_Q.js";
5
5
  import { n as isSafeCustomViewI18nPath, r as isSafeCustomViewPath, t as isSafeActionTemplatePath } from "./templatePath-k_WNbL_Q.js";
6
6
  import { realpathSync, watch } from "node:fs";
7
7
  import path from "node:path";
@@ -142,7 +142,7 @@ function realpathClosestAncestor(absPath) {
142
142
  while (cursor !== path.dirname(cursor)) try {
143
143
  return realpathSync(cursor);
144
144
  } catch (err) {
145
- if (err.code === "ENOENT") {
145
+ if (isErrorWithCode(err) && err.code === "ENOENT") {
146
146
  cursor = path.dirname(cursor);
147
147
  continue;
148
148
  }
@@ -246,8 +246,7 @@ async function isRegularFile(filePath) {
246
246
  * null when it isn't a JSON object (array / scalar / null). */
247
247
  function parseRecordJson(raw) {
248
248
  const parsed = JSON.parse(raw);
249
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) return parsed;
250
- return null;
249
+ return isRecord(parsed) ? parsed : null;
251
250
  }
252
251
  async function tryReadRecord(filePath) {
253
252
  if (!await isRegularFile(filePath)) return null;
@@ -272,7 +271,7 @@ async function listItems(dataDir, opts = {}) {
272
271
  try {
273
272
  entries = await readdir(dataDir);
274
273
  } catch (err) {
275
- if (err.code === "ENOENT") return [];
274
+ if (isErrorWithCode(err) && err.code === "ENOENT") return [];
276
275
  throw err;
277
276
  }
278
277
  const results = [];
@@ -302,7 +301,7 @@ async function readItem(dataDir, itemId, opts = {}) {
302
301
  try {
303
302
  return parseRecordJson(await readFile(filePath, "utf-8"));
304
303
  } catch (err) {
305
- if (err.code === "ENOENT") return null;
304
+ if (isErrorWithCode(err) && err.code === "ENOENT") return null;
306
305
  throw err;
307
306
  }
308
307
  }
@@ -372,7 +371,7 @@ async function writeItem(dataDir, itemId, item, opts = {}) {
372
371
  try {
373
372
  handle = await open(filePath, "wx");
374
373
  } catch (err) {
375
- if (err.code === "EEXIST") return {
374
+ if (isErrorWithCode(err) && err.code === "EEXIST") return {
376
375
  kind: "conflict",
377
376
  itemId: safeId
378
377
  };
@@ -418,7 +417,7 @@ async function deleteItem(dataDir, itemId, opts = {}) {
418
417
  itemId: safeId
419
418
  };
420
419
  } catch (err) {
421
- if (err.code === "ENOENT") return {
420
+ if (isErrorWithCode(err) && err.code === "ENOENT") return {
422
421
  kind: "not-found",
423
422
  itemId: safeId
424
423
  };
@@ -596,7 +595,7 @@ function whereFragment(cond) {
596
595
  }
597
596
  if (cond.op === "contains") return {
598
597
  sql: `contains(${asText}, ?)`,
599
- params: [String(cond.value)]
598
+ params: [String(scalarValue(cond))]
600
599
  };
601
600
  const operator = {
602
601
  eq: "=",
@@ -608,9 +607,16 @@ function whereFragment(cond) {
608
607
  }[cond.op];
609
608
  return {
610
609
  sql: `${typeof cond.value === "string" && (cond.op === "eq" || cond.op === "ne") ? asText : column} ${operator} ?`,
611
- params: [cond.value]
610
+ params: [scalarValue(cond)]
612
611
  };
613
612
  }
613
+ /** `CollectionQueryZ` refines "`in` ⇔ array value", so an array reaching a
614
+ * scalar op means the query was compiled without being validated first —
615
+ * binding it would send an array to a single `?`. */
616
+ function scalarValue(cond) {
617
+ if (Array.isArray(cond.value)) throw new Error(`where condition on '${cond.field}' uses op '${cond.op}', which requires a scalar value, not an array`);
618
+ return cond.value;
619
+ }
614
620
  /** Compile a validated query against `fromSql` (a table-function call
615
621
  * whose FIRST placeholder is the source path — the executor binds it).
616
622
  * Returns the SQL and the where-value parameters that follow the path.
@@ -832,7 +838,7 @@ async function safeCsvStat(absPath, workspaceRoot) {
832
838
  try {
833
839
  info = await lstat(absPath);
834
840
  } catch (err) {
835
- if (err.code === "ENOENT") return null;
841
+ if (isErrorWithCode(err) && err.code === "ENOENT") return null;
836
842
  throw err;
837
843
  }
838
844
  if (!info.isFile()) {
@@ -1046,7 +1052,7 @@ function projectItemFields(items, fields, primaryKey) {
1046
1052
  * tests. `limit: 0` is a valid "count only" page. */
1047
1053
  function pageFromFullRead(items, opts, primaryKey, truncated) {
1048
1054
  const offset = Math.max(0, opts.offset ?? 0);
1049
- const end = opts.limit === void 0 ? void 0 : offset + Math.max(0, opts.limit);
1055
+ const end = opts.limit === void 0 ? items.length : offset + Math.max(0, opts.limit);
1050
1056
  return {
1051
1057
  items: projectItemFields(items.slice(offset, end), opts.fields, primaryKey),
1052
1058
  total: items.length,
@@ -2171,7 +2177,7 @@ var SpawnZ = z.object({
2171
2177
  * items natively and ignore it — so no kind-specific requirement here. */
2172
2178
  var DeclarativeIngestZ = z.object({
2173
2179
  kind: z.enum(INGEST_KINDS),
2174
- url: z.string().url(),
2180
+ url: z.url(),
2175
2181
  schedule: z.enum(FEED_SCHEDULES),
2176
2182
  atHour: z.number().int().min(0).max(23).optional(),
2177
2183
  itemsAt: z.string().trim().min(1).optional(),
@@ -2426,23 +2432,38 @@ function ownPrototypeKey(value) {
2426
2432
  for (const key of PROTOTYPE_KEYS) if (Object.hasOwn(value, key)) return key;
2427
2433
  return null;
2428
2434
  }
2435
+ /** Own enumerable entries of an object (arrays keyed by index), none for
2436
+ * anything else — the raw input is unvalidated, so `fields` may be junk. */
2437
+ function ownEntries(value) {
2438
+ if (isUnknownArray(value)) return value.map((entry, index) => [String(index), entry]);
2439
+ return isRecord(value) ? Object.entries(value) : [];
2440
+ }
2441
+ /** The name-defining sub-record a raw field spec (`of`) or action (`params`)
2442
+ * carries, or undefined when the holder isn't an object at all. */
2443
+ function nameDefiningSubRecord(holder, key) {
2444
+ return isRecord(holder) ? holder[key] : void 0;
2445
+ }
2446
+ /** Dotted path of the first prototype-sensitive `params` name across both
2447
+ * action lists, or null. */
2448
+ function prototypeActionParamPath(input) {
2449
+ for (const [listName, list] of [["actions", input.actions], ["collectionActions", input.collectionActions]]) for (const action of isUnknownArray(list) ? list : []) {
2450
+ const badParam = ownPrototypeKey(nameDefiningSubRecord(action, "params"));
2451
+ if (badParam !== null) return `${listName}.params.${badParam}`;
2452
+ }
2453
+ return null;
2454
+ }
2429
2455
  /** Dotted path of the first prototype-sensitive field name in the raw
2430
2456
  * schema input — top-level `fields`, each table field's `of`, and each
2431
2457
  * action's `params` (the three records that DEFINE names) — or null. */
2432
2458
  function prototypeFieldKeyPath(input) {
2433
- if (input === null || typeof input !== "object") return null;
2434
- const schema = input;
2435
- const bad = ownPrototypeKey(schema.fields);
2459
+ if (!isRecord(input)) return null;
2460
+ const bad = ownPrototypeKey(input.fields);
2436
2461
  if (bad !== null) return `fields.${bad}`;
2437
- for (const [key, spec] of Object.entries(schema.fields ?? {})) {
2438
- const badSub = ownPrototypeKey(spec?.of);
2462
+ for (const [key, spec] of ownEntries(input.fields)) {
2463
+ const badSub = ownPrototypeKey(nameDefiningSubRecord(spec, "of"));
2439
2464
  if (badSub !== null) return `fields.${key}.of.${badSub}`;
2440
2465
  }
2441
- for (const [listName, list] of [["actions", schema.actions], ["collectionActions", schema.collectionActions]]) for (const action of Array.isArray(list) ? list : []) {
2442
- const badParam = ownPrototypeKey(action?.params);
2443
- if (badParam !== null) return `${listName}.params.${badParam}`;
2444
- }
2445
- return null;
2466
+ return prototypeActionParamPath(input);
2446
2467
  }
2447
2468
  var CollectionSchemaZ = z.preprocess((input, ctx) => {
2448
2469
  const bad = prototypeFieldKeyPath(input);
@@ -2458,11 +2479,10 @@ var CollectionSchemaZ = z.preprocess((input, ctx) => {
2458
2479
  //#endregion
2459
2480
  //#region src/collection/server/discovery.ts
2460
2481
  function applyFeedSchemaDefaults(parsed, slug) {
2461
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return parsed;
2462
- const obj = parsed;
2463
- const icon = typeof obj.icon === "string" && obj.icon.trim().length > 0 ? obj.icon : "dynamic_feed";
2482
+ if (!isRecord(parsed)) return parsed;
2483
+ const icon = typeof parsed.icon === "string" && parsed.icon.trim().length > 0 ? parsed.icon : "dynamic_feed";
2464
2484
  return {
2465
- ...obj,
2485
+ ...parsed,
2466
2486
  icon,
2467
2487
  dataPath: `data/feeds/${slug}`
2468
2488
  };
@@ -2565,7 +2585,7 @@ async function loadOneCollection(skillsRoot, slug, source, workspaceRoot) {
2565
2585
  if (!(await stat(schemaPath)).isFile()) return null;
2566
2586
  raw = await readFile(schemaPath, "utf-8");
2567
2587
  } catch (err) {
2568
- if (err.code !== "ENOENT") log.warn("collections", "failed to read schema.json, skipping", {
2588
+ if (!isErrorWithCode(err) || err.code !== "ENOENT") log.warn("collections", "failed to read schema.json, skipping", {
2569
2589
  slug: safeName,
2570
2590
  path: schemaPath,
2571
2591
  error: String(err)
@@ -2619,7 +2639,7 @@ async function collectFromDir(skillsRoot, source, workspaceRoot) {
2619
2639
  try {
2620
2640
  entries = await readdir(skillsRoot);
2621
2641
  } catch (err) {
2622
- if (err.code === "ENOENT") return [];
2642
+ if (isErrorWithCode(err) && err.code === "ENOENT") return [];
2623
2643
  log.warn("collections", "failed to list skills dir, returning empty", {
2624
2644
  root: skillsRoot,
2625
2645
  error: String(err)
@@ -2695,4 +2715,4 @@ function toDetail(collection) {
2695
2715
  //#endregion
2696
2716
  export { skillsStagingDir as $, deleteItem as A, itemFilePath as B, compileCsvQuery as C, MAX_QUERY_ROWS as D, DEFAULT_QUERY_ROWS as E, resolveCreateItemId as F, archiveDir as G, resolveTemplatePath as H, writeItem as I, getWorkspaceRoot as J, collectionsRegistriesConfigPath as K, SCHEMA_FILE as L, isRegularFile as M, listItems as N, BackendUnavailableError as O, readItem as P, setCollectionChangePublisher as Q, isContainedInRoot as R, queryCsv as S, CollectionQueryZ as T, safeRecordId as U, resolveDataDir as V, safeSlugName as W, log as X, isPresetSlug as Y, publishCollectionChange as Z, csvRowToItem as _, toDetail as a, encodeCsvRecordId as b, resolveMutateSet as c, storeFor as d, createForwardingLogger as et, checkpointSqliteDatabase as f, cacheDir as g, MAX_CSV_ROWS as h, resolvePrimaryField as i, generateItemId as j, isBackendUnavailable as k, collectionWritable as l, projectItemFields as m, discoverCollections as n, toSummary as o, pageFromFullRead as p, configureCollectionHost as q, loadCollection as r, CollectionSchemaZ as s, acceptParsedSchema as t, createHostSlot as tt, readOnlyRefusal as u, decodeCsvRecordId as v, compileJsonlQuery as w, normalizeCsvValue as x, dedupeByRecordId as y, isContainedInWorkspace as z };
2697
2717
 
2698
- //# sourceMappingURL=discovery-D-ZJ6a6z.js.map
2718
+ //# sourceMappingURL=discovery-D6p4ITNR.js.map