@agentshouse/app-bridge 0.1.0-c4ed9ded90f19 → 0.1.0-c5002501f0eaf

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 (58) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +88 -37
  3. package/dist/mdmodel/definition.d.ts +4 -0
  4. package/dist/mdmodel/document.d.ts +1 -0
  5. package/dist/mdmodel/house-model.d.ts +39 -5
  6. package/dist/mdmodel/index.d.ts +11 -7
  7. package/dist/mdmodel/indexed.d.ts +8 -0
  8. package/dist/mdmodel/kinds.d.ts +3 -0
  9. package/dist/mdmodel/markdown.d.ts +0 -4
  10. package/dist/mdmodel/moment.d.ts +6 -0
  11. package/dist/mdmodel/paths.d.ts +5 -0
  12. package/dist/mdmodel/query/language.d.ts +2 -1
  13. package/dist/mdmodel/query/sql.d.ts +5 -1
  14. package/dist/mdmodel/query/walk.d.ts +62 -0
  15. package/dist/mdmodel/types.d.ts +0 -21
  16. package/dist/mdmodel/validate.d.ts +2 -0
  17. package/dist/mdruntime/adapter.d.ts +47 -6
  18. package/dist/mdruntime/authored.d.ts +87 -0
  19. package/dist/mdruntime/binary.d.ts +4 -0
  20. package/dist/mdruntime/client.d.ts +8 -2
  21. package/dist/mdruntime/collection.d.ts +2 -1
  22. package/dist/mdruntime/conversation-live.d.ts +2 -3
  23. package/dist/mdruntime/conversation.d.ts +7 -5
  24. package/dist/mdruntime/durability.d.ts +1 -0
  25. package/dist/mdruntime/house-query.d.ts +14 -0
  26. package/dist/mdruntime/listing.d.ts +20 -12
  27. package/dist/mdruntime/media.d.ts +14 -3
  28. package/dist/mdruntime/messages.d.ts +6 -1
  29. package/dist/mdruntime/modal.d.ts +1 -0
  30. package/dist/mdruntime/model.d.ts +4 -2
  31. package/dist/mdruntime/observation.d.ts +2 -0
  32. package/dist/mdruntime/outcome.d.ts +17 -4
  33. package/dist/mdruntime/preparation.d.ts +10 -5
  34. package/dist/mdruntime/reach.d.ts +13 -3
  35. package/dist/mdruntime/readiness.d.ts +14 -4
  36. package/dist/mdruntime/recovery.d.ts +1 -0
  37. package/dist/mdruntime/runtime.d.ts +3 -2
  38. package/dist/mdruntime/saves.d.ts +2 -0
  39. package/dist/mdruntime/socket/session.d.ts +4 -1
  40. package/dist/mdruntime/socket.d.ts +1 -0
  41. package/dist/mdruntime/store/records.d.ts +10 -1
  42. package/dist/mdruntime/store.d.ts +2 -1
  43. package/dist/mdruntime/stored.d.ts +8 -1
  44. package/dist/mdruntime/surface.d.ts +8 -4
  45. package/dist/mdruntime/tables.d.ts +2 -45
  46. package/dist/mdruntime/wire.d.ts +21 -0
  47. package/dist/session-content/check.d.ts +0 -1
  48. package/dist/session-content/index.d.ts +2 -3
  49. package/dist/session-content/parts.d.ts +10 -83
  50. package/dist/session-content/state.d.ts +4 -6
  51. package/dist/session-content/turn.d.ts +28 -219
  52. package/dist/test-host.d.ts +2 -2
  53. package/dist/test-host.js +18 -1
  54. package/docs/families.md +39 -21
  55. package/package.json +2 -2
  56. package/dist/mdmodel/divide.d.ts +0 -2
  57. package/dist/mdmodel/project.d.ts +0 -21
  58. package/dist/session-content/bounds.d.ts +0 -7
package/README.md CHANGED
@@ -4,7 +4,7 @@ The types of the agents.house App bridge, an accessor and an in-page test host.
4
4
  House builds the bridge object in every App it serves and hands it to the page
5
5
  before the App's own scripts run; `houseBridge()` returns that object, so an App
6
6
  carries no bridge code of its own. It carries these families: navigation,
7
- ceremonies, installation, notifications, Telegram, status, App
7
+ ceremonies, notifications, Telegram, status, App
8
8
  release code, external calls, App messages, App and Site screenshot reads and the
9
9
  Chat. [docs/families.md](docs/families.md) describes each and the test host.
10
10
 
package/dist/index.d.ts CHANGED
@@ -271,11 +271,33 @@ export interface HouseMethods {
271
271
  readonly room_ref: string;
272
272
  };
