@tomflow/chatloop-extension 0.3.58 → 0.3.60
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 +2 -0
- package/extension/background.js +1 -1
- package/extension/loop/resources.js +15 -6
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,6 +60,8 @@ Clean 只清空输入框,不发送,不更改 Owner;必须指定精确标
|
|
|
60
60
|
|
|
61
61
|
**可视化消息定位(0.3.58)**:真实 Chat 若因历史片段挂载而无法从当前 DOM 验证最新 BLOCKED Turn,不允许依赖旧消息直接 Continue。正式 Status 仅在真实 Owner tab URL 已核实且为 WAITING_REPLY/BLOCKED 时,于 diagnostics 返回只作定位用的 ownerTabId,绝非发送凭证。只有操作员明确打开原内置 Continue Action 并提供精确 tabId 与 Native 最新 updatedAt(resumeBlockedAt),Worker 才能只读核验原 Session/Chat/generation、BLOCKED 类型、独立故障、精确 tab/URL、正式 Action 来源和 Native CAS;核验通过后**仅由 Action 页**尝试滚动原 Chat 到最新挂载区。不更新 Worker 或 Native 会话状态,不点击提交。随后仍要求原有两次稳定最新 user/assistant 身份、无待审批表单和唯一发送许可;任何滚动/身份/状态不明均 fail-closed。普通 Continue/Handoff 与其它 Chat 不触发此行为,不能以滚动成功宣称业务恢复。
|
|
62
62
|
|
|
63
|
+
**终态历史 Chat 的资源配额(0.3.60)**:资源库存保留已结束的 Chat 标签与证据,但 DONE/BLOCKED 的旧 Session 不再占用新任务“活动 Owner + Handoff 继任者”两席配额,不关闭用户 Chat。已从 BLOCKED 受控恢复、仍是同一个活动 Session 的 Chat 必须重新占用活动配额;未知来源首页、未确认发送和未结束 Chat 仍计入限制并安全拒绝。该修正只影响资源准入计数,不改变 Native/Worker Owner、审批或消息发送权限。
|
|
64
|
+
|
|
63
65
|
## 原 Owner 的有界技术恢复
|
|
64
66
|
|
|
65
67
|
Worker仍是唯一发送裁决者,Native会话文件只是带身份校验的持久投影。正式Status返回当前Session/Chat及有限diagnostics(版本、失败码、消息身份、恢复预算、执行时钟),不返回发送token或任务正文;终态BLOCKED的Eye可只读检查同一个已确认Owner,不获得发送权。
|
package/extension/background.js
CHANGED
|
@@ -182,7 +182,7 @@ async function resourceChatGate(message,sender) {
|
|
|
182
182
|
|| !await resources.registerChat(tab,run))
|
|
183
183
|
return {status:'DENIED',code:'RESOURCE_CHAT_NOT_VERIFIED'};
|
|
184
184
|
const inventory=await resources.reconcile(run);
|
|
185
|
-
if(inventory.
|
|
185
|
+
if(inventory.activeChatCount>resources.CHAT_LIMIT)
|
|
186
186
|
return {status:'DENIED',code:'RESOURCE_CHAT_LIMIT'};
|
|
187
187
|
return {status:'OK',code:'RESOURCE_CHAT_REGISTERED'};
|
|
188
188
|
}
|
|
@@ -140,8 +140,17 @@
|
|
|
140
140
|
const after=await chrome.tabs.query({});
|
|
141
141
|
const actionCount=after.filter(t=>classify(t)).length;
|
|
142
142
|
const afterIds=new Set(after.map(t=>t.id));
|
|
143
|
-
const
|
|
144
|
-
&& afterIds.has(e.id))
|
|
143
|
+
const liveChatEntries=state.entries.filter(e=>e.kind==='chat'
|
|
144
|
+
&& afterIds.has(e.id));
|
|
145
|
+
const chatCount=liveChatEntries.length;
|
|
146
|
+
// The quota is for in-flight Owners and a Handoff successor, not for
|
|
147
|
+
// retained historical Chat tabs. Keep terminal provenance and the tabs;
|
|
148
|
+
// neither is permission to send. A recovered same-Session Owner counts
|
|
149
|
+
// again even when its ledger still records an earlier BLOCKED phase.
|
|
150
|
+
const activeChatCount=liveChatEntries.filter(e=>
|
|
151
|
+
!['DONE','BLOCKED'].includes(e.terminal)
|
|
152
|
+
||(e.sessionId===(run?.sessionId||run?.token)
|
|
153
|
+
&&!['DONE','BLOCKED'].includes(run?.phase))).length;
|
|
145
154
|
const unownedHomes=after.filter(t=>t.url==='https://chatgpt.com/'
|
|
146
155
|
&& !state.entries.some(e=>e.kind==='chat'&&e.id===t.id)).length;
|
|
147
156
|
state.peakActions=Math.max(state.peakActions,actionCount);
|
|
@@ -154,14 +163,14 @@
|
|
|
154
163
|
state.entries=[...chatEntries,...(slots?actionEntries.slice(-slots):[])];
|
|
155
164
|
// Native/manual pages remain counted directly from the browser snapshot.
|
|
156
165
|
state.current={actions:actionCount,chats:chatCount,
|
|
157
|
-
unownedHomes,totalTabs:after.length,at:now};
|
|
166
|
+
activeChats:activeChatCount,unownedHomes,totalTabs:after.length,at:now};
|
|
158
167
|
await save(state);
|
|
159
|
-
return {state,actionCount,chatCount,unownedHomes};
|
|
168
|
+
return {state,actionCount,chatCount,activeChatCount,unownedHomes};
|
|
160
169
|
}
|
|
161
170
|
async function admit(run,{kind='action'}={}) {
|
|
162
|
-
const {state,actionCount,chatCount,unownedHomes}=await reconcile(run);
|
|
171
|
+
const {state,actionCount,chatCount,activeChatCount,unownedHomes}=await reconcile(run);
|
|
163
172
|
const blocked=actionCount+(kind==='action'?1:0)>ACTION_LIMIT
|
|
164
|
-
? 'RESOURCE_ACTION_LIMIT' :
|
|
173
|
+
? 'RESOURCE_ACTION_LIMIT' : activeChatCount+unownedHomes+(kind==='chat'?1:0)>CHAT_LIMIT
|
|
165
174
|
? 'RESOURCE_CHAT_LIMIT' : null;
|
|
166
175
|
if (blocked) {
|
|
167
176
|
state.denied++;state.lastDenial={code:blocked,at:Date.now()};
|
package/extension/manifest.json
CHANGED