@agentshouse/app-bridge 0.1.0-c8d8dc6285bbd → 0.1.0-c8eb04e6114fb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/index.d.ts +910 -18
- package/dist/mdmodel/definition.d.ts +1 -1
- package/dist/mdmodel/document.d.ts +2 -1
- package/dist/mdmodel/event.d.ts +77 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/index.d.ts +19 -6
- package/dist/mdmodel/kinds.d.ts +18 -0
- package/dist/mdmodel/pattern.d.ts +9 -0
- package/dist/mdmodel/query/language.d.ts +253 -0
- package/dist/mdmodel/query/match.d.ts +13 -0
- package/dist/mdmodel/query/rows.d.ts +31 -0
- package/dist/mdmodel/query/sql.d.ts +38 -0
- package/dist/mdmodel/reserved.d.ts +4 -0
- package/dist/mdmodel/types.d.ts +11 -0
- package/dist/mdmodel/validate.d.ts +7 -5
- package/dist/mdruntime/actions.d.ts +19 -0
- package/dist/mdruntime/adapter.d.ts +107 -71
- package/dist/mdruntime/attached-model.d.ts +7 -0
- package/dist/mdruntime/bootstrap.d.ts +43 -0
- package/dist/mdruntime/cell.d.ts +5 -0
- package/dist/mdruntime/chain.d.ts +2 -1
- package/dist/mdruntime/change.d.ts +1 -0
- package/dist/mdruntime/client.d.ts +25 -10
- package/dist/mdruntime/collection.d.ts +7 -4
- package/dist/mdruntime/compile.d.ts +6 -6
- package/dist/mdruntime/conversation-live.d.ts +135 -0
- package/dist/mdruntime/conversation-row.d.ts +32 -0
- package/dist/mdruntime/conversation.d.ts +41 -45
- package/dist/mdruntime/durability.d.ts +15 -1
- package/dist/mdruntime/figures.d.ts +48 -0
- package/dist/mdruntime/holdings.d.ts +28 -0
- package/dist/mdruntime/identity.d.ts +0 -1
- package/dist/mdruntime/install.d.ts +55 -0
- package/dist/mdruntime/job.d.ts +32 -0
- package/dist/mdruntime/listing.d.ts +52 -0
- package/dist/mdruntime/live.d.ts +22 -0
- package/dist/mdruntime/log.d.ts +5 -0
- package/dist/mdruntime/media.d.ts +7 -0
- package/dist/mdruntime/messages.d.ts +27 -3
- package/dist/mdruntime/model.d.ts +8 -10
- package/dist/mdruntime/observation.d.ts +3 -2
- package/dist/mdruntime/outcome.d.ts +17 -6
- package/dist/mdruntime/overlay.d.ts +1 -0
- package/dist/mdruntime/preparation.d.ts +19 -0
- package/dist/mdruntime/query.d.ts +18 -207
- package/dist/mdruntime/reach.d.ts +20 -11
- package/dist/mdruntime/readiness.d.ts +3 -18
- package/dist/mdruntime/reads.d.ts +36 -0
- package/dist/mdruntime/recovery.d.ts +1 -0
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +11 -12
- package/dist/mdruntime/room-draft.d.ts +21 -5
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +42 -0
- package/dist/mdruntime/save.d.ts +7 -1
- package/dist/mdruntime/saves.d.ts +69 -0
- package/dist/mdruntime/search.d.ts +12 -63
- package/dist/mdruntime/seed.d.ts +11 -2
- package/dist/mdruntime/socket/admission.d.ts +6 -0
- package/dist/mdruntime/socket/answers.d.ts +5 -0
- package/dist/mdruntime/socket/lanes.d.ts +19 -0
- package/dist/mdruntime/socket/rooms.d.ts +43 -0
- package/dist/mdruntime/socket/session.d.ts +38 -0
- package/dist/mdruntime/socket.d.ts +69 -0
- package/dist/mdruntime/source.d.ts +60 -0
- package/dist/mdruntime/status.d.ts +4 -5
- package/dist/mdruntime/store/fences.d.ts +15 -0
- package/dist/mdruntime/store/installs.d.ts +29 -0
- package/dist/mdruntime/store/readiness.d.ts +9 -0
- package/dist/mdruntime/store/records.d.ts +211 -0
- package/dist/mdruntime/store/room-held.d.ts +7 -0
- package/dist/mdruntime/store/space.d.ts +10 -0
- package/dist/mdruntime/store/watchers.d.ts +16 -0
- package/dist/mdruntime/store/writes.d.ts +23 -0
- package/dist/mdruntime/store.d.ts +105 -158
- package/dist/mdruntime/stored.d.ts +66 -55
- package/dist/mdruntime/surface.d.ts +87 -0
- package/dist/mdruntime/tables.d.ts +131 -69
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +0 -5
- package/dist/mdruntime/turn.d.ts +8 -0
- package/dist/mdruntime/wire.d.ts +25 -9
- package/dist/test-host.d.ts +1 -4
- package/dist/test-host.js +2 -28
- package/docs/families.md +48 -52
- package/package.json +1 -1
- package/dist/calls.d.ts +0 -1007
- package/dist/calls.js +0 -1
- package/dist/mdmodel/condition.d.ts +0 -160
- package/dist/mdruntime/connection.d.ts +0 -151
- package/dist/mdruntime/file.d.ts +0 -11
- package/dist/mdruntime/fulltext.d.ts +0 -26
- package/dist/mdruntime/shared.d.ts +0 -15
|
@@ -40,6 +40,7 @@ export type RoomDraftParts = {
|
|
|
40
40
|
};
|
|
41
41
|
readonly file?: {
|
|
42
42
|
readonly blob: Blob;
|
|
43
|
+
readonly base?: string | null;
|
|
43
44
|
};
|
|
44
45
|
};
|
|
45
46
|
export type HeldFile = {
|
|
@@ -89,9 +90,9 @@ type ChangedUnderneath = {
|
|
|
89
90
|
readonly file?: string | null;
|
|
90
91
|
};
|
|
91
92
|
export type ReturnReason = ProviderRefusal & {
|
|
92
|
-
readonly kind: Open<'conflicted' | 'rejected' | '
|
|
93
|
+
readonly kind: Open<'conflicted' | 'rejected' | 'withdrawn'>;
|
|
93
94
|
};
|
|
94
|
-
export declare function returnedBy(
|
|
95
|
+
export declare function returnedBy(): ReturnReason;
|
|
95
96
|
export type RoomDraft = {
|
|
96
97
|
readonly room: string;
|
|
97
98
|
readonly path: string;
|
|
@@ -112,7 +113,7 @@ export type RoomDraftWrite = {
|
|
|
112
113
|
export declare function staleWrite(current: RoomDraft | null): RoomDraftWrite;
|
|
113
114
|
export type ChangedPart = {
|
|
114
115
|
readonly path: string;
|
|
115
|
-
readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | '
|
|
116
|
+
readonly part: Open<'field' | 'section' | 'preamble' | 'markdown' | 'move' | 'removal' | 'file'>;
|
|
116
117
|
readonly name?: string;
|
|
117
118
|
};
|
|
118
119
|
export type RoomDraftRecord = {
|
|
@@ -126,13 +127,14 @@ export type SavedDraft = {
|
|
|
126
127
|
readonly path: string;
|
|
127
128
|
readonly parts: HeldParts;
|
|
128
129
|
};
|
|
129
|
-
export declare function readParts(value: unknown): RoomDraftParts;
|
|
130
|
+
export declare function readParts(value: unknown, path: string): RoomDraftParts;
|
|
130
131
|
export declare function gatheredParts(earlier: unknown, later: unknown): unknown;
|
|
131
132
|
export declare function held(current: HeldParts | undefined, parts: RoomDraftParts, file?: HeldFile): HeldParts;
|
|
132
133
|
export declare function underneath(parts: HeldParts, path: string, visible: VisibleLayer | undefined): ChangedUnderneath;
|
|
133
134
|
export declare function heldFile(blob: Blob, base: string | null): Promise<HeldFile>;
|
|
134
135
|
export declare function binaryBase(visible: VisibleLayer | undefined, path: string): string | null;
|
|
135
|
-
export declare function changedParts(path: string,
|
|
136
|
+
export declare function changedParts(path: string, parts: HeldParts, visible: VisibleLayer | undefined): readonly ChangedPart[];
|
|
137
|
+
export declare function lineEnded(text: string): string;
|
|
136
138
|
export type TextParts = {
|
|
137
139
|
readonly fields?: Readonly<Record<string, {
|
|
138
140
|
readonly value: unknown;
|
|
@@ -149,6 +151,20 @@ export declare function returnedInto(existing: HeldParts | undefined, returned:
|
|
|
149
151
|
export declare function moveTarget(move: {
|
|
150
152
|
readonly to: string;
|
|
151
153
|
}): string;
|
|
154
|
+
export declare function readSavedParts(named: readonly {
|
|
155
|
+
readonly path: string;
|
|
156
|
+
readonly parts: unknown;
|
|
157
|
+
}[]): readonly {
|
|
158
|
+
readonly path: string;
|
|
159
|
+
readonly parts: RoomDraftParts;
|
|
160
|
+
}[];
|
|
161
|
+
export declare function partsChanges(named: readonly {
|
|
162
|
+
readonly path: string;
|
|
163
|
+
readonly parts: unknown;
|
|
164
|
+
}[]): {
|
|
165
|
+
readonly changes: readonly Change[];
|
|
166
|
+
readonly preconditions: readonly Precondition[];
|
|
167
|
+
};
|
|
152
168
|
export declare function changesOf(path: string, parts: HeldParts): {
|
|
153
169
|
changes: readonly Change[];
|
|
154
170
|
bases: readonly Precondition[];
|
|
@@ -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,42 @@
|
|
|
1
|
+
import type { Authorization, DiscoveredRoom, PathRule, ScopedRefusal, TypedPath } from './adapter.js';
|
|
2
|
+
import type { ChangeSet } from './change-set.js';
|
|
3
|
+
import type { ChangeBatch } from './change.js';
|
|
4
|
+
import type { RuntimeShell } from './durability.js';
|
|
5
|
+
import type { LiveConversations } from './conversation-live.js';
|
|
6
|
+
import type { FiguresRead } from './figures.js';
|
|
7
|
+
import type { Withheld } from './install.js';
|
|
8
|
+
import type { LiveQueries } from './live.js';
|
|
9
|
+
import type { Log } from './log.js';
|
|
10
|
+
import type { ModelState } from './model.js';
|
|
11
|
+
import type { ReadAnswers } from './reads.js';
|
|
12
|
+
import type { Recovery } from './recovery.js';
|
|
13
|
+
import type { ReplicaRecord } from './replica.js';
|
|
14
|
+
import type { RuntimeSocket, RoomDeclaration } from './socket.js';
|
|
15
|
+
import type { CycleProgress } from './status.js';
|
|
16
|
+
import type { Settling } from './saves.js';
|
|
17
|
+
import type { HeldCover, RuntimeStore, Store, Work } from './store.js';
|
|
18
|
+
import type { schemaTypes } from './attached-model.js';
|
|
19
|
+
export type Runtime = {
|
|
20
|
+
readonly store: Store;
|
|
21
|
+
readonly socket: RuntimeSocket;
|
|
22
|
+
readonly journal: Log;
|
|
23
|
+
readonly recovery: Recovery;
|
|
24
|
+
readonly shell: RuntimeShell;
|
|
25
|
+
readonly localSaves: boolean;
|
|
26
|
+
readonly roomTypes: Parameters<typeof schemaTypes>[1];
|
|
27
|
+
readonly builtIn: ModelState;
|
|
28
|
+
readonly typedPaths: readonly TypedPath[];
|
|
29
|
+
readonly pathRule: PathRule;
|
|
30
|
+
readonly usableWhenHeld: readonly string[];
|
|
31
|
+
readonly build: string;
|
|
32
|
+
readonly conversations: LiveConversations;
|
|
33
|
+
readonly liveQueries: LiveQueries<HeldCover>;
|
|
34
|
+
readonly figures: FiguresRead;
|
|
35
|
+
readonly lastAnswers: ReadAnswers;
|
|
36
|
+
settle(local: RuntimeStore, locator: string, work: Work, record: ReplicaRecord, queue: readonly ChangeBatch[], settling?: Settling): Promise<ChangeSet>;
|
|
37
|
+
scoped(result: ScopedRefusal, room: RoomDeclaration, local: RuntimeStore): Promise<void>;
|
|
38
|
+
submitLater(locator: string): void;
|
|
39
|
+
unpair(local: RuntimeStore): Promise<void>;
|
|
40
|
+
advanced(room: DiscoveredRoom, local: RuntimeStore, authorized: Authorization): Promise<Withheld | null>;
|
|
41
|
+
withhold(withheld: Withheld, room: DiscoveredRoom, local: RuntimeStore, progress: CycleProgress): Promise<void>;
|
|
42
|
+
};
|
package/dist/mdruntime/save.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Validation } from '../mdmodel/index.js';
|
|
2
|
-
import type { OperationScopes, ProviderLimit } from './adapter.js';
|
|
2
|
+
import type { OperationScopes, PathRule, ProviderLimit } from './adapter.js';
|
|
3
3
|
import { type Change, type ChangeBatch, type Precondition, type WrittenBy } from './change.js';
|
|
4
4
|
import { type Composition } from './collection.js';
|
|
5
5
|
import { type Layer } from './overlay.js';
|
|
@@ -19,8 +19,11 @@ export type SaveInput = {
|
|
|
19
19
|
baseRoomVersion: string;
|
|
20
20
|
operations: import('./adapter.js').OperationScopes;
|
|
21
21
|
providerOwnedPaths: readonly string[];
|
|
22
|
+
authoredPaths?: readonly string[];
|
|
22
23
|
providerLimits: readonly ProviderLimit[];
|
|
24
|
+
pathRule: PathRule;
|
|
23
25
|
visible: VisibleLayer;
|
|
26
|
+
folders: ReadonlySet<string>;
|
|
24
27
|
handle: string;
|
|
25
28
|
changes: readonly Change[];
|
|
26
29
|
bases: readonly Precondition[];
|
|
@@ -74,7 +77,9 @@ export type MoveSide = {
|
|
|
74
77
|
composition: Composition;
|
|
75
78
|
operations: OperationScopes;
|
|
76
79
|
providerOwnedPaths: readonly string[];
|
|
80
|
+
authoredPaths?: readonly string[];
|
|
77
81
|
visible: VisibleLayer;
|
|
82
|
+
folders: ReadonlySet<string>;
|
|
78
83
|
queued: ReadonlySet<string>;
|
|
79
84
|
unmodeled: boolean;
|
|
80
85
|
validate: Validator;
|
|
@@ -87,6 +92,7 @@ export type MoveInput = {
|
|
|
87
92
|
readonly to: string;
|
|
88
93
|
}[];
|
|
89
94
|
providerLimits: readonly ProviderLimit[];
|
|
95
|
+
pathRule: PathRule;
|
|
90
96
|
local: boolean;
|
|
91
97
|
writtenBy?: WrittenBy;
|
|
92
98
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type ChangeSet } from './change-set.js';
|
|
2
|
+
import { type ChangeBatch, type WrittenBy } from './change.js';
|
|
3
|
+
import { type AttachAnswer, type BinaryLinkAnswer, type HeldBinaryAnswer, type HeldShownAnswer } from './outcome.js';
|
|
4
|
+
import { type HeldReplica, type ReplicaRecord, type Slice, type VisibleLayer } from './replica.js';
|
|
5
|
+
import { type ReturnReason, type RoomDraftParts } from './room-draft.js';
|
|
6
|
+
import type { Runtime } from './runtime.js';
|
|
7
|
+
import { type SaveRefusal } from './save.js';
|
|
8
|
+
import type { AuthoredWrite, CommittedWrite, PendingState, RoomCommit, RuntimeStore, Store, StoredEntry, View, Work } from './store.js';
|
|
9
|
+
export type SaveResult = {
|
|
10
|
+
outcome: 'saved';
|
|
11
|
+
identifier: string;
|
|
12
|
+
} | ({
|
|
13
|
+
outcome: 'refused';
|
|
14
|
+
} & SaveRefusal);
|
|
15
|
+
export type SavedRoomDraft = {
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly revision: string;
|
|
18
|
+
};
|
|
19
|
+
export type SavedParts = {
|
|
20
|
+
readonly path: string;
|
|
21
|
+
readonly parts: RoomDraftParts;
|
|
22
|
+
};
|
|
23
|
+
export type BinaryFileSurface = {
|
|
24
|
+
read(room: string, path: string, revision?: string): Promise<HeldBinaryAnswer>;
|
|
25
|
+
link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
|
|
26
|
+
show(room: string, path: string, revision?: string): Promise<HeldShownAnswer>;
|
|
27
|
+
attach(room: string, file: File): Promise<AttachAnswer>;
|
|
28
|
+
part(file: string, part: number): Promise<Uint8Array | null>;
|
|
29
|
+
};
|
|
30
|
+
export type Leaving = {
|
|
31
|
+
batch: ChangeBatch;
|
|
32
|
+
returned: ReturnReason | null;
|
|
33
|
+
};
|
|
34
|
+
export declare function withdrawable(states: ReadonlyMap<string, PendingState>): (batch: ChangeBatch) => boolean;
|
|
35
|
+
export declare function sliceAt(store: Store, record: ReplicaRecord, view: View, queue: readonly ChangeBatch[], extra?: Iterable<string>, moved?: Iterable<string>): Promise<Slice>;
|
|
36
|
+
export declare function landedWhole(store: Store, locator: string, batch: ChangeBatch, confirmedLayer: Slice, current?: Readonly<Record<string, string>>): Promise<boolean>;
|
|
37
|
+
export type Settling = {
|
|
38
|
+
leaving?: readonly Leaving[];
|
|
39
|
+
room?: boolean;
|
|
40
|
+
view?: View;
|
|
41
|
+
commit?: Pick<RoomCommit, 'published' | 'refreshed'>;
|
|
42
|
+
changes?: {
|
|
43
|
+
readonly set: readonly StoredEntry[];
|
|
44
|
+
readonly removed: readonly string[];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export declare function preparedAfter(runtime: Runtime, locator: string, answer: CommittedWrite): void;
|
|
48
|
+
export declare function replayed(store: Store, record: ReplicaRecord, confirmedLayer: Slice, queue: readonly ChangeBatch[]): import("./turn.js").Later<import("./replica.js").Replayed>;
|
|
49
|
+
export declare function overlayDiff(record: ReplicaRecord, before: HeldReplica | undefined, visible: VisibleLayer, touched: ReadonlySet<string>): Promise<{
|
|
50
|
+
overlay: NonNullable<RoomCommit['overlay']>;
|
|
51
|
+
touched: ReadonlySet<string>;
|
|
52
|
+
}>;
|
|
53
|
+
export type Settlement = {
|
|
54
|
+
readonly locator: string;
|
|
55
|
+
readonly left: readonly ChangeBatch[];
|
|
56
|
+
readonly commit: {
|
|
57
|
+
readonly rooms: readonly RoomCommit[];
|
|
58
|
+
readonly writes: readonly AuthoredWrite[];
|
|
59
|
+
};
|
|
60
|
+
apply(answer: CommittedWrite): ChangeSet;
|
|
61
|
+
};
|
|
62
|
+
export declare function settle(runtime: Runtime, local: RuntimeStore, locator: string, work: Work, record: ReplicaRecord, queue: readonly ChangeBatch[], settling?: Settling): Promise<ChangeSet>;
|
|
63
|
+
export declare function together(runtime: Runtime, local: RuntimeStore, settlements: readonly Settlement[]): Promise<ChangeSet>;
|
|
64
|
+
export declare function settlement(runtime: Runtime, local: RuntimeStore, locator: string, work: Work, record: ReplicaRecord, queue: readonly ChangeBatch[], settling?: Settling): Promise<Settlement>;
|
|
65
|
+
export declare function unpairing(runtime: Runtime, local: RuntimeStore, locator: string, batches: readonly ChangeBatch[]): Promise<Settlement>;
|
|
66
|
+
export declare function saveRoomDrafts(runtime: Runtime, locator: string, named: readonly SavedRoomDraft[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
|
|
67
|
+
export declare function saveParts(runtime: Runtime, locator: string, named: readonly SavedParts[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
|
|
68
|
+
export declare function batchFile(store: Store, batch: ChangeBatch): (localId: string) => Promise<Blob>;
|
|
69
|
+
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,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,43 @@
|
|
|
1
|
+
import type { DiscoveredRoom, ProviderRefusal, TypedSelection } from '../adapter.js';
|
|
2
|
+
import type { ModelState } from '../model.js';
|
|
3
|
+
export type RoomDeclaration = Omit<DiscoveredRoom, 'roomVersion' | 'typedSelection'> & {
|
|
4
|
+
typedSelection?: TypedSelection | null;
|
|
5
|
+
};
|
|
6
|
+
export type Declared = {
|
|
7
|
+
readonly room: RoomDeclaration | null;
|
|
8
|
+
readonly available: boolean;
|
|
9
|
+
};
|
|
10
|
+
type RoomStanding = {
|
|
11
|
+
readonly unreadable: boolean;
|
|
12
|
+
readonly refusal: ProviderRefusal | null;
|
|
13
|
+
readonly unheldModel: ModelState | null;
|
|
14
|
+
readonly stale: boolean;
|
|
15
|
+
readonly repairable: {
|
|
16
|
+
readonly reset: string | undefined;
|
|
17
|
+
} | null;
|
|
18
|
+
readonly repairing: boolean;
|
|
19
|
+
readonly reloadDue: boolean;
|
|
20
|
+
readonly confirmed: boolean;
|
|
21
|
+
readonly unpreparable: boolean;
|
|
22
|
+
};
|
|
23
|
+
export type Rooms = {
|
|
24
|
+
declare(locator: string, declared: Declared): void;
|
|
25
|
+
declared(locator: string): Declared | undefined;
|
|
26
|
+
declarations(): ReadonlyMap<string, Declared>;
|
|
27
|
+
discover(room: DiscoveredRoom): void;
|
|
28
|
+
discovered(locator: string): DiscoveredRoom | undefined;
|
|
29
|
+
discoveredRooms(): readonly DiscoveredRoom[];
|
|
30
|
+
undiscoverAll(): void;
|
|
31
|
+
standing(locator: string): RoomStanding;
|
|
32
|
+
stand(locator: string, change: Partial<RoomStanding>): void;
|
|
33
|
+
standingWhere(held: (room: RoomStanding) => boolean): readonly string[];
|
|
34
|
+
standAll(change: Partial<RoomStanding>): void;
|
|
35
|
+
forget(locator: string): void;
|
|
36
|
+
askAgain(locator: string, ask: () => void): void;
|
|
37
|
+
readied(locator: string): void;
|
|
38
|
+
unreadied(): void;
|
|
39
|
+
connectionLost(lapsed: () => void): void;
|
|
40
|
+
connectionLive(): void;
|
|
41
|
+
};
|
|
42
|
+
export declare function createRooms(): Rooms;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
retryable: boolean;
|
|
10
|
+
reauthorizationOffered: boolean;
|
|
11
|
+
refusal: ProviderRefusal | null;
|
|
12
|
+
};
|
|
13
|
+
export type Moving = {
|
|
14
|
+
readonly state: SyncStatus['state'];
|
|
15
|
+
readonly providerUnreachable: boolean;
|
|
16
|
+
readonly resting: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type Session = {
|
|
19
|
+
readonly closed: boolean;
|
|
20
|
+
readonly stopping: boolean;
|
|
21
|
+
readonly paused: boolean;
|
|
22
|
+
readonly authorization: Authorization | undefined;
|
|
23
|
+
readonly refusal: ConnectionRefusal | null;
|
|
24
|
+
readonly discoveries: number;
|
|
25
|
+
readonly roomsNamed: boolean;
|
|
26
|
+
readonly roomsListed: boolean;
|
|
27
|
+
readonly serviceMode: ServiceMode;
|
|
28
|
+
readonly haltedRefusal: boolean;
|
|
29
|
+
readonly openSignals: number;
|
|
30
|
+
readonly authorityChanges: number;
|
|
31
|
+
readonly currencyQueued: number | null;
|
|
32
|
+
readonly moving: Moving;
|
|
33
|
+
readonly complete: boolean;
|
|
34
|
+
readonly recorded: boolean;
|
|
35
|
+
readonly underway: CycleProgress | null;
|
|
36
|
+
readonly streamed: CycleProgress | null;
|
|
37
|
+
};
|
|
38
|
+
export declare function createSession(authorization: Authorization | undefined): Cell<Session>;
|
|
@@ -0,0 +1,69 @@
|
|
|
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 Rooms } from './socket/rooms.js';
|
|
9
|
+
import { type Session } from './socket/session.js';
|
|
10
|
+
export type { Live } from './socket/lanes.js';
|
|
11
|
+
export type { RoomDeclaration } from './socket/rooms.js';
|
|
12
|
+
export type { ConnectionRefusal, ConnectionRefusalCode, Moving, RefusalReason, } from './socket/session.js';
|
|
13
|
+
type SocketEvent = {
|
|
14
|
+
readonly kind: 'opened';
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: 'discovered';
|
|
17
|
+
readonly discovery: Discovery;
|
|
18
|
+
readonly missed: boolean;
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: 'closed';
|
|
21
|
+
readonly revoked: boolean;
|
|
22
|
+
readonly lost: boolean;
|
|
23
|
+
readonly opened: boolean;
|
|
24
|
+
} | Exclude<RoomStreamEvent, {
|
|
25
|
+
kind: 'opened' | 'discovered' | 'closed';
|
|
26
|
+
}>;
|
|
27
|
+
export type RuntimeSocket = Admission & Answers & {
|
|
28
|
+
readonly reads: Reads;
|
|
29
|
+
readonly streamed: boolean;
|
|
30
|
+
readonly session: Cell<Session>;
|
|
31
|
+
readonly rooms: Rooms;
|
|
32
|
+
readonly lanes: Lanes;
|
|
33
|
+
readonly ready: Promise<void>;
|
|
34
|
+
readonly firstDiscovery: Promise<void>;
|
|
35
|
+
conversations(): Adapter['conversations'];
|
|
36
|
+
search(): Adapter['search'];
|
|
37
|
+
discover(authorized: Authorization): ReturnType<NonNullable<Adapter['discover']>> | undefined;
|
|
38
|
+
follows: Adapter['follows'];
|
|
39
|
+
mutate: Adapter['mutate'];
|
|
40
|
+
binary: Adapter['binary'];
|
|
41
|
+
link: Adapter['link'];
|
|
42
|
+
attach: Adapter['attach'];
|
|
43
|
+
history: Adapter['history'];
|
|
44
|
+
action: Adapter['action'];
|
|
45
|
+
authorize(): Promise<void>;
|
|
46
|
+
observe(listen: (event: SocketEvent) => void): void;
|
|
47
|
+
observeConversations(listen: (event: ConversationEvent) => void): void;
|
|
48
|
+
observeServiceMode(listen: (mode: ServiceMode) => void): void;
|
|
49
|
+
close(): void;
|
|
50
|
+
readyFromStore(): void;
|
|
51
|
+
notifyReady(): void;
|
|
52
|
+
closed(): boolean;
|
|
53
|
+
stopping(): boolean;
|
|
54
|
+
continuing(): boolean;
|
|
55
|
+
reached(): boolean;
|
|
56
|
+
writesHeld(): boolean;
|
|
57
|
+
haltedSince(opens: number): boolean;
|
|
58
|
+
isOpen(): boolean;
|
|
59
|
+
isAnnounced(): boolean;
|
|
60
|
+
isHanded(): boolean;
|
|
61
|
+
generation(): number;
|
|
62
|
+
naming(): boolean;
|
|
63
|
+
hand(rooms: readonly HeldRoom[]): void;
|
|
64
|
+
name(room: HeldRoom): void;
|
|
65
|
+
named(): void;
|
|
66
|
+
abortReads(): void;
|
|
67
|
+
stopReads(): void;
|
|
68
|
+
};
|
|
69
|
+
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;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Fence = {
|
|
2
|
+
readonly at: number;
|
|
3
|
+
readonly written: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type Fences = {
|
|
6
|
+
has(locator: string): boolean;
|
|
7
|
+
of(locator: string): Fence | undefined;
|
|
8
|
+
raise(locator: string, at: number): boolean;
|
|
9
|
+
mark(locator: string, written: boolean): void;
|
|
10
|
+
lift(locator: string): void;
|
|
11
|
+
count(): number;
|
|
12
|
+
since(locator: string, count: number): boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function createFences(): Fences;
|
|
15
|
+
export {};
|