@agentshouse/app-bridge 0.1.0-c8d97d63f2350 → 0.1.0-c8dd3de04bf64

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 (89) hide show
  1. package/README.md +6 -6
  2. package/dist/index.d.ts +196 -132
  3. package/dist/mdmodel/definition.d.ts +1 -1
  4. package/dist/mdmodel/document.d.ts +2 -1
  5. package/dist/mdmodel/event.d.ts +77 -0
  6. package/dist/mdmodel/facts.d.ts +14 -0
  7. package/dist/mdmodel/index.d.ts +19 -7
  8. package/dist/mdmodel/kinds.d.ts +17 -0
  9. package/dist/mdmodel/pattern.d.ts +9 -0
  10. package/dist/mdmodel/query/language.d.ts +253 -0
  11. package/dist/mdmodel/query/match.d.ts +13 -0
  12. package/dist/mdmodel/query/rows.d.ts +31 -0
  13. package/dist/mdmodel/query/sql.d.ts +38 -0
  14. package/dist/mdmodel/reserved.d.ts +5 -0
  15. package/dist/mdmodel/types.d.ts +11 -0
  16. package/dist/mdmodel/validate.d.ts +7 -5
  17. package/dist/mdruntime/actions.d.ts +19 -0
  18. package/dist/mdruntime/adapter.d.ts +45 -25
  19. package/dist/mdruntime/attached-model.d.ts +7 -0
  20. package/dist/mdruntime/bootstrap.d.ts +43 -0
  21. package/dist/mdruntime/cell.d.ts +5 -0
  22. package/dist/mdruntime/chain.d.ts +2 -1
  23. package/dist/mdruntime/change.d.ts +1 -0
  24. package/dist/mdruntime/client.d.ts +23 -5
  25. package/dist/mdruntime/collection.d.ts +2 -1
  26. package/dist/mdruntime/compile.d.ts +6 -6
  27. package/dist/mdruntime/conversation-live.d.ts +135 -0
  28. package/dist/mdruntime/conversation-row.d.ts +32 -0
  29. package/dist/mdruntime/conversation.d.ts +34 -38
  30. package/dist/mdruntime/durability.d.ts +15 -0
  31. package/dist/mdruntime/figures.d.ts +48 -0
  32. package/dist/mdruntime/holdings.d.ts +28 -0
  33. package/dist/mdruntime/identity.d.ts +0 -1
  34. package/dist/mdruntime/install.d.ts +55 -0
  35. package/dist/mdruntime/job.d.ts +32 -0
  36. package/dist/mdruntime/listing.d.ts +52 -0
  37. package/dist/mdruntime/live.d.ts +22 -0
  38. package/dist/mdruntime/log.d.ts +5 -0
  39. package/dist/mdruntime/media.d.ts +1 -1
  40. package/dist/mdruntime/messages.d.ts +27 -3
  41. package/dist/mdruntime/model.d.ts +2 -9
  42. package/dist/mdruntime/observation.d.ts +2 -2
  43. package/dist/mdruntime/outcome.d.ts +4 -1
  44. package/dist/mdruntime/overlay.d.ts +1 -0
  45. package/dist/mdruntime/preparation.d.ts +19 -0
  46. package/dist/mdruntime/query.d.ts +13 -209
  47. package/dist/mdruntime/reach.d.ts +14 -12
  48. package/dist/mdruntime/readiness.d.ts +0 -3
  49. package/dist/mdruntime/reads.d.ts +36 -0
  50. package/dist/mdruntime/refresh.d.ts +26 -0
  51. package/dist/mdruntime/replica.d.ts +9 -8
  52. package/dist/mdruntime/room-draft.d.ts +4 -5
  53. package/dist/mdruntime/room-drafts.d.ts +23 -0
  54. package/dist/mdruntime/runtime.d.ts +42 -0
  55. package/dist/mdruntime/save.d.ts +5 -1
  56. package/dist/mdruntime/saves.d.ts +69 -0
  57. package/dist/mdruntime/search.d.ts +12 -63
  58. package/dist/mdruntime/seed.d.ts +11 -2
  59. package/dist/mdruntime/socket/admission.d.ts +6 -0
  60. package/dist/mdruntime/socket/answers.d.ts +5 -0
  61. package/dist/mdruntime/socket/lanes.d.ts +19 -0
  62. package/dist/mdruntime/socket/rooms.d.ts +43 -0
  63. package/dist/mdruntime/socket/session.d.ts +37 -0
  64. package/dist/mdruntime/socket.d.ts +69 -0
  65. package/dist/mdruntime/source.d.ts +60 -0
  66. package/dist/mdruntime/status.d.ts +0 -2
  67. package/dist/mdruntime/store/fences.d.ts +15 -0
  68. package/dist/mdruntime/store/installs.d.ts +29 -0
  69. package/dist/mdruntime/store/readiness.d.ts +9 -0
  70. package/dist/mdruntime/store/records.d.ts +211 -0
  71. package/dist/mdruntime/store/room-held.d.ts +7 -0
  72. package/dist/mdruntime/store/space.d.ts +10 -0
  73. package/dist/mdruntime/store/watchers.d.ts +16 -0
  74. package/dist/mdruntime/store/writes.d.ts +23 -0
  75. package/dist/mdruntime/store.d.ts +107 -145
  76. package/dist/mdruntime/stored.d.ts +59 -33
  77. package/dist/mdruntime/surface.d.ts +87 -0
  78. package/dist/mdruntime/tables.d.ts +120 -29
  79. package/dist/mdruntime/tallies.d.ts +17 -0
  80. package/dist/mdruntime/transfer.d.ts +4 -0
  81. package/dist/mdruntime/turn.d.ts +8 -0
  82. package/dist/mdruntime/wire.d.ts +17 -1
  83. package/dist/test-host.js +1 -1
  84. package/docs/families.md +20 -8
  85. package/package.json +1 -1
  86. package/dist/mdmodel/condition.d.ts +0 -167
  87. package/dist/mdmodel/profile.d.ts +0 -5
  88. package/dist/mdruntime/connection.d.ts +0 -152
  89. package/dist/mdruntime/fulltext.d.ts +0 -26
