@agentshouse/mdruntime 0.1.0-cde2b99d2fcbc → 0.1.0-cdf06805b9658

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 (228) hide show
  1. package/AGENTS.md +286 -292
  2. package/README.md +16 -14
  3. package/dist/adapter.d.ts +99 -36
  4. package/dist/adapter.d.ts.map +1 -1
  5. package/dist/attached-model.d.ts +5 -1
  6. package/dist/attached-model.d.ts.map +1 -1
  7. package/dist/attached-model.js +21 -4
  8. package/dist/attempt.d.ts.map +1 -1
  9. package/dist/attempt.js +14 -1
  10. package/dist/binary.d.ts +0 -5
  11. package/dist/binary.d.ts.map +1 -1
  12. package/dist/binary.js +1 -1
  13. package/dist/bootstrap.d.ts +27 -9
  14. package/dist/bootstrap.d.ts.map +1 -1
  15. package/dist/bootstrap.js +155 -64
  16. package/dist/chain.d.ts +11 -0
  17. package/dist/chain.d.ts.map +1 -0
  18. package/dist/chain.js +64 -0
  19. package/dist/change-set.d.ts +9 -14
  20. package/dist/change-set.d.ts.map +1 -1
  21. package/dist/change-set.js +11 -63
  22. package/dist/change.d.ts +31 -1
  23. package/dist/change.d.ts.map +1 -1
  24. package/dist/change.js +10 -1
  25. package/dist/client.d.ts +24 -12
  26. package/dist/client.d.ts.map +1 -1
  27. package/dist/client.js +49 -9
  28. package/dist/collection.d.ts +7 -6
  29. package/dist/collection.d.ts.map +1 -1
  30. package/dist/collection.js +30 -77
  31. package/dist/compile.d.ts +16 -0
  32. package/dist/compile.d.ts.map +1 -0
  33. package/dist/compile.js +721 -0
  34. package/dist/connection.d.ts +42 -15
  35. package/dist/connection.d.ts.map +1 -1
  36. package/dist/connection.js +3397 -804
  37. package/dist/conversation.d.ts +30 -9
  38. package/dist/conversation.d.ts.map +1 -1
  39. package/dist/conversation.js +549 -181
  40. package/dist/digest.d.ts +7 -0
  41. package/dist/digest.d.ts.map +1 -0
  42. package/dist/digest.js +113 -0
  43. package/dist/durability.d.ts +5 -1
  44. package/dist/durability.d.ts.map +1 -1
  45. package/dist/durability.js +5 -0
  46. package/dist/entry.d.ts +19 -0
  47. package/dist/entry.d.ts.map +1 -0
  48. package/dist/entry.js +151 -0
  49. package/dist/fence.d.ts +6 -0
  50. package/dist/fence.d.ts.map +1 -0
  51. package/dist/fence.js +10 -0
  52. package/dist/file.d.ts +2 -10
  53. package/dist/file.d.ts.map +1 -1
  54. package/dist/file.js +3 -120
  55. package/dist/fulltext.d.ts +27 -0
  56. package/dist/fulltext.d.ts.map +1 -0
  57. package/dist/fulltext.js +368 -0
  58. package/dist/host.d.ts +15 -3
  59. package/dist/host.d.ts.map +1 -1
  60. package/dist/host.js +126 -16
  61. package/dist/identity.d.ts +1 -0
  62. package/dist/identity.d.ts.map +1 -1
  63. package/dist/identity.js +3 -0
  64. package/dist/index.d.ts +15 -9
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +5 -0
  67. package/dist/live.d.ts +22 -0
  68. package/dist/live.d.ts.map +1 -0
  69. package/dist/live.js +123 -0
  70. package/dist/memory.d.ts +10 -3
  71. package/dist/memory.d.ts.map +1 -1
  72. package/dist/memory.js +54 -26
  73. package/dist/messages.d.ts +28 -0
  74. package/dist/messages.d.ts.map +1 -0
  75. package/dist/messages.js +90 -0
  76. package/dist/model.d.ts +4 -2
  77. package/dist/model.d.ts.map +1 -1
  78. package/dist/model.js +11 -2
  79. package/dist/name.d.ts +4 -0
  80. package/dist/name.d.ts.map +1 -0
  81. package/dist/name.js +122 -0
  82. package/dist/observation.d.ts +19 -2
  83. package/dist/observation.d.ts.map +1 -1
  84. package/dist/observation.js +113 -12
  85. package/dist/opened.d.ts +22 -0
  86. package/dist/opened.d.ts.map +1 -0
  87. package/dist/opened.js +107 -0
  88. package/dist/outcome.d.ts +38 -4
  89. package/dist/outcome.d.ts.map +1 -1
  90. package/dist/outcome.js +26 -0
  91. package/dist/overlay.d.ts +3 -4
  92. package/dist/overlay.d.ts.map +1 -1
  93. package/dist/overlay.js +100 -182
  94. package/dist/query.d.ts +60 -4
  95. package/dist/query.d.ts.map +1 -1
  96. package/dist/query.js +48 -7
  97. package/dist/reach.d.ts +11 -6
  98. package/dist/reach.d.ts.map +1 -1
  99. package/dist/reach.js +182 -62
  100. package/dist/react.d.ts +8 -6
  101. package/dist/react.d.ts.map +1 -1
  102. package/dist/react.js +7 -17
  103. package/dist/readiness.d.ts +64 -0
  104. package/dist/readiness.d.ts.map +1 -0
  105. package/dist/readiness.js +33 -0
  106. package/dist/reads.d.ts +11 -0
  107. package/dist/reads.d.ts.map +1 -0
  108. package/dist/reads.js +100 -0
  109. package/dist/recovery.d.ts +25 -0
  110. package/dist/recovery.d.ts.map +1 -0
  111. package/dist/recovery.js +198 -0
  112. package/dist/refresh.d.ts +16 -15
  113. package/dist/refresh.d.ts.map +1 -1
  114. package/dist/refresh.js +113 -49
  115. package/dist/replica.d.ts +56 -33
  116. package/dist/replica.d.ts.map +1 -1
  117. package/dist/replica.js +297 -162
  118. package/dist/room-draft.d.ts +17 -2
  119. package/dist/room-draft.d.ts.map +1 -1
  120. package/dist/room-draft.js +65 -25
  121. package/dist/rows.d.ts +28 -37
  122. package/dist/rows.d.ts.map +1 -1
  123. package/dist/rows.js +113 -72
  124. package/dist/save.d.ts +50 -9
  125. package/dist/save.d.ts.map +1 -1
  126. package/dist/save.js +528 -166
  127. package/dist/search.d.ts +39 -28
  128. package/dist/search.d.ts.map +1 -1
  129. package/dist/search.js +37 -105
  130. package/dist/seed.d.ts +16 -0
  131. package/dist/seed.d.ts.map +1 -0
  132. package/dist/seed.js +75 -0
  133. package/dist/shared.d.ts +16 -0
  134. package/dist/shared.d.ts.map +1 -0
  135. package/dist/shared.js +431 -0
  136. package/dist/status.d.ts +4 -0
  137. package/dist/status.d.ts.map +1 -1
  138. package/dist/store.d.ts +118 -76
  139. package/dist/store.d.ts.map +1 -1
  140. package/dist/store.js +355 -444
  141. package/dist/stored.d.ts +145 -0
  142. package/dist/stored.d.ts.map +1 -0
  143. package/dist/stored.js +567 -0
  144. package/dist/tables.d.ts +354 -0
  145. package/dist/tables.d.ts.map +1 -0
  146. package/dist/tables.js +624 -0
  147. package/dist/turn.d.ts +9 -0
  148. package/dist/turn.d.ts.map +1 -0
  149. package/dist/turn.js +75 -0
  150. package/dist/validation.d.ts +30 -0
  151. package/dist/validation.d.ts.map +1 -0
  152. package/dist/validation.js +162 -0
  153. package/dist/windows.d.ts +22 -0
  154. package/dist/windows.d.ts.map +1 -0
  155. package/dist/windows.js +89 -0
  156. package/dist/wire.d.ts +164 -32
  157. package/dist/wire.d.ts.map +1 -1
  158. package/dist/wire.js +55 -31
  159. package/dist/words.d.ts +19 -0
  160. package/dist/words.d.ts.map +1 -0
  161. package/dist/words.js +150 -0
  162. package/package.json +27 -23
  163. package/dist/chat/acts.d.ts +0 -34
  164. package/dist/chat/acts.d.ts.map +0 -1
  165. package/dist/chat/acts.js +0 -36
  166. package/dist/chat/context.d.ts +0 -3
  167. package/dist/chat/context.d.ts.map +0 -1
  168. package/dist/chat/context.js +0 -10
  169. package/dist/chat/input.d.ts +0 -9
  170. package/dist/chat/input.d.ts.map +0 -1
  171. package/dist/chat/input.js +0 -99
  172. package/dist/chat/kit.d.ts +0 -60
  173. package/dist/chat/kit.d.ts.map +0 -1
  174. package/dist/chat/kit.js +0 -123
  175. package/dist/chat/lasting.d.ts +0 -6
  176. package/dist/chat/lasting.d.ts.map +0 -1
  177. package/dist/chat/lasting.js +0 -19
  178. package/dist/chat/list.d.ts +0 -20
  179. package/dist/chat/list.d.ts.map +0 -1
  180. package/dist/chat/list.js +0 -59
  181. package/dist/chat/markdown.d.ts +0 -19
  182. package/dist/chat/markdown.d.ts.map +0 -1
  183. package/dist/chat/markdown.js +0 -187
  184. package/dist/chat/message.d.ts +0 -6
  185. package/dist/chat/message.d.ts.map +0 -1
  186. package/dist/chat/message.js +0 -192
  187. package/dist/chat/messages.d.ts +0 -21
  188. package/dist/chat/messages.d.ts.map +0 -1
  189. package/dist/chat/messages.js +0 -151
  190. package/dist/chat/name.d.ts +0 -6
  191. package/dist/chat/name.d.ts.map +0 -1
  192. package/dist/chat/name.js +0 -37
  193. package/dist/chat/opened.d.ts +0 -11
  194. package/dist/chat/opened.d.ts.map +0 -1
  195. package/dist/chat/opened.js +0 -17
  196. package/dist/chat/overlay.d.ts +0 -31
  197. package/dist/chat/overlay.d.ts.map +0 -1
  198. package/dist/chat/overlay.js +0 -97
  199. package/dist/chat/parts.d.ts +0 -57
  200. package/dist/chat/parts.d.ts.map +0 -1
  201. package/dist/chat/parts.js +0 -119
  202. package/dist/chat/process.d.ts +0 -20
  203. package/dist/chat/process.d.ts.map +0 -1
  204. package/dist/chat/process.js +0 -32
  205. package/dist/chat/provider.d.ts +0 -63
  206. package/dist/chat/provider.d.ts.map +0 -1
  207. package/dist/chat/provider.js +0 -645
  208. package/dist/chat/question.d.ts +0 -9
  209. package/dist/chat/question.d.ts.map +0 -1
  210. package/dist/chat/question.js +0 -80
  211. package/dist/chat/questions.d.ts +0 -31
  212. package/dist/chat/questions.d.ts.map +0 -1
  213. package/dist/chat/questions.js +0 -111
  214. package/dist/chat/read.d.ts +0 -5
  215. package/dist/chat/read.d.ts.map +0 -1
  216. package/dist/chat/read.js +0 -13
  217. package/dist/chat/ready.d.ts +0 -33
  218. package/dist/chat/ready.d.ts.map +0 -1
  219. package/dist/chat/ready.js +0 -91
  220. package/dist/chat/style.d.ts +0 -4
  221. package/dist/chat/style.d.ts.map +0 -1
  222. package/dist/chat/style.js +0 -302
  223. package/dist/chat.d.ts +0 -14
  224. package/dist/chat.d.ts.map +0 -1
  225. package/dist/chat.js +0 -8
  226. package/dist/read-side.d.ts +0 -18
  227. package/dist/read-side.d.ts.map +0 -1
  228. package/dist/read-side.js +0 -440
