@agentshouse/app-bridge 0.1.0-c7cde22995b9e → 0.1.0-c7d445aecf994

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.
Files changed (76) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +107 -56
  3. package/dist/mdmodel/built-in.d.ts +3 -0
  4. package/dist/mdmodel/definition.d.ts +2 -2
  5. package/dist/mdmodel/document.d.ts +1 -2
  6. package/dist/mdmodel/fields.d.ts +1 -1
  7. package/dist/mdmodel/house-model.d.ts +869 -0
  8. package/dist/mdmodel/house-references/crockford.d.ts +3 -0
  9. package/dist/mdmodel/house-references/patterns.d.ts +8 -0
  10. package/dist/mdmodel/index.d.ts +18 -7
  11. package/dist/mdmodel/media-type.d.ts +71 -0
  12. package/dist/mdmodel/moment.d.ts +6 -0
  13. package/dist/mdmodel/not-ready.d.ts +1 -0
  14. package/dist/mdmodel/paths.d.ts +5 -0
  15. package/dist/mdmodel/query/match.d.ts +1 -1
  16. package/dist/mdmodel/query/rows.d.ts +1 -1
  17. package/dist/mdmodel/references.d.ts +2 -2
  18. package/dist/mdmodel/room-types.d.ts +6 -0
  19. package/dist/mdmodel/types.d.ts +1 -10
  20. package/dist/mdmodel/validate.d.ts +2 -0
  21. package/dist/mdmodel/yaml.d.ts +4 -4
  22. package/dist/mdruntime/actions.d.ts +1 -0
  23. package/dist/mdruntime/adapter.d.ts +85 -14
  24. package/dist/mdruntime/attached-model.d.ts +0 -1
  25. package/dist/mdruntime/authored.d.ts +87 -0
  26. package/dist/mdruntime/change.d.ts +4 -0
  27. package/dist/mdruntime/client.d.ts +14 -11
  28. package/dist/mdruntime/collection.d.ts +5 -1
  29. package/dist/mdruntime/conversation-live.d.ts +18 -6
  30. package/dist/mdruntime/conversation-row.d.ts +8 -1
  31. package/dist/mdruntime/conversation.d.ts +19 -7
  32. package/dist/mdruntime/durability.d.ts +2 -0
  33. package/dist/mdruntime/house-query.d.ts +20 -0
  34. package/dist/mdruntime/install.d.ts +59 -0
  35. package/dist/mdruntime/listing.d.ts +24 -12
  36. package/dist/mdruntime/live.d.ts +5 -3
  37. package/dist/mdruntime/media.d.ts +18 -1
  38. package/dist/mdruntime/messages.d.ts +12 -3
  39. package/dist/mdruntime/modal.d.ts +1 -0
  40. package/dist/mdruntime/model.d.ts +4 -2
  41. package/dist/mdruntime/observation.d.ts +29 -12
  42. package/dist/mdruntime/outcome.d.ts +10 -1
  43. package/dist/mdruntime/overlay.d.ts +1 -1
  44. package/dist/mdruntime/preparation.d.ts +27 -6
  45. package/dist/mdruntime/presence.d.ts +8 -2
  46. package/dist/mdruntime/reach.d.ts +11 -5
  47. package/dist/mdruntime/readiness.d.ts +9 -3
  48. package/dist/mdruntime/reads.d.ts +1 -1
  49. package/dist/mdruntime/recovery.d.ts +1 -0
  50. package/dist/mdruntime/room-draft.d.ts +28 -3
  51. package/dist/mdruntime/runtime.d.ts +1 -2
  52. package/dist/mdruntime/saves.d.ts +2 -0
  53. package/dist/mdruntime/socket/lanes.d.ts +10 -3
  54. package/dist/mdruntime/socket/session.d.ts +2 -1
  55. package/dist/mdruntime/socket.d.ts +3 -3
  56. package/dist/mdruntime/source.d.ts +5 -0
  57. package/dist/mdruntime/store/installs.d.ts +2 -2
  58. package/dist/mdruntime/store/readiness.d.ts +5 -4
  59. package/dist/mdruntime/store/records.d.ts +19 -5
  60. package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
  61. package/dist/mdruntime/store.d.ts +13 -9
  62. package/dist/mdruntime/stored.d.ts +24 -13
  63. package/dist/mdruntime/surface.d.ts +12 -6
  64. package/dist/mdruntime/tables.d.ts +16 -52
  65. package/dist/mdruntime/wire.d.ts +33 -10
  66. package/dist/session-content/check.d.ts +0 -1
  67. package/dist/session-content/index.d.ts +2 -3
  68. package/dist/session-content/parts.d.ts +12 -84
  69. package/dist/session-content/state.d.ts +4 -6
  70. package/dist/session-content/turn.d.ts +28 -219
  71. package/dist/test-host.d.ts +8 -1
  72. package/dist/test-host.js +31 -1
  73. package/docs/families.md +53 -24
  74. package/package.json +2 -2
  75. package/dist/mdruntime/log.d.ts +0 -5
  76. package/dist/session-content/bounds.d.ts +0 -7