273
273
  readonly result: {
274
- readonly history?: readonly {
274
+ readonly history?: readonly ({
275
+ readonly access?: "manage" | "owner" | "read" | "write";
276
+ readonly agent_name?: string;
277
+ readonly approved_by?: string;
275
278
  readonly at: string;
276
- readonly kind: "granted" | "revoked";
279
+ readonly by?: string;
280
+ readonly copies?: "online_only" | "search_only";
281
+ readonly kind: "granted";
282
+ readonly share?: string;
283
+ readonly through_space?: true;
277
284
  readonly user: string;
278
- }[];
285
+ } | {
286
+ readonly agent_name?: string;
287
+ readonly at: string;
288
+ readonly by?: string;
289
+ readonly kind: "revoked";
290
+ readonly through_space?: true;
291
+ readonly user: string;
292
+ } | {
293
+ readonly agent_name?: string;
294
+ readonly at: string;
295
+ readonly by?: string;
296
+ readonly kind: "role_given" | "role_taken";
297
+ readonly role: string;
298
+ readonly through_space?: true;
299
+ readonly user: string;
300
+ })[];
279
301
  readonly members: readonly {
280
302
  readonly access?: "manage" | "owner" | "read" | "write";
281
303
  readonly copies?: "online_only" | "search_only";
@@ -284,44 +306,45 @@ export interface HouseMethods {
284
306
  readonly member_document: null | string;
285
307
  readonly owner: boolean;
286
308
  readonly schema_roles?: readonly string[];
309
+ readonly schema_roles_given?: readonly {
310
+ readonly agent_name?: string;
311
+ readonly at: string;
312
+ readonly by?: string;
313
+ readonly role: string;
314
+ }[];
287
315
  readonly since: null | string;
288
316
  readonly through_space?: true;
289
317
  readonly user: string;
290
318
  }[];
291
319
  };
292
320
  };
