@agentshouse/mdruntime-families 0.1.0-c4dbafcb08099 → 0.1.0-c4e5a42fb10b3

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,4 +1,6 @@
1
+ import type { Outline } from '@agentshouse/mdmodel';
1
2
  import type { ModelResult } from './model.js';
3
+ export type { Outline };
2
4
  import type { Open } from './open.js';
3
5
  import type { ChangeBatch } from './change.js';
4
6
  export type Authorization = object;
@@ -44,6 +46,7 @@ export type ListedConversation = {
44
46
  outcome: string | null;
45
47
  waiting: boolean;
46
48
  newest: string | null;
49
+ processEnded: string | null;
47
50
  };
48
51
  export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
49
52
  export type ConversationMessage = {
@@ -297,6 +300,7 @@ export type HeldContent = {
297
300
  export type BootstrapRequest = {
298
301
  locator: string;
299
302
  selection: string;
303
+ path?: string;
300
304
  pageToken?: PageToken;
301
305
  held?: HeldContent;
302
306
  arriving?: (bytes: number) => void;
@@ -313,6 +317,7 @@ export type BootstrapPage = {
313
317
  roomVersion: string;
314
318
  models?: RoomModels;
315
319
  documents: Readonly<Record<string, string>>;
320
+ outlines?: Readonly<Record<string, Outline>>;
316
321
  revisions: Readonly<Record<string, string>>;
317
322
  fileIds?: Readonly<Record<string, string>>;
318
323
  changes: Readonly<Record<string, HeadChange>>;
@@ -335,6 +340,7 @@ export type RefreshPage = {
335
340
  roomVersion: string;
336
341
  models?: RoomModels;
337
342
  documents: Readonly<Record<string, string>>;
343
+ outlines?: Readonly<Record<string, Outline>>;
338
344
  revisions: Readonly<Record<string, string>>;
339
345
  fileIds?: Readonly<Record<string, string>>;
340
346
  changes: Readonly<Record<string, HeadChange>>;
@@ -391,10 +397,7 @@ export type MutationResult = (AcceptedRoom & {
391
397
  restored?: true;
392
398
  } | AdapterFailure;
393
399
  export type HistoryAuthor = {
394
- kind: 'user';
395
- id: string;
396
- } | {
397
- kind: 'site' | 'inbox' | 'app';
400
+ kind: 'user' | 'site' | 'inbox' | 'app';
398
401
  id: string;
399
402
  name: string;
400
403
  };
@@ -473,6 +476,22 @@ export type ActionResult = {
473
476
  } | (ProviderRefusal & {
474
477
  kind: 'rejected';
475
478
  }) | AdapterFailure;
479
+ export type SearchHit = {
480
+ room: string;
481
+ path: string;
482
+ line?: number;
483
+ snippet?: string;
484
+ };
485
+ export type SearchAsk = {
486
+ text: string;
487
+ rooms: readonly string[] | null;
488
+ };
489
+ export type SearchAnswer = {
490
+ kind: 'found';
491
+ documents: readonly SearchHit[];
492
+ } | (ProviderRefusal & {
493
+ kind: 'rejected';
494
+ }) | AdapterFailure;
476
495
  export type HeldRoom = {
477
496
  locator: string;
478
497
  roomVersion: string;
@@ -499,6 +518,7 @@ export type RoomStreamEvent = {
499
518
  kind: 'closed';
500
519
  revoked: boolean;
501
520
  lost: boolean;
521
+ authorityChanged: boolean;
502
522
  } | {
503
523
  kind: 'caught-up';
504
524
  expired: readonly string[];
@@ -521,10 +541,10 @@ export type Adapter = {
521
541
  link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
522
542
  attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
523
543
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
544
+ search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
524
545
  reached(locator: string, roomVersion: string, target: string): boolean;
525
546
  follows(locator: string, roomVersion: string, next: string): boolean;
526
547
  roomStream?: RoomStream;
527
548
  conversations?: ConversationStream;
528
549
  serviceMode?: ServiceModeSignal;
529
550
  };
530
- export {};
@@ -1,6 +1,6 @@
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, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
3
+ import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationView } from './conversation.js';
4
4
  import { type Observation } from './observation.js';
5
5
  import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
6
6
  import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
@@ -32,7 +32,7 @@ export type MdRuntimeClient = {
32
32
  };
33
33
  conversation: {
34
34
  list(): Promise<readonly ConversationEntry[]>;
35
- read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
35
+ read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
36
36
  create(input: unknown): Promise<CallResult>;
37
37
  send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
38
38
  answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
@@ -67,6 +67,7 @@ export type MdRuntimeClient = {
67
67
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
68
68
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
69
69
  (topic: 'member'): Promise<Observation<Member | null>>;
70
+ (topic: 'authority-changes'): Promise<Observation<number>>;
70
71
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
71
72
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
72
73
  (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
@@ -1,4 +1,4 @@
1
- import type { Plan, QueryRows } from './query.js';
1
+ import { type Plan, type QueryRows } from './query.js';
2
2
  import type { Connection, Value } from './tables.js';
3
3
  export type QueryRoom = {
4
4
  readonly locator: string;
@@ -13,7 +13,7 @@ import { type SaveRefusal } from './save.js';
13
13
  import { type RoomDraft, type RoomDraftParts, type RoomDraftWrite } from './room-draft.js';
14
14
  import { type SyncStatus } from './status.js';
15
15
  import { type RuntimeShell } from './durability.js';
16
- import { type CodeAvailability, type Persistence, type Readiness, type SearchObligation, type Space } from './readiness.js';
16
+ import { type CodeAvailability, type Persistence, type Readiness } from './readiness.js';
17
17
  import type { RuntimeDatabase } from './tables.js';
18
18
  import { type NarrowedView, type PortReach, type RuntimeView } from './reach.js';
19
19
  export type AppTypedSelection = {
@@ -124,6 +124,7 @@ export type MdRuntime = {
124
124
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
125
125
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
126
126
  (topic: 'member'): Promise<Observation<Member | null>>;
127
+ (topic: 'authority-changes'): Promise<Observation<number>>;
127
128
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
128
129
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
129
130
  (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
@@ -135,12 +136,10 @@ export type MdRuntime = {
135
136
  };
136
137
  reauthorize(): Promise<void>;
137
138
  };
138
- 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';
139
140
  export type ReadinessPort = {
140
141
  readonly target: string;
141
142
  readonly code: CodeAvailability;
142
- readonly space: Space | null;
143
- readonly search: SearchObligation;
144
143
  };
145
144
  export type ComposedRuntime = RuntimeView & {
146
145
  seed(entry: EntrySeed): void;
@@ -37,6 +37,9 @@ export type ConversationOptions = {
37
37
  after?: string;
38
38
  total?: true;
39
39
  };
40
+ export type ConversationRead = ConversationOptions & {
41
+ text?: string;
42
+ };
40
43
  export type ConversationView = {
41
44
  conversation: string;
42
45
  messages: readonly ConversationMessage[];
@@ -47,6 +50,7 @@ export type ConversationView = {
47
50
  process: {
48
51
  running: boolean;
49
52
  } | null;
53
+ processEnded: string | null;
50
54
  commands: readonly ProcessCommand[];
51
55
  options: readonly SessionOption[];
52
56
  starting: string | null;
@@ -61,7 +65,7 @@ export type ConversationView = {
61
65
  };
62
66
  export type ConversationSurface = {
63
67
  list(): Promise<readonly ConversationEntry[]>;
64
- read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
68
+ read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
65
69
  create(input: unknown): Promise<CallResult>;
66
70
  send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
67
71
  answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
@@ -107,8 +111,6 @@ export type ConversationStore = {
107
111
  watchAgents(deliver: (agents: readonly ConversationAgent[]) => void): () => void;
108
112
  changed(set: ChangeSet): void;
109
113
  receive(event: ConversationEvent): boolean;
110
- searchable(): readonly string[];
111
- acquired(conversation: string): boolean;
112
114
  close(): void;
113
115
  };
114
116
  export declare function unheldView(conversation: string): ConversationView;
@@ -20,8 +20,8 @@ export type ConversationWrite = {
20
20
  };
21
21
  export declare function heldConversations(connection: Connection): HeldConversation[];
22
22
  export declare function keptMessages(connection: Connection, { conversation, messages, read }: ConversationWrite): null;
23
- export declare function messageWindow(connection: Connection, conversation: string, limit: number, before: readonly [string, string] | null): MessageWindow;
24
- export declare function messageCount(connection: Connection, conversation: string): number;
23
+ export declare function messageWindow(connection: Connection, conversation: string, limit: number, before: readonly [string, string] | null, phrase: string | null): MessageWindow;
24
+ export declare function messageCount(connection: Connection, conversation: string, phrase: string | null): number;
25
25
  export declare function turnArrived(connection: Connection, conversation: string, turn: string): boolean;
26
26
  export declare function droppedMessages(connection: Connection, conversations: readonly string[]): void;
27
27
  export declare function forgottenMessages(connection: Connection): void;
@@ -27,8 +27,8 @@ export declare function rowsOf(result: QueryResult): readonly (QueryDocument | Q
27
27
  export declare function whole(message: QueryMessage): message is KeyedResult;
28
28
  export declare function applied(keyed: KeyedResult, message: QueryMessage): KeyedResult;
29
29
  export declare function observed(first: unknown, stop: () => void, keyed: boolean): Observed;
30
- export declare function opened(watch: (deliver: (message: unknown) => void) => () => void, keyed: boolean): Promise<Observation<unknown>>;
31
- export declare function observing<Topic extends string>(watch: (topic: Topic, input: readonly unknown[], deliver: (message: unknown) => void) => () => void): (topic: Topic, ...input: unknown[]) => Promise<Observation<unknown>>;
30
+ export declare function opened(watch: (deliver: (message: unknown) => void, fail: (error: unknown) => void) => () => void, keyed: boolean): Promise<Observation<unknown>>;
31
+ export declare function observing<Topic extends string>(watch: (topic: Topic, input: readonly unknown[], deliver: (message: unknown) => void, fail: (error: unknown) => void) => () => void): (topic: Topic, ...input: unknown[]) => Promise<Observation<unknown>>;
32
32
  export type Digest = {
33
33
  readonly pending: string;
34
34
  } | {
@@ -46,6 +46,7 @@ export type Filter = {
46
46
  backlinks?: Related & {
47
47
  field?: string;
48
48
  };
49
+ text?: string;
49
50
  };
50
51
  export type Key = 'room' | 'path' | 'type' | 'folder' | {
51
52
  field: string;
@@ -101,6 +102,7 @@ export type QueryDocument = {
101
102
  sections?: Readonly<Record<string, string>>;
102
103
  preamble?: string;
103
104
  markdown?: string;
105
+ textHeld?: false;
104
106
  backlinks?: readonly Backlink[];
105
107
  change?: HeadChange | null;
106
108
  fileId?: string | null;
@@ -224,6 +226,7 @@ export type DocumentShape = {
224
226
  };
225
227
  }[];
226
228
  };
229
+ export declare function bodied(shape: DocumentShape): boolean;
227
230
  export type GroupShape = {
228
231
  kind: 'groups';
229
232
  groupBy: readonly KeyPlan[];
@@ -260,6 +263,7 @@ export type Plan = {
260
263
  backlinks: (Scope & {
261
264
  field: string | null;
262
265
  }) | null;
266
+ text: string | null;
263
267
  shape: DocumentShape | GroupShape;
264
268
  limit: number | null;
265
269
  after: Continuation | null;
@@ -1,7 +1,7 @@
1
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
- import { type SearchResult } from './search.js';
4
+ import type { SearchResult } from './search.js';
5
5
  export type ReachedDocument = {
6
6
  readonly room: string;
7
7
  readonly path: string;
@@ -18,20 +18,20 @@ export type PortReach = {
18
18
  readonly conversations: boolean;
19
19
  };
20
20
  export type Deliver = (message: unknown) => void;
21
- export type Watch = (topic: RuntimeTopic, input: readonly unknown[], deliver: Deliver) => () => void;
21
+ export type Fail = (error: unknown) => void;
22
+ export type Watch = (topic: RuntimeTopic, input: readonly unknown[], deliver: Deliver, fail: Fail) => () => void;
22
23
  export type RuntimeView = {
23
24
  md: MdRuntime;
24
25
  watch: Watch;
25
26
  };
26
27
  export type NarrowedView = RuntimeView & {
27
28
  narrow(reach: PortReach | null): void;
28
- facts(port: ReadinessPort): void;
29
29
  };
30
30
  export type Reachable = RuntimeView & {
31
31
  plan(input: unknown, reach: PortReach | null): Plan;
32
32
  query(plan: Plan): Promise<QueryResult>;
33
- watchPlan(plan: Plan, deliver: (message: unknown) => void): () => void;
34
- search(input: unknown, reach: PortReach | null, locked: readonly string[]): Promise<SearchResult>;
33
+ watchPlan(plan: Plan, deliver: Deliver, fail: Fail): () => void;
34
+ search(input: unknown, reach: PortReach | null): Promise<SearchResult>;
35
35
  watchReadiness(port: ReadinessPort, reach: PortReach | null, deliver: (readiness: Readiness) => void): () => void;
36
36
  locked(room: string): boolean;
37
37
  lockedRooms(): readonly string[];
@@ -50,4 +50,4 @@ export declare function governs(reach: PortReach | null, room: {
50
50
  readonly selection: boolean;
51
51
  };
52
52
  export declare function planReach(reach: PortReach | null): PlanReach | null;
53
- export declare function narrowed(runtime: Reachable, given: PortReach | null, told: ReadinessPort): NarrowedView;
53
+ export declare function narrowed(runtime: Reachable, given: PortReach | null, port: ReadinessPort): NarrowedView;
@@ -6,13 +6,11 @@ export type RoomCoverage = {
6
6
  readonly state: RoomPreparation;
7
7
  };
8
8
  export type ConversationCoverage = Open<'complete' | 'acquiring' | 'undeclared'>;
9
- export type SearchObligation = Open<'required' | 'unused'>;
10
9
  export type TargetCoverage = {
11
10
  readonly complete: boolean;
12
11
  readonly listed: boolean;
13
12
  readonly rooms: readonly RoomCoverage[];
14
13
  readonly conversations: ConversationCoverage;
15
- readonly search: SearchObligation;
16
14
  };
17
15
  export type Persistence = Open<'granted' | 'denied' | 'unavailable'>;
18
16
  export type Durability = Open<'persistent' | 'best-effort'>;
@@ -127,13 +127,14 @@ export type SavedDraft = {
127
127
  readonly path: string;
128
128
  readonly parts: HeldParts;
129
129
  };
130
- export declare function readParts(value: unknown): RoomDraftParts;
130
+ export declare function readParts(value: unknown, path: string): RoomDraftParts;
131
131
  export declare function gatheredParts(earlier: unknown, later: unknown): unknown;
132
132
  export declare function held(current: HeldParts | undefined, parts: RoomDraftParts, file?: HeldFile): HeldParts;
133
133
  export declare function underneath(parts: HeldParts, path: string, visible: VisibleLayer | undefined): ChangedUnderneath;
134
134
  export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
135
135
  export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
136
136
  export declare function changedParts(path: string, parts: HeldParts, visible: VisibleLayer | undefined): readonly ChangedPart[];
137
+ export declare function lineEnded(text: string): string;
137
138
  export type TextParts = {
138
139
  readonly fields?: Readonly<Record<string, {
139
140
  readonly value: unknown;
@@ -1,72 +1,21 @@
1
- import type { ProviderRefusal } from './adapter.js';
2
- import { type CoveredRoom, type Filter, type PendingRoom } from './query.js';
3
- import type { Open } from './open.js';
4
- export type DocumentPart = Open<'fields' | 'sections' | 'preamble' | 'path'>;
1
+ import type { ProviderRefusal, SearchHit } from './adapter.js';
2
+ import type { Failure, Offline } from './outcome.js';
5
3
  export type SearchRequest = {
6
4
  text: string;
7
- documents?: Filter;
8
- collection?: true;
9
- conversations?: readonly string[];
10
- limit?: number;
11
- after?: string;
12
- total?: true;
5
+ rooms?: readonly string[];
13
6
  };
14
- export type MessagePart = Open<'text'>;
15
- export type Snippet<Part extends string> = {
16
- part: Part;
17
- text: string;
18
- at: readonly [number, number];
19
- };
20
- export type DocumentHit = {
21
- room: string;
22
- path: string;
23
- type: string;
24
- score: number;
25
- matches: Readonly<Record<string, readonly DocumentPart[]>>;
26
- snippet?: Snippet<DocumentPart>;
27
- };
28
- export type MessageHit = {
29
- conversation: string;
30
- identity: string;
31
- score: number;
32
- matches: Readonly<Record<string, readonly MessagePart[]>>;
33
- snippet?: Snippet<MessagePart>;
34
- };
35
- export type SearchCoverage = {
36
- rooms: readonly CoveredRoom[];
37
- conversations: readonly string[];
38
- overlay: readonly string[];
7
+ export type { SearchHit } from './adapter.js';
8
+ export type SearchFound = {
9
+ kind: 'found';
10
+ documents: readonly SearchHit[];
39
11
  };
40
- export type SearchHits = {
41
- documents: readonly DocumentHit[];
42
- messages: readonly MessageHit[];
43
- };
44
- export type SearchWindow = SearchHits & {
45
- next?: string;
46
- total?: {
47
- documents: number;
48
- messages: number;
49
- };
50
- };
51
- export type SearchPending = SearchHits & {
52
- pending: readonly PendingRoom[];
53
- coverage: SearchCoverage;
54
- };
55
- export type SearchUndeclared = ProviderRefusal & {
12
+ export type SearchResult = SearchFound | Offline | (ProviderRefusal & {
13
+ kind: 'rejected';
14
+ }) | (ProviderRefusal & {
56
15
  kind: 'undeclared';
57
- };
58
- export type SearchResult = (SearchWindow & {
59
- coverage: SearchCoverage;
60
- }) | SearchPending | SearchUndeclared;
61
- export declare function undeclaredSearch(): SearchUndeclared;
62
- export type HitCursor = readonly [number, string, string] | readonly [] | null;
16
+ }) | Failure;
63
17
  export type SearchPlan = {
64
18
  text: string;
65
- documents: unknown;
66
- collection: boolean;
67
- conversations: readonly string[] | null;
68
- limit: number | null;
69
- after: readonly [HitCursor, HitCursor] | null;
70
- total: boolean;
19
+ rooms: readonly string[] | null;
71
20
  };
72
21
  export declare function searchPlanOf(input: unknown): SearchPlan;
@@ -6,8 +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 { SearchWindow } from './search.js';
10
- import type { CommittedWrite, ConversationWrite, CountedRoom, HeldConversation, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, SearchAsk, StoredEntry, StoredFile, TypedEntry, View } from './tables.js';
9
+ import type { CommittedWrite, ConversationWrite, CountedRoom, HeldConversation, HeldEntry, HeldText, MessageWindow, QueryAnswer, QueryRoom, Referrer, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, TypedEntry, View } from './tables.js';
11
10
  export type { ConversationWrite, HeldConversation, MessageWindow } from './tables.js';
12
11
  export type TransferRecord = {
13
12
  readonly locator: string;
@@ -113,10 +112,19 @@ export type RuntimeStore = {
113
112
  }[]>;
114
113
  folders(key: number, view: View, paths: readonly string[]): Promise<readonly string[]>;
115
114
  typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
116
- search(ask: SearchAsk): Promise<SearchWindow>;
117
115
  stage(record: TransferRecord, composition: Composition, page: StagedPage): Promise<number | null>;
118
116
  refresh(key: number, composition: Composition, page: RefreshedPage): Promise<void>;
119
117
  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>;
120
128
  commit(commit: Commit): Promise<CommittedWrite>;
121
129
  fence(locators: readonly string[]): Promise<void>;
122
130
  erase(locator: string | null, limit: number): Promise<boolean>;
@@ -134,8 +142,8 @@ export type RuntimeStore = {
134
142
  present(record: PresentationRecord): Promise<void>;
135
143
  conversations(): Promise<readonly HeldConversation[]>;
136
144
  keepMessages(write: ConversationWrite): Promise<void>;
137
- messageWindow(conversation: string, limit: number, before: readonly [string, string] | null): Promise<MessageWindow>;
138
- messageCount(conversation: string): Promise<number>;
145
+ messageWindow(conversation: string, limit: number, before: readonly [string, string] | null, phrase?: string | null): Promise<MessageWindow>;
146
+ messageCount(conversation: string, phrase?: string | null): Promise<number>;
139
147
  turnArrived(conversation: string, turn: string): Promise<boolean>;
140
148
  dropConversations(conversations: readonly string[]): Promise<void>;
141
149
  chatDrafts(): Promise<readonly ChatDraftRecord[]>;
@@ -1,3 +1,4 @@
1
+ import type { Outline } from '@agentshouse/mdmodel';
1
2
  import type { HeadChange } from './adapter.js';
2
3
  import { type Composed, type Composition } from './collection.js';
3
4
  import type { HeldBinary } from './overlay.js';
@@ -7,6 +8,7 @@ export type View = 'confirmed' | 'visible' | 'refreshed';
7
8
  export type StoredEntry = {
8
9
  readonly path: string;
9
10
  readonly content: string | null;
11
+ readonly outline: Outline | null;
10
12
  readonly binary: HeldBinary | null;
11
13
  readonly revision: string | null;
12
14
  readonly fileId: string | null;
@@ -34,7 +36,6 @@ export type HeldKey = {
34
36
  readonly locator: string;
35
37
  readonly transfer: string;
36
38
  readonly rederiving: number | null;
37
- readonly searching: number | null;
38
39
  };
39
40
  export type ReplicaOpened = {
40
41
  readonly rooms: readonly {
@@ -116,6 +117,37 @@ export declare function rederive(connection: Connection, key: number, composed:
116
117
  readonly done: boolean;
117
118
  readonly text: number;
118
119
  };
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
+ }[];
119
151
  export declare function entries(connection: Connection, key: number, view: View, list: readonly string[]): HeldEntry[];
120
152
  export declare function typed(connection: Connection, key: number, view: View, list: readonly string[]): TypedEntry[];
121
153
  export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[], kinds: readonly string[]): Referrer[];
@@ -1,13 +1,10 @@
1
1
  import { type QueryAnswer, type QueryRoom } from './compile.js';
2
2
  import type { Composed } from './collection.js';
3
- import { type SearchAsk } from './fulltext.js';
4
3
  import { type ConversationWrite, type HeldConversation, type MessageWindow } from './messages.js';
5
4
  import type { Plan } from './query.js';
6
- import type { SearchWindow } from './search.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';
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';
9
7
  export type { QueryAnswer, QueryRoom } from './compile.js';
10
- export type { SearchAsk } from './fulltext.js';
11
8
  export type { ConversationWrite, HeldConversation, MessageWindow } from './messages.js';
12
9
  export type Value = string | number | bigint | Uint8Array | null;
13
10
  export type Row = Readonly<Record<string, Value>>;
@@ -36,6 +33,10 @@ export interface SqliteStatement {
36
33
  }
37
34
  export interface SqliteDatabase {
38
35
  readonly pointer: number;
36
+ createFunction(name: string, run: (context: number, ...values: Value[]) => Value, options: {
37
+ readonly arity: number;
38
+ readonly deterministic: true;
39
+ }): unknown;
39
40
  exec(options: {
40
41
  readonly sql: string;
41
42
  readonly bind: readonly Value[];
@@ -200,7 +201,6 @@ export interface RuntimeRequests {
200
201
  readonly 'replica.counts': Asked<{
201
202
  readonly rooms: readonly CountedRoom[];
202
203
  }, readonly number[]>;
203
- readonly 'replica.search': Asked<SearchAsk, SearchWindow>;
204
204
  readonly 'replica.stage': Asked<{
205
205
  readonly locator: string;
206
206
  readonly transfer: string;
@@ -249,6 +249,32 @@ export interface RuntimeRequests {
249
249
  readonly done: boolean;
250
250
  readonly text: number;
251
251
  }>;
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
+ }>;
252
278
  readonly 'replica.fact': Asked<{
253
279
  readonly name: string;
254
280
  readonly value: string;
@@ -294,9 +320,11 @@ export interface RuntimeRequests {
294
320
  readonly conversation: string;
295
321
  readonly limit: number;
296
322
  readonly before: readonly [string, string] | null;
323
+ readonly phrase: string | null;
297
324
  }, MessageWindow>;
298
325
  readonly 'conversation.count': Asked<{
299
326
  readonly conversation: string;
327
+ readonly phrase: string | null;
300
328
  }, number>;
301
329
  readonly 'conversation.turn': Asked<{
302
330
  readonly conversation: string;
@@ -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-c4dbafcb08099",
3
+ "version": "0.1.0-c4e5a42fb10b3",
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-c96c61ea31316"
31
+ "@agentshouse/mdmodel": "0.1.0-ca6c012c54fb0"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@refinedev/core": ">=5",
@@ -1,26 +0,0 @@
1
- import { type QueryRoom } from './compile.js';
2
- import type { Plan } from './query.js';
3
- import type { HitCursor, SearchWindow } from './search.js';
4
- import type { Connection } from './tables.js';
5
- export declare const SEARCH_TABLES: readonly string[];
6
- export type SearchAsk = {
7
- readonly text: string;
8
- readonly limit: number;
9
- readonly after: readonly [HitCursor, HitCursor] | null;
10
- readonly total: boolean;
11
- readonly documents: {
12
- readonly plan: Plan;
13
- readonly rooms: readonly QueryRoom[];
14
- readonly beneath: readonly {
15
- readonly key: number;
16
- readonly roots: readonly string[];
17
- }[];
18
- } | null;
19
- readonly conversations: readonly string[];
20
- };
21
- export declare function indexDocument(connection: Connection, id: number, path: string, content: string): void;
22
- export declare function indexMessage(connection: Connection, id: number, text: string): void;
23
- export declare function unindexDocuments(connection: Connection, ids: Iterable<number>): void;
24
- export declare function unindexMessages(connection: Connection, ids: Iterable<number>): void;
25
- export declare function unindexAll(connection: Connection): void;
26
- export declare function searched(connection: Connection, ask: SearchAsk): SearchWindow;