@agentshouse/app-bridge 0.1.0-cfbb4f5408379 → 0.1.0-cff4298f6ded6

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.
package/README.md CHANGED
@@ -42,9 +42,8 @@ async function manageSecurity(securityPath) {
42
42
 
43
43
  `bridge.runtime` resolves to the `MdRuntimeClient` of `@agentshouse/mdruntime/client`,
44
44
  whose README describes its members. Its `call(method, params)` is a remote procedure call
45
- to House, such as `call('member.list', { room_ref })`: `HouseMethods` names each method,
46
- the House act's name, with the `params` the App sends and the `result` House returns.
47
- `HouseParams<Name>` is a method's params and `HouseResult<Name>` what its call resolves with.
45
+ to a House act, such as `call('member.list', { room_ref })`: `HouseMethods` names each
46
+ with its `params`, `HouseParams<Name>`, and its `result`, `HouseResult<Name>`.
48
47
 
49
48
  ## Test without a House
50
49
 
package/dist/calls.d.ts CHANGED
@@ -170,6 +170,22 @@ export interface HouseMethods {
170
170
  readonly url: string;
171
171
  };
172
172
  };
173
+ readonly 'conversation.retry': {
174
+ readonly params: {
175
+ readonly conversation_id: string;
176
+ readonly operation_id: string;
177
+ readonly message_id: string;
178
+ };
179
+ readonly result: {
180
+ readonly conversation_id: string;
181
+ readonly agent_id: string;
182
+ readonly message_id: string;
183
+ readonly authority: string;
184
+ readonly position: string;
185
+ readonly log_epoch: string;
186
+ readonly url: string;
187
+ };
188
+ };
173
189
  readonly 'conversation.send': {
174
190
  readonly params: {
175
191
  readonly conversation: string;
@@ -9,7 +9,7 @@ export declare function relinkBody(body: string, file: string, moves: ReadonlyMa
9
9
  export declare function links(document: Document, file: string): readonly Link[];
10
10
  export declare function linkOccurrences(document: Document, file: string): readonly LinkOccurrence[];
11
11
  export declare function bodyLinks(body: string, file: string): readonly Link[];
12
- export declare function apply(document: Document, change: Change): ApplyResult;
12
+ export declare function apply(document: Document, changes: readonly Change[]): ApplyResult;
13
13
  export declare function serialize(document: Document): string;
14
14
  export declare function fieldStart(document: Document, pointer: string): number | undefined;
15
15
  export declare function frontmatter(document: Document): YamlMap | null;
@@ -12,7 +12,7 @@ export { references } from './references.js';
12
12
  export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
13
13
  export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
14
14
  export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, LinkOccurrence, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, Span, Validation, ValidationContext, VerifiedModel, } from './types.js';
15
- export { checkDocument, resolves, sectionReferences, validate, verify } from './validate.js';
15
+ export { checkDocument, resolves, sectionReferences, validate, validating, verify, } from './validate.js';
16
16
  export { VERSION } from './version.js';
17
17
  export { bodyAfterFrontmatter, equalValue, frontmatterValue } from './yaml.js';
18
18
  export type { FrontmatterValue } from './yaml.js';
@@ -15,6 +15,7 @@ export type InputResult = {
15
15
  readonly ok: false;
16
16
  readonly refusal: Refusal;
17
17
  };
18
+ export declare function firstEditFrom(edits: readonly Edit[], start: number): number;
18
19
  export declare function rangeText(content: string, range: Extent, edits: readonly Edit[]): string;
19
20
  export declare function projectionInput(document: Document, file: string, context: ProjectionContext): InputResult;
20
21
  export declare function project(document: Document, file: string, context?: ProjectionContext): Projection;
@@ -130,6 +130,7 @@ export type ApplyResult = {
130
130
  } | {
131
131
  readonly outcome: 'stale';
132
132
  readonly document: Document;
133
+ readonly stale: readonly number[];
133
134
  } | {
134
135
  readonly outcome: 'refuse';
135
136
  readonly refusal: Refusal;
@@ -4,4 +4,5 @@ export declare function resolves(reference: Reached, typeOf: (path: string) => s
4
4
  export declare function verify(schema: string): ModelVerification;
5
5
  export declare function checkDocument(file: string, content: string, model: VerifiedModel): DocumentCheck;
6
6
  export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
7
+ export declare function validating(library: Library, context?: ValidationContext, model?: VerifiedModel): Generator<string, Validation, void>;
7
8
  export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
@@ -162,6 +162,18 @@ export type ConversationEvent = {
162
162
  kind: 'options';
163
163
  conversation: string;
164
164
  options: readonly SessionOption[];
165
+ } | {
166
+ kind: 'starting';
167
+ conversation: string;
168
+ step: string | null;
169
+ } | {
170
+ kind: 'link';
171
+ conversation: string;
172
+ connected: boolean;
173
+ } | {
174
+ kind: 'deliveries';
175
+ conversation: string;
176
+ unknown: readonly string[];
165
177
  } | {
166
178
  kind: 'accepted-message';
167
179
  conversation: string;
@@ -23,12 +23,15 @@ export type ChangeSet = {
23
23
  messages: readonly MessageChange[];
24
24
  conversations: readonly string[];
25
25
  };
26
- export declare function changeSet(locator: string, before: Replica | null, after: Replica | null, changed?: {
26
+ type Changed = {
27
27
  drafts?: readonly string[];
28
28
  room?: boolean;
29
29
  queue?: boolean;
30
30
  presentation?: string;
31
- }): ChangeSet;
31
+ };
32
+ export declare function changeSet(locator: string, before: Replica | null, after: Replica | null, changed?: Changed): ChangeSet;
33
+ export declare function changing(locator: string, before: Replica | null, after: Replica | null, changed?: Changed): Generator<number, ChangeSet, void>;
32
34
  export declare function entering(locator: string, replica: Replica, paths: readonly string[]): ChangeSet;
33
35
  export declare function conversationChangeSet(messages: readonly MessageChange[], conversations: readonly string[]): ChangeSet;
34
36
  export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
37
+ export {};
@@ -19,11 +19,12 @@ export type Composition = {
19
19
  };
20
20
  export declare function governing(composition: Composition, path: string): ModelState;
21
21
  export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition, previous?: Collection): Collection;
22
+ export declare function collecting(text: Readonly<Record<string, string>>, composition: Composition, previous?: Collection): Generator<number, Collection, void>;
22
23
  export declare function passingFrontmatter(collection: Collection, path: string): Frontmatter | undefined;
23
24
  export declare function documentsOf(collection: Collection): Generator<readonly [string, Document]>;
24
- export declare function unreadable(text: Readonly<Record<string, string>>, previous?: Readonly<Record<string, string>>): Refused | null;
25
+ export declare function unreadable(text: Readonly<Record<string, string>>, previous?: Readonly<Record<string, string>>): Generator<number, Refused | null, void>;
25
26
  export declare function validRoot(root: unknown): root is string;
26
- export declare function validateCollection(text: Readonly<Record<string, string>>, binaryTargets: readonly string[], composition: Composition): Validation;
27
+ export declare function validateCollection(text: Readonly<Record<string, string>>, binaryTargets: readonly string[], composition: Composition): Generator<number, Validation, void>;
27
28
  type Held = {
28
29
  text: Paths<string>;
29
30
  binaries: Paths<unknown>;
@@ -34,5 +35,5 @@ export declare function referring(held: Held, composition: Composition, targets:
34
35
  export declare function available(composition: Composition): boolean;
35
36
  export declare function changedCleanly(next: Held, previous: Held & {
36
37
  composition: Composition;
37
- }, composition: Composition): boolean;
38
+ }, composition: Composition): Generator<number, boolean, void>;
38
39
  export {};
@@ -51,6 +51,11 @@ export type ConversationView = {
51
51
  } | null;
52
52
  commands: readonly ProcessCommand[];
53
53
  options: readonly SessionOption[];
54
+ starting: string | null;
55
+ link: {
56
+ connected: boolean;
57
+ } | null;
58
+ deliveryUnknown: readonly string[];
54
59
  chatDraft: (ChatDraft & {
55
60
  readonly revision: string;
56
61
  }) | null;
@@ -21,7 +21,7 @@ export type Layer = Heads & {
21
21
  export declare function acceptedBinaries(files: Readonly<Record<string, BinaryFile>>): Record<string, HeldBinary>;
22
22
  export declare function sameBinary(left: HeldBinary | undefined, right: HeldBinary | undefined): boolean;
23
23
  export declare function sameChange(left: HeadChange | undefined, right: HeadChange | undefined): boolean;
24
- export declare function overlay(base: Layer, queue: readonly ChangeBatch[], unapplied?: () => void): Layer;
25
- export declare function sameLayerText(left: Layer, right: Layer): boolean;
26
- export declare function changedPaths(left: Layer, right: Layer): ReadonlySet<string>;
27
- export declare function overlayChanged(base: Layer, queue: readonly ChangeBatch[], previousBase: Layer, previousQueue: readonly ChangeBatch[], previousVisible: Layer): Layer;
24
+ export declare function overlaying(base: Layer, queue: readonly ChangeBatch[], unapplied?: () => void): Generator<number, Layer, void>;
25
+ export declare function sameText(left: Layer, right: Layer): Generator<number, boolean, void>;
26
+ export declare function changedPaths(left: Layer, right: Layer): Generator<number, ReadonlySet<string>, void>;
27
+ export declare function overlayChanged(base: Layer, batch: ChangeBatch, previousBase: Layer, previousBatch: ChangeBatch, previousVisible: Layer): Generator<number, Layer, void>;
@@ -4,6 +4,7 @@ import { type Layer } from './overlay.js';
4
4
  import type { MutationResult } from './adapter.js';
5
5
  import type { ReplicaRecord } from './store.js';
6
6
  import type { Refused } from './transfer.js';
7
+ import { type Later } from './turn.js';
7
8
  export type ConfirmedLayer = {
8
9
  record: ReplicaRecord;
9
10
  collection: Collection;
@@ -31,19 +32,20 @@ type ReplayStep = {
31
32
  export declare function compositionOf(record: ReplicaRecord): Composition;
32
33
  export declare function confirmedOf(record: ReplicaRecord, previous?: ConfirmedLayer): ConfirmedLayer;
33
34
  export declare function sameMembership(record: ReplicaRecord, other: ReplicaRecord): boolean;
34
- export declare function readStaged(staged: ReplicaRecord, previous?: ConfirmedLayer): Staged;
35
- export declare function readReclassified(record: ReplicaRecord, previous: ConfirmedLayer): Staged | {
35
+ export declare function readStaged(staged: ReplicaRecord, previous?: ConfirmedLayer): Later<Staged>;
36
+ export declare function readReclassified(record: ReplicaRecord, previous: ConfirmedLayer): Later<Staged | {
36
37
  kind: 'deferred';
37
- };
38
+ }>;
38
39
  type Accepted = Extract<MutationResult, {
39
40
  kind: 'accepted';
40
41
  }>;
41
- export declare function applyReturned(confirmed: ConfirmedLayer, submitted: ChangeBatch, accepted: Accepted, roomVersion: string, writtenAt: string): Staged;
42
+ export declare function applyReturned(confirmed: ConfirmedLayer, submitted: ChangeBatch, accepted: Accepted, roomVersion: string, writtenAt: string): Later<Staged>;
43
+ export declare function replicating(confirmed: ConfirmedLayer, queue: readonly ChangeBatch[], previous?: Replica): Generator<number, Replica, void>;
42
44
  export declare function replicaOf(confirmed: ConfirmedLayer, queue: readonly ChangeBatch[], previous?: Replica): Replica;
43
45
  export declare function landed(batch: ChangeBatch, confirmed: ConfirmedLayer, current?: Readonly<Record<string, string>>): boolean;
44
46
  export type Standing = {
45
47
  readonly withdrawn: readonly ChangeBatch[];
46
48
  readonly kept: readonly ChangeBatch[];
47
49
  };
48
- export declare function standing(confirmed: ConfirmedLayer, queue: readonly ChangeBatch[], withdrawable: (batch: ChangeBatch) => boolean, local: boolean): Standing;
50
+ export declare function standing(confirmed: ConfirmedLayer, queue: readonly ChangeBatch[], withdrawable: (batch: ChangeBatch) => boolean, local: boolean): Generator<number, Standing, void>;
49
51
  export {};
@@ -3,6 +3,7 @@ import { type Change, type ChangeBatch, type Precondition, type WrittenBy } from
3
3
  import { type Composition } from './collection.js';
4
4
  import type { VisibleLayer } from './replica.js';
5
5
  import type { ChangedPart } from './room-draft.js';
6
+ import { type Later } from './turn.js';
6
7
  export type SaveRefusal = {
7
8
  code: string;
8
9
  retryable: boolean;
@@ -37,7 +38,7 @@ export type BatchResult = {
37
38
  kind: 'refused';
38
39
  refusal: SaveRefusal;
39
40
  };
40
- export declare function providerRewritten(batch: ChangeBatch, visible: VisibleLayer): ChangeBatch;
41
+ export declare function providerRewritten(batch: ChangeBatch, visible: VisibleLayer): Generator<number, ChangeBatch, void>;
41
42
  export declare function queuedDocuments(queue: readonly ChangeBatch[]): ReadonlySet<string>;
42
43
  export type Requeued = {
43
44
  kind: 'requeued';
@@ -61,4 +62,4 @@ export type Joining = {
61
62
  export declare function requeued(queue: readonly ChangeBatch[], changes: readonly Change[], visible: VisibleLayer, changeable: (batch: ChangeBatch) => boolean, state: (queue: readonly ChangeBatch[]) => VisibleLayer): Requeued;
62
63
  export declare function joined(queue: readonly ChangeBatch[], owner: ChangeBatch, extra: ChangeBatch): Joining;
63
64
  export declare function limitedIn(queue: readonly ChangeBatch[], batch: ChangeBatch, limits: readonly ProviderLimit[], state: (queue: readonly ChangeBatch[]) => VisibleLayer): SaveRefusal | null;
64
- export declare function buildBatch(input: SaveInput): BatchResult;
65
+ export declare function buildBatch(input: SaveInput): Later<BatchResult>;
@@ -1,10 +1,14 @@
1
1
  export type Paths<V> = Readonly<Record<string, V>>;
2
2
  type Weigh<V> = (key: string, value: V) => number;
3
+ export declare function sharing<V>(map: Paths<V>): Generator<number, Paths<V>, void>;
3
4
  export declare function shared<V>(map: Paths<V>): Paths<V>;
4
5
  export declare function patched<V>(base: Paths<V>, set: Iterable<readonly [string, V]>, removed?: Iterable<string>): Paths<V>;
6
+ export declare function patching<V>(base: Paths<V>, set: Iterable<readonly [string, V]>, removed?: Iterable<string>): Generator<number, Paths<V>, void>;
5
7
  export declare function tally<V>(map: Paths<V>, weigh: Weigh<V>): number;
6
8
  export declare function sizeOf<V>(map: Paths<V>): number;
9
+ export declare function differences<V>(left: Paths<V>, right: Paths<V>, same?: (left: V, right: V) => boolean): Generator<number, ReadonlySet<string>, void>;
7
10
  export declare function differing<V>(left: Paths<V>, right: Paths<V>, same?: (left: V, right: V) => boolean): ReadonlySet<string>;
8
11
  export declare function drafted<V>(base: Paths<V>): Record<string, V>;
9
12
  export declare function settled<V>(draft: Record<string, V>): Paths<V>;
13
+ export declare function settling<V>(draft: Record<string, V>): Generator<number, Paths<V>, void>;
10
14
  export {};
@@ -3,6 +3,7 @@ import type { Capability, HeadChange, Member, OperationScopes, ProviderLimit, Re
3
3
  import type { AcceptedMessage, KeptReceipt } from './adapter.js';
4
4
  import type { ChangeBatch } from './change.js';
5
5
  import { type HeldBinary } from './overlay.js';
6
+ import { type Later } from './turn.js';
6
7
  import type { ChatDraftFile } from './file.js';
7
8
  import type { Submission } from './outcome.js';
8
9
  import type { RoomDraftRecord, SavedDraft } from './room-draft.js';
@@ -165,6 +166,7 @@ export type RuntimeStore = {
165
166
  rememberGeneration(value: string): Promise<void>;
166
167
  close(): void;
167
168
  };
169
+ export declare function transacted<T>(database: IDBDatabase, stores: string | readonly string[], mode: IDBTransactionMode, work: (transaction: IDBTransaction) => Later<T>): Promise<T>;
168
170
  export declare function authoredHolder(): Promise<string | null>;
169
171
  export declare function authoredBy(holder: string): Promise<boolean>;
170
172
  export declare function authoredBinding(): Promise<string | null>;
@@ -2,5 +2,7 @@ export declare function yielded(): Promise<void>;
2
2
  export declare const ROW_WEIGHT = 256;
3
3
  export type Later<T> = T | Promise<T>;
4
4
  export declare function after<T, R>(value: Later<T>, next: (value: T) => Later<R>): Later<R>;
5
- export declare function inUnits<T>(items: Iterable<T>, each: (item: T) => number, ended?: () => void): Later<void>;
5
+ export declare function inUnits<T>(items: Iterable<T>, each: (item: T) => number, ended?: () => void, paused?: () => Promise<void>): Later<void>;
6
+ export declare function finished<R>(steps: Generator<number, R, void>): R;
7
+ export declare function stepped<R>(steps: Generator<number, R, void>): Later<R>;
6
8
  export declare function inChunks<T>(items: readonly T[], weigh: (item: T) => number, each: (chunk: readonly T[]) => Later<void>): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/app-bridge",
3
- "version": "0.1.0-cfbb4f5408379",
3
+ "version": "0.1.0-cff4298f6ded6",
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, and App messages, with an accessor and an in-page test host.",
5
5
  "license": "MIT",
6
6
  "type": "module",