@agentshouse/app-bridge 0.1.0-ce602e5dccd9f → 0.1.0-ce61879ee484f
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 +2 -2
- package/dist/index.d.ts +47 -504
- package/dist/mdmodel/body.d.ts +84 -0
- package/dist/mdmodel/built-in.d.ts +3 -0
- package/dist/mdmodel/crockford.d.ts +3 -0
- package/dist/mdmodel/definition.d.ts +18 -9
- package/dist/mdmodel/document.d.ts +7 -4
- package/dist/mdmodel/event.d.ts +1 -2
- package/dist/mdmodel/fields.d.ts +1 -1
- package/dist/mdmodel/house-model.d.ts +826 -0
- package/dist/mdmodel/house-references.d.ts +3 -0
- package/dist/mdmodel/index.d.ts +15 -6
- package/dist/mdmodel/markdown.d.ts +28 -4
- package/dist/mdmodel/paths.d.ts +10 -1
- package/dist/mdmodel/room-types.d.ts +6 -0
- package/dist/mdmodel/types.d.ts +3 -6
- package/dist/mdmodel/validate.d.ts +2 -1
- package/dist/mdruntime/actions.d.ts +8 -2
- package/dist/mdruntime/adapter.d.ts +13 -7
- package/dist/mdruntime/attached-model.d.ts +0 -1
- package/dist/mdruntime/change-set.d.ts +4 -0
- package/dist/mdruntime/client.d.ts +6 -17
- package/dist/mdruntime/compile.d.ts +2 -0
- package/dist/mdruntime/conversation-live.d.ts +10 -2
- package/dist/mdruntime/conversation.d.ts +26 -5
- package/dist/mdruntime/durability.d.ts +4 -0
- package/dist/mdruntime/failure.d.ts +2 -0
- package/dist/mdruntime/listing.d.ts +5 -9
- package/dist/mdruntime/messages.d.ts +9 -2
- package/dist/mdruntime/observation.d.ts +3 -2
- package/dist/mdruntime/opened.d.ts +1 -1
- package/dist/mdruntime/outcome.d.ts +3 -0
- package/dist/mdruntime/overlay.d.ts +3 -0
- package/dist/mdruntime/presence.d.ts +51 -0
- package/dist/mdruntime/readiness.d.ts +1 -1
- package/dist/mdruntime/reads.d.ts +3 -1
- package/dist/mdruntime/recovery.d.ts +3 -1
- package/dist/mdruntime/retried.d.ts +29 -0
- package/dist/mdruntime/room-draft.d.ts +2 -3
- package/dist/mdruntime/runtime.d.ts +6 -16
- package/dist/mdruntime/save.d.ts +40 -83
- package/dist/mdruntime/saves.d.ts +2 -40
- package/dist/mdruntime/socket/lanes.d.ts +12 -4
- package/dist/mdruntime/socket.d.ts +3 -5
- package/dist/mdruntime/source.d.ts +0 -7
- package/dist/mdruntime/store/records.d.ts +7 -3
- package/dist/mdruntime/store.d.ts +10 -5
- package/dist/mdruntime/stored.d.ts +1 -0
- package/dist/mdruntime/surface.d.ts +1 -1
- package/dist/mdruntime/tables.d.ts +6 -3
- package/dist/mdruntime/wire.d.ts +47 -3
- package/dist/session-content/index.d.ts +1 -1
- package/dist/session-content/parts.d.ts +4 -3
- package/dist/session-content/turn.d.ts +3 -3
- package/docs/families.md +4 -9
- package/package.json +2 -2
- package/dist/mdruntime/install.d.ts +0 -55
- package/dist/mdruntime/log.d.ts +0 -5
- package/dist/mdruntime/socket/rooms.d.ts +0 -40
- package/dist/mdruntime/store/fences.d.ts +0 -15
- package/dist/mdruntime/turn.d.ts +0 -8
package/dist/mdmodel/index.d.ts
CHANGED
|
@@ -11,21 +11,30 @@ export type { HeldKind, HeldLink, HeldValue, Indexed, Reach } from './query/rows
|
|
|
11
11
|
export * as sql from './query/sql.js';
|
|
12
12
|
export { headingLines } from './markdown.js';
|
|
13
13
|
export type { HeadingLine } from './markdown.js';
|
|
14
|
+
export { labelAt, NAME_FIELD } from './body.js';
|
|
15
|
+
export type { Naming } from './body.js';
|
|
14
16
|
export { divide } from './divide.js';
|
|
15
|
-
export { apply, bodyLinks, create, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, textSpans, unlinkBody, } from './document.js';
|
|
17
|
+
export { apply, bodyLinks, create, links, parse, parseFrontmatter, relabel, relabels, relativize, relativizeBody, relinkBody, serialize, textSpans, unlinkBody, } from './document.js';
|
|
16
18
|
export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
|
|
17
19
|
export type { ReferenceTarget, SavedFacts } from './facts.js';
|
|
20
|
+
export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './crockford.js';
|
|
18
21
|
export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
|
|
19
|
-
export {
|
|
22
|
+
export { HOUSE_MODEL, HOUSE_ROOM_TYPES } from './built-in.js';
|
|
23
|
+
export { APP_PREFERENCES_HOME, HOUSE_MODEL_DECLARATION, HOUSE_TYPED_PATHS } from './house-model.js';
|
|
24
|
+
export { APP_REFERENCE_PATTERN, ROOM_REFERENCE_PATTERN, SPACE_REFERENCE_PATTERN, } from './house-references.js';
|
|
25
|
+
export type { HouseDocumentFields, HouseModelType } from './house-model.js';
|
|
26
|
+
export { CHAT_MESSAGE_TYPE, CHAT_TYPE, INBOX_CHANNEL_KINDS, INBOX_TYPES } from './room-types.js';
|
|
27
|
+
export type { InboxChannelKind } from './room-types.js';
|
|
28
|
+
export { linkedPath, relative, retarget, roomPath, roomTarget, target } from './paths.js';
|
|
20
29
|
export { openPatternBudget } from './pattern.js';
|
|
21
|
-
export type { RoomTarget } from './paths.js';
|
|
30
|
+
export type { LinkedPath, RoomTarget } from './paths.js';
|
|
22
31
|
export { project } from './project.js';
|
|
23
32
|
export { references } from './references.js';
|
|
24
33
|
export { CAPTURE_HOME, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION, } from './reserved.js';
|
|
25
34
|
export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, untitled, } from './definition.js';
|
|
26
|
-
export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue,
|
|
27
|
-
export type { ApplyResult, BodyResult, Change, DefinitionOf, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
|
|
28
|
-
export { assess, assessReferences, bodyRoomLinks, checkDocument, definitionAt, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
|
|
35
|
+
export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, Shape, Transition, ValueFacts, } from './definition.js';
|
|
36
|
+
export type { ApplyResult, BodyResult, Change, DefinitionOf, Division, DivisionContext, Document, DocumentCheck, Extent, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
|
|
37
|
+
export { assess, assessReferences, bodyRoomLinks, checkDocument, definitionAt, readTypes, resolves, roomReferences, validate, validateParsed, validating, verdicts, verify, } from './validate.js';
|
|
29
38
|
export type { Assessment, Verdicts } from './validate.js';
|
|
30
39
|
export { VERSION } from './version.js';
|
|
31
40
|
export { bodyAfterFrontmatter, equalValue, frontmatterValue, plain } from './yaml.js';
|
|
@@ -24,17 +24,42 @@ export type DefinitionBlock = {
|
|
|
24
24
|
readonly end: number;
|
|
25
25
|
readonly destination: HrefOccurrence;
|
|
26
26
|
};
|
|
27
|
-
export type
|
|
28
|
-
readonly
|
|
27
|
+
export type Node = {
|
|
28
|
+
readonly type: string;
|
|
29
|
+
readonly position?: {
|
|
30
|
+
readonly start: {
|
|
31
|
+
readonly offset?: number;
|
|
32
|
+
};
|
|
33
|
+
readonly end: {
|
|
34
|
+
readonly offset?: number;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
readonly children?: readonly Node[];
|
|
38
|
+
readonly depth?: number;
|
|
39
|
+
readonly identifier?: string;
|
|
40
|
+
readonly checked?: boolean | null;
|
|
41
|
+
readonly ordered?: boolean | null;
|
|
42
|
+
readonly lang?: string | null;
|
|
43
|
+
readonly value?: string;
|
|
29
44
|
};
|
|
30
45
|
export type Reading = {
|
|
31
46
|
readonly headings: readonly HeadingLine[];
|
|
32
|
-
readonly blocks: readonly
|
|
47
|
+
readonly blocks: readonly Extent[];
|
|
33
48
|
readonly uses: readonly LinkUse[];
|
|
34
49
|
readonly definitions: readonly DefinitionBlock[];
|
|
50
|
+
readonly tree: readonly Node[];
|
|
51
|
+
readonly base: number;
|
|
52
|
+
};
|
|
53
|
+
export declare function lineBreaks(text: string): readonly number[];
|
|
54
|
+
export declare function lineNumber(breaks: readonly number[], offset: number): number;
|
|
55
|
+
export declare function lineStart(text: string, index: number): number;
|
|
56
|
+
export declare function lineEnd(text: string, index: number): {
|
|
57
|
+
readonly end: number;
|
|
58
|
+
readonly next: number;
|
|
35
59
|
};
|
|
36
60
|
export declare function read(text: string, at?: number): Reading;
|
|
37
61
|
export declare function destinations(reading: Reading): readonly HrefOccurrence[];
|
|
62
|
+
export declare function linkable(text: string, from?: number): boolean;
|
|
38
63
|
export declare function hrefOccurrences(body: string): readonly HrefOccurrence[];
|
|
39
64
|
export declare function headingLines(content: string, from: number, to: number): HeadingLine[];
|
|
40
65
|
export type SectionSpan = {
|
|
@@ -46,5 +71,4 @@ export type SectionSpan = {
|
|
|
46
71
|
export declare function sectionSpans(reading: Reading, end: number): SectionSpan[];
|
|
47
72
|
export declare function sectionsRecord(spans: readonly SectionSpan[], content: string): Record<string, string>;
|
|
48
73
|
export declare function headingsIn(reading: Reading, from: number, to: number): readonly HeadingLine[];
|
|
49
|
-
export declare function listItems(reading: Reading, from: number, to: number): Extent[] | null;
|
|
50
74
|
export declare function blockRanges(reading: Reading, from: number, to: number): Extent[];
|
package/dist/mdmodel/paths.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type RoomTarget = {
|
|
|
6
6
|
readonly handle: string;
|
|
7
7
|
readonly path: string;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type Classified = {
|
|
10
10
|
kind: 'skip';
|
|
11
11
|
} | {
|
|
12
12
|
kind: 'path';
|
|
@@ -16,10 +16,19 @@ export declare function classifyHref(from: string, href: string): {
|
|
|
16
16
|
} & RoomTarget) | {
|
|
17
17
|
kind: 'invalid';
|
|
18
18
|
};
|
|
19
|
+
export declare function classifyHref(from: string, href: string): Classified;
|
|
19
20
|
export declare function roomTarget(href: string): RoomTarget | null;
|
|
20
21
|
export declare function roomPath(href: string): string | null;
|
|
21
22
|
export declare function target(from: string, href: string): string | null;
|
|
23
|
+
export interface LinkedPath {
|
|
24
|
+
readonly handle: string | null;
|
|
25
|
+
readonly path: string;
|
|
26
|
+
readonly fragment: string | null;
|
|
27
|
+
}
|
|
28
|
+
export declare function linkedPath(from: string, href: string): LinkedPath | null;
|
|
22
29
|
export declare function retarget(href: string, to: string): string;
|
|
23
30
|
export declare function relative(from: string, target: string): string;
|
|
24
31
|
export declare const SHELL_ROOMS = "/rooms/";
|
|
25
32
|
export declare function shellTarget(href: string, handle: string): string | null;
|
|
33
|
+
export declare function destinationText(to: string, bracketed: boolean): string | null;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CHAT_TYPE = "chat";
|
|
2
|
+
export declare const CHAT_MESSAGE_TYPE = "chat-message";
|
|
3
|
+
export declare const INBOX_TYPES: readonly string[];
|
|
4
|
+
export declare const INBOX_CHANNEL_KINDS: readonly ['telegram-bot', 'telegram-business', 'whatsapp', 'messenger', 'instagram', 'viber', 'tiktok'];
|
|
5
|
+
export type InboxChannelKind = (typeof INBOX_CHANNEL_KINDS)[number];
|
|
6
|
+
export declare const ROOM_TYPES_TEXT: string;
|
package/dist/mdmodel/types.d.ts
CHANGED
|
@@ -46,12 +46,15 @@ export type Document = Frontmatter & {
|
|
|
46
46
|
readonly preamble: string;
|
|
47
47
|
readonly sections: Readonly<Record<string, string>>;
|
|
48
48
|
readonly text: string;
|
|
49
|
+
readonly ranges: Readonly<Record<string, Extent>>;
|
|
50
|
+
readonly listEnd: number;
|
|
49
51
|
};
|
|
50
52
|
export type DefinitionOf = (type: string | undefined) => Definition | undefined;
|
|
51
53
|
export type Refusal = {
|
|
52
54
|
readonly file: string;
|
|
53
55
|
readonly rule: string;
|
|
54
56
|
readonly location?: string;
|
|
57
|
+
readonly line?: number;
|
|
55
58
|
readonly referrers?: readonly string[];
|
|
56
59
|
};
|
|
57
60
|
export type Reached = {
|
|
@@ -125,12 +128,6 @@ export type RoomReference = {
|
|
|
125
128
|
readonly value: string;
|
|
126
129
|
readonly to: readonly string[];
|
|
127
130
|
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
131
|
});
|
|
135
132
|
export type Change = {
|
|
136
133
|
readonly kind: 'field';
|
|
@@ -11,6 +11,7 @@ export declare function roomReferences(document: Document, definition?: Definiti
|
|
|
11
11
|
type Placed = {
|
|
12
12
|
readonly reference: Reached;
|
|
13
13
|
readonly location: string;
|
|
14
|
+
readonly line?: number;
|
|
14
15
|
};
|
|
15
16
|
export type Assessment = {
|
|
16
17
|
readonly file: string;
|
|
@@ -20,7 +21,6 @@ export type Assessment = {
|
|
|
20
21
|
readonly structured: Validation | null;
|
|
21
22
|
readonly fields: readonly Placed[];
|
|
22
23
|
readonly linked: boolean;
|
|
23
|
-
readonly sections: readonly Placed[];
|
|
24
24
|
};
|
|
25
25
|
export declare function assess(file: string, parsed: ParseResult, binary: boolean, model?: VerifiedModel, context?: Placing): Assessment;
|
|
26
26
|
export declare function assessReferences(file: string, parsed: ParseResult, changed: ReadonlySet<string>, model?: VerifiedModel, context?: Placing): Assessment;
|
|
@@ -31,4 +31,5 @@ export type Verdicts = {
|
|
|
31
31
|
export declare function verdicts(): Verdicts;
|
|
32
32
|
export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
|
|
33
33
|
export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
|
|
34
|
+
export declare function validateParsed(library: ReadonlyMap<string, ParseResult>, context?: ValidationContext, model?: VerifiedModel): Validation;
|
|
34
35
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ConversationHistoryRequest } from './adapter.js';
|
|
2
2
|
import { type CallResult, type HistoryAnswer, type Resolution } from './outcome.js';
|
|
3
3
|
import type { Attempted } from './recovery.js';
|
|
4
|
+
import type { Attempt } from './retried.js';
|
|
4
5
|
import type { Runtime } from './runtime.js';
|
|
5
6
|
export type HistoryQuery = {
|
|
6
7
|
revision?: string;
|
|
@@ -12,8 +13,13 @@ export declare function located(runtime: Runtime, room: string, path: string, de
|
|
|
12
13
|
path: string;
|
|
13
14
|
} | null>;
|
|
14
15
|
export declare function resolveReference(runtime: Runtime, room: string, path: string, destination: string): Promise<Resolution>;
|
|
15
|
-
export
|
|
16
|
+
export type Invoked = {
|
|
17
|
+
readonly dispatching?: () => Promise<void>;
|
|
18
|
+
readonly attempt?: Attempt;
|
|
19
|
+
};
|
|
20
|
+
export declare function invokeAction(runtime: Runtime, name: string, input: unknown, { dispatching, attempt }?: Invoked): Promise<CallResult>;
|
|
16
21
|
export declare function readConversationHistory(runtime: Runtime, request: ConversationHistoryRequest): Promise<CallResult>;
|
|
17
|
-
export declare function called(runtime: Runtime, name: string, input: unknown): Promise<CallResult>;
|
|
22
|
+
export declare function called(runtime: Runtime, name: string, input: unknown, attempt?: Attempt): Promise<CallResult>;
|
|
23
|
+
export declare function answeredCall(runtime: Runtime, operation: string): Promise<boolean>;
|
|
18
24
|
export declare function resendCalls(runtime: Runtime, signal: AbortSignal): Promise<Attempted>;
|
|
19
25
|
export declare function resendLater(runtime: Runtime): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SavedFacts, TypedPath } from '../mdmodel/index.js';
|
|
1
|
+
import type { SavedFacts, TypedPath, VerifiedModel } from '../mdmodel/index.js';
|
|
2
2
|
import type { Operation, SessionState } from '../session-content/index.js';
|
|
3
3
|
import type { ModelResult } from './model.js';
|
|
4
4
|
export type { SavedFacts, TypedPath };
|
|
@@ -52,7 +52,7 @@ export type ListedConversation = {
|
|
|
52
52
|
newest: string | null;
|
|
53
53
|
processEnded: string | null;
|
|
54
54
|
};
|
|
55
|
-
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
|
|
55
|
+
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete' | 'conversations/take-out' | 'conversations/rename' | 'conversations/option/set' | 'conversations/retry' | 'agent-functions/decide';
|
|
56
56
|
export type ConversationMessage = {
|
|
57
57
|
identity: string;
|
|
58
58
|
turn: string;
|
|
@@ -61,6 +61,7 @@ export type ConversationMessage = {
|
|
|
61
61
|
};
|
|
62
62
|
export type AcceptedMessage = ConversationMessage & {
|
|
63
63
|
position: string;
|
|
64
|
+
change: string;
|
|
64
65
|
};
|
|
65
66
|
export type ConversationHistoryRequest = {
|
|
66
67
|
conversations: readonly {
|
|
@@ -152,6 +153,7 @@ export type ConversationEvent = {
|
|
|
152
153
|
} | {
|
|
153
154
|
kind: 'deliveries';
|
|
154
155
|
conversation: string;
|
|
156
|
+
waiting: readonly string[];
|
|
155
157
|
unknown: readonly string[];
|
|
156
158
|
} | {
|
|
157
159
|
kind: 'accepted-message';
|
|
@@ -173,10 +175,17 @@ export type ConversationEvent = {
|
|
|
173
175
|
kind: 'unlisted';
|
|
174
176
|
conversation: string;
|
|
175
177
|
};
|
|
178
|
+
export type AgentEnvironment = {
|
|
179
|
+
identity: string;
|
|
180
|
+
name: string;
|
|
181
|
+
state: 'online' | 'offline';
|
|
182
|
+
};
|
|
176
183
|
export type ListedAgent = {
|
|
177
184
|
agent: string;
|
|
178
185
|
name: string;
|
|
179
186
|
retired: boolean;
|
|
187
|
+
cli: string;
|
|
188
|
+
environment: AgentEnvironment;
|
|
180
189
|
};
|
|
181
190
|
export type ConversationStream = {
|
|
182
191
|
replicate(conversations: readonly string[]): void;
|
|
@@ -215,6 +224,7 @@ export type Discovery = {
|
|
|
215
224
|
};
|
|
216
225
|
export type TransportUncertainty = {
|
|
217
226
|
kind: 'transport-uncertainty';
|
|
227
|
+
failure?: unknown;
|
|
218
228
|
};
|
|
219
229
|
export type RoomNotReadable = {
|
|
220
230
|
kind: 'room-not-readable';
|
|
@@ -349,12 +359,9 @@ export type AcceptedRoom = {
|
|
|
349
359
|
};
|
|
350
360
|
export type MutationResult = (AcceptedRoom & {
|
|
351
361
|
kind: 'accepted';
|
|
352
|
-
author?: string;
|
|
353
|
-
time?: string;
|
|
354
362
|
destination?: AcceptedRoom;
|
|
355
363
|
}) | (ProviderRefusal & {
|
|
356
364
|
kind: 'conflicted';
|
|
357
|
-
roomVersion?: string;
|
|
358
365
|
affected: Readonly<Record<string, string>>;
|
|
359
366
|
}) | (ProviderRefusal & {
|
|
360
367
|
kind: 'rejected';
|
|
@@ -497,8 +504,7 @@ export type RoomStream = {
|
|
|
497
504
|
export type PathRule = (path: string) => boolean;
|
|
498
505
|
export type Adapter = {
|
|
499
506
|
readonly localSaves?: true;
|
|
500
|
-
readonly roomTypes?:
|
|
501
|
-
readonly nameableRoomTypes?: readonly string[];
|
|
507
|
+
readonly roomTypes?: VerifiedModel;
|
|
502
508
|
readonly typedPaths?: readonly TypedPath[];
|
|
503
509
|
readonly pathRule?: PathRule;
|
|
504
510
|
readonly unkeptReads?: readonly string[];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type VerifiedModel } from '../mdmodel/index.js';
|
|
2
2
|
import type { ModelResult, ModelState } from './model.js';
|
|
3
3
|
export declare const NO_ROOM_TYPES: VerifiedModel;
|
|
4
|
-
export declare function roomTypesOf(schema: string | undefined, nameable?: readonly string[]): VerifiedModel;
|
|
5
4
|
export declare function builtInModel(roomTypes: VerifiedModel): ModelState;
|
|
6
5
|
export declare function schemaTypes(schema: string | null, roomTypes: VerifiedModel): VerifiedModel['types'];
|
|
7
6
|
export declare function attachedModel(answer: ModelResult, roomTypes: VerifiedModel): ModelState;
|
|
@@ -12,6 +12,8 @@ export type ChangeSet = {
|
|
|
12
12
|
queues: readonly string[];
|
|
13
13
|
presentations: readonly string[];
|
|
14
14
|
conversations: readonly string[];
|
|
15
|
+
unindexed: readonly string[];
|
|
16
|
+
due: readonly string[];
|
|
15
17
|
};
|
|
16
18
|
type Changed = {
|
|
17
19
|
documents?: readonly string[] | null;
|
|
@@ -19,6 +21,8 @@ type Changed = {
|
|
|
19
21
|
room?: boolean;
|
|
20
22
|
queue?: boolean;
|
|
21
23
|
presentation?: string;
|
|
24
|
+
unindexed?: boolean;
|
|
25
|
+
due?: boolean;
|
|
22
26
|
};
|
|
23
27
|
export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
|
|
24
28
|
export declare function conversationChangeSet(conversations: readonly string[]): ChangeSet;
|
|
@@ -6,9 +6,9 @@ import type { RoomSchemas } from './surface.js';
|
|
|
6
6
|
import type { SavedParts, SavedRoomDraft, SaveResult } from './saves.js';
|
|
7
7
|
import type { Member, ServiceMode } from './adapter.js';
|
|
8
8
|
import type { UnsentWork } from './durability.js';
|
|
9
|
-
import type {
|
|
9
|
+
import type { ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationSurface, ConversationView } from './conversation.js';
|
|
10
10
|
import { type Observation } from './observation.js';
|
|
11
|
-
import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer,
|
|
11
|
+
import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, QueueEntry, Resolution } from './outcome.js';
|
|
12
12
|
import type { FiguresResult } from './figures.js';
|
|
13
13
|
import type { Holdings } from './holdings.js';
|
|
14
14
|
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
@@ -41,21 +41,10 @@ export type MdRuntimeClient = {
|
|
|
41
41
|
write(value: unknown): Promise<void>;
|
|
42
42
|
edit(members: Readonly<Record<string, unknown>>): Promise<void>;
|
|
43
43
|
};
|
|
44
|
-
conversation: {
|
|
45
|
-
|
|
46
|
-
read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
|
|
47
|
-
create(input: unknown): Promise<CallResult>;
|
|
48
|
-
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
49
|
-
answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
|
|
50
|
-
interrupt(conversation: string): Promise<CallResult>;
|
|
51
|
-
kill(conversation: string): Promise<CallResult>;
|
|
52
|
-
delete(conversation: string): Promise<CallResult>;
|
|
53
|
-
};
|
|
54
|
-
chatDraft: {
|
|
55
|
-
write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
|
|
56
|
-
prepend(conversation: string, draft: ChatDraft): Promise<void>;
|
|
57
|
-
discard(conversation: string): Promise<void>;
|
|
44
|
+
conversation: ConversationSurface & {
|
|
45
|
+
pageMetadata(app: string, address: string): Promise<string>;
|
|
58
46
|
};
|
|
47
|
+
chatDraft: ChatDraftSurface;
|
|
59
48
|
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
|
|
60
49
|
resolve(room: string, path: string, destination: string): Promise<Resolution>;
|
|
61
50
|
binaryFile: {
|
|
@@ -64,8 +53,8 @@ export type MdRuntimeClient = {
|
|
|
64
53
|
download(room: string, path: string, revision?: string): Promise<DownloadAnswer>;
|
|
65
54
|
};
|
|
66
55
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
56
|
+
answered(operation: string): Promise<boolean>;
|
|
67
57
|
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
68
|
-
log(): Promise<string>;
|
|
69
58
|
persistence(): Promise<boolean>;
|
|
70
59
|
retry(): Promise<void>;
|
|
71
60
|
cleanUp(): Promise<number>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { sql } from '../mdmodel/index.js';
|
|
2
|
+
import { type Composition } from './collection.js';
|
|
2
3
|
import type { Plan, QueryRows } from './query.js';
|
|
3
4
|
import type { Connection } from './tables.js';
|
|
4
5
|
export type QueryRoom = {
|
|
5
6
|
readonly locator: string;
|
|
6
7
|
readonly key: number;
|
|
8
|
+
readonly composition?: Composition;
|
|
7
9
|
};
|
|
8
10
|
type Fragment = sql.Fragment;
|
|
9
11
|
export declare const VISIBLE: (alias: string) => string;
|
|
@@ -5,9 +5,10 @@ import type { ChangeSet } from './change-set.js';
|
|
|
5
5
|
import type { Asked, ConversationAgent, ConversationEntry, ConversationView, RunningTurn } from './conversation.js';
|
|
6
6
|
import type { CallResult } from './outcome.js';
|
|
7
7
|
import type { Recovery } from './recovery.js';
|
|
8
|
+
import type { Attempt, Retries } from './retried.js';
|
|
8
9
|
import type { ChatDraftRecord, RuntimeStore } from './store.js';
|
|
9
10
|
export type ConversationDependencies = {
|
|
10
|
-
call(name: ConversationAction, input: unknown): Promise<CallResult>;
|
|
11
|
+
call(name: ConversationAction, input: unknown, attempt?: Attempt): Promise<CallResult>;
|
|
11
12
|
history(request: ConversationHistoryRequest): Promise<CallResult>;
|
|
12
13
|
durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
|
|
13
14
|
local(): Promise<RuntimeStore>;
|
|
@@ -19,7 +20,9 @@ export type ConversationDependencies = {
|
|
|
19
20
|
full(): boolean;
|
|
20
21
|
closed(): boolean;
|
|
21
22
|
unanswered(): void;
|
|
23
|
+
heard(operation: string, lost: boolean): void;
|
|
22
24
|
readonly recovery: Recovery;
|
|
25
|
+
readonly retries: Retries;
|
|
23
26
|
};
|
|
24
27
|
export type Live = {
|
|
25
28
|
turn: RunningTurn | null;
|
|
@@ -34,6 +37,7 @@ export type Live = {
|
|
|
34
37
|
link: {
|
|
35
38
|
connected: boolean;
|
|
36
39
|
} | null;
|
|
40
|
+
deliveryWaiting: readonly string[];
|
|
37
41
|
deliveryUnknown: readonly string[];
|
|
38
42
|
};
|
|
39
43
|
export declare const QUIET: Live;
|
|
@@ -46,6 +50,7 @@ type HeldWindow = {
|
|
|
46
50
|
readonly window: readonly AcceptedMessage[] | null;
|
|
47
51
|
readonly draft: ChatDraftRecord | null;
|
|
48
52
|
readonly ended: string | null;
|
|
53
|
+
readonly dismissed: string | null;
|
|
49
54
|
readonly more: boolean;
|
|
50
55
|
readonly total: number | null;
|
|
51
56
|
};
|
|
@@ -71,6 +76,8 @@ export type Audience<T> = {
|
|
|
71
76
|
};
|
|
72
77
|
type HeldFacts = {
|
|
73
78
|
readonly listKnown: boolean;
|
|
79
|
+
readonly openingRead: boolean;
|
|
80
|
+
readonly openingListed: boolean;
|
|
74
81
|
readonly listOwed: boolean;
|
|
75
82
|
readonly listTelling: boolean;
|
|
76
83
|
readonly agentsShown: string | null;
|
|
@@ -106,7 +113,7 @@ export type LiveConversations = {
|
|
|
106
113
|
caughtUpTo(conversation: string): void;
|
|
107
114
|
gapOpened(conversation: string): void;
|
|
108
115
|
generation(conversation: string): number;
|
|
109
|
-
heardAt(conversation: string,
|
|
116
|
+
heardAt(conversation: string, change: string): void;
|
|
110
117
|
newestHeard(conversation: string): string | undefined;
|
|
111
118
|
catching(conversation: string): Promise<void> | undefined;
|
|
112
119
|
catchingUntil(conversation: string, ended: Promise<void>): void;
|
|
@@ -126,6 +133,7 @@ export type LiveConversations = {
|
|
|
126
133
|
forget(conversation: string): void;
|
|
127
134
|
current(): boolean;
|
|
128
135
|
known(): boolean;
|
|
136
|
+
listed(): boolean;
|
|
129
137
|
reopened(): void;
|
|
130
138
|
lost(): void;
|
|
131
139
|
close(): void;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type Part, type SessionState } from '../session-content/index.js';
|
|
2
|
-
import type { ConversationEvent, ConversationMessage, ProcessCommand, SessionOption } from './adapter.js';
|
|
2
|
+
import type { AgentEnvironment, ConversationEvent, ConversationMessage, ProcessCommand, SessionOption } from './adapter.js';
|
|
3
3
|
import { type ChangeSet } from './change-set.js';
|
|
4
4
|
import { type LiveConversations } from './conversation-live.js';
|
|
5
5
|
import { type ConversationHeld } from './conversation-row.js';
|
|
6
6
|
import type { Open } from './open.js';
|
|
7
7
|
import { type CallResult, type Offline } from './outcome.js';
|
|
8
|
+
import type { ChatRequest } from './source.js';
|
|
8
9
|
import type { CycleProgress } from './status.js';
|
|
9
10
|
import type { RuntimeStore } from './store.js';
|
|
10
11
|
export type ConversationState = Open<'working' | 'asking' | 'idle'>;
|
|
@@ -29,6 +30,8 @@ export type ConversationEntry = ConversationHeld & {
|
|
|
29
30
|
export type ConversationAgent = {
|
|
30
31
|
identity: string;
|
|
31
32
|
name: string;
|
|
33
|
+
cli?: string;
|
|
34
|
+
environment?: AgentEnvironment;
|
|
32
35
|
};
|
|
33
36
|
export type RunningTurn = {
|
|
34
37
|
turn: string;
|
|
@@ -64,20 +67,33 @@ export type ConversationView = {
|
|
|
64
67
|
link: {
|
|
65
68
|
connected: boolean;
|
|
66
69
|
} | null;
|
|
70
|
+
deliveryWaiting: readonly string[];
|
|
67
71
|
deliveryUnknown: readonly string[];
|
|
68
72
|
chatDraft: (ChatDraft & {
|
|
69
73
|
readonly revision: string;
|
|
70
74
|
}) | null;
|
|
75
|
+
dismissedSuggestion: string | null;
|
|
71
76
|
};
|
|
77
|
+
export type RequestDecision = 'approve' | 'decline';
|
|
72
78
|
export type ConversationSurface = {
|
|
73
79
|
list(): Promise<readonly ConversationEntry[]>;
|
|
74
80
|
read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
|
|
75
81
|
create(input: unknown): Promise<CallResult>;
|
|
76
82
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
77
|
-
answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
|
|
78
|
-
interrupt(conversation: string): Promise<CallResult>;
|
|
79
|
-
kill(conversation: string): Promise<CallResult>;
|
|
80
|
-
delete(conversation: string): Promise<CallResult>;
|
|
83
|
+
answer(conversation: string, answer: ConversationAnswer, operation: string): Promise<CallResult>;
|
|
84
|
+
interrupt(conversation: string, operation: string): Promise<CallResult>;
|
|
85
|
+
kill(conversation: string, operation: string): Promise<CallResult>;
|
|
86
|
+
delete(conversation: string, operation: string): Promise<CallResult>;
|
|
87
|
+
takeOut(conversation: string, message: string, operation: string): Promise<CallResult>;
|
|
88
|
+
decide(request: ChatRequest, decision: RequestDecision, operation: string): Promise<CallResult>;
|
|
89
|
+
rename(conversation: string, name: string, operation: string): Promise<CallResult>;
|
|
90
|
+
option(conversation: string, option: string, value: string | boolean, operation: string): Promise<CallResult>;
|
|
91
|
+
retry(conversation: string, message: string, operation: string): Promise<CallResult>;
|
|
92
|
+
pins(): Promise<readonly string[]>;
|
|
93
|
+
pin(figures: readonly string[]): Promise<void>;
|
|
94
|
+
openedTurns(): Promise<Readonly<Record<string, string>>>;
|
|
95
|
+
openTurn(conversation: string, turn: string): Promise<void>;
|
|
96
|
+
dismissSuggestion(conversation: string, suggestion: string): Promise<void>;
|
|
81
97
|
};
|
|
82
98
|
export type ConversationAnswer = {
|
|
83
99
|
interaction_id: string;
|
|
@@ -86,10 +102,12 @@ export type ConversationAnswer = {
|
|
|
86
102
|
export type ChatDraftSurface = {
|
|
87
103
|
write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
|
|
88
104
|
prepend(conversation: string, draft: ChatDraft): Promise<void>;
|
|
105
|
+
append(conversation: string, draft: ChatDraft): Promise<void>;
|
|
89
106
|
discard(conversation: string): Promise<void>;
|
|
90
107
|
};
|
|
91
108
|
export declare function unheldView(conversation: string): ConversationView;
|
|
92
109
|
export declare const SESSION_STARTED = "Session started";
|
|
110
|
+
export declare const CATCHING_UP = "catching-up";
|
|
93
111
|
export declare const HISTORY_CONVERSATIONS = 64;
|
|
94
112
|
export declare function newChat(agent: string): string;
|
|
95
113
|
export type Asked = {
|
|
@@ -98,12 +116,15 @@ export type Asked = {
|
|
|
98
116
|
before: readonly [string, string] | null;
|
|
99
117
|
total: boolean;
|
|
100
118
|
};
|
|
119
|
+
export declare function joinedDraft(first: string, second: string): string;
|
|
101
120
|
export declare function conversationsLearned(alive: LiveConversations): void;
|
|
102
121
|
export declare function conversationSurface(alive: LiveConversations): ConversationSurface;
|
|
103
122
|
export declare function chatDraftSurface(alive: LiveConversations): ChatDraftSurface;
|
|
104
123
|
export declare function conversationsOpened(alive: LiveConversations, local: RuntimeStore): Promise<void>;
|
|
124
|
+
export declare function reconcileOpening(alive: LiveConversations): Promise<void>;
|
|
105
125
|
export declare function reconcileConversations(alive: LiveConversations): Promise<void>;
|
|
106
126
|
export declare function catchUpConversations(alive: LiveConversations, progress: CycleProgress): Promise<void>;
|
|
127
|
+
export declare function holdsSubmission(alive: LiveConversations, operation: string): Promise<boolean>;
|
|
107
128
|
export declare function resendConversations(alive: LiveConversations, progress: CycleProgress): Promise<void>;
|
|
108
129
|
export declare function watchConversation(alive: LiveConversations, conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
|
|
109
130
|
export declare function watchConversationList(alive: LiveConversations, deliver: (entries: readonly ConversationEntry[]) => void): () => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Persistence } from './readiness.js';
|
|
2
|
+
import type { RetriedFailure, Step } from './retried.js';
|
|
2
3
|
export type UnsentKind = 'pending-change' | 'call' | 'room-draft' | 'chat-draft';
|
|
3
4
|
export type UnsentWork = {
|
|
4
5
|
readonly kind: UnsentKind;
|
|
@@ -20,7 +21,10 @@ export type RuntimeShell = {
|
|
|
20
21
|
cleanUp?(): Promise<number>;
|
|
21
22
|
measure?(measured: (app: string, code: AppCode | null) => void): Promise<HeldCode>;
|
|
22
23
|
reset(): Promise<void>;
|
|
24
|
+
retried?(failure: RetriedFailure): void;
|
|
25
|
+
succeeded?(step: Step): void;
|
|
23
26
|
};
|
|
24
27
|
export declare function refusedForSpace(error: unknown): boolean;
|
|
25
28
|
export declare function detectStorageLoss(stored: string | null, reported: string | null): string | null;
|
|
29
|
+
export declare function lossStated(persistence: Persistence, loss: string | null): string | null;
|
|
26
30
|
export declare function nextGeneration(stored: string | null, reported: string | null): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProviderRefusal } from './adapter.js';
|
|
1
2
|
export type RuntimeError = Error & {
|
|
2
3
|
readonly code: string;
|
|
3
4
|
readonly retryable: boolean;
|
|
@@ -8,6 +9,7 @@ export type Described = {
|
|
|
8
9
|
retryable: boolean;
|
|
9
10
|
};
|
|
10
11
|
export declare function runtimeError(code: string, message?: string, retryable?: boolean): RuntimeError;
|
|
12
|
+
export declare function refusalError(refusal: ProviderRefusal): RuntimeError;
|
|
11
13
|
export declare function failed(error: unknown): RuntimeError;
|
|
12
14
|
export declare function uncaught(error: unknown): void;
|
|
13
15
|
export declare function described(error: unknown): Described;
|
|
@@ -19,6 +19,7 @@ export type AppRoom = {
|
|
|
19
19
|
model: TypesResult;
|
|
20
20
|
typedSelection: AppTypedSelection | null;
|
|
21
21
|
providerOwnedPaths: readonly string[];
|
|
22
|
+
authoredPaths: readonly string[];
|
|
22
23
|
roomVersion: string | null;
|
|
23
24
|
documents: number;
|
|
24
25
|
synchronizationAvailable: boolean;
|
|
@@ -30,22 +31,17 @@ type ListedEntry = ListedRoom & {
|
|
|
30
31
|
readonly documents: number;
|
|
31
32
|
};
|
|
32
33
|
export type Listing = ReadonlyMap<string, ListedEntry>;
|
|
33
|
-
export declare function modelIn({ socket }: Runtime, locator: string, stored: Stored | undefined): ModelState;
|
|
34
|
+
export declare function modelIn({ socket, presence }: Runtime, locator: string, stored: Stored | undefined): ModelState;
|
|
34
35
|
export declare function compositionFor(runtime: Runtime, record: ReplicaRecord): Composition;
|
|
35
|
-
export declare function declarationOf({
|
|
36
|
+
export declare function declarationOf({ presence }: Runtime, locator: string, stored: Stored | undefined): {
|
|
36
37
|
readonly room: RoomDeclaration;
|
|
37
38
|
readonly available: boolean;
|
|
38
39
|
} | undefined;
|
|
39
|
-
export declare function listedLocators({
|
|
40
|
+
export declare function listedLocators({ presence }: Runtime, held: ReadonlyMap<string, unknown>): string[];
|
|
40
41
|
export declare function patchedListing(runtime: Runtime, changed: ReadonlySet<string>): Promise<Listing | null>;
|
|
41
42
|
export declare function listingNow(runtime: Runtime): Promise<Listing>;
|
|
42
|
-
export declare function shownRooms(
|
|
43
|
+
export declare function shownRooms({ presence }: Runtime, listing: Listing): readonly AppRoom[];
|
|
43
44
|
export declare function roomFacts(runtime: Runtime, reach?: PortReach | null): Promise<HeldRooms>;
|
|
44
|
-
export declare function list({ store, socket }: Runtime, locator: string, declaration: RoomDeclaration, synchronizationAvailable: boolean): void;
|
|
45
|
-
export declare function listHeld({ store, socket }: Runtime, locator: string): void;
|
|
46
|
-
export declare function admitted({ socket }: Runtime, locator: string, declaration: RoomDeclaration): boolean;
|
|
47
|
-
export declare function readable(runtime: Runtime, room: DiscoveredRoom): void;
|
|
48
|
-
export declare function usable(runtime: Runtime, room: DiscoveredRoom): void;
|
|
49
45
|
export declare function heldRooms({ store }: Runtime, listed: readonly DiscoveredRoom[]): Promise<HeldRoom[]>;
|
|
50
46
|
export declare function name(runtime: Runtime, locator: string): Promise<void>;
|
|
51
47
|
export {};
|
|
@@ -30,6 +30,12 @@ export type HeldRow = {
|
|
|
30
30
|
readonly at: string | null;
|
|
31
31
|
}) | null;
|
|
32
32
|
};
|
|
33
|
+
export type ConversationFact = 'openedTurn' | 'dismissedSuggestion';
|
|
34
|
+
export type HeldFact = {
|
|
35
|
+
readonly conversation: string;
|
|
36
|
+
readonly name: ConversationFact;
|
|
37
|
+
readonly value: string;
|
|
38
|
+
};
|
|
33
39
|
export type ConversationWrite = {
|
|
34
40
|
readonly conversation: string;
|
|
35
41
|
readonly messages: readonly AcceptedMessage[];
|
|
@@ -44,5 +50,6 @@ export declare function messageWindow(connection: Connection, conversation: stri
|
|
|
44
50
|
export declare function messageCount(connection: Connection, conversation: string, phrase: string | null): number;
|
|
45
51
|
export declare function conversationRows(connection: Connection, conversations: readonly string[]): HeldRow[];
|
|
46
52
|
export declare function turnArrived(connection: Connection, conversation: string, turn: string): boolean;
|
|
47
|
-
export declare function
|
|
48
|
-
export declare function
|
|
53
|
+
export declare function conversationFacts(connection: Connection): HeldFact[];
|
|
54
|
+
export declare function keptFact(connection: Connection, { conversation, name, value }: HeldFact): null;
|
|
55
|
+
export declare function forgottenConversations(connection: Connection): void;
|
|
@@ -25,9 +25,10 @@ export type Observed = {
|
|
|
25
25
|
};
|
|
26
26
|
export declare function rowsOf(result: QueryResult): readonly (QueryDocument | QueryGroup)[];
|
|
27
27
|
export declare function whole(message: QueryMessage): message is KeyedResult;
|
|
28
|
+
export declare function replaces(topic: string, message: unknown): boolean;
|
|
28
29
|
export declare function applied(keyed: KeyedResult, message: QueryMessage): KeyedResult;
|
|
29
|
-
export declare function observed(first: unknown, stop: () => void,
|
|
30
|
-
export declare function opened(watch: (deliver: (message: unknown) => void, fail: (error: unknown) => void) => () => void,
|
|
30
|
+
export declare function observed(first: unknown, stop: () => void, topic: string): Observed;
|
|
31
|
+
export declare function opened(watch: (deliver: (message: unknown) => void, fail: (error: unknown) => void) => () => void, topic: string): Promise<Observation<unknown>>;
|
|
31
32
|
export declare function observing<Topic extends string>(watch: (topic: Topic, input: readonly unknown[], deliver: (message: unknown) => void, fail: (error: unknown) => void) => () => void): (topic: Topic, ...input: unknown[]) => Promise<Observation<unknown>>;
|
|
32
33
|
export type Digest = {
|
|
33
34
|
readonly pending: string;
|
|
@@ -18,4 +18,4 @@ export type OpenedFiles = {
|
|
|
18
18
|
find(name: OpenedName): Promise<KeptBinary | null>;
|
|
19
19
|
fetch(name: OpenedName, read: () => Promise<BinaryResult>): Promise<KeptResult>;
|
|
20
20
|
};
|
|
21
|
-
export declare function openedFiles(database: RuntimeDatabase,
|
|
21
|
+
export declare function openedFiles(database: RuntimeDatabase, lost: (locator: string) => boolean): OpenedFiles;
|