dsh-browser-cdp 0.17.18 → 0.17.19
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/lib/client.js +75 -72
- package/lib/index.js +30 -17
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -4307,22 +4307,24 @@ var TAB_CSS = `
|
|
|
4307
4307
|
* attachments are — the block carries its source CDP connection
|
|
4308
4308
|
* (endpoint + targetId) so the agent can find the element's DOM again
|
|
4309
4309
|
* (backendNodeId is directly addressable via bcdp_cdp DOM.describeNode).
|
|
4310
|
-
* Format inside the draft
|
|
4311
|
-
*
|
|
4312
|
-
*
|
|
4313
|
-
* [
|
|
4310
|
+
* Format inside the draft(@mention 精髓:被替换字段以 @ 开头):
|
|
4311
|
+
* @"picks/<file>.json"
|
|
4312
|
+
* — 显示层把该 token 替换成文件片;归档 JSON
|
|
4313
|
+
* {"cdpEndpoint":..., "targetId":..., "pageUrl":..., "elements":[...]}
|
|
4314
|
+
* 存 <workspace>/picks/<file>.json,dock 卡按引用取回渲染。
|
|
4314
4315
|
*/
|
|
4315
4316
|
function injectPickCardStyles() {
|
|
4316
4317
|
if (document.getElementById("dsh-cdp-picks-styles") !== null) return;
|
|
4317
4318
|
var style = document.createElement("style");
|
|
4318
4319
|
style.id = "dsh-cdp-picks-styles";
|
|
4319
|
-
style.textContent = "[data-dsh-cdp-picks-card] {\n box-sizing: border-box; flex: none;\n display: grid; gap: 4px; padding: 8px 10px;\n font: inherit; font-size: 12px;\n color: #1d1d1f; background: #f7f7f9;\n border: 1px solid rgba(0, 0, 0, 0.16); border-radius: 12px;\n box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);\n /* input-traffic
|
|
4320
|
+
style.textContent = "[data-dsh-cdp-picks-card] {\n box-sizing: border-box; flex: none;\n display: grid; gap: 4px; padding: 8px 10px;\n font: inherit; font-size: 12px;\n color: #1d1d1f; background: #f7f7f9;\n border: 1px solid rgba(0, 0, 0, 0.16); border-radius: 12px;\n box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);\n /* input-traffic 同款限宽 + 居中:卡宽限制在内容列(拖动范围)内,两侧留出\n clearance,auto margins 在 dock 带内居中,永不顶满整窗 */\n margin-left: auto;\n margin-right: auto;\n width: min(\n calc(100% - var(--dsh-composer-side-clearance, 16px) - var(--dsh-composer-side-clearance, 16px) - var(--dsh-composer-dock-inset, 8px) - var(--dsh-composer-dock-inset, 8px)),\n calc(var(--dsh-chat-content-width, 100%) - var(--dsh-composer-dock-inset, 8px) - var(--dsh-composer-dock-inset, 8px))\n );\n overflow-y: auto; max-height: 40vh;\n}\n@media (prefers-color-scheme: dark) {\n [data-dsh-cdp-picks-card] { color: #f2f2f7; background: #1c1c1e; border-color: rgba(255, 255, 255, 0.18); }\n}\n[data-dsh-cdp-picks-card] .dsh-cdp-picks-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }\n[data-dsh-cdp-picks-card] .dsh-cdp-picks-sub { font-size: 11px; color: rgba(60, 60, 67, 0.62); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }\n[data-dsh-cdp-picks-card] .dsh-cdp-picks-chip { display: flex; align-items: baseline; gap: 6px; padding: 3px 8px; background: rgba(120, 120, 128, 0.12); border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 8px; min-width: 0; }\n[data-dsh-cdp-picks-card] .dsh-cdp-picks-num { font-weight: 700; flex: none; color: rgba(60, 60, 67, 0.62); }\n[data-dsh-cdp-picks-card] .dsh-cdp-picks-tag { font-weight: 600; flex: none; }\n[data-dsh-cdp-picks-card] .dsh-cdp-picks-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }\n[data-dsh-cdp-picks-card] .dsh-cdp-picks-close { margin-left: auto; flex: none; font: inherit; font-size: 12px; cursor: pointer; border: none; background: none; color: rgba(60, 60, 67, 0.62); padding: 0 2px; border-radius: 6px; }\n[data-dsh-cdp-picks-card] .dsh-cdp-picks-close:hover { background: rgba(120, 120, 128, 0.18); }\n@media (prefers-color-scheme: dark) {\n [data-dsh-cdp-picks-card] .dsh-cdp-picks-sub { color: rgba(235, 235, 245, 0.62); }\n [data-dsh-cdp-picks-card] .dsh-cdp-picks-chip { background: rgba(120, 120, 128, 0.24); border-color: rgba(255, 255, 255, 0.12); }\n [data-dsh-cdp-picks-card] .dsh-cdp-picks-num { color: rgba(235, 235, 245, 0.62); }\n [data-dsh-cdp-picks-card] .dsh-cdp-picks-close { color: rgba(235, 235, 245, 0.62); }\n [data-dsh-cdp-picks-card] .dsh-cdp-picks-close:hover { background: rgba(120, 120, 128, 0.3); }\n}";
|
|
4320
4321
|
document.head.appendChild(style);
|
|
4321
4322
|
}
|
|
4322
4323
|
function CdpPicksDockCard(props) {
|
|
4323
4324
|
var input = props.input;
|
|
4324
4325
|
var h = React.createElement;
|
|
4325
|
-
var
|
|
4326
|
+
var tick = React.useState(0);
|
|
4327
|
+
var setTick = tick[1];
|
|
4326
4328
|
React.useEffect(function() {
|
|
4327
4329
|
var timer = window.setInterval(function() {
|
|
4328
4330
|
setTick(function(n) {
|
|
@@ -4334,13 +4336,10 @@ function CdpPicksDockCard(props) {
|
|
|
4334
4336
|
};
|
|
4335
4337
|
}, []);
|
|
4336
4338
|
var snap = readDraftText(input);
|
|
4337
|
-
var refRe =
|
|
4339
|
+
var refRe = /@"(picks\/[^"\s]+\.json)"/g;
|
|
4338
4340
|
var refs = [], mm;
|
|
4339
4341
|
while ((mm = refRe.exec(snap)) !== null) refs.push({
|
|
4340
4342
|
file: mm[1],
|
|
4341
|
-
endpoint: mm[2],
|
|
4342
|
-
title: mm[3],
|
|
4343
|
-
count: Number(mm[4]),
|
|
4344
4343
|
line: mm[0]
|
|
4345
4344
|
});
|
|
4346
4345
|
try {
|
|
@@ -4358,8 +4357,10 @@ function CdpPicksDockCard(props) {
|
|
|
4358
4357
|
React.useEffect(function() {
|
|
4359
4358
|
var cancelled = false;
|
|
4360
4359
|
refs.forEach(function(r) {
|
|
4361
|
-
|
|
4362
|
-
|
|
4360
|
+
postJson("/bcdp/api/picks-load", {
|
|
4361
|
+
file: r.file.slice(6),
|
|
4362
|
+
session: props.session
|
|
4363
|
+
}).then(function(res) {
|
|
4363
4364
|
if (cancelled) return;
|
|
4364
4365
|
var content = res && res.ok !== false && res.value ? String(res.value.content || "") : "";
|
|
4365
4366
|
setContents(function(prev) {
|
|
@@ -4372,7 +4373,7 @@ function CdpPicksDockCard(props) {
|
|
|
4372
4373
|
return function() {
|
|
4373
4374
|
cancelled = true;
|
|
4374
4375
|
};
|
|
4375
|
-
}, [filesKey]);
|
|
4376
|
+
}, [filesKey, Math.floor(tick[0] / 5)]);
|
|
4376
4377
|
if (refs.length === 0) return null;
|
|
4377
4378
|
function removeRef(line) {
|
|
4378
4379
|
var cur = readDraftText(input);
|
|
@@ -4388,11 +4389,13 @@ function CdpPicksDockCard(props) {
|
|
|
4388
4389
|
} }, refs.map(function(r) {
|
|
4389
4390
|
var content = contents[r.file];
|
|
4390
4391
|
var elements = [];
|
|
4392
|
+
var pageTitle = "";
|
|
4391
4393
|
if (typeof content === "string" && content !== "") try {
|
|
4392
4394
|
var obj = JSON.parse(content);
|
|
4393
4395
|
elements = obj && obj.elements || [];
|
|
4396
|
+
pageTitle = obj && obj.pageTitle || "";
|
|
4394
4397
|
} catch (e) {}
|
|
4395
|
-
var head = h("div", { className: "dsh-cdp-picks-head" }, h("span", { style: { fontWeight: 700 } }, "🌐 " + wt("pickCardTitle")), h("span", { className: "dsh-cdp-picks-sub" },
|
|
4398
|
+
var head = h("div", { className: "dsh-cdp-picks-head" }, h("span", { style: { fontWeight: 700 } }, "🌐 " + wt("pickCardTitle")), h("span", { className: "dsh-cdp-picks-sub" }, "@" + r.file), h("span", { className: "dsh-cdp-picks-sub" }, pageTitle), h("span", { className: "dsh-cdp-picks-sub" }, typeof content === "string" ? wt("pickCardElements", { n: elements.length }) : "…"), h("button", {
|
|
4396
4399
|
type: "button",
|
|
4397
4400
|
title: wt("pickCardRemove"),
|
|
4398
4401
|
className: "dsh-cdp-picks-close",
|
|
@@ -4439,14 +4442,9 @@ function CdpPicksBadge(props) {
|
|
|
4439
4442
|
try {
|
|
4440
4443
|
if (props && props.sessionId !== void 0 && props.sessionId !== null ? String(props.sessionId) : null) {
|
|
4441
4444
|
var draft = typeof props.getDraft === "function" ? String(props.getDraft() || "") : "";
|
|
4442
|
-
var refRe =
|
|
4445
|
+
var refRe = /@"(picks\/[^"\s]+\.json)"/g;
|
|
4443
4446
|
var mm;
|
|
4444
|
-
while ((mm = refRe.exec(draft)) !== null) refs.push({
|
|
4445
|
-
file: mm[1],
|
|
4446
|
-
endpoint: mm[2],
|
|
4447
|
-
title: mm[3],
|
|
4448
|
-
count: Number(mm[4])
|
|
4449
|
-
});
|
|
4447
|
+
while ((mm = refRe.exec(draft)) !== null) refs.push({ file: mm[1] });
|
|
4450
4448
|
}
|
|
4451
4449
|
} catch (e) {}
|
|
4452
4450
|
try {
|
|
@@ -4457,7 +4455,7 @@ function CdpPicksBadge(props) {
|
|
|
4457
4455
|
return h("span", {
|
|
4458
4456
|
key: r.file,
|
|
4459
4457
|
className: "dsh-cdp-picks-badge",
|
|
4460
|
-
title: "🌐 " +
|
|
4458
|
+
title: "🌐 @" + r.file
|
|
4461
4459
|
}, "🌐" + (refs.length > 1 ? " " + (i + 1) : ""));
|
|
4462
4460
|
}));
|
|
4463
4461
|
}
|
|
@@ -4483,15 +4481,18 @@ function mountPicksDockCard(ctx) {
|
|
|
4483
4481
|
locale: "dsh-browser-cdp",
|
|
4484
4482
|
order: 0,
|
|
4485
4483
|
inject: function(sessionId) {
|
|
4486
|
-
var input = null;
|
|
4484
|
+
var input = null, session = null;
|
|
4487
4485
|
try {
|
|
4488
4486
|
var actx = ctx.sessions.scope(sessionId);
|
|
4489
4487
|
input = actx.get("conversation").input.for(actx);
|
|
4488
|
+
session = String(sessionId);
|
|
4490
4489
|
} catch (e) {
|
|
4491
4490
|
input = null;
|
|
4491
|
+
session = null;
|
|
4492
4492
|
}
|
|
4493
4493
|
return {
|
|
4494
4494
|
input,
|
|
4495
|
+
session,
|
|
4495
4496
|
getDraft: function() {
|
|
4496
4497
|
return readDraftText(input);
|
|
4497
4498
|
}
|
|
@@ -4570,67 +4571,69 @@ function deliverPickToConversation(ctx, element, action) {
|
|
|
4570
4571
|
focusable: !!element.keyboardFocusable,
|
|
4571
4572
|
describe
|
|
4572
4573
|
};
|
|
4573
|
-
var reRef =
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
mm[
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4574
|
+
var reRef = /@"(picks\/([^"\s]+\.json))"/g;
|
|
4575
|
+
var mentions = [], mm;
|
|
4576
|
+
while ((mm = reRef.exec(draft)) !== null) mentions.push({
|
|
4577
|
+
token: mm[0],
|
|
4578
|
+
file: mm[2]
|
|
4579
|
+
});
|
|
4580
|
+
(async function() {
|
|
4581
|
+
try {
|
|
4582
|
+
var found = null, hit = null, obj = null;
|
|
4583
|
+
for (var i = 0; i < mentions.length; i++) {
|
|
4584
|
+
var lres = await postJson("/bcdp/api/picks-load", {
|
|
4585
|
+
file: mentions[i].file,
|
|
4586
|
+
session: sessionId
|
|
4587
|
+
});
|
|
4588
|
+
if (!lres || lres.ok === false || !lres.value) continue;
|
|
4589
|
+
obj = JSON.parse(lres.value.content);
|
|
4590
|
+
if (obj && obj.cdpEndpoint === src.endpoint) {
|
|
4591
|
+
found = mentions[i];
|
|
4592
|
+
hit = obj.elements || [];
|
|
4593
|
+
break;
|
|
4594
|
+
}
|
|
4595
|
+
}
|
|
4596
|
+
if (found) {
|
|
4587
4597
|
var maxN = 0;
|
|
4588
|
-
for (var k = 0; k <
|
|
4598
|
+
for (var k = 0; k < hit.length; k++) if (hit[k].n > maxN) maxN = hit[k].n;
|
|
4589
4599
|
entry.n = maxN + 1;
|
|
4590
|
-
|
|
4600
|
+
hit.push(Object.assign({}, entry));
|
|
4591
4601
|
var page = {
|
|
4592
4602
|
cdpEndpoint: obj.cdpEndpoint || src.endpoint,
|
|
4593
4603
|
targetId: obj.targetId || src.targetId,
|
|
4594
4604
|
pageUrl: obj.pageUrl || src.pageUrl,
|
|
4595
4605
|
pageTitle: obj.pageTitle || src.pageTitle,
|
|
4596
|
-
elements:
|
|
4606
|
+
elements: hit
|
|
4597
4607
|
};
|
|
4598
|
-
postJson("/bcdp/api/picks-save", {
|
|
4608
|
+
await postJson("/bcdp/api/picks-save", {
|
|
4599
4609
|
block: JSON.stringify(page, null, 2),
|
|
4600
|
-
file
|
|
4610
|
+
file: found.file,
|
|
4611
|
+
session: sessionId
|
|
4601
4612
|
});
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
block: JSON.stringify(pageNew, null, 2),
|
|
4623
|
-
file: newFile
|
|
4624
|
-
}).then(function(res) {
|
|
4625
|
-
if (!res || res.ok === false || !res.value) return;
|
|
4626
|
-
var cur = readDraftText(input);
|
|
4627
|
-
var line = "[🌐 CDP-PICKS → " + res.value.file + " | " + src.endpoint + " | " + (src.pageTitle || src.pageUrl || "") + " | elements:1]";
|
|
4628
|
-
cur = cur ? cur + (cur.charAt(cur.length - 1) === "\n" ? "" : "\n") + line : line;
|
|
4629
|
-
input.setDraft(cur);
|
|
4630
|
-
}).catch(function() {});
|
|
4613
|
+
return;
|
|
4614
|
+
}
|
|
4615
|
+
var pageNew = {
|
|
4616
|
+
cdpEndpoint: src.endpoint,
|
|
4617
|
+
targetId: src.targetId,
|
|
4618
|
+
pageUrl: src.pageUrl,
|
|
4619
|
+
pageTitle: src.pageTitle,
|
|
4620
|
+
elements: [Object.assign({ n: 1 }, entry)]
|
|
4621
|
+
};
|
|
4622
|
+
var sres = await postJson("/bcdp/api/picks-save", {
|
|
4623
|
+
block: JSON.stringify(pageNew, null, 2),
|
|
4624
|
+
session: sessionId
|
|
4625
|
+
});
|
|
4626
|
+
if (!sres || sres.ok === false || !sres.value) return;
|
|
4627
|
+
var token = "@\"picks/" + sres.value.file + "\"";
|
|
4628
|
+
var cur = readDraftText(input);
|
|
4629
|
+
cur = cur ? cur + (cur.charAt(cur.length - 1) === "\n" ? "" : "\n") + token : token;
|
|
4630
|
+
input.setDraft(cur);
|
|
4631
|
+
} catch (e) {}
|
|
4632
|
+
})();
|
|
4631
4633
|
return {
|
|
4632
4634
|
ok: true,
|
|
4633
|
-
code: "archiving"
|
|
4635
|
+
code: "archiving",
|
|
4636
|
+
count: 1
|
|
4634
4637
|
};
|
|
4635
4638
|
} catch (err) {
|
|
4636
4639
|
return {
|
package/lib/index.js
CHANGED
|
@@ -2733,19 +2733,6 @@ function normalizeProbeState(link) {
|
|
|
2733
2733
|
/** HTTP route prefix owning every ego-browser API request. */
|
|
2734
2734
|
const API_PREFIX = "/bcdp/api";
|
|
2735
2735
|
/**
|
|
2736
|
-
* Archive dir for CDP-PICKS blocks: the composer holds a one-line reference
|
|
2737
|
-
* and the raw JSON lives here (the dsh-paste-dock content model — the raw
|
|
2738
|
-
* expanded text must not flood the input). Plugin-namespaced subdir under
|
|
2739
|
-
* the same state root the cast worker uses.
|
|
2740
|
-
*/
|
|
2741
|
-
function picksDir() {
|
|
2742
|
-
const e = process.env;
|
|
2743
|
-
const isWin = process.platform === "win32";
|
|
2744
|
-
const home = e.HOME || e.USERPROFILE || (isWin ? e.LOCALAPPDATA || "" : "/root");
|
|
2745
|
-
const stateHome = e.EGO_LINUX_STATE_DIR || (isWin ? e.LOCALAPPDATA || `${home}\\AppData\\Local` : e.XDG_STATE_HOME || `${home}/.local/state`);
|
|
2746
|
-
return stateHome.endsWith("ego-lite-linux") ? resolve(stateHome, "picks") : resolve(stateHome, "ego-lite-linux", "picks");
|
|
2747
|
-
}
|
|
2748
|
-
/**
|
|
2749
2736
|
* Register the `/bcdp/api` HTTP route on the host's web server.
|
|
2750
2737
|
*
|
|
2751
2738
|
* The route reads/writes the `ego-browser` settings namespace in-process
|
|
@@ -2753,7 +2740,7 @@ function picksDir() {
|
|
|
2753
2740
|
* when absent, `get` degrades to the entry source and `set` returns a
|
|
2754
2741
|
* clear error.
|
|
2755
2742
|
*/
|
|
2756
|
-
function registerEgoBrowserGateway(ctx, bridge, ffmpegManager) {
|
|
2743
|
+
function registerEgoBrowserGateway(ctx, bridge, ffmpegManager, picks) {
|
|
2757
2744
|
ctx.effect?.(() => {
|
|
2758
2745
|
const webServer = ctx.get?.("webServer");
|
|
2759
2746
|
if (!webServer || typeof webServer.register !== "function") return;
|
|
@@ -2848,6 +2835,12 @@ function registerEgoBrowserGateway(ctx, bridge, ffmpegManager) {
|
|
|
2848
2835
|
}
|
|
2849
2836
|
writeJson(res, 200, envelopeOk({ outcome: await probeEndpoint(endpoint, { timeoutMs: typeof body.timeoutMs === "number" && Number.isFinite(body.timeoutMs) ? body.timeoutMs : void 0 }) }));
|
|
2850
2837
|
} else if (method === "picks-save") {
|
|
2838
|
+
const picksSession = typeof body.session === "string" ? body.session : void 0;
|
|
2839
|
+
const picksDir0 = picks ? picks.resolveDir(picksSession) : void 0;
|
|
2840
|
+
if (!picksDir0) {
|
|
2841
|
+
writeJson(res, 409, envelopeError("no-workspace", "no registered workspace resolves for this session"));
|
|
2842
|
+
return;
|
|
2843
|
+
}
|
|
2851
2844
|
const saveBody = body;
|
|
2852
2845
|
const block = typeof saveBody.block === "string" ? saveBody.block : "";
|
|
2853
2846
|
if (block === "") {
|
|
@@ -2855,7 +2848,7 @@ function registerEgoBrowserGateway(ctx, bridge, ffmpegManager) {
|
|
|
2855
2848
|
return;
|
|
2856
2849
|
}
|
|
2857
2850
|
const file = typeof saveBody.file === "string" && /^[A-Za-z0-9._-]+\.json$/.test(saveBody.file) ? saveBody.file : `picks-${Date.now()}.json`;
|
|
2858
|
-
const dir =
|
|
2851
|
+
const dir = picksDir0;
|
|
2859
2852
|
await mkdir(dir, { recursive: true });
|
|
2860
2853
|
const target = resolve(dir, file);
|
|
2861
2854
|
if (!target.startsWith(resolve(dir))) {
|
|
@@ -2868,6 +2861,12 @@ function registerEgoBrowserGateway(ctx, bridge, ffmpegManager) {
|
|
|
2868
2861
|
file
|
|
2869
2862
|
}));
|
|
2870
2863
|
} else if (method === "picks-load") {
|
|
2864
|
+
const loadSession = typeof body.session === "string" ? body.session : void 0;
|
|
2865
|
+
const loadDir0 = picks ? picks.resolveDir(loadSession) : void 0;
|
|
2866
|
+
if (!loadDir0) {
|
|
2867
|
+
writeJson(res, 409, envelopeError("no-workspace", "no registered workspace resolves for this session"));
|
|
2868
|
+
return;
|
|
2869
|
+
}
|
|
2871
2870
|
const loadBody = body;
|
|
2872
2871
|
const file = typeof loadBody.file === "string" && /^[A-Za-z0-9._-]+\.json$/.test(loadBody.file) ? loadBody.file : "";
|
|
2873
2872
|
if (file === "") {
|
|
@@ -2875,7 +2874,7 @@ function registerEgoBrowserGateway(ctx, bridge, ffmpegManager) {
|
|
|
2875
2874
|
return;
|
|
2876
2875
|
}
|
|
2877
2876
|
try {
|
|
2878
|
-
writeJson(res, 200, envelopeOk({ content: await readFile(resolve(
|
|
2877
|
+
writeJson(res, 200, envelopeOk({ content: await readFile(resolve(loadDir0, file), "utf8") }));
|
|
2879
2878
|
} catch (error) {
|
|
2880
2879
|
writeJson(res, 404, envelopeError("not-found", error instanceof Error ? error.message : String(error)));
|
|
2881
2880
|
}
|
|
@@ -7098,7 +7097,21 @@ function apply(ctx, config = {}) {
|
|
|
7098
7097
|
ctx.logger?.warn?.(`dsh-browser-cdp: cast server init failed: ${err?.message ?? err}`);
|
|
7099
7098
|
}
|
|
7100
7099
|
try {
|
|
7101
|
-
registerEgoBrowserGateway(wctx, bridge, ffmpegManager)
|
|
7100
|
+
registerEgoBrowserGateway(wctx, bridge, ffmpegManager, { resolveDir: (sessionId) => {
|
|
7101
|
+
try {
|
|
7102
|
+
const registry = typeof ctx.get === "function" ? ctx.get("workspaceRegistry") : void 0;
|
|
7103
|
+
const workspaces = (registry ? registry.list() : []) ?? [];
|
|
7104
|
+
if (workspaces.length === 0) return void 0;
|
|
7105
|
+
if (sessionId) {
|
|
7106
|
+
const owned = workspaces.find((w) => w.sessionIds.includes(sessionId));
|
|
7107
|
+
if (owned) return owned.path + "/picks";
|
|
7108
|
+
}
|
|
7109
|
+
if (workspaces.length === 1) return workspaces[0].path + "/picks";
|
|
7110
|
+
return;
|
|
7111
|
+
} catch {
|
|
7112
|
+
return;
|
|
7113
|
+
}
|
|
7114
|
+
} });
|
|
7102
7115
|
} catch (err) {
|
|
7103
7116
|
ctx.logger?.warn?.(`dsh-browser-cdp: capability gateway init failed: ${err?.message ?? err}`);
|
|
7104
7117
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-cdp",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.19",
|
|
4
4
|
"description": "dsh-browser-cdp: DSH browser plugin — attach to a running Chrome/Edge over CDP (no bundled browser needed); structured browser-automation tools (30+ bcdp_*) that drive the vendored ego runtime through ctx.subprocess, plus a realtime watch panel (live SSE screencast + direct mouse interaction + download capture + human-verification notice). Web shell: floating watch panel without dsh-better-sidebar, sidebar tab with it. Headless/TUI hosts: tools-only. [DSH 0.1.7+ line: declarative settings via Config .volatile() fields; for DSH 0.1.2-rc.1 ~ 0.1.6 use the 0.16.x line]",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|