@tomflow/chatloop-extension 0.3.81 → 0.3.82
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 +23 -7
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
package/extension/background.js
CHANGED
|
@@ -1250,11 +1250,18 @@ async function onAdoptKickoffPrepare(message,sender){
|
|
|
1250
1250
|
||disk.session.phase!=='WAITING_REPLY'
|
|
1251
1251
|
||disk.session.updatedAt!==message.nativeUpdatedAt)
|
|
1252
1252
|
return {status:'DENIED',code:'ADOPT_KICKOFF_NATIVE_CHANGED'};
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1253
|
+
// run.snapshot requires a business checkpoint. A freshly adopted Task has
|
|
1254
|
+
// no checkpoint yet, so use the existing read-only live terminalStatus
|
|
1255
|
+
// which verifies the current bound holder without inventing one.
|
|
1256
|
+
const status=await chrome.runtime.sendNativeMessage(SESSION_HOST,{
|
|
1257
|
+
op:'context-control',command:'run.terminalStatus',args:{}}).catch(()=>null);
|
|
1258
|
+
if(status?.status!=='OK'
|
|
1259
|
+
||status.result?.runRef!==run.sessionId+':'+run.taskId+':0'
|
|
1260
|
+
||!Number.isSafeInteger(status.result?.approvalRevision)
|
|
1261
|
+
||status.result.approvalRevision<1
|
|
1262
|
+
||status.result?.unknownEffectCount!==0
|
|
1263
|
+
||status.result?.executionOutcome==='DONE'
|
|
1264
|
+
||status.result?.deliveryRef)
|
|
1258
1265
|
return {status:'DENIED',code:'ADOPT_KICKOFF_CONTEXT_UNVERIFIED'};
|
|
1259
1266
|
const exactId=chatIdOf(tab.url);
|
|
1260
1267
|
const read=async()=>{
|
|
@@ -1656,11 +1663,20 @@ async function onTake(message, sender) {
|
|
|
1656
1663
|
status:run.action==="HANDOFF"&&run.modelIntent.action==="CONTINUE"
|
|
1657
1664
|
?"OVERRIDDEN_BY_DEADLINE":"PENDING"}) : pending);
|
|
1658
1665
|
if(run.action==="CONTINUE" &&run.contextManaged &&!recoveredContext &&run.retryMode!=="NATIVE"){
|
|
1659
|
-
|
|
1666
|
+
let snapshot=await chrome.runtime.sendNativeMessage(SESSION_HOST,{
|
|
1660
1667
|
op:"context-control",command:"run.snapshot",args:{}}).catch(()=>null);
|
|
1668
|
+
// First controlled Continue may precede the FIRST business checkpoint.
|
|
1669
|
+
// Only a proven CHECKPOINT_NOT_FOUND may use the current live task/run
|
|
1670
|
+
// projection. Network errors and all other snapshot failures stay BLOCKED.
|
|
1671
|
+
if(snapshot?.status!=="OK"&&snapshot?.code==="CHECKPOINT_NOT_FOUND")
|
|
1672
|
+
snapshot=await chrome.runtime.sendNativeMessage(SESSION_HOST,{
|
|
1673
|
+
op:"context-control",command:"run.terminalStatus",args:{}}).catch(()=>null);
|
|
1661
1674
|
const cp=snapshot?.result;
|
|
1662
1675
|
if(snapshot?.status!=="OK"||!cp ||cp.runRef!==
|
|
1663
|
-
run.sessionId+":"+run.taskId+":"+(run.generation||0)
|
|
1676
|
+
run.sessionId+":"+run.taskId+":"+(run.generation||0)
|
|
1677
|
+
||!Number.isSafeInteger(cp.taskRevision)||cp.taskRevision<1
|
|
1678
|
+
||!Number.isSafeInteger(cp.approvalRevision)||cp.approvalRevision<1
|
|
1679
|
+
||cp.unknownEffectCount!==0||cp.executionOutcome==="DONE"){
|
|
1664
1680
|
await saveRun({...pending,phase:"BLOCKED",reason:"CONTEXT_CONTINUE_SNAPSHOT_UNVERIFIED"});
|
|
1665
1681
|
return {status:"DENIED",code:"CONTEXT_CONTINUE_SNAPSHOT_UNVERIFIED"};
|
|
1666
1682
|
}
|
package/extension/manifest.json
CHANGED