@agentshouse/app-bridge 0.1.0-ce42efd6bfc0c → 0.1.0-ce602e5dccd9f
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 -11
- package/dist/index.d.ts +1043 -10
- package/dist/mdmodel/definition.d.ts +18 -1
- package/dist/mdmodel/document.d.ts +10 -6
- package/dist/mdmodel/event.d.ts +77 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/index.d.ts +26 -12
- package/dist/mdmodel/kinds.d.ts +17 -0
- package/dist/mdmodel/markdown.d.ts +50 -0
- package/dist/mdmodel/paths.d.ts +9 -1
- package/dist/mdmodel/pattern.d.ts +9 -0
- package/dist/mdmodel/project.d.ts +1 -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/reserved.d.ts +5 -0
- package/dist/mdmodel/types.d.ts +46 -5
- package/dist/mdmodel/validate.d.ts +31 -4
- package/dist/mdruntime/actions.d.ts +19 -0
- package/dist/mdruntime/adapter.d.ts +166 -121
- package/dist/mdruntime/attached-model.d.ts +7 -0
- package/dist/mdruntime/binary.d.ts +0 -5
- 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 +9 -16
- package/dist/mdruntime/change.d.ts +32 -1
- package/dist/mdruntime/client.d.ts +38 -12
- package/dist/mdruntime/collection.d.ts +29 -21
- package/dist/mdruntime/compile.d.ts +15 -0
- package/dist/mdruntime/conversation-live.d.ts +134 -0
- package/dist/mdruntime/conversation-row.d.ts +32 -0
- package/dist/mdruntime/conversation.d.ts +54 -45
- package/dist/mdruntime/declaration.d.ts +9 -0
- package/dist/mdruntime/durability.d.ts +16 -4
- package/dist/mdruntime/failure.d.ts +1 -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 +55 -0
- package/dist/mdruntime/listing.d.ts +51 -0
- package/dist/mdruntime/live.d.ts +22 -0
- package/dist/mdruntime/log.d.ts +5 -0
- package/dist/mdruntime/media.d.ts +7 -0
- package/dist/mdruntime/messages.d.ts +48 -0
- package/dist/mdruntime/model.d.ts +11 -13
- package/dist/mdruntime/observation.d.ts +17 -2
- package/dist/mdruntime/opened.d.ts +21 -0
- package/dist/mdruntime/outcome.d.ts +49 -8
- package/dist/mdruntime/overlay.d.ts +5 -5
- package/dist/mdruntime/preparation.d.ts +19 -0
- package/dist/mdruntime/query.d.ts +27 -186
- package/dist/mdruntime/reach.d.ts +19 -9
- package/dist/mdruntime/readiness.d.ts +13 -17
- package/dist/mdruntime/reads.d.ts +36 -0
- package/dist/mdruntime/recovery.d.ts +3 -2
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +50 -33
- package/dist/mdruntime/room-draft.d.ts +39 -9
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +43 -0
- package/dist/mdruntime/save.d.ts +54 -16
- package/dist/mdruntime/saves.d.ts +69 -0
- package/dist/mdruntime/search.d.ts +15 -77
- 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 +19 -0
- package/dist/mdruntime/socket/rooms.d.ts +40 -0
- package/dist/mdruntime/socket/session.d.ts +37 -0
- package/dist/mdruntime/socket.d.ts +68 -0
- package/dist/mdruntime/source.d.ts +60 -0
- package/dist/mdruntime/status.d.ts +4 -5
- package/dist/mdruntime/store/fences.d.ts +15 -0
- package/dist/mdruntime/store/installs.d.ts +29 -0
- package/dist/mdruntime/store/readiness.d.ts +9 -0
- package/dist/mdruntime/store/records.d.ts +209 -0
- package/dist/mdruntime/store/room-held.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 +106 -148
- package/dist/mdruntime/stored.d.ts +155 -0
- package/dist/mdruntime/surface.d.ts +87 -0
- package/dist/mdruntime/tables.d.ts +411 -0
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +0 -5
- package/dist/mdruntime/turn.d.ts +5 -3
- package/dist/mdruntime/wire.d.ts +183 -37
- 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 +102 -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 +7 -1
- package/dist/test-host.js +19 -2
- package/docs/families.md +71 -18
- package/package.json +8 -3
- package/dist/calls.d.ts +0 -117
- package/dist/calls.js +0 -1
- package/dist/mdmodel/blocks.d.ts +0 -10
- package/dist/mdmodel/condition.d.ts +0 -149
- package/dist/mdmodel/profile.d.ts +0 -5
- package/dist/mdruntime/acquisition.d.ts +0 -13
- package/dist/mdruntime/connection.d.ts +0 -138
- package/dist/mdruntime/file.d.ts +0 -19
- package/dist/mdruntime/rows.d.ts +0 -36
- package/dist/mdruntime/shared.d.ts +0 -10
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const ROOM_DESCRIPTION = "ROOM.md";
|
|
2
|
+
export declare const CAPTURE_HOME = "capture";
|
|
3
|
+
export declare const RESERVED_NAMES: readonly string[];
|
|
4
|
+
export declare function isReservedName(name: string): boolean;
|
|
5
|
+
export declare function isDocumentPath(path: string): boolean;
|
package/dist/mdmodel/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Definition } from './definition.js';
|
|
|
2
2
|
export type Library = Readonly<Record<string, string>>;
|
|
3
3
|
export type VerifiedModel = {
|
|
4
4
|
readonly types: Readonly<Record<string, Definition>>;
|
|
5
|
+
readonly nameable?: readonly string[];
|
|
5
6
|
};
|
|
6
7
|
export type ModelVerification = {
|
|
7
8
|
readonly verdict: 'accept';
|
|
@@ -11,15 +12,23 @@ export type ModelVerification = {
|
|
|
11
12
|
readonly rule: string;
|
|
12
13
|
readonly location?: string;
|
|
13
14
|
};
|
|
15
|
+
export type TypedPath = {
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly type: string;
|
|
18
|
+
readonly named: boolean;
|
|
19
|
+
readonly body: boolean;
|
|
20
|
+
};
|
|
14
21
|
export type ValidationContext = {
|
|
15
22
|
readonly binaryTargets: readonly string[];
|
|
23
|
+
readonly anyRoom?: true;
|
|
24
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
16
25
|
};
|
|
17
26
|
export type ProjectionContext = {
|
|
18
27
|
readonly documentTargets: readonly string[];
|
|
19
28
|
readonly definition?: Definition;
|
|
20
29
|
};
|
|
21
30
|
export type DivisionContext = ProjectionContext & {
|
|
22
|
-
readonly
|
|
31
|
+
readonly bound: number;
|
|
23
32
|
};
|
|
24
33
|
export type Extent = {
|
|
25
34
|
readonly start: number;
|
|
@@ -36,7 +45,9 @@ export type Frontmatter = {
|
|
|
36
45
|
export type Document = Frontmatter & {
|
|
37
46
|
readonly preamble: string;
|
|
38
47
|
readonly sections: Readonly<Record<string, string>>;
|
|
48
|
+
readonly text: string;
|
|
39
49
|
};
|
|
50
|
+
export type DefinitionOf = (type: string | undefined) => Definition | undefined;
|
|
40
51
|
export type Refusal = {
|
|
41
52
|
readonly file: string;
|
|
42
53
|
readonly rule: string;
|
|
@@ -60,6 +71,10 @@ export type Validation = {
|
|
|
60
71
|
} | ({
|
|
61
72
|
readonly verdict: 'refuse';
|
|
62
73
|
} & Refusal);
|
|
74
|
+
export type ValidationStep = {
|
|
75
|
+
readonly path: string;
|
|
76
|
+
readonly resolved: number;
|
|
77
|
+
};
|
|
63
78
|
export type Projection = {
|
|
64
79
|
readonly ok: true;
|
|
65
80
|
readonly text: string;
|
|
@@ -92,14 +107,31 @@ export type Link = {
|
|
|
92
107
|
readonly href: string;
|
|
93
108
|
readonly target: string;
|
|
94
109
|
};
|
|
95
|
-
export type LinkOccurrence = Link & {
|
|
96
|
-
readonly start: number;
|
|
97
|
-
};
|
|
98
110
|
export type Reference = {
|
|
99
111
|
readonly pointer: string;
|
|
100
112
|
readonly value: string;
|
|
101
113
|
readonly to: readonly string[];
|
|
114
|
+
readonly crossRoom?: true;
|
|
102
115
|
};
|
|
116
|
+
export type RoomReference = {
|
|
117
|
+
readonly handle: string;
|
|
118
|
+
readonly path: string;
|
|
119
|
+
} & ({
|
|
120
|
+
readonly kind: 'link';
|
|
121
|
+
readonly href: string;
|
|
122
|
+
} | {
|
|
123
|
+
readonly kind: 'field';
|
|
124
|
+
readonly pointer: string;
|
|
125
|
+
readonly value: string;
|
|
126
|
+
readonly to: readonly string[];
|
|
127
|
+
readonly crossRoom?: true;
|
|
128
|
+
} | {
|
|
129
|
+
readonly kind: 'item';
|
|
130
|
+
readonly section: string;
|
|
131
|
+
readonly href: string;
|
|
132
|
+
readonly to: readonly string[];
|
|
133
|
+
readonly crossRoom?: true;
|
|
134
|
+
});
|
|
103
135
|
export type Change = {
|
|
104
136
|
readonly kind: 'field';
|
|
105
137
|
readonly name: string;
|
|
@@ -109,11 +141,15 @@ export type Change = {
|
|
|
109
141
|
readonly kind: 'section';
|
|
110
142
|
readonly name: string;
|
|
111
143
|
readonly value: string;
|
|
112
|
-
readonly prior: string;
|
|
144
|
+
readonly prior: string | undefined;
|
|
113
145
|
} | {
|
|
114
146
|
readonly kind: 'preamble';
|
|
115
147
|
readonly value: string;
|
|
116
148
|
readonly prior: string;
|
|
149
|
+
} | {
|
|
150
|
+
readonly kind: 'text';
|
|
151
|
+
readonly value: string;
|
|
152
|
+
readonly prior: string;
|
|
117
153
|
} | {
|
|
118
154
|
readonly kind: 'link';
|
|
119
155
|
readonly href: string;
|
|
@@ -130,6 +166,7 @@ export type ApplyResult = {
|
|
|
130
166
|
} | {
|
|
131
167
|
readonly outcome: 'stale';
|
|
132
168
|
readonly document: Document;
|
|
169
|
+
readonly stale: readonly number[];
|
|
133
170
|
} | {
|
|
134
171
|
readonly outcome: 'refuse';
|
|
135
172
|
readonly refusal: Refusal;
|
|
@@ -141,3 +178,7 @@ export type BodyResult = {
|
|
|
141
178
|
readonly outcome: 'refuse';
|
|
142
179
|
readonly refusal: Refusal;
|
|
143
180
|
};
|
|
181
|
+
export type UnlinkedBody = {
|
|
182
|
+
readonly body: string;
|
|
183
|
+
readonly links: ReadonlyMap<string, string>;
|
|
184
|
+
};
|
|
@@ -1,7 +1,34 @@
|
|
|
1
1
|
import { type Definition } from './definition.js';
|
|
2
|
-
import type { DocumentCheck, Library, ModelVerification, Reached, Validation, ValidationContext, VerifiedModel } from './types.js';
|
|
2
|
+
import type { DefinitionOf, Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
|
|
3
|
+
export declare function definitionAt(model: VerifiedModel, file: string, typedPaths?: readonly TypedPath[]): DefinitionOf;
|
|
3
4
|
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
|
|
6
|
-
|
|
5
|
+
export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
|
|
6
|
+
export declare function readTypes(schema: string, provided?: VerifiedModel): VerifiedModel;
|
|
7
|
+
type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
|
|
8
|
+
export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
|
|
9
|
+
export declare function bodyRoomLinks(body: string): RoomReference[];
|
|
10
|
+
export declare function roomReferences(document: Document, definition?: Definition): readonly RoomReference[];
|
|
11
|
+
type Placed = {
|
|
12
|
+
readonly reference: Reached;
|
|
13
|
+
readonly location: string;
|
|
14
|
+
};
|
|
15
|
+
export type Assessment = {
|
|
16
|
+
readonly file: string;
|
|
17
|
+
readonly type: string | undefined;
|
|
18
|
+
readonly targets: readonly string[];
|
|
19
|
+
readonly read: Validation | null;
|
|
20
|
+
readonly structured: Validation | null;
|
|
21
|
+
readonly fields: readonly Placed[];
|
|
22
|
+
readonly linked: boolean;
|
|
23
|
+
readonly sections: readonly Placed[];
|
|
24
|
+
};
|
|
25
|
+
export declare function assess(file: string, parsed: ParseResult, binary: boolean, model?: VerifiedModel, context?: Placing): Assessment;
|
|
26
|
+
export declare function assessReferences(file: string, parsed: ParseResult, changed: ReadonlySet<string>, model?: VerifiedModel, context?: Placing): Assessment;
|
|
27
|
+
export type Verdicts = {
|
|
28
|
+
add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
|
|
29
|
+
verdict(): Validation;
|
|
30
|
+
};
|
|
31
|
+
export declare function verdicts(): Verdicts;
|
|
32
|
+
export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
|
|
7
33
|
export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ConversationHistoryRequest } from './adapter.js';
|
|
2
|
+
import { type CallResult, type HistoryAnswer, type Resolution } from './outcome.js';
|
|
3
|
+
import type { Attempted } from './recovery.js';
|
|
4
|
+
import type { Runtime } from './runtime.js';
|
|
5
|
+
export type HistoryQuery = {
|
|
6
|
+
revision?: string;
|
|
7
|
+
pageToken?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function readHistory(runtime: Runtime, locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
|
|
10
|
+
export declare function located(runtime: Runtime, room: string, path: string, destination: string): Promise<{
|
|
11
|
+
room: string;
|
|
12
|
+
path: string;
|
|
13
|
+
} | null>;
|
|
14
|
+
export declare function resolveReference(runtime: Runtime, room: string, path: string, destination: string): Promise<Resolution>;
|
|
15
|
+
export declare function invokeAction(runtime: Runtime, name: string, input: unknown, dispatching?: () => Promise<void>): Promise<CallResult>;
|
|
16
|
+
export declare function readConversationHistory(runtime: Runtime, request: ConversationHistoryRequest): Promise<CallResult>;
|
|
17
|
+
export declare function called(runtime: Runtime, name: string, input: unknown): Promise<CallResult>;
|
|
18
|
+
export declare function resendCalls(runtime: Runtime, signal: AbortSignal): Promise<Attempted>;
|
|
19
|
+
export declare function resendLater(runtime: Runtime): void;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { SavedFacts, TypedPath } from '../mdmodel/index.js';
|
|
2
|
+
import type { Operation, SessionState } from '../session-content/index.js';
|
|
1
3
|
import type { ModelResult } from './model.js';
|
|
4
|
+
export type { SavedFacts, TypedPath };
|
|
2
5
|
import type { Open } from './open.js';
|
|
3
6
|
import type { ChangeBatch } from './change.js';
|
|
4
7
|
export type Authorization = object;
|
|
@@ -10,47 +13,46 @@ export type TypedSelection = {
|
|
|
10
13
|
roots: readonly string[];
|
|
11
14
|
};
|
|
12
15
|
export type OperationScopes = {
|
|
13
|
-
read: readonly string[];
|
|
14
|
-
sync: readonly string[];
|
|
15
16
|
write: readonly string[];
|
|
16
|
-
|
|
17
|
+
erase: readonly string[];
|
|
17
18
|
};
|
|
18
19
|
export type ReplicaAdmission = {
|
|
19
20
|
selection: string;
|
|
20
21
|
admission: Open<'admitted' | 'unavailable'>;
|
|
22
|
+
offline: Open<'locked' | 'open'>;
|
|
21
23
|
};
|
|
22
|
-
export type
|
|
23
|
-
name: string;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
export type RoomDeclaration = {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly handle: string;
|
|
27
|
+
readonly operations: OperationScopes;
|
|
28
|
+
readonly replica: ReplicaAdmission;
|
|
29
|
+
readonly typedSelection: TypedSelection | null;
|
|
30
|
+
readonly providerOwnedPaths: readonly string[];
|
|
31
|
+
readonly authoredPaths: readonly string[];
|
|
32
|
+
};
|
|
33
|
+
export type DiscoveredRoom = RoomDeclaration & {
|
|
34
|
+
readonly locator: string;
|
|
35
|
+
readonly roomVersion: string;
|
|
31
36
|
};
|
|
32
37
|
export type Capability = {
|
|
33
38
|
name: string;
|
|
34
39
|
limits?: readonly ProviderLimit[];
|
|
35
40
|
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
41
|
};
|
|
45
42
|
export type ListedConversation = {
|
|
46
43
|
conversation: string;
|
|
47
44
|
agent: string;
|
|
45
|
+
agentName: string;
|
|
46
|
+
agentRetired: boolean;
|
|
48
47
|
name: string;
|
|
49
48
|
created: string;
|
|
50
49
|
finished: string | null;
|
|
51
50
|
outcome: string | null;
|
|
51
|
+
waiting: boolean;
|
|
52
|
+
newest: string | null;
|
|
53
|
+
processEnded: string | null;
|
|
52
54
|
};
|
|
53
|
-
export type ConversationAction = '
|
|
55
|
+
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
|
|
54
56
|
export type ConversationMessage = {
|
|
55
57
|
identity: string;
|
|
56
58
|
turn: string;
|
|
@@ -74,37 +76,10 @@ export type ConversationHistoryPage = {
|
|
|
74
76
|
export type ConversationHistories = {
|
|
75
77
|
histories: readonly ConversationHistoryPage[];
|
|
76
78
|
};
|
|
77
|
-
export type TurnContext = {
|
|
78
|
-
used: number;
|
|
79
|
-
window: number;
|
|
80
|
-
};
|
|
81
79
|
export type TurnOperation = {
|
|
82
80
|
op: 'begin';
|
|
83
81
|
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);
|
|
82
|
+
} | Operation;
|
|
108
83
|
export type ProcessCommand = {
|
|
109
84
|
[field: string]: unknown;
|
|
110
85
|
name: string;
|
|
@@ -162,6 +137,22 @@ export type ConversationEvent = {
|
|
|
162
137
|
kind: 'options';
|
|
163
138
|
conversation: string;
|
|
164
139
|
options: readonly SessionOption[];
|
|
140
|
+
} | {
|
|
141
|
+
kind: 'starting';
|
|
142
|
+
conversation: string;
|
|
143
|
+
step: string | null;
|
|
144
|
+
} | {
|
|
145
|
+
kind: 'state';
|
|
146
|
+
conversation: string;
|
|
147
|
+
state: SessionState | null;
|
|
148
|
+
} | {
|
|
149
|
+
kind: 'link';
|
|
150
|
+
conversation: string;
|
|
151
|
+
connected: boolean;
|
|
152
|
+
} | {
|
|
153
|
+
kind: 'deliveries';
|
|
154
|
+
conversation: string;
|
|
155
|
+
unknown: readonly string[];
|
|
165
156
|
} | {
|
|
166
157
|
kind: 'accepted-message';
|
|
167
158
|
conversation: string;
|
|
@@ -172,6 +163,9 @@ export type ConversationEvent = {
|
|
|
172
163
|
} | {
|
|
173
164
|
kind: 'list';
|
|
174
165
|
entries: readonly ListedConversation[];
|
|
166
|
+
whole: boolean;
|
|
167
|
+
more: boolean;
|
|
168
|
+
cursor: string | null;
|
|
175
169
|
} | {
|
|
176
170
|
kind: 'listed';
|
|
177
171
|
entry: ListedConversation;
|
|
@@ -179,14 +173,23 @@ export type ConversationEvent = {
|
|
|
179
173
|
kind: 'unlisted';
|
|
180
174
|
conversation: string;
|
|
181
175
|
};
|
|
176
|
+
export type ListedAgent = {
|
|
177
|
+
agent: string;
|
|
178
|
+
name: string;
|
|
179
|
+
retired: boolean;
|
|
180
|
+
};
|
|
182
181
|
export type ConversationStream = {
|
|
183
182
|
replicate(conversations: readonly string[]): void;
|
|
183
|
+
hold(cursor: string | null): void;
|
|
184
184
|
observe(notify: (event: ConversationEvent) => void): () => void;
|
|
185
|
+
agents?(): Promise<readonly ListedAgent[] | null>;
|
|
186
|
+
history?(request: ConversationHistoryRequest): Promise<ActionResult>;
|
|
185
187
|
};
|
|
186
188
|
export type ActionDeclaration = {
|
|
187
189
|
name: string;
|
|
188
190
|
inputShape: unknown;
|
|
189
191
|
resultKind: unknown;
|
|
192
|
+
room?: string;
|
|
190
193
|
};
|
|
191
194
|
export type ProviderLimit = {
|
|
192
195
|
name: string;
|
|
@@ -200,7 +203,6 @@ export type HistoryRetention = {
|
|
|
200
203
|
};
|
|
201
204
|
export type Retention = {
|
|
202
205
|
history: HistoryRetention;
|
|
203
|
-
outcome: number;
|
|
204
206
|
refreshHorizon: number;
|
|
205
207
|
};
|
|
206
208
|
export type Discovery = {
|
|
@@ -229,7 +231,7 @@ export type ProviderRefusal = {
|
|
|
229
231
|
export type ScopedRefusal = ProviderRefusal & {
|
|
230
232
|
kind: 'scoped-refusal';
|
|
231
233
|
locator: string;
|
|
232
|
-
scope: Open<'content' | '
|
|
234
|
+
scope: Open<'content' | 'model' | 'operation' | 'undisclosed'>;
|
|
233
235
|
};
|
|
234
236
|
export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
|
|
235
237
|
export type ContractUnavailable = ProviderRefusal & {
|
|
@@ -238,54 +240,63 @@ export type ContractUnavailable = ProviderRefusal & {
|
|
|
238
240
|
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
239
241
|
export type PageToken = string;
|
|
240
242
|
export type ChangeAuthor = {
|
|
241
|
-
kind: 'user'
|
|
243
|
+
kind: Open<'user' | 'site' | 'inbox' | 'app'>;
|
|
242
244
|
id: string;
|
|
243
245
|
name: string;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
+
};
|
|
247
|
+
export type Member = {
|
|
248
|
+
kind: Open<'user'>;
|
|
246
249
|
id: string;
|
|
247
250
|
name: string;
|
|
248
251
|
};
|
|
249
|
-
export type Member = Extract<ChangeAuthor, {
|
|
250
|
-
kind: 'user';
|
|
251
|
-
}>;
|
|
252
252
|
export type HeadChange = {
|
|
253
253
|
author: ChangeAuthor | null;
|
|
254
254
|
time: string;
|
|
255
255
|
};
|
|
256
256
|
export type BinaryFile = {
|
|
257
|
-
fileRef: string;
|
|
258
257
|
byteLength: number;
|
|
259
258
|
mediaType: string;
|
|
260
259
|
sha256: string;
|
|
261
260
|
};
|
|
262
|
-
export type HeldContent = {
|
|
263
|
-
documents: Readonly<Record<string, string>>;
|
|
264
|
-
revisions: Readonly<Record<string, string>>;
|
|
265
|
-
};
|
|
266
261
|
export type BootstrapRequest = {
|
|
267
262
|
locator: string;
|
|
268
263
|
selection: string;
|
|
269
264
|
pageToken?: PageToken;
|
|
270
|
-
|
|
265
|
+
arriving?: (bytes: number) => void;
|
|
266
|
+
signal?: AbortSignal;
|
|
267
|
+
};
|
|
268
|
+
export type BootstrapPart = {
|
|
269
|
+
readonly id: string;
|
|
270
|
+
readonly bytes: number;
|
|
271
|
+
};
|
|
272
|
+
export type BootstrapInventory = {
|
|
273
|
+
readonly bytes: number;
|
|
271
274
|
};
|
|
272
275
|
export type RoomModels = {
|
|
273
276
|
collection?: ModelResult;
|
|
274
|
-
selection?: ModelResult;
|
|
275
277
|
};
|
|
276
278
|
export type BootstrapPage = {
|
|
277
279
|
kind: 'bootstrap';
|
|
278
280
|
roomVersion: string;
|
|
279
281
|
models?: RoomModels;
|
|
280
282
|
documents: Readonly<Record<string, string>>;
|
|
283
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
281
284
|
revisions: Readonly<Record<string, string>>;
|
|
285
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
286
|
+
created?: Readonly<Record<string, string>>;
|
|
282
287
|
changes: Readonly<Record<string, HeadChange>>;
|
|
283
288
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
289
|
+
folders?: readonly string[];
|
|
284
290
|
pageToken?: PageToken;
|
|
291
|
+
parts?: readonly BootstrapPart[];
|
|
292
|
+
bytes?: number;
|
|
293
|
+
};
|
|
294
|
+
export type NotReady = {
|
|
295
|
+
kind: 'not-ready';
|
|
285
296
|
};
|
|
286
297
|
export type BootstrapResult = BootstrapPage | {
|
|
287
298
|
kind: 'beyond-horizon';
|
|
288
|
-
} | AdapterFailure;
|
|
299
|
+
} | NotReady | AdapterFailure;
|
|
289
300
|
export type RefreshRequest = {
|
|
290
301
|
locator: string;
|
|
291
302
|
selection: string;
|
|
@@ -297,10 +308,15 @@ export type RefreshPage = {
|
|
|
297
308
|
roomVersion: string;
|
|
298
309
|
models?: RoomModels;
|
|
299
310
|
documents: Readonly<Record<string, string>>;
|
|
311
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
300
312
|
revisions: Readonly<Record<string, string>>;
|
|
313
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
314
|
+
created?: Readonly<Record<string, string>>;
|
|
301
315
|
changes: Readonly<Record<string, HeadChange>>;
|
|
302
316
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
303
317
|
removals: readonly string[];
|
|
318
|
+
folders?: readonly string[];
|
|
319
|
+
folderRemovals?: readonly string[];
|
|
304
320
|
pageToken?: PageToken;
|
|
305
321
|
};
|
|
306
322
|
export type RefreshResult = {
|
|
@@ -311,6 +327,7 @@ export type RefreshResult = {
|
|
|
311
327
|
export type MutationRequest = {
|
|
312
328
|
locator: string;
|
|
313
329
|
changeBatch: ChangeBatch;
|
|
330
|
+
file(localId: string): Promise<Blob>;
|
|
314
331
|
upload?: unknown;
|
|
315
332
|
};
|
|
316
333
|
export type RetryableRefusal = ProviderRefusal & {
|
|
@@ -321,17 +338,21 @@ export type ServiceMode = Open<'open' | 'write-halted'>;
|
|
|
321
338
|
export type ServiceModeSignal = {
|
|
322
339
|
observe(notify: (mode: ServiceMode) => void): () => void;
|
|
323
340
|
};
|
|
324
|
-
export type
|
|
325
|
-
kind: 'accepted';
|
|
341
|
+
export type AcceptedRoom = {
|
|
326
342
|
roomVersion: string;
|
|
327
343
|
documents: Readonly<Record<string, string>>;
|
|
328
344
|
revisions: Readonly<Record<string, string>>;
|
|
345
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
329
346
|
changes: Readonly<Record<string, HeadChange>>;
|
|
330
347
|
removals: readonly string[];
|
|
331
348
|
binaryFiles?: Readonly<Record<string, BinaryFile>>;
|
|
349
|
+
};
|
|
350
|
+
export type MutationResult = (AcceptedRoom & {
|
|
351
|
+
kind: 'accepted';
|
|
332
352
|
author?: string;
|
|
333
353
|
time?: string;
|
|
334
|
-
|
|
354
|
+
destination?: AcceptedRoom;
|
|
355
|
+
}) | (ProviderRefusal & {
|
|
335
356
|
kind: 'conflicted';
|
|
336
357
|
roomVersion?: string;
|
|
337
358
|
affected: Readonly<Record<string, string>>;
|
|
@@ -340,15 +361,9 @@ export type MutationResult = {
|
|
|
340
361
|
affected: Readonly<Record<string, string>>;
|
|
341
362
|
}) | RetryableRefusal | {
|
|
342
363
|
kind: 'write-halted';
|
|
343
|
-
} | {
|
|
344
|
-
kind: 'expired';
|
|
345
|
-
restored?: true;
|
|
346
364
|
} | AdapterFailure;
|
|
347
365
|
export type HistoryAuthor = {
|
|
348
|
-
kind: 'user';
|
|
349
|
-
id: string;
|
|
350
|
-
} | {
|
|
351
|
-
kind: 'site';
|
|
366
|
+
kind: 'user' | 'site' | 'inbox' | 'app';
|
|
352
367
|
id: string;
|
|
353
368
|
name: string;
|
|
354
369
|
};
|
|
@@ -380,22 +395,35 @@ export type BinaryRequest = {
|
|
|
380
395
|
locator: string;
|
|
381
396
|
path: string;
|
|
382
397
|
revision: string;
|
|
383
|
-
fileRef?: string;
|
|
384
|
-
} | {
|
|
385
|
-
kind: 'reference';
|
|
386
|
-
fileRef: string;
|
|
387
|
-
referrer: unknown;
|
|
388
|
-
};
|
|
389
|
-
export type ReferrerScope = {
|
|
390
|
-
kind: 'room';
|
|
391
|
-
locator: string;
|
|
392
|
-
path?: string;
|
|
393
|
-
} | {
|
|
394
|
-
kind: 'conversations';
|
|
395
398
|
};
|
|
396
399
|
export type BinaryResult = {
|
|
397
400
|
kind: 'binary';
|
|
401
|
+
body: ReadableStream<Uint8Array>;
|
|
402
|
+
mediaType: string;
|
|
403
|
+
sha256?: string;
|
|
404
|
+
} | (ProviderRefusal & {
|
|
405
|
+
kind: 'rejected';
|
|
406
|
+
}) | AdapterFailure;
|
|
407
|
+
export type BinaryLinkResult = {
|
|
408
|
+
kind: 'link';
|
|
409
|
+
url: string;
|
|
410
|
+
name: string;
|
|
411
|
+
mediaType?: string;
|
|
412
|
+
} | (ProviderRefusal & {
|
|
413
|
+
kind: 'rejected';
|
|
414
|
+
}) | AdapterFailure;
|
|
415
|
+
export type AttachRequest = {
|
|
416
|
+
locator: string;
|
|
417
|
+
name: string;
|
|
418
|
+
mediaType: string;
|
|
419
|
+
byteLength: number;
|
|
420
|
+
sha256: string;
|
|
398
421
|
blob: Blob;
|
|
422
|
+
};
|
|
423
|
+
export type AttachResult = {
|
|
424
|
+
kind: 'attached';
|
|
425
|
+
path: string;
|
|
426
|
+
revision: string;
|
|
399
427
|
} | (ProviderRefusal & {
|
|
400
428
|
kind: 'rejected';
|
|
401
429
|
}) | AdapterFailure;
|
|
@@ -411,67 +439,84 @@ export type ActionResult = {
|
|
|
411
439
|
kind: 'action';
|
|
412
440
|
result: unknown;
|
|
413
441
|
at?: RoomVersionAt;
|
|
442
|
+
} | (ProviderRefusal & {
|
|
443
|
+
kind: 'rejected';
|
|
444
|
+
reset?: string;
|
|
445
|
+
}) | AdapterFailure;
|
|
446
|
+
export type SearchHit = {
|
|
447
|
+
room: string;
|
|
448
|
+
path: string;
|
|
449
|
+
line?: number;
|
|
450
|
+
snippet?: string;
|
|
451
|
+
};
|
|
452
|
+
export type SearchAsk = {
|
|
453
|
+
text: string;
|
|
454
|
+
rooms: readonly string[] | null;
|
|
455
|
+
};
|
|
456
|
+
export type SearchAnswer = {
|
|
457
|
+
kind: 'found';
|
|
458
|
+
documents: readonly SearchHit[];
|
|
414
459
|
} | (ProviderRefusal & {
|
|
415
460
|
kind: 'rejected';
|
|
416
461
|
}) | AdapterFailure;
|
|
417
462
|
export type HeldRoom = {
|
|
418
463
|
locator: string;
|
|
464
|
+
roomVersion: string | null;
|
|
465
|
+
};
|
|
466
|
+
export type RoomChange = {
|
|
467
|
+
kind: 'room-change';
|
|
468
|
+
locator: string;
|
|
469
|
+
from: string | null;
|
|
419
470
|
roomVersion: string;
|
|
420
|
-
|
|
421
|
-
|
|
471
|
+
read(): Promise<RefreshPage>;
|
|
472
|
+
};
|
|
473
|
+
export type AuthorityChange = {
|
|
474
|
+
kind: 'authority-changed';
|
|
475
|
+
rooms: readonly DiscoveredRoom[];
|
|
476
|
+
left: readonly string[];
|
|
477
|
+
member?: Member;
|
|
422
478
|
};
|
|
423
479
|
export type RoomStreamEvent = {
|
|
424
480
|
kind: 'opened';
|
|
481
|
+
} | {
|
|
482
|
+
kind: 'discovered';
|
|
483
|
+
discovery: Discovery;
|
|
425
484
|
} | {
|
|
426
485
|
kind: 'closed';
|
|
427
486
|
revoked: boolean;
|
|
487
|
+
lost: boolean;
|
|
488
|
+
authorityChanged: boolean;
|
|
428
489
|
} | {
|
|
429
|
-
kind: '
|
|
490
|
+
kind: 'caught-up';
|
|
430
491
|
expired: readonly string[];
|
|
431
|
-
} |
|
|
432
|
-
kind: 'room-version';
|
|
433
|
-
locator: string;
|
|
434
|
-
roomVersion: string;
|
|
435
|
-
};
|
|
436
|
-
export type KeptReceipt = {
|
|
437
|
-
key: string;
|
|
438
|
-
head: unknown;
|
|
439
|
-
};
|
|
440
|
-
export type StreamReceipts = {
|
|
441
|
-
heads(): Promise<readonly KeptReceipt[]>;
|
|
442
|
-
parts(key: string, count: number): Promise<readonly unknown[]>;
|
|
443
|
-
keep(key: string, head: unknown, part?: {
|
|
444
|
-
index: number;
|
|
445
|
-
value: unknown;
|
|
446
|
-
}): Promise<void>;
|
|
447
|
-
drop(keys: readonly string[]): Promise<void>;
|
|
448
|
-
};
|
|
449
|
-
export type AcquiredDemand = {
|
|
450
|
-
rooms: readonly string[];
|
|
451
|
-
conversations: boolean;
|
|
452
|
-
};
|
|
492
|
+
} | AuthorityChange | RoomChange;
|
|
453
493
|
export type RoomStream = {
|
|
454
|
-
hold(rooms: readonly HeldRoom[]
|
|
455
|
-
|
|
456
|
-
published(locator: string, roomVersion: string): void;
|
|
457
|
-
observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts): () => void;
|
|
494
|
+
hold(rooms: readonly HeldRoom[]): void;
|
|
495
|
+
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
458
496
|
};
|
|
497
|
+
export type PathRule = (path: string) => boolean;
|
|
459
498
|
export type Adapter = {
|
|
460
499
|
readonly localSaves?: true;
|
|
461
|
-
readonly
|
|
500
|
+
readonly roomTypes?: string;
|
|
501
|
+
readonly nameableRoomTypes?: readonly string[];
|
|
502
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
503
|
+
readonly pathRule?: PathRule;
|
|
504
|
+
readonly unkeptReads?: readonly string[];
|
|
505
|
+
readonly leadingReads?: readonly string[];
|
|
462
506
|
authorize(): Promise<Authorization>;
|
|
463
|
-
discover(authorization: Authorization): Promise<DiscoverResult>;
|
|
507
|
+
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
464
508
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
465
|
-
refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
509
|
+
refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
466
510
|
mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
|
|
467
511
|
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
468
512
|
binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
|
|
469
|
-
|
|
513
|
+
link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
|
|
514
|
+
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
470
515
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
516
|
+
search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
|
|
471
517
|
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
472
518
|
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
473
519
|
roomStream?: RoomStream;
|
|
474
520
|
conversations?: ConversationStream;
|
|
475
521
|
serviceMode?: ServiceModeSignal;
|
|
476
522
|
};
|
|
477
|
-
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type VerifiedModel } from '../mdmodel/index.js';
|
|
2
|
+
import type { ModelResult, ModelState } from './model.js';
|
|
3
|
+
export declare const NO_ROOM_TYPES: VerifiedModel;
|
|
4
|
+
export declare function roomTypesOf(schema: string | undefined, nameable?: readonly string[]): VerifiedModel;
|
|
5
|
+
export declare function builtInModel(roomTypes: VerifiedModel): ModelState;
|
|
6
|
+
export declare function schemaTypes(schema: string | null, roomTypes: VerifiedModel): VerifiedModel['types'];
|
|
7
|
+
export declare function attachedModel(answer: ModelResult, roomTypes: VerifiedModel): ModelState;
|