@agentshouse/app-bridge 0.1.0-c8d97d63f2350 → 0.1.0-c8dd3de04bf64
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 +6 -6
- package/dist/index.d.ts +196 -132
- package/dist/mdmodel/definition.d.ts +1 -1
- package/dist/mdmodel/document.d.ts +2 -1
- package/dist/mdmodel/event.d.ts +77 -0
- package/dist/mdmodel/facts.d.ts +14 -0
- package/dist/mdmodel/index.d.ts +19 -7
- package/dist/mdmodel/kinds.d.ts +17 -0
- package/dist/mdmodel/pattern.d.ts +9 -0
- package/dist/mdmodel/query/language.d.ts +253 -0
- package/dist/mdmodel/query/match.d.ts +13 -0
- package/dist/mdmodel/query/rows.d.ts +31 -0
- package/dist/mdmodel/query/sql.d.ts +38 -0
- package/dist/mdmodel/reserved.d.ts +5 -0
- package/dist/mdmodel/types.d.ts +11 -0
- package/dist/mdmodel/validate.d.ts +7 -5
- package/dist/mdruntime/actions.d.ts +19 -0
- package/dist/mdruntime/adapter.d.ts +45 -25
- package/dist/mdruntime/attached-model.d.ts +7 -0
- package/dist/mdruntime/bootstrap.d.ts +43 -0
- package/dist/mdruntime/cell.d.ts +5 -0
- package/dist/mdruntime/chain.d.ts +2 -1
- package/dist/mdruntime/change.d.ts +1 -0
- package/dist/mdruntime/client.d.ts +23 -5
- package/dist/mdruntime/collection.d.ts +2 -1
- package/dist/mdruntime/compile.d.ts +6 -6
- package/dist/mdruntime/conversation-live.d.ts +135 -0
- package/dist/mdruntime/conversation-row.d.ts +32 -0
- package/dist/mdruntime/conversation.d.ts +34 -38
- package/dist/mdruntime/durability.d.ts +15 -0
- package/dist/mdruntime/figures.d.ts +48 -0
- package/dist/mdruntime/holdings.d.ts +28 -0
- package/dist/mdruntime/identity.d.ts +0 -1
- package/dist/mdruntime/install.d.ts +55 -0
- package/dist/mdruntime/job.d.ts +32 -0
- package/dist/mdruntime/listing.d.ts +52 -0
- package/dist/mdruntime/live.d.ts +22 -0
- package/dist/mdruntime/log.d.ts +5 -0
- package/dist/mdruntime/media.d.ts +1 -1
- package/dist/mdruntime/messages.d.ts +27 -3
- package/dist/mdruntime/model.d.ts +2 -9
- package/dist/mdruntime/observation.d.ts +2 -2
- package/dist/mdruntime/outcome.d.ts +4 -1
- package/dist/mdruntime/overlay.d.ts +1 -0
- package/dist/mdruntime/preparation.d.ts +19 -0
- package/dist/mdruntime/query.d.ts +13 -209
- package/dist/mdruntime/reach.d.ts +14 -12
- package/dist/mdruntime/readiness.d.ts +0 -3
- package/dist/mdruntime/reads.d.ts +36 -0
- package/dist/mdruntime/refresh.d.ts +26 -0
- package/dist/mdruntime/replica.d.ts +9 -8
- package/dist/mdruntime/room-draft.d.ts +4 -5
- package/dist/mdruntime/room-drafts.d.ts +23 -0
- package/dist/mdruntime/runtime.d.ts +42 -0
- package/dist/mdruntime/save.d.ts +5 -1
- package/dist/mdruntime/saves.d.ts +69 -0
- package/dist/mdruntime/search.d.ts +12 -63
- package/dist/mdruntime/seed.d.ts +11 -2
- package/dist/mdruntime/socket/admission.d.ts +6 -0
- package/dist/mdruntime/socket/answers.d.ts +5 -0
- package/dist/mdruntime/socket/lanes.d.ts +19 -0
- package/dist/mdruntime/socket/rooms.d.ts +43 -0
- package/dist/mdruntime/socket/session.d.ts +37 -0
- package/dist/mdruntime/socket.d.ts +69 -0
- package/dist/mdruntime/source.d.ts +60 -0
- package/dist/mdruntime/status.d.ts +0 -2
- package/dist/mdruntime/store/fences.d.ts +15 -0
- package/dist/mdruntime/store/installs.d.ts +29 -0
- package/dist/mdruntime/store/readiness.d.ts +9 -0
- package/dist/mdruntime/store/records.d.ts +211 -0
- package/dist/mdruntime/store/room-held.d.ts +7 -0
- package/dist/mdruntime/store/space.d.ts +10 -0
- package/dist/mdruntime/store/watchers.d.ts +16 -0
- package/dist/mdruntime/store/writes.d.ts +23 -0
- package/dist/mdruntime/store.d.ts +107 -145
- package/dist/mdruntime/stored.d.ts +59 -33
- package/dist/mdruntime/surface.d.ts +87 -0
- package/dist/mdruntime/tables.d.ts +120 -29
- package/dist/mdruntime/tallies.d.ts +17 -0
- package/dist/mdruntime/transfer.d.ts +4 -0
- package/dist/mdruntime/turn.d.ts +8 -0
- package/dist/mdruntime/wire.d.ts +17 -1
- package/dist/test-host.js +1 -1
- package/docs/families.md +20 -8
- package/package.json +1 -1
- package/dist/mdmodel/condition.d.ts +0 -167
- package/dist/mdmodel/profile.d.ts +0 -5
- package/dist/mdruntime/connection.d.ts +0 -152
- package/dist/mdruntime/fulltext.d.ts +0 -26
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { SavedFacts, TypedPath } from '../mdmodel/index.js';
|
|
1
2
|
import type { ModelResult } from './model.js';
|
|
3
|
+
export type { SavedFacts, TypedPath };
|
|
2
4
|
import type { Open } from './open.js';
|
|
3
5
|
import type { ChangeBatch } from './change.js';
|
|
4
6
|
export type Authorization = object;
|
|
@@ -11,7 +13,7 @@ export type TypedSelection = {
|
|
|
11
13
|
};
|
|
12
14
|
export type OperationScopes = {
|
|
13
15
|
write: readonly string[];
|
|
14
|
-
|
|
16
|
+
erase: readonly string[];
|
|
15
17
|
};
|
|
16
18
|
export type ReplicaAdmission = {
|
|
17
19
|
selection: string;
|
|
@@ -27,6 +29,7 @@ export type DiscoveredRoom = {
|
|
|
27
29
|
replica: ReplicaAdmission;
|
|
28
30
|
typedSelection?: TypedSelection;
|
|
29
31
|
providerOwnedPaths: readonly string[];
|
|
32
|
+
authoredPaths?: readonly string[];
|
|
30
33
|
};
|
|
31
34
|
export type Capability = {
|
|
32
35
|
name: string;
|
|
@@ -44,6 +47,7 @@ export type ListedConversation = {
|
|
|
44
47
|
outcome: string | null;
|
|
45
48
|
waiting: boolean;
|
|
46
49
|
newest: string | null;
|
|
50
|
+
processEnded: string | null;
|
|
47
51
|
};
|
|
48
52
|
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
|
|
49
53
|
export type ConversationMessage = {
|
|
@@ -227,7 +231,6 @@ export type HistoryRetention = {
|
|
|
227
231
|
};
|
|
228
232
|
export type Retention = {
|
|
229
233
|
history: HistoryRetention;
|
|
230
|
-
outcome: number;
|
|
231
234
|
refreshHorizon: number;
|
|
232
235
|
};
|
|
233
236
|
export type Discovery = {
|
|
@@ -283,25 +286,17 @@ export type BinaryFile = {
|
|
|
283
286
|
mediaType: string;
|
|
284
287
|
sha256: string;
|
|
285
288
|
};
|
|
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
289
|
export type BootstrapRequest = {
|
|
298
290
|
locator: string;
|
|
299
291
|
selection: string;
|
|
300
292
|
pageToken?: PageToken;
|
|
301
|
-
held?: HeldContent;
|
|
302
293
|
arriving?: (bytes: number) => void;
|
|
303
294
|
signal?: AbortSignal;
|
|
304
295
|
};
|
|
296
|
+
export type BootstrapPart = {
|
|
297
|
+
readonly id: string;
|
|
298
|
+
readonly bytes: number;
|
|
299
|
+
};
|
|
305
300
|
export type BootstrapInventory = {
|
|
306
301
|
readonly bytes: number;
|
|
307
302
|
};
|
|
@@ -313,17 +308,23 @@ export type BootstrapPage = {
|
|
|
313
308
|
roomVersion: string;
|
|
314
309
|
models?: RoomModels;
|
|
315
310
|
documents: Readonly<Record<string, string>>;
|
|
311
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
316
312
|
revisions: Readonly<Record<string, string>>;
|
|
317
313
|
fileIds?: Readonly<Record<string, string>>;
|
|
314
|
+
created?: Readonly<Record<string, string>>;
|
|
318
315
|
changes: Readonly<Record<string, HeadChange>>;
|
|
319
316
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
320
317
|
folders?: readonly string[];
|
|
321
318
|
pageToken?: PageToken;
|
|
319
|
+
parts?: readonly BootstrapPart[];
|
|
322
320
|
bytes?: number;
|
|
323
321
|
};
|
|
322
|
+
export type NotReady = {
|
|
323
|
+
kind: 'not-ready';
|
|
324
|
+
};
|
|
324
325
|
export type BootstrapResult = BootstrapPage | {
|
|
325
326
|
kind: 'beyond-horizon';
|
|
326
|
-
} | AdapterFailure;
|
|
327
|
+
} | NotReady | AdapterFailure;
|
|
327
328
|
export type RefreshRequest = {
|
|
328
329
|
locator: string;
|
|
329
330
|
selection: string;
|
|
@@ -335,8 +336,10 @@ export type RefreshPage = {
|
|
|
335
336
|
roomVersion: string;
|
|
336
337
|
models?: RoomModels;
|
|
337
338
|
documents: Readonly<Record<string, string>>;
|
|
339
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
338
340
|
revisions: Readonly<Record<string, string>>;
|
|
339
341
|
fileIds?: Readonly<Record<string, string>>;
|
|
342
|
+
created?: Readonly<Record<string, string>>;
|
|
340
343
|
changes: Readonly<Record<string, HeadChange>>;
|
|
341
344
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
342
345
|
removals: readonly string[];
|
|
@@ -386,15 +389,9 @@ export type MutationResult = (AcceptedRoom & {
|
|
|
386
389
|
affected: Readonly<Record<string, string>>;
|
|
387
390
|
}) | RetryableRefusal | {
|
|
388
391
|
kind: 'write-halted';
|
|
389
|
-
} | {
|
|
390
|
-
kind: 'expired';
|
|
391
|
-
restored?: true;
|
|
392
392
|
} | AdapterFailure;
|
|
393
393
|
export type HistoryAuthor = {
|
|
394
|
-
kind: 'user';
|
|
395
|
-
id: string;
|
|
396
|
-
} | {
|
|
397
|
-
kind: 'site' | 'inbox' | 'app';
|
|
394
|
+
kind: 'user' | 'site' | 'inbox' | 'app';
|
|
398
395
|
id: string;
|
|
399
396
|
name: string;
|
|
400
397
|
};
|
|
@@ -470,17 +467,34 @@ export type ActionResult = {
|
|
|
470
467
|
kind: 'action';
|
|
471
468
|
result: unknown;
|
|
472
469
|
at?: RoomVersionAt;
|
|
470
|
+
} | (ProviderRefusal & {
|
|
471
|
+
kind: 'rejected';
|
|
472
|
+
reset?: string;
|
|
473
|
+
}) | AdapterFailure;
|
|
474
|
+
export type SearchHit = {
|
|
475
|
+
room: string;
|
|
476
|
+
path: string;
|
|
477
|
+
line?: number;
|
|
478
|
+
snippet?: string;
|
|
479
|
+
};
|
|
480
|
+
export type SearchAsk = {
|
|
481
|
+
text: string;
|
|
482
|
+
rooms: readonly string[] | null;
|
|
483
|
+
};
|
|
484
|
+
export type SearchAnswer = {
|
|
485
|
+
kind: 'found';
|
|
486
|
+
documents: readonly SearchHit[];
|
|
473
487
|
} | (ProviderRefusal & {
|
|
474
488
|
kind: 'rejected';
|
|
475
489
|
}) | AdapterFailure;
|
|
476
490
|
export type HeldRoom = {
|
|
477
491
|
locator: string;
|
|
478
|
-
roomVersion: string;
|
|
492
|
+
roomVersion: string | null;
|
|
479
493
|
};
|
|
480
494
|
export type RoomChange = {
|
|
481
495
|
kind: 'room-change';
|
|
482
496
|
locator: string;
|
|
483
|
-
from: string;
|
|
497
|
+
from: string | null;
|
|
484
498
|
roomVersion: string;
|
|
485
499
|
read(): Promise<RefreshPage>;
|
|
486
500
|
};
|
|
@@ -499,6 +513,7 @@ export type RoomStreamEvent = {
|
|
|
499
513
|
kind: 'closed';
|
|
500
514
|
revoked: boolean;
|
|
501
515
|
lost: boolean;
|
|
516
|
+
authorityChanged: boolean;
|
|
502
517
|
} | {
|
|
503
518
|
kind: 'caught-up';
|
|
504
519
|
expired: readonly string[];
|
|
@@ -507,10 +522,15 @@ export type RoomStream = {
|
|
|
507
522
|
hold(rooms: readonly HeldRoom[]): void;
|
|
508
523
|
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
509
524
|
};
|
|
525
|
+
export type PathRule = (path: string) => boolean;
|
|
510
526
|
export type Adapter = {
|
|
511
527
|
readonly localSaves?: true;
|
|
512
528
|
readonly roomTypes?: string;
|
|
513
529
|
readonly nameableRoomTypes?: readonly string[];
|
|
530
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
531
|
+
readonly pathRule?: PathRule;
|
|
532
|
+
readonly unkeptReads?: readonly string[];
|
|
533
|
+
readonly leadingReads?: readonly string[];
|
|
514
534
|
authorize(): Promise<Authorization>;
|
|
515
535
|
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
516
536
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
@@ -521,10 +541,10 @@ export type Adapter = {
|
|
|
521
541
|
link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
|
|
522
542
|
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
523
543
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
544
|
+
search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
|
|
524
545
|
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
525
546
|
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
526
547
|
roomStream?: RoomStream;
|
|
527
548
|
conversations?: ConversationStream;
|
|
528
549
|
serviceMode?: ServiceModeSignal;
|
|
529
550
|
};
|
|
530
|
-
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
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 roomTypesOf(schema: string | undefined, nameable?: readonly string[]): VerifiedModel;
|
|
5
|
+
export declare function builtInModel(roomTypes: VerifiedModel): ModelState;
|
|
6
|
+
export declare function schemaTypes(schema: string | null, roomTypes: VerifiedModel): VerifiedModel['types'];
|
|
7
|
+
export declare function attachedModel(answer: ModelResult, roomTypes: VerifiedModel): ModelState;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ModelState } from './model.js';
|
|
2
|
+
import type { Adapter, TypedPath, AdapterFailure, Authorization, BootstrapPart, DiscoveredRoom, NotReady, RetryableRefusal, RoomModels } from './adapter.js';
|
|
3
|
+
import type { Composition } from './collection.js';
|
|
4
|
+
import type { InstallationStep } from './readiness.js';
|
|
5
|
+
import { type Refreshing } from './refresh.js';
|
|
6
|
+
import type { ReplicaRecord } from './replica.js';
|
|
7
|
+
import type { StagedPage, TransferRecord } from './store.js';
|
|
8
|
+
import { type Unconfirmed } from './transfer.js';
|
|
9
|
+
export type Bootstrapped = {
|
|
10
|
+
kind: 'staged';
|
|
11
|
+
record: ReplicaRecord;
|
|
12
|
+
refreshed: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type BootstrapOutcome = Bootstrapped | Unconfirmed | NotReady | RetryableRefusal | AdapterFailure;
|
|
15
|
+
export type HeldModels = {
|
|
16
|
+
collection: ModelState;
|
|
17
|
+
};
|
|
18
|
+
export type Remodel = (models: RoomModels | undefined, held: HeldModels) => HeldModels;
|
|
19
|
+
export type Reads = Pick<Adapter, 'bootstrap' | 'refresh' | 'reached'>;
|
|
20
|
+
export type Arriving = {
|
|
21
|
+
at(bytes: number): void;
|
|
22
|
+
end(): void;
|
|
23
|
+
};
|
|
24
|
+
export type Resumed = {
|
|
25
|
+
readonly record: TransferRecord | null;
|
|
26
|
+
readonly staged: ReadonlySet<string>;
|
|
27
|
+
};
|
|
28
|
+
export type Staging = {
|
|
29
|
+
held(locator: string): TransferRecord | null;
|
|
30
|
+
turn(locator: string, step: InstallationStep): Promise<() => void>;
|
|
31
|
+
unqueued(): Promise<void>;
|
|
32
|
+
queued(text: number): () => void;
|
|
33
|
+
arriving(locator: string): Arriving;
|
|
34
|
+
readonly streamed: boolean;
|
|
35
|
+
stage(record: TransferRecord, page: StagedPage, composition: Composition): Promise<TransferRecord | null>;
|
|
36
|
+
resume(record: TransferRecord, parts: readonly BootstrapPart[], composition: Composition): Promise<Resumed | null>;
|
|
37
|
+
derive(locator: string, key: number, composition: Composition): Promise<boolean>;
|
|
38
|
+
refreshing(locator: string, key: number, composition: Composition): Promise<Refreshing>;
|
|
39
|
+
abandon(locator: string): Promise<void>;
|
|
40
|
+
setAside(locator: string): Promise<void>;
|
|
41
|
+
release(key: number): Promise<void>;
|
|
42
|
+
};
|
|
43
|
+
export declare function bootstrapRoom(adapter: Reads, authorization: Authorization, room: DiscoveredRoom, held: HeldModels, builtIn: ModelState, typedPaths: readonly TypedPath[], remodel: Remodel, continuing: () => boolean, staging: Staging): Promise<BootstrapOutcome>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
|
|
1
2
|
import type { MdRuntimeClient } from './client.js';
|
|
2
|
-
import type {
|
|
3
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
3
4
|
type Rows = DocumentResult | GroupResult;
|
|
4
5
|
export type WindowAnswer = Rows | PendingResult;
|
|
5
6
|
export type WindowChain = {
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
|
|
2
|
+
import type { HistoryQuery } from './actions.js';
|
|
3
|
+
import type { AppRoom } from './listing.js';
|
|
4
|
+
import type { ConnectionRefusal } from './socket.js';
|
|
5
|
+
import type { RoomSchemas } from './surface.js';
|
|
6
|
+
import type { SavedParts, SavedRoomDraft, SaveResult } from './saves.js';
|
|
2
7
|
import type { Member, ServiceMode } from './adapter.js';
|
|
3
|
-
import type {
|
|
8
|
+
import type { UnsentWork } from './durability.js';
|
|
9
|
+
import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationView } from './conversation.js';
|
|
4
10
|
import { type Observation } from './observation.js';
|
|
5
11
|
import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
|
|
6
|
-
import type {
|
|
12
|
+
import type { FiguresResult } from './figures.js';
|
|
13
|
+
import type { Holdings } from './holdings.js';
|
|
14
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
7
15
|
import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
|
|
8
16
|
import type { SearchRequest, SearchResult } from './search.js';
|
|
9
17
|
import type { Readiness } from './readiness.js';
|
|
18
|
+
import type { ObservedRead } from './reads.js';
|
|
10
19
|
import type { SyncStatus } from './status.js';
|
|
11
20
|
import { type RuntimePort } from './wire.js';
|
|
21
|
+
export type BuildFile = (name: string) => Promise<Blob | null>;
|
|
12
22
|
export type MdRuntimeClient = {
|
|
23
|
+
buildFile(name: string): Promise<Blob | null>;
|
|
13
24
|
rooms(): Promise<readonly AppRoom[]>;
|
|
14
25
|
query: {
|
|
15
26
|
(query: DocumentQuery): Promise<DocumentResult | PendingResult>;
|
|
@@ -32,7 +43,7 @@ export type MdRuntimeClient = {
|
|
|
32
43
|
};
|
|
33
44
|
conversation: {
|
|
34
45
|
list(): Promise<readonly ConversationEntry[]>;
|
|
35
|
-
read(conversation: string, options?:
|
|
46
|
+
read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
|
|
36
47
|
create(input: unknown): Promise<CallResult>;
|
|
37
48
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
38
49
|
answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
|
|
@@ -58,6 +69,9 @@ export type MdRuntimeClient = {
|
|
|
58
69
|
persistence(): Promise<boolean>;
|
|
59
70
|
retry(): Promise<void>;
|
|
60
71
|
cleanUp(): Promise<number>;
|
|
72
|
+
unsent(): Promise<readonly UnsentWork[]>;
|
|
73
|
+
reset(): Promise<void>;
|
|
74
|
+
readAgain(): Promise<void>;
|
|
61
75
|
observe: {
|
|
62
76
|
(topic: 'deployment-facts'): Promise<Observation<unknown>>;
|
|
63
77
|
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
@@ -67,6 +81,7 @@ export type MdRuntimeClient = {
|
|
|
67
81
|
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
68
82
|
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
69
83
|
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
84
|
+
(topic: 'authority-changes'): Promise<Observation<number>>;
|
|
70
85
|
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
|
|
71
86
|
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
|
|
72
87
|
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
|
@@ -75,11 +90,14 @@ export type MdRuntimeClient = {
|
|
|
75
90
|
(topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
|
|
76
91
|
(topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
|
|
77
92
|
(topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
|
|
93
|
+
(topic: 'figures'): Promise<Observation<FiguresResult>>;
|
|
94
|
+
(topic: 'holdings'): Promise<Observation<Holdings>>;
|
|
95
|
+
(topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
|
|
78
96
|
};
|
|
79
97
|
reauthorize(): Promise<void>;
|
|
80
98
|
settled(): Promise<void>;
|
|
81
99
|
};
|
|
82
|
-
export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
|
|
100
|
+
export declare function connectMdRuntime(port: RuntimePort, buildFile?: BuildFile): MdRuntimeClient;
|
|
83
101
|
export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
|
|
84
102
|
export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
|
|
85
103
|
export { roomDraftRevision } from './identity.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Document } from '../mdmodel/index.js';
|
|
1
|
+
import { type Document, type TypedPath } from '../mdmodel/index.js';
|
|
2
2
|
import type { ModelState } from './model.js';
|
|
3
3
|
import type { MdModelIdentity } from './adapter.js';
|
|
4
4
|
export declare const MD_MODEL: MdModelIdentity;
|
|
@@ -13,6 +13,7 @@ export type Composition = {
|
|
|
13
13
|
roots: readonly string[];
|
|
14
14
|
model: ModelState;
|
|
15
15
|
} | null;
|
|
16
|
+
typedPaths: readonly TypedPath[];
|
|
16
17
|
};
|
|
17
18
|
export type Composed = {
|
|
18
19
|
readonly composition: Composition;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { sql } from '../mdmodel/index.js';
|
|
1
2
|
import type { Plan, QueryRows } from './query.js';
|
|
2
|
-
import type { Connection
|
|
3
|
+
import type { Connection } from './tables.js';
|
|
3
4
|
export type QueryRoom = {
|
|
4
5
|
readonly locator: string;
|
|
5
6
|
readonly key: number;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
8
|
+
type Fragment = sql.Fragment;
|
|
9
|
+
export declare const VISIBLE: (alias: string) => string;
|
|
10
|
+
export declare function within(alias: string, path: string): Fragment;
|
|
11
11
|
export type QueryAnswer = QueryRows & {
|
|
12
12
|
readonly more?: string;
|
|
13
13
|
};
|
|
14
|
-
export declare function selected(connection: Connection, plan: Plan, rooms: readonly QueryRoom[]): Fragment;
|
|
15
14
|
export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { AcceptedMessage, ConversationAction, ConversationHistoryRequest, ConversationStream, ListedAgent, ListedConversation, ProcessCommand, RunningSubagent, SessionOption } from './adapter.js';
|
|
2
|
+
import { type Cell } from './cell.js';
|
|
3
|
+
import type { ChangeSet } from './change-set.js';
|
|
4
|
+
import type { Asked, ConversationAgent, ConversationEntry, ConversationView, RunningTurn } from './conversation.js';
|
|
5
|
+
import type { JobMarker } from './job.js';
|
|
6
|
+
import type { CallResult } from './outcome.js';
|
|
7
|
+
import type { Recovery } from './recovery.js';
|
|
8
|
+
import type { ChatDraftRecord, RuntimeStore } from './store.js';
|
|
9
|
+
export type ConversationDependencies = {
|
|
10
|
+
call(name: ConversationAction, input: unknown): Promise<CallResult>;
|
|
11
|
+
history(request: ConversationHistoryRequest): Promise<CallResult>;
|
|
12
|
+
durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
|
|
13
|
+
local(): Promise<RuntimeStore>;
|
|
14
|
+
again(): void;
|
|
15
|
+
settled(): void;
|
|
16
|
+
stream(): ConversationStream | undefined;
|
|
17
|
+
publish(set: ChangeSet): void;
|
|
18
|
+
online(): boolean;
|
|
19
|
+
full(): boolean;
|
|
20
|
+
closed(): boolean;
|
|
21
|
+
unanswered(): void;
|
|
22
|
+
readonly recovery: Recovery;
|
|
23
|
+
};
|
|
24
|
+
export type Live = {
|
|
25
|
+
turn: RunningTurn | null;
|
|
26
|
+
questions: readonly unknown[];
|
|
27
|
+
process: {
|
|
28
|
+
running: boolean;
|
|
29
|
+
} | null;
|
|
30
|
+
commands: readonly ProcessCommand[];
|
|
31
|
+
options: readonly SessionOption[];
|
|
32
|
+
starting: string | null;
|
|
33
|
+
subagents: readonly RunningSubagent[];
|
|
34
|
+
link: {
|
|
35
|
+
connected: boolean;
|
|
36
|
+
} | null;
|
|
37
|
+
deliveryUnknown: readonly string[];
|
|
38
|
+
};
|
|
39
|
+
export declare const QUIET: Live;
|
|
40
|
+
export type Fact = Exclude<keyof Live, 'turn'>;
|
|
41
|
+
export declare const FACTS: readonly Fact[];
|
|
42
|
+
type Watcher = {
|
|
43
|
+
readonly notify: (view: ConversationView) => void;
|
|
44
|
+
};
|
|
45
|
+
type HeldWindow = {
|
|
46
|
+
readonly window: readonly AcceptedMessage[] | null;
|
|
47
|
+
readonly draft: ChatDraftRecord | null;
|
|
48
|
+
readonly ended: string | null;
|
|
49
|
+
readonly marked: readonly JobMarker[];
|
|
50
|
+
readonly more: boolean;
|
|
51
|
+
readonly total: number | null;
|
|
52
|
+
};
|
|
53
|
+
export type SharedView = {
|
|
54
|
+
readonly conversation: string;
|
|
55
|
+
readonly asked: Asked;
|
|
56
|
+
readonly held: Cell<HeldWindow>;
|
|
57
|
+
ready(): readonly Watcher[];
|
|
58
|
+
join(watcher: Watcher): void;
|
|
59
|
+
admit(watcher: Watcher): boolean;
|
|
60
|
+
leave(watcher: Watcher): boolean;
|
|
61
|
+
empty(): boolean;
|
|
62
|
+
};
|
|
63
|
+
type Listing<T> = (value: T) => void;
|
|
64
|
+
export type Audience<T> = {
|
|
65
|
+
waiting(): boolean;
|
|
66
|
+
told(): boolean;
|
|
67
|
+
join(watcher: Listing<T>): void;
|
|
68
|
+
leave(watcher: Listing<T>): void;
|
|
69
|
+
tell(value: T): void;
|
|
70
|
+
welcome(value: T): void;
|
|
71
|
+
clear(): void;
|
|
72
|
+
};
|
|
73
|
+
type HeldFacts = {
|
|
74
|
+
readonly listKnown: boolean;
|
|
75
|
+
readonly listOwed: boolean;
|
|
76
|
+
readonly listTelling: boolean;
|
|
77
|
+
readonly agentsShown: string | null;
|
|
78
|
+
readonly listedAgents: readonly ListedAgent[] | null;
|
|
79
|
+
readonly agentsReading: boolean;
|
|
80
|
+
readonly replicated: ReadonlySet<string>;
|
|
81
|
+
readonly handedReplicated: string | undefined;
|
|
82
|
+
};
|
|
83
|
+
export type Dispatch = Cell<{
|
|
84
|
+
readonly answered: boolean;
|
|
85
|
+
}>;
|
|
86
|
+
export type LiveConversations = {
|
|
87
|
+
readonly deps: ConversationDependencies;
|
|
88
|
+
readonly held: Cell<HeldFacts>;
|
|
89
|
+
readonly closing: AbortSignal;
|
|
90
|
+
readonly listeners: Audience<readonly ConversationEntry[]>;
|
|
91
|
+
readonly agentListeners: Audience<readonly ConversationAgent[]>;
|
|
92
|
+
views(): Iterable<SharedView>;
|
|
93
|
+
viewJoined(key: string, conversation: string, asked: Asked, notify: (view: ConversationView) => void): {
|
|
94
|
+
readonly view: SharedView;
|
|
95
|
+
readonly watcher: Watcher;
|
|
96
|
+
};
|
|
97
|
+
viewLeft(key: string, view: SharedView, watcher: Watcher): void;
|
|
98
|
+
liveOf(conversation: string): Live;
|
|
99
|
+
liveHeld(conversation: string): Live | undefined;
|
|
100
|
+
holdLive(conversation: string, next: Live | null): void;
|
|
101
|
+
factsOwed(conversation: string): void;
|
|
102
|
+
factsHeard(conversation: string, facts: readonly Fact[]): void;
|
|
103
|
+
factsTaken(): readonly (readonly [string, ReadonlySet<Fact>])[];
|
|
104
|
+
behind(conversation: string): boolean;
|
|
105
|
+
behindAll(): readonly string[];
|
|
106
|
+
fellBehind(conversation: string): void;
|
|
107
|
+
caughtUpTo(conversation: string): void;
|
|
108
|
+
gapOpened(conversation: string): void;
|
|
109
|
+
generation(conversation: string): number;
|
|
110
|
+
heardAt(conversation: string, position: string): void;
|
|
111
|
+
newestHeard(conversation: string): string | undefined;
|
|
112
|
+
catching(conversation: string): Promise<void> | undefined;
|
|
113
|
+
catchingUntil(conversation: string, ended: Promise<void>): void;
|
|
114
|
+
creating(conversation: string): void;
|
|
115
|
+
created(conversation: string): void;
|
|
116
|
+
isCreating(conversation: string): boolean;
|
|
117
|
+
relisting(): boolean;
|
|
118
|
+
relistBegun(): void;
|
|
119
|
+
relistHeard(entries: readonly ListedConversation[]): void;
|
|
120
|
+
relistDropped(conversation: string): void;
|
|
121
|
+
relistTaken(): ReadonlyMap<string, ListedConversation> | null;
|
|
122
|
+
sendingBegan(operation: string): Dispatch;
|
|
123
|
+
sendingEnded(operation: string, dispatch: Dispatch): void;
|
|
124
|
+
sending(operation: string): boolean;
|
|
125
|
+
rowSoon(tell: () => void): void;
|
|
126
|
+
inOrder(work: () => Promise<void>): void;
|
|
127
|
+
forget(conversation: string): void;
|
|
128
|
+
current(): boolean;
|
|
129
|
+
known(): boolean;
|
|
130
|
+
reopened(): void;
|
|
131
|
+
lost(): void;
|
|
132
|
+
close(): void;
|
|
133
|
+
};
|
|
134
|
+
export declare function createLiveConversations(deps: ConversationDependencies): LiveConversations;
|
|
135
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { HeldRow } from './messages.js';
|
|
2
|
+
import { type HouseSource } from './source.js';
|
|
3
|
+
export type ConversationLast = {
|
|
4
|
+
readonly text: string;
|
|
5
|
+
readonly by: 'owner' | 'agent' | 'house';
|
|
6
|
+
readonly at: string;
|
|
7
|
+
};
|
|
8
|
+
export type ConversationStart = Extract<HouseSource, {
|
|
9
|
+
readonly kind: 'request' | 'trigger';
|
|
10
|
+
}>;
|
|
11
|
+
export type ConversationAsk = {
|
|
12
|
+
readonly who: string;
|
|
13
|
+
readonly agent: string | null;
|
|
14
|
+
readonly room: {
|
|
15
|
+
readonly ref: string;
|
|
16
|
+
readonly name: string;
|
|
17
|
+
};
|
|
18
|
+
readonly prompt: string;
|
|
19
|
+
readonly at: string;
|
|
20
|
+
readonly request: string;
|
|
21
|
+
readonly message?: string;
|
|
22
|
+
};
|
|
23
|
+
export type ConversationHeld = {
|
|
24
|
+
readonly last: ConversationLast | null;
|
|
25
|
+
readonly failure: string | null;
|
|
26
|
+
readonly startedBy: ConversationStart | null;
|
|
27
|
+
readonly asks: ConversationAsk | null;
|
|
28
|
+
};
|
|
29
|
+
export declare function heldFacts(held: HeldRow | undefined, listed: {
|
|
30
|
+
readonly outcome: string | null;
|
|
31
|
+
readonly waiting: boolean;
|
|
32
|
+
}): ConversationHeld;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ConversationEvent, ConversationMessage, ProcessCommand, RunningSubagent, SessionOption, TurnContext } from './adapter.js';
|
|
2
2
|
import { type ChangeSet } from './change-set.js';
|
|
3
|
+
import { type LiveConversations } from './conversation-live.js';
|
|
4
|
+
import { type ConversationHeld } from './conversation-row.js';
|
|
5
|
+
import type { OpenJob } from './job.js';
|
|
3
6
|
import type { Open } from './open.js';
|
|
4
7
|
import { type CallResult, type Offline } from './outcome.js';
|
|
5
8
|
import type { CycleProgress } from './status.js';
|
|
6
|
-
import type {
|
|
9
|
+
import type { RuntimeStore } from './store.js';
|
|
7
10
|
export type ConversationState = Open<'working' | 'asking' | 'idle'>;
|
|
8
|
-
export type ConversationEntry = {
|
|
11
|
+
export type ConversationEntry = ConversationHeld & {
|
|
9
12
|
conversation: string;
|
|
10
13
|
agent: {
|
|
11
14
|
identity: string;
|
|
12
15
|
name: string;
|
|
16
|
+
retired: boolean;
|
|
13
17
|
};
|
|
14
18
|
name: string;
|
|
15
19
|
created: string;
|
|
@@ -18,6 +22,9 @@ export type ConversationEntry = {
|
|
|
18
22
|
waiting: boolean;
|
|
19
23
|
state: ConversationState;
|
|
20
24
|
started: string | null;
|
|
25
|
+
line: string | null;
|
|
26
|
+
question: string | null;
|
|
27
|
+
asked: string | null;
|
|
21
28
|
};
|
|
22
29
|
export type ConversationAgent = {
|
|
23
30
|
identity: string;
|
|
@@ -37,6 +44,9 @@ export type ConversationOptions = {
|
|
|
37
44
|
after?: string;
|
|
38
45
|
total?: true;
|
|
39
46
|
};
|
|
47
|
+
export type ConversationRead = ConversationOptions & {
|
|
48
|
+
text?: string;
|
|
49
|
+
};
|
|
40
50
|
export type ConversationView = {
|
|
41
51
|
conversation: string;
|
|
42
52
|
messages: readonly ConversationMessage[];
|
|
@@ -47,6 +57,7 @@ export type ConversationView = {
|
|
|
47
57
|
process: {
|
|
48
58
|
running: boolean;
|
|
49
59
|
} | null;
|
|
60
|
+
processEnded: string | null;
|
|
50
61
|
commands: readonly ProcessCommand[];
|
|
51
62
|
options: readonly SessionOption[];
|
|
52
63
|
starting: string | null;
|
|
@@ -58,10 +69,11 @@ export type ConversationView = {
|
|
|
58
69
|
chatDraft: (ChatDraft & {
|
|
59
70
|
readonly revision: string;
|
|
60
71
|
}) | null;
|
|
72
|
+
jobs: readonly OpenJob[];
|
|
61
73
|
};
|
|
62
74
|
export type ConversationSurface = {
|
|
63
75
|
list(): Promise<readonly ConversationEntry[]>;
|
|
64
|
-
read(conversation: string, options?:
|
|
76
|
+
read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
|
|
65
77
|
create(input: unknown): Promise<CallResult>;
|
|
66
78
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
67
79
|
answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
|
|
@@ -78,41 +90,25 @@ export type ChatDraftSurface = {
|
|
|
78
90
|
prepend(conversation: string, draft: ChatDraft): Promise<void>;
|
|
79
91
|
discard(conversation: string): Promise<void>;
|
|
80
92
|
};
|
|
81
|
-
export type ConversationDependencies = {
|
|
82
|
-
call(name: ConversationAction, input: unknown): Promise<CallResult>;
|
|
83
|
-
history(request: ConversationHistoryRequest): Promise<CallResult>;
|
|
84
|
-
durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
|
|
85
|
-
stream(): ConversationStream | undefined;
|
|
86
|
-
publish(set: ChangeSet): void;
|
|
87
|
-
online(): boolean;
|
|
88
|
-
full(): boolean;
|
|
89
|
-
closed(): boolean;
|
|
90
|
-
unanswered(): void;
|
|
91
|
-
expired(operation: string): boolean;
|
|
92
|
-
};
|
|
93
|
-
export type ConversationStore = {
|
|
94
|
-
surface: ConversationSurface;
|
|
95
|
-
chatDraft: ChatDraftSurface;
|
|
96
|
-
hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[], list: readonly ListedConversation[] | null, cursor: string | null): void;
|
|
97
|
-
reconcile(): Promise<void>;
|
|
98
|
-
catchUp(progress: CycleProgress): Promise<void>;
|
|
99
|
-
resend(progress: CycleProgress): Promise<void>;
|
|
100
|
-
current(): boolean;
|
|
101
|
-
known(): boolean;
|
|
102
|
-
learned(): void;
|
|
103
|
-
reopened(): void;
|
|
104
|
-
lost(): void;
|
|
105
|
-
watch(conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
|
|
106
|
-
watchList(deliver: (entries: readonly ConversationEntry[]) => void): () => void;
|
|
107
|
-
watchAgents(deliver: (agents: readonly ConversationAgent[]) => void): () => void;
|
|
108
|
-
changed(set: ChangeSet): void;
|
|
109
|
-
receive(event: ConversationEvent): boolean;
|
|
110
|
-
searchable(): readonly string[];
|
|
111
|
-
acquired(conversation: string): boolean;
|
|
112
|
-
close(): void;
|
|
113
|
-
};
|
|
114
93
|
export declare function unheldView(conversation: string): ConversationView;
|
|
115
94
|
export declare const SESSION_STARTED = "Session started";
|
|
116
95
|
export declare const HISTORY_CONVERSATIONS = 64;
|
|
117
96
|
export declare function newChat(agent: string): string;
|
|
118
|
-
export
|
|
97
|
+
export type Asked = {
|
|
98
|
+
limit: number;
|
|
99
|
+
after: string | undefined;
|
|
100
|
+
before: readonly [string, string] | null;
|
|
101
|
+
total: boolean;
|
|
102
|
+
};
|
|
103
|
+
export declare function conversationsLearned(alive: LiveConversations): void;
|
|
104
|
+
export declare function conversationSurface(alive: LiveConversations): ConversationSurface;
|
|
105
|
+
export declare function chatDraftSurface(alive: LiveConversations): ChatDraftSurface;
|
|
106
|
+
export declare function conversationsOpened(alive: LiveConversations, local: RuntimeStore): Promise<void>;
|
|
107
|
+
export declare function reconcileConversations(alive: LiveConversations): Promise<void>;
|
|
108
|
+
export declare function catchUpConversations(alive: LiveConversations, progress: CycleProgress): Promise<void>;
|
|
109
|
+
export declare function resendConversations(alive: LiveConversations, progress: CycleProgress): Promise<void>;
|
|
110
|
+
export declare function watchConversation(alive: LiveConversations, conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
|
|
111
|
+
export declare function watchConversationList(alive: LiveConversations, deliver: (entries: readonly ConversationEntry[]) => void): () => void;
|
|
112
|
+
export declare function watchConversationAgents(alive: LiveConversations, deliver: (agents: readonly ConversationAgent[]) => void): () => void;
|
|
113
|
+
export declare function conversationsChanged(alive: LiveConversations, set: ChangeSet): void;
|
|
114
|
+
export declare function receiveConversationEvent(alive: LiveConversations, event: ConversationEvent): void;
|