@agentshouse/app-bridge 0.1.0-cfb5ca35059bb → 0.1.0-cfb893a1d2cd3

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 (118) hide show
  1. package/README.md +6 -6
  2. package/dist/index.d.ts +237 -401
  3. package/dist/mdmodel/body.d.ts +84 -0
  4. package/dist/mdmodel/built-in.d.ts +3 -0
  5. package/dist/mdmodel/definition.d.ts +24 -11
  6. package/dist/mdmodel/document.d.ts +14 -8
  7. package/dist/mdmodel/event.d.ts +76 -0
  8. package/dist/mdmodel/facts.d.ts +14 -0
  9. package/dist/mdmodel/fields.d.ts +1 -1
  10. package/dist/mdmodel/house-model.d.ts +869 -0
  11. package/dist/mdmodel/house-references/crockford.d.ts +3 -0
  12. package/dist/mdmodel/house-references/patterns.d.ts +8 -0
  13. package/dist/mdmodel/index.d.ts +42 -15
  14. package/dist/mdmodel/indexed.d.ts +8 -0
  15. package/dist/mdmodel/kinds.d.ts +19 -0
  16. package/dist/mdmodel/markdown.d.ts +74 -0
  17. package/dist/mdmodel/media-type.d.ts +71 -0
  18. package/dist/mdmodel/moment.d.ts +6 -0
  19. package/dist/mdmodel/not-ready.d.ts +1 -0
  20. package/dist/mdmodel/paths.d.ts +15 -1
  21. package/dist/mdmodel/pattern.d.ts +9 -0
  22. package/dist/mdmodel/query/language.d.ts +253 -0
  23. package/dist/mdmodel/query/match.d.ts +13 -0
  24. package/dist/mdmodel/query/rows.d.ts +31 -0
  25. package/dist/mdmodel/query/sql.d.ts +38 -0
  26. package/dist/mdmodel/references.d.ts +2 -2
  27. package/dist/mdmodel/reserved.d.ts +5 -0
  28. package/dist/mdmodel/room-types.d.ts +6 -0
  29. package/dist/mdmodel/types.d.ts +22 -17
  30. package/dist/mdmodel/validate.d.ts +12 -6
  31. package/dist/mdmodel/yaml.d.ts +4 -4
  32. package/dist/mdruntime/actions.d.ts +25 -0
  33. package/dist/mdruntime/adapter.d.ts +154 -81
  34. package/dist/mdruntime/attached-model.d.ts +6 -0
  35. package/dist/mdruntime/authored.d.ts +87 -0
  36. package/dist/mdruntime/bootstrap.d.ts +43 -0
  37. package/dist/mdruntime/cell.d.ts +5 -0
  38. package/dist/mdruntime/chain.d.ts +2 -1
  39. package/dist/mdruntime/change-set.d.ts +4 -0
  40. package/dist/mdruntime/change.d.ts +5 -0
  41. package/dist/mdruntime/client.d.ts +37 -23
  42. package/dist/mdruntime/collection.d.ts +27 -4
  43. package/dist/mdruntime/compile.d.ts +8 -6
  44. package/dist/mdruntime/conversation-live.d.ts +149 -0
  45. package/dist/mdruntime/conversation-row.d.ts +39 -0
  46. package/dist/mdruntime/conversation.d.ts +67 -46
  47. package/dist/mdruntime/declaration.d.ts +9 -0
  48. package/dist/mdruntime/durability.d.ts +20 -0
  49. package/dist/mdruntime/failure.d.ts +3 -0
  50. package/dist/mdruntime/figures.d.ts +48 -0
  51. package/dist/mdruntime/holdings.d.ts +28 -0
  52. package/dist/mdruntime/house-query.d.ts +20 -0
  53. package/dist/mdruntime/identity.d.ts +0 -1
  54. package/dist/mdruntime/install.d.ts +59 -0
  55. package/dist/mdruntime/listing.d.ts +59 -0
  56. package/dist/mdruntime/live.d.ts +24 -0
  57. package/dist/mdruntime/media.d.ts +19 -2
  58. package/dist/mdruntime/messages.d.ts +35 -5
  59. package/dist/mdruntime/modal.d.ts +1 -0
  60. package/dist/mdruntime/model.d.ts +6 -12
  61. package/dist/mdruntime/observation.d.ts +30 -13
  62. package/dist/mdruntime/opened.d.ts +1 -1
  63. package/dist/mdruntime/outcome.d.ts +17 -2
  64. package/dist/mdruntime/overlay.d.ts +7 -2
  65. package/dist/mdruntime/preparation.d.ts +40 -0
  66. package/dist/mdruntime/presence.d.ts +57 -0
  67. package/dist/mdruntime/query.d.ts +13 -209
  68. package/dist/mdruntime/reach.d.ts +24 -14
  69. package/dist/mdruntime/readiness.d.ts +9 -6
  70. package/dist/mdruntime/reads.d.ts +38 -0
  71. package/dist/mdruntime/recovery.d.ts +4 -1
  72. package/dist/mdruntime/refresh.d.ts +26 -0
  73. package/dist/mdruntime/replica.d.ts +11 -16
  74. package/dist/mdruntime/retried.d.ts +29 -0
  75. package/dist/mdruntime/room-draft.d.ts +34 -10
  76. package/dist/mdruntime/room-drafts.d.ts +23 -0
  77. package/dist/mdruntime/runtime.d.ts +34 -0
  78. package/dist/mdruntime/save.d.ts +42 -86
  79. package/dist/mdruntime/saves.d.ts +33 -0
  80. package/dist/mdruntime/search.d.ts +12 -63
  81. package/dist/mdruntime/seed.d.ts +11 -2
  82. package/dist/mdruntime/socket/admission.d.ts +6 -0
  83. package/dist/mdruntime/socket/answers.d.ts +5 -0
  84. package/dist/mdruntime/socket/lanes.d.ts +27 -0
  85. package/dist/mdruntime/socket/session.d.ts +38 -0
  86. package/dist/mdruntime/socket.d.ts +67 -0
  87. package/dist/mdruntime/source.d.ts +58 -0
  88. package/dist/mdruntime/status.d.ts +0 -2
  89. package/dist/mdruntime/store/installs.d.ts +29 -0
  90. package/dist/mdruntime/store/readiness.d.ts +10 -0
  91. package/dist/mdruntime/store/records.d.ts +225 -0
  92. package/dist/mdruntime/store/room-held.d.ts +7 -0
  93. package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
  94. package/dist/mdruntime/store/space.d.ts +10 -0
  95. package/dist/mdruntime/store/watchers.d.ts +16 -0
  96. package/dist/mdruntime/store/writes.d.ts +23 -0
  97. package/dist/mdruntime/store.d.ts +116 -144
  98. package/dist/mdruntime/stored.d.ts +72 -35
  99. package/dist/mdruntime/surface.d.ts +93 -0
  100. package/dist/mdruntime/tables.d.ts +118 -67
  101. package/dist/mdruntime/tallies.d.ts +17 -0
  102. package/dist/mdruntime/transfer.d.ts +4 -0
  103. package/dist/mdruntime/wire.d.ts +82 -7
  104. package/dist/session-content/check.d.ts +17 -0
  105. package/dist/session-content/index.d.ts +6 -0
  106. package/dist/session-content/parts.d.ts +30 -0
  107. package/dist/session-content/state.d.ts +59 -0
  108. package/dist/session-content/turn.d.ts +137 -0
  109. package/dist/test-host.d.ts +8 -1
  110. package/dist/test-host.js +32 -2
  111. package/docs/families.md +73 -37
  112. package/package.json +2 -2
  113. package/dist/mdmodel/blocks.d.ts +0 -10
  114. package/dist/mdmodel/condition.d.ts +0 -179
  115. package/dist/mdmodel/links.d.ts +0 -28
  116. package/dist/mdmodel/profile.d.ts +0 -5
  117. package/dist/mdruntime/connection.d.ts +0 -152
  118. package/dist/mdruntime/fulltext.d.ts +0 -26
