@agentshouse/app-bridge 0.1.0-c43d9cbcf6c8d → 0.1.0-c44cf2cfcc09a
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 +6 -6
- package/dist/index.d.ts +143 -399
- package/dist/mdmodel/body.d.ts +84 -0
- package/dist/mdmodel/definition.d.ts +20 -10
- package/dist/mdmodel/document.d.ts +14 -7
- package/dist/mdmodel/event.d.ts +76 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/fields.d.ts +1 -1
- package/dist/mdmodel/index.d.ts +27 -13
- package/dist/mdmodel/kinds.d.ts +17 -0
- package/dist/mdmodel/markdown.d.ts +74 -0
- package/dist/mdmodel/paths.d.ts +10 -1
- package/dist/mdmodel/pattern.d.ts +9 -0
- package/dist/mdmodel/query/language.d.ts +253 -0
- package/dist/mdmodel/query/match.d.ts +13 -0
- package/dist/mdmodel/query/rows.d.ts +31 -0
- package/dist/mdmodel/query/sql.d.ts +38 -0
- package/dist/mdmodel/reserved.d.ts +5 -0
- package/dist/mdmodel/types.d.ts +21 -7
- package/dist/mdmodel/validate.d.ts +10 -6
- package/dist/mdruntime/actions.d.ts +25 -0
- package/dist/mdruntime/adapter.d.ts +71 -69
- package/dist/mdruntime/attached-model.d.ts +7 -0
- package/dist/mdruntime/bootstrap.d.ts +43 -0
- package/dist/mdruntime/cell.d.ts +5 -0
- package/dist/mdruntime/chain.d.ts +2 -1
- package/dist/mdruntime/change-set.d.ts +4 -0
- package/dist/mdruntime/change.d.ts +1 -0
- package/dist/mdruntime/client.d.ts +27 -19
- package/dist/mdruntime/collection.d.ts +23 -4
- package/dist/mdruntime/compile.d.ts +8 -6
- package/dist/mdruntime/conversation-live.d.ts +139 -0
- package/dist/mdruntime/conversation-row.d.ts +32 -0
- package/dist/mdruntime/conversation.d.ts +59 -45
- package/dist/mdruntime/declaration.d.ts +9 -0
- package/dist/mdruntime/durability.d.ts +18 -0
- package/dist/mdruntime/failure.d.ts +3 -0
- package/dist/mdruntime/figures.d.ts +48 -0
- package/dist/mdruntime/holdings.d.ts +28 -0
- package/dist/mdruntime/identity.d.ts +0 -1
- package/dist/mdruntime/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 +1 -1
- package/dist/mdruntime/messages.d.ts +24 -3
- package/dist/mdruntime/model.d.ts +2 -10
- package/dist/mdruntime/observation.d.ts +2 -2
- package/dist/mdruntime/opened.d.ts +1 -1
- package/dist/mdruntime/outcome.d.ts +7 -1
- package/dist/mdruntime/overlay.d.ts +6 -1
- package/dist/mdruntime/preparation.d.ts +19 -0
- package/dist/mdruntime/presence.d.ts +51 -0
- package/dist/mdruntime/query.d.ts +13 -209
- package/dist/mdruntime/reach.d.ts +14 -12
- package/dist/mdruntime/readiness.d.ts +0 -3
- package/dist/mdruntime/reads.d.ts +38 -0
- package/dist/mdruntime/recovery.d.ts +3 -1
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +11 -16
- package/dist/mdruntime/retried.d.ts +29 -0
- package/dist/mdruntime/room-draft.d.ts +7 -8
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +35 -0
- package/dist/mdruntime/save.d.ts +42 -86
- package/dist/mdruntime/saves.d.ts +31 -0
- package/dist/mdruntime/search.d.ts +12 -63
- package/dist/mdruntime/seed.d.ts +11 -2
- package/dist/mdruntime/socket/admission.d.ts +6 -0
- package/dist/mdruntime/socket/answers.d.ts +5 -0
- package/dist/mdruntime/socket/lanes.d.ts +27 -0
- package/dist/mdruntime/socket/session.d.ts +37 -0
- package/dist/mdruntime/socket.d.ts +67 -0
- package/dist/mdruntime/source.d.ts +53 -0
- package/dist/mdruntime/status.d.ts +0 -2
- 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 +212 -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 +112 -145
- package/dist/mdruntime/stored.d.ts +59 -33
- package/dist/mdruntime/surface.d.ts +88 -0
- package/dist/mdruntime/tables.d.ts +116 -29
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +4 -0
- package/dist/mdruntime/wire.d.ts +69 -5
- 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.js +1 -1
- package/docs/families.md +24 -17
- package/package.json +2 -2
- package/dist/mdmodel/blocks.d.ts +0 -10
- package/dist/mdmodel/condition.d.ts +0 -179
- package/dist/mdmodel/links.d.ts +0 -28
- package/dist/mdmodel/profile.d.ts +0 -5
- package/dist/mdruntime/connection.d.ts +0 -152
- package/dist/mdruntime/fulltext.d.ts +0 -26
|
@@ -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';
|
|
@@ -90,9 +91,9 @@ type ChangedUnderneath = {
|
|
|
90
91
|
readonly file?: string | null;
|
|
91
92
|
};
|
|
92
93
|
export type ReturnReason = ProviderRefusal & {
|
|
93
|
-
readonly kind: Open<'conflicted' | 'rejected' | '
|
|
94
|
+
readonly kind: Open<'conflicted' | 'rejected' | 'withdrawn'>;
|
|
94
95
|
};
|
|
95
|
-
export declare function returnedBy(
|
|
96
|
+
export declare function returnedBy(): ReturnReason;
|
|
96
97
|
export type RoomDraft = {
|
|
97
98
|
readonly room: string;
|
|
98
99
|
readonly path: string;
|
|
@@ -106,8 +107,6 @@ export type RoomDraftWrite = {
|
|
|
106
107
|
readonly roomDraft: RoomDraft | null;
|
|
107
108
|
} | {
|
|
108
109
|
readonly outcome: 'stale';
|
|
109
|
-
readonly code: string;
|
|
110
|
-
readonly retryable: boolean;
|
|
111
110
|
readonly current: RoomDraft | null;
|
|
112
111
|
};
|
|
113
112
|
export declare function staleWrite(current: RoomDraft | null): RoomDraftWrite;
|
|
@@ -127,13 +126,14 @@ export type SavedDraft = {
|
|
|
127
126
|
readonly path: string;
|
|
128
127
|
readonly parts: HeldParts;
|
|
129
128
|
};
|
|
130
|
-
export declare function readParts(value: unknown): RoomDraftParts;
|
|
129
|
+
export declare function readParts(value: unknown, path: string): RoomDraftParts;
|
|
131
130
|
export declare function gatheredParts(earlier: unknown, later: unknown): unknown;
|
|
132
131
|
export declare function held(current: HeldParts | undefined, parts: RoomDraftParts, file?: HeldFile): HeldParts;
|
|
133
132
|
export declare function underneath(parts: HeldParts, path: string, visible: VisibleLayer | undefined): ChangedUnderneath;
|
|
134
133
|
export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
|
|
135
134
|
export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
|
|
136
135
|
export declare function changedParts(path: string, parts: HeldParts, visible: VisibleLayer | undefined): readonly ChangedPart[];
|
|
136
|
+
export declare function lineEnded(text: string): string;
|
|
137
137
|
export type TextParts = {
|
|
138
138
|
readonly fields?: Readonly<Record<string, {
|
|
139
139
|
readonly value: unknown;
|
|
@@ -145,8 +145,8 @@ export type TextParts = {
|
|
|
145
145
|
readonly value: string;
|
|
146
146
|
};
|
|
147
147
|
};
|
|
148
|
-
export declare function partsAfter(markdown: string, parts: TextParts): string;
|
|
149
|
-
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts): HeldParts;
|
|
148
|
+
export declare function partsAfter(markdown: string, parts: TextParts, definitions?: DefinitionOf): string | null;
|
|
149
|
+
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts, definitions?: DefinitionOf): HeldParts | null;
|
|
150
150
|
export declare function moveTarget(move: {
|
|
151
151
|
readonly to: string;
|
|
152
152
|
}): string;
|
|
@@ -168,6 +168,5 @@ export declare function changesOf(path: string, parts: HeldParts): {
|
|
|
168
168
|
changes: readonly Change[];
|
|
169
169
|
bases: readonly Precondition[];
|
|
170
170
|
};
|
|
171
|
-
export declare function joinedDraft(carried: SavedDraft, saved: readonly SavedDraft[]): SavedDraft;
|
|
172
171
|
export declare function withdrawnDrafts(drafts: readonly SavedDraft[], changes: readonly Change[]): readonly SavedDraft[];
|
|
173
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,35 @@
|
|
|
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 { Retries } from './retried.js';
|
|
13
|
+
import type { RuntimeSocket } from './socket.js';
|
|
14
|
+
import type { HeldCover, Store } from './store.js';
|
|
15
|
+
import type { schemaTypes } from './attached-model.js';
|
|
16
|
+
export type Runtime = {
|
|
17
|
+
readonly store: Store;
|
|
18
|
+
readonly socket: RuntimeSocket;
|
|
19
|
+
readonly presence: Presence;
|
|
20
|
+
readonly journal: Log;
|
|
21
|
+
readonly recovery: Recovery;
|
|
22
|
+
readonly retries: Retries;
|
|
23
|
+
readonly shell: RuntimeShell;
|
|
24
|
+
readonly localSaves: boolean;
|
|
25
|
+
readonly roomTypes: Parameters<typeof schemaTypes>[1];
|
|
26
|
+
readonly builtIn: ModelState;
|
|
27
|
+
readonly typedPaths: readonly TypedPath[];
|
|
28
|
+
readonly writeRule: (declaration: RoomDeclaration) => WriteRule;
|
|
29
|
+
readonly usableWhenHeld: readonly string[];
|
|
30
|
+
readonly build: string;
|
|
31
|
+
readonly conversations: LiveConversations;
|
|
32
|
+
readonly liveQueries: LiveQueries<HeldCover>;
|
|
33
|
+
readonly figures: FiguresRead;
|
|
34
|
+
readonly lastAnswers: ReadAnswers;
|
|
35
|
+
};
|
package/dist/mdruntime/save.d.ts
CHANGED
|
@@ -1,102 +1,58 @@
|
|
|
1
1
|
import { type Validation } from '../mdmodel/index.js';
|
|
2
|
-
import type {
|
|
3
|
-
import { type
|
|
2
|
+
import type { ProviderLimit } from './adapter.js';
|
|
3
|
+
import { type ChangeBatch, type WrittenBy } from './change.js';
|
|
4
4
|
import { type Composition } from './collection.js';
|
|
5
|
+
import type { WriteRule } from './declaration.js';
|
|
5
6
|
import { type Layer } from './overlay.js';
|
|
6
|
-
import type { VisibleLayer } from './replica.js';
|
|
7
|
-
import type
|
|
7
|
+
import type { ReplicaRecord, VisibleLayer } from './replica.js';
|
|
8
|
+
import { type ChangedPart, type RoomDraftRecord, type SavedDraft } from './room-draft.js';
|
|
8
9
|
export type SaveRefusal = {
|
|
9
10
|
code: string;
|
|
10
11
|
retryable: boolean;
|
|
11
12
|
file?: string;
|
|
12
13
|
location?: string;
|
|
14
|
+
line?: number;
|
|
13
15
|
referrers?: readonly string[];
|
|
14
16
|
parts?: readonly ChangedPart[];
|
|
15
17
|
};
|
|
16
|
-
export type
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
providerLimits: readonly ProviderLimit[];
|
|
23
|
-
visible: VisibleLayer;
|
|
24
|
-
folders: ReadonlySet<string>;
|
|
25
|
-
handle: string;
|
|
26
|
-
changes: readonly Change[];
|
|
27
|
-
bases: readonly Precondition[];
|
|
28
|
-
queued?: ReadonlySet<string>;
|
|
29
|
-
writtenBy?: WrittenBy;
|
|
30
|
-
unmodeled: boolean;
|
|
31
|
-
validate: Validator;
|
|
18
|
+
export type SaveAsk = {
|
|
19
|
+
readonly saved: readonly SavedDraft[];
|
|
20
|
+
readonly consumed: ReadonlySet<string>;
|
|
21
|
+
readonly writtenBy?: WrittenBy;
|
|
22
|
+
readonly local: boolean;
|
|
23
|
+
readonly providerLimits: readonly ProviderLimit[];
|
|
32
24
|
};
|
|
33
|
-
export type
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
export type SavingRoom = {
|
|
26
|
+
readonly record: ReplicaRecord;
|
|
27
|
+
readonly rule: WriteRule;
|
|
28
|
+
readonly composition: Composition;
|
|
29
|
+
readonly queue: readonly ChangeBatch[];
|
|
30
|
+
readonly changeable: ReadonlySet<string>;
|
|
31
|
+
readonly saved: ReadonlyMap<string, readonly SavedDraft[]>;
|
|
32
|
+
readonly replay: (queue: readonly ChangeBatch[]) => Generator<number, VisibleLayer, void>;
|
|
33
|
+
readonly folders: ReadonlySet<string>;
|
|
34
|
+
readonly modelled: boolean;
|
|
35
|
+
readonly drafts: ReadonlyMap<string, RoomDraftRecord>;
|
|
36
|
+
readonly validate: Validator;
|
|
37
37
|
};
|
|
38
|
-
export type
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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>;
|
|
47
|
-
export type Requeued = {
|
|
48
|
-
kind: 'requeued';
|
|
49
|
-
queue: readonly ChangeBatch[];
|
|
50
|
-
changes: readonly Change[];
|
|
51
|
-
queued: ReadonlySet<string>;
|
|
52
|
-
withdrawn: ReadonlyMap<string, ChangeBatch | null>;
|
|
53
|
-
owners: ReadonlySet<string>;
|
|
54
|
-
} | {
|
|
55
|
-
kind: 'refused';
|
|
56
|
-
refusal: SaveRefusal;
|
|
38
|
+
export type PlannedRoom = {
|
|
39
|
+
readonly locator: string;
|
|
40
|
+
readonly queue: readonly ChangeBatch[];
|
|
41
|
+
readonly saved: ReadonlyMap<string, readonly SavedDraft[]>;
|
|
42
|
+
readonly consumed: readonly string[];
|
|
43
|
+
readonly carried: readonly RoomDraftRecord[];
|
|
57
44
|
};
|
|
58
|
-
export type
|
|
59
|
-
kind: '
|
|
60
|
-
|
|
61
|
-
queue: readonly ChangeBatch[];
|
|
45
|
+
export type SavePlan = {
|
|
46
|
+
readonly kind: 'refused';
|
|
47
|
+
readonly refusal: SaveRefusal;
|
|
62
48
|
} | {
|
|
63
|
-
kind: '
|
|
64
|
-
|
|
65
|
-
|
|
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>;
|
|
68
|
-
export declare function joined(queue: readonly ChangeBatch[], owner: ChangeBatch, extra: ChangeBatch): Joining;
|
|
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;
|
|
49
|
+
readonly kind: 'planned';
|
|
50
|
+
readonly identifier: string;
|
|
51
|
+
readonly rooms: readonly PlannedRoom[];
|
|
83
52
|
};
|
|
84
|
-
export type
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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 {};
|
|
53
|
+
export type Validator = (resulting: Layer, touched: readonly string[]) => Promise<Validation>;
|
|
54
|
+
export declare function providerRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
55
|
+
export declare function rewriting(batch: ChangeBatch, locator: string): boolean;
|
|
56
|
+
export declare function effectiveIn(batch: ChangeBatch, locator: string, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
|
|
57
|
+
export declare function destination(locator: string, saved: readonly SavedDraft[]): string | null;
|
|
58
|
+
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,72 +1,21 @@
|
|
|
1
|
-
import type { ProviderRefusal } from './adapter.js';
|
|
2
|
-
import
|
|
3
|
-
import type { Open } from './open.js';
|
|
4
|
-
export type DocumentPart = Open<'fields' | 'sections' | 'preamble' | 'path'>;
|
|
1
|
+
import type { ProviderRefusal, SearchHit } from './adapter.js';
|
|
2
|
+
import type { Failure, Offline } from './outcome.js';
|
|
5
3
|
export type SearchRequest = {
|
|
6
4
|
text: string;
|
|
7
|
-
|
|
8
|
-
collection?: true;
|
|
9
|
-
conversations?: readonly string[];
|
|
10
|
-
limit?: number;
|
|
11
|
-
after?: string;
|
|
12
|
-
total?: true;
|
|
5
|
+
rooms?: readonly string[];
|
|
13
6
|
};
|
|
14
|
-
export type
|
|
15
|
-
export type
|
|
16
|
-
|
|
17
|
-
|
|
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[];
|
|
7
|
+
export type { SearchHit } from './adapter.js';
|
|
8
|
+
export type SearchFound = {
|
|
9
|
+
kind: 'found';
|
|
10
|
+
documents: readonly SearchHit[];
|
|
39
11
|
};
|
|
40
|
-
export type
|
|
41
|
-
|
|
42
|
-
|
|
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 & {
|
|
12
|
+
export type SearchResult = SearchFound | Offline | (ProviderRefusal & {
|
|
13
|
+
kind: 'rejected';
|
|
14
|
+
}) | (ProviderRefusal & {
|
|
56
15
|
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;
|
|
16
|
+
}) | Failure;
|
|
63
17
|
export type SearchPlan = {
|
|
64
18
|
text: string;
|
|
65
|
-
|
|
66
|
-
collection: boolean;
|
|
67
|
-
conversations: readonly string[] | null;
|
|
68
|
-
limit: number | null;
|
|
69
|
-
after: readonly [HitCursor, HitCursor] | null;
|
|
70
|
-
total: boolean;
|
|
19
|
+
rooms: readonly string[] | null;
|
|
71
20
|
};
|
|
72
21
|
export declare function searchPlanOf(input: unknown): SearchPlan;
|
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,27 @@
|
|
|
1
|
+
import type { CallResult } from '../outcome.js';
|
|
2
|
+
export type Live = () => boolean;
|
|
3
|
+
export type KeptSender = {
|
|
4
|
+
next(): Promise<CallResult>;
|
|
5
|
+
};
|
|
6
|
+
type LaneRules = {
|
|
7
|
+
generation(): number;
|
|
8
|
+
continuing(): boolean;
|
|
9
|
+
stopping(): boolean;
|
|
10
|
+
failed(locator: string, error: unknown): void;
|
|
11
|
+
};
|
|
12
|
+
export type Lanes = {
|
|
13
|
+
task(lane: string, work: (live: Live) => Promise<void>): Promise<void>;
|
|
14
|
+
inRoom<T>(locator: string, work: (live: Live) => Promise<T>): Promise<T>;
|
|
15
|
+
roomTask(locator: string, work: (live: Live) => Promise<void>): Promise<void>;
|
|
16
|
+
roomWork(): number;
|
|
17
|
+
current(): Promise<unknown>;
|
|
18
|
+
finished(): Promise<unknown>;
|
|
19
|
+
sender(operation: string): KeptSender | undefined;
|
|
20
|
+
sending(operation: string, sender: KeptSender): void;
|
|
21
|
+
sent(operation: string, sender: KeptSender): void;
|
|
22
|
+
settled(operation: string): Promise<void>;
|
|
23
|
+
settle(operation: string, lost: boolean): void;
|
|
24
|
+
unclaimed(operation: string): boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare function createLanes({ generation, continuing, stopping, failed }: LaneRules): Lanes;
|
|
27
|
+
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,67 @@
|
|
|
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 { Retries } from './retried.js';
|
|
6
|
+
import { type Admission } from './socket/admission.js';
|
|
7
|
+
import { type Answers } from './socket/answers.js';
|
|
8
|
+
import { type Lanes } from './socket/lanes.js';
|
|
9
|
+
import { type Session } from './socket/session.js';
|
|
10
|
+
export type { KeptSender, Live } from './socket/lanes.js';
|
|
11
|
+
export type { ConnectionRefusal, ConnectionRefusalCode, Moving, RefusalReason, } from './socket/session.js';
|
|
12
|
+
type SocketEvent = {
|
|
13
|
+
readonly kind: 'opened';
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'discovered';
|
|
16
|
+
readonly discovery: Discovery;
|
|
17
|
+
readonly missed: boolean;
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: 'closed';
|
|
20
|
+
readonly revoked: boolean;
|
|
21
|
+
readonly lost: boolean;
|
|
22
|
+
readonly opened: boolean;
|
|
23
|
+
} | Exclude<RoomStreamEvent, {
|
|
24
|
+
kind: 'opened' | 'discovered' | 'closed';
|
|
25
|
+
}>;
|
|
26
|
+
export type RuntimeSocket = Admission & Answers & {
|
|
27
|
+
readonly reads: Reads;
|
|
28
|
+
readonly streamed: boolean;
|
|
29
|
+
readonly session: Cell<Session>;
|
|
30
|
+
readonly lanes: Lanes;
|
|
31
|
+
readonly ready: Promise<void>;
|
|
32
|
+
readonly firstDiscovery: Promise<void>;
|
|
33
|
+
conversations(): Adapter['conversations'];
|
|
34
|
+
search(): Adapter['search'];
|
|
35
|
+
discover(authorized: Authorization): ReturnType<NonNullable<Adapter['discover']>> | undefined;
|
|
36
|
+
follows: Adapter['follows'];
|
|
37
|
+
mutate: Adapter['mutate'];
|
|
38
|
+
binary: Adapter['binary'];
|
|
39
|
+
link: Adapter['link'];
|
|
40
|
+
attach: Adapter['attach'];
|
|
41
|
+
history: Adapter['history'];
|
|
42
|
+
action: Adapter['action'];
|
|
43
|
+
authorize(): Promise<void>;
|
|
44
|
+
observe(listen: (event: SocketEvent) => void): void;
|
|
45
|
+
observeConversations(listen: (event: ConversationEvent) => void): void;
|
|
46
|
+
observeServiceMode(listen: (mode: ServiceMode) => void): void;
|
|
47
|
+
close(): void;
|
|
48
|
+
readyFromStore(): void;
|
|
49
|
+
notifyReady(): void;
|
|
50
|
+
closed(): boolean;
|
|
51
|
+
stopping(): boolean;
|
|
52
|
+
continuing(): boolean;
|
|
53
|
+
reached(): boolean;
|
|
54
|
+
writesHeld(): boolean;
|
|
55
|
+
haltedSince(opens: number): boolean;
|
|
56
|
+
isOpen(): boolean;
|
|
57
|
+
isAnnounced(): boolean;
|
|
58
|
+
isHanded(): boolean;
|
|
59
|
+
generation(): number;
|
|
60
|
+
naming(): boolean;
|
|
61
|
+
hand(rooms: readonly HeldRoom[]): void;
|
|
62
|
+
name(room: HeldRoom): void;
|
|
63
|
+
named(): void;
|
|
64
|
+
abortReads(): void;
|
|
65
|
+
stopReads(): void;
|
|
66
|
+
};
|
|
67
|
+
export declare function createSocket(adapter: Adapter, journal: Log, retries: Retries, authorization: Authorization | undefined): RuntimeSocket;
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
type RequestAgentFunction = {
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly version: number;
|
|
51
|
+
};
|
|
52
|
+
export declare function sourceOf(value: unknown, sender: string | null): HouseSource | null;
|
|
53
|
+
export {};
|
|
@@ -22,6 +22,4 @@ export type CycleProgress = {
|
|
|
22
22
|
reachable: boolean;
|
|
23
23
|
};
|
|
24
24
|
export declare const STARTING: SyncStatus;
|
|
25
|
-
export declare function transferring(status: SyncStatus): SyncStatus;
|
|
26
|
-
export declare function saving(status: SyncStatus): SyncStatus;
|
|
27
25
|
export declare function same(one: SyncStatus, other: SyncStatus): boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { InstallationAmount } from '../readiness.js';
|
|
2
|
+
import type { TransferRecord } from './records.js';
|
|
3
|
+
type OwedIndex = {
|
|
4
|
+
readonly bytes: number;
|
|
5
|
+
readonly text: number;
|
|
6
|
+
};
|
|
7
|
+
export type RoomInstall = {
|
|
8
|
+
readonly transfer: TransferRecord | null;
|
|
9
|
+
readonly arrived: number | null;
|
|
10
|
+
readonly streaming: boolean;
|
|
11
|
+
readonly underived: number;
|
|
12
|
+
readonly unindexed: readonly OwedIndex[];
|
|
13
|
+
readonly startedOver: InstallationAmount | null;
|
|
14
|
+
readonly installing: boolean;
|
|
15
|
+
readonly catching: boolean;
|
|
16
|
+
readonly highest: string | null;
|
|
17
|
+
readonly beyondHorizon: boolean;
|
|
18
|
+
readonly confirmations: number;
|
|
19
|
+
};
|
|
20
|
+
export declare const NO_INSTALL: RoomInstall;
|
|
21
|
+
export type Installs = {
|
|
22
|
+
of(locator: string): RoomInstall;
|
|
23
|
+
change(locator: string, next: (held: RoomInstall) => RoomInstall): void;
|
|
24
|
+
underway(): ReadonlySet<string>;
|
|
25
|
+
transferring(): readonly string[];
|
|
26
|
+
arrivalDue(now: number, everyMs: number): boolean;
|
|
27
|
+
};
|
|
28
|
+
export declare function createInstalls(): Installs;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ReadinessQueue<W> = {
|
|
2
|
+
add(watch: W): () => void;
|
|
3
|
+
held(watch: W): boolean;
|
|
4
|
+
changed(watch: W, reading: string): boolean;
|
|
5
|
+
owe(watches: readonly W[]): void;
|
|
6
|
+
queue(): void;
|
|
7
|
+
close(): void;
|
|
8
|
+
};
|
|
9
|
+
export declare function createReadinessQueue<W>(deliver: (owed: readonly W[]) => Promise<void>, unpublished: (error: unknown) => void): ReadinessQueue<W>;
|