@agentshouse/mdruntime 0.1.0-c7bd7ca3faee4 → 0.1.0-c7df8f7608e12

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 (364) hide show
  1. package/README.md +27 -12
  2. package/dist/acceptance.d.ts +3 -0
  3. package/dist/acceptance.d.ts.map +1 -0
  4. package/dist/acceptance.js +328 -0
  5. package/dist/act-lanes.d.ts +30 -0
  6. package/dist/act-lanes.d.ts.map +1 -0
  7. package/dist/act-lanes.js +225 -0
  8. package/dist/actions.d.ts +26 -0
  9. package/dist/actions.d.ts.map +1 -0
  10. package/dist/actions.js +338 -0
  11. package/dist/adapter.d.ts +349 -95
  12. package/dist/adapter.d.ts.map +1 -1
  13. package/dist/attached-model.d.ts +6 -10
  14. package/dist/attached-model.d.ts.map +1 -1
  15. package/dist/attached-model.js +35 -41
  16. package/dist/attachment.d.ts +21 -2
  17. package/dist/attachment.d.ts.map +1 -1
  18. package/dist/attachment.js +14 -7
  19. package/dist/authored.d.ts +88 -0
  20. package/dist/authored.d.ts.map +1 -0
  21. package/dist/authored.js +345 -0
  22. package/dist/bootstrap.d.ts +37 -5
  23. package/dist/bootstrap.d.ts.map +1 -1
  24. package/dist/bootstrap.js +324 -52
  25. package/dist/cell.d.ts +6 -0
  26. package/dist/cell.d.ts.map +1 -0
  27. package/dist/cell.js +9 -0
  28. package/dist/chain.d.ts +12 -0
  29. package/dist/chain.d.ts.map +1 -0
  30. package/dist/chain.js +67 -0
  31. package/dist/change-set.d.ts +13 -14
  32. package/dist/change-set.d.ts.map +1 -1
  33. package/dist/change-set.js +17 -56
  34. package/dist/change.d.ts +50 -0
  35. package/dist/change.d.ts.map +1 -1
  36. package/dist/change.js +39 -0
  37. package/dist/chat-types.d.ts +3 -0
  38. package/dist/chat-types.d.ts.map +1 -0
  39. package/dist/chat-types.js +11 -0
  40. package/dist/client.d.ts +68 -27
  41. package/dist/client.d.ts.map +1 -1
  42. package/dist/client.js +129 -38
  43. package/dist/collection.d.ts +36 -14
  44. package/dist/collection.d.ts.map +1 -1
  45. package/dist/collection.js +74 -54
  46. package/dist/column.d.ts +5 -0
  47. package/dist/column.d.ts.map +1 -0
  48. package/dist/column.js +9 -0
  49. package/dist/compile.d.ts +19 -0
  50. package/dist/compile.d.ts.map +1 -0
  51. package/dist/compile.js +755 -0
  52. package/dist/connection.d.ts +8 -105
  53. package/dist/connection.d.ts.map +1 -1
  54. package/dist/connection.js +115 -2121
  55. package/dist/context.d.ts +2 -0
  56. package/dist/context.d.ts.map +1 -0
  57. package/dist/context.js +7 -0
  58. package/dist/conversation-live.d.ts +150 -0
  59. package/dist/conversation-live.d.ts.map +1 -0
  60. package/dist/conversation-live.js +260 -0
  61. package/dist/conversation-row.d.ts +52 -0
  62. package/dist/conversation-row.d.ts.map +1 -0
  63. package/dist/conversation-row.js +76 -0
  64. package/dist/conversation.d.ts +104 -48
  65. package/dist/conversation.d.ts.map +1 -1
  66. package/dist/conversation.js +1139 -545
  67. package/dist/declaration.d.ts +10 -0
  68. package/dist/declaration.d.ts.map +1 -0
  69. package/dist/declaration.js +24 -0
  70. package/dist/digest.d.ts +7 -0
  71. package/dist/digest.d.ts.map +1 -0
  72. package/dist/digest.js +113 -0
  73. package/dist/discovery.d.ts +12 -0
  74. package/dist/discovery.d.ts.map +1 -0
  75. package/dist/discovery.js +175 -0
  76. package/dist/download.d.ts +6 -0
  77. package/dist/download.d.ts.map +1 -0
  78. package/dist/download.js +42 -0
  79. package/dist/durability.d.ts +24 -1
  80. package/dist/durability.d.ts.map +1 -1
  81. package/dist/durability.js +12 -0
  82. package/dist/entry.d.ts +44 -0
  83. package/dist/entry.d.ts.map +1 -0
  84. package/dist/entry.js +238 -0
  85. package/dist/expectation.d.ts +34 -0
  86. package/dist/expectation.d.ts.map +1 -0
  87. package/dist/expectation.js +123 -0
  88. package/dist/failure.d.ts +16 -0
  89. package/dist/failure.d.ts.map +1 -0
  90. package/dist/failure.js +27 -0
  91. package/dist/figures.d.ts +49 -0
  92. package/dist/figures.d.ts.map +1 -0
  93. package/dist/figures.js +199 -0
  94. package/dist/file.d.ts +2 -19
  95. package/dist/file.d.ts.map +1 -1
  96. package/dist/file.js +8 -122
  97. package/dist/holdings.d.ts +29 -0
  98. package/dist/holdings.d.ts.map +1 -0
  99. package/dist/holdings.js +95 -0
  100. package/dist/host.d.ts +33 -4
  101. package/dist/host.d.ts.map +1 -1
  102. package/dist/host.js +221 -35
  103. package/dist/house-query.d.ts +24 -0
  104. package/dist/house-query.d.ts.map +1 -0
  105. package/dist/house-query.js +102 -0
  106. package/dist/identity.d.ts +3 -0
  107. package/dist/identity.d.ts.map +1 -1
  108. package/dist/identity.js +13 -1
  109. package/dist/index.d.ts +51 -10
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +25 -0
  112. package/dist/install.d.ts +60 -0
  113. package/dist/install.d.ts.map +1 -0
  114. package/dist/install.js +537 -0
  115. package/dist/lifecycle.d.ts +7 -0
  116. package/dist/lifecycle.d.ts.map +1 -0
  117. package/dist/lifecycle.js +292 -0
  118. package/dist/listing.d.ts +60 -0
  119. package/dist/listing.d.ts.map +1 -0
  120. package/dist/listing.js +168 -0
  121. package/dist/live.d.ts +39 -0
  122. package/dist/live.d.ts.map +1 -0
  123. package/dist/live.js +223 -0
  124. package/dist/loaded.d.ts +7 -0
  125. package/dist/loaded.d.ts.map +1 -0
  126. package/dist/loaded.js +46 -0
  127. package/dist/locks.d.ts +7 -0
  128. package/dist/locks.d.ts.map +1 -0
  129. package/dist/locks.js +34 -0
  130. package/dist/lost.d.ts +5 -0
  131. package/dist/lost.d.ts.map +1 -0
  132. package/dist/lost.js +49 -0
  133. package/dist/media.d.ts +24 -0
  134. package/dist/media.d.ts.map +1 -0
  135. package/dist/media.js +365 -0
  136. package/dist/memory.d.ts +28 -8
  137. package/dist/memory.d.ts.map +1 -1
  138. package/dist/memory.js +358 -104
  139. package/dist/messages.d.ts +67 -0
  140. package/dist/messages.d.ts.map +1 -0
  141. package/dist/messages.js +180 -0
  142. package/dist/modal.d.ts +2 -0
  143. package/dist/modal.d.ts.map +1 -0
  144. package/dist/modal.js +11 -0
  145. package/dist/model.d.ts +19 -16
  146. package/dist/model.d.ts.map +1 -1
  147. package/dist/model.js +12 -14
  148. package/dist/models.d.ts +10 -0
  149. package/dist/models.d.ts.map +1 -0
  150. package/dist/models.js +153 -0
  151. package/dist/name.d.ts +3 -0
  152. package/dist/name.d.ts.map +1 -0
  153. package/dist/name.js +118 -0
  154. package/dist/observation.d.ts +44 -9
  155. package/dist/observation.d.ts.map +1 -1
  156. package/dist/observation.js +271 -33
  157. package/dist/online.d.ts +7 -0
  158. package/dist/online.d.ts.map +1 -0
  159. package/dist/online.js +29 -0
  160. package/dist/open.d.ts +2 -0
  161. package/dist/open.d.ts.map +1 -0
  162. package/dist/open.js +1 -0
  163. package/dist/opened.d.ts +22 -0
  164. package/dist/opened.d.ts.map +1 -0
  165. package/dist/opened.js +107 -0
  166. package/dist/opening.d.ts +4 -0
  167. package/dist/opening.d.ts.map +1 -0
  168. package/dist/opening.js +71 -0
  169. package/dist/outcome.d.ts +95 -5
  170. package/dist/outcome.d.ts.map +1 -1
  171. package/dist/outcome.js +114 -1
  172. package/dist/overlay.d.ts +32 -6
  173. package/dist/overlay.d.ts.map +1 -1
  174. package/dist/overlay.js +240 -189
  175. package/dist/page-metadata.d.ts +8 -0
  176. package/dist/page-metadata.d.ts.map +1 -0
  177. package/dist/page-metadata.js +19 -0
  178. package/dist/parts.d.ts +6 -0
  179. package/dist/parts.d.ts.map +1 -0
  180. package/dist/parts.js +36 -0
  181. package/dist/paths.d.ts +2 -0
  182. package/dist/paths.d.ts.map +1 -1
  183. package/dist/paths.js +26 -0
  184. package/dist/preparation.d.ts +46 -0
  185. package/dist/preparation.d.ts.map +1 -0
  186. package/dist/preparation.js +344 -0
  187. package/dist/presence.d.ts +58 -0
  188. package/dist/presence.d.ts.map +1 -0
  189. package/dist/presence.js +231 -0
  190. package/dist/queries.d.ts +16 -0
  191. package/dist/queries.d.ts.map +1 -0
  192. package/dist/queries.js +330 -0
  193. package/dist/query.d.ts +51 -181
  194. package/dist/query.d.ts.map +1 -1
  195. package/dist/query.js +3 -461
  196. package/dist/questions.d.ts +30 -0
  197. package/dist/questions.d.ts.map +1 -0
  198. package/dist/questions.js +117 -0
  199. package/dist/queue.d.ts +40 -0
  200. package/dist/queue.d.ts.map +1 -0
  201. package/dist/queue.js +480 -0
  202. package/dist/reach.d.ts +30 -5
  203. package/dist/reach.d.ts.map +1 -1
  204. package/dist/reach.js +475 -91
  205. package/dist/react.d.ts +37 -9
  206. package/dist/react.d.ts.map +1 -1
  207. package/dist/react.js +41 -18
  208. package/dist/read.d.ts +7 -0
  209. package/dist/read.d.ts.map +1 -0
  210. package/dist/read.js +17 -0
  211. package/dist/readiness.d.ts +68 -0
  212. package/dist/readiness.d.ts.map +1 -0
  213. package/dist/readiness.js +35 -0
  214. package/dist/reads.d.ts +39 -0
  215. package/dist/reads.d.ts.map +1 -0
  216. package/dist/reads.js +189 -0
  217. package/dist/recovery.d.ts +29 -0
  218. package/dist/recovery.d.ts.map +1 -0
  219. package/dist/recovery.js +255 -0
  220. package/dist/refresh.d.ts +20 -7
  221. package/dist/refresh.d.ts.map +1 -1
  222. package/dist/refresh.js +155 -59
  223. package/dist/refusal.d.ts +5 -0
  224. package/dist/refusal.d.ts.map +1 -0
  225. package/dist/refusal.js +55 -0
  226. package/dist/replica.d.ts +48 -33
  227. package/dist/replica.d.ts.map +1 -1
  228. package/dist/replica.js +362 -166
  229. package/dist/retried.d.ts +30 -0
  230. package/dist/retried.d.ts.map +1 -0
  231. package/dist/retried.js +72 -0
  232. package/dist/room-draft.d.ts +85 -14
  233. package/dist/room-draft.d.ts.map +1 -1
  234. package/dist/room-draft.js +502 -96
  235. package/dist/room-drafts.d.ts +24 -0
  236. package/dist/room-drafts.d.ts.map +1 -0
  237. package/dist/room-drafts.js +222 -0
  238. package/dist/room-list.d.ts +10 -0
  239. package/dist/room-list.d.ts.map +1 -0
  240. package/dist/room-list.js +47 -0
  241. package/dist/rows.d.ts +40 -35
  242. package/dist/rows.d.ts.map +1 -1
  243. package/dist/rows.js +77 -123
  244. package/dist/run-tables.d.ts +25 -0
  245. package/dist/run-tables.d.ts.map +1 -0
  246. package/dist/run-tables.js +98 -0
  247. package/dist/running.d.ts +5 -0
  248. package/dist/running.d.ts.map +1 -0
  249. package/dist/running.js +10 -0
  250. package/dist/runs.d.ts +27 -0
  251. package/dist/runs.d.ts.map +1 -0
  252. package/dist/runs.js +92 -0
  253. package/dist/runtime.d.ts +35 -0
  254. package/dist/runtime.d.ts.map +1 -0
  255. package/dist/runtime.js +1 -0
  256. package/dist/save.d.ts +48 -22
  257. package/dist/save.d.ts.map +1 -1
  258. package/dist/save.js +994 -215
  259. package/dist/saves.d.ts +34 -0
  260. package/dist/saves.d.ts.map +1 -0
  261. package/dist/saves.js +463 -0
  262. package/dist/search.d.ts +15 -54
  263. package/dist/search.d.ts.map +1 -1
  264. package/dist/search.js +10 -121
  265. package/dist/seed.d.ts +25 -0
  266. package/dist/seed.d.ts.map +1 -0
  267. package/dist/seed.js +145 -0
  268. package/dist/selector.d.ts +3 -0
  269. package/dist/selector.d.ts.map +1 -0
  270. package/dist/selector.js +22 -0
  271. package/dist/shared.d.ts +10 -0
  272. package/dist/shared.d.ts.map +1 -0
  273. package/dist/shared.js +339 -0
  274. package/dist/shown.d.ts +35 -0
  275. package/dist/shown.d.ts.map +1 -0
  276. package/dist/shown.js +326 -0
  277. package/dist/socket/admission.d.ts +7 -0
  278. package/dist/socket/admission.d.ts.map +1 -0
  279. package/dist/socket/admission.js +39 -0
  280. package/dist/socket/answers.d.ts +6 -0
  281. package/dist/socket/answers.d.ts.map +1 -0
  282. package/dist/socket/answers.js +20 -0
  283. package/dist/socket/lanes.d.ts +28 -0
  284. package/dist/socket/lanes.d.ts.map +1 -0
  285. package/dist/socket/lanes.js +103 -0
  286. package/dist/socket/reads.d.ts +10 -0
  287. package/dist/socket/reads.d.ts.map +1 -0
  288. package/dist/socket/reads.js +31 -0
  289. package/dist/socket/session.d.ts +41 -0
  290. package/dist/socket/session.d.ts.map +1 -0
  291. package/dist/socket/session.js +26 -0
  292. package/dist/socket.d.ts +70 -0
  293. package/dist/socket.d.ts.map +1 -0
  294. package/dist/socket.js +172 -0
  295. package/dist/source.d.ts +76 -0
  296. package/dist/source.d.ts.map +1 -0
  297. package/dist/source.js +119 -0
  298. package/dist/status.d.ts +7 -4
  299. package/dist/status.d.ts.map +1 -1
  300. package/dist/status.js +3 -15
  301. package/dist/store/installs.d.ts +30 -0
  302. package/dist/store/installs.d.ts.map +1 -0
  303. package/dist/store/installs.js +40 -0
  304. package/dist/store/readiness.d.ts +11 -0
  305. package/dist/store/readiness.d.ts.map +1 -0
  306. package/dist/store/readiness.js +68 -0
  307. package/dist/store/records.d.ts +234 -0
  308. package/dist/store/records.d.ts.map +1 -0
  309. package/dist/store/records.js +474 -0
  310. package/dist/store/room-held.d.ts +8 -0
  311. package/dist/store/room-held.d.ts.map +1 -0
  312. package/dist/store/room-held.js +17 -0
  313. package/dist/store/rooms-shown.d.ts +8 -0
  314. package/dist/store/rooms-shown.d.ts.map +1 -0
  315. package/dist/store/rooms-shown.js +13 -0
  316. package/dist/store/space.d.ts +11 -0
  317. package/dist/store/space.d.ts.map +1 -0
  318. package/dist/store/space.js +41 -0
  319. package/dist/store/watchers.d.ts +17 -0
  320. package/dist/store/watchers.d.ts.map +1 -0
  321. package/dist/store/watchers.js +56 -0
  322. package/dist/store/writes.d.ts +24 -0
  323. package/dist/store/writes.d.ts.map +1 -0
  324. package/dist/store/writes.js +125 -0
  325. package/dist/store.d.ts +115 -95
  326. package/dist/store.d.ts.map +1 -1
  327. package/dist/store.js +173 -395
  328. package/dist/stored.d.ts +181 -0
  329. package/dist/stored.d.ts.map +1 -0
  330. package/dist/stored.js +807 -0
  331. package/dist/surface.d.ts +100 -0
  332. package/dist/surface.d.ts.map +1 -0
  333. package/dist/surface.js +258 -0
  334. package/dist/sync.d.ts +21 -0
  335. package/dist/sync.d.ts.map +1 -0
  336. package/dist/sync.js +557 -0
  337. package/dist/tables.d.ts +400 -0
  338. package/dist/tables.d.ts.map +1 -0
  339. package/dist/tables.js +520 -0
  340. package/dist/tallies.d.ts +18 -0
  341. package/dist/tallies.d.ts.map +1 -0
  342. package/dist/tallies.js +128 -0
  343. package/dist/transfer.d.ts +0 -5
  344. package/dist/transfer.d.ts.map +1 -1
  345. package/dist/turn.d.ts +9 -0
  346. package/dist/turn.d.ts.map +1 -0
  347. package/dist/turn.js +75 -0
  348. package/dist/validation.d.ts +31 -0
  349. package/dist/validation.d.ts.map +1 -0
  350. package/dist/validation.js +144 -0
  351. package/dist/windows.d.ts +11 -0
  352. package/dist/windows.d.ts.map +1 -0
  353. package/dist/windows.js +16 -0
  354. package/dist/wire.d.ts +248 -37
  355. package/dist/wire.d.ts.map +1 -1
  356. package/dist/wire.js +93 -33
  357. package/package.json +28 -16
  358. package/AGENTS.md +0 -253
  359. package/dist/log.d.ts +0 -5
  360. package/dist/log.d.ts.map +0 -1
  361. package/dist/log.js +0 -14
  362. package/dist/read-side.d.ts +0 -18
  363. package/dist/read-side.d.ts.map +0 -1
  364. package/dist/read-side.js +0 -433
