@agentshouse/app-bridge 0.1.0-cb198cb4a971a → 0.1.0-cb7c659b27f00

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.
@@ -78,4 +78,5 @@ export type PointerFacts = {
78
78
  export declare function crossedFacts(facts: ValueFacts): ValueFacts[];
79
79
  export declare function fieldFacts(definition: Definition, key: string): ValueFacts | undefined;
80
80
  export declare function pointerFacts(definition: Definition, pointer: string): PointerFacts | undefined;
81
+ export declare function untitled(definition: Definition): Definition;
81
82
  export declare function readSchema(text: string, provided?: VerifiedModel, checked?: boolean): VerifiedModel | Failure;
@@ -1,17 +1,19 @@
1
1
  import { type Definition } from './definition.js';
2
2
  import { type HrefOccurrence, type Reading } from './markdown.js';
3
- import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, ParseResult, UnlinkedBody } from './types.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
5
  export declare function readingOf(document: Document): Reading;
6
6
  export declare function linkDestinations(document: Document): readonly HrefOccurrence[];
7
+ export declare function textSpans(document: Document): readonly Span[];
7
8
  export declare function parseFrontmatter(content: string, file?: string): FrontmatterResult;
8
- 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;
9
11
  export declare function relativize(document: Document, file: string, handle: string, definition?: Definition, kept?: ReadonlySet<string>): ApplyResult;
10
12
  export declare function relativizeBody(body: string, file: string, handle: string): BodyResult;
11
13
  export declare function relinkBody(body: string, file: string, moves: ReadonlyMap<string, string>): BodyResult;
12
14
  export declare function unlinkBody(body: string, hrefs: ReadonlySet<string>): UnlinkedBody;
13
15
  export declare function links(document: Document, file: string): readonly Link[];
14
16
  export declare function bodyLinks(body: string, file: string): readonly Link[];
15
- export declare function apply(document: Document, changes: readonly Change[]): ApplyResult;
17
+ export declare function apply(document: Document, changes: readonly Change[], definition?: Definition): ApplyResult;
16
18
  export declare function serialize(document: Document): string;
17
19
  export declare function frontmatter(document: Document): YamlMap | null;
@@ -12,7 +12,7 @@ export * as sql from './query/sql.js';
12
12
  export { headingLines } from './markdown.js';
13
13
  export type { HeadingLine } from './markdown.js';
14
14
  export { divide } from './divide.js';
15
- export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, unlinkBody, } from './document.js';
15
+ export { apply, bodyLinks, create, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, textSpans, unlinkBody, } from './document.js';
16
16
  export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
17
17
  export type { ReferenceTarget, SavedFacts } from './facts.js';
18
18
  export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
@@ -22,10 +22,10 @@ export type { RoomTarget } from './paths.js';
22
22
  export { project } from './project.js';
23
23
  export { references } from './references.js';
24
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, } from './definition.js';
25
+ export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, untitled, } from './definition.js';
26
26
  export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
27
- export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
28
- 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';
29
29
  export type { Assessment, Verdicts } from './validate.js';
30
30
  export { VERSION } from './version.js';
31
31
  export { bodyAfterFrontmatter, equalValue, frontmatterValue, plain } from './yaml.js';
