@agentshouse/app-bridge 0.1.0-alpha.11 → 0.1.0-alpha.12
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 +6 -1
- package/client/src/bridge.d.ts +1 -0
- package/client/src/bridge.js +11 -5
- package/client/src/test-host.d.ts +1 -0
- package/client/src/test-host.js +5 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -70,6 +70,10 @@ port's one listener. It carries nine families:
|
|
|
70
70
|
it ran its current release, as a PNG `Blob` at most 1200 pixels wide, or
|
|
71
71
|
`null` when this browser holds none. The image stays in the browser; a Site
|
|
72
72
|
holds none.
|
|
73
|
+
- **Site screenshot read** - given one of the User's Site identifiers,
|
|
74
|
+
`readSiteScreenshot(site)` answers the image House captured of that Site
|
|
75
|
+
after its latest release, as a JPEG `Blob`, or `null` when House holds none
|
|
76
|
+
or does not answer. A Site's own renderer reads none.
|
|
73
77
|
|
|
74
78
|
The package carries no credential handling and no Runtime family. It surfaces
|
|
75
79
|
the dedicated Runtime port the worker transfers over the bridge as a plain
|
|
@@ -131,7 +135,8 @@ records in `consents` each
|
|
|
131
135
|
choice leaves, records in `tabs` each `setTab` the shell would take and ignores
|
|
132
136
|
any other, answers a release code read from the `sources` it was given, or
|
|
133
137
|
`null`, answers `readScreenshot` from the `screenshots` it was given by App
|
|
134
|
-
reference
|
|
138
|
+
reference and `readSiteScreenshot` from the `siteScreenshots` it was given by
|
|
139
|
+
Site identifier, answers every `install()` `'manual'`, as a browser with no install
|
|
135
140
|
prompt does, answers every `notifications()` `'unavailable'`, as a browser
|
|
136
141
|
without push does, settles every `setBadge`, delivers each App message
|
|
137
142
|
`message({ from, body })` plays, and attaches a Runtime port.
|
package/client/src/bridge.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export interface HouseBridge {
|
|
|
30
30
|
sourceTop(app: string, release?: string): Promise<HouseSourceTop | HouseSourceRefusal | null>;
|
|
31
31
|
sourceDownload(app: string, release?: string): Promise<HouseSourceDownload | HouseSourceRefusal | null>;
|
|
32
32
|
readScreenshot(app: string): Promise<Blob | null>;
|
|
33
|
+
readSiteScreenshot(site: string): Promise<Blob | null>;
|
|
33
34
|
status(): HouseStatus | null;
|
|
34
35
|
onStatus(listener: (status: HouseStatus) => void): () => void;
|
|
35
36
|
messages(listener: (message: HouseAppMessage) => void): () => void;
|
package/client/src/bridge.js
CHANGED
|
@@ -179,6 +179,13 @@ export function connectHouseBridge(source = heldBridge()) {
|
|
|
179
179
|
send({ house, id, app, release });
|
|
180
180
|
return pending.promise;
|
|
181
181
|
}
|
|
182
|
+
function screenshot(house, asked) {
|
|
183
|
+
const pending = settled();
|
|
184
|
+
const id = ++nextScreenshot;
|
|
185
|
+
screenshots.set(id, pending.settle);
|
|
186
|
+
send({ house, id, ...asked });
|
|
187
|
+
return pending.promise;
|
|
188
|
+
}
|
|
182
189
|
function navigate(mode, asked) {
|
|
183
190
|
const pending = settled();
|
|
184
191
|
navigations.push({ address: asked, settle: pending.settle });
|
|
@@ -246,11 +253,10 @@ export function connectHouseBridge(source = heldBridge()) {
|
|
|
246
253
|
return readSource('source-download', app, release);
|
|
247
254
|
},
|
|
248
255
|
readScreenshot(app) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
return pending.promise;
|
|
256
|
+
return screenshot('screenshot-read', { app });
|
|
257
|
+
},
|
|
258
|
+
readSiteScreenshot(site) {
|
|
259
|
+
return screenshot('site-screenshot-read', { site });
|
|
254
260
|
},
|
|
255
261
|
status() {
|
|
256
262
|
return status;
|
|
@@ -27,5 +27,6 @@ export interface HouseBridgeTestHostOptions {
|
|
|
27
27
|
readonly download: HouseSourceDownload;
|
|
28
28
|
}[];
|
|
29
29
|
readonly screenshots?: Readonly<Record<string, Blob>>;
|
|
30
|
+
readonly siteScreenshots?: Readonly<Record<string, Blob>>;
|
|
30
31
|
}
|
|
31
32
|
export declare function createHouseBridgeTestHost(options?: HouseBridgeTestHostOptions): HouseBridgeTestHost;
|
package/client/src/test-host.js
CHANGED
|
@@ -123,6 +123,11 @@ export function createHouseBridgeTestHost(options = {}) {
|
|
|
123
123
|
const held = typeof asked.app === 'string' ? options.screenshots?.[asked.app] : undefined;
|
|
124
124
|
deliver({ house: 'screenshot', id: asked.id, image: held ?? null });
|
|
125
125
|
}
|
|
126
|
+
else if (data.house === 'site-screenshot-read') {
|
|
127
|
+
const asked = data;
|
|
128
|
+
const held = typeof asked.site === 'string' ? options.siteScreenshots?.[asked.site] : undefined;
|
|
129
|
+
deliver({ house: 'screenshot', id: asked.id, image: held ?? null });
|
|
130
|
+
}
|
|
126
131
|
}
|
|
127
132
|
const port = {
|
|
128
133
|
postMessage(message) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/app-bridge",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
4
|
-
"description": "Renderer-side client of the agents.house App bridge: navigation, the tab title and icon, ceremonies, installation, notifications and the icon badge, status, Site image reads, App release code and
|
|
3
|
+
"version": "0.1.0-alpha.12",
|
|
4
|
+
"description": "Renderer-side client of the agents.house App bridge: 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 in-page test host.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|