@agentshouse/app-bridge 0.1.0-c1e94bea3fb3f → 0.1.0-c1f26b8512403

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 (57) hide show
  1. package/dist/index.d.ts +144 -49
  2. package/dist/mdmodel/definition.d.ts +1 -0
  3. package/dist/mdmodel/document.d.ts +8 -5
  4. package/dist/mdmodel/event.d.ts +2 -2
  5. package/dist/mdmodel/index.d.ts +9 -10
  6. package/dist/mdmodel/kinds.d.ts +1 -2
  7. package/dist/mdmodel/markdown.d.ts +50 -0
  8. package/dist/mdmodel/reserved.d.ts +1 -0
  9. package/dist/mdmodel/types.d.ts +7 -1
  10. package/dist/mdmodel/validate.d.ts +2 -1
  11. package/dist/mdruntime/adapter.d.ts +18 -43
  12. package/dist/mdruntime/bootstrap.d.ts +1 -1
  13. package/dist/mdruntime/change-set.d.ts +4 -0
  14. package/dist/mdruntime/client.d.ts +3 -1
  15. package/dist/mdruntime/collection.d.ts +22 -4
  16. package/dist/mdruntime/conversation-live.d.ts +134 -0
  17. package/dist/mdruntime/conversation.d.ts +23 -40
  18. package/dist/mdruntime/declaration.d.ts +9 -0
  19. package/dist/mdruntime/failure.d.ts +1 -0
  20. package/dist/mdruntime/figures.d.ts +1 -0
  21. package/dist/mdruntime/listing.d.ts +3 -4
  22. package/dist/mdruntime/media.d.ts +1 -1
  23. package/dist/mdruntime/messages.d.ts +0 -3
  24. package/dist/mdruntime/model.d.ts +0 -1
  25. package/dist/mdruntime/overlay.d.ts +2 -1
  26. package/dist/mdruntime/query.d.ts +0 -1
  27. package/dist/mdruntime/readiness.d.ts +0 -1
  28. package/dist/mdruntime/reads.d.ts +1 -0
  29. package/dist/mdruntime/replica.d.ts +5 -10
  30. package/dist/mdruntime/room-draft.d.ts +4 -5
  31. package/dist/mdruntime/runtime.d.ts +7 -17
  32. package/dist/mdruntime/save.d.ts +5 -6
  33. package/dist/mdruntime/saves.d.ts +2 -40
  34. package/dist/mdruntime/socket/rooms.d.ts +3 -5
  35. package/dist/mdruntime/socket/session.d.ts +0 -1
  36. package/dist/mdruntime/socket.d.ts +0 -1
  37. package/dist/mdruntime/store/records.d.ts +2 -4
  38. package/dist/mdruntime/store/space.d.ts +1 -1
  39. package/dist/mdruntime/store.d.ts +2 -2
  40. package/dist/mdruntime/stored.d.ts +1 -1
  41. package/dist/mdruntime/surface.d.ts +1 -1
  42. package/dist/mdruntime/tables.d.ts +4 -7
  43. package/dist/mdruntime/wire.d.ts +4 -4
  44. package/dist/session-content/bounds.d.ts +7 -0
  45. package/dist/session-content/check.d.ts +18 -0
  46. package/dist/session-content/index.d.ts +7 -0
  47. package/dist/session-content/parts.d.ts +102 -0
  48. package/dist/session-content/state.d.ts +61 -0
  49. package/dist/session-content/turn.d.ts +328 -0
  50. package/docs/families.md +1 -1
  51. package/package.json +1 -1
  52. package/dist/mdmodel/blocks.d.ts +0 -10
  53. package/dist/mdmodel/links.d.ts +0 -28
  54. package/dist/mdmodel/profile.d.ts +0 -5
  55. package/dist/mdruntime/install.d.ts +0 -55
  56. package/dist/mdruntime/job.d.ts +0 -32
  57. package/dist/mdruntime/turn.d.ts +0 -8
