@agentshouse/app-bridge 0.1.0-c8d8dc6285bbd → 0.1.0-c8dc2a697434d

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 (120) hide show
  1. package/README.md +7 -7
  2. package/dist/index.d.ts +595 -24
  3. package/dist/mdmodel/body.d.ts +84 -0
  4. package/dist/mdmodel/built-in.d.ts +3 -0
  5. package/dist/mdmodel/definition.d.ts +20 -11
  6. package/dist/mdmodel/document.d.ts +14 -8
  7. package/dist/mdmodel/event.d.ts +76 -0
  8. package/dist/mdmodel/facts.d.ts +14 -0
  9. package/dist/mdmodel/fields.d.ts +1 -1
  10. package/dist/mdmodel/house-model.d.ts +869 -0
  11. package/dist/mdmodel/house-references/crockford.d.ts +3 -0
  12. package/dist/mdmodel/house-references/patterns.d.ts +8 -0
  13. package/dist/mdmodel/index.d.ts +40 -15
  14. package/dist/mdmodel/kinds.d.ts +17 -0
  15. package/dist/mdmodel/markdown.d.ts +74 -0
  16. package/dist/mdmodel/media-type.d.ts +71 -0
  17. package/dist/mdmodel/moment.d.ts +6 -0
  18. package/dist/mdmodel/not-ready.d.ts +1 -0
  19. package/dist/mdmodel/paths.d.ts +15 -1
  20. package/dist/mdmodel/pattern.d.ts +9 -0
  21. package/dist/mdmodel/query/language.d.ts +253 -0
  22. package/dist/mdmodel/query/match.d.ts +13 -0
  23. package/dist/mdmodel/query/rows.d.ts +31 -0
  24. package/dist/mdmodel/query/sql.d.ts +38 -0
  25. package/dist/mdmodel/references.d.ts +2 -2
  26. package/dist/mdmodel/reserved.d.ts +5 -0
  27. package/dist/mdmodel/room-types.d.ts +6 -0
  28. package/dist/mdmodel/types.d.ts +22 -17
  29. package/dist/mdmodel/validate.d.ts +12 -6
  30. package/dist/mdmodel/yaml.d.ts +4 -4
  31. package/dist/mdruntime/actions.d.ts +25 -0
  32. package/dist/mdruntime/adapter.d.ts +181 -113
  33. package/dist/mdruntime/attached-model.d.ts +6 -0
  34. package/dist/mdruntime/authored.d.ts +87 -0
  35. package/dist/mdruntime/bootstrap.d.ts +43 -0
  36. package/dist/mdruntime/cell.d.ts +5 -0
  37. package/dist/mdruntime/chain.d.ts +2 -1
  38. package/dist/mdruntime/change-set.d.ts +4 -0
  39. package/dist/mdruntime/change.d.ts +5 -0
  40. package/dist/mdruntime/client.d.ts +33 -25
  41. package/dist/mdruntime/collection.d.ts +31 -7
  42. package/dist/mdruntime/compile.d.ts +8 -6
  43. package/dist/mdruntime/conversation-live.d.ts +149 -0
  44. package/dist/mdruntime/conversation-row.d.ts +39 -0
  45. package/dist/mdruntime/conversation.d.ts +72 -51
  46. package/dist/mdruntime/declaration.d.ts +9 -0
  47. package/dist/mdruntime/durability.d.ts +19 -1
  48. package/dist/mdruntime/failure.d.ts +3 -0
  49. package/dist/mdruntime/figures.d.ts +48 -0
  50. package/dist/mdruntime/holdings.d.ts +28 -0
  51. package/dist/mdruntime/identity.d.ts +0 -1
  52. package/dist/mdruntime/install.d.ts +59 -0
  53. package/dist/mdruntime/listing.d.ts +51 -0
  54. package/dist/mdruntime/live.d.ts +24 -0
  55. package/dist/mdruntime/media.d.ts +24 -0
  56. package/dist/mdruntime/messages.d.ts +35 -5
  57. package/dist/mdruntime/model.d.ts +8 -11
  58. package/dist/mdruntime/observation.d.ts +29 -13
  59. package/dist/mdruntime/opened.d.ts +1 -1
  60. package/dist/mdruntime/outcome.d.ts +30 -7
  61. package/dist/mdruntime/overlay.d.ts +7 -2
  62. package/dist/mdruntime/preparation.d.ts +40 -0
  63. package/dist/mdruntime/presence.d.ts +57 -0
  64. package/dist/mdruntime/query.d.ts +18 -208
  65. package/dist/mdruntime/reach.d.ts +21 -13
  66. package/dist/mdruntime/readiness.d.ts +12 -21
  67. package/dist/mdruntime/reads.d.ts +38 -0
  68. package/dist/mdruntime/recovery.d.ts +3 -0
  69. package/dist/mdruntime/refresh.d.ts +26 -0
  70. package/dist/mdruntime/replica.d.ts +13 -20
  71. package/dist/mdruntime/retried.d.ts +29 -0
  72. package/dist/mdruntime/room-draft.d.ts +51 -12
  73. package/dist/mdruntime/room-drafts.d.ts +23 -0
  74. package/dist/mdruntime/runtime.d.ts +33 -0
  75. package/dist/mdruntime/save.d.ts +42 -84
  76. package/dist/mdruntime/saves.d.ts +33 -0
  77. package/dist/mdruntime/search.d.ts +12 -63
  78. package/dist/mdruntime/seed.d.ts +11 -2
  79. package/dist/mdruntime/socket/admission.d.ts +6 -0
  80. package/dist/mdruntime/socket/answers.d.ts +5 -0
  81. package/dist/mdruntime/socket/lanes.d.ts +27 -0
  82. package/dist/mdruntime/socket/session.d.ts +37 -0
  83. package/dist/mdruntime/socket.d.ts +66 -0
  84. package/dist/mdruntime/source.d.ts +58 -0
  85. package/dist/mdruntime/status.d.ts +4 -5
  86. package/dist/mdruntime/store/installs.d.ts +29 -0
  87. package/dist/mdruntime/store/readiness.d.ts +10 -0
  88. package/dist/mdruntime/store/records.d.ts +222 -0
  89. package/dist/mdruntime/store/room-held.d.ts +7 -0
  90. package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
  91. package/dist/mdruntime/store/space.d.ts +10 -0
  92. package/dist/mdruntime/store/watchers.d.ts +16 -0
  93. package/dist/mdruntime/store/writes.d.ts +23 -0
  94. package/dist/mdruntime/store.d.ts +113 -157
  95. package/dist/mdruntime/stored.d.ts +79 -57
  96. package/dist/mdruntime/surface.d.ts +89 -0
  97. package/dist/mdruntime/tables.d.ts +129 -107
  98. package/dist/mdruntime/tallies.d.ts +17 -0
  99. package/dist/mdruntime/transfer.d.ts +0 -5
  100. package/dist/mdruntime/wire.d.ts +75 -13
  101. package/dist/session-content/bounds.d.ts +7 -0
  102. package/dist/session-content/check.d.ts +18 -0
  103. package/dist/session-content/index.d.ts +7 -0
  104. package/dist/session-content/parts.d.ts +103 -0
  105. package/dist/session-content/state.d.ts +61 -0
  106. package/dist/session-content/turn.d.ts +328 -0
  107. package/dist/test-host.d.ts +8 -4
  108. package/dist/test-host.js +28 -28
  109. package/docs/families.md +79 -67
  110. package/package.json +2 -2
  111. package/dist/calls.d.ts +0 -1007
  112. package/dist/calls.js +0 -1
  113. package/dist/mdmodel/blocks.d.ts +0 -10
  114. package/dist/mdmodel/condition.d.ts +0 -160
  115. package/dist/mdmodel/links.d.ts +0 -28
  116. package/dist/mdmodel/profile.d.ts +0 -5
  117. package/dist/mdruntime/connection.d.ts +0 -151
  118. package/dist/mdruntime/file.d.ts +0 -11
  119. package/dist/mdruntime/fulltext.d.ts +0 -26
  120. package/dist/mdruntime/shared.d.ts +0 -15
