@flrande/bak-extension 0.6.14 → 0.6.16

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.
@@ -2001,7 +2001,7 @@
2001
2001
  for (const [index, table] of htmlTables.entries()) {
2002
2002
  const handle = {
2003
2003
  id: buildTableId(table.closest(".dataTables_wrapper") ? "dataTables" : "html", index),
2004
- name: (table.getAttribute("aria-label") || table.getAttribute("data-testid") || table.id || `table-${index + 1}`).trim(),
2004
+ label: (table.getAttribute("aria-label") || table.getAttribute("data-testid") || table.id || `table-${index + 1}`).trim(),
2005
2005
  kind: table.closest(".dataTables_wrapper") ? "dataTables" : "html",
2006
2006
  selector: table.id ? `#${table.id}` : void 0,
2007
2007
  rowCount: table.querySelectorAll("tbody tr").length || table.querySelectorAll("tr").length,
@@ -2014,7 +2014,7 @@
2014
2014
  const kind = grid.className.includes("ag-") ? "ag-grid" : "aria-grid";
2015
2015
  const handle = {
2016
2016
  id: buildTableId(kind, index),
2017
- name: (grid.getAttribute("aria-label") || grid.getAttribute("data-testid") || grid.id || `grid-${index + 1}`).trim(),
2017
+ label: (grid.getAttribute("aria-label") || grid.getAttribute("data-testid") || grid.id || `grid-${index + 1}`).trim(),
2018
2018
  kind,
2019
2019
  selector: grid.id ? `#${grid.id}` : void 0,
2020
2020
  rowCount: gridRowNodes(grid).length,
@@ -2026,7 +2026,13 @@
2026
2026
  }
2027
2027
  function resolveTable(handleId) {
2028
2028
  const tables = describeTables();
2029
- const handle = tables.find((candidate) => candidate.id === handleId);
2029
+ const normalizedHandleId = handleId.trim().toLowerCase();
2030
+ const handle = tables.find((candidate) => {
2031
+ if (candidate.id === handleId) {
2032
+ return true;
2033
+ }
2034
+ return typeof candidate.label === "string" && candidate.label.trim().toLowerCase() === normalizedHandleId;
2035
+ });
2030
2036
  if (!handle) {
2031
2037
  return null;
2032
2038
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Browser Agent Kit",
4
- "version": "0.6.14",
4
+ "version": "0.6.16",
5
5
  "action": {
6
6
  "default_popup": "popup.html"
7
7
  },
@@ -101,7 +101,7 @@
101
101
  const lastError = `${state.lastErrorContext ?? ""} ${state.lastError ?? ""}`.toLowerCase();
102
102
  const runtimeOffline = lastError.includes("cannot connect to bak cli");
103
103
  if (state.connected) {
104
- const body = state.sessionBindings.detachedCount > 0 ? `${pluralize(state.sessionBindings.detachedCount, "remembered session")} are detached. Check the cards below before you continue browser work.` : "The extension bridge is healthy and ready for CLI-driven browser work.";
104
+ const body = state.sessionBindings.detachedCount > 0 ? `${pluralize(state.sessionBindings.detachedCount, "remembered session")} are detached. Check the cards below before you continue browser work.` : state.sessionBindings.windowOnlyCount > 0 ? `${pluralize(state.sessionBindings.windowOnlyCount, "remembered session")} still point at a live window, but do not own tabs yet.` : "The extension bridge is healthy and ready for CLI-driven browser work.";
105
105
  return {
106
106
  badge: "Ready",
107
107
  title: "Connected to the local bak runtime",
@@ -110,6 +110,9 @@
110
110
  recoverySteps: state.sessionBindings.detachedCount > 0 ? [
111
111
  "Resume or recreate detached work from the bak CLI before sending new page commands.",
112
112
  "Use the Sessions panel below to confirm which remembered session lost its owned tabs."
113
+ ] : state.sessionBindings.windowOnlyCount > 0 ? [
114
+ "New bak page commands can reuse those remembered windows without disturbing your human tabs.",
115
+ "Use the Sessions panel below to confirm which binding is only waiting for a new owned tab."
113
116
  ] : [
114
117
  "Start browser work from the bak CLI.",
115
118
  "Use Reconnect bridge only when you intentionally changed token or port settings."
@@ -234,7 +237,7 @@
234
237
  if (state.count === 0) {
235
238
  sessionSummaryEl.textContent = "No remembered sessions";
236
239
  } else {
237
- sessionSummaryEl.textContent = `${pluralize(state.count, "session")}, ${pluralize(state.attachedCount, "attached binding")}, ${pluralize(state.detachedCount, "detached binding")}, ${pluralize(state.tabCount, "tracked tab")}`;
240
+ sessionSummaryEl.textContent = `${pluralize(state.count, "session")}, ${pluralize(state.attachedCount, "attached binding")}, ${pluralize(state.windowOnlyCount, "window-only binding")}, ${pluralize(state.detachedCount, "detached binding")}, ${pluralize(state.tabCount, "tracked tab")}`;
238
241
  }
239
242
  sessionCardsEl.replaceChildren();
240
243
  if (state.items.length === 0) {
@@ -247,7 +250,7 @@
247
250
  for (const item of state.items) {
248
251
  const card = document.createElement("section");
249
252
  card.className = "session-card";
250
- card.dataset.detached = item.detached ? "true" : "false";
253
+ card.dataset.status = item.status;
251
254
  const header = document.createElement("div");
252
255
  header.className = "session-card-header";
253
256
  const titleWrap = document.createElement("div");
@@ -261,16 +264,16 @@
261
264
  titleWrap.append(title, subtitle);
262
265
  const badge = document.createElement("span");
263
266
  badge.className = "session-badge";
264
- badge.dataset.detached = item.detached ? "true" : "false";
265
- badge.textContent = item.detached ? "Detached" : "Attached";
267
+ badge.dataset.status = item.status;
268
+ badge.textContent = item.status === "attached" ? "Attached" : item.status === "window-only" ? "Window only" : "Detached";
266
269
  header.append(titleWrap, badge);
267
270
  const activeTitle = document.createElement("div");
268
271
  activeTitle.className = "session-active-title";
269
- activeTitle.textContent = item.activeTabTitle ? truncate(item.activeTabTitle, 72) : "No active tab title";
272
+ activeTitle.textContent = item.activeTabTitle ? truncate(item.activeTabTitle, 72) : item.status === "window-only" ? "No owned tab yet" : "No active tab title";
270
273
  activeTitle.title = item.activeTabTitle ?? "";
271
274
  const activeUrl = document.createElement("div");
272
275
  activeUrl.className = "session-active-url";
273
- activeUrl.textContent = formatUrl(item.activeTabUrl);
276
+ activeUrl.textContent = item.status === "window-only" && !item.activeTabUrl ? "Next bak page command can reuse this window" : formatUrl(item.activeTabUrl);
274
277
  activeUrl.title = item.activeTabUrl ?? "";
275
278
  const meta = document.createElement("div");
276
279
  meta.className = "session-meta-grid";
@@ -286,7 +289,7 @@
286
289
  );
287
290
  const footer = document.createElement("div");
288
291
  footer.className = "session-card-footer";
289
- footer.textContent = item.detached ? "bak still remembers this session, but its owned tabs or window are missing." : "The saved binding still points at live browser tabs.";
292
+ footer.textContent = item.status === "attached" ? "The saved binding still points at live browser tabs." : item.status === "window-only" ? "bak still remembers the target window for this session, but it does not own any live tabs right now." : "bak still remembers this session, but its owned tabs or window are missing.";
290
293
  card.append(header, activeTitle, activeUrl, meta, footer);
291
294
  sessionCardsEl.appendChild(card);
292
295
  }
package/dist/popup.html CHANGED
@@ -245,7 +245,12 @@
245
245
  background: rgba(255, 255, 255, 0.92);
246
246
  }
247
247
 
248
- .session-card[data-detached="true"] {
248
+ .session-card[data-status="window-only"] {
249
+ border-color: #38bdf8;
250
+ background: rgba(240, 249, 255, 0.95);
251
+ }
252
+
253
+ .session-card[data-status="detached"] {
249
254
  border-color: #f59e0b;
250
255
  background: rgba(255, 251, 235, 0.95);
251
256
  }
@@ -283,12 +288,17 @@
283
288
  white-space: nowrap;
284
289
  }
285
290
 
286
- .session-badge[data-detached="true"] {
291
+ .session-badge[data-status="window-only"] {
292
+ background: #e0f2fe;
293
+ color: #0369a1;
294
+ }
295
+
296
+ .session-badge[data-status="detached"] {
287
297
  background: #fef3c7;
288
298
  color: #b45309;
289
299
  }
290
300
 
291
- .session-badge[data-detached="false"] {
301
+ .session-badge[data-status="attached"] {
292
302
  background: #dbeafe;
293
303
  color: #1d4ed8;
294
304
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@flrande/bak-extension",
3
- "version": "0.6.14",
3
+ "version": "0.6.16",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "@flrande/bak-protocol": "0.6.14"
6
+ "@flrande/bak-protocol": "0.6.16"
7
7
  },
8
8
  "devDependencies": {
9
9
  "@types/chrome": "^0.1.14",
package/public/popup.html CHANGED
@@ -245,7 +245,12 @@
245
245
  background: rgba(255, 255, 255, 0.92);
246
246
  }
247
247
 
248
- .session-card[data-detached="true"] {
248
+ .session-card[data-status="window-only"] {
249
+ border-color: #38bdf8;
250
+ background: rgba(240, 249, 255, 0.95);
251
+ }
252
+
253
+ .session-card[data-status="detached"] {
249
254
  border-color: #f59e0b;
250
255
  background: rgba(255, 251, 235, 0.95);
251
256
  }
@@ -283,12 +288,17 @@
283
288
  white-space: nowrap;
284
289
  }
285
290
 
286
- .session-badge[data-detached="true"] {
291
+ .session-badge[data-status="window-only"] {
292
+ background: #e0f2fe;
293
+ color: #0369a1;
294
+ }
295
+
296
+ .session-badge[data-status="detached"] {
287
297
  background: #fef3c7;
288
298
  color: #b45309;
289
299
  }
290
300
 
291
- .session-badge[data-detached="false"] {
301
+ .session-badge[data-status="attached"] {
292
302
  background: #dbeafe;
293
303
  color: #1d4ed8;
294
304
  }