package/dist/adapter.d.ts CHANGED
@@ -1,5 +1,11 @@
1
+ import type { SavedFacts, TypedPath, VerifiedModel } from '@agentshouse/mdmodel';
2
+ import type { Operation, SessionState } from '@agentshouse/session-content';
1
3
  import type { ModelResult } from './model.js';
4
+ export type { SavedFacts, TypedPath };
5
+ import type { Open } from './open.js';
2
6
  import type { ChangeBatch } from './change.js';
7
+ import type { Written } from './overlay.js';
8
+ import type { QueryDocument, QueryGroup } from './query.js';
3
9
  export type Authorization = object;
4
10
  export type MdModelIdentity = {
5
11
  identity: string;
@@ -9,46 +15,53 @@ export type TypedSelection = {
9
15
  roots: readonly string[];
10
16
  };
11
17
  export type OperationScopes = {
12
- read: readonly string[];
13
- sync: readonly string[];
14
18
  write: readonly string[];
15
- delete: readonly string[];
19
+ erase: readonly string[];
16
20
  };
17
21
  export type ReplicaAdmission = {
18
22
  selection: string;
19
- admission: 'admitted' | 'unavailable';
20
- };
21
- export type DiscoveredRoom = {
22
- name: string;
23
- locator: string;
24
- handle: string;
25
- roomVersion: string;
26
- operations: OperationScopes;
27
- replica: ReplicaAdmission;
28
- typedSelection?: TypedSelection;
29
- providerOwnedPaths: readonly string[];
23
+ admission: Open<'admitted' | 'unavailable'>;
24
+ offline: Open<'locked' | 'open'>;
25
+ };
26
+ export type RoomDeclaration = {
27
+ readonly name: string;
28
+ readonly handle: string;
29
+ readonly operations: OperationScopes;
30
+ readonly replica: ReplicaAdmission;
31
+ readonly typedSelection: TypedSelection | null;
32
+ readonly providerOwnedPaths: readonly string[];
33
+ readonly authoredPaths: readonly string[];
34
+ };
35
+ export type DiscoveredRoom = RoomDeclaration & {
36
+ readonly locator: string;
37
+ readonly roomVersion: string;
30
38
  };
31
39
  export type Capability = {
32
40
  name: string;
33
41
  limits?: readonly ProviderLimit[];
34
42
  actions?: readonly ActionDeclaration[];
35
- conversationAgents?: ConversationAgents;
36
43
  };
37
- export type ConversationAgents = {
38
- locator: string;
39
- type: string;
40
- identity: string;
41
- name: string;
44
+ export type ConversationActivity = {
45
+ turn: Open<'running' | 'asking' | 'ended'>;
46
+ secret: boolean;
47
+ background: boolean | 'runs';
42
48
  };
43
49
  export type ListedConversation = {
44
50
  conversation: string;
45
51
  agent: string;
46
52
  name: string;
47
53
  created: string;
48
- finished: string | null;
49
54
  outcome: string | null;
50
- };
51
- export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
55
+ waiting: boolean;
56
+ newest: string | null;
57
+ processEnded: string | null;
58
+ activity: ConversationActivity | null;
59
+ subject: string | null;
60
+ room: string | null;
61
+ model: string | null;
62
+ effort: string | null;
63
+ };
64
+ export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete' | 'conversations/take-out' | 'conversations/rename' | 'conversations/set' | 'conversations/retry' | 'agent-functions/decide';
52
65
  export type ConversationMessage = {
53
66
  identity: string;
54
67
  turn: string;
@@ -57,6 +70,7 @@ export type ConversationMessage = {
57
70
  };
58
71
  export type AcceptedMessage = ConversationMessage & {
59
72
  position: string;
73
+ change: string;
60
74
  };
61
75
  export type ConversationHistoryRequest = {
62
76
  conversations: readonly {
@@ -72,37 +86,10 @@ export type ConversationHistoryPage = {
72
86
  export type ConversationHistories = {
73
87
  histories: readonly ConversationHistoryPage[];
74
88
  };
75
- export type TurnContext = {
76
- used: number;
77
- window: number;
78
- };
79
89
  export type TurnOperation = {
80
90
  op: 'begin';
81
91
  at: string;
82
- } | {
83
- op: 'start';
84
- index: number;
85
- part: unknown;
86
- } | {
87
- op: 'append';
88
- index: number;
89
- text: string;
90
- } | {
91
- op: 'status';
92
- index: number;
93
- status: string;
94
- result: unknown;
95
- } | {
96
- op: 'count';
97
- index: number;
98
- count: number;
99
- } | {
100
- op: 'plan';
101
- index: number;
102
- entries: readonly unknown[];
103
- } | ({
104
- op: 'context';
105
- } & TurnContext);
92
+ } | Operation;
106
93
  export type ProcessCommand = {
107
94
  [field: string]: unknown;
108
95
  name: string;
@@ -160,6 +147,19 @@ export type ConversationEvent = {
160
147
  kind: 'options';
161
148
  conversation: string;
162
149
  options: readonly SessionOption[];
150
+ } | {
151
+ kind: 'starting';
152
+ conversation: string;
153
+ step: string | null;
154
+ } | {
155
+ kind: 'state';
156
+ conversation: string;
157
+ state: SessionState | null;
158
+ } | {
159
+ kind: 'deliveries';
160
+ conversation: string;
161
+ waiting: readonly string[];
162
+ unknown: readonly string[];
163
163
  } | {
164
164
  kind: 'accepted-message';
165
165
  conversation: string;
@@ -169,22 +169,88 @@ export type ConversationEvent = {
169
169
  conversation: string;
170
170
  } | {
171
171
  kind: 'list';
172
+ agents: readonly ListedAgent[];
172
173
  entries: readonly ListedConversation[];
174
+ whole: boolean;
175
+ more: boolean;
176
+ cursor: string | null;
173
177
  } | {
174
178
  kind: 'listed';
175
179
  entry: ListedConversation;
180
+ } | {
181
+ kind: 'agent';
182
+ agent: ListedAgent;
176
183
  } | {
177
184
  kind: 'unlisted';
178
185
  conversation: string;
179
186
  };
187
+ export type AgentEnvironment = {
188
+ identity: string;
189
+ name: string;
190
+ state: 'online' | 'offline';
191
+ };
192
+ export type ListedOwner = {
193
+ readonly user: string;
194
+ readonly name: string;
195
+ };
196
+ export type ListedSpaceRef = {
197
+ readonly space_ref: string;
198
+ readonly name: string;
199
+ };
200
+ export type RoomListEntry = {
201
+ readonly room_ref: string;
202
+ readonly room_handle: string;
203
+ readonly name: string;
204
+ readonly level: 'search' | 'open' | 'keep';
205
+ readonly access: 'owner' | 'manage' | 'write' | 'read' | 'public';
206
+ readonly owner: ListedOwner;
207
+ readonly created: string;
208
+ readonly archived?: string;
209
+ readonly exportable?: true;
210
+ readonly space?: ListedSpaceRef;
211
+ };
212
+ export type SpaceListEntry = ListedSpaceRef & {
213
+ readonly owner: ListedOwner;
214
+ readonly created: string;
215
+ readonly manages?: true;
216
+ };
217
+ export type RoomList = {
218
+ readonly rooms: readonly RoomListEntry[];
219
+ readonly spaces: readonly SpaceListEntry[];
220
+ };
221
+ export type ListedAgent = {
222
+ id: string;
223
+ name: string;
224
+ revision: number;
225
+ environment: string;
226
+ environment_name: string;
227
+ environment_connected: boolean;
228
+ launch_directory: string;
229
+ cli: string;
230
+ model: string;
231
+ effort: string | null;
232
+ model_fixed: boolean;
233
+ mode: string | null;
234
+ base_instructions: string;
235
+ compaction_threshold: number | null;
236
+ compaction_words: string;
237
+ in_telegram: boolean;
238
+ telegram_messages: 'every' | 'last';
239
+ created: string;
240
+ retired_at: string | null;
241
+ };
180
242
  export type ConversationStream = {
181
243
  replicate(conversations: readonly string[]): void;
244
+ hold(cursor: string | null): void;
182
245
  observe(notify: (event: ConversationEvent) => void): () => void;
246
+ history?(request: ConversationHistoryRequest): Promise<ActionResult>;
183
247
  };
184
248
  export type ActionDeclaration = {
185
249
  name: string;
186
250
  inputShape: unknown;
187
251
  resultKind: unknown;
252
+ room?: string;
253
+ roomPaths?: readonly string[];
188
254
  };
189
255
  export type ProviderLimit = {
190
256
  name: string;
@@ -198,9 +264,13 @@ export type HistoryRetention = {
198
264
  };
199
265
  export type Retention = {
200
266
  history: HistoryRetention;
201
- outcome: number;
202
267
  refreshHorizon: number;
203
268
  };
269
+ export type QueriedRoom = {
270
+ readonly locator: string;
271
+ readonly handle: string;
272
+ readonly name: string;
273
+ };
204
274
  export type Discovery = {
205
275
  kind: 'discovery';
206
276
  rooms: readonly DiscoveredRoom[];
@@ -208,9 +278,13 @@ export type Discovery = {
208
278
  providerLimits: readonly ProviderLimit[];
209
279
  retention: Retention;
210
280
  member?: Member;
281
+ timeZone?: string | null;
282
+ roomList?: RoomList;
283
+ queriesOnly?: readonly QueriedRoom[];
211
284
  };
212
285
  export type TransportUncertainty = {
213
286
  kind: 'transport-uncertainty';
287
+ failure?: unknown;
214
288
  };
215
289
  export type RoomNotReadable = {
216
290
  kind: 'room-not-readable';
@@ -222,11 +296,12 @@ export type RevokedAuthorization = {
222
296
  export type ProviderRefusal = {
223
297
  code: string;
224
298
  fields: Readonly<Record<string, unknown>>;
299
+ retryable: boolean;
225
300
  };
226
301
  export type ScopedRefusal = ProviderRefusal & {
227
302
  kind: 'scoped-refusal';
228
303
  locator: string;
229
- scope: 'content' | 'sync' | 'model' | 'operation' | 'undisclosed';
304
+ scope: Open<'content' | 'model' | 'operation' | 'undisclosed'>;
230
305
  };
231
306
  export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
232
307
  export type ContractUnavailable = ProviderRefusal & {
@@ -235,49 +310,65 @@ export type ContractUnavailable = ProviderRefusal & {
235
310
  export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
236
311
  export type PageToken = string;
237
312
  export type ChangeAuthor = {
238
- kind: 'user';
313
+ kind: Open<'user' | 'site' | 'inbox' | 'app'>;
239
314
  id: string;
240
315
  name: string;
241
- } | {
242
- kind: 'site';
316
+ };
317
+ export type Member = {
318
+ kind: Open<'user'>;
243
319
  id: string;
244
320
  name: string;
245
321
  };
246
- export type Member = Extract<ChangeAuthor, {
247
- kind: 'user';
248
- }>;
249
322
  export type HeadChange = {
250
323
  author: ChangeAuthor | null;
251
324
  time: string;
252
325
  };
253
- export type RoomAttachment = {
254
- reference: string;
255
- name: string;
326
+ export type Attachment = {
256
327
  byteLength: number;
257
- mediaType: string | null;
258
- entry: unknown;
328
+ mediaType: string;
329
+ sha256: string;
330
+ width?: number | null;
331
+ height?: number | null;
259
332
  };
260
333
  export type BootstrapRequest = {
261
334
  locator: string;
262
335
  selection: string;
263
336
  pageToken?: PageToken;
337
+ arriving?: (bytes: number) => void;
338
+ signal?: AbortSignal;
339
+ };
340
+ export type BootstrapPart = {
341
+ readonly id: string;
342
+ readonly bytes: number;
343
+ };
344
+ export type BootstrapInventory = {
345
+ readonly bytes: number;
264
346
  };
265
347
  export type RoomModels = {
266
348
  collection?: ModelResult;
267
- selection?: ModelResult;
268
349
  };
269
350
  export type BootstrapPage = {
270
351
  kind: 'bootstrap';
271
352
  roomVersion: string;
272
353
  models?: RoomModels;
273
354
  documents: Readonly<Record<string, string>>;
355
+ facts: Readonly<Record<string, SavedFacts>>;
274
356
  revisions: Readonly<Record<string, string>>;
357
+ fileIds?: Readonly<Record<string, string>>;
358
+ created?: Readonly<Record<string, string>>;
275
359
  changes: Readonly<Record<string, HeadChange>>;
276
- binaryTargets: readonly string[];
277
- attachments?: readonly RoomAttachment[];
360
+ attachments: Readonly<Record<string, Attachment>>;
361
+ folders?: readonly string[];
278
362
  pageToken?: PageToken;
363
+ parts?: readonly BootstrapPart[];
364
+ bytes?: number;
365
+ };
366
+ export type NotReady = {
367
+ kind: 'not-ready';
279
368
  };
280
- export type BootstrapResult = BootstrapPage | AdapterFailure;
369
+ export type BootstrapResult = BootstrapPage | {
370
+ kind: 'beyond-horizon';
371
+ } | NotReady | AdapterFailure;
281
372
  export type RefreshRequest = {
282
373
  locator: string;
283
374
  selection: string;
@@ -289,11 +380,15 @@ export type RefreshPage = {
289
380
  roomVersion: string;
290
381
  models?: RoomModels;
291
382
  documents: Readonly<Record<string, string>>;
383
+ facts: Readonly<Record<string, SavedFacts>>;
292
384
  revisions: Readonly<Record<string, string>>;
385
+ fileIds?: Readonly<Record<string, string>>;
386
+ created?: Readonly<Record<string, string>>;
293
387
  changes: Readonly<Record<string, HeadChange>>;
294
- binaryTargets: readonly string[];
388
+ attachments: Readonly<Record<string, Attachment>>;
295
389
  removals: readonly string[];
296
- attachments?: readonly RoomAttachment[];
390
+ folders?: readonly string[];
391
+ folderRemovals?: readonly string[];
297
392
  pageToken?: PageToken;
298
393
  };
299
394
  export type RefreshResult = {
@@ -304,43 +399,41 @@ export type RefreshResult = {
304
399
  export type MutationRequest = {
305
400
  locator: string;
306
401
  changeBatch: ChangeBatch;
402
+ written: Written;
403
+ file(localId: string): Promise<Blob>;
307
404
  upload?: unknown;
308
405
  };
309
406
  export type RetryableRefusal = ProviderRefusal & {
310
407
  kind: 'retryable-refusal';
311
408
  reset?: string;
312
409
  };
313
- export type ServiceMode = 'open' | 'write-halted';
410
+ export type ServiceMode = Open<'open' | 'write-halted'>;
314
411
  export type ServiceModeSignal = {
315
412
  observe(notify: (mode: ServiceMode) => void): () => void;
316
413
  };
317
- export type MutationResult = {
318
- kind: 'accepted';
414
+ export type AcceptedRoom = {
319
415
  roomVersion: string;
320
416
  documents: Readonly<Record<string, string>>;
321
417
  revisions: Readonly<Record<string, string>>;
418
+ fileIds?: Readonly<Record<string, string>>;
322
419
  changes: Readonly<Record<string, HeadChange>>;
323
420
  removals: readonly string[];
324
- attachments?: readonly RoomAttachment[];
325
- author?: string;
326
- time?: string;
327
- } | (ProviderRefusal & {
421
+ attachments?: Readonly<Record<string, Attachment>>;
422
+ };
423
+ export type MutationResult = (AcceptedRoom & {
424
+ kind: 'accepted';
425
+ destination?: AcceptedRoom;
426
+ }) | (ProviderRefusal & {
328
427
  kind: 'conflicted';
329
- roomVersion?: string;
330
428
  affected: Readonly<Record<string, string>>;
331
429
  }) | (ProviderRefusal & {
332
430
  kind: 'rejected';
333
431
  affected: Readonly<Record<string, string>>;
334
432
  }) | RetryableRefusal | {
335
433
  kind: 'write-halted';
336
- } | {
337
- kind: 'expired';
338
434
  } | AdapterFailure;
339
435
  export type HistoryAuthor = {
340
- kind: 'user';
341
- id: string;
342
- } | {
343
- kind: 'site';
436
+ kind: 'user' | 'site' | 'inbox' | 'app';
344
437
  id: string;
345
438
  name: string;
346
439
  };
@@ -348,6 +441,7 @@ export type HistoryRevision = {
348
441
  revision: string;
349
442
  author: HistoryAuthor;
350
443
  time: string;
444
+ attachment?: Attachment;
351
445
  };
352
446
  export type HistoryRequest = {
353
447
  locator: string;
@@ -366,6 +460,56 @@ export type HistoryResult = {
366
460
  } | {
367
461
  kind: 'no-history';
368
462
  } | AdapterFailure;
463
+ export type AttachmentRequest = {
464
+ kind: 'path';
465
+ locator: string;
466
+ path: string;
467
+ revision: string;
468
+ };
469
+ export type KeyedRequest = {
470
+ kind: 'key';
471
+ link: string;
472
+ };
473
+ export type AttachmentCopy = {
474
+ url: string;
475
+ width: number;
476
+ };
477
+ export type AttachmentResult = {
478
+ kind: 'binary';
479
+ body: ReadableStream<Uint8Array>;
480
+ mediaType: string;
481
+ sha256?: string;
482
+ url?: string;
483
+ copies?: readonly AttachmentCopy[];
484
+ } | (ProviderRefusal & {
485
+ kind: 'rejected';
486
+ }) | AdapterFailure;
487
+ export type AttachmentLinkResult = {
488
+ kind: 'link';
489
+ url: string;
490
+ name: string;
491
+ mediaType?: string;
492
+ } | (ProviderRefusal & {
493
+ kind: 'rejected';
494
+ }) | AdapterFailure;
495
+ export type AttachRequest = {
496
+ locator?: string;
497
+ name: string;
498
+ mediaType: string;
499
+ byteLength: number;
500
+ sha256: string;
501
+ blob: Blob;
502
+ };
503
+ export type AttachResult = {
504
+ kind: 'attached';
505
+ path: string;
506
+ revision: string;
507
+ } | {
508
+ kind: 'linked';
509
+ link: string;
510
+ } | (ProviderRefusal & {
511
+ kind: 'rejected';
512
+ }) | AdapterFailure;
369
513
  export type ActionRequest = {
370
514
  name: string;
371
515
  input: unknown;
@@ -378,47 +522,157 @@ export type ActionResult = {
378
522
  kind: 'action';
379
523
  result: unknown;
380
524
  at?: RoomVersionAt;
525
+ } | (ProviderRefusal & {
526
+ kind: 'rejected';
527
+ reset?: string;
528
+ }) | AdapterFailure;
529
+ export type SearchHit = {
530
+ room: string;
531
+ path: string;
532
+ line?: number;
533
+ snippet?: string;
534
+ };
535
+ export type SearchAsk = {
536
+ text: string;
537
+ rooms: readonly string[] | null;
538
+ };
539
+ export type SearchAnswer = {
540
+ kind: 'found';
541
+ documents: readonly SearchHit[];
381
542
  } | (ProviderRefusal & {
382
543
  kind: 'rejected';
383
544
  }) | AdapterFailure;
545
+ export type HouseQueryFollow = string | {
546
+ readonly room: string;
547
+ readonly path: string;
548
+ } | {
549
+ readonly room: string;
550
+ readonly path: string;
551
+ readonly open: readonly string[];
552
+ };
553
+ export type HouseQueryAsk = {
554
+ room: string;
555
+ fresh: boolean;
556
+ follows?: readonly HouseQueryFollow[];
557
+ } & ({
558
+ query: Readonly<Record<string, unknown>>;
559
+ } | {
560
+ path: string;
561
+ after?: string;
562
+ });
563
+ export type HouseQueryRows = {
564
+ kind: 'rows';
565
+ documents: readonly QueryDocument[];
566
+ next?: string;
567
+ total?: number;
568
+ totalCapped?: true;
569
+ };
570
+ export type HouseQueryGroups = {
571
+ kind: 'groups';
572
+ groups: readonly QueryGroup[];
573
+ next?: string;
574
+ capped?: true;
575
+ };
576
+ export type HouseQueryAnswer = HouseQueryRows | HouseQueryGroups | (ProviderRefusal & {
577
+ kind: 'rejected';
578
+ }) | AdapterFailure;
384
579
  export type HeldRoom = {
385
580
  locator: string;
581
+ roomVersion: string | null;
582
+ };
583
+ export type RoomChange = {
584
+ kind: 'room-change';
585
+ locator: string;
586
+ from: string | null;
386
587
  roomVersion: string;
387
- documents: Readonly<Record<string, string>>;
388
- revisions: Readonly<Record<string, string>>;
389
- attachments: readonly RoomAttachment[];
588
+ read(): Promise<RefreshPage>;
589
+ };
590
+ export type AuthorityChange = {
591
+ kind: 'authority-changed';
592
+ rooms: readonly DiscoveredRoom[];
593
+ left: readonly string[];
594
+ member?: Member;
595
+ timeZone?: string | null;
596
+ roomList?: RoomList & {
597
+ readonly left: readonly string[];
598
+ };
390
599
  };
391
600
  export type RoomStreamEvent = {
392
601
  kind: 'opened';
602
+ } | {
603
+ kind: 'discovered';
604
+ discovery: Discovery;
393
605
  } | {
394
606
  kind: 'closed';
395
607
  revoked: boolean;
608
+ lost: boolean;
609
+ authorityChanged: boolean;
396
610
  } | {
397
- kind: 'opening';
611
+ kind: 'caught-up';
398
612
  expired: readonly string[];
399
613
  } | {
400
- kind: 'room-version';
401
- locator: string;
402
- roomVersion: string;
614
+ kind: 'reported';
615
+ } | AuthorityChange | RoomChange;
616
+ export type HeardRun = {
617
+ readonly room: string;
618
+ readonly name: string;
619
+ readonly document: string;
620
+ readonly current: boolean;
621
+ readonly starter: string | null;
622
+ };
623
+ export type RunEvent = {
624
+ readonly kind: 'run';
625
+ readonly run: HeardRun;
626
+ readonly listing: string | null;
627
+ } | {
628
+ readonly kind: 'removed';
629
+ readonly room: string;
630
+ readonly name: string;
631
+ } | {
632
+ readonly kind: 'runs';
633
+ readonly listing: string | null;
634
+ readonly runs: readonly HeardRun[];
635
+ readonly whole: boolean;
636
+ readonly more: boolean;
637
+ readonly mark: string;
638
+ };
639
+ export type RunMarks = {
640
+ readonly rooms: Readonly<Record<string, string>>;
641
+ readonly sent: string | null;
642
+ };
643
+ export type RunStream = {
644
+ hold(marks: RunMarks): void;
645
+ observe(notify: (event: RunEvent) => void): () => void;
403
646
  };
404
647
  export type RoomStream = {
405
648
  hold(rooms: readonly HeldRoom[]): void;
406
- reopen(): void;
407
649
  observe(notify: (event: RoomStreamEvent) => void): () => void;
408
650
  };
651
+ export type PathRule = (path: string) => boolean;
409
652
  export type Adapter = {
653
+ readonly localSaves?: true;
654
+ readonly roomTypes?: VerifiedModel;
655
+ readonly typedPaths?: readonly TypedPath[];
656
+ readonly pathRule?: PathRule;
657
+ readonly unkeptReads?: readonly string[];
658
+ readonly leadingReads?: readonly string[];
410
659
  authorize(): Promise<Authorization>;
411
- discover(authorization: Authorization): Promise<DiscoverResult>;
660
+ discover?(authorization: Authorization): Promise<DiscoverResult>;
412
661
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
413
- refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
662
+ refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
414
663
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
415
664
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
665
+ binary(authorization: Authorization, request: AttachmentRequest): Promise<AttachmentResult>;
666
+ link(authorization: Authorization, request: AttachmentRequest | KeyedRequest): Promise<AttachmentLinkResult>;
667
+ attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
416
668
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
669
+ search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
670
+ queryHouse?(authorization: Authorization, request: HouseQueryAsk): Promise<HouseQueryAnswer>;
417
671
  reached(locator: string, roomVersion: string, target: string): boolean;
418
672
  follows(locator: string, roomVersion: string, next: string): boolean;
419
673
  roomStream?: RoomStream;
420
674
  conversations?: ConversationStream;
675
+ runs?: RunStream;
421
676
  serviceMode?: ServiceModeSignal;
422
677
  };
423
- export {};
424
678
  //# sourceMappingURL=adapter.d.ts.map