@agentshouse/mdruntime-adapter 0.1.0-alpha.18 → 0.1.0-alpha.19

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 (2) hide show
  1. package/AGENTS.md +36 -0
  2. package/package.json +2 -2
package/AGENTS.md CHANGED
@@ -36,6 +36,42 @@ owns their boundary.
36
36
  The in-memory Adapter at `@agentshouse/mdruntime/memory` is for tests and
37
37
  ships in no bundle.
38
38
 
39
+ ## Local Query rules
40
+
41
+ `query(q)` answers once from local state; `observe('query', q, listener)` hears
42
+ the whole result at once and again only when it changes. A query is data:
43
+
44
+ - **Filter.** `rooms` names Room locators and defaults to every Room. `types`
45
+ names MD Types, and `any` names the untyped Documents. `pathPrefix` is a
46
+ directory: `notes` keeps `notes/a.md` and not `notes2/a.md`.
47
+ - **Fields.** `where` names frontmatter fields, ANDs them, and nests `$and` and
48
+ `$or`. A bare value is equality; the operators are `$eq`, `$ne`, `$in`, `$nin`,
49
+ `$gt`, `$gte`, `$lt`, `$lte`, `$all`, `$size` and `$exists`. Equality on a list
50
+ asks whether it contains the value. Missing, null and empty differ:
51
+ `$exists: false` keeps a missing field, `null` an explicit null, `''` empty
52
+ text and `$size: 0` an empty list. A date compares in calendar order and never
53
+ with a date-time. A reference compares by the Room Path it resolves to.
54
+ Untyped frontmatter is plain values. There is no text containment or regular
55
+ expression.
56
+ - **Relations.** `hop: { field, types, where, pathPrefix }` keeps Documents whose
57
+ reference `field` points to a matching Document of the same Room.
58
+ `backlinks: { field, types, where, pathPrefix }` keeps Documents that a
59
+ matching Document of the same Room references. Each keeps a Document once.
60
+ - **Parts.** A Document query must `select`: `'all'`, or `fields`, `sections`,
61
+ `preamble`, `markdown` and `backlinks`, where `fields` and `sections` are
62
+ `'all'` or a list of names. Room, Path and MD Type always return, and an
63
+ unselected part is absent. Select only what a screen shows: a list that selects
64
+ the Markdown hears every edit of it.
65
+ - **Order and groups.** `orderBy` sorts by `room`, `path`, `type` or `{ field }`
66
+ with TanStack DB's own options, and ties end with Room, then Path. `groupBy` by
67
+ `room`, `type` or `{ field }` answers `{ groups: [{ key, count }] }`, counted
68
+ over every match and ordered by `count` or a key. `limit` bounds the Documents
69
+ or the groups.
70
+ - **Results and errors.** A result carries no Room Version: read freshness from
71
+ Rooms and Sync Status. An invalid query fails with `invalid-query`,
72
+ `unknown-type`, `unknown-field` or `wrong-kind`, naming where, and never
73
+ answers an empty result in its place.
74
+
39
75
  ## Room Draft, Save, and outcome rules
40
76
 
41
77
  The MD Runtime owns one Room Draft per Room and Path, shared by every App and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdruntime-adapter",
3
- "version": "0.1.0-alpha.18",
3
+ "version": "0.1.0-alpha.19",
4
4
  "description": "Agents House Adapter for the MD Runtime",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -34,6 +34,6 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@agentshouse/mdmodel": "0.1.0-alpha.14",
37
- "@agentshouse/mdruntime": "0.1.0-alpha.24"
37
+ "@agentshouse/mdruntime": "0.1.0-alpha.25"
38
38
  }
39
39
  }