@agentshouse/mdruntime 0.1.0-ca9a5a0b81b98 → 0.1.0-cab56bd8fdcb7

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