@mulmoclaude/core 5.10.1 → 5.11.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.
@@ -2344,6 +2344,20 @@ async function handlePutSchema(slug, schemaArg, deps) {
2344
2344
  });
2345
2345
  }
2346
2346
  var MANAGE_COLLECTION_PROMPT = "Use `manageCollection` instead of raw Read/Write/Edit when working with a collection's records OR its schema (raw file I/O stays available as the escape hatch). Before authoring or changing a collection's `schema.json`, call `schemaDocs` to load the field/DSL reference — the default reply is the core authoring guide plus a table of contents; fetch advanced sections (actions, bells, calendar/kanban views, dataSource, storage) by passing their heading as `topic` rather than dumping `topic: \"all\"`. Then read with `getSchema` and write with `putSchema` — `putSchema` validates the whole schema before writing and returns actionable errors instead of silently failing discovery's validation. `getItems` is the only way to see computed values — `derived` fields (e.g. a portfolio's value), `toggle` projections, and `embed` records are host-computed and never present in the stored JSON files. On large collections pass `ids` and/or `fields` to keep the result small. For a question that spans collections (\"which clients have unpaid invoices?\"), start with `getOntology`: it lists every collection with its primaryKey, record count, and outbound `ref`/`embed` relations, so you know which collections to join before reading any records. `putItems` GATES every row on what would make the record unopenable — required fields, enum values, primaryKey = record id — and returns `{ written, rejected }`; fix each rejected row using its `problem` text and retry just those rows. Never include computed fields in a row you write. That gate does NOT check the SHAPE of a value: a `datetime` written as an instant (`2026-08-17T15:00:00.000Z`, what `toISOString()` produces) rather than as a wall clock, a `number` holding something that is not a number at all, a `date` that is not a real day are all WRITTEN, and come back in a `lint` block beside `written`. Read it — a full `getItems` listing warns about the same rows and publishing a shared app REFUSES them, so a silent `lint` is the only proof the values are right. Before generating a large set, read the exact stored form of each type in the `Field types` section of `schemaDocs` (`topic: \"Field types\"` fetches just that one), then write ONE batch and check that `lint` is absent. `datetime` in particular is a local wall clock (`YYYY-MM-DDTHH:MM`, no timezone suffix; a bare `YYYY-MM-DD` means ALL DAY and is not the same as `…T00:00`, a real midnight start), so `new Date(...).toISOString()` is wrong twice over — the suffix, and the hours the conversion moved. The one `Z`-suffixed datetime the strict tier accepts is a shared app's server-stamped instant, written by the SERVER with nine fractional digits; you never produce that value. When the rows come from a script rather than from you (a generated schedule, an imported set, anything past a few dozen records), write them to a JSON file UNDER THE WORKSPACE and pass its absolute path as `itemsFile` instead of `items` — the host reads the file, so the rows never pass through your context. Do NOT hand-transcribe a generated file into `items`, and never drive the collection by spawning the MCP bridge yourself. To update a few fields of an existing record, use `mode: \"merge\"` with a partial row ({ id, <changed fields> }) — the default upsert replaces the WHOLE record, so a partial upsert would silently erase every optional field it omits. `deleteItems` removes records by id and returns `{ deleted, rejected }`; an id that doesn't exist comes back rejected rather than counted as deleted, so check `rejected` before reporting a deletion as done. Answer aggregation questions (counts, sums, averages, group-bys) with `queryItems` on ANY collection — on a dataSource (CSV) collection it scans the whole file (getItems is row-capped, so aggregates computed from its output can be silently wrong on large files); on a file-backed collection it aggregates the enriched records, so computed fields (derived/rollup/toggle) are queryable columns.";
2347
+ var MANAGE_COLLECTION_REFERENCE_FILE = "manageCollection.md";
2348
+ /** Injected instead of the full prompt by a host that supports `promptCompact` /
2349
+ * `promptFiles` (`../../prompt-files`). Keeps every rule that decides whether to
2350
+ * call the tool, and the one write rule whose omission loses data (a partial
2351
+ * upsert erases fields); the write-gate / lint / field-format detail is behind
2352
+ * the Read. */
2353
+ var MANAGE_COLLECTION_PROMPT_COMPACT = [
2354
+ "Use `manageCollection` instead of raw Read/Write/Edit for a collection's records or schema.",
2355
+ "`getItems` is the only way to see computed values (`derived`, `toggle`, `embed`); pass `ids` / `fields` on large collections.",
2356
+ "Start a cross-collection question with `getOntology`, and answer counts / sums / averages / group-bys with `queryItems`.",
2357
+ "Before changing a `schema.json`, call `schemaDocs`, then `getSchema` / `putSchema`.",
2358
+ "To update a few fields use `mode: \"merge\"` — the default upsert replaces the WHOLE record and erases every optional field the row omits.",
2359
+ `Before writing or deleting records (\`putItems\`, \`itemsFile\`, \`deleteItems\`), Read {{promptFilesDir}}/${MANAGE_COLLECTION_REFERENCE_FILE} for the write gate, the \`lint\` block and the stored form of each field type.`
2360
+ ].join(" ");
2347
2361
  /** Validate getItems' optional `ids`/`fields` args, then delegate. */
2348
2362
  async function dispatchGetItems(collection, args, deps) {
2349
2363
  const ids = optionalStringArray(args.ids, "ids");
@@ -2470,6 +2484,8 @@ function makeManageCollectionTool(deps = {}) {
2470
2484
  definition: MANAGE_COLLECTION_DEFINITION,
2471
2485
  alwaysActive: true,
2472
2486
  prompt: MANAGE_COLLECTION_PROMPT,
2487
+ promptCompact: MANAGE_COLLECTION_PROMPT_COMPACT,
2488
+ promptFiles: { [MANAGE_COLLECTION_REFERENCE_FILE]: MANAGE_COLLECTION_PROMPT },
2473
2489
  handler: (args) => manageCollectionHandler(deps, args)
2474
2490
  };
2475
2491
  }
@@ -2715,4 +2731,4 @@ Object.defineProperty(exports, "validateRecordObject", {
2715
2731
  }
2716
2732
  });
2717
2733
 
2718
- //# sourceMappingURL=server-C-1R-aQ-.cjs.map
2734
+ //# sourceMappingURL=server-CJek9Y3Q.cjs.map