@@ -0,0 +1,3 @@
1
+ export declare const CROCKFORD_ALPHABET = "0123456789abcdefghjkmnpqrstvwxyz";
2
+ export declare const CROCKFORD_CHARACTER = "[0123456789abcdefghjkmnpqrstvwxyz]";
3
+ export declare const CROCKFORD_LEADING_CHARACTER: string;
@@ -0,0 +1,8 @@
1
+ export declare const ROOM_REFERENCE_PREFIX = "r_";
2
+ export declare const APP_REFERENCE_PREFIX = "a_";
3
+ export declare const SPACE_REFERENCE_PREFIX = "sp_";
4
+ export declare const REVISION_REFERENCE_PREFIX = "fr_";
5
+ export declare const ROOM_REFERENCE_PATTERN: RegExp;
6
+ export declare const APP_REFERENCE_PATTERN: RegExp;
7
+ export declare const SPACE_REFERENCE_PATTERN: RegExp;
8
+ export declare const REVISION_REFERENCE_PATTERN: RegExp;
@@ -1,20 +1,45 @@
1
- export { ACTOR_PATHS, actorOperators, changeFields, CONDITION_OPERATORS, dated, datePointers, DOCUMENT_PATHS, factKind, facts, fires, holds, instant, ITEM_PATHS, itemFires, itemKind, itemOperators, memberPointers, members, pointed, prosePaths, testOperators, valuedChange, WRITE_DOORS, } from './condition.js';
2
- export type { Actor, Condition, ConditionOperator, ConditionScope, ConditionTest, ConditionValue, CronCondition, DateCondition, DocumentCondition, DocumentEvent, DocumentFacts, Fact, FactKind, ItemCondition, ItemFacts, Resolved, WriteDoor, } from './condition.js';
3
- export { headingLines } from './blocks.js';
4
- export type { HeadingLine } from './blocks.js';
1
+ export { candidateOf, datePointers, facts, memberPointers, members, pointed, prosePaths, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './event.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
+ export type { Kind, Ordering } from './kinds.js';
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, 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 { heldAt, matches } from './query/match.js';
8
+ export type { Candidate } from './query/match.js';
9
+ export { heldKind, indexed } from './query/rows.js';
10
+ export type { HeldKind, HeldLink, HeldValue, Indexed, Reach } from './query/rows.js';
11
+ export * as sql from './query/sql.js';
12
+ export { headingLines } from './markdown.js';
13
+ export type { HeadingLine } from './markdown.js';
14
+ 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';
15
+ export { shownDay, shownMoment } from './moment.js';
16
+ export type { MomentReader } from './moment.js';
17
+ export { labelAt, NAME_FIELD } from './body.js';
18
+ export type { Naming } from './body.js';
5
19
  export { divide } from './divide.js';
6
- export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
7
- export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
8
- export { relative, retarget, roomPath, roomTarget, target } from './paths.js';
9
- export type { RoomTarget } from './paths.js';
10
- export { MARKDOWN_SYNTAX_PROFILE } from './profile.js';
20
+ export { apply, bodyLinks, create, links, parse, relabel, relabels, relativize, relativizeBody, relinkBody, serialize, textSpans, unlinkBody, } from './document.js';
21
+ export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
22
+ export { notReadyWaitMs } from './not-ready.js';
23
+ export type { ReferenceTarget, SavedFacts } from './facts.js';
24
+ export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './house-references/crockford.js';
25
+ export { HOUSE_FIELDS, MEMBER_FIELD, SITE_FIELD, SUBMITTED_FIELD, TYPE_FIELD } from './fields.js';
26
+ export { HOUSE_MODEL, HOUSE_ROOM_TYPES } from './built-in.js';
27
+ export { APP_PREFERENCES_HOME, HOUSE_MODEL_DECLARATION, HOUSE_TYPED_PATHS } from './house-model.js';
28
+ export { APP_REFERENCE_PATTERN, APP_REFERENCE_PREFIX, ROOM_REFERENCE_PATTERN, REVISION_REFERENCE_PATTERN, REVISION_REFERENCE_PREFIX, ROOM_REFERENCE_PREFIX, SPACE_REFERENCE_PATTERN, SPACE_REFERENCE_PREFIX, } from './house-references/patterns.js';
29
+ export type { HouseDocumentFields, HouseModelType } from './house-model.js';
30
+ export { CHAT_MESSAGE_TYPE, CHAT_TYPE, INBOX_CHANNEL_KINDS, INBOX_TYPES } from './room-types.js';
31
+ export type { InboxChannelKind } from './room-types.js';
32
+ export { keyedDestination, keyedLink, linkedPath, relative, retarget, roomPath, roomTarget, target, } from './paths.js';
33
+ export { openPatternBudget } from './pattern.js';
34
+ export type { LinkedPath, RoomTarget } from './paths.js';
11
35
  export { project } from './project.js';
12
36
  export { references } from './references.js';
13
- export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
14
- export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
15
- export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
16
- export { assess, bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verdicts, verify, } from './validate.js';
37
+ export { CAPTURE_HOME, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION, } from './reserved.js';
38
+ export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, untitled, } from './definition.js';
39
+ export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, Shape, Transition, ValueFacts, } from './definition.js';
40
+ 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';
41
+ export { assess, assessReferences, bodyKeyedLinks, bodyRoomLinks, checkDocument, definitionAt, readTypes, resolves, roomReferences, validate, validateParsed, validating, verdicts, verify, } from './validate.js';
17
42
  export type { Assessment, Verdicts } from './validate.js';
