@agentshouse/app-bridge 0.1.0-c7cd0546b3c09 → 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 (120) hide show
  1. package/README.md +7 -7
  2. package/dist/index.d.ts +653 -27
  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 +21 -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 +40 -15
  14. package/dist/mdmodel/kinds.d.ts +17 -0
  15. package/dist/mdmodel/markdown.d.ts +74 -0
  16. package/dist/mdmodel/media-type.d.ts +71 -0
  17. package/dist/mdmodel/moment.d.ts +6 -0
  18. package/dist/mdmodel/not-ready.d.ts +1 -0
  19. package/dist/mdmodel/paths.d.ts +15 -1
  20. package/dist/mdmodel/pattern.d.ts +9 -0
  21. package/dist/mdmodel/query/language.d.ts +253 -0
  22. package/dist/mdmodel/query/match.d.ts +13 -0
  23. package/dist/mdmodel/query/rows.d.ts +31 -0
  24. package/dist/mdmodel/query/sql.d.ts +38 -0
  25. package/dist/mdmodel/references.d.ts +2 -2
  26. package/dist/mdmodel/reserved.d.ts +5 -0
  27. package/dist/mdmodel/room-types.d.ts +6 -0
  28. package/dist/mdmodel/types.d.ts +22 -17
  29. package/dist/mdmodel/validate.d.ts +12 -6
  30. package/dist/mdmodel/yaml.d.ts +4 -4
  31. package/dist/mdruntime/actions.d.ts +25 -0
  32. package/dist/mdruntime/adapter.d.ts +186 -113
  33. package/dist/mdruntime/attached-model.d.ts +6 -0
  34. package/dist/mdruntime/authored.d.ts +87 -0
  35. package/dist/mdruntime/bootstrap.d.ts +43 -0
  36. package/dist/mdruntime/cell.d.ts +5 -0
  37. package/dist/mdruntime/chain.d.ts +2 -1
  38. package/dist/mdruntime/change-set.d.ts +4 -0
  39. package/dist/mdruntime/change.d.ts +5 -0
  40. package/dist/mdruntime/client.d.ts +37 -24
  41. package/dist/mdruntime/collection.d.ts +27 -7
  42. package/dist/mdruntime/compile.d.ts +8 -6
  43. package/dist/mdruntime/conversation-live.d.ts +149 -0
  44. package/dist/mdruntime/conversation-row.d.ts +39 -0
  45. package/dist/mdruntime/conversation.d.ts +72 -51
  46. package/dist/mdruntime/declaration.d.ts +9 -0
  47. package/dist/mdruntime/durability.d.ts +20 -1
  48. package/dist/mdruntime/failure.d.ts +3 -0
  49. package/dist/mdruntime/figures.d.ts +48 -0
  50. package/dist/mdruntime/holdings.d.ts +28 -0
  51. package/dist/mdruntime/house-query.d.ts +20 -0
  52. package/dist/mdruntime/identity.d.ts +0 -1
  53. package/dist/mdruntime/install.d.ts +59 -0
  54. package/dist/mdruntime/listing.d.ts +59 -0
  55. package/dist/mdruntime/live.d.ts +24 -0
  56. package/dist/mdruntime/media.d.ts +19 -2
  57. package/dist/mdruntime/messages.d.ts +35 -5
  58. package/dist/mdruntime/modal.d.ts +1 -0
  59. package/dist/mdruntime/model.d.ts +6 -13
  60. package/dist/mdruntime/observation.d.ts +30 -13
  61. package/dist/mdruntime/opened.d.ts +1 -1
  62. package/dist/mdruntime/outcome.d.ts +17 -5
  63. package/dist/mdruntime/overlay.d.ts +7 -2
  64. package/dist/mdruntime/preparation.d.ts +40 -0
  65. package/dist/mdruntime/presence.d.ts +57 -0
  66. package/dist/mdruntime/query.d.ts +14 -210
  67. package/dist/mdruntime/reach.d.ts +23 -15
  68. package/dist/mdruntime/readiness.d.ts +12 -21
  69. package/dist/mdruntime/reads.d.ts +38 -0
  70. package/dist/mdruntime/recovery.d.ts +4 -0
  71. package/dist/mdruntime/refresh.d.ts +26 -0
  72. package/dist/mdruntime/replica.d.ts +12 -18
  73. package/dist/mdruntime/retried.d.ts +29 -0
  74. package/dist/mdruntime/room-draft.d.ts +51 -12
  75. package/dist/mdruntime/room-drafts.d.ts +23 -0
  76. package/dist/mdruntime/runtime.d.ts +34 -0
  77. package/dist/mdruntime/save.d.ts +42 -86
  78. package/dist/mdruntime/saves.d.ts +33 -0
  79. package/dist/mdruntime/search.d.ts +12 -63
  80. package/dist/mdruntime/seed.d.ts +11 -2
  81. package/dist/mdruntime/socket/admission.d.ts +6 -0
  82. package/dist/mdruntime/socket/answers.d.ts +5 -0
  83. package/dist/mdruntime/socket/lanes.d.ts +27 -0
  84. package/dist/mdruntime/socket/session.d.ts +38 -0
  85. package/dist/mdruntime/socket.d.ts +67 -0
  86. package/dist/mdruntime/source.d.ts +58 -0
  87. package/dist/mdruntime/status.d.ts +0 -6
  88. package/dist/mdruntime/store/installs.d.ts +29 -0
  89. package/dist/mdruntime/store/readiness.d.ts +10 -0
  90. package/dist/mdruntime/store/records.d.ts +225 -0
  91. package/dist/mdruntime/store/room-held.d.ts +7 -0
  92. package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
  93. package/dist/mdruntime/store/space.d.ts +10 -0
  94. package/dist/mdruntime/store/watchers.d.ts +16 -0
  95. package/dist/mdruntime/store/writes.d.ts +23 -0
  96. package/dist/mdruntime/store.d.ts +124 -175
  97. package/dist/mdruntime/stored.d.ts +73 -60
  98. package/dist/mdruntime/surface.d.ts +93 -0
  99. package/dist/mdruntime/tables.d.ts +118 -104
  100. package/dist/mdruntime/tallies.d.ts +17 -0
  101. package/dist/mdruntime/transfer.d.ts +0 -5
  102. package/dist/mdruntime/wire.d.ts +80 -9
  103. package/dist/session-content/check.d.ts +17 -0
  104. package/dist/session-content/index.d.ts +6 -0
  105. package/dist/session-content/parts.d.ts +30 -0
  106. package/dist/session-content/state.d.ts +59 -0
  107. package/dist/session-content/turn.d.ts +137 -0
  108. package/dist/test-host.d.ts +8 -4
  109. package/dist/test-host.js +33 -29
  110. package/docs/families.md +102 -87
  111. package/package.json +2 -2
  112. package/dist/calls.d.ts +0 -707
  113. package/dist/calls.js +0 -1
  114. package/dist/mdmodel/blocks.d.ts +0 -10
  115. package/dist/mdmodel/condition.d.ts +0 -160
  116. package/dist/mdmodel/links.d.ts +0 -28
  117. package/dist/mdmodel/profile.d.ts +0 -5
  118. package/dist/mdruntime/connection.d.ts +0 -154
  119. package/dist/mdruntime/fulltext.d.ts +0 -26
  120. package/dist/mdruntime/shared.d.ts +0 -15
