webhelm 1.0.28 → 1.0.30

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 CHANGED
@@ -47,10 +47,13 @@ The Actions checkout is `~/.local/webhelm`, with site modules at `~/.local/webhe
47
47
 
48
48
  ## Optional site Keep Alive (Extension)
49
49
 
50
- On a WebHelm-leased HTTPS page, use the Extension's **Keep Alive** toggle to
50
+ Only a Session in the **WebHelm** Workspace can use the Extension's **Keep Alive** toggle on an HTTPS page to
51
51
  register that website's **origin**. The website stays in the popup's Keep Alive
52
- Sites list even after the original Session ends. Click its name to open/focus
53
- that website in the existing managed Chrome profile and sign in again. Remove
52
+ Sites list even after the original Session ends. Custom/other Workspace
53
+ Sessions have no Keep Alive toggle. A green dot and website name mean that
54
+ the Platform last confirmed login; gray means not confirmed or not logged in
55
+ (hover to see the exact status). Click a website to open/focus it in the
56
+ existing managed Chrome profile and sign in again. The × control
54
57
  clears the registration. Credentials, cookies, URL query strings, and browser
55
58
  Session IDs are never copied into the registry. Site registration does **not**
56
59
  keep a WebHelm Session or Tab permanently leased.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webhelm",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "Agent browser automation in a visible managed Chrome with persistent JavaScript sessions",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,6 +13,7 @@ const transitions = new Set([
13
13
  "CHECKING>SENDING",
14
14
  "CHECKING>BLOCKED",
15
15
  "SENDING>SENT",
16
+ "SENDING>WAITING",
16
17
  "SENDING>UNCERTAIN",
17
18
  "UNCERTAIN>SENT",
18
19
  "UNCERTAIN>WAITING",
@@ -304,13 +305,25 @@ export class ChatGPTQueue extends DurableQueueCore {
304
305
  }
305
306
  this.transition(item.id, owner, "CHECKING", "SENDING");
306
307
  const receipt = await this._send(item);
307
- if (!["send-button-disabled", "user-turn"].includes(receipt?.verified_by)) {
308
+ // These diagnostics are all returned before clicking Send. A safe retry
309
+ // must not block this thread forever as an ambiguous delivery.
310
+ if (["pre_send_gate_not_ready", "send_control_not_found", "thread_redirect_mismatch"]
311
+ .includes(receipt?.diagnostic)) {
312
+ this.transition(item.id, owner, "SENDING", "WAITING", {
313
+ delay: this.intervalMs / 1000,
314
+ receipt: receipt.diagnostic,
315
+ });
316
+ } else if (["send-button-disabled", "user-turn"].includes(receipt?.verified_by)) {
317
+ this.transition(item.id, owner, "SENDING", "SENT", {
318
+ receipt: receipt.verified_by,
319
+ });
320
+ } else {
321
+ // After any unverified click, keep UNCERTAIN until a read-only check
322
+ // proves that the turn is present or absent; never send twice blindly.
308
323
  this.transition(item.id, owner, "SENDING", "UNCERTAIN", {
309
324
  receipt: receipt?.diagnostic || "missing_user_turn_receipt",
310
325
  });
311
- } else {this.transition(item.id, owner, "SENDING", "SENT", {
312
- receipt: "send-button-disabled",
313
- });}
326
+ }
314
327
  } catch (e) {
315
328
  const diagnostic = this._safeDiagnostic(e),
316
329
  current = this._one("SELECT * FROM turns WHERE id=?", item.id);
@@ -4,15 +4,14 @@ import { SEND_ENABLED_JS } from "./lifecycle-common.mjs";
4
4
  /** Source executed inside a caller-owned WebHelm Session, never a separate tab. */
5
5
  export function submissionScript(item) {
6
6
  const prompt = item.message.slice(0, 120);
7
- const selectorJS = "(() => {for(const s of ['button[aria-label=\"Send\"]','button[data-testid=\"send-button\"]','button[aria-label=\"Send prompt\"]']){const b=document.querySelector(s);if(b&&b.getClientRects().length&&!b.disabled)return s;}return null;})()";
7
+ const selectorJS = "(() => { const selector=\'button[aria-label=\"Send\"],button[data-testid=\"send-button\"],button[aria-label=\"Send prompt\"],form button[type=\"submit\"]\'; for(const b of document.querySelectorAll(\'[data-webhelm-queue-send]\'))b.removeAttribute(\'data-webhelm-queue-send\'); for(const b of document.querySelectorAll(selector)){if(!b.getClientRects().length||b.disabled||b.getAttribute(\'aria-disabled\')===\'true\')continue;b.setAttribute(\'data-webhelm-queue-send\',\'1\');return \'[data-webhelm-queue-send=\"1\"]\';} return null; })()";
8
8
  const userTurnsJS = "(() => [...document.querySelectorAll('h4[data-conversation-role=\"user\"]')].filter(h=>(h.parentElement?.innerText||'').includes(" +
9
9
  JSON.stringify(prompt) + ")).length)()";
10
10
  return [
11
11
  "return await (async()=>{",
12
12
  "const gate=await js("+JSON.stringify(PROBE_JS)+");",
13
- "const url=new URL((await page_info()).url);",
14
- "const actualId=url.pathname.split('/c/')[1]?.split('/')[0]||'';",
15
- "if(decodeURIComponent(actualId)!=="+JSON.stringify(item.thread_id)+
13
+ "const actualId=await js("+JSON.stringify("location.pathname.split('/c/')[1]?.split('/')[0]||''")+");",
14
+ "if(actualId!=="+JSON.stringify(item.thread_id)+
16
15
  ")return {diagnostic:'thread_redirect_mismatch'};",
17
16
  "if(gate?.state!=='READY'||!(await js("+JSON.stringify(SEND_ENABLED_JS)+")))",
18
17
  " return {diagnostic:'pre_send_gate_not_ready'};",
@@ -56,6 +56,8 @@ export function createControlRpc({control, manager, summarizeWorkspaces, schedul
56
56
  if (!state.connected) throw Error('WebHelm daemon is not responding');
57
57
  const session = state.sessions.find(s => s.session_id === args.sessionId);
58
58
  if (!session || !validTabId(session.tabId)) throw Error('Session tab is no longer leased');
59
+ if (session.workspace !== 'WebHelm')
60
+ throw Error('Keep Alive can be enabled only from a WebHelm Session');
59
61
  const tab = await chromeApi.tabs.get(session.tabId);
60
62
  const id = siteOrigin(tab.url || '');
61
63
  return setKeptSite(chromeApi,id,Boolean(args.enabled));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "WebHelm",
4
- "version": "0.4.11",
4
+ "version": "0.4.12",
5
5
  "description": "Own named Chrome tab-group workspaces and lazy reusable tab pools for browser agents.",
6
6
  "permissions": [
7
7
  "storage",
@@ -33,14 +33,13 @@
33
33
  .session-info strong { display:block; font-size:12px; }
34
34
  .session-info span { display:block; color:light-dark(var(--muted),#acb8c9); font-size:11px; }
35
35
  .session-row button { width:auto; padding:5px 9px; font-size:11px; }
36
- #keepalive-list { max-height:160px; overflow-y:auto; border-bottom:1px solid light-dark(var(--border),#334155); padding-bottom:6px; font-size:11px; color:light-dark(var(--muted),#acb8c9); }
37
- .keepalive-row { display:flex; align-items:center; gap:6px; padding:5px 0; }
38
- .keepalive-info { flex:1; min-width:0; overflow:hidden; }
39
- .keepalive-row button { width:auto; padding:4px 7px; font-size:11px; }
40
- .keepalive-row .tab-title { width:100%; font-size:12px; }
41
- .keepalive-status { display:block; font-size:10px; }
42
- .keepalive-status[data-status="alive"] { color:#23915c; }
43
- .keepalive-status[data-status="login_required"] { color:#ae3849; }
36
+ #keepalive-list { max-height:160px; overflow-y:auto; border-bottom:1px solid light-dark(var(--border),#334155); padding:3px 0 5px; font-size:11px; color:light-dark(var(--muted),#acb8c9); }
37
+ .keepalive-row { display:flex; align-items:center; gap:7px; min-height:25px; padding:2px 0; }
38
+ .keepalive-status { flex:0 0 7px; width:7px; height:7px; border-radius:50%; background:light-dark(#8893a1,#8995a5); }
39
+ .keepalive-status[data-status="alive"] { background:#23915c; }
40
+ .keepalive-row .keepalive-name { flex:1; min-width:0; color:light-dark(var(--muted),#acb8c9); font-size:11px; font-weight:500; }
41
+ .keepalive-row .keepalive-name.is-logged-in { color:#23915c; }
42
+ .keepalive-row .keepalive-remove { flex:0 0 19px; width:19px; padding:1px; border:0; background:transparent; color:light-dark(var(--muted),#acb8c9); font-size:16px; font-weight:400; line-height:18px; }
44
43
  .session-row button.site-enabled { color:#23915c; }
45
44
  #queue-list { border-top:1px solid light-dark(var(--border),#334155); padding-top:6px; margin-top:2px; }
46
45
  .queue-platform { padding:5px 0; }
@@ -49,26 +49,32 @@ function renderKeptSites(sites, busy, connected) {
49
49
  const target = el('keepalive-list');
50
50
  target.replaceChildren();
51
51
  if (!sites.length) {
52
- target.textContent='Toggle Keep Alive on a leased website to add it here.';
52
+ target.textContent='Enable Keep Alive from a WebHelm Session.';
53
53
  return;
54
54
  }
55
- const labels={alive:'Logged in',login_required:'Login required',unknown:'Login unknown',
56
- error:'Check failed',unsupported:'No heartbeat action',pending:'Pending check'};
55
+ const labels={alive:'Logged in',login_required:'Login required',unknown:'Login not confirmed',
56
+ error:'Heartbeat failed',unsupported:'No heartbeat action',pending:'Checking login'};
57
57
  for (const site of sites) {
58
58
  const row=document.createElement('div'); row.className='keepalive-row';
59
- const details=document.createElement('div'); details.className='keepalive-info';
59
+ const loggedIn=site.status==='alive';
60
+ const statusText=labels[site.status] || labels.pending;
61
+ const status=document.createElement('span'); status.className='keepalive-status';
62
+ status.dataset.status=loggedIn?'alive':'inactive';
63
+ status.title=statusText;
64
+ status.setAttribute('aria-hidden','true');
60
65
  const name=actionButton(new URL(site.url).hostname,false,async()=>{
61
66
  try {await rpc('workspace.control.site.open',{siteId:site.id});}
62
67
  catch(error){el('message').textContent=error.message;}
63
- },'tab-title');
64
- const status=document.createElement('span'); status.className='keepalive-status';
65
- status.textContent=labels[site.status] || 'Pending check';
66
- status.dataset.status=site.status;
67
- details.append(name,status);
68
- row.append(details,actionButton('Remove',false,async()=>{
68
+ },`tab-title keepalive-name ${loggedIn?'is-logged-in':''}`);
69
+ name.title=`${statusText} · Click to open site`;
70
+ name.setAttribute('aria-label',`${new URL(site.url).hostname}: ${statusText}. Open site`);
71
+ const remove=actionButton('×',false,async()=>{
69
72
  try {await rpc('workspace.control.site.remove',{siteId:site.id});lastSignature='';refresh();}
70
73
  catch(error){el('message').textContent=error.message;}
71
- }));
74
+ },'keepalive-remove');
75
+ remove.title=`Remove ${new URL(site.url).hostname} from Keep Alive`;
76
+ remove.setAttribute('aria-label',remove.title);
77
+ row.append(status,name,remove);
72
78
  target.append(row);
73
79
  }
74
80
  }
@@ -76,7 +82,7 @@ function renderKeptSites(sites, busy, connected) {
76
82
  function renderWorkspaces(workspaces, busy, connected) {
77
83
  const signature = JSON.stringify(workspaces.map(w => [
78
84
  w.name,w.initialized,w.available,w.poolSize,w.idleTabs,w.leasedTabs,w.sessions.map(s => [s.session_id,s.tab_title,s.tabId,s.tab_url]),
79
- ])) + ':' + busy + ':' + connected;
85
+ ])) + ':' + JSON.stringify(currentSites.map(site=>site.id)) + ':' + busy + ':' + connected;
80
86
  if (signature === lastSignature) return;
81
87
  lastSignature = signature;
82
88
  const target = el('workspace-list');
@@ -113,7 +119,7 @@ function renderWorkspaces(workspaces, busy, connected) {
113
119
  details.append(title);
114
120
  const siteId=originForTab(session.tab_url);
115
121
  sessionRow.append(details);
116
- if (siteId) {
122
+ if (workspace.name === 'WebHelm' && siteId) {
117
123
  const enabled=currentSites.some(site=>site.id===siteId);
118
124
  sessionRow.append(actionButton(enabled?'On':'Keep Alive',busy||!connected,async()=>{
119
125
  try {