package/dist/identity.js CHANGED
@@ -10,6 +10,9 @@ export function changeBatchIdentity(at = Date.now()) {
10
10
  const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
11
11
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
12
12
  }
13
+ export function identityTime(identity) {
14
+ return Number.parseInt(identity.replaceAll('-', '').slice(0, 12), 16);
15
+ }
13
16
  function randomIdentity() {
14
17
  const bytes = new Uint8Array(16);
15
18
  crypto.getRandomValues(bytes);
package/dist/index.d.ts CHANGED
@@ -1,22 +1,28 @@
1
- export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BinaryFile, BinaryRequest, BinaryResult, ReferrerScope, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationAgents, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldRoom, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
2
- export type { Change, ChangeBatch, Precondition, WrittenBy } from './change.js';
1
+ export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult, BootstrapInventory, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationAgents, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, DiscoveryScope, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldContent, HeldFile, HeldRevisions, HeldRoom, KeptReceipt, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, ServiceMode, ServiceModeSignal, StreamReceipts, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
2
+ export type { Change, ChangeBatch, Precondition, RoomMove, WrittenBy } from './change.js';
3
3
  export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
4
- export type { ChatDraftFile, FileDeclaration } from './file.js';
5
- export type { AppRoom, AppTypedSelection, BinaryFileSurface, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedRoomDraft, SaveResult, } from './connection.js';
4
+ export type { ChosenFile, FileDeclaration } from './file.js';
5
+ export type { AppRoom, AppTypedSelection, BinaryFileSurface, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult, } from './connection.js';
6
6
  export type { Observation } from './observation.js';
7
- export type { BinaryAnswer, CallResult, Failure, HistoryAnswer, QueueEntry, Submission, } from './outcome.js';
8
- export type { BinaryFileRecord, BinaryReference } from './binary.js';
7
+ export type { BinaryAnswer, BinaryLinkAnswer, CallResult, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
8
+ export type { BinaryFileRecord } from './binary.js';
9
9
  export type { RuntimeError } from './failure.js';
10
- export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, } from './room-draft.js';
10
+ export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, TextParts, } from './room-draft.js';
11
11
  export type { SaveRefusal } from './save.js';
