@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,43 @@
|
|
|
1
|
+
import type { ModelState } from './model.js';
|
|
2
|
+
import type { Adapter, TypedPath, AdapterFailure, Authorization, BootstrapPart, DiscoveredRoom, NotReady, RetryableRefusal, RoomModels } from './adapter.js';
|
|
3
|
+
import type { Composition } from './collection.js';
|
|
4
|
+
import type { InstallationStep } from './readiness.js';
|
|
5
|
+
import { type Refreshing } from './refresh.js';
|
|
6
|
+
import { type ReplicaRecord } from './replica.js';
|
|
7
|
+
import type { StagedPage, TransferRecord } from './store.js';
|
|
8
|
+
import { type Unconfirmed } from './transfer.js';
|
|
9
|
+
export type Bootstrapped = {
|
|
10
|
+
kind: 'staged';
|
|
11
|
+
record: ReplicaRecord;
|
|
12
|
+
refreshed: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type BootstrapOutcome = Bootstrapped | Unconfirmed | NotReady | RetryableRefusal | AdapterFailure;
|
|
15
|
+
export type HeldModels = {
|
|
16
|
+
collection: ModelState;
|
|
17
|
+
};
|
|
18
|
+
export type Remodel = (models: RoomModels | undefined, held: HeldModels) => HeldModels;
|
|
19
|
+
export type Reads = Pick<Adapter, 'bootstrap' | 'refresh' | 'reached'>;
|
|
20
|
+
export type Arriving = {
|
|
21
|
+
at(bytes: number): void;
|
|
22
|
+
end(): void;
|
|
23
|
+
};
|
|
24
|
+
export type Resumed = {
|
|
25
|
+
readonly record: TransferRecord | null;
|
|
26
|
+
readonly staged: ReadonlySet<string>;
|
|
27
|
+
};
|
|
28
|
+
export type Staging = {
|
|
29
|
+
held(locator: string): TransferRecord | null;
|
|
30
|
+
turn(locator: string, step: InstallationStep): Promise<() => void>;
|
|
31
|
+
unqueued(): Promise<void>;
|
|
32
|
+
queued(text: number): () => void;
|
|
33
|
+
arriving(locator: string): Arriving;
|
|
34
|
+
readonly streamed: boolean;
|
|
35
|
+
stage(record: TransferRecord, page: StagedPage, composition: Composition): Promise<TransferRecord | null>;
|
|
36
|
+
resume(record: TransferRecord, parts: readonly BootstrapPart[], composition: Composition): Promise<Resumed | null>;
|
|
37
|
+
derive(locator: string, key: number, composition: Composition): Promise<boolean>;
|
|
38
|
+
refreshing(locator: string, key: number, composition: Composition): Promise<Refreshing>;
|
|
39
|
+
abandon(locator: string): Promise<void>;
|
|
40
|
+
setAside(locator: string): Promise<void>;
|
|
41
|
+
release(key: number): Promise<void>;
|
|
42
|
+
};
|
|
43
|
+
export declare function bootstrapRoom(adapter: Reads, authorization: Authorization, room: DiscoveredRoom, held: HeldModels, builtIn: ModelState, typedPaths: readonly TypedPath[], remodel: Remodel, continuing: () => boolean, staging: Staging): Promise<BootstrapOutcome>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
|
|
2
|
+
import type { MdRuntimeClient } from './client.js';
|
|
3
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
4
|
+
type Rows = DocumentResult | GroupResult;
|
|
5
|
+
export type WindowAnswer = Rows | PendingResult;
|
|
6
|
+
export type WindowChain = {
|
|
7
|
+
want(count: number): void;
|
|
8
|
+
close(): void;
|
|
9
|
+
};
|
|
10
|
+
export declare function chainedWindows(runtime: MdRuntimeClient, query: DocumentQuery | GroupQuery, count: number, publish: (answers: readonly (WindowAnswer | null)[], settled: boolean) => void): WindowChain;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type DocumentChange = {
|
|
2
|
+
readonly locator: string;
|
|
3
|
+
readonly path: string | null;
|
|
4
|
+
};
|
|
5
|
+
export type ChangeSet = {
|
|
6
|
+
documents: readonly DocumentChange[];
|
|
7
|
+
drafts: readonly {
|
|
8
|
+
locator: string;
|
|
9
|
+
path: string;
|
|
10
|
+
}[];
|
|
11
|
+
rooms: readonly string[];
|
|
12
|
+
queues: readonly string[];
|
|
13
|
+
presentations: readonly string[];
|
|
14
|
+
conversations: readonly string[];
|
|
15
|
+
unindexed: readonly string[];
|
|
16
|
+
due: readonly string[];
|
|
17
|
+
};
|
|
18
|
+
type Changed = {
|
|
19
|
+
documents?: readonly string[] | null;
|
|
20
|
+
drafts?: readonly string[];
|
|
21
|
+
room?: boolean;
|
|
22
|
+
queue?: boolean;
|
|
23
|
+
presentation?: string;
|
|
24
|
+
unindexed?: boolean;
|
|
25
|
+
due?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
|
|
28
|
+
export declare function conversationChangeSet(conversations: readonly string[]): ChangeSet;
|
|
29
|
+
export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
|
|
30
|
+
export declare function touches(set: ChangeSet, locator: string, path: string): boolean;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { BinaryFile, HeadChange } from './adapter.js';
|
|
2
|
+
export type Change = {
|
|
3
|
+
readonly kind: 'field';
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly value: unknown;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: 'section';
|
|
9
|
+
readonly path: string;
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly value: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: 'preamble';
|
|
14
|
+
readonly path: string;
|
|
15
|
+
readonly value: string;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: 'create';
|
|
18
|
+
readonly path: string;
|
|
19
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
20
|
+
readonly sections: Readonly<Record<string, string>>;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: 'create';
|
|
23
|
+
readonly path: string;
|
|
24
|
+
readonly content: string;
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: 'replace';
|
|
27
|
+
readonly path: string;
|
|
28
|
+
readonly content: string;
|
|
29
|
+
} | {
|
|
30
|
+
readonly kind: 'binary';
|
|
31
|
+
readonly path: string;
|
|
32
|
+
readonly localId: string;
|
|
33
|
+
readonly byteLength: number;
|
|
34
|
+
readonly mediaType: string;
|
|
35
|
+
readonly sha256: string;
|
|
36
|
+
} | {
|
|
37
|
+
readonly kind: 'move';
|
|
38
|
+
readonly path: string;
|
|
39
|
+
readonly to: string;
|
|
40
|
+
} | {
|
|
41
|
+
readonly kind: 'remove';
|
|
42
|
+
readonly path: string;
|
|
43
|
+
} | (Arriving & {
|
|
44
|
+
readonly content: string;
|
|
45
|
+
}) | (Arriving & {
|
|
46
|
+
readonly binary: BinaryFile;
|
|
47
|
+
});
|
|
48
|
+
type Arriving = {
|
|
49
|
+
readonly kind: 'arrival';
|
|
50
|
+
readonly path: string;
|
|
51
|
+
readonly revision?: string;
|
|
52
|
+
readonly fileId?: string;
|
|
53
|
+
readonly created?: string;
|
|
54
|
+
readonly change?: HeadChange;
|
|
55
|
+
};
|
|
56
|
+
export type PartChange = Extract<Change, {
|
|
57
|
+
readonly kind: 'field' | 'section' | 'preamble';
|
|
58
|
+
}>;
|
|
59
|
+
export declare function isPart(change: Change): change is PartChange;
|
|
60
|
+
export type RoomMove = {
|
|
61
|
+
readonly source: {
|
|
62
|
+
readonly room: string;
|
|
63
|
+
readonly baseRoomVersion: string;
|
|
64
|
+
};
|
|
65
|
+
readonly destination: {
|
|
66
|
+
readonly room: string;
|
|
67
|
+
readonly baseRoomVersion: string;
|
|
68
|
+
readonly handle: string;
|
|
69
|
+
};
|
|
70
|
+
readonly moves: readonly {
|
|
71
|
+
readonly path: string;
|
|
72
|
+
readonly to: string;
|
|
73
|
+
}[];
|
|
74
|
+
};
|
|
75
|
+
export type Precondition = {
|
|
76
|
+
readonly kind: 'field';
|
|
77
|
+
readonly path: string;
|
|
78
|
+
readonly name: string;
|
|
79
|
+
readonly value: unknown;
|
|
80
|
+
} | {
|
|
81
|
+
readonly kind: 'section';
|
|
82
|
+
readonly path: string;
|
|
83
|
+
readonly name: string;
|
|
84
|
+
readonly value: string;
|
|
85
|
+
} | {
|
|
86
|
+
readonly kind: 'preamble';
|
|
87
|
+
readonly path: string;
|
|
88
|
+
readonly value: string;
|
|
89
|
+
} | {
|
|
90
|
+
readonly kind: 'revision';
|
|
91
|
+
readonly path: string;
|
|
92
|
+
readonly revision: string;
|
|
93
|
+
} | {
|
|
94
|
+
readonly kind: 'content';
|
|
95
|
+
readonly path: string;
|
|
96
|
+
readonly content: string;
|
|
97
|
+
} | {
|
|
98
|
+
readonly kind: 'present';
|
|
99
|
+
readonly path: string;
|
|
100
|
+
} | {
|
|
101
|
+
readonly kind: 'absent';
|
|
102
|
+
readonly path: string;
|
|
103
|
+
};
|
|
104
|
+
export type WrittenBy = {
|
|
105
|
+
readonly app: string;
|
|
106
|
+
readonly release: string;
|
|
107
|
+
};
|
|
108
|
+
export type ChangeBatch = {
|
|
109
|
+
validation?: import('./model.js').ValidationReceipt;
|
|
110
|
+
readonly id: string;
|
|
111
|
+
readonly baseRoomVersion: string;
|
|
112
|
+
readonly changes: readonly Change[];
|
|
113
|
+
readonly preconditions: readonly Precondition[];
|
|
114
|
+
readonly writtenBy?: WrittenBy;
|
|
115
|
+
readonly between?: RoomMove;
|
|
116
|
+
};
|
|
117
|
+
export declare function immutable(batch: ChangeBatch): ChangeBatch;
|
|
118
|
+
export declare function partnerOf(batch: ChangeBatch, locator: string): string | null;
|
|
119
|
+
export declare function leaving(batch: ChangeBatch, locator: string): boolean;
|
|
120
|
+
export declare function landing(changes: readonly Change[], index: number, path: string): string | null;
|
|
121
|
+
export declare function departure(changes: readonly Change[], index: number): string;
|
|
122
|
+
export declare function queuedFile(batch: ChangeBatch, path: string, localId: string): number;
|
|
123
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
|
|
2
|
+
import type { HistoryQuery } from './actions.js';
|
|
3
|
+
import type { AppRoom } from './listing.js';
|
|
4
|
+
import type { ConnectionRefusal } from './socket.js';
|
|
5
|
+
import type { RoomSchemas } from './surface.js';
|
|
6
|
+
import type { SavedParts, SavedRoomDraft, SaveResult } from './saves.js';
|
|
7
|
+
import type { ListedAgent, Member, RoomList, ServiceMode } from './adapter.js';
|
|
8
|
+
import type { UnsentWork } from './durability.js';
|
|
9
|
+
import type { ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationSurface, ConversationView } from './conversation.js';
|
|
10
|
+
import { type Observation } from './observation.js';
|
|
11
|
+
import { type AttachAnswer, type BinaryAnswer, type CallResult, type DownloadAnswer, type HistoryAnswer, type QueueEntry, type Resolution } from './outcome.js';
|
|
12
|
+
import type { FiguresResult } from './figures.js';
|
|
13
|
+
import type { Holdings } from './holdings.js';
|
|
14
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
15
|
+
import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
|
|
16
|
+
import type { SearchRequest, SearchResult } from './search.js';
|
|
17
|
+
import type { Readiness } from './readiness.js';
|
|
18
|
+
import type { ObservedRead } from './reads.js';
|
|
19
|
+
import type { SyncStatus } from './status.js';
|
|
20
|
+
import { type RuntimePort } from './wire.js';
|
|
21
|
+
export type BuildFile = (name: string) => Promise<Blob | null>;
|
|
22
|
+
export type MdRuntimeClient = {
|
|
23
|
+
buildFile(name: string): Promise<Blob | null>;
|
|
24
|
+
rooms(): Promise<readonly AppRoom[]>;
|
|
25
|
+
query: {
|
|
26
|
+
(query: DocumentQuery): Promise<DocumentResult | PendingResult>;
|
|
27
|
+
(query: GroupQuery): Promise<GroupResult | PendingResult>;
|
|
28
|
+
};
|
|
29
|
+
search(request: SearchRequest): Promise<SearchResult>;
|
|
30
|
+
types(locator: string): Promise<RoomSchemas>;
|
|
31
|
+
roomDraft: {
|
|
32
|
+
list(): Promise<readonly RoomDraft[]>;
|
|
33
|
+
read(room: string, path: string): Promise<RoomDraft | null>;
|
|
34
|
+
write(room: string, path: string, revision: string | null, parts: RoomDraftParts, next?: string): Promise<RoomDraftWrite>;
|
|
35
|
+
discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
|
|
36
|
+
};
|
|
37
|
+
save(room: string, roomDrafts: readonly SavedRoomDraft[]): Promise<SaveResult>;
|
|
38
|
+
saveParts(room: string, parts: readonly SavedParts[]): Promise<SaveResult>;
|
|
39
|
+
presentation: {
|
|
40
|
+
read(): Promise<unknown>;
|
|
41
|
+
write(value: unknown): Promise<void>;
|
|
42
|
+
edit(members: Readonly<Record<string, unknown>>): Promise<void>;
|
|
43
|
+
};
|
|
44
|
+
conversation: ConversationSurface & {
|
|
45
|
+
pageMetadata(app: string, address: string): Promise<string>;
|
|
46
|
+
};
|
|
47
|
+
chatDraft: ChatDraftSurface;
|
|
48
|
+
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
|
|
49
|
+
resolve(room: string, path: string, destination: string): Promise<Resolution>;
|
|
50
|
+
binaryFile: {
|
|
51
|
+
read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
|
|
52
|
+
attach(room: string, file: File): Promise<AttachAnswer>;
|
|
53
|
+
download(room: string, path: string, revision?: string): Promise<DownloadAnswer>;
|
|
54
|
+
};
|
|
55
|
+
call(name: string, input: unknown): Promise<CallResult>;
|
|
56
|
+
answered(operation: string): Promise<boolean>;
|
|
57
|
+
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
58
|
+
persistence(): Promise<boolean>;
|
|
59
|
+
retry(): Promise<void>;
|
|
60
|
+
cleanUp(): Promise<number>;
|
|
61
|
+
unsent(): Promise<readonly UnsentWork[]>;
|
|
62
|
+
reset(): Promise<void>;
|
|
63
|
+
readAgain(): Promise<void>;
|
|
64
|
+
observe: {
|
|
65
|
+
(topic: 'deployment-facts'): Promise<Observation<unknown>>;
|
|
66
|
+
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
67
|
+
(topic: 'readiness'): Promise<Observation<Readiness>>;
|
|
68
|
+
(topic: 'connection-refusal'): Promise<Observation<ConnectionRefusal | null>>;
|
|
69
|
+
(topic: 'storage-loss'): Promise<Observation<string | null>>;
|
|
70
|
+
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
71
|
+
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
72
|
+
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
73
|
+
(topic: 'authority-changes'): Promise<Observation<number>>;
|
|
74
|
+
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
|
|
75
|
+
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
|
|
76
|
+
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
|
77
|
+
(topic: 'room-drafts'): Promise<Observation<readonly RoomDraft[]>>;
|
|
78
|
+
(topic: 'presentation'): Promise<Observation<unknown>>;
|
|
79
|
+
(topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
|
|
80
|
+
(topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
|
|
81
|
+
(topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
|
|
82
|
+
(topic: 'listed-agents'): Promise<Observation<readonly ListedAgent[]>>;
|
|
83
|
+
(topic: 'room-list'): Promise<Observation<RoomList | null>>;
|
|
84
|
+
(topic: 'figures'): Promise<Observation<FiguresResult>>;
|
|
85
|
+
(topic: 'holdings'): Promise<Observation<Holdings>>;
|
|
86
|
+
(topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
|
|
87
|
+
};
|
|
88
|
+
reauthorize(): Promise<void>;
|
|
89
|
+
settled(): Promise<void>;
|
|
90
|
+
};
|
|
91
|
+
export declare function connectMdRuntime(port: RuntimePort, buildFile?: BuildFile): MdRuntimeClient;
|
|
92
|
+
export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
|
|
93
|
+
export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
|
|
94
|
+
export { roomDraftRevision } from './identity.js';
|
|
95
|
+
export { defineRoomMedia, ROOM_MEDIA, viewFile } from './media.js';
|
|
96
|
+
export type { Observation } from './observation.js';
|
|
97
|
+
export type { Open } from './open.js';
|
|
98
|
+
export { unanswered, type RuntimePort, type WireMember } from './wire.js';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type DefinitionOf, type Document, type ParseResult, type TypedPath } from '../mdmodel/index.js';
|
|
2
|
+
import type { ModelState, TypesResult } from './model.js';
|
|
3
|
+
import type { AppTypedSelection } from './listing.js';
|
|
4
|
+
import type { MdModelIdentity } from './adapter.js';
|
|
5
|
+
export declare const MD_MODEL: MdModelIdentity;
|
|
6
|
+
export type Collection = {
|
|
7
|
+
text: Readonly<Record<string, string>>;
|
|
8
|
+
composition: Composition;
|
|
9
|
+
document(path: string): Document | undefined;
|
|
10
|
+
};
|
|
11
|
+
export type Composition = {
|
|
12
|
+
model: ModelState;
|
|
13
|
+
selection: {
|
|
14
|
+
roots: readonly string[];
|
|
15
|
+
model: ModelState;
|
|
16
|
+
} | null;
|
|
17
|
+
typedPaths: readonly TypedPath[];
|
|
18
|
+
};
|
|
19
|
+
export type Composed = {
|
|
20
|
+
readonly composition: Composition;
|
|
21
|
+
readonly fingerprint: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function composedOf(composition: Composition): Composed;
|
|
24
|
+
type Selecting<M> = {
|
|
25
|
+
readonly model: M;
|
|
26
|
+
readonly selection: {
|
|
27
|
+
readonly roots: readonly string[];
|
|
28
|
+
readonly model: M;
|
|
29
|
+
} | null;
|
|
30
|
+
};
|
|
31
|
+
export declare function selected(composition: {
|
|
32
|
+
readonly selection: {
|
|
33
|
+
readonly roots: readonly string[];
|
|
34
|
+
} | null;
|
|
35
|
+
}, path: string): boolean;
|
|
36
|
+
export declare function governing<M>(composition: Selecting<M>, path: string): M;
|
|
37
|
+
export declare function definitionsAt(composition: Composition, path: string): DefinitionOf;
|
|
38
|
+
export declare function definitionsIn(room: {
|
|
39
|
+
readonly model: TypesResult;
|
|
40
|
+
readonly typedSelection: AppTypedSelection | null;
|
|
41
|
+
}, path: string, typedPaths: readonly TypedPath[]): DefinitionOf;
|
|
42
|
+
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
|
|
43
|
+
export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
|
|
44
|
+
export declare function validRoot(root: unknown): root is string;
|
|
45
|
+
export declare const UNTYPED = "any";
|
|
46
|
+
export declare function textType(read: ParseResult): string | undefined;
|
|
47
|
+
export declare function typedText(read: ParseResult): boolean;
|
|
48
|
+
export declare function available(composition: Composition): boolean;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { sql } from '../mdmodel/index.js';
|
|
2
|
+
import { type Composition } from './collection.js';
|
|
3
|
+
import type { Plan, QueryRows } from './query.js';
|
|
4
|
+
import type { Connection } from './tables.js';
|
|
5
|
+
export type QueryRoom = {
|
|
6
|
+
readonly locator: string;
|
|
7
|
+
readonly key: number;
|
|
8
|
+
readonly composition?: Composition;
|
|
9
|
+
};
|
|
10
|
+
type Fragment = sql.Fragment;
|
|
11
|
+
export declare const VISIBLE: (alias: string) => string;
|
|
12
|
+
export declare function within(alias: string, path: string): Fragment;
|
|
13
|
+
export type QueryAnswer = QueryRows & {
|
|
14
|
+
readonly more?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { SessionState } from '../session-content/index.js';
|
|
2
|
+
import type { AcceptedMessage, ConversationAction, ConversationHistoryRequest, ConversationStream, ListedAgent, ListedConversation, ProcessCommand, SessionOption } from './adapter.js';
|
|
3
|
+
import { type Cell } from './cell.js';
|
|
4
|
+
import type { ChangeSet } from './change-set.js';
|
|
5
|
+
import type { Asked, ConversationAgent, ConversationEntry, ConversationView, RunningTurn } from './conversation.js';
|
|
6
|
+
import type { CallResult } from './outcome.js';
|
|
7
|
+
import type { Recovery } from './recovery.js';
|
|
8
|
+
import type { Attempt, Retries } from './retried.js';
|
|
9
|
+
import type { ChatDraftRecord, RuntimeStore } from './store.js';
|
|
10
|
+
export type ConversationDependencies = {
|
|
11
|
+
call(name: ConversationAction, input: unknown, attempt?: Attempt): Promise<CallResult>;
|
|
12
|
+
history(request: ConversationHistoryRequest): Promise<CallResult>;
|
|
13
|
+
durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
|
|
14
|
+
local(): Promise<RuntimeStore>;
|
|
15
|
+
again(): void;
|
|
16
|
+
settled(): void;
|
|
17
|
+
stream(): ConversationStream | undefined;
|
|
18
|
+
publish(set: ChangeSet): void;
|
|
19
|
+
online(): boolean;
|
|
20
|
+
full(): boolean;
|
|
21
|
+
closed(): boolean;
|
|
22
|
+
unanswered(): void;
|
|
23
|
+
heard(operation: string, lost: boolean): void;
|
|
24
|
+
readonly recovery: Recovery;
|
|
25
|
+
readonly retries: Retries;
|
|
26
|
+
};
|
|
27
|
+
export type Live = {
|
|
28
|
+
turn: RunningTurn | null;
|
|
29
|
+
questions: readonly unknown[];
|
|
30
|
+
process: {
|
|
31
|
+
running: boolean;
|
|
32
|
+
} | null;
|
|
33
|
+
commands: readonly ProcessCommand[];
|
|
34
|
+
options: readonly SessionOption[];
|
|
35
|
+
starting: string | null;
|
|
36
|
+
state: SessionState | null;
|
|
37
|
+
link: {
|
|
38
|
+
connected: boolean;
|
|
39
|
+
} | null;
|
|
40
|
+
deliveryWaiting: readonly string[];
|
|
41
|
+
deliveryUnknown: readonly string[];
|
|
42
|
+
};
|
|
43
|
+
export declare const QUIET: Live;
|
|
44
|
+
export type Fact = Exclude<keyof Live, 'turn'>;
|
|
45
|
+
export declare const FACTS: readonly Fact[];
|
|
46
|
+
type Watcher = {
|
|
47
|
+
readonly notify: (view: ConversationView) => void;
|
|
48
|
+
};
|
|
49
|
+
export type Kept = {
|
|
50
|
+
readonly draft: ChatDraftRecord | null;
|
|
51
|
+
readonly ended: string | null;
|
|
52
|
+
readonly dismissed: string | null;
|
|
53
|
+
readonly pins: readonly string[];
|
|
54
|
+
};
|
|
55
|
+
type HeldWindow = Kept & {
|
|
56
|
+
readonly window: readonly AcceptedMessage[] | null;
|
|
57
|
+
readonly more: boolean;
|
|
58
|
+
readonly total: number | null;
|
|
59
|
+
};
|
|
60
|
+
export type SharedView = {
|
|
61
|
+
readonly conversation: string;
|
|
62
|
+
readonly asked: Asked;
|
|
63
|
+
readonly held: Cell<HeldWindow>;
|
|
64
|
+
ready(): readonly Watcher[];
|
|
65
|
+
join(watcher: Watcher): void;
|
|
66
|
+
admit(watcher: Watcher): boolean;
|
|
67
|
+
leave(watcher: Watcher): boolean;
|
|
68
|
+
empty(): boolean;
|
|
69
|
+
};
|
|
70
|
+
type Listing<T> = (value: T) => void;
|
|
71
|
+
export type Audience<T> = {
|
|
72
|
+
waiting(): boolean;
|
|
73
|
+
told(): boolean;
|
|
74
|
+
join(watcher: Listing<T>): void;
|
|
75
|
+
leave(watcher: Listing<T>): void;
|
|
76
|
+
tell(value: T): void;
|
|
77
|
+
welcome(value: T): void;
|
|
78
|
+
clear(): void;
|
|
79
|
+
};
|
|
80
|
+
type HeldFacts = {
|
|
81
|
+
readonly listKnown: boolean;
|
|
82
|
+
readonly openingRead: boolean;
|
|
83
|
+
readonly openingListed: boolean;
|
|
84
|
+
readonly listOwed: boolean;
|
|
85
|
+
readonly listTelling: boolean;
|
|
86
|
+
readonly agentsShown: string | null;
|
|
87
|
+
readonly listedShown: string | null;
|
|
88
|
+
readonly replicated: ReadonlySet<string>;
|
|
89
|
+
readonly handedReplicated: string | undefined;
|
|
90
|
+
};
|
|
91
|
+
export type Dispatch = Cell<{
|
|
92
|
+
readonly answered: boolean;
|
|
93
|
+
}>;
|
|
94
|
+
export type Relisted = {
|
|
95
|
+
readonly conversations: ReadonlyMap<string, ListedConversation>;
|
|
96
|
+
readonly agents: ReadonlyMap<string, ListedAgent>;
|
|
97
|
+
};
|
|
98
|
+
export type LiveConversations = {
|
|
99
|
+
readonly deps: ConversationDependencies;
|
|
100
|
+
readonly held: Cell<HeldFacts>;
|
|
101
|
+
readonly closing: AbortSignal;
|
|
102
|
+
readonly listeners: Audience<readonly ConversationEntry[]>;
|
|
103
|
+
readonly agentListeners: Audience<readonly ConversationAgent[]>;
|
|
104
|
+
readonly listedListeners: Audience<readonly ListedAgent[]>;
|
|
105
|
+
views(): Iterable<SharedView>;
|
|
106
|
+
viewJoined(key: string, conversation: string, asked: Asked, notify: (view: ConversationView) => void): {
|
|
107
|
+
readonly view: SharedView;
|
|
108
|
+
readonly watcher: Watcher;
|
|
109
|
+
};
|
|
110
|
+
viewLeft(key: string, view: SharedView, watcher: Watcher): void;
|
|
111
|
+
liveOf(conversation: string): Live;
|
|
112
|
+
liveHeld(conversation: string): Live | undefined;
|
|
113
|
+
holdLive(conversation: string, next: Live | null): void;
|
|
114
|
+
factsOwed(conversation: string): void;
|
|
115
|
+
factsHeard(conversation: string, facts: readonly Fact[]): void;
|
|
116
|
+
factsTaken(): readonly (readonly [string, ReadonlySet<Fact>])[];
|
|
117
|
+
behind(conversation: string): boolean;
|
|
118
|
+
behindAll(): readonly string[];
|
|
119
|
+
fellBehind(conversation: string): void;
|
|
120
|
+
caughtUpTo(conversation: string): void;
|
|
121
|
+
gapOpened(conversation: string): void;
|
|
122
|
+
generation(conversation: string): number;
|
|
123
|
+
heardAt(conversation: string, change: string): void;
|
|
124
|
+
newestHeard(conversation: string): string | undefined;
|
|
125
|
+
catching(conversation: string): Promise<void> | undefined;
|
|
126
|
+
catchingUntil(conversation: string, ended: Promise<void>): void;
|
|
127
|
+
creating(conversation: string): void;
|
|
128
|
+
created(conversation: string): void;
|
|
129
|
+
isCreating(conversation: string): boolean;
|
|
130
|
+
relisting(): boolean;
|
|
131
|
+
relistBegun(): void;
|
|
132
|
+
relistHeard(entries: readonly ListedConversation[], agents: readonly ListedAgent[]): void;
|
|
133
|
+
relistDropped(conversation: string): void;
|
|
134
|
+
relistTaken(): Relisted | null;
|
|
135
|
+
sendingBegan(operation: string): Dispatch;
|
|
136
|
+
sendingEnded(operation: string, dispatch: Dispatch): void;
|
|
137
|
+
sending(operation: string): boolean;
|
|
138
|
+
rowSoon(tell: () => void): void;
|
|
139
|
+
inOrder(work: () => Promise<void>): void;
|
|
140
|
+
forget(conversation: string): void;
|
|
141
|
+
current(): boolean;
|
|
142
|
+
known(): boolean;
|
|
143
|
+
listed(): boolean;
|
|
144
|
+
reopened(): void;
|
|
145
|
+
lost(): void;
|
|
146
|
+
close(): void;
|
|
147
|
+
};
|
|
148
|
+
export declare function createLiveConversations(deps: ConversationDependencies): LiveConversations;
|
|
149
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { HeldRow } from './messages.js';
|
|
2
|
+
import { type HouseSource, type RequestAnswer } from './source.js';
|
|
3
|
+
export type ConversationLast = {
|
|
4
|
+
readonly text: string;
|
|
5
|
+
readonly by: 'owner' | 'agent' | 'house';
|
|
6
|
+
readonly at: string;
|
|
7
|
+
};
|
|
8
|
+
export type ConversationStart = Extract<HouseSource, {
|
|
9
|
+
readonly kind: 'request' | 'trigger';
|
|
10
|
+
}>;
|
|
11
|
+
export type ConversationAsk = {
|
|
12
|
+
readonly who: string;
|
|
13
|
+
readonly fromRoom: boolean;
|
|
14
|
+
readonly agent: string | null;
|
|
15
|
+
readonly room: {
|
|
16
|
+
readonly ref: string;
|
|
17
|
+
readonly handle: string;
|
|
18
|
+
readonly name: string;
|
|
19
|
+
};
|
|
20
|
+
readonly prompt: string;
|
|
21
|
+
readonly agentFunction: string | null;
|
|
22
|
+
readonly answer: RequestAnswer | null;
|
|
23
|
+
readonly instruction: string | null;
|
|
24
|
+
readonly at: string;
|
|
25
|
+
readonly request: string;
|
|
26
|
+
readonly message?: string;
|
|
27
|
+
};
|
|
28
|
+
export type ConversationHeld = {
|
|
29
|
+
readonly last: ConversationLast | null;
|
|
30
|
+
readonly answered: string | null;
|
|
31
|
+
readonly opened: string | null;
|
|
32
|
+
readonly failure: string | null;
|
|
33
|
+
readonly startedBy: ConversationStart | null;
|
|
34
|
+
readonly asks: ConversationAsk | null;
|
|
35
|
+
};
|
|
36
|
+
export declare function heldFacts(held: HeldRow | undefined, listed: {
|
|
37
|
+
readonly outcome: string | null;
|
|
38
|
+
readonly waiting: boolean;
|
|
39
|
+
}): ConversationHeld;
|