package/dist/index.d.ts CHANGED
@@ -208,7 +208,6 @@ export interface HouseMethods {
208
208
  readonly conversation_id: string;
209
209
  readonly jobs: readonly {
210
210
  readonly name: string;
211
- readonly running_since: string;
212
211
  }[];
213
212
  readonly log_epoch: string;
214
213
  readonly position: string;
@@ -232,47 +231,150 @@ export interface HouseMethods {
232
231
  readonly conversation_id: string;
233
232
  readonly messages: readonly {
234
233
  readonly accepted_at: string;
235
- readonly context: null | {
236
- readonly used: number;
237
- readonly window: number;
234
+ readonly content: null | {
235
+ readonly parts: readonly ({
236
+ readonly calls: null | number;
237
+ readonly duration: null | number;
238
+ readonly kind: "agent" | "fork" | "workflow";
239
+ readonly name: null | string;
240
+ readonly parent: null | number;
241
+ readonly report: null | string;
242
+ readonly status: "done" | "failed" | "running" | "stopped";
243
+ readonly step: null | string;
244
+ readonly task: string;
245
+ readonly tokens: null | number;
246
+ readonly type: "subagent";
247
+ } | {
248
+ readonly command: string;
249
+ readonly parent: null | number;
250
+ readonly target: null | string;
251
+ readonly type: "message";
252
+ } | {
253
+ readonly duration: null | number;
254
+ readonly exit: null | number;
255
+ readonly kind: "command";
256
+ readonly line: string;
257
+ readonly output: string;
258
+ readonly parent: null | number;
259
+ readonly status: "done" | "failed" | "running" | "stopped";
260
+ readonly type: "call";
261
+ } | {
262
+ readonly duration: null | number;
263
+ readonly files: readonly {
264
+ readonly added: number;
265
+ readonly diff: null | string;
266
+ readonly path: string;
267
+ readonly removed: number;
268
+ }[];
269
+ readonly kind: "edit";
270
+ readonly line: string;
271
+ readonly parent: null | number;
272
+ readonly status: "done" | "failed" | "running" | "stopped";
273
+ readonly type: "call";
274
+ } | {
275
+ readonly duration: null | number;
276
+ readonly kind: "fetch" | "other" | "tool";
277
+ readonly line: string;
278
+ readonly output: string;
279
+ readonly parent: null | number;
280
+ readonly status: "done" | "failed" | "running" | "stopped";
281
+ readonly type: "call";
282
+ } | {
283
+ readonly duration: null | number;
284
+ readonly kind: "read" | "search";
285
+ readonly line: string;
286
+ readonly parent: null | number;
287
+ readonly returned: null | number;
288
+ readonly status: "done" | "failed" | "running" | "stopped";
289
+ readonly type: "call";
290
+ } | {
291
+ readonly entries: readonly {
292
+ readonly content: string;
293
+ readonly status: "done" | "pending" | "running";
294
+ }[];
295
+ readonly parent: null | number;
296
+ readonly type: "plan";
297
+ } | {
298
+ readonly file: string;
299
+ readonly media_type: string;
300
+ readonly name: string;
301
+ readonly parent: null | number;
302
+ readonly type: "image";
303
+ } | {
304
+ readonly kind: "compaction" | "error" | "info" | "mode" | "model" | "retry" | "warning";
305
+ readonly parent: null | number;
306
+ readonly text: string;
307
+ readonly type: "notice";
308
+ } | {
309
+ readonly kind: "monitor" | "schedule" | "shell" | "task";
310
+ readonly label: string;
311
+ readonly parent: null | number;
312
+ readonly status: "done" | "failed" | "running" | "stopped";
313
+ readonly type: "background";
314
+ } | {
315
+ readonly parent: null | number;
316
+ readonly text: string;
317
+ readonly type: "reasoning" | "text";
318
+ })[];
319
+ readonly state: {
320
+ readonly branch: null | string;
321
+ readonly context: null | {
322
+ readonly breakdown: readonly {
323
+ readonly name: string;
324
+ readonly tokens: number;
325
+ }[];
326
+ readonly used: number;
327
+ readonly window: number;
328
+ };
329
+ readonly cost: null | {
330
+ readonly amount: number;
331
+ readonly currency: string;
332
+ };
333
+ readonly duration: null | number;
334
+ readonly effort: null | string;
335
+ readonly files: readonly {
336
+ readonly added: number;
337
+ readonly path: string;
338
+ readonly removed: number;
339
+ }[];
340
+ readonly limits: readonly {
341
+ readonly minutes: number;
342
+ readonly name: null | string;
343
+ readonly percent: number;
344
+ readonly resets: null | string;
345
+ }[];
346
+ readonly mode: null | string;
347
+ readonly model: null | string;
348
+ readonly pull: null | {
349
+ readonly number: number;
350
+ readonly url: string;
351
+ };
352
+ readonly running: readonly {
353
+ readonly kind: "monitor" | "schedule" | "shell" | "subagent" | "task";
354
+ readonly label: string;
355
+ readonly next: null | string;
356
+ readonly progress: null | string;
357
+ }[];
358
+ readonly suggestion: null | string;
359
+ readonly title: null | string;
360
+ readonly tokens: null | {
361
+ readonly cache_read: number;
362
+ readonly cache_write: number;
363
+ readonly input: number;
364
+ readonly output: number;
365
+ };
366
+ readonly worktree: null | string;
367
+ };
368
+ readonly tokens: null | {
369
+ readonly cache_read: number;
370
+ readonly cache_write: number;
371
+ readonly input: number;
372
+ readonly output: number;
373
+ };
238
374
  };
239
375
  readonly conversation_id: string;
240
376
  readonly failure: null | string;
241
377
  readonly message_id: string;
242
- readonly parts: readonly ({
243
- readonly command: string;
244
- readonly target: null | string;
245
- readonly type: "message";
246
- } | {
247
- readonly count: number;
248
- readonly type: "commands";
249
- } | {
250
- readonly description: string;
251
- readonly result: null | string;
252
- readonly status: "done" | "running";
253
- readonly type: "subagent";
254
- } | {
255
- readonly entries: readonly {
256
- readonly content: string;
257
- readonly status: string;
258
- }[];
259
- readonly type: "plan";
260
- } | {
261
- readonly file: string;
262
- readonly media_type: string;
263
- readonly name: string;
264
- readonly type: "image";
265
- } | {
266
- readonly marker: "compaction" | "job" | "mode" | "model" | "retry";
267
- readonly text: string;
268
- readonly type: "marker";
269
- } | {
270
- readonly text: string;
271
- readonly type: "reasoning";
272
- } | {
273
- readonly text: string;
274
- readonly type: "text";
275
- })[];
276
378
  readonly role: "assistant" | "house" | "user";
277
379
  readonly sender?: "conversation" | "customer" | "owner" | "replier" | "report" | "requester" | "trigger";
278
380
  readonly source?: {
@@ -356,12 +458,6 @@ export interface HouseMethods {
356
458
  };
357
459
  readonly telegram_undelivered?: true;
358
460
  readonly text: string;
359
- readonly tokens?: {
360
- readonly cache_read: number;
361
- readonly cache_write: number;
362
- readonly input: number;
363
- readonly output: number;
364
- };
365
461
  readonly transcripts?: readonly {
366
462
  readonly path: string;
367
463
  readonly text: string;
@@ -834,14 +930,14 @@ export interface HouseMethods {
834
930
  readonly limit: "custom_domains" | "external_calls" | "publish_data" | "sites";
835
931
  readonly outcome: "refused";
836
932
  readonly position: number;
837
- } | {
838
- readonly code: "agent_function_not_found" | "agent_function_retired" | "app_function_not_found" | "app_not_found" | "environment_function_not_found" | "environment_offline" | "no_recipient" | "target_agent_unavailable";
839
- readonly outcome: "no_target";
840
- readonly position: number;
841
933
  } | {
842
934
  readonly code: "agent_function_request_not_started" | "internal_error";
843
935
  readonly outcome: "failed";
844
936
  readonly position: number;
937
+ } | {
938
+ readonly code: "agent_function_retired" | "environment_offline" | "no_recipient" | "not_found" | "target_agent_unavailable";
939
+ readonly outcome: "no_target";
940
+ readonly position: number;
845
941
  } | {
846
942
  readonly code: string;
847
943
  readonly outcome: "refused";
@@ -937,7 +1033,6 @@ export interface HouseStatus {
937
1033
  readonly sync: HouseSyncState | null;
938
1034
  readonly refusal: {
939
1035
  readonly code: string;
940
- readonly retryable: boolean;
941
1036
  } | null;
942
1037
  readonly loss: string | null;
943
1038
  readonly database: Open<HouseDatabaseFailure> | null;
@@ -78,4 +78,5 @@ export type PointerFacts = {
78
78
  export declare function crossedFacts(facts: ValueFacts): ValueFacts[];
79
79
  export declare function fieldFacts(definition: Definition, key: string): ValueFacts | undefined;
80
80
  export declare function pointerFacts(definition: Definition, pointer: string): PointerFacts | undefined;
81
+ export declare function untitled(definition: Definition): Definition;
81
82
  export declare function readSchema(text: string, provided?: VerifiedModel, checked?: boolean): VerifiedModel | Failure;
@@ -1,16 +1,19 @@
1
1
  import { type Definition } from './definition.js';
2
- import { type LinkInventory } from './links.js';
3
- import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, ParseResult, UnlinkedBody } from './types.js';
2
+ import { type HrefOccurrence, type Reading } from './markdown.js';
3
+ import type { ApplyResult, BodyResult, FrontmatterResult, Change, DefinitionOf, Document, Link, ParseResult, Span, UnlinkedBody } from './types.js';
4
4
  import { type YamlMap } from './yaml.js';
5
- export declare function inventoryOf(document: Document): LinkInventory;
5
+ export declare function readingOf(document: Document): Reading;
6
+ export declare function linkDestinations(document: Document): readonly HrefOccurrence[];
7
+ export declare function textSpans(document: Document): readonly Span[];
6
8
  export declare function parseFrontmatter(content: string, file?: string): FrontmatterResult;
7
- export declare function parse(content: string, file?: string): ParseResult;
9
+ export declare function parse(content: string, file?: string, definition?: Definition | DefinitionOf): ParseResult;
10
+ export declare function create(type: string | undefined, definition?: Definition): Document;
8
11
  export declare function relativize(document: Document, file: string, handle: string, definition?: Definition, kept?: ReadonlySet<string>): ApplyResult;
9
12
  export declare function relativizeBody(body: string, file: string, handle: string): BodyResult;
10
13
  export declare function relinkBody(body: string, file: string, moves: ReadonlyMap<string, string>): BodyResult;
11
14
  export declare function unlinkBody(body: string, hrefs: ReadonlySet<string>): UnlinkedBody;
12
15
  export declare function links(document: Document, file: string): readonly Link[];
13
16
  export declare function bodyLinks(body: string, file: string): readonly Link[];
14
- export declare function apply(document: Document, changes: readonly Change[]): ApplyResult;
17
+ export declare function apply(document: Document, changes: readonly Change[], definition?: Definition): ApplyResult;
15
18
  export declare function serialize(document: Document): string;
16
19
  export declare function frontmatter(document: Document): YamlMap | null;
@@ -1,10 +1,10 @@
1
1
  import { type Definition } from './definition.js';
2
+ import { type Kind } from './kinds.js';
2
3
  import type { Candidate } from './query/match.js';
3
4
  import type { Document, VerifiedModel } from './types.js';
4
- export type FactKind = 'string' | 'number' | 'boolean' | 'date' | 'time' | 'enum' | 'reference';
5
5
  type Scalar = string | number | boolean;
6
6
  export type Fact = {
7
- readonly kind: FactKind;
7
+ readonly kind: Kind;
8
8
  readonly value: Scalar;
9
9
  readonly member?: string;
10
10
  } | {
@@ -1,6 +1,6 @@
1
1
  export { candidateOf, datePointers, facts, memberPointers, members, pointed, prosePaths, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './event.js';
2
- export type { Actor, DocumentEvent, DocumentFacts, Fact, FactKind, ItemFacts, MessageFacts, Resolved, WriteDoor, } from './event.js';
3
- export { byCodePoint, compared, dated, fitsKind, instant, instantKey, KINDS, kindOf, kindWords, } from './kinds.js';
2
+ export type { Actor, DocumentEvent, DocumentFacts, Fact, ItemFacts, MessageFacts, Resolved, WriteDoor, } from './event.js';
3
+ export { byCodePoint, compared, dated, fitsKind, instant, instantKey, kindOf, kindWords, } from './kinds.js';
4
4
  export type { Kind, Ordering } from './kinds.js';
5
5
  export { bodied, cursorOf, decodedCursor, identityOf, invalid, known, placeText, planOf, QueryError, queryKey, } from './query/language.js';
6
6
  export type { Clause, Continuation, Direction, DocumentQuery, DocumentShape, Filter, GroupKey, GroupOrder, GroupQuery, GroupSelect, GroupShape, HeldRooms, Key, KeyPlan, LocalQuery, OrderOptions, Place, Predicate, QueryErrorCode, QueryPlan, Related, RoomFacts, Scope, Select, Test, Value, Where, } from './query/language.js';
@@ -9,24 +9,23 @@ export type { Candidate } from './query/match.js';
9
9
  export { heldKind, indexed } from './query/rows.js';
10
10
  export type { HeldKind, HeldLink, HeldValue, Indexed, Reach } from './query/rows.js';
11
11
  export * as sql from './query/sql.js';
12
- export { headingLines } from './blocks.js';
13
- export type { HeadingLine } from './blocks.js';
12
+ export { headingLines } from './markdown.js';
13
+ export type { HeadingLine } from './markdown.js';
14
14
  export { divide } from './divide.js';
15
- export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, unlinkBody, } from './document.js';
15
+ export { apply, bodyLinks, create, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, textSpans, unlinkBody, } from './document.js';
16
16
  export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
17
17
  export type { ReferenceTarget, SavedFacts } from './facts.js';
18
18
  export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
19
19
  export { relative, retarget, roomPath, roomTarget, target } from './paths.js';
20
20
  export { openPatternBudget } from './pattern.js';
21
21
  export type { RoomTarget } from './paths.js';
22
- export { MARKDOWN_SYNTAX_PROFILE } from './profile.js';
23
22
  export { project } from './project.js';
24
23
  export { references } from './references.js';
25
- export { isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION } from './reserved.js';
26
- export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
24
+ export { CAPTURE_HOME, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION, } from './reserved.js';
25
+ export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, untitled, } from './definition.js';
27
26
  export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
28
- export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
29
- export { assess, assessReferences, bodyRoomLinks, checkDocument, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
27
+ export type { ApplyResult, BodyResult, Change, DefinitionOf, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
28
+ export { assess, assessReferences, bodyRoomLinks, checkDocument, definitionAt, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
30
29
  export type { Assessment, Verdicts } from './validate.js';
31
30
  export { VERSION } from './version.js';
32
31
  export { bodyAfterFrontmatter, equalValue, frontmatterValue, plain } from './yaml.js';
@@ -1,6 +1,5 @@
1
1
  import type { ValueFacts } from './definition.js';
2
- export declare const KINDS: readonly ['string', 'number', 'integer', 'boolean', 'date', 'date-time', 'time', 'enum', 'reference'];
3
- export type Kind = (typeof KINDS)[number];
2
+ export type Kind = 'string' | 'number' | 'integer' | 'boolean' | 'date' | 'date-time' | 'time' | 'enum' | 'reference';
4
3
  export type Ordering = {
5
4
  readonly direction: 'asc' | 'desc';
6
5
  readonly nulls: 'first' | 'last';
@@ -0,0 +1,50 @@
1
+ import type { Extent } from './types.js';
2
+ export type HeadingLine = {
3
+ readonly level: number;
4
+ readonly name: string;
5
+ readonly start: number;
6
+ readonly textEnd: number;
7
+ readonly next: number;
8
+ };
9
+ export type HrefOccurrence = {
10
+ readonly href: string;
11
+ readonly start: number;
12
+ readonly end: number;
13
+ readonly bracketed: boolean;
14
+ };
15
+ export type LinkUse = {
16
+ readonly start: number;
17
+ readonly end: number;
18
+ readonly labelStart: number;
19
+ readonly labelEnd: number;
20
+ readonly destination: HrefOccurrence;
21
+ };
22
+ export type DefinitionBlock = {
23
+ readonly start: number;
24
+ readonly end: number;
25
+ readonly destination: HrefOccurrence;
26
+ };
27
+ export type Block = Extent & {
28
+ readonly items: readonly Extent[] | null;
29
+ };
30
+ export type Reading = {
31
+ readonly headings: readonly HeadingLine[];
32
+ readonly blocks: readonly Block[];
33
+ readonly uses: readonly LinkUse[];
34
+ readonly definitions: readonly DefinitionBlock[];
35
+ };
36
+ export declare function read(text: string, at?: number): Reading;
37
+ export declare function destinations(reading: Reading): readonly HrefOccurrence[];
38
+ export declare function hrefOccurrences(body: string): readonly HrefOccurrence[];
39
+ export declare function headingLines(content: string, from: number, to: number): HeadingLine[];
40
+ export type SectionSpan = {
41
+ readonly name: string;
42
+ readonly headingStart: number;
43
+ readonly bodyStart: number;
44
+ readonly bodyEnd: number;
45
+ };
46
+ export declare function sectionSpans(reading: Reading, end: number): SectionSpan[];
47
+ export declare function sectionsRecord(spans: readonly SectionSpan[], content: string): Record<string, string>;
48
+ export declare function headingsIn(reading: Reading, from: number, to: number): readonly HeadingLine[];
49
+ export declare function listItems(reading: Reading, from: number, to: number): Extent[] | null;
50
+ export declare function blockRanges(reading: Reading, from: number, to: number): Extent[];
@@ -1,4 +1,5 @@
1
1
  export declare const ROOM_DESCRIPTION = "ROOM.md";
2
+ export declare const CAPTURE_HOME = "capture";
2
3
  export declare const RESERVED_NAMES: readonly string[];
3
4
  export declare function isReservedName(name: string): boolean;
4
5
  export declare function isDocumentPath(path: string): boolean;
@@ -45,7 +45,9 @@ export type Frontmatter = {
45
45
  export type Document = Frontmatter & {
46
46
  readonly preamble: string;
47
47
  readonly sections: Readonly<Record<string, string>>;
48
+ readonly text: string;
48
49
  };
50
+ export type DefinitionOf = (type: string | undefined) => Definition | undefined;
49
51
  export type Refusal = {
50
52
  readonly file: string;
51
53
  readonly rule: string;
@@ -139,11 +141,15 @@ export type Change = {
139
141
  readonly kind: 'section';
140
142
  readonly name: string;
141
143
  readonly value: string;
142
- readonly prior: string;
144
+ readonly prior: string | undefined;
143
145
  } | {
144
146
  readonly kind: 'preamble';
145
147
  readonly value: string;
146
148
  readonly prior: string;
149
+ } | {
150
+ readonly kind: 'text';
151
+ readonly value: string;
152
+ readonly prior: string;
147
153
  } | {
148
154
  readonly kind: 'link';
149
155
  readonly href: string;
@@ -1,5 +1,6 @@
1
1
  import { type Definition } from './definition.js';
2
- import type { Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
2
+ import type { DefinitionOf, Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
3
+ export declare function definitionAt(model: VerifiedModel, file: string, typedPaths?: readonly TypedPath[]): DefinitionOf;
3
4
  export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
4
5
  export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
5
6
  export declare function readTypes(schema: string, provided?: VerifiedModel): VerifiedModel;
@@ -1,4 +1,5 @@
1
1
  import type { SavedFacts, TypedPath } from '../mdmodel/index.js';
2
+ import type { Operation, SessionState } from '../session-content/index.js';
2
3
  import type { ModelResult } from './model.js';
3
4
  export type { SavedFacts, TypedPath };
4
5
  import type { Open } from './open.js';
@@ -20,15 +21,18 @@ export type ReplicaAdmission = {
20
21
  admission: Open<'admitted' | 'unavailable'>;
21
22
  offline: Open<'locked' | 'open'>;
22
23
  };
23
- export type DiscoveredRoom = {
24
- name: string;
25
- locator: string;
26
- handle: string;
27
- roomVersion: string;
28
- operations: OperationScopes;
29
- replica: ReplicaAdmission;
30
- typedSelection?: TypedSelection;
31
- providerOwnedPaths: readonly string[];
24
+ export type RoomDeclaration = {
25
+ readonly name: string;
26
+ readonly handle: string;
27
+ readonly operations: OperationScopes;
28
+ readonly replica: ReplicaAdmission;
29
+ readonly typedSelection: TypedSelection | null;
30
+ readonly providerOwnedPaths: readonly string[];
31
+ readonly authoredPaths: readonly string[];
32
+ };
33
+ export type DiscoveredRoom = RoomDeclaration & {
34
+ readonly locator: string;
35
+ readonly roomVersion: string;
32
36
  };
33
37
  export type Capability = {
34
38
  name: string;
@@ -72,37 +76,10 @@ export type ConversationHistoryPage = {
72
76
  export type ConversationHistories = {
73
77
  histories: readonly ConversationHistoryPage[];
74
78
  };
75
- export type TurnContext = {
76
- used: number;
77
- window: number;
78
- };
79
79
  export type TurnOperation = {
80
80
  op: 'begin';
81
81
  at: string;
82
- } | {
83
- op: 'start';
84
- index: number;
85
- part: unknown;
86
- } | {
87
- op: 'append';
88
- index: number;
89
- text: string;
90
- } | {
91
- op: 'status';
92
- index: number;
93
- status: string;
94
- result: unknown;
95
- } | {
96
- op: 'count';
97
- index: number;
98
- count: number;
99
- } | {
100
- op: 'plan';
101
- index: number;
102
- entries: readonly unknown[];
103
- } | ({
104
- op: 'context';
105
- } & TurnContext);
82
+ } | Operation;
106
83
  export type ProcessCommand = {
107
84
  [field: string]: unknown;
108
85
  name: string;
@@ -139,10 +116,6 @@ export type SessionOption = (SessionOptionNaming & {
139
116
  type: 'boolean';
140
117
  currentValue: boolean;
141
118
  });
142
- export type RunningSubagent = {
143
- description: string;
144
- activity: string | null;
145
- };
146
119
  export type ConversationEvent = {
147
120
  kind: 'turn';
148
121
  conversation: string;
@@ -169,9 +142,9 @@ export type ConversationEvent = {
169
142
  conversation: string;
170
143
  step: string | null;
171
144
  } | {
172
- kind: 'subagents';
145
+ kind: 'state';
173
146
  conversation: string;
174
- subagents: readonly RunningSubagent[];
147
+ state: SessionState | null;
175
148
  } | {
176
149
  kind: 'link';
177
150
  conversation: string;
@@ -521,11 +494,13 @@ export type RoomStream = {
521
494
  hold(rooms: readonly HeldRoom[]): void;
522
495
  observe(notify: (event: RoomStreamEvent) => void): () => void;
523
496
  };
497
+ export type PathRule = (path: string) => boolean;
524
498
  export type Adapter = {
525
499
  readonly localSaves?: true;
526
500
  readonly roomTypes?: string;
527
501
  readonly nameableRoomTypes?: readonly string[];
528
502
  readonly typedPaths?: readonly TypedPath[];
503
+ readonly pathRule?: PathRule;
529
504
  readonly unkeptReads?: readonly string[];
530
505
  readonly leadingReads?: readonly string[];
531
506
  authorize(): Promise<Authorization>;
@@ -3,7 +3,7 @@ import type { Adapter, TypedPath, AdapterFailure, Authorization, BootstrapPart,
3
3
  import type { Composition } from './collection.js';
4
4
  import type { InstallationStep } from './readiness.js';
5
5
  import { type Refreshing } from './refresh.js';
6
- import type { ReplicaRecord } from './replica.js';
6
+ import { type ReplicaRecord } from './replica.js';
7
7
  import type { StagedPage, TransferRecord } from './store.js';
8
8
  import { type Unconfirmed } from './transfer.js';
9
9
  export type Bootstrapped = {
@@ -12,6 +12,8 @@ export type ChangeSet = {
12
12
  queues: readonly string[];
13
13
  presentations: readonly string[];
14
14
  conversations: readonly string[];
15
+ unindexed: readonly string[];
16
+ due: readonly string[];
15
17
  };
16
18
  type Changed = {
17
19
  documents?: readonly string[] | null;
@@ -19,6 +21,8 @@ type Changed = {
19
21
  room?: boolean;
20
22
  queue?: boolean;
21
23
  presentation?: string;
24
+ unindexed?: boolean;
25
+ due?: boolean;
22
26
  };
23
27
  export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
24
28
  export declare function conversationChangeSet(conversations: readonly string[]): ChangeSet;
@@ -18,7 +18,9 @@ import type { Readiness } from './readiness.js';
18
18
  import type { ObservedRead } from './reads.js';
19
19
  import type { SyncStatus } from './status.js';
20
20
  import { type RuntimePort } from './wire.js';
21
+ export type BuildFile = (name: string) => Promise<Blob | null>;
21
22
  export type MdRuntimeClient = {
23
+ buildFile(name: string): Promise<Blob | null>;
22
24
  rooms(): Promise<readonly AppRoom[]>;
23
25
  query: {
24
26
  (query: DocumentQuery): Promise<DocumentResult | PendingResult>;
@@ -95,7 +97,7 @@ export type MdRuntimeClient = {
95
97
  reauthorize(): Promise<void>;
96
98
  settled(): Promise<void>;
97
99
  };
98
- export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
100
+ export declare function connectMdRuntime(port: RuntimePort, buildFile?: BuildFile): MdRuntimeClient;
99
101
  export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
100
102
  export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
101
103
  export { roomDraftRevision } from './identity.js';
@@ -1,5 +1,6 @@
1
- import { type Document, type TypedPath } from '../mdmodel/index.js';
2
- import type { ModelState } from './model.js';
1
+ import { type DefinitionOf, type Document, type TypedPath } from '../mdmodel/index.js';
2
+ import type { ModelState, TypesResult } from './model.js';
3
+ import type { AppTypedSelection } from './listing.js';
3
4
  import type { MdModelIdentity } from './adapter.js';
4
5
  export declare const MD_MODEL: MdModelIdentity;
5
6
  export type Collection = {
@@ -20,9 +21,26 @@ export type Composed = {
20
21
  readonly fingerprint: string;
21
22
  };
22
23
  export declare function composedOf(composition: Composition): Composed;
23
- export declare function selected(composition: Composition, path: string): boolean;
24
- export declare function governing(composition: Composition, path: string): ModelState;
24
+ type Selecting<M> = {
25
+ readonly model: M;
26
+ readonly selection: {
27
+ readonly roots: readonly string[];
28
+ readonly model: M;
29
+ } | null;
30
+ };
31
+ export declare function selected(composition: {
32
+ readonly selection: {
33
+ readonly roots: readonly string[];
34
+ } | null;
35
+ }, path: string): boolean;
36
+ export declare function governing<M>(composition: Selecting<M>, path: string): M;
37
+ export declare function definitionsAt(composition: Composition, path: string): DefinitionOf;
38
+ export declare function definitionsIn(room: {
39
+ readonly model: TypesResult;
40
+ readonly typedSelection: AppTypedSelection | null;
41
+ }, path: string, typedPaths: readonly TypedPath[]): DefinitionOf;
25
42
  export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
26
43
  export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
27
44
  export declare function validRoot(root: unknown): root is string;
28
45
  export declare function available(composition: Composition): boolean;
46
+ export {};