293
- readonly "rooms/settings/processing/read": {
321
+ readonly "service-keys/signatures/check": {
294
322
  readonly params: {
295
323
  readonly operation_id?: string;
296
- readonly path: string;
324
+ readonly origin: string;
297
325
  readonly room_ref: string;
326
+ readonly signature: string;
327
+ readonly text: string;
298
328
  };
299
329
  readonly result: {
300
- readonly embedding: {
301
- readonly condition: null | {
302
- readonly kind: "demand_failed" | "embed_again_failed";
303
- readonly path: string;
304
- };
305
- readonly embedding_estimate: null | {
306
- readonly documents: number;
307
- readonly measured_tokens: number;
308
- readonly unmeasured_documents: number;
309
- };
310
- readonly finished: boolean;
311
- readonly indexed_chunks: number;
312
- };
313
- readonly explicit: readonly {
314
- readonly path: string;
315
- readonly policy: "Off" | "On";
316
- }[];
317
- readonly path: string;
318
- readonly policy: {
319
- readonly from: null | string;
320
- readonly origin: "default" | "explicit" | "inherited";
321
- readonly reason: null | "full_house_required" | "room_too_large";
322
- readonly value: "Off" | "On";
323
- };
324
- readonly writable: boolean;
330
+ readonly matched: boolean;
331
+ };
332
+ };
333
+ readonly "sites/functions/call": {
334
+ readonly params: {
335
+ readonly function: string;
336
+ readonly input?: readonly (readonly unknown[] | boolean | null | number | {
337
+ readonly [key: string]: unknown;
338
+ } | string)[] | boolean | null | number | {
339
+ readonly [key: string]: readonly unknown[] | boolean | null | number | {
340
+ readonly [key: string]: unknown;
341
+ } | string;
342
+ } | string;
343
+ };
344
+ readonly result: {
345
+ readonly answer: readonly unknown[] | boolean | null | number | {
346
+ readonly [key: string]: unknown;
347
+ } | string;
325
348
  };
326
349
  };
327
350
  readonly "sites/submissions/create": {
@@ -483,17 +506,22 @@ export interface HouseMethods {
483
506
  readonly value: string;
484
507
  } | {
485
508
  readonly code: "limit_reached";
486
- readonly limit: "custom_domains" | "external_calls" | "publish_data" | "sites";
509
+ readonly limit: "custom_domains" | "external_calls" | "publish_data" | "site_function_calls" | "sites";
487
510
  readonly outcome: "refused";
488
511
  readonly position: number;
489
512
  readonly retry_at: string;
490
513
  } | {
491
514
  readonly code: "limit_reached";
492
- readonly limit: "custom_domains" | "external_calls" | "publish_data" | "sites";
515
+ readonly limit: "custom_domains" | "external_calls" | "publish_data" | "site_function_calls" | "sites";
493
516
  readonly outcome: "refused";
494
517
  readonly position: number;
495
518
  } | {
496
- readonly code: "agent_function_retired" | "environment_offline" | "no_recipient" | "not_found" | "target_agent_unavailable";
519
+ readonly code: "post_not_confirmed";
520
+ readonly final: true;
521
+ readonly outcome: "failed";
522
+ readonly position: number;
523
+ } | {
524
+ readonly code: "agent_function_retired" | "environment_offline" | "no_group" | "no_recipient" | "not_found" | "target_agent_unavailable";
497
525
  readonly outcome: "no_target";
498
526
  readonly position: number;
499
527
  } | {
@@ -511,6 +539,10 @@ export interface HouseMethods {
511
539
  readonly output?: string;
512
540
  readonly position: number;
513
541
  readonly run: string;
542
+ } | {
543
+ readonly mentioned: number;
544
+ readonly outcome: "posted";
545
+ readonly position: number;
514
546
  } | {
515
547
  readonly outcome: "continued";
516
548
  readonly position: number;
@@ -602,6 +634,7 @@ export type HouseNavigationMode = 'push' | 'replace';
602
634
  export interface HouseTab {
603
635
  readonly title?: string;
604
636
  readonly icon?: string;
637
+ readonly scheme?: 'light' | 'dark' | null;
605
638
  }
606
639
  interface HouseRelease {
607
640
  readonly app_ref: string;
@@ -652,13 +685,26 @@ export interface HouseAppMessage {
652
685
  readonly from: string;
653
686
  readonly body: unknown;
654
687
  }
655
- export type HouseInstallation = Open<'accepted' | 'dismissed' | 'manual'>;
688
+ export interface HouseBox {
689
+ readonly x: number;
690
+ readonly y: number;
691
+ readonly width: number;
692
+ readonly height: number;
693
+ }
694
+ export interface HouseTitleRow {
695
+ readonly height: number;
696
+ readonly controls: readonly HouseBox[];
697
+ }
656
698
  export type HouseNotifications = Open<'on' | 'off' | 'blocked' | 'unavailable'>;
657
699
  export interface HouseTelegram {
658
700
  readonly state: Open<'available' | 'linked' | 'unavailable'>;
659
701
  readonly name: string | null;
660
702
  readonly username: string | null;
661
703
  }
704
+ export interface HouseCeremonyEnded {
705
+ readonly said: string | null;
706
+ readonly done: boolean;
707
+ }
662
708
  export interface HouseCeremonyRefused extends Error {
663
709
  readonly name: 'HouseCeremonyRefused';
664
710
  readonly code: Open<'house_ceremony_refused'>;
@@ -696,6 +742,9 @@ export interface HouseChatButtonOptions {
696
742
  readonly onOpen?: (opened: HouseChatOpened) => void;
697
743
  readonly onLink?: (href: string) => void;
698
744
  }
745
+ export interface HouseChatButtonMount extends HouseChatButtonOptions {
746
+ readonly agent?: string | null;
747
+ }
699
748
  export interface HouseChatTarget {
700
749
  readonly conversation?: string | null;
701
750
  readonly agent?: string | null;
@@ -709,17 +758,19 @@ export interface HouseChatButton {
709
758
  }
710
759
  export interface HouseChat {
711
760
  mount(element: object, options?: HouseChatOptions): Promise<HouseMountedChat>;
712
- mountButton(options?: HouseChatButtonOptions): Promise<HouseChatButton>;
761
+ mountButton(options?: HouseChatButtonMount): Promise<HouseChatButton>;
713
762
  }
714
763
  export interface HouseBridge {
715
764
  readonly runtime: Promise<HouseRuntime>;
716
765
  readonly chat: HouseChat;
717
766
  address(): string | null;
718
767
  onAddress(listener: (address: string) => void): () => void;
768
+ cameFrom(): string | null;
719
769
  push(address: string): Promise<string>;
720
770
  replace(address: string): Promise<string>;
721
- ceremony(path: string): Promise<never>;
722
- install(): Promise<HouseInstallation>;
771
+ ceremony(path: string): Promise<HouseCeremonyEnded>;
772
+ onTitleBar(listener: (area: HouseBox | null) => void): () => void;
773
+ setTitleBar(row: HouseTitleRow | null): void;
723
774
  notifications(on?: boolean): Promise<HouseNotifications>;
724
775
  telegram(link?: true): Promise<HouseTelegram>;
725
776
  setTab(tab: HouseTab): void;
@@ -14,6 +14,7 @@ export type ValueFacts = {
14
14
  readonly prefix?: readonly ValueFacts[];
15
15
  readonly items?: ValueFacts;
16
16
  readonly properties?: Readonly<Record<string, ValueFacts>>;
17
+ readonly required?: readonly string[];
17
18
  readonly patterns?: readonly PatternFacts[];
18
19
  readonly additional?: ValueFacts;
19
20
  };
@@ -44,6 +45,7 @@ export type Definition = {
44
45
  readonly rules: Readonly<Record<string, FieldRules>>;
45
46
  readonly createRoles?: readonly string[];
46
47
  readonly deleteRoles?: readonly string[];
48
+ readonly indexed?: readonly string[];
47
49
  readonly shape: Shape;
48
50
  };
49
51
  export type Failure = {
@@ -58,6 +60,7 @@ export declare const JSON_TYPES: readonly JsonType[];
58
60
  export declare const BUILT_IN_TYPE = "any";
59
61
  export declare const ATTACHMENT = "attachment";
60
62
  export declare const OPENING: readonly string[];
63
+ export declare const UNIONS: readonly string[];
61
64
  export declare const ARRAY_INDEX: RegExp;
62
65
  export declare const JSON_POINTER: RegExp;
63
66
  export declare function refuse(rule: string, location: string): Failure;
@@ -75,6 +78,7 @@ export declare function conjoined(declared: readonly {
75
78
  readonly ancestry: ReadonlySet<unknown>;
76
79
  };
77
80
  export declare function variantsOf({ node, at }: Placed): Placed[];
81
+ export declare function admitted(nodes: readonly unknown[], defs: Readonly<Record<string, unknown>>, ancestry: ReadonlySet<unknown>): Set<string> | null;
78
82
  export declare function valueFacts(node: unknown, defs: Readonly<Record<string, unknown>>): ValueFacts;
79
83
  export declare function itemFacts(facts: ValueFacts, index: number): ValueFacts | undefined;
80
84
  export declare function memberFacts(facts: ValueFacts, key: string): ValueFacts | undefined;
@@ -15,6 +15,7 @@ export declare function unlinkBody(body: string, hrefs: ReadonlySet<string>): Un
15
15
  export declare function links(document: Document, file: string): readonly Link[];
16
16
  export declare function bodyLinks(body: string, file: string): readonly Link[];
17
17
  export declare function bodyWith(document: Document, definition: Definition | undefined): Body | null | Refusal;
18
+ export declare function partText(part: string): string;
18
19
  export declare function apply(document: Document, changes: readonly Change[], definition?: Definition, nameOf?: Naming): ApplyResult;
19
20
  export declare function relabel(document: Document, before: Definition, after: Definition): string;
20
21
  export declare function relabels(before: Definition, after: Definition): boolean;
@@ -43,7 +43,7 @@ export declare const HOUSE_MODEL_DECLARATION: {
43
43
  readonly kind: {
44
44
  readonly title: 'Kind';
45
45
  readonly type: 'string';
46
- readonly enum: readonly ['share-offer', 'join-request', 'join-request-approved', 'room-ownership-offer', 'managed-environment-retention-opened', 'storage-full', 'sandbox-budget-spent', 'trigger-failed', 'room-telegram-chat-paused', 'break-glass-owner-disclosure', 'export-ready', 'export-failed', 'custom', 'agent-function-request-finished'];
46
+ readonly enum: readonly ['share-offer', 'join-request', 'join-request-approved', 'room-ownership-offer', 'managed-environment-retention-opened', 'storage-full', 'sandbox-budget-spent', 'trigger-failed', 'room-telegram-chat-paused', 'break-glass-owner-disclosure', 'export-ready', 'export-failed', 'custom', 'agent-function-request-finished', 'storage-past-included'];
47
47
  };
48
48
  readonly created: {
49
49
  readonly title: 'Created';
@@ -103,7 +103,7 @@ export declare const HOUSE_MODEL_DECLARATION: {
103
103
  readonly format: 'email';
104
104
  };
105
105
  };
106
- readonly required: readonly ['name', 'email'];
106
+ readonly required: readonly ['name'];
107
107
  };
108
108
  readonly rooms: {
109
109
  readonly title: 'Rooms';
@@ -246,7 +246,7 @@ export declare const HOUSE_MODEL_DECLARATION: {
246
246
  readonly format: 'email';
247
247
  };
248
248
  };
249
- readonly required: readonly ['name', 'email'];
249
+ readonly required: readonly ['name'];
250
250
  };
251
251
  readonly environment: {
252
252
  readonly title: 'Environment';
@@ -411,7 +411,7 @@ export declare const HOUSE_MODEL_DECLARATION: {
411
411
  readonly code: {
412
412
  readonly title: 'Code';
413
413
  readonly type: 'string';
414
- readonly enum: readonly ['failed', 'internal_error', 'agent_function_unreadable', 'function_failed', 'function_not_started', 'agent_function_request_not_started'];
414
+ readonly enum: readonly ['failed', 'internal_error', 'agent_function_unreadable', 'function_failed', 'function_not_started', 'agent_function_request_not_started', 'post_not_confirmed'];
415
415
  };
416
416
  readonly action: {
417
417
  readonly title: 'Action';
@@ -465,6 +465,36 @@ export declare const HOUSE_MODEL_DECLARATION: {
465
465
  readonly type: 'integer';
466
466
  readonly minimum: 1;
467
467
  };
468
+ readonly meter: {
469
+ readonly title: 'Meter';
470
+ readonly type: 'string';
471
+ readonly enum: readonly ['indexed_text', 'blob'];
472
+ };
473
+ readonly average_bytes: {
474
+ readonly title: 'Average in bytes';
475
+ readonly type: 'integer';
476
+ readonly minimum: 0;
477
+ };
478
+ readonly included_bytes: {
479
+ readonly title: 'Included in bytes';
480
+ readonly type: 'integer';
481
+ readonly minimum: 1;
482
+ };
483
+ readonly block_bytes: {
484
+ readonly title: 'Block in bytes';
485
+ readonly type: 'integer';
486
+ readonly minimum: 1;
487
+ };
488
+ readonly block_usd: {
489
+ readonly title: 'Block price in USD';
490
+ readonly type: 'number';
491
+ readonly exclusiveMinimum: 0;
492
+ };
493
+ readonly amount_usd: {
494
+ readonly title: 'Amount in USD';
495
+ readonly type: 'number';
496
+ readonly exclusiveMinimum: 0;
497
+ };
468
498
  };
469
499
  readonly required: readonly ['notification', 'kind', 'created', 'way_in', 'subject'];
470
500
  };
@@ -541,7 +571,7 @@ export declare const HOUSE_MODEL_DECLARATION: {
541
571
  readonly required: readonly ['description', 'input', 'agent'];
542
572
  };
543
573
  readonly 'house-trigger': {
544
- readonly description: "One Trigger of this Room as its acts wrote it, which House alone writes: its `description`, the `condition` it fires on, its `actions` in order, whether each action and the Trigger are `enabled`, `paused_by` `types` while a change of the Room's types paused it, its `creator` by `user` and the `name` they had then, and when it was `created`. A `notify` action reaches the `users` its `to` names, the members its `fields` name in the matched document and the holders of its `roles`; an `agent_function` action sends its `payload` to the Agent function whose card under this Room's `house/agent-functions/` its `card` names, absent while this Room holds no card of that Agent function; a `message` action puts its `text` into the active conversation that Agent function started for what the Event is about, or starts that Agent function when none is active; a `done` action marks Done every active conversation an Agent function request of this Room started for the Event's document; a `function` action runs the `function` its `app`'s latest release declares, on House's servers, or, naming no `app`, the Room owner's Environment function of that name on its Environment, which only a Trigger of their Private Room holds. Whether an action's target holds is not written: it follows from the Room's members, the Agent function's card, the App's latest release and the owner's functions.";
574
+ readonly description: "One Trigger of this Room as its acts wrote it, which House alone writes: its `description`, the `condition` it fires on, its `actions` in order, whether each action and the Trigger are `enabled`, `paused_by` `types` while a change of the Room's types paused it, its `creator` by `user` and the `name` they had then, and when it was `created`. A `notify` action reaches the `users` its `to` names, the members its `fields` name in the matched document and the holders of its `roles`, or, `in_group`, posts once in this Room's Telegram group in their place, mentioning each; an `agent_function` action sends its `payload` to the Agent function whose card under this Room's `house/agent-functions/` its `card` names, absent while this Room holds no card of that Agent function; a `message` action puts its `text` into the active conversation that Agent function started for what the Event is about, or starts that Agent function when none is active; a `done` action marks Done every active conversation an Agent function request of this Room started for the Event's document; a `function` action runs the `function` its `app`'s latest release declares, on House's servers, or, naming no `app`, the Room owner's Environment function of that name on its Environment, which only a Trigger of their Private Room holds. Whether an action's target holds is not written: it follows from the Room's members, the Agent function's card, the App's latest release and the owner's functions.";
545
575
  readonly properties: {
546
576
  readonly reflected: {
547
577
  readonly title: 'Reflected';
@@ -623,6 +653,10 @@ export declare const HOUSE_MODEL_DECLARATION: {
623
653
  };
624
654
  readonly required: readonly ['users', 'fields', 'roles'];
625
655
  };
656
+ readonly in_group: {
657
+ readonly title: 'In group';
658
+ readonly const: true;
659
+ };
626
660
  };
627
661
  readonly required: readonly ['kind', 'enabled', 'title', 'text', 'to'];
628
662
  }, {
@@ -1,9 +1,13 @@
1
1
  export { candidateOf, datePointers, facts, memberPointers, members, pointed, prosePaths, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './event.js';
2
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';
3
+ export { byCodePoint, compared, dated, fitsKind, indexKey, 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';
7
+ export { countOf, countShape, pageOrder, walkedValue, walkOf } from './query/walk.js';
8
+ export type { Count, KeyBound, KeyRange, PageOrder, Walk, WalkRun } from './query/walk.js';
9
+ export { verifyIndexBounds } from './indexed.js';
10
+ export type { IndexBounds } from './indexed.js';
7
11
  export { heldAt, matches } from './query/match.js';
8
12
  export type { Candidate } from './query/match.js';
9
13
  export { heldKind, indexed } from './query/rows.js';
@@ -12,10 +16,11 @@ export * as sql from './query/sql.js';
12
16
  export { headingLines } from './markdown.js';
13
17
  export type { HeadingLine } from './markdown.js';
14
18
  export { acceptsType, dataUrl, dataUrlPattern, declaresUtf8, FILE_MEDIA_TYPES, fileExtension, formDataType, gitMediaType, isAudioType, isImageType, isVideoType, MEDIA_TYPES, mediaTypeEssence, SCRIPT_MEDIA_TYPES, servedMediaType, UTF8_TEXT, withCharset, } from './media-type.js';
19
+ export { shownDay, shownMoment } from './moment.js';
20
+ export type { MomentReader } from './moment.js';
15
21
  export { labelAt, NAME_FIELD } from './body.js';
16
22
  export type { Naming } from './body.js';
17
- export { divide } from './divide.js';
18
- export { apply, bodyLinks, create, links, parse, relabel, relabels, relativize, relativizeBody, relinkBody, serialize, textSpans, unlinkBody, } from './document.js';
23
+ export { apply, bodyLinks, create, links, parse, partText, relabel, relabels, relativize, relativizeBody, relinkBody, serialize, textSpans, unlinkBody, } from './document.js';
19
24
  export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
20
25
  export { notReadyWaitMs } from './not-ready.js';
21
26
  export type { ReferenceTarget, SavedFacts } from './facts.js';
@@ -27,16 +32,15 @@ export { APP_REFERENCE_PATTERN, APP_REFERENCE_PREFIX, ROOM_REFERENCE_PATTERN, RE
27
32
  export type { HouseDocumentFields, HouseModelType } from './house-model.js';
28
33
  export { CHAT_MESSAGE_TYPE, CHAT_TYPE, INBOX_CHANNEL_KINDS, INBOX_TYPES } from './room-types.js';
29
34
  export type { InboxChannelKind } from './room-types.js';
30
- export { linkedPath, relative, retarget, roomPath, roomTarget, target } from './paths.js';
35
+ export { keyedDestination, keyedLink, linkedPath, relative, retarget, roomPath, roomTarget, target, } from './paths.js';
31
36
  export { openPatternBudget } from './pattern.js';
32
37
  export type { LinkedPath, RoomTarget } from './paths.js';
33
- export { project } from './project.js';
34
38
  export { references } from './references.js';
35
39
  export { CAPTURE_HOME, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION, } from './reserved.js';
36
40
  export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, untitled, } from './definition.js';
37
41
  export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, Shape, Transition, ValueFacts, } from './definition.js';
38
- export type { ApplyResult, BodyResult, Change, DefinitionOf, Division, DivisionContext, Document, DocumentCheck, Extent, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
39
- export { assess, assessReferences, bodyRoomLinks, checkDocument, definitionAt, readTypes, resolves, roomReferences, validate, validateParsed, validating, verdicts, verify, } from './validate.js';
42
+ export type { ApplyResult, BodyResult, Change, DefinitionOf, Document, DocumentCheck, Extent, Library, ModelVerification, Link, ParseResult, Reached, Reference, Refusal, RoomReference, Span, TypedPath, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
43
+ export { assess, assessReferences, bodyKeyedLinks, bodyRoomLinks, checkDocument, definitionAt, readTypes, resolves, roomReferences, validate, validateParsed, validating, verdicts, verify, } from './validate.js';
40
44
  export type { Assessment, Verdicts } from './validate.js';
41
45
  export { VERSION } from './version.js';
42
46
  export { bodyAfterFrontmatter, documentValue, equalValue, plain } from './yaml.js';
@@ -0,0 +1,8 @@
1
+ import { type Failure } from './definition.js';
2
+ import type { ModelVerification, VerifiedModel } from './types.js';
3
+ export type IndexBounds = {
4
+ readonly perType: number;
5
+ readonly longestText: number;
6
+ };
7
+ export declare function indexedFailure(model: VerifiedModel): Failure | undefined;
8
+ export declare function verifyIndexBounds(model: VerifiedModel, bounds: IndexBounds): ModelVerification;
@@ -13,5 +13,8 @@ export declare function kindWords(facts: ValueFacts | undefined): readonly strin
13
13
  export declare function dated(value: unknown): value is string;
14
14
  export declare function instant(value: unknown): bigint | undefined;
15
15
  export declare function instantKey(value: unknown): string | null;
16
+ export declare function instantOf(facts: ValueFacts | undefined, value: unknown): string | null;
17
+ export declare function indexKey(facts: ValueFacts, value: unknown): Uint8Array;
18
+ export declare function sortedKey(value: unknown): Uint8Array | null;
16
19
  export declare function byCodePoint(left: string, right: string): number;
17
20
  export declare function compared(left: unknown, right: unknown, ordering: Ordering): number;
@@ -1,4 +1,3 @@
1
- import type { Extent } from './types.js';
2
1
  export type HeadingLine = {
3
2
  readonly level: number;
4
3
  readonly name: string;
@@ -44,7 +43,6 @@ export type Node = {
44
43
  };
45
44
  export type Reading = {
46
45
  readonly headings: readonly HeadingLine[];
47
- readonly blocks: readonly Extent[];
48
46
  readonly uses: readonly LinkUse[];
49
47
  readonly definitions: readonly DefinitionBlock[];
50
48
  readonly tree: readonly Node[];
@@ -70,5 +68,3 @@ export type SectionSpan = {
70
68
  };
71
69
  export declare function sectionSpans(reading: Reading, end: number): SectionSpan[];
72
70
  export declare function sectionsRecord(spans: readonly SectionSpan[], content: string): Record<string, string>;
73
- export declare function headingsIn(reading: Reading, from: number, to: number): readonly HeadingLine[];
74
- export declare function blockRanges(reading: Reading, from: number, to: number): Extent[];
@@ -0,0 +1,6 @@
1
+ export interface MomentReader {
2
+ readonly language: string;
3
+ readonly zone: string | null;
4
+ }
5
+ export declare function shownMoment(at: Date, reader: MomentReader): string;
6
+ export declare function shownDay(at: Date, reader: MomentReader): string;
@@ -26,6 +26,11 @@ export interface LinkedPath {
26
26
  readonly fragment: string | null;
27
27
  }
28
28
  export declare function linkedPath(from: string, href: string): LinkedPath | null;
29
+ export interface KeyedLink extends RoomTarget {
30
+ readonly key: string;
31
+ }
32
+ export declare function keyedLink(href: string): KeyedLink | null;
33
+ export declare function keyedDestination(path: string, key: string): string;
29
34
  export declare function retarget(href: string, to: string): string;
30
35
  export declare function relative(from: string, target: string): string;
31
36
  export declare const SHELL_ROOMS = "/rooms/";
@@ -1,4 +1,4 @@
1
- import { type Definition } from '../definition.js';
1
+ import { type Definition, type ValueFacts } from '../definition.js';
2
2
  export type Value = string | number | boolean | null;
3
3
  export type Predicate = Value | {
4
4
  $eq: Value;
@@ -245,6 +245,7 @@ export declare function bodied(shape: DocumentShape): boolean;
245
245
  export declare function invalid(at: At, problem: string, accepts?: readonly string[]): never;
246
246
  export declare function placeText(at: Place): string;
247
247
  export declare function known(value: Entries, allowed: readonly string[], at: At): void;
248
+ export declare function textless(facts: ValueFacts): boolean;
248
249
  export declare function planOf(input: unknown, facts: HeldRooms): QueryPlan;
249
250
  export declare function cursorOf(values: readonly unknown[]): string;
250
251
  export declare function decodedCursor(text: string): readonly unknown[] | null;
@@ -28,7 +28,11 @@ export declare function any(parts: readonly Fragment[]): Fragment;
28
28
  export declare function grouped(part: Fragment): Fragment;
29
29
  export declare function listed(values: readonly SqlValue[]): Fragment;
30
30
  export declare function exists(part: Fragment): Fragment;
31
- export declare function insertedValues(doc: number, values: readonly HeldValue[]): Fragment;
31
+ export type HeldValues = {
32
+ readonly doc: number;
33
+ readonly values: readonly HeldValue[];
34
+ };
35
+ export declare function insertedValues(held: readonly HeldValues[]): Fragment;
32
36
  export declare function placed(alias: string, field: string, reach: Reach): Fragment;
33
37
  export declare function scoped(alias: string, scope: Scope, byPaths?: boolean): Fragment;
34
38
  export declare function tests(alias: string, plan: QueryPlan): Fragment;
@@ -0,0 +1,62 @@
1
+ import { type Definition } from '../definition.js';
2
+ import type { VerifiedModel } from '../types.js';
3
+ import { type Direction, type QueryPlan } from './language.js';
4
+ export type KeyBound = {
5
+ readonly key: Uint8Array;
6
+ readonly inclusive: boolean;
7
+ };
8
+ export type KeyRange = {
9
+ readonly lower: KeyBound;
10
+ readonly upper: KeyBound | null;
11
+ };
12
+ export type WalkRun = {
13
+ readonly by: 'key';
14
+ readonly key: Uint8Array;
15
+ readonly after: boolean;
16
+ } | {
17
+ readonly by: 'range';
18
+ readonly range: KeyRange;
19
+ };
20
+ export type PageOrder = {
21
+ readonly by: 'path';
22
+ readonly direction: Direction;
23
+ } | {
24
+ readonly by: 'field';
25
+ readonly field: string;
26
+ readonly direction: Direction;
27
+ readonly nulls: 'first' | 'last';
28
+ readonly lexical: boolean;
29
+ readonly after: {
30
+ readonly key: Uint8Array;
31
+ readonly tie: unknown;
32
+ } | null;
33
+ };
34
+ export type Walk = {
35
+ readonly by: 'path';
36
+ readonly direction: Direction;
37
+ } | {
38
+ readonly by: 'keys';
39
+ readonly field: string;
40
+ readonly direction: Direction;
41
+ readonly types: readonly {
42
+ readonly type: string;
43
+ readonly keys: readonly Uint8Array[];
44
+ }[];
45
+ } | {
46
+ readonly by: 'order';
47
+ readonly field: string;
48
+ readonly direction: Direction;
49
+ readonly types: readonly {
50
+ readonly type: string;
51
+ readonly runs: readonly WalkRun[];
52
+ }[];
53
+ };
54
+ export type Count = {
55
+ readonly walk: Walk;
56
+ readonly fields: readonly string[];
57
+ };
58
+ export declare function pageOrder(plan: QueryPlan): PageOrder;
59
+ export declare function walkOf(plan: QueryPlan, model: VerifiedModel): Walk;
60
+ export declare function countShape(plan: QueryPlan): boolean;
61
+ export declare function countOf(plan: QueryPlan, model: VerifiedModel, where: unknown): Count | null;
62
+ export declare function walkedValue(definition: Definition, field: string, value: unknown): unknown;
@@ -23,13 +23,6 @@ export type ValidationContext = {
23
23
  readonly anyRoom?: true;
24
24
  readonly typedPaths?: readonly TypedPath[];
25
25
  };
26
- export type ProjectionContext = {
27
- readonly documentTargets: readonly string[];
28
- readonly definition?: Definition;
29
- };
30
- export type DivisionContext = ProjectionContext & {
31
- readonly bound: number;
32
- };
33
26
  export type Extent = {
34
27
  readonly start: number;
35
28
  readonly end: number;
@@ -76,20 +69,6 @@ export type ValidationStep = {
76
69
  readonly path: string;
77
70
  readonly resolved: number;
78
71
  };
79
- export type Projection = {
80
- readonly ok: true;
81
- readonly text: string;
82
- } | {
83
- readonly ok: false;
84
- readonly refusal: Refusal;
85
- };
86
- export type Division = {
87
- readonly ok: true;
88
- readonly spans: readonly Span[];
89
- } | {
90
- readonly ok: false;
91
- readonly refusal: Refusal;
92
- };
93
72
  export type ParseResult = {
94
73
  readonly ok: true;
95
74
  readonly document: Document;
@@ -1,4 +1,5 @@
1
1
  import { type Definition } from './definition.js';
2
+ import { type KeyedLink } from './paths.js';
2
3
  import type { DefinitionOf, Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
3
4
  export declare function definitionAt(model: VerifiedModel, file: string, typedPaths?: readonly TypedPath[]): DefinitionOf;
4
5
  export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
@@ -7,6 +8,7 @@ export declare function readTypes(schema: string, provided?: VerifiedModel): Ver
7
8
  type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
8
9
  export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
9
10
  export declare function bodyRoomLinks(body: string): RoomReference[];
11
+ export declare function bodyKeyedLinks(body: string): KeyedLink[];
10
12
  export declare function roomReferences(document: Document, definition?: Definition): readonly RoomReference[];
11
13
  type Placed = {
12
14
  readonly reference: Reached;