@mulmoclaude/core 4.0.1 → 4.1.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 (34) hide show
  1. package/assets/helps/collection-skills.md +6 -1
  2. package/dist/collection/core/draft.d.ts +9 -1
  3. package/dist/collection/core/fieldDefaults.d.ts +28 -0
  4. package/dist/collection/core/schemaZ.d.ts +3 -0
  5. package/dist/collection/index.cjs +18 -7
  6. package/dist/collection/index.cjs.map +1 -1
  7. package/dist/collection/index.d.ts +1 -0
  8. package/dist/collection/index.js +16 -8
  9. package/dist/collection/index.js.map +1 -1
  10. package/dist/collection/registry/server/index.cjs +2 -2
  11. package/dist/collection/registry/server/index.js +2 -2
  12. package/dist/collection/server/index.cjs +2 -2
  13. package/dist/collection/server/index.js +2 -2
  14. package/dist/collection-watchers/index.cjs +3 -3
  15. package/dist/collection-watchers/index.js +3 -3
  16. package/dist/{discovery-C_3gXoin.cjs → discovery-B9EESjHP.cjs} +15 -3
  17. package/dist/{discovery-C_3gXoin.cjs.map → discovery-B9EESjHP.cjs.map} +1 -1
  18. package/dist/{discovery-CQp0wi-n.js → discovery-D88x2DmW.js} +15 -3
  19. package/dist/{discovery-CQp0wi-n.js.map → discovery-D88x2DmW.js.map} +1 -1
  20. package/dist/feeds/server/index.cjs +2 -2
  21. package/dist/feeds/server/index.js +2 -2
  22. package/dist/google/index.cjs +1 -1
  23. package/dist/google/index.js +1 -1
  24. package/dist/{promptSafety-CSdyp7RF.js → promptSafety-CJ-sC1pX.js} +43 -2
  25. package/dist/promptSafety-CJ-sC1pX.js.map +1 -0
  26. package/dist/{promptSafety-CWqYq-NS.cjs → promptSafety-CuczAN9d.cjs} +60 -1
  27. package/dist/promptSafety-CuczAN9d.cjs.map +1 -0
  28. package/dist/{server-CF_tGCGP.cjs → server-DSrRdPvf.cjs} +11 -5
  29. package/dist/{server-CF_tGCGP.cjs.map → server-DSrRdPvf.cjs.map} +1 -1
  30. package/dist/{server-BIewQYpC.js → server-dijB4BYv.js} +11 -5
  31. package/dist/{server-BIewQYpC.js.map → server-dijB4BYv.js.map} +1 -1
  32. package/package.json +1 -1
  33. package/dist/promptSafety-CSdyp7RF.js.map +0 -1
  34. package/dist/promptSafety-CWqYq-NS.cjs.map +0 -1
