@agentshouse/app-bridge 0.1.0-ca559eade7c19 → 0.1.0-caae3da69c1c2

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.
@@ -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,8 @@ 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>;
42
+ export declare function queuedDocuments(queue: readonly ChangeBatch[]): ReadonlySet<string>;
41
43
  export type Requeued = {
42
44
  kind: 'requeued';
43
45
  queue: readonly ChangeBatch[];
@@ -60,4 +62,4 @@ export type Joining = {
60
62
  export declare function requeued(queue: readonly ChangeBatch[], changes: readonly Change[], visible: VisibleLayer, changeable: (batch: ChangeBatch) => boolean, state: (queue: readonly ChangeBatch[]) => VisibleLayer): Requeued;
61
63
  export declare function joined(queue: readonly ChangeBatch[], owner: ChangeBatch, extra: ChangeBatch): Joining;
62
64
  export declare function limitedIn(queue: readonly ChangeBatch[], batch: ChangeBatch, limits: readonly ProviderLimit[], state: (queue: readonly ChangeBatch[]) => VisibleLayer): SaveRefusal | null;
63
- export declare function buildBatch(input: SaveInput): BatchResult;
65
+ export declare function buildBatch(input: SaveInput): Later<BatchResult>;
@@ -9,6 +9,8 @@ export type SearchRequest = {
9
9
  collection?: true;
10
10
  conversations?: readonly string[];
11
11
  limit?: number;
12
+ after?: string;
13
+ total?: true;
12
14
  };
13
15
  export type DocumentHit = {
14
16
  room: string;
@@ -37,6 +39,13 @@ export type SearchHits = {
37
39
  documents: readonly DocumentHit[];
38
40
  messages: readonly MessageHit[];
39
41
  };
42
+ export type SearchWindow = SearchHits & {
43
+ next?: string;
44
+ total?: {
45
+ documents: number;
46
+ messages: number;
47
+ };
48
+ };
40
49
  export type SearchPending = SearchHits & {
41
50
  pending: readonly (PendingRoom | PendingConversation)[];
42
51
  coverage: SearchCoverage;
@@ -44,7 +53,7 @@ export type SearchPending = SearchHits & {
44
53
  export type SearchUndeclared = ProviderRefusal & {
45
54
  kind: 'undeclared';
46
55
  };
47
- export type SearchResult = (SearchHits & {
56
+ export type SearchResult = (SearchWindow & {
48
57
  coverage: SearchCoverage;
49
58
  }) | SearchPending | SearchUndeclared;
50
59
  export declare function undeclaredSearch(): SearchUndeclared;
@@ -65,12 +74,15 @@ export type SearchSource = {
65
74
  room(room: string): readonly string[];
66
75
  document(room: string, path: string): SearchedDocument | null;
67
76
  };
77
+ type HitCursor = readonly [number, string, string] | readonly [] | null;
68
78
  export type SearchPlan = {
69
79
  text: string;
70
80
  documents: unknown;
71
81
  collection: boolean;
72
82
  conversations: readonly string[] | null;
73
83
  limit: number | null;
84
+ after: readonly [HitCursor, HitCursor] | null;
85
+ total: boolean;
74
86
  };
75
87
  export type SearchIndex = {
76
88
  generation(): string;
@@ -85,7 +97,8 @@ export type SearchIndex = {
85
97
  search(plan: SearchPlan, documents: readonly {
86
98
  room: string;
87
99
  path: string;
88
- }[] | null, conversations: readonly string[], rooms: ReadonlySet<string> | null, selections: ReadonlyMap<string, readonly string[]> | null): SearchHits;
100
+ }[] | null, conversations: readonly string[], rooms: ReadonlySet<string> | null, selections: ReadonlyMap<string, readonly string[]> | null): SearchWindow;
89
101
  };
90
102
  export declare function searchPlanOf(input: unknown): SearchPlan;
91
103
  export declare function createSearchIndex(source: SearchSource): SearchIndex;
104
+ export {};
@@ -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,11 +3,12 @@ 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';
9
10
  export declare const STORE_SCHEMA = 25;
10
- export declare const AUTHORED_SCHEMA = 2;
11
+ export declare const AUTHORED_SCHEMA = 3;
11
12
  export type ReplicaRecord = {
12
13
  locator: string;
13
14
  name: string;
@@ -66,6 +67,10 @@ export type HeldConversation = {
66
67
  read: string | null | undefined;
67
68
  partial: boolean;
68
69
  };
70
+ export type MessageWindow = {
71
+ messages: AcceptedMessage[];
72
+ more: boolean;
73
+ };
69
74
  export type ConversationWrite = {
70
75
  conversation: string;
71
76
  messages: readonly AcceptedMessage[];
@@ -88,6 +93,11 @@ export type ChatDraftRecord = {
88
93
  submitted?: readonly ChatSubmission[];
89
94
  moves?: readonly string[];
90
95
  };
96
+ export type CallRecord = {
97
+ readonly operation: string;
98
+ readonly name: string;
99
+ readonly input: unknown;
100
+ };
91
101
  export type RecordWrite = {
92
102
  next: ReplicaRecord;
93
103
  previous: ReplicaRecord | null;
@@ -96,6 +106,7 @@ export type RecordWrite = {
96
106
  export type AuthoredWrite = {
97
107
  locator: string;
98
108
  queue: readonly ChangeBatch[];
109
+ founded?: readonly ChangeBatch[];
99
110
  saved?: ReadonlyMap<string, readonly SavedDraft[]>;
100
111
  roomDrafts?: readonly RoomDraftRecord[];
101
112
  consumedRoomDrafts?: readonly string[];
@@ -123,7 +134,8 @@ export type RuntimeStore = {
123
134
  present(record: PresentationRecord): Promise<void>;
124
135
  conversations(): Promise<readonly HeldConversation[]>;
125
136
  keepMessages(write: ConversationWrite): Promise<void>;
126
- messageWindow(conversation: string, limit: number | undefined): Promise<AcceptedMessage[]>;
137
+ messageWindow(conversation: string, limit: number, before: readonly [string, string] | null): Promise<MessageWindow>;
138
+ messageCount(conversation: string): Promise<number>;
127
139
  messagesAfter(conversation: string, identity: string | null): Promise<AcceptedMessage[]>;
128
140
  messageIdentities(conversation: string): Promise<readonly string[]>;
129
141
  turnArrived(conversation: string, turn: string): Promise<boolean>;
@@ -131,6 +143,9 @@ export type RuntimeStore = {
131
143
  chatDrafts(): Promise<readonly ChatDraftRecord[]>;
132
144
  keepChatDrafts(records: readonly ChatDraftRecord[]): Promise<void>;
133
145
  dropChatDraft(conversation: string): Promise<void>;
146
+ calls(): Promise<readonly CallRecord[]>;
147
+ keepCall(record: CallRecord): Promise<void>;
148
+ dropCall(operation: string): Promise<void>;
134
149
  keepRoomDraft(record: RoomDraftRecord): Promise<void>;
135
150
  discardRoomDraft(locator: string, path: string): Promise<void>;
136
151
  fences(): Promise<readonly string[]>;
@@ -151,6 +166,7 @@ export type RuntimeStore = {
151
166
  rememberGeneration(value: string): Promise<void>;
152
167
  close(): void;
153
168
  };
169
+ export declare function transacted<T>(database: IDBDatabase, stores: string | readonly string[], mode: IDBTransactionMode, work: (transaction: IDBTransaction) => Later<T>): Promise<T>;
154
170
  export declare function authoredHolder(): Promise<string | null>;
155
171
  export declare function authoredBy(holder: string): Promise<boolean>;
156
172
  export declare function authoredBinding(): Promise<string | null>;
@@ -1,6 +1,8 @@
1
1
  export declare function yielded(): Promise<void>;
2
2
  export declare const ROW_WEIGHT = 256;
3
3
  export type Later<T> = T | Promise<T>;
4
- export declare function after<T, R>(value: Later<T>, next: (value: T) => R): Later<R>;
5
- export declare function inUnits<T>(items: Iterable<T>, each: (item: T) => number): Later<void>;
6
- export declare function inChunks<T>(items: readonly T[], weigh: (item: T) => number, each: (chunk: readonly T[]) => void): Promise<void>;
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, 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>;
8
+ export declare function inChunks<T>(items: readonly T[], weigh: (item: T) => number, each: (chunk: readonly T[]) => Later<void>): Promise<void>;
@@ -34,6 +34,10 @@ declare const MEMBERS: {
34
34
  readonly reach: 'within';
35
35
  readonly effect: 'write';
36
36
  };
37
+ readonly saveParts: {
38
+ readonly reach: 'within';
39
+ readonly effect: 'write';
40
+ };
37
41
  readonly history: {
38
42
  readonly reach: 'within';
39
43
  readonly effect: 'read';
@@ -42,6 +46,10 @@ declare const MEMBERS: {
42
46
  readonly reach: 'within';
43
47
  readonly effect: 'read';
44
48
  };
49
+ readonly 'binaryFile.link': {
50
+ readonly reach: 'within';
51
+ readonly effect: 'read';
52
+ };
45
53
  readonly 'binaryFile.readReference': {
46
54
  readonly reach: 'within';
47
55
  readonly effect: 'read';
@@ -94,6 +102,10 @@ declare const MEMBERS: {
94
102
  readonly reach: 'app';
95
103
  readonly effect: 'write';
96
104
  };
105
+ readonly 'presentation.edit': {
106
+ readonly reach: 'app';
107
+ readonly effect: 'write';
108
+ };
97
109
  readonly 'conversation.list': {
98
110
  readonly reach: 'within';
99
111
  readonly effect: 'read';
@@ -134,6 +146,10 @@ declare const MEMBERS: {
134
146
  readonly reach: 'within';
135
147
  readonly effect: 'write';
136
148
  };
149
+ readonly 'chatDraft.prepend': {
150
+ readonly reach: 'within';
151
+ readonly effect: 'write';
152
+ };
137
153
  readonly 'chatDraft.discard': {
138
154
  readonly reach: 'within';
139
155
  readonly effect: 'write';
package/dist/test-host.js CHANGED
@@ -99,7 +99,7 @@ export function createHouseBridgeTestHost(options = {}) {
99
99
  });
100
100
  }
101
101
  const bridge = {
102
- runtime,
102
+ runtime: runtime,
103
103
  address: () => shown,
104
104
  onAddress(listener) {
105
105
  return followHeld(addressListeners, listener, () => shown);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/app-bridge",
3
- "version": "0.1.0-ca559eade7c19",
3
+ "version": "0.1.0-caae3da69c1c2",
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",
@@ -1,13 +0,0 @@
1
- export type RuntimeDemand = {
2
- readonly whole: boolean;
3
- readonly rooms: readonly string[];
4
- readonly handles: readonly string[];
5
- readonly conversations: boolean;
6
- };
7
- export declare const WHOLE_DEMAND: RuntimeDemand;
8
- export declare function demanded(demand: RuntimeDemand, room: {
9
- readonly locator: string;
10
- readonly handle: string;
11
- }): boolean;
12
- export declare function wider(next: RuntimeDemand, current: RuntimeDemand): boolean;
13
- export declare function narrower(next: RuntimeDemand, current: RuntimeDemand): boolean;