@tomflow/chatloop-extension 0.3.83 → 0.3.84
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/background.js +14 -0
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
package/extension/background.js
CHANGED
|
@@ -383,6 +383,20 @@ async function sessionStartPrepare(message,sender){
|
|
|
383
383
|
if(matchingBlocked&&(!disk.session||disk.session.phase!=='BLOCKED'
|
|
384
384
|
||disk.session.sessionId!==replace||disk.session.projectId!==prior.projectId))
|
|
385
385
|
return {status:'DENIED',code:'SESSION_REPLACEMENT_MISMATCH'};
|
|
386
|
+
// An abandoned Managed Context writer can outlive its Browser Owner.
|
|
387
|
+
// Replacing the Native session without first verifying its terminal fence
|
|
388
|
+
// would strand a live runRef (and an old write credential) in the Store.
|
|
389
|
+
// Never make that replacement based solely on BLOCKED or absent Owner.
|
|
390
|
+
if(matchingBlocked&&prior.contextManaged){
|
|
391
|
+
const terminal=await chrome.runtime.sendNativeMessage(SESSION_HOST,{
|
|
392
|
+
op:'context-control',command:'run.terminalStatus',args:{}}).catch(()=>null);
|
|
393
|
+
const state=terminal?.result;
|
|
394
|
+
if(terminal?.status!=='OK'||!state
|
|
395
|
+
||state.projectId!==prior.projectId||state.taskId!==prior.taskId
|
|
396
|
+
||state.runRef!==null||state.executionOutcome!=='DONE'
|
|
397
|
+
||typeof state.deliveryRef!=='string'||!state.deliveryRef)
|
|
398
|
+
return {status:'DENIED',code:'CONTEXT_BLOCKED_RUN_UNFENCED'};
|
|
399
|
+
}
|
|
386
400
|
if(disk.session&&disk.session.phase!=='DONE'&&!matchingBlocked)
|
|
387
401
|
return {status:'DENIED',code:'SESSION_ALREADY_ACTIVE'};
|
|
388
402
|
const capacity=await resources.admit(prior,{kind:intent.mode==='adopt'?'action':'chat'});
|
package/extension/manifest.json
CHANGED