@@ -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,35 +15,30 @@ 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;
33
40
  limits?: readonly ProviderLimit[];
34
41
  actions?: readonly ActionDeclaration[];
35
- conversationAgents?: ConversationAgents;
36
- };
37
- export type ConversationAgents = {
38
- locator: string;
39
- type: string;
40
- identity: string;
41
- name: string;
42
- retired?: string;
43
42
  };
44
43
  export type ListedConversation = {
45
44
  conversation: string;
@@ -49,8 +48,11 @@ export type ListedConversation = {
49
48
  finished: string | null;
50
49
  outcome: string | null;
51
50
  waiting: boolean;
51
+ newest: string | null;
52
+ processEnded: string | null;
53
+ subject: string | null;
52
54
  };
53
- export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
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';
54
56
  export type ConversationMessage = {
55
57
  identity: string;
56
58
  turn: string;
@@ -59,6 +61,7 @@ export type ConversationMessage = {
59
61
  };
60
62
  export type AcceptedMessage = ConversationMessage & {
61
63
  position: string;
64
+ change: string;
62
65
  };
63
66
  export type ConversationHistoryRequest = {
64
67
  conversations: readonly {
@@ -74,37 +77,10 @@ export type ConversationHistoryPage = {
74
77
  export type ConversationHistories = {
75
78
  histories: readonly ConversationHistoryPage[];
76
79
  };
77
- export type TurnContext = {
78
- used: number;
79
- window: number;
80
- };
81
80
  export type TurnOperation = {
82
81
  op: 'begin';
83
82
  at: string;
84
- } | {
85
- op: 'start';
86
- index: number;
87
- part: unknown;
88
- } | {
89
- op: 'append';
90
- index: number;
91
- text: string;
92
- } | {
93
- op: 'status';
94
- index: number;
95
- status: string;
96
- result: unknown;
97
- } | {
98
- op: 'count';
99
- index: number;
100
- count: number;
101
- } | {
102
- op: 'plan';
103
- index: number;
104
- entries: readonly unknown[];
105
- } | ({
106
- op: 'context';
107
- } & TurnContext);
83
+ } | Operation;
108
84
  export type ProcessCommand = {
109
85
  [field: string]: unknown;
110
86
  name: string;
@@ -166,6 +142,10 @@ export type ConversationEvent = {
166
142
  kind: 'starting';
167
143
  conversation: string;
168
144
  step: string | null;
145
+ } | {
146
+ kind: 'state';
147
+ conversation: string;
148
+ state: SessionState | null;
169
149
  } | {
170
150
  kind: 'link';
171
151
  conversation: string;
@@ -173,6 +153,7 @@ export type ConversationEvent = {
173
153
  } | {
174
154
  kind: 'deliveries';
175
155
  conversation: string;
156
+ waiting: readonly string[];
176
157
  unknown: readonly string[];
177
158
  } | {
178
159
  kind: 'accepted-message';
@@ -183,17 +164,77 @@ export type ConversationEvent = {
183
164
  conversation: string;
184
165
  } | {
185
166
  kind: 'list';
167
+ agents: readonly ListedAgent[];
186
168
  entries: readonly ListedConversation[];
169
+ whole: boolean;
170
+ more: boolean;
171
+ cursor: string | null;
187
172
  } | {
188
173
  kind: 'listed';
189
174
  entry: ListedConversation;
175
+ } | {
176
+ kind: 'agent';
177
+ agent: ListedAgent;
190
178
  } | {
191
179
  kind: 'unlisted';
192
180
  conversation: string;
193
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
+ };
216
+ export type ListedAgent = {
217
+ id: string;
218
+ name: string;
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;
232
+ };
194
233
  export type ConversationStream = {
195
234
  replicate(conversations: readonly string[]): void;
235
+ hold(cursor: string | null): void;
196
236
  observe(notify: (event: ConversationEvent) => void): () => void;
237
+ history?(request: ConversationHistoryRequest): Promise<ActionResult>;
197
238
  };
198
239
  export type ActionDeclaration = {
199
240
  name: string;
@@ -213,9 +254,13 @@ export type HistoryRetention = {
213
254
  };
214
255
  export type Retention = {
215
256
  history: HistoryRetention;
216
- outcome: number;
217
257
  refreshHorizon: number;
218
258
  };
259
+ export type QueriedRoom = {
260
+ readonly locator: string;
261
+ readonly handle: string;
262
+ readonly name: string;
263
+ };
219
264
  export type Discovery = {
220
265
  kind: 'discovery';
221
266
  rooms: readonly DiscoveredRoom[];
@@ -223,13 +268,13 @@ export type Discovery = {
223
268
  providerLimits: readonly ProviderLimit[];
224
269
  retention: Retention;
225
270
  member?: Member;
226
- covered?: readonly string[];
227
- };
228
- export type DiscoveryScope = {
229
- readonly authorities: readonly string[];
271
+ timeZone?: string | null;
272
+ roomList?: RoomList;
273
+ queriesOnly?: readonly QueriedRoom[];
230
274
  };
231
275
  export type TransportUncertainty = {
232
276
  kind: 'transport-uncertainty';
277
+ failure?: unknown;
233
278
  };
234
279
  export type RoomNotReadable = {
235
280
  kind: 'room-not-readable';
@@ -255,7 +300,7 @@ export type ContractUnavailable = ProviderRefusal & {
255
300
  export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
256
301
  export type PageToken = string;
257
302
  export type ChangeAuthor = {
258
- kind: Open<'user' | 'site' | 'inbox'>;
303
+ kind: Open<'user' | 'site' | 'inbox' | 'app'>;
259
304
  id: string;
260
305
  name: string;
261
306
  };
@@ -273,27 +318,18 @@ export type BinaryFile = {
273
318
  mediaType: string;
274
319
  sha256: string;
275
320
  };
276
- export type HeldFile = {
277
- readonly path: string;
278
- readonly revision: string;
279
- };
280
- export type HeldContent = {
281
- files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
282
- contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
283
- readonly content: string;
284
- readonly revision: string;
285
- }>>;
286
- };
287
321
  export type BootstrapRequest = {
288
322
  locator: string;
289
323
  selection: string;
290
324
  pageToken?: PageToken;
291
- held?: HeldContent;
292
- received?: Uint8Array;
293
325
  arriving?: (bytes: number) => void;
326
+ signal?: AbortSignal;
327
+ };
328
+ export type BootstrapPart = {
329
+ readonly id: string;
330
+ readonly bytes: number;
294
331
  };
295
332
  export type BootstrapInventory = {
296
- readonly parts: number;
297
333
  readonly bytes: number;
298
334
  };
299
335
  export type RoomModels = {
@@ -304,18 +340,23 @@ export type BootstrapPage = {
304
340
  roomVersion: string;
305
341
  models?: RoomModels;
306
342
  documents: Readonly<Record<string, string>>;
343
+ facts: Readonly<Record<string, SavedFacts>>;
307
344
  revisions: Readonly<Record<string, string>>;
308
345
  fileIds?: Readonly<Record<string, string>>;
346
+ created?: Readonly<Record<string, string>>;
309
347
  changes: Readonly<Record<string, HeadChange>>;
310
348
  binaryFiles: Readonly<Record<string, BinaryFile>>;
311
349
  folders?: readonly string[];
312
350
  pageToken?: PageToken;
313
- inventory?: BootstrapInventory;
314
- received?: Uint8Array;
351
+ parts?: readonly BootstrapPart[];
352
+ bytes?: number;
353
+ };
354
+ export type NotReady = {
355
+ kind: 'not-ready';
315
356
  };
316
357
  export type BootstrapResult = BootstrapPage | {
317
358
  kind: 'beyond-horizon';
318
- } | AdapterFailure;
359
+ } | NotReady | AdapterFailure;
319
360
  export type RefreshRequest = {
320
361
  locator: string;
321
362
  selection: string;
@@ -327,8 +368,10 @@ export type RefreshPage = {
327
368
  roomVersion: string;
328
369
  models?: RoomModels;
329
370
  documents: Readonly<Record<string, string>>;
371
+ facts: Readonly<Record<string, SavedFacts>>;
330
372
  revisions: Readonly<Record<string, string>>;
331
373
  fileIds?: Readonly<Record<string, string>>;
374
+ created?: Readonly<Record<string, string>>;
332
375
  changes: Readonly<Record<string, HeadChange>>;
333
376
  binaryFiles: Readonly<Record<string, BinaryFile>>;
334
377
  removals: readonly string[];
@@ -366,27 +409,18 @@ export type AcceptedRoom = {
366
409
  };
367
410
  export type MutationResult = (AcceptedRoom & {
368
411
  kind: 'accepted';
369
- author?: string;
370
- time?: string;
371
412
  destination?: AcceptedRoom;
372
413
  }) | (ProviderRefusal & {
373
414
  kind: 'conflicted';
374
- roomVersion?: string;
375
415
  affected: Readonly<Record<string, string>>;
376
416
  }) | (ProviderRefusal & {
377
417
  kind: 'rejected';
378
418
  affected: Readonly<Record<string, string>>;
379
419
  }) | RetryableRefusal | {
380
420
  kind: 'write-halted';
381
- } | {
382
- kind: 'expired';
383
- restored?: true;
384
421
  } | AdapterFailure;
385
422
  export type HistoryAuthor = {
386
- kind: 'user';
387
- id: string;
388
- } | {
389
- kind: 'site' | 'inbox';
423
+ kind: 'user' | 'site' | 'inbox' | 'app';
390
424
  id: string;
391
425
  name: string;
392
426
  };
@@ -419,6 +453,10 @@ export type BinaryRequest = {
419
453
  path: string;
420
454
  revision: string;
421
455
  };
456
+ export type KeyedRequest = {
457
+ kind: 'key';
458
+ link: string;
459
+ };
422
460
  export type BinaryResult = {
423
461
  kind: 'binary';
424
462
  body: ReadableStream<Uint8Array>;
@@ -436,7 +474,7 @@ export type BinaryLinkResult = {
436
474
  kind: 'rejected';
437
475
  }) | AdapterFailure;
438
476
  export type AttachRequest = {
439
- locator: string;
477
+ locator?: string;
440
478
  name: string;
441
479
  mediaType: string;
442
480
  byteLength: number;
@@ -447,6 +485,9 @@ export type AttachResult = {
447
485
  kind: 'attached';
448
486
  path: string;
449
487
  revision: string;
488
+ } | {
489
+ kind: 'linked';
490
+ link: string;
450
491
  } | (ProviderRefusal & {
451
492
  kind: 'rejected';
452
493
  }) | AdapterFailure;
@@ -462,69 +503,101 @@ export type ActionResult = {
462
503
  kind: 'action';
463
504
  result: unknown;
464
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;
465
534
  } | (ProviderRefusal & {
466
535
  kind: 'rejected';
467
536
  }) | AdapterFailure;
468
537
  export type HeldRoom = {
469
538
  locator: string;
539
+ roomVersion: string | null;
540
+ };
541
+ export type RoomChange = {
542
+ kind: 'room-change';
543
+ locator: string;
544
+ from: string | null;
470
545
  roomVersion: string;
546
+ read(): Promise<RefreshPage>;
547
+ };
548
+ export type AuthorityChange = {
549
+ kind: 'authority-changed';
550
+ rooms: readonly DiscoveredRoom[];
551
+ left: readonly string[];
552
+ member?: Member;
553
+ timeZone?: string | null;
554
+ roomList?: RoomList & {
555
+ readonly left: readonly string[];
556
+ };
471
557
  };
472
- export type HeldRevisions = (locator: string, paths: readonly string[]) => Promise<ReadonlyMap<string, string>>;
473
558
  export type RoomStreamEvent = {
474
559
  kind: 'opened';
560
+ } | {
561
+ kind: 'discovered';
562
+ discovery: Discovery;
475
563
  } | {
476
564
  kind: 'closed';
477
565
  revoked: boolean;
478
566
  lost: boolean;
567
+ authorityChanged: boolean;
479
568
  } | {
480
- kind: 'opening';
569
+ kind: 'caught-up';
481
570
  expired: readonly string[];
482
571
  } | {
483
- kind: 'authority-changed';
484
- scope?: DiscoveryScope;
485
- } | {
486
- kind: 'room-version';
487
- locator: string;
488
- roomVersion: string;
489
- };
490
- export type KeptReceipt = {
491
- key: string;
492
- head: unknown;
493
- };
494
- export type StreamReceipts = {
495
- heads(): Promise<readonly KeptReceipt[]>;
496
- parts(key: string, count: number): Promise<readonly unknown[]>;
497
- keep(key: string, head: unknown, part?: {
498
- index: number;
499
- value: unknown;
500
- }): Promise<void>;
501
- drop(keys: readonly string[]): Promise<void>;
502
- };
572
+ kind: 'reported';
573
+ } | AuthorityChange | RoomChange;
503
574
  export type RoomStream = {
504
575
  hold(rooms: readonly HeldRoom[]): void;
505
- reopen(): void;
506
- published(locator: string, roomVersion: string): void;
507
- observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts, revisions: HeldRevisions): () => void;
576
+ observe(notify: (event: RoomStreamEvent) => void): () => void;
508
577
  };
578
+ export type PathRule = (path: string) => boolean;
509
579
  export type Adapter = {
510
580
  readonly localSaves?: true;
511
- readonly exhaustiveDiscovery?: 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
- discover(authorization: Authorization, scope?: DiscoveryScope): Promise<DiscoverResult>;
587
+ discover?(authorization: Authorization): Promise<DiscoverResult>;
516
588
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
517
- refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
589
+ refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
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 {};