@@ -1,14 +1,16 @@
1
1
  import { type QueryAnswer, type QueryRoom } from './compile.js';
2
2
  import type { Composed } from './collection.js';
3
- import { type SearchAsk } from './fulltext.js';
4
- import { type ConversationWrite, type HeldConversation, type MessageWindow } from './messages.js';
5
- import type { Plan } from './query.js';
6
- import type { SearchWindow } from './search.js';
7
- import { type Committed, type CountedRoom, type HeldEntry, type ReplicaOpened, type Referrer, type RoomCommit, type StoredEntry, type TypedEntry, type View } from './stored.js';
8
- export type { Committed, CountedRoom, HeldEntry, OverlayEntry, ReplicaOpened, Referrer, RoomCommit, StoredEntry, TypedEntry, View, } from './stored.js';
3
+ import type { UnsentWork } from './durability.js';
4
+ import type { JobMarker } from './job.js';
5
+ import { type ConversationWrite, type HeldConversation, type HeldRow, type MessageWindow } from './messages.js';
6
+ import type { GroupTotal, Plan } from './query.js';
7
+ import { type ReadAt } from './reads.js';
8
+ import { type ConversationTally, type RoomTally } from './tallies.js';
9
+ import { type Committed, type Covering, type HeldEntry, type HeldLocators, type HeldRoomRow, type HeldRoomWork, type ReplicaOpened, type Referrer, type Resumed, type RoomCommit, type StoredEntry, type TypedEntry, type View } from './stored.js';
10
+ export type { Committed, Covering, HeldEntry, HeldLocators, HeldRoomRow, HeldRoomWork, OverlayEntry, ReplicaOpened, Referrer, Resumed, RoomCommit, StoredEntry, TypedEntry, View, } from './stored.js';
9
11
  export type { QueryAnswer, QueryRoom } from './compile.js';
10
- export type { SearchAsk } from './fulltext.js';
11
- export type { ConversationWrite, HeldConversation, MessageWindow } from './messages.js';
12
+ export type { ConversationWrite, HeldConversation, HeldRow, MessageWindow } from './messages.js';
13
+ export type { ConversationTally, RoomTally } from './tallies.js';
12
14
  export type Value = string | number | bigint | Uint8Array | null;
13
15
  export type Row = Readonly<Record<string, Value>>;