12
- export type { DocumentHit, DocumentPart, MessageHit, SearchRequest, SearchResult, } from './search.js';
12
+ export type { DocumentHit, DocumentPart, MessageHit, MessagePart, SearchCoverage, SearchHits, SearchPending, SearchRequest, SearchResult, SearchUndeclared, Snippet, } from './search.js';
13
13
  export { departure } from './change.js';
14
+ export { partsAfter } from './room-draft.js';
15
+ export { cutName, nameFrom, transliterated } from './name.js';
16
+ export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
14
17
  export { changeBatchIdentity } from './identity.js';
18
+ export { paced, ROW_WEIGHT, stepped } from './turn.js';
19
+ export { entriesIn, patching, sortedKeys } from './shared.js';
15
20
  export { attempts, identities, intentOf, type Answered, type Attempt, type Attempts, type Identities, } from './attempt.js';
16
21
  export { expectedList, expecting, type ExpectedOf, type Expecting } from './expectation.js';
17
22
  export type { RuntimeShell } from './durability.js';
23
+ export type { CodeAvailability, ConnectionAvailability, ConversationCoverage, Durability, HouseOutcome, Installation, InstallationAmount, InstallationPause, InstallationStep, Persistence, Readiness, ReadinessStatus, RefusedRoom, RoomCoverage, RoomPreparation, SearchObligation, Space, TargetCoverage, } from './readiness.js';
18
24
  export type { AttentionEntry, SyncStatus } from './status.js';
19
- export type { Backlink, Direction, DocumentQuery, DocumentResult, Filter, GroupQuery, GroupResult, Key, LocalQuery, OrderOptions, Predicate, QueryDocument, QueryGroup, QueryResult, Related, Select, Value, Where, } from './query.js';
25
+ export type { Awaits, Backlink, CoveredRoom, Direction, DocumentQuery, DocumentResult, Filter, GroupQuery, GroupResult, Key, LocalQuery, OrderOptions, PendingResult, PendingRoom, Predicate, QueryCoverage, QueryDocument, QueryGroup, QueryResult, QueryRows, Related, Select, Value, Where, } from './query.js';
20
26
  export type { MdType, ModelIdentity, ModelSnapshot, ModelState, ModelResult, TypesResult, ValidationReceipt, } from './model.js';
