@agentshouse/app-bridge 0.1.0-ca559eade7c19 → 0.1.0-ca61ac777c0b7
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 +11 -11
- package/dist/index.d.ts +1033 -20
- package/dist/mdmodel/definition.d.ts +18 -1
- package/dist/mdmodel/document.d.ts +10 -6
- package/dist/mdmodel/event.d.ts +77 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/index.d.ts +25 -11
- package/dist/mdmodel/kinds.d.ts +17 -0
- package/dist/mdmodel/markdown.d.ts +50 -0
- package/dist/mdmodel/paths.d.ts +9 -1
- package/dist/mdmodel/pattern.d.ts +9 -0
- package/dist/mdmodel/project.d.ts +1 -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 +5 -0
- package/dist/mdmodel/types.d.ts +46 -5
- package/dist/mdmodel/validate.d.ts +31 -4
- package/dist/mdruntime/actions.d.ts +19 -0
- package/dist/mdruntime/adapter.d.ts +161 -116
- package/dist/mdruntime/attached-model.d.ts +7 -0
- package/dist/mdruntime/binary.d.ts +0 -5
- package/dist/mdruntime/bootstrap.d.ts +43 -0
- package/dist/mdruntime/cell.d.ts +5 -0
- package/dist/mdruntime/chain.d.ts +11 -0
- package/dist/mdruntime/change-set.d.ts +13 -16
- package/dist/mdruntime/change.d.ts +32 -1
- package/dist/mdruntime/client.d.ts +36 -11
- package/dist/mdruntime/collection.d.ts +29 -21
- package/dist/mdruntime/compile.d.ts +15 -0
- package/dist/mdruntime/conversation-live.d.ts +135 -0
- package/dist/mdruntime/conversation-row.d.ts +32 -0
- package/dist/mdruntime/conversation.d.ts +54 -46
- package/dist/mdruntime/declaration.d.ts +9 -0
- package/dist/mdruntime/durability.d.ts +16 -4
- package/dist/mdruntime/failure.d.ts +1 -0
- package/dist/mdruntime/figures.d.ts +48 -0
- package/dist/mdruntime/holdings.d.ts +28 -0
- package/dist/mdruntime/identity.d.ts +5 -0
- package/dist/mdruntime/listing.d.ts +47 -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 +48 -0
- package/dist/mdruntime/model.d.ts +8 -11
- package/dist/mdruntime/observation.d.ts +17 -2
- package/dist/mdruntime/opened.d.ts +21 -0
- package/dist/mdruntime/outcome.d.ts +49 -8
- package/dist/mdruntime/overlay.d.ts +4 -5
- package/dist/mdruntime/preparation.d.ts +19 -0
- package/dist/mdruntime/presence.d.ts +51 -0
- package/dist/mdruntime/query.d.ts +25 -191
- package/dist/mdruntime/reach.d.ts +20 -9
- package/dist/mdruntime/readiness.d.ts +13 -17
- package/dist/mdruntime/reads.d.ts +36 -0
- package/dist/mdruntime/recovery.d.ts +3 -2
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +50 -33
- package/dist/mdruntime/room-draft.d.ts +28 -11
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +33 -0
- package/dist/mdruntime/save.d.ts +42 -48
- package/dist/mdruntime/saves.d.ts +31 -0
- package/dist/mdruntime/search.d.ts +12 -82
- 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/session.d.ts +37 -0
- package/dist/mdruntime/socket.d.ts +66 -0
- package/dist/mdruntime/source.d.ts +60 -0
- package/dist/mdruntime/status.d.ts +4 -5
- 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 +209 -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 +109 -150
- package/dist/mdruntime/stored.d.ts +155 -0
- package/dist/mdruntime/surface.d.ts +87 -0
- package/dist/mdruntime/tables.d.ts +411 -0
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +0 -5
- package/dist/mdruntime/wire.d.ts +54 -10
- package/dist/session-content/bounds.d.ts +7 -0
- package/dist/session-content/check.d.ts +18 -0
- package/dist/session-content/index.d.ts +7 -0
- package/dist/session-content/parts.d.ts +102 -0
- package/dist/session-content/state.d.ts +61 -0
- package/dist/session-content/turn.d.ts +328 -0
- package/dist/test-host.d.ts +7 -4
- package/dist/test-host.js +19 -29
- package/docs/families.md +69 -56
- package/package.json +8 -3
- package/dist/calls.d.ts +0 -118
- package/dist/calls.js +0 -1
- package/dist/mdmodel/blocks.d.ts +0 -10
- package/dist/mdmodel/condition.d.ts +0 -149
- package/dist/mdmodel/profile.d.ts +0 -5
- package/dist/mdruntime/acquisition.d.ts +0 -13
- package/dist/mdruntime/connection.d.ts +0 -141
- package/dist/mdruntime/file.d.ts +0 -19
- package/dist/mdruntime/rows.d.ts +0 -37
- package/dist/mdruntime/shared.d.ts +0 -10
- package/dist/mdruntime/turn.d.ts +0 -6
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type DefinitionOf } from '../mdmodel/index.js';
|
|
1
2
|
import type { ProviderRefusal } from './adapter.js';
|
|
2
3
|
import type { Open } from './open.js';
|
|
3
4
|
import type { Change, Precondition } from './change.js';
|
|
@@ -32,6 +33,7 @@ export type RoomDraftParts = {
|
|
|
32
33
|
readonly creation?: RoomDraftCreation;
|
|
33
34
|
readonly move?: {
|
|
34
35
|
readonly to: string;
|
|
36
|
+
readonly room?: string;
|
|
35
37
|
readonly base?: string | null;
|
|
36
38
|
};
|
|
37
39
|
readonly removal?: {
|
|
@@ -39,11 +41,12 @@ export type RoomDraftParts = {
|
|
|
39
41
|
};
|
|
40
42
|
readonly file?: {
|
|
41
43
|
readonly blob: Blob;
|
|
44
|
+
readonly base?: string | null;
|
|
42
45
|
};
|
|
43
46
|
};
|
|
44
47
|
export type HeldFile = {
|
|
45
|
-
readonly blob: Blob;
|
|
46
48
|
readonly localId: string;
|
|
49
|
+
readonly name?: string;
|
|
47
50
|
readonly byteLength: number;
|
|
48
51
|
readonly mediaType: string;
|
|
49
52
|
readonly sha256: string;
|
|
@@ -69,6 +72,7 @@ type HeldParts = {
|
|
|
69
72
|
readonly creation?: RoomDraftCreation;
|
|
70
73
|
readonly move?: {
|
|
71
74
|
readonly to: string;
|
|
75
|
+
readonly room?: string;
|
|
72
76
|
readonly base: string | null;
|
|
73
77
|
};
|
|
74
78
|
readonly removal?: {
|
|
@@ -87,9 +91,9 @@ type ChangedUnderneath = {
|
|
|
87
91
|
readonly file?: string | null;
|
|
88
92
|
};
|
|
89
93
|
export type ReturnReason = ProviderRefusal & {
|
|
90
|
-
readonly kind: Open<'conflicted' | 'rejected' | '
|
|
94
|
+
readonly kind: Open<'conflicted' | 'rejected' | 'withdrawn'>;
|
|
91
95
|
};
|
|
92
|
-
export declare function returnedBy(
|
|
96
|
+
export declare function returnedBy(): ReturnReason;
|
|
93
97
|
export type RoomDraft = {
|
|
94
98
|
readonly room: string;
|
|
95
99
|
readonly path: string;
|
|
@@ -103,14 +107,12 @@ export type RoomDraftWrite = {
|
|
|
103
107
|
readonly roomDraft: RoomDraft | null;
|
|
104
108
|
} | {
|
|
105
109
|
readonly outcome: 'stale';
|
|
106
|
-
readonly code: string;
|
|
107
|
-
readonly retryable: boolean;
|
|
108
110
|
readonly current: RoomDraft | null;
|
|
109
111
|
};
|
|
110
112
|
export declare function staleWrite(current: RoomDraft | null): RoomDraftWrite;
|
|
111
113
|
export type ChangedPart = {
|
|
112
114
|
readonly path: string;
|
|
113
|
-
readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | '
|
|
115
|
+
readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | 'move' | 'removal' | 'file'>;
|
|
114
116
|
readonly name?: string;
|
|
115
117
|
};
|
|
116
118
|
export type RoomDraftRecord = {
|
|
@@ -124,12 +126,14 @@ export type SavedDraft = {
|
|
|
124
126
|
readonly path: string;
|
|
125
127
|
readonly parts: HeldParts;
|
|
126
128
|
};
|
|
127
|
-
export declare function readParts(value: unknown): RoomDraftParts;
|
|
129
|
+
export declare function readParts(value: unknown, path: string): RoomDraftParts;
|
|
130
|
+
export declare function gatheredParts(earlier: unknown, later: unknown): unknown;
|
|
128
131
|
export declare function held(current: HeldParts | undefined, parts: RoomDraftParts, file?: HeldFile): HeldParts;
|
|
129
132
|
export declare function underneath(parts: HeldParts, path: string, visible: VisibleLayer | undefined): ChangedUnderneath;
|
|
130
133
|
export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
|
|
131
134
|
export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
|
|
132
|
-
export declare function changedParts(path: string,
|
|
135
|
+
export declare function changedParts(path: string, parts: HeldParts, visible: VisibleLayer | undefined): readonly ChangedPart[];
|
|
136
|
+
export declare function lineEnded(text: string): string;
|
|
133
137
|
export type TextParts = {
|
|
134
138
|
readonly fields?: Readonly<Record<string, {
|
|
135
139
|
readonly value: unknown;
|
|
@@ -141,15 +145,28 @@ export type TextParts = {
|
|
|
141
145
|
readonly value: string;
|
|
142
146
|
};
|
|
143
147
|
};
|
|
144
|
-
export declare function partsAfter(markdown: string, parts: TextParts): string;
|
|
145
|
-
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts): HeldParts;
|
|
148
|
+
export declare function partsAfter(markdown: string, parts: TextParts, definitions?: DefinitionOf): string;
|
|
149
|
+
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts, definitions?: DefinitionOf): HeldParts;
|
|
146
150
|
export declare function moveTarget(move: {
|
|
147
151
|
readonly to: string;
|
|
148
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
|
+
};
|
|
149
167
|
export declare function changesOf(path: string, parts: HeldParts): {
|
|
150
168
|
changes: readonly Change[];
|
|
151
169
|
bases: readonly Precondition[];
|
|
152
170
|
};
|
|
153
|
-
export declare function joinedDraft(carried: SavedDraft, saved: readonly SavedDraft[]): SavedDraft;
|
|
154
171
|
export declare function withdrawnDrafts(drafts: readonly SavedDraft[], changes: readonly Change[]): readonly SavedDraft[];
|
|
155
172
|
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ChangeSet } from './change-set.js';
|
|
2
|
+
import { type VisibleLayer } from './replica.js';
|
|
3
|
+
import { type RoomDraft, type RoomDraftWrite } from './room-draft.js';
|
|
4
|
+
import type { Runtime } from './runtime.js';
|
|
5
|
+
import type { Store } from './store.js';
|
|
6
|
+
export type RoomDraftSurface = {
|
|
7
|
+
list(): Promise<readonly RoomDraft[]>;
|
|
8
|
+
read(room: string, path: string): Promise<RoomDraft | null>;
|
|
9
|
+
write(room: string, path: string, revision: string | null, parts: unknown, next?: string): Promise<RoomDraftWrite>;
|
|
10
|
+
discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
|
|
11
|
+
};
|
|
12
|
+
export type PresentationSurface = {
|
|
13
|
+
read(app: string): Promise<unknown>;
|
|
14
|
+
write(app: string, value: unknown): Promise<void>;
|
|
15
|
+
edit(app: string, members: Readonly<Record<string, unknown>>): Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
export declare function visibleOf(store: Store, locator: string, paths: readonly string[]): Promise<VisibleLayer | undefined>;
|
|
18
|
+
export declare function publishRoomDrafts({ store, socket }: Runtime, waitingOnly: boolean, touched?: ChangeSet['documents'] | null): Promise<void>;
|
|
19
|
+
export declare function emitPresentation({ store, socket }: Runtime, app: string): Promise<void>;
|
|
20
|
+
export declare function roomDraftSurface(runtime: Runtime): RoomDraftSurface;
|
|
21
|
+
export declare function presentationSurface(runtime: Runtime): PresentationSurface;
|
|
22
|
+
export declare function watchRoomDrafts({ store, socket }: Runtime, deliver: (value: unknown) => void): () => void;
|
|
23
|
+
export declare function watchPresentation({ store, socket }: Runtime, app: string, deliver: (value: unknown) => void): () => void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { RoomDeclaration, TypedPath } from './adapter.js';
|
|
2
|
+
import type { RuntimeShell } from './durability.js';
|
|
3
|
+
import type { LiveConversations } from './conversation-live.js';
|
|
4
|
+
import type { WriteRule } from './declaration.js';
|
|
5
|
+
import type { FiguresRead } from './figures.js';
|
|
6
|
+
import type { LiveQueries } from './live.js';
|
|
7
|
+
import type { Log } from './log.js';
|
|
8
|
+
import type { ModelState } from './model.js';
|
|
9
|
+
import type { Presence } from './presence.js';
|
|
10
|
+
import type { ReadAnswers } from './reads.js';
|
|
11
|
+
import type { Recovery } from './recovery.js';
|
|
12
|
+
import type { RuntimeSocket } from './socket.js';
|
|
13
|
+
import type { HeldCover, Store } from './store.js';
|
|
14
|
+
import type { schemaTypes } from './attached-model.js';
|
|
15
|
+
export type Runtime = {
|
|
16
|
+
readonly store: Store;
|
|
17
|
+
readonly socket: RuntimeSocket;
|
|
18
|
+
readonly presence: Presence;
|
|
19
|
+
readonly journal: Log;
|
|
20
|
+
readonly recovery: Recovery;
|
|
21
|
+
readonly shell: RuntimeShell;
|
|
22
|
+
readonly localSaves: boolean;
|
|
23
|
+
readonly roomTypes: Parameters<typeof schemaTypes>[1];
|
|
24
|
+
readonly builtIn: ModelState;
|
|
25
|
+
readonly typedPaths: readonly TypedPath[];
|
|
26
|
+
readonly writeRule: (declaration: RoomDeclaration) => WriteRule;
|
|
27
|
+
readonly usableWhenHeld: readonly string[];
|
|
28
|
+
readonly build: string;
|
|
29
|
+
readonly conversations: LiveConversations;
|
|
30
|
+
readonly liveQueries: LiveQueries<HeldCover>;
|
|
31
|
+
readonly figures: FiguresRead;
|
|
32
|
+
readonly lastAnswers: ReadAnswers;
|
|
33
|
+
};
|
package/dist/mdruntime/save.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { type Validation } from '../mdmodel/index.js';
|
|
1
2
|
import type { ProviderLimit } from './adapter.js';
|
|
2
|
-
import { type
|
|
3
|
+
import { type ChangeBatch, type WrittenBy } from './change.js';
|
|
3
4
|
import { type Composition } from './collection.js';
|
|
4
|
-
import type {
|
|
5
|
-
import type
|
|
5
|
+
import type { WriteRule } from './declaration.js';
|
|
6
|
+
import { type Layer } from './overlay.js';
|
|
7
|
+
import type { ReplicaRecord, VisibleLayer } from './replica.js';
|
|
8
|
+
import { type ChangedPart, type RoomDraftRecord, type SavedDraft } from './room-draft.js';
|
|
6
9
|
export type SaveRefusal = {
|
|
7
10
|
code: string;
|
|
8
11
|
retryable: boolean;
|
|
@@ -11,53 +14,44 @@ export type SaveRefusal = {
|
|
|
11
14
|
referrers?: readonly string[];
|
|
12
15
|
parts?: readonly ChangedPart[];
|
|
13
16
|
};
|
|
14
|
-
export type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
providerLimits: readonly ProviderLimit[];
|
|
21
|
-
visible: VisibleLayer;
|
|
22
|
-
handle: string;
|
|
23
|
-
changes: readonly Change[];
|
|
24
|
-
bases: readonly Precondition[];
|
|
25
|
-
queued?: ReadonlySet<string>;
|
|
26
|
-
writtenBy?: WrittenBy;
|
|
27
|
-
clean?: {
|
|
28
|
-
text: Readonly<Record<string, string>>;
|
|
29
|
-
binaries: Readonly<Record<string, unknown>>;
|
|
30
|
-
composition: Composition;
|
|
31
|
-
};
|
|
17
|
+
export type SaveAsk = {
|
|
18
|
+
readonly saved: readonly SavedDraft[];
|
|
19
|
+
readonly consumed: ReadonlySet<string>;
|
|
20
|
+
readonly writtenBy?: WrittenBy;
|
|
21
|
+
readonly local: boolean;
|
|
22
|
+
readonly providerLimits: readonly ProviderLimit[];
|
|
32
23
|
};
|
|
33
|
-
export type
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
export type SavingRoom = {
|
|
25
|
+
readonly record: ReplicaRecord;
|
|
26
|
+
readonly rule: WriteRule;
|
|
27
|
+
readonly composition: Composition;
|
|
28
|
+
readonly queue: readonly ChangeBatch[];
|
|
29
|
+
readonly changeable: ReadonlySet<string>;
|
|
30
|
+
readonly saved: ReadonlyMap<string, readonly SavedDraft[]>;
|
|
31
|
+
readonly replay: (queue: readonly ChangeBatch[]) => Generator<number, VisibleLayer, void>;
|
|
32
|
+
readonly folders: ReadonlySet<string>;
|
|
33
|
+
readonly modelled: boolean;
|
|
34
|
+
readonly drafts: ReadonlyMap<string, RoomDraftRecord>;
|
|
35
|
+
readonly validate: Validator;
|
|
39
36
|
};
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
withdrawn: ReadonlyMap<string, ChangeBatch | null>;
|
|
47
|
-
owners: ReadonlySet<string>;
|
|
48
|
-
} | {
|
|
49
|
-
kind: 'refused';
|
|
50
|
-
refusal: SaveRefusal;
|
|
37
|
+
export type PlannedRoom = {
|
|
38
|
+
readonly locator: string;
|
|
39
|
+
readonly queue: readonly ChangeBatch[];
|
|
40
|
+
readonly saved: ReadonlyMap<string, readonly SavedDraft[]>;
|
|
41
|
+
readonly consumed: readonly string[];
|
|
42
|
+
readonly carried: readonly RoomDraftRecord[];
|
|
51
43
|
};
|
|
52
|
-
export type
|
|
53
|
-
kind: '
|
|
54
|
-
|
|
55
|
-
queue: readonly ChangeBatch[];
|
|
44
|
+
export type SavePlan = {
|
|
45
|
+
readonly kind: 'refused';
|
|
46
|
+
readonly refusal: SaveRefusal;
|
|
56
47
|
} | {
|
|
57
|
-
kind: '
|
|
58
|
-
|
|
48
|
+
readonly kind: 'planned';
|
|
49
|
+
readonly identifier: string;
|
|
50
|
+
readonly rooms: readonly PlannedRoom[];
|
|
59
51
|
};
|
|
60
|
-
export
|
|
61
|
-
export declare function
|
|
62
|
-
export declare function
|
|
63
|
-
export declare function
|
|
52
|
+
export type Validator = (resulting: Layer, touched: readonly string[]) => Promise<Validation>;
|
|
53
|
+
export declare function providerRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
54
|
+
export declare function rewriting(batch: ChangeBatch, locator: string): boolean;
|
|
55
|
+
export declare function effectiveIn(batch: ChangeBatch, locator: string, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
56
|
+
export declare function destination(locator: string, saved: readonly SavedDraft[]): string | null;
|
|
57
|
+
export declare function planSave(ask: SaveAsk, room: SavingRoom, into?: SavingRoom): Promise<SavePlan>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ChangeBatch, type WrittenBy } from './change.js';
|
|
2
|
+
import { type AttachAnswer, type BinaryLinkAnswer, type HeldBinaryAnswer, type HeldShownAnswer } from './outcome.js';
|
|
3
|
+
import { type RoomDraftParts } from './room-draft.js';
|
|
4
|
+
import type { Runtime } from './runtime.js';
|
|
5
|
+
import { type SaveRefusal } from './save.js';
|
|
6
|
+
import type { Store } from './store.js';
|
|
7
|
+
export type SaveResult = {
|
|
8
|
+
outcome: 'saved';
|
|
9
|
+
identifier: string;
|
|
10
|
+
} | ({
|
|
11
|
+
outcome: 'refused';
|
|
12
|
+
} & SaveRefusal);
|
|
13
|
+
export type SavedRoomDraft = {
|
|
14
|
+
readonly path: string;
|
|
15
|
+
readonly revision: string;
|
|
16
|
+
};
|
|
17
|
+
export type SavedParts = {
|
|
18
|
+
readonly path: string;
|
|
19
|
+
readonly parts: RoomDraftParts;
|
|
20
|
+
};
|
|
21
|
+
export type BinaryFileSurface = {
|
|
22
|
+
read(room: string, path: string, revision?: string): Promise<HeldBinaryAnswer>;
|
|
23
|
+
link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
|
|
24
|
+
show(room: string, path: string, revision?: string): Promise<HeldShownAnswer>;
|
|
25
|
+
attach(room: string, file: File): Promise<AttachAnswer>;
|
|
26
|
+
part(file: string, part: number): Promise<Uint8Array | null>;
|
|
27
|
+
};
|
|
28
|
+
export declare function saveRoomDrafts(runtime: Runtime, locator: string, named: readonly SavedRoomDraft[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
|
|
29
|
+
export declare function saveParts(runtime: Runtime, locator: string, named: readonly SavedParts[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
|
|
30
|
+
export declare function batchFile(store: Store, batch: ChangeBatch): (localId: string) => Promise<Blob>;
|
|
31
|
+
export declare function binaryFileSurface(runtime: Runtime): BinaryFileSurface;
|
|
@@ -1,91 +1,21 @@
|
|
|
1
|
-
import type { ProviderRefusal } from './adapter.js';
|
|
2
|
-
import type {
|
|
3
|
-
import { type CoveredRoom, type Filter, type PendingRoom } from './query.js';
|
|
4
|
-
import type { Open } from './open.js';
|
|
5
|
-
export type DocumentPart = Open<'fields' | 'sections' | 'preamble' | 'path'>;
|
|
1
|
+
import type { ProviderRefusal, SearchHit } from './adapter.js';
|
|
2
|
+
import type { Failure, Offline } from './outcome.js';
|
|
6
3
|
export type SearchRequest = {
|
|
7
4
|
text: string;
|
|
8
|
-
|
|
9
|
-
collection?: true;
|
|
10
|
-
conversations?: readonly string[];
|
|
11
|
-
limit?: number;
|
|
5
|
+
rooms?: readonly string[];
|
|
12
6
|
};
|
|
13
|
-
export type
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
score: number;
|
|
18
|
-
matches: Readonly<Record<string, readonly DocumentPart[]>>;
|
|
7
|
+
export type { SearchHit } from './adapter.js';
|
|
8
|
+
export type SearchFound = {
|
|
9
|
+
kind: 'found';
|
|
10
|
+
documents: readonly SearchHit[];
|
|
19
11
|
};
|
|
20
|
-
export type
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
score: number;
|
|
24
|
-
matches: Readonly<Record<string, readonly Open<'text'>[]>>;
|
|
25
|
-
};
|
|
26
|
-
export type SearchCoverage = {
|
|
27
|
-
rooms: readonly CoveredRoom[];
|
|
28
|
-
conversations: readonly string[];
|
|
29
|
-
index: string;
|
|
30
|
-
overlay: readonly string[];
|
|
31
|
-
};
|
|
32
|
-
export type PendingConversation = {
|
|
33
|
-
conversation: string;
|
|
34
|
-
awaits: Open<'index'>;
|
|
35
|
-
};
|
|
36
|
-
export type SearchHits = {
|
|
37
|
-
documents: readonly DocumentHit[];
|
|
38
|
-
messages: readonly MessageHit[];
|
|
39
|
-
};
|
|
40
|
-
export type SearchPending = SearchHits & {
|
|
41
|
-
pending: readonly (PendingRoom | PendingConversation)[];
|
|
42
|
-
coverage: SearchCoverage;
|
|
43
|
-
};
|
|
44
|
-
export type SearchUndeclared = ProviderRefusal & {
|
|
12
|
+
export type SearchResult = SearchFound | Offline | (ProviderRefusal & {
|
|
13
|
+
kind: 'rejected';
|
|
14
|
+
}) | (ProviderRefusal & {
|
|
45
15
|
kind: 'undeclared';
|
|
46
|
-
};
|
|
47
|
-
export type SearchResult = (SearchHits & {
|
|
48
|
-
coverage: SearchCoverage;
|
|
49
|
-
}) | SearchPending | SearchUndeclared;
|
|
50
|
-
export declare function undeclaredSearch(): SearchUndeclared;
|
|
51
|
-
export type SearchedDocument = {
|
|
52
|
-
room: string;
|
|
53
|
-
path: string;
|
|
54
|
-
type: string;
|
|
55
|
-
fields: Readonly<Record<string, unknown>>;
|
|
56
|
-
preamble: string;
|
|
57
|
-
sections: Readonly<Record<string, string>>;
|
|
58
|
-
};
|
|
59
|
-
export type SearchedMessage = {
|
|
60
|
-
conversation: string;
|
|
61
|
-
identity: string;
|
|
62
|
-
text: string;
|
|
63
|
-
};
|
|
64
|
-
export type SearchSource = {
|
|
65
|
-
room(room: string): readonly string[];
|
|
66
|
-
document(room: string, path: string): SearchedDocument | null;
|
|
67
|
-
};
|
|
16
|
+
}) | Failure;
|
|
68
17
|
export type SearchPlan = {
|
|
69
18
|
text: string;
|
|
70
|
-
|
|
71
|
-
collection: boolean;
|
|
72
|
-
conversations: readonly string[] | null;
|
|
73
|
-
limit: number | null;
|
|
74
|
-
};
|
|
75
|
-
export type SearchIndex = {
|
|
76
|
-
generation(): string;
|
|
77
|
-
rooms(): ReadonlySet<string>;
|
|
78
|
-
conversations(): ReadonlySet<string>;
|
|
79
|
-
indexRoom(room: string): Promise<void>;
|
|
80
|
-
indexMessages(conversation: string, messages: readonly SearchedMessage[], whole: boolean): void;
|
|
81
|
-
forget(rooms: readonly string[]): void;
|
|
82
|
-
changed(set: ChangeSet): void;
|
|
83
|
-
changes(): number;
|
|
84
|
-
caughtUp(): Promise<void>;
|
|
85
|
-
search(plan: SearchPlan, documents: readonly {
|
|
86
|
-
room: string;
|
|
87
|
-
path: string;
|
|
88
|
-
}[] | null, conversations: readonly string[], rooms: ReadonlySet<string> | null, selections: ReadonlyMap<string, readonly string[]> | null): SearchHits;
|
|
19
|
+
rooms: readonly string[] | null;
|
|
89
20
|
};
|
|
90
21
|
export declare function searchPlanOf(input: unknown): SearchPlan;
|
|
91
|
-
export declare function createSearchIndex(source: SearchSource): SearchIndex;
|
package/dist/mdruntime/seed.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
1
|
+
import type { Cover } from './live.js';
|
|
2
|
+
import { type KeyedResult } from './observation.js';
|
|
3
|
+
import type { Plan, QueryRows } from './query.js';
|
|
4
|
+
import type { Deliver } from './reach.js';
|
|
5
|
+
import type { Runtime } from './runtime.js';
|
|
6
|
+
import type { HeldCover, Store } from './store.js';
|
|
3
7
|
export type EntrySeed = {
|
|
4
8
|
readonly at: Readonly<Record<string, string>>;
|
|
5
9
|
readonly queries: readonly {
|
|
@@ -11,5 +15,10 @@ export type Seeded = {
|
|
|
11
15
|
readonly rows: QueryRows;
|
|
12
16
|
readonly at: Readonly<Record<string, string>>;
|
|
13
17
|
};
|
|
18
|
+
type SeededWatch = (coverOf: (cover: Cover, held: HeldCover) => Cover, deliver: (message: unknown) => void) => () => void;
|
|
14
19
|
export declare function entrySeedOf(value: unknown): EntrySeed | null;
|
|
15
20
|
export declare function seededResult(seed: Seeded): KeyedResult;
|
|
21
|
+
export declare function seedApplies(runtime: Runtime, plan: Plan, held: HeldCover): Seeded | null;
|
|
22
|
+
export declare function keepEntrySeed(store: Store, entry: EntrySeed): void;
|
|
23
|
+
export declare function watchSeeded(runtime: Runtime, plan: Plan, deliver: Deliver, watch: SeededWatch): () => void;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type Live = () => boolean;
|
|
2
|
+
type LaneRules = {
|
|
3
|
+
generation(): number;
|
|
4
|
+
continuing(): boolean;
|
|
5
|
+
stopping(): boolean;
|
|
6
|
+
};
|
|
7
|
+
export type Lanes = {
|
|
8
|
+
task(lane: string, work: (live: Live) => Promise<void>): Promise<void>;
|
|
9
|
+
inRoom<T>(locator: string, work: (live: Live) => Promise<T>): Promise<T>;
|
|
10
|
+
roomTask(locator: string, work: (live: Live) => Promise<void>): Promise<void>;
|
|
11
|
+
roomWork(): number;
|
|
12
|
+
current(): Promise<unknown>;
|
|
13
|
+
finished(): Promise<unknown>;
|
|
14
|
+
calling(operation: string): boolean;
|
|
15
|
+
call(operation: string): void;
|
|
16
|
+
called(operation: string): void;
|
|
17
|
+
};
|
|
18
|
+
export declare function createLanes({ generation, continuing, stopping }: LaneRules): Lanes;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Authorization, ProviderRefusal, ServiceMode } from '../adapter.js';
|
|
2
|
+
import { type Cell } from '../cell.js';
|
|
3
|
+
import type { Open } from '../open.js';
|
|
4
|
+
import type { CycleProgress, SyncStatus } from '../status.js';
|
|
5
|
+
export type RefusalReason = 'missing-required-guarantee' | 'revoked-authorization';
|
|
6
|
+
export type ConnectionRefusalCode = Open<RefusalReason>;
|
|
7
|
+
export type ConnectionRefusal = {
|
|
8
|
+
code: ConnectionRefusalCode;
|
|
9
|
+
reauthorizationOffered: boolean;
|
|
10
|
+
refusal: ProviderRefusal | null;
|
|
11
|
+
};
|
|
12
|
+
export type Moving = {
|
|
13
|
+
readonly state: SyncStatus['state'];
|
|
14
|
+
readonly providerUnreachable: boolean;
|
|
15
|
+
readonly resting: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type Session = {
|
|
18
|
+
readonly closed: boolean;
|
|
19
|
+
readonly stopping: boolean;
|
|
20
|
+
readonly paused: boolean;
|
|
21
|
+
readonly authorization: Authorization | undefined;
|
|
22
|
+
readonly refusal: ConnectionRefusal | null;
|
|
23
|
+
readonly discoveries: number;
|
|
24
|
+
readonly roomsNamed: boolean;
|
|
25
|
+
readonly roomsListed: boolean;
|
|
26
|
+
readonly serviceMode: ServiceMode;
|
|
27
|
+
readonly haltedRefusal: boolean;
|
|
28
|
+
readonly openSignals: number;
|
|
29
|
+
readonly authorityChanges: number;
|
|
30
|
+
readonly currencyQueued: number | null;
|
|
31
|
+
readonly moving: Moving;
|
|
32
|
+
readonly complete: boolean;
|
|
33
|
+
readonly recorded: boolean;
|
|
34
|
+
readonly underway: CycleProgress | null;
|
|
35
|
+
readonly streamed: CycleProgress | null;
|
|
36
|
+
};
|
|
37
|
+
export declare function createSession(authorization: Authorization | undefined): Cell<Session>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Adapter, Authorization, ConversationEvent, Discovery, HeldRoom, RoomStreamEvent, ServiceMode } from './adapter.js';
|
|
2
|
+
import type { Reads } from './bootstrap.js';
|
|
3
|
+
import type { Cell } from './cell.js';
|
|
4
|
+
import type { Log } from './log.js';
|
|
5
|
+
import { type Admission } from './socket/admission.js';
|
|
6
|
+
import { type Answers } from './socket/answers.js';
|
|
7
|
+
import { type Lanes } from './socket/lanes.js';
|
|
8
|
+
import { type Session } from './socket/session.js';
|
|
9
|
+
export type { Live } from './socket/lanes.js';
|
|
10
|
+
export type { ConnectionRefusal, ConnectionRefusalCode, Moving, RefusalReason, } from './socket/session.js';
|
|
11
|
+
type SocketEvent = {
|
|
12
|
+
readonly kind: 'opened';
|
|
13
|
+
} | {
|
|
14
|
+
readonly kind: 'discovered';
|
|
15
|
+
readonly discovery: Discovery;
|
|
16
|
+
readonly missed: boolean;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: 'closed';
|
|
19
|
+
readonly revoked: boolean;
|
|
20
|
+
readonly lost: boolean;
|
|
21
|
+
readonly opened: boolean;
|
|
22
|
+
} | Exclude<RoomStreamEvent, {
|
|
23
|
+
kind: 'opened' | 'discovered' | 'closed';
|
|
24
|
+
}>;
|
|
25
|
+
export type RuntimeSocket = Admission & Answers & {
|
|
26
|
+
readonly reads: Reads;
|
|
27
|
+
readonly streamed: boolean;
|
|
28
|
+
readonly session: Cell<Session>;
|
|
29
|
+
readonly lanes: Lanes;
|
|
30
|
+
readonly ready: Promise<void>;
|
|
31
|
+
readonly firstDiscovery: Promise<void>;
|
|
32
|
+
conversations(): Adapter['conversations'];
|
|
33
|
+
search(): Adapter['search'];
|
|
34
|
+
discover(authorized: Authorization): ReturnType<NonNullable<Adapter['discover']>> | undefined;
|
|
35
|
+
follows: Adapter['follows'];
|
|
36
|
+
mutate: Adapter['mutate'];
|
|
37
|
+
binary: Adapter['binary'];
|
|
38
|
+
link: Adapter['link'];
|
|
39
|
+
attach: Adapter['attach'];
|
|
40
|
+
history: Adapter['history'];
|
|
41
|
+
action: Adapter['action'];
|
|
42
|
+
authorize(): Promise<void>;
|
|
43
|
+
observe(listen: (event: SocketEvent) => void): void;
|
|
44
|
+
observeConversations(listen: (event: ConversationEvent) => void): void;
|
|
45
|
+
observeServiceMode(listen: (mode: ServiceMode) => void): void;
|
|
46
|
+
close(): void;
|
|
47
|
+
readyFromStore(): void;
|
|
48
|
+
notifyReady(): void;
|
|
49
|
+
closed(): boolean;
|
|
50
|
+
stopping(): boolean;
|
|
51
|
+
continuing(): boolean;
|
|
52
|
+
reached(): boolean;
|
|
53
|
+
writesHeld(): boolean;
|
|
54
|
+
haltedSince(opens: number): boolean;
|
|
55
|
+
isOpen(): boolean;
|
|
56
|
+
isAnnounced(): boolean;
|
|
57
|
+
isHanded(): boolean;
|
|
58
|
+
generation(): number;
|
|
59
|
+
naming(): boolean;
|
|
60
|
+
hand(rooms: readonly HeldRoom[]): void;
|
|
61
|
+
name(room: HeldRoom): void;
|
|
62
|
+
named(): void;
|
|
63
|
+
abortReads(): void;
|
|
64
|
+
stopReads(): void;
|
|
65
|
+
};
|
|
66
|
+
export declare function createSocket(adapter: Adapter, journal: Log, authorization: Authorization | undefined): RuntimeSocket;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type HouseSource = {
|
|
2
|
+
readonly kind: 'request';
|
|
3
|
+
readonly request: string;
|
|
4
|
+
readonly agentFunction: RequestAgentFunction | null;
|
|
5
|
+
readonly requester: {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly room: boolean;
|
|
8
|
+
};
|
|
9
|
+
readonly room: {
|
|
10
|
+
readonly ref: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
};
|
|
13
|
+
readonly approved: string | null;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'mail';
|
|
16
|
+
readonly request: string;
|
|
17
|
+
readonly room: string;
|
|
18
|
+
readonly report: boolean;
|
|
19
|
+
readonly agent: string;
|
|
20
|
+
readonly owner: string;
|
|
21
|
+
readonly approved: string | null;
|
|
22
|
+
readonly declined: string | null;
|
|
23
|
+
} | {
|
|
24
|
+
readonly kind: 'trigger';
|
|
25
|
+
readonly customer: boolean;
|
|
26
|
+
readonly trigger: string;
|
|
27
|
+
readonly room: {
|
|
28
|
+
readonly ref: string;
|
|
29
|
+
readonly name: string;
|
|
30
|
+
};
|
|
31
|
+
} | {
|
|
32
|
+
readonly kind: 'conversation';
|
|
33
|
+
readonly conversation: {
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly name: string;
|
|
36
|
+
};
|
|
37
|
+
readonly agent: string;
|
|
38
|
+
} | {
|
|
39
|
+
readonly kind: 'declined';
|
|
40
|
+
readonly agent: string;
|
|
41
|
+
readonly owner: string;
|
|
42
|
+
};
|
|
43
|
+
export type ChatRequest = {
|
|
44
|
+
readonly request: string;
|
|
45
|
+
readonly room: string;
|
|
46
|
+
readonly message?: string;
|
|
47
|
+
};
|
|
48
|
+
export type ChatRoomRequest = {
|
|
49
|
+
readonly request: string;
|
|
50
|
+
readonly room: {
|
|
51
|
+
readonly ref: string;
|
|
52
|
+
readonly name: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
type RequestAgentFunction = {
|
|
56
|
+
readonly name: string;
|
|
57
|
+
readonly version: number;
|
|
58
|
+
};
|
|
59
|
+
export declare function sourceOf(value: unknown, sender: string | null): HouseSource | null;
|
|
60
|
+
export {};
|
|
@@ -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 = {
|
|
@@ -21,6 +22,4 @@ export type CycleProgress = {
|
|
|
21
22
|
reachable: boolean;
|
|
22
23
|
};
|
|
23
24
|
export declare const STARTING: SyncStatus;
|
|
24
|
-
export declare function transferring(status: SyncStatus): SyncStatus;
|
|
25
|
-
export declare function saving(status: SyncStatus): SyncStatus;
|
|
26
25
|
export declare function same(one: SyncStatus, other: SyncStatus): boolean;
|