@agentshouse/mdruntime 0.1.0-cbb8d8acc9d19 → 0.1.0-cbbae1fff01c6

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 (324) hide show
  1. package/README.md +24 -11
  2. package/dist/acceptance.d.ts +3 -0
  3. package/dist/acceptance.d.ts.map +1 -0
  4. package/dist/acceptance.js +308 -0
  5. package/dist/actions.d.ts +20 -0
  6. package/dist/actions.d.ts.map +1 -0
  7. package/dist/actions.js +251 -0
  8. package/dist/adapter.d.ts +194 -90
  9. package/dist/adapter.d.ts.map +1 -1
  10. package/dist/attached-model.d.ts +7 -10
  11. package/dist/attached-model.d.ts.map +1 -1
  12. package/dist/attached-model.js +40 -41
  13. package/dist/attempt.d.ts +16 -0
  14. package/dist/attempt.d.ts.map +1 -0
  15. package/dist/attempt.js +70 -0
  16. package/dist/binary.d.ts +18 -0
  17. package/dist/binary.d.ts.map +1 -0
  18. package/dist/binary.js +8 -0
  19. package/dist/bootstrap.d.ts +37 -5
  20. package/dist/bootstrap.d.ts.map +1 -1
  21. package/dist/bootstrap.js +324 -52
  22. package/dist/cell.d.ts +6 -0
  23. package/dist/cell.d.ts.map +1 -0
  24. package/dist/cell.js +9 -0
  25. package/dist/chain.d.ts +12 -0
  26. package/dist/chain.d.ts.map +1 -0
  27. package/dist/chain.js +64 -0
  28. package/dist/change-set.d.ts +13 -14
  29. package/dist/change-set.d.ts.map +1 -1
  30. package/dist/change-set.js +17 -56
  31. package/dist/change.d.ts +46 -0
  32. package/dist/change.d.ts.map +1 -1
  33. package/dist/change.js +36 -0
  34. package/dist/chat-types.d.ts +5 -0
  35. package/dist/chat-types.d.ts.map +1 -0
  36. package/dist/chat-types.js +13 -0
  37. package/dist/client.d.ts +56 -18
  38. package/dist/client.d.ts.map +1 -1
  39. package/dist/client.js +164 -23
  40. package/dist/collection.d.ts +31 -14
  41. package/dist/collection.d.ts.map +1 -1
  42. package/dist/collection.js +61 -55
  43. package/dist/compile.d.ts +16 -0
  44. package/dist/compile.d.ts.map +1 -0
  45. package/dist/compile.js +711 -0
  46. package/dist/connection.d.ts +8 -104
  47. package/dist/connection.d.ts.map +1 -1
  48. package/dist/connection.js +107 -2094
  49. package/dist/context.d.ts +2 -0
  50. package/dist/context.d.ts.map +1 -0
  51. package/dist/context.js +7 -0
  52. package/dist/conversation-live.d.ts +135 -0
  53. package/dist/conversation-live.d.ts.map +1 -0
  54. package/dist/conversation-live.js +247 -0
  55. package/dist/conversation-row.d.ts +33 -0
  56. package/dist/conversation-row.d.ts.map +1 -0
  57. package/dist/conversation-row.js +53 -0
  58. package/dist/conversation.d.ts +67 -44
  59. package/dist/conversation.d.ts.map +1 -1
  60. package/dist/conversation.js +1010 -549
  61. package/dist/declaration.d.ts +10 -0
  62. package/dist/declaration.d.ts.map +1 -0
  63. package/dist/declaration.js +24 -0
  64. package/dist/digest.d.ts +7 -0
  65. package/dist/digest.d.ts.map +1 -0
  66. package/dist/digest.js +113 -0
  67. package/dist/discovery.d.ts +10 -0
  68. package/dist/discovery.d.ts.map +1 -0
  69. package/dist/discovery.js +148 -0
  70. package/dist/durability.d.ts +19 -1
  71. package/dist/durability.d.ts.map +1 -1
  72. package/dist/durability.js +5 -0
  73. package/dist/entry.d.ts +20 -0
  74. package/dist/entry.d.ts.map +1 -0
  75. package/dist/entry.js +161 -0
  76. package/dist/expectation.d.ts +23 -0
  77. package/dist/expectation.d.ts.map +1 -0
  78. package/dist/expectation.js +92 -0
  79. package/dist/failure.d.ts +14 -0
  80. package/dist/failure.d.ts.map +1 -0
  81. package/dist/failure.js +22 -0
  82. package/dist/figures.d.ts +49 -0
  83. package/dist/figures.d.ts.map +1 -0
  84. package/dist/figures.js +197 -0
  85. package/dist/file.d.ts +2 -19
  86. package/dist/file.d.ts.map +1 -1
  87. package/dist/file.js +7 -122
  88. package/dist/holdings.d.ts +29 -0
  89. package/dist/holdings.d.ts.map +1 -0
  90. package/dist/holdings.js +95 -0
  91. package/dist/host.d.ts +28 -4
  92. package/dist/host.d.ts.map +1 -1
  93. package/dist/host.js +149 -27
  94. package/dist/identity.d.ts +3 -0
  95. package/dist/identity.d.ts.map +1 -1
  96. package/dist/identity.js +13 -1
  97. package/dist/index.d.ts +40 -10
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/index.js +17 -0
  100. package/dist/install.d.ts +54 -0
  101. package/dist/install.d.ts.map +1 -0
  102. package/dist/install.js +538 -0
  103. package/dist/job.d.ts +5 -0
  104. package/dist/job.d.ts.map +1 -0
  105. package/dist/job.js +7 -0
  106. package/dist/lifecycle.d.ts +7 -0
  107. package/dist/lifecycle.d.ts.map +1 -0
  108. package/dist/lifecycle.js +272 -0
  109. package/dist/listing.d.ts +48 -0
  110. package/dist/listing.d.ts.map +1 -0
  111. package/dist/listing.js +139 -0
  112. package/dist/live.d.ts +23 -0
  113. package/dist/live.d.ts.map +1 -0
  114. package/dist/live.js +165 -0
  115. package/dist/locks.d.ts +7 -0
  116. package/dist/locks.d.ts.map +1 -0
  117. package/dist/locks.js +33 -0
  118. package/dist/log.d.ts +1 -0
  119. package/dist/log.d.ts.map +1 -1
  120. package/dist/lost.d.ts +5 -0
  121. package/dist/lost.d.ts.map +1 -0
  122. package/dist/lost.js +50 -0
  123. package/dist/media.d.ts +8 -0
  124. package/dist/media.d.ts.map +1 -0
  125. package/dist/media.js +218 -0
  126. package/dist/memory.d.ts +25 -8
  127. package/dist/memory.d.ts.map +1 -1
  128. package/dist/memory.js +295 -99
  129. package/dist/messages.d.ts +49 -0
  130. package/dist/messages.d.ts.map +1 -0
  131. package/dist/messages.js +148 -0
  132. package/dist/model.d.ts +13 -13
  133. package/dist/model.d.ts.map +1 -1
  134. package/dist/model.js +7 -15
  135. package/dist/models.d.ts +10 -0
  136. package/dist/models.d.ts.map +1 -0
  137. package/dist/models.js +156 -0
  138. package/dist/name.d.ts +4 -0
  139. package/dist/name.d.ts.map +1 -0
  140. package/dist/name.js +122 -0
  141. package/dist/observation.d.ts +22 -4
  142. package/dist/observation.d.ts.map +1 -1
  143. package/dist/observation.js +127 -26
  144. package/dist/open.d.ts +2 -0
  145. package/dist/open.d.ts.map +1 -0
  146. package/dist/open.js +1 -0
  147. package/dist/opened.d.ts +22 -0
  148. package/dist/opened.d.ts.map +1 -0
  149. package/dist/opened.js +107 -0
  150. package/dist/opening.d.ts +4 -0
  151. package/dist/opening.d.ts.map +1 -0
  152. package/dist/opening.js +59 -0
  153. package/dist/outcome.d.ts +75 -5
  154. package/dist/outcome.d.ts.map +1 -1
  155. package/dist/outcome.js +84 -1
  156. package/dist/overlay.d.ts +17 -5
  157. package/dist/overlay.d.ts.map +1 -1
  158. package/dist/overlay.js +168 -190
  159. package/dist/parts.d.ts +11 -0
  160. package/dist/parts.d.ts.map +1 -0
  161. package/dist/parts.js +21 -0
  162. package/dist/paths.d.ts +2 -0
  163. package/dist/paths.d.ts.map +1 -1
  164. package/dist/paths.js +26 -0
  165. package/dist/preparation.d.ts +20 -0
  166. package/dist/preparation.d.ts.map +1 -0
  167. package/dist/preparation.js +233 -0
  168. package/dist/presence.d.ts +52 -0
  169. package/dist/presence.d.ts.map +1 -0
  170. package/dist/presence.js +220 -0
  171. package/dist/queries.d.ts +16 -0
  172. package/dist/queries.d.ts.map +1 -0
  173. package/dist/queries.js +270 -0
  174. package/dist/query.d.ts +51 -181
  175. package/dist/query.d.ts.map +1 -1
  176. package/dist/query.js +3 -461
  177. package/dist/questions.d.ts +34 -0
  178. package/dist/questions.d.ts.map +1 -0
  179. package/dist/questions.js +122 -0
  180. package/dist/queue.d.ts +40 -0
  181. package/dist/queue.d.ts.map +1 -0
  182. package/dist/queue.js +455 -0
  183. package/dist/reach.d.ts +21 -5
  184. package/dist/reach.d.ts.map +1 -1
  185. package/dist/reach.js +305 -80
  186. package/dist/react.d.ts +43 -20
  187. package/dist/react.d.ts.map +1 -1
  188. package/dist/react.js +22 -21
  189. package/dist/read.d.ts +7 -0
  190. package/dist/read.d.ts.map +1 -0
  191. package/dist/read.js +17 -0
  192. package/dist/readiness.d.ts +49 -0
  193. package/dist/readiness.d.ts.map +1 -0
  194. package/dist/readiness.js +27 -0
  195. package/dist/reads.d.ts +37 -0
  196. package/dist/reads.d.ts.map +1 -0
  197. package/dist/reads.js +174 -0
  198. package/dist/recovery.d.ts +26 -0
  199. package/dist/recovery.d.ts.map +1 -0
  200. package/dist/recovery.js +232 -0
  201. package/dist/refresh.d.ts +20 -7
  202. package/dist/refresh.d.ts.map +1 -1
  203. package/dist/refresh.js +155 -59
  204. package/dist/refusal.d.ts +5 -0
  205. package/dist/refusal.d.ts.map +1 -0
  206. package/dist/refusal.js +57 -0
  207. package/dist/replica.d.ts +53 -33
  208. package/dist/replica.d.ts.map +1 -1
  209. package/dist/replica.js +361 -164
  210. package/dist/room-draft.d.ts +58 -12
  211. package/dist/room-draft.d.ts.map +1 -1
  212. package/dist/room-draft.js +270 -90
  213. package/dist/room-drafts.d.ts +24 -0
  214. package/dist/room-drafts.d.ts.map +1 -0
  215. package/dist/room-drafts.js +217 -0
  216. package/dist/rows.d.ts +32 -35
  217. package/dist/rows.d.ts.map +1 -1
  218. package/dist/rows.js +64 -124
  219. package/dist/runtime.d.ts +34 -0
  220. package/dist/runtime.d.ts.map +1 -0
  221. package/dist/runtime.js +1 -0
  222. package/dist/save.d.ts +46 -22
  223. package/dist/save.d.ts.map +1 -1
  224. package/dist/save.js +969 -171
  225. package/dist/saves.d.ts +32 -0
  226. package/dist/saves.d.ts.map +1 -0
  227. package/dist/saves.js +413 -0
  228. package/dist/search.d.ts +15 -54
  229. package/dist/search.d.ts.map +1 -1
  230. package/dist/search.js +10 -121
  231. package/dist/seed.d.ts +25 -0
  232. package/dist/seed.d.ts.map +1 -0
  233. package/dist/seed.js +145 -0
  234. package/dist/shared.d.ts +10 -0
  235. package/dist/shared.d.ts.map +1 -0
  236. package/dist/shared.js +339 -0
  237. package/dist/shown.d.ts +32 -0
  238. package/dist/shown.d.ts.map +1 -0
  239. package/dist/shown.js +290 -0
  240. package/dist/socket/admission.d.ts +7 -0
  241. package/dist/socket/admission.d.ts.map +1 -0
  242. package/dist/socket/admission.js +39 -0
  243. package/dist/socket/answers.d.ts +6 -0
  244. package/dist/socket/answers.d.ts.map +1 -0
  245. package/dist/socket/answers.js +20 -0
  246. package/dist/socket/lanes.d.ts +20 -0
  247. package/dist/socket/lanes.d.ts.map +1 -0
  248. package/dist/socket/lanes.js +77 -0
  249. package/dist/socket/reads.d.ts +10 -0
  250. package/dist/socket/reads.d.ts.map +1 -0
  251. package/dist/socket/reads.js +31 -0
  252. package/dist/socket/session.d.ts +38 -0
  253. package/dist/socket/session.d.ts.map +1 -0
  254. package/dist/socket/session.js +23 -0
  255. package/dist/socket.d.ts +67 -0
  256. package/dist/socket.d.ts.map +1 -0
  257. package/dist/socket.js +170 -0
  258. package/dist/source.d.ts +61 -0
  259. package/dist/source.d.ts.map +1 -0
  260. package/dist/source.js +82 -0
  261. package/dist/status.d.ts +7 -4
  262. package/dist/status.d.ts.map +1 -1
  263. package/dist/status.js +3 -15
  264. package/dist/store/installs.d.ts +30 -0
  265. package/dist/store/installs.d.ts.map +1 -0
  266. package/dist/store/installs.js +34 -0
  267. package/dist/store/readiness.d.ts +10 -0
  268. package/dist/store/readiness.d.ts.map +1 -0
  269. package/dist/store/readiness.js +52 -0
  270. package/dist/store/records.d.ts +210 -0
  271. package/dist/store/records.d.ts.map +1 -0
  272. package/dist/store/records.js +428 -0
  273. package/dist/store/room-held.d.ts +8 -0
  274. package/dist/store/room-held.d.ts.map +1 -0
  275. package/dist/store/room-held.js +17 -0
  276. package/dist/store/space.d.ts +11 -0
  277. package/dist/store/space.d.ts.map +1 -0
  278. package/dist/store/space.js +41 -0
  279. package/dist/store/watchers.d.ts +17 -0
  280. package/dist/store/watchers.d.ts.map +1 -0
  281. package/dist/store/watchers.js +56 -0
  282. package/dist/store/writes.d.ts +24 -0
  283. package/dist/store/writes.d.ts.map +1 -0
  284. package/dist/store/writes.js +125 -0
  285. package/dist/store.d.ts +109 -94
  286. package/dist/store.d.ts.map +1 -1
  287. package/dist/store.js +161 -384
  288. package/dist/stored.d.ts +156 -0
  289. package/dist/stored.d.ts.map +1 -0
  290. package/dist/stored.js +649 -0
  291. package/dist/surface.d.ts +88 -0
  292. package/dist/surface.d.ts.map +1 -0
  293. package/dist/surface.js +223 -0
  294. package/dist/sync.d.ts +19 -0
  295. package/dist/sync.d.ts.map +1 -0
  296. package/dist/sync.js +521 -0
  297. package/dist/tables.d.ts +412 -0
  298. package/dist/tables.d.ts.map +1 -0
  299. package/dist/tables.js +737 -0
  300. package/dist/tallies.d.ts +18 -0
  301. package/dist/tallies.d.ts.map +1 -0
  302. package/dist/tallies.js +129 -0
  303. package/dist/transfer.d.ts +0 -5
  304. package/dist/transfer.d.ts.map +1 -1
  305. package/dist/turn.d.ts +9 -0
  306. package/dist/turn.d.ts.map +1 -0
  307. package/dist/turn.js +75 -0
  308. package/dist/validation.d.ts +29 -0
  309. package/dist/validation.d.ts.map +1 -0
  310. package/dist/validation.js +104 -0
  311. package/dist/windows.d.ts +11 -0
  312. package/dist/windows.d.ts.map +1 -0
  313. package/dist/windows.js +16 -0
  314. package/dist/wire.d.ts +189 -37
  315. package/dist/wire.d.ts.map +1 -1
  316. package/dist/wire.js +77 -33
  317. package/package.json +27 -15
  318. package/AGENTS.md +0 -244
  319. package/dist/attachment.d.ts +0 -3
  320. package/dist/attachment.d.ts.map +0 -1
  321. package/dist/attachment.js +0 -8
  322. package/dist/read-side.d.ts +0 -18
  323. package/dist/read-side.d.ts.map +0 -1
  324. package/dist/read-side.js +0 -433