21
27
  export type { OperationScopes, ReplicaAdmission, ScopedRefusal } from './adapter.js';
22
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChF,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAChE,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,i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V,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,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,KAAK,GACN,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,9 @@
1
1
  export { departure } from './change.js';
2
+ export { partsAfter } from './room-draft.js';
3
+ export { cutName, nameFrom, transliterated } from './name.js';
4
+ export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
2
5
  export { changeBatchIdentity } from './identity.js';
6
+ export { paced, ROW_WEIGHT, stepped } from './turn.js';
7
+ export { entriesIn, patching, sortedKeys } from './shared.js';
3
8
  export { attempts, identities, intentOf, } from './attempt.js';
4
9
  export { expectedList, expecting } from './expectation.js';
package/dist/live.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ import type { ChangeSet } from './change-set.js';
2
+ import { type KeyedResult, type QueryMessage } from './observation.js';
3
+ import type { PendingResult, Plan, QueryCoverage } from './query.js';
4
+ import type { QueryRoom } from './tables.js';
5
+ export type Cover = {
6
+ coverage: QueryCoverage;
7
+ rooms: readonly QueryRoom[];
8
+ } | PendingResult;
9
+ export type Ran = KeyedResult & {
10
+ readonly current: () => boolean;
11
+ };
12
+ export type Run = (plan: Plan, cover: () => Cover) => Promise<Ran>;
13
+ type Listener = (message: QueryMessage) => void;
14
+ export type LiveQueries = {
15
+ touched(set: ChangeSet): void;
16
+ recover(): void;
17
+ watch(plan: Plan, identity: string, cover: () => Cover, deliver: Listener): () => void;
18
+ close(): void;
19
+ };
20
+ export declare function createLiveQueries(run: Run): LiveQueries;
21
+ export {};
22
+ //# sourceMappingURL=live.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,KAAK,GAAG;IAAE,QAAQ,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAA;CAAE,GAAG,aAAa,CAAC;AAE7F,MAAM,MAAM,GAAG,GAAG,WAAW,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAA;CAAE,CAAC;AAEpE,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEnE,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;AAchD,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,OAAO,IAAI,IAAI,CAAC;IAChB,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,EAAE,OAAO,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;IACvF,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAmCF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,CAuFvD"}
package/dist/live.js ADDED
@@ -0,0 +1,123 @@
1
+ import { changeOf, digestOf, } from './observation.js';
2
+ import { roomOfKey } from './rows.js';
3
+ function narrowed(plan) {
4
+ return (plan.paths !== null &&
5
+ plan.hop === null &&
6
+ plan.backlinks === null &&
7
+ !(plan.shape.kind === 'documents' && plan.shape.backlinks));
8
+ }
9
+ function reads(plan, locator) {
10
+ if (plan.locked.includes(locator))
11
+ return false;
12
+ if (plan.rooms !== null && !plan.rooms.includes(locator))
13
+ return false;
14
+ if (plan.reach === null)
15
+ return true;
16
+ return (plan.reach.rooms.includes(locator) ||
17
+ plan.reach.documents.some((document) => roomOfKey(document) === locator));
18
+ }
19
+ function affected(plan, set) {
20
+ if (set.rooms.some((locator) => reads(plan, locator)))
21
+ return true;
22
+ const paths = narrowed(plan) ? new Set(plan.paths) : null;
23
+ return set.documents.some(({ locator, path }) => reads(plan, locator) && (paths === null || path === null || paths.has(path)));
24
+ }
25
+ function shown(entry) {
26
+ const cover = entry.cover();
27
+ return JSON.stringify('pending' in cover ? cover : cover.coverage);
28
+ }
29
+ export function createLiveQueries(run) {
30
+ const entries = new Map();
31
+ let closed = false;
32
+ function deliver(entry, next) {
33
+ const previous = entry.digest;
34
+ entry.digest = digestOf(next);
35
+ entry.covered = JSON.stringify('pending' in next.result ? next.result : next.result.coverage);
36
+ const change = previous === undefined ? null : changeOf(previous, next);
37
+ if (change !== null) {
38
+ for (const listener of entry.ready)
39
+ listener(change);
40
+ }
41
+ for (const listener of entry.fresh) {
42
+ entry.ready.add(listener);
43
+ listener(next);
44
+ }
45
+ entry.fresh.clear();
46
+ }
47
+ function schedule(entry) {
48
+ if (closed || entry.listeners.size === 0)
49
+ return;
50
+ if (entry.running) {
51
+ entry.dirty = true;
52
+ return;
53
+ }
54
+ entry.running = true;
55
+ void (async () => {
56
+ try {
57
+ for (;;) {
58
+ entry.dirty = false;
59
+ const { current, ...next } = await run(entry.plan, entry.cover);
60
+ if (closed || entry.listeners.size === 0)
61
+ return;
62
+ deliver(entry, next);
63
+ if (!(entry.dirty && !current()) && shown(entry) === entry.covered)
64
+ break;
65
+ }
66
+ }
67
+ catch {
68
+ entry.dirty = false;
69
+ }
70
+ finally {
71
+ entry.running = false;
72
+ }
73
+ })();
74
+ }
75
+ return {
76
+ touched(set) {
77
+ for (const entry of entries.values()) {
78
+ if (affected(entry.plan, set))
79
+ schedule(entry);
80
+ }
81
+ },
82
+ recover() {
83
+ for (const entry of entries.values()) {
84
+ if (entry.running)
85
+ continue;
86
+ if (entry.digest === undefined || shown(entry) !== entry.covered)
87
+ schedule(entry);
88
+ }
89
+ },
90
+ watch(plan, identity, cover, listener) {
91
+ let entry = entries.get(identity);
92
+ if (entry === undefined) {
93
+ entry = {
94
+ plan,
95
+ cover,
96
+ listeners: new Set(),
97
+ fresh: new Set(),
98
+ ready: new Set(),
99
+ digest: undefined,
100
+ covered: '',
101
+ dirty: false,
102
+ running: false,
103
+ };
104
+ entries.set(identity, entry);
105
+ }
106
+ const held = entry;
107
+ held.listeners.add(listener);
108
+ held.fresh.add(listener);
109
+ schedule(held);
110
+ return () => {
111
+ held.listeners.delete(listener);
112
+ held.fresh.delete(listener);
113
+ held.ready.delete(listener);
114
+ if (held.listeners.size === 0 && entries.get(identity) === held)
115
+ entries.delete(identity);
116
+ };
117
+ },
118
+ close() {
119
+ closed = true;
120
+ entries.clear();
121
+ },
122
+ };
123
+ }
package/dist/memory.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  import type { ModelResult } from './model.js';
2
- import { type AcceptedMessage, type ActionResult, type Adapter, type BinaryFile, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type HeadChange, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode } from './adapter.js';
2
+ import { type AcceptedMessage, type ActionResult, type Adapter, type BinaryFile, type Capability, type ConversationAction, type ConversationEvent, type DiscoveryScope, type DiscoveredRoom, type HeadChange, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode } from './adapter.js';
3
3
  export type MemoryRoom = DiscoveredRoom & {
4
4
  model?: ModelResult;
5
- selectionModel?: ModelResult;
6
5
  documents?: Readonly<Record<string, string>>;
7
6
  revisions?: Readonly<Record<string, string>>;
7
+ fileIds?: Readonly<Record<string, string>>;
8
8
  changes?: Readonly<Record<string, HeadChange>>;
9
9
  binaryFiles?: Readonly<Record<string, BinaryFile>>;
10
+ folders?: readonly string[];
10
11
  blobs?: Readonly<Record<string, Blob>>;
11
12
  };
