@agentshouse/app-bridge 0.1.0-ce602e5dccd9f → 0.1.0-ce61879ee484f
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 +2 -2
- package/dist/index.d.ts +47 -504
- package/dist/mdmodel/body.d.ts +84 -0
- package/dist/mdmodel/built-in.d.ts +3 -0
- package/dist/mdmodel/crockford.d.ts +3 -0
- package/dist/mdmodel/definition.d.ts +18 -9
- package/dist/mdmodel/document.d.ts +7 -4
- package/dist/mdmodel/event.d.ts +1 -2
- package/dist/mdmodel/fields.d.ts +1 -1
- package/dist/mdmodel/house-model.d.ts +826 -0
- package/dist/mdmodel/house-references.d.ts +3 -0
- package/dist/mdmodel/index.d.ts +15 -6
- package/dist/mdmodel/markdown.d.ts +28 -4
- package/dist/mdmodel/paths.d.ts +10 -1
- package/dist/mdmodel/room-types.d.ts +6 -0
- package/dist/mdmodel/types.d.ts +3 -6
- package/dist/mdmodel/validate.d.ts +2 -1
- package/dist/mdruntime/actions.d.ts +8 -2
- package/dist/mdruntime/adapter.d.ts +13 -7
- package/dist/mdruntime/attached-model.d.ts +0 -1
- package/dist/mdruntime/change-set.d.ts +4 -0
- package/dist/mdruntime/client.d.ts +6 -17
- package/dist/mdruntime/compile.d.ts +2 -0
- package/dist/mdruntime/conversation-live.d.ts +10 -2
- package/dist/mdruntime/conversation.d.ts +26 -5
- package/dist/mdruntime/durability.d.ts +4 -0
- package/dist/mdruntime/failure.d.ts +2 -0
- package/dist/mdruntime/listing.d.ts +5 -9
- package/dist/mdruntime/messages.d.ts +9 -2
- package/dist/mdruntime/observation.d.ts +3 -2
- package/dist/mdruntime/opened.d.ts +1 -1
- package/dist/mdruntime/outcome.d.ts +3 -0
- package/dist/mdruntime/overlay.d.ts +3 -0
- package/dist/mdruntime/presence.d.ts +51 -0
- package/dist/mdruntime/readiness.d.ts +1 -1
- package/dist/mdruntime/reads.d.ts +3 -1
- package/dist/mdruntime/recovery.d.ts +3 -1
- package/dist/mdruntime/retried.d.ts +29 -0
- package/dist/mdruntime/room-draft.d.ts +2 -3
- package/dist/mdruntime/runtime.d.ts +6 -16
- package/dist/mdruntime/save.d.ts +40 -83
- package/dist/mdruntime/saves.d.ts +2 -40
- package/dist/mdruntime/socket/lanes.d.ts +12 -4
- package/dist/mdruntime/socket.d.ts +3 -5
- package/dist/mdruntime/source.d.ts +0 -7
- package/dist/mdruntime/store/records.d.ts +7 -3
- package/dist/mdruntime/store.d.ts +10 -5
- package/dist/mdruntime/stored.d.ts +1 -0
- package/dist/mdruntime/surface.d.ts +1 -1
- package/dist/mdruntime/tables.d.ts +6 -3
- package/dist/mdruntime/wire.d.ts +47 -3
- package/dist/session-content/index.d.ts +1 -1
- package/dist/session-content/parts.d.ts +4 -3
- package/dist/session-content/turn.d.ts +3 -3
- package/docs/families.md +4 -9
- package/package.json +2 -2
- package/dist/mdruntime/install.d.ts +0 -55
- package/dist/mdruntime/log.d.ts +0 -5
- package/dist/mdruntime/socket/rooms.d.ts +0 -40
- package/dist/mdruntime/store/fences.d.ts +0 -15
- package/dist/mdruntime/turn.d.ts +0 -8
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ActionResult, AdapterFailure, AttachResult, BinaryLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
|
+
import type { Attempt, Retries } from './retried.js';
|
|
3
4
|
import type { KeptBinary, KeptResult } from './opened.js';
|
|
4
5
|
type Refused<Kind extends string> = ProviderRefusal & {
|
|
5
6
|
kind: Kind;
|
|
@@ -84,4 +85,6 @@ export type QueueEntry = {
|
|
|
84
85
|
} & (Submission | {
|
|
85
86
|
readonly state: 'local';
|
|
86
87
|
});
|
|
88
|
+
export declare const UNANSWERED: ActionResult;
|
|
89
|
+
export declare function handedOutcome(retries: Retries, attempt: Attempt | undefined, result: ActionResult): CallResult;
|
|
87
90
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ApplyResult } from '../mdmodel/index.js';
|
|
1
2
|
import type { BinaryFile, HeadChange } from './adapter.js';
|
|
2
3
|
import { type Composition } from './collection.js';
|
|
3
4
|
import type { ChangeBatch } from './change.js';
|
|
@@ -23,4 +24,6 @@ export type Layer = Heads & {
|
|
|
23
24
|
export declare function acceptedBinaries(files: Readonly<Record<string, BinaryFile>>): Generator<readonly [string, HeldBinary]>;
|
|
24
25
|
export declare function sameBinary(left: HeldBinary | undefined, right: HeldBinary | undefined): boolean;
|
|
25
26
|
export declare function sameChange(left: HeadChange | undefined, right: HeadChange | undefined): boolean;
|
|
27
|
+
export declare function composed(path: string, fields: Readonly<Record<string, unknown>>, sections: Readonly<Record<string, string>>, composition: Composition): ApplyResult;
|
|
28
|
+
export declare function compose(path: string, fields: Readonly<Record<string, unknown>>, sections: Readonly<Record<string, string>>, composition: Composition): string;
|
|
26
29
|
export declare function overlaying(base: Layer, queue: readonly ChangeBatch[], composition: Composition, unapplied?: () => void): Generator<number, Layer, void>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { DiscoveredRoom, ProviderRefusal, ScopedRefusal } from './adapter.js';
|
|
2
|
+
import type { ModelState } from './model.js';
|
|
3
|
+
type Repairable = {
|
|
4
|
+
readonly reset: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
type Standing = {
|
|
7
|
+
readonly stale: boolean;
|
|
8
|
+
readonly repairable: Repairable | null;
|
|
9
|
+
readonly repairing: boolean;
|
|
10
|
+
readonly reloadDue: boolean;
|
|
11
|
+
};
|
|
12
|
+
type Listing = {
|
|
13
|
+
readonly whole: boolean;
|
|
14
|
+
readonly live: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type Presence = {
|
|
17
|
+
list(found: readonly DiscoveredRoom[], how: Listing): readonly DiscoveredRoom[];
|
|
18
|
+
room(locator: string): DiscoveredRoom | undefined;
|
|
19
|
+
rooms(): readonly DiscoveredRoom[];
|
|
20
|
+
available(locator: string, selection?: string): boolean;
|
|
21
|
+
refusal(locator: string): ProviderRefusal | null;
|
|
22
|
+
unheldModel(locator: string): ModelState | null;
|
|
23
|
+
refused(locator: string, refusal: ScopedRefusal | null): void;
|
|
24
|
+
readable(locator: string): boolean;
|
|
25
|
+
modelled(locator: string, model: ModelState | null): void;
|
|
26
|
+
installed(locator: string, bootstrapped: boolean): void;
|
|
27
|
+
locked(locator: string, stored: () => Promise<string | null>): Promise<boolean>;
|
|
28
|
+
lockedAmong(stored: ReadonlyMap<string, string>): readonly string[];
|
|
29
|
+
connectionLost(lapsed: () => void): void;
|
|
30
|
+
connectionLive(): void;
|
|
31
|
+
lapse(): void;
|
|
32
|
+
stood(locator: string, stale: boolean, repairable?: Repairable | null): void;
|
|
33
|
+
repairing(locator: string, running: boolean): void;
|
|
34
|
+
reload(locator: string, due: boolean): void;
|
|
35
|
+
standing(locator: string): Standing;
|
|
36
|
+
settled(): boolean;
|
|
37
|
+
repairsOwed(): readonly string[];
|
|
38
|
+
askAgain(locator: string, ask: () => void): void;
|
|
39
|
+
stopAsking(locator?: string): void;
|
|
40
|
+
lose(locator: string, during: number): boolean;
|
|
41
|
+
writing(locator: string): boolean;
|
|
42
|
+
unwritten(locator: string): void;
|
|
43
|
+
lost(locator: string): boolean;
|
|
44
|
+
losses(): number;
|
|
45
|
+
lostSince(locator: string, losses: number): boolean;
|
|
46
|
+
liftable(locator: string, discovery: number): boolean;
|
|
47
|
+
lift(locator: string, discovery: number, unfenced: boolean): void;
|
|
48
|
+
close(): void;
|
|
49
|
+
};
|
|
50
|
+
export declare function createPresence(): Presence;
|
|
51
|
+
export {};
|
|
@@ -12,7 +12,7 @@ export type TargetCoverage = {
|
|
|
12
12
|
readonly rooms: readonly RoomCoverage[];
|
|
13
13
|
readonly conversations: ConversationCoverage;
|
|
14
14
|
};
|
|
15
|
-
export type Persistence = Open<'granted' | 'denied' | 'unavailable'>;
|
|
15
|
+
export type Persistence = Open<'granted' | 'denied' | 'unavailable' | 'memory'>;
|
|
16
16
|
export type Durability = Open<'persistent' | 'best-effort'>;
|
|
17
17
|
export type ConnectionAvailability = Open<'connected' | 'connecting' | 'unreachable'>;
|
|
18
18
|
export type HouseOutcome = Open<'open' | 'write-halted' | 'refused'>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CallResult } from './outcome.js';
|
|
2
2
|
import type { Recovery } from './recovery.js';
|
|
3
|
+
import type { Attempt, Retries } from './retried.js';
|
|
3
4
|
import type { Connection, RuntimeDatabase } from './tables.js';
|
|
4
5
|
export declare const READ_TABLES: readonly string[];
|
|
5
6
|
export type ReadAt = {
|
|
@@ -23,7 +24,8 @@ export type ReadAnswersOptions = {
|
|
|
23
24
|
readonly unkept: readonly string[];
|
|
24
25
|
readonly leading: readonly string[];
|
|
25
26
|
readonly recovery: Recovery;
|
|
26
|
-
|
|
27
|
+
readonly retries: Retries;
|
|
28
|
+
call(name: string, input: unknown, attempt: Attempt): Promise<CallResult>;
|
|
27
29
|
online(): boolean;
|
|
28
30
|
streaming(): boolean;
|
|
29
31
|
closed(): boolean;
|
|
@@ -16,10 +16,12 @@ export type Recovery = {
|
|
|
16
16
|
attempt(intent: string, run: Attempt, options?: AttemptOptions): Promise<boolean>;
|
|
17
17
|
pending(intent: string): boolean;
|
|
18
18
|
resume(): void;
|
|
19
|
+
again(): void;
|
|
20
|
+
waits(wake: () => void): () => void;
|
|
19
21
|
cancel(intent: string): void;
|
|
20
22
|
scope(inFlight?: number): Recovery;
|
|
21
23
|
retire(): Promise<void>;
|
|
22
24
|
};
|
|
23
25
|
export declare function retryDelay(tries: number, firstMs?: number, maxMs?: number): number;
|
|
24
|
-
export declare function untilAnswered<T>(ask: () => Promise<T>, signal: AbortSignal, answered?: (answer: T) => boolean): Promise<T>;
|
|
26
|
+
export declare function untilAnswered<T>(ask: () => Promise<T>, signal: AbortSignal, answered?: (answer: T) => boolean, owner?: Recovery): Promise<T>;
|
|
25
27
|
export declare function createRecovery(options?: RecoveryOptions): Recovery;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type RuntimeShell } from './durability.js';
|
|
2
|
+
export declare const STEPS: readonly ['database', 'sign_in', 'connection', 'code', 'download', 'conversations', 'sending', 'reading'];
|
|
3
|
+
export type Step = (typeof STEPS)[number];
|
|
4
|
+
export type RetriedFailure = {
|
|
5
|
+
readonly step: Step;
|
|
6
|
+
readonly answered: false;
|
|
7
|
+
} | {
|
|
8
|
+
readonly step: Step;
|
|
9
|
+
readonly answered: true;
|
|
10
|
+
readonly error: unknown;
|
|
11
|
+
};
|
|
12
|
+
export type Uncertain = {
|
|
13
|
+
readonly failure?: unknown;
|
|
14
|
+
};
|
|
15
|
+
export type Attempt = {
|
|
16
|
+
readonly step: Step;
|
|
17
|
+
readonly instance: string;
|
|
18
|
+
};
|
|
19
|
+
export declare class Unanswered extends Error {
|
|
20
|
+
}
|
|
21
|
+
export declare function uncertainError(uncertainty: Uncertain): unknown;
|
|
22
|
+
export type Retries = {
|
|
23
|
+
failed(step: Step, instance: string, error: unknown): void;
|
|
24
|
+
unanswered(step: Step, instance: string): void;
|
|
25
|
+
uncertain(step: Step, instance: string, uncertainty: Uncertain): void;
|
|
26
|
+
succeeded(step: Step, instance: string): void;
|
|
27
|
+
};
|
|
28
|
+
export declare function createRetries(shell: Pick<RuntimeShell, 'retried' | 'succeeded'>): Retries;
|
|
29
|
+
export declare function retrying<T>(retries: Retries, step: Step, instance: string, ask: () => Promise<T>): () => Promise<T>;
|
|
@@ -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, definitions?: DefinitionOf): string;
|
|
149
|
-
export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts, definitions?: DefinitionOf): 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 {};
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ChangeSet } from './change-set.js';
|
|
3
|
-
import type { ChangeBatch } from './change.js';
|
|
1
|
+
import type { RoomDeclaration, TypedPath } from './adapter.js';
|
|
4
2
|
import type { RuntimeShell } from './durability.js';
|
|
5
3
|
import type { LiveConversations } from './conversation-live.js';
|
|
6
4
|
import type { WriteRule } from './declaration.js';
|
|
7
5
|
import type { FiguresRead } from './figures.js';
|
|
8
|
-
import type { Withheld } from './install.js';
|
|
9
6
|
import type { LiveQueries } from './live.js';
|
|
10
|
-
import type { Log } from './log.js';
|
|
11
7
|
import type { ModelState } from './model.js';
|
|
8
|
+
import type { Presence } from './presence.js';
|
|
12
9
|
import type { ReadAnswers } from './reads.js';
|
|
13
10
|
import type { Recovery } from './recovery.js';
|
|
14
|
-
import type {
|
|
11
|
+
import type { Retries } from './retried.js';
|
|
15
12
|
import type { RuntimeSocket } from './socket.js';
|
|
16
|
-
import type {
|
|
17
|
-
import type { Settling } from './saves.js';
|
|
18
|
-
import type { HeldCover, RuntimeStore, Store, Work } from './store.js';
|
|
13
|
+
import type { HeldCover, Store } from './store.js';
|
|
19
14
|
import type { schemaTypes } from './attached-model.js';
|
|
20
15
|
export type Runtime = {
|
|
21
16
|
readonly store: Store;
|
|
22
17
|
readonly socket: RuntimeSocket;
|
|
23
|
-
readonly
|
|
18
|
+
readonly presence: Presence;
|
|
24
19
|
readonly recovery: Recovery;
|
|
20
|
+
readonly retries: Retries;
|
|
25
21
|
readonly shell: RuntimeShell;
|
|
26
22
|
readonly localSaves: boolean;
|
|
27
23
|
readonly roomTypes: Parameters<typeof schemaTypes>[1];
|
|
@@ -34,10 +30,4 @@ export type Runtime = {
|
|
|
34
30
|
readonly liveQueries: LiveQueries<HeldCover>;
|
|
35
31
|
readonly figures: FiguresRead;
|
|
36
32
|
readonly lastAnswers: ReadAnswers;
|
|
37
|
-
settle(local: RuntimeStore, locator: string, work: Work, record: ReplicaRecord, queue: readonly ChangeBatch[], settling?: Settling): Promise<ChangeSet>;
|
|
38
|
-
scoped(result: ScopedRefusal, locator: string, declaration: RoomDeclaration, local: RuntimeStore): Promise<void>;
|
|
39
|
-
submitLater(locator: string): void;
|
|
40
|
-
unpair(local: RuntimeStore): Promise<void>;
|
|
41
|
-
advanced(room: DiscoveredRoom, local: RuntimeStore, authorized: Authorization): Promise<Withheld | null>;
|
|
42
|
-
withhold(withheld: Withheld, room: DiscoveredRoom, local: RuntimeStore, progress: CycleProgress): Promise<void>;
|
|
43
33
|
};
|
package/dist/mdruntime/save.d.ts
CHANGED
|
@@ -1,101 +1,58 @@
|
|
|
1
1
|
import { type Validation } from '../mdmodel/index.js';
|
|
2
2
|
import type { ProviderLimit } from './adapter.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type ChangeBatch, type WrittenBy } from './change.js';
|
|
4
4
|
import { type Composition } from './collection.js';
|
|
5
5
|
import type { WriteRule } from './declaration.js';
|
|
6
6
|
import { type Layer } from './overlay.js';
|
|
7
|
-
import type { VisibleLayer } from './replica.js';
|
|
8
|
-
import type
|
|
7
|
+
import type { ReplicaRecord, VisibleLayer } from './replica.js';
|
|
8
|
+
import { type ChangedPart, type RoomDraftRecord, type SavedDraft } from './room-draft.js';
|
|
9
9
|
export type SaveRefusal = {
|
|
10
10
|
code: string;
|
|
11
11
|
retryable: boolean;
|
|
12
12
|
file?: string;
|
|
13
13
|
location?: string;
|
|
14
|
+
line?: number;
|
|
14
15
|
referrers?: readonly string[];
|
|
15
16
|
parts?: readonly ChangedPart[];
|
|
16
17
|
};
|
|
17
|
-
export type
|
|
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, composition: Composition): 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
|
-
rule: WriteRule;
|
|
77
|
-
visible: VisibleLayer;
|
|
78
|
-
folders: ReadonlySet<string>;
|
|
79
|
-
queued: ReadonlySet<string>;
|
|
80
|
-
unmodeled: boolean;
|
|
81
|
-
validate: Validator;
|
|
49
|
+
readonly kind: 'planned';
|
|
50
|
+
readonly identifier: string;
|
|
51
|
+
readonly rooms: readonly PlannedRoom[];
|
|
82
52
|
};
|
|
83
|
-
export type
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}[];
|
|
90
|
-
providerLimits: readonly ProviderLimit[];
|
|
91
|
-
local: boolean;
|
|
92
|
-
writtenBy?: WrittenBy;
|
|
93
|
-
};
|
|
94
|
-
export type MoveResult = {
|
|
95
|
-
kind: 'moved';
|
|
96
|
-
leaving: ChangeBatch;
|
|
97
|
-
arriving: ChangeBatch;
|
|
98
|
-
} | Refusing;
|
|
99
|
-
export declare function buildMove(input: MoveInput): Promise<MoveResult>;
|
|
100
|
-
export declare function buildBatch(input: SaveInput): Promise<BatchResult>;
|
|
101
|
-
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>;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { type ChangeSet } from './change-set.js';
|
|
2
1
|
import { type ChangeBatch, type WrittenBy } from './change.js';
|
|
3
2
|
import { type AttachAnswer, type BinaryLinkAnswer, type HeldBinaryAnswer, type HeldShownAnswer } from './outcome.js';
|
|
4
|
-
import { type
|
|
5
|
-
import { type ReturnReason, type RoomDraftParts } from './room-draft.js';
|
|
3
|
+
import { type RoomDraftParts } from './room-draft.js';
|
|
6
4
|
import type { Runtime } from './runtime.js';
|
|
7
5
|
import { type SaveRefusal } from './save.js';
|
|
8
|
-
import type {
|
|
6
|
+
import type { Store } from './store.js';
|
|
9
7
|
export type SaveResult = {
|
|
10
8
|
outcome: 'saved';
|
|
11
9
|
identifier: string;
|
|
@@ -27,42 +25,6 @@ export type BinaryFileSurface = {
|
|
|
27
25
|
attach(room: string, file: File): Promise<AttachAnswer>;
|
|
28
26
|
part(file: string, part: number): Promise<Uint8Array | null>;
|
|
29
27
|
};
|
|
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, record: ReplicaRecord, 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
28
|
export declare function saveRoomDrafts(runtime: Runtime, locator: string, named: readonly SavedRoomDraft[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
|
|
67
29
|
export declare function saveParts(runtime: Runtime, locator: string, named: readonly SavedParts[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
|
|
68
30
|
export declare function batchFile(store: Store, batch: ChangeBatch): (localId: string) => Promise<Blob>;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import type { CallResult } from '../outcome.js';
|
|
1
2
|
export type Live = () => boolean;
|
|
3
|
+
export type KeptSender = {
|
|
4
|
+
next(): Promise<CallResult>;
|
|
5
|
+
};
|
|
2
6
|
type LaneRules = {
|
|
3
7
|
generation(): number;
|
|
4
8
|
continuing(): boolean;
|
|
5
9
|
stopping(): boolean;
|
|
10
|
+
failed(locator: string, error: unknown): void;
|
|
6
11
|
};
|
|
7
12
|
export type Lanes = {
|
|
8
13
|
task(lane: string, work: (live: Live) => Promise<void>): Promise<void>;
|
|
@@ -11,9 +16,12 @@ export type Lanes = {
|
|
|
11
16
|
roomWork(): number;
|
|
12
17
|
current(): Promise<unknown>;
|
|
13
18
|
finished(): Promise<unknown>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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;
|
|
17
25
|
};
|
|
18
|
-
export declare function createLanes({ generation, continuing, stopping }: LaneRules): Lanes;
|
|
26
|
+
export declare function createLanes({ generation, continuing, stopping, failed }: LaneRules): Lanes;
|
|
19
27
|
export {};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { Adapter, Authorization, ConversationEvent, Discovery, HeldRoom, RoomStreamEvent, ServiceMode } from './adapter.js';
|
|
2
2
|
import type { Reads } from './bootstrap.js';
|
|
3
3
|
import type { Cell } from './cell.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Retries } from './retried.js';
|
|
5
5
|
import { type Admission } from './socket/admission.js';
|
|
6
6
|
import { type Answers } from './socket/answers.js';
|
|
7
7
|
import { type Lanes } from './socket/lanes.js';
|
|
8
|
-
import { type Rooms } from './socket/rooms.js';
|
|
9
8
|
import { type Session } from './socket/session.js';
|
|
10
|
-
export type { Live } from './socket/lanes.js';
|
|
9
|
+
export type { KeptSender, Live } from './socket/lanes.js';
|
|
11
10
|
export type { ConnectionRefusal, ConnectionRefusalCode, Moving, RefusalReason, } from './socket/session.js';
|
|
12
11
|
type SocketEvent = {
|
|
13
12
|
readonly kind: 'opened';
|
|
@@ -27,7 +26,6 @@ export type RuntimeSocket = Admission & Answers & {
|
|
|
27
26
|
readonly reads: Reads;
|
|
28
27
|
readonly streamed: boolean;
|
|
29
28
|
readonly session: Cell<Session>;
|
|
30
|
-
readonly rooms: Rooms;
|
|
31
29
|
readonly lanes: Lanes;
|
|
32
30
|
readonly ready: Promise<void>;
|
|
33
31
|
readonly firstDiscovery: Promise<void>;
|
|
@@ -65,4 +63,4 @@ export type RuntimeSocket = Admission & Answers & {
|
|
|
65
63
|
abortReads(): void;
|
|
66
64
|
stopReads(): void;
|
|
67
65
|
};
|
|
68
|
-
export declare function createSocket(adapter: Adapter,
|
|
66
|
+
export declare function createSocket(adapter: Adapter, retries: Retries, authorization: Authorization | undefined): RuntimeSocket;
|
|
@@ -45,13 +45,6 @@ export type ChatRequest = {
|
|
|
45
45
|
readonly room: string;
|
|
46
46
|
readonly message?: string;
|
|
47
47
|
};
|
|
48
|
-
export type ChatRoomRequest = {
|
|
49
|
-
readonly request: string;
|
|
50
|
-
readonly room: {
|
|
51
|
-
readonly ref: string;
|
|
52
|
-
readonly name: string;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
48
|
type RequestAgentFunction = {
|
|
56
49
|
readonly name: string;
|
|
57
50
|
readonly version: number;
|
|
@@ -6,8 +6,8 @@ import type { ReplicaRecord } from '../replica.js';
|
|
|
6
6
|
import type { Submission } from '../outcome.js';
|
|
7
7
|
import type { RoomDraftRecord, SavedDraft } from '../room-draft.js';
|
|
8
8
|
import type { ModelState, StoredModel } from '../model.js';
|
|
9
|
-
import type { CommittedWrite, ConversationWrite, HeldConversation, HeldRow, HeldEntry, MessageWindow, QueryAnswer, QueryRoom, Referrer, ReplicaOpened, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, TypedEntry, View } from '../tables.js';
|
|
10
|
-
export type { ConversationWrite, HeldConversation, MessageWindow } from '../tables.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
11
|
export type TransferRecord = {
|
|
12
12
|
readonly locator: string;
|
|
13
13
|
readonly transfer: string;
|
|
@@ -125,6 +125,7 @@ export type Facts = {
|
|
|
125
125
|
readonly targets: Readonly<Record<string, TargetRecord>>;
|
|
126
126
|
readonly conversationList: readonly ListedConversation[] | null;
|
|
127
127
|
readonly conversationCursor: string | null;
|
|
128
|
+
readonly chatPins: readonly string[];
|
|
128
129
|
};
|
|
129
130
|
export type Commit = {
|
|
130
131
|
readonly rooms: readonly RoomCommit[];
|
|
@@ -191,7 +192,10 @@ export type RuntimeStore = {
|
|
|
191
192
|
messageCount(conversation: string, phrase?: string | null): Promise<number>;
|
|
192
193
|
turnArrived(conversation: string, turn: string): Promise<boolean>;
|
|
193
194
|
conversationRows(conversations: readonly string[]): Promise<readonly HeldRow[]>;
|
|
194
|
-
|
|
195
|
+
conversationFacts(): Promise<readonly HeldFact[]>;
|
|
196
|
+
keepConversationFact(fact: HeldFact): Promise<void>;
|
|
197
|
+
storedConversations(): Promise<readonly string[]>;
|
|
198
|
+
dropConversations(conversations: readonly string[]): Promise<readonly string[]>;
|
|
195
199
|
chatDrafts(): Promise<readonly ChatDraftRecord[]>;
|
|
196
200
|
chatDraft(conversation: string): Promise<ChatDraftRecord | null>;
|
|
197
201
|
keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
|
|
@@ -6,6 +6,7 @@ import type { ChangeSet } from './change-set.js';
|
|
|
6
6
|
import type { Composition } from './collection.js';
|
|
7
7
|
import type { ReadinessWatch } from './preparation.js';
|
|
8
8
|
import type { Persistence } from './readiness.js';
|
|
9
|
+
import type { Retries } from './retried.js';
|
|
9
10
|
import type { Listing } from './listing.js';
|
|
10
11
|
import type { Seeded } from './seed.js';
|
|
11
12
|
import type { ModelState } from './model.js';
|
|
@@ -14,16 +15,15 @@ import { type HeldReplica, type ReplicaRecord } from './replica.js';
|
|
|
14
15
|
import type { RoomDraftRecord } from './room-draft.js';
|
|
15
16
|
import { type SyncStatus } from './status.js';
|
|
16
17
|
import type { RuntimeDatabase } from './tables.js';
|
|
17
|
-
import { type Fences } from './store/fences.js';
|
|
18
18
|
import { type Installs } from './store/installs.js';
|
|
19
|
-
import { type HeldCover, type PendingState, type RuntimeStore } from './store/records.js';
|
|
19
|
+
import { type HeldCover, type HeldStatus, type PendingState, type RuntimeStore } from './store/records.js';
|
|
20
20
|
import { type ReadinessQueue } from './store/readiness.js';
|
|
21
21
|
import { type RoomHeld } from './store/room-held.js';
|
|
22
22
|
import { type Space } from './store/space.js';
|
|
23
23
|
import { type Watcher, type Watching } from './store/watchers.js';
|
|
24
24
|
import { createWrites, type InstallHold } from './store/writes.js';
|
|
25
|
-
export {
|
|
26
|
-
export type { AuthoredWrite, ChatDraftRecord, ChatSubmission, CoveredRoom, Facts, HeldConversation, HeldCover, PendingState, RefreshedPage, RuntimeStore, StagedPage, TransferRecord, } from './store/records.js';
|
|
25
|
+
export type { RoomInstall } from './store/installs.js';
|
|
26
|
+
export type { AuthoredWrite, ChatDraftRecord, ChatSubmission, ConversationFact, CoveredRoom, Facts, HeldConversation, HeldCover, PendingState, RefreshedPage, RuntimeStore, StagedPage, TransferRecord, } from './store/records.js';
|
|
27
27
|
export type { InstallHold } from './store/writes.js';
|
|
28
28
|
export type { CommittedWrite, QueryRoom, RoomCommit, RuntimeDatabase, StoredEntry, StoredFile, View, } from './tables.js';
|
|
29
29
|
export type Stored = {
|
|
@@ -56,6 +56,7 @@ type Device = {
|
|
|
56
56
|
readonly preparing: boolean;
|
|
57
57
|
readonly sweeping: boolean;
|
|
58
58
|
readonly unpreparedDemand: ReadonlySet<string>;
|
|
59
|
+
readonly unpreparable: ReadonlySet<string>;
|
|
59
60
|
readonly establishing: ReadonlySet<string>;
|
|
60
61
|
readonly status: SyncStatus;
|
|
61
62
|
readonly roomsShown: Listing | null;
|
|
@@ -66,6 +67,8 @@ type StoreOptions = {
|
|
|
66
67
|
readonly builtIn: ModelState;
|
|
67
68
|
readonly typedPaths: readonly TypedPath[];
|
|
68
69
|
readonly persistence: Persistence;
|
|
70
|
+
readonly retries: Retries;
|
|
71
|
+
lost(locator: string): boolean;
|
|
69
72
|
opening(records: RuntimeStore): Promise<RuntimeStore>;
|
|
70
73
|
unpublished(error: unknown): void;
|
|
71
74
|
changed(set: ChangeSet): Promise<void>;
|
|
@@ -95,6 +98,8 @@ export type Store = {
|
|
|
95
98
|
work(locator: string): Promise<Work>;
|
|
96
99
|
replica(locator: string): Promise<Held | undefined>;
|
|
97
100
|
covering(): Promise<HeldCover>;
|
|
101
|
+
status(): Promise<HeldStatus>;
|
|
102
|
+
queued(): Promise<readonly string[]>;
|
|
98
103
|
drafts(locator?: string, paths?: readonly string[]): Promise<readonly RoomDraftRecord[]>;
|
|
99
104
|
draft(locator: string, path: string): Promise<RoomDraftRecord | undefined>;
|
|
100
105
|
composed(record: Pick<ReplicaRecord, 'model' | 'declaration'>): Composition;
|
|
@@ -103,13 +108,13 @@ export type Store = {
|
|
|
103
108
|
watch(topic: string, notify: (value: unknown) => void): Watcher;
|
|
104
109
|
watching(topic: string, which?: Watching): readonly Watcher[];
|
|
105
110
|
tell(topic: string, value: unknown): void;
|
|
106
|
-
readonly fences: Fences;
|
|
107
111
|
readonly installs: Installs;
|
|
108
112
|
readonly seeds: Seeds;
|
|
109
113
|
readonly landed: RoomHeld<LandedAhead>;
|
|
110
114
|
readonly attached: RoomHeld<AttachedFile>;
|
|
111
115
|
readonly opened: OpenedFiles;
|
|
112
116
|
part(file: string, part: number): Promise<Uint8Array | null>;
|
|
117
|
+
prepareAgain(locator?: string): void;
|
|
113
118
|
forget(locator: string): void;
|
|
114
119
|
close(): void;
|
|
115
120
|
};
|
|
@@ -152,4 +152,5 @@ export declare function heldLocators(connection: Connection): readonly string[];
|
|
|
152
152
|
export declare function demoted(connection: Connection): null;
|
|
153
153
|
export declare function facts(connection: Connection): Readonly<Record<string, string>>;
|
|
154
154
|
export declare function presentation(connection: Connection, app: string): string | null;
|
|
155
|
+
export declare function tablesOf(statements: readonly string[]): readonly string[];
|
|
155
156
|
export declare function ended(connection: Connection): void;
|
|
@@ -46,8 +46,8 @@ export type MdRuntime = {
|
|
|
46
46
|
resolve(room: string, path: string, destination: string): Promise<Resolution>;
|
|
47
47
|
binaryFile: BinaryFileSurface;
|
|
48
48
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
49
|
+
answered(operation: string): Promise<boolean>;
|
|
49
50
|
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
50
|
-
log(): string;
|
|
51
51
|
persistence(): boolean;
|
|
52
52
|
retry(): Promise<void>;
|
|
53
53
|
cleanUp(): Promise<number>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { type QueryAnswer, type QueryRoom } from './compile.js';
|
|
2
2
|
import type { Composed } from './collection.js';
|
|
3
3
|
import type { UnsentWork } from './durability.js';
|
|
4
|
-
import { type ConversationWrite, type HeldConversation, type HeldRow, type MessageWindow } from './messages.js';
|
|
4
|
+
import { type ConversationWrite, type HeldConversation, type HeldFact, type HeldRow, type MessageWindow } from './messages.js';
|
|
5
5
|
import type { GroupTotal, Plan } from './query.js';
|
|
6
6
|
import { type ReadAt } from './reads.js';
|
|
7
7
|
import { type ConversationTally, type RoomTally } from './tallies.js';
|
|
8
8
|
import { type Committed, type Covering, type HeldEntry, type HeldLocators, type HeldRoomRow, type HeldRoomWork, type ReplicaOpened, type Referrer, type Resumed, type RoomCommit, type StoredEntry, type TypedEntry, type View } from './stored.js';
|
|
9
9
|
export type { Committed, Covering, HeldEntry, HeldLocators, HeldRoomRow, HeldRoomWork, OverlayEntry, ReplicaOpened, Referrer, Resumed, RoomCommit, StoredEntry, TypedEntry, View, } from './stored.js';
|
|
10
10
|
export type { QueryAnswer, QueryRoom } from './compile.js';
|
|
11
|
-
export type { ConversationWrite, HeldConversation, HeldRow, MessageWindow } from './messages.js';
|
|
11
|
+
export type { ConversationFact, ConversationWrite, HeldConversation, HeldFact, HeldRow, MessageWindow, } from './messages.js';
|
|
12
12
|
export type { ConversationTally, RoomTally } from './tallies.js';
|
|
13
13
|
export type Value = string | number | bigint | Uint8Array | null;
|
|
14
14
|
export type Row = Readonly<Record<string, Value>>;
|
|
@@ -380,9 +380,12 @@ export interface RuntimeRequests {
|
|
|
380
380
|
readonly conversations: readonly string[] | null;
|
|
381
381
|
readonly since: string;
|
|
382
382
|
}, readonly ConversationTally[]>;
|
|
383
|
+
readonly 'conversation.facts': Asked<Nothing, readonly HeldFact[]>;
|
|
384
|
+
readonly 'conversation.fact': Asked<HeldFact, null>;
|
|
385
|
+
readonly 'conversation.stored': Asked<Nothing, readonly string[]>;
|
|
383
386
|
readonly 'conversation.drop': Asked<{
|
|
384
387
|
readonly conversations: readonly string[];
|
|
385
|
-
},
|
|
388
|
+
}, readonly string[]>;
|
|
386
389
|
readonly 'space.probe': Asked<Nothing, null>;
|
|
387
390
|
readonly 'read.stored': Asked<ReadAt, string | null>;
|
|
388
391
|
readonly 'read.keep': Asked<ReadAt & {
|