@agentshouse/app-bridge 0.1.0-cc70c9b07c3ec → 0.1.0-ccb370c312d73
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/dist/calls.d.ts +2 -1
- package/dist/index.d.ts +16 -2
- package/dist/mdmodel/definition.d.ts +12 -0
- package/dist/mdmodel/document.d.ts +2 -1
- package/dist/mdmodel/index.d.ts +5 -5
- package/dist/mdmodel/references.d.ts +2 -2
- package/dist/mdmodel/types.d.ts +22 -1
- package/dist/mdmodel/validate.d.ts +5 -1
- package/dist/mdruntime/acquisition.d.ts +13 -0
- package/dist/mdruntime/adapter.d.ts +38 -9
- package/dist/mdruntime/change-set.d.ts +2 -0
- package/dist/mdruntime/client.d.ts +12 -8
- package/dist/mdruntime/collection.d.ts +17 -3
- package/dist/mdruntime/connection.d.ts +24 -7
- package/dist/mdruntime/conversation.d.ts +15 -7
- package/dist/mdruntime/durability.d.ts +7 -1
- package/dist/mdruntime/model.d.ts +4 -2
- package/dist/mdruntime/observation.d.ts +5 -2
- package/dist/mdruntime/outcome.d.ts +4 -0
- package/dist/mdruntime/overlay.d.ts +2 -0
- package/dist/mdruntime/query.d.ts +35 -3
- package/dist/mdruntime/reach.d.ts +6 -3
- package/dist/mdruntime/readiness.d.ts +52 -0
- package/dist/mdruntime/recovery.d.ts +24 -0
- package/dist/mdruntime/replica.d.ts +1 -1
- package/dist/mdruntime/room-draft.d.ts +13 -1
- package/dist/mdruntime/rows.d.ts +5 -13
- package/dist/mdruntime/save.d.ts +6 -2
- package/dist/mdruntime/search.d.ts +36 -6
- package/dist/mdruntime/seed.d.ts +15 -0
- package/dist/mdruntime/shared.d.ts +10 -0
- package/dist/mdruntime/status.d.ts +4 -0
- package/dist/mdruntime/store.d.ts +42 -11
- package/dist/mdruntime/turn.d.ts +6 -0
- package/dist/mdruntime/wire.d.ts +136 -32
- package/dist/test-host.d.ts +4 -1
- package/dist/test-host.js +27 -0
- package/docs/families.md +38 -1
- package/package.json +1 -1
package/dist/calls.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export interface HouseCalls {
|
|
2
2
|
readonly 'access.read': {
|
|
3
3
|
readonly room_ref: string;
|
|
4
|
+
readonly statistics?: boolean;
|
|
4
5
|
};
|
|
5
6
|
readonly 'conversation.answer': {
|
|
6
7
|
readonly answer: {
|
|
@@ -53,7 +54,7 @@ export interface HouseCalls {
|
|
|
53
54
|
readonly name: string;
|
|
54
55
|
readonly width?: number;
|
|
55
56
|
}[];
|
|
56
|
-
readonly operation_id
|
|
57
|
+
readonly operation_id: string;
|
|
57
58
|
readonly text?: string;
|
|
58
59
|
};
|
|
59
60
|
readonly 'conversation.setOption': {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { MdRuntimeClient } from './mdruntime/client.js';
|
|
1
|
+
import type { MdRuntimeClient, Open } from './mdruntime/client.js';
|
|
2
2
|
import type { HouseCalls } from './calls.js';
|
|
3
3
|
export type { HouseCalls } from './calls.js';
|
|
4
|
-
type Open<Value extends string> = Value | (string & {});
|
|
5
4
|
export type HouseCallInput<Name extends string> = Name extends keyof HouseCalls ? HouseCalls[Name] : unknown;
|
|
6
5
|
export interface HouseRuntime extends Omit<MdRuntimeClient, 'call'> {
|
|
7
6
|
call<Name extends Open<keyof HouseCalls>>(name: Name, input: HouseCallInput<Name>): ReturnType<MdRuntimeClient['call']>;
|
|
@@ -110,6 +109,20 @@ export interface HouseBrowserRefused extends Error {
|
|
|
110
109
|
readonly code: string;
|
|
111
110
|
readonly retryable: boolean;
|
|
112
111
|
}
|
|
112
|
+
export interface HouseTrialWithheld {
|
|
113
|
+
readonly code: Open<'house_trial_withheld'>;
|
|
114
|
+
readonly retryable: true;
|
|
115
|
+
}
|
|
116
|
+
export type HouseTask = unknown;
|
|
117
|
+
export type HouseActivation = Open<'committed' | 'abandoned'>;
|
|
118
|
+
export interface HouseCooperation {
|
|
119
|
+
checkpoint(): Promise<void> | void;
|
|
120
|
+
persist(): Promise<void> | void;
|
|
121
|
+
capture(): Promise<HouseTask> | HouseTask;
|
|
122
|
+
restore(task: HouseTask | null): Promise<void> | void;
|
|
123
|
+
ready(): Promise<boolean> | boolean;
|
|
124
|
+
settle(activation: HouseActivation): void;
|
|
125
|
+
}
|
|
113
126
|
export interface HouseBridge {
|
|
114
127
|
readonly runtime: Promise<HouseRuntime>;
|
|
115
128
|
address(): string | null;
|
|
@@ -130,6 +143,7 @@ export interface HouseBridge {
|
|
|
130
143
|
onStatus(listener: (status: HouseStatus) => void): () => void;
|
|
131
144
|
messages(listener: (message: HouseAppMessage) => void): () => void;
|
|
132
145
|
analyticsConsent(choice: HouseAnalyticsChoice): void;
|
|
146
|
+
cooperate(cooperation: HouseCooperation): () => void;
|
|
133
147
|
}
|
|
134
148
|
export interface HouseHeld {
|
|
135
149
|
readonly houseBridge: HouseBridge;
|
|
@@ -29,12 +29,24 @@ export type Shape = {
|
|
|
29
29
|
readonly schema: Readonly<Record<string, unknown>>;
|
|
30
30
|
readonly defs: Readonly<Record<string, unknown>>;
|
|
31
31
|
};
|
|
32
|
+
export type RuleValue = string | number | boolean | null;
|
|
33
|
+
export type Transition = {
|
|
34
|
+
readonly from: RuleValue;
|
|
35
|
+
readonly to: RuleValue;
|
|
36
|
+
readonly roles?: readonly string[];
|
|
37
|
+
};
|
|
38
|
+
export type FieldRules = {
|
|
39
|
+
readonly changeRoles?: readonly string[];
|
|
40
|
+
readonly initialRoles?: readonly string[];
|
|
41
|
+
readonly transitions?: readonly Transition[];
|
|
42
|
+
};
|
|
32
43
|
export type Definition = {
|
|
33
44
|
readonly name: string;
|
|
34
45
|
readonly memberDocument: boolean;
|
|
35
46
|
readonly frontmatter: ValueFacts;
|
|
36
47
|
readonly fields: Readonly<Record<string, ValueFacts>>;
|
|
37
48
|
readonly sections: Readonly<Record<string, SectionSpec>>;
|
|
49
|
+
readonly rules: Readonly<Record<string, FieldRules>>;
|
|
38
50
|
readonly shape: Shape;
|
|
39
51
|
};
|
|
40
52
|
export type Failure = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Definition } from './definition.js';
|
|
2
|
-
import type { ApplyResult, BodyResult, Change, Document, Link, LinkOccurrence, ParseResult } from './types.js';
|
|
2
|
+
import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, LinkOccurrence, ParseResult } from './types.js';
|
|
3
3
|
import { type YamlMap } from './yaml.js';
|
|
4
|
+
export declare function parseFrontmatter(content: string, file?: string): FrontmatterResult;
|
|
4
5
|
export declare function parse(content: string, file?: string): ParseResult;
|
|
5
6
|
export declare function relativize(document: Document, file: string, handle: string, definition?: Definition): ApplyResult;
|
|
6
7
|
export declare function relativizeBody(body: string, file: string, handle: string): BodyResult;
|
package/dist/mdmodel/index.d.ts
CHANGED
|
@@ -3,16 +3,16 @@ export type { Actor, Condition, ConditionScope, ConditionTest, ConditionValue, C
|
|
|
3
3
|
export { headingLines } from './blocks.js';
|
|
4
4
|
export type { HeadingLine } from './blocks.js';
|
|
5
5
|
export { divide } from './divide.js';
|
|
6
|
-
export { apply, bodyLinks, fieldStart, linkOccurrences, links, parse, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
|
|
6
|
+
export { apply, bodyLinks, fieldStart, linkOccurrences, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
|
|
7
7
|
export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
|
|
8
8
|
export { relative, retarget, target } from './paths.js';
|
|
9
9
|
export { MARKDOWN_SYNTAX_PROFILE } from './profile.js';
|
|
10
10
|
export { project } from './project.js';
|
|
11
11
|
export { references } from './references.js';
|
|
12
12
|
export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
|
|
13
|
-
export type { Definition, JsonType, PatternFacts, PointerFacts, SectionSpec, Shape, ValueFacts, } from './definition.js';
|
|
14
|
-
export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, Library, ModelVerification, Link, LinkOccurrence, ParseResult, Projection, ProjectionContext, Reference, Refusal, Span, Validation, ValidationContext, VerifiedModel, } from './types.js';
|
|
15
|
-
export { validate, verify } from './validate.js';
|
|
13
|
+
export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
|
|
14
|
+
export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, LinkOccurrence, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, Span, Validation, ValidationContext, VerifiedModel, } from './types.js';
|
|
15
|
+
export { checkDocument, resolves, sectionReferences, validate, verify } from './validate.js';
|
|
16
16
|
export { VERSION } from './version.js';
|
|
17
|
-
export { equalValue, frontmatterValue } from './yaml.js';
|
|
17
|
+
export { bodyAfterFrontmatter, equalValue, frontmatterValue } from './yaml.js';
|
|
18
18
|
export type { FrontmatterValue } from './yaml.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Definition } from './definition.js';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function references(document:
|
|
2
|
+
import type { Frontmatter, Reference } from './types.js';
|
|
3
|
+
export declare function references(document: Pick<Frontmatter, 'fields'>, definition: Definition): readonly Reference[];
|
package/dist/mdmodel/types.d.ts
CHANGED
|
@@ -28,10 +28,12 @@ export type Extent = {
|
|
|
28
28
|
export type Span = Extent & {
|
|
29
29
|
readonly text: string;
|
|
30
30
|
};
|
|
31
|
-
export type
|
|
31
|
+
export type Frontmatter = {
|
|
32
32
|
readonly content: string;
|
|
33
33
|
readonly type: string | undefined;
|
|
34
34
|
readonly fields: Readonly<Record<string, unknown>>;
|
|
35
|
+
};
|
|
36
|
+
export type Document = Frontmatter & {
|
|
35
37
|
readonly preamble: string;
|
|
36
38
|
readonly sections: Readonly<Record<string, string>>;
|
|
37
39
|
};
|
|
@@ -41,6 +43,18 @@ export type Refusal = {
|
|
|
41
43
|
readonly location?: string;
|
|
42
44
|
readonly referrers?: readonly string[];
|
|
43
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
|
+
};
|
|
44
58
|
export type Validation = {
|
|
45
59
|
readonly verdict: 'accept';
|
|
46
60
|
} | ({
|
|
@@ -60,6 +74,13 @@ export type Division = {
|
|
|
60
74
|
readonly ok: false;
|
|
61
75
|
readonly refusal: Refusal;
|
|
62
76
|
};
|
|
77
|
+
export type FrontmatterResult = {
|
|
78
|
+
readonly ok: true;
|
|
79
|
+
readonly frontmatter: Frontmatter;
|
|
80
|
+
} | {
|
|
81
|
+
readonly ok: false;
|
|
82
|
+
readonly refusal: Refusal;
|
|
83
|
+
};
|
|
63
84
|
export type ParseResult = {
|
|
64
85
|
readonly ok: true;
|
|
65
86
|
readonly document: Document;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
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;
|
|
2
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[];
|
|
3
7
|
export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
|
|
@@ -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;
|
|
@@ -238,17 +238,15 @@ export type ContractUnavailable = ProviderRefusal & {
|
|
|
238
238
|
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
239
239
|
export type PageToken = string;
|
|
240
240
|
export type ChangeAuthor = {
|
|
241
|
-
kind: 'user'
|
|
241
|
+
kind: Open<'user' | 'site'>;
|
|
242
242
|
id: string;
|
|
243
243
|
name: string;
|
|
244
|
-
}
|
|
245
|
-
|
|
244
|
+
};
|
|
245
|
+
export type Member = {
|
|
246
|
+
kind: Open<'user'>;
|
|
246
247
|
id: string;
|
|
247
248
|
name: string;
|
|
248
249
|
};
|
|
249
|
-
export type Member = Extract<ChangeAuthor, {
|
|
250
|
-
kind: 'user';
|
|
251
|
-
}>;
|
|
252
250
|
export type HeadChange = {
|
|
253
251
|
author: ChangeAuthor | null;
|
|
254
252
|
time: string;
|
|
@@ -259,10 +257,15 @@ export type BinaryFile = {
|
|
|
259
257
|
mediaType: string;
|
|
260
258
|
sha256: string;
|
|
261
259
|
};
|
|
260
|
+
export type HeldContent = {
|
|
261
|
+
documents: Readonly<Record<string, string>>;
|
|
262
|
+
revisions: Readonly<Record<string, string>>;
|
|
263
|
+
};
|
|
262
264
|
export type BootstrapRequest = {
|
|
263
265
|
locator: string;
|
|
264
266
|
selection: string;
|
|
265
267
|
pageToken?: PageToken;
|
|
268
|
+
held?: HeldContent;
|
|
266
269
|
};
|
|
267
270
|
export type RoomModels = {
|
|
268
271
|
collection?: ModelResult;
|
|
@@ -274,11 +277,14 @@ export type BootstrapPage = {
|
|
|
274
277
|
models?: RoomModels;
|
|
275
278
|
documents: Readonly<Record<string, string>>;
|
|
276
279
|
revisions: Readonly<Record<string, string>>;
|
|
280
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
277
281
|
changes: Readonly<Record<string, HeadChange>>;
|
|
278
282
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
279
283
|
pageToken?: PageToken;
|
|
280
284
|
};
|
|
281
|
-
export type BootstrapResult = BootstrapPage |
|
|
285
|
+
export type BootstrapResult = BootstrapPage | {
|
|
286
|
+
kind: 'beyond-horizon';
|
|
287
|
+
} | AdapterFailure;
|
|
282
288
|
export type RefreshRequest = {
|
|
283
289
|
locator: string;
|
|
284
290
|
selection: string;
|
|
@@ -291,6 +297,7 @@ export type RefreshPage = {
|
|
|
291
297
|
models?: RoomModels;
|
|
292
298
|
documents: Readonly<Record<string, string>>;
|
|
293
299
|
revisions: Readonly<Record<string, string>>;
|
|
300
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
294
301
|
changes: Readonly<Record<string, HeadChange>>;
|
|
295
302
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
296
303
|
removals: readonly string[];
|
|
@@ -319,6 +326,7 @@ export type MutationResult = {
|
|
|
319
326
|
roomVersion: string;
|
|
320
327
|
documents: Readonly<Record<string, string>>;
|
|
321
328
|
revisions: Readonly<Record<string, string>>;
|
|
329
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
322
330
|
changes: Readonly<Record<string, HeadChange>>;
|
|
323
331
|
removals: readonly string[];
|
|
324
332
|
binaryFiles?: Readonly<Record<string, BinaryFile>>;
|
|
@@ -335,6 +343,7 @@ export type MutationResult = {
|
|
|
335
343
|
kind: 'write-halted';
|
|
336
344
|
} | {
|
|
337
345
|
kind: 'expired';
|
|
346
|
+
restored?: true;
|
|
338
347
|
} | AdapterFailure;
|
|
339
348
|
export type HistoryAuthor = {
|
|
340
349
|
kind: 'user';
|
|
@@ -417,6 +426,7 @@ export type RoomStreamEvent = {
|
|
|
417
426
|
} | {
|
|
418
427
|
kind: 'closed';
|
|
419
428
|
revoked: boolean;
|
|
429
|
+
lost: boolean;
|
|
420
430
|
} | {
|
|
421
431
|
kind: 'opening';
|
|
422
432
|
expired: readonly string[];
|
|
@@ -425,13 +435,32 @@ export type RoomStreamEvent = {
|
|
|
425
435
|
locator: string;
|
|
426
436
|
roomVersion: string;
|
|
427
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
|
+
};
|
|
428
455
|
export type RoomStream = {
|
|
429
|
-
hold(rooms: readonly HeldRoom[]): void;
|
|
456
|
+
hold(rooms: readonly HeldRoom[], demand: AcquiredDemand | null): void;
|
|
430
457
|
reopen(): void;
|
|
431
|
-
|
|
458
|
+
published(locator: string, roomVersion: string): void;
|
|
459
|
+
observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts): () => void;
|
|
432
460
|
};
|
|
433
461
|
export type Adapter = {
|
|
434
462
|
readonly localSaves?: true;
|
|
463
|
+
readonly exhaustiveDiscovery?: true;
|
|
435
464
|
authorize(): Promise<Authorization>;
|
|
436
465
|
discover(authorization: Authorization): Promise<DiscoverResult>;
|
|
437
466
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
@@ -9,6 +9,7 @@ export type DocumentChange = {
|
|
|
9
9
|
export type MessageChange = {
|
|
10
10
|
conversation: string;
|
|
11
11
|
identity: string;
|
|
12
|
+
text: string | null;
|
|
12
13
|
};
|
|
13
14
|
export type ChangeSet = {
|
|
14
15
|
documents: readonly DocumentChange[];
|
|
@@ -28,5 +29,6 @@ export declare function changeSet(locator: string, before: Replica | null, after
|
|
|
28
29
|
queue?: boolean;
|
|
29
30
|
presentation?: string;
|
|
30
31
|
}): ChangeSet;
|
|
32
|
+
export declare function entering(locator: string, replica: Replica, paths: readonly string[]): ChangeSet;
|
|
31
33
|
export declare function conversationChangeSet(messages: readonly MessageChange[], conversations: readonly string[]): ChangeSet;
|
|
32
34
|
export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
|
|
@@ -3,17 +3,18 @@ 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 { BinaryAnswer, CallResult, HistoryAnswer, QueueEntry } from './outcome.js';
|
|
7
|
-
import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult } from './query.js';
|
|
6
|
+
import type { BinaryAnswer, CallResult, HistoryAnswer, Offline, QueueEntry } from './outcome.js';
|
|
7
|
+
import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
|
|
8
8
|
import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
|
|
9
9
|
import type { SearchRequest, SearchResult } from './search.js';
|
|
10
|
+
import type { Readiness } from './readiness.js';
|
|
10
11
|
import type { SyncStatus } from './status.js';
|
|
11
12
|
import { type RuntimePort } from './wire.js';
|
|
12
13
|
export type MdRuntimeClient = {
|
|
13
14
|
rooms(): Promise<readonly AppRoom[]>;
|
|
14
15
|
query: {
|
|
15
|
-
(query: DocumentQuery): Promise<DocumentResult>;
|
|
16
|
-
(query: GroupQuery): Promise<GroupResult>;
|
|
16
|
+
(query: DocumentQuery): Promise<DocumentResult | PendingResult>;
|
|
17
|
+
(query: GroupQuery): Promise<GroupResult | PendingResult>;
|
|
17
18
|
};
|
|
18
19
|
search(request: SearchRequest): Promise<SearchResult>;
|
|
19
20
|
types(locator: string): Promise<RoomSchemas>;
|
|
@@ -32,7 +33,7 @@ export type MdRuntimeClient = {
|
|
|
32
33
|
list(): Promise<readonly ConversationEntry[]>;
|
|
33
34
|
read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
|
|
34
35
|
create(input: unknown): Promise<CallResult>;
|
|
35
|
-
send(conversation: string): Promise<CallResult>;
|
|
36
|
+
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
36
37
|
answer(conversation: string, answer: unknown): Promise<CallResult>;
|
|
37
38
|
interrupt(conversation: string): Promise<CallResult>;
|
|
38
39
|
kill(conversation: string): Promise<CallResult>;
|
|
@@ -52,16 +53,18 @@ export type MdRuntimeClient = {
|
|
|
52
53
|
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
53
54
|
log(): Promise<string>;
|
|
54
55
|
persistence(): Promise<boolean>;
|
|
56
|
+
retry(): Promise<void>;
|
|
55
57
|
observe: {
|
|
56
58
|
(topic: 'deployment-facts'): Promise<Observation<unknown>>;
|
|
57
59
|
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
60
|
+
(topic: 'readiness'): Promise<Observation<Readiness>>;
|
|
58
61
|
(topic: 'connection-refusal'): Promise<Observation<ConnectionRefusal | null>>;
|
|
59
62
|
(topic: 'storage-loss'): Promise<Observation<string | null>>;
|
|
60
63
|
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
61
64
|
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
62
65
|
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
63
|
-
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult>>;
|
|
64
|
-
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult>>;
|
|
66
|
+
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
|
|
67
|
+
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
|
|
65
68
|
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
|
66
69
|
(topic: 'room-drafts'): Promise<Observation<readonly RoomDraft[]>>;
|
|
67
70
|
(topic: 'presentation'): Promise<Observation<unknown>>;
|
|
@@ -75,4 +78,5 @@ export type MdRuntimeClient = {
|
|
|
75
78
|
export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
|
|
76
79
|
export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
|
|
77
80
|
export type { Observation } from './observation.js';
|
|
78
|
-
export type {
|
|
81
|
+
export type { Open } from './open.js';
|
|
82
|
+
export { unanswered, type RuntimePort, type WireMember } from './wire.js';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { type Document, type Validation } from '../mdmodel/index.js';
|
|
2
|
-
import type
|
|
1
|
+
import { type Document, type Frontmatter, type Validation } from '../mdmodel/index.js';
|
|
2
|
+
import { type ModelState } from './model.js';
|
|
3
3
|
import type { MdModelIdentity } from './adapter.js';
|
|
4
|
+
import { type Paths } from './shared.js';
|
|
4
5
|
import type { Refused } from './transfer.js';
|
|
6
|
+
import { type Later } from './turn.js';
|
|
5
7
|
export declare const MD_MODEL: MdModelIdentity;
|
|
6
8
|
export type Collection = {
|
|
7
9
|
text: Readonly<Record<string, string>>;
|
|
@@ -17,8 +19,20 @@ export type Composition = {
|
|
|
17
19
|
};
|
|
18
20
|
export declare function governing(composition: Composition, path: string): ModelState;
|
|
19
21
|
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition, previous?: Collection): Collection;
|
|
20
|
-
export declare function
|
|
22
|
+
export declare function passingFrontmatter(collection: Collection, path: string): Frontmatter | undefined;
|
|
21
23
|
export declare function documentsOf(collection: Collection): Generator<readonly [string, Document]>;
|
|
22
24
|
export declare function unreadable(text: Readonly<Record<string, string>>, previous?: Readonly<Record<string, string>>): Refused | null;
|
|
23
25
|
export declare function validRoot(root: unknown): root is string;
|
|
24
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
|
+
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 {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type TypesResult } from './model.js';
|
|
2
2
|
import { type Observation } from './observation.js';
|
|
3
|
-
import { type DocumentQuery, type DocumentResult, type GroupQuery, type GroupResult } from './query.js';
|
|
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';
|
|
@@ -8,10 +9,13 @@ import { type WrittenBy } from './change.js';
|
|
|
8
9
|
import type { Open } from './open.js';
|
|
9
10
|
import { type BinaryReference } from './binary.js';
|
|
10
11
|
import { type BinaryAnswer, type CallResult, type HistoryAnswer, type QueueEntry } from './outcome.js';
|
|
12
|
+
import { type Recovery } from './recovery.js';
|
|
11
13
|
import { type SaveRefusal } from './save.js';
|
|
12
14
|
import { type RoomDraft, type RoomDraftWrite } from './room-draft.js';
|
|
13
15
|
import { type SyncStatus } from './status.js';
|
|
14
16
|
import { type RuntimeShell } from './durability.js';
|
|
17
|
+
import { type RuntimeDemand } from './acquisition.js';
|
|
18
|
+
import { type CapacityCause, type CodeAvailability, type Persistence, type Readiness, type SearchObligation } from './readiness.js';
|
|
15
19
|
import { type NarrowedView, type PortReach, type RuntimeView } from './reach.js';
|
|
16
20
|
export type AppTypedSelection = {
|
|
17
21
|
roots: readonly string[];
|
|
@@ -48,6 +52,7 @@ export type MdRuntimeOptions = {
|
|
|
48
52
|
shell: RuntimeShell;
|
|
49
53
|
authorization?: Authorization;
|
|
50
54
|
signal?: AbortSignal;
|
|
55
|
+
recovery?: Recovery;
|
|
51
56
|
};
|
|
52
57
|
export type SaveResult = {
|
|
53
58
|
outcome: 'saved';
|
|
@@ -81,8 +86,8 @@ export type MdRuntime = {
|
|
|
81
86
|
loaded(): Promise<void>;
|
|
82
87
|
rooms(): readonly AppRoom[];
|
|
83
88
|
query: {
|
|
84
|
-
(query: DocumentQuery): Promise<DocumentResult>;
|
|
85
|
-
(query: GroupQuery): Promise<GroupResult>;
|
|
89
|
+
(query: DocumentQuery): Promise<DocumentResult | PendingResult>;
|
|
90
|
+
(query: GroupQuery): Promise<GroupResult | PendingResult>;
|
|
86
91
|
};
|
|
87
92
|
search(request: SearchRequest): Promise<SearchResult>;
|
|
88
93
|
types(locator: string): RoomSchemas;
|
|
@@ -97,15 +102,17 @@ export type MdRuntime = {
|
|
|
97
102
|
reached(locator: string, roomVersion: string, path?: string): boolean;
|
|
98
103
|
log(): string;
|
|
99
104
|
persistence(): boolean;
|
|
105
|
+
retry(): Promise<void>;
|
|
100
106
|
observe: {
|
|
101
107
|
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
108
|
+
(topic: 'readiness'): Promise<Observation<Readiness>>;
|
|
102
109
|
(topic: 'connection-refusal'): Promise<Observation<ConnectionRefusal | null>>;
|
|
103
110
|
(topic: 'storage-loss'): Promise<Observation<string | null>>;
|
|
104
111
|
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
105
112
|
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
106
113
|
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
107
|
-
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult>>;
|
|
108
|
-
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult>>;
|
|
114
|
+
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
|
|
115
|
+
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
|
|
109
116
|
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
|
110
117
|
(topic: 'room-drafts'): Promise<Observation<readonly RoomDraft[]>>;
|
|
111
118
|
(topic: 'presentation', app: string): Promise<Observation<unknown>>;
|
|
@@ -115,10 +122,20 @@ export type MdRuntime = {
|
|
|
115
122
|
};
|
|
116
123
|
reauthorize(): Promise<void>;
|
|
117
124
|
};
|
|
118
|
-
export type RuntimeTopic = 'rooms' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents';
|
|
125
|
+
export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents';
|
|
126
|
+
export type ReadinessPort = {
|
|
127
|
+
readonly target: string;
|
|
128
|
+
readonly code: CodeAvailability;
|
|
129
|
+
readonly capacity: CapacityCause | null;
|
|
130
|
+
readonly search: SearchObligation;
|
|
131
|
+
};
|
|
119
132
|
export type ComposedRuntime = RuntimeView & {
|
|
133
|
+
seed(entry: EntrySeed): void;
|
|
120
134
|
stop(): Promise<void>;
|
|
121
|
-
|
|
135
|
+
lose(locators: readonly string[]): Promise<void>;
|
|
136
|
+
acquire(demand: RuntimeDemand): void;
|
|
137
|
+
persisted(answer: Persistence): void;
|
|
138
|
+
within(reach: PortReach | null, port: ReadinessPort): NarrowedView;
|
|
122
139
|
};
|
|
123
140
|
export declare function composeRuntime(options: MdRuntimeOptions): ComposedRuntime;
|
|
124
141
|
export {};
|
|
@@ -2,9 +2,8 @@ import type { ConversationAction, ConversationAgents, ConversationEvent, Convers
|
|
|
2
2
|
import { type ChangeSet } from './change-set.js';
|
|
3
3
|
import { type ChatDraftFile } from './file.js';
|
|
4
4
|
import type { Open } from './open.js';
|
|
5
|
-
import type
|
|
6
|
-
import type { DocumentResult } from './query.js';
|
|
7
|
-
import type { SearchedMessage } from './search.js';
|
|
5
|
+
import { type CallResult, type Offline } from './outcome.js';
|
|
6
|
+
import type { DocumentResult, PendingResult } from './query.js';
|
|
8
7
|
import type { CycleProgress } from './status.js';
|
|
9
8
|
import type { ChatDraftRecord, HeldConversation, RuntimeStore } from './store.js';
|
|
10
9
|
export type ConversationState = Open<'working' | 'asking' | 'idle'>;
|
|
@@ -56,7 +55,7 @@ export type ConversationSurface = {
|
|
|
56
55
|
list(): Promise<readonly ConversationEntry[]>;
|
|
57
56
|
read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
|
|
58
57
|
create(input: unknown): Promise<CallResult>;
|
|
59
|
-
send(conversation: string): Promise<CallResult>;
|
|
58
|
+
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
60
59
|
answer(conversation: string, answer: unknown): Promise<CallResult>;
|
|
61
60
|
interrupt(conversation: string): Promise<CallResult>;
|
|
62
61
|
kill(conversation: string): Promise<CallResult>;
|
|
@@ -69,12 +68,15 @@ export type ChatDraftSurface = {
|
|
|
69
68
|
};
|
|
70
69
|
export type ConversationDependencies = {
|
|
71
70
|
agents(): ConversationAgents | undefined;
|
|
72
|
-
documents(
|
|
71
|
+
documents(agents: ConversationAgents): Promise<DocumentResult | PendingResult>;
|
|
73
72
|
call(name: ConversationAction, input: unknown): Promise<CallResult>;
|
|
74
73
|
durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
|
|
75
74
|
stream(): ConversationStream | undefined;
|
|
76
75
|
publish(set: ChangeSet): void;
|
|
76
|
+
online(): boolean;
|
|
77
77
|
closed(): boolean;
|
|
78
|
+
unanswered(): void;
|
|
79
|
+
expired(operation: string): boolean;
|
|
78
80
|
};
|
|
79
81
|
export type ConversationStore = {
|
|
80
82
|
surface: ConversationSurface;
|
|
@@ -82,16 +84,22 @@ export type ConversationStore = {
|
|
|
82
84
|
hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[]): void;
|
|
83
85
|
reconcile(): Promise<void>;
|
|
84
86
|
catchUp(progress: CycleProgress): Promise<void>;
|
|
87
|
+
resend(progress: CycleProgress): Promise<void>;
|
|
85
88
|
current(): boolean;
|
|
89
|
+
known(): boolean;
|
|
86
90
|
reconnected(): void;
|
|
91
|
+
reopened(): void;
|
|
92
|
+
lost(): void;
|
|
87
93
|
watch(conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
|
|
88
94
|
watchList(deliver: (entries: readonly ConversationEntry[]) => void): () => void;
|
|
89
95
|
watchAgents(deliver: (agents: readonly ConversationAgent[]) => void): () => void;
|
|
90
96
|
changed(set: ChangeSet): void;
|
|
91
97
|
receive(event: ConversationEvent): boolean;
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
searchable(): readonly string[];
|
|
99
|
+
acquired(conversation: string): boolean;
|
|
94
100
|
close(): void;
|
|
95
101
|
};
|
|
96
102
|
export declare function unheldView(conversation: string): ConversationView;
|
|
103
|
+
export declare const SESSION_STARTED = "Session started";
|
|
104
|
+
export declare function newChat(agent: string): string;
|
|
97
105
|
export declare function createConversationStore(deps: ConversationDependencies): ConversationStore;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import type { Persistence } from './readiness.js';
|
|
2
|
+
export type StorageEstimate = {
|
|
3
|
+
readonly usage: number;
|
|
4
|
+
readonly quota: number;
|
|
5
|
+
};
|
|
1
6
|
export type RuntimeShell = {
|
|
2
|
-
|
|
7
|
+
persistence: Persistence;
|
|
3
8
|
generation: string | null;
|
|
4
9
|
keepGeneration(value: string): void | Promise<void>;
|
|
5
10
|
dropGeneration(): void | Promise<void>;
|
|
11
|
+
estimate?(): Promise<StorageEstimate | null>;
|
|
6
12
|
};
|
|
7
13
|
export declare function detectStorageLoss(stored: string | null, reported: string | null): string | null;
|
|
8
14
|
export declare function nextGeneration(stored: string | null, reported: string | null): string;
|
|
@@ -29,12 +29,13 @@ export type ModelState = {
|
|
|
29
29
|
types: VerifiedModel['types'];
|
|
30
30
|
};
|
|
31
31
|
export type TypesResult = {
|
|
32
|
-
status: 'unavailable'
|
|
32
|
+
status: Open<'unavailable'>;
|
|
33
33
|
reason: ModelUnavailableReason;
|
|
34
|
+
types: null;
|
|
34
35
|
schema?: string | null;
|
|
35
36
|
revision?: string | null;
|
|
36
37
|
} | {
|
|
37
|
-
status: 'current' | 'cached'
|
|
38
|
+
status: Open<'current' | 'cached'>;
|
|
38
39
|
identity: string;
|
|
39
40
|
version: string;
|
|
40
41
|
verifiedWith: ModelIdentity;
|
|
@@ -52,4 +53,5 @@ export declare function definitionOf(state: ModelState, type: string | undefined
|
|
|
52
53
|
export declare function modelTypes(state: ModelState): TypesResult;
|
|
53
54
|
export declare function cached(state: ModelState): ModelState;
|
|
54
55
|
export declare function sameModel(left: ModelIdentity, right: ModelIdentity): boolean;
|
|
56
|
+
export declare function sameTyping(left: ModelState, right: ModelState): boolean;
|
|
55
57
|
export declare function referenceField(facts: ValueFacts | undefined): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { QueryDocument, QueryGroup, QueryResult } from './query.js';
|
|
1
|
+
import type { QueryCoverage, QueryDocument, QueryGroup, QueryResult } from './query.js';
|
|
2
2
|
export type Observation<T> = {
|
|
3
3
|
current(): T;
|
|
4
4
|
subscribe(listener: (value: T) => void): () => void;
|
|
@@ -13,14 +13,17 @@ export type QueryChange = {
|
|
|
13
13
|
changed: readonly (readonly [RowKey, QueryDocument | QueryGroup])[];
|
|
14
14
|
removed: readonly RowKey[];
|
|
15
15
|
order: readonly RowKey[] | null;
|
|
16
|
+
coverage?: QueryCoverage;
|
|
16
17
|
};
|
|
18
|
+
export type QueryMessage = KeyedResult | QueryChange;
|
|
17
19
|
export type Observed = {
|
|
18
20
|
observation: Observation<unknown>;
|
|
19
21
|
receive(message: unknown): void;
|
|
20
22
|
end(): void;
|
|
21
23
|
};
|
|
22
24
|
export declare function rowsOf(result: QueryResult): readonly (QueryDocument | QueryGroup)[];
|
|
23
|
-
export declare function
|
|
25
|
+
export declare function whole(message: QueryMessage): message is KeyedResult;
|
|
26
|
+
export declare function applied(keyed: KeyedResult, message: QueryMessage): KeyedResult;
|
|
24
27
|
export declare function observed(first: unknown, stop: () => void, keyed: boolean): Observed;
|
|
25
28
|
export declare function opened(watch: (deliver: (message: unknown) => void) => () => void, keyed: boolean): Promise<Observation<unknown>>;
|
|
26
29
|
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>>;
|
|
@@ -20,6 +20,10 @@ export type BinaryAnswer = {
|
|
|
20
20
|
} | Refused<'rejected'> | Refused<'absent'> | Failure;
|
|
21
21
|
export declare function absentBinary(path: string): BinaryAnswer;
|
|
22
22
|
export declare function binaryAnswer(result: BinaryResult): BinaryAnswer;
|
|
23
|
+
export type Offline = {
|
|
24
|
+
readonly kind: 'offline';
|
|
25
|
+
};
|
|
26
|
+
export declare const OFFLINE: Offline;
|
|
23
27
|
export declare const UNCERTAIN: Failure;
|
|
24
28
|
export declare function undeclared(name: string): CallResult;
|
|
25
29
|
export declare function failure(result: AdapterFailure): Failure;
|