@@ -0,0 +1,3 @@
1
+ export declare const CROCKFORD_ALPHABET = "0123456789abcdefghjkmnpqrstvwxyz";
2
+ export declare const CROCKFORD_CHARACTER = "[0123456789abcdefghjkmnpqrstvwxyz]";
3
+ export declare const CROCKFORD_LEADING_CHARACTER: string;
@@ -0,0 +1,8 @@
1
+ export declare const ROOM_REFERENCE_PREFIX = "r_";
2
+ export declare const APP_REFERENCE_PREFIX = "a_";
3
+ export declare const SPACE_REFERENCE_PREFIX = "sp_";
4
+ export declare const REVISION_REFERENCE_PREFIX = "fr_";
5
+ export declare const ROOM_REFERENCE_PATTERN: RegExp;
6
+ export declare const APP_REFERENCE_PATTERN: RegExp;
7
+ export declare const SPACE_REFERENCE_PATTERN: RegExp;
8
+ export declare const REVISION_REFERENCE_PATTERN: RegExp;
@@ -11,14 +11,25 @@ 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 { acceptsType, dataUrl, dataUrlPattern, declaresUtf8, FILE_MEDIA_TYPES, fileExtension, formDataType, gitMediaType, isAudioType, isImageType, isVideoType, MEDIA_TYPES, mediaTypeEssence, SCRIPT_MEDIA_TYPES, servedMediaType, UTF8_TEXT, withCharset, } from './media-type.js';
15
+ export { shownDay, shownMoment } from './moment.js';
16
+ export type { MomentReader } from './moment.js';
14
17
  export { labelAt, NAME_FIELD } from './body.js';
15
18
  export type { Naming } from './body.js';
16
19
  export { divide } from './divide.js';
17
- export { apply, bodyLinks, create, links, parse, parseFrontmatter, relabel, relabels, relativize, relativizeBody, relinkBody, serialize, textSpans, unlinkBody, } from './document.js';
20
+ export { apply, bodyLinks, create, links, parse, relabel, relabels, relativize, relativizeBody, relinkBody, serialize, textSpans, unlinkBody, } from './document.js';
18
21
  export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
22
+ export { notReadyWaitMs } from './not-ready.js';
19
23
  export type { ReferenceTarget, SavedFacts } from './facts.js';
20
- export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
21
- export { linkedPath, relative, retarget, roomPath, roomTarget, target } from './paths.js';
24
+ export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './house-references/crockford.js';
25
+ export { HOUSE_FIELDS, MEMBER_FIELD, SITE_FIELD, SUBMITTED_FIELD, TYPE_FIELD } from './fields.js';
26
+ export { HOUSE_MODEL, HOUSE_ROOM_TYPES } from './built-in.js';
27
+ export { APP_PREFERENCES_HOME, HOUSE_MODEL_DECLARATION, HOUSE_TYPED_PATHS } from './house-model.js';
28
+ export { APP_REFERENCE_PATTERN, APP_REFERENCE_PREFIX, ROOM_REFERENCE_PATTERN, REVISION_REFERENCE_PATTERN, REVISION_REFERENCE_PREFIX, ROOM_REFERENCE_PREFIX, SPACE_REFERENCE_PATTERN, SPACE_REFERENCE_PREFIX, } from './house-references/patterns.js';
29
+ export type { HouseDocumentFields, HouseModelType } from './house-model.js';
30
+ export { CHAT_MESSAGE_TYPE, CHAT_TYPE, INBOX_CHANNEL_KINDS, INBOX_TYPES } from './room-types.js';
31
+ export type { InboxChannelKind } from './room-types.js';
32
+ export { keyedDestination, keyedLink, linkedPath, relative, retarget, roomPath, roomTarget, target, } from './paths.js';
22
33
  export { openPatternBudget } from './pattern.js';
