@agentshouse/app-bridge 0.1.0-ca4ec913df08d → 0.1.0-ca559eade7c19
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 +3 -1
- package/dist/calls.d.ts +118 -0
- package/dist/calls.js +1 -0
- package/dist/index.d.ts +43 -16
- package/dist/mdmodel/blocks.d.ts +10 -0
- package/dist/mdmodel/condition.d.ts +149 -0
- package/dist/mdmodel/definition.d.ts +79 -0
- package/dist/mdmodel/divide.d.ts +2 -0
- package/dist/mdmodel/document.d.ts +15 -0
- package/dist/mdmodel/fields.d.ts +5 -0
- package/dist/mdmodel/index.d.ts +18 -0
- package/dist/mdmodel/paths.d.ts +17 -0
- package/dist/mdmodel/profile.d.ts +5 -0
- package/dist/mdmodel/project.d.ts +20 -0
- package/dist/mdmodel/references.d.ts +3 -0
- package/dist/mdmodel/types.d.ts +143 -0
- package/dist/mdmodel/validate.d.ts +7 -0
- package/dist/mdmodel/version.d.ts +1 -0
- package/dist/mdmodel/yaml.d.ts +55 -0
- package/dist/mdruntime/acquisition.d.ts +13 -0
- package/dist/mdruntime/adapter.d.ts +479 -0
- package/dist/mdruntime/binary.d.ts +22 -0
- package/dist/mdruntime/change-set.d.ts +34 -0
- package/dist/mdruntime/change.d.ts +88 -0
- package/dist/mdruntime/client.d.ts +82 -0
- package/dist/mdruntime/collection.d.ts +38 -0
- package/dist/mdruntime/connection.d.ts +141 -0
- package/dist/mdruntime/conversation.d.ts +105 -0
- package/dist/mdruntime/durability.d.ts +14 -0
- package/dist/mdruntime/failure.d.ts +12 -0
- package/dist/mdruntime/file.d.ts +19 -0
- package/dist/mdruntime/model.d.ts +57 -0
- package/dist/mdruntime/observation.d.ts +29 -0
- package/dist/mdruntime/open.d.ts +1 -0
- package/dist/mdruntime/outcome.d.ts +46 -0
- package/dist/mdruntime/overlay.d.ts +27 -0
- package/dist/mdruntime/query.d.ts +253 -0
- package/dist/mdruntime/reach.d.ts +44 -0
- package/dist/mdruntime/readiness.d.ts +52 -0
- package/dist/mdruntime/recovery.d.ts +24 -0
- package/dist/mdruntime/replica.d.ts +45 -0
- package/dist/mdruntime/room-draft.d.ts +155 -0
- package/dist/mdruntime/rows.d.ts +37 -0
- package/dist/mdruntime/save.d.ts +63 -0
- package/dist/mdruntime/search.d.ts +91 -0
- package/dist/mdruntime/seed.d.ts +15 -0
- package/dist/mdruntime/shared.d.ts +10 -0
- package/dist/mdruntime/status.d.ts +26 -0
- package/dist/mdruntime/store.d.ts +160 -0
- package/dist/mdruntime/transfer.d.ts +9 -0
- package/dist/mdruntime/turn.d.ts +6 -0
- package/dist/mdruntime/wire.d.ts +206 -0
- package/dist/test-host.d.ts +5 -5
- package/dist/test-host.js +60 -21
- package/docs/families.md +57 -15
- package/package.json +1 -4
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { Definition } from './definition.js';
|
|
2
|
+
export type Library = Readonly<Record<string, string>>;
|
|
3
|
+
export type VerifiedModel = {
|
|
4
|
+
readonly types: Readonly<Record<string, Definition>>;
|
|
5
|
+
};
|
|
6
|
+
export type ModelVerification = {
|
|
7
|
+
readonly verdict: 'accept';
|
|
8
|
+
readonly model: VerifiedModel;
|
|
9
|
+
} | {
|
|
10
|
+
readonly verdict: 'refuse';
|
|
11
|
+
readonly rule: string;
|
|
12
|
+
readonly location?: string;
|
|
13
|
+
};
|
|
14
|
+
export type ValidationContext = {
|
|
15
|
+
readonly binaryTargets: readonly string[];
|
|
16
|
+
};
|
|
17
|
+
export type ProjectionContext = {
|
|
18
|
+
readonly documentTargets: readonly string[];
|
|
19
|
+
readonly definition?: Definition;
|
|
20
|
+
};
|
|
21
|
+
export type DivisionContext = ProjectionContext & {
|
|
22
|
+
readonly budget: number;
|
|
23
|
+
};
|
|
24
|
+
export type Extent = {
|
|
25
|
+
readonly start: number;
|
|
26
|
+
readonly end: number;
|
|
27
|
+
};
|
|
28
|
+
export type Span = Extent & {
|
|
29
|
+
readonly text: string;
|
|
30
|
+
};
|
|
31
|
+
export type Frontmatter = {
|
|
32
|
+
readonly content: string;
|
|
33
|
+
readonly type: string | undefined;
|
|
34
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
35
|
+
};
|
|
36
|
+
export type Document = Frontmatter & {
|
|
37
|
+
readonly preamble: string;
|
|
38
|
+
readonly sections: Readonly<Record<string, string>>;
|
|
39
|
+
};
|
|
40
|
+
export type Refusal = {
|
|
41
|
+
readonly file: string;
|
|
42
|
+
readonly rule: string;
|
|
43
|
+
readonly location?: string;
|
|
44
|
+
readonly referrers?: readonly string[];
|
|
45
|
+
};
|
|
46
|
+
export type Reached = {
|
|
47
|
+
readonly target: string | null;
|
|
48
|
+
readonly to: readonly string[];
|
|
49
|
+
};
|
|
50
|
+
export type DocumentCheck = {
|
|
51
|
+
readonly ok: false;
|
|
52
|
+
} | {
|
|
53
|
+
readonly ok: true;
|
|
54
|
+
readonly type: string;
|
|
55
|
+
readonly typed: boolean;
|
|
56
|
+
readonly references: readonly Reached[];
|
|
57
|
+
};
|
|
58
|
+
export type Validation = {
|
|
59
|
+
readonly verdict: 'accept';
|
|
60
|
+
} | ({
|
|
61
|
+
readonly verdict: 'refuse';
|
|
62
|
+
} & Refusal);
|
|
63
|
+
export type Projection = {
|
|
64
|
+
readonly ok: true;
|
|
65
|
+
readonly text: string;
|
|
66
|
+
} | {
|
|
67
|
+
readonly ok: false;
|
|
68
|
+
readonly refusal: Refusal;
|
|
69
|
+
};
|
|
70
|
+
export type Division = {
|
|
71
|
+
readonly ok: true;
|
|
72
|
+
readonly spans: readonly Span[];
|
|
73
|
+
} | {
|
|
74
|
+
readonly ok: false;
|
|
75
|
+
readonly refusal: Refusal;
|
|
76
|
+
};
|
|
77
|
+
export type FrontmatterResult = {
|
|
78
|
+
readonly ok: true;
|
|
79
|
+
readonly frontmatter: Frontmatter;
|
|
80
|
+
} | {
|
|
81
|
+
readonly ok: false;
|
|
82
|
+
readonly refusal: Refusal;
|
|
83
|
+
};
|
|
84
|
+
export type ParseResult = {
|
|
85
|
+
readonly ok: true;
|
|
86
|
+
readonly document: Document;
|
|
87
|
+
} | {
|
|
88
|
+
readonly ok: false;
|
|
89
|
+
readonly refusal: Refusal;
|
|
90
|
+
};
|
|
91
|
+
export type Link = {
|
|
92
|
+
readonly href: string;
|
|
93
|
+
readonly target: string;
|
|
94
|
+
};
|
|
95
|
+
export type LinkOccurrence = Link & {
|
|
96
|
+
readonly start: number;
|
|
97
|
+
};
|
|
98
|
+
export type Reference = {
|
|
99
|
+
readonly pointer: string;
|
|
100
|
+
readonly value: string;
|
|
101
|
+
readonly to: readonly string[];
|
|
102
|
+
};
|
|
103
|
+
export type Change = {
|
|
104
|
+
readonly kind: 'field';
|
|
105
|
+
readonly name: string;
|
|
106
|
+
readonly value: unknown;
|
|
107
|
+
readonly prior: unknown;
|
|
108
|
+
} | {
|
|
109
|
+
readonly kind: 'section';
|
|
110
|
+
readonly name: string;
|
|
111
|
+
readonly value: string;
|
|
112
|
+
readonly prior: string;
|
|
113
|
+
} | {
|
|
114
|
+
readonly kind: 'preamble';
|
|
115
|
+
readonly value: string;
|
|
116
|
+
readonly prior: string;
|
|
117
|
+
} | {
|
|
118
|
+
readonly kind: 'link';
|
|
119
|
+
readonly href: string;
|
|
120
|
+
readonly to: string;
|
|
121
|
+
} | {
|
|
122
|
+
readonly kind: 'reference';
|
|
123
|
+
readonly pointer: string;
|
|
124
|
+
readonly value: string;
|
|
125
|
+
readonly prior: string;
|
|
126
|
+
};
|
|
127
|
+
export type ApplyResult = {
|
|
128
|
+
readonly outcome: 'applied';
|
|
129
|
+
readonly document: Document;
|
|
130
|
+
} | {
|
|
131
|
+
readonly outcome: 'stale';
|
|
132
|
+
readonly document: Document;
|
|
133
|
+
} | {
|
|
134
|
+
readonly outcome: 'refuse';
|
|
135
|
+
readonly refusal: Refusal;
|
|
136
|
+
};
|
|
137
|
+
export type BodyResult = {
|
|
138
|
+
readonly outcome: 'applied';
|
|
139
|
+
readonly body: string;
|
|
140
|
+
} | {
|
|
141
|
+
readonly outcome: 'refuse';
|
|
142
|
+
readonly refusal: Refusal;
|
|
143
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Definition } from './definition.js';
|
|
2
|
+
import type { DocumentCheck, Library, ModelVerification, Reached, Validation, ValidationContext, VerifiedModel } from './types.js';
|
|
3
|
+
export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
|
|
4
|
+
export declare function verify(schema: string): ModelVerification;
|
|
5
|
+
export declare function checkDocument(file: string, content: string, model: VerifiedModel): DocumentCheck;
|
|
6
|
+
export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
|
|
7
|
+
export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION = "0.1.0-alpha.19";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare class YamlError extends Error {
|
|
2
|
+
readonly offset: number;
|
|
3
|
+
constructor(offset: number);
|
|
4
|
+
}
|
|
5
|
+
export type YamlScalar = {
|
|
6
|
+
readonly kind: 'scalar';
|
|
7
|
+
readonly value: string | number | boolean | null;
|
|
8
|
+
readonly start: number;
|
|
9
|
+
readonly end: number;
|
|
10
|
+
};
|
|
11
|
+
export type YamlSeq = {
|
|
12
|
+
readonly kind: 'seq';
|
|
13
|
+
readonly items: readonly YamlNode[];
|
|
14
|
+
readonly start: number;
|
|
15
|
+
readonly end: number;
|
|
16
|
+
};
|
|
17
|
+
export type YamlEntry = {
|
|
18
|
+
readonly key: string;
|
|
19
|
+
readonly after: number;
|
|
20
|
+
readonly value: YamlNode;
|
|
21
|
+
};
|
|
22
|
+
export type YamlMap = {
|
|
23
|
+
readonly kind: 'map';
|
|
24
|
+
readonly entries: readonly YamlEntry[];
|
|
25
|
+
readonly start: number;
|
|
26
|
+
readonly end: number;
|
|
27
|
+
};
|
|
28
|
+
export type YamlNode = YamlScalar | YamlSeq | YamlMap;
|
|
29
|
+
export declare function interpretPlain(text: string): string | number | boolean | null;
|
|
30
|
+
export declare function parseYamlMapping(text: string, start: number, end: number): YamlMap;
|
|
31
|
+
export declare function jsValue(node: YamlNode): unknown;
|
|
32
|
+
export declare function mapEntry(map: YamlMap, key: string): YamlEntry | undefined;
|
|
33
|
+
export declare function isPlainSafe(text: string): boolean;
|
|
34
|
+
export type FrontmatterValue = string | number | boolean | null | readonly FrontmatterValue[] | {
|
|
35
|
+
readonly [name: string]: FrontmatterValue;
|
|
36
|
+
};
|
|
37
|
+
export declare function plain(value: unknown): value is Record<string, unknown>;
|
|
38
|
+
export declare function frontmatterValue(value: unknown): value is FrontmatterValue;
|
|
39
|
+
export declare function serializeJs(value: FrontmatterValue): string;
|
|
40
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
41
|
+
export declare function serializeKey(name: string): string;
|
|
42
|
+
export declare function bodyStartAfterYaml(content: string, yamlEnd: number): number;
|
|
43
|
+
export declare function bodyStartOf(content: string): number;
|
|
44
|
+
export declare function bodyAfterFrontmatter(content: string): string;
|
|
45
|
+
export declare function extractFrontmatter(content: string): {
|
|
46
|
+
kind: 'none';
|
|
47
|
+
} | {
|
|
48
|
+
kind: 'unclosed';
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'ok';
|
|
51
|
+
yamlStart: number;
|
|
52
|
+
yamlEnd: number;
|
|
53
|
+
};
|
|
54
|
+
export declare function equalValue(left: unknown, right: unknown): boolean;
|
|
55
|
+
export declare function lineEnding(content: string): '\n' | '\r\n';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type RuntimeDemand = {
|
|
2
|
+
readonly whole: boolean;
|
|
3
|
+
readonly rooms: readonly string[];
|
|
4
|
+
readonly handles: readonly string[];
|
|
5
|
+
readonly conversations: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const WHOLE_DEMAND: RuntimeDemand;
|
|
8
|
+
export declare function demanded(demand: RuntimeDemand, room: {
|
|
9
|
+
readonly locator: string;
|
|
10
|
+
readonly handle: string;
|
|
11
|
+
}): boolean;
|
|
12
|
+
export declare function wider(next: RuntimeDemand, current: RuntimeDemand): boolean;
|
|
13
|
+
export declare function narrower(next: RuntimeDemand, current: RuntimeDemand): boolean;
|
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import type { ModelResult } from './model.js';
|
|
2
|
+
import type { Open } from './open.js';
|
|
3
|
+
import type { ChangeBatch } from './change.js';
|
|
4
|
+
export type Authorization = object;
|
|
5
|
+
export type MdModelIdentity = {
|
|
6
|
+
identity: string;
|
|
7
|
+
version: string;
|
|
8
|
+
};
|
|
9
|
+
export type TypedSelection = {
|
|
10
|
+
roots: readonly string[];
|
|
11
|
+
};
|
|
12
|
+
export type OperationScopes = {
|
|
13
|
+
read: readonly string[];
|
|
14
|
+
sync: readonly string[];
|
|
15
|
+
write: readonly string[];
|
|
16
|
+
delete: readonly string[];
|
|
17
|
+
};
|
|
18
|
+
export type ReplicaAdmission = {
|
|
19
|
+
selection: string;
|
|
20
|
+
admission: Open<'admitted' | 'unavailable'>;
|
|
21
|
+
};
|
|
22
|
+
export type DiscoveredRoom = {
|
|
23
|
+
name: string;
|
|
24
|
+
locator: string;
|
|
25
|
+
handle: string;
|
|
26
|
+
roomVersion: string;
|
|
27
|
+
operations: OperationScopes;
|
|
28
|
+
replica: ReplicaAdmission;
|
|
29
|
+
typedSelection?: TypedSelection;
|
|
30
|
+
providerOwnedPaths: readonly string[];
|
|
31
|
+
};
|
|
32
|
+
export type Capability = {
|
|
33
|
+
name: string;
|
|
34
|
+
limits?: readonly ProviderLimit[];
|
|
35
|
+
actions?: readonly ActionDeclaration[];
|
|
36
|
+
conversationAgents?: ConversationAgents;
|
|
37
|
+
};
|
|
38
|
+
export type ConversationAgents = {
|
|
39
|
+
locator: string;
|
|
40
|
+
type: string;
|
|
41
|
+
identity: string;
|
|
42
|
+
name: string;
|
|
43
|
+
retired?: string;
|
|
44
|
+
};
|
|
45
|
+
export type ListedConversation = {
|
|
46
|
+
conversation: string;
|
|
47
|
+
agent: string;
|
|
48
|
+
name: string;
|
|
49
|
+
created: string;
|
|
50
|
+
finished: string | null;
|
|
51
|
+
outcome: string | null;
|
|
52
|
+
};
|
|
53
|
+
export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
|
|
54
|
+
export type ConversationMessage = {
|
|
55
|
+
identity: string;
|
|
56
|
+
turn: string;
|
|
57
|
+
text: string;
|
|
58
|
+
message: unknown;
|
|
59
|
+
};
|
|
60
|
+
export type AcceptedMessage = ConversationMessage & {
|
|
61
|
+
position: string;
|
|
62
|
+
};
|
|
63
|
+
export type ConversationHistoryRequest = {
|
|
64
|
+
conversations: readonly {
|
|
65
|
+
conversation: string;
|
|
66
|
+
after?: string;
|
|
67
|
+
}[];
|
|
68
|
+
};
|
|
69
|
+
export type ConversationHistoryPage = {
|
|
70
|
+
conversation: string;
|
|
71
|
+
messages: readonly AcceptedMessage[];
|
|
72
|
+
next?: string;
|
|
73
|
+
};
|
|
74
|
+
export type ConversationHistories = {
|
|
75
|
+
histories: readonly ConversationHistoryPage[];
|
|
76
|
+
};
|
|
77
|
+
export type TurnContext = {
|
|
78
|
+
used: number;
|
|
79
|
+
window: number;
|
|
80
|
+
};
|
|
81
|
+
export type TurnOperation = {
|
|
82
|
+
op: 'begin';
|
|
83
|
+
at: string;
|
|
84
|
+
} | {
|
|
85
|
+
op: 'start';
|
|
86
|
+
index: number;
|
|
87
|
+
part: unknown;
|
|
88
|
+
} | {
|
|
89
|
+
op: 'append';
|
|
90
|
+
index: number;
|
|
91
|
+
text: string;
|
|
92
|
+
} | {
|
|
93
|
+
op: 'status';
|
|
94
|
+
index: number;
|
|
95
|
+
status: string;
|
|
96
|
+
result: unknown;
|
|
97
|
+
} | {
|
|
98
|
+
op: 'count';
|
|
99
|
+
index: number;
|
|
100
|
+
count: number;
|
|
101
|
+
} | {
|
|
102
|
+
op: 'plan';
|
|
103
|
+
index: number;
|
|
104
|
+
entries: readonly unknown[];
|
|
105
|
+
} | ({
|
|
106
|
+
op: 'context';
|
|
107
|
+
} & TurnContext);
|
|
108
|
+
export type ProcessCommand = {
|
|
109
|
+
[field: string]: unknown;
|
|
110
|
+
name: string;
|
|
111
|
+
description: string;
|
|
112
|
+
input?: {
|
|
113
|
+
[field: string]: unknown;
|
|
114
|
+
hint: string;
|
|
115
|
+
} | null;
|
|
116
|
+
};
|
|
117
|
+
type SelectValue = {
|
|
118
|
+
[field: string]: unknown;
|
|
119
|
+
value: string;
|
|
120
|
+
name: string;
|
|
121
|
+
description?: string | null;
|
|
122
|
+
};
|
|
123
|
+
type SelectGroup = {
|
|
124
|
+
[field: string]: unknown;
|
|
125
|
+
group: string;
|
|
126
|
+
name: string;
|
|
127
|
+
options: readonly SelectValue[];
|
|
128
|
+
};
|
|
129
|
+
type SessionOptionNaming = {
|
|
130
|
+
[field: string]: unknown;
|
|
131
|
+
id: string;
|
|
132
|
+
name: string;
|
|
133
|
+
description?: string | null;
|
|
134
|
+
category?: string | null;
|
|
135
|
+
};
|
|
136
|
+
export type SessionOption = (SessionOptionNaming & {
|
|
137
|
+
type: 'select';
|
|
138
|
+
currentValue: string;
|
|
139
|
+
options: readonly SelectValue[] | readonly SelectGroup[];
|
|
140
|
+
}) | (SessionOptionNaming & {
|
|
141
|
+
type: 'boolean';
|
|
142
|
+
currentValue: boolean;
|
|
143
|
+
});
|
|
144
|
+
export type ConversationEvent = {
|
|
145
|
+
kind: 'turn';
|
|
146
|
+
conversation: string;
|
|
147
|
+
turn: string;
|
|
148
|
+
operation: TurnOperation;
|
|
149
|
+
} | {
|
|
150
|
+
kind: 'questions';
|
|
151
|
+
conversation: string;
|
|
152
|
+
questions: readonly unknown[];
|
|
153
|
+
} | {
|
|
154
|
+
kind: 'process';
|
|
155
|
+
conversation: string;
|
|
156
|
+
running: boolean;
|
|
157
|
+
} | {
|
|
158
|
+
kind: 'commands';
|
|
159
|
+
conversation: string;
|
|
160
|
+
commands: readonly ProcessCommand[];
|
|
161
|
+
} | {
|
|
162
|
+
kind: 'options';
|
|
163
|
+
conversation: string;
|
|
164
|
+
options: readonly SessionOption[];
|
|
165
|
+
} | {
|
|
166
|
+
kind: 'accepted-message';
|
|
167
|
+
conversation: string;
|
|
168
|
+
message: AcceptedMessage;
|
|
169
|
+
} | {
|
|
170
|
+
kind: 'gap';
|
|
171
|
+
conversation: string;
|
|
172
|
+
} | {
|
|
173
|
+
kind: 'list';
|
|
174
|
+
entries: readonly ListedConversation[];
|
|
175
|
+
} | {
|
|
176
|
+
kind: 'listed';
|
|
177
|
+
entry: ListedConversation;
|
|
178
|
+
} | {
|
|
179
|
+
kind: 'unlisted';
|
|
180
|
+
conversation: string;
|
|
181
|
+
};
|
|
182
|
+
export type ConversationStream = {
|
|
183
|
+
replicate(conversations: readonly string[]): void;
|
|
184
|
+
observe(notify: (event: ConversationEvent) => void): () => void;
|
|
185
|
+
};
|
|
186
|
+
export type ActionDeclaration = {
|
|
187
|
+
name: string;
|
|
188
|
+
inputShape: unknown;
|
|
189
|
+
resultKind: unknown;
|
|
190
|
+
};
|
|
191
|
+
export type ProviderLimit = {
|
|
192
|
+
name: string;
|
|
193
|
+
value?: number | string;
|
|
194
|
+
};
|
|
195
|
+
export type HistoryRetention = {
|
|
196
|
+
kind: 'duration';
|
|
197
|
+
seconds: number;
|
|
198
|
+
} | {
|
|
199
|
+
kind: 'no-declared-time-bound';
|
|
200
|
+
};
|
|
201
|
+
export type Retention = {
|
|
202
|
+
history: HistoryRetention;
|
|
203
|
+
outcome: number;
|
|
204
|
+
refreshHorizon: number;
|
|
205
|
+
};
|
|
206
|
+
export type Discovery = {
|
|
207
|
+
kind: 'discovery';
|
|
208
|
+
rooms: readonly DiscoveredRoom[];
|
|
209
|
+
capabilities: readonly Capability[];
|
|
210
|
+
providerLimits: readonly ProviderLimit[];
|
|
211
|
+
retention: Retention;
|
|
212
|
+
member?: Member;
|
|
213
|
+
};
|
|
214
|
+
export type TransportUncertainty = {
|
|
215
|
+
kind: 'transport-uncertainty';
|
|
216
|
+
};
|
|
217
|
+
export type RoomNotReadable = {
|
|
218
|
+
kind: 'room-not-readable';
|
|
219
|
+
locator: string;
|
|
220
|
+
};
|
|
221
|
+
export type RevokedAuthorization = {
|
|
222
|
+
kind: 'revoked-authorization';
|
|
223
|
+
};
|
|
224
|
+
export type ProviderRefusal = {
|
|
225
|
+
code: string;
|
|
226
|
+
fields: Readonly<Record<string, unknown>>;
|
|
227
|
+
retryable: boolean;
|
|
228
|
+
};
|
|
229
|
+
export type ScopedRefusal = ProviderRefusal & {
|
|
230
|
+
kind: 'scoped-refusal';
|
|
231
|
+
locator: string;
|
|
232
|
+
scope: Open<'content' | 'sync' | 'model' | 'operation' | 'undisclosed'>;
|
|
233
|
+
};
|
|
234
|
+
export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
|
|
235
|
+
export type ContractUnavailable = ProviderRefusal & {
|
|
236
|
+
kind: 'contract-unavailable';
|
|
237
|
+
};
|
|
238
|
+
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
239
|
+
export type PageToken = string;
|
|
240
|
+
export type ChangeAuthor = {
|
|
241
|
+
kind: Open<'user' | 'site'>;
|
|
242
|
+
id: string;
|
|
243
|
+
name: string;
|
|
244
|
+
};
|
|
245
|
+
export type Member = {
|
|
246
|
+
kind: Open<'user'>;
|
|
247
|
+
id: string;
|
|
248
|
+
name: string;
|
|
249
|
+
};
|
|
250
|
+
export type HeadChange = {
|
|
251
|
+
author: ChangeAuthor | null;
|
|
252
|
+
time: string;
|
|
253
|
+
};
|
|
254
|
+
export type BinaryFile = {
|
|
255
|
+
fileRef: string;
|
|
256
|
+
byteLength: number;
|
|
257
|
+
mediaType: string;
|
|
258
|
+
sha256: string;
|
|
259
|
+
};
|
|
260
|
+
export type HeldContent = {
|
|
261
|
+
documents: Readonly<Record<string, string>>;
|
|
262
|
+
revisions: Readonly<Record<string, string>>;
|
|
263
|
+
};
|
|
264
|
+
export type BootstrapRequest = {
|
|
265
|
+
locator: string;
|
|
266
|
+
selection: string;
|
|
267
|
+
pageToken?: PageToken;
|
|
268
|
+
held?: HeldContent;
|
|
269
|
+
};
|
|
270
|
+
export type RoomModels = {
|
|
271
|
+
collection?: ModelResult;
|
|
272
|
+
selection?: ModelResult;
|
|
273
|
+
};
|
|
274
|
+
export type BootstrapPage = {
|
|
275
|
+
kind: 'bootstrap';
|
|
276
|
+
roomVersion: string;
|
|
277
|
+
models?: RoomModels;
|
|
278
|
+
documents: Readonly<Record<string, string>>;
|
|
279
|
+
revisions: Readonly<Record<string, string>>;
|
|
280
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
281
|
+
changes: Readonly<Record<string, HeadChange>>;
|
|
282
|
+
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
283
|
+
pageToken?: PageToken;
|
|
284
|
+
};
|
|
285
|
+
export type BootstrapResult = BootstrapPage | {
|
|
286
|
+
kind: 'beyond-horizon';
|
|
287
|
+
} | AdapterFailure;
|
|
288
|
+
export type RefreshRequest = {
|
|
289
|
+
locator: string;
|
|
290
|
+
selection: string;
|
|
291
|
+
fromRoomVersion: string;
|
|
292
|
+
pageToken?: PageToken;
|
|
293
|
+
};
|
|
294
|
+
export type RefreshPage = {
|
|
295
|
+
kind: 'net-advancement';
|
|
296
|
+
roomVersion: string;
|
|
297
|
+
models?: RoomModels;
|
|
298
|
+
documents: Readonly<Record<string, string>>;
|
|
299
|
+
revisions: Readonly<Record<string, string>>;
|
|
300
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
301
|
+
changes: Readonly<Record<string, HeadChange>>;
|
|
302
|
+
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
303
|
+
removals: readonly string[];
|
|
304
|
+
pageToken?: PageToken;
|
|
305
|
+
};
|
|
306
|
+
export type RefreshResult = {
|
|
307
|
+
kind: 'still-current';
|
|
308
|
+
} | RefreshPage | {
|
|
309
|
+
kind: 'beyond-horizon';
|
|
310
|
+
} | RetryableRefusal | AdapterFailure;
|
|
311
|
+
export type MutationRequest = {
|
|
312
|
+
locator: string;
|
|
313
|
+
changeBatch: ChangeBatch;
|
|
314
|
+
upload?: unknown;
|
|
315
|
+
};
|
|
316
|
+
export type RetryableRefusal = ProviderRefusal & {
|
|
317
|
+
kind: 'retryable-refusal';
|
|
318
|
+
reset?: string;
|
|
319
|
+
};
|
|
320
|
+
export type ServiceMode = Open<'open' | 'write-halted'>;
|
|
321
|
+
export type ServiceModeSignal = {
|
|
322
|
+
observe(notify: (mode: ServiceMode) => void): () => void;
|
|
323
|
+
};
|
|
324
|
+
export type MutationResult = {
|
|
325
|
+
kind: 'accepted';
|
|
326
|
+
roomVersion: string;
|
|
327
|
+
documents: Readonly<Record<string, string>>;
|
|
328
|
+
revisions: Readonly<Record<string, string>>;
|
|
329
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
330
|
+
changes: Readonly<Record<string, HeadChange>>;
|
|
331
|
+
removals: readonly string[];
|
|
332
|
+
binaryFiles?: Readonly<Record<string, BinaryFile>>;
|
|
333
|
+
author?: string;
|
|
334
|
+
time?: string;
|
|
335
|
+
} | (ProviderRefusal & {
|
|
336
|
+
kind: 'conflicted';
|
|
337
|
+
roomVersion?: string;
|
|
338
|
+
affected: Readonly<Record<string, string>>;
|
|
339
|
+
}) | (ProviderRefusal & {
|
|
340
|
+
kind: 'rejected';
|
|
341
|
+
affected: Readonly<Record<string, string>>;
|
|
342
|
+
}) | RetryableRefusal | {
|
|
343
|
+
kind: 'write-halted';
|
|
344
|
+
} | {
|
|
345
|
+
kind: 'expired';
|
|
346
|
+
restored?: true;
|
|
347
|
+
} | AdapterFailure;
|
|
348
|
+
export type HistoryAuthor = {
|
|
349
|
+
kind: 'user';
|
|
350
|
+
id: string;
|
|
351
|
+
} | {
|
|
352
|
+
kind: 'site';
|
|
353
|
+
id: string;
|
|
354
|
+
name: string;
|
|
355
|
+
};
|
|
356
|
+
export type HistoryRevision = {
|
|
357
|
+
revision: string;
|
|
358
|
+
author: HistoryAuthor;
|
|
359
|
+
time: string;
|
|
360
|
+
binaryFile?: BinaryFile;
|
|
361
|
+
};
|
|
362
|
+
export type HistoryRequest = {
|
|
363
|
+
locator: string;
|
|
364
|
+
path: string;
|
|
365
|
+
revision?: string;
|
|
366
|
+
pageToken?: PageToken;
|
|
367
|
+
};
|
|
368
|
+
export type HistoryResult = {
|
|
369
|
+
kind: 'history';
|
|
370
|
+
revisions: readonly HistoryRevision[];
|
|
371
|
+
pageToken?: PageToken;
|
|
372
|
+
deleted?: true;
|
|
373
|
+
} | {
|
|
374
|
+
kind: 'revision';
|
|
375
|
+
content: string;
|
|
376
|
+
} | {
|
|
377
|
+
kind: 'no-history';
|
|
378
|
+
} | AdapterFailure;
|
|
379
|
+
export type BinaryRequest = {
|
|
380
|
+
kind: 'path';
|
|
381
|
+
locator: string;
|
|
382
|
+
path: string;
|
|
383
|
+
revision: string;
|
|
384
|
+
fileRef?: string;
|
|
385
|
+
} | {
|
|
386
|
+
kind: 'reference';
|
|
387
|
+
fileRef: string;
|
|
388
|
+
referrer: unknown;
|
|
389
|
+
};
|
|
390
|
+
export type ReferrerScope = {
|
|
391
|
+
kind: 'room';
|
|
392
|
+
locator: string;
|
|
393
|
+
path?: string;
|
|
394
|
+
} | {
|
|
395
|
+
kind: 'conversations';
|
|
396
|
+
};
|
|
397
|
+
export type BinaryResult = {
|
|
398
|
+
kind: 'binary';
|
|
399
|
+
blob: Blob;
|
|
400
|
+
} | (ProviderRefusal & {
|
|
401
|
+
kind: 'rejected';
|
|
402
|
+
}) | AdapterFailure;
|
|
403
|
+
export type ActionRequest = {
|
|
404
|
+
name: string;
|
|
405
|
+
input: unknown;
|
|
406
|
+
};
|
|
407
|
+
export type RoomVersionAt = {
|
|
408
|
+
locator: string;
|
|
409
|
+
roomVersion: string;
|
|
410
|
+
};
|
|
411
|
+
export type ActionResult = {
|
|
412
|
+
kind: 'action';
|
|
413
|
+
result: unknown;
|
|
414
|
+
at?: RoomVersionAt;
|
|
415
|
+
} | (ProviderRefusal & {
|
|
416
|
+
kind: 'rejected';
|
|
417
|
+
}) | AdapterFailure;
|
|
418
|
+
export type HeldRoom = {
|
|
419
|
+
locator: string;
|
|
420
|
+
roomVersion: string;
|
|
421
|
+
documents: Readonly<Record<string, string>>;
|
|
422
|
+
revisions: Readonly<Record<string, string>>;
|
|
423
|
+
};
|
|
424
|
+
export type RoomStreamEvent = {
|
|
425
|
+
kind: 'opened';
|
|
426
|
+
} | {
|
|
427
|
+
kind: 'closed';
|
|
428
|
+
revoked: boolean;
|
|
429
|
+
lost: boolean;
|
|
430
|
+
} | {
|
|
431
|
+
kind: 'opening';
|
|
432
|
+
expired: readonly string[];
|
|
433
|
+
} | {
|
|
434
|
+
kind: 'room-version';
|
|
435
|
+
locator: string;
|
|
436
|
+
roomVersion: string;
|
|
437
|
+
};
|
|
438
|
+
export type KeptReceipt = {
|
|
439
|
+
key: string;
|
|
440
|
+
head: unknown;
|
|
441
|
+
};
|
|
442
|
+
export type StreamReceipts = {
|
|
443
|
+
heads(): Promise<readonly KeptReceipt[]>;
|
|
444
|
+
parts(key: string, count: number): Promise<readonly unknown[]>;
|
|
445
|
+
keep(key: string, head: unknown, part?: {
|
|
446
|
+
index: number;
|
|
447
|
+
value: unknown;
|
|
448
|
+
}): Promise<void>;
|
|
449
|
+
drop(keys: readonly string[]): Promise<void>;
|
|
450
|
+
};
|
|
451
|
+
export type AcquiredDemand = {
|
|
452
|
+
rooms: readonly string[];
|
|
453
|
+
conversations: boolean;
|
|
454
|
+
};
|
|
455
|
+
export type RoomStream = {
|
|
456
|
+
hold(rooms: readonly HeldRoom[], demand: AcquiredDemand | null): void;
|
|
457
|
+
reopen(): void;
|
|
458
|
+
published(locator: string, roomVersion: string): void;
|
|
459
|
+
observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts): () => void;
|
|
460
|
+
};
|
|
461
|
+
export type Adapter = {
|
|
462
|
+
readonly localSaves?: true;
|
|
463
|
+
readonly exhaustiveDiscovery?: true;
|
|
464
|
+
authorize(): Promise<Authorization>;
|
|
465
|
+
discover(authorization: Authorization): Promise<DiscoverResult>;
|
|
466
|
+
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
467
|
+
refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
468
|
+
mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
|
|
469
|
+
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
470
|
+
binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
|
|
471
|
+
referrerScope(referrer: unknown): ReferrerScope | null;
|
|
472
|
+
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
473
|
+
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
474
|
+
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
475
|
+
roomStream?: RoomStream;
|
|
476
|
+
conversations?: ConversationStream;
|
|
477
|
+
serviceMode?: ServiceModeSignal;
|
|
478
|
+
};
|
|
479
|
+
export {};
|