@tomflow/chatloop-extension 0.3.79 → 0.3.80
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.
|
@@ -230,7 +230,7 @@ async function run() {
|
|
|
230
230
|
const raw = params.get("tabId") || "";
|
|
231
231
|
let token = params.get("token") || "";
|
|
232
232
|
let tabId = Number(raw);
|
|
233
|
-
if ([...params.keys()].some(k => k !== "tabId" && k !== "token" && k !== "repairLegacyReservation" && k !== "resumeBlockedAt" && k !== "recoverContextNotSentAt")
|
|
233
|
+
if ([...params.keys()].some(k => k !== "tabId" && k !== "token" && k !== "repairLegacyReservation" && k !== "resumeBlockedAt" && k !== "recoverContextNotSentAt" && k !== "adoptBaselineAt")
|
|
234
234
|
|| [...params.keys()].length !== new Set(params.keys()).size)
|
|
235
235
|
throw Error("ACTION_PARAMETERS_INVALID");
|
|
236
236
|
if (raw && !/^[1-9][0-9]*$/.test(raw)
|
|
@@ -239,6 +239,21 @@ async function run() {
|
|
|
239
239
|
||params.has("recoverContextNotSentAt"))) throw Error("ACTION_PARAMETERS_INVALID");
|
|
240
240
|
const own = await chrome.tabs.getCurrent();
|
|
241
241
|
if (!own?.id || own.url !== location.href) throw Error("ACTION_TAB_UNVERIFIED");
|
|
242
|
+
if(params.has("adoptBaselineAt")){
|
|
243
|
+
const rawAt=params.get("adoptBaselineAt"),at=Number(rawAt);
|
|
244
|
+
if(params.size!==2||!raw||token||!/^[1-9][0-9]{12}$/.test(rawAt||"")
|
|
245
|
+
||!Number.isSafeInteger(at))
|
|
246
|
+
throw Error("ADOPT_BASELINE_PARAMETERS_INVALID");
|
|
247
|
+
show("VERIFYING","对同一原 Chat 的历史审批回复进行只读复核;绝不发送消息。");
|
|
248
|
+
const result=await chrome.runtime.sendMessage({
|
|
249
|
+
type:"CHAT_LOOP_ADOPT_BASELINE_REPAIR_V1",
|
|
250
|
+
tabId,nativeUpdatedAt:at});
|
|
251
|
+
if(result?.status!=="REPAIRED")
|
|
252
|
+
throw Error(result?.code||"ADOPT_BASELINE_REPAIR_UNVERIFIED");
|
|
253
|
+
show("SUCCESS","已对原 Chat 完成历史基线恢复;未创建 Chat、未发送消息。");
|
|
254
|
+
await chrome.tabs.remove(own.id);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
242
257
|
if (!token) {
|
|
243
258
|
show("VERIFYING", "手动打开 Continue:核对当前已完成的 Turn,并申请单次发送许可。");
|
|
244
259
|
if(params.has("resumeBlockedAt")){
|
|
@@ -190,7 +190,8 @@ async function run(){
|
|
|
190
190
|
||evidence.priorDoneAssistantKey!==taken.priorDoneAssistantKey
|
|
191
191
|
: evidence.rVersion!==taken.rVersion
|
|
192
192
|
||evidence.pVersion!==taken.pVersion
|
|
193
|
-
||(evidence.priorAssistantKey||null)!==(taken.priorAssistantKey||null)
|
|
193
|
+
||(evidence.priorAssistantKey||null)!==(taken.priorAssistantKey||null)
|
|
194
|
+
||(evidence.postApprovalAssistantKey||null)!==(taken.postApprovalAssistantKey||null)))
|
|
194
195
|
throw Error('ADOPTION_APPROVAL_CHANGED');
|
|
195
196
|
const registered=await chrome.runtime.sendMessage({type:'CHAT_LOOP_RESOURCE_CHAT_V1',
|
|
196
197
|
action:'start',stage:'adopt',tabId:existing.id});
|
|
@@ -202,7 +203,9 @@ async function run(){
|
|
|
202
203
|
if(committed?.status!=='OK')throw Error(committed?.code||'ADOPTION_COMMIT_UNVERIFIED');
|
|
203
204
|
await chrome.tabs.sendMessage(existing.id,{type:'CHAT_LOOP_TURN_RESUME_V1',
|
|
204
205
|
page:taken.page,userKey:taken.userKey,
|
|
205
|
-
assistantKey:taken.priorAssistantKey||null,
|
|
206
|
+
assistantKey:taken.postApprovalAssistantKey||taken.priorAssistantKey||null,
|
|
207
|
+
...(taken.postApprovalAssistantKey?{baselineOnly:true}:{}),
|
|
208
|
+
startedAt:Date.now()}).catch(()=>null);
|
|
206
209
|
const stored=await chrome.runtime.sendNativeMessage(host,{op:'complete',
|
|
207
210
|
id,nonce:proof.nonce,action:'start',status:'OK',payload:JSON.stringify(committed)});
|
|
208
211
|
if(stored?.status!=='SAVED')throw Error(stored?.code||'ADOPTION_RECEIPT_UNVERIFIED');
|
package/extension/background.js
CHANGED
|
@@ -112,7 +112,7 @@ async function saveRun(run) {
|
|
|
112
112
|
}
|
|
113
113
|
const stored=await readRun();
|
|
114
114
|
const recoveryCommit=next.sessionId&&next.phase==="RESERVED"
|
|
115
|
-
&&["TOOL_PREFLIGHT_REPAIRED","HANDOFF_NOT_SENT"].includes(next.recoveryMode)
|
|
115
|
+
&&["TOOL_PREFLIGHT_REPAIRED","HANDOFF_NOT_SENT","ADOPT_IDLE_BASELINE"].includes(next.recoveryMode)
|
|
116
116
|
&&next.recoveryAttempts>=1&&stored?.phase==="BLOCKED";
|
|
117
117
|
const syncNative=async()=>{
|
|
118
118
|
if(!next.sessionId)return;
|
|
@@ -262,6 +262,7 @@ async function approvedAdoptionTarget(chatUrl=null,taskId=null){
|
|
|
262
262
|
matched.push({tabId:tab.id,page,userKey:proof.userKey,
|
|
263
263
|
priorAssistantKey:proof.priorAssistantKey||null,
|
|
264
264
|
rVersion:proof.rVersion,pVersion:proof.pVersion,
|
|
265
|
+
postApprovalAssistantKey:proof.postApprovalAssistantKey||null,
|
|
265
266
|
...(!requestedId&&taskId?{explicitChatId:scopedId,expectedTaskId:taskId}:{})});
|
|
266
267
|
}
|
|
267
268
|
if(matched.length!==1)return {error:matched.length
|
|
@@ -276,7 +277,8 @@ async function approvedAdoptionTarget(chatUrl=null,taskId=null){
|
|
|
276
277
|
if(second?.status!=="VERIFIED"
|
|
277
278
|
||second.page!==target.page||second.userKey!==target.userKey
|
|
278
279
|
||second.rVersion!==target.rVersion||second.pVersion!==target.pVersion
|
|
279
|
-
||(second.priorAssistantKey||null)!==(target.priorAssistantKey||null)
|
|
280
|
+
||(second.priorAssistantKey||null)!==(target.priorAssistantKey||null)
|
|
281
|
+
||(second.postApprovalAssistantKey||null)!==target.postApprovalAssistantKey)
|
|
280
282
|
return {error:"ADOPTION_APPROVAL_CHANGED"};
|
|
281
283
|
return {target};
|
|
282
284
|
}
|
|
@@ -422,6 +424,7 @@ async function sessionStartPrepare(message,sender){
|
|
|
422
424
|
...(adoption.target.expectedTaskId
|
|
423
425
|
?{adoptExpectedTaskId:adoption.target.expectedTaskId}:{}),
|
|
424
426
|
adoptPriorAssistantKey:adoption.target.priorAssistantKey,
|
|
427
|
+
adoptPostApprovalAssistantKey:adoption.target.postApprovalAssistantKey||null,
|
|
425
428
|
...(intent.purpose==='REPAIR_SAME_SCOPE'?{}:{
|
|
426
429
|
adoptRVersion:adoption.target.rVersion,
|
|
427
430
|
adoptPVersion:adoption.target.pVersion}),
|
|
@@ -461,6 +464,7 @@ async function sessionStartTake(message,sender){
|
|
|
461
464
|
...(run.adoptExplicitChatId?{explicitChatId:run.adoptExplicitChatId}:{}),
|
|
462
465
|
...(run.adoptExpectedTaskId?{expectedTaskId:run.adoptExpectedTaskId}:{}),
|
|
463
466
|
priorAssistantKey:run.adoptPriorAssistantKey,
|
|
467
|
+
postApprovalAssistantKey:run.adoptPostApprovalAssistantKey||null,
|
|
464
468
|
...(run.purpose==='REPAIR_SAME_SCOPE'
|
|
465
469
|
?{purpose:'REPAIR_SAME_SCOPE',repairUserText:run.repairUserText,
|
|
466
470
|
priorDoneAssistantKey:run.repairDoneAssistantKey}
|
|
@@ -502,15 +506,20 @@ async function sessionStartResult(message,sender){
|
|
|
502
506
|
&&proof.priorDoneAssistantKey===run.repairDoneAssistantKey
|
|
503
507
|
:proof.rVersion===run.adoptRVersion
|
|
504
508
|
&&proof.pVersion===run.adoptPVersion
|
|
505
|
-
&&(proof.priorAssistantKey||null)===(run.adoptPriorAssistantKey||null)
|
|
509
|
+
&&(proof.priorAssistantKey||null)===(run.adoptPriorAssistantKey||null)
|
|
510
|
+
&&(proof.postApprovalAssistantKey||null)===(run.adoptPostApprovalAssistantKey||null));
|
|
506
511
|
}
|
|
507
512
|
}
|
|
508
513
|
// Four-hour execution clock begins at confirmed enrollment, not at
|
|
509
514
|
// the UI approval or potentially long Start readiness/preparation.
|
|
515
|
+
const adoptedIdle=confirmed&&adopted&&!!run.adoptPostApprovalAssistantKey;
|
|
510
516
|
const next={...run,phase:confirmed?'WAITING_REPLY':'BLOCKED',
|
|
511
517
|
startedAt:confirmed?Date.now():run.startedAt,
|
|
512
518
|
lastStartActionTabId:sender.tab.id,
|
|
513
|
-
|
|
519
|
+
...(adoptedIdle?{assistantKey:run.adoptPostApprovalAssistantKey,
|
|
520
|
+
userKey:run.adoptUserKey}:{}),
|
|
521
|
+
reason:confirmed?(adoptedIdle?'ADOPTED_IDLE_BASELINE':'')
|
|
522
|
+
:adopted?'ADOPTION_UNVERIFIED':'START_SEND_UNVERIFIED',
|
|
514
523
|
...(!confirmed&&['START_HOME_URL_UNVERIFIED','NEW_CHAT_NOT_READY',
|
|
515
524
|
'START_COMPOSER_NOT_EMPTY','START_ACCOUNT_SWITCH_VISIBLE',
|
|
516
525
|
'FIRST_TURN_OBSERVER_UNAVAILABLE','START_SEND_BUTTON_UNAVAILABLE','START_INPUT_CHANGED',
|
|
@@ -531,6 +540,7 @@ async function sessionStartResult(message,sender){
|
|
|
531
540
|
delete next.adoptExplicitChatId;
|
|
532
541
|
delete next.adoptExpectedTaskId;
|
|
533
542
|
delete next.adoptPriorAssistantKey;
|
|
543
|
+
delete next.adoptPostApprovalAssistantKey;
|
|
534
544
|
delete next.adoptRVersion;
|
|
535
545
|
delete next.adoptPVersion;
|
|
536
546
|
delete next.repairUserText;
|
|
@@ -1043,7 +1053,7 @@ async function onTurnFinished(message, sender) {
|
|
|
1043
1053
|
// assistant must be the exact already-handled question from this Owner, with
|
|
1044
1054
|
// no intervening user messages. This keeps the old identity boundary
|
|
1045
1055
|
// without adding a WAITING_USER phase or a second communication channel.
|
|
1046
|
-
const humanReply=previous.reason
|
|
1056
|
+
const humanReply=["PENDING_CONFIRMATION_DOM","ADOPTED_IDLE_BASELINE"].includes(previous.reason)
|
|
1047
1057
|
&& message.userKey!==previous.newUserKey
|
|
1048
1058
|
&& previous.userKey && previous.assistantKey
|
|
1049
1059
|
&& message.userKey!==previous.userKey
|
|
@@ -1214,6 +1224,84 @@ async function repairUncommittedBlockedRecovery(){
|
|
|
1214
1224
|
await saveRun(restored);
|
|
1215
1225
|
return restored;
|
|
1216
1226
|
}
|
|
1227
|
+
// One-shot recovery of an ALREADY committed same-Chat Adopt whose historical
|
|
1228
|
+
// post-approval reply was wrongly classified UNKNOWN. Never writes a composer,
|
|
1229
|
+
// retries an action or replaces Context/Owner. Requires exact Native BLOCKED CAS.
|
|
1230
|
+
async function onAdoptBaselineRepair(message,sender){
|
|
1231
|
+
const prior=await readRun();
|
|
1232
|
+
if(prior?.phase!=='BLOCKED'||prior.reason!=='UNKNOWN'
|
|
1233
|
+
||prior.action!=='START'||!prior.contextManaged||!prior.taskId
|
|
1234
|
+
||(prior.recoveryAttempts||0)!==0
|
|
1235
|
+
||!prior.sessionId||!Number.isInteger(prior.tabId)
|
|
1236
|
+
||prior.tabId!==message.tabId||!prior.page
|
|
1237
|
+
||!/^user:[^\s]{8,}$/.test(prior.newUserKey||'')
|
|
1238
|
+
||!/^assistant:[^\s]{8,}$/.test(prior.assistantKey||'')
|
|
1239
|
+
||prior.userKey!==prior.newUserKey)
|
|
1240
|
+
return {status:'DENIED',code:'ADOPT_BASELINE_NOT_ELIGIBLE'};
|
|
1241
|
+
if(!Number.isSafeInteger(message.nativeUpdatedAt)||message.nativeUpdatedAt<=0
|
|
1242
|
+
||!Number.isInteger(sender.tab?.id))
|
|
1243
|
+
return {status:'DENIED',code:'ADOPT_BASELINE_INVALID_SOURCE'};
|
|
1244
|
+
const expected=chrome.runtime.getURL('continue.html')
|
|
1245
|
+
+'?tabId='+prior.tabId+'&adoptBaselineAt='+message.nativeUpdatedAt;
|
|
1246
|
+
if(sender.url!==expected)
|
|
1247
|
+
return {status:'DENIED',code:'ADOPT_BASELINE_INVALID_ACTION'};
|
|
1248
|
+
const tab=await chrome.tabs.get(prior.tabId).catch(()=>null);
|
|
1249
|
+
if(pathOf(tab?.url)!==prior.page)
|
|
1250
|
+
return {status:'DENIED',code:'ADOPT_BASELINE_CHAT_CHANGED'};
|
|
1251
|
+
const disk=await chrome.runtime.sendNativeMessage(SESSION_HOST,
|
|
1252
|
+
{op:'session-read'}).catch(()=>null);
|
|
1253
|
+
if(disk?.status!=='OK'||!matchesNativeProjection(sessionProjection(prior),disk.session)
|
|
1254
|
+
||disk.session?.phase!=='BLOCKED'
|
|
1255
|
+
||disk.session.updatedAt!==message.nativeUpdatedAt)
|
|
1256
|
+
return {status:'DENIED',code:'ADOPT_BASELINE_NATIVE_CHANGED'};
|
|
1257
|
+
const exactChatId=chatIdOf(tab.url);
|
|
1258
|
+
const read=async()=>{
|
|
1259
|
+
const approval=await chrome.tabs.sendMessage(tab.id,
|
|
1260
|
+
{type:'CHAT_LOOP_APPROVAL_EVIDENCE_V1',
|
|
1261
|
+
explicitChatId:exactChatId,expectedTaskId:prior.taskId}).catch(()=>null);
|
|
1262
|
+
const turn=await chrome.tabs.sendMessage(tab.id,
|
|
1263
|
+
{type:'CHAT_LOOP_TURN_VERIFY_V1'}).catch(()=>null);
|
|
1264
|
+
if(approval?.contract!=='chat-loop.turn-observer.v1'
|
|
1265
|
+
||approval.status!=='VERIFIED'
|
|
1266
|
+
||approval.page!==prior.page
|
|
1267
|
+
||approval.userKey!==prior.newUserKey
|
|
1268
|
+
||approval.postApprovalAssistantKey!==prior.assistantKey
|
|
1269
|
+
||turn?.contract!=='chat-loop.turn-observer.v1'
|
|
1270
|
+
||turn.status!=='READY'||turn.page!==prior.page
|
|
1271
|
+
||turn.userKey!==prior.newUserKey||turn.assistantKey!==prior.assistantKey
|
|
1272
|
+
||turn.pendingConfirmation
|
|
1273
|
+
||globalThis.ChatLoopCoreV1.parseStatus(turn.replyText)!=='UNKNOWN')
|
|
1274
|
+
return null;
|
|
1275
|
+
return {userKey:turn.userKey,assistantKey:turn.assistantKey,
|
|
1276
|
+
replyText:turn.replyText,rVersion:approval.rVersion,pVersion:approval.pVersion};
|
|
1277
|
+
};
|
|
1278
|
+
const a=await read();
|
|
1279
|
+
if(!a)return {status:'DENIED',code:'ADOPT_BASELINE_PROOF_MISSING'};
|
|
1280
|
+
await new Promise(resolve=>setTimeout(resolve,2300));
|
|
1281
|
+
const b=await read();
|
|
1282
|
+
if(!b||JSON.stringify(a)!==JSON.stringify(b))
|
|
1283
|
+
return {status:'DENIED',code:'ADOPT_BASELINE_PROOF_CHANGED'};
|
|
1284
|
+
// Re-arm the observer as a historical baseline BEFORE Native CAS. Failure
|
|
1285
|
+
// cannot leave Native in a half-resumed state. This sends no Chat message.
|
|
1286
|
+
const armed=await chrome.tabs.sendMessage(tab.id,{
|
|
1287
|
+
type:'CHAT_LOOP_TURN_RESUME_V1',
|
|
1288
|
+
page:prior.page,userKey:prior.newUserKey,
|
|
1289
|
+
assistantKey:prior.assistantKey,baselineOnly:true,
|
|
1290
|
+
startedAt:prior.startedAt
|
|
1291
|
+
}).catch(()=>null);
|
|
1292
|
+
if(armed?.status!=='RESUMED'||armed.baselineOnly!==true)
|
|
1293
|
+
return {status:'DENIED',code:'ADOPT_BASELINE_OBSERVER_UNVERIFIED'};
|
|
1294
|
+
await saveRun({...prior,phase:'RESERVED',
|
|
1295
|
+
reason:'ADOPT_BASELINE_RECOVERY',
|
|
1296
|
+
recoveryMode:'ADOPT_IDLE_BASELINE',recoveryAttempts:1});
|
|
1297
|
+
const clean={...prior,phase:'WAITING_REPLY',reason:'ADOPTED_IDLE_BASELINE',
|
|
1298
|
+
recoveryAttempts:1,userKey:prior.newUserKey,assistantKey:prior.assistantKey};
|
|
1299
|
+
delete clean.recoveryMode;
|
|
1300
|
+
await saveRun(clean);
|
|
1301
|
+
return {status:'REPAIRED',sessionId:prior.sessionId,taskId:prior.taskId,
|
|
1302
|
+
activeChatId:exactChatId,baselineAssistantKey:prior.assistantKey,
|
|
1303
|
+
generation:prior.generation||0};
|
|
1304
|
+
}
|
|
1217
1305
|
// Only an explicitly opened, existing Continue Action may reveal a
|
|
1218
1306
|
// scroll-virtualized *terminal Owner* before the normal double Turn check.
|
|
1219
1307
|
// This grants no send permit and changes neither Worker nor Native state.
|
|
@@ -1776,6 +1864,7 @@ async function reconnectOpenChats() {
|
|
|
1776
1864
|
type: "CHAT_LOOP_TURN_RESUME_V1", page: owner.page,
|
|
1777
1865
|
userKey:freshUser?proof.userKey:owner.newUserKey,
|
|
1778
1866
|
assistantKey: owner.assistantKey || null,
|
|
1867
|
+
...(owner.reason==='ADOPTED_IDLE_BASELINE'?{baselineOnly:true}:{}),
|
|
1779
1868
|
startedAt: owner.startedAt
|
|
1780
1869
|
}).catch(() => null);
|
|
1781
1870
|
if (res?.status !== "RESUMED" && res?.status !== "ALREADY_MONITORING")
|
|
@@ -1827,6 +1916,7 @@ async function watchActiveTurn() {
|
|
|
1827
1916
|
type: "CHAT_LOOP_TURN_RESUME_V1", page: run.page,
|
|
1828
1917
|
userKey: freshHuman?proof.userKey:run.newUserKey,
|
|
1829
1918
|
assistantKey: run.assistantKey || null,
|
|
1919
|
+
...(run.reason==='ADOPTED_IDLE_BASELINE'?{baselineOnly:true}:{}),
|
|
1830
1920
|
startedAt: run.startedAt
|
|
1831
1921
|
}).catch(() => null);
|
|
1832
1922
|
}
|
|
@@ -1949,6 +2039,7 @@ const SERIAL_ROUTES=new Map([
|
|
|
1949
2039
|
['CHAT_LOOP_ACTION_TAKE_V1',onTake],
|
|
1950
2040
|
['CHAT_LOOP_ACTION_RESULT_V1',onResult],
|
|
1951
2041
|
['CHAT_LOOP_HANDOFF_SEND_BEGIN_V1',onHandoffSendBegin],
|
|
2042
|
+
['CHAT_LOOP_ADOPT_BASELINE_REPAIR_V1',onAdoptBaselineRepair],
|
|
1952
2043
|
['CHAT_LOOP_ACTION_MANUAL_REVEAL_V1',onManualReveal],
|
|
1953
2044
|
['CHAT_LOOP_ACTION_MANUAL_PREPARE_V1',onManualPrepare],
|
|
1954
2045
|
['CHAT_LOOP_MODEL_INTENT_V1',onModelIntent],
|
|
@@ -415,8 +415,9 @@
|
|
|
415
415
|
return false;
|
|
416
416
|
}
|
|
417
417
|
if (message?.type === "CHAT_LOOP_TURN_RESUME_V1") {
|
|
418
|
-
// Rebind only the exact Worker-owned
|
|
419
|
-
//
|
|
418
|
+
// Rebind only the exact Worker-owned Turn after Extension reload.
|
|
419
|
+
// A dedicated baseline-only mode never reports an already-completed
|
|
420
|
+
// pre-adoption assistant as a new execution Turn.
|
|
420
421
|
const snap = inspect();
|
|
421
422
|
if (!snap.path || snap.unavailable || snap.path !== message.page
|
|
422
423
|
|| !/^user:[^\s]{8,}$/.test(message.userKey || "")
|
|
@@ -429,20 +430,26 @@
|
|
|
429
430
|
// lost (e.g. MV3 worker suspension). Only that Worker-owned exact Turn
|
|
430
431
|
// may request a new stable read. Never replay on ordinary DOM polling.
|
|
431
432
|
if (session.pendingUser === message.userKey && !session.attaching
|
|
432
|
-
&& session.completedUser !== message.userKey) {
|
|
433
|
+
&& session.completedUser !== message.userKey && message.baselineOnly!==true) {
|
|
433
434
|
reply({contract: CONTRACT, status: "ALREADY_MONITORING"});
|
|
434
435
|
return false;
|
|
435
436
|
}
|
|
437
|
+
if(message.baselineOnly===true &&
|
|
438
|
+
(!message.assistantKey || snap.assistantKey!==message.assistantKey
|
|
439
|
+
|| snap.stop||snap.busy||snap.pendingConfirmation||!snap.copyAction)){
|
|
440
|
+
reply({contract:CONTRACT,status:"UNVERIFIED",reason:"ADOPT_BASELINE_UNVERIFIED"});
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
436
443
|
session.path = snap.path;
|
|
437
444
|
session.sawHomepage = false;
|
|
438
445
|
session.attaching = false;
|
|
439
446
|
session.attachingFirstTurn = false;
|
|
440
447
|
session.firstSendSeen = false;
|
|
441
448
|
session.priorUser = null;
|
|
442
|
-
session.baselineUser = null;
|
|
449
|
+
session.baselineUser = message.baselineOnly===true ? message.userKey : null;
|
|
443
450
|
session.baselineAssistant = message.assistantKey || null;
|
|
444
|
-
session.pendingUser = message.userKey;
|
|
445
|
-
session.completedUser = null;
|
|
451
|
+
session.pendingUser = message.baselineOnly===true ? null : message.userKey;
|
|
452
|
+
session.completedUser = message.baselineOnly===true ? message.userKey : null;
|
|
446
453
|
session.firstTurnAt = Number.isSafeInteger(message.startedAt)
|
|
447
454
|
&& message.startedAt > 0 ? message.startedAt : Date.now();
|
|
448
455
|
session.attachSignature = "";
|
|
@@ -450,7 +457,8 @@
|
|
|
450
457
|
const observation = poll();
|
|
451
458
|
reply({contract: CONTRACT, status: "RESUMED",
|
|
452
459
|
observation: observation.status, reason: observation.reason,
|
|
453
|
-
userKey: observation.userKey
|
|
460
|
+
userKey: observation.userKey,
|
|
461
|
+
...(message.baselineOnly===true?{baselineOnly:true}:{})});
|
|
454
462
|
return false;
|
|
455
463
|
}
|
|
456
464
|
if (message?.type === "CHAT_LOOP_REPAIR_EVIDENCE_V1") {
|
|
@@ -719,7 +727,10 @@
|
|
|
719
727
|
fail("APPROVAL_LAST_TURN_UNVERIFIED");return false;
|
|
720
728
|
}
|
|
721
729
|
reply({contract:CONTRACT,status:"VERIFIED",page:path,
|
|
722
|
-
userKey,rVersion,pVersion,priorAssistantKey:messageId(pAssistant.el,"assistant")
|
|
730
|
+
userKey,rVersion,pVersion,priorAssistantKey:messageId(pAssistant.el,"assistant"),
|
|
731
|
+
// Idle post-approval assistant was completed BEFORE adoption.
|
|
732
|
+
// This is a historical baseline, never a fresh execution Turn.
|
|
733
|
+
...(scopedIdle?{postApprovalAssistantKey:snap.assistantKey}:{})});
|
|
723
734
|
return false;
|
|
724
735
|
}
|
|
725
736
|
if (message?.type === "CHAT_LOOP_TURN_VERIFY_V1") {
|
package/extension/manifest.json
CHANGED