12
13
  export type MemoryConversation = {
@@ -25,18 +26,24 @@ export type MemoryAdapterOptions = {
25
26
  retention?: Retention;
26
27
  member?: Member;
27
28
  unopened?: boolean;
29
+ exhaustiveDiscovery?: true;
30
+ roomTypes?: string;
28
31
  };
29
32
  export type MemoryAdapter = Adapter & {
30
33
  setRooms(rooms: readonly MemoryRoom[]): void;
31
34
  setConversations(conversations: readonly MemoryConversation[]): void;
32
35
  script(operation: keyof Adapter, answer: unknown): void;
33
36
  open(): void;
34
- close(revoked?: boolean): void;
37
+ close(closing?: {
38
+ revoked?: boolean;
39
+ lost?: boolean;
40
+ }): void;
35
41
  expire(locators: readonly string[]): void;
36
42
  notifyRoomVersion(notification: {
37
43
  locator: string;
38
44
  roomVersion: string;
39
45
  }): void;
46
+ notifyAuthorityChanged(scope?: DiscoveryScope): void;
40
47
  notifyConversation(event: ConversationEvent): void;
41
48
  notifyServiceMode(mode: ServiceMode): void;
42
49
  heldRooms(): readonly string[];
@@ -1 +1 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EAEZ,KAAK,UAAU,EAKf,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAItB,KAAK,cAAc,EACnB,KAAK,UAAU,EAGf,KAAK,kBAAkB,EACvB,KAAK,MAAM,EAGX,KAAK,aAAa,EAIlB,KAAK,SAAS,EAGd,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAkBtB,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG;IACxC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,cAAc,CAAC,EAAE,WAAW,CAAC;IA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{ kind: 'duration', seconds: 1 },
4
- outcome: 1,
4
+ outcome: 604_800,
5
5
  refreshHorizon: 1,
6
6
  };
7
7
  function declaredRetention(value) {
@@ -15,12 +15,7 @@ function declaredRetention(value) {
15
15
  }
16
16
  const MODEL_ABSENT = { kind: 'model-unavailable', reason: 'not-readable' };
17
17
  function modelsOf(room) {
18
- return {
19
- collection: room.model ?? MODEL_ABSENT,
20
- ...(room.typedSelection === undefined
21
- ? {}
22
- : { selection: room.selectionModel ?? MODEL_ABSENT }),
23
- };
18
+ return { collection: room.model ?? MODEL_ABSENT };
24
19
  }
25
20
  function changedModels(room, from) {
26
21
  const now = modelsOf(room);
@@ -55,6 +50,7 @@ export function createMemoryAdapter(options = {}) {
55
50
  const scripted = new Map();
56
51
  const unsealed = new Map();
57
52
  const sealed = new Set();
53
+ const sentTurns = new Map();
58
54
  const historyPageSize = options.historyPageSize;
59
55
  let held = [];
60
56
  let expiring = [];
@@ -121,17 +117,32 @@ export function createMemoryAdapter(options = {}) {
121
117
  ...(opening ? { models: modelsOf(room) } : {}),
122
118
  documents: named(room.documents ?? {}, taken),
123
119
  revisions: named(room.revisions ?? {}, [...taken, ...targets]),
120
+ ...(room.fileIds === undefined
121
+ ? {}
122
+ : { fileIds: named(room.fileIds, [...taken, ...targets]) }),
124
123
  changes: named(room.changes ?? {}, [...taken, ...targets]),
125
124
  binaryFiles: named(room.binaryFiles ?? {}, targets),
125
+ ...(opening && room.folders !== undefined ? { folders: room.folders } : {}),
126
126
  ...(next < paths.length ? { pageToken: taken.at(-1) } : {}),
127
127
  };
128
128
  }
129
+ function foldersMoved(room, from) {
130
+ const now = new Set(room.folders ?? []);
131
+ const before = new Set(from.folders ?? []);
132
+ const folders = [...now].filter((folder) => !before.has(folder)).sort();
133
+ const folderRemovals = [...before].filter((folder) => !now.has(folder)).sort();
134
+ return {
135
+ ...(folders.length === 0 ? {} : { folders }),
136
+ ...(folderRemovals.length === 0 ? {} : { folderRemovals }),
137
+ };
138
+ }
129
139
  function advancement(room, from, at) {
130
140
  const current = room.documents ?? {};
131
141
  const previous = from.documents ?? {};
132
142
  const currentTargets = new Set(Object.keys(room.binaryFiles ?? {}));
133
143
  const previousTargets = new Set(Object.keys(from.binaryFiles ?? {}));
134
144
  const headMoved = (path) => room.revisions?.[path] !== from.revisions?.[path] ||
145
+ room.fileIds?.[path] !== from.fileIds?.[path] ||
135
146
  !sameChange(room.changes?.[path], from.changes?.[path]);
136
147
  const changed = Object.keys(current)
137
148
  .filter((path) => current[path] !== previous[path] || headMoved(path))
@@ -153,8 +164,12 @@ export function createMemoryAdapter(options = {}) {
153
164
  ...(models === undefined ? {} : { models }),
154
165
  documents: named(current, taken),
155
166
  revisions: named(room.revisions ?? {}, [...taken, ...targets]),
167
+ ...(room.fileIds === undefined
168
+ ? {}
169
+ : { fileIds: named(room.fileIds, [...taken, ...targets]) }),
156
170
  changes: named(room.changes ?? {}, [...taken, ...targets]),
157
171
  binaryFiles: named(room.binaryFiles ?? {}, targets),
172
+ ...(opening ? foldersMoved(room, from) : {}),
158
173
  removals: opening
159
174
  ? [
160
175
  ...Object.keys(previous).filter((path) => !(path in current) && !currentTargets.has(path)),
@@ -220,9 +235,15 @@ export function createMemoryAdapter(options = {}) {
220
235
  if (outcome !== undefined)
221
236
  return outcome;
222
237
  if (name === 'conversation.send') {
238
+ const operation = typeof input.operation_id === 'string' ? input.operation_id : null;
239
+ const answered = operation === null ? undefined : sentTurns.get(operation);
240
+ if (answered !== undefined)
241
+ return { kind: 'action', result: { turn: answered } };
223
242
  issued += 1;
224
243
  const turn = `turn-${issued}`;
225
244
  unsealed.set(turn, named);
245
+ if (operation !== null)
246
+ sentTurns.set(operation, turn);
226
247
  return { kind: 'action', result: { turn } };
227
248
  }
228
249
  if (name === 'conversation.cancel') {
@@ -253,6 +274,8 @@ export function createMemoryAdapter(options = {}) {
253
274
  };
254
275
  }
255
276
  return {
277
+ ...(options.exhaustiveDiscovery === undefined ? {} : { exhaustiveDiscovery: true }),
278
+ ...(options.roomTypes === undefined ? {} : { roomTypes: options.roomTypes }),
256
279
  setRooms(next) {
257
280
  rooms = [...next];
258
281
  retain(rooms);
@@ -265,9 +288,9 @@ export function createMemoryAdapter(options = {}) {
265
288
  for (const observer of observers)
266
289
  observer({ kind: 'opened' });
267
290
  },
268
- close(revoked = false) {
291
+ close({ revoked = false, lost = !revoked } = {}) {
269
292
  for (const observer of observers)
270
- observer({ kind: 'closed', revoked });
293
+ observer({ kind: 'closed', revoked, lost });
271
294
  },
272
295
  expire(locators) {
273
296
  expiring = [...locators];
@@ -276,6 +299,13 @@ export function createMemoryAdapter(options = {}) {
276
299
  for (const observer of observers)
277
300
  observer({ kind: 'room-version', locator, roomVersion });
278
301
  },
302
+ notifyAuthorityChanged(scope) {
303
+ for (const observer of observers) {
304
+ observer(scope === undefined
305
+ ? { kind: 'authority-changed' }
306
+ : { kind: 'authority-changed', scope });
307
+ }
308
+ },
279
309
  notifyConversation(event) {
280
310
  if (event.kind === 'accepted-message') {
281
311
  sealed.add(event.message.turn);
@@ -336,17 +366,19 @@ export function createMemoryAdapter(options = {}) {
336
366
  },
337
367
  reopen() {
338
368
  queueMicrotask(() => {
339
- for (const observer of observers)
340
- observer({ kind: 'closed', revoked: false });
369
+ for (const observer of observers) {
370
+ observer({ kind: 'closed', revoked: false, lost: false });
371
+ }
341
372
  });
342
373
  },
374
+ published() { },
343
375
  observe(notify) {
344
376
  observers.add(notify);
345
377
  queueMicrotask(() => {
346
378
  if (!observers.has(notify))
347
379
  return;
348
380
  if (options.unopened === true) {
349
- notify({ kind: 'closed', revoked: false });
381
+ notify({ kind: 'closed', revoked: false, lost: true });
350
382
  return;
351
383
  }
352
384
  announceList();
@@ -429,7 +461,13 @@ export function createMemoryAdapter(options = {}) {
429
461
  retryable: false,
430
462
  affected: {},
431
463
  };
432
- }, request).then((answer) => note(request.locator, answer));
464
+ }, request).then((answer) => {
465
+ const destination = request.changeBatch.between?.destination.room;
466
+ if (answer.kind === 'accepted' && answer.destination !== undefined && destination) {
467
+ note(destination, answer.destination);
468
+ }
469
+ return note(request.locator, answer);
470
+ });
433
471
  },
434
472
  async history(_authorization, request) {
435
473
  return resolveScript(scripts.history, () => {
@@ -445,27 +483,17 @@ export function createMemoryAdapter(options = {}) {
445
483
  },
446
484
  async binary(_authorization, request) {
447
485
  return resolveScript(scripts.binary, () => {
448
- if (request.kind === 'reference') {
449
- return { kind: 'rejected', code: 'unscripted-binary', fields: {}, retryable: false };
450
- }
451
486
  const room = rooms.find((entry) => entry.locator === request.locator);
452
487
  if (room === undefined)
453
488
  return { kind: 'room-not-readable', locator: request.locator };
454
489
  const blob = room.blobs?.[request.path];
455
490
  return blob === undefined
456
491
  ? { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false }
457
- : { kind: 'binary', blob };
492
+ : { kind: 'binary', body: blob.stream(), mediaType: blob.type };
458
493
  }, request);
459
494
  },
460
- referrerScope(referrer) {
461
- if (typeof referrer !== 'object' || referrer === null)
462
- return null;
463
- const { room, path, message } = referrer;
464
- if (typeof message === 'string')
465
- return { kind: 'conversations' };
466
- if (typeof room !== 'string')
467
- return null;
468
- return { kind: 'room', locator: room, ...(typeof path === 'string' ? { path } : {}) };
495
+ async link(_authorization, request) {
496
+ return resolveScript(scripts.link, () => ({ kind: 'rejected', code: 'unscripted-link', fields: {}, retryable: false }), request);
469
497
  },
470
498
  async action(_authorization, request) {
471
499
  return resolveScript(scripts.action, () => {
@@ -0,0 +1,28 @@
1
+ import type { AcceptedMessage } from './adapter.js';
2
+ import type { Connection } from './tables.js';
3
+ export declare const MESSAGE_TABLES: readonly string[];
4
+ export type HeldConversation = {
5
+ readonly conversation: string;
6
+ readonly read: string | null | undefined;
7
+ readonly partial: boolean;
8
+ };
9
+ export type MessageWindow = {
10
+ readonly messages: AcceptedMessage[];
11
+ readonly more: boolean;
12
+ };
13
+ export type ConversationWrite = {
14
+ readonly conversation: string;
15
+ readonly messages: readonly AcceptedMessage[];
16
+ readonly read?: {
17
+ readonly at: string | null;
18
+ readonly partial: boolean;
19
+ };
20
+ };
21
+ export declare function heldConversations(connection: Connection): HeldConversation[];
22
+ export declare function keptMessages(connection: Connection, { conversation, messages, read }: ConversationWrite): null;
23
+ export declare function messageWindow(connection: Connection, conversation: string, limit: number, before: readonly [string, string] | null): MessageWindow;
24
+ export declare function messageCount(connection: Connection, conversation: string): number;
25
+ export declare function turnArrived(connection: Connection, conversation: string, turn: string): boolean;
26
+ export declare function droppedMessages(connection: Connection, conversations: readonly string[]): void;
27
+ export declare function forgottenMessages(connection: Connection): void;
28
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AAE1D,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAM3C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,eAAe,EAAE,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7F,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IAC9C,QAAQ,CAAC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAC3E,CAAC;AAMF,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,gBAAgB,EAAE,CAmB5E;AAED,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,iBAAiB,GAClD,IAAI,CAoCN;AAYD,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GACvC,aAAa,CAUf;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAMjF;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAO/F;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAW9F;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAG9D"}
@@ -0,0 +1,90 @@
1
+ import { indexMessage, unindexMessages } from './fulltext.js';
2
+ export const MESSAGE_TABLES = [
3
+ 'CREATE TABLE conversation_reads (conversation TEXT PRIMARY KEY, read TEXT, partial INTEGER NOT NULL) WITHOUT ROWID',
4
+ 'CREATE TABLE conversation_messages (id INTEGER PRIMARY KEY, conversation TEXT NOT NULL, identity TEXT NOT NULL, turn TEXT NOT NULL, position TEXT NOT NULL, message TEXT NOT NULL, text TEXT NOT NULL)',
5
+ 'CREATE UNIQUE INDEX conversation_messages_identity ON conversation_messages (conversation, identity)',
6
+ 'CREATE INDEX conversation_messages_position ON conversation_messages (conversation, position, identity)',
7
+ 'CREATE INDEX conversation_messages_turn ON conversation_messages (conversation, turn)',
8
+ ];
9
+ function text(value) {
10
+ return typeof value === 'string' ? value : String(value);
11
+ }
12
+ export function heldConversations(connection) {
13
+ const held = new Map();
14
+ for (const row of connection.rows('SELECT conversation, read, partial FROM conversation_reads')) {
15
+ held.set(text(row.conversation), {
16
+ conversation: text(row.conversation),
17
+ read: row.read === null ? null : text(row.read),
18
+ partial: Number(row.partial) === 1,
19
+ });
20
+ }
21
+ for (const row of connection.rows('SELECT DISTINCT conversation FROM conversation_messages WHERE conversation NOT IN (SELECT conversation FROM conversation_reads)')) {
22
+ held.set(text(row.conversation), {
23
+ conversation: text(row.conversation),
24
+ read: undefined,
25
+ partial: true,
26
+ });
27
+ }
28
+ return [...held.values()];
29
+ }
30
+ export function keptMessages(connection, { conversation, messages, read }) {
31
+ for (const message of messages) {
32
+ const [held] = connection.rows('SELECT id FROM conversation_messages WHERE conversation = ? AND identity = ?', [conversation, message.identity]);
33
+ const record = [
34
+ message.turn,
35
+ message.position,
36
+ JSON.stringify(message.message ?? null),
37
+ message.text,
38
+ ];
39
+ let id;
40
+ if (held === undefined) {
41
+ connection.run('INSERT INTO conversation_messages (conversation, identity, turn, position, message, text) VALUES (?, ?, ?, ?, ?, ?)', [conversation, message.identity, ...record]);
42
+ id = Number(connection.rows('SELECT last_insert_rowid() AS id')[0].id);
43
+ }
44
+ else {
45
+ id = Number(held.id);
46
+ unindexMessages(connection, [id]);
47
+ connection.run('UPDATE conversation_messages SET turn = ?, position = ?, message = ?, text = ? WHERE id = ?', [...record, id]);
48
+ }
49
+ indexMessage(connection, id, message.text);
50
+ }
51
+ if (read !== undefined) {
52
+ connection.run('INSERT OR REPLACE INTO conversation_reads (conversation, read, partial) VALUES (?, ?, ?)', [conversation, read.at, read.partial ? 1 : 0]);
53
+ }
54
+ return null;
55
+ }
56
+ function accepted(row) {
57
+ return {
58
+ identity: text(row.identity),
59
+ turn: text(row.turn),
60
+ position: text(row.position),
61
+ text: text(row.text),
62
+ message: JSON.parse(text(row.message)),
63
+ };
64
+ }
65
+ export function messageWindow(connection, conversation, limit, before) {
66
+ const rows = connection.rows(`SELECT identity, turn, position, message, text FROM conversation_messages WHERE conversation = ?${before === null ? '' : ' AND (position < ? OR (position = ? AND identity < ?))'} ORDER BY position DESC, identity DESC LIMIT ?`, before === null
67
+ ? [conversation, limit + 1]
68
+ : [conversation, before[0], before[0], before[1], limit + 1]);
69
+ return { messages: rows.slice(0, limit).map(accepted).reverse(), more: rows.length > limit };
70
+ }
71
+ export function messageCount(connection, conversation) {
72
+ const [counted] = connection.rows('SELECT count(*) AS held FROM conversation_messages WHERE conversation = ?', [conversation]);
73
+ return Number(counted?.held ?? 0);
74
+ }
75
+ export function turnArrived(connection, conversation, turn) {
76
+ return (connection.rows('SELECT 1 FROM conversation_messages WHERE conversation = ? AND turn = ? LIMIT 1', [conversation, turn]).length > 0);
77
+ }
78
+ export function droppedMessages(connection, conversations) {
79
+ for (const conversation of conversations) {
80
+ unindexMessages(connection, connection
81
+ .rows('SELECT id FROM conversation_messages WHERE conversation = ?', [conversation])
82
+ .map((row) => Number(row.id)));
83
+ connection.run('DELETE FROM conversation_messages WHERE conversation = ?', [conversation]);
84
+ connection.run('DELETE FROM conversation_reads WHERE conversation = ?', [conversation]);
85
+ }
86
+ }
87
+ export function forgottenMessages(connection) {
88
+ connection.run('DELETE FROM conversation_messages');
89
+ connection.run('DELETE FROM conversation_reads');
90
+ }
package/dist/model.d.ts CHANGED
@@ -29,12 +29,13 @@ export type ModelState = {
29
29
  types: VerifiedModel['types'];
30
30
  };
31
31
  export type TypesResult = {
32
- status: 'unavailable';
32
+ status: Open<'unavailable'>;
33
33
  reason: ModelUnavailableReason;
34
+ types: null;
34
35
  schema?: string | null;
35
36
  revision?: string | null;
36
37
  } | {
37
- status: 'current' | 'cached';
38
+ status: Open<'current' | 'cached'>;
38
39
  identity: string;
39
40
  version: string;
40
41
  verifiedWith: ModelIdentity;
@@ -52,5 +53,6 @@ export declare function definitionOf(state: ModelState, type: string | undefined
52
53
  export declare function modelTypes(state: ModelState): TypesResult;
53
54
  export declare function cached(state: ModelState): ModelState;
54
55
  export declare function sameModel(left: ModelIdentity, right: ModelIdentity): boolean;
56
+ export declare function sameTyping(left: ModelState, right: ModelState): boolean;
55
57
  export declare function referenceField(facts: ValueFacts | undefined): boolean;
56
58
  //# sourceMappingURL=model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAC/F,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,CAAC,CAAC;AACnG,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,CAAC;AAClE,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAChC,MAAM,MAAM,UAAU,GAClB;IACE,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,GACD;IACE,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;IA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