package/dist/query.js CHANGED
@@ -1,462 +1,4 @@
1
- import { pointerFacts, } from '@agentshouse/mdmodel';
2
- import { referenceField } from './model.js';
3
- import { normalize } from './paths.js';
4
- export class QueryError extends Error {
5
- constructor(code, at, problem) {
6
- super(`${code} at ${at}: ${problem}`);
7
- }
8
- }
9
- const RANGE = ['$gt', '$gte', '$lt', '$lte'];
10
- const SINGLE = ['$eq', '$ne', '$in', '$nin', '$all', '$size', '$exists'];
11
- const FILTER = ['rooms', 'types', 'where', 'pathPrefix', 'hop', 'backlinks'];
12
- const RELATED = ['types', 'where', 'pathPrefix', 'field'];
13
- const PARTS = ['fields', 'sections', 'preamble', 'markdown', 'backlinks', 'change'];
14
- const ORDER = ['by', 'direction', 'nulls', 'stringSort', 'locale', 'localeOptions'];
15
- const CALENDAR_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
16
- const STRAY_ESCAPE = /~(?![01])/u;
17
- export function invalid(at, problem) {
18
- throw new QueryError('invalid-query', at, problem);
19
- }
20
- function place(at, name) {
21
- return at === '' ? name : `${at}.${name}`;
22
- }
23
- export function plain(value) {
24
- return (typeof value === 'object' &&
25
- value !== null &&
26
- !Array.isArray(value) &&
27
- (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null));
28
- }
29
- export function known(value, allowed, at) {
30
- for (const name of Object.keys(value)) {
31
- if (!allowed.includes(name))
32
- invalid(place(at, name), 'unknown part');
33
- }
34
- }
35
- function list(input, at) {
36
- if (!Array.isArray(input))
37
- invalid(at, 'expects a list');
38
- return input;
39
- }
40
- function value(input, at) {
41
- if (Array.isArray(input))
42
- invalid(at, 'a list is not a value');
43
- if (input !== null &&
44
- typeof input !== 'string' &&
45
- typeof input !== 'boolean' &&
46
- !(typeof input === 'number' && Number.isFinite(input))) {
47
- invalid(at, 'not a value');
48
- }
49
- return input;
50
- }
51
- function values(input, at) {
52
- return list(input, at).map((item, index) => value(item, `${at}[${index}]`));
53
- }
54
- function names(input, at) {
55
- const listed = list(input, at);
56
- if (listed.some((item) => typeof item !== 'string'))
57
- invalid(at, 'expects a list of names');
58
- return [...new Set(listed)].sort();
59
- }
60
- function directory(input, at) {
61
- if (typeof input !== 'string' || normalize(input) !== input) {
62
- invalid(at, 'expects a normalized directory');
63
- }
64
- return input;
65
- }
66
- function calendarDate(value) {
67
- const match = CALENDAR_DATE.exec(value);
68
- if (match === null)
69
- return false;
70
- const [year, month, day] = match.slice(1).map(Number);
71
- const date = new Date(Date.UTC(year, month - 1, day));
72
- return (date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day);
73
- }
74
- function itemOf(facts) {
75
- return facts.type === 'array' ? facts.items : facts;
76
- }
77
- function fits(facts, value) {
78
- const item = itemOf(facts);
79
- if (item?.type === undefined)
80
- return true;
81
- if (item.values !== undefined)
82
- return item.values.includes(value);
83
- if (item.type === 'number')
84
- return typeof value === 'number';
85
- if (item.type === 'integer')
86
- return Number.isSafeInteger(value);
87
- if (item.type === 'boolean')
88
- return typeof value === 'boolean';
89
- if (item.type !== 'string' || typeof value !== 'string')
90
- return false;
91
- if (item.reference !== undefined)
92
- return value !== '' && normalize(value) === value;
93
- if (item.format === 'date')
94
- return calendarDate(value);
95
- return true;
96
- }
97
- function typing(facts, rooms, types, at) {
98
- const read = rooms === null ? facts.rooms : facts.rooms.filter((room) => rooms.includes(room.locator));
99
- const acquiring = !facts.listed &&
100
- (rooms === null ||
101
- rooms.some((locator) => !facts.rooms.some((room) => room.locator === locator)));
102
- const available = !acquiring && read.every((room) => room.available);
103
- const declared = read.flatMap((room) => room.types);
104
- for (const name of types ?? []) {
105
- if (name === 'any' || !available || declared.some((type) => type.name === name))
106
- continue;
107
- throw new QueryError('unknown-type', place(at, 'types'), `no model it reads declares ${name}`);
108
- }
109
- return {
110
- untyped: types === null || types.includes('any') || !available,
111
- types: types === null ? declared : declared.filter((type) => types.includes(type.name)),
112
- };
113
- }
114
- function pointer(input, at) {
115
- if (typeof input !== 'string' || !input.startsWith('/') || STRAY_ESCAPE.test(input)) {
116
- invalid(at, 'expects a JSON Pointer');
117
- }
118
- return input;
119
- }
120
- function specs(typed, input, at) {
121
- const field = pointer(input, at);
122
- const declared = typed.types.flatMap((type) => {
123
- const spec = pointerFacts(type, field);
124
- return spec === undefined ? [] : [spec];
125
- });
126
- if (declared.length === 0 && !typed.untyped) {
127
- throw new QueryError('unknown-field', at, `no MD Type it reads declares ${field}`);
128
- }
129
- if (!declared.some((spec) => spec.conditional))
130
- return declared;
131
- return declared.map((spec) => ({
132
- facts: { prose: false },
133
- through: several(spec),
134
- conditional: true,
135
- }));
136
- }
137
- function several(spec) {
138
- return spec.through || spec.facts.type === 'array';
139
- }
140
- function single(spec) {
141
- return spec.facts.type !== undefined && spec.facts.type !== 'array';
142
- }
143
- function every(declared, holds) {
144
- return declared.length > 0 && declared.every(holds);
145
- }
146
- function kind(declared, checked, at) {
147
- if (checked === null ||
148
- declared.length === 0 ||
149
- declared.some((spec) => fits(spec.facts, checked))) {
150
- return;
151
- }
152
- throw new QueryError('wrong-kind', at, `${JSON.stringify(checked)} is not of its field's kind`);
153
- }
154
- function test(declared, input, at) {
155
- if (!plain(input)) {
156
- const equal = value(input, at);
157
- kind(declared, equal, at);
158
- return { op: 'eq', value: equal };
159
- }
160
- const operators = Object.keys(input);
161
- if (operators.length === 0)
162
- invalid(at, 'names no operator');
163
- if (operators.some((operator) => RANGE.includes(operator))) {
164
- const stray = operators.find((operator) => !RANGE.includes(operator));
165
- if (stray !== undefined)
166
- invalid(place(at, stray), 'cannot join a range');
167
- if (every(declared, (spec) => spec.facts.type === 'array'))
168
- invalid(at, 'a range on a list');
169
- if (every(declared, (spec) => spec.facts.type === 'boolean' || spec.facts.type === 'object')) {
170
- throw new QueryError('wrong-kind', at, 'its field does not compare in order');
171
- }
172
- return {
173
- op: 'range',
174
- bounds: RANGE.filter((operator) => operators.includes(operator)).map((operator) => {
175
- const bound = value(input[operator], place(at, operator));
176
- if (bound === null)
177
- invalid(place(at, operator), 'a range bound is never null');
178
- kind(declared, bound, place(at, operator));
179
- return [operator.slice(1), bound];
180
- }),
181
- };
182
- }
183
- if (operators.length > 1)
184
- invalid(place(at, operators[1]), 'names a second operator');
185
- const [operator] = operators;
186
- const where = place(at, operator);
187
- if (!SINGLE.includes(operator))
188
- invalid(where, 'unknown operator');
189
- const operand = input[operator];
190
- if (operator === '$eq' || operator === '$ne') {
191
- const compared = value(operand, where);
192
- kind(declared, compared, where);
193
- return operator === '$eq' ? { op: 'eq', value: compared } : { op: 'ne', value: compared };
194
- }
195
- if (operator === '$in' || operator === '$nin' || operator === '$all') {
196
- const compared = values(operand, where);
197
- compared.forEach((item, index) => kind(declared, item, `${where}[${index}]`));
198
- if (operator === '$in')
199
- return { op: 'in', values: compared };
200
- if (operator === '$nin')
201
- return { op: 'nin', values: compared };
202
- if (compared.includes(null))
203
- invalid(where, 'a list holds no null');
204
- if (every(declared, single))
205
- invalid(where, 'the field is not a list');
206
- return { op: 'all', values: compared };
207
- }
208
- if (operator === '$size') {
209
- if (!Number.isSafeInteger(operand) || operand < 0) {
210
- invalid(where, 'expects a nonnegative integer');
211
- }
212
- if (every(declared, single))
213
- invalid(where, 'the field is not a list');
214
- return { op: 'size', size: operand };
215
- }
216
- if (typeof operand !== 'boolean')
217
- invalid(where, 'expects true or false');
218
- return { op: 'exists', exists: operand };
219
- }
220
- function condition(typed, input, at) {
221
- if (!plain(input))
222
- invalid(at, 'expects an object of field predicates');
223
- const conditions = [];
224
- for (const name of Object.keys(input).sort()) {
225
- const where = name.startsWith('/') ? `${at}${name}` : place(at, name);
226
- const entry = input[name];
227
- if (name === '$and' || name === '$or') {
228
- const nested = list(entry, where).map((item, index) => condition(typed, item, `${where}[${index}]`));
229
- if (nested.length === 0)
230
- invalid(where, 'expects a nonempty list');
231
- conditions.push(name === '$and' ? { every: nested } : { some: nested });
232
- continue;
233
- }
234
- if (name.startsWith('$'))
235
- invalid(where, 'unknown operator');
236
- conditions.push({ field: name, test: test(specs(typed, name, where), entry, where) });
237
- }
238
- if (conditions.length === 0)
239
- invalid(at, 'names no field');
240
- return conditions.length === 1 ? conditions[0] : { every: conditions };
241
- }
242
- function scope(facts, rooms, input, at) {
243
- const types = input.types === undefined ? null : names(input.types, place(at, 'types'));
244
- const typed = typing(facts, rooms, types, at);
245
- return {
246
- typed,
247
- types,
248
- where: input.where === undefined || (plain(input.where) && Object.keys(input.where).length === 0)
249
- ? null
250
- : condition(typed, input.where, place(at, 'where')),
251
- pathPrefix: input.pathPrefix === undefined ? null : directory(input.pathPrefix, place(at, 'pathPrefix')),
252
- };
253
- }
254
- function referenceName(typed, field, at) {
255
- const declared = specs(typed, field, at);
256
- if (declared.length > 0 &&
257
- !declared.some((spec) => spec.conditional || referenceField(spec.facts))) {
258
- invalid(at, 'not a reference field');
259
- }
260
- return field;
261
- }
262
- function hopOf(facts, rooms, root, input) {
263
- if (!plain(input))
264
- invalid('hop', 'expects an object');
265
- known(input, RELATED, 'hop');
266
- const field = referenceName(root, input.field, 'hop.field');
267
- const { types, where, pathPrefix } = scope(facts, rooms, input, 'hop');
268
- return { types, where, pathPrefix, field };
269
- }
270
- function backlinksOf(facts, rooms, input) {
271
- if (!plain(input))
272
- invalid('backlinks', 'expects an object');
273
- known(input, RELATED, 'backlinks');
274
- const { typed, types, where, pathPrefix } = scope(facts, rooms, input, 'backlinks');
275
- const field = input.field === undefined ? null : referenceName(typed, input.field, 'backlinks.field');
276
- return { types, where, pathPrefix, field };
277
- }
278
- function keyPlan(typed, input, at, path) {
279
- if (input === 'room' || input === 'type' || (path && input === 'path'))
280
- return { of: input };
281
- if (plain(input) && Object.hasOwn(input, 'field') && Object.keys(input).length === 1) {
282
- if (specs(typed, input.field, place(at, 'field')).some(several)) {
283
- invalid(place(at, 'field'), 'a path that can hold several values');
284
- }
285
- return { of: 'field', field: input.field };
286
- }
287
- return invalid(at, path ? 'expects room, path, type or a field' : 'expects room, type or a field');
288
- }
289
- function direction(input, at) {
290
- if (input === undefined)
291
- return 'asc';
292
- if (input !== 'asc' && input !== 'desc')
293
- invalid(at, 'expects asc or desc');
294
- return input;
295
- }
296
- function orderOptions(input, at) {
297
- const options = {
298
- direction: direction(input.direction, place(at, 'direction')),
299
- };
300
- if (input.nulls !== undefined) {
301
- if (input.nulls !== 'first' && input.nulls !== 'last') {
302
- invalid(place(at, 'nulls'), 'expects first or last');
303
- }
304
- options.nulls = input.nulls;
305
- }
306
- if (input.stringSort !== undefined) {
307
- if (input.stringSort !== 'lexical' && input.stringSort !== 'locale') {
308
- invalid(place(at, 'stringSort'), 'expects lexical or locale');
309
- }
310
- options.stringSort = input.stringSort;
311
- }
312
- if (input.locale !== undefined) {
313
- if (typeof input.locale !== 'string' || !collates(input.locale, undefined)) {
314
- invalid(place(at, 'locale'), 'expects a locale name');
315
- }
316
- options.locale = input.locale;
317
- }
318
- if (input.localeOptions !== undefined) {
319
- if (!plain(input.localeOptions) || !collates(options.locale, input.localeOptions)) {
320
- invalid(place(at, 'localeOptions'), 'expects collation options');
321
- }
322
- options.localeOptions = input.localeOptions;
323
- }
324
- return options;
325
- }
326
- function collates(locale, options) {
327
- try {
328
- ''.localeCompare('', locale, options);
329
- return true;
330
- }
331
- catch {
332
- return false;
333
- }
334
- }
335
- function parts(typed, input, at, fields) {
336
- if (input === undefined)
337
- return null;
338
- if (input === 'all')
339
- return 'all';
340
- const named = list(input, at);
341
- named.forEach((name, index) => {
342
- if (fields)
343
- specs(typed, name, `${at}[${index}]`);
344
- else if (typeof name !== 'string')
345
- invalid(`${at}[${index}]`, 'expects a name');
346
- });
347
- return named;
348
- }
349
- function flag(input, at) {
350
- if (input === undefined)
351
- return false;
352
- if (input !== true)
353
- invalid(at, 'expects true');
354
- return true;
355
- }
356
- function documentShape(typed, input) {
357
- const orderBy = (input.orderBy === undefined ? [] : list(input.orderBy, 'orderBy')).map((clause, index) => {
358
- const at = `orderBy[${index}]`;
359
- if (!plain(clause))
360
- invalid(at, 'expects an order clause');
361
- known(clause, ORDER, at);
362
- return {
363
- key: keyPlan(typed, clause.by, place(at, 'by'), true),
364
- options: orderOptions(clause, at),
365
- };
366
- });
367
- const select = input.select;
368
- if (select === 'all') {
369
- return {
370
- kind: 'documents',
371
- fields: 'all',
372
- sections: 'all',
373
- preamble: true,
374
- markdown: true,
375
- backlinks: true,
376
- change: true,
377
- orderBy,
378
- };
379
- }
380
- if (!plain(select))
381
- invalid('select', "expects 'all' or the parts to return");
382
- known(select, PARTS, 'select');
383
- return {
384
- kind: 'documents',
385
- fields: parts(typed, select.fields, 'select.fields', true),
386
- sections: parts(typed, select.sections, 'select.sections', false),
387
- preamble: flag(select.preamble, 'select.preamble'),
388
- markdown: flag(select.markdown, 'select.markdown'),
389
- backlinks: flag(select.backlinks, 'select.backlinks'),
390
- change: flag(select.change, 'select.change'),
391
- orderBy,
392
- };
393
- }
394
- function groupShape(typed, input) {
395
- const groupBy = list(input.groupBy, 'groupBy').map((key, index) => keyPlan(typed, key, `groupBy[${index}]`, false));
396
- if (groupBy.length === 0)
397
- invalid('groupBy', 'names no key');
398
- const grouped = groupBy.map((key) => JSON.stringify(key));
399
- const orderBy = (input.orderBy === undefined ? [] : list(input.orderBy, 'orderBy')).map((clause, index) => {
400
- const at = `orderBy[${index}]`;
401
- if (!plain(clause))
402
- invalid(at, 'expects an order clause');
403
- known(clause, ['by', 'direction'], at);
404
- const by = clause.by === 'count'
405
- ? 'count'
406
- : grouped.indexOf(JSON.stringify(keyPlan(typed, clause.by, place(at, 'by'), false)));
407
- if (by === -1)
408
- invalid(place(at, 'by'), 'orders by a key the query does not group by');
409
- return { by, direction: direction(clause.direction, place(at, 'direction')) };
410
- });
411
- return { kind: 'groups', groupBy, orderBy };
412
- }
413
- export function planOf(input, facts, reach = null) {
414
- if (!plain(input))
415
- invalid('query', 'expects a query object');
416
- const grouped = input.groupBy !== undefined;
417
- if (grouped && input.select !== undefined)
418
- invalid('select', 'a grouped query selects nothing');
419
- if (!grouped && input.select === undefined)
420
- invalid('select', 'a Document query must select');
421
- known(input, [...FILTER, 'orderBy', 'limit', grouped ? 'groupBy' : 'select'], '');
422
- const limit = limitOf(input.limit);
423
- const rooms = input.rooms === undefined ? null : names(input.rooms, 'rooms');
424
- const { typed, ...root } = scope(facts, rooms, input, '');
425
- return {
426
- rooms,
427
- reach,
428
- root,
429
- hop: input.hop === undefined ? null : hopOf(facts, rooms, typed, input.hop),
430
- backlinks: input.backlinks === undefined ? null : backlinksOf(facts, rooms, input.backlinks),
431
- shape: grouped ? groupShape(typed, input) : documentShape(typed, input),
432
- limit,
433
- };
434
- }
435
- export function limitOf(input) {
436
- if (input === undefined)
437
- return null;
438
- if (!Number.isSafeInteger(input) || input < 0) {
439
- invalid('limit', 'expects a nonnegative integer');
440
- }
441
- return input;
442
- }
443
- export function filterOf(input, facts, reach = null) {
444
- if (!plain(input))
445
- invalid('documents', 'expects a filter object');
446
- known(input, FILTER, '');
447
- return planOf({ ...input, select: {} }, facts, reach);
448
- }
449
- function canonical(value) {
450
- if (Array.isArray(value))
451
- return `[${value.map(canonical).join(',')}]`;
452
- if (typeof value === 'object' && value !== null) {
453
- return `{${Object.keys(value)
454
- .sort()
455
- .map((name) => `${JSON.stringify(name)}:${canonical(value[name])}`)
456
- .join(',')}}`;
457
- }
458
- return JSON.stringify(value);
459
- }
460
- export function identityOf(plan) {
461
- return canonical(plan);
1
+ import { planOf } from '@agentshouse/mdmodel';
2
+ export function planWithin(input, facts, reach = null) {
3
+ return { ...planOf(input, facts), reach, locked: [] };
462
4
  }
@@ -0,0 +1,34 @@
1
+ import type { ConversationView } from './conversation.js';
2
+ export type ChatChoice = {
3
+ readonly value: string;
4
+ readonly label: string;
5
+ readonly about: string | null;
6
+ };
7
+ export type ChatField = {
8
+ readonly name: string;
9
+ readonly kind: 'string' | 'number' | 'integer' | 'boolean' | 'multi-select';
10
+ readonly prompt: string;
11
+ readonly about: string | null;
12
+ readonly choices: readonly ChatChoice[];
13
+ };
14
+ export type ChatAnswer = Readonly<Record<string, unknown>>;
15
+ export type ChatQuestion = {
16
+ readonly interaction: string;
17
+ readonly asked: string | null;
18
+ readonly secret: boolean;
19
+ readonly message: string;
20
+ readonly fields: readonly ChatField[];
21
+ readonly undelivered: boolean;
22
+ accept(answer: ChatAnswer): unknown;
23
+ readonly decline: unknown;
24
+ };
25
+ export declare function entered(field: ChatField): boolean;
26
+ export declare function questionsOf(view: Pick<ConversationView, 'questions'> | null): readonly ChatQuestion[];
27
+ export declare function openQuestion(questions: readonly unknown[]): string | null;
28
+ export declare function questionAsked(questions: readonly unknown[]): string | null;
29
+ export type ChatLone = {
30
+ readonly question: ChatQuestion;
31
+ readonly field: ChatField;
32
+ };
33
+ export declare function loneOf(questions: readonly ChatQuestion[]): ChatLone | null;
34
+ //# sourceMappingURL=questions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../src/questions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,cAAc,CAAC;IAC5E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE3D,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,CAAC;AAuCF,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAEjD;AA2DD,wBAAgB,WAAW,CACzB,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,IAAI,GAC/C,SAAS,YAAY,EAAE,CAiBzB;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,GAAG,IAAI,CAKzE;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,GAAG,IAAI,CAE1E;AAED,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEtF,wBAAgB,MAAM,CAAC,SAAS,EAAE,SAAS,YAAY,EAAE,GAAG,QAAQ,GAAG,IAAI,CAM1E"}
@@ -0,0 +1,122 @@
1
+ import { excerpt, list, record, text } from './read.js';
2
+ const OPTION = 'optionId';
3
+ function choicesOf(schema) {
4
+ const items = record(schema.items);
5
+ const listed = [schema.oneOf, schema.enum, items.anyOf, items.enum].find(Array.isArray) ?? [];
6
+ return listed.flatMap((one) => {
7
+ if (typeof one === 'string')
8
+ return [{ value: one, label: one, about: null }];
9
+ const value = text(record(one), 'const');
10
+ return value === null
11
+ ? []
12
+ : [
13
+ {
14
+ value,
15
+ label: text(record(one), 'title') ?? value,
16
+ about: text(record(one), 'description'),
17
+ },
18
+ ];
19
+ });
20
+ }
21
+ function fieldOf(name, schema) {
22
+ const type = text(schema, 'type');
23
+ const kind = type === 'boolean' || type === 'number' || type === 'integer'
24
+ ? type
25
+ : type === 'array'
26
+ ? 'multi-select'
27
+ : 'string';
28
+ return {
29
+ name,
30
+ kind,
31
+ prompt: text(schema, 'title') ?? name,
32
+ about: text(schema, 'description'),
33
+ choices: kind === 'boolean' ? [] : choicesOf(schema),
34
+ };
35
+ }
36
+ export function entered(field) {
37
+ return field.kind !== 'boolean' && field.choices.length === 0;
38
+ }
39
+ function valueOf(field, raw) {
40
+ return field.kind === 'number' || field.kind === 'integer' ? Number(raw) : raw;
41
+ }
42
+ function typed(fields, answer) {
43
+ return Object.fromEntries(Object.entries(answer).map(([name, value]) => {
44
+ const field = fields.find((one) => one.name === name);
45
+ return [
46
+ name,
47
+ field !== undefined && entered(field) && typeof value === 'string'
48
+ ? valueOf(field, value)
49
+ : value,
50
+ ];
51
+ }));
52
+ }
53
+ function askedOf(request) {
54
+ const params = record(request.params);
55
+ const method = text(request, 'method');
56
+ if (method === 'session/request_permission') {
57
+ return {
58
+ message: '',
59
+ fields: [
60
+ {
61
+ name: OPTION,
62
+ kind: 'string',
63
+ prompt: text(record(params.toolCall), 'title') ?? '',
64
+ about: null,
65
+ choices: list(params, 'options').flatMap((entry) => {
66
+ const one = record(entry);
67
+ const value = text(one, OPTION);
68
+ return value === null
69
+ ? []
70
+ : [{ value, label: text(one, 'name') ?? value, about: null }];
71
+ }),
72
+ },
73
+ ],
74
+ accept: (answer) => ({ outcome: { outcome: 'selected', optionId: answer[OPTION] } }),
75
+ decline: null,
76
+ };
77
+ }
78
+ if (method !== 'elicitation/create')
79
+ return null;
80
+ const fields = Object.entries(record(record(params.requestedSchema).properties)).map(([name, schema]) => fieldOf(name, record(schema)));
81
+ return {
82
+ message: text(params, 'message') ?? '',
83
+ fields,
84
+ accept: (answer) => ({ action: 'accept', content: typed(fields, answer) }),
85
+ decline: { action: 'decline' },
86
+ };
87
+ }
88
+ export function questionsOf(view) {
89
+ return (view?.questions ?? []).flatMap((entry) => {
90
+ const one = record(entry);
91
+ const interaction = text(one, 'interaction_id');
92
+ const asked = askedOf(record(one.request));
93
+ return asked === null || interaction === null
94
+ ? []
95
+ : [
96
+ {
97
+ interaction,
98
+ asked: text(one, 'asked_at'),
99
+ secret: one.secret === true,
100
+ undelivered: one.telegram_undelivered === true,
101
+ ...asked,
102
+ },
103
+ ];
104
+ });
105
+ }
106
+ export function openQuestion(questions) {
107
+ const [asked] = questionsOf({ questions });
108
+ if (asked === undefined)
109
+ return null;
110
+ const said = asked.message === '' ? asked.fields[0]?.prompt : asked.message;
111
+ return said === undefined || said === '' ? null : excerpt(said);
112
+ }
113
+ export function questionAsked(questions) {
114
+ return questionsOf({ questions })[0]?.asked ?? null;
115
+ }
116
+ export function loneOf(questions) {
117
+ const asked = questions.length === 1 && !questions[0].secret ? questions[0] : undefined;
118
+ const only = asked?.fields.length === 1 ? asked.fields[0] : undefined;
119
+ return asked !== undefined && only !== undefined && entered(only)
120
+ ? { question: asked, field: only }
121
+ : null;
122
+ }
@@ -0,0 +1,40 @@
1
+ import type { MutationResult } from './adapter.js';
2
+ import { type ChangeBatch } from './change.js';
3
+ import { type HeldReplica, type ReplicaRecord, type Returned, type Slice } from './replica.js';
4
+ import type { Runtime } from './runtime.js';
5
+ import type { SavePlan } from './save.js';
6
+ import type { SaveResult } from './saves.js';
7
+ import type { PendingState, RoomCommit, Store, StoredFile, View, Work } from './store.js';
8
+ export type Queueing = Pick<Runtime, 'store' | 'journal' | 'localSaves'> & {
9
+ readonly socket: Pick<Runtime['socket'], 'continuing'>;
10
+ readonly presence: Pick<Runtime['presence'], 'lost'>;
11
+ };
12
+ export type Restand = {
13
+ readonly locator: string;
14
+ readonly record: ReplicaRecord;
15
+ readonly accepted?: string;
16
+ readonly adopted?: Returned;
17
+ readonly installed?: Pick<RoomCommit, 'published' | 'refreshed'>;
18
+ readonly refused?: true;
19
+ readonly after?: () => void;
20
+ };
21
+ export type Appending = {
22
+ readonly plan: SavePlan;
23
+ readonly files: readonly StoredFile[];
24
+ readonly held: ReadonlyMap<string, {
25
+ readonly replica: HeldReplica;
26
+ readonly confirmed: Slice;
27
+ }>;
28
+ readonly after?: () => Promise<void>;
29
+ };
30
+ type Answer = Extract<MutationResult, {
31
+ kind: 'conflicted' | 'rejected';
32
+ }>;
33
+ export declare function withdrawable(states: ReadonlyMap<string, PendingState>): (batch: ChangeBatch) => boolean;
34
+ export declare function sliceAt(store: Store, record: ReplicaRecord, view: View, queue: readonly ChangeBatch[], extra?: Iterable<string>, moved?: Iterable<string>): Promise<Slice>;
35
+ export declare function settle(runtime: Queueing, locators: readonly string[], decide: (held: ReadonlyMap<string, Work>) => Promise<readonly Restand[]>): Promise<void>;
36
+ export declare function answered(runtime: Queueing, locator: string, head: ChangeBatch, answer: Answer): Promise<void>;
37
+ export declare function unpair(runtime: Queueing): Promise<void>;
38
+ export declare function append(runtime: Queueing, appending: Appending): Promise<SaveResult>;
39
+ export {};
40
+ //# sourceMappingURL=queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"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"}