@tomflow/chatloop-extension 0.3.65 → 0.3.66

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
@@ -14,6 +14,8 @@
14
14
 
15
15
  **0.3.65 Start 只读诊断(源码候选)**:当真实 Chrome Start 创建了首页标签,但返回 `NEW_CHAT_NOT_READY` 时,Status 读取精确 Session 的未确认标签资源;经原 Native Session 一致性校验,仅返回当前 URL 类型、DOM 加载阶段、可见 main 数、输入框数量/可见性/编辑性/空状态及消息节点数量,**不读取消息正文、不点击、不重新发送、不转移 Owner**。此诊断用于区分页面未水合与选择器失效,不能把该状态当作 `NOT_SENT`。专项回归测试对未知 Tab 和跨 Session 标签均拒绝归属。
16
16
 
17
+ **0.3.66 Start/清理动作修复(源码候选)**:真实 Chrome `0.3.65` Status 确认失败 Start 的新首页 `mainCount=1/editorVisible=true/editorEditable=true/messageNodeCount=0`,唯一不满足的是 `editorEmpty=false`。新版 Start 会立即返回 `START_COMPOSER_NOT_EMPTY`,不再等待 90s;原 Clean Action 精确允许 `BLOCKED` Start 所登记的未确认首页,在核实同一 tab ID、失败原因和原首页后只清理输入框(不发送、不清理其他 Chat)。专项负例覆盖外来 tab、非终态、缺少失败原因及导航变更,不能自动重发旧 UNKNOWN。
18
+
17
19
  **验收边界**:离线源码回归不等于已安装 Chrome 真机通过;正式安装包的 Owner、资源配额及受控发送需要独立实测,不能用旧版证据替代。
18
20
 
19
21
  Chrome 扩展(9 个独立 Action,含 Status / Start)及其独立 CLI / Native Messaging Host。执行前先看 Help:
@@ -12,7 +12,13 @@ function targetAuthorized(tab,run,machine,own){
12
12
  if(tab.id===own.id)throw Error('CLEAN_SELF_TARGET');
13
13
  if(machine){
14
14
  const owner=run?.tabId===tab.id && tab.url==='https://chatgpt.com'+run?.page;
15
- if(!owner)throw Error('CLEAN_MACHINE_TARGET_NOT_OWNED');
15
+ // This exact unconfirmed START home has no Chat Owner yet. The machine
16
+ // may clear its composer only after a terminal readiness failure.
17
+ const failedStartHome=run?.phase==='BLOCKED'&&run.action==='START'
18
+ &&run.attemptedNewTabId===tab.id&&tab.url==='https://chatgpt.com/'
19
+ &&['NEW_CHAT_NOT_READY','START_COMPOSER_NOT_EMPTY']
20
+ .includes(run.lastStartFailureCode);
21
+ if(!owner&&!failedStartHome)throw Error('CLEAN_MACHINE_TARGET_NOT_OWNED');
16
22
  if(run && !['DONE','BLOCKED'].includes(run.phase))
17
23
  throw Error('CLEAN_ACTIVE_LOOP_DENIED');
18
24
  }else{
@@ -32,10 +32,15 @@ async function newChatReady(id){
32
32
  const mains=[...document.querySelectorAll('main')].filter(visible);
33
33
  const editor=document.querySelector('[contenteditable="true"][data-composer-markdown]')
34
34
  ||document.querySelector('#prompt-textarea[contenteditable="true"]');
35
- return location.origin==='https://chatgpt.com'&&location.pathname==='/'&&mains.length===1
36
- &&visible(editor)&&!(editor.innerText||editor.textContent||'').trim()
37
- &&!mains[0].querySelector('[data-chatgpt-search-message-ids],[data-message-author-role]');
35
+ if(location.origin!=='https://chatgpt.com'||location.pathname!=='/'
36
+ ||mains.length!==1||!visible(editor)
37
+ ||mains[0].querySelector('[data-chatgpt-search-message-ids],[data-message-author-role]'))
38
+ return false;
39
+ return (editor.innerText||editor.textContent||'').trim()
40
+ ?'START_COMPOSER_NOT_EMPTY':true;
38
41
  }}),Math.min(1500,deadline-Date.now()));
42
+ if(result?.[0]?.result==='START_COMPOSER_NOT_EMPTY')
43
+ throw Error('START_COMPOSER_NOT_EMPTY');
39
44
  if(result?.[0]?.result===true)return;
40
45
  }
41
46
  await pause(Math.min(420,Math.max(1,deadline-Date.now())));
@@ -212,7 +217,8 @@ async function run(){
212
217
  // This is diagnostics only; it does NOT authorize a retry or prove a
213
218
  // message was never sent. Keep the existing fail-closed Owner semantics.
214
219
  const failureCode=['START_HOME_URL_UNVERIFIED','NEW_CHAT_NOT_READY',
215
- 'FIRST_TURN_OBSERVER_UNAVAILABLE'].includes(e.message) ? e.message : null;
220
+ 'START_COMPOSER_NOT_EMPTY','FIRST_TURN_OBSERVER_UNAVAILABLE']
221
+ .includes(e.message) ? e.message : null;
216
222
  await chrome.runtime.sendMessage({type:'CHAT_LOOP_SESSION_START_RESULT_V1',
217
223
  requestId:id,token:prepared.token,result:'UNVERIFIED',newTabId:newTab?.id,
218
224
  ...(failureCode?{failureCode}:{})}).catch(()=>{});
@@ -485,7 +485,8 @@ async function sessionStartResult(message,sender){
485
485
  lastStartActionTabId:sender.tab.id,
486
486
  reason:confirmed?'':adopted?'ADOPTION_UNVERIFIED':'START_SEND_UNVERIFIED',
487
487
  ...(!confirmed&&['START_HOME_URL_UNVERIFIED','NEW_CHAT_NOT_READY',
488
- 'FIRST_TURN_OBSERVER_UNAVAILABLE'].includes(message.failureCode)
488
+ 'START_COMPOSER_NOT_EMPTY','FIRST_TURN_OBSERVER_UNAVAILABLE']
489
+ .includes(message.failureCode)
489
490
  ?{lastStartFailureCode:message.failureCode}:{}),
490
491
  ...(confirmed?{tabId:message.newTabId,page:message.newPage,
491
492
  newUserKey:message.newUserKey}:{attemptedNewTabId:Number.isInteger(message.newTabId)?message.newTabId:null})};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Chat Loop Extension",
4
- "version": "0.3.65",
4
+ "version": "0.3.66",
5
5
  "description": "Chat Loop browser companion: Eye actions, Turn observer, Continue and Handoff Actions",
6
6
  "permissions": [
7
7
  "activeTab",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/chatloop-extension",
3
- "version": "0.3.65",
3
+ "version": "0.3.66",
4
4
  "type": "module",
5
5
  "description": "Chat Loop Extension package: nine formal Action pages and its own native CLI bridge",
6
6
  "bin": {