@@ -45,7 +45,9 @@ export type Frontmatter = {
45
45
  export type Document = Frontmatter & {
46
46
  readonly preamble: string;
47
47
  readonly sections: Readonly<Record<string, string>>;
48
+ readonly text: string;
48
49
  };
50
+ export type DefinitionOf = (type: string | undefined) => Definition | undefined;
49
51
  export type Refusal = {
50
52
  readonly file: string;
51
53
  readonly rule: string;
@@ -139,11 +141,15 @@ export type Change = {
139
141
  readonly kind: 'section';
140
142
  readonly name: string;
141
143
  readonly value: string;
142
- readonly prior: string;
144
+ readonly prior: string | undefined;
143
145
  } | {
144
146
  readonly kind: 'preamble';
145
147
  readonly value: string;
146
148
  readonly prior: string;
149
+ } | {
150
+ readonly kind: 'text';
151
+ readonly value: string;
152
+ readonly prior: string;
147
153
  } | {
148
154
  readonly kind: 'link';
149
155
  readonly href: string;
@@ -1,5 +1,6 @@
1
1
  import { type Definition } from './definition.js';
2
- import type { Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
2
+ import type { DefinitionOf, Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
3
+ export declare function definitionAt(model: VerifiedModel, file: string, typedPaths?: readonly TypedPath[]): DefinitionOf;
3
4
  export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
4
5
  export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
5
6
  export declare function readTypes(schema: string, provided?: VerifiedModel): VerifiedModel;
@@ -1,5 +1,6 @@
1
- import { type Document, type TypedPath } from '../mdmodel/index.js';
2
- import type { ModelState } from './model.js';
1
+ import { type DefinitionOf, type Document, type TypedPath } from '../mdmodel/index.js';
2
+ import type { ModelState, TypesResult } from './model.js';
3
+ import type { AppTypedSelection } from './listing.js';
3
4
  import type { MdModelIdentity } from './adapter.js';
4
5
  export declare const MD_MODEL: MdModelIdentity;
5
6
  export type Collection = {
@@ -20,9 +21,26 @@ export type Composed = {
20
21
  readonly fingerprint: string;
21
22
  };
22
23
  export declare function composedOf(composition: Composition): Composed;
23
- export declare function selected(composition: Composition, path: string): boolean;
24
- export declare function governing(composition: Composition, path: string): ModelState;
24
+ type Selecting<M> = {
25
+ readonly model: M;
26
+ readonly selection: {
27
+ readonly roots: readonly string[];
28
+ readonly model: M;
29
+ } | null;
30
+ };
31
+ export declare function selected(composition: {
32
+ readonly selection: {
33
+ readonly roots: readonly string[];
34
+ } | null;
35
+ }, path: string): boolean;
36
+ export declare function governing<M>(composition: Selecting<M>, path: string): M;
37
+ export declare function definitionsAt(composition: Composition, path: string): DefinitionOf;
38
+ export declare function definitionsIn(room: {
39
+ readonly model: TypesResult;
40
+ readonly typedSelection: AppTypedSelection | null;
41
+ }, path: string, typedPaths: readonly TypedPath[]): DefinitionOf;
25
42
  export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
26
43
  export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
27
44
  export declare function validRoot(root: unknown): root is string;
28
45
  export declare function available(composition: Composition): boolean;
46
+ export {};
@@ -50,6 +50,5 @@ export type ValidationReceipt = {
50
50
  source: Open<'current' | 'cached'>;
51
51
  };
52
52
  export declare const NO_MODEL: ModelState;
53
- export declare function definitionOf(state: ModelState, type: string | undefined): Definition | undefined;
54
53
  export declare function modelTypes(state: ModelState): TypesResult;
55
54
  export declare function storedModel(state: ModelState): StoredModel;
@@ -1,4 +1,5 @@
1
1
  import type { BinaryFile, HeadChange } from './adapter.js';
2
+ import { type Composition } from './collection.js';
2
3
  import type { ChangeBatch } from './change.js';
3
4
  export type Heads = {
4
5
  revisions: Readonly<Record<string, string>>;
@@ -22,4 +23,4 @@ export type Layer = Heads & {
22
23
  export declare function acceptedBinaries(files: Readonly<Record<string, BinaryFile>>): Generator<readonly [string, HeldBinary]>;
23
24
  export declare function sameBinary(left: HeldBinary | undefined, right: HeldBinary | undefined): boolean;
24
25
  export declare function sameChange(left: HeadChange | undefined, right: HeadChange | undefined): boolean;
25
- export declare function overlaying(base: Layer, queue: readonly ChangeBatch[], unapplied?: () => void): Generator<number, Layer, void>;
26
+ export declare function overlaying(base: Layer, queue: readonly ChangeBatch[], composition: Composition, unapplied?: () => void): Generator<number, Layer, void>;
@@ -49,8 +49,8 @@ export type Replayed = {
49
49
  };
50
50
  export declare function replaying(confirmed: Slice, queue: readonly ChangeBatch[], locator: string, composition: Composition): Generator<number, Replayed, void>;
51
51
  export declare function overlayOf(visible: VisibleLayer, touched: Iterable<string>): Generator<number, OverlayEntry[], void>;
52
- export declare function holds(layer: Layer, preconditions: readonly Precondition[]): boolean;
53
- export declare function landed(batch: ChangeBatch, confirmed: Layer, current?: Readonly<Record<string, string>>): boolean;
52
+ export declare function holds(layer: Layer, preconditions: readonly Precondition[], composition: Composition): boolean;
53
+ export declare function landed(batch: ChangeBatch, confirmed: Layer, composition: Composition, current?: Readonly<Record<string, string>>): boolean;
54
54
  export type Standing = {
55
55
  readonly withdrawn: readonly ChangeBatch[];
56
56
  readonly kept: readonly ChangeBatch[];
@@ -1,3 +1,4 @@
1
+ import { type DefinitionOf } from '../mdmodel/index.js';
1
2
  import type { ProviderRefusal } from './adapter.js';
2
3
  import type { Open } from './open.js';
3
4
  import type { Change, Precondition } from './change.js';
@@ -144,8 +145,8 @@ export type TextParts = {
144
145
  readonly value: string;
145
146
  };
146
147
  };
147
- export declare function partsAfter(markdown: string, parts: TextParts): string;
148
- export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts): HeldParts;
148
+ export declare function partsAfter(markdown: string, parts: TextParts, definitions?: DefinitionOf): string;
149
+ export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts, definitions?: DefinitionOf): HeldParts;
149
150
  export declare function moveTarget(move: {
150
151
  readonly to: string;
151
152
  }): string;
@@ -67,7 +67,7 @@ export type Joining = {
67
67
  };
68
68
  type VisibleOver = (queue: readonly ChangeBatch[]) => Generator<number, VisibleLayer, void>;
69
69
  export declare function requeuing(queue: readonly ChangeBatch[], changes: readonly Change[], visible: VisibleLayer, changeable: (batch: ChangeBatch) => boolean, state: VisibleOver): Generator<number, Requeued, void>;
70
- export declare function joined(queue: readonly ChangeBatch[], owner: ChangeBatch, extra: ChangeBatch): Joining;
70
+ export declare function joined(queue: readonly ChangeBatch[], owner: ChangeBatch, extra: ChangeBatch, composition: Composition): Joining;
71
71
  export declare function limiting(queue: readonly ChangeBatch[], batch: ChangeBatch, limits: readonly ProviderLimit[], state: VisibleOver): Generator<number, SaveRefusal | null, void>;
72
72
  export declare const MOVE_DOCUMENTS = "move-documents";
73
73
  export type MoveSide = {
@@ -33,7 +33,7 @@ export type Leaving = {
33
33
  };
34
34
  export declare function withdrawable(states: ReadonlyMap<string, PendingState>): (batch: ChangeBatch) => boolean;
35
35
  export declare function sliceAt(store: Store, record: ReplicaRecord, view: View, queue: readonly ChangeBatch[], extra?: Iterable<string>, moved?: Iterable<string>): Promise<Slice>;
36
- export declare function landedWhole(store: Store, locator: string, batch: ChangeBatch, confirmedLayer: Slice, current?: Readonly<Record<string, string>>): Promise<boolean>;
36
+ export declare function landedWhole(store: Store, record: ReplicaRecord, batch: ChangeBatch, confirmedLayer: Slice, current?: Readonly<Record<string, string>>): Promise<boolean>;
37
37
  export type Settling = {
38
38
  leaving?: readonly Leaving[];
39
39
  room?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/app-bridge",
3
- "version": "0.1.0-cb198cb4a971a",
3
+ "version": "0.1.0-cb7c659b27f00",
4
4
  "description": "Types of the agents.house App bridge House hands every App: navigation, the tab title and icon, ceremonies, installation, notifications and the icon badge, status, Site image reads, App release code, App and Site screenshot reads, App messages and the Chat, with an accessor and an in-page test host.",
5
5
  "license": "MIT",
6
6
  "type": "module",