@tomflow/chatloop-extension 0.4.49 → 0.4.51
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.
|
@@ -78,10 +78,16 @@ async function nativeMentionAndSend(id,appId,prompt){
|
|
|
78
78
|
'[data-testid*="app-item"]','[data-testid*="mention-item"]'];
|
|
79
79
|
for(let i=0;i<55;i++){
|
|
80
80
|
if(location.pathname!=='/')return fail('ENTRY_PAGE_CHANGED');
|
|
81
|
-
const
|
|
82
|
-
.filter(visible)
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
const all=[...document.querySelectorAll(selectors.join(','))]
|
|
82
|
+
.filter(visible);
|
|
83
|
+
// ChatGPT may render the exact App option with empty innerText.
|
|
84
|
+
// Validate the native App ID first, not its incidental display text.
|
|
85
|
+
const matching=all.filter(e=>e.getAttribute('data-plugin-impression-id')===appId);
|
|
86
|
+
if(matching.length>1)return fail('ENTRY_NATIVE_APP_OPTION_AMBIGUOUS');
|
|
87
|
+
if(matching.length===1&&!matching[0].disabled){
|
|
88
|
+
choice=matching[0];break;
|
|
89
|
+
}
|
|
90
|
+
const nodes=all.filter(e=>(e.innerText||'').includes('Chat Loop'));
|
|
85
91
|
const exact=nodes.filter(e=>{
|
|
86
92
|
const t=(e.innerText||'').trim();
|
|
87
93
|
return t==='Chat Loop'||t.startsWith('Chat Loop\n');
|
|
@@ -36,6 +36,15 @@ if (message?.type === "CHAT_LOOP_APPROVAL_EVIDENCE_V1") {
|
|
|
36
36
|
const oldLabel=lines[4].match(/^选项标签:\s*A[||]\s*确认(?:当前\s*)?([RP][1-9][0-9]*)\s*(需求|技术与验证方案|技术方案|方案)$/i);
|
|
37
37
|
const modernLabel=lines[3]==='选项值: approve'
|
|
38
38
|
&&/^选项标签:\s*A[||]\s*确认(需求|技术与验证方案|技术方案|方案)$/.exec(lines[4]);
|
|
39
|
+
// Actual six-line user Forms explicitly say R1 v1 or P1 v1.
|
|
40
|
+
// Bind BOTH document identity and physical version, never prose.
|
|
41
|
+
const physicalLabel=lines[4].match(
|
|
42
|
+
/^选项标签:\s*A[||]\s*确认(?:当前\s*)?([RP][1-9][0-9]*)\s*V([1-9][0-9]*)\s*(需求|技术与验证方案|技术方案|方案|技术方案与验证交付计划)$/i);
|
|
43
|
+
const physicalIndex=Number(physicalLabel?.[2]||0);
|
|
44
|
+
const explicitPhysical=physicalLabel
|
|
45
|
+
&&physicalLabel[1][0].toUpperCase()===type
|
|
46
|
+
&&(Number(physicalLabel[1].slice(1))===1
|
|
47
|
+
||Number(physicalLabel[1].slice(1))===physicalIndex);
|
|
39
48
|
// The visible "P2 final revision" is a semantic review cycle.
|
|
40
49
|
// The stored document can be P1 V3 after a cancelled V2; only the
|
|
41
50
|
// explicit physical V3 may become the trusted approval version P3.
|
|
@@ -49,13 +58,17 @@ if (message?.type === "CHAT_LOOP_APPROVAL_EVIDENCE_V1") {
|
|
|
49
58
|
const versions=[...formId.matchAll(/(?:^|[-_])([rp][1-9][0-9]*)(?=[-_]|$)/gi)]
|
|
50
59
|
.map(m=>m[1].toUpperCase());
|
|
51
60
|
const version=oldLabel?.[1]?.toUpperCase()
|
|
61
|
+
||(explicitPhysical?type+String(physicalIndex):null)
|
|
52
62
|
||(revised?type+String(physical):null)
|
|
53
63
|
||(modernLabel&&versions.length===1?versions[0]:null);
|
|
54
64
|
const label=oldLabel?.[2]
|
|
55
|
-
||(
|
|
65
|
+
||(explicitPhysical?physicalLabel[3]
|
|
66
|
+
:revised?(type==='R'?'需求':'方案'):modernLabel?.[1]);
|
|
56
67
|
if(!version||version[0]!==type||!label
|
|
57
68
|
||(type==='R')!==(label==='需求')
|
|
58
69
|
||(oldLabel&&versions.some(v=>v!==version))
|
|
70
|
+
||explicitPhysical&&versions.some(v=>v!==physicalLabel[1].toUpperCase()
|
|
71
|
+
&&v!==version)
|
|
59
72
|
||revised&&versions.some(v=>v!==type+'1'&&v!==version
|
|
60
73
|
&&v!==revisionLabel[3].toUpperCase())
|
|
61
74
|
||formId===traceRef)return null;
|
package/extension/manifest.json
CHANGED