@tomflow/chatloop-extension 0.4.47 → 0.4.48
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
|
@@ -64,6 +64,30 @@ const onScopedBrowserMessage=(message,sender,reply)=>{
|
|
|
64
64
|
// Project grant before returning even bounded status metadata.
|
|
65
65
|
const native=await chrome.runtime.sendNativeMessage(SESSION_HOST,{
|
|
66
66
|
op:'context-status-v2',sourceRequestId:message.requestId});
|
|
67
|
+
if(native?.status==='OK'
|
|
68
|
+
&&native.scope==='TASK_SCOPED_PRESTART_READ_ONLY'
|
|
69
|
+
&&native.projectId===intent.projectId
|
|
70
|
+
&&native.taskId===intent.taskId){
|
|
71
|
+
const before=await scopedTaskRuns.get(intent.projectId,intent.taskId);
|
|
72
|
+
if(before.run)throw Error('SCOPED_PRESTART_WORKER_DRIFT');
|
|
73
|
+
// Existing no-URL admission: inspect open Chats only, never send.
|
|
74
|
+
const found=await approvedAdoptionTarget(null,intent.taskId);
|
|
75
|
+
const after=await scopedTaskRuns.get(intent.projectId,intent.taskId);
|
|
76
|
+
const n=await chrome.runtime.sendNativeMessage(SESSION_HOST,{
|
|
77
|
+
op:'context-status-v2',sourceRequestId:message.requestId});
|
|
78
|
+
if(after.storeRevision!==before.storeRevision||after.run
|
|
79
|
+
||n?.status!=='OK'||n.scope!=='TASK_SCOPED_PRESTART_READ_ONLY'
|
|
80
|
+
||n.projectId!==intent.projectId||n.taskId!==intent.taskId)
|
|
81
|
+
throw Error('SCOPED_PRESTART_STATE_CHANGED');
|
|
82
|
+
return {status:'OK',scope:'TASK_SCOPED_PRESTART_NO_OWNER',
|
|
83
|
+
projectId:intent.projectId,taskId:intent.taskId,
|
|
84
|
+
native:{phase:'NOT_CREATED'},worker:{state:'PRE_START_NO_OWNER'},
|
|
85
|
+
chatCandidate:found.target
|
|
86
|
+
?{url:'https://chatgpt.com'+found.target.page,
|
|
87
|
+
confidence:'SOFT_OBSERVER_CANDIDATE_ONLY'}:null,
|
|
88
|
+
chatCandidateStatus:found.target?'OBSERVED_SOFT'
|
|
89
|
+
:found.error||'UNVERIFIED'};
|
|
90
|
+
}
|
|
67
91
|
if(native?.status!=='OK'
|
|
68
92
|
||native.scope!=='TASK_SCOPED_STATUS_READ_ONLY'
|
|
69
93
|
||native.projectId!==intent.projectId
|
|
@@ -72,8 +72,10 @@ export function createScopedNativeControl(ports){
|
|
|
72
72
|
throw Object.assign(Error('Exact status intent required'),
|
|
73
73
|
{code:'SCOPED_STATUS_SOURCE_INVALID'});
|
|
74
74
|
const current=readScopedOwner(intent.projectId,intent.taskId).session;
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
// No Owner before Start is expected; this read grants no permit.
|
|
76
|
+
if(!current)return {status:'OK',
|
|
77
|
+
scope:'TASK_SCOPED_PRESTART_READ_ONLY',
|
|
78
|
+
projectId:intent.projectId,taskId:intent.taskId};
|
|
77
79
|
const proof=Object.fromEntries(['projectId','taskId','sessionId',
|
|
78
80
|
'generation','revision','phase','activeChatId']
|
|
79
81
|
.map(k=>[k,current[k]]));
|
|
@@ -390,4 +392,4 @@ export function createScopedNativeControl(ports){
|
|
|
390
392
|
}
|
|
391
393
|
return result;
|
|
392
394
|
};
|
|
393
|
-
}
|
|
395
|
+
}
|