@agentshouse/mdruntime-families 0.1.0-c686d19f36a21 → 0.1.0-c68df10f5cb2e

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.
@@ -32,25 +32,20 @@ export type Capability = {
32
32
  name: string;
33
33
  limits?: readonly ProviderLimit[];
34
34
  actions?: readonly ActionDeclaration[];
35
- conversationAgents?: ConversationAgents;
36
- };
37
- export type ConversationAgents = {
38
- locator: string;
39
- type: string;
40
- identity: string;
41
- name: string;
42
- retired?: string;
43
35
  };
44
36
  export type ListedConversation = {
45
37
  conversation: string;
46
38
  agent: string;
39
+ agentName: string;
40
+ agentRetired: boolean;
47
41
  name: string;
48
42
  created: string;
49
43
  finished: string | null;
50
44
  outcome: string | null;
51
45
  waiting: boolean;
46
+ newest: string | null;
52
47
  };
53
- export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.attach' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
48
+ export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
54
49
  export type ConversationMessage = {
55
50
  identity: string;
56
51
  turn: string;
@@ -141,6 +136,10 @@ export type SessionOption = (SessionOptionNaming & {
141
136
  type: 'boolean';
142
137
  currentValue: boolean;
143
138
  });
139
+ export type RunningSubagent = {
140
+ description: string;
141
+ activity: string | null;
142
+ };
144
143
  export type ConversationEvent = {
145
144
  kind: 'turn';
146
145
  conversation: string;
@@ -166,6 +165,10 @@ export type ConversationEvent = {
166
165
  kind: 'starting';
167
166
  conversation: string;
168
167
  step: string | null;
168
+ } | {
169
+ kind: 'subagents';
170
+ conversation: string;
171
+ subagents: readonly RunningSubagent[];
169
172
  } | {
170
173
  kind: 'link';
171
174
  conversation: string;
@@ -184,6 +187,9 @@ export type ConversationEvent = {
184
187
  } | {
185
188
  kind: 'list';
186
189
  entries: readonly ListedConversation[];
190
+ whole: boolean;
191
+ more: boolean;
192
+ cursor: string | null;
187
193
  } | {
188
194
  kind: 'listed';
189
195
  entry: ListedConversation;
@@ -191,9 +197,17 @@ export type ConversationEvent = {
191
197
  kind: 'unlisted';
192
198
  conversation: string;
193
199
  };
200
+ export type ListedAgent = {
201
+ agent: string;
202
+ name: string;
203
+ retired: boolean;
204
+ };
194
205
  export type ConversationStream = {
195
206
  replicate(conversations: readonly string[]): void;
207
+ hold(cursor: string | null): void;
196
208
  observe(notify: (event: ConversationEvent) => void): () => void;
209
+ agents?(): Promise<readonly ListedAgent[] | null>;
210
+ history?(request: ConversationHistoryRequest): Promise<ActionResult>;
197
211
  };
198
212
  export type ActionDeclaration = {
199
213
  name: string;
@@ -223,10 +237,6 @@ export type Discovery = {
223
237
  providerLimits: readonly ProviderLimit[];
224
238
  retention: Retention;
225
239
  member?: Member;
226
- covered?: readonly string[];
227
- };
228
- export type DiscoveryScope = {
229
- readonly authorities: readonly string[];
230
240
  };
231
241
  export type TransportUncertainty = {
232
242
  kind: 'transport-uncertainty';
@@ -255,7 +265,7 @@ export type ContractUnavailable = ProviderRefusal & {
255
265
  export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
256
266
  export type PageToken = string;
257
267
  export type ChangeAuthor = {
258
- kind: Open<'user' | 'site' | 'inbox'>;
268
+ kind: Open<'user' | 'site' | 'inbox' | 'app'>;
259
269
  id: string;
260
270
  name: string;
261
271
  };
@@ -289,16 +299,14 @@ export type BootstrapRequest = {
289
299
  selection: string;
290
300
  pageToken?: PageToken;
291
301
  held?: HeldContent;
292
- received?: Uint8Array;
293
302
  arriving?: (bytes: number) => void;
303
+ signal?: AbortSignal;
294
304
  };
295
305
  export type BootstrapInventory = {
296
- readonly parts: number;
297
306
  readonly bytes: number;
298
307
  };
299
308
  export type RoomModels = {
300
309
  collection?: ModelResult;
301
- selection?: ModelResult;
302
310
  };
303
311
  export type BootstrapPage = {
304
312
  kind: 'bootstrap';
@@ -311,8 +319,7 @@ export type BootstrapPage = {
311
319
  binaryFiles: Readonly<Record<string, BinaryFile>>;
312
320
  folders?: readonly string[];
313
321
  pageToken?: PageToken;
314
- inventory?: BootstrapInventory;
315
- received?: Uint8Array;
322
+ bytes?: number;
316
323
  };
317
324
  export type BootstrapResult = BootstrapPage | {
318
325
  kind: 'beyond-horizon';
@@ -387,7 +394,7 @@ export type HistoryAuthor = {
387
394
  kind: 'user';
388
395
  id: string;
389
396
  } | {
390
- kind: 'site' | 'inbox';
397
+ kind: 'site' | 'inbox' | 'app';
391
398
  id: string;
392
399
  name: string;
393
400
  };
@@ -432,6 +439,22 @@ export type BinaryLinkResult = {
432
439
  kind: 'link';
433
440
  url: string;
434
441
  name: string;
442
+ mediaType?: string;
443
+ } | (ProviderRefusal & {
444
+ kind: 'rejected';
445
+ }) | AdapterFailure;
446
+ export type AttachRequest = {
447
+ locator: string;
448
+ name: string;
449
+ mediaType: string;
450
+ byteLength: number;
451
+ sha256: string;
452
+ blob: Blob;
453
+ };
454
+ export type AttachResult = {
455
+ kind: 'attached';
456
+ path: string;
457
+ revision: string;
435
458
  } | (ProviderRefusal & {
436
459
  kind: 'rejected';
437
460
  }) | AdapterFailure;
@@ -454,55 +477,49 @@ export type HeldRoom = {
454
477
  locator: string;
455
478
  roomVersion: string;
456
479
  };
457
- export type HeldRevisions = (locator: string, paths: readonly string[]) => Promise<ReadonlyMap<string, string>>;
480
+ export type RoomChange = {
481
+ kind: 'room-change';
482
+ locator: string;
483
+ from: string;
484
+ roomVersion: string;
485
+ read(): Promise<RefreshPage>;
486
+ };
487
+ export type AuthorityChange = {
488
+ kind: 'authority-changed';
489
+ rooms: readonly DiscoveredRoom[];
490
+ left: readonly string[];
491
+ member?: Member;
492
+ };
458
493
  export type RoomStreamEvent = {
459
494
  kind: 'opened';
495
+ } | {
496
+ kind: 'discovered';
497
+ discovery: Discovery;
460
498
  } | {
461
499
  kind: 'closed';
462
500
  revoked: boolean;
463
501
  lost: boolean;
464
502
  } | {
465
- kind: 'opening';
503
+ kind: 'caught-up';
466
504
  expired: readonly string[];
467
- } | {
468
- kind: 'authority-changed';
469
- scope?: DiscoveryScope;
470
- } | {
471
- kind: 'room-version';
472
- locator: string;
473
- roomVersion: string;
474
- };
475
- export type KeptReceipt = {
476
- key: string;
477
- head: unknown;
478
- };
479
- export type StreamReceipts = {
480
- heads(): Promise<readonly KeptReceipt[]>;
481
- parts(key: string, count: number): Promise<readonly unknown[]>;
482
- keep(key: string, head: unknown, part?: {
483
- index: number;
484
- value: unknown;
485
- }): Promise<void>;
486
- drop(keys: readonly string[]): Promise<void>;
487
- };
505
+ } | AuthorityChange | RoomChange;
488
506
  export type RoomStream = {
489
507
  hold(rooms: readonly HeldRoom[]): void;
490
- reopen(): void;
491
- published(locator: string, roomVersion: string): void;
492
- observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts, revisions: HeldRevisions): () => void;
508
+ observe(notify: (event: RoomStreamEvent) => void): () => void;
493
509
  };
494
510
  export type Adapter = {
495
511
  readonly localSaves?: true;
496
- readonly exhaustiveDiscovery?: true;
497
512
  readonly roomTypes?: string;
513
+ readonly nameableRoomTypes?: readonly string[];
498
514
  authorize(): Promise<Authorization>;
499
- discover(authorization: Authorization, scope?: DiscoveryScope): Promise<DiscoverResult>;
515
+ discover?(authorization: Authorization): Promise<DiscoverResult>;
500
516
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
501
- refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
517
+ refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
502
518
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
503
519
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
504
520
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
505
521
  link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
522
+ attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
506
523
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
507
524
  reached(locator: string, roomVersion: string, target: string): boolean;
508
525
  follows(locator: string, roomVersion: string, next: string): boolean;
@@ -1,9 +1,8 @@
1
1
  import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult } from './connection.js';
2
2
  import type { Member, ServiceMode } from './adapter.js';
3
- import type { ChatDraft, ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
3
+ import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
4
4
  import { type Observation } from './observation.js';
5
- import type { ChosenFile } from './file.js';
6
- import type { BinaryAnswer, BinaryLinkAnswer, CallResult, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
5
+ import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
7
6
  import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
8
7
  import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
9
8
  import type { SearchRequest, SearchResult } from './search.js';
@@ -36,11 +35,9 @@ export type MdRuntimeClient = {
36
35
  read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
37
36
  create(input: unknown): Promise<CallResult>;
38
37
  send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
39
- attach(room: string, file: ChosenFile): Promise<CallResult | Offline>;
40
- answer(conversation: string, answer: unknown): Promise<CallResult>;
38
+ answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
41
39
  interrupt(conversation: string): Promise<CallResult>;
42
40
  kill(conversation: string): Promise<CallResult>;
43
- cancel(conversation: string, turn: string): Promise<CallResult>;
44
41
  delete(conversation: string): Promise<CallResult>;
45
42
  };
46
43
  chatDraft: {
@@ -52,7 +49,8 @@ export type MdRuntimeClient = {
52
49
  resolve(room: string, path: string, destination: string): Promise<Resolution>;
53
50
  binaryFile: {
54
51
  read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
55
- link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
52
+ attach(room: string, file: File): Promise<AttachAnswer>;
53
+ download(room: string, path: string, revision?: string): Promise<DownloadAnswer>;
56
54
  };
57
55
  call(name: string, input: unknown): Promise<CallResult>;
58
56
  reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
@@ -69,6 +67,7 @@ export type MdRuntimeClient = {
69
67
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
70
68
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
71
69
  (topic: 'member'): Promise<Observation<Member | null>>;
70
+ (topic: 'authority-changes'): Promise<Observation<number>>;
72
71
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
73
72
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
74
73
  (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
@@ -85,6 +84,7 @@ export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
85
84
  export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
86
85
  export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
87
86
  export { roomDraftRevision } from './identity.js';
87
+ export { defineRoomMedia, ROOM_MEDIA } from './media.js';
88
88
  export type { Observation } from './observation.js';
89
89
  export type { Open } from './open.js';
90
90
  export { unanswered, type RuntimePort, type WireMember } from './wire.js';
@@ -1,8 +1,6 @@
1
1
  import { type Document } from '@agentshouse/mdmodel';
2
2
  import type { ModelState } from './model.js';
3
3
  import type { MdModelIdentity } from './adapter.js';
4
- import { type Paths } from './shared.js';
5
- import type { Refused } from './transfer.js';
6
4
  export declare const MD_MODEL: MdModelIdentity;
7
5
  export type Collection = {
8
6
  text: Readonly<Record<string, string>>;
@@ -16,10 +14,14 @@ export type Composition = {
16
14
  model: ModelState;
17
15
  } | null;
18
16
  };
17
+ export type Composed = {
18
+ readonly composition: Composition;
19
+ readonly fingerprint: string;
20
+ };
21
+ export declare function composedOf(composition: Composition): Composed;
19
22
  export declare function selected(composition: Composition, path: string): boolean;
20
23
  export declare function governing(composition: Composition, path: string): ModelState;
21
24
  export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
22
25
  export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
23
- export declare function unreadable(text: Paths<string>, paths?: Iterable<string> | null): Generator<number, Refused | null, void>;
24
26
  export declare function validRoot(root: unknown): root is string;
25
27
  export declare function available(composition: Composition): boolean;
@@ -7,7 +7,7 @@ import { type Adapter, type Authorization, type Member, type ProviderRefusal, ty
7
7
  import { type ChatDraftSurface, type ConversationAgent, type ConversationEntry, type ConversationOptions, type ConversationSurface, type ConversationView } from './conversation.js';
8
8
  import { type WrittenBy } from './change.js';
9
9
  import type { Open } from './open.js';
10
- import { type BinaryLinkAnswer, type CallResult, type HeldBinaryAnswer, type HistoryAnswer, type QueueEntry, type Resolution } from './outcome.js';
10
+ import { type AttachAnswer, type BinaryLinkAnswer, type CallResult, type HeldBinaryAnswer, type HeldShownAnswer, type HistoryAnswer, type QueueEntry, type Resolution } from './outcome.js';
11
11
  import { type Recovery } from './recovery.js';
12
12
  import { type SaveRefusal } from './save.js';
13
13
  import { type RoomDraft, type RoomDraftParts, type RoomDraftWrite } from './room-draft.js';
@@ -54,6 +54,7 @@ export type MdRuntimeOptions = {
54
54
  authorization?: Authorization;
55
55
  signal?: AbortSignal;
56
56
  recovery?: Recovery;
57
+ usableWhenHeld?: readonly string[];
57
58
  };
58
59
  export type SaveResult = {
59
60
  outcome: 'saved';
@@ -83,6 +84,8 @@ export type PresentationSurface = {
83
84
  export type BinaryFileSurface = {
84
85
  read(room: string, path: string, revision?: string): Promise<HeldBinaryAnswer>;
85
86
  link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
87
+ show(room: string, path: string, revision?: string): Promise<HeldShownAnswer>;
88
+ attach(room: string, file: File): Promise<AttachAnswer>;
86
89
  part(file: string, part: number): Promise<Uint8Array | null>;
87
90
  };
88
91
  export type HistoryQuery = {
@@ -91,7 +94,7 @@ export type HistoryQuery = {
91
94
  };
92
95
  export type MdRuntime = {
93
96
  loaded(): Promise<void>;
94
- rooms(): readonly AppRoom[];
97
+ rooms(): Promise<readonly AppRoom[]>;
95
98
  query: {
96
99
  (query: DocumentQuery): Promise<DocumentResult | PendingResult>;
97
100
  (query: GroupQuery): Promise<GroupResult | PendingResult>;
@@ -121,6 +124,7 @@ export type MdRuntime = {
121
124
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
122
125
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
123
126
  (topic: 'member'): Promise<Observation<Member | null>>;
127
+ (topic: 'authority-changes'): Promise<Observation<number>>;
124
128
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
125
129
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
126
130
  (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
@@ -132,7 +136,7 @@ export type MdRuntime = {
132
136
  };
133
137
  reauthorize(): Promise<void>;
134
138
  };
135
- export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents';
139
+ export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'authority-changes' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents';
136
140
  export type ReadinessPort = {
137
141
  readonly target: string;
138
142
  readonly code: CodeAvailability;
@@ -142,9 +146,7 @@ export type ReadinessPort = {
142
146
  export type ComposedRuntime = RuntimeView & {
143
147
  seed(entry: EntrySeed): void;
144
148
  stop(): Promise<void>;
145
- lose(locators: readonly string[]): Promise<void>;
146
149
  persisted(answer: Persistence): void;
147
- shown(onScreen: boolean): void;
148
150
  within(reach: PortReach | null, port: ReadinessPort): NarrowedView;
149
151
  };
150
152
  export declare function composeRuntime(options: MdRuntimeOptions): ComposedRuntime;
@@ -1,9 +1,7 @@
1
- import type { ConversationAction, ConversationAgents, ConversationEvent, ConversationMessage, ConversationStream, ProcessCommand, SessionOption, TurnContext } from './adapter.js';
1
+ import type { ConversationAction, ConversationEvent, ConversationHistoryRequest, ConversationMessage, ConversationStream, ListedConversation, ProcessCommand, RunningSubagent, SessionOption, TurnContext } from './adapter.js';
2
2
  import { type ChangeSet } from './change-set.js';
3
- import { type ChosenFile } from './file.js';
4
3
  import type { Open } from './open.js';
5
4
  import { type CallResult, type Offline } from './outcome.js';
6
- import type { DocumentResult, PendingResult } from './query.js';
7
5
  import type { CycleProgress } from './status.js';
8
6
  import type { ChatDraftRecord, HeldConversation, RuntimeStore } from './store.js';
9
7
  export type ConversationState = Open<'working' | 'asking' | 'idle'>;
@@ -11,7 +9,7 @@ export type ConversationEntry = {
11
9
  conversation: string;
12
10
  agent: {
13
11
  identity: string;
14
- name: string | null;
12
+ name: string;
15
13
  };
16
14
  name: string;
17
15
  created: string;
@@ -52,6 +50,7 @@ export type ConversationView = {
52
50
  commands: readonly ProcessCommand[];
53
51
  options: readonly SessionOption[];
54
52
  starting: string | null;
53
+ subagents: readonly RunningSubagent[];
55
54
  link: {
56
55
  connected: boolean;
57
56
  } | null;
@@ -65,22 +64,23 @@ export type ConversationSurface = {
65
64
  read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
66
65
  create(input: unknown): Promise<CallResult>;
67
66
  send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
68
- attach(room: string, file: ChosenFile): Promise<CallResult | Offline>;
69
- answer(conversation: string, answer: unknown): Promise<CallResult>;
67
+ answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
70
68
  interrupt(conversation: string): Promise<CallResult>;
71
69
  kill(conversation: string): Promise<CallResult>;
72
- cancel(conversation: string, turn: string): Promise<CallResult>;
73
70
  delete(conversation: string): Promise<CallResult>;
74
71
  };
72
+ export type ConversationAnswer = {
73
+ interaction_id: string;
74
+ response: unknown;
75
+ };
75
76
  export type ChatDraftSurface = {
76
77
  write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
77
78
  prepend(conversation: string, draft: ChatDraft): Promise<void>;
78
79
  discard(conversation: string): Promise<void>;
79
80
  };
80
81
  export type ConversationDependencies = {
81
- agents(): ConversationAgents | undefined;
82
- documents(agents: ConversationAgents, after: string | undefined): Promise<DocumentResult | PendingResult>;
83
82
  call(name: ConversationAction, input: unknown): Promise<CallResult>;
83
+ history(request: ConversationHistoryRequest): Promise<CallResult>;
84
84
  durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
85
85
  stream(): ConversationStream | undefined;
86
86
  publish(set: ChangeSet): void;
@@ -93,13 +93,13 @@ export type ConversationDependencies = {
93
93
  export type ConversationStore = {
94
94
  surface: ConversationSurface;
95
95
  chatDraft: ChatDraftSurface;
96
- hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[]): void;
96
+ hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[], list: readonly ListedConversation[] | null, cursor: string | null): void;
97
97
  reconcile(): Promise<void>;
98
98
  catchUp(progress: CycleProgress): Promise<void>;
99
99
  resend(progress: CycleProgress): Promise<void>;
100
100
  current(): boolean;
101
101
  known(): boolean;
102
- reconnected(): void;
102
+ learned(): void;
103
103
  reopened(): void;
104
104
  lost(): void;
105
105
  watch(conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
@@ -2,7 +2,6 @@ import type { Persistence } from './readiness.js';
2
2
  export type RuntimeShell = {
3
3
  persistence: Persistence;
4
4
  generation: string | null;
5
- onScreen: boolean;
6
5
  keepGeneration(value: string): void | Promise<void>;
7
6
  dropGeneration(): void | Promise<void>;
8
7
  cleanUp?(): Promise<number>;
@@ -0,0 +1,7 @@
1
+ import type { MdRuntimeClient } from './client.js';
2
+ import { type ShownAnswer } from './outcome.js';
3
+ export declare const ROOM_MEDIA = "room-media";
4
+ type Show = (room: string, path: string, revision?: string) => Promise<ShownAnswer>;
5
+ export declare function shownBy(show: Show, client: MdRuntimeClient): MdRuntimeClient;
6
+ export declare function defineRoomMedia(client: Promise<MdRuntimeClient> | MdRuntimeClient, registry?: CustomElementRegistry): void;
7
+ export {};
@@ -28,6 +28,11 @@ export type ModelState = {
28
28
  verifiedWith: ModelIdentity;
29
29
  types: VerifiedModel['types'];
30
30
  };
31
+ export type StoredModel = Extract<ModelState, {
32
+ status: 'unavailable';
33
+ }> | Omit<Extract<ModelState, {
34
+ status: 'current' | 'cached';
35
+ }>, 'types'>;
31
36
  export type TypesResult = {
32
37
  status: Open<'unavailable'>;
33
38
  reason: ModelUnavailableReason;
@@ -51,7 +56,7 @@ export type ValidationReceipt = {
51
56
  export declare const NO_MODEL: ModelState;
52
57
  export declare function definitionOf(state: ModelState, type: string | undefined): Definition | undefined;
53
58
  export declare function modelTypes(state: ModelState): TypesResult;
59
+ export declare function storedModel(state: ModelState): StoredModel;
54
60
  export declare function cached(state: ModelState): ModelState;
55
61
  export declare function sameModel(left: ModelIdentity, right: ModelIdentity): boolean;
56
- export declare function sameTyping(left: ModelState, right: ModelState): boolean;
57
62
  export declare function referenceField(facts: ValueFacts | undefined): boolean;
@@ -38,6 +38,7 @@ export type Digest = {
38
38
  readonly next: string | undefined;
39
39
  readonly total: number | undefined;
40
40
  };
41
+ export declare function hashed(text: string): number;
41
42
  export declare function digestOf({ result, keys }: KeyedResult): Digest;
42
43
  export declare function digestApplied(digest: Digest, message: QueryMessage): Digest;
43
44
  export declare function changeOf(previous: Digest, next: KeyedResult): QueryMessage | null;
@@ -1,4 +1,4 @@
1
- import type { ActionResult, AdapterFailure, BinaryLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
1
+ import type { ActionResult, AdapterFailure, AttachResult, BinaryLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
2
2
  import type { ChangeBatch } from './change.js';
3
3
  import type { KeptBinary, KeptResult } from './opened.js';
4
4
  type Refused<Kind extends string> = ProviderRefusal & {
@@ -29,7 +29,17 @@ export type BinaryLinkAnswer = {
29
29
  kind: 'link';
30
30
  url: string;
31
31
  name: string;
32
+ mediaType: string;
32
33
  } | Refused<'rejected'> | Refused<'absent'> | Failure;
34
+ export type HeldShownAnswer = KeptBinary | BinaryLinkAnswer;
35
+ export type ShownAnswer = BinaryAnswer | BinaryLinkAnswer;
36
+ export type AttachAnswer = {
37
+ kind: 'attached';
38
+ path: string;
39
+ } | Offline | Refused<'rejected'> | Failure;
40
+ export type DownloadAnswer = {
41
+ kind: 'started';
42
+ } | Refused<'rejected'> | Refused<'absent'> | Refused<'blocked'> | Failure;
33
43
  export type Resolution = {
34
44
  readonly kind: 'document';
35
45
  readonly room: string;
@@ -45,7 +55,8 @@ export declare const LOCKED_UNREADABLE: Refused<'unreadable'>;
45
55
  export declare const ABSENT_TARGET: Refused<'absent'>;
46
56
  export declare function absentBinary(path: string): Refused<'absent'>;
47
57
  export declare function binaryAnswer(result: KeptResult): HeldBinaryAnswer;
48
- export declare function binaryLinkAnswer(result: BinaryLinkResult): BinaryLinkAnswer;
58
+ export declare function binaryLinkAnswer(result: BinaryLinkResult, held?: string): BinaryLinkAnswer;
59
+ export declare function attachAnswer(result: AttachResult): AttachAnswer;
49
60
  export declare const ROOM_LOCKED = "room-locked";
50
61
  export declare function lockedRoom(locator: string): Refused<'room-locked'> & {
51
62
  locator: string;
@@ -69,8 +80,5 @@ export type QueueEntry = {
69
80
  readonly batch: ChangeBatch;
70
81
  } & (Submission | {
71
82
  readonly state: 'local';
72
- } | {
73
- readonly state: 'accepted';
74
- readonly roomVersion: string;
75
83
  });
76
84
  export {};
@@ -232,9 +232,15 @@ export type GroupShape = {
232
232
  direction: Direction;
233
233
  }[];
234
234
  };
235
+ export type PlanArea = {
236
+ room: string;
237
+ path: string;
238
+ open: readonly string[];
239
+ };
235
240
  export type PlanReach = {
236
241
  rooms: readonly string[];
237
242
  documents: readonly string[];
243
+ areas: readonly PlanArea[];
238
244
  };
239
245
  export type Continuation = {
240
246
  text: string;
@@ -1,4 +1,4 @@
1
- import type { MdRuntime, ReadinessPort, RuntimeTopic } from './connection.js';
1
+ import type { AppRoom, MdRuntime, ReadinessPort, RuntimeTopic } from './connection.js';
2
2
  import type { Plan, PlanReach, QueryResult } from './query.js';
3
3
  import type { Readiness } from './readiness.js';
4
4
  import { type SearchResult } from './search.js';
@@ -6,9 +6,15 @@ export type ReachedDocument = {
6
6
  readonly room: string;
7
7
  readonly path: string;
8
8
  };
9
+ export type ReachedArea = {
10
+ readonly room: string;
11
+ readonly path: string;
12
+ readonly open: readonly string[];
13
+ };
9
14
  export type PortReach = {
10
15
  readonly rooms: readonly string[];
11
16
  readonly documents: readonly ReachedDocument[];
17
+ readonly areas?: readonly ReachedArea[];
12
18
  readonly conversations: boolean;
13
19
  };
14
20
  export type Deliver = (message: unknown) => void;
@@ -31,6 +37,7 @@ export type Reachable = RuntimeView & {
31
37
  lockedRooms(): readonly string[];
32
38
  watchLocks(notify: () => void): () => void;
33
39
  located(room: string, path: string, destination: string): ReachedDocument | null;
40
+ room(locator: string): AppRoom | undefined;
34
41
  };
35
42
  export declare function holds(reach: PortReach | null, room: string): boolean;
36
43
  export declare function governs(reach: PortReach | null, room: {
@@ -1,6 +1,6 @@
1
1
  import type { Open } from './open.js';
2
2
  export type CodeAvailability = Open<'stored' | 'absent'>;
3
- export type RoomPreparation = Open<'complete' | 'acquiring' | 'preparing' | 'refused' | 'unadmitted'>;
3
+ export type RoomPreparation = Open<'complete' | 'acquiring' | 'preparing' | 'unadmitted'>;
4
4
  export type RoomCoverage = {
5
5
  readonly room: string;
6
6
  readonly state: RoomPreparation;
@@ -19,28 +19,17 @@ export type Durability = Open<'persistent' | 'best-effort'>;
19
19
  export type ConnectionAvailability = Open<'connected' | 'connecting' | 'unreachable'>;
20
20
  export type HouseOutcome = Open<'open' | 'write-halted' | 'refused'>;
21
21
  export type Space = Open<'full'>;
22
- export type RefusedRoom = {
23
- readonly room: string;
24
- readonly name: string;
25
- readonly file: string;
26
- readonly rule: string;
27
- readonly location: string | null;
28
- };
29
- export type InstallationStep = Open<'listing' | 'downloading' | 'writing' | 'replaying'>;
30
- export type InstallationPause = Open<'hidden'>;
22
+ export type InstallationStep = Open<'downloading' | 'writing' | 'replaying'>;
31
23
  export type InstallationAmount = {
32
24
  readonly done: number;
33
25
  readonly total: number;
34
26
  };
35
27
  export type Installation = {
36
28
  readonly step: InstallationStep | null;
37
- readonly paused: InstallationPause | null;
38
29
  readonly rooms: InstallationAmount;
39
- readonly parts: InstallationAmount;
40
30
  readonly bytes: InstallationAmount;
41
- readonly received: InstallationAmount;
42
31
  };
43
- export type ReadinessStatus = Open<'preparing' | 'paused' | 'refused' | 'ready' | 'lost'>;
32
+ export type ReadinessStatus = Open<'preparing' | 'paused' | 'ready' | 'lost'>;
44
33
  export type Readiness = {
45
34
  readonly status: ReadinessStatus;
46
35
  readonly ready: boolean;
@@ -53,7 +42,6 @@ export type Readiness = {
53
42
  readonly house: HouseOutcome;
54
43
  readonly space: Space | null;
55
44
  readonly installation: Installation;
56
- readonly refused: readonly RefusedRoom[];
57
45
  readonly lost: boolean;
58
46
  };
59
47
  export type ReadinessFacts = Omit<Readiness, 'status' | 'ready' | 'usable' | 'durability' | 'coverage'> & {
@@ -21,4 +21,5 @@ export type Recovery = {
21
21
  retire(): Promise<void>;
22
22
  };
23
23
  export declare function retryDelay(tries: number, firstMs?: number, maxMs?: number): number;
24
+ export declare function untilAnswered<T>(ask: () => Promise<T>, signal: AbortSignal, answered?: (answer: T) => boolean): Promise<T>;
24
25
  export declare function createRecovery(options?: RecoveryOptions): Recovery;
@@ -1,7 +1,7 @@
1
1
  import type { BootstrapInventory, MutationResult, OperationScopes, ReplicaAdmission, TypedSelection } from './adapter.js';
2
2
  import { type ChangeBatch, type Precondition } from './change.js';
3
3
  import { type Collection, type Composition } from './collection.js';
4
- import type { ModelState } from './model.js';
4
+ import { type ModelState } from './model.js';
5
5
  import { type Layer } from './overlay.js';
6
6
  import type { HeldEntry, OverlayEntry, StoredEntry } from './tables.js';
7
7
  export type ReplicaRecord = {
@@ -12,11 +12,10 @@ export type ReplicaRecord = {
12
12
  readonly replica: ReplicaAdmission;
13
13
  readonly model: ModelState;
14
14
  readonly typedSelection: TypedSelection | null;
15
- readonly selectionModel: ModelState;
16
15
  readonly providerOwnedPaths: readonly string[];
17
16
  readonly roomVersion: string;
18
17
  readonly transfer: string;
19
- readonly inventory: BootstrapInventory | null;
18
+ readonly inventory: BootstrapInventory;
20
19
  readonly key: number;
21
20
  };
22
21
  export type HeldReplica = {
@@ -34,8 +33,7 @@ export type Slice = Layer & {
34
33
  readonly written: Readonly<Record<string, string>>;
35
34
  readonly held: ReadonlySet<string>;
36
35
  };
37
- export declare function compositionOf(record: Pick<ReplicaRecord, 'model' | 'typedSelection' | 'selectionModel'>): Composition;
38
- export declare function sameMembership(record: Pick<ReplicaRecord, 'typedSelection'>, other: Pick<ReplicaRecord, 'typedSelection'>): boolean;
36
+ export declare function compositionOf(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>, builtIn: ModelState): Composition;
39
37
  export declare function storedRecord(record: ReplicaRecord): string;
40
38
  export declare function slicing(entries: readonly HeldEntry[], paths: Iterable<string>): Generator<number, Slice, void>;
41
39
  export declare function entryAt(layer: Layer & {
@@ -40,6 +40,7 @@ export type RoomDraftParts = {
40
40
  };
41
41
  readonly file?: {
42
42
  readonly blob: Blob;
43
+ readonly base?: string | null;
43
44
  };
44
45
  };
45
46
  export type HeldFile = {
@@ -112,7 +113,7 @@ export type RoomDraftWrite = {
112
113
  export declare function staleWrite(current: RoomDraft | null): RoomDraftWrite;
113
114
  export type ChangedPart = {
114
115
  readonly path: string;
115
- readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | 'creation' | 'move' | 'removal' | 'file'>;
116
+ readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | 'move' | 'removal' | 'file'>;
116
117
  readonly name?: string;
117
118
  };
118
119
  export type RoomDraftRecord = {
@@ -132,7 +133,7 @@ export declare function held(current: HeldParts | undefined, parts: RoomDraftPar
132
133
  export declare function underneath(parts: HeldParts, path: string, visible: VisibleLayer | undefined): ChangedUnderneath;
133
134
  export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
134
135
  export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
135
- export declare function changedParts(path: string, report: ChangedUnderneath): readonly ChangedPart[];
136
+ export declare function changedParts(path: string, parts: HeldParts, visible: VisibleLayer | undefined): readonly ChangedPart[];
136
137
  export type TextParts = {
137
138
  readonly fields?: Readonly<Record<string, {
138
139
  readonly value: unknown;
@@ -149,6 +150,20 @@ export declare function returnedInto(existing: HeldParts | undefined, returned:
149
150
  export declare function moveTarget(move: {
150
151
  readonly to: string;
151
152
  }): string;
153
+ export declare function readSavedParts(named: readonly {
154
+ readonly path: string;
155
+ readonly parts: unknown;
156
+ }[]): readonly {
157
+ readonly path: string;
158
+ readonly parts: RoomDraftParts;
159
+ }[];
160
+ export declare function partsChanges(named: readonly {
161
+ readonly path: string;
162
+ readonly parts: unknown;
163
+ }[]): {
164
+ readonly changes: readonly Change[];
165
+ readonly preconditions: readonly Precondition[];
166
+ };
152
167
  export declare function changesOf(path: string, parts: HeldParts): {
153
168
  changes: readonly Change[];
154
169
  bases: readonly Precondition[];
@@ -21,6 +21,7 @@ export type SaveInput = {
21
21
  providerOwnedPaths: readonly string[];
22
22
  providerLimits: readonly ProviderLimit[];
23
23
  visible: VisibleLayer;
24
+ folders: ReadonlySet<string>;
24
25
  handle: string;
25
26
  changes: readonly Change[];
26
27
  bases: readonly Precondition[];
@@ -75,6 +76,7 @@ export type MoveSide = {
75
76
  operations: OperationScopes;
76
77
  providerOwnedPaths: readonly string[];
77
78
  visible: VisibleLayer;
79
+ folders: ReadonlySet<string>;
78
80
  queued: ReadonlySet<string>;
79
81
  unmodeled: boolean;
80
82
  validate: Validator;
@@ -1,19 +1,20 @@
1
1
  import type { Open } from './open.js';
2
- import type { ProviderRefusal } from './adapter.js';
3
2
  import type { ReturnReason } from './room-draft.js';
4
3
  export type AttentionEntry = {
5
4
  room: string;
6
5
  path: string;
7
6
  returned: ReturnReason;
8
- } | {
7
+ };
8
+ export type UnsentChange = {
9
9
  room: string;
10
- refusal: ProviderRefusal;
10
+ path: string;
11
11
  };
12
12
  export type SyncStatus = {
13
13
  state: Open<'pending' | 'syncing' | 'synced'>;
14
14
  lastCompleted: string | null;
15
15
  providerUnreachable: boolean;
16
16
  attentionRequired: readonly AttentionEntry[];
17
+ unsent: readonly UnsentChange[];
17
18
  reset: string | null;
18
19
  };
19
20
  export type CycleProgress = {
@@ -1,40 +1,34 @@
1
- import type { BootstrapInventory, Capability, KeptReceipt, Member, ProviderLimit } from './adapter.js';
1
+ import type { BootstrapInventory, Capability, ListedConversation, Member, ProviderLimit } from './adapter.js';
2
2
  import type { ChangeBatch } from './change.js';
3
- import type { Composition } from './collection.js';
3
+ import { type Composition } from './collection.js';
4
4
  import type { Plan } from './query.js';
5
5
  import type { ReplicaRecord } from './replica.js';
6
6
  import type { Submission } from './outcome.js';
7
7
  import type { RoomDraftRecord, SavedDraft } from './room-draft.js';
8
- import type { ModelState } from './model.js';
8
+ import type { ModelState, StoredModel } from './model.js';
9
9
  import type { SearchWindow } from './search.js';
10
- import type { CommittedWrite, ConversationWrite, CountedRoom, HeldConversation, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, SearchAsk, StoredEntry, StoredFile, TypedEntry, View, Walked } from './tables.js';
10
+ import type { CommittedWrite, ConversationWrite, CountedRoom, HeldConversation, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, SearchAsk, StoredEntry, StoredFile, TypedEntry, View } from './tables.js';
11
11
  export type { ConversationWrite, HeldConversation, MessageWindow } from './tables.js';
12
- export type TransferWriting = {
13
- readonly token: string | null;
14
- readonly written: number;
15
- };
16
12
  export type TransferRecord = {
17
13
  readonly locator: string;
18
14
  readonly transfer: string;
19
15
  readonly selection: string;
20
16
  readonly from: string;
21
17
  readonly last: string;
22
- readonly pageToken: string | null;
23
- readonly writing: TransferWriting | null;
24
- readonly inventory: BootstrapInventory | null;
25
18
  readonly done: BootstrapInventory;
26
19
  readonly models: {
27
20
  readonly collection: ModelState;
28
- readonly selection: ModelState;
29
21
  };
30
22
  readonly key: number | null;
31
23
  };
24
+ export type StoredReplica = Omit<ReplicaRecord, 'model'> & {
25
+ readonly model: StoredModel;
26
+ };
32
27
  export type PendingState = {
33
28
  readonly drafts: readonly SavedDraft[];
34
29
  readonly submission: Submission;
35
30
  readonly lost: boolean;
36
31
  readonly upload?: unknown;
37
- readonly accepted?: string;
38
32
  };
39
33
  export type TargetRecord = {
40
34
  established: boolean;
@@ -74,10 +68,6 @@ export type AuthoredWrite = {
74
68
  saved?: ReadonlyMap<string, readonly SavedDraft[]>;
75
69
  roomDrafts?: readonly RoomDraftRecord[];
76
70
  consumedRoomDrafts?: readonly string[];
77
- accepted?: readonly {
78
- readonly id: string;
79
- readonly roomVersion: string;
80
- }[];
81
71
  };
82
72
  export type StagedPage = {
83
73
  readonly entries: readonly StoredEntry[];
@@ -88,8 +78,7 @@ export type RefreshedPage = StagedPage & {
88
78
  readonly folderRemovals: readonly string[];
89
79
  };
90
80
  export type Opened = {
91
- readonly rooms: ReadonlyMap<string, ReplicaRecord>;
92
- readonly transfers: ReadonlyMap<string, TransferRecord>;
81
+ readonly rooms: ReadonlyMap<string, StoredReplica>;
93
82
  readonly unindexed: ReadonlySet<number>;
94
83
  readonly overlaid: ReadonlyMap<number, ReadonlySet<string>>;
95
84
  readonly erasing: boolean;
@@ -100,6 +89,8 @@ export type Opened = {
100
89
  readonly member: Member | null;
101
90
  readonly targets: Readonly<Record<string, TargetRecord>>;
102
91
  readonly presentation: readonly PresentationRecord[];
92
+ readonly conversationList: readonly ListedConversation[] | null;
93
+ readonly conversationCursor: string | null;
103
94
  };
104
95
  export type Commit = {
105
96
  readonly rooms: readonly RoomCommit[];
@@ -116,24 +107,25 @@ export type RuntimeStore = {
116
107
  entries(key: number, view: View, paths: readonly string[]): Promise<readonly HeldEntry[]>;
117
108
  typed(key: number, view: View, paths: readonly string[]): Promise<readonly TypedEntry[]>;
118
109
  referrers(key: number, view: View, targets: readonly string[], kinds: readonly string[]): Promise<readonly Referrer[]>;
119
- walk(key: number, view: View, after: string | null, bytes: number): Promise<Walked>;
120
110
  files(key: number, view: View, after: string | null, limit: number): Promise<readonly {
121
111
  readonly path: string;
122
112
  readonly revision: string;
123
113
  }[]>;
114
+ folders(key: number, view: View, paths: readonly string[]): Promise<readonly string[]>;
124
115
  typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
125
116
  search(ask: SearchAsk): Promise<SearchWindow>;
126
- stage(record: TransferRecord, composition: Composition, page: StagedPage, written?: string): Promise<number | null>;
127
- transferPart(locator: string, token: string): Promise<Uint8Array | null>;
128
- keepPart(locator: string, token: string, part: Uint8Array): Promise<void>;
129
- refresh(key: number, page: RefreshedPage): Promise<void>;
117
+ stage(record: TransferRecord, composition: Composition, page: StagedPage): Promise<number | null>;
118
+ refresh(key: number, composition: Composition, page: RefreshedPage): Promise<void>;
130
119
  unrefresh(key: number): Promise<void>;
131
120
  commit(commit: Commit): Promise<CommittedWrite>;
132
121
  fence(locators: readonly string[]): Promise<void>;
133
122
  erase(locator: string | null, limit: number): Promise<boolean>;
134
- abandon(locator: string, kept?: boolean): Promise<number | null>;
123
+ abandon(locator: string): Promise<void>;
135
124
  release(key: number): Promise<void>;
136
- rederive(key: number, limit: number): Promise<boolean>;
125
+ rederive(key: number, composition: Composition, bytes: number, ms: number, floor: number): Promise<{
126
+ readonly done: boolean;
127
+ readonly text: number;
128
+ }>;
137
129
  fact(name: string, value: unknown): Promise<void>;
138
130
  queues(): Promise<readonly QueueRecord[]>;
139
131
  submit(locator: string, id: string, submission: Submission, lost: boolean): Promise<void>;
@@ -155,13 +147,6 @@ export type RuntimeStore = {
155
147
  keepRoomDraft(record: RoomDraftRecord, files: readonly StoredFile[]): Promise<void>;
156
148
  discardRoomDraft(locator: string, path: string): Promise<void>;
157
149
  fences(): Promise<readonly string[]>;
158
- receivedHeads(): Promise<readonly KeptReceipt[]>;
159
- receivedParts(key: string, count: number): Promise<readonly unknown[]>;
160
- keepReceived(key: string, head: unknown, part?: {
161
- index: number;
162
- value: unknown;
163
- }): Promise<void>;
164
- dropReceived(keys: readonly string[]): Promise<void>;
165
150
  generation(): Promise<string | null>;
166
151
  rememberGeneration(value: string): Promise<void>;
167
152
  file(key: string, type: string): Promise<Blob>;
@@ -1,5 +1,5 @@
1
1
  import type { HeadChange } from './adapter.js';
2
- import type { Composition } from './collection.js';
2
+ import { type Composed, type Composition } from './collection.js';
3
3
  import type { HeldBinary } from './overlay.js';
4
4
  import type { Connection } from './tables.js';
5
5
  export declare const REPLICA_TABLES: readonly string[];
@@ -34,6 +34,7 @@ export type HeldKey = {
34
34
  readonly locator: string;
35
35
  readonly transfer: string;
36
36
  readonly rederiving: number | null;
37
+ readonly searching: number | null;
37
38
  };
38
39
  export type ReplicaOpened = {
39
40
  readonly rooms: readonly {
@@ -41,11 +42,6 @@ export type ReplicaOpened = {
41
42
  readonly key: number;
42
43
  readonly record: string;
43
44
  }[];
44
- readonly transfers: readonly {
45
- readonly locator: string;
46
- readonly key: number;
47
- readonly record: string;
48
- }[];
49
45
  readonly keys: readonly HeldKey[];
50
46
  readonly facts: Readonly<Record<string, string>>;
51
47
  readonly presentation: readonly {
@@ -71,7 +67,7 @@ export type RoomCommit = {
71
67
  readonly from: number | null;
72
68
  };
73
69
  readonly refreshed?: true;
74
- readonly composition?: Composition;
70
+ readonly composed: Composed;
75
71
  readonly confirmed?: {
76
72
  readonly set: readonly StoredEntry[];
77
73
  readonly removed: readonly string[];
@@ -90,24 +86,18 @@ export type CountedRoom = {
90
86
  readonly key: number;
91
87
  readonly roots: readonly string[];
92
88
  };
93
- export type Walked = {
94
- readonly entries: readonly HeldEntry[];
95
- readonly next: string | null;
96
- };
97
- export declare function fingerprint(composition: Composition): string;
98
89
  export declare function entered(connection: Connection, locator: string, composition: Composition, rows: readonly StoredEntry[]): number;
99
90
  export declare function stage(connection: Connection, request: {
100
91
  readonly locator: string;
101
92
  readonly transfer: string;
102
- readonly record: string;
103
93
  readonly key: number | null;
104
- readonly composition: Composition;
94
+ readonly fingerprint: string;
105
95
  readonly entries: readonly StoredEntry[];
106
96
  readonly folders: readonly string[];
107
- readonly written?: string;
108
97
  }): number;
109
98
  export declare function refreshing(connection: Connection, request: {
110
99
  readonly key: number;
100
+ readonly composed: Composed;
111
101
  readonly entries: readonly StoredEntry[];
112
102
  readonly removals: readonly string[];
113
103
  readonly folders: readonly string[];
@@ -117,28 +107,23 @@ export declare function unrefresh(connection: Connection, key: number): null;
117
107
  export declare function counts(connection: Connection, rooms: readonly CountedRoom[]): number[];
118
108
  export declare function commit(connection: Connection, rooms: readonly RoomCommit[]): Committed;
119
109
  export declare function fenceRooms(connection: Connection, locators: readonly string[]): null;
120
- export declare function abandon(connection: Connection, locator: string, kept: boolean): number | null;
110
+ export declare function abandon(connection: Connection, locator: string): null;
121
111
  export declare function release(connection: Connection, key: number): null;
122
112
  export declare function erase(connection: Connection, locator: string | null, limit: number): {
123
113
  readonly remaining: boolean;
124
114
  };
125
- export declare function rederive(connection: Connection, key: number, limit: number): {
115
+ export declare function rederive(connection: Connection, key: number, composed: Composed, bytes: number, ms: number, floor: number): {
126
116
  readonly done: boolean;
117
+ readonly text: number;
127
118
  };
128
119
  export declare function entries(connection: Connection, key: number, view: View, list: readonly string[]): HeldEntry[];
129
120
  export declare function typed(connection: Connection, key: number, view: View, list: readonly string[]): TypedEntry[];
130
121
  export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[], kinds: readonly string[]): Referrer[];
131
- export declare function walk(connection: Connection, key: number, view: View, after: string | null, bytes: number): Walked;
132
122
  export declare function files(connection: Connection, key: number, view: View, after: string | null, limit: number): {
133
123
  readonly path: string;
134
124
  readonly revision: string;
135
125
  }[];
126
+ export declare function folders(connection: Connection, key: number, view: View, list: readonly string[]): string[];
136
127
  export declare function typedWithin(connection: Connection, key: number, view: View, roots: readonly string[], within: boolean): boolean;
137
- export declare function transferPart(connection: Connection, locator: string, token: string): Uint8Array | null;
138
- export declare function keepPart(connection: Connection, request: {
139
- readonly locator: string;
140
- readonly token: string;
141
- readonly part: Uint8Array;
142
- }): null;
143
128
  export declare function opened(connection: Connection): ReplicaOpened;
144
129
  export declare function ended(connection: Connection): void;
@@ -1,12 +1,11 @@
1
1
  import { type QueryAnswer, type QueryRoom } from './compile.js';
2
- import type { KeptReceipt } from './adapter.js';
3
- import type { Composition } from './collection.js';
2
+ import type { Composed } from './collection.js';
4
3
  import { type SearchAsk } from './fulltext.js';
5
4
  import { type ConversationWrite, type HeldConversation, type MessageWindow } from './messages.js';
6
5
  import type { Plan } from './query.js';
7
6
  import type { SearchWindow } from './search.js';
8
- import { type Committed, type CountedRoom, type HeldEntry, type ReplicaOpened, type Referrer, type RoomCommit, type StoredEntry, type TypedEntry, type View, type Walked } from './stored.js';
9
- export type { Committed, CountedRoom, HeldEntry, OverlayEntry, ReplicaOpened, Referrer, RoomCommit, StoredEntry, TypedEntry, View, Walked, } from './stored.js';
7
+ import { type Committed, type CountedRoom, type HeldEntry, type ReplicaOpened, type Referrer, type RoomCommit, type StoredEntry, type TypedEntry, type View } from './stored.js';
8
+ export type { Committed, CountedRoom, HeldEntry, OverlayEntry, ReplicaOpened, Referrer, RoomCommit, StoredEntry, TypedEntry, View, } from './stored.js';
10
9
  export type { QueryAnswer, QueryRoom } from './compile.js';
11
10
  export type { SearchAsk } from './fulltext.js';
12
11
  export type { ConversationWrite, HeldConversation, MessageWindow } from './messages.js';
@@ -78,10 +77,6 @@ export type AuthoredRows = {
78
77
  readonly path: string;
79
78
  })[];
80
79
  readonly consumedRoomDrafts?: readonly string[];
81
- readonly amendments?: readonly {
82
- readonly id: string;
83
- readonly amendment: string;
84
- }[];
85
80
  };
86
81
  export type HeldQueues = {
87
82
  readonly queues: readonly {
@@ -182,12 +177,6 @@ export interface RuntimeRequests {
182
177
  readonly targets: readonly string[];
183
178
  readonly kinds: readonly string[];
184
179
  }, readonly Referrer[]>;
185
- readonly 'replica.walk': Asked<{
186
- readonly key: number;
187
- readonly view: View;
188
- readonly after: string | null;
189
- readonly bytes: number;
190
- }, Walked>;
191
180
  readonly 'replica.files': Asked<{
192
181
  readonly key: number;
193
182
  readonly view: View;
@@ -197,6 +186,11 @@ export interface RuntimeRequests {
197
186
  readonly path: string;
198
187
  readonly revision: string;
199
188
  }[]>;
189
+ readonly 'replica.folders': Asked<{
190
+ readonly key: number;
191
+ readonly view: View;
192
+ readonly paths: readonly string[];
193
+ }, readonly string[]>;
200
194
  readonly 'replica.typedWithin': Asked<{
201
195
  readonly key: number;
202
196
  readonly view: View;
@@ -207,32 +201,17 @@ export interface RuntimeRequests {
207
201
  readonly rooms: readonly CountedRoom[];
208
202
  }, readonly number[]>;
209
203
  readonly 'replica.search': Asked<SearchAsk, SearchWindow>;
210
- readonly 'replica.received': Asked<Nothing, readonly KeptReceipt[]>;
211
- readonly 'replica.receivedParts': Asked<{
212
- readonly key: string;
213
- readonly count: number;
214
- }, readonly unknown[]>;
215
204
  readonly 'replica.stage': Asked<{
216
205
  readonly locator: string;
217
206
  readonly transfer: string;
218
- readonly record: string;
219
207
  readonly key: number | null;
220
- readonly composition: Composition;
208
+ readonly fingerprint: string;
221
209
  readonly entries: readonly StoredEntry[];
222
210
  readonly folders: readonly string[];
223
- readonly written?: string;
224
211
  }, number | null>;
225
- readonly 'replica.transferPart': Asked<{
226
- readonly locator: string;
227
- readonly token: string;
228
- }, Uint8Array | null>;
229
- readonly 'replica.keepPart': Asked<{
230
- readonly locator: string;
231
- readonly token: string;
232
- readonly part: Uint8Array;
233
- }, null>;
234
212
  readonly 'replica.refresh': Asked<{
235
213
  readonly key: number;
214
+ readonly composed: Composed;
236
215
  readonly entries: readonly StoredEntry[];
237
216
  readonly removals: readonly string[];
238
217
  readonly folders: readonly string[];
@@ -256,16 +235,19 @@ export interface RuntimeRequests {
256
235
  }>;
257
236
  readonly 'replica.abandon': Asked<{
258
237
  readonly locator: string;
259
- readonly kept: boolean;
260
- }, number | null>;
238
+ }, null>;
261
239
  readonly 'replica.release': Asked<{
262
240
  readonly key: number;
263
241
  }, null>;
264
242
  readonly 'replica.rederive': Asked<{
265
243
  readonly key: number;
266
- readonly limit: number;
244
+ readonly composed: Composed;
245
+ readonly bytes: number;
246
+ readonly ms: number;
247
+ readonly floor: number;
267
248
  }, {
268
249
  readonly done: boolean;
250
+ readonly text: number;
269
251
  }>;
270
252
  readonly 'replica.fact': Asked<{
271
253
  readonly name: string;
@@ -275,17 +257,6 @@ export interface RuntimeRequests {
275
257
  readonly app: string;
276
258
  readonly value: string;
277
259
  }, null>;
278
- readonly 'replica.receive': Asked<{
279
- readonly key: string;
280
- readonly head: string;
281
- readonly part?: {
282
- readonly index: number;
283
- readonly value: string;
284
- };
285
- }, null>;
286
- readonly 'replica.unreceive': Asked<{
287
- readonly keys: readonly string[];
288
- }, null>;
289
260
  readonly 'opened.find': Asked<{
290
261
  readonly locator: string;
291
262
  readonly path: string;
@@ -54,6 +54,14 @@ declare const MEMBERS: {
54
54
  readonly reach: 'within';
55
55
  readonly effect: 'read';
56
56
  };
57
+ readonly 'binaryFile.show': {
58
+ readonly reach: 'within';
59
+ readonly effect: 'read';
60
+ };
61
+ readonly 'binaryFile.attach': {
62
+ readonly reach: 'within';
63
+ readonly effect: 'action';
64
+ };
57
65
  readonly 'binaryFile.part': {
58
66
  readonly reach: 'within';
59
67
  readonly effect: 'read';
@@ -130,10 +138,6 @@ declare const MEMBERS: {
130
138
  readonly reach: 'within';
131
139
  readonly effect: 'action';
132
140
  };
133
- readonly 'conversation.attach': {
134
- readonly reach: 'within';
135
- readonly effect: 'action';
136
- };
137
141
  readonly 'conversation.answer': {
138
142
  readonly reach: 'within';
139
143
  readonly effect: 'action';
@@ -146,10 +150,6 @@ declare const MEMBERS: {
146
150
  readonly reach: 'within';
147
151
  readonly effect: 'action';
148
152
  };
149
- readonly 'conversation.cancel': {
150
- readonly reach: 'within';
151
- readonly effect: 'action';
152
- };
153
153
  readonly 'conversation.delete': {
154
154
  readonly reach: 'within';
155
155
  readonly effect: 'action';
@@ -176,6 +176,7 @@ declare const TOPICS: {
176
176
  readonly 'sync-status': 'within';
177
177
  readonly 'service-mode': 'runtime';
178
178
  readonly member: 'runtime';
179
+ readonly 'authority-changes': 'runtime';
179
180
  readonly query: 'within';
180
181
  readonly queue: 'within';
181
182
  readonly 'room-drafts': 'within';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdruntime-families",
3
- "version": "0.1.0-c686d19f36a21",
3
+ "version": "0.1.0-c68df10f5cb2e",
4
4
  "description": "react-admin and Refine data providers over the MD Runtime client",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,7 +28,7 @@
28
28
  "LICENSE"
29
29
  ],
30
30
  "dependencies": {
31
- "@agentshouse/mdmodel": "0.1.0-c2522b181299a"
31
+ "@agentshouse/mdmodel": "0.1.0-ca34cd330fc15"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@refinedev/core": ">=5",
@@ -42,5 +42,10 @@
42
42
  "ra-core": {
43
43
  "optional": true
44
44
  }
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/agentshouse/core.git",
49
+ "directory": "mdruntime/packages/mdruntime-families"
45
50
  }
46
51
  }
@@ -1,11 +0,0 @@
1
- export type ChosenFile = {
2
- name: string;
3
- blob: Blob;
4
- };
5
- export type FileDeclaration = {
6
- name: string;
7
- mediaType: string;
8
- byteLength: number;
9
- contentHash: string;
10
- };
11
- export declare function declaredFile(file: ChosenFile): Promise<FileDeclaration>;
@@ -1,15 +0,0 @@
1
- export type Paths<V> = Readonly<Record<string, V>>;
2
- export declare function entriesIn<V>(map: Paths<V>): Generator<readonly [string, V]>;
3
- export declare function keysIn(...maps: readonly Paths<unknown>[]): Generator<number, Set<string>, void>;
4
- export declare function sortedKeys(map: Paths<unknown>): Generator<number, readonly string[], void>;
5
- export declare function sorting(keys: Iterable<string>): Generator<number, readonly string[], void>;
6
- export declare function sharing<V>(map: Paths<V>): Generator<number, Paths<V>, void>;
7
- export declare function shared<V>(map: Paths<V>): Paths<V>;
8
- export declare function patched<V>(base: Paths<V>, set: Iterable<readonly [string, V]>, removed?: Iterable<string>): Paths<V>;
9
- export declare function patching<V>(base: Paths<V>, set: Iterable<readonly [string, V]>, removed?: Iterable<string>): Generator<number, Paths<V>, void>;
10
- export declare function sizeOf<V>(map: Paths<V>): number;
11
- export declare function differences<V>(left: Paths<V>, right: Paths<V>, same?: (left: V, right: V) => boolean): Generator<number, ReadonlySet<string>, void>;
12
- export declare function differing<V>(left: Paths<V>, right: Paths<V>, same?: (left: V, right: V) => boolean): ReadonlySet<string>;
13
- export declare function drafted<V>(base: Paths<V>): Record<string, V>;
14
- export declare function settled<V>(draft: Record<string, V>): Paths<V>;
15
- export declare function settling<V>(draft: Record<string, V>): Generator<number, Paths<V>, void>;
@@ -1,9 +0,0 @@
1
- import type { Refusal } from '@agentshouse/mdmodel';
2
- export type Unconfirmed = {
3
- kind: 'unconfirmed';
4
- };
5
- export type Refused = {
6
- kind: 'refused';
7
- refusal: Refusal;
8
- };
9
- export declare const unconfirmed: Unconfirmed;