@agentshouse/app-bridge 0.1.0-cfb5ca35059bb → 0.1.0-cfbb2e428ff88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +4 -4
  2. package/dist/index.d.ts +56 -36
  3. package/dist/mdmodel/definition.d.ts +1 -1
  4. package/dist/mdmodel/event.d.ts +77 -0
  5. package/dist/mdmodel/facts.d.ts +14 -0
  6. package/dist/mdmodel/index.d.ts +17 -5
  7. package/dist/mdmodel/kinds.d.ts +18 -0
  8. package/dist/mdmodel/query/language.d.ts +222 -0
  9. package/dist/mdmodel/query/match.d.ts +13 -0
  10. package/dist/mdmodel/query/rows.d.ts +31 -0
  11. package/dist/mdmodel/query/sql.d.ts +38 -0
  12. package/dist/mdmodel/reserved.d.ts +4 -0
  13. package/dist/mdmodel/types.d.ts +7 -0
  14. package/dist/mdmodel/validate.d.ts +4 -3
  15. package/dist/mdruntime/adapter.d.ts +25 -9
  16. package/dist/mdruntime/chain.d.ts +2 -1
  17. package/dist/mdruntime/client.d.ts +8 -3
  18. package/dist/mdruntime/collection.d.ts +2 -1
  19. package/dist/mdruntime/compile.d.ts +1 -6
  20. package/dist/mdruntime/connection.d.ts +8 -6
  21. package/dist/mdruntime/conversation.d.ts +5 -4
  22. package/dist/mdruntime/durability.d.ts +6 -0
  23. package/dist/mdruntime/identity.d.ts +0 -1
  24. package/dist/mdruntime/messages.d.ts +2 -2
  25. package/dist/mdruntime/model.d.ts +2 -7
  26. package/dist/mdruntime/observation.d.ts +2 -2
  27. package/dist/mdruntime/query.d.ts +3 -208
  28. package/dist/mdruntime/reach.d.ts +6 -6
  29. package/dist/mdruntime/readiness.d.ts +0 -2
  30. package/dist/mdruntime/replica.d.ts +8 -5
  31. package/dist/mdruntime/room-draft.d.ts +4 -3
  32. package/dist/mdruntime/search.d.ts +12 -63
  33. package/dist/mdruntime/store.d.ts +4 -7
  34. package/dist/mdruntime/stored.d.ts +3 -4
  35. package/dist/mdruntime/tables.d.ts +8 -6
  36. package/dist/mdruntime/wire.d.ts +9 -0
  37. package/dist/test-host.js +1 -0
  38. package/docs/families.md +14 -1
  39. package/package.json +1 -1
  40. package/dist/mdmodel/condition.d.ts +0 -179
  41. package/dist/mdruntime/fulltext.d.ts +0 -26
