@tomflow/chatloop-extension 0.3.74 → 0.3.75
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.
|
@@ -520,15 +520,26 @@
|
|
|
520
520
|
const textOf=x=>(x.el.querySelector?.(".markdown")?.innerText
|
|
521
521
|
||x.el.innerText||x.el.textContent||"").trim();
|
|
522
522
|
const confirms=(value,type)=>{
|
|
523
|
-
const line=value.replace(/\s+/g,"").trim();
|
|
524
|
-
if
|
|
525
|
-
// Only an affirmative standalone user action. Do NOT accept
|
|
526
|
-
// "我确认方案 P1,但测试先不要做" or copied/embedded approvals.
|
|
523
|
+
const line=value.replace(/\s+/g," ").trim();
|
|
524
|
+
if(!line||line.length>500)return false;
|
|
527
525
|
const target=type==="R"
|
|
528
526
|
? "(?:这份|当前|本版|上述)?(?:需求(?:R[1-9][0-9]*)?|R[1-9][0-9]*)"
|
|
529
527
|
: "(?:这份|当前|本版|上述)?(?:方案(?:与|及|和)?计划|实施计划|方案|计划|P[1-9][0-9]*)(?:P[1-9][0-9]*)?";
|
|
530
|
-
|
|
531
|
-
|
|
528
|
+
const affirmative=new RegExp("^(?:我)?(?:已经|已)?(?:确认|同意|批准)"+target+"[。.!!]?$","i");
|
|
529
|
+
// Keep the original standalone approval. Some real native R/P forms
|
|
530
|
+
// submit a scoped request ID followed by a direct affirmative sentence
|
|
531
|
+
// and bounded next-stage context in ONE genuine user message.
|
|
532
|
+
if(line.length<=100&&affirmative.test(line.replace(/\s+/g,"")))return true;
|
|
533
|
+
const scoped=line.match(/^([A-Z][A-Z0-9._:-]{7,120})[||]\s*([^。.!!]+[。.!!])\s*(.{1,320})$/i);
|
|
534
|
+
if(!scoped||!affirmative.test(scoped[2].replace(/\s+/g,"")))return false;
|
|
535
|
+
const note=scoped[3];
|
|
536
|
+
// A form's scope note cannot revoke approval, request the model to
|
|
537
|
+
// merely quote it, or explicitly withhold the approved plan's start.
|
|
538
|
+
if(/(?:TEST_ONLY|NOT_APPROVED|只是测试文字|只是引用|仅为引用|复制示例|不授权|未授权|并非授权|不代表.{0,15}(?:授权|确认|批准)|不作为.{0,10}(?:审批|批准|授权)|(?:仅|只是)(?:用|供|用于).{0,5}(?:测试|演示|验证))/i.test(note)
|
|
539
|
+
||/(?:撤销|取消|拒绝|不通过|不同意|不批准)(?:当前|本次|这份)?(?:需求|方案|计划|R[1-9][0-9]*|P[1-9][0-9]*)/i.test(note)
|
|
540
|
+
||type==="P"&&/(?:暂不|先不|不要|不能|不允许|禁止).{0,15}(?:执行|Start|实施|开始|启动|做)/i.test(note)
|
|
541
|
+
||/(?:但|不过|只是).{0,12}(?:先不要|先不做|不做|不要做)/.test(note))return false;
|
|
542
|
+
return true;
|
|
532
543
|
};
|
|
533
544
|
// Prefer an explicit current-version declaration. Historical mentions
|
|
534
545
|
// must not choose a version; ambiguous prose is not approval evidence.
|
|
@@ -543,6 +554,12 @@
|
|
|
543
554
|
fail("APPROVAL_SEQUENCE_UNVERIFIED");return false;
|
|
544
555
|
}
|
|
545
556
|
const pUser=rows[lastUser],pAssistant=rows[lastUser-1];
|
|
557
|
+
// A plan document explicitly withheld in PLAN_DRAFT is not an issued
|
|
558
|
+
// review. A user cannot make it effective by typing a P1 approval after
|
|
559
|
+
// the assistant said the current plan was not presented for approval.
|
|
560
|
+
if(/(?:当前阶段[::]\s*PLAN_DRAFT|(?:维持|保持|仍为|停留在)\s*PLAN_DRAFT|方案(?:草稿)?.{0,20}(?:尚未|未曾|没有)正式(?:发布|提交)|(?:暂不|不(?:予|会|再)?)展示.{0,12}提交方案评审)/i.test(textOf(pAssistant))){
|
|
561
|
+
fail("APPROVAL_PLAN_NOT_ISSUED");return false;
|
|
562
|
+
}
|
|
546
563
|
if(!confirms(textOf(pUser),"P")
|
|
547
564
|
|| !/(?:方案|计划)/.test(textOf(pAssistant))
|
|
548
565
|
|| !/\bP[1-9][0-9]*\b/i.test(textOf(pAssistant))) {
|
package/extension/manifest.json
CHANGED