@tomflow/chatloop-extension 0.4.47 → 0.4.49
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.
|
@@ -14,8 +14,17 @@ async function run(){
|
|
|
14
14
|
:{type:'CHAT_LOOP_SESSION_STATUS_V1',requestId:id,
|
|
15
15
|
...(proof.traceParent?{traceParent:proof.traceParent}:{})})
|
|
16
16
|
.catch(()=>null);
|
|
17
|
+
// A signed Task without its FIRST Owner is a healthy pre-Start read.
|
|
18
|
+
// Accept only exact Task identity and bounded non-sending projection;
|
|
19
|
+
// this is not approval, a lease, or a sender permit.
|
|
20
|
+
const exact=state?.projectId===proof.intent?.projectId
|
|
21
|
+
&&state?.taskId===proof.intent?.taskId;
|
|
22
|
+
const scopedOwned=exact&&state?.scope==='TASK_SCOPED_STATUS_READ_ONLY';
|
|
23
|
+
const scopedPrestart=exact&&state?.scope==='TASK_SCOPED_PRESTART_NO_OWNER'
|
|
24
|
+
&&state?.native?.phase==='NOT_CREATED'
|
|
25
|
+
&&state?.worker?.state==='PRE_START_NO_OWNER';
|
|
17
26
|
if(scoped&&(state?.status!=='OK'
|
|
18
|
-
||
|
|
27
|
+
||!(scopedOwned||scopedPrestart))){
|
|
19
28
|
const code=/^[A-Z][A-Z0-9_]{1,95}$/.test(state?.code||'')
|
|
20
29
|
?state.code:'SCOPED_TASK_STATUS_UNVERIFIED';
|
|
21
30
|
// Failure is an actual read-only result, not an absent ACK that makes
|
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
|
+
}
|