@@ -0,0 +1,38 @@
1
+ import { type Ordering } from '../kinds.js';
2
+ import type { QueryPlan, Scope } from './language.js';
3
+ import { type HeldValue, type Reach } from './rows.js';
4
+ export type SqlValue = string | number | bigint | Uint8Array | null;
5
+ export type Fragment = {
6
+ readonly sql: string;
7
+ readonly bind: readonly SqlValue[];
8
+ };
9
+ export type Collate = (ordering: Ordering, lists: boolean, total: boolean) => string | null;
10
+ export type Term = {
11
+ readonly ordering: Ordering;
12
+ readonly kind: Fragment;
13
+ readonly value: Fragment;
14
+ readonly instant?: Fragment;
15
+ readonly total?: boolean;
16
+ };
17
+ export type Following = {
18
+ readonly beyond: Fragment;
19
+ readonly equal: Fragment;
20
+ };
21
+ export declare const VALUE_TABLE = "CREATE TABLE replica_values (doc INTEGER NOT NULL, keys TEXT NOT NULL, places TEXT NOT NULL, item INTEGER NOT NULL, kind TEXT NOT NULL, value, size INTEGER, instant TEXT, PRIMARY KEY (doc, keys, places, item)) WITHOUT ROWID";
22
+ export declare const HOLDS_PHRASE = "holds_phrase";
23
+ export declare function holdsPhrase(_context: number, text: unknown, phrase: unknown): number;
24
+ export declare function fragment(sql: string, bind?: readonly SqlValue[]): Fragment;
25
+ export declare function joined(parts: readonly Fragment[], separator: string): Fragment;
26
+ export declare function all(parts: readonly Fragment[]): Fragment;
27
+ export declare function any(parts: readonly Fragment[]): Fragment;
28
+ export declare function grouped(part: Fragment): Fragment;
29
+ export declare function listed(values: readonly SqlValue[]): Fragment;
30
+ export declare function exists(part: Fragment): Fragment;
31
+ export declare function insertedValues(doc: number, values: readonly HeldValue[]): Fragment;
32
+ export declare function placed(alias: string, field: string, reach: Reach): Fragment;
33
+ export declare function scoped(alias: string, scope: Scope, byPaths?: boolean): Fragment;
34
+ export declare function tests(alias: string, plan: QueryPlan): Fragment;
35
+ export declare function sortValue(kind: SqlValue | undefined, value: unknown, instant: SqlValue | undefined): unknown;
36
+ export declare function sorted(collate: Collate, term: Term): Fragment;
37
+ export declare function beyond(collate: Collate, term: Term, value: unknown): Following;
38
+ export declare function following(parts: readonly Following[], tie: Fragment): Fragment;
@@ -0,0 +1,4 @@
1
+ export declare const ROOM_DESCRIPTION = "ROOM.md";
2
+ export declare const RESERVED_NAMES: readonly string[];
3
+ export declare function isReservedName(name: string): boolean;
4
+ export declare function isDocumentPath(path: string): boolean;
@@ -12,9 +12,16 @@ export type ModelVerification = {
12
12
  readonly rule: string;
13
13
  readonly location?: string;
14
14
  };
15
+ export type TypedPath = {
16
+ readonly path: string;
17
+ readonly type: string;
18
+ readonly named: boolean;
19
+ readonly body: boolean;
20
+ };
15
21
  export type ValidationContext = {
16
22
  readonly binaryTargets: readonly string[];
17
23
  readonly anyRoom?: true;
24
+ readonly typedPaths?: readonly TypedPath[];
18
25
  };
