@agentshouse/app-bridge 0.1.0-c58a055eeaa71 → 0.1.0-c59dd0a694516
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -9
- package/dist/index.d.ts +620 -14
- package/dist/mdmodel/body.d.ts +84 -0
- package/dist/mdmodel/built-in.d.ts +3 -0
- package/dist/mdmodel/definition.d.ts +90 -0
- package/dist/mdmodel/divide.d.ts +2 -0
- package/dist/mdmodel/document.d.ts +21 -0
- package/dist/mdmodel/event.d.ts +76 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/fields.d.ts +5 -0
- package/dist/mdmodel/house-model.d.ts +865 -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 +43 -0
- 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/not-ready.d.ts +1 -0
- package/dist/mdmodel/paths.d.ts +39 -0
- package/dist/mdmodel/pattern.d.ts +9 -0
- package/dist/mdmodel/project.d.ts +21 -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 +3 -0
- package/dist/mdmodel/reserved.d.ts +5 -0
- package/dist/mdmodel/room-types.d.ts +6 -0
- package/dist/mdmodel/types.d.ts +172 -0
- package/dist/mdmodel/validate.d.ts +37 -0
- package/dist/mdmodel/version.d.ts +1 -0
- package/dist/mdmodel/yaml.d.ts +55 -0
- package/dist/mdruntime/actions.d.ts +25 -0
- package/dist/mdruntime/adapter.d.ts +575 -0
- package/dist/mdruntime/attached-model.d.ts +6 -0
- package/dist/mdruntime/authored.d.ts +87 -0
- package/dist/mdruntime/binary.d.ts +17 -0
- package/dist/mdruntime/bootstrap.d.ts +43 -0
- package/dist/mdruntime/cell.d.ts +5 -0
- package/dist/mdruntime/chain.d.ts +11 -0
- package/dist/mdruntime/change-set.d.ts +31 -0
- package/dist/mdruntime/change.d.ts +123 -0
- package/dist/mdruntime/client.d.ts +98 -0
- package/dist/mdruntime/collection.d.ts +49 -0
- package/dist/mdruntime/compile.d.ts +17 -0
- package/dist/mdruntime/conversation-live.d.ts +149 -0
- package/dist/mdruntime/conversation-row.d.ts +39 -0
- package/dist/mdruntime/conversation.d.ts +136 -0
- package/dist/mdruntime/declaration.d.ts +9 -0
- package/dist/mdruntime/durability.d.ts +30 -0
- package/dist/mdruntime/failure.d.ts +15 -0
- package/dist/mdruntime/figures.d.ts +48 -0
- package/dist/mdruntime/holdings.d.ts +28 -0
- package/dist/mdruntime/identity.d.ts +5 -0
- package/dist/mdruntime/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 +12 -0
- package/dist/mdruntime/messages.d.ts +57 -0
- package/dist/mdruntime/model.d.ts +54 -0
- package/dist/mdruntime/observation.d.ts +59 -0
- package/dist/mdruntime/open.d.ts +1 -0
- package/dist/mdruntime/opened.d.ts +21 -0
- package/dist/mdruntime/outcome.d.ts +94 -0
- package/dist/mdruntime/overlay.d.ts +29 -0
- package/dist/mdruntime/preparation.d.ts +40 -0
- package/dist/mdruntime/presence.d.ts +57 -0
- package/dist/mdruntime/query.d.ts +87 -0
- package/dist/mdruntime/reach.d.ts +54 -0
- package/dist/mdruntime/readiness.d.ts +54 -0
- package/dist/mdruntime/reads.d.ts +38 -0
- package/dist/mdruntime/recovery.d.ts +27 -0
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +62 -0
- package/dist/mdruntime/retried.d.ts +29 -0
- package/dist/mdruntime/room-draft.d.ts +197 -0
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +33 -0
- package/dist/mdruntime/save.d.ts +58 -0
- package/dist/mdruntime/saves.d.ts +31 -0
- package/dist/mdruntime/search.d.ts +21 -0
- package/dist/mdruntime/seed.d.ts +24 -0
- 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 +25 -0
- 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 +125 -0
- package/dist/mdruntime/stored.d.ts +166 -0
- package/dist/mdruntime/surface.d.ts +89 -0
- package/dist/mdruntime/tables.d.ts +375 -0
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +4 -0
- package/dist/mdruntime/wire.d.ts +288 -0
- 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 +15 -5
- package/dist/test-host.js +74 -23
- package/docs/families.md +93 -22
- package/package.json +8 -6
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { type Part, type SessionState } from '../session-content/index.js';
|
|
2
|
+
import type { AgentEnvironment, ConversationEvent, ConversationMessage, ListedAgent, ProcessCommand, SessionOption } from './adapter.js';
|
|
3
|
+
import { type ChangeSet } from './change-set.js';
|
|
4
|
+
import { type LiveConversations } from './conversation-live.js';
|
|
5
|
+
import { type ConversationHeld } from './conversation-row.js';
|
|
6
|
+
import type { Open } from './open.js';
|
|
7
|
+
import { type CallResult, type Offline } from './outcome.js';
|
|
8
|
+
import type { ChatRequest } from './source.js';
|
|
9
|
+
import type { CycleProgress } from './status.js';
|
|
10
|
+
import type { RuntimeStore } from './store.js';
|
|
11
|
+
export type ConversationState = Open<'working' | 'asking' | 'idle'>;
|
|
12
|
+
export type ConversationEntry = ConversationHeld & {
|
|
13
|
+
conversation: string;
|
|
14
|
+
agent: {
|
|
15
|
+
identity: string;
|
|
16
|
+
name: string;
|
|
17
|
+
retired: boolean;
|
|
18
|
+
};
|
|
19
|
+
name: string;
|
|
20
|
+
created: string;
|
|
21
|
+
finished: string | null;
|
|
22
|
+
outcome: string | null;
|
|
23
|
+
waiting: boolean;
|
|
24
|
+
subject: string | null;
|
|
25
|
+
state: ConversationState;
|
|
26
|
+
started: string | null;
|
|
27
|
+
line: string | null;
|
|
28
|
+
question: string | null;
|
|
29
|
+
asked: string | null;
|
|
30
|
+
};
|
|
31
|
+
export type ConversationAgent = {
|
|
32
|
+
identity: string;
|
|
33
|
+
name: string;
|
|
34
|
+
cli: string;
|
|
35
|
+
model: string | null;
|
|
36
|
+
effort: string | null;
|
|
37
|
+
environment: AgentEnvironment;
|
|
38
|
+
};
|
|
39
|
+
export type RunningTurn = {
|
|
40
|
+
turn: string;
|
|
41
|
+
started: string | null;
|
|
42
|
+
parts: readonly Part[];
|
|
43
|
+
};
|
|
44
|
+
export type ChatDraft = {
|
|
45
|
+
text: string;
|
|
46
|
+
};
|
|
47
|
+
export type ConversationOptions = {
|
|
48
|
+
limit?: number;
|
|
49
|
+
after?: string;
|
|
50
|
+
total?: true;
|
|
51
|
+
};
|
|
52
|
+
export type ConversationRead = ConversationOptions & {
|
|
53
|
+
text?: string;
|
|
54
|
+
};
|
|
55
|
+
export type ConversationView = {
|
|
56
|
+
conversation: string;
|
|
57
|
+
messages: readonly ConversationMessage[];
|
|
58
|
+
next?: string;
|
|
59
|
+
total?: number;
|
|
60
|
+
turn: RunningTurn | null;
|
|
61
|
+
questions: readonly unknown[];
|
|
62
|
+
process: {
|
|
63
|
+
running: boolean;
|
|
64
|
+
} | null;
|
|
65
|
+
processEnded: string | null;
|
|
66
|
+
commands: readonly ProcessCommand[];
|
|
67
|
+
options: readonly SessionOption[];
|
|
68
|
+
starting: string | null;
|
|
69
|
+
state: SessionState | null;
|
|
70
|
+
link: {
|
|
71
|
+
connected: boolean;
|
|
72
|
+
} | null;
|
|
73
|
+
deliveryWaiting: readonly string[];
|
|
74
|
+
deliveryUnknown: readonly string[];
|
|
75
|
+
chatDraft: (ChatDraft & {
|
|
76
|
+
readonly revision: string;
|
|
77
|
+
}) | null;
|
|
78
|
+
dismissedSuggestion: string | null;
|
|
79
|
+
pins: readonly string[];
|
|
80
|
+
};
|
|
81
|
+
export type RequestDecision = 'approve' | 'decline';
|
|
82
|
+
export type ConversationSurface = {
|
|
83
|
+
list(): Promise<readonly ConversationEntry[]>;
|
|
84
|
+
read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
|
|
85
|
+
create(input: unknown): Promise<CallResult>;
|
|
86
|
+
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
87
|
+
answer(conversation: string, answer: ConversationAnswer, operation: string): Promise<CallResult>;
|
|
88
|
+
interrupt(conversation: string, operation: string): Promise<CallResult>;
|
|
89
|
+
kill(conversation: string, operation: string): Promise<CallResult>;
|
|
90
|
+
delete(conversation: string, operation: string): Promise<CallResult>;
|
|
91
|
+
takeOut(conversation: string, message: string, operation: string): Promise<CallResult>;
|
|
92
|
+
decide(request: ChatRequest, decision: RequestDecision, operation: string): Promise<CallResult>;
|
|
93
|
+
rename(conversation: string, name: string, operation: string): Promise<CallResult>;
|
|
94
|
+
option(conversation: string, option: string, value: string | boolean, operation: string): Promise<CallResult>;
|
|
95
|
+
retry(conversation: string, message: string, operation: string): Promise<CallResult>;
|
|
96
|
+
pin(figures: readonly string[]): Promise<void>;
|
|
97
|
+
openTurn(conversation: string, turn: string): Promise<void>;
|
|
98
|
+
dismissSuggestion(conversation: string, suggestion: string): Promise<void>;
|
|
99
|
+
};
|
|
100
|
+
export type ConversationAnswer = {
|
|
101
|
+
interaction_id: string;
|
|
102
|
+
response: unknown;
|
|
103
|
+
};
|
|
104
|
+
export type ChatDraftSurface = {
|
|
105
|
+
write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
|
|
106
|
+
prepend(conversation: string, draft: ChatDraft): Promise<void>;
|
|
107
|
+
append(conversation: string, draft: ChatDraft): Promise<void>;
|
|
108
|
+
discard(conversation: string): Promise<void>;
|
|
109
|
+
};
|
|
110
|
+
export declare function unheldView(conversation: string): ConversationView;
|
|
111
|
+
export declare const SESSION_STARTED = "Session started";
|
|
112
|
+
export declare const CATCHING_UP = "catching-up";
|
|
113
|
+
export declare const HISTORY_CONVERSATIONS = 64;
|
|
114
|
+
export declare function newChat(agent: string): string;
|
|
115
|
+
export type Asked = {
|
|
116
|
+
limit: number;
|
|
117
|
+
after: string | undefined;
|
|
118
|
+
before: readonly [string, string] | null;
|
|
119
|
+
total: boolean;
|
|
120
|
+
};
|
|
121
|
+
export declare function joinedDraft(first: string, second: string): string;
|
|
122
|
+
export declare function conversationsLearned(alive: LiveConversations): void;
|
|
123
|
+
export declare function conversationSurface(alive: LiveConversations): ConversationSurface;
|
|
124
|
+
export declare function chatDraftSurface(alive: LiveConversations): ChatDraftSurface;
|
|
125
|
+
export declare function conversationsOpened(alive: LiveConversations, local: RuntimeStore): Promise<void>;
|
|
126
|
+
export declare function reconcileOpening(alive: LiveConversations): Promise<void>;
|
|
127
|
+
export declare function reconcileConversations(alive: LiveConversations): Promise<void>;
|
|
128
|
+
export declare function catchUpConversations(alive: LiveConversations, progress: CycleProgress): Promise<void>;
|
|
129
|
+
export declare function holdsSubmission(alive: LiveConversations, operation: string): Promise<boolean>;
|
|
130
|
+
export declare function resendConversations(alive: LiveConversations, progress: CycleProgress): Promise<void>;
|
|
131
|
+
export declare function watchConversation(alive: LiveConversations, conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
|
|
132
|
+
export declare function watchConversationList(alive: LiveConversations, deliver: (entries: readonly ConversationEntry[]) => void): () => void;
|
|
133
|
+
export declare function watchConversationAgents(alive: LiveConversations, deliver: (agents: readonly ConversationAgent[]) => void): () => void;
|
|
134
|
+
export declare function watchListedAgents(alive: LiveConversations, deliver: (agents: readonly ListedAgent[]) => void): () => void;
|
|
135
|
+
export declare function conversationsChanged(alive: LiveConversations, set: ChangeSet): void;
|
|
136
|
+
export declare function receiveConversationEvent(alive: LiveConversations, event: ConversationEvent): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DiscoveredRoom, OperationScopes, PathRule, RoomDeclaration } from './adapter.js';
|
|
2
|
+
export type WriteRefusal = {
|
|
3
|
+
readonly code: 'room-root' | 'provider-owned-path' | 'invalid-path' | `${keyof OperationScopes}-grant`;
|
|
4
|
+
readonly path: string;
|
|
5
|
+
};
|
|
6
|
+
export type WriteRule = (path: string, needs: readonly (keyof OperationScopes)[]) => WriteRefusal | null;
|
|
7
|
+
export declare function declared({ locator: _locator, roomVersion: _roomVersion, ...declaration }: DiscoveredRoom): RoomDeclaration;
|
|
8
|
+
export declare function sameDeclaration(left: RoomDeclaration, right: RoomDeclaration): boolean;
|
|
9
|
+
export declare function writeRule({ operations, providerOwnedPaths, authoredPaths, }: Pick<RoomDeclaration, 'operations' | 'providerOwnedPaths' | 'authoredPaths'>, pathRule: PathRule, local: boolean): WriteRule;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Persistence } from './readiness.js';
|
|
2
|
+
import type { RetriedFailure, Step } from './retried.js';
|
|
3
|
+
export type UnsentKind = 'pending-change' | 'call' | 'room-draft' | 'chat-draft';
|
|
4
|
+
export type UnsentWork = {
|
|
5
|
+
readonly kind: UnsentKind;
|
|
6
|
+
readonly count: number;
|
|
7
|
+
};
|
|
8
|
+
export type AppCode = {
|
|
9
|
+
readonly running: number;
|
|
10
|
+
readonly older: number;
|
|
11
|
+
};
|
|
12
|
+
export type HeldCode = {
|
|
13
|
+
readonly house: number | null;
|
|
14
|
+
readonly apps: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
export type RuntimeShell = {
|
|
17
|
+
persistence: Persistence;
|
|
18
|
+
generation: string | null;
|
|
19
|
+
keepGeneration(value: string): void | Promise<void>;
|
|
20
|
+
dropGeneration(): void | Promise<void>;
|
|
21
|
+
cleanUp?(): Promise<number>;
|
|
22
|
+
measure?(measured: (app: string, code: AppCode | null) => void): Promise<HeldCode>;
|
|
23
|
+
reset(): Promise<void>;
|
|
24
|
+
retried?(failure: RetriedFailure): void;
|
|
25
|
+
succeeded?(step: Step): void;
|
|
26
|
+
};
|
|
27
|
+
export declare function refusedForSpace(error: unknown): boolean;
|
|
28
|
+
export declare function detectStorageLoss(stored: string | null, reported: string | null): string | null;
|
|
29
|
+
export declare function lossStated(persistence: Persistence, loss: string | null): string | null;
|
|
30
|
+
export declare function nextGeneration(stored: string | null, reported: string | null): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ProviderRefusal } from './adapter.js';
|
|
2
|
+
export type RuntimeError = Error & {
|
|
3
|
+
readonly code: string;
|
|
4
|
+
readonly retryable: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type Described = {
|
|
7
|
+
message: string;
|
|
8
|
+
code: string;
|
|
9
|
+
retryable: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function runtimeError(code: string, message?: string, retryable?: boolean): RuntimeError;
|
|
12
|
+
export declare function refusalError(refusal: ProviderRefusal): RuntimeError;
|
|
13
|
+
export declare function failed(error: unknown): RuntimeError;
|
|
14
|
+
export declare function uncaught(error: unknown): void;
|
|
15
|
+
export declare function described(error: unknown): Described;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ChangeSet } from './change-set.js';
|
|
2
|
+
import type { GroupTotal, PendingResult } from './query.js';
|
|
3
|
+
import type { Deliver, Fail } from './reach.js';
|
|
4
|
+
import type { ConversationTally, RoomTally } from './tallies.js';
|
|
5
|
+
import type { QueryRoom } from './tables.js';
|
|
6
|
+
export declare const HOUSE_DIRECTORY = "house";
|
|
7
|
+
export declare const ROOM_TOTALS: {
|
|
8
|
+
readonly outside: readonly ["house"];
|
|
9
|
+
readonly groupBy: readonly ["room"];
|
|
10
|
+
readonly select: {
|
|
11
|
+
readonly size: true;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const FIGURES_DAY_MS = 86400000;
|
|
15
|
+
export type DayFigures = {
|
|
16
|
+
readonly created: number;
|
|
17
|
+
readonly changed: number;
|
|
18
|
+
readonly chats: number;
|
|
19
|
+
readonly messages: number;
|
|
20
|
+
};
|
|
21
|
+
export type RoomFigures = {
|
|
22
|
+
readonly room: string;
|
|
23
|
+
readonly day: DayFigures;
|
|
24
|
+
readonly total: {
|
|
25
|
+
readonly documents: GroupTotal;
|
|
26
|
+
readonly files: GroupTotal;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type Figures = {
|
|
30
|
+
readonly rooms: readonly RoomFigures[];
|
|
31
|
+
readonly agentMessages: number;
|
|
32
|
+
};
|
|
33
|
+
export type FiguresResult = Figures | PendingResult;
|
|
34
|
+
export type FiguresCover = PendingResult | {
|
|
35
|
+
readonly rooms: readonly QueryRoom[];
|
|
36
|
+
};
|
|
37
|
+
export type FiguresSources = {
|
|
38
|
+
cover(): Promise<FiguresCover>;
|
|
39
|
+
rooms(rooms: readonly QueryRoom[], since: string): Promise<readonly RoomTally[]>;
|
|
40
|
+
conversations(conversations: readonly string[] | null, since: string): Promise<readonly ConversationTally[]>;
|
|
41
|
+
};
|
|
42
|
+
export type FiguresRead = {
|
|
43
|
+
watch(deliver: Deliver, fail: Fail): () => void;
|
|
44
|
+
touched(set: ChangeSet): void;
|
|
45
|
+
recover(): void;
|
|
46
|
+
close(): void;
|
|
47
|
+
};
|
|
48
|
+
export declare function createFigures(sources: FiguresSources): FiguresRead;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AppCode } from './durability.js';
|
|
2
|
+
import type { GroupTotal, PendingResult } from './query.js';
|
|
3
|
+
import type { Deliver, Fail } from './reach.js';
|
|
4
|
+
import type { Runtime } from './runtime.js';
|
|
5
|
+
import type { OpenedRoom } from './tables.js';
|
|
6
|
+
export type RoomDocuments = {
|
|
7
|
+
readonly room: string;
|
|
8
|
+
readonly documents: GroupTotal;
|
|
9
|
+
};
|
|
10
|
+
export type HeldApp = ({
|
|
11
|
+
readonly app: string;
|
|
12
|
+
readonly state: 'measured';
|
|
13
|
+
} & AppCode) | {
|
|
14
|
+
readonly app: string;
|
|
15
|
+
readonly state: 'asking' | 'unknown';
|
|
16
|
+
};
|
|
17
|
+
export type Holdings = {
|
|
18
|
+
readonly rooms: readonly RoomDocuments[] | PendingResult;
|
|
19
|
+
readonly opened: GroupTotal & {
|
|
20
|
+
readonly rooms: readonly OpenedRoom[];
|
|
21
|
+
};
|
|
22
|
+
readonly apps: readonly HeldApp[];
|
|
23
|
+
readonly house: number | null;
|
|
24
|
+
readonly total: number | null;
|
|
25
|
+
readonly cleanUp: number | null;
|
|
26
|
+
};
|
|
27
|
+
export declare const CLEANED_TOPIC = "cleaned";
|
|
28
|
+
export declare function watchHoldings({ store, figures, shell }: Runtime, deliver: Deliver, fail: Fail): () => void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function changeBatchIdentity(at?: number): string;
|
|
2
|
+
export declare function roomDraftRevision(): string;
|
|
3
|
+
export declare function chatDraftRevision(): string;
|
|
4
|
+
export declare function transferIdentity(): string;
|
|
5
|
+
export declare function binaryLocalId(): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { AdapterFailure, Authorization, DiscoveredRoom, NotReady, RetryableRefusal } from './adapter.js';
|
|
2
|
+
import { type Reads } from './bootstrap.js';
|
|
3
|
+
import type { Installation, InstallationAmount, RoomCoverage } from './readiness.js';
|
|
4
|
+
import { advancement, type Refresher } from './refresh.js';
|
|
5
|
+
import type { ReplicaRecord } from './replica.js';
|
|
6
|
+
import type { Runtime } from './runtime.js';
|
|
7
|
+
import type { Live } from './socket.js';
|
|
8
|
+
import { type CoveredRoom, type InstallHold, type RuntimeStore, type Store } from './store.js';
|
|
9
|
+
import { type Unconfirmed } from './transfer.js';
|
|
10
|
+
type Standing = {
|
|
11
|
+
readonly key: number | null;
|
|
12
|
+
readonly confirmed: number;
|
|
13
|
+
};
|
|
14
|
+
export type Unheld = {
|
|
15
|
+
readonly staged: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type Withheld = AdapterFailure | RetryableRefusal | NotReady | Unconfirmed;
|
|
18
|
+
type Landing = {
|
|
19
|
+
readonly kind: 'refreshed';
|
|
20
|
+
readonly from: Standing;
|
|
21
|
+
readonly remodelled: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: 'bootstrapped';
|
|
24
|
+
readonly refreshed: boolean;
|
|
25
|
+
readonly from: Standing;
|
|
26
|
+
};
|
|
27
|
+
type Refreshed = {
|
|
28
|
+
kind: 'advanced';
|
|
29
|
+
record: ReplicaRecord;
|
|
30
|
+
from: Standing;
|
|
31
|
+
remodelled: boolean;
|
|
32
|
+
} | Exclude<Awaited<ReturnType<typeof advancement>>, {
|
|
33
|
+
kind: 'advanced';
|
|
34
|
+
}>;
|
|
35
|
+
export declare const ERASE_BATCH = 512;
|
|
36
|
+
export type InstallShare = {
|
|
37
|
+
readonly installing: boolean;
|
|
38
|
+
readonly downloading: boolean;
|
|
39
|
+
readonly bytes: InstallationAmount;
|
|
40
|
+
};
|
|
41
|
+
export declare function installShare(store: Store, { room, state }: RoomCoverage, held: ReadonlyMap<string, CoveredRoom>): InstallShare;
|
|
42
|
+
export declare function installationOf(installing: number, downloading: number, bytes: InstallationAmount): Installation;
|
|
43
|
+
export declare function roomInFlight(store: Store, locator: string): boolean;
|
|
44
|
+
export declare function sweep({ store, socket }: Runtime): void;
|
|
45
|
+
export declare function caughtUpTo(runtime: Runtime, locator: string): void;
|
|
46
|
+
export declare function catching(store: Store, locator: string): void;
|
|
47
|
+
export declare function standingAt(store: Store, locator: string, held: Pick<ReplicaRecord, 'key'> | undefined): Standing;
|
|
48
|
+
export declare function showing(system: Runtime, locator: string, roomVersion: string, held: string | undefined): void;
|
|
49
|
+
export declare function olderThan(system: Runtime, locator: string, roomVersion: string, held: string | undefined): boolean;
|
|
50
|
+
export declare function replaced(store: Store, locators: readonly string[]): void;
|
|
51
|
+
export declare function reachedBy({ store, socket }: Runtime, locator: string, roomVersion: string): Promise<boolean>;
|
|
52
|
+
export declare function behind({ store, socket }: Runtime, room: DiscoveredRoom): Promise<boolean>;
|
|
53
|
+
export declare function writtenAfter({ store, socket }: Runtime, locator: string, roomVersion: string, path: string): Promise<boolean>;
|
|
54
|
+
export declare function pullRefresh(runtime: Runtime, authorized: Authorization, record: ReplicaRecord, liveness: Live, hold: InstallHold, refresh: Refresher): Promise<Refreshed>;
|
|
55
|
+
export declare function pullBootstrap(runtime: Runtime, authorized: Authorization, room: DiscoveredRoom, local: RuntimeStore, liveness: Live, prior: ReplicaRecord | undefined, from?: Reads, unheld?: Unheld): Promise<import("./bootstrap.js").Bootstrapped | NotReady | import("./adapter.js").RevokedAuthorization | import("./adapter.js").RoomNotReadable | import("./adapter.js").TransportUncertainty | Unconfirmed | {
|
|
56
|
+
readonly kind: 'transport-uncertainty';
|
|
57
|
+
} | RetryableRefusal | import("./adapter.js").ScopedRefusal>;
|
|
58
|
+
export declare function publish(runtime: Runtime, local: RuntimeStore, room: DiscoveredRoom, reached: ReplicaRecord, landing: Landing, live: Live): Promise<boolean>;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { HeldRooms } from '../mdmodel/index.js';
|
|
2
|
+
import type { DiscoveredRoom, HeldRoom, OperationScopes, ProviderRefusal, ReplicaAdmission, RoomDeclaration } from './adapter.js';
|
|
3
|
+
import type { Composition } from './collection.js';
|
|
4
|
+
import type { KeyedChange } from './observation.js';
|
|
5
|
+
import { type ModelState, type TypesResult } from './model.js';
|
|
6
|
+
import { type PortReach } from './reach.js';
|
|
7
|
+
import type { ReplicaRecord } from './replica.js';
|
|
8
|
+
import type { Runtime } from './runtime.js';
|
|
9
|
+
import type { Stored } from './store.js';
|
|
10
|
+
export type AppTypedSelection = {
|
|
11
|
+
roots: readonly string[];
|
|
12
|
+
model: TypesResult;
|
|
13
|
+
};
|
|
14
|
+
export type AppRoom = {
|
|
15
|
+
name: string;
|
|
16
|
+
locator: string;
|
|
17
|
+
handle: string;
|
|
18
|
+
operations: OperationScopes;
|
|
19
|
+
replica: ReplicaAdmission;
|
|
20
|
+
model: TypesResult;
|
|
21
|
+
typedSelection: AppTypedSelection | null;
|
|
22
|
+
providerOwnedPaths: readonly string[];
|
|
23
|
+
authoredPaths: readonly string[];
|
|
24
|
+
roomVersion: string | null;
|
|
25
|
+
documents: number;
|
|
26
|
+
synchronizationAvailable: boolean;
|
|
27
|
+
refusal: ProviderRefusal | null;
|
|
28
|
+
locked: boolean;
|
|
29
|
+
};
|
|
30
|
+
type ListedRoom = Omit<AppRoom, 'documents' | 'locked'>;
|
|
31
|
+
export type ListedEntry = ListedRoom & {
|
|
32
|
+
readonly documents: number;
|
|
33
|
+
};
|
|
34
|
+
export type Listing = ReadonlyMap<string, ListedEntry>;
|
|
35
|
+
export type RoomsChange = KeyedChange<string, AppRoom>;
|
|
36
|
+
export declare function modelIn({ socket, presence }: Runtime, locator: string, stored: Stored | undefined): ModelState;
|
|
37
|
+
export declare function compositionFor(runtime: Runtime, record: ReplicaRecord): Composition;
|
|
38
|
+
export declare function declarationOf({ presence }: Runtime, locator: string, stored: Stored | undefined): {
|
|
39
|
+
readonly room: RoomDeclaration;
|
|
40
|
+
readonly available: boolean;
|
|
41
|
+
} | undefined;
|
|
42
|
+
export declare function listedLocators({ presence }: Runtime, held: ReadonlyMap<string, unknown>): string[];
|
|
43
|
+
export declare function listedOrHeld({ presence }: Runtime, held: ReadonlyMap<string, unknown>, locator: string): boolean;
|
|
44
|
+
export declare function listedEntries(runtime: Runtime, touched: readonly string[]): Promise<readonly ListedEntry[] | null>;
|
|
45
|
+
export declare function listingNow(runtime: Runtime): Promise<Listing>;
|
|
46
|
+
export declare function shownRooms(runtime: Runtime, listing: Listing): readonly AppRoom[];
|
|
47
|
+
export declare function shownChange(runtime: Runtime, entries: readonly ListedEntry[]): RoomsChange;
|
|
48
|
+
export declare function roomFacts(runtime: Runtime, reach?: PortReach | null): Promise<HeldRooms>;
|
|
49
|
+
export declare function heldRooms({ store }: Runtime, listed: readonly DiscoveredRoom[]): Promise<HeldRoom[]>;
|
|
50
|
+
export declare function name(runtime: Runtime, locator: string): Promise<void>;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ChangeSet } from './change-set.js';
|
|
2
|
+
import { type KeyedResult, type QueryMessage } from './observation.js';
|
|
3
|
+
import type { PendingResult, PendingRoom, Plan, QueryCoverage } from './query.js';
|
|
4
|
+
import type { Fail } from './reach.js';
|
|
5
|
+
import type { QueryRoom } from './tables.js';
|
|
6
|
+
export type Cover = {
|
|
7
|
+
coverage: QueryCoverage;
|
|
8
|
+
rooms: readonly QueryRoom[];
|
|
9
|
+
} | PendingResult;
|
|
10
|
+
export type Ran = KeyedResult & {
|
|
11
|
+
readonly current: () => boolean;
|
|
12
|
+
};
|
|
13
|
+
export type Run = (plan: Plan, cover: () => Promise<Cover>) => Promise<Ran>;
|
|
14
|
+
export type PendingAt<H> = (held: H, rooms: readonly string[]) => ReadonlyMap<string, PendingRoom | null> | null;
|
|
15
|
+
type Listener = (message: QueryMessage) => void;
|
|
16
|
+
export type LiveQueries<H> = {
|
|
17
|
+
touched(set: ChangeSet): void;
|
|
18
|
+
recover(locators?: readonly string[]): void;
|
|
19
|
+
watch(plan: Plan, identity: string, cover: (held: H) => Cover, pendingAt: PendingAt<H>, deliver: Listener, failed: Fail): () => void;
|
|
20
|
+
close(): void;
|
|
21
|
+
};
|
|
22
|
+
export declare function readerOf(plan: Plan): (locator: string) => boolean;
|
|
23
|
+
export declare function createLiveQueries<H>(run: Run, holding: () => Promise<H>): LiveQueries<H>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MdRuntimeClient } from './client.js';
|
|
2
|
+
import { type ShownAnswer } from './outcome.js';
|
|
3
|
+
export declare const ROOM_MEDIA = "room-media";
|
|
4
|
+
export declare const DIAGRAM = "md-diagram";
|
|
5
|
+
export declare const VIEWING = "ahc-viewer";
|
|
6
|
+
type Show = (room: string, path: string, revision?: string) => Promise<ShownAnswer>;
|
|
7
|
+
export declare function shownBy(show: Show, client: MdRuntimeClient): MdRuntimeClient;
|
|
8
|
+
export declare function rendered(element: Element): boolean;
|
|
9
|
+
export declare function viewable(element: Element): boolean;
|
|
10
|
+
export declare function viewFile(client: MdRuntimeClient, media: Element): void;
|
|
11
|
+
export declare function defineRoomMedia(client: Promise<MdRuntimeClient> | MdRuntimeClient): void;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { AcceptedMessage } from './adapter.js';
|
|
2
|
+
import type { Connection } from './tables.js';
|
|
3
|
+
export declare const MESSAGE_TABLES: readonly string[];
|
|
4
|
+
export declare const ROWS = "WITH chosen AS (\n SELECT listed.value AS conversation,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'assistant' ORDER BY position DESC, identity DESC LIMIT 1) AS answer,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND text <> '' ORDER BY position DESC, identity DESC LIMIT 1) AS said,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'house' ORDER BY position, identity LIMIT 1) AS opened,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'house' AND json_extract(message, '$.waiting') = 1 ORDER BY position, identity LIMIT 1) AS asking\n FROM json_each(?) AS listed\n )\n SELECT chosen.conversation AS conversation,\n substr(said.text, 1, 512) AS said_text,\n json_extract(said.message, '$.role') AS said_role,\n json_extract(said.message, '$.accepted_at') AS said_at,\n answer.turn AS answered,\n substr(json_extract(answer.message, '$.failure'), 1, 512) AS failure,\n (SELECT value FROM conversation_facts WHERE conversation = chosen.conversation AND name = 'openedTurn') AS opened_turn,\n json_extract(opened.message, '$.source') AS opened_source,\n json_extract(opened.message, '$.sender') AS opened_sender,\n asking.identity AS asking_identity,\n asking.text AS asking_text,\n json_extract(asking.message, '$.accepted_at') AS asking_at,\n json_extract(asking.message, '$.source') AS asking_source,\n json_extract(asking.message, '$.sender') AS asking_sender\n FROM chosen\n LEFT JOIN conversation_messages said ON said.id = chosen.said\n LEFT JOIN conversation_messages answer ON answer.id = chosen.answer\n LEFT JOIN conversation_messages opened ON opened.id = chosen.opened\n LEFT JOIN conversation_messages asking ON asking.id = chosen.asking";
|
|
5
|
+
export type HeldConversation = {
|
|
6
|
+
readonly conversation: string;
|
|
7
|
+
readonly read: string | null | undefined;
|
|
8
|
+
readonly partial: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type MessageWindow = {
|
|
11
|
+
readonly messages: AcceptedMessage[];
|
|
12
|
+
readonly more: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type HeldSource = {
|
|
15
|
+
readonly source: unknown;
|
|
16
|
+
readonly sender: string | null;
|
|
17
|
+
};
|
|
18
|
+
export type HeldRow = {
|
|
19
|
+
readonly conversation: string;
|
|
20
|
+
readonly said: {
|
|
21
|
+
readonly text: string;
|
|
22
|
+
readonly role: string | null;
|
|
23
|
+
readonly at: string | null;
|
|
24
|
+
} | null;
|
|
25
|
+
readonly answered: string | null;
|
|
26
|
+
readonly openedTurn: string | null;
|
|
27
|
+
readonly failure: string | null;
|
|
28
|
+
readonly opened: HeldSource | null;
|
|
29
|
+
readonly asking: (HeldSource & {
|
|
30
|
+
readonly identity: string;
|
|
31
|
+
readonly text: string;
|
|
32
|
+
readonly at: string | null;
|
|
33
|
+
}) | null;
|
|
34
|
+
};
|
|
35
|
+
export type ConversationFact = 'openedTurn' | 'dismissedSuggestion';
|
|
36
|
+
export type HeldFact = {
|
|
37
|
+
readonly conversation: string;
|
|
38
|
+
readonly name: ConversationFact;
|
|
39
|
+
readonly value: string;
|
|
40
|
+
};
|
|
41
|
+
export type ConversationWrite = {
|
|
42
|
+
readonly conversation: string;
|
|
43
|
+
readonly messages: readonly AcceptedMessage[];
|
|
44
|
+
readonly read?: {
|
|
45
|
+
readonly at: string | null;
|
|
46
|
+
readonly partial: boolean;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare function heldConversations(connection: Connection, conversations: readonly string[] | null): HeldConversation[];
|
|
50
|
+
export declare function keptMessages(connection: Connection, { conversation, messages, read }: ConversationWrite): null;
|
|
51
|
+
export declare function messageWindow(connection: Connection, conversation: string, limit: number, before: readonly [string, string] | null, phrase: string | null): MessageWindow;
|
|
52
|
+
export declare function messageCount(connection: Connection, conversation: string, phrase: string | null): number;
|
|
53
|
+
export declare function conversationRows(connection: Connection, conversations: readonly string[]): HeldRow[];
|
|
54
|
+
export declare function turnArrived(connection: Connection, conversation: string, turn: string): boolean;
|
|
55
|
+
export declare function conversationFacts(connection: Connection): HeldFact[];
|
|
56
|
+
export declare function keptFact(connection: Connection, { conversation, name, value }: HeldFact): null;
|
|
57
|
+
export declare function forgottenConversations(connection: Connection): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Definition, VerifiedModel } from '../mdmodel/index.js';
|
|
2
|
+
import type { Open } from './open.js';
|
|
3
|
+
export type ModelIdentity = {
|
|
4
|
+
identity: string;
|
|
5
|
+
version: string;
|
|
6
|
+
};
|
|
7
|
+
export type ModelSnapshot = ModelIdentity & {
|
|
8
|
+
schema: string | null;
|
|
9
|
+
revision: string | null;
|
|
10
|
+
};
|
|
11
|
+
export type ModelUnavailableReason = Open<'not-readable' | 'revoked' | 'not-acquired'>;
|
|
12
|
+
export type ModelResult = {
|
|
13
|
+
kind: 'model';
|
|
14
|
+
snapshot: ModelSnapshot;
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'model-unavailable';
|
|
17
|
+
reason: ModelUnavailableReason;
|
|
18
|
+
};
|
|
19
|
+
export type MdType = Definition;
|
|
20
|
+
export type ModelState = {
|
|
21
|
+
status: 'unavailable';
|
|
22
|
+
reason: ModelUnavailableReason;
|
|
23
|
+
} | {
|
|
24
|
+
status: 'current' | 'cached';
|
|
25
|
+
snapshot: ModelSnapshot;
|
|
26
|
+
verifiedWith: ModelIdentity;
|
|
27
|
+
types: VerifiedModel['types'];
|
|
28
|
+
};
|
|
29
|
+
export type StoredModel = Extract<ModelState, {
|
|
30
|
+
status: 'unavailable';
|
|
31
|
+
}> | Omit<Extract<ModelState, {
|
|
32
|
+
status: 'current' | 'cached';
|
|
33
|
+
}>, 'types'>;
|
|
34
|
+
export type TypesResult = {
|
|
35
|
+
status: Open<'unavailable'>;
|
|
36
|
+
reason: ModelUnavailableReason;
|
|
37
|
+
types: null;
|
|
38
|
+
} | {
|
|
39
|
+
status: Open<'current' | 'cached'>;
|
|
40
|
+
identity: string;
|
|
41
|
+
version: string;
|
|
42
|
+
verifiedWith: ModelIdentity;
|
|
43
|
+
types: readonly MdType[];
|
|
44
|
+
schema: string | null;
|
|
45
|
+
revision: string | null;
|
|
46
|
+
};
|
|
47
|
+
export type ValidationReceipt = {
|
|
48
|
+
identity: string;
|
|
49
|
+
version: string;
|
|
50
|
+
source: Open<'current' | 'cached'>;
|
|
51
|
+
};
|
|
52
|
+
export declare const NO_MODEL: ModelState;
|
|
53
|
+
export declare function modelTypes(state: ModelState): TypesResult;
|
|
54
|
+
export declare function storedModel(state: ModelState): StoredModel;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { PendingRoom, QueryCoverage, QueryDocument, QueryGroup, QueryResult } from './query.js';
|
|
2
|
+
import type { ReadinessShown, RoomCoverage } from './readiness.js';
|
|
3
|
+
export type Observation<T> = {
|
|
4
|
+
current(): T;
|
|
5
|
+
subscribe(listener: (value: T) => void): () => void;
|
|
6
|
+
close(): void;
|
|
7
|
+
};
|
|
8
|
+
export type RowKey = string | number;
|
|
9
|
+
export type KeyedResult = {
|
|
10
|
+
result: QueryResult;
|
|
11
|
+
keys: readonly RowKey[];
|
|
12
|
+
};
|
|
13
|
+
export type KeyedChange<K, T> = {
|
|
14
|
+
readonly changed: readonly (readonly [K, T])[];
|
|
15
|
+
readonly removed: readonly K[];
|
|
16
|
+
readonly order: readonly K[] | null;
|
|
17
|
+
};
|
|
18
|
+
export type QueryChange = KeyedChange<RowKey, QueryDocument | QueryGroup> & {
|
|
19
|
+
coverage?: QueryCoverage;
|
|
20
|
+
next?: string | null;
|
|
21
|
+
total?: number;
|
|
22
|
+
};
|
|
23
|
+
export type ReadinessChange = {
|
|
24
|
+
readonly shown: ReadinessShown;
|
|
25
|
+
readonly rooms: KeyedChange<string, RoomCoverage>;
|
|
26
|
+
};
|
|
27
|
+
export type PendingChange = {
|
|
28
|
+
readonly pending: KeyedChange<string, PendingRoom>;
|
|
29
|
+
};
|
|
30
|
+
export type QueryMessage = KeyedResult | QueryChange | PendingChange;
|
|
31
|
+
export type Observed = {
|
|
32
|
+
observation: Observation<unknown>;
|
|
33
|
+
receive(message: unknown): void;
|
|
34
|
+
end(): void;
|
|
35
|
+
};
|
|
36
|
+
export declare function rowsOf(result: QueryResult): readonly (QueryDocument | QueryGroup)[];
|
|
37
|
+
export declare function whole(message: QueryMessage): message is KeyedResult;
|
|
38
|
+
export declare function pendingChange(message: QueryMessage): message is PendingChange;
|
|
39
|
+
export declare function unchanged(change: KeyedChange<unknown, unknown>): boolean;
|
|
40
|
+
export declare function keyedChange<K, H, T>(held: ReadonlyMap<K, H>, keys: readonly K[], rows: readonly T[], same: (was: H, now: T) => boolean): KeyedChange<K, T>;
|
|
41
|
+
export declare function keyedAt<K, H, T>(held: ReadonlyMap<K, H>, at: ReadonlyMap<K, T | null>, same: (was: H, now: T) => boolean): KeyedChange<K, T> | null;
|
|
42
|
+
export declare function keyedInto<K, T>(held: Map<K, T>, change: KeyedChange<K, T>): void;
|
|
43
|
+
export declare function samePending(was: PendingRoom, now: PendingRoom): boolean;
|
|
44
|
+
export declare function replaces(topic: string, message: unknown): boolean;
|
|
45
|
+
export declare function observed(first: unknown, stop: () => void, topic: string): Observed;
|
|
46
|
+
export declare function opened(watch: (deliver: (message: unknown) => void, fail: (error: unknown) => void) => () => void, topic: string): Promise<Observation<unknown>>;
|
|
47
|
+
export declare function observing<Topic extends string>(watch: (topic: Topic, input: readonly unknown[], deliver: (message: unknown) => void, fail: (error: unknown) => void) => () => void): (topic: Topic, ...input: unknown[]) => Promise<Observation<unknown>>;
|
|
48
|
+
export type Digest = {
|
|
49
|
+
readonly pending: Map<string, PendingRoom>;
|
|
50
|
+
} | {
|
|
51
|
+
readonly rows: Map<RowKey, number>;
|
|
52
|
+
readonly coverage: string;
|
|
53
|
+
readonly next: string | undefined;
|
|
54
|
+
readonly total: number | undefined;
|
|
55
|
+
};
|
|
56
|
+
export declare function hashed(text: string): number;
|
|
57
|
+
export declare function digestOf({ result, keys }: KeyedResult): Digest;
|
|
58
|
+
export declare function digestApplied(digest: Digest, message: QueryMessage): Digest;
|
|
59
|
+
export declare function changeOf(previous: Digest, next: KeyedResult): QueryMessage | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Open<Value extends string> = Value | (string & {});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BinaryResult } from './adapter.js';
|
|
2
|
+
import { type RuntimeDatabase } from './tables.js';
|
|
3
|
+
export type OpenedName = {
|
|
4
|
+
readonly locator: string;
|
|
5
|
+
readonly path: string;
|
|
6
|
+
readonly revision: string;
|
|
7
|
+
};
|
|
8
|
+
export type KeptBinary = {
|
|
9
|
+
readonly kind: 'binary';
|
|
10
|
+
readonly file: string;
|
|
11
|
+
readonly byteLength: number;
|
|
12
|
+
readonly mediaType: string;
|
|
13
|
+
};
|
|
14
|
+
export type KeptResult = KeptBinary | Exclude<BinaryResult, {
|
|
15
|
+
kind: 'binary';
|
|
16
|
+
}>;
|
|
17
|
+
export type OpenedFiles = {
|
|
18
|
+
find(name: OpenedName): Promise<KeptBinary | null>;
|
|
19
|
+
fetch(name: OpenedName, read: () => Promise<BinaryResult>): Promise<KeptResult>;
|
|
20
|
+
};
|
|
21
|
+
export declare function openedFiles(database: RuntimeDatabase, lost: (locator: string) => boolean): OpenedFiles;
|