@sovovs/bycli 2.1.62 → 2.1.63
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/extension/README.md +19 -0
- package/extension/dist/background.js +178 -13
- package/extension/manifest.json +2 -1
- package/package.json +1 -1
package/extension/README.md
CHANGED
|
@@ -9,6 +9,9 @@ commands.
|
|
|
9
9
|
- `debugger`: sends CDP commands to byCLI-controlled or bound tabs.
|
|
10
10
|
- `tabs` / `tabGroups`: manages the dedicated byCLI automation container and
|
|
11
11
|
reports selected tab metadata back to the CLI.
|
|
12
|
+
- `system.display`: reads logical display work areas so owned windows fit the
|
|
13
|
+
usable screen space, including headless virtual displays. It does not change
|
|
14
|
+
display settings.
|
|
12
15
|
- `cookies`: reads cookies for browser-backed adapters that need authenticated
|
|
13
16
|
fetches.
|
|
14
17
|
- `downloads`: surfaces download lifecycle to `bycli browser wait download`.
|
|
@@ -17,6 +20,22 @@ commands.
|
|
|
17
20
|
filters by the command's filename/URL pattern and timeout, and does not modify,
|
|
18
21
|
redirect, or persist browser download history.
|
|
19
22
|
|
|
23
|
+
## Owned Window Placement
|
|
24
|
+
|
|
25
|
+
New byCLI windows use up to 1280 × 900 logical pixels, capped by the selected
|
|
26
|
+
display's work area. The last-focused normal Chrome window selects the display;
|
|
27
|
+
the primary display is the fallback. Existing owned normal windows stay on the
|
|
28
|
+
display with their largest intersection, keeping smaller sizes and positions
|
|
29
|
+
that already fit. Bounds are corrected on reuse, lease restoration and display
|
|
30
|
+
changes without changing focus. Borrowed user windows and minimized, maximized
|
|
31
|
+
or fullscreen window states are preserved.
|
|
32
|
+
Dragging an owned tab into a user window does not transfer window ownership
|
|
33
|
+
during lease restoration. A move, resize or state change while display metadata
|
|
34
|
+
is being read also takes precedence over that pending correction.
|
|
35
|
+
|
|
36
|
+
If display metadata is unavailable, byCLI logs a warning. New windows use
|
|
37
|
+
Chrome's natural size and placement, and existing windows retain their bounds.
|
|
38
|
+
|
|
20
39
|
Suggested Chrome Web Store justification for `downloads`:
|
|
21
40
|
|
|
22
41
|
> This extension uses `chrome.downloads` to surface download lifecycle
|
|
@@ -1558,6 +1558,46 @@ function checkUrlSyntax(input, opts = {}) {
|
|
|
1558
1558
|
return { ok: true, url: parsed.toString(), hostname, isIpLiteral: false };
|
|
1559
1559
|
}
|
|
1560
1560
|
|
|
1561
|
+
function hasUsableBounds(bounds) {
|
|
1562
|
+
return !!bounds && Number.isFinite(bounds.left) && Number.isFinite(bounds.top) && Number.isFinite(bounds.width) && Number.isFinite(bounds.height) && bounds.width >= 1 && bounds.height >= 1;
|
|
1563
|
+
}
|
|
1564
|
+
function selectWindowWorkArea(displays, reference) {
|
|
1565
|
+
const usable = displays.filter((display) => display.isEnabled && display.activeState !== "inactive" && hasUsableBounds(display.workArea));
|
|
1566
|
+
if (usable.length === 0) return null;
|
|
1567
|
+
let selected = usable.find((display) => display.isPrimary) ?? usable[0];
|
|
1568
|
+
let largestIntersection = 0;
|
|
1569
|
+
if (hasUsableBounds(reference)) {
|
|
1570
|
+
for (const display of usable) {
|
|
1571
|
+
const area = display.workArea;
|
|
1572
|
+
const width = Math.max(0, Math.min(reference.left + reference.width, area.left + area.width) - Math.max(reference.left, area.left));
|
|
1573
|
+
const height = Math.max(0, Math.min(reference.top + reference.height, area.top + area.height) - Math.max(reference.top, area.top));
|
|
1574
|
+
const intersection = width * height;
|
|
1575
|
+
if (intersection > largestIntersection) {
|
|
1576
|
+
largestIntersection = intersection;
|
|
1577
|
+
selected = display;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
return selected.workArea;
|
|
1582
|
+
}
|
|
1583
|
+
function createOwnedWindowBounds(area) {
|
|
1584
|
+
return {
|
|
1585
|
+
left: area.left,
|
|
1586
|
+
top: area.top,
|
|
1587
|
+
width: Math.min(1280, area.width),
|
|
1588
|
+
height: Math.min(900, area.height)
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
function constrainOwnedWindowBounds(window, area) {
|
|
1592
|
+
if (!hasUsableBounds(window)) return null;
|
|
1593
|
+
const width = Math.min(window.width, area.width);
|
|
1594
|
+
const height = Math.min(window.height, area.height);
|
|
1595
|
+
const left = Math.min(Math.max(window.left, area.left), area.left + area.width - width);
|
|
1596
|
+
const top = Math.min(Math.max(window.top, area.top), area.top + area.height - height);
|
|
1597
|
+
if (width === window.width && height === window.height && left === window.left && top === window.top) return null;
|
|
1598
|
+
return { left, top, width, height };
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1561
1601
|
const EXTENSION_CAPABILITIES = ["focus-window-v1", "ima-reader-v1"];
|
|
1562
1602
|
let ws = null;
|
|
1563
1603
|
let reconnectTimer = null;
|
|
@@ -2047,7 +2087,86 @@ async function focusOwnedWindowIfRequested(windowId, mode) {
|
|
|
2047
2087
|
if (typeof updateWindow === "function") await updateWindow(windowId, { focused: true }).catch(() => {
|
|
2048
2088
|
});
|
|
2049
2089
|
}
|
|
2090
|
+
async function getOwnedWindowWorkArea(reference) {
|
|
2091
|
+
try {
|
|
2092
|
+
if (typeof chrome.system?.display?.getInfo !== "function") throw new Error("system.display API unavailable");
|
|
2093
|
+
const displays = await chrome.system.display.getInfo();
|
|
2094
|
+
const area = selectWindowWorkArea(displays, reference);
|
|
2095
|
+
if (!area) throw new Error("no enabled displays with a valid work area");
|
|
2096
|
+
return area;
|
|
2097
|
+
} catch (err) {
|
|
2098
|
+
console.warn(`[bycli] Unable to query display work area: ${err instanceof Error ? err.message : String(err)}`);
|
|
2099
|
+
return null;
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
async function getNewOwnedWindowBounds() {
|
|
2103
|
+
let reference;
|
|
2104
|
+
try {
|
|
2105
|
+
if (typeof chrome.windows.getLastFocused === "function") {
|
|
2106
|
+
const lastFocused = await chrome.windows.getLastFocused({ windowTypes: ["normal"] });
|
|
2107
|
+
if (lastFocused.type === "normal") reference = lastFocused;
|
|
2108
|
+
}
|
|
2109
|
+
} catch {
|
|
2110
|
+
}
|
|
2111
|
+
const area = await getOwnedWindowWorkArea(reference);
|
|
2112
|
+
return area ? createOwnedWindowBounds(area) : void 0;
|
|
2113
|
+
}
|
|
2114
|
+
const ownedWindowGeometryUpdates = /* @__PURE__ */ new Map();
|
|
2115
|
+
const excludedOwnedWindowIds = /* @__PURE__ */ new Set();
|
|
2116
|
+
function isKnownOwnedWindow(windowId) {
|
|
2117
|
+
return Object.values(ownedContainers).some((container) => container.windowId === windowId) || [...automationSessions.values()].some((session) => session.owned && session.windowId === windowId);
|
|
2118
|
+
}
|
|
2119
|
+
function rememberOwnedTabDrift(tab, ownedWindowId) {
|
|
2120
|
+
if (tab.windowId !== ownedWindowId && !isKnownOwnedWindow(tab.windowId)) {
|
|
2121
|
+
excludedOwnedWindowIds.add(tab.windowId);
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
async function rememberOwnedGroupDrift(groupId, ownedWindowId) {
|
|
2125
|
+
if (groupId === null) return;
|
|
2126
|
+
try {
|
|
2127
|
+
const group = await chrome.tabGroups.get(groupId);
|
|
2128
|
+
if (group.windowId !== ownedWindowId && !isKnownOwnedWindow(group.windowId)) {
|
|
2129
|
+
excludedOwnedWindowIds.add(group.windowId);
|
|
2130
|
+
}
|
|
2131
|
+
} catch {
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
async function constrainOwnedWindowGeometry(windowId) {
|
|
2135
|
+
const previous = ownedWindowGeometryUpdates.get(windowId) ?? Promise.resolve();
|
|
2136
|
+
const next = previous.catch(() => void 0).then(async () => {
|
|
2137
|
+
if (!isKnownOwnedWindow(windowId)) return;
|
|
2138
|
+
try {
|
|
2139
|
+
const window = await chrome.windows.get(windowId);
|
|
2140
|
+
if (window.type !== "normal" || window.state !== "normal") return;
|
|
2141
|
+
const originalBounds = { left: window.left, top: window.top, width: window.width, height: window.height };
|
|
2142
|
+
const area = await getOwnedWindowWorkArea(window);
|
|
2143
|
+
if (!area || !isKnownOwnedWindow(windowId)) return;
|
|
2144
|
+
const current = await chrome.windows.get(windowId);
|
|
2145
|
+
if (!isKnownOwnedWindow(windowId) || current.type !== "normal" || current.state !== "normal" || current.left !== originalBounds.left || current.top !== originalBounds.top || current.width !== originalBounds.width || current.height !== originalBounds.height) return;
|
|
2146
|
+
const bounds = constrainOwnedWindowBounds(current, area);
|
|
2147
|
+
if (bounds) await chrome.windows.update(windowId, bounds);
|
|
2148
|
+
} catch (err) {
|
|
2149
|
+
console.warn(`[bycli] Failed to constrain owned window ${windowId} geometry: ${err instanceof Error ? err.message : String(err)}`);
|
|
2150
|
+
}
|
|
2151
|
+
});
|
|
2152
|
+
const tracked = next.finally(() => {
|
|
2153
|
+
if (ownedWindowGeometryUpdates.get(windowId) === tracked) ownedWindowGeometryUpdates.delete(windowId);
|
|
2154
|
+
});
|
|
2155
|
+
ownedWindowGeometryUpdates.set(windowId, tracked);
|
|
2156
|
+
await tracked;
|
|
2157
|
+
}
|
|
2158
|
+
chrome.system?.display?.onDisplayChanged?.addListener(async () => {
|
|
2159
|
+
const ids = /* @__PURE__ */ new Set();
|
|
2160
|
+
for (const container of Object.values(ownedContainers)) {
|
|
2161
|
+
if (container.windowId !== null) ids.add(container.windowId);
|
|
2162
|
+
}
|
|
2163
|
+
for (const session of automationSessions.values()) {
|
|
2164
|
+
if (session.owned) ids.add(session.windowId);
|
|
2165
|
+
}
|
|
2166
|
+
await Promise.all([...ids].map(constrainOwnedWindowGeometry));
|
|
2167
|
+
});
|
|
2050
2168
|
async function toOwnedContainerDiscoveryCandidate(group) {
|
|
2169
|
+
if (excludedOwnedWindowIds.has(group.windowId)) return null;
|
|
2051
2170
|
try {
|
|
2052
2171
|
const chromeWindow = await chrome.windows.get(group.windowId);
|
|
2053
2172
|
const reusableTabId = await findReusableOwnedContainerTab(group.windowId, group.id);
|
|
@@ -2074,6 +2193,7 @@ async function discoverOwnedContainerFromTabGroup(role) {
|
|
|
2074
2193
|
if (container.groupId !== null) {
|
|
2075
2194
|
try {
|
|
2076
2195
|
const group = await chrome.tabGroups.get(container.groupId);
|
|
2196
|
+
if (excludedOwnedWindowIds.has(group.windowId)) throw new Error("Owned group moved to a user window");
|
|
2077
2197
|
await chrome.windows.get(group.windowId);
|
|
2078
2198
|
container.windowId = group.windowId;
|
|
2079
2199
|
return { windowId: group.windowId, groupId: group.id };
|
|
@@ -2139,8 +2259,11 @@ async function ensureOwnedContainerWindow(role, initialUrl, mode = "background")
|
|
|
2139
2259
|
async function ensureOwnedContainerWindowUnlocked(role, initialUrl, mode = "background") {
|
|
2140
2260
|
const container = ownedContainers[role];
|
|
2141
2261
|
if (container.windowId !== null) {
|
|
2262
|
+
const knownWindowId = container.windowId;
|
|
2263
|
+
const knownGroupId = container.groupId;
|
|
2142
2264
|
try {
|
|
2143
2265
|
await chrome.windows.get(container.windowId);
|
|
2266
|
+
await constrainOwnedWindowGeometry(container.windowId);
|
|
2144
2267
|
await focusOwnedWindowIfRequested(container.windowId, mode);
|
|
2145
2268
|
const initialTabId2 = await findReusableOwnedContainerTab(container.windowId, await getOwnedContainerGroupId(role, container.windowId));
|
|
2146
2269
|
await ensureOwnedContainerTabGroup(role, container.windowId, [initialTabId2]);
|
|
@@ -2149,12 +2272,16 @@ async function ensureOwnedContainerWindowUnlocked(role, initialUrl, mode = "back
|
|
|
2149
2272
|
initialTabId: initialTabId2
|
|
2150
2273
|
};
|
|
2151
2274
|
} catch {
|
|
2152
|
-
|
|
2153
|
-
container.groupId
|
|
2275
|
+
await rememberOwnedGroupDrift(knownGroupId, knownWindowId);
|
|
2276
|
+
if (container.windowId === knownWindowId && container.groupId === knownGroupId) {
|
|
2277
|
+
container.windowId = null;
|
|
2278
|
+
container.groupId = null;
|
|
2279
|
+
}
|
|
2154
2280
|
}
|
|
2155
2281
|
}
|
|
2156
2282
|
const discovered = await discoverOwnedContainerFromTabGroup(role);
|
|
2157
2283
|
if (discovered) {
|
|
2284
|
+
await constrainOwnedWindowGeometry(discovered.windowId);
|
|
2158
2285
|
await focusOwnedWindowIfRequested(discovered.windowId, mode);
|
|
2159
2286
|
const initialTabId2 = await findReusableOwnedContainerTab(discovered.windowId, discovered.groupId);
|
|
2160
2287
|
await ensureOwnedContainerTabGroup(role, discovered.windowId, [initialTabId2]);
|
|
@@ -2168,8 +2295,7 @@ async function ensureOwnedContainerWindowUnlocked(role, initialUrl, mode = "back
|
|
|
2168
2295
|
const win = await chrome.windows.create({
|
|
2169
2296
|
url: startUrl,
|
|
2170
2297
|
focused: mode === "foreground",
|
|
2171
|
-
|
|
2172
|
-
height: 900,
|
|
2298
|
+
...await getNewOwnedWindowBounds(),
|
|
2173
2299
|
type: "normal"
|
|
2174
2300
|
});
|
|
2175
2301
|
container.windowId = win.id;
|
|
@@ -2264,9 +2390,14 @@ async function getAutomationWindow(leaseKey, initialUrl) {
|
|
|
2264
2390
|
const tabId = existing.preferredTabId;
|
|
2265
2391
|
if (tabId !== null) {
|
|
2266
2392
|
const tab = await chrome.tabs.get(tabId);
|
|
2267
|
-
|
|
2393
|
+
rememberOwnedTabDrift(tab, existing.windowId);
|
|
2394
|
+
if (isDebuggableUrl(tab.url) && tab.windowId === existing.windowId) {
|
|
2395
|
+
await constrainOwnedWindowGeometry(existing.windowId);
|
|
2396
|
+
return existing.windowId;
|
|
2397
|
+
}
|
|
2268
2398
|
}
|
|
2269
2399
|
await chrome.windows.get(existing.windowId);
|
|
2400
|
+
await constrainOwnedWindowGeometry(existing.windowId);
|
|
2270
2401
|
return existing.windowId;
|
|
2271
2402
|
} catch {
|
|
2272
2403
|
await removeLeaseSession(leaseKey);
|
|
@@ -2277,10 +2408,15 @@ async function getAutomationWindow(leaseKey, initialUrl) {
|
|
|
2277
2408
|
return (await ensureOwnedContainerWindow(role, initialUrl, getWindowModeForOwnedPage(leaseKey, url))).windowId;
|
|
2278
2409
|
}
|
|
2279
2410
|
chrome.windows.onRemoved.addListener(async (windowId) => {
|
|
2411
|
+
excludedOwnedWindowIds.delete(windowId);
|
|
2280
2412
|
for (const container of Object.values(ownedContainers)) {
|
|
2281
2413
|
if (container.windowId === windowId) {
|
|
2282
|
-
|
|
2283
|
-
|
|
2414
|
+
const knownGroupId = container.groupId;
|
|
2415
|
+
await rememberOwnedGroupDrift(knownGroupId, windowId);
|
|
2416
|
+
if (container.windowId === windowId && container.groupId === knownGroupId) {
|
|
2417
|
+
container.windowId = null;
|
|
2418
|
+
container.groupId = null;
|
|
2419
|
+
}
|
|
2284
2420
|
}
|
|
2285
2421
|
}
|
|
2286
2422
|
for (const [leaseKey, expected] of [...automationSessions.entries()]) {
|
|
@@ -2535,8 +2671,14 @@ async function resolveTabUnlocked(tabId, leaseKey, initialUrl, blankFirst = fals
|
|
|
2535
2671
|
try {
|
|
2536
2672
|
const tab = await chrome.tabs.get(tabId);
|
|
2537
2673
|
const session = existingSession;
|
|
2674
|
+
if (session?.owned && (session.preferredTabId === tabId || session.preferredTabId === null)) {
|
|
2675
|
+
rememberOwnedTabDrift(tab, session.windowId);
|
|
2676
|
+
}
|
|
2538
2677
|
const matchesSession = session ? session.preferredTabId !== null ? session.preferredTabId === tabId : tab.windowId === session.windowId : false;
|
|
2539
|
-
if (isDebuggableUrl(tab.url) && matchesSession)
|
|
2678
|
+
if (isDebuggableUrl(tab.url) && matchesSession) {
|
|
2679
|
+
if (session?.owned && tab.windowId === session.windowId) await constrainOwnedWindowGeometry(session.windowId);
|
|
2680
|
+
return { tabId, tab };
|
|
2681
|
+
}
|
|
2540
2682
|
if (session && !session.owned) {
|
|
2541
2683
|
throw new CommandFailure(
|
|
2542
2684
|
matchesSession ? "bound_tab_not_debuggable" : "bound_tab_mismatch",
|
|
@@ -2550,6 +2692,7 @@ async function resolveTabUnlocked(tabId, leaseKey, initialUrl, blankFirst = fals
|
|
|
2550
2692
|
await chrome.tabs.move(tabId, { windowId: session.windowId, index: -1 });
|
|
2551
2693
|
const moved = await chrome.tabs.get(tabId);
|
|
2552
2694
|
if (moved.windowId === session.windowId && isDebuggableUrl(moved.url)) {
|
|
2695
|
+
if (session.owned) await constrainOwnedWindowGeometry(session.windowId);
|
|
2553
2696
|
return { tabId, tab: moved };
|
|
2554
2697
|
}
|
|
2555
2698
|
} catch (moveErr) {
|
|
@@ -2576,7 +2719,11 @@ async function resolveTabUnlocked(tabId, leaseKey, initialUrl, blankFirst = fals
|
|
|
2576
2719
|
const session = existingSession;
|
|
2577
2720
|
try {
|
|
2578
2721
|
const preferredTab = await chrome.tabs.get(existingPreferredTabId);
|
|
2579
|
-
if (
|
|
2722
|
+
if (session.owned) rememberOwnedTabDrift(preferredTab, session.windowId);
|
|
2723
|
+
if (isDebuggableUrl(preferredTab.url)) {
|
|
2724
|
+
if (session.owned && preferredTab.windowId === session.windowId) await constrainOwnedWindowGeometry(session.windowId);
|
|
2725
|
+
return { tabId: preferredTab.id, tab: preferredTab };
|
|
2726
|
+
}
|
|
2580
2727
|
if (!session.owned) {
|
|
2581
2728
|
throw new CommandFailure(
|
|
2582
2729
|
"bound_tab_not_debuggable",
|
|
@@ -2871,6 +3018,8 @@ async function handleFocusUnlocked(cmd, leaseKey) {
|
|
|
2871
3018
|
if (activatedTab.id !== tabId || activatedTab.windowId !== focusLease.windowId) {
|
|
2872
3019
|
return { id: cmd.id, ok: false, error: "Current automation session tab changed window during focus" };
|
|
2873
3020
|
}
|
|
3021
|
+
await constrainOwnedWindowGeometry(focusLease.windowId);
|
|
3022
|
+
if (!isFocusLeaseCurrent(leaseKey, focusLease)) return focusLeaseChangedResult(cmd.id);
|
|
2874
3023
|
await updateWindow(focusLease.windowId, { focused: true });
|
|
2875
3024
|
if (!isFocusLeaseCurrent(leaseKey, focusLease)) return focusLeaseChangedResult(cmd.id);
|
|
2876
3025
|
return { id: cmd.id, ok: true, data: { focused: true } };
|
|
@@ -2964,12 +3113,16 @@ async function handleTabSelectUnlocked(cmd, leaseKey) {
|
|
|
2964
3113
|
if (!session || tab.windowId !== session.windowId) {
|
|
2965
3114
|
return { id: cmd.id, ok: false, error: "Page is not in the automation container" };
|
|
2966
3115
|
}
|
|
3116
|
+
if (session.owned) await constrainOwnedWindowGeometry(session.windowId);
|
|
2967
3117
|
await chrome.tabs.update(cmdTabId, { active: true });
|
|
2968
3118
|
return pageScopedResult(cmd.id, cmdTabId, { selected: true });
|
|
2969
3119
|
}
|
|
2970
3120
|
const tabs = await listAutomationWebTabsUnlocked(leaseKey);
|
|
2971
3121
|
const target = tabs[cmd.index];
|
|
2972
3122
|
if (!target?.id) return { id: cmd.id, ok: false, error: `Tab index ${cmd.index} not found` };
|
|
3123
|
+
if (lockedSession?.owned && target.windowId === lockedSession.windowId) {
|
|
3124
|
+
await constrainOwnedWindowGeometry(lockedSession.windowId);
|
|
3125
|
+
}
|
|
2973
3126
|
await chrome.tabs.update(target.id, { active: true });
|
|
2974
3127
|
return pageScopedResult(cmd.id, target.id, { selected: true });
|
|
2975
3128
|
}
|
|
@@ -3285,13 +3438,20 @@ async function reconcileTargetLeaseRegistry() {
|
|
|
3285
3438
|
for (const role of Object.keys(ownedContainers)) {
|
|
3286
3439
|
ownedContainers[role].windowId = registry.ownedContainers[role]?.windowId ?? null;
|
|
3287
3440
|
ownedContainers[role].groupId = registry.ownedContainers[role]?.groupId ?? null;
|
|
3441
|
+
}
|
|
3442
|
+
for (const role of Object.keys(ownedContainers)) {
|
|
3288
3443
|
const windowId = ownedContainers[role].windowId;
|
|
3444
|
+
const groupId = ownedContainers[role].groupId;
|
|
3289
3445
|
if (windowId !== null) {
|
|
3290
3446
|
try {
|
|
3291
3447
|
await chrome.windows.get(windowId);
|
|
3448
|
+
await constrainOwnedWindowGeometry(windowId);
|
|
3292
3449
|
} catch {
|
|
3293
|
-
|
|
3294
|
-
ownedContainers[role].groupId
|
|
3450
|
+
await rememberOwnedGroupDrift(groupId, windowId);
|
|
3451
|
+
if (ownedContainers[role].windowId === windowId && ownedContainers[role].groupId === groupId) {
|
|
3452
|
+
ownedContainers[role].windowId = null;
|
|
3453
|
+
ownedContainers[role].groupId = null;
|
|
3454
|
+
}
|
|
3295
3455
|
}
|
|
3296
3456
|
}
|
|
3297
3457
|
}
|
|
@@ -3302,6 +3462,8 @@ async function reconcileTargetLeaseRegistry() {
|
|
|
3302
3462
|
try {
|
|
3303
3463
|
const tab = await chrome.tabs.get(tabId);
|
|
3304
3464
|
if (!isDebuggableUrl(tab.url)) continue;
|
|
3465
|
+
if (stored.owned && (!Number.isInteger(stored.windowId) || stored.windowId < 0)) continue;
|
|
3466
|
+
if (stored.owned) rememberOwnedTabDrift(tab, stored.windowId);
|
|
3305
3467
|
if (stored.lifecycle === "ephemeral" || stored.lifecycle === "persistent" || stored.lifecycle === "pinned") {
|
|
3306
3468
|
sessionLifecycleOverrides.set(leaseKey, stored.lifecycle);
|
|
3307
3469
|
}
|
|
@@ -3309,7 +3471,9 @@ async function reconcileTargetLeaseRegistry() {
|
|
|
3309
3471
|
session: typeof stored.session === "string" ? stored.session : getSessionFromKey(leaseKey),
|
|
3310
3472
|
surface: stored.surface === "adapter" ? "adapter" : getSurfaceFromKey(leaseKey),
|
|
3311
3473
|
kind: stored.kind === "bound" || stored.owned === false ? "bound" : "owned",
|
|
3312
|
-
|
|
3474
|
+
// A leased tab can be dragged into a user window while the worker is
|
|
3475
|
+
// stopped. Its current location does not transfer window ownership.
|
|
3476
|
+
windowId: stored.owned ? stored.windowId : tab.windowId,
|
|
3313
3477
|
owned: stored.owned,
|
|
3314
3478
|
preferredTabId: tabId
|
|
3315
3479
|
});
|
|
@@ -3319,9 +3483,10 @@ async function reconcileTargetLeaseRegistry() {
|
|
|
3319
3483
|
idleTimer: null,
|
|
3320
3484
|
idleDeadlineAt: stored.idleDeadlineAt
|
|
3321
3485
|
});
|
|
3322
|
-
if (session.owned) {
|
|
3486
|
+
if (session.owned && tab.windowId === session.windowId) {
|
|
3323
3487
|
const role = getOwnedWindowRole(leaseKey);
|
|
3324
3488
|
if (ownedContainers[role].windowId === null) ownedContainers[role].windowId = tab.windowId;
|
|
3489
|
+
await constrainOwnedWindowGeometry(tab.windowId);
|
|
3325
3490
|
await ensureOwnedContainerTabGroup(role, tab.windowId, [tabId]);
|
|
3326
3491
|
}
|
|
3327
3492
|
const remaining = stored.idleDeadlineAt > 0 ? stored.idleDeadlineAt - Date.now() : timeout;
|
package/extension/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"name": "byCLI",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.24",
|
|
5
5
|
"description": "Browser automation bridge for the byCLI CLI tool. Executes commands in Chrome tab leases via a local daemon.",
|
|
6
6
|
"permissions": [
|
|
7
7
|
"debugger",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"alarms",
|
|
12
12
|
"storage",
|
|
13
13
|
"tabGroups",
|
|
14
|
+
"system.display",
|
|
14
15
|
"downloads"
|
|
15
16
|
],
|
|
16
17
|
"host_permissions": [
|