18
43
  export { VERSION } from './version.js';
19
- export { bodyAfterFrontmatter, equalValue, frontmatterValue } from './yaml.js';
20
- export type { FrontmatterValue } from './yaml.js';
44
+ export { bodyAfterFrontmatter, documentValue, equalValue, plain } from './yaml.js';
45
+ export type { DocumentValue } from './yaml.js';
@@ -0,0 +1,17 @@
1
+ import type { ValueFacts } from './definition.js';
2
+ export type Kind = 'string' | 'number' | 'integer' | 'boolean' | 'date' | 'date-time' | 'time' | 'enum' | 'reference';
3
+ export type Ordering = {
4
+ readonly direction: 'asc' | 'desc';
5
+ readonly nulls: 'first' | 'last';
6
+ readonly stringSort: 'lexical' | 'locale';
7
+ readonly locale: string | undefined;
8
+ readonly localeOptions: Intl.CollatorOptions | undefined;
9
+ };
10
+ export declare function kindOf(facts: ValueFacts): Kind | null;
11
+ export declare function fitsKind(kind: Kind, facts: ValueFacts, value: unknown): boolean;
12
+ export declare function kindWords(facts: ValueFacts | undefined): readonly string[];
13
+ export declare function dated(value: unknown): value is string;
14
+ export declare function instant(value: unknown): bigint | undefined;
15
+ export declare function instantKey(value: unknown): string | null;
16
+ export declare function byCodePoint(left: string, right: string): number;
17
+ export declare function compared(left: unknown, right: unknown, ordering: Ordering): number;
@@ -0,0 +1,74 @@
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 Node = {
28
+ readonly type: string;
29
+ readonly position?: {
30
+ readonly start: {
31
+ readonly offset?: number;
32
+ };
33
+ readonly end: {
34
+ readonly offset?: number;
35
+ };
36
+ };
37
+ readonly children?: readonly Node[];
38
+ readonly depth?: number;
39
+ readonly identifier?: string;
40
+ readonly checked?: boolean | null;
41
+ readonly ordered?: boolean | null;
42
+ readonly lang?: string | null;
43
+ readonly value?: string;
44
+ };
45
+ export type Reading = {
46
+ readonly headings: readonly HeadingLine[];
47
+ readonly blocks: readonly Extent[];
48
+ readonly uses: readonly LinkUse[];
49
+ readonly definitions: readonly DefinitionBlock[];
50
+ readonly tree: readonly Node[];
51
+ readonly base: number;
52
+ };
53
+ export declare function lineBreaks(text: string): readonly number[];
54
+ export declare function lineNumber(breaks: readonly number[], offset: number): number;
55
+ export declare function lineStart(text: string, index: number): number;
56
+ export declare function lineEnd(text: string, index: number): {
57
+ readonly end: number;
58
+ readonly next: number;
59
+ };
60
+ export declare function read(text: string, at?: number): Reading;
61
+ export declare function destinations(reading: Reading): readonly HrefOccurrence[];
62
+ export declare function linkable(text: string, from?: number): boolean;
63
+ export declare function hrefOccurrences(body: string): readonly HrefOccurrence[];
64
+ export declare function headingLines(content: string, from: number, to: number): HeadingLine[];
65
+ export type SectionSpan = {
66
+ readonly name: string;
67
+ readonly headingStart: number;
68
+ readonly bodyStart: number;
69
+ readonly bodyEnd: number;
70
+ };
71
+ export declare function sectionSpans(reading: Reading, end: number): SectionSpan[];
72
+ 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,71 @@
1
+ export declare const MEDIA_TYPES: {
2
+ readonly html: 'text/html';
3
+ readonly css: 'text/css';
4
+ readonly javascript: 'text/javascript';
5
+ readonly plainText: 'text/plain';
6
+ readonly markdown: 'text/markdown';
7
+ readonly csv: 'text/csv';
8
+ readonly json: 'application/json';
9
+ readonly xml: 'application/xml';
10
+ readonly yaml: 'application/yaml';
11
+ readonly ndjson: 'application/x-ndjson';
12
+ readonly webManifest: 'application/manifest+json';
13
+ readonly reports: 'application/reports+json';
14
+ readonly githubJson: 'application/vnd.github+json';
15
+ readonly form: 'application/x-www-form-urlencoded';
16
+ readonly octetStream: 'application/octet-stream';
17
+ readonly gzip: 'application/gzip';
18
+ readonly tar: 'application/x-tar';
19
+ readonly zip: 'application/zip';
20
+ readonly gitBundle: 'application/x-git-bundle';
21
+ readonly wasm: 'application/wasm';
22
+ readonly pdf: 'application/pdf';
23
+ readonly docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
24
+ readonly pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
25
+ readonly xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
26
+ readonly avif: 'image/avif';
27
+ readonly gif: 'image/gif';
28
+ readonly heic: 'image/heic';
29
+ readonly icon: 'image/vnd.microsoft.icon';
30
+ readonly jpeg: 'image/jpeg';
31
+ readonly png: 'image/png';
32
+ readonly svg: 'image/svg+xml';
33
+ readonly webp: 'image/webp';
34
+ readonly aac: 'audio/aac';
35
+ readonly amr: 'audio/amr';
36
+ readonly m4a: 'audio/mp4';
37
+ readonly mp3: 'audio/mpeg';
38
+ readonly ogg: 'audio/ogg';
39
+ readonly wav: 'audio/wav';
40
+ readonly threeGpp: 'video/3gpp';
41
+ readonly mp4: 'video/mp4';
42
+ readonly quickTime: 'video/quicktime';
43
+ readonly webm: 'video/webm';
44
+ readonly otf: 'font/otf';
45
+ readonly ttf: 'font/ttf';
46
+ readonly woff: 'font/woff';
47
+ readonly woff2: 'font/woff2';
48
+ };
49
+ export declare function withCharset(type: string, charset: string): string;
50
+ export declare const UTF8_TEXT: {
51
+ readonly html: string;
52
+ readonly css: string;
53
+ readonly javascript: string;
54
+ readonly plainText: string;
55
+ readonly markdown: string;
56
+ readonly xml: string;
57
+ };
58
+ export declare const SCRIPT_MEDIA_TYPES: readonly string[];
59
+ export declare const FILE_MEDIA_TYPES: Readonly<Record<string, string>>;
60
+ export declare function servedMediaType(path: string): string;
61
+ export declare function fileExtension(type: string): string | null;
62
+ export declare function dataUrl(type: string, base64: string): string;
63
+ export declare function dataUrlPattern(types: readonly string[]): RegExp;
64
+ export declare function formDataType(boundary: string): string;
65
+ export declare function gitMediaType(service: string, part: 'advertisement' | 'request' | 'result'): string;
66
+ export declare function mediaTypeEssence(value: string): string;
67
+ export declare function declaresUtf8(value: string): boolean;
68
+ export declare function acceptsType(accept: string | undefined, type: string): boolean;
69
+ export declare function isImageType(value: string): boolean;
70
+ export declare function isVideoType(value: string): boolean;
71
+ export declare function isAudioType(value: string): boolean;
@@ -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;
@@ -0,0 +1 @@
1
+ export declare function notReadyWaitMs(asked: number): number;
@@ -6,7 +6,7 @@ export type RoomTarget = {
6
6
  readonly handle: string;
7
7
  readonly path: string;
8
8
  };
