@agentshouse/mdruntime-families 0.1.0-cda80fefef829 → 0.1.0-cdb0627dbd199

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.
@@ -1,6 +1,6 @@
1
- import type { Outline, TypedPath } from '@agentshouse/mdmodel';
1
+ import type { SavedFacts, TypedPath } from '@agentshouse/mdmodel';
2
2
  import type { ModelResult } from './model.js';
3
- export type { Outline, TypedPath };
3
+ export type { SavedFacts, TypedPath };
4
4
  import type { Open } from './open.js';
5
5
  import type { ChangeBatch } from './change.js';
6
6
  export type Authorization = object;
@@ -13,7 +13,7 @@ export type TypedSelection = {
13
13
  };
14
14
  export type OperationScopes = {
15
15
  write: readonly string[];
16
- delete: readonly string[];
16
+ erase: readonly string[];
17
17
  };
18
18
  export type ReplicaAdmission = {
19
19
  selection: string;
@@ -230,7 +230,6 @@ export type HistoryRetention = {
230
230
  };
231
231
  export type Retention = {
232
232
  history: HistoryRetention;
233
- outcome: number;
234
233
  refreshHorizon: number;
235
234
  };
236
235
  export type Discovery = {
@@ -286,26 +285,17 @@ export type BinaryFile = {
286
285
  mediaType: string;
287
286
  sha256: string;
288
287
  };
289
- export type HeldFile = {
290
- readonly path: string;
291
- readonly revision: string;
292
- };
293
- export type HeldContent = {
294
- files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
295
- contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
296
- readonly content: string;
297
- readonly revision: string;
298
- }>>;
299
- };
300
288
  export type BootstrapRequest = {
301
289
  locator: string;
302
290
  selection: string;
303
- path?: string;
304
291
  pageToken?: PageToken;
305
- held?: HeldContent;
306
292
  arriving?: (bytes: number) => void;
307
293
  signal?: AbortSignal;
308
294
  };
295
+ export type BootstrapPart = {
296
+ readonly id: string;
297
+ readonly bytes: number;
298
+ };
309
299
  export type BootstrapInventory = {
310
300
  readonly bytes: number;
311
301
  };
@@ -317,18 +307,22 @@ export type BootstrapPage = {
317
307
  roomVersion: string;
318
308
  models?: RoomModels;
319
309
  documents: Readonly<Record<string, string>>;
320
- outlines?: Readonly<Record<string, Outline>>;
310
+ facts: Readonly<Record<string, SavedFacts>>;
321
311
  revisions: Readonly<Record<string, string>>;
322
312
  fileIds?: Readonly<Record<string, string>>;
323
313
  changes: Readonly<Record<string, HeadChange>>;
324
314
  binaryFiles: Readonly<Record<string, BinaryFile>>;
325
315
  folders?: readonly string[];
326
316
  pageToken?: PageToken;
317
+ parts?: readonly BootstrapPart[];
327
318
  bytes?: number;
328
319
  };
320
+ export type NotReady = {
321
+ kind: 'not-ready';
322
+ };
329
323
  export type BootstrapResult = BootstrapPage | {
330
324
  kind: 'beyond-horizon';
331
- } | AdapterFailure;
325
+ } | NotReady | AdapterFailure;
332
326
  export type RefreshRequest = {
333
327
  locator: string;
334
328
  selection: string;
@@ -340,7 +334,7 @@ export type RefreshPage = {
340
334
  roomVersion: string;
341
335
  models?: RoomModels;
342
336
  documents: Readonly<Record<string, string>>;
343
- outlines?: Readonly<Record<string, Outline>>;
337
+ facts: Readonly<Record<string, SavedFacts>>;
344
338
  revisions: Readonly<Record<string, string>>;
345
339
  fileIds?: Readonly<Record<string, string>>;
346
340
  changes: Readonly<Record<string, HeadChange>>;
@@ -392,9 +386,6 @@ export type MutationResult = (AcceptedRoom & {
392
386
  affected: Readonly<Record<string, string>>;
393
387
  }) | RetryableRefusal | {
394
388
  kind: 'write-halted';
395
- } | {
396
- kind: 'expired';
397
- restored?: true;
398
389
  } | AdapterFailure;
399
390
  export type HistoryAuthor = {
400
391
  kind: 'user' | 'site' | 'inbox' | 'app';
@@ -494,12 +485,12 @@ export type SearchAnswer = {
494
485
  }) | AdapterFailure;
495
486
  export type HeldRoom = {
496
487
  locator: string;
497
- roomVersion: string;
488
+ roomVersion: string | null;
498
489
  };
499
490
  export type RoomChange = {
500
491
  kind: 'room-change';
501
492
  locator: string;
502
- from: string;
493
+ from: string | null;
503
494
  roomVersion: string;
504
495
  read(): Promise<RefreshPage>;
505
496
  };
@@ -1,5 +1,6 @@
1
+ import type { DocumentQuery, GroupQuery } from '@agentshouse/mdmodel';
1
2
  import type { MdRuntimeClient } from './client.js';
2
- import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
3
+ import type { DocumentResult, GroupResult, PendingResult } from './query.js';
3
4
  type Rows = DocumentResult | GroupResult;
4
5
  export type WindowAnswer = Rows | PendingResult;
5
6
  export type WindowChain = {
@@ -1,9 +1,11 @@
1
+ import type { DocumentQuery, GroupQuery } from '@agentshouse/mdmodel';
1
2
  import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult } from './connection.js';
2
3
  import type { Member, ServiceMode } from './adapter.js';
4
+ import type { UnsentWork } from './durability.js';
3
5
  import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationView } from './conversation.js';
4
6
  import { type Observation } from './observation.js';
5
7
  import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
6
- import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
8
+ import type { DocumentResult, GroupResult, PendingResult } from './query.js';
7
9
  import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
8
10
  import type { SearchRequest, SearchResult } from './search.js';
9
11
  import type { Readiness } from './readiness.js';
@@ -58,6 +60,8 @@ export type MdRuntimeClient = {
58
60
  persistence(): Promise<boolean>;
59
61
  retry(): Promise<void>;
60
62
  cleanUp(): Promise<number>;
63
+ unsent(): Promise<readonly UnsentWork[]>;
64
+ reset(): Promise<void>;
61
65
  observe: {
62
66
  (topic: 'deployment-facts'): Promise<Observation<unknown>>;
63
67
  (topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
@@ -1,15 +1,10 @@
1
- import { type Plan, type QueryRows } from './query.js';
2
- import type { Connection, Value } from './tables.js';
1
+ import type { Plan, QueryRows } from './query.js';
2
+ import type { Connection } from './tables.js';
3
3
  export type QueryRoom = {
4
4
  readonly locator: string;
5
5
  readonly key: number;
6
6
  };
7
- export type Fragment = {
8
- readonly sql: string;
9
- readonly bind: readonly Value[];
10
- };
11
7
  export type QueryAnswer = QueryRows & {
12
8
  readonly more?: string;
13
9
  };
14
- export declare function selected(connection: Connection, plan: Plan, rooms: readonly QueryRoom[]): Fragment;
15
10
  export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
@@ -1,6 +1,7 @@
1
+ import { type DocumentQuery, type GroupQuery } from '@agentshouse/mdmodel';
1
2
  import { type TypesResult } from './model.js';
2
3
  import { type Observation } from './observation.js';
3
- import { type DocumentQuery, type DocumentResult, type GroupQuery, type GroupResult, type PendingResult } from './query.js';
4
+ import { type DocumentResult, type GroupResult, type PendingResult } from './query.js';
4
5
  import { type EntrySeed } from './seed.js';
5
6
  import { type SearchRequest, type SearchResult } from './search.js';
6
7
  import { type Adapter, type Authorization, type Member, type ProviderRefusal, type ServiceMode } from './adapter.js';
@@ -12,7 +13,7 @@ import { type Recovery } from './recovery.js';
12
13
  import { type SaveRefusal } from './save.js';
13
14
  import { type RoomDraft, type RoomDraftParts, type RoomDraftWrite } from './room-draft.js';
14
15
  import { type SyncStatus } from './status.js';
15
- import { type RuntimeShell } from './durability.js';
16
+ import { type RuntimeShell, type UnsentWork } from './durability.js';
16
17
  import { type CodeAvailability, type Persistence, type Readiness } from './readiness.js';
17
18
  import type { RuntimeDatabase } from './tables.js';
18
19
  import { type NarrowedView, type PortReach, type RuntimeView } from './reach.js';
@@ -116,6 +117,8 @@ export type MdRuntime = {
116
117
  persistence(): boolean;
117
118
  retry(): Promise<void>;
118
119
  cleanUp(): Promise<number>;
120
+ unsent(): Promise<readonly UnsentWork[]>;
121
+ reset(): Promise<void>;
119
122
  observe: {
120
123
  (topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
121
124
  (topic: 'readiness'): Promise<Observation<Readiness>>;
@@ -92,7 +92,6 @@ export type ConversationDependencies = {
92
92
  full(): boolean;
93
93
  closed(): boolean;
94
94
  unanswered(): void;
95
- expired(operation: string): boolean;
96
95
  };
97
96
  export type ConversationStore = {
98
97
  surface: ConversationSurface;
@@ -1,10 +1,16 @@
1
1
  import type { Persistence } from './readiness.js';
2
+ export type UnsentKind = 'pending-change' | 'call' | 'room-draft' | 'chat-draft';
3
+ export type UnsentWork = {
4
+ readonly kind: UnsentKind;
5
+ readonly count: number;
6
+ };
2
7
  export type RuntimeShell = {
3
8
  persistence: Persistence;
4
9
  generation: string | null;
5
10
  keepGeneration(value: string): void | Promise<void>;
6
11
  dropGeneration(): void | Promise<void>;
7
12
  cleanUp?(): Promise<number>;
13
+ reset(): Promise<void>;
8
14
  };
9
15
  export declare function refusedForSpace(error: unknown): boolean;
10
16
  export declare function detectStorageLoss(stored: string | null, reported: string | null): string | null;
@@ -1,5 +1,4 @@
1
1
  export declare function changeBatchIdentity(at?: number): string;
2
- export declare function identityTime(identity: string): number;
3
2
  export declare function roomDraftRevision(): string;
4
3
  export declare function chatDraftRevision(): string;
5
4
  export declare function transferIdentity(): string;
@@ -1,4 +1,4 @@
1
- import type { Definition, ValueFacts, VerifiedModel } from '@agentshouse/mdmodel';
1
+ import type { Definition, VerifiedModel } from '@agentshouse/mdmodel';
2
2
  import type { Open } from './open.js';
3
3
  export type ModelIdentity = {
4
4
  identity: string;
@@ -8,7 +8,7 @@ export type ModelSnapshot = ModelIdentity & {
8
8
  schema: string | null;
9
9
  revision: string | null;
10
10
  };
11
- export type ModelUnavailableReason = Open<'not-readable' | 'revoked' | 'not-acquired' | 'invalid'>;
11
+ export type ModelUnavailableReason = Open<'not-readable' | 'revoked' | 'not-acquired'>;
12
12
  export type ModelResult = {
13
13
  kind: 'model';
14
14
  snapshot: ModelSnapshot;
@@ -20,8 +20,6 @@ export type MdType = Definition;
20
20
  export type ModelState = {
21
21
  status: 'unavailable';
22
22
  reason: ModelUnavailableReason;
23
- schema?: string | null;
24
- revision?: string | null;
25
23
  } | {
26
24
  status: 'current' | 'cached';
27
25
  snapshot: ModelSnapshot;
@@ -37,8 +35,6 @@ export type TypesResult = {
37
35
  status: Open<'unavailable'>;
38
36
  reason: ModelUnavailableReason;
39
37
  types: null;
40
- schema?: string | null;
41
- revision?: string | null;
42
38
  } | {
43
39
  status: Open<'current' | 'cached'>;
44
40
  identity: string;
@@ -59,4 +55,3 @@ export declare function modelTypes(state: ModelState): TypesResult;
59
55
  export declare function storedModel(state: ModelState): StoredModel;
60
56
  export declare function cached(state: ModelState): ModelState;
61
57
  export declare function sameModel(left: ModelIdentity, right: ModelIdentity): boolean;
62
- export declare function referenceField(facts: ValueFacts | undefined): boolean;
@@ -1,94 +1,7 @@
1
- import { type Definition } from '@agentshouse/mdmodel';
1
+ import { type HeldRooms, type QueryPlan } from '@agentshouse/mdmodel';
2
2
  import type { HeadChange } from './adapter.js';
3
3
  import type { BinaryFileRecord } from './binary.js';
4
4
  import type { Open } from './open.js';
5
- export type Value = string | number | boolean | null;
6
- export type Predicate = Value | {
7
- $eq: Value;
8
- } | {
9
- $ne: Value;
10
- } | {
11
- $in: readonly Value[];
12
- } | {
13
- $nin: readonly Value[];
14
- } | {
15
- $gt?: Value;
16
- $gte?: Value;
17
- $lt?: Value;
18
- $lte?: Value;
19
- } | {
20
- $all: readonly Value[];
21
- } | {
22
- $size: number;
23
- } | {
24
- $exists: boolean;
25
- };
26
- export type Where = {
27
- $and?: readonly Where[];
28
- $or?: readonly Where[];
29
- [field: string]: Predicate | readonly Where[] | undefined;
30
- };
31
- export type Related = {
32
- types?: readonly string[];
33
- where?: Where;
34
- pathPrefix?: string;
35
- };
36
- export type Filter = {
37
- rooms?: readonly string[];
38
- types?: readonly string[];
39
- where?: Where;
40
- pathPrefix?: string;
41
- folder?: string;
42
- paths?: readonly string[];
43
- hop?: Related & {
44
- field: string;
45
- };
46
- backlinks?: Related & {
47
- field?: string;
48
- };
49
- text?: string;
50
- };
51
- export type Key = 'room' | 'path' | 'type' | 'folder' | {
52
- field: string;
53
- };
54
- export type Select = 'all' | {
55
- fields?: 'all' | readonly string[];
56
- sections?: 'all' | readonly string[];
57
- preamble?: true;
58
- markdown?: true;
59
- backlinks?: true;
60
- change?: true;
61
- fileId?: true;
62
- revision?: true;
63
- };
64
- export type OrderOptions = {
65
- nulls?: 'first' | 'last';
66
- stringSort?: 'lexical' | 'locale';
67
- locale?: string;
68
- localeOptions?: Readonly<Record<string, unknown>>;
69
- };
70
- export type Direction = 'asc' | 'desc';
71
- export type DocumentQuery = Filter & {
72
- select: Select;
73
- orderBy?: readonly ({
74
- by: Key;
75
- direction?: Direction;
76
- } & OrderOptions)[];
77
- limit?: number;
78
- after?: string;
79
- total?: true;
80
- };
81
- export type GroupQuery = Filter & {
82
- groupBy: readonly Exclude<Key, 'path'>[];
83
- orderBy?: readonly {
84
- by: 'count' | Exclude<Key, 'path'>;
85
- direction?: Direction;
86
- }[];
87
- limit?: number;
88
- after?: string;
89
- total?: true;
90
- };
91
- export type LocalQuery = DocumentQuery | GroupQuery;
92
5
  export type Backlink = {
93
6
  path: string;
94
7
  type: string;
@@ -102,7 +15,6 @@ export type QueryDocument = {
102
15
  sections?: Readonly<Record<string, string>>;
103
16
  preamble?: string;
104
17
  markdown?: string;
105
- textHeld?: false;
106
18
  backlinks?: readonly Backlink[];
107
19
  change?: HeadChange | null;
108
20
  fileId?: string | null;
@@ -149,92 +61,6 @@ export type GroupResult = GroupRows & {
149
61
  coverage: QueryCoverage;
150
62
  };
151
63
  export type QueryResult = DocumentResult | GroupResult | PendingResult;
152
- export type QueryErrorCode = 'invalid-query' | 'unknown-type' | 'unknown-field' | 'wrong-kind';
153
- export type RoomFacts = {
154
- locator: string;
155
- available: boolean;
156
- types: readonly Definition[];
157
- };
158
- export type HeldRooms = {
159
- listed: boolean;
160
- rooms: readonly RoomFacts[];
161
- };
162
- export type Test = {
163
- op: 'eq';
164
- value: Value;
165
- } | {
166
- op: 'ne';
167
- value: Value;
168
- } | {
169
- op: 'in';
170
- values: readonly Value[];
171
- } | {
172
- op: 'nin';
173
- values: readonly Value[];
174
- } | {
175
- op: 'range';
176
- bounds: readonly (readonly ['gt' | 'gte' | 'lt' | 'lte', Value])[];
177
- } | {
178
- op: 'all';
179
- values: readonly Value[];
180
- } | {
181
- op: 'size';
182
- size: number;
183
- } | {
184
- op: 'exists';
185
- exists: boolean;
186
- };
187
- export type Condition = {
188
- every: readonly Condition[];
189
- } | {
190
- some: readonly Condition[];
191
- } | {
192
- field: string;
193
- test: Test;
194
- };
195
- export type Scope = {
196
- types: readonly string[] | null;
197
- where: Condition | null;
198
- pathPrefix: string | null;
199
- };
200
- export type KeyPlan = {
201
- of: 'room';
202
- } | {
203
- of: 'path';
204
- } | {
205
- of: 'type';
206
- } | {
207
- of: 'folder';
208
- } | {
209
- of: 'field';
210
- field: string;
211
- };
212
- export type DocumentShape = {
213
- kind: 'documents';
214
- fields: 'all' | readonly string[] | null;
215
- sections: 'all' | readonly string[] | null;
216
- preamble: boolean;
217
- markdown: boolean;
218
- backlinks: boolean;
219
- change: boolean;
220
- fileId: boolean;
221
- revision: boolean;
222
- orderBy: readonly {
223
- key: KeyPlan;
224
- options: OrderOptions & {
225
- direction: Direction;
226
- };
227
- }[];
228
- };
229
- export declare function bodied(shape: DocumentShape): boolean;
230
- export type GroupShape = {
231
- kind: 'groups';
232
- groupBy: readonly KeyPlan[];
233
- orderBy: readonly {
234
- by: 'count' | number;
235
- direction: Direction;
236
- }[];
237
- };
238
64
  export type PlanArea = {
239
65
  room: string;
240
66
  path: string;
@@ -245,43 +71,8 @@ export type PlanReach = {
245
71
  documents: readonly string[];
246
72
  areas: readonly PlanArea[];
247
73
  };
248
- export type Continuation = {
249
- text: string;
250
- values: readonly unknown[] | null;
251
- };
252
- export type Plan = {
253
- key: string;
254
- rooms: readonly string[] | null;
74
+ export type Plan = QueryPlan & {
255
75
  reach: PlanReach | null;
256
76
  locked: readonly string[];
257
- root: Scope;
258
- folder: string | null;
259
- paths: readonly string[] | null;
260
- hop: (Scope & {
261
- field: string;
262
- }) | null;
263
- backlinks: (Scope & {
264
- field: string | null;
265
- }) | null;
266
- text: string | null;
267
- shape: DocumentShape | GroupShape;
268
- limit: number | null;
269
- after: Continuation | null;
270
- total: boolean;
271
77
  };
272
- export declare class QueryError extends Error {
273
- readonly code: QueryErrorCode;
274
- readonly retryable = false;
275
- constructor(code: QueryErrorCode, at: string, problem: string);
276
- }
277
- type Entries = Readonly<Record<string, unknown>>;
278
- export declare function invalid(at: string, problem: string): never;
279
- export declare function plain(value: unknown): value is Entries;
280
- export declare function known(value: Entries, allowed: readonly string[], at: string): void;
281
- export declare function flag(input: unknown, at: string): boolean;
282
- export declare function planOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
283
- export declare function limitOf(input: unknown): number | null;
284
- export declare function filterOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
285
- export declare function queryKey(query: unknown): string;
286
- export declare function identityOf(plan: Plan): string;
287
- export {};
78
+ export declare function planWithin(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
@@ -1,5 +1,5 @@
1
1
  import { type TypedPath } from '@agentshouse/mdmodel';
2
- import type { BootstrapInventory, MutationResult, OperationScopes, ReplicaAdmission, TypedSelection } from './adapter.js';
2
+ import type { BootstrapInventory, SavedFacts, MutationResult, OperationScopes, ReplicaAdmission, TypedSelection } from './adapter.js';
3
3
  import { type ChangeBatch, type Precondition } from './change.js';
4
4
  import { type Collection, type Composition } from './collection.js';
5
5
  import { type ModelState } from './model.js';
@@ -32,14 +32,16 @@ export type VisibleLayer = Layer & {
32
32
  };
33
33
  export type Slice = Layer & {
34
34
  readonly written: Readonly<Record<string, string>>;
35
+ readonly facts: Readonly<Record<string, SavedFacts>>;
35
36
  readonly held: ReadonlySet<string>;
36
37
  };
37
38
  export declare function compositionOf(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>, builtIn: ModelState, typedPaths: readonly TypedPath[]): Composition;
38
39
  export declare function storedRecord(record: ReplicaRecord): string;
39
40
  export declare function slicing(entries: readonly HeldEntry[], paths: Iterable<string>): Generator<number, Slice, void>;
41
+ export type LayerEntry = Omit<StoredEntry, 'facts'>;
40
42
  export declare function entryAt(layer: Layer & {
41
43
  readonly written?: Readonly<Record<string, string>>;
42
- }, path: string): StoredEntry | null;
44
+ }, path: string): LayerEntry | null;
43
45
  export declare function slicingWith(slice: Slice, set: readonly StoredEntry[], removed: readonly string[]): Generator<number, Slice, void>;
44
46
  export declare function touchedBy(queue: readonly ChangeBatch[]): Set<string>;
45
47
  export declare function movedBy(queue: readonly ChangeBatch[], locator: string): Set<string>;
@@ -48,7 +50,7 @@ export type Replayed = {
48
50
  readonly touched: ReadonlySet<string>;
49
51
  };
50
52
  export declare function replaying(confirmed: Slice, queue: readonly ChangeBatch[], locator: string, composition: Composition): Generator<number, Replayed, void>;
51
- export declare function overlayOf(visible: Layer, touched: Iterable<string>): Generator<number, OverlayEntry[], void>;
53
+ export declare function overlayOf(visible: VisibleLayer, touched: Iterable<string>): Generator<number, OverlayEntry[], void>;
52
54
  export declare function holds(layer: Layer, preconditions: readonly Precondition[]): boolean;
53
55
  export declare function landed(batch: ChangeBatch, confirmed: Layer, current?: Readonly<Record<string, string>>): boolean;
54
56
  export type Standing = {
@@ -64,5 +66,5 @@ export type Returned = {
64
66
  readonly removed: readonly string[];
65
67
  };
66
68
  export declare function returnedPaths(submitted: ChangeBatch, accepted: Accepted): Set<string>;
67
- export declare function returning(confirmed: Slice, submitted: ChangeBatch, accepted: Accepted, writtenAt: string): Generator<number, Returned, void>;
69
+ export declare function returning(confirmed: Slice, submitted: ChangeBatch, accepted: Accepted, writtenAt: string, composition: Composition): Generator<number, Returned, void>;
68
70
  export {};
@@ -90,9 +90,9 @@ type ChangedUnderneath = {
90
90
  readonly file?: string | null;
91
91
  };
92
92
  export type ReturnReason = ProviderRefusal & {
93
- readonly kind: Open<'conflicted' | 'rejected' | 'expired' | 'withdrawn'>;
93
+ readonly kind: Open<'conflicted' | 'rejected' | 'withdrawn'>;
94
94
  };
95
- export declare function returnedBy(kind: 'expired' | 'withdrawn'): ReturnReason;
95
+ export declare function returnedBy(kind: 'withdrawn'): ReturnReason;
96
96
  export type RoomDraft = {
97
97
  readonly room: string;
98
98
  readonly path: string;
@@ -6,7 +6,7 @@ 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
8
  import type { ModelState, StoredModel } from './model.js';
9
- import type { CommittedWrite, ConversationWrite, CountedRoom, HeldConversation, HeldEntry, HeldText, MessageWindow, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, TypedEntry, View } from './tables.js';
9
+ import type { CommittedWrite, ConversationWrite, CountedRoom, HeldConversation, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, TypedEntry, View } from './tables.js';
10
10
  export type { ConversationWrite, HeldConversation, MessageWindow } from './tables.js';
11
11
  export type TransferRecord = {
12
12
  readonly locator: string;
@@ -71,6 +71,12 @@ export type AuthoredWrite = {
71
71
  export type StagedPage = {
72
72
  readonly entries: readonly StoredEntry[];
73
73
  readonly folders: readonly string[];
74
+ readonly part?: string;
75
+ };
76
+ export type ResumedTransfer = {
77
+ readonly key: number | null;
78
+ readonly transfer: string;
79
+ readonly staged: readonly string[];
74
80
  };
75
81
  export type RefreshedPage = StagedPage & {
76
82
  readonly removals: readonly string[];
@@ -82,6 +88,7 @@ export type Opened = {
82
88
  readonly overlaid: ReadonlyMap<number, ReadonlySet<string>>;
83
89
  readonly erasing: boolean;
84
90
  readonly orphans: readonly number[];
91
+ readonly staged: ReadonlySet<string>;
85
92
  readonly lastCompleted: string | null;
86
93
  readonly providerLimits: readonly ProviderLimit[];
87
94
  readonly capabilities: readonly Capability[];
@@ -96,7 +103,6 @@ export type Commit = {
96
103
  readonly writes?: readonly AuthoredWrite[];
97
104
  readonly files?: readonly StoredFile[];
98
105
  readonly whole?: boolean;
99
- readonly discards?: readonly string[];
100
106
  };
101
107
  export type RuntimeStore = {
102
108
  opened(): Promise<Opened>;
@@ -105,26 +111,13 @@ export type RuntimeStore = {
105
111
  changes(keys: readonly number[]): number;
106
112
  entries(key: number, view: View, paths: readonly string[]): Promise<readonly HeldEntry[]>;
107
113
  typed(key: number, view: View, paths: readonly string[]): Promise<readonly TypedEntry[]>;
108
- referrers(key: number, view: View, targets: readonly string[], kinds: readonly string[]): Promise<readonly Referrer[]>;
109
- files(key: number, view: View, after: string | null, limit: number): Promise<readonly {
110
- readonly path: string;
111
- readonly revision: string;
112
- }[]>;
114
+ referrers(key: number, view: View, targets: readonly string[]): Promise<readonly Referrer[]>;
113
115
  folders(key: number, view: View, paths: readonly string[]): Promise<readonly string[]>;
114
116
  typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
115
117
  stage(record: TransferRecord, composition: Composition, page: StagedPage): Promise<number | null>;
118
+ resume(record: TransferRecord, composition: Composition, parts: readonly string[], published: number | null): Promise<ResumedTransfer | null>;
116
119
  refresh(key: number, composition: Composition, page: RefreshedPage): Promise<void>;
117
120
  unrefresh(key: number): Promise<void>;
118
- hold(locator: string, key: number, composition: Composition, texts: readonly HeldText[]): Promise<readonly string[]>;
119
- unhold(locator: string, key: number, composition: Composition): Promise<{
120
- readonly paths: readonly string[];
121
- readonly bytes: number;
122
- }>;
123
- wanted(locator: string, key: number): Promise<readonly {
124
- readonly path: string;
125
- readonly revision: string;
126
- }[]>;
127
- remember(locator: string, key: number, paths: readonly string[]): Promise<void>;
128
121
  commit(commit: Commit): Promise<CommittedWrite>;
129
122
  fence(locators: readonly string[]): Promise<void>;
130
123
  erase(locator: string | null, limit: number): Promise<boolean>;
@@ -1,5 +1,4 @@
1
- import type { Outline } from '@agentshouse/mdmodel';
2
- import type { HeadChange } from './adapter.js';
1
+ import type { SavedFacts, HeadChange } from './adapter.js';
3
2
  import { type Composed, type Composition } from './collection.js';
4
3
  import type { HeldBinary } from './overlay.js';
5
4
  import type { Connection } from './tables.js';
@@ -8,12 +7,12 @@ export type View = 'confirmed' | 'visible' | 'refreshed';
8
7
  export type StoredEntry = {
9
8
  readonly path: string;
10
9
  readonly content: string | null;
11
- readonly outline: Outline | null;
12
10
  readonly binary: HeldBinary | null;
13
11
  readonly revision: string | null;
14
12
  readonly fileId: string | null;
15
13
  readonly change: HeadChange | null;
16
14
  readonly written: string | null;
15
+ readonly facts: SavedFacts | null;
17
16
  };
18
17
  export type OverlayEntry = StoredEntry & {
19
18
  readonly present: boolean;
@@ -29,7 +28,6 @@ export type TypedEntry = {
29
28
  export type Referrer = {
30
29
  readonly path: string;
31
30
  readonly target: string;
32
- readonly kind: string;
33
31
  };
34
32
  export type HeldKey = {
35
33
  readonly key: number;
@@ -95,7 +93,20 @@ export declare function stage(connection: Connection, request: {
95
93
  readonly fingerprint: string;
96
94
  readonly entries: readonly StoredEntry[];
97
95
  readonly folders: readonly string[];
96
+ readonly part: string | null;
98
97
  }): number;
98
+ export type Resumed = {
99
+ readonly key: number | null;
100
+ readonly transfer: string;
101
+ readonly staged: readonly string[];
102
+ };
103
+ export declare function resume(connection: Connection, request: {
104
+ readonly locator: string;
105
+ readonly transfer: string;
106
+ readonly fingerprint: string;
107
+ readonly parts: readonly string[];
108
+ readonly published: number | null;
109
+ }): Resumed;
99
110
  export declare function refreshing(connection: Connection, request: {
100
111
  readonly key: number;
101
112
  readonly composed: Composed;
@@ -117,44 +128,9 @@ export declare function rederive(connection: Connection, key: number, composed:
117
128
  readonly done: boolean;
118
129
  readonly text: number;
119
130
  };
120
- export type HeldText = {
121
- readonly path: string;
122
- readonly revision: string;
123
- readonly content: string;
124
- };
125
- export declare function holdTexts(connection: Connection, request: {
126
- readonly key: number;
127
- readonly locator: string;
128
- readonly composed: Composed;
129
- readonly texts: readonly HeldText[];
130
- }): string[];
131
- export declare function unholdTexts(connection: Connection, request: {
132
- readonly key: number;
133
- readonly locator: string;
134
- readonly composed: Composed;
135
- }): {
136
- readonly paths: readonly string[];
137
- readonly bytes: number;
138
- };
139
- export declare function remembered(connection: Connection, request: {
140
- readonly key: number;
141
- readonly locator: string;
142
- readonly paths: readonly string[];
143
- }): null;
144
- export declare function wanted(connection: Connection, request: {
145
- readonly key: number;
146
- readonly locator: string;
147
- }): {
148
- readonly path: string;
149
- readonly revision: string;
150
- }[];
151
131
  export declare function entries(connection: Connection, key: number, view: View, list: readonly string[]): HeldEntry[];
152
132
  export declare function typed(connection: Connection, key: number, view: View, list: readonly string[]): TypedEntry[];
153
- export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[], kinds: readonly string[]): Referrer[];
154
- export declare function files(connection: Connection, key: number, view: View, after: string | null, limit: number): {
155
- readonly path: string;
156
- readonly revision: string;
157
- }[];
133
+ export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[]): Referrer[];
158
134
  export declare function folders(connection: Connection, key: number, view: View, list: readonly string[]): string[];
159
135
  export declare function typedWithin(connection: Connection, key: number, view: View, roots: readonly string[], within: boolean): boolean;
160
136
  export declare function opened(connection: Connection): ReplicaOpened;
@@ -1,9 +1,10 @@
1
1
  import { type QueryAnswer, type QueryRoom } from './compile.js';
2
2
  import type { Composed } from './collection.js';
3
+ import type { UnsentWork } from './durability.js';
3
4
  import { type ConversationWrite, type HeldConversation, type MessageWindow } from './messages.js';
4
5
  import type { Plan } from './query.js';
5
- import { type Committed, type CountedRoom, type HeldEntry, type HeldText, type ReplicaOpened, type Referrer, type RoomCommit, type StoredEntry, type TypedEntry, type View } from './stored.js';
6
- export type { Committed, CountedRoom, HeldEntry, HeldText, OverlayEntry, ReplicaOpened, Referrer, RoomCommit, StoredEntry, TypedEntry, View, } from './stored.js';
6
+ import { type Committed, type CountedRoom, type HeldEntry, type ReplicaOpened, type Referrer, type Resumed, type RoomCommit, type StoredEntry, type TypedEntry, type View } from './stored.js';
7
+ export type { Committed, CountedRoom, HeldEntry, OverlayEntry, ReplicaOpened, Referrer, Resumed, RoomCommit, StoredEntry, TypedEntry, View, } from './stored.js';
7
8
  export type { QueryAnswer, QueryRoom } from './compile.js';
8
9
  export type { ConversationWrite, HeldConversation, MessageWindow } from './messages.js';
9
10
  export type Value = string | number | bigint | Uint8Array | null;
@@ -108,7 +109,6 @@ export type AuthoredWrite = {
108
109
  readonly writes: readonly AuthoredRows[];
109
110
  readonly files: readonly StoredFile[];
110
111
  readonly whole: boolean;
111
- readonly discards?: readonly string[];
112
112
  };
113
113
  export interface RuntimeRequests {
114
114
  readonly 'authored.queues': Asked<Nothing, HeldQueues>;
@@ -116,6 +116,7 @@ export interface RuntimeRequests {
116
116
  readonly 'authored.chatDrafts': Asked<Nothing, readonly string[]>;
117
117
  readonly 'authored.calls': Asked<Nothing, readonly string[]>;
118
118
  readonly 'authored.fences': Asked<Nothing, readonly string[]>;
119
+ readonly 'authored.unsent': Asked<Nothing, readonly UnsentWork[]>;
119
120
  readonly 'authored.fact': Asked<{
120
121
  readonly name: AuthoredFact;
121
122
  }, string | null>;
@@ -176,17 +177,7 @@ export interface RuntimeRequests {
176
177
  readonly key: number;
177
178
  readonly view: View;
178
179
  readonly targets: readonly string[];
179
- readonly kinds: readonly string[];
180
180
  }, readonly Referrer[]>;
181
- readonly 'replica.files': Asked<{
182
- readonly key: number;
183
- readonly view: View;
184
- readonly after: string | null;
185
- readonly limit: number;
186
- }, readonly {
187
- readonly path: string;
188
- readonly revision: string;
189
- }[]>;
190
181
  readonly 'replica.folders': Asked<{
191
182
  readonly key: number;
192
183
  readonly view: View;
@@ -208,7 +199,15 @@ export interface RuntimeRequests {
208
199
  readonly fingerprint: string;
209
200
  readonly entries: readonly StoredEntry[];
210
201
  readonly folders: readonly string[];
202
+ readonly part: string | null;
211
203
  }, number | null>;
204
+ readonly 'replica.resume': Asked<{
205
+ readonly locator: string;
206
+ readonly transfer: string;
207
+ readonly fingerprint: string;
208
+ readonly parts: readonly string[];
209
+ readonly published: number | null;
210
+ }, Resumed | null>;
212
211
  readonly 'replica.refresh': Asked<{
213
212
  readonly key: number;
214
213
  readonly composed: Composed;
@@ -249,32 +248,6 @@ export interface RuntimeRequests {
249
248
  readonly done: boolean;
250
249
  readonly text: number;
251
250
  }>;
252
- readonly 'replica.hold': Asked<{
253
- readonly key: number;
254
- readonly locator: string;
255
- readonly composed: Composed;
256
- readonly texts: readonly HeldText[];
257
- }, readonly string[]>;
258
- readonly 'replica.remember': Asked<{
259
- readonly key: number;
260
- readonly locator: string;
261
- readonly paths: readonly string[];
262
- }, null>;
263
- readonly 'replica.wanted': Asked<{
264
- readonly key: number;
265
- readonly locator: string;
266
- }, readonly {
267
- readonly path: string;
268
- readonly revision: string;
269
- }[]>;
270
- readonly 'replica.unhold': Asked<{
271
- readonly key: number;
272
- readonly locator: string;
273
- readonly composed: Composed;
274
- }, {
275
- readonly paths: readonly string[];
276
- readonly bytes: number;
277
- }>;
278
251
  readonly 'replica.fact': Asked<{
279
252
  readonly name: string;
280
253
  readonly value: string;
@@ -82,6 +82,14 @@ declare const MEMBERS: {
82
82
  readonly reach: 'whole';
83
83
  readonly effect: 'write';
84
84
  };
85
+ readonly unsent: {
86
+ readonly reach: 'whole';
87
+ readonly effect: 'read';
88
+ };
89
+ readonly reset: {
90
+ readonly reach: 'whole';
91
+ readonly effect: 'write';
92
+ };
85
93
  readonly persistence: {
86
94
  readonly reach: 'runtime';
87
95
  readonly effect: 'read';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdruntime-families",
3
- "version": "0.1.0-cda80fefef829",
3
+ "version": "0.1.0-cdb0627dbd199",
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-caf3d712ed842"
31
+ "@agentshouse/mdmodel": "0.1.0-c69a8c1d0563b"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@refinedev/core": ">=5",