@tomflow/chatloop-extension 0.4.37 → 0.4.38
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/extension/manifest.json
CHANGED
|
@@ -103,6 +103,21 @@ async function startReadinessEvidence(run){
|
|
|
103
103
|
...(result&&typeof result.mainCount==='number'?{readiness:result}:{})};
|
|
104
104
|
}
|
|
105
105
|
// TEST_ONLY is an independent native @ App first-turn, never a managed Owner.
|
|
106
|
+
// An old Native CANCELLED pointer is harmless only when its own Context
|
|
107
|
+
// independently confirms the precise terminal fence and no unknown effects.
|
|
108
|
+
// Never rewrite the stale V1 Worker projection to make this admission pass.
|
|
109
|
+
async function verifiedCancelledLegacyPointer(record){
|
|
110
|
+
if(record?.phase!=='CANCELLED')return false;
|
|
111
|
+
const checked=await chrome.runtime.sendNativeMessage(SESSION_HOST,{
|
|
112
|
+
op:'context-control',command:'run.terminalStatus',args:{}
|
|
113
|
+
}).catch(()=>null);
|
|
114
|
+
const state=checked?.result,closed=state?.sessionCancellation;
|
|
115
|
+
return checked?.status==='OK'&&state?.runRef===null
|
|
116
|
+
&&state.unknownEffectCount===0&&state.pendingHandoff===false
|
|
117
|
+
&&closed?.status==='CANCELLED_NOT_DELIVERED'
|
|
118
|
+
&&closed.sessionId===record.sessionId
|
|
119
|
+
&&closed.generation===record.generation;
|
|
120
|
+
}
|
|
106
121
|
// A frozen BLOCKED run with a lost Owner tab must not disable ordinary first-
|
|
107
122
|
// turn testing forever. Keep its Native pointer untouched: this read-only
|
|
108
123
|
// gate checks both authorities and denies any live/unknown Owner transition.
|
|
@@ -115,11 +130,27 @@ async function entryTestAdmission(message,sender){
|
|
|
115
130
|
const run=await readRun(),record=disk.session;
|
|
116
131
|
if(!run?.sessionId){
|
|
117
132
|
return !record||record.phase==='DONE'
|
|
133
|
+
||await verifiedCancelledLegacyPointer(record)
|
|
118
134
|
?{status:'OK',scope:'TEST_ONLY'}
|
|
119
135
|
:{status:'DENIED',code:'ENTRY_TEST_OWNER_UNVERIFIED'};
|
|
120
136
|
}
|
|
121
|
-
if(!matchesNativeProjection(sessionProjection(run),record))
|
|
137
|
+
if(!matchesNativeProjection(sessionProjection(run),record)){
|
|
138
|
+
// A terminal Native/Context pointer may belong to a different, older V1
|
|
139
|
+
// Task than the stale Worker snapshot. TEST_ONLY sends no managed Owner
|
|
140
|
+
// actions; admit only if the Worker is terminal/frozen and its old Chat is
|
|
141
|
+
// not open. A live Worker or ambiguous Native fence still fails closed.
|
|
142
|
+
if(['BLOCKED','DONE','CANCELLED'].includes(run.phase)
|
|
143
|
+
&&!run.handoffPending&&await verifiedCancelledLegacyPointer(record)){
|
|
144
|
+
const tabs=await chrome.tabs.query({url:'https://chatgpt.com/*'})
|
|
145
|
+
.catch(()=>null);
|
|
146
|
+
const oldChatId=typeof run.page==='string'
|
|
147
|
+
?chatIdOf('https://chatgpt.com'+run.page):null;
|
|
148
|
+
if(Array.isArray(tabs)&&(!oldChatId
|
|
149
|
+
||!tabs.some(t=>chatIdOf(t.url)===oldChatId)))
|
|
150
|
+
return {status:'OK',scope:'TEST_ONLY',mode:'FENCED_LEGACY_DRIFT'};
|
|
151
|
+
}
|
|
122
152
|
return {status:'DENIED',code:'ENTRY_TEST_OWNER_MISMATCH'};
|
|
153
|
+
}
|
|
123
154
|
if(run.phase==='DONE')
|
|
124
155
|
return !run.contextManaged||run.taskId&&terminalFenceVerified(run)
|
|
125
156
|
?{status:'OK',scope:'TEST_ONLY'}
|