@agentshouse/app-bridge 0.1.0-c8d8dc6285bbd → 0.1.0-c8d97d63f2350
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.d.ts +844 -17
- package/dist/mdmodel/condition.d.ts +9 -2
- package/dist/mdmodel/index.d.ts +2 -2
- package/dist/mdruntime/adapter.d.ts +65 -49
- package/dist/mdruntime/client.d.ts +6 -7
- package/dist/mdruntime/collection.d.ts +5 -3
- package/dist/mdruntime/connection.d.ts +5 -4
- package/dist/mdruntime/conversation.d.ts +11 -11
- package/dist/mdruntime/durability.d.ts +0 -1
- package/dist/mdruntime/media.d.ts +7 -0
- package/dist/mdruntime/model.d.ts +6 -1
- package/dist/mdruntime/observation.d.ts +1 -0
- package/dist/mdruntime/outcome.d.ts +13 -5
- package/dist/mdruntime/query.d.ts +6 -0
- package/dist/mdruntime/reach.d.ts +8 -1
- package/dist/mdruntime/readiness.d.ts +3 -15
- package/dist/mdruntime/recovery.d.ts +1 -0
- package/dist/mdruntime/replica.d.ts +3 -5
- package/dist/mdruntime/room-draft.d.ts +17 -2
- package/dist/mdruntime/save.d.ts +2 -0
- package/dist/mdruntime/status.d.ts +4 -3
- package/dist/mdruntime/store.d.ts +18 -33
- package/dist/mdruntime/stored.d.ts +9 -24
- package/dist/mdruntime/tables.d.ts +16 -45
- package/dist/mdruntime/wire.d.ts +8 -8
- package/dist/test-host.d.ts +1 -4
- package/dist/test-host.js +1 -27
- package/docs/families.md +30 -46
- package/package.json +1 -1
- package/dist/calls.d.ts +0 -1007
- package/dist/calls.js +0 -1
- package/dist/mdruntime/file.d.ts +0 -11
- package/dist/mdruntime/shared.d.ts +0 -15
- package/dist/mdruntime/transfer.d.ts +0 -9
|
@@ -76,7 +76,11 @@ export type DateCondition = {
|
|
|
76
76
|
readonly time_zone: string;
|
|
77
77
|
readonly match?: ConditionTest;
|
|
78
78
|
};
|
|
79
|
-
export type
|
|
79
|
+
export type NotificationCondition = {
|
|
80
|
+
readonly on: 'notifications';
|
|
81
|
+
readonly match?: ConditionTest;
|
|
82
|
+
};
|
|
83
|
+
export type Condition = DocumentCondition | ItemCondition | CronCondition | DateCondition | NotificationCondition;
|
|
80
84
|
export type FactKind = 'string' | 'number' | 'boolean' | 'date' | 'time' | 'enum' | 'reference';
|
|
81
85
|
type Scalar = string | number | boolean;
|
|
82
86
|
export type Fact = {
|
|
@@ -103,11 +107,13 @@ export type DocumentFacts = {
|
|
|
103
107
|
readonly fields: Readonly<Record<string, Fact>>;
|
|
104
108
|
readonly sections: readonly string[];
|
|
105
109
|
};
|
|
106
|
-
export declare const
|
|
110
|
+
export declare const TEXT_FIELD = "/text";
|
|
111
|
+
export declare const WRITE_DOORS: readonly ['browser', 'agent', 'client', 'function'];
|
|
107
112
|
export type WriteDoor = (typeof WRITE_DOORS)[number];
|
|
108
113
|
export type Actor = {
|
|
109
114
|
readonly user?: string;
|
|
110
115
|
readonly site?: string;
|
|
116
|
+
readonly app?: string;
|
|
111
117
|
readonly door?: WriteDoor;
|
|
112
118
|
};
|
|
113
119
|
export type DocumentEvent = {
|
|
@@ -157,4 +163,5 @@ export declare function members(document: DocumentFacts, path: string): readonly
|
|
|
157
163
|
export declare function holds(test: ConditionTest, document: DocumentFacts): Truth;
|
|
158
164
|
export declare function fires(condition: DocumentCondition, event: DocumentEvent): boolean;
|
|
159
165
|
export declare function itemFires(condition: ItemCondition, item: ItemFacts): boolean;
|
|
166
|
+
export declare function notificationFires(condition: NotificationCondition, notification: DocumentFacts): boolean;
|
|
160
167
|
export {};
|
package/dist/mdmodel/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ACTOR_PATHS, actorOperators, changeFields, CONDITION_OPERATORS, dated, datePointers, DOCUMENT_PATHS, factKind, facts, fires, holds, instant, ITEM_PATHS, itemFires, itemKind, itemOperators, memberPointers, members, pointed, prosePaths, testOperators, valuedChange, WRITE_DOORS, } from './condition.js';
|
|
2
|
-
export type { Actor, Condition, ConditionOperator, ConditionScope, ConditionTest, ConditionValue, CronCondition, DateCondition, DocumentCondition, DocumentEvent, DocumentFacts, Fact, FactKind, ItemCondition, ItemFacts, Resolved, WriteDoor, } from './condition.js';
|
|
1
|
+
export { ACTOR_PATHS, actorOperators, changeFields, CONDITION_OPERATORS, dated, datePointers, DOCUMENT_PATHS, factKind, facts, fires, holds, instant, ITEM_PATHS, itemFires, itemKind, itemOperators, memberPointers, members, notificationFires, pointed, prosePaths, testOperators, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './condition.js';
|
|
2
|
+
export type { Actor, Condition, ConditionOperator, ConditionScope, ConditionTest, ConditionValue, CronCondition, DateCondition, DocumentCondition, DocumentEvent, DocumentFacts, Fact, FactKind, ItemCondition, ItemFacts, NotificationCondition, Resolved, WriteDoor, } from './condition.js';
|
|
3
3
|
export { headingLines } from './blocks.js';
|
|
4
4
|
export type { HeadingLine } from './blocks.js';
|
|
5
5
|
export { divide } from './divide.js';
|
|
@@ -32,25 +32,20 @@ export type Capability = {
|
|
|
32
32
|
name: string;
|
|
33
33
|
limits?: readonly ProviderLimit[];
|
|
34
34
|
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
35
|
};
|
|
44
36
|
export type ListedConversation = {
|
|
45
37
|
conversation: string;
|
|
46
38
|
agent: string;
|
|
39
|
+
agentName: string;
|
|
40
|
+
agentRetired: boolean;
|
|
47
41
|
name: string;
|
|
48
42
|
created: string;
|
|
49
43
|
finished: string | null;
|
|
50
44
|
outcome: string | null;
|
|
51
45
|
waiting: boolean;
|
|
46
|
+
newest: string | null;
|
|
52
47
|
};
|
|
53
|
-
export type ConversationAction = '
|
|
48
|
+
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
|
|
54
49
|
export type ConversationMessage = {
|
|
55
50
|
identity: string;
|
|
56
51
|
turn: string;
|
|
@@ -141,6 +136,10 @@ export type SessionOption = (SessionOptionNaming & {
|
|
|
141
136
|
type: 'boolean';
|
|
142
137
|
currentValue: boolean;
|
|
143
138
|
});
|
|
139
|
+
export type RunningSubagent = {
|
|
140
|
+
description: string;
|
|
141
|
+
activity: string | null;
|
|
142
|
+
};
|
|
144
143
|
export type ConversationEvent = {
|
|
145
144
|
kind: 'turn';
|
|
146
145
|
conversation: string;
|
|
@@ -166,6 +165,10 @@ export type ConversationEvent = {
|
|
|
166
165
|
kind: 'starting';
|
|
167
166
|
conversation: string;
|
|
168
167
|
step: string | null;
|
|
168
|
+
} | {
|
|
169
|
+
kind: 'subagents';
|
|
170
|
+
conversation: string;
|
|
171
|
+
subagents: readonly RunningSubagent[];
|
|
169
172
|
} | {
|
|
170
173
|
kind: 'link';
|
|
171
174
|
conversation: string;
|
|
@@ -184,6 +187,9 @@ export type ConversationEvent = {
|
|
|
184
187
|
} | {
|
|
185
188
|
kind: 'list';
|
|
186
189
|
entries: readonly ListedConversation[];
|
|
190
|
+
whole: boolean;
|
|
191
|
+
more: boolean;
|
|
192
|
+
cursor: string | null;
|
|
187
193
|
} | {
|
|
188
194
|
kind: 'listed';
|
|
189
195
|
entry: ListedConversation;
|
|
@@ -191,9 +197,17 @@ export type ConversationEvent = {
|
|
|
191
197
|
kind: 'unlisted';
|
|
192
198
|
conversation: string;
|
|
193
199
|
};
|
|
200
|
+
export type ListedAgent = {
|
|
201
|
+
agent: string;
|
|
202
|
+
name: string;
|
|
203
|
+
retired: boolean;
|
|
204
|
+
};
|
|
194
205
|
export type ConversationStream = {
|
|
195
206
|
replicate(conversations: readonly string[]): void;
|
|
207
|
+
hold(cursor: string | null): void;
|
|
196
208
|
observe(notify: (event: ConversationEvent) => void): () => void;
|
|
209
|
+
agents?(): Promise<readonly ListedAgent[] | null>;
|
|
210
|
+
history?(request: ConversationHistoryRequest): Promise<ActionResult>;
|
|
197
211
|
};
|
|
198
212
|
export type ActionDeclaration = {
|
|
199
213
|
name: string;
|
|
@@ -223,10 +237,6 @@ export type Discovery = {
|
|
|
223
237
|
providerLimits: readonly ProviderLimit[];
|
|
224
238
|
retention: Retention;
|
|
225
239
|
member?: Member;
|
|
226
|
-
covered?: readonly string[];
|
|
227
|
-
};
|
|
228
|
-
export type DiscoveryScope = {
|
|
229
|
-
readonly authorities: readonly string[];
|
|
230
240
|
};
|
|
231
241
|
export type TransportUncertainty = {
|
|
232
242
|
kind: 'transport-uncertainty';
|
|
@@ -255,7 +265,7 @@ export type ContractUnavailable = ProviderRefusal & {
|
|
|
255
265
|
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
256
266
|
export type PageToken = string;
|
|
257
267
|
export type ChangeAuthor = {
|
|
258
|
-
kind: Open<'user' | 'site' | 'inbox'>;
|
|
268
|
+
kind: Open<'user' | 'site' | 'inbox' | 'app'>;
|
|
259
269
|
id: string;
|
|
260
270
|
name: string;
|
|
261
271
|
};
|
|
@@ -289,16 +299,14 @@ export type BootstrapRequest = {
|
|
|
289
299
|
selection: string;
|
|
290
300
|
pageToken?: PageToken;
|
|
291
301
|
held?: HeldContent;
|
|
292
|
-
received?: Uint8Array;
|
|
293
302
|
arriving?: (bytes: number) => void;
|
|
303
|
+
signal?: AbortSignal;
|
|
294
304
|
};
|
|
295
305
|
export type BootstrapInventory = {
|
|
296
|
-
readonly parts: number;
|
|
297
306
|
readonly bytes: number;
|
|
298
307
|
};
|
|
299
308
|
export type RoomModels = {
|
|
300
309
|
collection?: ModelResult;
|
|
301
|
-
selection?: ModelResult;
|
|
302
310
|
};
|
|
303
311
|
export type BootstrapPage = {
|
|
304
312
|
kind: 'bootstrap';
|
|
@@ -311,8 +319,7 @@ export type BootstrapPage = {
|
|
|
311
319
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
312
320
|
folders?: readonly string[];
|
|
313
321
|
pageToken?: PageToken;
|
|
314
|
-
|
|
315
|
-
received?: Uint8Array;
|
|
322
|
+
bytes?: number;
|
|
316
323
|
};
|
|
317
324
|
export type BootstrapResult = BootstrapPage | {
|
|
318
325
|
kind: 'beyond-horizon';
|
|
@@ -387,7 +394,7 @@ export type HistoryAuthor = {
|
|
|
387
394
|
kind: 'user';
|
|
388
395
|
id: string;
|
|
389
396
|
} | {
|
|
390
|
-
kind: 'site' | 'inbox';
|
|
397
|
+
kind: 'site' | 'inbox' | 'app';
|
|
391
398
|
id: string;
|
|
392
399
|
name: string;
|
|
393
400
|
};
|
|
@@ -432,6 +439,22 @@ export type BinaryLinkResult = {
|
|
|
432
439
|
kind: 'link';
|
|
433
440
|
url: string;
|
|
434
441
|
name: string;
|
|
442
|
+
mediaType?: string;
|
|
443
|
+
} | (ProviderRefusal & {
|
|
444
|
+
kind: 'rejected';
|
|
445
|
+
}) | AdapterFailure;
|
|
446
|
+
export type AttachRequest = {
|
|
447
|
+
locator: string;
|
|
448
|
+
name: string;
|
|
449
|
+
mediaType: string;
|
|
450
|
+
byteLength: number;
|
|
451
|
+
sha256: string;
|
|
452
|
+
blob: Blob;
|
|
453
|
+
};
|
|
454
|
+
export type AttachResult = {
|
|
455
|
+
kind: 'attached';
|
|
456
|
+
path: string;
|
|
457
|
+
revision: string;
|
|
435
458
|
} | (ProviderRefusal & {
|
|
436
459
|
kind: 'rejected';
|
|
437
460
|
}) | AdapterFailure;
|
|
@@ -454,56 +477,49 @@ export type HeldRoom = {
|
|
|
454
477
|
locator: string;
|
|
455
478
|
roomVersion: string;
|
|
456
479
|
};
|
|
457
|
-
export type
|
|
480
|
+
export type RoomChange = {
|
|
481
|
+
kind: 'room-change';
|
|
482
|
+
locator: string;
|
|
483
|
+
from: string;
|
|
484
|
+
roomVersion: string;
|
|
485
|
+
read(): Promise<RefreshPage>;
|
|
486
|
+
};
|
|
487
|
+
export type AuthorityChange = {
|
|
488
|
+
kind: 'authority-changed';
|
|
489
|
+
rooms: readonly DiscoveredRoom[];
|
|
490
|
+
left: readonly string[];
|
|
491
|
+
member?: Member;
|
|
492
|
+
};
|
|
458
493
|
export type RoomStreamEvent = {
|
|
459
494
|
kind: 'opened';
|
|
495
|
+
} | {
|
|
496
|
+
kind: 'discovered';
|
|
497
|
+
discovery: Discovery;
|
|
460
498
|
} | {
|
|
461
499
|
kind: 'closed';
|
|
462
500
|
revoked: boolean;
|
|
463
501
|
lost: boolean;
|
|
464
502
|
} | {
|
|
465
|
-
kind: '
|
|
503
|
+
kind: 'caught-up';
|
|
466
504
|
expired: readonly string[];
|
|
467
|
-
} |
|
|
468
|
-
kind: 'authority-changed';
|
|
469
|
-
scope?: DiscoveryScope;
|
|
470
|
-
} | {
|
|
471
|
-
kind: 'room-version';
|
|
472
|
-
locator: string;
|
|
473
|
-
roomVersion: string;
|
|
474
|
-
};
|
|
475
|
-
export type KeptReceipt = {
|
|
476
|
-
key: string;
|
|
477
|
-
head: unknown;
|
|
478
|
-
};
|
|
479
|
-
export type StreamReceipts = {
|
|
480
|
-
heads(): Promise<readonly KeptReceipt[]>;
|
|
481
|
-
parts(key: string, count: number): Promise<readonly unknown[]>;
|
|
482
|
-
keep(key: string, head: unknown, part?: {
|
|
483
|
-
index: number;
|
|
484
|
-
value: unknown;
|
|
485
|
-
}): Promise<void>;
|
|
486
|
-
drop(keys: readonly string[]): Promise<void>;
|
|
487
|
-
};
|
|
505
|
+
} | AuthorityChange | RoomChange;
|
|
488
506
|
export type RoomStream = {
|
|
489
507
|
hold(rooms: readonly HeldRoom[]): void;
|
|
490
|
-
|
|
491
|
-
published(locator: string, roomVersion: string): void;
|
|
492
|
-
observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts, revisions: HeldRevisions): () => void;
|
|
508
|
+
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
493
509
|
};
|
|
494
510
|
export type Adapter = {
|
|
495
511
|
readonly localSaves?: true;
|
|
496
|
-
readonly exhaustiveDiscovery?: true;
|
|
497
512
|
readonly roomTypes?: string;
|
|
498
513
|
readonly nameableRoomTypes?: readonly string[];
|
|
499
514
|
authorize(): Promise<Authorization>;
|
|
500
|
-
discover(authorization: Authorization
|
|
515
|
+
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
501
516
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
502
|
-
refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
517
|
+
refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
503
518
|
mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
|
|
504
519
|
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
505
520
|
binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
|
|
506
521
|
link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
|
|
522
|
+
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
507
523
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
508
524
|
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
509
525
|
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult } from './connection.js';
|
|
2
2
|
import type { Member, ServiceMode } from './adapter.js';
|
|
3
|
-
import type { ChatDraft, ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
|
|
3
|
+
import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
|
|
4
4
|
import { type Observation } from './observation.js';
|
|
5
|
-
import type {
|
|
6
|
-
import type { BinaryAnswer, BinaryLinkAnswer, CallResult, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
|
|
5
|
+
import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
|
|
7
6
|
import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
|
|
8
7
|
import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
|
|
9
8
|
import type { SearchRequest, SearchResult } from './search.js';
|
|
@@ -36,11 +35,9 @@ export type MdRuntimeClient = {
|
|
|
36
35
|
read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
|
|
37
36
|
create(input: unknown): Promise<CallResult>;
|
|
38
37
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
39
|
-
|
|
40
|
-
answer(conversation: string, answer: unknown): Promise<CallResult>;
|
|
38
|
+
answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
|
|
41
39
|
interrupt(conversation: string): Promise<CallResult>;
|
|
42
40
|
kill(conversation: string): Promise<CallResult>;
|
|
43
|
-
cancel(conversation: string, turn: string): Promise<CallResult>;
|
|
44
41
|
delete(conversation: string): Promise<CallResult>;
|
|
45
42
|
};
|
|
46
43
|
chatDraft: {
|
|
@@ -52,7 +49,8 @@ export type MdRuntimeClient = {
|
|
|
52
49
|
resolve(room: string, path: string, destination: string): Promise<Resolution>;
|
|
53
50
|
binaryFile: {
|
|
54
51
|
read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
|
|
55
|
-
|
|
52
|
+
attach(room: string, file: File): Promise<AttachAnswer>;
|
|
53
|
+
download(room: string, path: string, revision?: string): Promise<DownloadAnswer>;
|
|
56
54
|
};
|
|
57
55
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
58
56
|
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
@@ -85,6 +83,7 @@ export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
|
|
|
85
83
|
export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
|
|
86
84
|
export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
|
|
87
85
|
export { roomDraftRevision } from './identity.js';
|
|
86
|
+
export { defineRoomMedia, ROOM_MEDIA } from './media.js';
|
|
88
87
|
export type { Observation } from './observation.js';
|
|
89
88
|
export type { Open } from './open.js';
|
|
90
89
|
export { unanswered, type RuntimePort, type WireMember } from './wire.js';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { type Document } from '../mdmodel/index.js';
|
|
2
2
|
import type { ModelState } from './model.js';
|
|
3
3
|
import type { MdModelIdentity } from './adapter.js';
|
|
4
|
-
import { type Paths } from './shared.js';
|
|
5
|
-
import type { Refused } from './transfer.js';
|
|
6
4
|
export declare const MD_MODEL: MdModelIdentity;
|
|
7
5
|
export type Collection = {
|
|
8
6
|
text: Readonly<Record<string, string>>;
|
|
@@ -16,10 +14,14 @@ export type Composition = {
|
|
|
16
14
|
model: ModelState;
|
|
17
15
|
} | null;
|
|
18
16
|
};
|
|
17
|
+
export type Composed = {
|
|
18
|
+
readonly composition: Composition;
|
|
19
|
+
readonly fingerprint: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function composedOf(composition: Composition): Composed;
|
|
19
22
|
export declare function selected(composition: Composition, path: string): boolean;
|
|
20
23
|
export declare function governing(composition: Composition, path: string): ModelState;
|
|
21
24
|
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
|
|
22
25
|
export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
|
|
23
|
-
export declare function unreadable(text: Paths<string>, paths?: Iterable<string> | null): Generator<number, Refused | null, void>;
|
|
24
26
|
export declare function validRoot(root: unknown): root is string;
|
|
25
27
|
export declare function available(composition: Composition): boolean;
|
|
@@ -7,7 +7,7 @@ import { type Adapter, type Authorization, type Member, type ProviderRefusal, ty
|
|
|
7
7
|
import { type ChatDraftSurface, type ConversationAgent, type ConversationEntry, type ConversationOptions, type ConversationSurface, type ConversationView } from './conversation.js';
|
|
8
8
|
import { type WrittenBy } from './change.js';
|
|
9
9
|
import type { Open } from './open.js';
|
|
10
|
-
import { type BinaryLinkAnswer, type CallResult, type HeldBinaryAnswer, type HistoryAnswer, type QueueEntry, type Resolution } from './outcome.js';
|
|
10
|
+
import { type AttachAnswer, type BinaryLinkAnswer, type CallResult, type HeldBinaryAnswer, type HeldShownAnswer, type HistoryAnswer, type QueueEntry, type Resolution } from './outcome.js';
|
|
11
11
|
import { type Recovery } from './recovery.js';
|
|
12
12
|
import { type SaveRefusal } from './save.js';
|
|
13
13
|
import { type RoomDraft, type RoomDraftParts, type RoomDraftWrite } from './room-draft.js';
|
|
@@ -54,6 +54,7 @@ export type MdRuntimeOptions = {
|
|
|
54
54
|
authorization?: Authorization;
|
|
55
55
|
signal?: AbortSignal;
|
|
56
56
|
recovery?: Recovery;
|
|
57
|
+
usableWhenHeld?: readonly string[];
|
|
57
58
|
};
|
|
58
59
|
export type SaveResult = {
|
|
59
60
|
outcome: 'saved';
|
|
@@ -83,6 +84,8 @@ export type PresentationSurface = {
|
|
|
83
84
|
export type BinaryFileSurface = {
|
|
84
85
|
read(room: string, path: string, revision?: string): Promise<HeldBinaryAnswer>;
|
|
85
86
|
link(room: string, path: string, revision?: string): Promise<BinaryLinkAnswer>;
|
|
87
|
+
show(room: string, path: string, revision?: string): Promise<HeldShownAnswer>;
|
|
88
|
+
attach(room: string, file: File): Promise<AttachAnswer>;
|
|
86
89
|
part(file: string, part: number): Promise<Uint8Array | null>;
|
|
87
90
|
};
|
|
88
91
|
export type HistoryQuery = {
|
|
@@ -91,7 +94,7 @@ export type HistoryQuery = {
|
|
|
91
94
|
};
|
|
92
95
|
export type MdRuntime = {
|
|
93
96
|
loaded(): Promise<void>;
|
|
94
|
-
rooms(): readonly AppRoom[]
|
|
97
|
+
rooms(): Promise<readonly AppRoom[]>;
|
|
95
98
|
query: {
|
|
96
99
|
(query: DocumentQuery): Promise<DocumentResult | PendingResult>;
|
|
97
100
|
(query: GroupQuery): Promise<GroupResult | PendingResult>;
|
|
@@ -142,9 +145,7 @@ export type ReadinessPort = {
|
|
|
142
145
|
export type ComposedRuntime = RuntimeView & {
|
|
143
146
|
seed(entry: EntrySeed): void;
|
|
144
147
|
stop(): Promise<void>;
|
|
145
|
-
lose(locators: readonly string[]): Promise<void>;
|
|
146
148
|
persisted(answer: Persistence): void;
|
|
147
|
-
shown(onScreen: boolean): void;
|
|
148
149
|
within(reach: PortReach | null, port: ReadinessPort): NarrowedView;
|
|
149
150
|
};
|
|
150
151
|
export declare function composeRuntime(options: MdRuntimeOptions): ComposedRuntime;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { ConversationAction,
|
|
1
|
+
import type { ConversationAction, ConversationEvent, ConversationHistoryRequest, ConversationMessage, ConversationStream, ListedConversation, ProcessCommand, RunningSubagent, SessionOption, TurnContext } from './adapter.js';
|
|
2
2
|
import { type ChangeSet } from './change-set.js';
|
|
3
|
-
import { type ChosenFile } from './file.js';
|
|
4
3
|
import type { Open } from './open.js';
|
|
5
4
|
import { type CallResult, type Offline } from './outcome.js';
|
|
6
|
-
import type { DocumentResult, PendingResult } from './query.js';
|
|
7
5
|
import type { CycleProgress } from './status.js';
|
|
8
6
|
import type { ChatDraftRecord, HeldConversation, RuntimeStore } from './store.js';
|
|
9
7
|
export type ConversationState = Open<'working' | 'asking' | 'idle'>;
|
|
@@ -11,7 +9,7 @@ export type ConversationEntry = {
|
|
|
11
9
|
conversation: string;
|
|
12
10
|
agent: {
|
|
13
11
|
identity: string;
|
|
14
|
-
name: string
|
|
12
|
+
name: string;
|
|
15
13
|
};
|
|
16
14
|
name: string;
|
|
17
15
|
created: string;
|
|
@@ -52,6 +50,7 @@ export type ConversationView = {
|
|
|
52
50
|
commands: readonly ProcessCommand[];
|
|
53
51
|
options: readonly SessionOption[];
|
|
54
52
|
starting: string | null;
|
|
53
|
+
subagents: readonly RunningSubagent[];
|
|
55
54
|
link: {
|
|
56
55
|
connected: boolean;
|
|
57
56
|
} | null;
|
|
@@ -65,22 +64,23 @@ export type ConversationSurface = {
|
|
|
65
64
|
read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
|
|
66
65
|
create(input: unknown): Promise<CallResult>;
|
|
67
66
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
68
|
-
|
|
69
|
-
answer(conversation: string, answer: unknown): Promise<CallResult>;
|
|
67
|
+
answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
|
|
70
68
|
interrupt(conversation: string): Promise<CallResult>;
|
|
71
69
|
kill(conversation: string): Promise<CallResult>;
|
|
72
|
-
cancel(conversation: string, turn: string): Promise<CallResult>;
|
|
73
70
|
delete(conversation: string): Promise<CallResult>;
|
|
74
71
|
};
|
|
72
|
+
export type ConversationAnswer = {
|
|
73
|
+
interaction_id: string;
|
|
74
|
+
response: unknown;
|
|
75
|
+
};
|
|
75
76
|
export type ChatDraftSurface = {
|
|
76
77
|
write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
|
|
77
78
|
prepend(conversation: string, draft: ChatDraft): Promise<void>;
|
|
78
79
|
discard(conversation: string): Promise<void>;
|
|
79
80
|
};
|
|
80
81
|
export type ConversationDependencies = {
|
|
81
|
-
agents(): ConversationAgents | undefined;
|
|
82
|
-
documents(agents: ConversationAgents, after: string | undefined): Promise<DocumentResult | PendingResult>;
|
|
83
82
|
call(name: ConversationAction, input: unknown): Promise<CallResult>;
|
|
83
|
+
history(request: ConversationHistoryRequest): Promise<CallResult>;
|
|
84
84
|
durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
|
|
85
85
|
stream(): ConversationStream | undefined;
|
|
86
86
|
publish(set: ChangeSet): void;
|
|
@@ -93,13 +93,13 @@ export type ConversationDependencies = {
|
|
|
93
93
|
export type ConversationStore = {
|
|
94
94
|
surface: ConversationSurface;
|
|
95
95
|
chatDraft: ChatDraftSurface;
|
|
96
|
-
hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[]): void;
|
|
96
|
+
hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[], list: readonly ListedConversation[] | null, cursor: string | null): void;
|
|
97
97
|
reconcile(): Promise<void>;
|
|
98
98
|
catchUp(progress: CycleProgress): Promise<void>;
|
|
99
99
|
resend(progress: CycleProgress): Promise<void>;
|
|
100
100
|
current(): boolean;
|
|
101
101
|
known(): boolean;
|
|
102
|
-
|
|
102
|
+
learned(): void;
|
|
103
103
|
reopened(): void;
|
|
104
104
|
lost(): void;
|
|
105
105
|
watch(conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
|
|
@@ -2,7 +2,6 @@ import type { Persistence } from './readiness.js';
|
|
|
2
2
|
export type RuntimeShell = {
|
|
3
3
|
persistence: Persistence;
|
|
4
4
|
generation: string | null;
|
|
5
|
-
onScreen: boolean;
|
|
6
5
|
keepGeneration(value: string): void | Promise<void>;
|
|
7
6
|
dropGeneration(): void | Promise<void>;
|
|
8
7
|
cleanUp?(): Promise<number>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MdRuntimeClient } from './client.js';
|
|
2
|
+
import { type ShownAnswer } from './outcome.js';
|
|
3
|
+
export declare const ROOM_MEDIA = "room-media";
|
|
4
|
+
type Show = (room: string, path: string, revision?: string) => Promise<ShownAnswer>;
|
|
5
|
+
export declare function shownBy(show: Show, client: MdRuntimeClient): MdRuntimeClient;
|
|
6
|
+
export declare function defineRoomMedia(client: Promise<MdRuntimeClient> | MdRuntimeClient, registry?: CustomElementRegistry): void;
|
|
7
|
+
export {};
|
|
@@ -28,6 +28,11 @@ export type ModelState = {
|
|
|
28
28
|
verifiedWith: ModelIdentity;
|
|
29
29
|
types: VerifiedModel['types'];
|
|
30
30
|
};
|
|
31
|
+
export type StoredModel = Extract<ModelState, {
|
|
32
|
+
status: 'unavailable';
|
|
33
|
+
}> | Omit<Extract<ModelState, {
|
|
34
|
+
status: 'current' | 'cached';
|
|
35
|
+
}>, 'types'>;
|
|
31
36
|
export type TypesResult = {
|
|
32
37
|
status: Open<'unavailable'>;
|
|
33
38
|
reason: ModelUnavailableReason;
|
|
@@ -51,7 +56,7 @@ export type ValidationReceipt = {
|
|
|
51
56
|
export declare const NO_MODEL: ModelState;
|
|
52
57
|
export declare function definitionOf(state: ModelState, type: string | undefined): Definition | undefined;
|
|
53
58
|
export declare function modelTypes(state: ModelState): TypesResult;
|
|
59
|
+
export declare function storedModel(state: ModelState): StoredModel;
|
|
54
60
|
export declare function cached(state: ModelState): ModelState;
|
|
55
61
|
export declare function sameModel(left: ModelIdentity, right: ModelIdentity): boolean;
|
|
56
|
-
export declare function sameTyping(left: ModelState, right: ModelState): boolean;
|
|
57
62
|
export declare function referenceField(facts: ValueFacts | undefined): boolean;
|
|
@@ -38,6 +38,7 @@ export type Digest = {
|
|
|
38
38
|
readonly next: string | undefined;
|
|
39
39
|
readonly total: number | undefined;
|
|
40
40
|
};
|
|
41
|
+
export declare function hashed(text: string): number;
|
|
41
42
|
export declare function digestOf({ result, keys }: KeyedResult): Digest;
|
|
42
43
|
export declare function digestApplied(digest: Digest, message: QueryMessage): Digest;
|
|
43
44
|
export declare function changeOf(previous: Digest, next: KeyedResult): QueryMessage | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionResult, AdapterFailure, BinaryLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
1
|
+
import type { ActionResult, AdapterFailure, AttachResult, BinaryLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
3
|
import type { KeptBinary, KeptResult } from './opened.js';
|
|
4
4
|
type Refused<Kind extends string> = ProviderRefusal & {
|
|
@@ -29,7 +29,17 @@ export type BinaryLinkAnswer = {
|
|
|
29
29
|
kind: 'link';
|
|
30
30
|
url: string;
|
|
31
31
|
name: string;
|
|
32
|
+
mediaType: string;
|
|
32
33
|
} | Refused<'rejected'> | Refused<'absent'> | Failure;
|
|
34
|
+
export type HeldShownAnswer = KeptBinary | BinaryLinkAnswer;
|
|
35
|
+
export type ShownAnswer = BinaryAnswer | BinaryLinkAnswer;
|
|
36
|
+
export type AttachAnswer = {
|
|
37
|
+
kind: 'attached';
|
|
38
|
+
path: string;
|
|
39
|
+
} | Offline | Refused<'rejected'> | Failure;
|
|
40
|
+
export type DownloadAnswer = {
|
|
41
|
+
kind: 'started';
|
|
42
|
+
} | Refused<'rejected'> | Refused<'absent'> | Refused<'blocked'> | Failure;
|
|
33
43
|
export type Resolution = {
|
|
34
44
|
readonly kind: 'document';
|
|
35
45
|
readonly room: string;
|
|
@@ -45,7 +55,8 @@ export declare const LOCKED_UNREADABLE: Refused<'unreadable'>;
|
|
|
45
55
|
export declare const ABSENT_TARGET: Refused<'absent'>;
|
|
46
56
|
export declare function absentBinary(path: string): Refused<'absent'>;
|
|
47
57
|
export declare function binaryAnswer(result: KeptResult): HeldBinaryAnswer;
|
|
48
|
-
export declare function binaryLinkAnswer(result: BinaryLinkResult): BinaryLinkAnswer;
|
|
58
|
+
export declare function binaryLinkAnswer(result: BinaryLinkResult, held?: string): BinaryLinkAnswer;
|
|
59
|
+
export declare function attachAnswer(result: AttachResult): AttachAnswer;
|
|
49
60
|
export declare const ROOM_LOCKED = "room-locked";
|
|
50
61
|
export declare function lockedRoom(locator: string): Refused<'room-locked'> & {
|
|
51
62
|
locator: string;
|
|
@@ -69,8 +80,5 @@ export type QueueEntry = {
|
|
|
69
80
|
readonly batch: ChangeBatch;
|
|
70
81
|
} & (Submission | {
|
|
71
82
|
readonly state: 'local';
|
|
72
|
-
} | {
|
|
73
|
-
readonly state: 'accepted';
|
|
74
|
-
readonly roomVersion: string;
|
|
75
83
|
});
|
|
76
84
|
export {};
|
|
@@ -232,9 +232,15 @@ export type GroupShape = {
|
|
|
232
232
|
direction: Direction;
|
|
233
233
|
}[];
|
|
234
234
|
};
|
|
235
|
+
export type PlanArea = {
|
|
236
|
+
room: string;
|
|
237
|
+
path: string;
|
|
238
|
+
open: readonly string[];
|
|
239
|
+
};
|
|
235
240
|
export type PlanReach = {
|
|
236
241
|
rooms: readonly string[];
|
|
237
242
|
documents: readonly string[];
|
|
243
|
+
areas: readonly PlanArea[];
|
|
238
244
|
};
|
|
239
245
|
export type Continuation = {
|
|
240
246
|
text: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MdRuntime, ReadinessPort, RuntimeTopic } from './connection.js';
|
|
1
|
+
import type { AppRoom, MdRuntime, ReadinessPort, RuntimeTopic } from './connection.js';
|
|
2
2
|
import type { Plan, PlanReach, QueryResult } from './query.js';
|
|
3
3
|
import type { Readiness } from './readiness.js';
|
|
4
4
|
import { type SearchResult } from './search.js';
|
|
@@ -6,9 +6,15 @@ export type ReachedDocument = {
|
|
|
6
6
|
readonly room: string;
|
|
7
7
|
readonly path: string;
|
|
8
8
|
};
|
|
9
|
+
export type ReachedArea = {
|
|
10
|
+
readonly room: string;
|
|
11
|
+
readonly path: string;
|
|
12
|
+
readonly open: readonly string[];
|
|
13
|
+
};
|
|
9
14
|
export type PortReach = {
|
|
10
15
|
readonly rooms: readonly string[];
|
|
11
16
|
readonly documents: readonly ReachedDocument[];
|
|
17
|
+
readonly areas?: readonly ReachedArea[];
|
|
12
18
|
readonly conversations: boolean;
|
|
13
19
|
};
|
|
14
20
|
export type Deliver = (message: unknown) => void;
|
|
@@ -31,6 +37,7 @@ export type Reachable = RuntimeView & {
|
|
|
31
37
|
lockedRooms(): readonly string[];
|
|
32
38
|
watchLocks(notify: () => void): () => void;
|
|
33
39
|
located(room: string, path: string, destination: string): ReachedDocument | null;
|
|
40
|
+
room(locator: string): AppRoom | undefined;
|
|
34
41
|
};
|
|
35
42
|
export declare function holds(reach: PortReach | null, room: string): boolean;
|
|
36
43
|
export declare function governs(reach: PortReach | null, room: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Open } from './open.js';
|
|
2
2
|
export type CodeAvailability = Open<'stored' | 'absent'>;
|
|
3
|
-
export type RoomPreparation = Open<'complete' | 'acquiring' | 'preparing' | '
|
|
3
|
+
export type RoomPreparation = Open<'complete' | 'acquiring' | 'preparing' | 'unadmitted'>;
|
|
4
4
|
export type RoomCoverage = {
|
|
5
5
|
readonly room: string;
|
|
6
6
|
readonly state: RoomPreparation;
|
|
@@ -19,28 +19,17 @@ export type Durability = Open<'persistent' | 'best-effort'>;
|
|
|
19
19
|
export type ConnectionAvailability = Open<'connected' | 'connecting' | 'unreachable'>;
|
|
20
20
|
export type HouseOutcome = Open<'open' | 'write-halted' | 'refused'>;
|
|
21
21
|
export type Space = Open<'full'>;
|
|
22
|
-
export type
|
|
23
|
-
readonly room: string;
|
|
24
|
-
readonly name: string;
|
|
25
|
-
readonly file: string;
|
|
26
|
-
readonly rule: string;
|
|
27
|
-
readonly location: string | null;
|
|
28
|
-
};
|
|
29
|
-
export type InstallationStep = Open<'listing' | 'downloading' | 'writing' | 'replaying'>;
|
|
30
|
-
export type InstallationPause = Open<'hidden'>;
|
|
22
|
+
export type InstallationStep = Open<'downloading' | 'writing' | 'replaying'>;
|
|
31
23
|
export type InstallationAmount = {
|
|
32
24
|
readonly done: number;
|
|
33
25
|
readonly total: number;
|
|
34
26
|
};
|
|
35
27
|
export type Installation = {
|
|
36
28
|
readonly step: InstallationStep | null;
|
|
37
|
-
readonly paused: InstallationPause | null;
|
|
38
29
|
readonly rooms: InstallationAmount;
|
|
39
|
-
readonly parts: InstallationAmount;
|
|
40
30
|
readonly bytes: InstallationAmount;
|
|
41
|
-
readonly received: InstallationAmount;
|
|
42
31
|
};
|
|
43
|
-
export type ReadinessStatus = Open<'preparing' | 'paused' | '
|
|
32
|
+
export type ReadinessStatus = Open<'preparing' | 'paused' | 'ready' | 'lost'>;
|
|
44
33
|
export type Readiness = {
|
|
45
34
|
readonly status: ReadinessStatus;
|
|
46
35
|
readonly ready: boolean;
|
|
@@ -53,7 +42,6 @@ export type Readiness = {
|
|
|
53
42
|
readonly house: HouseOutcome;
|
|
54
43
|
readonly space: Space | null;
|
|
55
44
|
readonly installation: Installation;
|
|
56
|
-
readonly refused: readonly RefusedRoom[];
|
|
57
45
|
readonly lost: boolean;
|
|
58
46
|
};
|
|
59
47
|
export type ReadinessFacts = Omit<Readiness, 'status' | 'ready' | 'usable' | 'durability' | 'coverage'> & {
|
|
@@ -21,4 +21,5 @@ export type Recovery = {
|
|
|
21
21
|
retire(): Promise<void>;
|
|
22
22
|
};
|
|
23
23
|
export declare function retryDelay(tries: number, firstMs?: number, maxMs?: number): number;
|
|
24
|
+
export declare function untilAnswered<T>(ask: () => Promise<T>, signal: AbortSignal, answered?: (answer: T) => boolean): Promise<T>;
|
|
24
25
|
export declare function createRecovery(options?: RecoveryOptions): Recovery;
|