@agentshouse/app-bridge 0.1.0-alpha.9 → 0.1.0-c0079debc581d

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 (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -79
  3. package/dist/calls.d.ts +955 -0
  4. package/dist/calls.js +1 -0
  5. package/dist/index.d.ts +162 -0
  6. package/dist/index.js +1 -0
  7. package/dist/mdmodel/blocks.d.ts +10 -0
  8. package/dist/mdmodel/condition.d.ts +161 -0
  9. package/dist/mdmodel/definition.d.ts +80 -0
  10. package/dist/mdmodel/divide.d.ts +2 -0
  11. package/dist/mdmodel/document.d.ts +15 -0
  12. package/dist/mdmodel/fields.d.ts +5 -0
  13. package/dist/mdmodel/index.d.ts +19 -0
  14. package/dist/mdmodel/links.d.ts +28 -0
  15. package/dist/mdmodel/paths.d.ts +25 -0
  16. package/dist/mdmodel/profile.d.ts +5 -0
  17. package/dist/mdmodel/project.d.ts +21 -0
  18. package/dist/mdmodel/references.d.ts +3 -0
  19. package/dist/mdmodel/types.d.ts +166 -0
  20. package/dist/mdmodel/validate.d.ts +10 -0
  21. package/dist/mdmodel/version.d.ts +1 -0
  22. package/dist/mdmodel/yaml.d.ts +55 -0
  23. package/dist/mdruntime/adapter.d.ts +507 -0
  24. package/dist/mdruntime/binary.d.ts +22 -0
  25. package/dist/mdruntime/change-set.d.ts +37 -0
  26. package/dist/mdruntime/change.d.ts +118 -0
  27. package/dist/mdruntime/client.d.ts +89 -0
  28. package/dist/mdruntime/collection.d.ts +39 -0
  29. package/dist/mdruntime/connection.d.ts +150 -0
  30. package/dist/mdruntime/conversation.d.ts +116 -0
  31. package/dist/mdruntime/durability.d.ts +14 -0
  32. package/dist/mdruntime/failure.d.ts +12 -0
  33. package/dist/mdruntime/file.d.ts +11 -0
  34. package/dist/mdruntime/model.d.ts +57 -0
  35. package/dist/mdruntime/observation.d.ts +31 -0
  36. package/dist/mdruntime/open.d.ts +1 -0
  37. package/dist/mdruntime/outcome.d.ts +71 -0
  38. package/dist/mdruntime/overlay.d.ts +27 -0
  39. package/dist/mdruntime/query.d.ts +274 -0
  40. package/dist/mdruntime/reach.d.ts +48 -0
  41. package/dist/mdruntime/readiness.d.ts +52 -0
  42. package/dist/mdruntime/recovery.d.ts +24 -0
  43. package/dist/mdruntime/replica.d.ts +50 -0
  44. package/dist/mdruntime/room-draft.d.ts +157 -0
  45. package/dist/mdruntime/rows.d.ts +38 -0
  46. package/dist/mdruntime/save.d.ts +101 -0
  47. package/dist/mdruntime/search.d.ts +104 -0
  48. package/dist/mdruntime/seed.d.ts +15 -0
  49. package/dist/mdruntime/shared.d.ts +18 -0
  50. package/dist/mdruntime/status.d.ts +26 -0
  51. package/dist/mdruntime/store.d.ts +171 -0
  52. package/dist/mdruntime/tables.d.ts +180 -0
  53. package/dist/mdruntime/transfer.d.ts +9 -0
  54. package/dist/mdruntime/turn.d.ts +8 -0
  55. package/dist/mdruntime/wire.d.ts +230 -0
  56. package/dist/test-host.d.ts +33 -0
  57. package/dist/test-host.js +200 -0
  58. package/docs/families.md +149 -0
  59. package/package.json +11 -14
  60. package/client/src/bridge.d.ts +0 -35
  61. package/client/src/bridge.js +0 -229
  62. package/client/src/index.d.ts +0 -3
  63. package/client/src/index.js +0 -2
  64. package/client/src/test-host.d.ts +0 -30
  65. package/client/src/test-host.js +0 -159
  66. package/client/src/wire.d.ts +0 -69
  67. package/client/src/wire.js +0 -1
  68. package/src/apps/remainder.d.ts +0 -2
  69. package/src/apps/remainder.js +0 -16
  70. package/src/apps/tab.d.ts +0 -6
  71. package/src/apps/tab.js +0 -27
@@ -0,0 +1,166 @@
1
+ import type { Definition } from './definition.js';
2
+ export type Library = Readonly<Record<string, string>>;
3
+ export type VerifiedModel = {
4
+ readonly types: Readonly<Record<string, Definition>>;
5
+ };
6
+ export type ModelVerification = {
7
+ readonly verdict: 'accept';
8
+ readonly model: VerifiedModel;
9
+ } | {
10
+ readonly verdict: 'refuse';
11
+ readonly rule: string;
12
+ readonly location?: string;
13
+ };
14
+ export type ValidationContext = {
15
+ readonly binaryTargets: readonly string[];
16
+ readonly anyRoom?: true;
17
+ };
18
+ export type ProjectionContext = {
19
+ readonly documentTargets: readonly string[];
20
+ readonly definition?: Definition;
21
+ };
22
+ export type DivisionContext = ProjectionContext & {
23
+ readonly bound: number;
24
+ };
25
+ export type Extent = {
26
+ readonly start: number;
27
+ readonly end: number;
28
+ };
29
+ export type Span = Extent & {
30
+ readonly text: string;
31
+ };
32
+ export type Frontmatter = {
33
+ readonly content: string;
34
+ readonly type: string | undefined;
35
+ readonly fields: Readonly<Record<string, unknown>>;
36
+ };
37
+ export type Document = Frontmatter & {
38
+ readonly preamble: string;
39
+ readonly sections: Readonly<Record<string, string>>;
40
+ };
41
+ export type Refusal = {
42
+ readonly file: string;
43
+ readonly rule: string;
44
+ readonly location?: string;
45
+ readonly referrers?: readonly string[];
46
+ };
47
+ export type Reached = {
48
+ readonly target: string | null;
49
+ readonly to: readonly string[];
50
+ };
51
+ export type DocumentCheck = {
52
+ readonly ok: false;
53
+ } | {
54
+ readonly ok: true;
55
+ readonly type: string;
56
+ readonly typed: boolean;
57
+ readonly references: readonly Reached[];
58
+ };
59
+ export type Validation = {
60
+ readonly verdict: 'accept';
61
+ } | ({
62
+ readonly verdict: 'refuse';
63
+ } & Refusal);
64
+ export type ValidationStep = {
65
+ readonly path: string;
66
+ readonly resolved: number;
67
+ };
68
+ export type Projection = {
69
+ readonly ok: true;
70
+ readonly text: string;
71
+ } | {
72
+ readonly ok: false;
73
+ readonly refusal: Refusal;
74
+ };
75
+ export type Division = {
76
+ readonly ok: true;
77
+ readonly spans: readonly Span[];
78
+ } | {
79
+ readonly ok: false;
80
+ readonly refusal: Refusal;
81
+ };
82
+ export type FrontmatterResult = {
83
+ readonly ok: true;
84
+ readonly frontmatter: Frontmatter;
85
+ } | {
86
+ readonly ok: false;
87
+ readonly refusal: Refusal;
88
+ };
89
+ export type ParseResult = {
90
+ readonly ok: true;
91
+ readonly document: Document;
92
+ } | {
93
+ readonly ok: false;
94
+ readonly refusal: Refusal;
95
+ };
96
+ export type Link = {
97
+ readonly href: string;
98
+ readonly target: string;
99
+ };
100
+ export type Reference = {
101
+ readonly pointer: string;
102
+ readonly value: string;
103
+ readonly to: readonly string[];
104
+ readonly crossRoom?: true;
105
+ };
106
+ export type RoomReference = {
107
+ readonly handle: string;
108
+ readonly path: string;
109
+ } & ({
110
+ readonly kind: 'link';
111
+ readonly href: string;
112
+ } | {
113
+ readonly kind: 'field';
114
+ readonly pointer: string;
115
+ readonly value: string;
116
+ readonly to: readonly string[];
117
+ readonly crossRoom?: true;
118
+ } | {
119
+ readonly kind: 'item';
120
+ readonly section: string;
121
+ readonly href: string;
122
+ readonly to: readonly string[];
123
+ readonly crossRoom?: true;
124
+ });
125
+ export type Change = {
126
+ readonly kind: 'field';
127
+ readonly name: string;
128
+ readonly value: unknown;
129
+ readonly prior: unknown;
130
+ } | {
131
+ readonly kind: 'section';
132
+ readonly name: string;
133
+ readonly value: string;
134
+ readonly prior: string;
135
+ } | {
136
+ readonly kind: 'preamble';
137
+ readonly value: string;
138
+ readonly prior: string;
139
+ } | {
140
+ readonly kind: 'link';
141
+ readonly href: string;
142
+ readonly to: string;
143
+ } | {
144
+ readonly kind: 'reference';
145
+ readonly pointer: string;
146
+ readonly value: string;
147
+ readonly prior: string;
148
+ };
149
+ export type ApplyResult = {
150
+ readonly outcome: 'applied';
151
+ readonly document: Document;
152
+ } | {
153
+ readonly outcome: 'stale';
154
+ readonly document: Document;
155
+ readonly stale: readonly number[];
156
+ } | {
157
+ readonly outcome: 'refuse';
158
+ readonly refusal: Refusal;
159
+ };
160
+ export type BodyResult = {
161
+ readonly outcome: 'applied';
162
+ readonly body: string;
163
+ } | {
164
+ readonly outcome: 'refuse';
165
+ readonly refusal: Refusal;
166
+ };
@@ -0,0 +1,10 @@
1
+ import { type Definition } from './definition.js';
2
+ import type { DocumentCheck, Library, ModelVerification, Reached, RoomReference, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
3
+ export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
4
+ export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
5
+ export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): DocumentCheck;
6
+ export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
7
+ export declare function bodyRoomLinks(body: string): RoomReference[];
8
+ export declare function roomReferences(file: string, content: string, definition?: Definition): readonly RoomReference[];
9
+ export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
10
+ export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
@@ -0,0 +1 @@
1
+ export declare const VERSION = "0.1.0-alpha.19";
@@ -0,0 +1,55 @@
1
+ export declare class YamlError extends Error {
2
+ readonly offset: number;
3
+ constructor(offset: number);
4
+ }
5
+ export type YamlScalar = {
6
+ readonly kind: 'scalar';
7
+ readonly value: string | number | boolean | null;
8
+ readonly start: number;
9
+ readonly end: number;
10
+ };
11
+ export type YamlSeq = {
12
+ readonly kind: 'seq';
13
+ readonly items: readonly YamlNode[];
14
+ readonly start: number;
15
+ readonly end: number;
16
+ };
17
+ export type YamlEntry = {
18
+ readonly key: string;
19
+ readonly after: number;
20
+ readonly value: YamlNode;
21
+ };
22
+ export type YamlMap = {
23
+ readonly kind: 'map';
24
+ readonly entries: readonly YamlEntry[];
25
+ readonly start: number;
26
+ readonly end: number;
27
+ };
28
+ export type YamlNode = YamlScalar | YamlSeq | YamlMap;
29
+ export declare function interpretPlain(text: string): string | number | boolean | null;
30
+ export declare function parseYamlMapping(text: string, start: number, end: number): YamlMap;
31
+ export declare function jsValue(node: YamlNode): unknown;
32
+ export declare function mapEntry(map: YamlMap, key: string): YamlEntry | undefined;
33
+ export declare function isPlainSafe(text: string): boolean;
34
+ export type FrontmatterValue = string | number | boolean | null | readonly FrontmatterValue[] | {
35
+ readonly [name: string]: FrontmatterValue;
36
+ };
37
+ export declare function plain(value: unknown): value is Record<string, unknown>;
38
+ export declare function frontmatterValue(value: unknown): value is FrontmatterValue;
39
+ export declare function serializeJs(value: FrontmatterValue): string;
40
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
41
+ export declare function serializeKey(name: string): string;
42
+ export declare function bodyStartAfterYaml(content: string, yamlEnd: number): number;
43
+ export declare function bodyStartOf(content: string): number;
44
+ export declare function bodyAfterFrontmatter(content: string): string;
45
+ export declare function extractFrontmatter(content: string): {
46
+ kind: 'none';
47
+ } | {
48
+ kind: 'unclosed';
49
+ } | {
50
+ kind: 'ok';
51
+ yamlStart: number;
52
+ yamlEnd: number;
53
+ };
54
+ export declare function equalValue(left: unknown, right: unknown): boolean;
55
+ export declare function lineEnding(content: string): '\n' | '\r\n';