@agentshouse/app-bridge 0.1.0-ca12d3a8d9ae5 → 0.1.0-ca2cc2cd99f13

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 (47) hide show
  1. package/README.md +6 -6
  2. package/dist/index.d.ts +827 -16
  3. package/dist/mdmodel/condition.d.ts +20 -4
  4. package/dist/mdmodel/document.d.ts +2 -1
  5. package/dist/mdmodel/index.d.ts +15 -5
  6. package/dist/mdmodel/kinds.d.ts +17 -0
  7. package/dist/mdmodel/query/language.d.ts +217 -0
  8. package/dist/mdmodel/query/match.d.ts +11 -0
  9. package/dist/mdmodel/query/rows.d.ts +31 -0
  10. package/dist/mdmodel/query/sql.d.ts +38 -0
  11. package/dist/mdmodel/reserved.d.ts +4 -0
  12. package/dist/mdmodel/types.d.ts +12 -0
  13. package/dist/mdmodel/validate.d.ts +3 -2
  14. package/dist/mdruntime/adapter.d.ts +72 -51
  15. package/dist/mdruntime/chain.d.ts +2 -1
  16. package/dist/mdruntime/client.d.ts +6 -5
  17. package/dist/mdruntime/collection.d.ts +2 -4
  18. package/dist/mdruntime/compile.d.ts +1 -6
  19. package/dist/mdruntime/connection.d.ts +5 -7
  20. package/dist/mdruntime/conversation.d.ts +15 -14
  21. package/dist/mdruntime/durability.d.ts +0 -1
  22. package/dist/mdruntime/media.d.ts +1 -1
  23. package/dist/mdruntime/messages.d.ts +2 -2
  24. package/dist/mdruntime/model.d.ts +1 -3
  25. package/dist/mdruntime/observation.d.ts +2 -2
  26. package/dist/mdruntime/outcome.d.ts +0 -3
  27. package/dist/mdruntime/query.d.ts +5 -209
  28. package/dist/mdruntime/reach.d.ts +7 -7
  29. package/dist/mdruntime/readiness.d.ts +3 -17
  30. package/dist/mdruntime/recovery.d.ts +1 -0
  31. package/dist/mdruntime/replica.d.ts +3 -3
  32. package/dist/mdruntime/room-draft.d.ts +2 -1
  33. package/dist/mdruntime/search.d.ts +12 -63
  34. package/dist/mdruntime/status.d.ts +0 -4
  35. package/dist/mdruntime/store.d.ts +18 -33
  36. package/dist/mdruntime/stored.d.ts +34 -26
  37. package/dist/mdruntime/tables.d.ts +35 -44
  38. package/dist/mdruntime/wire.d.ts +1 -4
  39. package/dist/test-host.d.ts +1 -4
  40. package/dist/test-host.js +2 -27
  41. package/docs/families.md +38 -44
  42. package/package.json +1 -1
  43. package/dist/calls.d.ts +0 -704
  44. package/dist/calls.js +0 -1
  45. package/dist/mdruntime/fulltext.d.ts +0 -26
  46. package/dist/mdruntime/shared.d.ts +0 -15
  47. package/dist/mdruntime/transfer.d.ts +0 -9
@@ -1,4 +1,6 @@
1
+ import type { Outline, TypedPath } from '../mdmodel/index.js';
1
2
  import type { ModelResult } from './model.js';
3
+ export type { Outline, TypedPath };
2
4
  import type { Open } from './open.js';
3
5
  import type { ChangeBatch } from './change.js';
4
6
  export type Authorization = object;
@@ -32,25 +34,21 @@ export type Capability = {
32
34
  name: string;
33
35
  limits?: readonly ProviderLimit[];
34
36
  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
37
  };
44
38
  export type ListedConversation = {
45
39
  conversation: string;
46
40
  agent: string;
41
+ agentName: string;
42
+ agentRetired: boolean;
47
43
  name: string;
48
44
  created: string;
49
45
  finished: string | null;
50
46
  outcome: string | null;
51
47
  waiting: boolean;
48
+ newest: string | null;
49
+ processEnded: string | null;
52
50
  };
