@agentshouse/app-bridge 0.1.0-c646d0da70608 → 0.1.0-c66ec79ae3f1a
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 +4 -4
- package/dist/calls.d.ts +897 -66
- package/dist/index.d.ts +15 -4
- package/dist/mdmodel/condition.d.ts +20 -8
- package/dist/mdmodel/definition.d.ts +16 -1
- package/dist/mdmodel/document.d.ts +5 -5
- package/dist/mdmodel/index.d.ts +10 -8
- package/dist/mdmodel/links.d.ts +28 -0
- package/dist/mdmodel/paths.d.ts +9 -1
- package/dist/mdmodel/project.d.ts +1 -0
- package/dist/mdmodel/types.d.ts +27 -4
- package/dist/mdmodel/validate.d.ts +27 -3
- package/dist/mdruntime/adapter.d.ts +67 -24
- package/dist/mdruntime/chain.d.ts +10 -0
- package/dist/mdruntime/change-set.d.ts +8 -9
- package/dist/mdruntime/change.d.ts +31 -1
- package/dist/mdruntime/client.d.ts +11 -2
- package/dist/mdruntime/collection.d.ts +6 -19
- package/dist/mdruntime/compile.d.ts +10 -0
- package/dist/mdruntime/connection.d.ts +23 -9
- package/dist/mdruntime/conversation.d.ts +15 -3
- package/dist/mdruntime/durability.d.ts +2 -1
- package/dist/mdruntime/file.d.ts +2 -10
- package/dist/mdruntime/observation.d.ts +14 -0
- package/dist/mdruntime/opened.d.ts +21 -0
- package/dist/mdruntime/outcome.d.ts +35 -4
- package/dist/mdruntime/overlay.d.ts +3 -5
- package/dist/mdruntime/query.d.ts +29 -2
- package/dist/mdruntime/reach.d.ts +6 -3
- package/dist/mdruntime/readiness.d.ts +1 -1
- package/dist/mdruntime/recovery.d.ts +2 -2
- package/dist/mdruntime/replica.d.ts +55 -33
- package/dist/mdruntime/room-draft.d.ts +15 -1
- package/dist/mdruntime/save.d.ts +51 -14
- package/dist/mdruntime/search.d.ts +25 -5
- package/dist/mdruntime/seed.d.ts +15 -0
- package/dist/mdruntime/shared.d.ts +8 -3
- package/dist/mdruntime/store.d.ts +99 -71
- package/dist/mdruntime/stored.d.ts +142 -0
- package/dist/mdruntime/tables.d.ts +319 -0
- package/dist/mdruntime/turn.d.ts +5 -3
- package/dist/mdruntime/wire.d.ts +32 -0
- package/dist/test-host.js +1 -1
- package/docs/families.md +8 -5
- package/package.json +1 -1
- package/dist/mdruntime/acquisition.d.ts +0 -13
- package/dist/mdruntime/rows.d.ts +0 -36
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BinaryFile, HeadChange } from './adapter.js';
|
|
1
2
|
export type Change = {
|
|
2
3
|
readonly kind: 'field';
|
|
3
4
|
readonly path: string;
|
|
@@ -29,7 +30,6 @@ export type Change = {
|
|
|
29
30
|
readonly kind: 'binary';
|
|
30
31
|
readonly path: string;
|
|
31
32
|
readonly localId: string;
|
|
32
|
-
readonly blob: Blob;
|
|
33
33
|
readonly byteLength: number;
|
|
34
34
|
readonly mediaType: string;
|
|
35
35
|
readonly sha256: string;
|
|
@@ -40,6 +40,32 @@ export type Change = {
|
|
|
40
40
|
} | {
|
|
41
41
|
readonly kind: 'remove';
|
|
42
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 change?: HeadChange;
|
|
54
|
+
};
|
|
55
|
+
export type RoomMove = {
|
|
56
|
+
readonly source: {
|
|
57
|
+
readonly room: string;
|
|
58
|
+
readonly baseRoomVersion: string;
|
|
59
|
+
};
|
|
60
|
+
readonly destination: {
|
|
61
|
+
readonly room: string;
|
|
62
|
+
readonly baseRoomVersion: string;
|
|
63
|
+
readonly handle: string;
|
|
64
|
+
};
|
|
65
|
+
readonly moves: readonly {
|
|
66
|
+
readonly path: string;
|
|
67
|
+
readonly to: string;
|
|
68
|
+
}[];
|
|
43
69
|
};
|
|
44
70
|
export type Precondition = {
|
|
45
71
|
readonly kind: 'field';
|
|
@@ -81,8 +107,12 @@ export type ChangeBatch = {
|
|
|
81
107
|
readonly changes: readonly Change[];
|
|
82
108
|
readonly preconditions: readonly Precondition[];
|
|
83
109
|
readonly writtenBy?: WrittenBy;
|
|
110
|
+
readonly between?: RoomMove;
|
|
84
111
|
};
|
|
85
112
|
export declare function immutable(batch: ChangeBatch): ChangeBatch;
|
|
113
|
+
export declare function partnerOf(batch: ChangeBatch, locator: string): string | null;
|
|
114
|
+
export declare function leaving(batch: ChangeBatch, locator: string): boolean;
|
|
86
115
|
export declare function landing(changes: readonly Change[], index: number, path: string): string | null;
|
|
87
116
|
export declare function departure(changes: readonly Change[], index: number): string;
|
|
88
117
|
export declare function queuedFile(batch: ChangeBatch, path: string, localId: string): number;
|
|
118
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedRoomDraft, SaveResult } from './connection.js';
|
|
1
|
+
import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult } from './connection.js';
|
|
2
2
|
import type { Member, ServiceMode } from './adapter.js';
|
|
3
3
|
import type { ChatDraft, ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
|
|
4
4
|
import { type Observation } from './observation.js';
|
|
5
5
|
import type { BinaryReference } from './binary.js';
|
|
6
|
-
import type {
|
|
6
|
+
import type { ChosenFile } from './file.js';
|
|
7
|
+
import type { BinaryAnswer, BinaryLinkAnswer, CallResult, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
|
|
7
8
|
import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
|
|
8
9
|
import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
|
|
9
10
|
import type { SearchRequest, SearchResult } from './search.js';
|
|
@@ -25,15 +26,18 @@ export type MdRuntimeClient = {
|
|
|
25
26
|
discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
|
|
26
27
|
};
|
|
27
28
|
save(room: string, roomDrafts: readonly SavedRoomDraft[]): Promise<SaveResult>;
|
|
29
|
+
saveParts(room: string, parts: readonly SavedParts[]): Promise<SaveResult>;
|
|
28
30
|
presentation: {
|
|
29
31
|
read(): Promise<unknown>;
|
|
30
32
|
write(value: unknown): Promise<void>;
|
|
33
|
+
edit(members: Readonly<Record<string, unknown>>): Promise<void>;
|
|
31
34
|
};
|
|
32
35
|
conversation: {
|
|
33
36
|
list(): Promise<readonly ConversationEntry[]>;
|
|
34
37
|
read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
|
|
35
38
|
create(input: unknown): Promise<CallResult>;
|
|
36
39
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
40
|
+
attach(room: string, file: ChosenFile): Promise<CallResult | Offline>;
|
|
37
41
|
answer(conversation: string, answer: unknown): Promise<CallResult>;
|
|
38
42
|
interrupt(conversation: string): Promise<CallResult>;
|
|
39
43
|
kill(conversation: string): Promise<CallResult>;
|
|
@@ -42,11 +46,14 @@ export type MdRuntimeClient = {
|
|
|
42
46
|
};
|
|
43
47
|
chatDraft: {
|
|
44
48
|
write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
|
|
49
|
+
prepend(conversation: string, draft: ChatDraft): Promise<void>;
|
|
45
50
|
discard(conversation: string): Promise<void>;
|
|
46
51
|
};
|
|
47
52
|
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
|
|
53
|
+
resolve(room: string, path: string, destination: string): Promise<Resolution>;
|
|
48
54
|
binaryFile: {
|
|
49
55
|
read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
|
|
56
|
+
link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
|
|
50
57
|
readReference(reference: BinaryReference): Promise<BinaryAnswer>;
|
|
51
58
|
};
|
|
52
59
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
@@ -54,6 +61,7 @@ export type MdRuntimeClient = {
|
|
|
54
61
|
log(): Promise<string>;
|
|
55
62
|
persistence(): Promise<boolean>;
|
|
56
63
|
retry(): Promise<void>;
|
|
64
|
+
cleanUp(): Promise<number>;
|
|
57
65
|
observe: {
|
|
58
66
|
(topic: 'deployment-facts'): Promise<Observation<unknown>>;
|
|
59
67
|
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
@@ -77,6 +85,7 @@ export type MdRuntimeClient = {
|
|
|
77
85
|
};
|
|
78
86
|
export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
|
|
79
87
|
export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
|
|
88
|
+
export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
|
|
80
89
|
export type { Observation } from './observation.js';
|
|
81
90
|
export type { Open } from './open.js';
|
|
82
91
|
export { unanswered, type RuntimePort, type WireMember } from './wire.js';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { type Document
|
|
2
|
-
import {
|
|
1
|
+
import { type Document } from '../mdmodel/index.js';
|
|
2
|
+
import type { ModelState } from './model.js';
|
|
3
3
|
import type { MdModelIdentity } from './adapter.js';
|
|
4
4
|
import { type Paths } from './shared.js';
|
|
5
5
|
import type { Refused } from './transfer.js';
|
|
6
|
-
import { type Later } from './turn.js';
|
|
7
6
|
export declare const MD_MODEL: MdModelIdentity;
|
|
8
7
|
export type Collection = {
|
|
9
8
|
text: Readonly<Record<string, string>>;
|
|
@@ -17,22 +16,10 @@ export type Composition = {
|
|
|
17
16
|
model: ModelState;
|
|
18
17
|
} | null;
|
|
19
18
|
};
|
|
19
|
+
export declare function selected(composition: Composition, path: string): boolean;
|
|
20
20
|
export declare function governing(composition: Composition, path: string): ModelState;
|
|
21
|
-
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition
|
|
22
|
-
export declare function
|
|
23
|
-
export declare function
|
|
24
|
-
export declare function unreadable(text: Readonly<Record<string, string>>, previous?: Readonly<Record<string, string>>): Refused | null;
|
|
21
|
+
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
|
|
22
|
+
export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
|
|
23
|
+
export declare function unreadable(text: Paths<string>, paths?: Iterable<string> | null): Generator<number, Refused | null, void>;
|
|
25
24
|
export declare function validRoot(root: unknown): root is string;
|
|
26
|
-
export declare function validateCollection(text: Readonly<Record<string, string>>, binaryTargets: readonly string[], composition: Composition): Validation;
|
|
27
|
-
type Held = {
|
|
28
|
-
text: Paths<string>;
|
|
29
|
-
binaries: Paths<unknown>;
|
|
30
|
-
};
|
|
31
|
-
export declare function indexReferrers(held: Held, composition: Composition): Later<void>;
|
|
32
|
-
export declare function referencesIndexed(held: Held, composition: Composition): boolean;
|
|
33
|
-
export declare function referring(held: Held, composition: Composition, targets: Iterable<string>): ReadonlySet<string> | null;
|
|
34
25
|
export declare function available(composition: Composition): boolean;
|
|
35
|
-
export declare function changedCleanly(next: Held, previous: Held & {
|
|
36
|
-
composition: Composition;
|
|
37
|
-
}, composition: Composition): boolean;
|
|
38
|
-
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Plan, QueryRows } from './query.js';
|
|
2
|
+
import type { Connection } from './tables.js';
|
|
3
|
+
export type QueryRoom = {
|
|
4
|
+
readonly locator: string;
|
|
5
|
+
readonly key: number;
|
|
6
|
+
};
|
|
7
|
+
export type QueryAnswer = QueryRows & {
|
|
8
|
+
readonly more?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { type TypesResult } from './model.js';
|
|
2
2
|
import { type Observation } from './observation.js';
|
|
3
3
|
import { type DocumentQuery, type DocumentResult, type GroupQuery, type GroupResult, type PendingResult } from './query.js';
|
|
4
|
+
import { type EntrySeed } from './seed.js';
|
|
4
5
|
import { type SearchRequest, type SearchResult } from './search.js';
|
|
5
6
|
import { type Adapter, type Authorization, type Member, type ProviderRefusal, type ServiceMode } from './adapter.js';
|
|
6
7
|
import { type ChatDraftSurface, type ConversationAgent, type ConversationEntry, type ConversationOptions, type ConversationSurface, type ConversationView } from './conversation.js';
|
|
7
8
|
import { type WrittenBy } from './change.js';
|
|
8
9
|
import type { Open } from './open.js';
|
|
9
10
|
import { type BinaryReference } from './binary.js';
|
|
10
|
-
import { type
|
|
11
|
+
import { type BinaryLinkAnswer, type CallResult, type HeldBinaryAnswer, type HistoryAnswer, type QueueEntry, type Resolution } from './outcome.js';
|
|
11
12
|
import { type Recovery } from './recovery.js';
|
|
12
13
|
import { type SaveRefusal } from './save.js';
|
|
13
|
-
import { type RoomDraft, type RoomDraftWrite } from './room-draft.js';
|
|
14
|
+
import { type RoomDraft, type RoomDraftParts, type RoomDraftWrite } from './room-draft.js';
|
|
14
15
|
import { type SyncStatus } from './status.js';
|
|
15
16
|
import { type RuntimeShell } from './durability.js';
|
|
16
|
-
import { type
|
|
17
|
-
import
|
|
17
|
+
import { type CapacityCause, type CodeAvailability, type Persistence, type Readiness, type SearchObligation } from './readiness.js';
|
|
18
|
+
import type { RuntimeDatabase } from './tables.js';
|
|
18
19
|
import { type NarrowedView, type PortReach, type RuntimeView } from './reach.js';
|
|
19
20
|
export type AppTypedSelection = {
|
|
20
21
|
roots: readonly string[];
|
|
@@ -33,6 +34,7 @@ export type AppRoom = {
|
|
|
33
34
|
documents: number;
|
|
34
35
|
synchronizationAvailable: boolean;
|
|
35
36
|
refusal: ProviderRefusal | null;
|
|
37
|
+
locked: boolean;
|
|
36
38
|
};
|
|
37
39
|
export type RoomSchemas = {
|
|
38
40
|
collection: TypesResult;
|
|
@@ -49,6 +51,7 @@ export type ConnectionRefusal = {
|
|
|
49
51
|
export type MdRuntimeOptions = {
|
|
50
52
|
adapter: Adapter;
|
|
51
53
|
shell: RuntimeShell;
|
|
54
|
+
database: RuntimeDatabase;
|
|
52
55
|
authorization?: Authorization;
|
|
53
56
|
signal?: AbortSignal;
|
|
54
57
|
recovery?: Recovery;
|
|
@@ -63,19 +66,26 @@ export type SavedRoomDraft = {
|
|
|
63
66
|
readonly path: string;
|
|
64
67
|
readonly revision: string;
|
|
65
68
|
};
|
|
69
|
+
export type SavedParts = {
|
|
70
|
+
readonly path: string;
|
|
71
|
+
readonly parts: RoomDraftParts;
|
|
72
|
+
};
|
|
66
73
|
export type RoomDraftSurface = {
|
|
67
74
|
list(): Promise<readonly RoomDraft[]>;
|
|
68
|
-
read(room: string, path: string): RoomDraft | null
|
|
75
|
+
read(room: string, path: string): Promise<RoomDraft | null>;
|
|
69
76
|
write(room: string, path: string, revision: string | null, parts: unknown): Promise<RoomDraftWrite>;
|
|
70
77
|
discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
|
|
71
78
|
};
|
|
72
79
|
export type PresentationSurface = {
|
|
73
80
|
read(app: string): Promise<unknown>;
|
|
74
81
|
write(app: string, value: unknown): Promise<void>;
|
|
82
|
+
edit(app: string, members: Readonly<Record<string, unknown>>): Promise<void>;
|
|
75
83
|
};
|
|
76
84
|
export type BinaryFileSurface = {
|
|
77
|
-
read(room: string, path: string, revision?: string): Promise<
|
|
78
|
-
|
|
85
|
+
read(room: string, path: string, revision?: string): Promise<HeldBinaryAnswer>;
|
|
86
|
+
link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
|
|
87
|
+
readReference(reference: BinaryReference): Promise<HeldBinaryAnswer>;
|
|
88
|
+
part(file: string, part: number): Promise<Uint8Array | null>;
|
|
79
89
|
};
|
|
80
90
|
export type HistoryQuery = {
|
|
81
91
|
revision?: string;
|
|
@@ -95,13 +105,16 @@ export type MdRuntime = {
|
|
|
95
105
|
chatDraft: ChatDraftSurface;
|
|
96
106
|
presentation: PresentationSurface;
|
|
97
107
|
save(room: string, roomDrafts: readonly SavedRoomDraft[], writtenBy?: WrittenBy): Promise<SaveResult>;
|
|
108
|
+
saveParts(room: string, parts: readonly SavedParts[], writtenBy?: WrittenBy): Promise<SaveResult>;
|
|
98
109
|
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
|
|
110
|
+
resolve(room: string, path: string, destination: string): Promise<Resolution>;
|
|
99
111
|
binaryFile: BinaryFileSurface;
|
|
100
112
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
101
|
-
reached(locator: string, roomVersion: string, path?: string): boolean
|
|
113
|
+
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
102
114
|
log(): string;
|
|
103
115
|
persistence(): boolean;
|
|
104
116
|
retry(): Promise<void>;
|
|
117
|
+
cleanUp(): Promise<number>;
|
|
105
118
|
observe: {
|
|
106
119
|
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
107
120
|
(topic: 'readiness'): Promise<Observation<Readiness>>;
|
|
@@ -126,11 +139,12 @@ export type ReadinessPort = {
|
|
|
126
139
|
readonly target: string;
|
|
127
140
|
readonly code: CodeAvailability;
|
|
128
141
|
readonly capacity: CapacityCause | null;
|
|
142
|
+
readonly search: SearchObligation;
|
|
129
143
|
};
|
|
130
144
|
export type ComposedRuntime = RuntimeView & {
|
|
145
|
+
seed(entry: EntrySeed): void;
|
|
131
146
|
stop(): Promise<void>;
|
|
132
147
|
lose(locators: readonly string[]): Promise<void>;
|
|
133
|
-
acquire(demand: RuntimeDemand): void;
|
|
134
148
|
persisted(answer: Persistence): void;
|
|
135
149
|
within(reach: PortReach | null, port: ReadinessPort): NarrowedView;
|
|
136
150
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ConversationAction, ConversationAgents, ConversationEvent, ConversationMessage, ConversationStream, ProcessCommand, SessionOption, TurnContext } from './adapter.js';
|
|
2
2
|
import { type ChangeSet } from './change-set.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type ChosenFile } from './file.js';
|
|
4
4
|
import type { Open } from './open.js';
|
|
5
5
|
import { type CallResult, type Offline } from './outcome.js';
|
|
6
6
|
import type { DocumentResult, PendingResult } from './query.js';
|
|
@@ -17,6 +17,7 @@ export type ConversationEntry = {
|
|
|
17
17
|
created: string;
|
|
18
18
|
finished: string | null;
|
|
19
19
|
outcome: string | null;
|
|
20
|
+
waiting: boolean;
|
|
20
21
|
state: ConversationState;
|
|
21
22
|
started: string | null;
|
|
22
23
|
};
|
|
@@ -32,14 +33,17 @@ export type RunningTurn = {
|
|
|
32
33
|
};
|
|
33
34
|
export type ChatDraft = {
|
|
34
35
|
text: string;
|
|
35
|
-
files: readonly ChatDraftFile[];
|
|
36
36
|
};
|
|
37
37
|
export type ConversationOptions = {
|
|
38
38
|
limit?: number;
|
|
39
|
+
after?: string;
|
|
40
|
+
total?: true;
|
|
39
41
|
};
|
|
40
42
|
export type ConversationView = {
|
|
41
43
|
conversation: string;
|
|
42
44
|
messages: readonly ConversationMessage[];
|
|
45
|
+
next?: string;
|
|
46
|
+
total?: number;
|
|
43
47
|
turn: RunningTurn | null;
|
|
44
48
|
questions: readonly unknown[];
|
|
45
49
|
process: {
|
|
@@ -47,6 +51,11 @@ export type ConversationView = {
|
|
|
47
51
|
} | null;
|
|
48
52
|
commands: readonly ProcessCommand[];
|
|
49
53
|
options: readonly SessionOption[];
|
|
54
|
+
starting: string | null;
|
|
55
|
+
link: {
|
|
56
|
+
connected: boolean;
|
|
57
|
+
} | null;
|
|
58
|
+
deliveryUnknown: readonly string[];
|
|
50
59
|
chatDraft: (ChatDraft & {
|
|
51
60
|
readonly revision: string;
|
|
52
61
|
}) | null;
|
|
@@ -56,6 +65,7 @@ export type ConversationSurface = {
|
|
|
56
65
|
read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
|
|
57
66
|
create(input: unknown): Promise<CallResult>;
|
|
58
67
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
68
|
+
attach(room: string, file: ChosenFile): Promise<CallResult | Offline>;
|
|
59
69
|
answer(conversation: string, answer: unknown): Promise<CallResult>;
|
|
60
70
|
interrupt(conversation: string): Promise<CallResult>;
|
|
61
71
|
kill(conversation: string): Promise<CallResult>;
|
|
@@ -64,11 +74,12 @@ export type ConversationSurface = {
|
|
|
64
74
|
};
|
|
65
75
|
export type ChatDraftSurface = {
|
|
66
76
|
write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
|
|
77
|
+
prepend(conversation: string, draft: ChatDraft): Promise<void>;
|
|
67
78
|
discard(conversation: string): Promise<void>;
|
|
68
79
|
};
|
|
69
80
|
export type ConversationDependencies = {
|
|
70
81
|
agents(): ConversationAgents | undefined;
|
|
71
|
-
documents(agents: ConversationAgents): Promise<DocumentResult | PendingResult>;
|
|
82
|
+
documents(agents: ConversationAgents, after: string | undefined): Promise<DocumentResult | PendingResult>;
|
|
72
83
|
call(name: ConversationAction, input: unknown): Promise<CallResult>;
|
|
73
84
|
durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
|
|
74
85
|
stream(): ConversationStream | undefined;
|
|
@@ -89,6 +100,7 @@ export type ConversationStore = {
|
|
|
89
100
|
known(): boolean;
|
|
90
101
|
reconnected(): void;
|
|
91
102
|
reopened(): void;
|
|
103
|
+
lost(): void;
|
|
92
104
|
watch(conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
|
|
93
105
|
watchList(deliver: (entries: readonly ConversationEntry[]) => void): () => void;
|
|
94
106
|
watchAgents(deliver: (agents: readonly ConversationAgent[]) => void): () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Persistence } from './readiness.js';
|
|
2
2
|
export type StorageEstimate = {
|
|
3
3
|
readonly usage: number;
|
|
4
|
-
readonly
|
|
4
|
+
readonly total: number;
|
|
5
5
|
};
|
|
6
6
|
export type RuntimeShell = {
|
|
7
7
|
persistence: Persistence;
|
|
@@ -9,6 +9,7 @@ export type RuntimeShell = {
|
|
|
9
9
|
keepGeneration(value: string): void | Promise<void>;
|
|
10
10
|
dropGeneration(): void | Promise<void>;
|
|
11
11
|
estimate?(): Promise<StorageEstimate | null>;
|
|
12
|
+
cleanUp?(): Promise<number>;
|
|
12
13
|
};
|
|
13
14
|
export declare function detectStorageLoss(stored: string | null, reported: string | null): string | null;
|
|
14
15
|
export declare function nextGeneration(stored: string | null, reported: string | null): string;
|
package/dist/mdruntime/file.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type ChosenFile = {
|
|
2
2
|
name: string;
|
|
3
3
|
blob: Blob;
|
|
4
4
|
};
|
|
@@ -7,13 +7,5 @@ export type FileDeclaration = {
|
|
|
7
7
|
mediaType: string;
|
|
8
8
|
byteLength: number;
|
|
9
9
|
contentHash: string;
|
|
10
|
-
width?: number;
|
|
11
|
-
height?: number;
|
|
12
10
|
};
|
|
13
|
-
export
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
};
|
|
17
|
-
export declare function extentOf(bytes: Uint8Array): Extent | null;
|
|
18
|
-
export declare function hexDigest(digest: ArrayBuffer): string;
|
|
19
|
-
export declare function declaredFile(file: ChatDraftFile): Promise<FileDeclaration>;
|
|
11
|
+
export declare function declaredFile(file: ChosenFile): Promise<FileDeclaration>;
|
|
@@ -14,6 +14,8 @@ export type QueryChange = {
|
|
|
14
14
|
removed: readonly RowKey[];
|
|
15
15
|
order: readonly RowKey[] | null;
|
|
16
16
|
coverage?: QueryCoverage;
|
|
17
|
+
next?: string | null;
|
|
18
|
+
total?: number;
|
|
17
19
|
};
|
|
18
20
|
export type QueryMessage = KeyedResult | QueryChange;
|
|
19
21
|
export type Observed = {
|
|
@@ -27,3 +29,15 @@ export declare function applied(keyed: KeyedResult, message: QueryMessage): Keye
|
|
|
27
29
|
export declare function observed(first: unknown, stop: () => void, keyed: boolean): Observed;
|
|
28
30
|
export declare function opened(watch: (deliver: (message: unknown) => void) => () => void, keyed: boolean): Promise<Observation<unknown>>;
|
|
29
31
|
export declare function observing<Topic extends string>(watch: (topic: Topic, input: readonly unknown[], deliver: (message: unknown) => void) => () => void): (topic: Topic, ...input: unknown[]) => Promise<Observation<unknown>>;
|
|
32
|
+
export type Digest = {
|
|
33
|
+
readonly pending: string;
|
|
34
|
+
} | {
|
|
35
|
+
readonly keys: readonly RowKey[];
|
|
36
|
+
readonly rows: ReadonlyMap<RowKey, number>;
|
|
37
|
+
readonly coverage: string;
|
|
38
|
+
readonly next: string | undefined;
|
|
39
|
+
readonly total: number | undefined;
|
|
40
|
+
};
|
|
41
|
+
export declare function digestOf({ result, keys }: KeyedResult): Digest;
|
|
42
|
+
export declare function digestApplied(digest: Digest, message: QueryMessage): Digest;
|
|
43
|
+
export declare function changeOf(previous: Digest, next: KeyedResult): QueryMessage | null;
|
|
@@ -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, fenced: (locator: string) => boolean): OpenedFiles;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type { ActionResult, AdapterFailure,
|
|
1
|
+
import type { ActionResult, AdapterFailure, BinaryLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
|
+
import type { KeptBinary, KeptResult } from './opened.js';
|
|
3
4
|
type Refused<Kind extends string> = ProviderRefusal & {
|
|
4
5
|
kind: Kind;
|
|
5
6
|
};
|
|
6
7
|
export type Failure = Refused<'transport-uncertainty'> | Refused<'revoked-authorization'> | (Refused<'room-not-readable'> & {
|
|
7
8
|
locator: string;
|
|
9
|
+
}) | (Refused<'room-locked'> & {
|
|
10
|
+
locator: string;
|
|
8
11
|
}) | ScopedRefusal;
|
|
9
12
|
export type CallResult = {
|
|
10
13
|
kind: 'action';
|
|
@@ -14,12 +17,40 @@ export type CallResult = {
|
|
|
14
17
|
export type HistoryAnswer = Exclude<HistoryResult, {
|
|
15
18
|
kind: Failure['kind'];
|
|
16
19
|
}> | Failure;
|
|
20
|
+
type BinaryRefusal = Refused<'rejected'> | Refused<'absent'> | Failure;
|
|
17
21
|
export type BinaryAnswer = {
|
|
18
22
|
kind: 'binary';
|
|
19
|
-
|
|
23
|
+
stream: ReadableStream<Uint8Array>;
|
|
24
|
+
byteLength: number;
|
|
25
|
+
mediaType: string;
|
|
26
|
+
} | BinaryRefusal;
|
|
27
|
+
export type HeldBinaryAnswer = KeptBinary | BinaryRefusal;
|
|
28
|
+
export type BinaryLinkAnswer = {
|
|
29
|
+
kind: 'link';
|
|
30
|
+
url: string;
|
|
31
|
+
name: string;
|
|
20
32
|
} | Refused<'rejected'> | Refused<'absent'> | Failure;
|
|
21
|
-
export
|
|
22
|
-
|
|
33
|
+
export type Resolution = {
|
|
34
|
+
readonly kind: 'document';
|
|
35
|
+
readonly room: string;
|
|
36
|
+
readonly path: string;
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: 'deleted';
|
|
39
|
+
readonly room: string;
|
|
40
|
+
readonly path: string;
|
|
41
|
+
readonly revision: HistoryRevision;
|
|
42
|
+
} | Refused<'unreadable'> | Refused<'absent'> | Failure;
|
|
43
|
+
export declare const UNREADABLE: Refused<'unreadable'>;
|
|
44
|
+
export declare const LOCKED_UNREADABLE: Refused<'unreadable'>;
|
|
45
|
+
export declare const ABSENT_TARGET: Refused<'absent'>;
|
|
46
|
+
export declare function absentBinary(path: string): Refused<'absent'>;
|
|
47
|
+
export declare function absentReference(fileRef: string): Refused<'absent'>;
|
|
48
|
+
export declare function binaryAnswer(result: KeptResult): HeldBinaryAnswer;
|
|
49
|
+
export declare function binaryLinkAnswer(result: BinaryLinkResult): BinaryLinkAnswer;
|
|
50
|
+
export declare const ROOM_LOCKED = "room-locked";
|
|
51
|
+
export declare function lockedRoom(locator: string): Refused<'room-locked'> & {
|
|
52
|
+
locator: string;
|
|
53
|
+
};
|
|
23
54
|
export type Offline = {
|
|
24
55
|
readonly kind: 'offline';
|
|
25
56
|
};
|
|
@@ -2,6 +2,7 @@ import type { BinaryFile, HeadChange } from './adapter.js';
|
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
3
|
export type Heads = {
|
|
4
4
|
revisions: Readonly<Record<string, string>>;
|
|
5
|
+
fileIds: Readonly<Record<string, string>>;
|
|
5
6
|
changes: Readonly<Record<string, HeadChange>>;
|
|
6
7
|
};
|
|
7
8
|
export type HeldBinary = ({
|
|
@@ -17,10 +18,7 @@ export type Layer = Heads & {
|
|
|
17
18
|
documents: Readonly<Record<string, string>>;
|
|
18
19
|
binaries: Readonly<Record<string, HeldBinary>>;
|
|
19
20
|
};
|
|
20
|
-
export declare function acceptedBinaries(files: Readonly<Record<string, BinaryFile>>):
|
|
21
|
+
export declare function acceptedBinaries(files: Readonly<Record<string, BinaryFile>>): Generator<readonly [string, HeldBinary]>;
|
|
21
22
|
export declare function sameBinary(left: HeldBinary | undefined, right: HeldBinary | undefined): boolean;
|
|
22
23
|
export declare function sameChange(left: HeadChange | undefined, right: HeadChange | undefined): boolean;
|
|
23
|
-
export declare function
|
|
24
|
-
export declare function sameLayerText(left: Layer, right: Layer): boolean;
|
|
25
|
-
export declare function changedPaths(left: Layer, right: Layer): ReadonlySet<string>;
|
|
26
|
-
export declare function overlayChanged(base: Layer, queue: readonly ChangeBatch[], previousBase: Layer, previousQueue: readonly ChangeBatch[], previousVisible: Layer): Layer;
|
|
24
|
+
export declare function overlaying(base: Layer, queue: readonly ChangeBatch[], unapplied?: () => void): Generator<number, Layer, void>;
|
|
@@ -38,6 +38,8 @@ export type Filter = {
|
|
|
38
38
|
types?: readonly string[];
|
|
39
39
|
where?: Where;
|
|
40
40
|
pathPrefix?: string;
|
|
41
|
+
folder?: string;
|
|
42
|
+
paths?: readonly string[];
|
|
41
43
|
hop?: Related & {
|
|
42
44
|
field: string;
|
|
43
45
|
};
|
|
@@ -45,7 +47,7 @@ export type Filter = {
|
|
|
45
47
|
field?: string;
|
|
46
48
|
};
|
|
47
49
|
};
|
|
48
|
-
export type Key = 'room' | 'path' | 'type' | {
|
|
50
|
+
export type Key = 'room' | 'path' | 'type' | 'folder' | {
|
|
49
51
|
field: string;
|
|
50
52
|
};
|
|
51
53
|
export type Select = 'all' | {
|
|
@@ -55,6 +57,7 @@ export type Select = 'all' | {
|
|
|
55
57
|
markdown?: true;
|
|
56
58
|
backlinks?: true;
|
|
57
59
|
change?: true;
|
|
60
|
+
fileId?: true;
|
|
58
61
|
};
|
|
59
62
|
export type OrderOptions = {
|
|
60
63
|
nulls?: 'first' | 'last';
|
|
@@ -70,6 +73,8 @@ export type DocumentQuery = Filter & {
|
|
|
70
73
|
direction?: Direction;
|
|
71
74
|
} & OrderOptions)[];
|
|
72
75
|
limit?: number;
|
|
76
|
+
after?: string;
|
|
77
|
+
total?: true;
|
|
73
78
|
};
|
|
74
79
|
export type GroupQuery = Filter & {
|
|
75
80
|
groupBy: readonly Exclude<Key, 'path'>[];
|
|
@@ -78,6 +83,8 @@ export type GroupQuery = Filter & {
|
|
|
78
83
|
direction?: Direction;
|
|
79
84
|
}[];
|
|
80
85
|
limit?: number;
|
|
86
|
+
after?: string;
|
|
87
|
+
total?: true;
|
|
81
88
|
};
|
|
82
89
|
export type LocalQuery = DocumentQuery | GroupQuery;
|
|
83
90
|
export type Backlink = {
|
|
@@ -95,6 +102,7 @@ export type QueryDocument = {
|
|
|
95
102
|
markdown?: string;
|
|
96
103
|
backlinks?: readonly Backlink[];
|
|
97
104
|
change?: HeadChange | null;
|
|
105
|
+
fileId?: string | null;
|
|
98
106
|
binaryFile?: BinaryFileRecord;
|
|
99
107
|
};
|
|
100
108
|
export type QueryGroup = {
|
|
@@ -111,7 +119,7 @@ export type QueryCoverage = {
|
|
|
111
119
|
indexes: readonly string[];
|
|
112
120
|
overlay: readonly string[];
|
|
113
121
|
};
|
|
114
|
-
export type Awaits = Open<'acquisition' | 'preparation' | 'index'>;
|
|
122
|
+
export type Awaits = Open<'acquisition' | 'preparation' | 'index' | 'unlock'>;
|
|
115
123
|
export type PendingRoom = {
|
|
116
124
|
room: string;
|
|
117
125
|
awaits: Awaits;
|
|
@@ -121,9 +129,13 @@ export type PendingResult = {
|
|
|
121
129
|
};
|
|
122
130
|
export type DocumentRows = {
|
|
123
131
|
documents: readonly QueryDocument[];
|
|
132
|
+
next?: string;
|
|
133
|
+
total?: number;
|
|
124
134
|
};
|
|
125
135
|
export type GroupRows = {
|
|
126
136
|
groups: readonly QueryGroup[];
|
|
137
|
+
next?: string;
|
|
138
|
+
total?: number;
|
|
127
139
|
};
|
|
128
140
|
export type QueryRows = DocumentRows | GroupRows;
|
|
129
141
|
export type DocumentResult = DocumentRows & {
|
|
@@ -187,6 +199,8 @@ export type KeyPlan = {
|
|
|
187
199
|
of: 'path';
|
|
188
200
|
} | {
|
|
189
201
|
of: 'type';
|
|
202
|
+
} | {
|
|
203
|
+
of: 'folder';
|
|
190
204
|
} | {
|
|
191
205
|
of: 'field';
|
|
192
206
|
field: string;
|
|
@@ -199,6 +213,7 @@ export type DocumentShape = {
|
|
|
199
213
|
markdown: boolean;
|
|
200
214
|
backlinks: boolean;
|
|
201
215
|
change: boolean;
|
|
216
|
+
fileId: boolean;
|
|
202
217
|
orderBy: readonly {
|
|
203
218
|
key: KeyPlan;
|
|
204
219
|
options: OrderOptions & {
|
|
@@ -218,10 +233,18 @@ export type PlanReach = {
|
|
|
218
233
|
rooms: readonly string[];
|
|
219
234
|
documents: readonly string[];
|
|
220
235
|
};
|
|
236
|
+
export type Continuation = {
|
|
237
|
+
text: string;
|
|
238
|
+
values: readonly unknown[] | null;
|
|
239
|
+
};
|
|
221
240
|
export type Plan = {
|
|
241
|
+
key: string;
|
|
222
242
|
rooms: readonly string[] | null;
|
|
223
243
|
reach: PlanReach | null;
|
|
244
|
+
locked: readonly string[];
|
|
224
245
|
root: Scope;
|
|
246
|
+
folder: string | null;
|
|
247
|
+
paths: readonly string[] | null;
|
|
225
248
|
hop: (Scope & {
|
|
226
249
|
field: string;
|
|
227
250
|
}) | null;
|
|
@@ -230,6 +253,8 @@ export type Plan = {
|
|
|
230
253
|
}) | null;
|
|
231
254
|
shape: DocumentShape | GroupShape;
|
|
232
255
|
limit: number | null;
|
|
256
|
+
after: Continuation | null;
|
|
257
|
+
total: boolean;
|
|
233
258
|
};
|
|
234
259
|
export declare class QueryError extends Error {
|
|
235
260
|
readonly code: QueryErrorCode;
|
|
@@ -240,8 +265,10 @@ type Entries = Readonly<Record<string, unknown>>;
|
|
|
240
265
|
export declare function invalid(at: string, problem: string): never;
|
|
241
266
|
export declare function plain(value: unknown): value is Entries;
|
|
242
267
|
export declare function known(value: Entries, allowed: readonly string[], at: string): void;
|
|
268
|
+
export declare function flag(input: unknown, at: string): boolean;
|
|
243
269
|
export declare function planOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
244
270
|
export declare function limitOf(input: unknown): number | null;
|
|
245
271
|
export declare function filterOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
272
|
+
export declare function queryKey(query: unknown): string;
|
|
246
273
|
export declare function identityOf(plan: Plan): string;
|
|
247
274
|
export {};
|