14
16
  export interface Connection {
@@ -36,6 +38,10 @@ export interface SqliteStatement {
36
38
  }
37
39
  export interface SqliteDatabase {
38
40
  readonly pointer: number;
41
+ createFunction(name: string, run: (context: number, ...values: Value[]) => Value, options: {
42
+ readonly arity: number;
43
+ readonly deterministic: true;
44
+ }): unknown;
39
45
  exec(options: {
40
46
  readonly sql: string;
41
47
  readonly bind: readonly Value[];
@@ -47,7 +53,7 @@ export interface SqliteDatabase {
47
53
  export declare function sqliteConnection(engine: SqliteEngine, database: SqliteDatabase): Connection;
48
54
  export declare const FILE_PART_BYTES = 1048576;
49
55
  export declare const RUNTIME_TABLES: readonly string[];
50
- export type AuthoredFact = 'holder' | 'binding' | 'generation';
56
+ export type AuthoredFact = 'holder' | 'generation';
51
57
  export type StoredFile = {
52
58
  readonly key: string;
53
59
  readonly blob: Blob;
@@ -63,6 +69,8 @@ export type KeptPending = {
63
69
  readonly batch: string;
64
70
  readonly state: string;
65
71
  readonly files: readonly string[];
72
+ readonly paths: readonly string[];
73
+ readonly moving: boolean;
66
74
  };
67
75
  export type KeptRecord = {
68
76
  readonly record: string;
@@ -90,11 +98,31 @@ export type HeldQueues = {
90
98
  readonly state: string;
91
99
  }[];
92
100
  };
101
+ export type HeldStatus = {
102
+ readonly queued: readonly string[];
103
+ readonly lastCompleted: string | null;
104
+ readonly changes: readonly {
105
+ readonly locator: string;
106
+ readonly path: string;
107
+ }[];
108
+ readonly resets: readonly {
109
+ readonly locator: string;
110
+ readonly reset: string;
111
+ }[];
112
+ readonly returned: readonly string[];
113
+ };
93
114
  export type OpenedFile = {
94
115
  readonly key: string;
95
116
  readonly byteLength: number;
96
117
  readonly mediaType: string;
97
118
  };
119
+ export type OpenedRoom = GroupTotal & {
120
+ readonly room: string;
121
+ };
122
+ export type OpenedHeld = {
123
+ readonly rooms: readonly OpenedRoom[];
124
+ readonly cleanable: number;
125
+ };
98
126
  type Asked<A, R> = {
99
127
  readonly asked: A;
100
128
  readonly answer: R;
@@ -107,14 +135,36 @@ export type AuthoredWrite = {
107
135
  readonly writes: readonly AuthoredRows[];
108
136
  readonly files: readonly StoredFile[];
109
137
  readonly whole: boolean;
110
- readonly discards?: readonly string[];
111
138
  };
112
139
  export interface RuntimeRequests {
113
- readonly 'authored.queues': Asked<Nothing, HeldQueues>;
114
- readonly 'authored.roomDrafts': Asked<Nothing, readonly string[]>;
140
+ readonly 'authored.status': Asked<Nothing, HeldStatus>;
141
+ readonly 'authored.moving': Asked<Nothing, HeldQueues>;
142
+ readonly 'authored.pending': Asked<{
143
+ readonly locator: string;
144
+ readonly id: string;
145
+ }, {
146
+ readonly state: string | null;
147
+ readonly room: boolean;
148
+ }>;
149
+ readonly 'authored.batch': Asked<{
150
+ readonly locator: string;
151
+ readonly id: string;
152
+ }, string | null>;
153
+ readonly 'authored.order': Asked<{
154
+ readonly locator: string;
155
+ }, readonly string[]>;
156
+ readonly 'authored.queued': Asked<Nothing, readonly string[]>;
157
+ readonly 'authored.roomDrafts': Asked<{
158
+ readonly locator: string | null;
159
+ readonly paths: readonly string[] | null;
160
+ }, readonly string[]>;
161
+ readonly 'authored.chatDraft.read': Asked<{
162
+ readonly conversation: string;
163
+ }, string | null>;
115
164
  readonly 'authored.chatDrafts': Asked<Nothing, readonly string[]>;
116
165
  readonly 'authored.calls': Asked<Nothing, readonly string[]>;
117
166
  readonly 'authored.fences': Asked<Nothing, readonly string[]>;
167
+ readonly 'authored.unsent': Asked<Nothing, readonly UnsentWork[]>;
118
168
  readonly 'authored.fact': Asked<{
119
169
  readonly name: AuthoredFact;
120
170
  }, string | null>;
@@ -156,11 +206,32 @@ export interface RuntimeRequests {
156
206
  readonly holder: string | null;
157
207
  }, boolean>;
158
208
  readonly 'replica.open': Asked<Nothing, ReplicaOpened>;
209
+ readonly 'replica.rooms': Asked<{
210
+ readonly locators: readonly string[] | null;
211
+ }, readonly HeldRoomRow[]>;
212
+ readonly 'replica.room': Asked<{
213
+ readonly locator: string;
214
+ }, HeldRoomWork>;
215
+ readonly 'replica.covering': Asked<Nothing, Covering>;
216
+ readonly 'replica.offline': Asked<{
217
+ readonly locator: string;
218
+ }, string | null>;
219
+ readonly 'replica.held': Asked<Nothing, HeldLocators>;
220
+ readonly 'replica.demote': Asked<Nothing, null>;
221
+ readonly 'replica.facts': Asked<Nothing, Readonly<Record<string, string>>>;
222
+ readonly 'replica.presentation': Asked<{
223
+ readonly app: string;
224
+ }, string | null>;
159
225
  readonly 'replica.query': Asked<{
160
226
  readonly plan: Plan;
161
227
  readonly rooms: readonly QueryRoom[];
162
228
  readonly budget: number | null;
163
229
  }, QueryAnswer>;
230
+ readonly 'replica.tallies': Asked<{
231
+ readonly totals: Plan;
232
+ readonly rooms: readonly QueryRoom[];
233
+ readonly since: string;
234
+ }, readonly RoomTally[]>;
164
235
  readonly 'replica.entries': Asked<{
165
236
  readonly key: number;
166
237
  readonly view: View;
@@ -175,20 +246,9 @@ export interface RuntimeRequests {
175
246
  readonly key: number;
176
247
  readonly view: View;
177
248
  readonly targets: readonly string[];
178
- readonly kinds: readonly string[];
179
249
  }, readonly Referrer[]>;
180
- readonly 'replica.files': Asked<{
181
- readonly key: number;
182
- readonly view: View;
183
- readonly after: string | null;
184
- readonly limit: number;
185
- }, readonly {
186
- readonly path: string;
187
- readonly revision: string;
188
- }[]>;
189
250
  readonly 'replica.folders': Asked<{
190
251
  readonly key: number;
191
- readonly view: View;
192
252
  readonly paths: readonly string[];
193
253
  }, readonly string[]>;
194
254
  readonly 'replica.typedWithin': Asked<{
@@ -197,10 +257,6 @@ export interface RuntimeRequests {
197
257
  readonly roots: readonly string[];
198
258
  readonly within: boolean;
199
259
  }, boolean>;
200
- readonly 'replica.counts': Asked<{
201
- readonly rooms: readonly CountedRoom[];
202
- }, readonly number[]>;
203
- readonly 'replica.search': Asked<SearchAsk, SearchWindow>;
204
260
  readonly 'replica.stage': Asked<{
205
261
  readonly locator: string;
206
262
  readonly transfer: string;
@@ -208,7 +264,15 @@ export interface RuntimeRequests {
208
264
  readonly fingerprint: string;
209
265
  readonly entries: readonly StoredEntry[];
210
266
  readonly folders: readonly string[];
267
+ readonly part: string | null;
211
268
  }, number | null>;
269
+ readonly 'replica.resume': Asked<{
270
+ readonly locator: string;
271
+ readonly transfer: string;
272
+ readonly fingerprint: string;
273
+ readonly parts: readonly string[];
274
+ readonly published: number | null;
275
+ }, Resumed | null>;
212
276
  readonly 'replica.refresh': Asked<{
213
277
  readonly key: number;
214
278
  readonly composed: Composed;
@@ -236,6 +300,9 @@ export interface RuntimeRequests {
236
300
  readonly 'replica.abandon': Asked<{
237
301
  readonly locator: string;
238
302
  }, null>;
303
+ readonly 'replica.unfence': Asked<{
304
+ readonly locators: readonly string[];
305
+ }, readonly string[]>;
239
306
  readonly 'replica.release': Asked<{
240
307
  readonly key: number;
241
308
  }, null>;
@@ -284,28 +351,50 @@ export interface RuntimeRequests {
284
351
  readonly key: string;
285
352
  }, null>;
286
353
  readonly 'opened.clean': Asked<Nothing, number>;
354
+ readonly 'opened.held': Asked<Nothing, OpenedHeld>;
287
355
  readonly 'file.part': Asked<{
288
356
  readonly key: string;
289
357
  readonly part: number;
290
358
  }, Uint8Array | null>;
291
- readonly 'conversation.held': Asked<Nothing, readonly HeldConversation[]>;
359
+ readonly 'conversation.held': Asked<{
360
+ readonly conversations: readonly string[] | null;
361
+ }, readonly HeldConversation[]>;
292
362
  readonly 'conversation.keep': Asked<ConversationWrite, null>;
293
363
  readonly 'conversation.window': Asked<{
294
364
  readonly conversation: string;
295
365
  readonly limit: number;
296
366
  readonly before: readonly [string, string] | null;
367
+ readonly phrase: string | null;
297
368
  }, MessageWindow>;
298
369
  readonly 'conversation.count': Asked<{
299
370
  readonly conversation: string;
371
+ readonly phrase: string | null;
300
372
  }, number>;
301
373
  readonly 'conversation.turn': Asked<{
302
374
  readonly conversation: string;
303
375
  readonly turn: string;
304
376
  }, boolean>;
377
+ readonly 'conversation.rows': Asked<{
378
+ readonly conversations: readonly string[];
379
+ }, readonly HeldRow[]>;
380
+ readonly 'conversation.jobs': Asked<{
381
+ readonly conversation: string;
382
+ }, readonly JobMarker[]>;
383
+ readonly 'conversation.tallies': Asked<{
384
+ readonly conversations: readonly string[] | null;
385
+ readonly since: string;
386
+ }, readonly ConversationTally[]>;
305
387
  readonly 'conversation.drop': Asked<{
306
388
  readonly conversations: readonly string[];
307
389
  }, null>;
308
390
  readonly 'space.probe': Asked<Nothing, null>;
391
+ readonly 'read.stored': Asked<ReadAt, string | null>;
392
+ readonly 'read.keep': Asked<ReadAt & {
393
+ readonly answer: string;
394
+ }, null>;
395
+ readonly 'read.builds': Asked<{
396
+ readonly build: string;
397
+ }, null>;
309
398
  }
310
399
  export type RuntimeKind = keyof RuntimeRequests;
311
400
  export type RuntimeRequest<K extends RuntimeKind = RuntimeKind> = {
@@ -320,5 +409,7 @@ export interface RuntimeDatabase {
320
409
  export declare function isRuntime(request: {
321
410
  readonly kind: string;
322
411
  }): request is RuntimeRequest;
323
- export declare function readsRuntime(request: RuntimeRequest): boolean;
412
+ export declare function readsRuntime(request: {
413
+ readonly kind: string;
414
+ }): boolean;
324
415
  export declare function answerRuntime(connection: Connection, request: RuntimeRequest, spool: FileSpool): unknown;
@@ -0,0 +1,17 @@
1
+ import { type QueryRoom } from './compile.js';
2
+ import type { GroupTotal, Plan } from './query.js';
3
+ import type { Connection } from './tables.js';
4
+ export type RoomTally = {
5
+ readonly key: number;
6
+ readonly documents: GroupTotal;
7
+ readonly files: GroupTotal;
8
+ readonly documentTimes: readonly (readonly [string | null, string | null])[];
9
+ readonly chatTimes: readonly string[];
10
+ readonly messageTimes: readonly string[];
11
+ };
12
+ export type ConversationTally = {
13
+ readonly conversation: string;
14
+ readonly said: readonly string[];
15
+ };
16
+ export declare function roomTallies(connection: Connection, totals: Plan, rooms: readonly QueryRoom[], since: string): RoomTally[];
17
+ export declare function conversationTallies(connection: Connection, conversations: readonly string[] | null, since: string): ConversationTally[];
@@ -0,0 +1,4 @@
1
+ export type Unconfirmed = {
2
+ kind: 'unconfirmed';
3
+ };
4
+ export declare const unconfirmed: Unconfirmed;
@@ -0,0 +1,8 @@
1
+ export declare function yielded(): Promise<void>;
2
+ export declare const ROW_WEIGHT = 256;
3
+ export type Later<T> = T | Promise<T>;
4
+ export declare function after<T, R>(value: Later<T>, next: (value: T) => Later<R>): Later<R>;
5
+ export declare function paced(): (weight: number) => Later<void>;
6
+ export declare function inUnits<T>(items: Iterable<T>, each: (item: T) => number, ended?: () => void, paused?: () => Promise<void>): Later<void>;
7
+ export declare function finished<R>(steps: Generator<number, R, void>): R;
8
+ export declare function stepped<R>(steps: Generator<number, R, void>): Later<R>;
@@ -1,4 +1,4 @@
1
- import type { ConnectionRefusal } from './connection.js';
1
+ import type { ConnectionRefusal } from './socket.js';
2
2
  import type { Described } from './failure.js';
3
3
  export type RuntimePort = {
4
4
  postMessage(message: unknown): void;
@@ -82,6 +82,18 @@ declare const MEMBERS: {
82
82
  readonly reach: 'whole';
83
83
  readonly effect: 'write';
84
84
  };
85
+ readonly unsent: {
86
+ readonly reach: 'whole';
87
+ readonly effect: 'read';
88
+ };
89
+ readonly reset: {
90
+ readonly reach: 'whole';
91
+ readonly effect: 'write';
92
+ };
93
+ readonly readAgain: {
94
+ readonly reach: 'whole';
95
+ readonly effect: 'read';
96
+ };
85
97
  readonly persistence: {
86
98
  readonly reach: 'runtime';
87
99
  readonly effect: 'read';
@@ -176,6 +188,7 @@ declare const TOPICS: {
176
188
  readonly 'sync-status': 'within';
177
189
  readonly 'service-mode': 'runtime';
178
190
  readonly member: 'runtime';
191
+ readonly 'authority-changes': 'runtime';
179
192
  readonly query: 'within';
180
193
  readonly queue: 'within';
181
194
  readonly 'room-drafts': 'within';
@@ -183,6 +196,9 @@ declare const TOPICS: {
183
196
  readonly conversation: 'within';
184
197
  readonly conversations: 'within';
185
198
  readonly agents: 'within';
199
+ readonly figures: 'whole';
200
+ readonly holdings: 'whole';
201
+ readonly read: 'whole';
186
202
  };
187
203
  export declare const WIRE: {
188
204
  readonly members: Readonly<Record<string, WireCall>>;
package/dist/test-host.js CHANGED
@@ -129,7 +129,7 @@ export function createHouseBridgeTestHost(options = {}) {
129
129
  },
130
130
  install: () => Promise.resolve('manual'),
131
131
  notifications: () => Promise.resolve('unavailable'),
132
- setBadge: () => Promise.resolve(),
132
+ telegram: () => Promise.resolve({ state: 'unavailable', name: null, username: null }),
133
133
  setTab(tab) {
134
134
  tabs.push(tab);
135
135
  },
package/docs/families.md CHANGED
@@ -13,7 +13,8 @@
13
13
  absolute path, carries its current address as the return target, and the page
14
14
  returns there when it completes. An App names an address House gave it in a
15
15
  reading and composes one only for `/bind/<app_ref>`, where the User binds
16
- its Rooms, with `?slot=<name>` to open at one slot.
16
+ its Rooms, with `?slot=<name>` to open at one slot, and `/sign-out`, which
17
+ signs the User out and opens sign-in.
17
18
  - **Installation** - `install()` offers the page as a Home-screen app. Where the
18
19
  browser has an install prompt ready the shell shows it and the call resolves
19
20
  `'accepted'` or `'dismissed'` with the User's choice, spending that prompt;
@@ -28,11 +29,22 @@
28
29
  notifications, or `'unavailable'` where it has no push, as on an iPhone or
29
30
  iPad outside a Home-screen app. `notifications(true)` asks the browser's
30
31
  permission and subscribes, `notifications(false)` unsubscribes, and each
31
- answers the state it leaves; a failure of the browser's push service, and
32
- of `setBadge`, rejects the same way. Call `notifications(true)` from a
33
- click. `setBadge(unread)` takes the identifiers of the Human Notifications
34
- unread in this storage and sets the icon's badge to their number, or clears
35
- it at none, where the browser shows one.
32
+ answers the state it leaves; a failure of the browser's push service
33
+ rejects the same way. Call `notifications(true)` from a click. House's
34
+ service worker counts the icon's badge itself, as pushes arrive and as
35
+ read marks reach this storage.
36
+ - **Telegram** - House's own panel alone, refused to an App or a Site the same
37
+ way. `telegram()` answers `{ state, name, username }`: `state` is
38
+ `'available'` where the page runs inside a House bot's Mini App that gave it
39
+ Telegram's launch data naming an account, with that account's `name` and its
40
+ `username` or `null`, and `'unavailable'` with both `null` elsewhere.
41
+ `telegram(true)` links the signed-in User to that account and answers
42
+ `'linked'` with it; where the User's sign-in is
43
+ not recent, the page goes to sign in again, and nothing links until a later
44
+ `telegram(true)`.
45
+ Telegram's refusal rejects with an error coded `linked_elsewhere`,
46
+ `rate_limited` or `refused`, and a failed request with the browser's own
47
+ error name.
36
48
  - **Status** - the App reference the runtime client is attached under,
37
49
  `preferences`: the `roomRef` and Path of the App's own preferences document,
38
50
  or `null` until the runtime holds that Room, sync
@@ -69,7 +81,7 @@
69
81
  path, its size and its `text`, or its bytes as `base64`. The browser keeps
70
82
  each answer per App and release: a read naming a release it holds answers
71
83
  without asking House, and keeping a newer release drops the earlier one. A
72
- refusal is House's `{ error: { code, retryable } }`, `app_release_not_found` for an
84
+ refusal is House's `{ error: { code, retryable } }`, `not_found` for an
73
85
  App with no release; a read House does not answer, or one that outlived
74
86
  the browser's signed-in User, is `null`.
75
87
  - **External calls** - `callExternal({ url, method, headers, body, room_ref })`
@@ -142,7 +154,7 @@ records in `tabs` each `setTab`, answers a release code read from the
142
154
  by App reference and `readSiteScreenshot` from the `siteScreenshots` it was
143
155
  given by Site identifier, answers every `install()` `'manual'`, as a browser
144
156
  with no install prompt does, answers every `notifications()` `'unavailable'`,
145
- as a browser without push does, settles every `setBadge`, records in `chats`
157
+ as a browser without push does, records in `chats`
146
158
  each Chat `chat.mount` places, with its `element`, the `options` it was last
147
159
  given and whether it is still `mounted`, drawing nothing, delivers each App
148
160
  message `message({ from, body })` plays, and hands `bridge.runtime` the MD
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/app-bridge",
3
- "version": "0.1.0-c8d97d63f2350",
3
+ "version": "0.1.0-c8dd3de04bf64",
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",
@@ -1,167 +0,0 @@
1
- import { type Definition, type ValueFacts } from './definition.js';
2
- import type { Document, VerifiedModel } from './types.js';
3
- export type ConditionValue = string | number | boolean;
4
- export declare const CONDITION_OPERATORS: readonly ['eq', 'in', 'exists', 'contains', 'gt', 'gte', 'lt', 'lte', 'prefix'];
5
- export type ConditionOperator = (typeof CONDITION_OPERATORS)[number];
6
- export type ConditionTest = {
7
- readonly all: readonly ConditionTest[];
8
- } | {
9
- readonly any: readonly ConditionTest[];
10
- } | {
11
- readonly not: ConditionTest;
12
- } | ({
13
- readonly path: string;
14
- } & ({
15
- readonly eq: ConditionValue;
16
- } | {
17
- readonly in: readonly ConditionValue[];
18
- } | {
19
- readonly exists: boolean;
20
- } | {
21
- readonly contains: ConditionValue;
22
- } | {
23
- readonly gt: number | string;
24
- } | {
25
- readonly gte: number | string;
26
- } | {
27
- readonly lt: number | string;
28
- } | {
29
- readonly lte: number | string;
30
- } | {
31
- readonly prefix: string;
32
- }));
33
- export type ConditionScope = {
34
- readonly type: string;
35
- } | {
36
- readonly folder: string;
37
- } | {
38
- readonly document: string;
39
- };
40
- type DocumentEventBase = {
41
- readonly on: 'documents';
42
- readonly scope: ConditionScope;
43
- readonly by?: ConditionTest;
44
- readonly moved_between_rooms?: boolean;
45
- };
46
- export type DocumentCondition = (DocumentEventBase & {
47
- readonly mode: 'starts_matching';
48
- readonly new_documents: boolean;
49
- readonly match: ConditionTest;
50
- }) | (DocumentEventBase & {
51
- readonly mode: 'field_changes';
52
- readonly field: string;
53
- readonly from?: readonly ConditionValue[] | 'new';
54
- readonly to?: readonly ConditionValue[] | 'deleted';
55
- readonly match?: ConditionTest;
56
- });
57
- export type ItemCondition = {
58
- readonly on: 'items';
59
- readonly source?: string;
60
- readonly address?: string;
61
- readonly match?: ConditionTest;
62
- };
63
- export type CronCondition = {
64
- readonly on: 'clock';
65
- readonly cron: string;
66
- readonly time_zone: string;
67
- };
68
- export type DateCondition = {
69
- readonly on: 'clock';
70
- readonly scope: {
71
- readonly type: string;
72
- };
73
- readonly date: string;
74
- readonly days: number;
75
- readonly at: string;
76
- readonly time_zone: string;
77
- readonly match?: ConditionTest;
78
- };
79
- export type NotificationCondition = {
80
- readonly on: 'notifications';
81
- readonly match?: ConditionTest;
82
- };
83
- export type Condition = DocumentCondition | ItemCondition | CronCondition | DateCondition | NotificationCondition;
84
- export type FactKind = 'string' | 'number' | 'boolean' | 'date' | 'time' | 'enum' | 'reference';
85
- type Scalar = string | number | boolean;
86
- export type Fact = {
87
- readonly kind: FactKind;
88
- readonly value: Scalar;
89
- readonly member?: string;
90
- } | {
91
- readonly kind: 'prose';
92
- } | {
93
- readonly kind: 'null';
94
- } | {
95
- readonly kind: 'unreadable';
96
- } | {
97
- readonly kind: 'list';
98
- readonly items: readonly Fact[];
99
- } | {
100
- readonly kind: 'object';
101
- readonly fields: Readonly<Record<string, Fact>>;
102
- };
103
- export type DocumentFacts = {
104
- readonly id: string;
105
- readonly path: string;
106
- readonly type: string | null;
107
- readonly fields: Readonly<Record<string, Fact>>;
108
- readonly sections: readonly string[];
109
- };
110
- export declare const TEXT_FIELD = "/text";
111
- export declare const WRITE_DOORS: readonly ['browser', 'agent', 'client', 'function'];
112
- export type WriteDoor = (typeof WRITE_DOORS)[number];
113
- export type Actor = {
114
- readonly user?: string;
115
- readonly site?: string;
116
- readonly app?: string;
117
- readonly door?: WriteDoor;
118
- };
119
- export type DocumentEvent = {
120
- readonly before: DocumentFacts | null;
121
- readonly after: DocumentFacts | null;
122
- readonly changed: readonly string[];
123
- readonly by: Actor;
124
- readonly moved_between_rooms: boolean;
125
- };
126
- export type ItemFacts = {
127
- readonly delivery: string;
128
- readonly source: string | null;
129
- readonly address: string | null;
130
- readonly container: string | null;
131
- readonly author: string | null;
132
- readonly headers: Readonly<Record<string, string>>;
133
- readonly json: {
134
- readonly value: unknown;
135
- } | null;
136
- };
137
- export type Resolved = {
138
- readonly id: string;
139
- readonly member?: string;
140
- };
141
- type Truth = boolean | undefined;
142
- export declare function factKind(facts: ValueFacts): FactKind | null;
143
- export declare function facts(document: Document, at: {
144
- readonly id: string;
145
- readonly path: string;
146
- }, model: VerifiedModel, resolve: (target: string) => Resolved | undefined): DocumentFacts;
147
- export declare function prosePaths(facts: DocumentFacts): string[];
148
- export declare function datePointers(fields: Readonly<Record<string, ValueFacts>>): string[];
149
- export declare function valuedChange(definition: Definition, field: string): boolean;
150
- export declare function changeFields(definition: Definition): string[];
151
- export declare function memberPointers(definition: Definition, memberType: string): string[];
152
- export declare const DOCUMENT_PATHS: readonly string[];
153
- export declare const ACTOR_PATHS: readonly string[];
154
- export declare const ITEM_PATHS: readonly string[];
155
- export declare function testOperators(definitions: readonly Definition[], path: string, memberType: string | null): readonly ConditionOperator[];
156
- export declare function actorOperators(path: string): readonly ConditionOperator[];
157
- export declare function itemOperators(path: string): readonly ConditionOperator[];
158
- export declare function itemKind(path: string): FactKind | null;
159
- export declare function dated(value: unknown): value is string;
160
- export declare function instant(value: unknown): bigint | undefined;
161
- export declare function pointed(value: unknown, pointer: string): unknown;
162
- export declare function members(document: DocumentFacts, path: string): readonly string[];
163
- export declare function holds(test: ConditionTest, document: DocumentFacts): Truth;
164
- export declare function fires(condition: DocumentCondition, event: DocumentEvent): boolean;
165
- export declare function itemFires(condition: ItemCondition, item: ItemFacts): boolean;
166
- export declare function notificationFires(condition: NotificationCondition, notification: DocumentFacts): boolean;
167
- export {};
@@ -1,5 +0,0 @@
1
- export declare const MARKDOWN_SYNTAX_PROFILE: {
2
- readonly name: 'GitHub Flavored Markdown';
3
- readonly spec: '0.29';
4
- readonly url: 'https://github.github.com/gfm/';
5
- };