53
- export type ConversationAction = 'conversation.create' | 'conversation.send' | 'conversation.answer' | 'conversation.interrupt' | 'conversation.kill' | 'conversation.cancel' | 'conversation.delete' | 'conversation.history';
51
+ export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete';
54
52
  export type ConversationMessage = {
55
53
  identity: string;
56
54
  turn: string;
@@ -141,6 +139,10 @@ export type SessionOption = (SessionOptionNaming & {
141
139
  type: 'boolean';
142
140
  currentValue: boolean;
143
141
  });
142
+ export type RunningSubagent = {
143
+ description: string;
144
+ activity: string | null;
145
+ };
144
146
  export type ConversationEvent = {
145
147
  kind: 'turn';
146
148
  conversation: string;
@@ -166,6 +168,10 @@ export type ConversationEvent = {
166
168
  kind: 'starting';
167
169
  conversation: string;
168
170
  step: string | null;
171
+ } | {
172
+ kind: 'subagents';
173
+ conversation: string;
174
+ subagents: readonly RunningSubagent[];
169
175
  } | {
170
176
  kind: 'link';
171
177
  conversation: string;
@@ -184,6 +190,9 @@ export type ConversationEvent = {
184
190
  } | {
185
191
  kind: 'list';
186
192
  entries: readonly ListedConversation[];
193
+ whole: boolean;
194
+ more: boolean;
195
+ cursor: string | null;
187
196
  } | {
188
197
  kind: 'listed';
189
198
  entry: ListedConversation;
@@ -191,9 +200,17 @@ export type ConversationEvent = {
191
200
  kind: 'unlisted';
192
201
  conversation: string;
193
202
  };
203
+ export type ListedAgent = {
204
+ agent: string;
205
+ name: string;
206
+ retired: boolean;
207
+ };
194
208
  export type ConversationStream = {
195
209
  replicate(conversations: readonly string[]): void;
210
+ hold(cursor: string | null): void;
196
211
  observe(notify: (event: ConversationEvent) => void): () => void;
212
+ agents?(): Promise<readonly ListedAgent[] | null>;
213
+ history?(request: ConversationHistoryRequest): Promise<ActionResult>;
197
214
  };
198
215
  export type ActionDeclaration = {
199
216
  name: string;
@@ -223,10 +240,6 @@ export type Discovery = {
223
240
  providerLimits: readonly ProviderLimit[];
224
241
  retention: Retention;
225
242
  member?: Member;
226
- covered?: readonly string[];
227
- };
228
- export type DiscoveryScope = {
229
- readonly authorities: readonly string[];
230
243
  };
231
244
  export type TransportUncertainty = {
232
245
  kind: 'transport-uncertainty';
@@ -287,13 +300,13 @@ export type HeldContent = {
287
300
  export type BootstrapRequest = {
288
301
  locator: string;
289
302
  selection: string;
303
+ path?: string;
290
304
  pageToken?: PageToken;
291
305
  held?: HeldContent;
292
- received?: Uint8Array;
293
306
  arriving?: (bytes: number) => void;
307
+ signal?: AbortSignal;
294
308
  };
295
309
  export type BootstrapInventory = {
296
- readonly parts: number;
297
310
  readonly bytes: number;
298
311
  };
299
312
  export type RoomModels = {
@@ -304,14 +317,14 @@ export type BootstrapPage = {
304
317
  roomVersion: string;
305
318
  models?: RoomModels;
306
319
  documents: Readonly<Record<string, string>>;
320
+ outlines?: Readonly<Record<string, Outline>>;
307
321
  revisions: Readonly<Record<string, string>>;
308
322
  fileIds?: Readonly<Record<string, string>>;
309
323
  changes: Readonly<Record<string, HeadChange>>;
310
324
  binaryFiles: Readonly<Record<string, BinaryFile>>;
311
325
  folders?: readonly string[];
312
326
  pageToken?: PageToken;
313
- inventory?: BootstrapInventory;
314
- received?: Uint8Array;
327
+ bytes?: number;
315
328
  };
316
329
  export type BootstrapResult = BootstrapPage | {
317
330
  kind: 'beyond-horizon';
@@ -327,6 +340,7 @@ export type RefreshPage = {
327
340
  roomVersion: string;
328
341
  models?: RoomModels;
329
342
  documents: Readonly<Record<string, string>>;
343
+ outlines?: Readonly<Record<string, Outline>>;
330
344
  revisions: Readonly<Record<string, string>>;
331
345
  fileIds?: Readonly<Record<string, string>>;
332
346
  changes: Readonly<Record<string, HeadChange>>;
@@ -383,10 +397,7 @@ export type MutationResult = (AcceptedRoom & {
383
397
  restored?: true;
384
398
  } | AdapterFailure;
385
399
  export type HistoryAuthor = {
386
- kind: 'user';
387
- id: string;
388
- } | {
389
- kind: 'site' | 'inbox' | 'app';
400
+ kind: 'user' | 'site' | 'inbox' | 'app';
390
401
  id: string;
391
402
  name: string;
392
403
  };
@@ -465,66 +476,76 @@ export type ActionResult = {
465
476
  } | (ProviderRefusal & {
466
477
  kind: 'rejected';
467
478
  }) | AdapterFailure;
479
+ export type SearchHit = {
480
+ room: string;
481
+ path: string;
482
+ line?: number;
483
+ snippet?: string;
484
+ };
485
+ export type SearchAsk = {
486
+ text: string;
487
+ rooms: readonly string[] | null;
488
+ };
489
+ export type SearchAnswer = {
490
+ kind: 'found';
491
+ documents: readonly SearchHit[];
492
+ } | (ProviderRefusal & {
493
+ kind: 'rejected';
494
+ }) | AdapterFailure;
468
495
  export type HeldRoom = {
469
496
  locator: string;
470
497
  roomVersion: string;
471
498
  };
472
- export type HeldRevisions = (locator: string, paths: readonly string[]) => Promise<ReadonlyMap<string, string>>;
499
+ export type RoomChange = {
500
+ kind: 'room-change';
501
+ locator: string;
502
+ from: string;
503
+ roomVersion: string;
504
+ read(): Promise<RefreshPage>;
505
+ };
506
+ export type AuthorityChange = {
507
+ kind: 'authority-changed';
508
+ rooms: readonly DiscoveredRoom[];
509
+ left: readonly string[];
510
+ member?: Member;
511
+ };
473
512
  export type RoomStreamEvent = {
474
513
  kind: 'opened';
514
+ } | {
515
+ kind: 'discovered';
516
+ discovery: Discovery;
475
517
  } | {
476
518
  kind: 'closed';
477
519
  revoked: boolean;
478
520
  lost: boolean;
521
+ authorityChanged: boolean;
479
522
  } | {
480
- kind: 'opening';
523
+ kind: 'caught-up';
481
524
  expired: readonly string[];
482
- } | {
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
- };
525
+ } | AuthorityChange | RoomChange;
503
526
  export type RoomStream = {
504
527
  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;
528
+ observe(notify: (event: RoomStreamEvent) => void): () => void;
508
529
  };
509
530
  export type Adapter = {
510
531
  readonly localSaves?: true;
511
- readonly exhaustiveDiscovery?: true;
512
532
  readonly roomTypes?: string;
513
533
  readonly nameableRoomTypes?: readonly string[];
534
+ readonly typedPaths?: readonly TypedPath[];
514
535
  authorize(): Promise<Authorization>;
515
- discover(authorization: Authorization, scope?: DiscoveryScope): Promise<DiscoverResult>;
536
+ discover?(authorization: Authorization): Promise<DiscoverResult>;
516
537
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
517
- refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
538
+ refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
518
539
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
519
540
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
520
541
  binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
521
542
  link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
522
543
  attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
523
544
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
545
+ search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
524
546
  reached(locator: string, roomVersion: string, target: string): boolean;
525
547
  follows(locator: string, roomVersion: string, next: string): boolean;
526
548
  roomStream?: RoomStream;
527
549
  conversations?: ConversationStream;
528
550
  serviceMode?: ServiceModeSignal;
529
551
  };
530
- export {};
@@ -1,5 +1,6 @@
1
+ import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
1
2
  import type { MdRuntimeClient } from './client.js';
2
- import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
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,9 +1,10 @@
1
+ import type { DocumentQuery, GroupQuery } from '../mdmodel/index.js';
1
2
  import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult } from './connection.js';
2
3
  import type { Member, ServiceMode } from './adapter.js';
3
- import type { ChatDraft, ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
4
+ import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationView } from './conversation.js';
4
5
  import { type Observation } from './observation.js';
5
6
  import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
6
- import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
7
+ import type { DocumentResult, GroupResult, PendingResult } from './query.js';
7
8
  import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
8
9
  import type { SearchRequest, SearchResult } from './search.js';
9
10
  import type { Readiness } from './readiness.js';
@@ -32,13 +33,12 @@ export type MdRuntimeClient = {
32
33
  };
33
34
  conversation: {
34
35
  list(): Promise<readonly ConversationEntry[]>;
35
- read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
36
+ read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
36
37
  create(input: unknown): Promise<CallResult>;
37
38
  send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
38
- answer(conversation: string, answer: unknown): Promise<CallResult>;
39
+ answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
39
40
  interrupt(conversation: string): Promise<CallResult>;
40
41
  kill(conversation: string): Promise<CallResult>;
41
- cancel(conversation: string, turn: string): Promise<CallResult>;
42
42
  delete(conversation: string): Promise<CallResult>;
43
43
  };
44
44
  chatDraft: {
@@ -68,6 +68,7 @@ export type MdRuntimeClient = {
68
68
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
69
69
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
70
70
  (topic: 'member'): Promise<Observation<Member | null>>;
71
+ (topic: 'authority-changes'): Promise<Observation<number>>;
71
72
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
72
73
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
73
74
  (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
@@ -1,8 +1,6 @@
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
- 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>>;
@@ -15,6 +13,7 @@ export type Composition = {
15
13
  roots: readonly string[];
16
14
  model: ModelState;
17
15
  } | null;
16
+ typedPaths: readonly TypedPath[];
18
17
  };
19
18
  export type Composed = {
20
19
  readonly composition: Composition;
@@ -25,6 +24,5 @@ export declare function selected(composition: Composition, path: string): boolea
25
24
  export declare function governing(composition: Composition, path: string): ModelState;
26
25
  export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
27
26
  export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
28
- export declare function unreadable(text: Paths<string>, paths?: Iterable<string> | null): Generator<number, Refused | null, void>;
29
27
  export declare function validRoot(root: unknown): root is string;
30
28
  export declare function available(composition: Composition): boolean;
@@ -1,15 +1,10 @@
1
1
  import type { Plan, QueryRows } from './query.js';
2
- import type { Connection, Value } from './tables.js';
2
+ import type { Connection } from './tables.js';
3
3
  export type QueryRoom = {
4
4
  readonly locator: string;
5
5
  readonly key: number;
6
6
  };
7
- export type Fragment = {
8
- readonly sql: string;
9
- readonly bind: readonly Value[];
10
- };
11
7
  export type QueryAnswer = QueryRows & {
12
8
  readonly more?: string;
13
9
  };
14
- export declare function selected(connection: Connection, plan: Plan, rooms: readonly QueryRoom[]): Fragment;
15
10
  export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
@@ -1,6 +1,7 @@
1
+ import { type DocumentQuery, type GroupQuery } from '../mdmodel/index.js';
1
2
  import { type TypesResult } from './model.js';
2
3
  import { type Observation } from './observation.js';
3
- import { type DocumentQuery, type DocumentResult, type GroupQuery, type GroupResult, type PendingResult } from './query.js';
4
+ import { type DocumentResult, type GroupResult, type PendingResult } from './query.js';
4
5
  import { type EntrySeed } from './seed.js';
5
6
  import { type SearchRequest, type SearchResult } from './search.js';
6
7
  import { type Adapter, type Authorization, type Member, type ProviderRefusal, type ServiceMode } from './adapter.js';
@@ -13,7 +14,7 @@ import { type SaveRefusal } from './save.js';
13
14
  import { type RoomDraft, type RoomDraftParts, type RoomDraftWrite } from './room-draft.js';
14
15
  import { type SyncStatus } from './status.js';
15
16
  import { type RuntimeShell } from './durability.js';
16
- import { type CodeAvailability, type Persistence, type Readiness, type SearchObligation, type Space } from './readiness.js';
17
+ import { type CodeAvailability, type Persistence, type Readiness } from './readiness.js';
17
18
  import type { RuntimeDatabase } from './tables.js';
18
19
  import { type NarrowedView, type PortReach, type RuntimeView } from './reach.js';
19
20
  export type AppTypedSelection = {
@@ -124,6 +125,7 @@ export type MdRuntime = {
124
125
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
125
126
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
126
127
  (topic: 'member'): Promise<Observation<Member | null>>;
128
+ (topic: 'authority-changes'): Promise<Observation<number>>;
127
129
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
128
130
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
129
131
  (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
@@ -135,19 +137,15 @@ export type MdRuntime = {
135
137
  };
136
138
  reauthorize(): Promise<void>;
137
139
  };
138
- export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents';
140
+ export type RuntimeTopic = 'rooms' | 'readiness' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'authority-changes' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents';
139
141
  export type ReadinessPort = {
140
142
  readonly target: string;
141
143
  readonly code: CodeAvailability;
142
- readonly space: Space | null;
143
- readonly search: SearchObligation;
144
144
  };
145
145
  export type ComposedRuntime = RuntimeView & {
146
146
  seed(entry: EntrySeed): void;
147
147
  stop(): Promise<void>;
148
- lose(locators: readonly string[]): Promise<void>;
149
148
  persisted(answer: Persistence): void;
150
- shown(onScreen: boolean): void;
151
149
  within(reach: PortReach | null, port: ReadinessPort): NarrowedView;
152
150
  };
153
151
  export declare function composeRuntime(options: MdRuntimeOptions): ComposedRuntime;
@@ -1,8 +1,7 @@
1
- import type { ConversationAction, ConversationAgents, ConversationEvent, ConversationMessage, ConversationStream, ListedConversation, ProcessCommand, SessionOption, TurnContext } from './adapter.js';
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
3
  import type { Open } from './open.js';
4
4
  import { type CallResult, type Offline } from './outcome.js';
5
- import type { DocumentResult, PendingResult } from './query.js';
6
5
  import type { CycleProgress } from './status.js';
7
6
  import type { ChatDraftRecord, HeldConversation, RuntimeStore } from './store.js';
8
7
  export type ConversationState = Open<'working' | 'asking' | 'idle'>;
@@ -10,7 +9,7 @@ export type ConversationEntry = {
10
9
  conversation: string;
11
10
  agent: {
12
11
  identity: string;
13
- name: string | null;
12
+ name: string;
14
13
  };
15
14
  name: string;
16
15
  created: string;
@@ -38,6 +37,9 @@ export type ConversationOptions = {
38
37
  after?: string;
39
38
  total?: true;
40
39
  };
40
+ export type ConversationRead = ConversationOptions & {
41
+ text?: string;
42
+ };
41
43
  export type ConversationView = {
42
44
  conversation: string;
43
45
  messages: readonly ConversationMessage[];
@@ -48,9 +50,11 @@ export type ConversationView = {
48
50
  process: {
49
51
  running: boolean;
50
52
  } | null;
53
+ processEnded: string | null;
51
54
  commands: readonly ProcessCommand[];
52
55
  options: readonly SessionOption[];
53
56
  starting: string | null;
57
+ subagents: readonly RunningSubagent[];
54
58
  link: {
55
59
  connected: boolean;
56
60
  } | null;
@@ -61,29 +65,30 @@ export type ConversationView = {
61
65
  };
62
66
  export type ConversationSurface = {
63
67
  list(): Promise<readonly ConversationEntry[]>;
64
- read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
68
+ read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
65
69
  create(input: unknown): Promise<CallResult>;
66
70
  send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
67
- answer(conversation: string, answer: unknown): Promise<CallResult>;
71
+ answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
68
72
  interrupt(conversation: string): Promise<CallResult>;
69
73
  kill(conversation: string): Promise<CallResult>;
70
- cancel(conversation: string, turn: string): Promise<CallResult>;
71
74
  delete(conversation: string): Promise<CallResult>;
72
75
  };
76
+ export type ConversationAnswer = {
77
+ interaction_id: string;
78
+ response: unknown;
79
+ };
73
80
  export type ChatDraftSurface = {
74
81
  write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
75
82
  prepend(conversation: string, draft: ChatDraft): Promise<void>;
76
83
  discard(conversation: string): Promise<void>;
77
84
  };
78
85
  export type ConversationDependencies = {
79
- agents(): ConversationAgents | undefined;
80
- documents(agents: ConversationAgents, after: string | undefined): Promise<DocumentResult | PendingResult>;
81
86
  call(name: ConversationAction, input: unknown): Promise<CallResult>;
87
+ history(request: ConversationHistoryRequest): Promise<CallResult>;
82
88
  durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
83
89
  stream(): ConversationStream | undefined;
84
90
  publish(set: ChangeSet): void;
85
91
  online(): boolean;
86
- listed(): boolean;
87
92
  full(): boolean;
88
93
  closed(): boolean;
89
94
  unanswered(): void;
@@ -92,15 +97,13 @@ export type ConversationDependencies = {
92
97
  export type ConversationStore = {
93
98
  surface: ConversationSurface;
94
99
  chatDraft: ChatDraftSurface;
95
- hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[], list: readonly ListedConversation[] | null): void;
100
+ hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[], list: readonly ListedConversation[] | null, cursor: string | null): void;
96
101
  reconcile(): Promise<void>;
97
102
  catchUp(progress: CycleProgress): Promise<void>;
98
103
  resend(progress: CycleProgress): Promise<void>;
99
104
  current(): boolean;
100
105
  known(): boolean;
101
106
  learned(): void;
102
- declared(): void;
103
- reconnected(): void;
104
107
  reopened(): void;
105
108
  lost(): void;
106
109
  watch(conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
@@ -108,8 +111,6 @@ export type ConversationStore = {
108
111
  watchAgents(deliver: (agents: readonly ConversationAgent[]) => void): () => void;
109
112
  changed(set: ChangeSet): void;
110
113
  receive(event: ConversationEvent): boolean;
111
- searchable(): readonly string[];
112
- acquired(conversation: string): boolean;
113
114
  close(): void;
114
115
  };
115
116
  export declare function unheldView(conversation: string): ConversationView;
@@ -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>;
@@ -1,5 +1,5 @@
1
1
  import type { MdRuntimeClient } from './client.js';
2
- import type { ShownAnswer } from './outcome.js';
2
+ import { type ShownAnswer } from './outcome.js';
3
3
  export declare const ROOM_MEDIA = "room-media";
4
4
  type Show = (room: string, path: string, revision?: string) => Promise<ShownAnswer>;
5
5
  export declare function shownBy(show: Show, client: MdRuntimeClient): MdRuntimeClient;
@@ -20,8 +20,8 @@ export type ConversationWrite = {
20
20
  };
21
21
  export declare function heldConversations(connection: Connection): HeldConversation[];
22
22
  export declare function keptMessages(connection: Connection, { conversation, messages, read }: ConversationWrite): null;
23
- export declare function messageWindow(connection: Connection, conversation: string, limit: number, before: readonly [string, string] | null): MessageWindow;
24
- export declare function messageCount(connection: Connection, conversation: string): number;
23
+ export declare function messageWindow(connection: Connection, conversation: string, limit: number, before: readonly [string, string] | null, phrase: string | null): MessageWindow;
24
+ export declare function messageCount(connection: Connection, conversation: string, phrase: string | null): number;
25
25
  export declare function turnArrived(connection: Connection, conversation: string, turn: string): boolean;
26
26
  export declare function droppedMessages(connection: Connection, conversations: readonly string[]): void;
27
27
  export declare function forgottenMessages(connection: Connection): void;
@@ -1,4 +1,4 @@
1
- import type { Definition, ValueFacts, VerifiedModel } from '../mdmodel/index.js';
1
+ import type { Definition, VerifiedModel } from '../mdmodel/index.js';
2
2
  import type { Open } from './open.js';
3
3
  export type ModelIdentity = {
4
4
  identity: string;
@@ -59,5 +59,3 @@ export declare function modelTypes(state: ModelState): TypesResult;
59
59
  export declare function storedModel(state: ModelState): StoredModel;
60
60
  export declare function cached(state: ModelState): ModelState;
61
61
  export declare function sameModel(left: ModelIdentity, right: ModelIdentity): boolean;
62
- export declare function sameTyping(left: ModelState, right: ModelState): boolean;
63
- export declare function referenceField(facts: ValueFacts | undefined): boolean;
@@ -27,8 +27,8 @@ export declare function rowsOf(result: QueryResult): readonly (QueryDocument | Q
27
27
  export declare function whole(message: QueryMessage): message is KeyedResult;
28
28
  export declare function applied(keyed: KeyedResult, message: QueryMessage): KeyedResult;
29
29
  export declare function observed(first: unknown, stop: () => void, keyed: boolean): Observed;
30
- export declare function opened(watch: (deliver: (message: unknown) => void) => () => void, keyed: boolean): Promise<Observation<unknown>>;
31
- export declare function observing<Topic extends string>(watch: (topic: Topic, input: readonly unknown[], deliver: (message: unknown) => void) => () => void): (topic: Topic, ...input: unknown[]) => Promise<Observation<unknown>>;
30
+ export declare function opened(watch: (deliver: (message: unknown) => void, fail: (error: unknown) => void) => () => void, keyed: boolean): Promise<Observation<unknown>>;
31
+ export declare function observing<Topic extends string>(watch: (topic: Topic, input: readonly unknown[], deliver: (message: unknown) => void, fail: (error: unknown) => void) => () => void): (topic: Topic, ...input: unknown[]) => Promise<Observation<unknown>>;
32
32
  export type Digest = {
33
33
  readonly pending: string;
34
34
  } | {
@@ -80,8 +80,5 @@ export type QueueEntry = {
80
80
  readonly batch: ChangeBatch;
81
81
  } & (Submission | {
82
82
  readonly state: 'local';
83
- } | {
84
- readonly state: 'accepted';
85
- readonly roomVersion: string;
86
83
  });
87
84
  export {};