9
- export declare function classifyHref(from: string, href: string): {
9
+ type Classified = {
10
10
  kind: 'skip';
11
11
  } | {
12
12
  kind: 'path';
@@ -16,10 +16,24 @@ export declare function classifyHref(from: string, href: string): {
16
16
  } & RoomTarget) | {
17
17
  kind: 'invalid';
18
18
  };
19
+ export declare function classifyHref(from: string, href: string): Classified;
19
20
  export declare function roomTarget(href: string): RoomTarget | null;
20
21
  export declare function roomPath(href: string): string | null;
21
22
  export declare function target(from: string, href: string): string | null;
23
+ export interface LinkedPath {
24
+ readonly handle: string | null;
25
+ readonly path: string;
26
+ readonly fragment: string | null;
27
+ }
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;
22
34
  export declare function retarget(href: string, to: string): string;
23
35
  export declare function relative(from: string, target: string): string;
24
36
  export declare const SHELL_ROOMS = "/rooms/";
25
37
  export declare function shellTarget(href: string, handle: string): string | null;
38
+ export declare function destinationText(to: string, bracketed: boolean): string | null;
39
+ export {};
@@ -0,0 +1,9 @@
1
+ export declare const PATTERN_STATES = 1000;
2
+ export declare class PatternTooCostly extends Error {
3
+ }
4
+ export type Pattern = {
5
+ readonly test: (text: string) => boolean;
6
+ };
7
+ export declare function linearPattern(source: string): Pattern | null;
8
+ export declare function withLinearRegExp<T>(run: () => T): T;
9
+ export declare function openPatternBudget(): () => void;
@@ -0,0 +1,253 @@
1
+ import { type Definition } from '../definition.js';
2
+ export type Value = string | number | boolean | null;
3
+ export type Predicate = Value | {
4
+ $eq: Value;
5
+ } | {
6
+ $ne: Value;
7
+ } | {
8
+ $in: readonly Value[];
9
+ } | {
10
+ $nin: readonly Value[];
11
+ } | {
12
+ $gt?: Value;
13
+ $gte?: Value;
14
+ $lt?: Value;
15
+ $lte?: Value;
16
+ } | {
17
+ $all: readonly Value[];
18
+ } | {
19
+ $size: number;
20
+ } | {
21
+ $exists: boolean;
22
+ } | {
23
+ $prefix: string;
24
+ };
25
+ export type Where = {
26
+ $and?: readonly Where[];
27
+ $or?: readonly Where[];
28
+ [field: string]: Predicate | readonly Where[] | undefined;
29
+ };
30
+ export type Related = {
31
+ types?: readonly string[];
32
+ where?: Where;
33
+ pathPrefix?: string;
34
+ };
35
+ export type Filter = {
36
+ rooms?: readonly string[];
37
+ types?: readonly string[];
38
+ where?: Where;
39
+ pathPrefix?: string;
40
+ outside?: readonly string[];
41
+ folder?: string;
42
+ paths?: readonly string[];
43
+ fileIds?: readonly string[];
44
+ hop?: Related & {
45
+ field: string;
46
+ };
47
+ backlinks?: Related & {
48
+ field?: string;
49
+ };
50
+ text?: string;
51
+ };
52
+ export type Key = 'room' | 'path' | 'type' | 'folder' | 'size' | 'created' | 'updated' | {
53
+ field: string;
54
+ };
55
+ export type GroupKey = 'room' | 'type' | 'folder' | 'subfolder' | {
56
+ field: string;
57
+ };
58
+ export type Select = 'all' | {
59
+ fields?: 'all' | readonly string[];
60
+ sections?: 'all' | readonly string[];
61
+ preamble?: true;
62
+ markdown?: true;
63
+ backlinks?: true;
64
+ change?: true;
65
+ fileId?: true;
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
+ };
76
+ };
77
+ export type GroupOrder = 'count' | 'size' | 'updated' | 'greatest';
78
+ export type OrderOptions = {
79
+ nulls?: 'first' | 'last';
80
+ stringSort?: 'lexical' | 'locale';
81
+ locale?: string;
82
+ localeOptions?: Readonly<Record<string, unknown>>;
83
+ };
84
+ export type Direction = 'asc' | 'desc';
85
+ export type DocumentQuery = Filter & {
86
+ select: Select;
87
+ orderBy?: readonly ({
88
+ by: Key;
89
+ direction?: Direction;
90
+ } & OrderOptions)[];
91
+ limit?: number;
92
+ after?: string;
93
+ total?: true;
94
+ };
95
+ export type GroupQuery = Filter & {
96
+ groupBy: readonly GroupKey[];
97
+ select?: GroupSelect;
98
+ orderBy?: readonly {
99
+ by: GroupOrder | GroupKey;
100
+ direction?: Direction;
101
+ nulls?: 'first' | 'last';
102
+ }[];
103
+ limit?: number;
104
+ after?: string;
105
+ total?: true;
106
+ };
107
+ export type LocalQuery = DocumentQuery | GroupQuery;
108
+ export type QueryErrorCode = 'invalid-query' | 'unknown-type' | 'unknown-field' | 'wrong-kind';
109
+ export type RoomFacts = {
110
+ locator: string;
111
+ available: boolean;
112
+ types: readonly Definition[];
113
+ };
114
+ export type HeldRooms = {
115
+ listed: boolean;
116
+ rooms: readonly RoomFacts[];
117
+ };
118
+ export type Test = {
119
+ op: 'eq';
120
+ value: Value;
121
+ } | {
122
+ op: 'ne';
123
+ value: Value;
124
+ } | {
125
+ op: 'in';
126
+ values: readonly Value[];
127
+ } | {
128
+ op: 'nin';
129
+ values: readonly Value[];
130
+ } | {
131
+ op: 'range';
132
+ bounds: readonly (readonly ['gt' | 'gte' | 'lt' | 'lte', Value])[];
133
+ } | {
134
+ op: 'all';
135
+ values: readonly Value[];
136
+ } | {
137
+ op: 'size';
138
+ size: number;
139
+ } | {
140
+ op: 'exists';
141
+ exists: boolean;
142
+ } | {
143
+ op: 'prefix';
144
+ prefix: string;
145
+ };
146
+ export type Clause = {
147
+ every: readonly Clause[];
148
+ } | {
149
+ some: readonly Clause[];
150
+ } | {
151
+ field: string;
152
+ test: Test;
153
+ };
154
+ export type Scope = {
155
+ types: readonly string[] | null;
156
+ where: Clause | null;
157
+ pathPrefix: string | null;
158
+ };
159
+ export type KeyPlan = {
160
+ of: 'room';
161
+ } | {
162
+ of: 'path';
163
+ } | {
164
+ of: 'type';
165
+ } | {
166
+ of: 'folder';
167
+ } | {
168
+ of: 'subfolder';
169
+ } | {
170
+ of: 'size';
171
+ } | {
172
+ of: 'created';
173
+ } | {
174
+ of: 'updated';
175
+ } | {
176
+ of: 'field';
177
+ field: string;
178
+ };
179
+ export type DocumentShape = {
180
+ kind: 'documents';
181
+ fields: 'all' | readonly string[] | null;
182
+ sections: 'all' | readonly string[] | null;
183
+ preamble: boolean;
184
+ markdown: boolean;
185
+ backlinks: boolean;
186
+ change: boolean;
187
+ fileId: boolean;
188
+ revision: boolean;
189
+ size: boolean;
190
+ created: boolean;
191
+ orderBy: readonly {
192
+ key: KeyPlan;
193
+ options: OrderOptions & {
194
+ direction: Direction;
195
+ };
196
+ }[];
197
+ };
198
+ export type GroupShape = {
199
+ kind: 'groups';
200
+ groupBy: readonly KeyPlan[];
201
+ size: boolean;
202
+ updated: boolean;
203
+ greatest: string | null;
204
+ orderBy: readonly {
205
+ by: GroupOrder | number;
206
+ direction: Direction;
207
+ nulls: 'first' | 'last' | null;
208
+ }[];
209
+ };
210
+ export type Continuation = {
211
+ text: string;
212
+ values: readonly unknown[] | null;
213
+ };
214
+ export type QueryPlan = {
215
+ key: string;
216
+ rooms: readonly string[] | null;
217
+ root: Scope;
218
+ outside: readonly string[] | null;
219
+ folder: string | null;
220
+ paths: readonly string[] | null;
221
+ fileIds: readonly string[] | null;
222
+ hop: (Scope & {
223
+ field: string;
224
+ }) | null;
225
+ backlinks: (Scope & {
226
+ field: string | null;
227
+ }) | null;
228
+ text: string | null;
229
+ shape: DocumentShape | GroupShape;
230
+ limit: number | null;
231
+ after: Continuation | null;
232
+ total: boolean;
233
+ };
234
+ export type Place = readonly (string | number)[];
235
+ type At = Place | string;
236
+ export declare class QueryError extends Error {
237
+ readonly code: QueryErrorCode;
238
+ readonly place: Place;
239
+ readonly accepts: readonly string[];
240
+ readonly retryable = false;
241
+ constructor(code: QueryErrorCode, at: At, problem: string, accepts?: readonly string[]);
242
+ }
243
+ type Entries = Readonly<Record<string, unknown>>;
244
+ export declare function bodied(shape: DocumentShape): boolean;
245
+ export declare function invalid(at: At, problem: string, accepts?: readonly string[]): never;
246
+ export declare function placeText(at: Place): string;
247
+ export declare function known(value: Entries, allowed: readonly string[], at: At): void;
248
+ export declare function planOf(input: unknown, facts: HeldRooms): QueryPlan;
249
+ export declare function cursorOf(values: readonly unknown[]): string;
250
+ export declare function decodedCursor(text: string): readonly unknown[] | null;
251
+ export declare function queryKey(query: unknown): string;
252
+ export declare function identityOf(plan: QueryPlan): string;
253
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { Definition } from '../definition.js';
2
+ import { type QueryPlan } from './language.js';
3
+ import { type HeldValue } from './rows.js';
4
+ export type Candidate = {
5
+ readonly path: string;
6
+ readonly type: string | null;
7
+ readonly fileId: string | null;
8
+ readonly fields: Readonly<Record<string, unknown>>;
9
+ readonly definition?: Pick<Definition, 'root'>;
10
+ readonly text: string | null;
11
+ };
12
+ export declare function heldAt(candidate: Candidate, field: string): readonly HeldValue[];
13
+ export declare function matches(plan: QueryPlan, candidate: Candidate): boolean;
@@ -0,0 +1,31 @@
1
+ import { type Definition } from '../definition.js';
2
+ export type HeldKind = 'string' | 'number' | 'boolean' | 'null' | 'array' | 'object' | 'undefined';
3
+ export type HeldValue = {
4
+ readonly keys: string;
5
+ readonly places: string;
6
+ readonly item: number;
7
+ readonly kind: HeldKind;
8
+ readonly value: string | number | null;
9
+ readonly size: number | null;
10
+ readonly instant: string | null;
11
+ };
12
+ export type HeldLink = {
13
+ readonly kind: 'field';
14
+ readonly keys: string;
15
+ readonly places: string;
16
+ readonly target: string;
17
+ readonly field: string;
18
+ };
19
+ export type Indexed = {
20
+ readonly values: readonly HeldValue[];
21
+ readonly links: readonly HeldLink[];
22
+ };
23
+ export type Reach = 'exact' | 'value' | 'link';
24
+ export type Placed = {
25
+ readonly keys: string;
26
+ readonly places: string;
27
+ readonly glob: boolean;
28
+ };
29
+ export declare function placedOf(pointer: string, reach: Reach): Placed;
30
+ export declare function heldKind(value: unknown): HeldKind;
31
+ export declare function indexed(path: string, fields: Readonly<Record<string, unknown>>, definition: Pick<Definition, 'root'> | undefined): Indexed;
@@ -0,0 +1,38 @@
1
+ import { type Ordering } from '../kinds.js';
2
+ import type { QueryPlan, Scope } from './language.js';
3
+ import { type HeldValue, type Reach } from './rows.js';
4
+ export type SqlValue = string | number | bigint | Uint8Array | null;
5
+ export type Fragment = {
6
+ readonly sql: string;
7
+ readonly bind: readonly SqlValue[];
8
+ };
9
+ export type Collate = (ordering: Ordering, lists: boolean, total: boolean) => string | null;
10
+ export type Term = {
11
+ readonly ordering: Ordering;
12
+ readonly kind: Fragment;
13
+ readonly value: Fragment;
14
+ readonly instant?: Fragment;
15
+ readonly total?: boolean;
16
+ };
17
+ export type Following = {
18
+ readonly beyond: Fragment;
19
+ readonly equal: Fragment;
20
+ };
21
+ export declare const VALUE_TABLE = "CREATE TABLE replica_values (doc INTEGER NOT NULL, keys TEXT NOT NULL, places TEXT NOT NULL, item INTEGER NOT NULL, kind TEXT NOT NULL, value, size INTEGER, instant TEXT, PRIMARY KEY (doc, keys, places, item)) WITHOUT ROWID";
22
+ export declare const HOLDS_PHRASE = "holds_phrase";
23
+ export declare function holdsPhrase(_context: number, text: unknown, phrase: unknown): number;
24
+ export declare function fragment(sql: string, bind?: readonly SqlValue[]): Fragment;
25
+ export declare function joined(parts: readonly Fragment[], separator: string): Fragment;
26
+ export declare function all(parts: readonly Fragment[]): Fragment;
27
+ export declare function any(parts: readonly Fragment[]): Fragment;
28
+ export declare function grouped(part: Fragment): Fragment;
29
+ export declare function listed(values: readonly SqlValue[]): Fragment;
30
+ export declare function exists(part: Fragment): Fragment;
31
+ export declare function insertedValues(doc: number, values: readonly HeldValue[]): Fragment;
32
+ export declare function placed(alias: string, field: string, reach: Reach): Fragment;
33
+ export declare function scoped(alias: string, scope: Scope, byPaths?: boolean): Fragment;
34
+ export declare function tests(alias: string, plan: QueryPlan): Fragment;
35
+ export declare function sortValue(kind: SqlValue | undefined, value: unknown, instant: SqlValue | undefined): unknown;
36
+ export declare function sorted(collate: Collate, term: Term): Fragment;
37
+ export declare function beyond(collate: Collate, term: Term, value: unknown): Following;
38
+ export declare function following(parts: readonly Following[], tie: Fragment): Fragment;
@@ -1,3 +1,3 @@
1
1
  import { type Definition } from './definition.js';