@@ -2,8 +2,8 @@ import { a as isErrorWithCode, c as isStringArray, l as isUnknownArray, s as isR
2
2
  import { n as writeFileAtomic } from "./root-BMroU_mB.js";
3
3
  import { n as toPosixRelPath } from "./relPath-DW8MC8VO.js";
4
4
  import { B as fieldText, I as embedTargetId, L as isFieldDrivenEvery, N as COMPUTED_TYPES, V as fieldTextOrNull, d as parseIsoDate, f as parseIsoDateTime, z as storageKindFor } from "./itemId-DfTm08jm.js";
5
- import { C as actionVisible, _ as uniqueRefTargets, b as projectBacklinkRow, c as selectDynamicRecord, f as itemIsDone, g as uniqueEmbedTargets, h as uniqueBacklinkSources, i as ownProp, n as deriveAll, o as firstDateField, s as resolveIcon, t as defangForPrompt, v as backlinkRows, x as rollupValue, y as coerceNumeric } from "./promptSafety-CSdyp7RF.js";
6
- import { B as SCHEMA_FILE$1, C as CollectionQueryZ, J as isBackendUnavailable, K as safeSlugName, O as isRegularFile, S as compileJsonlQuery, U as resolveDataDir, V as isContainedInRoot, W as resolveTemplatePath, X as archiveDir, b as queryCsv, c as resolveMutateSet, d as storeFor, f as checkpointSqliteDatabase, ht as stagingSkillDir, i as resolvePrimaryField, it as isPresetSlug$1, j as resolveCreateItemId, m as cacheDir, n as discoverCollections, nt as getWorkspaceRoot, ot as log, r as loadCollection, s as CollectionSchemaZ, u as readOnlyRefusal, y as normalizeCsvValue } from "./discovery-CQp0wi-n.js";
5
+ import { C as actionVisible, O as firstUnknownDefault, _ as uniqueRefTargets, b as projectBacklinkRow, c as selectDynamicRecord, f as itemIsDone, g as uniqueEmbedTargets, h as uniqueBacklinkSources, i as ownProp, k as schemaDefaults, n as deriveAll, o as firstDateField, s as resolveIcon, t as defangForPrompt, v as backlinkRows, x as rollupValue, y as coerceNumeric } from "./promptSafety-CJ-sC1pX.js";
6
+ import { B as SCHEMA_FILE$1, C as CollectionQueryZ, J as isBackendUnavailable, K as safeSlugName, O as isRegularFile, S as compileJsonlQuery, U as resolveDataDir, V as isContainedInRoot, W as resolveTemplatePath, X as archiveDir, b as queryCsv, c as resolveMutateSet, d as storeFor, f as checkpointSqliteDatabase, ht as stagingSkillDir, i as resolvePrimaryField, it as isPresetSlug$1, j as resolveCreateItemId, m as cacheDir, n as discoverCollections, nt as getWorkspaceRoot, ot as log, r as loadCollection, s as CollectionSchemaZ, u as readOnlyRefusal, y as normalizeCsvValue } from "./discovery-D88x2DmW.js";
7
7
  import { ingestStatePath } from "./feeds/paths.js";
8
8
  import { mirrorSkillWrite } from "./skill-bridge/index.js";
9
9
  import path from "node:path";
@@ -1712,7 +1712,11 @@ async function mergeWithExisting(collection, store, record, itemId) {
1712
1712
  }
1713
1713
  async function putOneItem(collection, store, write, record, mode, deps) {
1714
1714
  const { schema } = collection;
1715
- const itemId = resolveCreateItemId(schema, record);
1715
+ const created = mode === "create" ? {
1716
+ ...schemaDefaults(schema),
1717
+ ...record
1718
+ } : record;
1719
+ const itemId = resolveCreateItemId(schema, created);
1716
1720
  const reject = (about, problem) => ({ rejected: {
1717
1721
  id: defangForPrompt(about),
1718
1722
  problem: defangForPrompt(problem)
@@ -1720,7 +1724,7 @@ async function putOneItem(collection, store, write, record, mode, deps) {
1720
1724
  if (itemId === null) return reject("(no id)", `record has no '${schema.primaryKey}' value — set it (it doubles as the filename)`);
1721
1725
  const computed = computedKeyProblem(record, schema);
1722
1726
  if (computed) return reject(itemId, computed);
1723
- let toWrite = record;
1727
+ let toWrite = created;
1724
1728
  if (mode === "merge") {
1725
1729
  const merged = await mergeWithExisting(collection, store, record, itemId);
1726
1730
  if (typeof merged === "string") return reject(itemId, merged);
@@ -1944,6 +1948,8 @@ async function handlePutSchema(slug, schemaArg, deps) {
1944
1948
  if (refusal) return refusal;
1945
1949
  const parsed = CollectionSchemaZ.safeParse(schemaArg);
1946
1950
  if (!parsed.success) return formatSchemaIssues(parsed.error.issues);
1951
+ const unknownDefault = firstUnknownDefault(parsed.data);
1952
+ if (unknownDefault) return `manageCollection: schema rejected — field '${defangForPrompt(unknownDefault.key)}' has default '${defangForPrompt(unknownDefault.value)}', which is not one of its values (${unknownDefault.values.map(defangForPrompt).join(", ")}).`;
1947
1953
  const gate = schemaDiscoveryGate(parsed.data, resolveBase(deps));
1948
1954
  if (gate) return `manageCollection: schema rejected — ${gate} (call schemaDocs for the field reference). It passes basic validation but discovery would skip it, hiding the collection.`;
1949
1955
  await writeAndMirrorSchema(collection.slug, collection.skillDir, parsed.data, deps);
@@ -2081,4 +2087,4 @@ function makeManageCollectionTool(deps = {}) {
2081
2087
  //#endregion
2082
2088
  export { runQueryOverRows as A, STORE_UNREADABLE as C, recordFieldProblem as D, compileRecordZ as E, readCustomViewI18n as F, readSkillTemplate as I, buildCollectionActionSeedPrompt as M, promptPathsFor as N, runCollectionQuery as O, readCustomViewHtml as P, MAX_RECORD_ISSUES as S, validateRecordObject as T, computeCollectionIcon as _, deleteCollection as a, applyMutateAction as b, computeSuccessor as c, isTriggerDue as d, maybeSpawnSuccessor as f, ONE_SECOND_MS as g, successorId as h, deleteCustomView as i, buildActionSeedPrompt as j, enrichItems as k, daysInMonth as l, resolveEvery as m, MAX_UNSELECTIVE_ITEMS as n, deleteCollectionRefusalMessage as o, parseCivil as p, makeManageCollectionTool as r, advanceTriggerDate as s, MAX_SCHEMA_ISSUES as t, formatCivil as u, buildWorkspaceOntology as v, validateCollectionRecords as w, firstMutateParamProblem as x, schemaRelations as y };
2083
2089
 
2084
- //# sourceMappingURL=server-BIewQYpC.js.map
2090
+ //# sourceMappingURL=server-dijB4BYv.js.map