@agentshouse/app-bridge 0.1.0-c8d8dc6285bbd → 0.1.0-c8eb04e6114fb
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.
- package/README.md +7 -7
- package/dist/index.d.ts +910 -18
- package/dist/mdmodel/definition.d.ts +1 -1
- package/dist/mdmodel/document.d.ts +2 -1
- package/dist/mdmodel/event.d.ts +77 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/index.d.ts +19 -6
- package/dist/mdmodel/kinds.d.ts +18 -0
- package/dist/mdmodel/pattern.d.ts +9 -0
- package/dist/mdmodel/query/language.d.ts +253 -0
- package/dist/mdmodel/query/match.d.ts +13 -0
- package/dist/mdmodel/query/rows.d.ts +31 -0
- package/dist/mdmodel/query/sql.d.ts +38 -0
- package/dist/mdmodel/reserved.d.ts +4 -0
- package/dist/mdmodel/types.d.ts +11 -0
- package/dist/mdmodel/validate.d.ts +7 -5
- package/dist/mdruntime/actions.d.ts +19 -0
- package/dist/mdruntime/adapter.d.ts +107 -71
- package/dist/mdruntime/attached-model.d.ts +7 -0
- package/dist/mdruntime/bootstrap.d.ts +43 -0
- package/dist/mdruntime/cell.d.ts +5 -0
- package/dist/mdruntime/chain.d.ts +2 -1
- package/dist/mdruntime/change.d.ts +1 -0
- package/dist/mdruntime/client.d.ts +25 -10
- package/dist/mdruntime/collection.d.ts +7 -4
- package/dist/mdruntime/compile.d.ts +6 -6
- package/dist/mdruntime/conversation-live.d.ts +135 -0
- package/dist/mdruntime/conversation-row.d.ts +32 -0
- package/dist/mdruntime/conversation.d.ts +41 -45
- package/dist/mdruntime/durability.d.ts +15 -1
- package/dist/mdruntime/figures.d.ts +48 -0
- package/dist/mdruntime/holdings.d.ts +28 -0
- package/dist/mdruntime/identity.d.ts +0 -1
- package/dist/mdruntime/install.d.ts +55 -0
- package/dist/mdruntime/job.d.ts +32 -0
- package/dist/mdruntime/listing.d.ts +52 -0
- package/dist/mdruntime/live.d.ts +22 -0
- package/dist/mdruntime/log.d.ts +5 -0
- package/dist/mdruntime/media.d.ts +7 -0
- package/dist/mdruntime/messages.d.ts +27 -3
- package/dist/mdruntime/model.d.ts +8 -10
- package/dist/mdruntime/observation.d.ts +3 -2
- package/dist/mdruntime/outcome.d.ts +17 -6
- package/dist/mdruntime/overlay.d.ts +1 -0
- package/dist/mdruntime/preparation.d.ts +19 -0
- package/dist/mdruntime/query.d.ts +18 -207
- package/dist/mdruntime/reach.d.ts +20 -11
- package/dist/mdruntime/readiness.d.ts +3 -18
- package/dist/mdruntime/reads.d.ts +36 -0
- package/dist/mdruntime/recovery.d.ts +1 -0
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +11 -12
- package/dist/mdruntime/room-draft.d.ts +21 -5
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +42 -0
- package/dist/mdruntime/save.d.ts +7 -1
- package/dist/mdruntime/saves.d.ts +69 -0
- package/dist/mdruntime/search.d.ts +12 -63
- package/dist/mdruntime/seed.d.ts +11 -2
- package/dist/mdruntime/socket/admission.d.ts +6 -0
- package/dist/mdruntime/socket/answers.d.ts +5 -0
- package/dist/mdruntime/socket/lanes.d.ts +19 -0
- package/dist/mdruntime/socket/rooms.d.ts +43 -0
- package/dist/mdruntime/socket/session.d.ts +38 -0
- package/dist/mdruntime/socket.d.ts +69 -0
- package/dist/mdruntime/source.d.ts +60 -0
- package/dist/mdruntime/status.d.ts +4 -5
- package/dist/mdruntime/store/fences.d.ts +15 -0
- package/dist/mdruntime/store/installs.d.ts +29 -0
- package/dist/mdruntime/store/readiness.d.ts +9 -0
- package/dist/mdruntime/store/records.d.ts +211 -0
- package/dist/mdruntime/store/room-held.d.ts +7 -0
- package/dist/mdruntime/store/space.d.ts +10 -0
- package/dist/mdruntime/store/watchers.d.ts +16 -0
- package/dist/mdruntime/store/writes.d.ts +23 -0
- package/dist/mdruntime/store.d.ts +105 -158
- package/dist/mdruntime/stored.d.ts +66 -55
- package/dist/mdruntime/surface.d.ts +87 -0
- package/dist/mdruntime/tables.d.ts +131 -69
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +0 -5
- package/dist/mdruntime/turn.d.ts +8 -0
- package/dist/mdruntime/wire.d.ts +25 -9
- package/dist/test-host.d.ts +1 -4
- package/dist/test-host.js +2 -28
- package/docs/families.md +48 -52
- package/package.json +1 -1
- package/dist/calls.d.ts +0 -1007
- package/dist/calls.js +0 -1
- package/dist/mdmodel/condition.d.ts +0 -160
- package/dist/mdruntime/connection.d.ts +0 -151
- package/dist/mdruntime/file.d.ts +0 -11
- package/dist/mdruntime/fulltext.d.ts +0 -26
- package/dist/mdruntime/shared.d.ts +0 -15
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HeadChange } from './adapter.js';
|
|
2
|
-
import type
|
|
1
|
+
import type { SavedFacts, HeadChange } from './adapter.js';
|
|
2
|
+
import { type Composed, type Composition } from './collection.js';
|
|
3
3
|
import type { HeldBinary } from './overlay.js';
|
|
4
4
|
import type { Connection } from './tables.js';
|
|
5
5
|
export declare const REPLICA_TABLES: readonly string[];
|
|
@@ -10,8 +10,10 @@ export type StoredEntry = {
|
|
|
10
10
|
readonly binary: HeldBinary | null;
|
|
11
11
|
readonly revision: string | null;
|
|
12
12
|
readonly fileId: string | null;
|
|
13
|
+
readonly created: string | null;
|
|
13
14
|
readonly change: HeadChange | null;
|
|
14
15
|
readonly written: string | null;
|
|
16
|
+
readonly facts: SavedFacts | null;
|
|
15
17
|
};
|
|
16
18
|
export type OverlayEntry = StoredEntry & {
|
|
17
19
|
readonly present: boolean;
|
|
@@ -27,39 +29,46 @@ export type TypedEntry = {
|
|
|
27
29
|
export type Referrer = {
|
|
28
30
|
readonly path: string;
|
|
29
31
|
readonly target: string;
|
|
30
|
-
readonly kind: string;
|
|
31
32
|
};
|
|
32
|
-
export type
|
|
33
|
-
readonly key: number;
|
|
33
|
+
export type HeldRoomRow = {
|
|
34
34
|
readonly locator: string;
|
|
35
|
-
readonly
|
|
36
|
-
readonly
|
|
35
|
+
readonly key: number;
|
|
36
|
+
readonly record: string;
|
|
37
|
+
readonly indexed: boolean;
|
|
38
|
+
readonly documents: number;
|
|
37
39
|
};
|
|
38
|
-
export type
|
|
39
|
-
readonly
|
|
40
|
-
readonly
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
export type HeldRoomWork = {
|
|
41
|
+
readonly room: (HeldRoomRow & {
|
|
42
|
+
readonly overlaid: readonly string[];
|
|
43
|
+
}) | null;
|
|
44
|
+
readonly queue: readonly {
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly batch: string;
|
|
47
|
+
readonly state: string;
|
|
43
48
|
}[];
|
|
44
|
-
|
|
49
|
+
};
|
|
50
|
+
export type Covering = {
|
|
51
|
+
readonly rooms: readonly {
|
|
45
52
|
readonly locator: string;
|
|
46
53
|
readonly key: number;
|
|
47
|
-
readonly
|
|
54
|
+
readonly transfer: string;
|
|
55
|
+
readonly roomVersion: string;
|
|
56
|
+
readonly indexed: boolean;
|
|
57
|
+
readonly documents: number;
|
|
58
|
+
readonly bytes: number;
|
|
59
|
+
readonly offline: string;
|
|
48
60
|
}[];
|
|
49
|
-
readonly
|
|
50
|
-
readonly facts: Readonly<Record<string, string>>;
|
|
51
|
-
readonly presentation: readonly {
|
|
52
|
-
readonly app: string;
|
|
53
|
-
readonly value: string;
|
|
54
|
-
}[];
|
|
55
|
-
readonly overlaid: readonly {
|
|
56
|
-
readonly key: number;
|
|
57
|
-
readonly path: string;
|
|
58
|
-
}[];
|
|
59
|
-
readonly erasing: readonly {
|
|
60
|
-
readonly key: number;
|
|
61
|
+
readonly queues: readonly {
|
|
61
62
|
readonly locator: string;
|
|
63
|
+
readonly ids: readonly string[];
|
|
62
64
|
}[];
|
|
65
|
+
};
|
|
66
|
+
export type HeldLocators = {
|
|
67
|
+
readonly held: readonly string[];
|
|
68
|
+
readonly staged: readonly string[];
|
|
69
|
+
};
|
|
70
|
+
export type ReplicaOpened = {
|
|
71
|
+
readonly erasing: boolean;
|
|
63
72
|
readonly orphans: readonly number[];
|
|
64
73
|
};
|
|
65
74
|
export type RoomCommit = {
|
|
@@ -71,7 +80,7 @@ export type RoomCommit = {
|
|
|
71
80
|
readonly from: number | null;
|
|
72
81
|
};
|
|
73
82
|
readonly refreshed?: true;
|
|
74
|
-
readonly
|
|
83
|
+
readonly composed: Composed;
|
|
75
84
|
readonly confirmed?: {
|
|
76
85
|
readonly set: readonly StoredEntry[];
|
|
77
86
|
readonly removed: readonly string[];
|
|
@@ -82,63 +91,65 @@ export type RoomCommit = {
|
|
|
82
91
|
};
|
|
83
92
|
};
|
|
84
93
|
export type Committed = {
|
|
85
|
-
readonly counts: Readonly<Record<string, number>>;
|
|
86
94
|
readonly changed: Readonly<Record<string, readonly string[] | null>>;
|
|
87
95
|
readonly indexed: Readonly<Record<string, boolean>>;
|
|
88
96
|
};
|
|
89
|
-
export type CountedRoom = {
|
|
90
|
-
readonly key: number;
|
|
91
|
-
readonly roots: readonly string[];
|
|
92
|
-
};
|
|
93
|
-
export type Walked = {
|
|
94
|
-
readonly entries: readonly HeldEntry[];
|
|
95
|
-
readonly next: string | null;
|
|
96
|
-
};
|
|
97
|
-
export declare function fingerprint(composition: Composition): string;
|
|
98
97
|
export declare function entered(connection: Connection, locator: string, composition: Composition, rows: readonly StoredEntry[]): number;
|
|
99
98
|
export declare function stage(connection: Connection, request: {
|
|
100
99
|
readonly locator: string;
|
|
101
100
|
readonly transfer: string;
|
|
102
|
-
readonly record: string;
|
|
103
101
|
readonly key: number | null;
|
|
104
|
-
readonly
|
|
102
|
+
readonly fingerprint: string;
|
|
105
103
|
readonly entries: readonly StoredEntry[];
|
|
106
104
|
readonly folders: readonly string[];
|
|
107
|
-
readonly
|
|
105
|
+
readonly part: string | null;
|
|
108
106
|
}): number;
|
|
107
|
+
export type Resumed = {
|
|
108
|
+
readonly key: number | null;
|
|
109
|
+
readonly transfer: string;
|
|
110
|
+
readonly staged: readonly string[];
|
|
111
|
+
};
|
|
112
|
+
export declare function resume(connection: Connection, request: {
|
|
113
|
+
readonly locator: string;
|
|
114
|
+
readonly transfer: string;
|
|
115
|
+
readonly fingerprint: string;
|
|
116
|
+
readonly parts: readonly string[];
|
|
117
|
+
readonly published: number | null;
|
|
118
|
+
}): Resumed;
|
|
109
119
|
export declare function refreshing(connection: Connection, request: {
|
|
110
120
|
readonly key: number;
|
|
121
|
+
readonly composed: Composed;
|
|
111
122
|
readonly entries: readonly StoredEntry[];
|
|
112
123
|
readonly removals: readonly string[];
|
|
113
124
|
readonly folders: readonly string[];
|
|
114
125
|
readonly folderRemovals: readonly string[];
|
|
115
126
|
}): null;
|
|
116
127
|
export declare function unrefresh(connection: Connection, key: number): null;
|
|
117
|
-
export declare function counts(connection: Connection, rooms: readonly CountedRoom[]): number[];
|
|
118
128
|
export declare function commit(connection: Connection, rooms: readonly RoomCommit[]): Committed;
|
|
119
129
|
export declare function fenceRooms(connection: Connection, locators: readonly string[]): null;
|
|
120
|
-
export declare function abandon(connection: Connection, locator: string
|
|
130
|
+
export declare function abandon(connection: Connection, locator: string): null;
|
|
121
131
|
export declare function release(connection: Connection, key: number): null;
|
|
122
132
|
export declare function erase(connection: Connection, locator: string | null, limit: number): {
|
|
123
133
|
readonly remaining: boolean;
|
|
124
134
|
};
|
|
125
|
-
export declare function rederive(connection: Connection, key: number,
|
|
135
|
+
export declare function rederive(connection: Connection, key: number, composed: Composed, bytes: number, ms: number, floor: number): {
|
|
126
136
|
readonly done: boolean;
|
|
137
|
+
readonly text: number;
|
|
127
138
|
};
|
|
128
139
|
export declare function entries(connection: Connection, key: number, view: View, list: readonly string[]): HeldEntry[];
|
|
129
140
|
export declare function typed(connection: Connection, key: number, view: View, list: readonly string[]): TypedEntry[];
|
|
130
|
-
export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[]
|
|
131
|
-
export declare function
|
|
132
|
-
export declare function files(connection: Connection, key: number, view: View, after: string | null, limit: number): {
|
|
133
|
-
readonly path: string;
|
|
134
|
-
readonly revision: string;
|
|
135
|
-
}[];
|
|
141
|
+
export declare function referrers(connection: Connection, key: number, view: View, targets: readonly string[]): Referrer[];
|
|
142
|
+
export declare function folders(connection: Connection, key: number, list: readonly string[]): string[];
|
|
136
143
|
export declare function typedWithin(connection: Connection, key: number, view: View, roots: readonly string[], within: boolean): boolean;
|
|
137
|
-
export declare function transferPart(connection: Connection, locator: string, token: string): Uint8Array | null;
|
|
138
|
-
export declare function keepPart(connection: Connection, request: {
|
|
139
|
-
readonly locator: string;
|
|
140
|
-
readonly token: string;
|
|
141
|
-
readonly part: Uint8Array;
|
|
142
|
-
}): null;
|
|
143
144
|
export declare function opened(connection: Connection): ReplicaOpened;
|
|
145
|
+
export declare function heldRooms(connection: Connection, locators: readonly string[] | null): readonly HeldRoomRow[];
|
|
146
|
+
export declare function heldRoom(connection: Connection, locator: string): HeldRoomRow | null;
|
|
147
|
+
export declare function overlaid(connection: Connection, key: number): readonly string[];
|
|
148
|
+
export declare function covering(connection: Connection): Covering['rooms'];
|
|
149
|
+
export declare function offlineMode(connection: Connection, locator: string): string | null;
|
|
150
|
+
export declare function stagedLocators(connection: Connection): readonly string[];
|
|
151
|
+
export declare function heldLocators(connection: Connection): readonly string[];
|
|
152
|
+
export declare function demoted(connection: Connection): null;
|
|
153
|
+
export declare function facts(connection: Connection): Readonly<Record<string, string>>;
|
|
154
|
+
export declare function presentation(connection: Connection, app: string): string | null;
|
|
144
155
|
export declare function ended(connection: Connection): void;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
|
|
2
|
+
import { type HistoryQuery } from './actions.js';
|
|
3
|
+
import type { Member, ServiceMode } from './adapter.js';
|
|
4
|
+
import type { WrittenBy } from './change.js';
|
|
5
|
+
import { type ChatDraftSurface, type ConversationEntry, type ConversationAgent, type ConversationOptions, type ConversationSurface, type ConversationView } from './conversation.js';
|
|
6
|
+
import type { UnsentWork } from './durability.js';
|
|
7
|
+
import type { FiguresResult } from './figures.js';
|
|
8
|
+
import { type Holdings } from './holdings.js';
|
|
9
|
+
import { type AppRoom } from './listing.js';
|
|
10
|
+
import { type TypesResult } from './model.js';
|
|
11
|
+
import { type Observation } from './observation.js';
|
|
12
|
+
import type { HistoryAnswer, QueueEntry, Resolution, CallResult } from './outcome.js';
|
|
13
|
+
import { type ReadinessPort } from './preparation.js';
|
|
14
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
15
|
+
import { type NarrowedView, type PortReach, type RuntimeView } from './reach.js';
|
|
16
|
+
import type { Persistence, Readiness } from './readiness.js';
|
|
17
|
+
import type { ObservedRead } from './reads.js';
|
|
18
|
+
import type { RoomDraft } from './room-draft.js';
|
|
19
|
+
import { type PresentationSurface, type RoomDraftSurface } from './room-drafts.js';
|
|
20
|
+
import type { Runtime } from './runtime.js';
|
|
21
|
+
import { type BinaryFileSurface, type SavedParts, type SavedRoomDraft, type SaveResult } from './saves.js';
|
|
22
|
+
import type { SearchRequest, SearchResult } from './search.js';
|
|
23
|
+
import { type EntrySeed } from './seed.js';
|
|
24
|
+
import type { ConnectionRefusal } from './socket.js';
|
|
25
|
+
import type { SyncStatus } from './status.js';
|
|
26
|
+
export type RoomSchemas = {
|
|
27
|
+
collection: TypesResult;
|
|
28
|
+
typedSelection: TypesResult | null;
|
|
29
|
+
};
|
|
30
|
+
export type MdRuntime = {
|
|
31
|
+
loaded(): Promise<void>;
|
|
32
|
+
rooms(): Promise<readonly AppRoom[]>;
|
|
33
|
+
query: {
|
|
34
|
+
(query: DocumentQuery): Promise<DocumentResult | PendingResult>;
|
|
35
|
+
(query: GroupQuery): Promise<GroupResult | PendingResult>;
|
|
36
|
+
};
|
|
37
|
+
search(request: SearchRequest): Promise<SearchResult>;
|
|
38
|
+
types(locator: string): Promise<RoomSchemas>;
|
|
39
|
+
roomDraft: RoomDraftSurface;
|
|
40
|
+
conversation: ConversationSurface;
|
|
41
|
+
chatDraft: ChatDraftSurface;
|
|
42
|
+
presentation: PresentationSurface;
|
|
43
|
+
save(room: string, roomDrafts: readonly SavedRoomDraft[], writtenBy?: WrittenBy): Promise<SaveResult>;
|
|
44
|
+
saveParts(room: string, parts: readonly SavedParts[], writtenBy?: WrittenBy): Promise<SaveResult>;
|
|
45
|
+
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
|
|
46
|
+
resolve(room: string, path: string, destination: string): Promise<Resolution>;
|
|
47
|
+
binaryFile: BinaryFileSurface;
|
|
48
|
+
call(name: string, input: unknown): Promise<CallResult>;
|
|
49
|
+
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
50
|
+
log(): string;
|
|
51
|
+
persistence(): boolean;
|
|
52
|
+
retry(): Promise<void>;
|
|
53
|
+
cleanUp(): Promise<number>;
|
|
54
|
+
unsent(): Promise<readonly UnsentWork[]>;
|
|
55
|
+
reset(): Promise<void>;
|
|
56
|
+
readAgain(): Promise<void>;
|
|
57
|
+
observe: {
|
|
58
|
+
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
59
|
+
(topic: 'readiness'): Promise<Observation<Readiness>>;
|
|
60
|
+
(topic: 'connection-refusal'): Promise<Observation<ConnectionRefusal | null>>;
|
|
61
|
+
(topic: 'storage-loss'): Promise<Observation<string | null>>;
|
|
62
|
+
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
63
|
+
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
64
|
+
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
65
|
+
(topic: 'authority-changes'): Promise<Observation<number>>;
|
|
66
|
+
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
|
|
67
|
+
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
|
|
68
|
+
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
|
69
|
+
(topic: 'room-drafts'): Promise<Observation<readonly RoomDraft[]>>;
|
|
70
|
+
(topic: 'presentation', app: string): Promise<Observation<unknown>>;
|
|
71
|
+
(topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
|
|
72
|
+
(topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
|
|
73
|
+
(topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
|
|
74
|
+
(topic: 'figures'): Promise<Observation<FiguresResult>>;
|
|
75
|
+
(topic: 'holdings'): Promise<Observation<Holdings>>;
|
|
76
|
+
(topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
|
|
77
|
+
};
|
|
78
|
+
reauthorize(): Promise<void>;
|
|
79
|
+
};
|
|
80
|
+
export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'authority-changes' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents' | 'figures' | 'holdings' | 'read';
|
|
81
|
+
export type ComposedRuntime = RuntimeView & {
|
|
82
|
+
seed(entry: EntrySeed): void;
|
|
83
|
+
stop(): Promise<void>;
|
|
84
|
+
persisted(answer: Persistence): void;
|
|
85
|
+
within(reach: PortReach | null, port: ReadinessPort): NarrowedView;
|
|
86
|
+
};
|
|
87
|
+
export declare function composedRuntime(runtime: Runtime): ComposedRuntime;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { type QueryAnswer, type QueryRoom } from './compile.js';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
import { type ConversationWrite, type HeldConversation, type MessageWindow } from './messages.js';
|
|
6
|
-
import type { Plan } from './query.js';
|
|
7
|
-
import type
|
|
8
|
-
import { type
|
|
9
|
-
|
|
2
|
+
import type { Composed } from './collection.js';
|
|
3
|
+
import type { UnsentWork } from './durability.js';
|
|
4
|
+
import type { JobMarker } from './job.js';
|
|
5
|
+
import { type ConversationWrite, type HeldConversation, type HeldRow, type MessageWindow } from './messages.js';
|
|
6
|
+
import type { GroupTotal, Plan } from './query.js';
|
|
7
|
+
import { type ReadAt } from './reads.js';
|
|
8
|
+
import { type ConversationTally, type RoomTally } from './tallies.js';
|
|
9
|
+
import { type Committed, type Covering, type HeldEntry, type HeldLocators, type HeldRoomRow, type HeldRoomWork, type ReplicaOpened, type Referrer, type Resumed, type RoomCommit, type StoredEntry, type TypedEntry, type View } from './stored.js';
|
|
10
|
+
export type { Committed, Covering, HeldEntry, HeldLocators, HeldRoomRow, HeldRoomWork, OverlayEntry, ReplicaOpened, Referrer, Resumed, RoomCommit, StoredEntry, TypedEntry, View, } from './stored.js';
|
|
10
11
|
export type { QueryAnswer, QueryRoom } from './compile.js';
|
|
11
|
-
export type {
|
|
12
|
-
export type {
|
|
12
|
+
export type { ConversationWrite, HeldConversation, HeldRow, MessageWindow } from './messages.js';
|
|
13
|
+
export type { ConversationTally, RoomTally } from './tallies.js';
|
|
13
14
|
export type Value = string | number | bigint | Uint8Array | null;
|
|
14
15
|
export type Row = Readonly<Record<string, Value>>;
|
|
15
16
|
export interface Connection {
|
|
@@ -37,6 +38,10 @@ export interface SqliteStatement {
|
|
|
37
38
|
}
|
|
38
39
|
export interface SqliteDatabase {
|
|
39
40
|
readonly pointer: number;
|
|
41
|
+
createFunction(name: string, run: (context: number, ...values: Value[]) => Value, options: {
|
|
42
|
+
readonly arity: number;
|
|
43
|
+
readonly deterministic: true;
|
|
44
|
+
}): unknown;
|
|
40
45
|
exec(options: {
|
|
41
46
|
readonly sql: string;
|
|
42
47
|
readonly bind: readonly Value[];
|
|
@@ -48,7 +53,7 @@ export interface SqliteDatabase {
|
|
|
48
53
|
export declare function sqliteConnection(engine: SqliteEngine, database: SqliteDatabase): Connection;
|
|
49
54
|
export declare const FILE_PART_BYTES = 1048576;
|
|
50
55
|
export declare const RUNTIME_TABLES: readonly string[];
|
|
51
|
-
export type AuthoredFact = 'holder' | '
|
|
56
|
+
export type AuthoredFact = 'holder' | 'generation';
|
|
52
57
|
export type StoredFile = {
|
|
53
58
|
readonly key: string;
|
|
54
59
|
readonly blob: Blob;
|
|
@@ -64,6 +69,8 @@ export type KeptPending = {
|
|
|
64
69
|
readonly batch: string;
|
|
65
70
|
readonly state: string;
|
|
66
71
|
readonly files: readonly string[];
|
|
72
|
+
readonly paths: readonly string[];
|
|
73
|
+
readonly moving: boolean;
|
|
67
74
|
};
|
|
68
75
|
export type KeptRecord = {
|
|
69
76
|
readonly record: string;
|
|
@@ -78,10 +85,6 @@ export type AuthoredRows = {
|
|
|
78
85
|
readonly path: string;
|
|
79
86
|
})[];
|
|
80
87
|
readonly consumedRoomDrafts?: readonly string[];
|
|
81
|
-
readonly amendments?: readonly {
|
|
82
|
-
readonly id: string;
|
|
83
|
-
readonly amendment: string;
|
|
84
|
-
}[];
|
|
85
88
|
};
|
|
86
89
|
export type HeldQueues = {
|
|
87
90
|
readonly queues: readonly {
|
|
@@ -95,11 +98,31 @@ export type HeldQueues = {
|
|
|
95
98
|
readonly state: string;
|
|
96
99
|
}[];
|
|
97
100
|
};
|
|
101
|
+
export type HeldStatus = {
|
|
102
|
+
readonly queued: readonly string[];
|
|
103
|
+
readonly lastCompleted: string | null;
|
|
104
|
+
readonly changes: readonly {
|
|
105
|
+
readonly locator: string;
|
|
106
|
+
readonly path: string;
|
|
107
|
+
}[];
|
|
108
|
+
readonly resets: readonly {
|
|
109
|
+
readonly locator: string;
|
|
110
|
+
readonly reset: string;
|
|
111
|
+
}[];
|
|
112
|
+
readonly returned: readonly string[];
|
|
113
|
+
};
|
|
98
114
|
export type OpenedFile = {
|
|
99
115
|
readonly key: string;
|
|
100
116
|
readonly byteLength: number;
|
|
101
117
|
readonly mediaType: string;
|
|
102
118
|
};
|
|
119
|
+
export type OpenedRoom = GroupTotal & {
|
|
120
|
+
readonly room: string;
|
|
121
|
+
};
|
|
122
|
+
export type OpenedHeld = {
|
|
123
|
+
readonly rooms: readonly OpenedRoom[];
|
|
124
|
+
readonly cleanable: number;
|
|
125
|
+
};
|
|
103
126
|
type Asked<A, R> = {
|
|
104
127
|
readonly asked: A;
|
|
105
128
|
readonly answer: R;
|
|
@@ -112,14 +135,36 @@ export type AuthoredWrite = {
|
|
|
112
135
|
readonly writes: readonly AuthoredRows[];
|
|
113
136
|
readonly files: readonly StoredFile[];
|
|
114
137
|
readonly whole: boolean;
|
|
115
|
-
readonly discards?: readonly string[];
|
|
116
138
|
};
|
|
117
139
|
export interface RuntimeRequests {
|
|
118
|
-
readonly 'authored.
|
|
119
|
-
readonly 'authored.
|
|
140
|
+
readonly 'authored.status': Asked<Nothing, HeldStatus>;
|
|
141
|
+
readonly 'authored.moving': Asked<Nothing, HeldQueues>;
|
|
142
|
+
readonly 'authored.pending': Asked<{
|
|
143
|
+
readonly locator: string;
|
|
144
|
+
readonly id: string;
|
|
145
|
+
}, {
|
|
146
|
+
readonly state: string | null;
|
|
147
|
+
readonly room: boolean;
|
|
148
|
+
}>;
|
|
149
|
+
readonly 'authored.batch': Asked<{
|
|
150
|
+
readonly locator: string;
|
|
151
|
+
readonly id: string;
|
|
152
|
+
}, string | null>;
|
|
153
|
+
readonly 'authored.order': Asked<{
|
|
154
|
+
readonly locator: string;
|
|
155
|
+
}, readonly string[]>;
|
|
156
|
+
readonly 'authored.queued': Asked<Nothing, readonly string[]>;
|
|
157
|
+
readonly 'authored.roomDrafts': Asked<{
|
|
158
|
+
readonly locator: string | null;
|
|
159
|
+
readonly paths: readonly string[] | null;
|
|
160
|
+
}, readonly string[]>;
|
|
161
|
+
readonly 'authored.chatDraft.read': Asked<{
|
|
162
|
+
readonly conversation: string;
|
|
163
|
+
}, string | null>;
|
|
120
164
|
readonly 'authored.chatDrafts': Asked<Nothing, readonly string[]>;
|
|
121
165
|
readonly 'authored.calls': Asked<Nothing, readonly string[]>;
|
|
122
166
|
readonly 'authored.fences': Asked<Nothing, readonly string[]>;
|
|
167
|
+
readonly 'authored.unsent': Asked<Nothing, readonly UnsentWork[]>;
|
|
123
168
|
readonly 'authored.fact': Asked<{
|
|
124
169
|
readonly name: AuthoredFact;
|
|
125
170
|
}, string | null>;
|
|
@@ -161,11 +206,32 @@ export interface RuntimeRequests {
|
|
|
161
206
|
readonly holder: string | null;
|
|
162
207
|
}, boolean>;
|
|
163
208
|
readonly 'replica.open': Asked<Nothing, ReplicaOpened>;
|
|
209
|
+
readonly 'replica.rooms': Asked<{
|
|
210
|
+
readonly locators: readonly string[] | null;
|
|
211
|
+
}, readonly HeldRoomRow[]>;
|
|
212
|
+
readonly 'replica.room': Asked<{
|
|
213
|
+
readonly locator: string;
|
|
214
|
+
}, HeldRoomWork>;
|
|
215
|
+
readonly 'replica.covering': Asked<Nothing, Covering>;
|
|
216
|
+
readonly 'replica.offline': Asked<{
|
|
217
|
+
readonly locator: string;
|
|
218
|
+
}, string | null>;
|
|
219
|
+
readonly 'replica.held': Asked<Nothing, HeldLocators>;
|
|
220
|
+
readonly 'replica.demote': Asked<Nothing, null>;
|
|
221
|
+
readonly 'replica.facts': Asked<Nothing, Readonly<Record<string, string>>>;
|
|
222
|
+
readonly 'replica.presentation': Asked<{
|
|
223
|
+
readonly app: string;
|
|
224
|
+
}, string | null>;
|
|
164
225
|
readonly 'replica.query': Asked<{
|
|
165
226
|
readonly plan: Plan;
|
|
166
227
|
readonly rooms: readonly QueryRoom[];
|
|
167
228
|
readonly budget: number | null;
|
|
168
229
|
}, QueryAnswer>;
|
|
230
|
+
readonly 'replica.tallies': Asked<{
|
|
231
|
+
readonly totals: Plan;
|
|
232
|
+
readonly rooms: readonly QueryRoom[];
|
|
233
|
+
readonly since: string;
|
|
234
|
+
}, readonly RoomTally[]>;
|
|
169
235
|
readonly 'replica.entries': Asked<{
|
|
170
236
|
readonly key: number;
|
|
171
237
|
readonly view: View;
|
|
@@ -180,59 +246,36 @@ export interface RuntimeRequests {
|
|
|
180
246
|
readonly key: number;
|
|
181
247
|
readonly view: View;
|
|
182
248
|
readonly targets: readonly string[];
|
|
183
|
-
readonly kinds: readonly string[];
|
|
184
249
|
}, readonly Referrer[]>;
|
|
185
|
-
readonly 'replica.
|
|
186
|
-
readonly key: number;
|
|
187
|
-
readonly view: View;
|
|
188
|
-
readonly after: string | null;
|
|
189
|
-
readonly bytes: number;
|
|
190
|
-
}, Walked>;
|
|
191
|
-
readonly 'replica.files': Asked<{
|
|
250
|
+
readonly 'replica.folders': Asked<{
|
|
192
251
|
readonly key: number;
|
|
193
|
-
readonly
|
|
194
|
-
|
|
195
|
-
readonly limit: number;
|
|
196
|
-
}, readonly {
|
|
197
|
-
readonly path: string;
|
|
198
|
-
readonly revision: string;
|
|
199
|
-
}[]>;
|
|
252
|
+
readonly paths: readonly string[];
|
|
253
|
+
}, readonly string[]>;
|
|
200
254
|
readonly 'replica.typedWithin': Asked<{
|
|
201
255
|
readonly key: number;
|
|
202
256
|
readonly view: View;
|
|
203
257
|
readonly roots: readonly string[];
|
|
204
258
|
readonly within: boolean;
|
|
205
259
|
}, boolean>;
|
|
206
|
-
readonly 'replica.counts': Asked<{
|
|
207
|
-
readonly rooms: readonly CountedRoom[];
|
|
208
|
-
}, readonly number[]>;
|
|
209
|
-
readonly 'replica.search': Asked<SearchAsk, SearchWindow>;
|
|
210
|
-
readonly 'replica.received': Asked<Nothing, readonly KeptReceipt[]>;
|
|
211
|
-
readonly 'replica.receivedParts': Asked<{
|
|
212
|
-
readonly key: string;
|
|
213
|
-
readonly count: number;
|
|
214
|
-
}, readonly unknown[]>;
|
|
215
260
|
readonly 'replica.stage': Asked<{
|
|
216
261
|
readonly locator: string;
|
|
217
262
|
readonly transfer: string;
|
|
218
|
-
readonly record: string;
|
|
219
263
|
readonly key: number | null;
|
|
220
|
-
readonly
|
|
264
|
+
readonly fingerprint: string;
|
|
221
265
|
readonly entries: readonly StoredEntry[];
|
|
222
266
|
readonly folders: readonly string[];
|
|
223
|
-
readonly
|
|
267
|
+
readonly part: string | null;
|
|
224
268
|
}, number | null>;
|
|
225
|
-
readonly 'replica.
|
|
269
|
+
readonly 'replica.resume': Asked<{
|
|
226
270
|
readonly locator: string;
|
|
227
|
-
readonly
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
readonly
|
|
231
|
-
|
|
232
|
-
readonly part: Uint8Array;
|
|
233
|
-
}, null>;
|
|
271
|
+
readonly transfer: string;
|
|
272
|
+
readonly fingerprint: string;
|
|
273
|
+
readonly parts: readonly string[];
|
|
274
|
+
readonly published: number | null;
|
|
275
|
+
}, Resumed | null>;
|
|
234
276
|
readonly 'replica.refresh': Asked<{
|
|
235
277
|
readonly key: number;
|
|
278
|
+
readonly composed: Composed;
|
|
236
279
|
readonly entries: readonly StoredEntry[];
|
|
237
280
|
readonly removals: readonly string[];
|
|
238
281
|
readonly folders: readonly string[];
|
|
@@ -256,16 +299,22 @@ export interface RuntimeRequests {
|
|
|
256
299
|
}>;
|
|
257
300
|
readonly 'replica.abandon': Asked<{
|
|
258
301
|
readonly locator: string;
|
|
259
|
-
|
|
260
|
-
|
|
302
|
+
}, null>;
|
|
303
|
+
readonly 'replica.unfence': Asked<{
|
|
304
|
+
readonly locators: readonly string[];
|
|
305
|
+
}, readonly string[]>;
|
|
261
306
|
readonly 'replica.release': Asked<{
|
|
262
307
|
readonly key: number;
|
|
263
308
|
}, null>;
|
|
264
309
|
readonly 'replica.rederive': Asked<{
|
|
265
310
|
readonly key: number;
|
|
266
|
-
readonly
|
|
311
|
+
readonly composed: Composed;
|
|
312
|
+
readonly bytes: number;
|
|
313
|
+
readonly ms: number;
|
|
314
|
+
readonly floor: number;
|
|
267
315
|
}, {
|
|
268
316
|
readonly done: boolean;
|
|
317
|
+
readonly text: number;
|
|
269
318
|
}>;
|
|
270
319
|
readonly 'replica.fact': Asked<{
|
|
271
320
|
readonly name: string;
|
|
@@ -275,17 +324,6 @@ export interface RuntimeRequests {
|
|
|
275
324
|
readonly app: string;
|
|
276
325
|
readonly value: string;
|
|
277
326
|
}, null>;
|
|
278
|
-
readonly 'replica.receive': Asked<{
|
|
279
|
-
readonly key: string;
|
|
280
|
-
readonly head: string;
|
|
281
|
-
readonly part?: {
|
|
282
|
-
readonly index: number;
|
|
283
|
-
readonly value: string;
|
|
284
|
-
};
|
|
285
|
-
}, null>;
|
|
286
|
-
readonly 'replica.unreceive': Asked<{
|
|
287
|
-
readonly keys: readonly string[];
|
|
288
|
-
}, null>;
|
|
289
327
|
readonly 'opened.find': Asked<{
|
|
290
328
|
readonly locator: string;
|
|
291
329
|
readonly path: string;
|
|
@@ -313,28 +351,50 @@ export interface RuntimeRequests {
|
|
|
313
351
|
readonly key: string;
|
|
314
352
|
}, null>;
|
|
315
353
|
readonly 'opened.clean': Asked<Nothing, number>;
|
|
354
|
+
readonly 'opened.held': Asked<Nothing, OpenedHeld>;
|
|
316
355
|
readonly 'file.part': Asked<{
|
|
317
356
|
readonly key: string;
|
|
318
357
|
readonly part: number;
|
|
319
358
|
}, Uint8Array | null>;
|
|
320
|
-
readonly 'conversation.held': Asked<
|
|
359
|
+
readonly 'conversation.held': Asked<{
|
|
360
|
+
readonly conversations: readonly string[] | null;
|
|
361
|
+
}, readonly HeldConversation[]>;
|
|
321
362
|
readonly 'conversation.keep': Asked<ConversationWrite, null>;
|
|
322
363
|
readonly 'conversation.window': Asked<{
|
|
323
364
|
readonly conversation: string;
|
|
324
365
|
readonly limit: number;
|
|
325
366
|
readonly before: readonly [string, string] | null;
|
|
367
|
+
readonly phrase: string | null;
|
|
326
368
|
}, MessageWindow>;
|
|
327
369
|
readonly 'conversation.count': Asked<{
|
|
328
370
|
readonly conversation: string;
|
|
371
|
+
readonly phrase: string | null;
|
|
329
372
|
}, number>;
|
|
330
373
|
readonly 'conversation.turn': Asked<{
|
|
331
374
|
readonly conversation: string;
|
|
332
375
|
readonly turn: string;
|
|
333
376
|
}, boolean>;
|
|
377
|
+
readonly 'conversation.rows': Asked<{
|
|
378
|
+
readonly conversations: readonly string[];
|
|
379
|
+
}, readonly HeldRow[]>;
|
|
380
|
+
readonly 'conversation.jobs': Asked<{
|
|
381
|
+
readonly conversation: string;
|
|
382
|
+
}, readonly JobMarker[]>;
|
|
383
|
+
readonly 'conversation.tallies': Asked<{
|
|
384
|
+
readonly conversations: readonly string[] | null;
|
|
385
|
+
readonly since: string;
|
|
386
|
+
}, readonly ConversationTally[]>;
|
|
334
387
|
readonly 'conversation.drop': Asked<{
|
|
335
388
|
readonly conversations: readonly string[];
|
|
336
389
|
}, null>;
|
|
337
390
|
readonly 'space.probe': Asked<Nothing, null>;
|
|
391
|
+
readonly 'read.stored': Asked<ReadAt, string | null>;
|
|
392
|
+
readonly 'read.keep': Asked<ReadAt & {
|
|
393
|
+
readonly answer: string;
|
|
394
|
+
}, null>;
|
|
395
|
+
readonly 'read.builds': Asked<{
|
|
396
|
+
readonly build: string;
|
|
397
|
+
}, null>;
|
|
338
398
|
}
|
|
339
399
|
export type RuntimeKind = keyof RuntimeRequests;
|
|
340
400
|
export type RuntimeRequest<K extends RuntimeKind = RuntimeKind> = {
|
|
@@ -349,5 +409,7 @@ export interface RuntimeDatabase {
|
|
|
349
409
|
export declare function isRuntime(request: {
|
|
350
410
|
readonly kind: string;
|
|
351
411
|
}): request is RuntimeRequest;
|
|
352
|
-
export declare function readsRuntime(request:
|
|
412
|
+
export declare function readsRuntime(request: {
|
|
413
|
+
readonly kind: string;
|
|
414
|
+
}): boolean;
|
|
353
415
|
export declare function answerRuntime(connection: Connection, request: RuntimeRequest, spool: FileSpool): unknown;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type QueryRoom } from './compile.js';
|
|
2
|
+
import type { GroupTotal, Plan } from './query.js';
|
|
3
|
+
import type { Connection } from './tables.js';
|
|
4
|
+
export type RoomTally = {
|
|
5
|
+
readonly key: number;
|
|
6
|
+
readonly documents: GroupTotal;
|
|
7
|
+
readonly files: GroupTotal;
|
|
8
|
+
readonly documentTimes: readonly (readonly [string | null, string | null])[];
|
|
9
|
+
readonly chatTimes: readonly string[];
|
|
10
|
+
readonly messageTimes: readonly string[];
|
|
11
|
+
};
|
|
12
|
+
export type ConversationTally = {
|
|
13
|
+
readonly conversation: string;
|
|
14
|
+
readonly said: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
export declare function roomTallies(connection: Connection, totals: Plan, rooms: readonly QueryRoom[], since: string): RoomTally[];
|
|
17
|
+
export declare function conversationTallies(connection: Connection, conversations: readonly string[] | null, since: string): ConversationTally[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function yielded(): Promise<void>;
|
|
2
|
+
export declare const ROW_WEIGHT = 256;
|
|
3
|
+
export type Later<T> = T | Promise<T>;
|
|
4
|
+
export declare function after<T, R>(value: Later<T>, next: (value: T) => Later<R>): Later<R>;
|
|
5
|
+
export declare function paced(): (weight: number) => Later<void>;
|
|
6
|
+
export declare function inUnits<T>(items: Iterable<T>, each: (item: T) => number, ended?: () => void, paused?: () => Promise<void>): Later<void>;
|
|
7
|
+
export declare function finished<R>(steps: Generator<number, R, void>): R;
|
|
8
|
+
export declare function stepped<R>(steps: Generator<number, R, void>): Later<R>;
|