2
- import type { Frontmatter, Reference } from './types.js';
3
- export declare function references(document: Pick<Frontmatter, 'fields'>, definition: Definition): readonly Reference[];
2
+ import type { Document, Reference } from './types.js';
3
+ export declare function references(document: Pick<Document, 'fields'>, definition: Definition): readonly Reference[];
@@ -0,0 +1,5 @@
1
+ export declare const ROOM_DESCRIPTION = "ROOM.md";
2
+ export declare const CAPTURE_HOME = "capture";
3
+ export declare const RESERVED_NAMES: readonly string[];
4
+ export declare function isReservedName(name: string): boolean;
5
+ export declare function isDocumentPath(path: string): boolean;
@@ -0,0 +1,6 @@
1
+ export declare const CHAT_TYPE = "chat";
2
+ export declare const CHAT_MESSAGE_TYPE = "chat-message";
3
+ export declare const INBOX_TYPES: readonly string[];
4
+ export declare const INBOX_CHANNEL_KINDS: readonly ['telegram-bot', 'telegram-business', 'whatsapp', 'messenger', 'instagram', 'tiktok'];
5
+ export type InboxChannelKind = (typeof INBOX_CHANNEL_KINDS)[number];
6
+ export declare const ROOM_TYPES_TEXT: string;