@ai-ecoverse/sliccy-browser 0.1.41 → 0.1.42
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/package.json +2 -2
- package/src/browser.js +21 -1
- package/src/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/sliccy-browser",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "sliccy:browser for jsh, over CDP. Discovers Chrome via SLICC_CDP_URL, slicc browsers --json, DevToolsActivePort under slicc profiles (live /json/version must match the file's websocket path), then 127.0.0.1:9222. Discovered endpoints refuse seven/vault/extension/error pages.",
|
|
3
|
+
"version": "0.1.42",
|
|
4
|
+
"description": "sliccy:browser for jsh, over CDP. Discovers Chrome via SLICC_CDP_URL, slicc browsers --json, DevToolsActivePort under slicc profiles (live /json/version must match the file's websocket path), then 127.0.0.1:9222. Discovered endpoints refuse seven/vault/extension/error pages; pre-attach websocket frames are dropped with a one-time warning.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
package/src/browser.js
CHANGED
|
@@ -16,6 +16,8 @@ export { REFUSAL, resolveCdpEndpoint, version };
|
|
|
16
16
|
|
|
17
17
|
const LOAD_TIMEOUT_MS = 15000;
|
|
18
18
|
const HELD_FRAMES = 100;
|
|
19
|
+
const UNKNOWN_SOCKET_WARNING =
|
|
20
|
+
'browser.websocket: frames from sockets opened before the first attach are ignored in discovered mode; reload the tab or reconnect the socket after the first attach to make them visible';
|
|
19
21
|
const RECORDER = `(() => {
|
|
20
22
|
if (globalThis.__sliccWsSent) return true;
|
|
21
23
|
const sent = [];
|
|
@@ -191,11 +193,24 @@ function dispatchFrame(message) {
|
|
|
191
193
|
route(targetId, url, response.payloadData, () => true);
|
|
192
194
|
return;
|
|
193
195
|
}
|
|
194
|
-
if (guarded)
|
|
196
|
+
if (guarded) {
|
|
197
|
+
noteUnknownDrop(targetId);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
195
200
|
route(targetId, url, response.payloadData, (sub) => sub.urlMatch === undefined);
|
|
196
201
|
holdFrame(message.sessionId, targetId, key, response.payloadData);
|
|
197
202
|
}
|
|
198
203
|
|
|
204
|
+
function noteUnknownDrop(targetId) {
|
|
205
|
+
for (const sub of subscribers.values()) {
|
|
206
|
+
if (sub.targetId !== targetId) continue;
|
|
207
|
+
sub.dropped += 1;
|
|
208
|
+
if (sub.warnedUnknown) continue;
|
|
209
|
+
sub.warnedUnknown = true;
|
|
210
|
+
console.warn(UNKNOWN_SOCKET_WARNING);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
199
214
|
function route(targetId, url, raw, which) {
|
|
200
215
|
if (guarded && (typeof url !== 'string' || isProtectedUrl(url))) return;
|
|
201
216
|
for (const sub of subscribers.values()) {
|
|
@@ -719,6 +734,9 @@ function toInfo(sub) {
|
|
|
719
734
|
function makeHandle(sub) {
|
|
720
735
|
return {
|
|
721
736
|
...toInfo(sub),
|
|
737
|
+
get dropped() {
|
|
738
|
+
return sub.dropped;
|
|
739
|
+
},
|
|
722
740
|
async update(patch = {}) {
|
|
723
741
|
if (patch.urlMatch === null) {
|
|
724
742
|
delete sub.urlMatch;
|
|
@@ -792,6 +810,8 @@ export const websocket = {
|
|
|
792
810
|
forward: sink,
|
|
793
811
|
createdAt: new Date().toISOString(),
|
|
794
812
|
writing: Promise.resolve(),
|
|
813
|
+
dropped: 0,
|
|
814
|
+
warnedUnknown: false,
|
|
795
815
|
};
|
|
796
816
|
if (urlMatch !== undefined) {
|
|
797
817
|
sub.urlMatch = urlMatch;
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.1.
|
|
1
|
+
export const version = '0.1.42';
|