@agentshouse/app-bridge 0.1.0-c8d8dc6285bbd → 0.1.0-c8dc2a697434d
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 +595 -24
- package/dist/mdmodel/body.d.ts +84 -0
- package/dist/mdmodel/built-in.d.ts +3 -0
- package/dist/mdmodel/definition.d.ts +20 -11
- package/dist/mdmodel/document.d.ts +14 -8
- 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/house-model.d.ts +869 -0
- package/dist/mdmodel/house-references/crockford.d.ts +3 -0
- package/dist/mdmodel/house-references/patterns.d.ts +8 -0
- package/dist/mdmodel/index.d.ts +40 -15
- package/dist/mdmodel/kinds.d.ts +17 -0
- package/dist/mdmodel/markdown.d.ts +74 -0
- package/dist/mdmodel/media-type.d.ts +71 -0
- package/dist/mdmodel/moment.d.ts +6 -0
- package/dist/mdmodel/not-ready.d.ts +1 -0
- package/dist/mdmodel/paths.d.ts +15 -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/references.d.ts +2 -2
- package/dist/mdmodel/reserved.d.ts +5 -0
- package/dist/mdmodel/room-types.d.ts +6 -0
- package/dist/mdmodel/types.d.ts +22 -17
- package/dist/mdmodel/validate.d.ts +12 -6
- package/dist/mdmodel/yaml.d.ts +4 -4
- package/dist/mdruntime/actions.d.ts +25 -0
- package/dist/mdruntime/adapter.d.ts +181 -113
- package/dist/mdruntime/attached-model.d.ts +6 -0
- package/dist/mdruntime/authored.d.ts +87 -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 +5 -0
- package/dist/mdruntime/client.d.ts +33 -25
- package/dist/mdruntime/collection.d.ts +31 -7
- package/dist/mdruntime/compile.d.ts +8 -6
- package/dist/mdruntime/conversation-live.d.ts +149 -0
- package/dist/mdruntime/conversation-row.d.ts +39 -0
- package/dist/mdruntime/conversation.d.ts +72 -51
- package/dist/mdruntime/declaration.d.ts +9 -0
- package/dist/mdruntime/durability.d.ts +19 -1
- 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/install.d.ts +59 -0
- package/dist/mdruntime/listing.d.ts +51 -0
- package/dist/mdruntime/live.d.ts +24 -0
- package/dist/mdruntime/media.d.ts +24 -0
- package/dist/mdruntime/messages.d.ts +35 -5
- package/dist/mdruntime/model.d.ts +8 -11
- package/dist/mdruntime/observation.d.ts +29 -13
- package/dist/mdruntime/opened.d.ts +1 -1
- package/dist/mdruntime/outcome.d.ts +30 -7
- package/dist/mdruntime/overlay.d.ts +7 -2
- package/dist/mdruntime/preparation.d.ts +40 -0
- package/dist/mdruntime/presence.d.ts +57 -0
- package/dist/mdruntime/query.d.ts +18 -208
- package/dist/mdruntime/reach.d.ts +21 -13
- package/dist/mdruntime/readiness.d.ts +12 -21
- package/dist/mdruntime/reads.d.ts +38 -0
- package/dist/mdruntime/recovery.d.ts +3 -0
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +13 -20
- package/dist/mdruntime/retried.d.ts +29 -0
- package/dist/mdruntime/room-draft.d.ts +51 -12
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +33 -0
- package/dist/mdruntime/save.d.ts +42 -84
- package/dist/mdruntime/saves.d.ts +33 -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 +66 -0
- package/dist/mdruntime/source.d.ts +58 -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 +10 -0
- package/dist/mdruntime/store/records.d.ts +222 -0
- package/dist/mdruntime/store/room-held.d.ts +7 -0
- package/dist/mdruntime/store/rooms-shown.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 +113 -157
- package/dist/mdruntime/stored.d.ts +79 -57
- package/dist/mdruntime/surface.d.ts +89 -0
- package/dist/mdruntime/tables.d.ts +129 -107
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +0 -5
- package/dist/mdruntime/wire.d.ts +75 -13
- 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 +103 -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 +8 -4
- package/dist/test-host.js +28 -28
- package/docs/families.md +79 -67
- package/package.json +2 -2
- package/dist/calls.d.ts +0 -1007
- package/dist/calls.js +0 -1
- package/dist/mdmodel/blocks.d.ts +0 -10
- package/dist/mdmodel/condition.d.ts +0 -160
- package/dist/mdmodel/links.d.ts +0 -28
- package/dist/mdmodel/profile.d.ts +0 -5
- 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
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,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 { Retries } from './retried.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 { KeptSender, 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, retries: Retries, authorization: Authorization | undefined): RuntimeSocket;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type RequestAnswer = 'at_once' | 'ask_me' | 'off';
|
|
2
|
+
export type HouseSource = {
|
|
3
|
+
readonly kind: 'request';
|
|
4
|
+
readonly request: string;
|
|
5
|
+
readonly agentFunction: RequestAgentFunction | null;
|
|
6
|
+
readonly requester: {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly room: boolean;
|
|
9
|
+
};
|
|
10
|
+
readonly room: {
|
|
11
|
+
readonly ref: string;
|
|
12
|
+
readonly handle: string;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
};
|
|
15
|
+
readonly sent: string;
|
|
16
|
+
readonly instruction: string | null;
|
|
17
|
+
readonly answer: RequestAnswer | null;
|
|
18
|
+
readonly approved: string | null;
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: 'mail';
|
|
21
|
+
readonly request: string;
|
|
22
|
+
readonly room: string;
|
|
23
|
+
readonly report: boolean;
|
|
24
|
+
readonly agent: string;
|
|
25
|
+
readonly owner: string;
|
|
26
|
+
readonly approved: string | null;
|
|
27
|
+
readonly declined: string | null;
|
|
28
|
+
} | {
|
|
29
|
+
readonly kind: 'trigger';
|
|
30
|
+
readonly customer: boolean;
|
|
31
|
+
readonly trigger: string;
|
|
32
|
+
readonly room: {
|
|
33
|
+
readonly ref: string;
|
|
34
|
+
readonly name: string;
|
|
35
|
+
};
|
|
36
|
+
} | {
|
|
37
|
+
readonly kind: 'conversation';
|
|
38
|
+
readonly conversation: {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly name: string;
|
|
41
|
+
};
|
|
42
|
+
readonly agent: string;
|
|
43
|
+
} | {
|
|
44
|
+
readonly kind: 'declined';
|
|
45
|
+
readonly agent: string;
|
|
46
|
+
readonly owner: string;
|
|
47
|
+
};
|
|
48
|
+
export type ChatRequest = {
|
|
49
|
+
readonly request: string;
|
|
50
|
+
readonly room: string;
|
|
51
|
+
readonly message?: string;
|
|
52
|
+
};
|
|
53
|
+
type RequestAgentFunction = {
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly version: number;
|
|
56
|
+
};
|
|
57
|
+
export declare function sourceOf(value: unknown, sender: string | null): HouseSource | null;
|
|
58
|
+
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,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(among: readonly string[] | null): ReadonlySet<string>;
|
|
25
|
+
transferring(): readonly string[];
|
|
26
|
+
arrivalsDue(locator: string, now: number, everyMs: number): readonly string[];
|
|
27
|
+
};
|
|
28
|
+
export declare function createInstalls(): Installs;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ReadinessQueue<W, S> = {
|
|
2
|
+
add(watch: W): () => void;
|
|
3
|
+
held(watch: W): boolean;
|
|
4
|
+
kept(watch: W): S | undefined;
|
|
5
|
+
keep(watch: W, shown: S): void;
|
|
6
|
+
owe(watches: readonly W[]): void;
|
|
7
|
+
queue(rooms?: readonly string[]): void;
|
|
8
|
+
close(): void;
|
|
9
|
+
};
|
|
10
|
+
export declare function createReadinessQueue<W, S>(deliver: (owed: readonly W[], rooms: ReadonlySet<string> | null) => Promise<void>, unpublished: (error: unknown) => void): ReadinessQueue<W, S>;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import type { BootstrapInventory, Capability, ListedAgent, ListedConversation, Member, ProviderLimit, RoomList } from '../adapter.js';
|
|
2
|
+
import type { ChangeBatch } from '../change.js';
|
|
3
|
+
import { type Composition } from '../collection.js';
|
|
4
|
+
import type { Plan } from '../query.js';
|
|
5
|
+
import type { ReplicaRecord } from '../replica.js';
|
|
6
|
+
import type { Submission } from '../outcome.js';
|
|
7
|
+
import type { RoomDraftRecord, SavedDraft } from '../room-draft.js';
|
|
8
|
+
import type { ModelState, StoredModel } from '../model.js';
|
|
9
|
+
import type { CommittedWrite, ConversationWrite, HeldConversation, HeldFact, HeldRow, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, ReplicaOpened, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, TypedEntry, View } from '../tables.js';
|
|
10
|
+
export type { ConversationFact, ConversationWrite, HeldConversation, MessageWindow, } from '../tables.js';
|
|
11
|
+
declare const FILE = "\0file";
|
|
12
|
+
export type TransferRecord = {
|
|
13
|
+
readonly locator: string;
|
|
14
|
+
readonly transfer: string;
|
|
15
|
+
readonly selection: string;
|
|
16
|
+
readonly from: string;
|
|
17
|
+
readonly last: string;
|
|
18
|
+
readonly done: BootstrapInventory;
|
|
19
|
+
readonly models: {
|
|
20
|
+
readonly collection: ModelState;
|
|
21
|
+
};
|
|
22
|
+
readonly key: number | null;
|
|
23
|
+
};
|
|
24
|
+
export type StoredReplica = Omit<ReplicaRecord, 'model'> & {
|
|
25
|
+
readonly model: StoredModel;
|
|
26
|
+
};
|
|
27
|
+
export type PendingState = {
|
|
28
|
+
readonly drafts: readonly SavedDraft[];
|
|
29
|
+
readonly submission: Submission;
|
|
30
|
+
readonly lost: boolean;
|
|
31
|
+
readonly upload?: unknown;
|
|
32
|
+
};
|
|
33
|
+
export type TargetRecord = {
|
|
34
|
+
established: boolean;
|
|
35
|
+
};
|
|
36
|
+
export type PresentationRecord = {
|
|
37
|
+
app: string;
|
|
38
|
+
value: unknown;
|
|
39
|
+
};
|
|
40
|
+
export type ChatSubmission = {
|
|
41
|
+
readonly operation: string;
|
|
42
|
+
readonly text: string;
|
|
43
|
+
readonly turn: string | null;
|
|
44
|
+
};
|
|
45
|
+
export type ChatDraftRecord = {
|
|
46
|
+
conversation: string;
|
|
47
|
+
text: string;
|
|
48
|
+
revision: string;
|
|
49
|
+
submitted?: readonly ChatSubmission[];
|
|
50
|
+
moves?: readonly string[];
|
|
51
|
+
};
|
|
52
|
+
export type CallRecord = {
|
|
53
|
+
readonly operation: string;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly input: unknown;
|
|
56
|
+
};
|
|
57
|
+
export type AuthoredWrite = {
|
|
58
|
+
locator: string;
|
|
59
|
+
queue?: readonly ChangeBatch[];
|
|
60
|
+
stored?: readonly ChangeBatch[];
|
|
61
|
+
founded?: readonly ChangeBatch[];
|
|
62
|
+
saved?: ReadonlyMap<string, readonly SavedDraft[]>;
|
|
63
|
+
roomDrafts?: readonly RoomDraftRecord[];
|
|
64
|
+
consumedRoomDrafts?: readonly string[];
|
|
65
|
+
};
|
|
66
|
+
export type StagedPage = {
|
|
67
|
+
readonly entries: readonly StoredEntry[];
|
|
68
|
+
readonly folders: readonly string[];
|
|
69
|
+
readonly part?: string;
|
|
70
|
+
};
|
|
71
|
+
export type ResumedTransfer = {
|
|
72
|
+
readonly key: number | null;
|
|
73
|
+
readonly transfer: string;
|
|
74
|
+
readonly staged: readonly string[];
|
|
75
|
+
};
|
|
76
|
+
export type RefreshedPage = StagedPage & {
|
|
77
|
+
readonly removals: readonly string[];
|
|
78
|
+
readonly folderRemovals: readonly string[];
|
|
79
|
+
};
|
|
80
|
+
export type HeldRoom = {
|
|
81
|
+
readonly record: StoredReplica;
|
|
82
|
+
readonly indexed: boolean;
|
|
83
|
+
readonly documents: number;
|
|
84
|
+
};
|
|
85
|
+
export type QueuedChange = {
|
|
86
|
+
readonly batch: ChangeBatch;
|
|
87
|
+
readonly state: PendingState;
|
|
88
|
+
};
|
|
89
|
+
export type HeldWork = {
|
|
90
|
+
readonly room: (HeldRoom & {
|
|
91
|
+
readonly overlaid: ReadonlySet<string>;
|
|
92
|
+
}) | null;
|
|
93
|
+
readonly queue: readonly QueuedChange[];
|
|
94
|
+
};
|
|
95
|
+
export type CoveredRoom = {
|
|
96
|
+
readonly key: number;
|
|
97
|
+
readonly transfer: string;
|
|
98
|
+
readonly roomVersion: string;
|
|
99
|
+
readonly indexed: boolean;
|
|
100
|
+
readonly documents: number;
|
|
101
|
+
readonly bytes: number;
|
|
102
|
+
readonly offline: string;
|
|
103
|
+
};
|
|
104
|
+
export type HeldCover = {
|
|
105
|
+
readonly rooms: ReadonlyMap<string, CoveredRoom>;
|
|
106
|
+
readonly locking: ReadonlySet<string>;
|
|
107
|
+
readonly queues: ReadonlyMap<string, readonly string[]>;
|
|
108
|
+
};
|
|
109
|
+
export type HeldStatus = {
|
|
110
|
+
readonly queued: readonly string[];
|
|
111
|
+
readonly lastCompleted: string | null;
|
|
112
|
+
readonly unsent: readonly {
|
|
113
|
+
readonly room: string;
|
|
114
|
+
readonly path: string;
|
|
115
|
+
}[];
|
|
116
|
+
readonly resets: readonly {
|
|
117
|
+
readonly locator: string;
|
|
118
|
+
readonly reset: string;
|
|
119
|
+
}[];
|
|
120
|
+
readonly returned: readonly RoomDraftRecord[];
|
|
121
|
+
};
|
|
122
|
+
export type Facts = {
|
|
123
|
+
readonly lastCompleted: string | null;
|
|
124
|
+
readonly providerLimits: readonly ProviderLimit[];
|
|
125
|
+
readonly capabilities: readonly Capability[];
|
|
126
|
+
readonly member: Member | null;
|
|
127
|
+
readonly targets: Readonly<Record<string, TargetRecord>>;
|
|
128
|
+
readonly conversationList: readonly ListedConversation[] | null;
|
|
129
|
+
readonly agentList: readonly ListedAgent[] | null;
|
|
130
|
+
readonly conversationCursor: string | null;
|
|
131
|
+
readonly chatPins: readonly string[];
|
|
132
|
+
readonly roomList: RoomList | null;
|
|
133
|
+
};
|
|
134
|
+
export type Commit = {
|
|
135
|
+
readonly rooms: readonly RoomCommit[];
|
|
136
|
+
readonly writes?: readonly AuthoredWrite[];
|
|
137
|
+
readonly files?: readonly StoredFile[];
|
|
138
|
+
readonly whole?: boolean;
|
|
139
|
+
};
|
|
140
|
+
export type RuntimeStore = {
|
|
141
|
+
opened(): Promise<ReplicaOpened>;
|
|
142
|
+
rooms(locators?: readonly string[]): Promise<readonly HeldRoom[]>;
|
|
143
|
+
room(locator: string): Promise<HeldWork>;
|
|
144
|
+
covering(): Promise<HeldCover>;
|
|
145
|
+
offline(locator: string): Promise<string | null>;
|
|
146
|
+
held(): Promise<{
|
|
147
|
+
readonly held: ReadonlySet<string>;
|
|
148
|
+
readonly staged: ReadonlySet<string>;
|
|
149
|
+
}>;
|
|
150
|
+
status(): Promise<HeldStatus>;
|
|
151
|
+
batch(locator: string, id: string): Promise<ChangeBatch | null>;
|
|
152
|
+
order(locator: string): Promise<readonly string[]>;
|
|
153
|
+
queued(): Promise<readonly string[]>;
|
|
154
|
+
moving(): Promise<{
|
|
155
|
+
readonly queued: ReadonlyMap<string, readonly string[]>;
|
|
156
|
+
readonly moving: readonly (QueuedChange & {
|
|
157
|
+
readonly locator: string;
|
|
158
|
+
})[];
|
|
159
|
+
}>;
|
|
160
|
+
pending(locator: string, id: string): Promise<{
|
|
161
|
+
readonly state: PendingState | undefined;
|
|
162
|
+
readonly room: boolean;
|
|
163
|
+
}>;
|
|
164
|
+
facts(): Promise<Facts>;
|
|
165
|
+
facts<K extends keyof Facts>(names: readonly K[]): Promise<Pick<Facts, K>>;
|
|
166
|
+
presentation(app: string): Promise<unknown>;
|
|
167
|
+
demote(): Promise<void>;
|
|
168
|
+
query(plan: Plan, rooms: readonly QueryRoom[], budget: number | null): Promise<QueryAnswer>;
|
|
169
|
+
changes(keys: readonly number[]): number;
|
|
170
|
+
entries(key: number, view: View, paths: readonly string[]): Promise<readonly HeldEntry[]>;
|
|
171
|
+
typed(key: number, view: View, paths: readonly string[]): Promise<readonly TypedEntry[]>;
|
|
172
|
+
referrers(key: number, view: View, targets: readonly string[]): Promise<readonly Referrer[]>;
|
|
173
|
+
folders(key: number, paths: readonly string[]): Promise<readonly string[]>;
|
|
174
|
+
typedWithin(key: number, view: View, roots: readonly string[], within: boolean): Promise<boolean>;
|
|
175
|
+
stage(record: TransferRecord, composition: Composition, page: StagedPage): Promise<number | null>;
|
|
176
|
+
resume(record: TransferRecord, composition: Composition, parts: readonly string[], published: number | null): Promise<ResumedTransfer | null>;
|
|
177
|
+
refresh(key: number, composition: Composition, page: RefreshedPage): Promise<void>;
|
|
178
|
+
unrefresh(key: number): Promise<void>;
|
|
179
|
+
commit(commit: Commit): Promise<CommittedWrite>;
|
|
180
|
+
fence(locators: readonly string[]): Promise<void>;
|
|
181
|
+
erase(locator: string | null, limit: number): Promise<boolean>;
|
|
182
|
+
abandon(locator: string): Promise<void>;
|
|
183
|
+
unfence(locators: readonly string[]): Promise<ReadonlySet<string>>;
|
|
184
|
+
release(key: number): Promise<void>;
|
|
185
|
+
rederive(key: number, composition: Composition, bytes: number, ms: number, floor: number): Promise<{
|
|
186
|
+
readonly done: boolean;
|
|
187
|
+
readonly text: number;
|
|
188
|
+
}>;
|
|
189
|
+
fact(name: string, value: unknown): Promise<void>;
|
|
190
|
+
submit(locator: string, id: string, submission: Submission, lost: boolean): Promise<void>;
|
|
191
|
+
keepUpload(locator: string, id: string, upload: unknown): Promise<void>;
|
|
192
|
+
roomDrafts(locator?: string, paths?: readonly string[]): Promise<readonly RoomDraftRecord[]>;
|
|
193
|
+
present(record: PresentationRecord): Promise<void>;
|
|
194
|
+
conversations(conversations?: readonly string[]): Promise<readonly HeldConversation[]>;
|
|
195
|
+
keepMessages(write: ConversationWrite): Promise<void>;
|
|
196
|
+
messageWindow(conversation: string, limit: number, before: readonly [string, string] | null, phrase?: string | null): Promise<MessageWindow>;
|
|
197
|
+
messageCount(conversation: string, phrase?: string | null): Promise<number>;
|
|
198
|
+
turnArrived(conversation: string, turn: string): Promise<boolean>;
|
|
199
|
+
conversationRows(conversations: readonly string[]): Promise<readonly HeldRow[]>;
|
|
200
|
+
conversationFacts(): Promise<readonly HeldFact[]>;
|
|
201
|
+
keepConversationFact(fact: HeldFact): Promise<void>;
|
|
202
|
+
storedConversations(): Promise<readonly string[]>;
|
|
203
|
+
dropConversations(conversations: readonly string[]): Promise<readonly string[]>;
|
|
204
|
+
chatDrafts(): Promise<readonly ChatDraftRecord[]>;
|
|
205
|
+
chatDraft(conversation: string): Promise<ChatDraftRecord | null>;
|
|
206
|
+
keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
|
|
207
|
+
dropChatDraft(conversation: string): Promise<void>;
|
|
208
|
+
calls(): Promise<readonly CallRecord[]>;
|
|
209
|
+
keepCall(record: CallRecord): Promise<void>;
|
|
210
|
+
dropCall(operation: string): Promise<void>;
|
|
211
|
+
keepRoomDraft(record: RoomDraftRecord, files: readonly StoredFile[]): Promise<void>;
|
|
212
|
+
discardRoomDraft(locator: string, path: string): Promise<void>;
|
|
213
|
+
fences(): Promise<readonly string[]>;
|
|
214
|
+
generation(): Promise<string | null>;
|
|
215
|
+
rememberGeneration(value: string): Promise<void>;
|
|
216
|
+
file(key: string, type: string): Promise<Blob>;
|
|
217
|
+
};
|
|
218
|
+
export type FileMark = {
|
|
219
|
+
readonly [FILE]: string;
|
|
220
|
+
readonly type: string;
|
|
221
|
+
};
|
|
222
|
+
export declare function openRuntimeStore(database: RuntimeDatabase): RuntimeStore;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type RoomHeld<T> = {
|
|
2
|
+
of(locator: string, key: string): T | undefined;
|
|
3
|
+
hold(locator: string, key: string, value: T): void;
|
|
4
|
+
drop(locator: string, key: string): void;
|
|
5
|
+
forget(locator: string): void;
|
|
6
|
+
};
|
|
7
|
+
export declare function createRoomHeld<T>(): RoomHeld<T>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RuntimeDatabase } from '../tables.js';
|
|
2
|
+
export type Space = {
|
|
3
|
+
full(): boolean;
|
|
4
|
+
fill(): boolean;
|
|
5
|
+
probing(): boolean;
|
|
6
|
+
probeEachMinute(): void;
|
|
7
|
+
probe(): Promise<void>;
|
|
8
|
+
stop(): void;
|
|
9
|
+
};
|
|
10
|
+
export declare function createSpace(database: RuntimeDatabase, freed: () => void): Space;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type Watcher = {
|
|
2
|
+
held(): boolean;
|
|
3
|
+
stop(): void;
|
|
4
|
+
answer(value: unknown): void;
|
|
5
|
+
};
|
|
6
|
+
export type Watching = 'all' | 'waiting' | 'ready';
|
|
7
|
+
type Watchers = {
|
|
8
|
+
publication(work: () => Promise<void>): Promise<void>;
|
|
9
|
+
owing<T>(topic: string, add: (owed: T | undefined) => T, work: (owed: T) => Promise<void>): Promise<void>;
|
|
10
|
+
watch(topic: string, notify: (value: unknown) => void): Watcher;
|
|
11
|
+
watching(topic: string, which?: Watching): readonly Watcher[];
|
|
12
|
+
tell(topic: string, value: unknown): void;
|
|
13
|
+
close(): void;
|
|
14
|
+
};
|
|
15
|
+
export declare function createWatchers(unpublished: (error: unknown) => void): Watchers;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Composition } from '../collection.js';
|
|
2
|
+
import type { RefreshedPage, RuntimeStore } from './records.js';
|
|
3
|
+
export type InstallHold = {
|
|
4
|
+
take(): void;
|
|
5
|
+
release(): void;
|
|
6
|
+
};
|
|
7
|
+
type Writes = {
|
|
8
|
+
exclusive<T>(work: () => Promise<T>): Promise<T>;
|
|
9
|
+
gathered<I, T>(key: string, input: I, merge: (earlier: I, later: I) => I | null, work: (input: I) => Promise<T>): Promise<T>;
|
|
10
|
+
written(): Promise<unknown>;
|
|
11
|
+
startingWrite<T>(work: () => Promise<T>): Promise<T>;
|
|
12
|
+
finishingWrite<T>(work: () => Promise<T>): Promise<T>;
|
|
13
|
+
ahead<T>(work: (hold: InstallHold) => Promise<T>): Promise<T>;
|
|
14
|
+
rederive(local: RuntimeStore, key: number, composition: Composition): Promise<{
|
|
15
|
+
readonly done: boolean;
|
|
16
|
+
readonly text: number;
|
|
17
|
+
}>;
|
|
18
|
+
refreshPage(local: RuntimeStore, key: number, composition: Composition, page: RefreshedPage): Promise<void>;
|
|
19
|
+
stageBytes(): number;
|
|
20
|
+
deriveBytes(): number;
|
|
21
|
+
};
|
|
22
|
+
export declare function createWrites(): Writes;
|
|
23
|
+
export {};
|