@tomflow/chatloop-extension 0.3.70 → 0.3.73
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 +4 -0
- package/extension/actions/start.js +13 -8
- package/extension/background.js +8 -0
- package/extension/loop/observer.js +8 -0
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
|
|
23
23
|
**0.3.70 失败 Start 的只读 Eye 取证(含临时地址严格匹配修正)**:在 `FIRST_SEND_RECEIPT_UNKNOWN` 导致 `BLOCKED` 且 Native 未绑定 Chat Owner 时,原有 `chat_text/chat_dom/chat_screenshot` 只允许检查**同一 Session 资源登记的未确认 Start 标签页**;需原提示词 SHA-256 指纹与恰好一条独立用户消息 ID 匹配,且 DOM 路径和 Chrome 标签 URL 再次一致。其他 Project、未登记资源、重复匹配、页面漂移、来源不符均拒绝。此权限仅用于证据读取,**不更改 Owner、不宣称消息送达、不允许 Continue/Handoff、不重发**。Screenshot Action 会短暂激活该精确标签以取真正的可见 PNG,不新建测试聊天;正式 E2E 必须将页面 Text/DOM/Screenshot 与 Native 和 Trace 一起核对。
|
|
24
24
|
|
|
25
|
+
**0.3.71 账号切换故障诊断**:失败 Start 的精确未确认标签页只读检查 ChatGPT 页面显式账号切换错误,返回 `startReadinessEvidence.readiness.uiErrorCode=ACCOUNT_SWITCHED_RETRY_REQUIRED`。该值只代表页面提示(不泄漏用户正文),不能推定是否已送达,不释放 BLOCKED Owner、不重发或点击重试;没有错误或提示仅在用户消息正文时为 `null`。本地源码通过测试后仍须验证已安装 Chrome Worker 的 Status,未部署不得声称实站通过。
|
|
26
|
+
|
|
27
|
+
**0.3.72 首轮发送回执窗口(源码候选)**:首次点击只执行一次;随后仅做最多 120 秒、最多 200 次的有界只读检查,允许临时 `local-chatgpt` 地址延迟转成正式 `/c/<Chat ID>`,避免旧 90 次约 38 秒窗口过早将慢成功判为 UNKNOWN。`tabs.get` 和 DOM 读取各自有 1.2 秒超时,整体仍低于原 330 秒 Worker 看门狗。窗口结束仍无匹配的正式 Chat ID 与原用户消息身份,必须保持 `FIRST_SEND_RECEIPT_UNKNOWN/BLOCKED`;不会重发、自动刷新或追认旧 Session。
|
|
28
|
+
|
|
25
29
|
**验收边界**:离线源码回归不等于已安装 Chrome 真机通过;正式安装包的 Owner、资源配额及受控发送需要独立实测,不能用旧版证据替代。
|
|
26
30
|
|
|
27
31
|
Chrome 扩展(9 个独立 Action,含 Status / Start)及其独立 CLI / Native Messaging Host。执行前先看 Help:
|
|
@@ -103,12 +103,17 @@ async function sendFirst(id,text){
|
|
|
103
103
|
},args:[text]});
|
|
104
104
|
if(clicked?.result?.clickedOnce!==true)
|
|
105
105
|
throw Error(clicked?.result?.reason||'START_CLICK_UNVERIFIED');
|
|
106
|
-
// Once clicked: read-only receipt
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
// Once clicked: ONLY bounded read-only receipt probes. A provisional
|
|
107
|
+
// local-chatgpt URL can settle late; never retry typing or clicking.
|
|
108
|
+
// Keep even the worst-case read budget below the 330s Worker watchdog,
|
|
109
|
+
// including the preceding 90s cold-page readiness window.
|
|
110
|
+
const deadline=Date.now()+120_000;
|
|
111
|
+
for(let i=0;i<200&&Date.now()<deadline;i++){
|
|
112
|
+
const tab=await boundedRead(()=>chrome.tabs.get(id),
|
|
113
|
+
Math.min(1200,Math.max(1,deadline-Date.now())));
|
|
109
114
|
const page=tab?.url&&new URL(tab.url).pathname;
|
|
110
115
|
if(/^\/c\/[0-9a-f-]{12,}$/i.test(page||'')){
|
|
111
|
-
const
|
|
116
|
+
const rows=await boundedRead(()=>chrome.scripting.executeScript({target:{tabId:id},func:expected=>{
|
|
112
117
|
const visible=e=>Boolean(e?.getClientRects?.().length);
|
|
113
118
|
const mains=[...document.querySelectorAll('main')].filter(visible);
|
|
114
119
|
if(mains.length!==1)return null;
|
|
@@ -124,11 +129,11 @@ async function sendFirst(id,text){
|
|
|
124
129
|
const canonical=v=>String(v||'').replace(/\s+/g,'');
|
|
125
130
|
return id&&canonical(bubble?.innerText||bubble?.textContent)===canonical(expected)
|
|
126
131
|
?{userKey:'user:'+id}:null;
|
|
127
|
-
},args:[text]}).
|
|
128
|
-
if(
|
|
129
|
-
newPage:page,newTabId:id};
|
|
132
|
+
},args:[text]}),Math.min(1200,Math.max(1,deadline-Date.now())));
|
|
133
|
+
if(rows?.[0]?.result?.userKey)return {status:'SENT_CONFIRMED',
|
|
134
|
+
newUserKey:rows[0].result.userKey,newPage:page,newTabId:id};
|
|
130
135
|
}
|
|
131
|
-
await pause(420);
|
|
136
|
+
await pause(Math.min(420,Math.max(1,deadline-Date.now())));
|
|
132
137
|
}
|
|
133
138
|
throw Error('FIRST_SEND_RECEIPT_UNKNOWN');
|
|
134
139
|
}
|
package/extension/background.js
CHANGED
|
@@ -636,7 +636,15 @@ async function startReadinessEvidence(run){
|
|
|
636
636
|
if(digest===expectedDigest)matched.push(user);
|
|
637
637
|
}
|
|
638
638
|
const key=(prefix,node)=>node&&messageId(node)?prefix+messageId(node):null;
|
|
639
|
+
// Diagnostic only: an account-switch error can leave a local-chatgpt
|
|
640
|
+
// user bubble visible without any server-confirmed first send.
|
|
641
|
+
// Never infer NOT_SENT or a retry permit from this UI text.
|
|
642
|
+
const switched=/你的账户已切换[。.!!\s]*请重新发送消息|your account (?:has been |was )?switched[.!\s]*please (?:re-?send|send again) (?:your )?message/i;
|
|
643
|
+
const inUserMessage=users.some(n=>switched.test(n.innerText||n.textContent||''));
|
|
644
|
+
const accountSwitchVisible=!inUserMessage&&mains.some(m=>
|
|
645
|
+
switched.test(m.innerText||m.textContent||''));
|
|
639
646
|
return {path:location.pathname,readyState:document.readyState,
|
|
647
|
+
uiErrorCode:accountSwitchVisible?'ACCOUNT_SWITCHED_RETRY_REQUIRED':null,
|
|
640
648
|
mainCount:mains.length,editorCount:editors.length,
|
|
641
649
|
editorVisible:Boolean(editor),editorEditable:Boolean(editor?.isContentEditable),
|
|
642
650
|
editorEmpty:editor?!(editor.innerText||editor.textContent||'').trim():null,
|
|
@@ -559,6 +559,14 @@
|
|
|
559
559
|
fail("APPROVAL_REQUIREMENTS_MISSING");return false;
|
|
560
560
|
}
|
|
561
561
|
const rAssistant=rows[rIndex-1],rUser=rows[rIndex];
|
|
562
|
+
// Only document-level TEST_ONLY markers deny production adoption:
|
|
563
|
+
// normal P plans can legitimately mention test-only scenarios.
|
|
564
|
+
const testOnlyReview=x=>
|
|
565
|
+
/(?:^|\n)\s*(?:#{1,6}\s*|>\s*)?(?:\*\*)?TEST_ONLY(?:\*\*)?(?:\s*$|\s*[/||:]\s*NOT_APPROVED)/mi
|
|
566
|
+
.test(textOf(x));
|
|
567
|
+
if(testOnlyReview(rAssistant)||testOnlyReview(pAssistant)){
|
|
568
|
+
fail("APPROVAL_TEST_ONLY");return false;
|
|
569
|
+
}
|
|
562
570
|
if(!/(?:需求|范围|验收)/.test(textOf(rAssistant))
|
|
563
571
|
|| !/\bR[1-9][0-9]*\b/i.test(textOf(rAssistant))) {
|
|
564
572
|
fail("APPROVAL_REQUIREMENTS_MISSING");return false;
|
package/extension/manifest.json
CHANGED