webhelm 1.0.36 → 1.0.37

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webhelm",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "Agent browser automation in a visible managed Chrome with persistent JavaScript sessions",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "WebHelm",
4
- "version": "1.0.36",
4
+ "version": "1.0.37",
5
5
  "description": "Own named Chrome tab-group workspaces and lazy reusable tab pools for browser agents.",
6
6
  "permissions": [
7
7
  "storage",
@@ -59,19 +59,43 @@ export function compactQueue(items, {expanded=false,maxHeads=8}={}) {
59
59
  const threads=new Map();
60
60
  for (const [index,item] of all.entries()) {
61
61
  const key=threadKey(item);
62
- if (!threads.has(key)) threads.set(key,{head:item,index,count:0});
62
+ if (!threads.has(key)) threads.set(key,{head:item,index,count:0,items:[]});
63
63
  threads.get(key).count++;
64
+ threads.get(key).items.push(item);
64
65
  }
65
66
  const heads=[...threads.values()].sort((a,b)=>
66
67
  (priority[a.head.state]??5)-(priority[b.head.state]??5)||a.index-b.index);
67
- const visible=expanded ? all : heads.slice(0,Math.max(1,maxHeads)).map(x=>x.head);
68
+ const visible=expanded ? heads.flatMap(x=>x.items) : heads.slice(0,Math.max(1,maxHeads)).map(x=>x.head);
69
+ const headFor=new Map(heads.flatMap(x=>x.items.map(item=>[item.id,x.head])));
68
70
  const behind=new Map(heads.map(x=>[x.head.id,x.count-1]));
69
71
  const uncertain=all.filter(x=>x.state==='UNCERTAIN').length;
70
72
  const blocked=all.filter(x=>x.state==='BLOCKED').length;
71
- return {visible,total:all.length,threads:threads.size,behind,
73
+ return {visible,total:all.length,threads:threads.size,behind,headFor,
72
74
  hidden:all.length-visible.length,uncertain,blocked};
73
75
  }
74
76
 
77
+ // Statuses describe what the user can do, not internal retry counters.
78
+ // A later QUEUED item cannot be sent until earlier items in the same thread resolve.
79
+ export function queueStatusText(item,{head=item,remaining=0}={}) {
80
+ const state=String(item.state||'QUEUED').toUpperCase();
81
+ const following=head.id!==item.id;
82
+ let message;
83
+ if(following && ['UNCERTAIN','BLOCKED'].includes(head.state))
84
+ message=head.state==='UNCERTAIN' ? 'Waiting — previous send unconfirmed' : 'Waiting — previous message blocked';
85
+ else if(following) message='Waiting behind earlier message';
86
+ else message=({
87
+ UNCERTAIN:'Send unconfirmed — open thread to check',
88
+ BLOCKED:'Blocked — needs attention',
89
+ SENDING:'Sending',
90
+ CHECKING:'Checking delivery',
91
+ WAITING:'Waiting to send',
92
+ QUEUED:'Queued to send',
93
+ })[state]||state.toLowerCase();
94
+ if(!following && remaining>0)
95
+ message+=' · '+remaining+' later message'+(remaining===1?'':'s')+' waiting';
96
+ return message;
97
+ }
98
+
75
99
  // Keep hidden groups out of the toolbar even if a running older worker has
76
100
  // not yet reloaded its control RPC. Do not mutate the persisted configuration.
77
101
  export const WORKSPACE_STORAGE_KEY='browserWorkspaceManager.v1';
@@ -47,10 +47,13 @@
47
47
  .queue-platform + .queue-platform { border-top:1px solid light-dark(var(--border),#334155); }
48
48
  .queue-platform-header { display:flex; align-items:center; justify-content:space-between; gap:6px; }
49
49
  .queue-platform-title { font-size:11px; }
50
+ .queue-platform-count { font-size:9px; flex:1; text-align:right; color:light-dark(var(--muted),#acb8c9); white-space:nowrap; }
50
51
  #queue-toggle { width:auto; padding:2px 5px; font-size:9px; }
51
52
  .queue-row { display:flex; align-items:center; gap:6px; padding:3px 0; }
53
+ .queue-row.queue-followup { margin-left:9px; padding-left:7px; border-left:2px solid light-dark(var(--border),#40516a); }
52
54
  .queue-info { min-width:0; flex:1; overflow-wrap:anywhere; }
53
55
  .queue-info span { display:block; color:light-dark(var(--muted),#acb8c9); font-size:9px; line-height:1.3; }
56
+ .queue-info span.queue-warning { color:light-dark(var(--warning),#f7a4ad); font-weight:500; }
54
57
  .queue-row button.queue-remove { flex:0 0 20px; width:20px; height:20px; padding:0; border:0; background:transparent; color:light-dark(var(--muted),#acb8c9); font-size:16px; font-weight:400; line-height:18px; }
55
58
  button.tab-title, button.queue-title { flex:1; min-width:0; width:100%; padding:0; border:0; border-radius:2px; background:transparent; color:inherit; text-align:left; font-size:12px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; cursor:pointer; }
56
59
  button.queue-title { font-size:10px; }
@@ -1,4 +1,4 @@
1
- import {readKeptSites, setStoredSite, compactQueue, readMenuWorkspaces} from './popup-data.mjs';
1
+ import {readKeptSites, setStoredSite, compactQueue, queueStatusText, readMenuWorkspaces} from './popup-data.mjs';
2
2
  const el = id => document.getElementById(id);
3
3
  el('extension-version').textContent = `v${chrome.runtime.getManifest().version}`;
4
4
  let confirming = false;
@@ -164,10 +164,18 @@ function renderQueue(items, busy, connected) {
164
164
  const shown=view.visible;
165
165
  const signature=JSON.stringify({shown:shown.map(item=>[item.id,item.platform,item.thread_id,item.title,item.url,item.state,item.attempts]),
166
166
  total:view.total,threads:view.threads,hidden:view.hidden,uncertain:view.uncertain,blocked:view.blocked,
167
- behind:[...view.behind],busy,connected,queueExpanded});
167
+ behind:[...view.behind],relations:shown.map(item=>[item.id,view.headFor.get(item.id)?.id,view.headFor.get(item.id)?.state]),busy,connected,queueExpanded});
168
168
  if (signature===lastQueueSignature) return;
169
169
  lastQueueSignature=signature;
170
170
  const target=el('queue-list');
171
+ const platformCounts=new Map();
172
+ for (const item of items) {
173
+ const platform=String(item.platform||'Queue');
174
+ if(!platformCounts.has(platform))platformCounts.set(platform,{total:0,threads:new Set()});
175
+ const stat=platformCounts.get(platform);
176
+ stat.total++;
177
+ stat.threads.add(item.thread_id||item.id);
178
+ }
171
179
  target.hidden=!items.length;
172
180
  queueToggle.hidden=!(queueExpanded || view.hidden>0);
173
181
  queueToggle.textContent=queueExpanded?'Show less':'Show all '+view.total;
@@ -198,9 +206,14 @@ function renderQueue(items, busy, connected) {
198
206
  const heading=document.createElement('strong');heading.className='queue-platform-title';
199
207
  heading.textContent=platform==='Queue'?'Queue':`${platform} Queue`;
200
208
  const rows=document.createElement('div');rows.className='queue-platform-rows';
201
- header.append(heading);
209
+ const count=document.createElement('span');count.className='queue-platform-count';
210
+ header.append(heading,count);
202
211
  group.append(header,rows);queueGroups.set(platform,group);target.append(group);
203
212
  }
213
+ const stats=platformCounts.get(platform);
214
+ group.querySelector('.queue-platform-count').textContent=stats.threads.size+
215
+ (stats.threads.size===1?' thread':' threads')+' · '+stats.total+
216
+ (stats.total===1?' message':' messages');
204
217
  if(platform===grouped.keys().next().value)group.querySelector('.queue-platform-header').append(queueToggle);
205
218
  for (const item of entries) {
206
219
  const key=`${platform}:${item.id}`;
@@ -214,7 +227,12 @@ function renderQueue(items, busy, connected) {
214
227
  },'queue-title');
215
228
  const detail=document.createElement('span');detail.className='queue-detail';
216
229
  const remove=actionButton('×',false,async()=>{
217
- try {const result=await rpc('workspace.control.queueCancel',{queueId:item.id});if(!result.id)throw Error('Missing queue request ID');el('message').textContent='Waiting for WebHelm daemon…';}
230
+ try {
231
+ if(row.dataset.state==='UNCERTAIN' && !confirm('Delivery is unconfirmed. This message may already be in ChatGPT. Removing it cannot unsend it and will unblock later messages in this thread. Remove it?'))return;
232
+ const result=await rpc('workspace.control.queueCancel',{queueId:item.id});
233
+ if(!result.id)throw Error('Missing queue request ID');
234
+ el('message').textContent='Waiting for WebHelm daemon…';
235
+ }
218
236
  catch(error){el('message').textContent=error.message;}
219
237
  refresh();
220
238
  },'queue-remove');
@@ -224,17 +242,23 @@ function renderQueue(items, busy, connected) {
224
242
  title.textContent=item.title||`${platform} message`;
225
243
  title.title=item.title||`${platform} message`;
226
244
  title.disabled=!connected||!item.url;
227
- const attempts=Number(item.attempts)||0;
228
- const more=!queueExpanded ? (view.behind.get(item.id)||0) : 0;
229
- row.querySelector('.queue-detail').textContent=`${String(item.state||'queued').toLowerCase()} · ${attempts} attempt${attempts===1?'':'s'}`+
230
- (more ? ` · ${more} more in this thread` : '');
245
+ row.dataset.state=item.state;
246
+ const head=view.headFor.get(item.id)||item;
247
+ const following=head.id!==item.id;
248
+ row.classList.toggle('queue-followup',following);
249
+ const detail=row.querySelector('.queue-detail');
250
+ detail.textContent=queueStatusText(item,{head,remaining:!queueExpanded?(view.behind.get(item.id)||0):0});
251
+ detail.classList.toggle('queue-warning',item.state==='UNCERTAIN' || (following && head.state==='UNCERTAIN'));
231
252
  const remove=row.querySelector('button:last-child');
232
253
  const safe=['QUEUED','WAITING','BLOCKED','UNCERTAIN'].includes(item.state);
233
254
  remove.disabled=!safe||busy||!connected;
234
255
  remove.title=safe?'Remove '+title.textContent+' from queue':'Cannot remove a running or completed submission';
235
256
  remove.setAttribute('aria-label',remove.title);
236
- row.querySelector('.queue-detail').title=['UNCERTAIN','BLOCKED'].includes(item.state)
237
- ? 'Verify the submission before retrying; later turns in the thread may be waiting.' : '';
257
+ detail.title=item.state==='UNCERTAIN'
258
+ ? 'A send was attempted but no delivery receipt was confirmed. The message may already be in ChatGPT; it will not be retried automatically.'
259
+ : following && head.state==='UNCERTAIN'
260
+ ? 'This message has not been sent. It waits until the earlier unconfirmed send is resolved.'
261
+ : '';
238
262
  const rows=group.querySelector('.queue-platform-rows');
239
263
  if(row.parentElement!==rows)rows.append(row);
240
264
  }