23
34
  export type { LinkedPath, RoomTarget } from './paths.js';
24
35
  export { project } from './project.js';
@@ -26,9 +37,9 @@ export { references } from './references.js';
26
37
  export { CAPTURE_HOME, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION, } from './reserved.js';
27
38
  export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, untitled, } from './definition.js';
28
39
  export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, Shape, Transition, ValueFacts, } from './definition.js';
29
- 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';
30
- export { assess, assessReferences, bodyRoomLinks, checkDocument, definitionAt, readTypes, resolves, roomReferences, validate, validateParsed, validating, verdicts, verify, } from './validate.js';
40
+ export type { ApplyResult, BodyResult, Change, DefinitionOf, Division, DivisionContext, Document, DocumentCheck, Extent, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
41
+ export { assess, assessReferences, bodyKeyedLinks, bodyRoomLinks, checkDocument, definitionAt, readTypes, resolves, roomReferences, validate, validateParsed, validating, verdicts, verify, } from './validate.js';
31
42
  export type { Assessment, Verdicts } from './validate.js';
32
43
  export { VERSION } from './version.js';
33
- export { bodyAfterFrontmatter, equalValue, frontmatterValue, plain } from './yaml.js';
34
- export type { FrontmatterValue } from './yaml.js';
44
+ export { bodyAfterFrontmatter, documentValue, equalValue, plain } from './yaml.js';
45
+ export type { DocumentValue } from './yaml.js';
@@ -0,0 +1,71 @@
1
+ export declare const MEDIA_TYPES: {
2
+ readonly html: 'text/html';
3
+ readonly css: 'text/css';
4
+ readonly javascript: 'text/javascript';
5
+ readonly plainText: 'text/plain';
6
+ readonly markdown: 'text/markdown';
7
+ readonly csv: 'text/csv';
8
+ readonly json: 'application/json';
9
+ readonly xml: 'application/xml';
10
+ readonly yaml: 'application/yaml';
11
+ readonly ndjson: 'application/x-ndjson';
12
+ readonly webManifest: 'application/manifest+json';
13
+ readonly reports: 'application/reports+json';
14
+ readonly githubJson: 'application/vnd.github+json';
15
+ readonly form: 'application/x-www-form-urlencoded';
16
+ readonly octetStream: 'application/octet-stream';
17
+ readonly gzip: 'application/gzip';
18
+ readonly tar: 'application/x-tar';
19
+ readonly zip: 'application/zip';
20
+ readonly gitBundle: 'application/x-git-bundle';
21
+ readonly wasm: 'application/wasm';
22
+ readonly pdf: 'application/pdf';
23
+ readonly docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
24
+ readonly pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
25
+ readonly xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
26
+ readonly avif: 'image/avif';
27
+ readonly gif: 'image/gif';
28
+ readonly heic: 'image/heic';
29
+ readonly icon: 'image/vnd.microsoft.icon';
30
+ readonly jpeg: 'image/jpeg';
31
+ readonly png: 'image/png';
32
+ readonly svg: 'image/svg+xml';
33
+ readonly webp: 'image/webp';
34
+ readonly aac: 'audio/aac';
35
+ readonly amr: 'audio/amr';
36
+ readonly m4a: 'audio/mp4';
37
+ readonly mp3: 'audio/mpeg';
38
+ readonly ogg: 'audio/ogg';
39
+ readonly wav: 'audio/wav';
40
+ readonly threeGpp: 'video/3gpp';
41
+ readonly mp4: 'video/mp4';
42
+ readonly quickTime: 'video/quicktime';
43
+ readonly webm: 'video/webm';
44
+ readonly otf: 'font/otf';
45
+ readonly ttf: 'font/ttf';
46
+ readonly woff: 'font/woff';
47
+ readonly woff2: 'font/woff2';
48
+ };
49
+ export declare function withCharset(type: string, charset: string): string;
50
+ export declare const UTF8_TEXT: {
51
+ readonly html: string;
52
+ readonly css: string;
53
+ readonly javascript: string;
54
+ readonly plainText: string;
55
+ readonly markdown: string;
56
+ readonly xml: string;
57
+ };
58
+ export declare const SCRIPT_MEDIA_TYPES: readonly string[];
59
+ export declare const FILE_MEDIA_TYPES: Readonly<Record<string, string>>;
60
+ export declare function servedMediaType(path: string): string;
61
+ export declare function fileExtension(type: string): string | null;
62
+ export declare function dataUrl(type: string, base64: string): string;
63
+ export declare function dataUrlPattern(types: readonly string[]): RegExp;
64
+ export declare function formDataType(boundary: string): string;
65
+ export declare function gitMediaType(service: string, part: 'advertisement' | 'request' | 'result'): string;
66
+ export declare function mediaTypeEssence(value: string): string;
67
+ export declare function declaresUtf8(value: string): boolean;
68
+ export declare function acceptsType(accept: string | undefined, type: string): boolean;
69
+ export declare function isImageType(value: string): boolean;
70
+ export declare function isVideoType(value: string): boolean;
71
+ export declare function isAudioType(value: string): boolean;
@@ -0,0 +1,6 @@
1
+ export interface MomentReader {
2
+ readonly language: string;
3
+ readonly zone: string | null;
4
+ }
5
+ export declare function shownMoment(at: Date, reader: MomentReader): string;
6
+ export declare function shownDay(at: Date, reader: MomentReader): string;
@@ -0,0 +1 @@
1
+ export declare function notReadyWaitMs(asked: number): number;
@@ -26,6 +26,11 @@ export interface LinkedPath {
26
26
  readonly fragment: string | null;
27
27
  }
28
28
  export declare function linkedPath(from: string, href: string): LinkedPath | null;
29
+ export interface KeyedLink extends RoomTarget {
30
+ readonly key: string;
31
+ }
32
+ export declare function keyedLink(href: string): KeyedLink | null;
33
+ export declare function keyedDestination(path: string, key: string): string;
29
34
  export declare function retarget(href: string, to: string): string;
30
35
  export declare function relative(from: string, target: string): string;
31
36
  export declare const SHELL_ROOMS = "/rooms/";
@@ -6,7 +6,7 @@ export type Candidate = {
6
6
  readonly type: string | null;
7
7
  readonly fileId: string | null;
8
8
  readonly fields: Readonly<Record<string, unknown>>;
9
- readonly definition?: Pick<Definition, 'frontmatter'>;
9
+ readonly definition?: Pick<Definition, 'root'>;
10
10
  readonly text: string | null;
11
11
  };
12
12
  export declare function heldAt(candidate: Candidate, field: string): readonly HeldValue[];
@@ -28,4 +28,4 @@ export type Placed = {
28
28
  };
29
29
  export declare function placedOf(pointer: string, reach: Reach): Placed;
30
30
  export declare function heldKind(value: unknown): HeldKind;
31
- export declare function indexed(path: string, fields: Readonly<Record<string, unknown>>, definition: Pick<Definition, 'frontmatter'> | undefined): Indexed;
31
+ export declare function indexed(path: string, fields: Readonly<Record<string, unknown>>, definition: Pick<Definition, 'root'> | undefined): Indexed;
@@ -1,3 +1,3 @@
1
1
  import { type Definition } from './definition.js';
2
- import type { Frontmatter, Reference } from './types.js';
3
- export declare function references(document: Pick<Frontmatter, 'fields'>, definition: Definition): readonly Reference[];
2
+ import type { Document, Reference } from './types.js';
3
+ export declare function references(document: Pick<Document, 'fields'>, definition: Definition): readonly Reference[];
@@ -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', 'tiktok'];
5
+ export type InboxChannelKind = (typeof INBOX_CHANNEL_KINDS)[number];
6
+ export declare const ROOM_TYPES_TEXT: string;
@@ -37,12 +37,10 @@ export type Extent = {
37
37
  export type Span = Extent & {
38
38
  readonly text: string;
39
39
  };
40
- export type Frontmatter = {
40
+ export type Document = {
41
41
  readonly content: string;
42
42
  readonly type: string | undefined;
43
43
  readonly fields: Readonly<Record<string, unknown>>;
44
- };
45
- export type Document = Frontmatter & {
46
44
  readonly preamble: string;
47
45
  readonly sections: Readonly<Record<string, string>>;
48
46
  readonly text: string;
@@ -92,13 +90,6 @@ export type Division = {
92
90
  readonly ok: false;
93
91
  readonly refusal: Refusal;
94
92
  };
95
- export type FrontmatterResult = {
96
- readonly ok: true;
97
- readonly frontmatter: Frontmatter;
98
- } | {
99
- readonly ok: false;
100
- readonly refusal: Refusal;
101
- };
102
93
  export type ParseResult = {
103
94
  readonly ok: true;
104
95
  readonly document: Document;
@@ -1,4 +1,5 @@
1
1
  import { type Definition } from './definition.js';
2
+ import { type KeyedLink } from './paths.js';
2
3
  import type { DefinitionOf, Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
3
4
  export declare function definitionAt(model: VerifiedModel, file: string, typedPaths?: readonly TypedPath[]): DefinitionOf;
4
5
  export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
@@ -7,6 +8,7 @@ export declare function readTypes(schema: string, provided?: VerifiedModel): Ver
7
8
  type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
8
9
  export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
9
10
  export declare function bodyRoomLinks(body: string): RoomReference[];
11
+ export declare function bodyKeyedLinks(body: string): KeyedLink[];
10
12
  export declare function roomReferences(document: Document, definition?: Definition): readonly RoomReference[];
11
13
  type Placed = {
12
14
  readonly reference: Reached;
@@ -31,12 +31,12 @@ export declare function parseYamlMapping(text: string, start: number, end: numbe
31
31
  export declare function jsValue(node: YamlNode): unknown;
32
32
  export declare function mapEntry(map: YamlMap, key: string): YamlEntry | undefined;
33
33
  export declare function isPlainSafe(text: string): boolean;
34
- export type FrontmatterValue = string | number | boolean | null | readonly FrontmatterValue[] | {
35
- readonly [name: string]: FrontmatterValue;
34
+ export type DocumentValue = string | number | boolean | null | readonly DocumentValue[] | {
35
+ readonly [name: string]: DocumentValue;
36
36
  };
37
37
  export declare function plain(value: unknown): value is Record<string, unknown>;
38
- export declare function frontmatterValue(value: unknown): value is FrontmatterValue;
39
- export declare function serializeJs(value: FrontmatterValue): string;
38
+ export declare function documentValue(value: unknown): value is DocumentValue;
39
+ export declare function serializeJs(value: DocumentValue): string;
40
40
  export declare function isRecord(value: unknown): value is Record<string, unknown>;
41
41
  export declare function serializeKey(name: string): string;
42
42
  export declare function bodyStartAfterYaml(content: string, yamlEnd: number): number;
@@ -20,5 +20,6 @@ export type Invoked = {
20
20
  export declare function invokeAction(runtime: Runtime, name: string, input: unknown, { dispatching, attempt }?: Invoked): Promise<CallResult>;
21
21
  export declare function readConversationHistory(runtime: Runtime, request: ConversationHistoryRequest): Promise<CallResult>;
22
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>;
23
24
  export declare function resendCalls(runtime: Runtime, signal: AbortSignal): Promise<Attempted>;
24
25
  export declare function resendLater(runtime: Runtime): void;
@@ -1,9 +1,10 @@
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 };
5
5
  import type { Open } from './open.js';
6
6
  import type { ChangeBatch } from './change.js';
7
+ import type { QueryDocument } from './query.js';
7
8
  export type Authorization = object;
8
9
  export type MdModelIdentity = {
9
10
  identity: string;
@@ -42,8 +43,6 @@ export type Capability = {
42
43
  export type ListedConversation = {
43
44
  conversation: string;
44
45
  agent: string;
45
- agentName: string;
46
- agentRetired: boolean;
47
46
  name: string;
48
47
  created: string;
49
48
  finished: string | null;
@@ -51,6 +50,7 @@ export type ListedConversation = {
51
50
  waiting: boolean;
52
51
  newest: string | null;
53
52
  processEnded: string | null;
53
+ subject: string | null;
54
54
  };
55
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 = {
@@ -164,6 +164,7 @@ export type ConversationEvent = {
164
164
  conversation: string;
165
165
  } | {
166
166
  kind: 'list';
167
+ agents: readonly ListedAgent[];
167
168
  entries: readonly ListedConversation[];
168
169
  whole: boolean;
169
170
  more: boolean;
@@ -171,6 +172,9 @@ export type ConversationEvent = {
171
172
  } | {
172
173
  kind: 'listed';
173
174
  entry: ListedConversation;
175
+ } | {
176
+ kind: 'agent';
177
+ agent: ListedAgent;
174
178
  } | {
175
179
  kind: 'unlisted';
176
180
  conversation: string;
@@ -180,18 +184,56 @@ export type AgentEnvironment = {
180
184
  name: string;
181
185
  state: 'online' | 'offline';
182
186
  };
187
+ export type ListedOwner = {
188
+ readonly user: string;
189
+ readonly name: string;
190
+ };
191
+ export type ListedSpaceRef = {
192
+ readonly space_ref: string;
193
+ readonly name: string;
194
+ };
195
+ export type RoomListEntry = {
196
+ readonly room_ref: string;
197
+ readonly room_handle: string;
198
+ readonly name: string;
199
+ readonly level: 'search' | 'open' | 'keep';
200
+ readonly access: 'owner' | 'manage' | 'write' | 'read' | 'public';
201
+ readonly owner: ListedOwner;
202
+ readonly created: string;
203
+ readonly archived?: string;
204
+ readonly exportable?: true;
205
+ readonly space?: ListedSpaceRef;
206
+ };
207
+ export type SpaceListEntry = ListedSpaceRef & {
208
+ readonly owner: ListedOwner;
209
+ readonly created: string;
210
+ readonly manages?: true;
211
+ };
212
+ export type RoomList = {
213
+ readonly rooms: readonly RoomListEntry[];
214
+ readonly spaces: readonly SpaceListEntry[];
215
+ };
183
216
  export type ListedAgent = {
184
- agent: string;
217
+ id: string;
185
218
  name: string;
186
- retired: boolean;
219
+ revision: number;
220
+ environment: string;
221
+ environment_name: string;
222
+ environment_connected: boolean;
223
+ launch_directory: string;
187
224
  cli: string;
188
- environment: AgentEnvironment;
225
+ model: string | null;
226
+ effort: string | null;
227
+ mode: string | null;
228
+ base_instructions: string;
229
+ in_telegram: boolean;
230
+ created: string;
231
+ retired_at: string | null;
189
232
  };
190
233
  export type ConversationStream = {
191
234
  replicate(conversations: readonly string[]): void;
192
235
  hold(cursor: string | null): void;
193
236
  observe(notify: (event: ConversationEvent) => void): () => void;
194
- agents?(): Promise<readonly ListedAgent[] | null>;
195
237
  history?(request: ConversationHistoryRequest): Promise<ActionResult>;
196
238
  };
197
239
  export type ActionDeclaration = {
@@ -214,6 +256,11 @@ export type Retention = {
214
256
  history: HistoryRetention;
215
257
  refreshHorizon: number;
216
258
  };
259
+ export type QueriedRoom = {
260
+ readonly locator: string;
261
+ readonly handle: string;
262
+ readonly name: string;
263
+ };
217
264
  export type Discovery = {
218
265
  kind: 'discovery';
219
266
  rooms: readonly DiscoveredRoom[];
@@ -221,6 +268,9 @@ export type Discovery = {
221
268
  providerLimits: readonly ProviderLimit[];
222
269
  retention: Retention;
223
270
  member?: Member;
271
+ timeZone?: string | null;
272
+ roomList?: RoomList;
273
+ queriesOnly?: readonly QueriedRoom[];
224
274
  };
225
275
  export type TransportUncertainty = {
226
276
  kind: 'transport-uncertainty';
@@ -359,12 +409,9 @@ export type AcceptedRoom = {
359
409
  };
360
410
  export type MutationResult = (AcceptedRoom & {
361
411
  kind: 'accepted';
362
- author?: string;
363
- time?: string;
364
412
  destination?: AcceptedRoom;
365
413
  }) | (ProviderRefusal & {
366
414
  kind: 'conflicted';
367
- roomVersion?: string;
368
415
  affected: Readonly<Record<string, string>>;
369
416
  }) | (ProviderRefusal & {
370
417
  kind: 'rejected';
@@ -406,6 +453,10 @@ export type BinaryRequest = {
406
453
  path: string;
407
454
  revision: string;
408
455
  };
456
+ export type KeyedRequest = {
457
+ kind: 'key';
458
+ link: string;
459
+ };
409
460
  export type BinaryResult = {
410
461
  kind: 'binary';
411
462
  body: ReadableStream<Uint8Array>;
@@ -423,7 +474,7 @@ export type BinaryLinkResult = {
423
474
  kind: 'rejected';
424
475
  }) | AdapterFailure;
425
476
  export type AttachRequest = {
426
- locator: string;
477
+ locator?: string;
427
478
  name: string;
428
479
  mediaType: string;
429
480
  byteLength: number;
@@ -434,6 +485,9 @@ export type AttachResult = {
434
485
  kind: 'attached';
435
486
  path: string;
436
487
  revision: string;
488
+ } | {
489
+ kind: 'linked';
490
+ link: string;
437
491
  } | (ProviderRefusal & {
438
492
  kind: 'rejected';
439
493
  }) | AdapterFailure;
@@ -469,6 +523,17 @@ export type SearchAnswer = {
469
523
  } | (ProviderRefusal & {
470
524
  kind: 'rejected';
471
525
  }) | AdapterFailure;
526
+ export type HouseQueryAsk = {
527
+ room: string;
528
+ query: Readonly<Record<string, unknown>>;
529
+ };
530
+ export type HouseQueryAnswer = {
531
+ kind: 'rows';
532
+ documents: readonly QueryDocument[];
533
+ next?: string;
534
+ } | (ProviderRefusal & {
535
+ kind: 'rejected';
536
+ }) | AdapterFailure;
472
537
  export type HeldRoom = {
473
538
  locator: string;
474
539
  roomVersion: string | null;
@@ -485,6 +550,10 @@ export type AuthorityChange = {
485
550
  rooms: readonly DiscoveredRoom[];
486
551
  left: readonly string[];
487
552
  member?: Member;
553
+ timeZone?: string | null;
554
+ roomList?: RoomList & {
555
+ readonly left: readonly string[];
556
+ };
488
557
  };
489
558
  export type RoomStreamEvent = {
490
559
  kind: 'opened';
@@ -499,6 +568,8 @@ export type RoomStreamEvent = {
499
568
  } | {
500
569
  kind: 'caught-up';
501
570
  expired: readonly string[];
571
+ } | {
572
+ kind: 'reported';
502
573
  } | AuthorityChange | RoomChange;
503
574
  export type RoomStream = {
504
575
  hold(rooms: readonly HeldRoom[]): void;
@@ -507,8 +578,7 @@ export type RoomStream = {
507
578
  export type PathRule = (path: string) => boolean;
508
579
  export type Adapter = {
509
580
  readonly localSaves?: true;
510
- readonly roomTypes?: string;
511
- readonly nameableRoomTypes?: readonly string[];
581
+ readonly roomTypes?: VerifiedModel;
512
582
  readonly typedPaths?: readonly TypedPath[];
513
583
  readonly pathRule?: PathRule;
514
584
  readonly unkeptReads?: readonly string[];
@@ -520,10 +590,11 @@ export type Adapter = {
520
590
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
521
591
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
522
592
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
523
- link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
593
+ link(authorization: Authorization, request: BinaryRequest | KeyedRequest): Promise<BinaryLinkResult>;
524
594
  attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
525
595
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
526
596
  search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
597
+ queryHouse?(authorization: Authorization, request: HouseQueryAsk): Promise<HouseQueryAnswer>;
527
598
  reached(locator: string, roomVersion: string, target: string): boolean;
528
599
  follows(locator: string, roomVersion: string, next: string): boolean;
529
600
  roomStream?: RoomStream;
@@ -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;
@@ -0,0 +1,87 @@
1
+ import type { UnsentWork } from './durability.js';
2
+ import type { Connection, FileSpool, HeldStatus } from './tables.js';
3
+ export declare const FILE_PART_BYTES = 1048576;
4
+ export declare const AUTHORED_TABLES: readonly string[];
5
+ export type AuthoredFact = 'holder' | 'generation' | 'format';
6
+ export type StoredFile = {
7
+ readonly key: string;
8
+ readonly blob: Blob;
9
+ };
10
+ type KeptPending = {
11
+ readonly id: string;
12
+ readonly batch: string;
13
+ readonly state: string;
14
+ readonly files: readonly string[];
15
+ readonly paths: readonly string[];
16
+ readonly moving: boolean;
17
+ };
18
+ export type KeptRecord = {
19
+ readonly record: string;
20
+ readonly files: readonly string[];
21
+ };
22
+ export type AuthoredRows = {
23
+ readonly locator: string;
24
+ readonly order?: readonly string[];
25
+ readonly added?: readonly KeptPending[];
26
+ readonly founded?: readonly Omit<KeptPending, 'state'>[];
27
+ readonly roomDrafts?: readonly (KeptRecord & {
28
+ readonly path: string;
29
+ })[];
30
+ readonly consumedRoomDrafts?: readonly string[];
31
+ };
32
+ export type AuthoredWrite = {
33
+ readonly writes: readonly AuthoredRows[];
34
+ readonly files: readonly StoredFile[];
35
+ readonly whole: boolean;
36
+ };
37
+ export type HeldQueues = {
38
+ readonly queues: readonly {
39
+ readonly locator: string;
40
+ readonly ids: readonly string[];
41
+ }[];
42
+ readonly pending: readonly QueuedRow[];
43
+ };
44
+ type QueuedRow = {
45
+ readonly locator: string;
46
+ readonly id: string;
47
+ readonly batch: string;
48
+ readonly state: string;
49
+ };
50
+ export declare function authoredTable(name: string): boolean;
51
+ export declare function heldTables(connection: Connection): string[];
52
+ export declare function formatted(connection: Connection, format: string, tables: readonly string[]): void;
53
+ export declare function fact(connection: Connection, name: AuthoredFact): string | null;
54
+ export declare function remember(connection: Connection, name: AuthoredFact, value: string): null;
55
+ export declare function fenced(connection: Connection, locator: string): boolean;
56
+ export declare function authoredPart(connection: Connection, key: string, part: number): Uint8Array | null;
57
+ export declare function spooled(connection: Connection, spool: FileSpool, key: string, type: string): Promise<Blob>;
58
+ export declare function queues(connection: Connection): HeldQueues['queues'];
59
+ export declare function queuedLocators(connection: Connection): string[];
60
+ export declare function authoredLocators(connection: Connection): string[];
61
+ export declare function heldOrder(connection: Connection, locator: string): readonly string[];
62
+ export declare function queueOf(connection: Connection, locator: string): Omit<QueuedRow, 'locator'>[];
63
+ export declare function moving(connection: Connection): HeldQueues;
64
+ export declare function unsentStatus(connection: Connection): Omit<HeldStatus, 'lastCompleted'>;
65
+ export declare function pendingState(connection: Connection, locator: string, id: string): string | null;
66
+ export declare function pendingBatch(connection: Connection, locator: string, id: string): string | null;
67
+ export declare function roomDraftRecords(connection: Connection, locator: string | null, paths: readonly string[] | null): string[];
68
+ export declare function chatDraftRecord(connection: Connection, conversation: string): string | null;
69
+ export declare function chatDraftRecords(connection: Connection): string[];
70
+ export declare function chatDraftConversations(connection: Connection, conversations: readonly string[] | null): string[];
71
+ export declare function chatDraftsDropped(connection: Connection, conversations: readonly string[]): void;
72
+ export declare function callRecords(connection: Connection): string[];
73
+ export declare function fences(connection: Connection): string[];
74
+ export declare function kept(connection: Connection, { writes, files, whole }: AuthoredWrite): Promise<string | null>;
75
+ export declare function amended(connection: Connection, locator: string, id: string, amendment: string): null;
76
+ export declare function roomDraft(connection: Connection, locator: string, path: string, draft: KeptRecord | null, files: readonly StoredFile[]): Promise<string | null>;
77
+ export declare function chatDraft(connection: Connection, drafts: readonly {
78
+ readonly conversation: string;
79
+ readonly record: string;
80
+ }[], dropped: readonly string[]): null;
81
+ export declare function call(connection: Connection, operation: string, held: KeptRecord | null, files: readonly StoredFile[]): Promise<null>;
82
+ export declare function fencedWork(connection: Connection, locators: readonly string[]): void;
83
+ export declare function unfenced(connection: Connection, locators: readonly string[]): void;
84
+ export declare function claim(connection: Connection, holder: string): boolean;
85
+ export declare function authoredEmptied(connection: Connection): void;
86
+ export declare function unsent(connection: Connection): UnsentWork[];
87
+ export {};
@@ -53,6 +53,10 @@ type Arriving = {
53
53
  readonly created?: string;
54
54
  readonly change?: HeadChange;
55
55
  };
56
+ export type PartChange = Extract<Change, {
57
+ readonly kind: 'field' | 'section' | 'preamble';
58
+ }>;
59
+ export declare function isPart(change: Change): change is PartChange;
56
60
  export type RoomMove = {
57
61
  readonly source: {
58
62
  readonly room: string;