@tomflow/chatloop-extension 0.4.24 → 0.4.25

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Chat Loop Extension",
4
- "version": "0.4.24",
4
+ "version": "0.4.25",
5
5
  "description": "Chat Loop browser companion: Eye actions, Turn observer, Continue and Handoff Actions",
6
6
  "permissions": [
7
7
  "activeTab",
@@ -47,8 +47,29 @@ async function sessionStartPrepare(message,sender){
47
47
  const independentTask=Boolean(intent.mode==='adopt'&&intent.contextLeaseRef
48
48
  &&intent.taskId && (!prior?.taskId && !prior?.contextManaged
49
49
  ||prior?.taskId&&prior.taskId!==intent.taskId));
50
+ // A first Adopt that failed BEFORE permit.consume completed has no Chat
51
+ // send, tab binding, or Context writer. A fresh Context lease (which
52
+ // independently requires runRef=null) may replace this exact BLOCKED
53
+ // pre-permit Session at most once for the SAME approved Task. Unknown
54
+ // post-permit / browser outcomes are never eligible for this route.
55
+ const prePermitRecovery=Boolean(prior?.phase==='BLOCKED'
56
+ &&prior.reason==='CONTEXT_START_PERMIT_UNVERIFIED'
57
+ &&prior.action==='START'&&prior.mode==='adopt'
58
+ &&prior.contextLeaseRef&&!prior.prePermitRetryUsed
59
+ &&!prior.contextManaged&&prior.projectId===intent.projectId
60
+ &&prior.taskId===intent.taskId&&intent.mode==='adopt'
61
+ &&intent.contextLeaseRef&&intent.contextLeaseRef!==prior.contextLeaseRef
62
+ &&prior.contextStoreEpoch===intent.contextStoreEpoch
63
+ &&prior.contextTaskRevision===intent.contextTaskRevision
64
+ &&prior.contextApprovalRevision===intent.contextApprovalRevision
65
+ &&prior.tabId===null&&prior.page==='/'&&!prior.newUserKey
66
+ &&!prior.userKey&&!prior.attemptedNewTabId
67
+ &&!!intent.chatUrl&&prior.adoptPage===pathOf(intent.chatUrl)
68
+ &&Number.isInteger(prior.adoptTabId)
69
+ &&typeof prior.adoptUserKey==='string');
50
70
  const matchingBlocked=prior?.phase==='BLOCKED' && prior.sessionId===replace
51
- && (prior.projectId!==intent.projectId || independentTask);
71
+ && (prior.projectId!==intent.projectId || independentTask
72
+ ||prePermitRecovery);
52
73
  if(replace&&!matchingBlocked)return {status:'DENIED',code:'BLOCKED_REPLACEMENT_MISMATCH'};
53
74
  if(prior&&prior.phase!=='DONE'&&!matchingBlocked)
54
75
  return {status:'DENIED',code:'LOOP_ALREADY_ACTIVE'};
@@ -112,6 +133,7 @@ async function sessionStartPrepare(message,sender){
112
133
  page:'/',tabId:null,startedAt:Date.now(),
113
134
  machineRequestId:message.requestId,machineActionTabId:sender.tab.id,
114
135
  ...(matchingBlocked?{replacedBlockedSessionId:replace}:{}),
136
+ ...(prePermitRecovery?{prePermitRetryUsed:true}:{}),
115
137
  ...(adoption?{mode:'adopt',adoptTabId:adoption.target.tabId,
116
138
  adoptPage:adoption.target.page,adoptUserKey:adoption.target.userKey,
117
139
  ...((intent.chatUrl||adoption.target.explicitChatId)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/chatloop-extension",
3
- "version": "0.4.24",
3
+ "version": "0.4.25",
4
4
  "type": "module",
5
5
  "description": "Chat Loop Extension: reviewed formal Action pages, including TEST_ONLY native App entry",
6
6
  "bin": {