@agentshouse/app-bridge 0.1.0-ccf413b4e709d → 0.1.0-cd6b14842b26e
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 +4 -2
- package/dist/calls.d.ts +1011 -0
- package/dist/calls.js +1 -0
- package/dist/index.d.ts +34 -4
- package/dist/mdmodel/blocks.d.ts +10 -0
- package/dist/mdmodel/condition.d.ts +160 -0
- package/dist/mdmodel/definition.d.ts +81 -0
- package/dist/mdmodel/divide.d.ts +2 -0
- package/dist/mdmodel/document.d.ts +15 -0
- package/dist/mdmodel/fields.d.ts +5 -0
- package/dist/mdmodel/index.d.ts +20 -0
- package/dist/mdmodel/links.d.ts +28 -0
- package/dist/mdmodel/paths.d.ts +25 -0
- package/dist/mdmodel/profile.d.ts +5 -0
- package/dist/mdmodel/project.d.ts +21 -0
- package/dist/mdmodel/references.d.ts +3 -0
- package/dist/mdmodel/types.d.ts +166 -0
- package/dist/mdmodel/validate.d.ts +31 -0
- package/dist/mdmodel/version.d.ts +1 -0
- package/dist/mdmodel/yaml.d.ts +55 -0
- package/dist/mdruntime/adapter.d.ts +513 -0
- package/dist/mdruntime/binary.d.ts +17 -0
- package/dist/mdruntime/chain.d.ts +10 -0
- package/dist/mdruntime/change-set.d.ts +27 -0
- package/dist/mdruntime/change.d.ts +118 -0
- package/dist/mdruntime/client.d.ts +89 -0
- package/dist/mdruntime/collection.d.ts +25 -0
- package/dist/mdruntime/compile.d.ts +15 -0
- package/dist/mdruntime/connection.d.ts +151 -0
- package/dist/mdruntime/conversation.d.ts +118 -0
- package/dist/mdruntime/durability.d.ts +12 -0
- package/dist/mdruntime/failure.d.ts +12 -0
- package/dist/mdruntime/file.d.ts +11 -0
- package/dist/mdruntime/fulltext.d.ts +26 -0
- package/dist/mdruntime/messages.d.ts +27 -0
- package/dist/mdruntime/model.d.ts +57 -0
- package/dist/mdruntime/observation.d.ts +43 -0
- package/dist/mdruntime/open.d.ts +1 -0
- package/dist/mdruntime/opened.d.ts +21 -0
- package/dist/mdruntime/outcome.d.ts +76 -0
- package/dist/mdruntime/overlay.d.ts +24 -0
- package/dist/mdruntime/query.d.ts +277 -0
- package/dist/mdruntime/reach.d.ts +46 -0
- package/dist/mdruntime/readiness.d.ts +62 -0
- package/dist/mdruntime/recovery.d.ts +24 -0
- package/dist/mdruntime/replica.d.ts +69 -0
- package/dist/mdruntime/room-draft.d.ts +157 -0
- package/dist/mdruntime/save.d.ts +100 -0
- package/dist/mdruntime/search.d.ts +72 -0
- package/dist/mdruntime/seed.d.ts +15 -0
- package/dist/mdruntime/shared.d.ts +15 -0
- package/dist/mdruntime/status.d.ts +26 -0
- package/dist/mdruntime/store.d.ts +169 -0
- package/dist/mdruntime/stored.d.ts +144 -0
- package/dist/mdruntime/tables.d.ts +343 -0
- package/dist/mdruntime/transfer.d.ts +9 -0
- package/dist/mdruntime/wire.d.ts +234 -0
- package/dist/test-host.d.ts +5 -2
- package/dist/test-host.js +57 -11
- package/docs/families.md +51 -9
- package/package.json +1 -4
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { ProviderRefusal } from './adapter.js';
|
|
2
|
+
import type { Open } from './open.js';
|
|
3
|
+
import type { Change, Precondition } from './change.js';
|
|
4
|
+
import type { VisibleLayer } from './replica.js';
|
|
5
|
+
export type FieldValue = {
|
|
6
|
+
readonly value: unknown;
|
|
7
|
+
} | null;
|
|
8
|
+
export type RoomDraftCreation = {
|
|
9
|
+
readonly type: string;
|
|
10
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
11
|
+
readonly sections: Readonly<Record<string, string>>;
|
|
12
|
+
} | {
|
|
13
|
+
readonly markdown: string;
|
|
14
|
+
};
|
|
15
|
+
export type RoomDraftParts = {
|
|
16
|
+
readonly fields?: Readonly<Record<string, {
|
|
17
|
+
readonly value: unknown;
|
|
18
|
+
readonly base?: FieldValue;
|
|
19
|
+
}>>;
|
|
20
|
+
readonly sections?: Readonly<Record<string, {
|
|
21
|
+
readonly value: string;
|
|
22
|
+
readonly base?: string;
|
|
23
|
+
}>>;
|
|
24
|
+
readonly preamble?: {
|
|
25
|
+
readonly value: string;
|
|
26
|
+
readonly base?: string;
|
|
27
|
+
};
|
|
28
|
+
readonly markdown?: {
|
|
29
|
+
readonly value: string;
|
|
30
|
+
readonly base?: string;
|
|
31
|
+
};
|
|
32
|
+
readonly creation?: RoomDraftCreation;
|
|
33
|
+
readonly move?: {
|
|
34
|
+
readonly to: string;
|
|
35
|
+
readonly room?: string;
|
|
36
|
+
readonly base?: string | null;
|
|
37
|
+
};
|
|
38
|
+
readonly removal?: {
|
|
39
|
+
readonly base?: string | null;
|
|
40
|
+
};
|
|
41
|
+
readonly file?: {
|
|
42
|
+
readonly blob: Blob;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export type HeldFile = {
|
|
46
|
+
readonly localId: string;
|
|
47
|
+
readonly name?: string;
|
|
48
|
+
readonly byteLength: number;
|
|
49
|
+
readonly mediaType: string;
|
|
50
|
+
readonly sha256: string;
|
|
51
|
+
readonly base: string | null;
|
|
52
|
+
};
|
|
53
|
+
type HeldParts = {
|
|
54
|
+
readonly fields?: Readonly<Record<string, {
|
|
55
|
+
readonly value: unknown;
|
|
56
|
+
readonly base: FieldValue;
|
|
57
|
+
}>>;
|
|
58
|
+
readonly sections?: Readonly<Record<string, {
|
|
59
|
+
readonly value: string;
|
|
60
|
+
readonly base: string;
|
|
61
|
+
}>>;
|
|
62
|
+
readonly preamble?: {
|
|
63
|
+
readonly value: string;
|
|
64
|
+
readonly base: string;
|
|
65
|
+
};
|
|
66
|
+
readonly markdown?: {
|
|
67
|
+
readonly value: string;
|
|
68
|
+
readonly base: string;
|
|
69
|
+
};
|
|
70
|
+
readonly creation?: RoomDraftCreation;
|
|
71
|
+
readonly move?: {
|
|
72
|
+
readonly to: string;
|
|
73
|
+
readonly room?: string;
|
|
74
|
+
readonly base: string | null;
|
|
75
|
+
};
|
|
76
|
+
readonly removal?: {
|
|
77
|
+
readonly base: string | null;
|
|
78
|
+
};
|
|
79
|
+
readonly file?: HeldFile;
|
|
80
|
+
};
|
|
81
|
+
type ChangedUnderneath = {
|
|
82
|
+
readonly fields?: Readonly<Record<string, FieldValue>>;
|
|
83
|
+
readonly sections?: Readonly<Record<string, string | null>>;
|
|
84
|
+
readonly preamble?: string | null;
|
|
85
|
+
readonly markdown?: string | null;
|
|
86
|
+
readonly creation?: string;
|
|
87
|
+
readonly move?: string | null;
|
|
88
|
+
readonly removal?: string | null;
|
|
89
|
+
readonly file?: string | null;
|
|
90
|
+
};
|
|
91
|
+
export type ReturnReason = ProviderRefusal & {
|
|
92
|
+
readonly kind: Open<'conflicted' | 'rejected' | 'expired' | 'withdrawn'>;
|
|
93
|
+
};
|
|
94
|
+
export declare function returnedBy(kind: 'expired' | 'withdrawn'): ReturnReason;
|
|
95
|
+
export type RoomDraft = {
|
|
96
|
+
readonly room: string;
|
|
97
|
+
readonly path: string;
|
|
98
|
+
readonly revision: string;
|
|
99
|
+
readonly parts: HeldParts;
|
|
100
|
+
readonly changedUnderneath: ChangedUnderneath;
|
|
101
|
+
readonly returned: ReturnReason | null;
|
|
102
|
+
};
|
|
103
|
+
export type RoomDraftWrite = {
|
|
104
|
+
readonly outcome: 'written';
|
|
105
|
+
readonly roomDraft: RoomDraft | null;
|
|
106
|
+
} | {
|
|
107
|
+
readonly outcome: 'stale';
|
|
108
|
+
readonly code: string;
|
|
109
|
+
readonly retryable: boolean;
|
|
110
|
+
readonly current: RoomDraft | null;
|
|
111
|
+
};
|
|
112
|
+
export declare function staleWrite(current: RoomDraft | null): RoomDraftWrite;
|
|
113
|
+
export type ChangedPart = {
|
|
114
|
+
readonly path: string;
|
|
115
|
+
readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | 'creation' | 'move' | 'removal' | 'file'>;
|
|
116
|
+
readonly name?: string;
|
|
117
|
+
};
|
|
118
|
+
export type RoomDraftRecord = {
|
|
119
|
+
readonly locator: string;
|
|
120
|
+
readonly path: string;
|
|
121
|
+
readonly revision: string;
|
|
122
|
+
readonly parts: HeldParts;
|
|
123
|
+
readonly returned: ReturnReason | null;
|
|
124
|
+
};
|
|
125
|
+
export type SavedDraft = {
|
|
126
|
+
readonly path: string;
|
|
127
|
+
readonly parts: HeldParts;
|
|
128
|
+
};
|
|
129
|
+
export declare function readParts(value: unknown): RoomDraftParts;
|
|
130
|
+
export declare function held(current: HeldParts | undefined, parts: RoomDraftParts, file?: HeldFile): HeldParts;
|
|
131
|
+
export declare function underneath(parts: HeldParts, path: string, visible: VisibleLayer | undefined): ChangedUnderneath;
|
|
132
|
+
export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
|
|
133
|
+
export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
|
|
134
|
+
export declare function changedParts(path: string, report: ChangedUnderneath): readonly ChangedPart[];
|
|
135
|
+
export type TextParts = {
|
|
136
|
+
readonly fields?: Readonly<Record<string, {
|
|
137
|
+
readonly value: unknown;
|
|
138
|
+
}>>;
|
|
139
|
+
readonly sections?: Readonly<Record<string, {
|
|
140
|
+
readonly value: string;
|
|
141
|
+
}>>;
|
|
142
|
+
readonly preamble?: {
|
|
143
|
+
readonly value: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
export declare function partsAfter(markdown: string, parts: TextParts): string;
|
|
147
|
+
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts): HeldParts;
|
|
148
|
+
export declare function moveTarget(move: {
|
|
149
|
+
readonly to: string;
|
|
150
|
+
}): string;
|
|
151
|
+
export declare function changesOf(path: string, parts: HeldParts): {
|
|
152
|
+
changes: readonly Change[];
|
|
153
|
+
bases: readonly Precondition[];
|
|
154
|
+
};
|
|
155
|
+
export declare function joinedDraft(carried: SavedDraft, saved: readonly SavedDraft[]): SavedDraft;
|
|
156
|
+
export declare function withdrawnDrafts(drafts: readonly SavedDraft[], changes: readonly Change[]): readonly SavedDraft[];
|
|
157
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type Validation } from '../mdmodel/index.js';
|
|
2
|
+
import type { OperationScopes, ProviderLimit } from './adapter.js';
|
|
3
|
+
import { type Change, type ChangeBatch, type Precondition, type WrittenBy } from './change.js';
|
|
4
|
+
import { type Composition } from './collection.js';
|
|
5
|
+
import { type Layer } from './overlay.js';
|
|
6
|
+
import type { VisibleLayer } from './replica.js';
|
|
7
|
+
import type { ChangedPart } from './room-draft.js';
|
|
8
|
+
export type SaveRefusal = {
|
|
9
|
+
code: string;
|
|
10
|
+
retryable: boolean;
|
|
11
|
+
file?: string;
|
|
12
|
+
location?: string;
|
|
13
|
+
referrers?: readonly string[];
|
|
14
|
+
parts?: readonly ChangedPart[];
|
|
15
|
+
};
|
|
16
|
+
export type SaveInput = {
|
|
17
|
+
local: boolean;
|
|
18
|
+
composition: Composition;
|
|
19
|
+
baseRoomVersion: string;
|
|
20
|
+
operations: import('./adapter.js').OperationScopes;
|
|
21
|
+
providerOwnedPaths: readonly string[];
|
|
22
|
+
providerLimits: readonly ProviderLimit[];
|
|
23
|
+
visible: VisibleLayer;
|
|
24
|
+
handle: string;
|
|
25
|
+
changes: readonly Change[];
|
|
26
|
+
bases: readonly Precondition[];
|
|
27
|
+
queued?: ReadonlySet<string>;
|
|
28
|
+
writtenBy?: WrittenBy;
|
|
29
|
+
unmodeled: boolean;
|
|
30
|
+
validate: Validator;
|
|
31
|
+
};
|
|
32
|
+
export type Validator = (resulting: Layer, touched: readonly string[]) => Promise<Validation>;
|
|
33
|
+
type Refusing = {
|
|
34
|
+
kind: 'refused';
|
|
35
|
+
refusal: SaveRefusal;
|
|
36
|
+
};
|
|
37
|
+
export type BatchResult = {
|
|
38
|
+
kind: 'batch';
|
|
39
|
+
batch: ChangeBatch;
|
|
40
|
+
} | Refusing;
|
|
41
|
+
export declare function providerRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
42
|
+
export declare function leavingRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
43
|
+
export declare function rewriting(batch: ChangeBatch, locator: string): boolean;
|
|
44
|
+
export declare function effectiveIn(batch: ChangeBatch, locator: string, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
45
|
+
export declare function queuedDocuments(queue: readonly ChangeBatch[]): ReadonlySet<string>;
|
|
46
|
+
export type Requeued = {
|
|
47
|
+
kind: 'requeued';
|
|
48
|
+
queue: readonly ChangeBatch[];
|
|
49
|
+
changes: readonly Change[];
|
|
50
|
+
queued: ReadonlySet<string>;
|
|
51
|
+
withdrawn: ReadonlyMap<string, ChangeBatch | null>;
|
|
52
|
+
owners: ReadonlySet<string>;
|
|
53
|
+
} | {
|
|
54
|
+
kind: 'refused';
|
|
55
|
+
refusal: SaveRefusal;
|
|
56
|
+
};
|
|
57
|
+
export type Joining = {
|
|
58
|
+
kind: 'joined';
|
|
59
|
+
batch: ChangeBatch;
|
|
60
|
+
queue: readonly ChangeBatch[];
|
|
61
|
+
} | {
|
|
62
|
+
kind: 'refused';
|
|
63
|
+
refusal: SaveRefusal;
|
|
64
|
+
};
|
|
65
|
+
type VisibleOver = (queue: readonly ChangeBatch[]) => Generator<number, VisibleLayer, void>;
|
|
66
|
+
export declare function requeuing(queue: readonly ChangeBatch[], changes: readonly Change[], visible: VisibleLayer, changeable: (batch: ChangeBatch) => boolean, state: VisibleOver): Generator<number, Requeued, void>;
|
|
67
|
+
export declare function joined(queue: readonly ChangeBatch[], owner: ChangeBatch, extra: ChangeBatch): Joining;
|
|
68
|
+
export declare function limiting(queue: readonly ChangeBatch[], batch: ChangeBatch, limits: readonly ProviderLimit[], state: VisibleOver): Generator<number, SaveRefusal | null, void>;
|
|
69
|
+
export declare const MOVE_DOCUMENTS = "move-documents";
|
|
70
|
+
export type MoveSide = {
|
|
71
|
+
room: string;
|
|
72
|
+
handle: string;
|
|
73
|
+
baseRoomVersion: string;
|
|
74
|
+
composition: Composition;
|
|
75
|
+
operations: OperationScopes;
|
|
76
|
+
providerOwnedPaths: readonly string[];
|
|
77
|
+
visible: VisibleLayer;
|
|
78
|
+
queued: ReadonlySet<string>;
|
|
79
|
+
unmodeled: boolean;
|
|
80
|
+
validate: Validator;
|
|
81
|
+
};
|
|
82
|
+
export type MoveInput = {
|
|
83
|
+
source: MoveSide;
|
|
84
|
+
destination: MoveSide;
|
|
85
|
+
moves: readonly {
|
|
86
|
+
readonly path: string;
|
|
87
|
+
readonly to: string;
|
|
88
|
+
}[];
|
|
89
|
+
providerLimits: readonly ProviderLimit[];
|
|
90
|
+
local: boolean;
|
|
91
|
+
writtenBy?: WrittenBy;
|
|
92
|
+
};
|
|
93
|
+
export type MoveResult = {
|
|
94
|
+
kind: 'moved';
|
|
95
|
+
leaving: ChangeBatch;
|
|
96
|
+
arriving: ChangeBatch;
|
|
97
|
+
} | Refusing;
|
|
98
|
+
export declare function buildMove(input: MoveInput): Promise<MoveResult>;
|
|
99
|
+
export declare function buildBatch(input: SaveInput): Promise<BatchResult>;
|
|
100
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
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'>;
|
|
5
|
+
export type SearchRequest = {
|
|
6
|
+
text: string;
|
|
7
|
+
documents?: Filter;
|
|
8
|
+
collection?: true;
|
|
9
|
+
conversations?: readonly string[];
|
|
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];
|
|
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[];
|
|
39
|
+
};
|
|
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 & {
|
|
56
|
+
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;
|
|
63
|
+
export type SearchPlan = {
|
|
64
|
+
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;
|
|
71
|
+
};
|
|
72
|
+
export declare function searchPlanOf(input: unknown): SearchPlan;
|
|
@@ -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;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type Paths<V> = Readonly<Record<string, V>>;
|
|
2
|
+
export declare function entriesIn<V>(map: Paths<V>): Generator<readonly [string, V]>;
|
|
3
|
+
export declare function keysIn(...maps: readonly Paths<unknown>[]): Generator<number, Set<string>, void>;
|
|
4
|
+
export declare function sortedKeys(map: Paths<unknown>): Generator<number, readonly string[], void>;
|
|
5
|
+
export declare function sorting(keys: Iterable<string>): Generator<number, readonly string[], void>;
|
|
6
|
+
export declare function sharing<V>(map: Paths<V>): Generator<number, Paths<V>, void>;
|
|
7
|
+
export declare function shared<V>(map: Paths<V>): Paths<V>;
|
|
8
|
+
export declare function patched<V>(base: Paths<V>, set: Iterable<readonly [string, V]>, removed?: Iterable<string>): Paths<V>;
|
|
9
|
+
export declare function patching<V>(base: Paths<V>, set: Iterable<readonly [string, V]>, removed?: Iterable<string>): Generator<number, Paths<V>, void>;
|
|
10
|
+
export declare function sizeOf<V>(map: Paths<V>): number;
|
|
11
|
+
export declare function differences<V>(left: Paths<V>, right: Paths<V>, same?: (left: V, right: V) => boolean): Generator<number, ReadonlySet<string>, void>;
|
|
12
|
+
export declare function differing<V>(left: Paths<V>, right: Paths<V>, same?: (left: V, right: V) => boolean): ReadonlySet<string>;
|
|
13
|
+
export declare function drafted<V>(base: Paths<V>): Record<string, V>;
|
|
14
|
+
export declare function settled<V>(draft: Record<string, V>): Paths<V>;
|
|
15
|
+
export declare function settling<V>(draft: Record<string, V>): Generator<number, Paths<V>, void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Open } from './open.js';
|
|
2
|
+
import type { ProviderRefusal } from './adapter.js';
|
|
3
|
+
import type { ReturnReason } from './room-draft.js';
|
|
4
|
+
export type AttentionEntry = {
|
|
5
|
+
room: string;
|
|
6
|
+
path: string;
|
|
7
|
+
returned: ReturnReason;
|
|
8
|
+
} | {
|
|
9
|
+
room: string;
|
|
10
|
+
refusal: ProviderRefusal;
|
|
11
|
+
};
|
|
12
|
+
export type SyncStatus = {
|
|
13
|
+
state: Open<'pending' | 'syncing' | 'synced'>;
|
|
14
|
+
lastCompleted: string | null;
|
|
15
|
+
providerUnreachable: boolean;
|
|
16
|
+
attentionRequired: readonly AttentionEntry[];
|
|
17
|
+
reset: string | null;
|
|
18
|
+
};
|
|
19
|
+
export type CycleProgress = {
|
|
20
|
+
complete: boolean;
|
|
21
|
+
reachable: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare const STARTING: SyncStatus;
|
|
24
|
+
export declare function transferring(status: SyncStatus): SyncStatus;
|
|
25
|
+
export declare function saving(status: SyncStatus): SyncStatus;
|
|
26
|
+
export declare function same(one: SyncStatus, other: SyncStatus): boolean;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { BootstrapInventory, Capability, KeptReceipt, Member, ProviderLimit } from './adapter.js';
|
|
2
|
+
import type { ChangeBatch } from './change.js';
|
|
3
|
+
import type { Composition } from './collection.js';
|
|
4
|
+
import type { Plan } from './query.js';
|
|
5
|
+
import type { ReplicaRecord } from './replica.js';
|
|
6
|
+
import type { Submission } from './outcome.js';
|
|
7
|
+
import type { RoomDraftRecord, SavedDraft } from './room-draft.js';
|
|
8
|
+
import type { ModelState } 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, Walked } from './tables.js';
|
|
11
|
+
export type { ConversationWrite, HeldConversation, MessageWindow } from './tables.js';
|
|
12
|
+
export type TransferWriting = {
|
|
13
|
+
readonly token: string | null;
|
|
14
|
+
readonly written: number;
|
|
15
|
+
};
|
|
16
|
+
export type TransferRecord = {
|
|
17
|
+
readonly locator: string;
|
|
18
|
+
readonly transfer: string;
|
|
19
|
+
readonly selection: string;
|
|
20
|
+
readonly from: string;
|
|
21
|
+
readonly last: string;
|
|
22
|
+
readonly pageToken: string | null;
|
|
23
|
+
readonly writing: TransferWriting | null;
|
|
24
|
+
readonly inventory: BootstrapInventory | null;
|
|
25
|
+
readonly done: BootstrapInventory;
|
|
26
|
+
readonly models: {
|
|
27
|
+
readonly collection: ModelState;
|
|
28
|
+
readonly selection: ModelState;
|
|
29
|
+
};
|
|
30
|
+
readonly key: number | null;
|
|
31
|
+
};
|
|
32
|
+
export type PendingState = {
|
|
33
|
+
readonly drafts: readonly SavedDraft[];
|
|
34
|
+
readonly submission: Submission;
|
|
35
|
+
readonly lost: boolean;
|
|
36
|
+
readonly upload?: unknown;
|
|
37
|
+
readonly accepted?: string;
|
|
38
|
+
};
|
|
39
|
+
export type TargetRecord = {
|
|
40
|
+
established: boolean;
|
|
41
|
+
};
|
|
42
|
+
export type QueueRecord = {
|
|
43
|
+
locator: string;
|
|
44
|
+
pending: readonly {
|
|
45
|
+
batch: ChangeBatch;
|
|
46
|
+
state: PendingState;
|
|
47
|
+
}[];
|
|
48
|
+
};
|
|
49
|
+
export type PresentationRecord = {
|
|
50
|
+
app: string;
|
|
51
|
+
value: unknown;
|
|
52
|
+
};
|
|
53
|
+
export type ChatSubmission = {
|
|
54
|
+
readonly operation: string;
|
|
55
|
+
readonly text: string;
|
|
56
|
+
readonly turn: string | null;
|
|
57
|
+
};
|
|
58
|
+
export type ChatDraftRecord = {
|
|
59
|
+
conversation: string;
|
|
60
|
+
text: string;
|
|
61
|
+
revision: string;
|
|
62
|
+
submitted?: readonly ChatSubmission[];
|
|
63
|
+
moves?: readonly string[];
|
|
64
|
+
};
|
|
65
|
+
export type CallRecord = {
|
|
66
|
+
readonly operation: string;
|
|
67
|
+
readonly name: string;
|
|
68
|
+
readonly input: unknown;
|
|
69
|
+
};
|
|
70
|
+
export type AuthoredWrite = {
|
|
71
|
+
locator: string;
|
|
72
|
+
queue?: readonly ChangeBatch[];
|
|
73
|
+
founded?: readonly ChangeBatch[];
|
|
74
|
+
saved?: ReadonlyMap<string, readonly SavedDraft[]>;
|
|
75
|
+
roomDrafts?: readonly RoomDraftRecord[];
|
|
76
|
+
consumedRoomDrafts?: readonly string[];
|
|
77
|
+
accepted?: readonly {
|
|
78
|
+
readonly id: string;
|
|
79
|
+
readonly roomVersion: string;
|
|
80
|
+
}[];
|
|
81
|
+
};
|
|
82
|
+
export type StagedPage = {
|
|
83
|
+
readonly entries: readonly StoredEntry[];
|
|
84
|
+
readonly folders: readonly string[];
|
|
85
|
+
};
|
|
86
|
+
export type RefreshedPage = StagedPage & {
|
|
87
|
+
readonly removals: readonly string[];
|
|
88
|
+
readonly folderRemovals: readonly string[];
|
|
89
|
+
};
|
|
90
|
+
export type Opened = {
|
|
91
|
+
readonly rooms: ReadonlyMap<string, ReplicaRecord>;
|
|
92
|
+
readonly transfers: ReadonlyMap<string, TransferRecord>;
|
|
93
|
+
readonly unindexed: ReadonlySet<number>;
|
|
94
|
+
readonly overlaid: ReadonlyMap<number, ReadonlySet<string>>;
|
|
95
|
+
readonly erasing: boolean;
|
|
96
|
+
readonly orphans: readonly number[];
|
|
97
|
+
readonly lastCompleted: string | null;
|
|
98
|
+
readonly providerLimits: readonly ProviderLimit[];
|
|
99
|
+
readonly capabilities: readonly Capability[];
|
|
100
|
+
readonly member: Member | null;
|
|
101
|
+
readonly targets: Readonly<Record<string, TargetRecord>>;
|
|
102
|
+
readonly presentation: readonly PresentationRecord[];
|
|
103
|
+
};
|
|
104
|
+
export type Commit = {
|
|
105
|
+
readonly rooms: readonly RoomCommit[];
|
|
106
|
+
readonly writes?: readonly AuthoredWrite[];
|
|
107
|
+
readonly files?: readonly StoredFile[];
|
|
108
|
+
readonly whole?: boolean;
|
|
109
|
+
readonly discards?: readonly string[];
|
|
110
|
+
};
|
|
111
|
+
export type RuntimeStore = {
|
|
112
|
+
opened(): Promise<Opened>;
|
|
113
|
+
counts(rooms: readonly CountedRoom[]): Promise<readonly number[]>;
|
|
114
|
+
query(plan: Plan, rooms: readonly QueryRoom[], budget: number | null): Promise<QueryAnswer>;
|
|
115
|
+
changes(keys: readonly number[]): number;
|
|
116
|
+
entries(key: number, view: View, paths: readonly string[]): Promise<readonly HeldEntry[]>;
|
|
117
|
+
typed(key: number, view: View, paths: readonly string[]): Promise<readonly TypedEntry[]>;
|
|
118
|
+
referrers(key: number, view: View, targets: readonly string[], kinds: readonly string[]): Promise<readonly Referrer[]>;
|
|
119
|
+
walk(key: number, view: View, after: string | null, bytes: number): Promise<Walked>;
|
|
120
|
+
files(key: number, view: View, after: string | null, limit: number): Promise<readonly {
|
|
121
|
+
readonly path: string;
|
|
122
|
+
readonly revision: string;
|
|
123
|
+
}[]>;
|
|
124
|
+
typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
|
|
125
|
+
search(ask: SearchAsk): Promise<SearchWindow>;
|
|
126
|
+
stage(record: TransferRecord, composition: Composition, page: StagedPage, written?: string): Promise<number | null>;
|
|
127
|
+
transferPart(locator: string, token: string): Promise<Uint8Array | null>;
|
|
128
|
+
keepPart(locator: string, token: string, part: Uint8Array): Promise<void>;
|
|
129
|
+
refresh(key: number, page: RefreshedPage): Promise<void>;
|
|
130
|
+
unrefresh(key: number): Promise<void>;
|
|
131
|
+
commit(commit: Commit): Promise<CommittedWrite>;
|
|
132
|
+
fence(locators: readonly string[]): Promise<void>;
|
|
133
|
+
erase(locator: string | null, limit: number): Promise<boolean>;
|
|
134
|
+
abandon(locator: string, kept?: boolean): Promise<number | null>;
|
|
135
|
+
release(key: number): Promise<void>;
|
|
136
|
+
rederive(key: number, limit: number): Promise<boolean>;
|
|
137
|
+
fact(name: string, value: unknown): Promise<void>;
|
|
138
|
+
queues(): Promise<readonly QueueRecord[]>;
|
|
139
|
+
submit(locator: string, id: string, submission: Submission, lost: boolean): Promise<void>;
|
|
140
|
+
keepUpload(locator: string, id: string, upload: unknown): Promise<void>;
|
|
141
|
+
roomDrafts(): Promise<readonly RoomDraftRecord[]>;
|
|
142
|
+
present(record: PresentationRecord): Promise<void>;
|
|
143
|
+
conversations(): Promise<readonly HeldConversation[]>;
|
|
144
|
+
keepMessages(write: ConversationWrite): Promise<void>;
|
|
145
|
+
messageWindow(conversation: string, limit: number, before: readonly [string, string] | null): Promise<MessageWindow>;
|
|
146
|
+
messageCount(conversation: string): Promise<number>;
|
|
147
|
+
turnArrived(conversation: string, turn: string): Promise<boolean>;
|
|
148
|
+
dropConversations(conversations: readonly string[]): Promise<void>;
|
|
149
|
+
chatDrafts(): Promise<readonly ChatDraftRecord[]>;
|
|
150
|
+
keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
|
|
151
|
+
dropChatDraft(conversation: string): Promise<void>;
|
|
152
|
+
calls(): Promise<readonly CallRecord[]>;
|
|
153
|
+
keepCall(record: CallRecord): Promise<void>;
|
|
154
|
+
dropCall(operation: string): Promise<void>;
|
|
155
|
+
keepRoomDraft(record: RoomDraftRecord, files: readonly StoredFile[]): Promise<void>;
|
|
156
|
+
discardRoomDraft(locator: string, path: string): Promise<void>;
|
|
157
|
+
fences(): Promise<readonly string[]>;
|
|
158
|
+
receivedHeads(): Promise<readonly KeptReceipt[]>;
|
|
159
|
+
receivedParts(key: string, count: number): Promise<readonly unknown[]>;
|
|
160
|
+
keepReceived(key: string, head: unknown, part?: {
|
|
161
|
+
index: number;
|
|
162
|
+
value: unknown;
|
|
163
|
+
}): Promise<void>;
|
|
164
|
+
dropReceived(keys: readonly string[]): Promise<void>;
|
|
165
|
+
generation(): Promise<string | null>;
|
|
166
|
+
rememberGeneration(value: string): Promise<void>;
|
|
167
|
+
file(key: string, type: string): Promise<Blob>;
|
|
168
|
+
};
|
|
169
|
+
export declare function openRuntimeStore(fenced: (locator: string) => boolean, authored: RuntimeDatabase): RuntimeStore;
|