@@ -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;
@@ -12,9 +12,16 @@ export type ModelVerification = {
12
12
  readonly rule: string;
13
13
  readonly location?: string;
14
14
  };
15
+ export type TypedPath = {
16
+ readonly path: string;
17
+ readonly type: string;
18
+ readonly named: boolean;
19
+ readonly body: boolean;
20
+ };
15
21
  export type ValidationContext = {
16
22
  readonly binaryTargets: readonly string[];
17
23
  readonly anyRoom?: true;
24
+ readonly typedPaths?: readonly TypedPath[];
18
25
  };
19
26
  export type ProjectionContext = {
20
27
  readonly documentTargets: readonly string[];
@@ -30,19 +37,22 @@ export type Extent = {
30
37
  export type Span = Extent & {
31
38
  readonly text: string;
32
39
  };
33
- export type Frontmatter = {
40
+ export type Document = {
34
41
  readonly content: string;
35
42
  readonly type: string | undefined;
36
43
  readonly fields: Readonly<Record<string, unknown>>;
37
- };
38
- export type Document = Frontmatter & {
39
44
  readonly preamble: string;
40
45
  readonly sections: Readonly<Record<string, string>>;
46
+ readonly text: string;
47
+ readonly ranges: Readonly<Record<string, Extent>>;
48
+ readonly listEnd: number;
41
49
  };
50
+ export type DefinitionOf = (type: string | undefined) => Definition | undefined;
42
51
  export type Refusal = {
43
52
  readonly file: string;
44
53
  readonly rule: string;
45
54
  readonly location?: string;
55
+ readonly line?: number;
46
56
  readonly referrers?: readonly string[];
47
57
  };
48
58
  export type Reached = {
@@ -80,13 +90,6 @@ export type Division = {
80
90
  readonly ok: false;
81
91
  readonly refusal: Refusal;
82
92
  };
83
- export type FrontmatterResult = {
84
- readonly ok: true;
85
- readonly frontmatter: Frontmatter;
86
- } | {
87
- readonly ok: false;
88
- readonly refusal: Refusal;
89
- };
90
93
  export type ParseResult = {
91
94
  readonly ok: true;
92
95
  readonly document: Document;
@@ -116,12 +119,6 @@ export type RoomReference = {
116
119
  readonly value: string;
117
120
  readonly to: readonly string[];
118
121
  readonly crossRoom?: true;
119
- } | {
120
- readonly kind: 'item';
121
- readonly section: string;
122
- readonly href: string;
123
- readonly to: readonly string[];
124
- readonly crossRoom?: true;
125
122
  });
126
123
  export type Change = {
127
124
  readonly kind: 'field';
@@ -132,11 +129,15 @@ export type Change = {
132
129
  readonly kind: 'section';
133
130
  readonly name: string;
134
131
  readonly value: string;
135
- readonly prior: string;
132
+ readonly prior: string | undefined;
136
133
  } | {
137
134
  readonly kind: 'preamble';
138
135
  readonly value: string;
139
136
  readonly prior: string;
137
+ } | {
138
+ readonly kind: 'text';
139
+ readonly value: string;
140
+ readonly prior: string;
140
141
  } | {
141
142
  readonly kind: 'link';
142
143
  readonly href: string;
@@ -165,3 +166,7 @@ export type BodyResult = {
165
166
  readonly outcome: 'refuse';
166
167
  readonly refusal: Refusal;
167
168
  };
169
+ export type UnlinkedBody = {
170
+ readonly body: string;
171
+ readonly links: ReadonlyMap<string, string>;
172
+ };
@@ -1,14 +1,19 @@
1
1
  import { type Definition } from './definition.js';
2
- import type { DocumentCheck, Library, ModelVerification, Reached, RoomReference, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
2
+ import { type KeyedLink } from './paths.js';
3
+ import type { DefinitionOf, Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
4
+ export declare function definitionAt(model: VerifiedModel, file: string, typedPaths?: readonly TypedPath[]): DefinitionOf;
3
5
  export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
4
6
  export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
5
- export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): DocumentCheck;
6
- export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
7
+ export declare function readTypes(schema: string, provided?: VerifiedModel): VerifiedModel;
8
+ type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
9
+ export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
7
10
  export declare function bodyRoomLinks(body: string): RoomReference[];
8
- export declare function roomReferences(file: string, content: string, definition?: Definition): readonly RoomReference[];
11
+ export declare function bodyKeyedLinks(body: string): KeyedLink[];
12
+ export declare function roomReferences(document: Document, definition?: Definition): readonly RoomReference[];
9
13
  type Placed = {
10
14
  readonly reference: Reached;
11
15
  readonly location: string;
16
+ readonly line?: number;
12
17
  };
13
18
  export type Assessment = {
14
19
  readonly file: string;
@@ -18,9 +23,9 @@ export type Assessment = {
18
23
  readonly structured: Validation | null;
19
24
  readonly fields: readonly Placed[];
20
25
  readonly linked: boolean;
21
- readonly sections: readonly Placed[];
22
26
  };
23
- export declare function assess(file: string, content: string, binary: boolean, model?: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): Assessment;
27
+ export declare function assess(file: string, parsed: ParseResult, binary: boolean, model?: VerifiedModel, context?: Placing): Assessment;
28
+ export declare function assessReferences(file: string, parsed: ParseResult, changed: ReadonlySet<string>, model?: VerifiedModel, context?: Placing): Assessment;
24
29
  export type Verdicts = {
25
30
  add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
26
31
  verdict(): Validation;
@@ -28,4 +33,5 @@ export type Verdicts = {
28
33
  export declare function verdicts(): Verdicts;
29
34
  export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
30
35
  export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
36
+ export declare function validateParsed(library: ReadonlyMap<string, ParseResult>, context?: ValidationContext, model?: VerifiedModel): Validation;
31
37
  export {};
@@ -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;
@@ -0,0 +1,25 @@
1
+ import type { ConversationHistoryRequest } from './adapter.js';
2
+ import { type CallResult, type HistoryAnswer, type Resolution } from './outcome.js';
3
+ import type { Attempted } from './recovery.js';
4
+ import type { Attempt } from './retried.js';
5
+ import type { Runtime } from './runtime.js';
6
+ export type HistoryQuery = {
7
+ revision?: string;
8
+ pageToken?: string;
9
+ };
10
+ export declare function readHistory(runtime: Runtime, locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
11
+ export declare function located(runtime: Runtime, room: string, path: string, destination: string): Promise<{
12
+ room: string;
13
+ path: string;
14
+ } | null>;
15
+ export declare function resolveReference(runtime: Runtime, room: string, path: string, destination: string): Promise<Resolution>;
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>;
21
+ export declare function readConversationHistory(runtime: Runtime, request: ConversationHistoryRequest): 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>;
24
+ export declare function resendCalls(runtime: Runtime, signal: AbortSignal): Promise<Attempted>;
25
+ export declare function resendLater(runtime: Runtime): void;
@@ -1,6 +1,10 @@
1
+ import type { SavedFacts, TypedPath, VerifiedModel } from '../mdmodel/index.js';
2
+ import type { Operation, SessionState } from '../session-content/index.js';
1
3
  import type { ModelResult } from './model.js';
4
+ export type { SavedFacts, TypedPath };
2
5
  import type { Open } from './open.js';
3
6
  import type { ChangeBatch } from './change.js';
7
+ import type { QueryDocument } from './query.js';
4
8
  export type Authorization = object;
5
9
  export type MdModelIdentity = {
6
10
  identity: string;
@@ -11,22 +15,25 @@ export type TypedSelection = {
11
15
  };
12
16
  export type OperationScopes = {
13
17
  write: readonly string[];
14
- delete: readonly string[];
18
+ erase: readonly string[];
15
19
  };
16
20
  export type ReplicaAdmission = {
17
21
  selection: string;
18
22
  admission: Open<'admitted' | 'unavailable'>;
19
23
  offline: Open<'locked' | 'open'>;
20
24
  };
21
- export type DiscoveredRoom = {
22
- name: string;
23
- locator: string;
24
- handle: string;
25
- roomVersion: string;
26
- operations: OperationScopes;
27
- replica: ReplicaAdmission;
28
- typedSelection?: TypedSelection;
29
- providerOwnedPaths: readonly string[];
25
+ export type RoomDeclaration = {
26
+ readonly name: string;
27
+ readonly handle: string;
28
+ readonly operations: OperationScopes;
29
+ readonly replica: ReplicaAdmission;
30
+ readonly typedSelection: TypedSelection | null;
31
+ readonly providerOwnedPaths: readonly string[];
32
+ readonly authoredPaths: readonly string[];
33
+ };
34
+ export type DiscoveredRoom = RoomDeclaration & {
35
+ readonly locator: string;
36
+ readonly roomVersion: string;
30
37
  };
31
38
  export type Capability = {
32
39
  name: string;
@@ -36,16 +43,16 @@ export type Capability = {
36
43
  export type ListedConversation = {
37
44
  conversation: string;
38
45
  agent: string;
39
- agentName: string;
40
- agentRetired: boolean;
41
46
  name: string;
42
47
  created: string;
43
48
  finished: string | null;
44
49
  outcome: string | null;
45
50
  waiting: boolean;
46
51
  newest: string | null;
52
+ processEnded: string | null;
53
+ subject: string | null;
47
54
  };
48
- 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';
49
56
  export type ConversationMessage = {
50
57
  identity: string;
51
58
  turn: string;
@@ -54,6 +61,7 @@ export type ConversationMessage = {
54
61
  };
55
62
  export type AcceptedMessage = ConversationMessage & {
56
63
  position: string;
64
+ change: string;
57
65
  };
58
66
  export type ConversationHistoryRequest = {
59
67
  conversations: readonly {
@@ -69,37 +77,10 @@ export type ConversationHistoryPage = {
69
77
  export type ConversationHistories = {
70
78
  histories: readonly ConversationHistoryPage[];
71
79
  };
72
- export type TurnContext = {
73
- used: number;
74
- window: number;
75
- };
76
80
  export type TurnOperation = {
77
81
  op: 'begin';
78
82
  at: string;
79
- } | {
80
- op: 'start';
81
- index: number;
82
- part: unknown;
83
- } | {
84
- op: 'append';
85
- index: number;
86
- text: string;
87
- } | {
88
- op: 'status';
89
- index: number;
90
- status: string;
91
- result: unknown;
92
- } | {
93
- op: 'count';
94
- index: number;
95
- count: number;
96
- } | {
97
- op: 'plan';
98
- index: number;
99
- entries: readonly unknown[];
100
- } | ({
101
- op: 'context';
102
- } & TurnContext);
83
+ } | Operation;
103
84
  export type ProcessCommand = {
104
85
  [field: string]: unknown;
105
86
  name: string;
@@ -136,10 +117,6 @@ export type SessionOption = (SessionOptionNaming & {
136
117
  type: 'boolean';
137
118
  currentValue: boolean;
138
119
  });
139
- export type RunningSubagent = {
140
- description: string;
141
- activity: string | null;
142
- };
143
120
  export type ConversationEvent = {
144
121
  kind: 'turn';
145
122
  conversation: string;
@@ -166,9 +143,9 @@ export type ConversationEvent = {
166
143
  conversation: string;
167
144
  step: string | null;
168
145
  } | {
169
- kind: 'subagents';
146
+ kind: 'state';
170
147
  conversation: string;
171
- subagents: readonly RunningSubagent[];
148
+ state: SessionState | null;
172
149
  } | {
173
150
  kind: 'link';
174
151
  conversation: string;
@@ -176,6 +153,7 @@ export type ConversationEvent = {
176
153
  } | {
177
154
  kind: 'deliveries';
178
155
  conversation: string;
156
+ waiting: readonly string[];
179
157
  unknown: readonly string[];
180
158
  } | {
181
159
  kind: 'accepted-message';
@@ -186,6 +164,7 @@ export type ConversationEvent = {
186
164
  conversation: string;
187
165
  } | {
188
166
  kind: 'list';
167
+ agents: readonly ListedAgent[];
189
168
  entries: readonly ListedConversation[];
190
169
  whole: boolean;
191
170
  more: boolean;
@@ -193,20 +172,68 @@ export type ConversationEvent = {
193
172
  } | {
194
173
  kind: 'listed';
195
174
  entry: ListedConversation;
175
+ } | {
176
+ kind: 'agent';
177
+ agent: ListedAgent;
196
178
  } | {
197
179
  kind: 'unlisted';
198
180
  conversation: string;
199
181
  };
182
+ export type AgentEnvironment = {
183
+ identity: string;
184
+ name: string;
185
+ state: 'online' | 'offline';
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
+ };
200
216
  export type ListedAgent = {
201
- agent: string;
217
+ id: string;
202
218
  name: string;
203
- retired: boolean;
219
+ revision: number;
220
+ environment: string;
221
+ environment_name: string;
222
+ environment_connected: boolean;
223
+ launch_directory: string;
224
+ cli: string;
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;
204
232
  };
205
233
  export type ConversationStream = {
206
234
  replicate(conversations: readonly string[]): void;
207
235
  hold(cursor: string | null): void;
208
236
  observe(notify: (event: ConversationEvent) => void): () => void;
209
- agents?(): Promise<readonly ListedAgent[] | null>;
210
237
  history?(request: ConversationHistoryRequest): Promise<ActionResult>;
211
238
  };
212
239
  export type ActionDeclaration = {
@@ -227,9 +254,13 @@ export type HistoryRetention = {
227
254
  };
228
255
  export type Retention = {
229
256
  history: HistoryRetention;
230
- outcome: number;
231
257
  refreshHorizon: number;
232
258
  };
259
+ export type QueriedRoom = {
260
+ readonly locator: string;
261
+ readonly handle: string;
262
+ readonly name: string;
263
+ };
233
264
  export type Discovery = {
234
265
  kind: 'discovery';
235
266
  rooms: readonly DiscoveredRoom[];
@@ -237,9 +268,13 @@ export type Discovery = {
237
268
  providerLimits: readonly ProviderLimit[];
238
269
  retention: Retention;
239
270
  member?: Member;
271
+ timeZone?: string | null;
272
+ roomList?: RoomList;
273
+ queriesOnly?: readonly QueriedRoom[];
240
274
  };
241
275
  export type TransportUncertainty = {
242
276
  kind: 'transport-uncertainty';
277
+ failure?: unknown;
243
278
  };
244
279
  export type RoomNotReadable = {
245
280
  kind: 'room-not-readable';
@@ -283,25 +318,17 @@ export type BinaryFile = {
283
318
  mediaType: string;
284
319
  sha256: string;
285
320
  };
286
- export type HeldFile = {
287
- readonly path: string;
288
- readonly revision: string;
289
- };
290
- export type HeldContent = {
291
- files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
292
- contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
293
- readonly content: string;
294
- readonly revision: string;
295
- }>>;
296
- };
297
321
  export type BootstrapRequest = {
298
322
  locator: string;
299
323
  selection: string;
300
324
  pageToken?: PageToken;
301
- held?: HeldContent;
302
325
  arriving?: (bytes: number) => void;
303
326
  signal?: AbortSignal;
304
327
  };
328
+ export type BootstrapPart = {
329
+ readonly id: string;
330
+ readonly bytes: number;
331
+ };
305
332
  export type BootstrapInventory = {
306
333
  readonly bytes: number;
307
334
  };
@@ -313,17 +340,23 @@ export type BootstrapPage = {
313
340
  roomVersion: string;
314
341
  models?: RoomModels;
315
342
  documents: Readonly<Record<string, string>>;
343
+ facts: Readonly<Record<string, SavedFacts>>;
316
344
  revisions: Readonly<Record<string, string>>;
317
345
  fileIds?: Readonly<Record<string, string>>;
346
+ created?: Readonly<Record<string, string>>;
318
347
  changes: Readonly<Record<string, HeadChange>>;
319
348
  binaryFiles: Readonly<Record<string, BinaryFile>>;
320
349
  folders?: readonly string[];
321
350
  pageToken?: PageToken;
351
+ parts?: readonly BootstrapPart[];
322
352
  bytes?: number;
323
353
  };
354
+ export type NotReady = {
355
+ kind: 'not-ready';
356
+ };
324
357
  export type BootstrapResult = BootstrapPage | {
325
358
  kind: 'beyond-horizon';
326
- } | AdapterFailure;
359
+ } | NotReady | AdapterFailure;
327
360
  export type RefreshRequest = {
328
361
  locator: string;
329
362
  selection: string;
@@ -335,8 +368,10 @@ export type RefreshPage = {
335
368
  roomVersion: string;
336
369
  models?: RoomModels;
337
370
  documents: Readonly<Record<string, string>>;
371
+ facts: Readonly<Record<string, SavedFacts>>;
338
372
  revisions: Readonly<Record<string, string>>;
339
373
  fileIds?: Readonly<Record<string, string>>;
374
+ created?: Readonly<Record<string, string>>;
340
375
  changes: Readonly<Record<string, HeadChange>>;
341
376
  binaryFiles: Readonly<Record<string, BinaryFile>>;
342
377
  removals: readonly string[];
@@ -374,27 +409,18 @@ export type AcceptedRoom = {
374
409
  };
375
410
  export type MutationResult = (AcceptedRoom & {
376
411
  kind: 'accepted';
377
- author?: string;
378
- time?: string;
379
412
  destination?: AcceptedRoom;
380
413
  }) | (ProviderRefusal & {
381
414
  kind: 'conflicted';
382
- roomVersion?: string;
383
415
  affected: Readonly<Record<string, string>>;
384
416
  }) | (ProviderRefusal & {
385
417
  kind: 'rejected';
386
418
  affected: Readonly<Record<string, string>>;
387
419
  }) | RetryableRefusal | {
388
420
  kind: 'write-halted';
389
- } | {
390
- kind: 'expired';
391
- restored?: true;
392
421
  } | AdapterFailure;
393
422
  export type HistoryAuthor = {
394
- kind: 'user';
395
- id: string;
396
- } | {
397
- kind: 'site' | 'inbox' | 'app';
423
+ kind: 'user' | 'site' | 'inbox' | 'app';
398
424
  id: string;
399
425
  name: string;
400
426
  };
@@ -427,6 +453,10 @@ export type BinaryRequest = {
427
453
  path: string;
428
454
  revision: string;
429
455
  };
456
+ export type KeyedRequest = {
457
+ kind: 'key';
458
+ link: string;
459
+ };
430
460
  export type BinaryResult = {
431
461
  kind: 'binary';
432
462
  body: ReadableStream<Uint8Array>;
@@ -444,7 +474,7 @@ export type BinaryLinkResult = {
444
474
  kind: 'rejected';
445
475
  }) | AdapterFailure;
446
476
  export type AttachRequest = {
447
- locator: string;
477
+ locator?: string;
448
478
  name: string;
449
479
  mediaType: string;
450
480
  byteLength: number;
@@ -455,6 +485,9 @@ export type AttachResult = {
455
485
  kind: 'attached';
456
486
  path: string;
457
487
  revision: string;
488
+ } | {
489
+ kind: 'linked';
490
+ link: string;
458
491
  } | (ProviderRefusal & {
459
492
  kind: 'rejected';
460
493
  }) | AdapterFailure;
@@ -470,17 +503,45 @@ export type ActionResult = {
470
503
  kind: 'action';
471
504
  result: unknown;
472
505
  at?: RoomVersionAt;
506
+ } | (ProviderRefusal & {
507
+ kind: 'rejected';
508
+ reset?: string;
509
+ }) | AdapterFailure;
510
+ export type SearchHit = {
511
+ room: string;
512
+ path: string;
513
+ line?: number;
514
+ snippet?: string;
515
+ };
516
+ export type SearchAsk = {
517
+ text: string;
518
+ rooms: readonly string[] | null;
519
+ };
520
+ export type SearchAnswer = {
521
+ kind: 'found';
522
+ documents: readonly SearchHit[];
523
+ } | (ProviderRefusal & {
524
+ kind: 'rejected';
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;
473
534
  } | (ProviderRefusal & {
474
535
  kind: 'rejected';
475
536
  }) | AdapterFailure;
476
537
  export type HeldRoom = {
477
538
  locator: string;
478
- roomVersion: string;
539
+ roomVersion: string | null;
479
540
  };
480
541
  export type RoomChange = {
481
542
  kind: 'room-change';
482
543
  locator: string;
483
- from: string;
544
+ from: string | null;
484
545
  roomVersion: string;
485
546
  read(): Promise<RefreshPage>;
486
547
  };
@@ -489,6 +550,10 @@ export type AuthorityChange = {
489
550
  rooms: readonly DiscoveredRoom[];
490
551
  left: readonly string[];
491
552
  member?: Member;
553
+ timeZone?: string | null;
554
+ roomList?: RoomList & {
555
+ readonly left: readonly string[];
556
+ };
492
557
  };
493
558
  export type RoomStreamEvent = {
494
559
  kind: 'opened';
@@ -499,18 +564,25 @@ export type RoomStreamEvent = {
499
564
  kind: 'closed';
500
565
  revoked: boolean;
501
566
  lost: boolean;
567
+ authorityChanged: boolean;
502
568
  } | {
503
569
  kind: 'caught-up';
504
570
  expired: readonly string[];
571
+ } | {
572
+ kind: 'reported';
505
573
  } | AuthorityChange | RoomChange;
506
574
  export type RoomStream = {
507
575
  hold(rooms: readonly HeldRoom[]): void;
508
576
  observe(notify: (event: RoomStreamEvent) => void): () => void;
509
577
  };
578
+ export type PathRule = (path: string) => boolean;
510
579
  export type Adapter = {
511
580
  readonly localSaves?: true;
512
- readonly roomTypes?: string;
513
- readonly nameableRoomTypes?: readonly string[];
581
+ readonly roomTypes?: VerifiedModel;
582
+ readonly typedPaths?: readonly TypedPath[];
583
+ readonly pathRule?: PathRule;
584
+ readonly unkeptReads?: readonly string[];
585
+ readonly leadingReads?: readonly string[];
514
586
  authorize(): Promise<Authorization>;
515
587
  discover?(authorization: Authorization): Promise<DiscoverResult>;
516
588
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
@@ -518,13 +590,14 @@ export type Adapter = {
518
590
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
519
591
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
520
592
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
521
- link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
593
+ link(authorization: Authorization, request: BinaryRequest | KeyedRequest): Promise<BinaryLinkResult>;
522
594
  attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
523
595
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
596
+ search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
597
+ queryHouse?(authorization: Authorization, request: HouseQueryAsk): Promise<HouseQueryAnswer>;
524
598
  reached(locator: string, roomVersion: string, target: string): boolean;
525
599
  follows(locator: string, roomVersion: string, next: string): boolean;
526
600
  roomStream?: RoomStream;
527
601
  conversations?: ConversationStream;
528
602
  serviceMode?: ServiceModeSignal;
529
603
  };
530
- export {};
@@ -0,0 +1,6 @@
1
+ import { type VerifiedModel } from '../mdmodel/index.js';
2
+ import type { ModelResult, ModelState } from './model.js';
3
+ export declare const NO_ROOM_TYPES: VerifiedModel;
4
+ export declare function builtInModel(roomTypes: VerifiedModel): ModelState;
5
+ export declare function schemaTypes(schema: string | null, roomTypes: VerifiedModel): VerifiedModel['types'];
6
+ export declare function attachedModel(answer: ModelResult, roomTypes: VerifiedModel): ModelState;