@agentshouse/app-bridge 0.1.0-c1bc683ed8f4e → 0.1.0-c1ccced28150f
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 +9 -9
- package/dist/index.d.ts +826 -18
- package/dist/mdmodel/condition.d.ts +41 -11
- package/dist/mdmodel/definition.d.ts +17 -1
- package/dist/mdmodel/document.d.ts +5 -5
- package/dist/mdmodel/index.d.ts +11 -9
- package/dist/mdmodel/links.d.ts +28 -0
- package/dist/mdmodel/paths.d.ts +9 -1
- package/dist/mdmodel/project.d.ts +1 -0
- package/dist/mdmodel/types.d.ts +28 -4
- package/dist/mdmodel/validate.d.ts +27 -3
- package/dist/mdruntime/adapter.d.ts +121 -66
- package/dist/mdruntime/binary.d.ts +0 -5
- package/dist/mdruntime/chain.d.ts +10 -0
- package/dist/mdruntime/change-set.d.ts +9 -16
- package/dist/mdruntime/change.d.ts +31 -1
- package/dist/mdruntime/client.d.ts +15 -8
- package/dist/mdruntime/collection.d.ts +10 -21
- package/dist/mdruntime/compile.d.ts +15 -0
- package/dist/mdruntime/connection.d.ts +28 -14
- package/dist/mdruntime/conversation.d.ts +26 -11
- package/dist/mdruntime/durability.d.ts +2 -5
- package/dist/mdruntime/fulltext.d.ts +26 -0
- package/dist/mdruntime/identity.d.ts +6 -0
- package/dist/mdruntime/media.d.ts +7 -0
- package/dist/mdruntime/messages.d.ts +27 -0
- package/dist/mdruntime/model.d.ts +6 -1
- package/dist/mdruntime/observation.d.ts +15 -0
- package/dist/mdruntime/opened.d.ts +21 -0
- package/dist/mdruntime/outcome.d.ts +45 -7
- package/dist/mdruntime/overlay.d.ts +3 -5
- package/dist/mdruntime/query.d.ts +38 -2
- package/dist/mdruntime/reach.d.ts +14 -6
- package/dist/mdruntime/readiness.d.ts +14 -15
- package/dist/mdruntime/recovery.d.ts +3 -2
- package/dist/mdruntime/replica.d.ts +55 -33
- package/dist/mdruntime/room-draft.d.ts +33 -3
- package/dist/mdruntime/save.d.ts +53 -14
- package/dist/mdruntime/search.d.ts +32 -43
- package/dist/mdruntime/seed.d.ts +15 -0
- package/dist/mdruntime/status.d.ts +4 -3
- package/dist/mdruntime/store.d.ts +93 -98
- package/dist/mdruntime/stored.d.ts +129 -0
- package/dist/mdruntime/tables.d.ts +324 -0
- package/dist/mdruntime/wire.d.ts +33 -5
- package/dist/test-host.d.ts +7 -4
- package/dist/test-host.js +18 -28
- package/docs/families.md +52 -47
- package/package.json +8 -3
- package/dist/calls.d.ts +0 -117
- package/dist/calls.js +0 -1
- package/dist/mdruntime/acquisition.d.ts +0 -13
- package/dist/mdruntime/file.d.ts +0 -19
- package/dist/mdruntime/rows.d.ts +0 -36
- package/dist/mdruntime/shared.d.ts +0 -10
- package/dist/mdruntime/transfer.d.ts +0 -9
- package/dist/mdruntime/turn.d.ts +0 -6
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { MdRuntime, ReadinessPort, RuntimeTopic } from './connection.js';
|
|
1
|
+
import type { AppRoom, MdRuntime, ReadinessPort, RuntimeTopic } from './connection.js';
|
|
3
2
|
import type { Plan, PlanReach, QueryResult } from './query.js';
|
|
4
3
|
import type { Readiness } from './readiness.js';
|
|
5
|
-
import type
|
|
4
|
+
import { type SearchResult } from './search.js';
|
|
6
5
|
export type ReachedDocument = {
|
|
7
6
|
readonly room: string;
|
|
8
7
|
readonly path: string;
|
|
9
8
|
};
|
|
9
|
+
export type ReachedArea = {
|
|
10
|
+
readonly room: string;
|
|
11
|
+
readonly path: string;
|
|
12
|
+
readonly open: readonly string[];
|
|
13
|
+
};
|
|
10
14
|
export type PortReach = {
|
|
11
15
|
readonly rooms: readonly string[];
|
|
12
16
|
readonly documents: readonly ReachedDocument[];
|
|
17
|
+
readonly areas?: readonly ReachedArea[];
|
|
13
18
|
readonly conversations: boolean;
|
|
14
19
|
};
|
|
15
20
|
export type Deliver = (message: unknown) => void;
|
|
@@ -26,10 +31,13 @@ export type Reachable = RuntimeView & {
|
|
|
26
31
|
plan(input: unknown, reach: PortReach | null): Plan;
|
|
27
32
|
query(plan: Plan): Promise<QueryResult>;
|
|
28
33
|
watchPlan(plan: Plan, deliver: (message: unknown) => void): () => void;
|
|
29
|
-
search(input: unknown, reach: PortReach | null): Promise<SearchResult>;
|
|
30
|
-
searching(target: string): void;
|
|
34
|
+
search(input: unknown, reach: PortReach | null, locked: readonly string[]): Promise<SearchResult>;
|
|
31
35
|
watchReadiness(port: ReadinessPort, reach: PortReach | null, deliver: (readiness: Readiness) => void): () => void;
|
|
32
|
-
|
|
36
|
+
locked(room: string): boolean;
|
|
37
|
+
lockedRooms(): readonly string[];
|
|
38
|
+
watchLocks(notify: () => void): () => void;
|
|
39
|
+
located(room: string, path: string, destination: string): ReachedDocument | null;
|
|
40
|
+
room(locator: string): AppRoom | undefined;
|
|
33
41
|
};
|
|
34
42
|
export declare function holds(reach: PortReach | null, room: string): boolean;
|
|
35
43
|
export declare function governs(reach: PortReach | null, room: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Open } from './open.js';
|
|
2
2
|
export type CodeAvailability = Open<'stored' | 'absent'>;
|
|
3
|
-
export type RoomPreparation = Open<'complete' | 'acquiring' | 'preparing' | '
|
|
3
|
+
export type RoomPreparation = Open<'complete' | 'acquiring' | 'preparing' | 'unadmitted'>;
|
|
4
4
|
export type RoomCoverage = {
|
|
5
5
|
readonly room: string;
|
|
6
6
|
readonly state: RoomPreparation;
|
|
7
7
|
};
|
|
8
|
-
export type ConversationCoverage = Open<'complete' | 'acquiring' | '
|
|
8
|
+
export type ConversationCoverage = Open<'complete' | 'acquiring' | 'undeclared'>;
|
|
9
9
|
export type SearchObligation = Open<'required' | 'unused'>;
|
|
10
10
|
export type TargetCoverage = {
|
|
11
11
|
readonly complete: boolean;
|
|
@@ -18,18 +18,18 @@ export type Persistence = Open<'granted' | 'denied' | 'unavailable'>;
|
|
|
18
18
|
export type Durability = Open<'persistent' | 'best-effort'>;
|
|
19
19
|
export type ConnectionAvailability = Open<'connected' | 'connecting' | 'unreachable'>;
|
|
20
20
|
export type HouseOutcome = Open<'open' | 'write-halted' | 'refused'>;
|
|
21
|
-
export type
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
readonly
|
|
21
|
+
export type Space = Open<'full'>;
|
|
22
|
+
export type InstallationStep = Open<'downloading' | 'writing' | 'replaying'>;
|
|
23
|
+
export type InstallationAmount = {
|
|
24
|
+
readonly done: number;
|
|
25
|
+
readonly total: number;
|
|
25
26
|
};
|
|
26
|
-
export type
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
30
|
-
readonly location: string | null;
|
|
27
|
+
export type Installation = {
|
|
28
|
+
readonly step: InstallationStep | null;
|
|
29
|
+
readonly rooms: InstallationAmount;
|
|
30
|
+
readonly bytes: InstallationAmount;
|
|
31
31
|
};
|
|
32
|
-
export type ReadinessStatus = Open<'preparing' | 'paused' | '
|
|
32
|
+
export type ReadinessStatus = Open<'preparing' | 'paused' | 'ready' | 'lost'>;
|
|
33
33
|
export type Readiness = {
|
|
34
34
|
readonly status: ReadinessStatus;
|
|
35
35
|
readonly ready: boolean;
|
|
@@ -40,13 +40,12 @@ export type Readiness = {
|
|
|
40
40
|
readonly persistence: Persistence;
|
|
41
41
|
readonly connection: ConnectionAvailability;
|
|
42
42
|
readonly house: HouseOutcome;
|
|
43
|
-
readonly
|
|
44
|
-
readonly
|
|
43
|
+
readonly space: Space | null;
|
|
44
|
+
readonly installation: Installation;
|
|
45
45
|
readonly lost: boolean;
|
|
46
46
|
};
|
|
47
47
|
export type ReadinessFacts = Omit<Readiness, 'status' | 'ready' | 'usable' | 'durability' | 'coverage'> & {
|
|
48
48
|
readonly coverage: Omit<TargetCoverage, 'complete'>;
|
|
49
49
|
readonly established: boolean;
|
|
50
50
|
};
|
|
51
|
-
export declare const SETTLED_ROOMS: ReadonlySet<string>;
|
|
52
51
|
export declare function readinessOf(facts: ReadinessFacts): Readiness;
|
|
@@ -8,7 +8,7 @@ export type AttemptOptions = {
|
|
|
8
8
|
};
|
|
9
9
|
export type RecoveryOptions = {
|
|
10
10
|
readonly firstMs?: number;
|
|
11
|
-
readonly
|
|
11
|
+
readonly maxMs?: number;
|
|
12
12
|
readonly attempts?: number;
|
|
13
13
|
readonly inFlight?: number;
|
|
14
14
|
};
|
|
@@ -20,5 +20,6 @@ export type Recovery = {
|
|
|
20
20
|
scope(inFlight?: number): Recovery;
|
|
21
21
|
retire(): Promise<void>;
|
|
22
22
|
};
|
|
23
|
-
export declare function retryDelay(tries: number, firstMs?: number,
|
|
23
|
+
export declare function retryDelay(tries: number, firstMs?: number, maxMs?: number): number;
|
|
24
|
+
export declare function untilAnswered<T>(ask: () => Promise<T>, signal: AbortSignal, answered?: (answer: T) => boolean): Promise<T>;
|
|
24
25
|
export declare function createRecovery(options?: RecoveryOptions): Recovery;
|
|
@@ -1,45 +1,67 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BootstrapInventory, MutationResult, OperationScopes, ReplicaAdmission, TypedSelection } from './adapter.js';
|
|
2
|
+
import { type ChangeBatch, type Precondition } from './change.js';
|
|
2
3
|
import { type Collection, type Composition } from './collection.js';
|
|
4
|
+
import { type ModelState } from './model.js';
|
|
3
5
|
import { type Layer } from './overlay.js';
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import type { HeldEntry, OverlayEntry, StoredEntry } from './tables.js';
|
|
7
|
+
export type ReplicaRecord = {
|
|
8
|
+
readonly locator: string;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly handle: string;
|
|
11
|
+
readonly operations: OperationScopes;
|
|
12
|
+
readonly replica: ReplicaAdmission;
|
|
13
|
+
readonly model: ModelState;
|
|
14
|
+
readonly typedSelection: TypedSelection | null;
|
|
15
|
+
readonly providerOwnedPaths: readonly string[];
|
|
16
|
+
readonly roomVersion: string;
|
|
17
|
+
readonly transfer: string;
|
|
18
|
+
readonly inventory: BootstrapInventory;
|
|
19
|
+
readonly key: number;
|
|
20
|
+
};
|
|
21
|
+
export type HeldReplica = {
|
|
22
|
+
readonly record: ReplicaRecord;
|
|
23
|
+
readonly queue: readonly ChangeBatch[];
|
|
24
|
+
readonly overlaid: ReadonlySet<string>;
|
|
25
|
+
readonly count: number;
|
|
26
|
+
readonly confirmed: number;
|
|
27
|
+
readonly indexed: boolean;
|
|
10
28
|
};
|
|
11
29
|
export type VisibleLayer = Layer & {
|
|
12
|
-
collection: Collection;
|
|
30
|
+
readonly collection: Collection;
|
|
13
31
|
};
|
|
14
|
-
export type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} | Refused;
|
|
18
|
-
export type Replica = {
|
|
19
|
-
confirmed: ConfirmedLayer;
|
|
20
|
-
queue: readonly ChangeBatch[];
|
|
21
|
-
visible: VisibleLayer;
|
|
22
|
-
replay: readonly ReplayStep[];
|
|
32
|
+
export type Slice = Layer & {
|
|
33
|
+
readonly written: Readonly<Record<string, string>>;
|
|
34
|
+
readonly held: ReadonlySet<string>;
|
|
23
35
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
export declare function compositionOf(record: Pick<ReplicaRecord, 'model' | 'typedSelection'>, builtIn: ModelState): Composition;
|
|
37
|
+
export declare function storedRecord(record: ReplicaRecord): string;
|
|
38
|
+
export declare function slicing(entries: readonly HeldEntry[], paths: Iterable<string>): Generator<number, Slice, void>;
|
|
39
|
+
export declare function entryAt(layer: Layer & {
|
|
40
|
+
readonly written?: Readonly<Record<string, string>>;
|
|
41
|
+
}, path: string): StoredEntry | null;
|
|
42
|
+
export declare function slicingWith(slice: Slice, set: readonly StoredEntry[], removed: readonly string[]): Generator<number, Slice, void>;
|
|
43
|
+
export declare function touchedBy(queue: readonly ChangeBatch[]): Set<string>;
|
|
44
|
+
export declare function movedBy(queue: readonly ChangeBatch[], locator: string): Set<string>;
|
|
45
|
+
export type Replayed = {
|
|
46
|
+
readonly visible: VisibleLayer;
|
|
47
|
+
readonly touched: ReadonlySet<string>;
|
|
30
48
|
};
|
|
31
|
-
export declare function
|
|
32
|
-
export declare function
|
|
33
|
-
export declare function
|
|
34
|
-
export declare function
|
|
35
|
-
export
|
|
36
|
-
|
|
49
|
+
export declare function replaying(confirmed: Slice, queue: readonly ChangeBatch[], locator: string, composition: Composition): Generator<number, Replayed, void>;
|
|
50
|
+
export declare function overlayOf(visible: Layer, touched: Iterable<string>): Generator<number, OverlayEntry[], void>;
|
|
51
|
+
export declare function holds(layer: Layer, preconditions: readonly Precondition[]): boolean;
|
|
52
|
+
export declare function landed(batch: ChangeBatch, confirmed: Layer, current?: Readonly<Record<string, string>>): boolean;
|
|
53
|
+
export type Standing = {
|
|
54
|
+
readonly withdrawn: readonly ChangeBatch[];
|
|
55
|
+
readonly kept: readonly ChangeBatch[];
|
|
37
56
|
};
|
|
57
|
+
export declare function standing(confirmed: Slice, queue: readonly ChangeBatch[], withdrawable: (batch: ChangeBatch) => boolean, local: boolean, locator: string, composition: Composition): Generator<number, Standing, void>;
|
|
38
58
|
type Accepted = Extract<MutationResult, {
|
|
39
59
|
kind: 'accepted';
|
|
40
60
|
}>;
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
61
|
+
export type Returned = {
|
|
62
|
+
readonly set: readonly StoredEntry[];
|
|
63
|
+
readonly removed: readonly string[];
|
|
64
|
+
};
|
|
65
|
+
export declare function returnedPaths(submitted: ChangeBatch, accepted: Accepted): Set<string>;
|
|
66
|
+
export declare function returning(confirmed: Slice, submitted: ChangeBatch, accepted: Accepted, writtenAt: string): Generator<number, Returned, void>;
|
|
45
67
|
export {};
|
|
@@ -32,6 +32,7 @@ export type RoomDraftParts = {
|
|
|
32
32
|
readonly creation?: RoomDraftCreation;
|
|
33
33
|
readonly move?: {
|
|
34
34
|
readonly to: string;
|
|
35
|
+
readonly room?: string;
|
|
35
36
|
readonly base?: string | null;
|
|
36
37
|
};
|
|
37
38
|
readonly removal?: {
|
|
@@ -39,11 +40,12 @@ export type RoomDraftParts = {
|
|
|
39
40
|
};
|
|
40
41
|
readonly file?: {
|
|
41
42
|
readonly blob: Blob;
|
|
43
|
+
readonly base?: string | null;
|
|
42
44
|
};
|
|
43
45
|
};
|
|
44
46
|
export type HeldFile = {
|
|
45
|
-
readonly blob: Blob;
|
|
46
47
|
readonly localId: string;
|
|
48
|
+
readonly name?: string;
|
|
47
49
|
readonly byteLength: number;
|
|
48
50
|
readonly mediaType: string;
|
|
49
51
|
readonly sha256: string;
|
|
@@ -69,6 +71,7 @@ type HeldParts = {
|
|
|
69
71
|
readonly creation?: RoomDraftCreation;
|
|
70
72
|
readonly move?: {
|
|
71
73
|
readonly to: string;
|
|
74
|
+
readonly room?: string;
|
|
72
75
|
readonly base: string | null;
|
|
73
76
|
};
|
|
74
77
|
readonly removal?: {
|
|
@@ -110,7 +113,7 @@ export type RoomDraftWrite = {
|
|
|
110
113
|
export declare function staleWrite(current: RoomDraft | null): RoomDraftWrite;
|
|
111
114
|
export type ChangedPart = {
|
|
112
115
|
readonly path: string;
|
|
113
|
-
readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | '
|
|
116
|
+
readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | 'move' | 'removal' | 'file'>;
|
|
114
117
|
readonly name?: string;
|
|
115
118
|
};
|
|
116
119
|
export type RoomDraftRecord = {
|
|
@@ -125,15 +128,42 @@ export type SavedDraft = {
|
|
|
125
128
|
readonly parts: HeldParts;
|
|
126
129
|
};
|
|
127
130
|
export declare function readParts(value: unknown): RoomDraftParts;
|
|
131
|
+
export declare function gatheredParts(earlier: unknown, later: unknown): unknown;
|
|
128
132
|
export declare function held(current: HeldParts | undefined, parts: RoomDraftParts, file?: HeldFile): HeldParts;
|
|
129
133
|
export declare function underneath(parts: HeldParts, path: string, visible: VisibleLayer | undefined): ChangedUnderneath;
|
|
130
134
|
export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
|
|
131
135
|
export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
|
|
132
|
-
export declare function changedParts(path: string,
|
|
136
|
+
export declare function changedParts(path: string, parts: HeldParts, visible: VisibleLayer | undefined): readonly ChangedPart[];
|
|
137
|
+
export type TextParts = {
|
|
138
|
+
readonly fields?: Readonly<Record<string, {
|
|
139
|
+
readonly value: unknown;
|
|
140
|
+
}>>;
|
|
141
|
+
readonly sections?: Readonly<Record<string, {
|
|
142
|
+
readonly value: string;
|
|
143
|
+
}>>;
|
|
144
|
+
readonly preamble?: {
|
|
145
|
+
readonly value: string;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
export declare function partsAfter(markdown: string, parts: TextParts): string;
|
|
133
149
|
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts): HeldParts;
|
|
134
150
|
export declare function moveTarget(move: {
|
|
135
151
|
readonly to: string;
|
|
136
152
|
}): string;
|
|
153
|
+
export declare function readSavedParts(named: readonly {
|
|
154
|
+
readonly path: string;
|
|
155
|
+
readonly parts: unknown;
|
|
156
|
+
}[]): readonly {
|
|
157
|
+
readonly path: string;
|
|
158
|
+
readonly parts: RoomDraftParts;
|
|
159
|
+
}[];
|
|
160
|
+
export declare function partsChanges(named: readonly {
|
|
161
|
+
readonly path: string;
|
|
162
|
+
readonly parts: unknown;
|
|
163
|
+
}[]): {
|
|
164
|
+
readonly changes: readonly Change[];
|
|
165
|
+
readonly preconditions: readonly Precondition[];
|
|
166
|
+
};
|
|
137
167
|
export declare function changesOf(path: string, parts: HeldParts): {
|
|
138
168
|
changes: readonly Change[];
|
|
139
169
|
bases: readonly Precondition[];
|
package/dist/mdruntime/save.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Validation } from '../mdmodel/index.js';
|
|
2
|
+
import type { OperationScopes, ProviderLimit } from './adapter.js';
|
|
2
3
|
import { type Change, type ChangeBatch, type Precondition, type WrittenBy } from './change.js';
|
|
3
4
|
import { type Composition } from './collection.js';
|
|
5
|
+
import { type Layer } from './overlay.js';
|
|
4
6
|
import type { VisibleLayer } from './replica.js';
|
|
5
7
|
import type { ChangedPart } from './room-draft.js';
|
|
6
8
|
export type SaveRefusal = {
|
|
@@ -19,25 +21,29 @@ export type SaveInput = {
|
|
|
19
21
|
providerOwnedPaths: readonly string[];
|
|
20
22
|
providerLimits: readonly ProviderLimit[];
|
|
21
23
|
visible: VisibleLayer;
|
|
24
|
+
folders: ReadonlySet<string>;
|
|
22
25
|
handle: string;
|
|
23
26
|
changes: readonly Change[];
|
|
24
27
|
bases: readonly Precondition[];
|
|
25
28
|
queued?: ReadonlySet<string>;
|
|
26
29
|
writtenBy?: WrittenBy;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
binaries: Readonly<Record<string, unknown>>;
|
|
30
|
-
composition: Composition;
|
|
31
|
-
};
|
|
30
|
+
unmodeled: boolean;
|
|
31
|
+
validate: Validator;
|
|
32
32
|
};
|
|
33
|
-
export type
|
|
34
|
-
|
|
35
|
-
batch: ChangeBatch;
|
|
36
|
-
} | {
|
|
33
|
+
export type Validator = (resulting: Layer, touched: readonly string[]) => Promise<Validation>;
|
|
34
|
+
type Refusing = {
|
|
37
35
|
kind: 'refused';
|
|
38
36
|
refusal: SaveRefusal;
|
|
39
37
|
};
|
|
40
|
-
export
|
|
38
|
+
export type BatchResult = {
|
|
39
|
+
kind: 'batch';
|
|
40
|
+
batch: ChangeBatch;
|
|
41
|
+
} | Refusing;
|
|
42
|
+
export declare function providerRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
43
|
+
export declare function leavingRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
44
|
+
export declare function rewriting(batch: ChangeBatch, locator: string): boolean;
|
|
45
|
+
export declare function effectiveIn(batch: ChangeBatch, locator: string, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
46
|
+
export declare function queuedDocuments(queue: readonly ChangeBatch[]): ReadonlySet<string>;
|
|
41
47
|
export type Requeued = {
|
|
42
48
|
kind: 'requeued';
|
|
43
49
|
queue: readonly ChangeBatch[];
|
|
@@ -57,7 +63,40 @@ export type Joining = {
|
|
|
57
63
|
kind: 'refused';
|
|
58
64
|
refusal: SaveRefusal;
|
|
59
65
|
};
|
|
60
|
-
|
|
66
|
+
type VisibleOver = (queue: readonly ChangeBatch[]) => Generator<number, VisibleLayer, void>;
|
|
67
|
+
export declare function requeuing(queue: readonly ChangeBatch[], changes: readonly Change[], visible: VisibleLayer, changeable: (batch: ChangeBatch) => boolean, state: VisibleOver): Generator<number, Requeued, void>;
|
|
61
68
|
export declare function joined(queue: readonly ChangeBatch[], owner: ChangeBatch, extra: ChangeBatch): Joining;
|
|
62
|
-
export declare function
|
|
63
|
-
export declare
|
|
69
|
+
export declare function limiting(queue: readonly ChangeBatch[], batch: ChangeBatch, limits: readonly ProviderLimit[], state: VisibleOver): Generator<number, SaveRefusal | null, void>;
|
|
70
|
+
export declare const MOVE_DOCUMENTS = "move-documents";
|
|
71
|
+
export type MoveSide = {
|
|
72
|
+
room: string;
|
|
73
|
+
handle: string;
|
|
74
|
+
baseRoomVersion: string;
|
|
75
|
+
composition: Composition;
|
|
76
|
+
operations: OperationScopes;
|
|
77
|
+
providerOwnedPaths: readonly string[];
|
|
78
|
+
visible: VisibleLayer;
|
|
79
|
+
folders: ReadonlySet<string>;
|
|
80
|
+
queued: ReadonlySet<string>;
|
|
81
|
+
unmodeled: boolean;
|
|
82
|
+
validate: Validator;
|
|
83
|
+
};
|
|
84
|
+
export type MoveInput = {
|
|
85
|
+
source: MoveSide;
|
|
86
|
+
destination: MoveSide;
|
|
87
|
+
moves: readonly {
|
|
88
|
+
readonly path: string;
|
|
89
|
+
readonly to: string;
|
|
90
|
+
}[];
|
|
91
|
+
providerLimits: readonly ProviderLimit[];
|
|
92
|
+
local: boolean;
|
|
93
|
+
writtenBy?: WrittenBy;
|
|
94
|
+
};
|
|
95
|
+
export type MoveResult = {
|
|
96
|
+
kind: 'moved';
|
|
97
|
+
leaving: ChangeBatch;
|
|
98
|
+
arriving: ChangeBatch;
|
|
99
|
+
} | Refusing;
|
|
100
|
+
export declare function buildMove(input: MoveInput): Promise<MoveResult>;
|
|
101
|
+
export declare function buildBatch(input: SaveInput): Promise<BatchResult>;
|
|
102
|
+
export {};
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ProviderRefusal } from './adapter.js';
|
|
2
2
|
import { type CoveredRoom, type Filter, type PendingRoom } from './query.js';
|
|
3
3
|
import type { Open } from './open.js';
|
|
4
4
|
export type DocumentPart = Open<'fields' | 'sections' | 'preamble' | 'path'>;
|
|
5
5
|
export type SearchRequest = {
|
|
6
6
|
text: string;
|
|
7
7
|
documents?: Filter;
|
|
8
|
+
collection?: true;
|
|
8
9
|
conversations?: readonly string[];
|
|
9
10
|
limit?: number;
|
|
11
|
+
after?: string;
|
|
12
|
+
total?: true;
|
|
13
|
+
};
|
|
14
|
+
export type MessagePart = Open<'text'>;
|
|
15
|
+
export type Snippet<Part extends string> = {
|
|
16
|
+
part: Part;
|
|
17
|
+
text: string;
|
|
18
|
+
at: readonly [number, number];
|
|
10
19
|
};
|
|
11
20
|
export type DocumentHit = {
|
|
12
21
|
room: string;
|
|
@@ -14,70 +23,50 @@ export type DocumentHit = {
|
|
|
14
23
|
type: string;
|
|
15
24
|
score: number;
|
|
16
25
|
matches: Readonly<Record<string, readonly DocumentPart[]>>;
|
|
26
|
+
snippet?: Snippet<DocumentPart>;
|
|
17
27
|
};
|
|
18
28
|
export type MessageHit = {
|
|
19
29
|
conversation: string;
|
|
20
30
|
identity: string;
|
|
21
31
|
score: number;
|
|
22
|
-
matches: Readonly<Record<string, readonly
|
|
32
|
+
matches: Readonly<Record<string, readonly MessagePart[]>>;
|
|
33
|
+
snippet?: Snippet<MessagePart>;
|
|
23
34
|
};
|
|
24
35
|
export type SearchCoverage = {
|
|
25
36
|
rooms: readonly CoveredRoom[];
|
|
26
37
|
conversations: readonly string[];
|
|
27
|
-
index: string;
|
|
28
38
|
overlay: readonly string[];
|
|
29
39
|
};
|
|
30
|
-
export type PendingConversation = {
|
|
31
|
-
conversation: string;
|
|
32
|
-
awaits: Open<'index'>;
|
|
33
|
-
};
|
|
34
|
-
export type SearchPending = {
|
|
35
|
-
pending: readonly (PendingRoom | PendingConversation)[];
|
|
36
|
-
};
|
|
37
40
|
export type SearchHits = {
|
|
38
41
|
documents: readonly DocumentHit[];
|
|
39
42
|
messages: readonly MessageHit[];
|
|
40
43
|
};
|
|
41
|
-
export type
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
type: string;
|
|
48
|
-
fields: Readonly<Record<string, unknown>>;
|
|
49
|
-
preamble: string;
|
|
50
|
-
sections: Readonly<Record<string, string>>;
|
|
44
|
+
export type SearchWindow = SearchHits & {
|
|
45
|
+
next?: string;
|
|
46
|
+
total?: {
|
|
47
|
+
documents: number;
|
|
48
|
+
messages: number;
|
|
49
|
+
};
|
|
51
50
|
};
|
|
52
|
-
export type
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
text: string;
|
|
51
|
+
export type SearchPending = SearchHits & {
|
|
52
|
+
pending: readonly PendingRoom[];
|
|
53
|
+
coverage: SearchCoverage;
|
|
56
54
|
};
|
|
57
|
-
export type
|
|
58
|
-
|
|
59
|
-
document(room: string, path: string): SearchedDocument | null;
|
|
55
|
+
export type SearchUndeclared = ProviderRefusal & {
|
|
56
|
+
kind: 'undeclared';
|
|
60
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;
|
|
61
63
|
export type SearchPlan = {
|
|
62
64
|
text: string;
|
|
63
65
|
documents: unknown;
|
|
66
|
+
collection: boolean;
|
|
64
67
|
conversations: readonly string[] | null;
|
|
65
68
|
limit: number | null;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
generation(): string;
|
|
69
|
-
rooms(): ReadonlySet<string>;
|
|
70
|
-
conversations(): ReadonlySet<string>;
|
|
71
|
-
indexRoom(room: string): Promise<void>;
|
|
72
|
-
indexMessages(conversation: string, messages: readonly SearchedMessage[], whole: boolean): void;
|
|
73
|
-
forget(rooms: readonly string[]): void;
|
|
74
|
-
changed(set: ChangeSet): void;
|
|
75
|
-
changes(): number;
|
|
76
|
-
caughtUp(): Promise<void>;
|
|
77
|
-
search(plan: SearchPlan, documents: readonly {
|
|
78
|
-
room: string;
|
|
79
|
-
path: string;
|
|
80
|
-
}[] | null, conversations: readonly string[]): SearchHits;
|
|
69
|
+
after: readonly [HitCursor, HitCursor] | null;
|
|
70
|
+
total: boolean;
|
|
81
71
|
};
|
|
82
72
|
export declare function searchPlanOf(input: unknown): SearchPlan;
|
|
83
|
-
export declare function createSearchIndex(source: SearchSource): SearchIndex;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { KeyedResult } from './observation.js';
|
|
2
|
+
import type { QueryRows } from './query.js';
|
|
3
|
+
export type EntrySeed = {
|
|
4
|
+
readonly at: Readonly<Record<string, string>>;
|
|
5
|
+
readonly queries: readonly {
|
|
6
|
+
readonly query: unknown;
|
|
7
|
+
readonly rows: QueryRows;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
export type Seeded = {
|
|
11
|
+
readonly rows: QueryRows;
|
|
12
|
+
readonly at: Readonly<Record<string, string>>;
|
|
13
|
+
};
|
|
14
|
+
export declare function entrySeedOf(value: unknown): EntrySeed | null;
|
|
15
|
+
export declare function seededResult(seed: Seeded): KeyedResult;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import type { Open } from './open.js';
|
|
2
|
-
import type { ProviderRefusal } from './adapter.js';
|
|
3
2
|
import type { ReturnReason } from './room-draft.js';
|
|
4
3
|
export type AttentionEntry = {
|
|
5
4
|
room: string;
|
|
6
5
|
path: string;
|
|
7
6
|
returned: ReturnReason;
|
|
8
|
-
}
|
|
7
|
+
};
|
|
8
|
+
export type UnsentChange = {
|
|
9
9
|
room: string;
|
|
10
|
-
|
|
10
|
+
path: string;
|
|
11
11
|
};
|
|
12
12
|
export type SyncStatus = {
|
|
13
13
|
state: Open<'pending' | 'syncing' | 'synced'>;
|
|
14
14
|
lastCompleted: string | null;
|
|
15
15
|
providerUnreachable: boolean;
|
|
16
16
|
attentionRequired: readonly AttentionEntry[];
|
|
17
|
+
unsent: readonly UnsentChange[];
|
|
17
18
|
reset: string | null;
|
|
18
19
|
};
|
|
19
20
|
export type CycleProgress = {
|