@agentshouse/app-bridge 0.1.0-c120f682ecb11 → 0.1.0-c15ccb5b094dd

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 (83) hide show
  1. package/dist/index.d.ts +205 -50
  2. package/dist/mdmodel/definition.d.ts +15 -0
  3. package/dist/mdmodel/document.d.ts +9 -5
  4. package/dist/mdmodel/event.d.ts +2 -2
  5. package/dist/mdmodel/index.d.ts +10 -11
  6. package/dist/mdmodel/kinds.d.ts +1 -2
  7. package/dist/mdmodel/markdown.d.ts +50 -0
  8. package/dist/mdmodel/query/language.d.ts +35 -4
  9. package/dist/mdmodel/reserved.d.ts +1 -0
  10. package/dist/mdmodel/types.d.ts +11 -1
  11. package/dist/mdmodel/validate.d.ts +2 -1
  12. package/dist/mdruntime/actions.d.ts +19 -0
  13. package/dist/mdruntime/adapter.d.ts +21 -43
  14. package/dist/mdruntime/attached-model.d.ts +7 -0
  15. package/dist/mdruntime/bootstrap.d.ts +43 -0
  16. package/dist/mdruntime/cell.d.ts +5 -0
  17. package/dist/mdruntime/change-set.d.ts +4 -0
  18. package/dist/mdruntime/client.d.ts +15 -2
  19. package/dist/mdruntime/collection.d.ts +22 -4
  20. package/dist/mdruntime/compile.d.ts +5 -0
  21. package/dist/mdruntime/conversation-live.d.ts +134 -0
  22. package/dist/mdruntime/conversation-row.d.ts +32 -0
  23. package/dist/mdruntime/conversation.d.ts +29 -39
  24. package/dist/mdruntime/declaration.d.ts +9 -0
  25. package/dist/mdruntime/durability.d.ts +9 -0
  26. package/dist/mdruntime/failure.d.ts +1 -0
  27. package/dist/mdruntime/figures.d.ts +48 -0
  28. package/dist/mdruntime/holdings.d.ts +28 -0
  29. package/dist/mdruntime/listing.d.ts +51 -0
  30. package/dist/mdruntime/live.d.ts +22 -0
  31. package/dist/mdruntime/log.d.ts +5 -0
  32. package/dist/mdruntime/media.d.ts +1 -1
  33. package/dist/mdruntime/messages.d.ts +21 -0
  34. package/dist/mdruntime/model.d.ts +0 -1
  35. package/dist/mdruntime/outcome.d.ts +4 -1
  36. package/dist/mdruntime/overlay.d.ts +2 -1
  37. package/dist/mdruntime/preparation.d.ts +19 -0
  38. package/dist/mdruntime/query.d.ts +10 -1
  39. package/dist/mdruntime/reach.d.ts +3 -1
  40. package/dist/mdruntime/readiness.d.ts +0 -1
  41. package/dist/mdruntime/reads.d.ts +36 -0
  42. package/dist/mdruntime/refresh.d.ts +26 -0
  43. package/dist/mdruntime/replica.d.ts +5 -13
  44. package/dist/mdruntime/room-draft.d.ts +4 -5
  45. package/dist/mdruntime/room-drafts.d.ts +23 -0
  46. package/dist/mdruntime/runtime.d.ts +31 -0
  47. package/dist/mdruntime/save.d.ts +5 -6
  48. package/dist/mdruntime/saves.d.ts +31 -0
  49. package/dist/mdruntime/seed.d.ts +11 -2
  50. package/dist/mdruntime/socket/admission.d.ts +6 -0
  51. package/dist/mdruntime/socket/answers.d.ts +5 -0
  52. package/dist/mdruntime/socket/lanes.d.ts +19 -0
  53. package/dist/mdruntime/socket/rooms.d.ts +40 -0
  54. package/dist/mdruntime/socket/session.d.ts +37 -0
  55. package/dist/mdruntime/socket.d.ts +68 -0
  56. package/dist/mdruntime/source.d.ts +60 -0
  57. package/dist/mdruntime/store/fences.d.ts +15 -0
  58. package/dist/mdruntime/store/installs.d.ts +29 -0
  59. package/dist/mdruntime/store/readiness.d.ts +9 -0
  60. package/dist/mdruntime/store/records.d.ts +209 -0
  61. package/dist/mdruntime/store/room-held.d.ts +7 -0
  62. package/dist/mdruntime/store/space.d.ts +10 -0
  63. package/dist/mdruntime/store/watchers.d.ts +16 -0
  64. package/dist/mdruntime/store/writes.d.ts +23 -0
  65. package/dist/mdruntime/store.d.ts +111 -203
  66. package/dist/mdruntime/stored.d.ts +1 -1
  67. package/dist/mdruntime/surface.d.ts +87 -0
  68. package/dist/mdruntime/tables.d.ts +37 -6
  69. package/dist/mdruntime/tallies.d.ts +17 -0
  70. package/dist/mdruntime/transfer.d.ts +4 -0
  71. package/dist/mdruntime/wire.d.ts +12 -5
  72. package/dist/session-content/bounds.d.ts +7 -0
  73. package/dist/session-content/check.d.ts +18 -0
  74. package/dist/session-content/index.d.ts +7 -0
  75. package/dist/session-content/parts.d.ts +102 -0
  76. package/dist/session-content/state.d.ts +61 -0
  77. package/dist/session-content/turn.d.ts +328 -0
  78. package/docs/families.md +1 -1
  79. package/package.json +1 -1
  80. package/dist/mdmodel/blocks.d.ts +0 -10
  81. package/dist/mdmodel/links.d.ts +0 -28
  82. package/dist/mdmodel/profile.d.ts +0 -5
  83. package/dist/mdruntime/connection.d.ts +0 -154
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;
@@ -610,6 +706,7 @@ export interface HouseMethods {
610
706
  readonly "storage/inventory/read": {
611
707
  readonly params: {
612
708
  readonly room_ref?: string;
709
+ readonly rooms?: "owned";
613
710
  };
614
711
  readonly result: {
615
712
  readonly blob: {
@@ -661,6 +758,35 @@ export interface HouseMethods {
661
758
  readonly layout: string;
662
759
  };
663
760
  };
761
+ readonly rooms?: readonly {
762
+ readonly blob: {
763
+ readonly bytes: string;
764
+ readonly gigabytes: string;
765
+ };
766
+ readonly freshness: {
767
+ readonly state: "settled";
768
+ };
769
+ readonly indexed_text: {
770
+ readonly approximate_pages: null | string;
771
+ readonly bytes: string;
772
+ readonly gigabytes: string;
773
+ };
774
+ readonly measurement: {
775
+ readonly page_reference: null | {
776
+ readonly bytes_per_page: string;
777
+ readonly encoding: string;
778
+ readonly font: string;
779
+ readonly font_size_pt: string;
780
+ readonly layout: string;
781
+ };
782
+ };
783
+ readonly room_ref: string;
784
+ readonly total: {
785
+ readonly bytes: string;
786
+ readonly gigabytes: string;
787
+ };
788
+ readonly url: string;
789
+ }[];
664
790
  readonly site_images: {
665
791
  readonly bound: string;
666
792
  readonly bytes: string;
@@ -692,6 +818,35 @@ export interface HouseMethods {
692
818
  readonly layout: string;
693
819
  };
694
820
  };
821
+ readonly rooms?: readonly {
822
+ readonly blob: {
823
+ readonly bytes: string;
824
+ readonly gigabytes: string;
825
+ };
826
+ readonly freshness: {
827
+ readonly state: "settled";
828
+ };
829
+ readonly indexed_text: {
830
+ readonly approximate_pages: null | string;
831
+ readonly bytes: string;
832
+ readonly gigabytes: string;
833
+ };
834
+ readonly measurement: {
835
+ readonly page_reference: null | {
836
+ readonly bytes_per_page: string;
837
+ readonly encoding: string;
838
+ readonly font: string;
839
+ readonly font_size_pt: string;
840
+ readonly layout: string;
841
+ };
842
+ };
843
+ readonly room_ref: string;
844
+ readonly total: {
845
+ readonly bytes: string;
846
+ readonly gigabytes: string;
847
+ };
848
+ readonly url: string;
849
+ }[];
695
850
  readonly total: {
696
851
  readonly bytes: string;
697
852
  readonly gigabytes: string;
@@ -700,7 +855,7 @@ export interface HouseMethods {
700
855
  };
701
856
  readonly "triggers/fired/list": {
702
857
  readonly params: {
703
- readonly room_ref: string;
858
+ readonly room_ref?: string;
704
859
  };
705
860
  readonly result: {
706
861
  readonly events: readonly {
@@ -775,14 +930,14 @@ export interface HouseMethods {
775
930
  readonly limit: "custom_domains" | "external_calls" | "publish_data" | "sites";
776
931
  readonly outcome: "refused";
777
932
  readonly position: number;
778
- } | {
779
- 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";
780
- readonly outcome: "no_target";
781
- readonly position: number;
782
933
  } | {
783
934
  readonly code: "agent_function_request_not_started" | "internal_error";
784
935
  readonly outcome: "failed";
785
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;
786
941
  } | {
787
942
  readonly code: string;
788
943
  readonly outcome: "refused";
@@ -834,6 +989,7 @@ export interface HouseMethods {
834
989
  readonly missed?: "failed" | "skipped";
835
990
  readonly moment?: string;
836
991
  readonly path?: string;
992
+ readonly room_ref?: string;
837
993
  readonly trigger: string;
838
994
  readonly url?: string;
839
995
  }[];
@@ -877,7 +1033,6 @@ export interface HouseStatus {
877
1033
  readonly sync: HouseSyncState | null;
878
1034
  readonly refusal: {
879
1035
  readonly code: string;
880
- readonly retryable: boolean;
881
1036
  } | null;
882
1037
  readonly loss: string | null;
883
1038
  readonly database: Open<HouseDatabaseFailure> | null;
@@ -56,17 +56,31 @@ export type Failure = {
56
56
  readonly rule: string;
57
57
  readonly location?: string;
58
58
  };
59
+ export type Placed = {
60
+ readonly node: Record<string, unknown>;
61
+ readonly at: string;
62
+ };
59
63
  export declare const JSON_TYPES: readonly JsonType[];
60
64
  export declare const BUILT_IN_TYPE = "any";
61
65
  export declare const ATTACHMENT = "attachment";
66
+ export declare const OPENING: readonly string[];
62
67
  export declare const ARRAY_INDEX: RegExp;
63
68
  export declare const JSON_POINTER: RegExp;
69
+ export declare function refuse(rule: string, location: string): Failure;
64
70
  export declare function escapePointer(key: string): string;
65
71
  export declare function pointerSegments(pointer: string): string[];
66
72
  export declare function refTarget(reference: string, defs: Readonly<Record<string, unknown>>): {
67
73
  readonly name: string;
68
74
  readonly node: unknown;
69
75
  } | undefined;
76
+ export declare function conjoined(declared: readonly {
77
+ readonly node: unknown;
78
+ readonly at: string;
79
+ }[], defs: Readonly<Record<string, unknown>>, ancestry: ReadonlySet<unknown>): {
80
+ readonly held: readonly Placed[];
81
+ readonly ancestry: ReadonlySet<unknown>;
82
+ };
83
+ export declare function variantsOf({ node, at }: Placed): Placed[];
70
84
  export declare function valueFacts(node: unknown, defs: Readonly<Record<string, unknown>>): ValueFacts;
71
85
  export declare function itemFacts(facts: ValueFacts, index: number): ValueFacts | undefined;
72
86
  export declare function memberFacts(facts: ValueFacts, key: string): ValueFacts | undefined;
@@ -78,4 +92,5 @@ export type PointerFacts = {
78
92
  export declare function crossedFacts(facts: ValueFacts): ValueFacts[];
79
93
  export declare function fieldFacts(definition: Definition, key: string): ValueFacts | undefined;
80
94
  export declare function pointerFacts(definition: Definition, pointer: string): PointerFacts | undefined;
95
+ export declare function untitled(definition: Definition): Definition;
81
96
  export declare function readSchema(text: string, provided?: VerifiedModel, checked?: boolean): VerifiedModel | Failure;
@@ -1,15 +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 } 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;
14
+ export declare function unlinkBody(body: string, hrefs: ReadonlySet<string>): UnlinkedBody;
11
15
  export declare function links(document: Document, file: string): readonly Link[];
12
16
  export declare function bodyLinks(body: string, file: string): readonly Link[];
13
- export declare function apply(document: Document, changes: readonly Change[]): ApplyResult;
17
+ export declare function apply(document: Document, changes: readonly Change[], definition?: Definition): ApplyResult;
14
18
  export declare function serialize(document: Document): string;
15
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,32 +1,31 @@
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
- export type { Clause, Continuation, Direction, DocumentQuery, DocumentShape, Filter, GroupQuery, GroupShape, HeldRooms, Key, KeyPlan, LocalQuery, OrderOptions, Place, Predicate, QueryErrorCode, QueryPlan, Related, RoomFacts, Scope, Select, Test, Value, Where, } from './query/language.js';
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';
7
7
  export { heldAt, matches } from './query/match.js';
8
8
  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, } 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, 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[];
@@ -37,6 +37,7 @@ export type Filter = {
37
37
  types?: readonly string[];
38
38
  where?: Where;
39
39
  pathPrefix?: string;
40
+ outside?: readonly string[];
40
41
  folder?: string;
41
42
  paths?: readonly string[];
42
43
  fileIds?: readonly string[];
@@ -48,7 +49,10 @@ export type Filter = {
48
49
  };
49
50
  text?: string;
50
51
  };
51
- export type Key = 'room' | 'path' | 'type' | 'folder' | {
52
+ export type Key = 'room' | 'path' | 'type' | 'folder' | 'size' | 'created' | 'updated' | {
53
+ field: string;
54
+ };
55
+ export type GroupKey = 'room' | 'type' | 'folder' | 'subfolder' | {
52
56
  field: string;
53
57
  };
54
58
  export type Select = 'all' | {
@@ -60,7 +64,17 @@ export type Select = 'all' | {
60
64
  change?: true;
61
65
  fileId?: true;
62
66
  revision?: true;
67
+ size?: true;
68
+ created?: true;
69
+ };
70
+ export type GroupSelect = {
71
+ size?: true;
72
+ updated?: true;
73
+ greatest?: {
74
+ field: string;
75
+ };
63
76
  };
77
+ export type GroupOrder = 'count' | 'size' | 'updated' | 'greatest';
64
78
  export type OrderOptions = {
65
79
  nulls?: 'first' | 'last';
66
80
  stringSort?: 'lexical' | 'locale';
@@ -79,10 +93,12 @@ export type DocumentQuery = Filter & {
79
93
  total?: true;
80
94
  };
81
95
  export type GroupQuery = Filter & {
82
- groupBy: readonly Exclude<Key, 'path'>[];
96
+ groupBy: readonly GroupKey[];
97
+ select?: GroupSelect;
83
98
  orderBy?: readonly {
84
- by: 'count' | Exclude<Key, 'path'>;
99
+ by: GroupOrder | GroupKey;
85
100
  direction?: Direction;
101
+ nulls?: 'first' | 'last';
86
102
  }[];
87
103
  limit?: number;
88
104
  after?: string;
@@ -148,6 +164,14 @@ export type KeyPlan = {
148
164
  of: 'type';
149
165
  } | {
150
166
  of: 'folder';
167
+ } | {
168
+ of: 'subfolder';
169
+ } | {
170
+ of: 'size';
171
+ } | {
172
+ of: 'created';
173
+ } | {
174
+ of: 'updated';
151
175
  } | {
152
176
  of: 'field';
153
177
  field: string;
@@ -162,6 +186,8 @@ export type DocumentShape = {
162
186
  change: boolean;
163
187
  fileId: boolean;
164
188
  revision: boolean;
189
+ size: boolean;
190
+ created: boolean;
165
191
  orderBy: readonly {
166
192
  key: KeyPlan;
167
193
  options: OrderOptions & {
@@ -172,9 +198,13 @@ export type DocumentShape = {
172
198
  export type GroupShape = {
173
199
  kind: 'groups';
174
200
  groupBy: readonly KeyPlan[];
201
+ size: boolean;
202
+ updated: boolean;
203
+ greatest: string | null;
175
204
  orderBy: readonly {
176
- by: 'count' | number;
205
+ by: GroupOrder | number;
177
206
  direction: Direction;
207
+ nulls: 'first' | 'last' | null;
178
208
  }[];
179
209
  };
180
210
  export type Continuation = {
@@ -185,6 +215,7 @@ export type QueryPlan = {
185
215
  key: string;
186
216
  rooms: readonly string[] | null;
187
217
  root: Scope;
218
+ outside: readonly string[] | null;
188
219
  folder: string | null;
189
220
  paths: readonly string[] | null;
190
221
  fileIds: readonly string[] | null;
@@ -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;
@@ -172,3 +178,7 @@ export type BodyResult = {
172
178
  readonly outcome: 'refuse';
173
179
  readonly refusal: Refusal;
174
180
  };
181
+ export type UnlinkedBody = {
182
+ readonly body: string;
183
+ readonly links: ReadonlyMap<string, string>;
184
+ };
@@ -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;