19
26
  export type ProjectionContext = {
20
27
  readonly documentTargets: readonly string[];
@@ -2,8 +2,9 @@ import { type Definition } from './definition.js';
2
2
  import type { DocumentCheck, Library, ModelVerification, Reached, RoomReference, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
3
3
  export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
4
4
  export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
5
- export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): DocumentCheck;
6
- export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
5
+ export declare function readTypes(schema: string, provided?: VerifiedModel): VerifiedModel;
6
+ type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
7
+ export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
7
8
  export declare function bodyRoomLinks(body: string): RoomReference[];
8
9
  export declare function roomReferences(file: string, content: string, definition?: Definition): readonly RoomReference[];
9
10
  type Placed = {
@@ -20,7 +21,7 @@ export type Assessment = {
20
21
  readonly linked: boolean;
21
22
  readonly sections: readonly Placed[];
22
23
  };
23
- export declare function assess(file: string, content: string, binary: boolean, model?: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): Assessment;
24
+ export declare function assess(file: string, content: string, binary: boolean, model?: VerifiedModel, context?: Placing): Assessment;
24
25
  export type Verdicts = {
25
26
  add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
26
27
  verdict(): Validation;
@@ -1,4 +1,6 @@
1
+ import type { SavedFacts, TypedPath } from '../mdmodel/index.js';
1
2
  import type { ModelResult } from './model.js';
3
+ export type { SavedFacts, TypedPath };
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 = {
@@ -227,7 +230,6 @@ export type HistoryRetention = {
227
230
  };
228
231
  export type Retention = {
229
232
  history: HistoryRetention;
230
- outcome: number;
231
233
  refreshHorizon: number;
232
234
  };
233
235
  export type Discovery = {
@@ -313,6 +315,7 @@ export type BootstrapPage = {
313
315
  roomVersion: string;
314
316
  models?: RoomModels;
315
317
  documents: Readonly<Record<string, string>>;
318
+ facts: Readonly<Record<string, SavedFacts>>;
316
319
  revisions: Readonly<Record<string, string>>;
317
320
  fileIds?: Readonly<Record<string, string>>;
318
321
  changes: Readonly<Record<string, HeadChange>>;
@@ -335,6 +338,7 @@ export type RefreshPage = {
335
338
  roomVersion: string;
336
339
  models?: RoomModels;
337
340
  documents: Readonly<Record<string, string>>;
341
+ facts: Readonly<Record<string, SavedFacts>>;
338
342
  revisions: Readonly<Record<string, string>>;
339
343
  fileIds?: Readonly<Record<string, string>>;
340
344
  changes: Readonly<Record<string, HeadChange>>;
@@ -386,15 +390,9 @@ export type MutationResult = (AcceptedRoom & {
386
390
  affected: Readonly<Record<string, string>>;
387
391
  }) | RetryableRefusal | {
388
392
  kind: 'write-halted';
389
- } | {
390
- kind: 'expired';
391
- restored?: true;
392
393
  } | AdapterFailure;
393
394
  export type HistoryAuthor = {
394
- kind: 'user';
395
- id: string;
396
- } | {
397
- kind: 'site' | 'inbox' | 'app';
395
+ kind: 'user' | 'site' | 'inbox' | 'app';
398
396
  id: string;
399
397
  name: string;
400
398
  };
@@ -473,6 +471,22 @@ export type ActionResult = {
473
471
  } | (ProviderRefusal & {
474
472
  kind: 'rejected';
475
473
  }) | AdapterFailure;
474
+ export type SearchHit = {
475
+ room: string;
476
+ path: string;
477
+ line?: number;
478
+ snippet?: string;
479
+ };
480
+ export type SearchAsk = {
481
+ text: string;
482
+ rooms: readonly string[] | null;
483
+ };
484
+ export type SearchAnswer = {
485
+ kind: 'found';
486
+ documents: readonly SearchHit[];
487
+ } | (ProviderRefusal & {
488
+ kind: 'rejected';
489
+ }) | AdapterFailure;
476
490
  export type HeldRoom = {
477
491
  locator: string;
478
492
  roomVersion: string;
@@ -499,6 +513,7 @@ export type RoomStreamEvent = {
499
513
  kind: 'closed';
500
514
  revoked: boolean;
501
515
  lost: boolean;
516
+ authorityChanged: boolean;
502
517
  } | {
503
518
  kind: 'caught-up';
504
519
  expired: readonly string[];
@@ -511,6 +526,7 @@ export type Adapter = {
511
526
  readonly localSaves?: true;
512
527
  readonly roomTypes?: string;
513
528
  readonly nameableRoomTypes?: readonly string[];
529
+ readonly typedPaths?: readonly TypedPath[];
514
530
  authorize(): Promise<Authorization>;
515
531
  discover?(authorization: Authorization): Promise<DiscoverResult>;
516
532
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
@@ -521,10 +537,10 @@ export type Adapter = {
521
537
  link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
522
538
  attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
523
539
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
540
+ search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
524
541
  reached(locator: string, roomVersion: string, target: string): boolean;
525
542
  follows(locator: string, roomVersion: string, next: string): boolean;
526
543
  roomStream?: RoomStream;
527
544
  conversations?: ConversationStream;
528
545
  serviceMode?: ServiceModeSignal;
529
546
  };
530
- export {};
@@ -1,5 +1,6 @@
1
+ import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
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 '../mdmodel/index.js';
1
2
  import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult } from './connection.js';
2
3
  import type { Member, ServiceMode } from './adapter.js';
3
- import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
4
+ import type { UnsentWork } from './durability.js';
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';
@@ -32,7 +34,7 @@ export type MdRuntimeClient = {
32
34
  };
33
35
  conversation: {
34
36
  list(): Promise<readonly ConversationEntry[]>;
35
- read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
37
+ read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
36
38
  create(input: unknown): Promise<CallResult>;
37
39
  send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
38
40
  answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
@@ -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[]>>;
@@ -67,6 +71,7 @@ export type MdRuntimeClient = {
67
71
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
68
72
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
69
73
  (topic: 'member'): Promise<Observation<Member | null>>;
74
+ (topic: 'authority-changes'): Promise<Observation<number>>;
70
75
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
71
76
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
72
77
  (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
@@ -1,4 +1,4 @@
1
- import { type Document } from '../mdmodel/index.js';
1
+ import { type Document, type TypedPath } from '../mdmodel/index.js';
2
2
  import type { ModelState } from './model.js';
3
3
  import type { MdModelIdentity } from './adapter.js';
4
4
  export declare const MD_MODEL: MdModelIdentity;
@@ -13,6 +13,7 @@ export type Composition = {
13
13
  roots: readonly string[];
14
14
  model: ModelState;
15
15
  } | null;
16
+ typedPaths: readonly TypedPath[];
16
17
  };
17
18
  export type Composed = {
18
19
  readonly composition: Composition;
@@ -1,15 +1,10 @@
1
1
  import type { Plan, QueryRows } from './query.js';
2
- import type { Connection, Value } from './tables.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 '../mdmodel/index.js';
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,8 +13,8 @@ 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 CodeAvailability, type Persistence, type Readiness, type SearchObligation, type Space } from './readiness.js';
16
+ import { type RuntimeShell, type UnsentWork } from './durability.js';
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';
19
20
  export type AppTypedSelection = {
@@ -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>>;
@@ -124,6 +127,7 @@ export type MdRuntime = {
124
127
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
125
128
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
126
129
  (topic: 'member'): Promise<Observation<Member | null>>;
130
+ (topic: 'authority-changes'): Promise<Observation<number>>;
127
131
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
128
132
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
129
133
  (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
@@ -135,12 +139,10 @@ export type MdRuntime = {
135
139
  };
136
140
  reauthorize(): Promise<void>;
137
141
  };
138
- export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents';
142
+ 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
143
  export type ReadinessPort = {
140
144
  readonly target: string;
141
145
  readonly code: CodeAvailability;
142
- readonly space: Space | null;
143
- readonly search: SearchObligation;
144
146
  };
145
147
  export type ComposedRuntime = RuntimeView & {
146
148
  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>;
@@ -88,7 +92,6 @@ export type ConversationDependencies = {
88
92
  full(): boolean;
89
93
  closed(): boolean;
90
94
  unanswered(): void;
91
- expired(operation: string): boolean;
92
95
  };
93
96
  export type ConversationStore = {
94
97
  surface: ConversationSurface;
@@ -107,8 +110,6 @@ export type ConversationStore = {
107
110
  watchAgents(deliver: (agents: readonly ConversationAgent[]) => void): () => void;
108
111
  changed(set: ChangeSet): void;
109
112
  receive(event: ConversationEvent): boolean;
110
- searchable(): readonly string[];
111
- acquired(conversation: string): boolean;
112
113
  close(): void;
113
114
  };
114
115
  export declare function unheldView(conversation: string): ConversationView;
@@ -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;
@@ -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;
@@ -1,4 +1,4 @@
1
- import type { Definition, ValueFacts, VerifiedModel } from '../mdmodel/index.js';
1
+ import type { Definition, VerifiedModel } from '../mdmodel/index.js';
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;
@@ -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
  } | {