@customize-agent/server 4.12.2 → 4.12.4

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.
@@ -109,19 +109,19 @@ ${a.graphContext}`:"",b?`事实卡:
109
109
  ${b}`:"",`小节任务:
110
110
  ${c}`,"写作要求:必须严格按“小节任务”逐项输出,每个任务都必须保留完全一致的三级标题“### 小节标题”;不得合并小节、不得改写小节标题、不得省略小节;项目专属事实只使用事实卡、图谱上下文和绑定证据,法律法规、标准规范等公共知识可直接引用;不得输出后台话术、兜底措辞、待确认、不适用;缺少项目事实的小节不得编造。"].filter(Boolean).join("\n\n")}function eq(a){let b=ek(a);return!(!b||b.length<3||/^(?:见|详见|按|执行|参见|依据).{0,16}(?:前附表|招标公告|招标文件|合同|协议书|通用条款|专用条款|图纸|清单|附件|资料)$/u.test(b)||/^(?:合同协议书|通用条款|专用条款|招标文件|招标公告|投标人须知前附表|附件|资料)$/u.test(b.replace(/[()()\d一二三四五六七八九十、..\s]/gu,"")))&&/项目|工程|编号|地点|规模|范围|工期|质量|安全|资源|材料|设备|验收|\d/u.test(ej(a))}function er(a){let b=[],c=a.draft.content||"";for(let d of eh)c.includes(d)&&b.push({level:"error",severity:"blocker",category:"style",owner:"system",message:`${a.draft.title} 正文包含禁止话术:${d}`,suggestion:"工作包"===d?"这是生成系统后台概念,正文中不得出现该词:结合上下文语义改写为正式术语(如“拆除工程”“按专业工程逐项说明”),不得做词面替换。":"改为事实支撑的正式表达;缺失事实不得占位。"});c.includes("[EVIDENCE_SKELETON]")&&b.push({level:"error",severity:"blocker",category:"evidence_coverage",owner:"system",message:`${a.draft.title} 正文为 LLM 全故障后的证据骨架草稿,禁止作为正式正文通过`,suggestion:"必须由 Repairer 基于小节事实卡与证据完整重写为正式正文,并删除 [EVIDENCE_SKELETON] 标记;若 LLM 仍不可用,本章节保持 failed 阻断。"}),(0,w.V7)(c);let d=a.plannedCoverage,e=a=>{let b=d?.[a];return b&&b.length>0?b[0]:a},f=new Map;for(let a of Object.values(d||{}))a.length>0&&f.set(a[0],(f.get(a[0])||0)+1);let g=a=>{let b=d?.[a];return!!b&&0!==b.length&&(f.get(b[0])||1)>1},h=new Map,i=new Set;for(let b of a.task.sections){let a=e(b.title);g(b.title);let c=h.get(a);h.set(a,void 0===c?b.minChars:Math.max(c,b.minChars))}for(let e of a.task.sections){let a=d?.[e.title],f=a&&a.length>0?a:[e.title],j=f[0],k=g(e.title),l=new Set,m="";for(let a of f){let b=(0,z.Xl)(c,a,{fuzzy:!0});b&&!l.has(b)&&(l.add(b),m+=(m?"\n":"")+b)}if(j!==e.title){let a=(0,z.Xl)(c,e.title,{fuzzy:!0});a&&!l.has(a)&&(0,w.V7)(a)>(0,w.V7)(m)&&(m=a)}if(m.includes("[WRITER_MISSING_SECTION]")||!m&&c.includes("[WRITER_MISSING_SECTION]"))i.has(j)||(i.add(j),b.push({level:"error",severity:"blocker",category:"structure",owner:"system",message:k?`${j} Writer 未完成(承接 ${e.title})`:`${e.title} Writer 未完成`,suggestion:"Repairer 必须基于该小节事实卡和证据生成正式正文,并删除 WRITER_MISSING_SECTION 标记。"}));else if(m&&!i.has(j)){i.add(j);let a=h.get(j)||e.minChars,c=/项目特点.*重点.*难点|重点.*难点.*分析|项目主要施工内容|主要分部分项工程施工方案|主要施工方法|危大工程专项施工方案审批流程|原材料进场复试|见证取样/u.test(e.title),d=k&&!c?Math.max(200,Math.floor(.5*a)):a;(0,w.V7)(m)>=Math.floor(.8*d)||b.push({level:c?"error":"warning",severity:c?"blocker":"warning",category:"structure",owner:"system",message:k?`${j} 正文不足,未达到任务最小深度(承接 ${e.title})`:`${e.title} 正文不足,未达到任务最小深度`,suggestion:c?"关键小节必须基于项目事实和对应关系重写补足;不得仅保留概述性文字。":"应基于该小节事实卡和证据重新生成,不得使用标题占位。"})}else if(!m&&!i.has(j)){i.add(j);let a=/项目特点.*重点.*难点|重点.*难点.*分析|项目主要施工内容|主要分部分项工程施工方案|主要施工方法|危大工程专项施工方案审批流程|原材料进场复试|见证取样/u.test(e.title);b.push({level:a?"error":"warning",severity:a?"blocker":"warning",category:"structure",owner:"system",message:a?`${e.title} 正文不足,未达到任务最小深度`:`${k?`承接小节 ${j} 缺失`:e.title} 未匹配到独立小节标题`,suggestion:a?"关键小节缺失正文,必须基于该小节事实卡和证据生成正式正文,不得以标题占位。":"正文已成文但小节标题与规划标题不完全一致,建议后续按规划标题进一步规范结构。"})}if(e.ready||b.push(...e.issues.map(a=>({...a,level:"warning",severity:"warning"}))),/主要分部分项工程施工方案|主要施工方法/u.test(e.title)){let a=(0,z.Xl)(c,j,{fuzzy:!0}),d=(0,w.V7)(a),f=new Set([...a.match(R.aX)||[],...a.match(R.LT)||[]]).size,g=new Set(a.match(R.s2)||[]).size,h=d>0?g/(d/1e3):0;(0,w.V7)(a)>=800&&(f<4||h<2)&&b.push({level:"warning",severity:"warning",category:"professional_chain",owner:"system",message:`${e.title} 参数落位不足:工艺参数 ${f} 个(要求不少于 4 个),量化参数密度每千字 ${h.toFixed(1)} 个(要求不少于 2 个)`,suggestion:"必须补充 mm/MPa/间距/偏差/坡度/试验压力等工艺参数(来自绑定资料或行业规范值)或设备型号规格参数,并提升量化参数(数量/规格/工期/面积等)落位密度;同一参数不得反复堆砌凑数。"})}if(/主要分部分项工程施工方案|主要施工方法|项目主要施工内容|施工流程|施工顺序|多工序穿插|三检制度|隐蔽工程验收|闭环整改|应急演练|转运路线/u.test(e.title)){let a=(0,z.Xl)(c,j,{fuzzy:!0});(0,w.V7)(a)>=500&&!(0,z.Z1)(a)&&b.push({level:"warning",severity:"warning",category:"professional_chain",owner:"system",message:`${e.title} 工序顺序表达缺失:工序序列未以顺序词叙述、编号步骤、列表或箭头链任一形式表达`,suggestion:"工艺流程与方法叙述中的连续工序须有明确的顺序表达,形式由模型自然选择(顺序词叙述、编号步骤、有序列表或箭头链均可,如“先进行基层清理,再放线定位,随后分层摊铺,然后碾压,最后验收”),保证工序先后顺序清晰即可。"})}}let j=a.context.materialScope.selectedRoots;for(let d of a.context.materialScope.rejectedRoots)d&&!j.includes(d)&&c.includes(d)&&b.push({level:"error",severity:"blocker",category:"evidence_coverage",owner:"system",message:`${a.draft.title} 混入非当前资料组名称:${d}`,suggestion:"必须删除跨项目内容并重新检索当前资料组证据。"});let k=a.task.facts.filter(eq),l=k.filter(a=>{let b=ek(a);return b.length>=2&&c.includes(b.slice(0,Math.min(18,b.length)))}).length;k.length>=3&&0===l&&1200>(0,w.V7)(c)&&b.push({level:"warning",severity:"warning",category:"evidence_coverage",owner:"system",message:`${a.draft.title} 未明显落位章节事实卡`,suggestion:"建议将章节事实卡中的关键工程事实写入对应小节,但不因引用型或低可执行事实阻断。"});let m=b.filter(a=>"error"===a.level||"blocker"===a.severity),n=b.filter(a=>/正文不足|未落位章节事实卡/u.test(a.message)),o=m.some(a=>/Writer 未完成|正文不足,未达到任务最小深度/u.test(a.message));return{issues:b,supportedFacts:l,unsupportedSignals:b.map(a=>a.message),repairable:b.length>0&&(b.length<=6||n.length===b.length||0===m.length||o)}}function es(a){return a.replace(/\s+/gu,"").toLowerCase()}var et=c(14070);async function eu(a){let b=(0,d.QJ)(a.templateId);if(!b)throw Error("Document template not found");let c=b.chapters.find(b=>b.id===a.chapterId);if(!c)throw Error("Document chapter not found");let f=e.resolve(a.projectRoot||(0,g.aY)());if(!f)throw Error("No knowledge base project found");let h=(0,g.Qh)(),i=(0,aT.Hh)(f,b,{requirement:a.requirement}),j=(0,aT.W9)(f,b,{requirement:a.requirement}),{kindByPath:k,processingByPath:l}=(0,aT.Hz)(j),m=new Set(i),n=bj(f,i),o=new Map([...k.entries()].map(([a,b])=>[a,(0,aT._W)(b)])),p=new Map([...l.entries()].map(([a,b])=>[a,b])),q=dH(await h.getProject(f),[...m],a.maxEvidencePerChapter),r=[],v=[...m].filter(Boolean).sort(),w=dE(c,c.queries,[]),x=function(a,b){let c=Number(process.env.DOCUMENT_MAX_QUERIES_PER_CHAPTER);return Math.max(2,Math.min(9,Math.floor(Number.isFinite(c)&&c>0?c:4)+ +((a.sections||[]).length>=6||a.requiredFacts.length>=8)+Math.min(2,b.length)))}(c,[]);for(let a of w.slice(0,x)){let b=await h.search(f,a,{scope:"project",filters:{filePaths:v},limit:Math.min(q,12),weights:{keyword:.4,vector:.45,rewrite:.75,hybridBonus:.15}});r.push(...b.results.filter(a=>(0,aR.Tz)(f,a.filePath,m)).map(a=>({chapterId:c.id,filePath:a.filePath,score:a.score,content:a.content,roleId:o.get(a.filePath),processingType:p.get(a.filePath),sectionTitle:a.sectionTitle,source:a.source})))}let y=dD(c,bm(r.filter(a=>(0,aR.Tz)(f,a.filePath,m)),n),{maxItems:function(a,b,c=!1){return Math.max(12,Math.min(c?58:26,a+10+4*((b.sections||[]).length>=6||b.requiredFacts.length>=8)+18*!!c))}(q,c),maxChars:16e3,preservePinned:!0});bo(y,n,`regenerate:${c.id}`);let z=a.currentMarkdown||"",A=new Set(a.existingFacts??[]),B=c.requiredFacts.filter(a=>!A.has(a)&&!y.some(b=>(0,u.Lk)(b,a)));if(0===y.length)throw Error(`${(0,t.GQ)(c.title)} 缺少可支撑正文的项目资料证据`);let C=[`## ${c.title}`,"",a.requirement?`> 生成要求:${a.requirement}`:"",z?`> 当前文档上下文摘要:${z.replace(/\s+/gu," ")}`:"",`本章依据已锁定项目资料围绕“${c.purpose}”重新整理,并与当前文档上下文保持一致。`,"","### 资料依据",...y.map(s.OF)].filter(Boolean).join("\n");return{id:c.id,title:c.title,content:C,evidence:y,missingFacts:B}}async function ev(a){var b;(0,z.Te)(a.signal);let c=(0,d.QJ)(a.templateId);if(!c)throw Error("Document template not found");let o=e.resolve(a.projectRoot||(0,g.aY)());if(!o)throw Error("No knowledge base project found");let p=(0,f.computeProjectId)(o),q=c,y=(0,g.Qh)(),A=[],B=[],C=(b,c=J)=>{let d=b?[...b].sort((a,b)=>{let c=B.indexOf(a.id),d=B.indexOf(b.id);return(c<0?Number.MAX_SAFE_INTEGER:c)-(d<0?Number.MAX_SAFE_INTEGER:d)}):void 0;a.onProgress?.([...c],d?{chapters:d}:void 0)},D=Math.max(15e3,Math.min(6e4,Number(process.env.DOCUMENT_GENERATION_HEARTBEAT_MS??3e4))),E=async(b,c=J)=>{let d=setInterval(()=>{a.signal?.aborted||C(A,c)},D);try{return await b()}finally{clearInterval(d)}},H=(0,d.N6)(q)||"none",I=(0,i.Mu)(H)?.name||H,J=[(0,aQ.X5)({type:"role_binding",roleId:H,status:"running",message:`生成任务已创建,正在读取模板与角色配置:${q.name}`,details:[`当前项目:${p}`,`资料目录:${(0,g.NW)(o)}`,"正在读取项目资料包和提示词配置"],progress:{current:1,total:4,label:"初始化配置"}},{subtitle:I,roleName:I,order:0})];C();let P=(0,d.bj)(q),Q=P.bindings;(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"document-preparation",status:"running",message:"正在分析模板规范、用户要求与项目资料包",details:["解析 OUTLINE 与模板章节","读取项目资料包","自动识别资料类型并构建项目理解"],progress:{current:1,total:3,label:"准备分析"}},{subtitle:"生成准备",order:J.length})),C();let U=(0,c3.Qu)({template:q,requirement:a.requirement,projectRoot:o,facts:[]}).materialScope.selectedFiles;if(0===U.length)throw Error("模板未绑定可用项目资料包,请先在模板中绑定需要参与生成的项目文件夹。");let V=(0,aT.W9)(o,q,{requirement:a.requirement}),W=(0,aT._n)(q,V),{kindByPath:X,processingByPath:$}=(0,aT.Hz)(V),_=(0,aR.fC)([...P.writerPrompts,...P.chapterPrompts]),ac=(0,t.cs)([{text:a.requirement,source:"用户需求",strict:!0},{text:_,source:"提示词角色",strict:!0}]),ad=ac.length>=2;ad&&(q={...c,chapters:ac});let ae=await E(()=>Promise.resolve((0,k.P)(o,{requirement:a.requirement,boundFilePaths:U})));(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"document-preparation",status:"running",message:"正在生成自动文档规格并评估生成准备度",details:[`项目资料:${U.length} 份`,`资料类型:${Object.values(V.groups).filter(a=>a.length>0).length} 类`,"生成事实字段与章节约束"],progress:{current:2,total:3,label:"规格评估"}},{subtitle:"生成准备",order:J.length})),C();let an=await E(()=>Promise.resolve((0,j.x)(q,a.requirement||""))),ao=an.spec,ap=function(a,b=""){let c=`${a?.id||""} ${a?.name||""} ${a?.category||""} ${a?.description||""} ${a?.outputTitle||""} ${b}`;return/施工组织设计|施工方案|危大工程|人、材、机|安全文明施工/u.test(c)?m:l}(q,a.requirement||""),ar=(0,r.$)({template:q,spec:ao,summary:ae,resolvedRoles:[]});if(!ar.ready)throw Error(`生成准备度不足:${ar.blockingIssues.join(";")}`);let ax=['【全文写作硬约束(每一章生成时必须遵守,违反即评审失分)】\n1. 禁止编造时间事实:开工日期、竣工日期、工期起止等未在项目资料中确认的日期一律不得写入正文;进度表述改用“开工后第 N 天”“第 N 周”等相对口径,或引用资料中已确认的日期。\n2. 禁止商务数据:暂列金额、暂估价、综合单价、清单合价、税率、投标报价等商务条款数据不得写入施工组织设计正文,商务口径只允许出现在项目信息表中。\n3. 禁止资料来源罗列话术:不得出现“根据/依据招标文件、工程量清单、图纸及答疑”式来源罗列句,直接陈述项目事实与施工安排;编制依据小节可集中列出依据文件。\n4. 禁止跨章复述概况:除“工程概况/项目概况”章节外,其余章节不得以“本项目为/本工程为”开头整段复述项目总体概况,应直接展开本章主题内容。\n5. 禁止后台内部话术:不得出现“工作包”“WRITER_MISSING_SECTION”“已确认资料”等系统内部术语与兜底话术,一律改写为正式施工组织设计表述。\n6. 合规数值红线(安全、职业健康、危大工程章节必须逐条对照,违反即合规失分):\n a. 高温停工按《防暑降温措施管理办法》(安监总安健〔2012〕89号):日最高气温达到40℃以上应停止当日室外露天作业;37℃~40℃时室外露天作业时间累计不得超过6小时且气温最高时段3小时内不得安排室外露天作业;35℃~37℃时应换班轮休缩短连续作业时间。不得写成42℃等其他阈值。\n b. 危大工程判定线按住建部令第37号及建办质〔2018〕31号:基坑(槽)土方开挖、支护、降水,开挖深度超过3m(含3m)属危大工程,超过5m(含5m)属超过一定规模(需专家论证);模板支撑搭设高度8m及以上或搭设跨度18m及以上属超过一定规模;落地式钢管脚手架搭设高度24m及以上属危大工程、50m及以上属超过一定规模,悬挑式脚手架分段架体搭设高度20m及以上属超过一定规模;采用非常规起重设备方法且单件起吊重量10kN及以上属危大工程、100kN及以上属超过一定规模。判定必须给出本项目对应参数(开挖深度/支撑高度/搭设高度/起吊重量),参数未在资料中确认的不得自行判定为危大或超危大。证据中含基坑底标高、\xb10.000对应绝对标高、垫层底标高等数值的,必须直接引用并据此给出开挖深度具体数值(开挖深度=地面标高-坑底标高),不得仅写“开挖深度超过3m”而不给数值;标高、坡率(如1:1.5)等设计参数应写入基坑支护与土方开挖相关小节。\n c. 专家论证程序按住建部令第37号:超过一定规模的危大工程专项方案应组织不少于5名符合专业要求的专家(从地方住建主管部门专家库选取)论证;修改后的方案由施工单位技术负责人审核签字、加盖单位公章,并由总监理工程师审查签字、加盖执业印章后方可实施。\n d. 监测预警值单一口径:同一监测指标(基坑位移速率、沉降预警值等)全文只能出现一个数值口径,不得前后矛盾;预警值优先引用设计文件明确值,无设计要求时按现行监测技术标准选取并注明依据。\n e. 自设数值自洽:自设的防护尺寸、频次、时间节点等数值必须与同章及跨章表述一致,且尽量引用现行规范依据;无规范依据的自设值不得写成硬性规定。\n7. 禁止数据自查话术:不得把表格口径推算、数据一致性自查过程写入正文(如"上表合计行…与…不一致,故…修正为…"),表格与正文数值必须直接自洽;不得把招标条款编号碎片(如"3项规定""1委员会确定中""56m15:…")作为小节标题。',W.prompt,(0,k.F)(ae,{publicSafe:!0}),(0,j.N)(ao,an.sourceHash,{publicSafe:!0}),(0,r.R)(ar,{publicSafe:!0})].filter(Boolean).join("\n\n"),ay=[W.prompt,(0,k.F)(ae),(0,j.N)(ao,an.sourceHash),(0,r.R)(ar)].filter(Boolean).join("\n\n"),az=(0,aR.fC)([...P.writerPrompts,...P.formattingPrompts]),aD=(0,aR.fC)([...P.writerPrompts,...P.chapterPrompts,...P.formattingPrompts]),aE=(0,aR.fC)(P.prompts),aF=(0,h.I)().load().webAccess||{enabled:!1,allowProjectFacts:!1,maxQueriesPerChapter:2,maxResultsPerQuery:3,trustedDomains:[]},aH=(0,a9.c_)({promptTexts:[ax,aE].filter(Boolean).join("\n\n"),requirement:a.requirement,template:q,rolePrompts:P.prompts}),aI=[(0,a9.el)(aH),!aF.enabled?"":"公开资料补充使用规则:\n1. 公开资料只可用于补充通用规范、政策、工艺和措施。\n2. 不得使用公开资料新增或修改项目名称、建设地点、建设规模、工期、质量标准、工程量、材料规格、图纸参数、商务数据。\n3. 本地项目资料与公开资料冲突时,必须以本地项目资料为准。\n4. 不得在正文中出现任何检索过程、外部页面、工具调用或系统内部过程性表述。\n5. 不得把公开资料中的其他项目案例参数写入本项目正文。"].filter(Boolean).join("\n\n"),aJ=[ax,aI,`生成前规划章节结构:
111
111
  ${(0,v.CK)(q)}`,az||aD].filter(Boolean).join("\n\n"),aK=[ay,aI,(0,aR.fC)([...P.extractionPrompts,...P.referencePrompts])].filter(Boolean).join("\n\n"),aL=[ax,aI,(0,aR.fC)([...P.writerPrompts,...P.chapterPrompts,...P.formattingPrompts])].filter(Boolean).join("\n\n");(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"document-preparation",status:"success",message:`模板规范与项目资料理解完成,识别 ${U.length} 份项目资料`,details:[`提示词绑定:${Q.length} 个`,`项目资料包:${V.materialRoots.join("、")||"当前知识库"}`,ad?`识别 OUTLINE 章节:${ac.length} 个`:"未识别显式 OUTLINE,使用模板章节"],progress:{current:3,total:3,label:"准备完成"}},{subtitle:"生成准备",order:J.length})),C();let aV=new Set(U),aW=new Map([...X.entries()].map(([a,b])=>[a,(0,aT._W)(b)])),aX=new Map([...$.entries()].map(([a,b])=>[a,b]));(0,aQ.fx)(J,(0,aQ.X5)({type:"knowledge_retrieval",roleId:"knowledge-index",status:"running",message:"正在读取项目资料包索引",details:["使用上传阶段已完成的解析、切片和索引结果","不在生成流程中重新解析或入库","准备按资料类型召回章节证据"],progress:{current:1,total:3,label:"读取索引"}},{subtitle:"知识库检索",order:J.length})),C();let aY=await E(()=>y.getProject(o)),aZ=function(a,b){let c=new Set(b.filter(Boolean)),d=(a.listFiles?.()||[]).filter(a=>0===c.size||c.has(a.relativePath)),e=new Set(d.map(a=>a.relativePath)),f=[...c].filter(a=>!e.has(a)),g=d.filter(a=>0===Math.max(0,Math.ceil(Number(a.chunkCount)||0))).map(a=>a.relativePath),h=d.filter(a=>"error"===a.status).map(a=>a.relativePath),i="function"==typeof a.countPendingIndexJobs?a.countPendingIndexJobs():0,j="function"==typeof a.getVectorStatus?a.getVectorStatus():void 0,k=d.filter(a=>"error"!==a.status&&Math.max(0,Math.ceil(Number(a.chunkCount)||0))>0),l=k.map(a=>a.relativePath),m=k.reduce((a,b)=>a+Math.max(0,Math.ceil(Number(b.chunkCount)||0)),0),n=[...dG("部分绑定文件未完成索引,已自动跳过",f),...dG("部分绑定文件没有可用切片,已自动跳过",g),...dG("部分绑定文件索引失败,已自动跳过",h)],o=c.size>0&&0===m?["所有绑定文件均无可用切片"]:[],p=[...n,...i>0?[`仍有 ${i} 个待索引任务,建议等待索引完成后生成`]:[],...j&&"ready"!==j.status?[`向量索引状态为 ${j.status},当前召回质量可能下降`]:[]];return{scopedRecords:d,usablePaths:l,missingFiles:f,emptyFiles:g,errorFiles:h,pendingJobs:i,vectorStatus:j,usableChunkCount:m,blockingIssues:o,warnings:p}}(aY,[...aV]);if(aZ.blockingIssues.length>0)throw Error(`生成前知识索引不可用:${aZ.blockingIssues.join(";")}`);let a0=new Set(aZ.usablePaths),a1=bj(p,[...a0]),a2=dH(aY,[...a0],a.maxEvidencePerChapter),a5=aZ.pendingJobs>0||0===aZ.usableChunkCount,a6=function(a){let b=Math.max(0,Math.ceil(a.totalChunks||0)),c=Math.max(0,Math.ceil(a.loadedChunks||0)),d=Math.max(0,b-c),e=b>0?c/b:1,f=[...b>=1e3&&e<.35?["切片未完全预加载"]:[],...!1===a.vectorReady?["向量索引未就绪"]:[]];return{totalChunks:b,loadedChunks:c,omittedChunks:d,loadedRatio:e,highRisk:f.length>0,riskReason:f.join("、")||void 0}}({totalChunks:Math.min(aZ.usableChunkCount,20*U.length),loadedChunks:Math.min(aZ.usableChunkCount,20*U.length),vectorReady:aZ.vectorStatus?"ready"===aZ.vectorStatus.status:void 0});(0,aQ.fx)(J,(0,aQ.X5)({type:"knowledge_retrieval",roleId:"knowledge-index",status:a5?"failed":"success",message:`已读取知识索引:项目资料 ${aZ.scopedRecords.length} 份,可用切片 ${aZ.usableChunkCount} 条`,details:[`项目资料:${aV.size} 份`,`可用证据文件:${a0.size} 份`,`向量状态:${aZ.vectorStatus?.status||"unknown"}`,...aZ.warnings,"后续将按招标正文/清单/图纸/补疑等资料类型召回"],progress:{current:3,total:3,label:"索引已就绪"}},{subtitle:"知识库检索",order:J.length})),C(),(0,z.Te)(a.signal);let a7=[],ba=[],bb={enabled:aF.enabled,queries:[],evidenceCount:0,filteredCount:0,chapters:[]},bc=[],bd=[],be=[],bf=[],bg=[],bi=-1,bk=new Map,bl=new Map,bp=a=>{let b=`${a}::full`;if(!bl.has(b))try{bl.set(b,aY.getFileDetail?.(a))}catch{bl.set(b,void 0)}return bl.get(b)},bq=async(a,b,c,d)=>{let e=dB(d),f=(0,z.c6)({query:a,scopedFilePaths:b,limit:c,weights:e,generationMode:!1}),g=bk.get(f);if(g)return g;let h=await y.search(o,a,{scope:"project",filters:{filePaths:b},limit:c,weights:e,generationMode:!1}).catch(()=>null),i=h?.results||[];return bk.set(f,i),i},br={stage:(0,aQ.X5)({type:"file_understanding",roleId:"project-understanding",status:"success",message:`已完成项目资料理解:${V.files.length} 份资料,${Object.values(V.groups).filter(a=>a.length>0).length} 类资料类型`,details:W.prompt.split("\n").slice(0,16)},{subtitle:"项目资料理解",order:J.length})};(0,aQ.fx)(J,br.stage),C();let bs=bm(await c9({manager:y,project:aY,projectRoot:o,scopedFilePaths:[...aV].filter(Boolean).sort(),fileRoleByPath:aW,fileProcessingByPath:aX,signal:a.signal}),a1);bo(bs,a1,"project-basic-evidence"),bs.length>0&&(a7.push(...bs),(0,aQ.fx)(J,(0,aQ.X5)({type:"knowledge_retrieval",roleId:"project-basic-evidence",status:"success",message:`已锁定项目基础事实证据 ${bs.length} 条`,details:bs.slice(0,8).map(a=>`${e.basename(a.filePath)}|${a.sectionTitle||"正文片段"}|score=${a.score.toFixed(2)}`)},{subtitle:"基础事实召回",order:J.length})),C());let bt=bn(T(a7,q,ao),a1),bu=bn(aa(a7),a1),bv=[...bt,...bu,...bn(ab(a7,ap),a1)],bw=(0,eg.hp)({projectRoot:o,template:q,requirement:a.requirement}),bx=[...bw?.facts||[],...bv],by=await am(bx,bn(S(a7),a1),bc,ao,ap),bz=(0,c3.Qu)({template:q,requirement:a.requirement,projectRoot:o,facts:bx,projectGraph:bw?.projectGraph,projectGraphSource:bw?"project-intelligence":void 0});for(let a of(0,c3.SU)(bz))(0,aQ.fx)(J,a);bw&&(0,aQ.fx)(J,(0,aQ.X5)({type:"file_understanding",roleId:"project-intelligence-cache",status:"success",message:`已复用入库后项目理解资产与绑定 scope 快照:${bw.files.length} 份绑定资料`,details:[`项目级缓存时间:${new Date(bw.cache.createdAt).toLocaleString()}`,`scope 快照:${bw.scopeSnapshot.scopeHash.slice(0,12)}`,`复用预计算事实:${bw.facts.length} 条`,`复用预计算项目图谱:${bw.projectGraph.works.length}工程/${bw.projectGraph.methods.length}工法/${bw.projectGraph.resources.length}资源`,`复用施工组织设计专项图谱:${bw.constructionOrganizationGraph.workPackages.length} 个工作包/${bw.constructionOrganizationGraph.controlMatrix.length} 条控制矩阵`,`图谱来源:${bw.cache.projectGraphMessage}`,`章节意图证据覆盖:${Object.keys(bw.evidenceByChapterId||{}).length}/${q.chapters.length} 章`,`排除正文不适用资料:${bw.files.filter(a=>!a.usableForBody).length} 份`]},{subtitle:"项目理解缓存 / Scope 快照"})),C();let bA=bz.baseProjectGraph;if(!bw){(0,aQ.fx)(J,(0,aQ.X5)({type:"file_understanding",roleId:"project-graph",status:"running",message:`正在临时构建完整项目图谱:${a7.length} 条证据 → LLM 结构化提取`,details:["缓存缺失或版本过期,建议重新构建项目理解缓存;本次生成将临时构建完整项目图谱。","提取:工程内容、施工方法、材料设备、技术标准、重点难点"],progress:{current:2,total:3,label:"项目图谱"}},{subtitle:"项目资料图谱分析",order:J.length})),C();let b=await E(()=>(0,ef.i)({evidence:a7,signal:a.signal,projectRoot:o,requirement:a.requirement,templateId:q.id}),J);if(!b.graph)throw Error(`完整项目图谱构建失败:${b.stage.message||b.stage.status}`);bA=b.graph,(0,aQ.fx)(J,b.stage),C()}bA&&(W=(0,aT._n)(q,V,bA));let bB=function(a){var b;let c=(0,z.c6)({version:"canonical-facts-v7",rulesHash:(0,cR.TG)(a.projectRoot),requirement:a.requirement||"",templateId:a.templateId||"",requiredKeys:a.requiredKeys||[],facts:a.facts.map(a=>({key:a.key,fieldId:a.fieldId,fieldName:a.fieldName,value:a.value,sourceFile:a.sourceFile,roleId:a.roleId,confidence:a.confidence})).sort((a,b)=>`${a.sourceFile}${a.key}${a.value}`.localeCompare(`${b.sourceFile}${b.key}${b.value}`)),graphHash:a.projectGraph?(0,z.c6)(a.projectGraph):"",markdownHash:a.markdown?(0,z.c6)(a.markdown.slice(0,2e4)):""}),d=function(a,b){let c=cY(a);if(c)try{let a=JSON.parse(O.readFileSync(e.join(c,`canonical-facts-${b}.json`),"utf8"));return a&&a.byKey&&Array.isArray(a.scopeConflicts)?a:void 0}catch{return}}(a.projectRoot,c);if(d)return d;let f=a.facts||[],g=c_(f,(0,cR.bC)(a.projectRoot));for(let a of g.map(a=>({caseType:"scope_conflict_arbitration",recordedAt:Date.now(),kind:a.kind,scope:a.scope,values:a.values.map(a=>({value:a.value,unit:a.unit,sourceFile:a.sourceFile,priority:a.priority})),winner:a.resolution,confidence:a.confidence,manualReviewRequired:!a.resolution})))cQ("arbitration-cases.jsonl",a);let h=c2(f,g),i=cW({facts:h,markdown:a.markdown}),j={};for(let[a,b]of i.entries())j[a]=function(a){let b=a.source.includes("generated_markdown")?"generated_markdown":a.source.includes("evidence")?"evidence":"structured_fact";return{key:a.fieldKey,label:a.label,value:a.value,normalizedValue:Z(a.value),sourceType:b,sourceFile:a.source,confidence:a.confidence,priority:cX(b),locked:cX(b)>=80,selectedReason:a.selectedReason}}(b);if(j.project_scale){let a=j.project_scale;if(/占地|用地/u.test(a.value)&&/建筑面积/u.test(a.value)){let b=a.value.search(/(?:单体)?总?建筑面积/u);if(b>0){let c=Y(a.value.slice(b)).trim();j.project_scale={...a,value:c,normalizedValue:Z(c),selectedReason:`${a.selectedReason};混合口径已净化,scale 只取建筑面积段`}}}}let k=[];for(let a of[{key:"project_name",label:"项目名称",pattern:/项目名称|工程名称|招标项目名称|project_name/u,bucket:"projectIdentity",valueType:"text"},{key:"project_code",label:"项目编号",pattern:/项目编号|招标项目编号|project_code/u,bucket:"projectIdentity",valueType:"identifier"},{key:"owner",label:"招标人",pattern:/招标人|建设单位|发包人|owner/u,bucket:"projectIdentity",valueType:"organization"},{key:"project_location",label:"建设地点",pattern:/建设地点|实施地点|project_location/u,bucket:"projectIdentity",valueType:"location"},{key:"project_scale",label:"建设规模",pattern:/建设规模|工程规模|project_scale/u,bucket:"projectScope",valueType:"scale"},{key:"construction_scope",label:"施工范围",pattern:/施工范围|招标范围|工程范围/u,bucket:"projectScope",valueType:"text"},{key:"duration",label:"计划工期",pattern:/计划工期|合同工期|总工期|schedule_requirement|duration/u,bucket:"schedule",valueType:"duration"},{key:"quality_target",label:"质量目标",pattern:/质量标准|质量目标|quality_standard/u,bucket:"quality",valueType:"standard"}]){let b=function(a,b,c,d,e){let f=cS.find(a=>a.key===b);return a.filter(a=>d.test(`${a.fieldId||""}${a.key||""}${a.fieldName||""}`)).map(a=>(function(a,b,c){let d=(0,z.lG)(a.value),e=function(a){let b=`${a.sourceFile||""} ${a.sourceRef?.sectionTitle||""} ${a.roleId||""}`;return/补疑|答疑|澄清|补充|更正|修改/u.test(b)?"addendum":/合同/u.test(b)?"contract":/招标|公告|前附表|需求书/u.test(b)?"tender":/清单|工程量|BOQ|报价/u.test(b)?"boq":/图纸|设计|CAD|DWG/u.test(b)?"drawing":/规范|标准/u.test(b)?"standard":"structured_fact"}(a);return{key:b,label:c,value:d,normalizedValue:Z(d),sourceType:e,sourceFile:a.sourceFile,sourceRef:a.sourceRef?.sectionTitle,confidence:Math.round(100*(a.confidence||.5)),priority:cX(e),locked:cX(e)>=80,selectedReason:"按资料来源优先级和字段置信度决策"}})(a,b,c)).filter(a=>a.value&&!/资料未明确|系统暂未确认/u.test(a.value)).filter(a=>{let d=e??f?.valueType;return!d||"text"===d||!cU(a.value,{key:b,label:c,aliases:[],valueType:d}).rejected}).sort((a,b)=>b.priority-a.priority||b.confidence-a.confidence||a.value.length-b.value.length)}(h,a.key,a.label,a.pattern,a.valueType);!j[a.key]&&b.length>0&&(j[a.key]=b[0]);let c=function(a,b,c){let d=[...new Map(c.map(a=>[a.normalizedValue,a])).values()];if(d.length<=1)return;let e=Math.max(...d.map(a=>a.priority)),f=d.filter(a=>a.priority===e);return{key:a,label:b,values:d.map(a=>({value:a.value,sourceFile:a.sourceFile,priority:a.priority,confidence:a.confidence})),decision:1===f.length?"highest_priority_selected":"manual_review_required"}}(a.key,a.label,b);c&&k.push(c)}let l=(b=a.projectGraph)?[...(b.resources||[]).map(a=>({key:`resource_${a.type}_${a.name}`,label:"equipment"===a.type?"机械设备":"labor"===a.type?"劳动力":"材料资源",value:[a.name,a.spec,a.quantity,a.unit].filter(Boolean).join(" "),normalizedValue:Z([a.name,a.spec,a.quantity,a.unit].filter(Boolean).join(" ")),sourceType:"projectGraph",sourceFile:a.sourceFiles?.[0],confidence:55,priority:cX("projectGraph"),locked:!1,selectedReason:"来自项目图谱资源节点"})).filter(a=>a.value),...(b.risks||[]).map(a=>({key:`risk_${a.risk}`,label:"风险源",value:[a.risk,a.level,a.mitigation].filter(Boolean).join(" "),normalizedValue:Z([a.risk,a.level,a.mitigation].filter(Boolean).join(" ")),sourceType:"projectGraph",sourceFile:a.sourceFiles?.[0],confidence:55,priority:cX("projectGraph"),locked:!1,selectedReason:"来自项目图谱风险节点"})).filter(a=>a.value)]:[],m=l.filter(a=>/resource_/u.test(a.key)),n=l.filter(a=>/risk_/u.test(a.key));for(let a of l)j[a.key]||(j[a.key]=a);let o=(a.requiredKeys||[]).filter(a=>!j[a]).map(a=>({key:a,label:cS.find(b=>b.key===a)?.label||a,reason:"未从用户输入、招标资料、清单、图纸或项目图谱中确认该事实"})),p={projectIdentity:{projectName:j.project_name,projectCode:j.project_code,owner:j.owner,location:j.project_location},projectScope:{scale:j.project_scale,constructionScope:j.construction_scope},schedule:{duration:j.duration||j.schedule_requirement},quality:{target:j.quality_target||j.quality_standard},safety:{risks:n},resources:{resources:m},environment:{},constraints:{},byKey:j,conflicts:k,gaps:o,scopeConflicts:g},q=cY(a.projectRoot);return q&&O.writeFileSync(e.join(q,`canonical-facts-${c}.json`),JSON.stringify(p,null,2)),p}({facts:bx,projectGraph:bA,requiredKeys:cS.map(a=>a.key),projectRoot:o,requirement:a.requirement,templateId:q.id});by.canonical=bB;let bC=(0,t.effectiveTemplateChapters)(q,ao,{preserveExplicitOutline:ad}),bD=(0,G.dK)({template:q,chapters:bC,requirement:a.requirement}).chapters,bE=a7.filter(a=>/评审|评分标准|评分办法|详细评审/u.test(`${a.sectionTitle||""}${a.content}`)).map(a=>a.content),bF=function(a){let b=a.join("\n"),c=new Map;for(let a of b.matchAll(/(\d{1,2})\s*[.、.]\s*([^;。\n]{4,60})/gu)){let b=a[2].trim().replace(/[“”"'"]/gu,"");if(!/[\u4e00-\u9fa5]{3}/u.test(b)&&!/[杯奖]/u.test(b)||/AI|大模型|评审|评分|分值|分项|子项|满分|得分|投标人须|详见|招标文件/u.test(b)||/公共资源|电子交易|加密|投标|开标|评标委员会/u.test(b))continue;let d=Number(a[1]);c.has(d)||c.set(d,{index:d,text:b,title:function(a){let b=a.replace(/^针对/u,"").replace(/^确保/u,"").replace(/的保障体系与措施$/u,"").replace(/的管理体系与措施$/u,"").replace(/保障体系与措施$/u,"").replace(/管理体系与措施$/u,"").replace(/[,、;,;]+$/u,"").trim();return!/[\u4e00-\u9fa5]{3}/u.test(b)&&!/[杯奖]/u.test(b)||/工期与质量/u.test(b)?"":b.length>24?b.slice(0,24):b}(b)})}return[...c.values()]}(bE);bE.length>0&&0===bF.length&&(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"bid-structure-audit",status:"skipped",message:"评审章节证据存在但未提取到评分条目标题:评分标准编号条目提取为空,承接审计将静默通过",details:["请检查招标文件评标办法章节编号格式;评分项要求(创优目标/绿色等级/禁编日期)由评分项要求提取通道覆盖"]},{subtitle:"评标结构校验",order:J.length}));let bG=await (0,M.Mv)(bF.map(a=>a.title),bD.map(K)),bH=L({template:q,chapters:bD,requirement:a.requirement,evaluationItems:bF,semanticSimilarity:bG}),bI=[];for(let a of[...aV].sort()){if(!/招标|补疑|答疑|评标/u.test(a))continue;let b=bp(a);if(b?.chunks?.length)for(let c of b.chunks)bI.push({chapterId:"tender-requirements",filePath:b.file?.relativePath||a,score:1,content:c.content||"",roleId:aW.get(a),processingType:aX.get(a),sectionTitle:c.sectionTitle,source:"pinned-evidence"})}let bJ=bI.length>0?bI:(0,s.QR)([...a7.filter(a=>/招标|评标|投标须知|专用合同|合同条款|技术标准|技术要求/u.test(`${a.filePath||""}${a.sectionTitle||""}`)),...a7.filter(a=>!/招标|评标|投标须知|专用合同|合同条款|技术标准|技术要求/u.test(`${a.filePath||""}${a.sectionTitle||""}`))],{preservePinned:!0}),bK=await E(()=>aq(bJ,{signal:a.signal}));!au(bK)&&bJ.length>0&&(bK=await E(()=>aq(bJ,{signal:a.signal})));let bL=await as(bI);if(bL.length>0&&(!(b=bK)||0===b.awardObjectives.length&&0===b.awardClauses.length&&!b.greenBuildingGrade&&!b.smartSiteGrade&&!b.assemblyRate&&0===b.systematicBenchmarks.length)){let b=await E(()=>aq(bL,{signal:a.signal}));au(b)&&(bK=at(bK,b),(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"tender-mandatory-extraction",status:"success",message:"必提条款窄通道补提完成(主提取漏提字段已补齐)",details:aC(b)},{subtitle:"评分项要求提取",order:J.length})),C())}au(bK)?((0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"tender-requirements-extraction",status:"success",message:"招标文件评分项要求结构化提取完成",details:aC(bK)},{subtitle:"评分项要求提取",order:J.length})),C()):bJ.length>0&&((0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"tender-requirements-extraction",status:"skipped",message:"评分项要求提取未获得有效结果(模型不可用或资料中无要求),零响应检测自动跳过",details:[]},{subtitle:"评分项要求提取",order:J.length})),C());let bM=(0,aO.w9)({chapters:bH.enrichedChapters,projectGraph:bA,canonicalFacts:bB});q={...q,chapters:bM};let bN=new Map;if(bA){let a=new Set;for(let b of[...bA.works,...bA.methods,...bA.resources,...bA.schedule,...bA.standards,...bA.risks,...bA.requirements,...bA.siteConditions])(b.sourceFiles||[]).forEach(b=>a.add(b));for(let b of bM){let c=[b.title,b.purpose,...b.sections||[],...b.requiredFacts||[],...b.queries||[]].join(" "),d=a=>a&&((0,et.C1)(a,c,.18)||(0,et.C1)(a,b.title,.12)),e=/概况|总体|部署|施工|进度|工期|质量|安全|资源|人材机|材料|机械|劳动力|风险|危大|绿色|环保/u.test(c),f=bA.works.filter(a=>a.name&&(d(a.name)||e)),g=bA.methods.filter(a=>a.name&&(d(a.name)||(a.applicableWorks||[]).some(d)||e)),h=bA.resources.filter(a=>a.name&&(d(a.name)||/资源|人材机|材料|机械|劳动力/u.test(c)&&/material|equipment|labor/u.test(a.type))),i=bA.gaps.filter(a=>d(a)||e),j=new Set;for(let a of f)(a.sourceFiles||[]).forEach(a=>j.add(a));for(let a of g)(a.sourceFiles||[]).forEach(a=>j.add(a));for(let a of h)(a.sourceFiles||[]).forEach(a=>j.add(a));0===j.size&&e&&[...a].forEach(a=>j.add(a)),bN.set(b.id,{graphFiles:j,graphBoqItems:h.map(a=>({name:a.name,quantity:a.quantity,unit:a.unit,sourceFiles:a.sourceFiles||[]})),graphWorks:f.map(a=>a.name),graphMethods:g.map(a=>a.name),gaps:i})}bw||((0,aQ.fx)(J,(0,aQ.X5)({type:"file_understanding",roleId:"project-graph-match",status:"success",message:`图谱→章节映射完成:${bA.works.length}工程 ${bA.methods.length}工法 ${bA.resources.length}资源 → ${bM.length}章`,details:bM.map(a=>{let b=bN.get(a.id);return`${(0,t.GQ)(a.title)}:匹配文件${b?.graphFiles.size||0}个,BOQ项${b?.graphBoqItems.length||0}个`})},{subtitle:"图谱章节映射"})),C())}let bO=bM,bP=(0,eg.TD)(bw?.constructionOrganizationGraph)||bw?.constructionOrganizationContext,bQ=[W.prompt,bP].filter(Boolean).join("\n\n"),bR=[bQ,F({template:{...q,chapters:bO},chapters:bO,factsModel:by,requirement:a.requirement,scopeConflicts:bB.scopeConflicts})].filter(Boolean).join("\n\n"),bS={...q,chapters:bO},bT=(0,a9.My)([aJ,a.requirement||""].filter(Boolean).join("\n\n"),bO),bU=(0,w.tF)({requirement:a.requirement,promptTexts:aJ,template:bS,chapters:bO,spec:ao}),bV=0,bW=0,bX=await (0,z.l$)(bO.map((a,b)=>({chapter:a,chapterIndex:b})),async({chapter:b,chapterIndex:c})=>{if(b.sections?.length){bV+=1;let a=bT.filter(a=>a.chapterIndex===c||a.chapterTitle&&(0,t.GQ)(a.chapterTitle)===(0,t.GQ)(b.title)).flatMap(a=>a.requiredSections.sort((a,b)=>(a.order||0)-(b.order||0)).map(a=>a.title)),d=(0,a9.k2)([...a,...b.sections],b.title);return{...b,sections:d.length?d:(0,a9.k2)(b.sections,b.title)}}bW+=1;let d=(0,s.QR)(a7.filter(a=>a.chapterId===b.id||(0,u.Lk)(a,b.title)),{preservePinned:!0}),e=W.chapterPlans.find(a=>a.chapterId===b.id)?.writingGoal||"",f=dv(P,b),g=await (0,a9.SP)({template:bS,chapter:b,chapterIndex:c,evidence:d,promptTexts:f.promptTexts,projectContext:bR,requirement:a.requirement,roleContext:e,targetWords:bU.chapterTargets.get(b.id)||1200,structuralRules:bT,signal:a.signal}),h=bT.filter(a=>a.chapterIndex===c||a.chapterTitle&&(0,t.GQ)(a.chapterTitle)===(0,t.GQ)(b.title)).flatMap(a=>a.requiredSections.map(a=>`强制小节:${a.title}`));if((0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"section-planning",promptId:f.primaryPromptId,status:g.length?"success":"failed",message:`${(0,t.GQ)(b.title)} 小节规划${g.length?`生成 ${g.length} 个小节`:"未生成可用小节"}`,details:[...f.promptDetails,...h,...g.length?g.map(a=>`规划小节:${a}`):["规划结果为空或被污染过滤"]]},{subtitle:"小节规划"})),!g.length)throw Error(`${(0,t.GQ)(b.title)} 小节规划未生成可用小节`);return{...b,sections:g}},{kind:"llmRepair",targetWords:bU.targetChars||4e3}),bY=(0,G.dK)({template:q,chapters:bX,requirement:a.requirement}),bZ=bY.chapters;{let a=bY.report;a.unattached.length>0?(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"construction-org-outline-unattached",status:"success",message:`标准模块挂靠:${a.totals.attachedModules} 个模块、${a.totals.sectionCount} 个小节;${a.unattached.length} 个可选模块未挂靠(无语义匹配章节,已记录)`,details:a.unattached.map(a=>`未挂靠:${a.moduleTitle}(${a.sections.length} 小节,${a.level})`)},{subtitle:"标准模块挂靠"})):(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"construction-org-outline-attached",status:"success",message:`标准模块挂靠:${a.totals.attachedModules} 个模块、${a.totals.sectionCount} 个小节全部挂靠`,details:a.attached.map(a=>`${"fallback"===a.kind?"兜底挂靠":"挂靠"}:${a.moduleTitle} → ${a.chapterTitle}`)},{subtitle:"标准模块挂靠"}))}let b$=await (0,M.Mv)(bF.map(a=>a.title),bZ.map(K)),b_=L({template:q,chapters:bZ,requirement:a.requirement,evaluationItems:bF,semanticSimilarity:b$});bO=(0,aO.w9)({chapters:b_.enrichedChapters,projectGraph:bA,canonicalFacts:bB}),(b_.issues.length>0||bH.issues.length>0)&&(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"bid-structure-audit",status:b_.issues.some(a=>"blocker"===a.severity)?"failed":"success",message:`评标结构符合性校验:${b_.diagnostics.length} 个结构组,${b_.diagnostics.filter(a=>"satisfied"===a.status).length} 个已满足,${b_.diagnostics.filter(a=>"missing"===a.status&&"required"===a.level).length} 个必查缺失(已自动补挂),${b_.diagnostics.filter(a=>"fragmented"===a.status).length} 个分散`,details:[...b_.diagnostics.map(a=>`${"satisfied"===a.status?"满足":"fragmented"===a.status?"分散":"补挂"}:${a.groupTitle}${"missing"===a.status?`(补挂小节:${a.missingSections.join("、")})`:""}`),...b_.issues.map(a=>`提示:${a.message}`).slice(0,8)]},{subtitle:"评标结构校验"})),q={...q,chapters:bO};let b0=await (0,M.Mv)(aw(bK).map(({item:a})=>av(a)),bO.map(a=>aA(a.title))),b1=await aB(bK,bO,b0);b1.length>0&&((0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"tender-requirement-routing",status:"success",message:`评分项要求章节级路由:${b1.length} 条要求已路由到责任章节(生成时显性响应)`,details:b1.map(a=>`${a.kind}“${a.item.text}” → ${a.chapterTitle}(相似度 ${a.score.toFixed(2)})`)},{subtitle:"要求响应路由",order:J.length})),C());let b2=await aG(),b3=await aM(),b4=function(a){let b=(0,G.yt)({template:{id:"runtime",name:a.templateName||"",outputTitle:"",description:"",category:"",chapters:a.chapters},chapters:a.chapters,requirement:a.requirement}),c=/施工组织设计|施工组织|施组|技术标/u.test(`${a.templateName||""} ${a.requirement||""} ${a.chapters.map(a=>a.title).join(" ")}`)||b.length>0,d=Object.values(a.factsModel?.canonical?.byKey||{}).map(a=>`${a.label}=${a.value}`),e=d.filter(a=>/建设规模|建筑面积|占地|用地面积|装配|层数|高度/u.test(a)).slice(0,8),f=(a.tenderRequirements?.frontScheduleClauses||[]).map(a=>a.text).filter(Boolean).slice(0,12),g=["正文必须落到本项目资料已确认的事实,不得使用模板化空话或跨小节复制段落","措施类内容写成“责任岗位+执行动作+量化标准+检查频次+整改时限+复查销项”闭环句式:同一自然段内三要素(责任岗位+检查频次+整改闭环)须同时出现,全文每 1500 字至少 1 段闭环句式","正文每 1000 字至少落位 6 处带单位量化工艺参数(mm/MPa/养护天数/间距/压实度等),施工流程与施工方法须有明确的工序顺序表达(形式由模型自然选择、不做统一要求:顺序词叙述、编号步骤、有序/无序列表或箭头链均可),每个分部分项方案至少 1 处 3 环节以上工序顺序表达",'专业工程类小节按"施工概况/施工流程/施工方法"三段式展开,小节标题用专业工程正式名称(如"拆除工程"),禁止使用"工作包"等后台概念命名','质量目标与创优目标必须使用招标文件原文的奖项名称逐字落位,禁止替换、降级或省略为其他奖项名称(如把招标文件指定奖项写成其他奖项);招标文件"确保/达到"类等级要求不得弱化为"争创/争取"',...f.length?[`投标人须知前附表响应条款(正文必须逐条落位或遵守,零响应即评标失分):${f.map((a,b)=>`${b+1}.${a}`).join(";")}`]:[]],h=a.chapters.map(b=>{var c;let d=(c=b.title,aN.find(a=>a.pattern.test(c))),e=(a.projectGraph?.works||[]).filter(a=>a.name&&(b.title.includes(a.name.slice(0,2))||/概况|总体|施工内容|方案|施工/u.test(b.title))).slice(0,10),f=(a.projectGraph?.resources||[]).filter(a=>a.quantity&&/概况|资源|总体|施工内容|方案/u.test(b.title)).slice(0,12).map(a=>({itemCode:"",itemName:a.name,quantity:a.quantity,unit:a.unit}));return{chapterId:b.id,chapterTitle:b.title,writingGoal:d?.goal||"结合本章标题与项目资料事实展开专业内容,避免泛化叙述",mustCover:[...d?.mustCover||[],...(b.requiredFacts||[]).slice(0,6)],factDomains:[...b.requiredFacts||[],...e.map(a=>a.name)].slice(0,10),evidenceRefs:b.queries.slice(0,6).map(a=>({filePath:a,kind:"query",priority:"should"})),boqTargets:f,drawingTargets:[],gaps:[]}});return{documentType:c?"施工组织设计":"专业文档",globalWritingFocus:c?[...g,"招标硬性要求必须逐项明确响应:质量标准、计划工期、缺陷责任期与保修、安全文明目标、项目经理及组织机构;工期/质量/保修类承诺可在概况与质量章节落位,不得遗漏",...e.length?[`项目规模事实卡(口径裁决值,正文引用规模数据必须与之一致,不得混淆总占地与建筑总量口径):${e.join(";")}`]:[],...d.length?[`项目可信基础事实(写作时必须优先落位):${d.slice(0,10).join(";")}`]:[]]:g.slice(0,2),chapters:h}}({chapters:bO,factsModel:by,projectGraph:bA||void 0,requirement:a.requirement,templateName:q.name,tenderRequirements:bK}),b5=[...(0,cK.$v)({templateName:q.name,chapterTitles:bO.map(a=>a.title),requirement:a.requirement,targetWords:bU.targetChars||0}),...(0,cK.Al)({templateName:q.name,chapterTitles:bO.map(a=>a.title),requirement:a.requirement})];b5.length>0&&(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"reference-benchmark",status:"success",message:"已读取模板参考库同类工程画像,作为质量软性参考注入文档蓝图",details:b5},{subtitle:"参考画像注入",order:J.length}));let b6=F({template:q,chapters:bO,factsModel:by,requirement:a.requirement,referenceLines:b5,scopeConflicts:bB.scopeConflicts});bR=[bQ,b6,function(a){if(!a||!au(a))return"";let b=[],c=(a,c)=>{for(let d of c)b.push(`${a}:${d.text}${d.source?`(来源:${d.source})`:""}。`)};return(c("本项目创优目标(必须全文显性响应,质量目标章节必须逐条承接并配套创优保证措施;奖项名称必须与招标文件原文逐字一致,禁止替换、降级或省略为其他奖项名称,“确保/达到”不得弱化为“争创”)",a.awardObjectives),c("特殊质量标准(实质性要求,质量目标必须显性写明)",a.specialQualityStandards),c("奖项条款(与创优目标关联,创优保证措施须覆盖申报与兑现条件)",a.awardClauses),a.greenBuildingGrade&&b.push(`绿色建筑等级要求:${a.greenBuildingGrade.text}。必须编制系统性绿色施工保证方案(节能/节地/节水/节材/室内环境指标控制与验收),不得仅以单一指标替代整体响应。`),a.smartSiteGrade&&b.push(`智慧工地等级要求:${a.smartSiteGrade.text},智慧工地建设方案须达到该等级。`),a.assemblyRate&&b.push(`装配率要求:${a.assemblyRate.text},装配式施工方案须覆盖水平构件与相关部品。`),c("体系基准要求(必须逐项覆盖表述,不得零散遗漏)",a.systematicBenchmarks),c("投标人须知前附表响应条款(施组必须逐条响应或遵守,零响应即评标失分)",a.frontScheduleClauses),a.dateFabricationProhibited&&b.push("禁止编造开工日期:招标文件以开工令时间为准,正文不得自行设定具体日历开工日期,一律表述为“以开工令时间为准”。"),c("禁止性/约束性要求(正文不得违反)",a.prohibitionNotes),a.pageLimit&&b.push(`篇幅建议:${a.pageLimit.text},注意控制篇幅与语言精练度。`),a.evaluationScheme&&b.push(`评标办法(章节结构的最强约束):${a.evaluationScheme.text}。正文章节结构必须逐项覆盖技术文件详细评审内容项,各评审项内容要对应到具体章节并做到针对性强、可落地;语言精练、不重复堆砌。`),0===b.length)?"":`【招标文件评分项要求(系统从绑定资料提取,必须逐条响应,零响应即评标失分)】
112
- ${b.map((a,b)=>`${b+1}. ${a}`).join("\n")}`}(bK)].filter(Boolean).join("\n\n"),bw||(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"document-blueprint",status:"success",message:"已生成全局事实主表与文档蓝图,后续章节和小节将共用同一套专业约束",details:b6.split("\n").slice(0,12)},{subtitle:"全局蓝图"}));let b7=(0,w.tF)({requirement:a.requirement,promptTexts:aJ,template:q,chapters:bO,spec:ao}),b8=function(a){let b=Date.now(),c=a.template.chapters.map(a=>{let b=a.sections?.length?a.sections:[a.title];return{chapterId:a.id,title:a.title,purpose:a.purpose||eo(a.title),requiredFacts:[...new Set([...a.requiredFacts||[],a.title])],requiredGraphNodes:[a.title],evidenceQueries:[...new Set([a.title,...a.queries||[],...a.requiredFacts||[]])],qualityRules:["项目专属事实必须来自锁定资料范围,不得混入其他项目名称","法规规范等公共知识不受锁定范围限制","不得出现后台话术和兜底措辞","章节必须覆盖规划小节"],forbiddenPhrases:eh,sections:b.map(b=>({title:b,objective:eo(b),requiredFacts:[...new Set([b,...a.requiredFacts||[]])],requiredGraphNodes:[b],evidenceQueries:[...new Set([a.title,b,...en(a.title),...en(b),...a.queries||[],...a.requiredFacts||[]].filter(Boolean))],forbiddenPhrases:eh,minChars:/项目特点.*重点.*难点|重点.*难点.*分析/u.test(b)?1800:/项目主要施工内容|主要分部分项工程施工方案|主要施工方法/u.test(b)?2200:/原材料进场复试|见证取样|危大工程专项施工方案审批流程/u.test(b)?800:/施工部署|施工流水|主要施工机械|劳动力|材料进场|资源动态|质量控制点|危大工程|安全隐患|临时用水|临时用电/u.test(b)?760:/概况|说明|依据/u.test(b)?260:420}))}});return{plan:{planId:`plan-${(0,z.c6)({templateId:a.template.id,scope:a.context.materialScope.scopeHash,chapters:c.map(a=>a.title)}).slice(0,10)}`,title:a.title||a.template.name,chapters:c,requiredGlobalFacts:["项目名称","工期","质量标准","招标范围"],forbiddenPhrases:eh,qualityRules:["资料范围先锁定","基础图谱必跑","章节任务先于正文","Reviewer 通过后才能导出"]},node:{id:"document-planner",type:"document_planner",status:"completed",startedAt:b,completedAt:Date.now(),outputSummary:`${c.length} 章、${c.reduce((a,b)=>a+b.sections.length,0)} 条细目任务`,metrics:{chapters:c.length}}}}({template:q,context:bz,title:q.name});bz.documentPlan=b8.plan,bz.nodes.push(b8.node),(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"agent-document-planner",status:"success",message:b8.node.outputSummary||"Agent 文档规划完成",details:b8.plan.chapters.map(a=>`${a.title}:${a.sections.length} 条细目`)},{subtitle:"Agent Document Planner",order:J.length})),B=bO.map(a=>a.id);let b9=b7.targetChars||[...b7.chapterTargets.values()].reduce((a,b)=>a+b,0),ca=(0,aR.JP)({template:q,targetWords:b9,requirement:a.requirement,materialFileCount:U.length,evidenceCount:a7.length}),cb=(0,aS.C)({template:q,chapters:bO,targetWords:b9,requirement:a.requirement,materialFileCount:U.length,evidenceCount:a7.length,hasVeryLargeExplicitChapter:bO.some(a=>(a.sections||[]).filter(Boolean).length>=30),configuredChapterConcurrency:Number(process.env.DOCUMENT_CHAPTER_CONCURRENCY||0),strategy:ca}),cc=(0,aR.Zk)(ca);(0,N.t5)(b9),(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"document-strategy",status:"success",message:`已自动选择 ${ca.mode} 生成策略:章节审查 ${ca.enableChapterReview?"启用":"跳过"}、全局审查 ${ca.enableGlobalReview?`${ca.globalReviewSamplingRate&&ca.globalReviewSamplingRate<1?`抽检 ${Math.round((ca.globalReviewSamplingRate??1)*100)}%`:"启用"}`:"跳过"}、最终质量审查 ${ca.enableFinalQualityReview?"启用":"跳过"}、全文扩写 ${ca.enableDocumentBudgetExpansion?"启用":"跳过"}`,details:cb.triggers},{subtitle:"后台自动策略"})),bB.scopeConflicts.length>0&&(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"scope-conflict-resolution",status:"success",message:`源级数据口径冲突已裁决(补疑/澄清修正文件权威最高):${bB.scopeConflicts.map(a=>a.resolution?`${a.scope} → ${a.resolution}`:`${a.scope} → 待人工复核`).join(";")}`,details:bB.scopeConflicts.flatMap(a=>a.values.map(a=>`来源「${a.sourceFile||"未知文件"}」取值 ${a.value}${a.unit}`))},{subtitle:"数据口径裁决"}));let cd=ad?"OUTLINE 章节":"模板章节",ce=(0,aQ.X5)({type:"validation",roleId:"section-planning",status:"success",message:`小节规划:${bW} 章由 LLM 基于${cd}、项目资料理解和证据规划小节,${bV} 章已由模板显式提供小节并跳过规划`},{subtitle:"小节规划策略"}),cf=ad?`;识别到 OUTLINE 章节 ${ac.length} 个`:";未识别到有效 OUTLINE,将使用模板章节",cg=[...P.prompts.map(a=>`${a.category}|${a.roleId}|${a.id}|${a.name}|${a.bindingSource}|${a.content.length} 字符|hash=${a.contentHash}|${a.contentPreview}`),...P.unresolvedRoles.map(a=>`unresolved|${a}|项目角色配置中的提示词角色不存在`),...P.missingResourceRoles.map(a=>`missingResource|${a}|提示词角色未显式绑定资源`)];(0,aQ.fx)(J,(0,aQ.X5)({type:"role_binding",roleId:H,status:"success",message:`已绑定项目资料 ${U.length} 份、${P.prompts.length} 个有效提示词;写作 ${P.writerPrompts.length}、章节 ${P.chapterPrompts.length}、抽取 ${P.extractionPrompts.length};已自动抽取运行时规则 ${aH.executionSummary.length} 条${cf}`,details:[...cg,...aH.executionSummary.map(a=>`runtimeRule|${a}`)]},{subtitle:I,roleName:I})),(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"runtime-prompt-rules",status:"success",message:`运行时提示词规则已抽取:${aH.executionSummary.length} 条,版本 ${aH.sourceHash}`,details:aH.executionSummary.length?[...aH.executionSummary,`必需表格:${aH.requiredTables.join("、")||"无"}`,`必含关键词:${aH.requiredKeywords?.join("、")||"无"}`,`禁含内容:${aH.forbiddenPatterns?.join("、")||"无"}`]:["未从提示词中识别到额外硬规则,使用系统默认质量规则"]},{subtitle:"提示词规则执行"})),(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"document-readiness",status:ar.ready?"success":"failed",message:"生成准备度:绑定资料已就绪",details:ar.diagnostics},{subtitle:"生成准备度检查"})),(0,aQ.fx)(J,ce),C();let ch=Math.round(([...b7.chapterTargets.values()].reduce((a,b)=>a+b,0)||b7.targetChars||0)/Math.max(1,bO.length)),ci=Number(process.env.DOCUMENT_CHAPTER_CONCURRENCY||0),cj=cb.chapterConcurrency,ck=cb.reviewConcurrency;(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"chapter-concurrency",status:"success",message:`章节流水线调度:${bO.length} 章全部同批并行生成,审查修复 ${ck} 路流水线(章节生成完立即进入审查,与后续章节生成重叠)`,details:[`有效章节数:${bO.length}`,`平均章节目标:${ch} 字`,Number.isFinite(ci)&&ci>0?`章节并发来自 DOCUMENT_CHAPTER_CONCURRENCY=${Math.floor(ci)}`:`全部章节并行生成,在飞调用不设并发上限;修复轮次预算 ${cb.repairRoundBudget} 轮`]},{subtitle:"章节流水线策略"})),C();let cl=new z.jf(ck),cm=[],cn={remaining:cb.repairPoolBudget},co=[...a0].filter(Boolean).sort(),cp=Date.now(),cq=co.length>0?(await (0,z.l$)(c7,async a=>bq(a,co,Math.min(a2,12),""),{kind:"search"})).flat():[];cc.evidence.searchQueries+=c7.length,cc.evidence.searchMs+=Date.now()-cp;for(let b=0;b<bO.length;b+=cj){let c=bO.slice(b,b+cj);for(let d of(await Promise.all(c.map(async(c,d)=>{let f,g=b+d;(0,z.Te)(a.signal);let h=Date.now(),i=J.length;try{var j,k;let b,d,m,p;J.push((0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:P.writerPrompts[0]?.id,status:"running",message:`${(0,t.GQ)(c.title)} 正在检索证据并准备章节内容`,details:[`章节序号:${g+1}/${bO.length}`,`二级小节:${c.sections?.length||0} 个`,"正在生成检索查询"],progress:{current:g+1,total:bO.length,label:"章节生成"}},{subtitle:(0,t.GQ)(c.title),order:g})),C();let r=a.resumeChapters?.find(a=>a.id===c.id||a.title===c.title),B=r?.content?.trim(),D=r?.evidence?.length?[...r.evidence]:[],F=W.chapterPlans.find(a=>a.chapterId===c.id||a.chapterTitle===c.title),G=F?Object.values(F.evidenceQueries).flat().filter(Boolean):[],H=c.queries.length>0?c.queries:[q.name,q.outputTitle,c.title],I=bN.get(c.id);if(bA&&I&&I.graphFiles.size>0){let a=[...a0],b=b=>a.includes(b)?b:a.find(a=>a.endsWith(b)||a.includes(b));for(let a of[...I.graphFiles].map(a=>b(a)||a).filter(a=>(0,aR.Tz)(o,a,a0))){let b=bp(a);if(b?.chunks?.length)for(let d of b.chunks)D.push({chapterId:c.id,filePath:b.file?.relativePath||a,score:5+(I.graphWorks.length+I.graphMethods.length)*.5,content:d.content,roleId:aW.get(a),processingType:aX.get(a),sectionTitle:d.sectionTitle,source:"graph-evidence"})}}let L=/概况|工程|项目|总体|部署|进度|工期|质量/u.test(c.title),O=dE(c,[...H,...G],[]),Q=Date.now();J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:P.writerPrompts[0]?.id,status:"running",message:`${(0,t.GQ)(c.title)} 正在执行质量优先的章节检索${I?.graphFiles.size?`(图谱匹配 ${I.graphFiles.size} 个文件)`:""}`,details:O.map(a=>`检索:${a.slice(0,42)}`),progress:{current:g+1,total:bO.length,label:"证据检索"}},{subtitle:(0,t.GQ)(c.title),order:g}),C();let S=B?[]:[...a0].filter(Boolean).sort(),T=B?[]:bw?.evidenceByChapterId?.[c.id]||[];T.length>0&&D.push(...T);let X=[],Y=(c.requiredFacts||[]).filter(a=>!!a&&!O.some(b=>b.includes(a)||a.includes(b))).map(a=>`${c.title} ${a}`),Z=[...O,...Y];if(S.length>0&&Z.length>0){(0,z.Te)(a.signal);let b=await (0,z.l$)(Z,async a=>bq(a,S,Math.min(a2,12),c.title),{kind:"search"});X.push(...b)}for(let a of(cc.evidence.searchQueries+=Z.length,cc.evidence.searchMs+=Date.now()-Q,X))D.push(...a.filter(a=>(0,aR.Tz)(o,a.filePath,aV)).map(a=>({chapterId:c.id,filePath:a.filePath,score:a.score,content:a.content,roleId:aW.get(a.filePath),processingType:aX.get(a.filePath),sectionTitle:a.sectionTitle,source:a.source})));L&&S.length>0&&cq.length>0&&D.push(...cq.filter(a=>(0,aR.Tz)(o,a.filePath,aV)).map(a=>({chapterId:c.id,filePath:a.filePath,score:a.score,content:a.content,roleId:aW.get(a.filePath),processingType:aX.get(a.filePath),sectionTitle:a.sectionTitle,source:"basic-fact-cache"})));let $=B?[]:await (0,aT.$b)({manager:y,projectRoot:o,chapter:c,plan:F,profile:V,scopedFilePaths:S,limitPerQuery:Math.min(a2,10),signal:a.signal}).catch(()=>[]);D.push(...$);let _=new Set((c.pinnedEvidenceFilePaths||[]).filter(Boolean)),aa=[];/概况|工程|项目|总体|部署|进度|工期|质量/u.test(c.title)&&D.push(...bs.map(a=>({...a,chapterId:c.id,source:"pinned-evidence"})));let ab=a7.filter(a=>/招标|投标须知|评标办法|专用合同条款|投标人须知/u.test(`${a.filePath||""}${a.sectionTitle||""}`));for(let a of(/概况|工程|项目|总体|部署/u.test(c.title)&&ab.length>0&&D.push(...ab.map(a=>({...a,chapterId:c.id,source:"pinned-evidence"}))),new Set([..._]))){if(!(0,aR.Tz)(o,a,aV))continue;let b=_.has(a),d=bp(a);d&&D.push(...d.chunks.map(a=>({chapterId:c.id,filePath:d.file.relativePath,score:1,content:a.content,roleId:aW.get(d.file.relativePath),processingType:aX.get(d.file.relativePath),sectionTitle:a.sectionTitle,source:b?"pinned-evidence":"bound-file"})))}let ac=D.filter(a=>(0,aR.Tz)(o,a.filePath,a0));if(!B&&aF.enabled&&aF.allowProjectFacts){let b=await bh({config:aF,chapterId:c.id,chapterTitle:c.title,sectionTitles:c.sections||[],runtimeRules:aH,localFacts:[...by.project,...by.schedule,...by.quality,...by.safety,...by.resources,...by.preciseFacts],signal:a.signal});bb.queries.push(...b.queries),bb.filteredCount+=b.filtered+b.evidence.length}let ad=B?[]:(0,aT.SK)({project:aY,chapter:c,plan:F,profile:V,scopedFilePaths:S,highRisk:a6.highRisk});ad.length>0&&ac.push(...bm(ad,a1));let ae=ac=bm(ac,a1),am=await (0,M.Mv)([K(c)],ae.map(dC)),an=dD(c,ac,{preservePinned:!0,semantic:{similarity:am,queryText:K(c)}},cc);an=c1(an,bB.scopeConflicts),bo(an,a1,`chapter:${c.id}:initial`);let aq=c.requiredFacts.filter(a=>!an.some(b=>(0,u.Lk)(b,a))),ar=0,as=I?[I.graphWorks.length?`图谱识别本章工程内容:${I.graphWorks.join("、")}`:"",I.graphMethods.length?`图谱识别本章施工方法:${I.graphMethods.join("、")}`:"",I.graphBoqItems.length?`图谱识别本章BOQ清单项(${I.graphBoqItems.length}项):${I.graphBoqItems.map(a=>`${a.name} ${a.quantity}${a.unit}`).join("、")}`:"",I.gaps.length?`图谱识别本章资料缺口:${I.gaps.join(";")}`:""].filter(Boolean).join("\n"):"",at=function(a){let b=[];for(let c of a){if(!c.resolution)continue;let a=c.values.filter(a=>`${a.value}${a.unit}`!==c.resolution);if(0===a.length)continue;let d=a.map(a=>`${a.value}${a.unit}`).join("、");"high"===c.confidence?b.push(`${c.scope}必须统一为 ${c.resolution}(补疑/答疑/澄清类修正文件权威最高;${d} 已被修正,正文禁止出现)`):"medium"===c.confidence?b.push(`${c.scope}应统一为 ${c.resolution}(按资料来源优先级裁决;${d} 为败选值,正文避免使用)`):b.push(`${c.scope}参考口径为 ${c.resolution}(锚定较弱,请人工复核;${d} 不参与自动改写)`)}return b}(bB.scopeConflicts),au=b1.length>0?(()=>{let a=aA(c.title),b=b1.filter(b=>b.chapterTitle===a);return 0===b.length?"":["【本章必须显性响应的招标要求(逐条写入正文,零响应即评标失分)】",...b.map(a=>`- ${a.kind}:${a.item.text}`)].join("\n")})():"",av=[as,au,at.length?`【数据口径强制约束】${at.join(";")}`:"",F?.writingGoal,F?.mustCover?.length?`本章必须覆盖:${F.mustCover.join("、")}`:"",F?.mustUseMaterialKinds?.length?`本章优先使用资料类型:${F.mustUseMaterialKinds.join("、")}`:""].filter(Boolean).join("\n"),aw=dv(P,c);if(P.writerPrompts.length>0&&!aw.primaryWriter)throw Error(`${(0,t.GQ)(c.title)} 写作主控提示词未进入章节生成阶段`);let ay=[aw.promptTexts,ax].filter(Boolean).join("\n\n"),az=aw.promptDetails.length?aw.promptDetails:["未绑定章节写作提示词"],aB=function(a){let b=a.profile||l,c=[],d=[a.template.name,a.template.outputTitle,a.chapter.title,a.chapter.purpose,...a.chapter.sections||[]].filter(Boolean).join(" "),e=a.spec?.chapterRules.find(b=>b.id===a.chapter.id||b.title===a.chapter.title);for(let d of a.chapter.requiredFacts||[])ah(c,b,{label:d,category:n(b,d)?.category||"required",required:!0,source:"template"});for(let d of a.chapter.sections||[])ah(c,b,{label:d,category:"section",required:!1,source:"section",queries:ag(d,[a.chapter.title])});for(let d of a.plan?.requiredContents||[])ah(c,b,{label:d,category:n(b,d)?.category||"plan",required:!0,source:"plan"});for(let d of a.plan?.evidenceNeeds||[])ah(c,b,{label:d,category:n(b,d)?.category||"plan",required:!0,source:"plan"});for(let d of e?.requiredFactIds||[]){let e=a.spec?.factFields.find(a=>a.id===d);e&&ah(c,b,{label:e.name,category:n(b,e.name)?.category||"spec",required:!0,source:"spec",fieldId:e.id,queries:ag(e.name,[e.extractionHint||"",e.validationHint||""])})}for(let e of a.spec?.factFields||[]){if(!e.required)continue;let f=n(b,e.name),g=`${e.name} ${e.extractionHint||""} ${e.validationHint||""}`;(d.includes(e.name)||ag(e.name,f?.aliases||[]).some(a=>d.includes(a))||a.chapter.requiredFacts.some(a=>a.includes(e.name)||e.name.includes(a)))&&ah(c,b,{label:e.name,category:f?.category||"spec",required:!0,source:"spec",fieldId:e.id,queries:ag(e.name,[g])})}for(let a of b.factFields)[a.name,...a.aliases].some(a=>a.length>=2&&d.includes(a))&&ai(c,b,a,"profile","must_use"===a.usagePolicy,[d]);let f=af(a.requirement||"");if(f)for(let a of b.factFields)[a.name,...a.aliases].some(a=>a.length>=2&&f.includes(a))&&ai(c,b,a,"requirement",!0,[f]);let g=af(a.promptTexts||"");if(g)for(let d of b.factFields)[d.name,...d.aliases].some(a=>a.length>=2&&g.includes(a))&&ai(c,b,d,"prompt","must_use"===d.usagePolicy,[a.chapter.title]);return c}({template:q,chapter:c,spec:ao,profile:ap,promptTexts:ay,requirement:a.requirement,plan:F?{requiredContents:F.mustCover,evidenceNeeds:Object.values(F.evidenceQueries).flat()}:void 0}),aC=ak({needs:aB,factsModel:by,evidence:ac,profile:ap}),aD=aC.filter(a=>a.need.required&&"satisfied"!==a.status).map(a=>a.need.label),aE=function(a){let b=(a.chapter.requiredFacts||[]).filter(b=>!a.evidence.some(a=>es(`${a.sectionTitle||""}${a.content||""}`).includes(es(b)))),c=(a.chapter.tablePlans||[]).flatMap(a=>a.fillability?.missingProjectFactFields||[]),d=a.evidence.length<3?["章节证据数量不足"]:[],e=b.length+c.length+d.length,f=e>=5?"high":e>=2?"medium":"low",g="high"===f?"evidence_first":c.length>0?"generate_with_review_notes":b.length>0?"section_first":"normal";return{chapterId:a.chapter.id,chapterTitle:a.chapter.title,canGenerate:!0,riskLevel:f,missingFacts:b,missingEvidence:d,tableFieldGaps:[...new Set(c)],suggestedStrategy:g,reason:0===e?"章节事实、证据和表格可填性满足常规生成条件。":`识别到 ${e} 项生成前缺口,按 ${g} 策略生成。`}}({chapter:c,evidence:an}),aG=new Set(an.map(a=>a.filePath)).size,aI=!!I&&(I?.graphFiles.size||0)>=8&&aG>=6&&0===aq.length&&"low"===aE.riskLevel,aJ=!((j={scopedFileCount:S.length,evidenceCount:an.length,evidenceFileCount:aG,suggestedStrategy:aE.suggestedStrategy,highRisk:a6.highRisk,missingFactsCount:aq.length,requiredMissingNeedsCount:aD.length,riskLevel:aE.riskLevel}).scopedFileCount>80)&&("evidence_first"===j.suggestedStrategy||j.highRisk||j.missingFactsCount>0||j.requiredMissingNeedsCount>0||j.evidenceFileCount<=2||j.evidenceCount<8&&"low"!==j.riskLevel);if(!aI&&aJ&&S.length>0){let b=await aP({manager:y,projectRoot:o,chapter:c,scopedFilePaths:S,fileRoleByPath:aW,fileProcessingByPath:aX,requiredNeeds:[...new Set([...aq,...aD])],highRisk:a6.highRisk||aD.length>0,signal:a.signal}).catch(()=>[]);ar=b.length,b.length>0&&(ac=dD(c,[...ac,...bm(b,a1)],{preservePinned:!0},cc),ac=bm(ac,a1),an=dD(c,ac,{preservePinned:!0},cc),an=c1(an,bB.scopeConflicts),bo(an,a1,`chapter:${c.id}:deep`),aq=c.requiredFacts.filter(a=>!an.some(b=>(0,u.Lk)(b,a)))),aD=(aC=ak({needs:aB,factsModel:by,evidence:ac,profile:ap})).filter(a=>a.need.required&&"satisfied"!==a.status).map(a=>a.need.label)}if(aD.length>0&&S.length>0){let b=bm(await aP({manager:y,projectRoot:o,chapter:c,scopedFilePaths:S,fileRoleByPath:aW,fileProcessingByPath:aX,requiredNeeds:aD,highRisk:!0,signal:a.signal}).catch(()=>[]),a1);b.length>0&&(ac=dD(c,[...ac,...b],{preservePinned:!0},cc),ac=bm(ac,a1),an=dD(c,ac,{preservePinned:!0},cc),an=c1(an,bB.scopeConflicts),bo(an,a1,`chapter:${c.id}:supplemental`),aq=c.requiredFacts.filter(a=>!an.some(b=>(0,u.Lk)(b,a))),aD=(aC=ak({needs:aB,factsModel:by,evidence:ac,profile:ap})).filter(a=>a.need.required&&"satisfied"!==a.status).map(a=>a.need.label))}for(let a of(bo(an,a1,`chapter:${c.id}:writer-input`),0===an.length&&bc.push(`${c.title}:缺少可支撑正文的项目资料证据`),aq))bc.push(`${c.title}:事实需求未满足 ${a}`);let aK=(0,aQ.X5)({type:"knowledge_retrieval",roleId:"knowledge-base",status:a7.length>0?"success":"failed",message:`已检索/绑定 ${a7.length} 条证据`});bi<0?bi=(0,aQ.fx)(J,aK):J[bi]={...aK,order:J[bi]?.order??aK.order},C(),(0,z.Te)(a.signal);let aL=new Map,aM=b=>{let d=(0,z.c6)({kind:"section",query:`${c.title} ${b}`.trim(),scopedFilePaths:S}),e=aL.get(d);if(e)return Promise.resolve(e);let f=(0,aU.Ym)(b,c,an),g=f.filter(a=>R.AM.test(a.content)).length;return f.length>=4&&g>=1?(aL.set(d,f),Promise.resolve(f)):dF({manager:y,projectRoot:o,chapter:c,sectionTitle:b,scopedFilePaths:S,fileRoleByPath:aW,fileProcessingByPath:aX,signal:a.signal}).then(a=>(aL.set(d,a),a))},aN=b=>{if(0===b.length||0===S.length)return Promise.resolve([]);let d=b.join(" ");return dF({manager:y,projectRoot:o,chapter:c,sectionTitle:d,scopedFilePaths:S,fileRoleByPath:aW,fileProcessingByPath:aX,signal:a.signal}).catch(()=>[])},aO=function(a){let b=a.chapter.sections?.length||0,c=(a.chapter.sections||[]).filter(b=>a.evidence.some(a=>(0,u.Lk)(a,b)||`${a.sectionTitle||""} ${a.content}`.includes(b))).length,d=a.chapter.requiredFacts.length,e=a.chapter.requiredFacts.filter(b=>a.evidence.some(a=>(0,u.Lk)(a,b))).length;return{chapterId:a.chapter.id,chapterTitle:a.chapter.title,risk:a.risk,evidenceCount:a.evidence.length,evidenceFiles:new Set(a.evidence.map(a=>a.filePath)).size,sectionCovered:c,sectionTotal:b,requiredFactCovered:e,requiredFactTotal:d}}({chapter:c,evidence:an,risk:a6});ba.push(aO);let aS=new Set(an.map(a=>a.filePath)),aZ=an.reduce((a,b)=>a+b.content.length,0),a5=[...a6.highRisk?[`召回覆盖风险(${a6.riskReason||"切片未完全预加载"}):已加载 ${a6.loadedChunks}/${a6.totalChunks},已启用深召回`]:[],`项目理解缓存证据:${T.length} 条`,`深召回证据:${ar} 条`,`事实覆盖:${aO.requiredFactCovered}/${aO.requiredFactTotal}`,`小节覆盖:${aO.sectionCovered}/${aO.sectionTotal}`];J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:P.writerPrompts[0]?.id,status:"running",message:`${(0,t.GQ)(c.title)} 已选取 ${an.length} 条高相关证据,正在生成正文`,details:[`使用绑定文件:${aS.size} 份`,`上下文字符:${aZ}`,`检索查询:${O.length} 组`,...a5],progress:{current:g+1,total:bO.length,label:"正文生成"}},{subtitle:(0,t.GQ)(c.title),order:g}),C(),cc.evidence.contextChars+=aZ;let a8=(k=aC,aj(k.flatMap(a=>a.facts))),a9=/概况|工程|项目|总体|部署|进度|工期|质量/u.test(c.title)?bu:[],be=(0,aU.hZ)({chapter:c,plan:void 0,spec:ao,roleFacts:aa,evidence:an,missingFacts:aq,indexedFacts:[...a9,...a8],resolvedFactNeeds:aC,factNeedsPrompt:function(a){let b=a.map(a=>{let b=a.facts.slice(0,5).map(b=>`${b.key||b.fieldName||a.need.label}=${al(b.value)}${b.sourceFile?`(${e.basename(b.sourceFile)})`:""}`),c=a.facts.length?[]:(a.evidence||[]).slice(0,2).map(a=>`证据片段:${al(a.content).slice(0,160)}${a.filePath?`(${e.basename(a.filePath)})`:""}`);return`- ${a.need.required?"必须":"相关"}|${a.need.label}|${a.status}${b.length||c.length?`:${[...b,...c].join(";")}`:":未在已解析资料中确认"}`});return b.length?`事实需求覆盖卡片:
113
- ${b.join("\n")}`:""}(aC)}),bj=function(a){let b=Date.now(),c=a.plan.chapters.find(b=>b.chapterId===a.chapter.id)||a.plan.chapters.find(b=>b.title===a.chapter.title);if(!c)throw Error(`缺少章节计划:${a.chapter.title}`);let d=a.context.facts.filter(a=>c.evidenceQueries.some(b=>el(a,b))||c.requiredFacts.some(b=>el(a,b))),e=c.sections.map(b=>{let c=a.context.facts.filter(a=>b.evidenceQueries.some(b=>el(a,b))||b.requiredFacts.some(b=>el(a,b))).slice(0,24),d=a.evidence.filter(a=>b.evidenceQueries.some(b=>(function(a,b){let c=ei(`${a.sectionTitle||""} ${a.content||""} ${a.filePath||""}`);return b.split(/[\s、,,;;::()()【】[-]+/u).filter(a=>a.length>=2).some(a=>c.includes(ei(a)))})(a,b))).slice(0,24),e=b.requiredGraphNodes.flatMap(b=>em(a.context.baseProjectGraph,b)).slice(0,12),f=[];return/法律法规|法规|规章|规范标准|标准规范|行业标准|现行规范|编制依据/u.test(b.title)||0!==d.length||0!==c.length||0!==e.length||f.push({level:"error",severity:"blocker",category:"evidence_coverage",owner:"system",message:`${b.title} 缺少事实、图谱或证据支撑`,suggestion:"应先定向检索和抽取事实,不能生成占位正文。"}),{...b,factIds:c.map(a=>(0,z.c6)({key:a.key,value:(0,z.lG)(a.value),sourceFile:a.sourceFile}).slice(0,12)),evidenceIds:d.map(a=>(0,z.c6)({filePath:a.filePath,content:a.content.slice(0,160),score:a.score}).slice(0,12)),graphNodeIds:e.map(a=>(0,z.c6)(a).slice(0,12)),ready:0===f.length,issues:f}}),f=e.flatMap(a=>a.issues),g={taskId:`chapter-task-${(0,z.c6)({plan:a.plan.planId,chapter:a.chapter.id,evidence:a.evidence.map(a=>(0,z.c6)({filePath:a.filePath,content:a.content.slice(0,120),score:a.score}))}).slice(0,10)}`,chapterId:a.chapter.id,title:a.chapter.title,facts:d.slice(0,48),evidence:a.evidence.slice(0,48),graphContext:em(a.context.baseProjectGraph,a.chapter.title).slice(0,20).join("\n"),sections:e,ready:0===f.length,issues:f};return{task:g,node:{id:`chapter-task-${a.chapter.id}`,type:"chapter_task_planner",status:g.ready?"completed":"failed",startedAt:b,completedAt:Date.now(),outputSummary:`${g.sections.filter(a=>a.ready).length}/${g.sections.length} 条细目任务就绪`,metrics:{facts:g.facts.length,evidence:g.evidence.length,issues:f.length},issues:f}}}({plan:b8.plan,chapter:c,context:bz,evidence:an});if(bz.chapterTasks=[...(bz.chapterTasks||[]).filter(a=>a.chapterId!==c.id),bj.task],bz.nodes.push(bj.node),(0,c3.cN)(bz),(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:`agent-chapter-task-${c.id}`,status:bj.task.ready||B?"success":"failed",message:bj.task.ready?bj.node.outputSummary||`${(0,t.GQ)(c.title)} 章节任务规划完成`:B?`${(0,t.GQ)(c.title)} 章节任务未完全就绪,已复用已有正文并交由 Reviewer/Repairer 处理`:bj.node.outputSummary||`${(0,t.GQ)(c.title)} 章节任务规划完成`,details:bj.task.issues.map(a=>a.message)},{subtitle:"Agent Chapter Task Planner",order:J.length})),C(A),!bj.task.ready&&!B)throw Error(`${(0,t.GQ)(c.title)} 章节任务未就绪:${bj.task.issues.map(a=>a.message).join(";")}`);let bk=[ay,ep(bj.task)].filter(Boolean).join("\n\n"),bl={total:aC.length,satisfied:aC.filter(a=>"satisfied"===a.status).length,missing:aC.filter(a=>"missing"===a.status).length,lowConfidence:aC.filter(a=>"low_confidence"===a.status).length};for(let a of aD)bc.push(`${c.title}:事实需求未确认 ${a}`);let bn=ao?.chapterRules.find(a=>a.id===c.id||a.title===c.title),br=b7.chapterTargets.get(c.id)||1200,bt=c.sections?.filter(Boolean).length||0,bv=/[、,,;;]/u.test(c.title),bx=function(a){let{budgetTarget:b,sectionCount:c,title:d,longformStrict:e}=a,f=/[、,,;;]/u.test(d),g=/工期|进度|质量|安全|危大|资源|人材机|保障|措施|重难点/u.test(d),h=/概况|结语|附录|说明/u.test(d),i=c>0?c*(f?720:g?900:780):g?5200:3600,j=e?h?2600:g?5200:3600:Math.min(1200,b),k=e?Math.min(Math.max(4200,b),c>=30?9800:f?8800:g?9200:7200):b,l=e?Math.max(j,b):Math.max(j,Math.min(b,i,k));return{budgetTarget:b,roundTarget:l,structureTarget:i,maxWords:Math.ceil(l*(a.longformStrict?1.12:1.18)),label:`章节预算约 ${b} 字,本轮生成约 ${l} 字,结构目标约 ${i} 字`}}({budgetTarget:br,sectionCount:bt,title:c.title,longformStrict:b7.longformStrict}),bC=Math.ceil(bx.maxWords*(b7.maxChars?1.05:1)),bD=b7.targetChars?Math.min(1800,Math.max(600,Math.floor(.45*bx.roundTarget))):1200,bE=bx.roundTarget,bF=Math.max(Math.min(bn?.minWords||0,bE),Math.min(ao?.dynamicChapterRule.minWordsPerChapter||0,bE),Math.floor(.68*bE),bD),bG=(0,aU.uV)(bF,bE),bH=bt>0?b7.longformStrict?bE:Math.min(bE,Math.max(1800,bx.structureTarget)):bE,bI=Math.max(4,Number(process.env.DOCUMENT_SECTION_FIRST_MAX_SECTIONS||8)),bJ=process.env.DOCUMENT_SECTION_FIRST_GENERATION,bK=void 0!==bJ&&0===Number(bJ),bL=void 0!==bJ&&0!==Number(bJ),bM=bE>=6e3&&bt>=4&&bt<=bI&&!bv,bP=!bK&&bt>=2&&(bt>bI||bv||b7.longformStrict&&bt>=6),bQ=!bK&&!bP&&bt>=2&&bt<=bI&&(bL||bM||b7.longformStrict),bS=0,bT=a=>{let b=Date.now();if(b-bS<3e3)return;bS=b;let d=a.filter(Boolean).join("\n\n");d.trim()&&C([...A,{id:c.id,title:c.title,content:`## ${c.title}
112
+ ${b.map((a,b)=>`${b+1}. ${a}`).join("\n")}`}(bK)].filter(Boolean).join("\n\n"),bw||(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"document-blueprint",status:"success",message:"已生成全局事实主表与文档蓝图,后续章节和小节将共用同一套专业约束",details:b6.split("\n").slice(0,12)},{subtitle:"全局蓝图"}));let b7=(0,w.tF)({requirement:a.requirement,promptTexts:aJ,template:q,chapters:bO,spec:ao}),b8=function(a){let b=Date.now(),c=a.template.chapters.map(a=>{let b=a.sections?.length?a.sections:[a.title];return{chapterId:a.id,title:a.title,purpose:a.purpose||eo(a.title),requiredFacts:[...new Set([...a.requiredFacts||[],a.title])],requiredGraphNodes:[a.title],evidenceQueries:[...new Set([a.title,...a.queries||[],...a.requiredFacts||[]])],qualityRules:["项目专属事实必须来自锁定资料范围,不得混入其他项目名称","法规规范等公共知识不受锁定范围限制","不得出现后台话术和兜底措辞","章节必须覆盖规划小节"],forbiddenPhrases:eh,sections:b.map(b=>({title:b,objective:eo(b),requiredFacts:[...new Set([b,...a.requiredFacts||[]])],requiredGraphNodes:[b],evidenceQueries:[...new Set([a.title,b,...en(a.title),...en(b),...a.queries||[],...a.requiredFacts||[]].filter(Boolean))],forbiddenPhrases:eh,minChars:/项目特点.*重点.*难点|重点.*难点.*分析/u.test(b)?1800:/项目主要施工内容|主要分部分项工程施工方案|主要施工方法/u.test(b)?2200:/原材料进场复试|见证取样|危大工程专项施工方案审批流程/u.test(b)?800:/施工部署|施工流水|主要施工机械|劳动力|材料进场|资源动态|质量控制点|危大工程|安全隐患|临时用水|临时用电/u.test(b)?760:/概况|说明|依据/u.test(b)?260:420}))}});return{plan:{planId:`plan-${(0,z.c6)({templateId:a.template.id,scope:a.context.materialScope.scopeHash,chapters:c.map(a=>a.title)}).slice(0,10)}`,title:a.title||a.template.name,chapters:c,requiredGlobalFacts:["项目名称","工期","质量标准","招标范围"],forbiddenPhrases:eh,qualityRules:["资料范围先锁定","基础图谱必跑","章节任务先于正文","Reviewer 通过后才能导出"]},node:{id:"document-planner",type:"document_planner",status:"completed",startedAt:b,completedAt:Date.now(),outputSummary:`${c.length} 章、${c.reduce((a,b)=>a+b.sections.length,0)} 条细目任务`,metrics:{chapters:c.length}}}}({template:q,context:bz,title:q.name});bz.documentPlan=b8.plan,bz.nodes.push(b8.node),(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"agent-document-planner",status:"success",message:b8.node.outputSummary||"Agent 文档规划完成",details:b8.plan.chapters.map(a=>`${a.title}:${a.sections.length} 条细目`)},{subtitle:"Agent Document Planner",order:J.length})),B=bO.map(a=>a.id);let b9=b7.targetChars||[...b7.chapterTargets.values()].reduce((a,b)=>a+b,0),ca=(0,aR.JP)({template:q,targetWords:b9,requirement:a.requirement,materialFileCount:U.length,evidenceCount:a7.length}),cb=(0,aS.C)({template:q,chapters:bO,targetWords:b9,requirement:a.requirement,materialFileCount:U.length,evidenceCount:a7.length,hasVeryLargeExplicitChapter:bO.some(a=>(a.sections||[]).filter(Boolean).length>=30),configuredChapterConcurrency:Number(process.env.DOCUMENT_CHAPTER_CONCURRENCY||0),strategy:ca}),cc=(0,aR.Zk)(ca);(0,N.t5)(b9),(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"document-strategy",status:"success",message:`已自动选择 ${ca.mode} 生成策略:章节审查 ${ca.enableChapterReview?"启用":"跳过"}、全局审查 ${ca.enableGlobalReview?`${ca.globalReviewSamplingRate&&ca.globalReviewSamplingRate<1?`抽检 ${Math.round((ca.globalReviewSamplingRate??1)*100)}%`:"启用"}`:"跳过"}、最终质量审查 ${ca.enableFinalQualityReview?"启用":"跳过"}、全文扩写 ${ca.enableDocumentBudgetExpansion?"启用":"跳过"}`,details:cb.triggers},{subtitle:"后台自动策略"})),bB.scopeConflicts.length>0&&(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"scope-conflict-resolution",status:"success",message:`源级数据口径冲突已裁决(补疑/澄清修正文件权威最高):${bB.scopeConflicts.map(a=>a.resolution?`${a.scope} → ${a.resolution}`:`${a.scope} → 待人工复核`).join(";")}`,details:bB.scopeConflicts.flatMap(a=>a.values.map(a=>`来源「${a.sourceFile||"未知文件"}」取值 ${a.value}${a.unit}`))},{subtitle:"数据口径裁决"}));let cd=ad?"OUTLINE 章节":"模板章节",ce=(0,aQ.X5)({type:"validation",roleId:"section-planning",status:"success",message:`小节规划:${bW} 章由 LLM 基于${cd}、项目资料理解和证据规划小节,${bV} 章已由模板显式提供小节并跳过规划`},{subtitle:"小节规划策略"}),cf=ad?`;识别到 OUTLINE 章节 ${ac.length} 个`:";未识别到有效 OUTLINE,将使用模板章节",cg=[...P.prompts.map(a=>`${a.category}|${a.roleId}|${a.id}|${a.name}|${a.bindingSource}|${a.content.length} 字符|hash=${a.contentHash}|${a.contentPreview}`),...P.unresolvedRoles.map(a=>`unresolved|${a}|项目角色配置中的提示词角色不存在`),...P.missingResourceRoles.map(a=>`missingResource|${a}|提示词角色未显式绑定资源`)];(0,aQ.fx)(J,(0,aQ.X5)({type:"role_binding",roleId:H,status:"success",message:`已绑定项目资料 ${U.length} 份、${P.prompts.length} 个有效提示词;写作 ${P.writerPrompts.length}、章节 ${P.chapterPrompts.length}、抽取 ${P.extractionPrompts.length};已自动抽取运行时规则 ${aH.executionSummary.length} 条${cf}`,details:[...cg,...aH.executionSummary.map(a=>`runtimeRule|${a}`)]},{subtitle:I,roleName:I})),(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"runtime-prompt-rules",status:"success",message:`运行时提示词规则已抽取:${aH.executionSummary.length} 条,版本 ${aH.sourceHash}`,details:aH.executionSummary.length?[...aH.executionSummary,`必需表格:${aH.requiredTables.join("、")||"无"}`,`必含关键词:${aH.requiredKeywords?.join("、")||"无"}`,`禁含内容:${aH.forbiddenPatterns?.join("、")||"无"}`]:["未从提示词中识别到额外硬规则,使用系统默认质量规则"]},{subtitle:"提示词规则执行"})),(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"document-readiness",status:ar.ready?"success":"failed",message:"生成准备度:绑定资料已就绪",details:ar.diagnostics},{subtitle:"生成准备度检查"})),(0,aQ.fx)(J,ce),C();let ch=Math.round(([...b7.chapterTargets.values()].reduce((a,b)=>a+b,0)||b7.targetChars||0)/Math.max(1,bO.length)),ci=Number(process.env.DOCUMENT_CHAPTER_CONCURRENCY||0),cj=cb.chapterConcurrency,ck=cb.reviewConcurrency;(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"chapter-concurrency",status:"success",message:`章节流水线调度:${bO.length} 章全部同批并行生成,审查修复 ${ck} 路流水线(章节生成完立即进入审查,与后续章节生成重叠)`,details:[`有效章节数:${bO.length}`,`平均章节目标:${ch} 字`,Number.isFinite(ci)&&ci>0?`章节并发来自 DOCUMENT_CHAPTER_CONCURRENCY=${Math.floor(ci)}`:`全部章节并行生成,在飞调用不设并发上限;修复轮次预算 ${cb.repairRoundBudget} 轮`]},{subtitle:"章节流水线策略"})),C();let cl=new z.jf(ck),cm=[],cn={remaining:cb.repairPoolBudget},co=[...a0].filter(Boolean).sort(),cp=Date.now(),cq=co.length>0?(await (0,z.l$)(c7,async a=>bq(a,co,Math.min(a2,12),""),{kind:"search"})).flat():[];cc.evidence.searchQueries+=c7.length,cc.evidence.searchMs+=Date.now()-cp;for(let b=0;b<bO.length;b+=cj){let c=bO.slice(b,b+cj);for(let d of(await Promise.all(c.map(async(c,d)=>{let f,g=b+d;(0,z.Te)(a.signal);let h=Date.now(),i=J.length;try{var j;let b,d,k,m;J.push((0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:P.writerPrompts[0]?.id,status:"running",message:`${(0,t.GQ)(c.title)} 正在检索证据并准备章节内容`,details:[`章节序号:${g+1}/${bO.length}`,`二级小节:${c.sections?.length||0} 个`,"正在生成检索查询"],progress:{current:g+1,total:bO.length,label:"章节生成"}},{subtitle:(0,t.GQ)(c.title),order:g})),C();let p=a.resumeChapters?.find(a=>a.id===c.id||a.title===c.title),r=p?.content?.trim(),B=p?.evidence?.length?[...p.evidence]:[],D=W.chapterPlans.find(a=>a.chapterId===c.id||a.chapterTitle===c.title),F=D?Object.values(D.evidenceQueries).flat().filter(Boolean):[],G=c.queries.length>0?c.queries:[q.name,q.outputTitle,c.title],H=bN.get(c.id);if(bA&&H&&H.graphFiles.size>0){let a=[...a0],b=b=>a.includes(b)?b:a.find(a=>a.endsWith(b)||a.includes(b));for(let a of[...H.graphFiles].map(a=>b(a)||a).filter(a=>(0,aR.Tz)(o,a,a0))){let b=bp(a);if(b?.chunks?.length)for(let d of b.chunks)B.push({chapterId:c.id,filePath:b.file?.relativePath||a,score:5+(H.graphWorks.length+H.graphMethods.length)*.5,content:d.content,roleId:aW.get(a),processingType:aX.get(a),sectionTitle:d.sectionTitle,source:"graph-evidence"})}}let I=/概况|工程|项目|总体|部署|进度|工期|质量/u.test(c.title),L=dE(c,[...G,...F],[]),O=Date.now();J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:P.writerPrompts[0]?.id,status:"running",message:`${(0,t.GQ)(c.title)} 正在执行质量优先的章节检索${H?.graphFiles.size?`(图谱匹配 ${H.graphFiles.size} 个文件)`:""}`,details:L.map(a=>`检索:${a.slice(0,42)}`),progress:{current:g+1,total:bO.length,label:"证据检索"}},{subtitle:(0,t.GQ)(c.title),order:g}),C();let Q=r?[]:[...a0].filter(Boolean).sort(),S=r?[]:bw?.evidenceByChapterId?.[c.id]||[];S.length>0&&B.push(...S);let T=[],X=(c.requiredFacts||[]).filter(a=>!!a&&!L.some(b=>b.includes(a)||a.includes(b))).map(a=>`${c.title} ${a}`),Y=[...L,...X];if(Q.length>0&&Y.length>0){(0,z.Te)(a.signal);let b=await (0,z.l$)(Y,async a=>bq(a,Q,Math.min(a2,12),c.title),{kind:"search"});T.push(...b)}for(let a of(cc.evidence.searchQueries+=Y.length,cc.evidence.searchMs+=Date.now()-O,T))B.push(...a.filter(a=>(0,aR.Tz)(o,a.filePath,aV)).map(a=>({chapterId:c.id,filePath:a.filePath,score:a.score,content:a.content,roleId:aW.get(a.filePath),processingType:aX.get(a.filePath),sectionTitle:a.sectionTitle,source:a.source})));I&&Q.length>0&&cq.length>0&&B.push(...cq.filter(a=>(0,aR.Tz)(o,a.filePath,aV)).map(a=>({chapterId:c.id,filePath:a.filePath,score:a.score,content:a.content,roleId:aW.get(a.filePath),processingType:aX.get(a.filePath),sectionTitle:a.sectionTitle,source:"basic-fact-cache"})));let Z=r?[]:await (0,aT.$b)({manager:y,projectRoot:o,chapter:c,plan:D,profile:V,scopedFilePaths:Q,limitPerQuery:Math.min(a2,10),signal:a.signal}).catch(()=>[]);B.push(...Z);let $=new Set((c.pinnedEvidenceFilePaths||[]).filter(Boolean)),_=[];/概况|工程|项目|总体|部署|进度|工期|质量/u.test(c.title)&&B.push(...bs.map(a=>({...a,chapterId:c.id,source:"pinned-evidence"})));let aa=a7.filter(a=>/招标|投标须知|评标办法|专用合同条款|投标人须知/u.test(`${a.filePath||""}${a.sectionTitle||""}`));for(let a of(/概况|工程|项目|总体|部署/u.test(c.title)&&aa.length>0&&B.push(...aa.map(a=>({...a,chapterId:c.id,source:"pinned-evidence"}))),new Set([...$]))){if(!(0,aR.Tz)(o,a,aV))continue;let b=$.has(a),d=bp(a);d&&B.push(...d.chunks.map(a=>({chapterId:c.id,filePath:d.file.relativePath,score:1,content:a.content,roleId:aW.get(d.file.relativePath),processingType:aX.get(d.file.relativePath),sectionTitle:a.sectionTitle,source:b?"pinned-evidence":"bound-file"})))}let ab=B.filter(a=>(0,aR.Tz)(o,a.filePath,a0));if(!r&&aF.enabled&&aF.allowProjectFacts){let b=await bh({config:aF,chapterId:c.id,chapterTitle:c.title,sectionTitles:c.sections||[],runtimeRules:aH,localFacts:[...by.project,...by.schedule,...by.quality,...by.safety,...by.resources,...by.preciseFacts],signal:a.signal});bb.queries.push(...b.queries),bb.filteredCount+=b.filtered+b.evidence.length}let ac=r?[]:(0,aT.SK)({project:aY,chapter:c,plan:D,profile:V,scopedFilePaths:Q,highRisk:a6.highRisk});ac.length>0&&ab.push(...bm(ac,a1));let ad=ab=bm(ab,a1),ae=await (0,M.Mv)([K(c)],ad.map(dC)),am=dD(c,ab,{preservePinned:!0,semantic:{similarity:ae,queryText:K(c)}},cc);am=c1(am,bB.scopeConflicts),bo(am,a1,`chapter:${c.id}:initial`);let an=c.requiredFacts.filter(a=>!am.some(b=>(0,u.Lk)(b,a))),aq=0,ar=H?[H.graphWorks.length?`图谱识别本章工程内容:${H.graphWorks.join("、")}`:"",H.graphMethods.length?`图谱识别本章施工方法:${H.graphMethods.join("、")}`:"",H.graphBoqItems.length?`图谱识别本章BOQ清单项(${H.graphBoqItems.length}项):${H.graphBoqItems.map(a=>`${a.name} ${a.quantity}${a.unit}`).join("、")}`:"",H.gaps.length?`图谱识别本章资料缺口:${H.gaps.join(";")}`:""].filter(Boolean).join("\n"):"",as=function(a){let b=[];for(let c of a){if(!c.resolution)continue;let a=c.values.filter(a=>`${a.value}${a.unit}`!==c.resolution);if(0===a.length)continue;let d=a.map(a=>`${a.value}${a.unit}`).join("、");"high"===c.confidence?b.push(`${c.scope}必须统一为 ${c.resolution}(补疑/答疑/澄清类修正文件权威最高;${d} 已被修正,正文禁止出现)`):"medium"===c.confidence?b.push(`${c.scope}应统一为 ${c.resolution}(按资料来源优先级裁决;${d} 为败选值,正文避免使用)`):b.push(`${c.scope}参考口径为 ${c.resolution}(锚定较弱,请人工复核;${d} 不参与自动改写)`)}return b}(bB.scopeConflicts),at=b1.length>0?(()=>{let a=aA(c.title),b=b1.filter(b=>b.chapterTitle===a);return 0===b.length?"":["【本章必须显性响应的招标要求(逐条写入正文,零响应即评标失分)】",...b.map(a=>`- ${a.kind}:${a.item.text}`)].join("\n")})():"",au=[ar,at,as.length?`【数据口径强制约束】${as.join(";")}`:"",D?.writingGoal,D?.mustCover?.length?`本章必须覆盖:${D.mustCover.join("、")}`:"",D?.mustUseMaterialKinds?.length?`本章优先使用资料类型:${D.mustUseMaterialKinds.join("、")}`:""].filter(Boolean).join("\n"),av=dv(P,c);if(P.writerPrompts.length>0&&!av.primaryWriter)throw Error(`${(0,t.GQ)(c.title)} 写作主控提示词未进入章节生成阶段`);let aw=[av.promptTexts,ax].filter(Boolean).join("\n\n"),ay=av.promptDetails.length?av.promptDetails:["未绑定章节写作提示词"],az=function(a){let b=a.profile||l,c=[],d=[a.template.name,a.template.outputTitle,a.chapter.title,a.chapter.purpose,...a.chapter.sections||[]].filter(Boolean).join(" "),e=a.spec?.chapterRules.find(b=>b.id===a.chapter.id||b.title===a.chapter.title);for(let d of a.chapter.requiredFacts||[])ah(c,b,{label:d,category:n(b,d)?.category||"required",required:!0,source:"template"});for(let d of a.chapter.sections||[])ah(c,b,{label:d,category:"section",required:!1,source:"section",queries:ag(d,[a.chapter.title])});for(let d of a.plan?.requiredContents||[])ah(c,b,{label:d,category:n(b,d)?.category||"plan",required:!0,source:"plan"});for(let d of a.plan?.evidenceNeeds||[])ah(c,b,{label:d,category:n(b,d)?.category||"plan",required:!0,source:"plan"});for(let d of e?.requiredFactIds||[]){let e=a.spec?.factFields.find(a=>a.id===d);e&&ah(c,b,{label:e.name,category:n(b,e.name)?.category||"spec",required:!0,source:"spec",fieldId:e.id,queries:ag(e.name,[e.extractionHint||"",e.validationHint||""])})}for(let e of a.spec?.factFields||[]){if(!e.required)continue;let f=n(b,e.name),g=`${e.name} ${e.extractionHint||""} ${e.validationHint||""}`;(d.includes(e.name)||ag(e.name,f?.aliases||[]).some(a=>d.includes(a))||a.chapter.requiredFacts.some(a=>a.includes(e.name)||e.name.includes(a)))&&ah(c,b,{label:e.name,category:f?.category||"spec",required:!0,source:"spec",fieldId:e.id,queries:ag(e.name,[g])})}for(let a of b.factFields)[a.name,...a.aliases].some(a=>a.length>=2&&d.includes(a))&&ai(c,b,a,"profile","must_use"===a.usagePolicy,[d]);let f=af(a.requirement||"");if(f)for(let a of b.factFields)[a.name,...a.aliases].some(a=>a.length>=2&&f.includes(a))&&ai(c,b,a,"requirement",!0,[f]);let g=af(a.promptTexts||"");if(g)for(let d of b.factFields)[d.name,...d.aliases].some(a=>a.length>=2&&g.includes(a))&&ai(c,b,d,"prompt","must_use"===d.usagePolicy,[a.chapter.title]);return c}({template:q,chapter:c,spec:ao,profile:ap,promptTexts:aw,requirement:a.requirement,plan:D?{requiredContents:D.mustCover,evidenceNeeds:Object.values(D.evidenceQueries).flat()}:void 0}),aB=ak({needs:az,factsModel:by,evidence:ab,profile:ap}),aC=aB.filter(a=>a.need.required&&"satisfied"!==a.status).map(a=>a.need.label),aD=function(a){let b=(a.chapter.requiredFacts||[]).filter(b=>!a.evidence.some(a=>es(`${a.sectionTitle||""}${a.content||""}`).includes(es(b)))),c=(a.chapter.tablePlans||[]).flatMap(a=>a.fillability?.missingProjectFactFields||[]),d=a.evidence.length<3?["章节证据数量不足"]:[],e=b.length+c.length+d.length,f=e>=5?"high":e>=2?"medium":"low",g="high"===f?"evidence_first":c.length>0?"generate_with_review_notes":b.length>0?"section_first":"normal";return{chapterId:a.chapter.id,chapterTitle:a.chapter.title,canGenerate:!0,riskLevel:f,missingFacts:b,missingEvidence:d,tableFieldGaps:[...new Set(c)],suggestedStrategy:g,reason:0===e?"章节事实、证据和表格可填性满足常规生成条件。":`识别到 ${e} 项生成前缺口,按 ${g} 策略生成。`}}({chapter:c,evidence:am}),aE=new Set(am.map(a=>a.filePath)).size,aG=!!H&&(H?.graphFiles.size||0)>=8&&aE>=6&&0===an.length&&"low"===aD.riskLevel,aI=function(a){let b=a.evidenceFileCount<=2;return a.scopedFileCount>80?b:"evidence_first"===a.suggestedStrategy||a.highRisk||a.missingFactsCount>0||a.requiredMissingNeedsCount>0||b||a.evidenceCount<8&&"low"!==a.riskLevel}({scopedFileCount:Q.length,evidenceCount:am.length,evidenceFileCount:aE,suggestedStrategy:aD.suggestedStrategy,highRisk:a6.highRisk,missingFactsCount:an.length,requiredMissingNeedsCount:aC.length,riskLevel:aD.riskLevel});if(!aG&&aI&&Q.length>0){let b=await aP({manager:y,projectRoot:o,chapter:c,scopedFilePaths:Q,fileRoleByPath:aW,fileProcessingByPath:aX,requiredNeeds:[...new Set([...an,...aC])],highRisk:a6.highRisk||aC.length>0,signal:a.signal}).catch(()=>[]);aq=b.length,b.length>0&&(ab=dD(c,[...ab,...bm(b,a1)],{preservePinned:!0},cc),ab=bm(ab,a1),am=dD(c,ab,{preservePinned:!0},cc),am=c1(am,bB.scopeConflicts),bo(am,a1,`chapter:${c.id}:deep`),an=c.requiredFacts.filter(a=>!am.some(b=>(0,u.Lk)(b,a)))),aC=(aB=ak({needs:az,factsModel:by,evidence:ab,profile:ap})).filter(a=>a.need.required&&"satisfied"!==a.status).map(a=>a.need.label)}if(aC.length>0&&Q.length>0){let b=bm(await aP({manager:y,projectRoot:o,chapter:c,scopedFilePaths:Q,fileRoleByPath:aW,fileProcessingByPath:aX,requiredNeeds:aC,highRisk:!0,signal:a.signal}).catch(()=>[]),a1);b.length>0&&(ab=dD(c,[...ab,...b],{preservePinned:!0},cc),ab=bm(ab,a1),am=dD(c,ab,{preservePinned:!0},cc),am=c1(am,bB.scopeConflicts),bo(am,a1,`chapter:${c.id}:supplemental`),an=c.requiredFacts.filter(a=>!am.some(b=>(0,u.Lk)(b,a))),aC=(aB=ak({needs:az,factsModel:by,evidence:ab,profile:ap})).filter(a=>a.need.required&&"satisfied"!==a.status).map(a=>a.need.label))}for(let a of(bo(am,a1,`chapter:${c.id}:writer-input`),0===am.length&&bc.push(`${c.title}:缺少可支撑正文的项目资料证据`),an))bc.push(`${c.title}:事实需求未满足 ${a}`);let aJ=(0,aQ.X5)({type:"knowledge_retrieval",roleId:"knowledge-base",status:a7.length>0?"success":"failed",message:`已检索/绑定 ${a7.length} 条证据`});bi<0?bi=(0,aQ.fx)(J,aJ):J[bi]={...aJ,order:J[bi]?.order??aJ.order},C(),(0,z.Te)(a.signal);let aK=new Map,aL=b=>{let d=(0,z.c6)({kind:"section",query:`${c.title} ${b}`.trim(),scopedFilePaths:Q}),e=aK.get(d);if(e)return Promise.resolve(e);let f=(0,aU.Ym)(b,c,am),g=f.filter(a=>R.AM.test(a.content)).length;return f.length>=4&&g>=1?(aK.set(d,f),Promise.resolve(f)):dF({manager:y,projectRoot:o,chapter:c,sectionTitle:b,scopedFilePaths:Q,fileRoleByPath:aW,fileProcessingByPath:aX,signal:a.signal}).then(a=>(aK.set(d,a),a))},aM=b=>{if(0===b.length||0===Q.length)return Promise.resolve([]);let d=b.join(" ");return dF({manager:y,projectRoot:o,chapter:c,sectionTitle:d,scopedFilePaths:Q,fileRoleByPath:aW,fileProcessingByPath:aX,signal:a.signal}).catch(()=>[])},aN=function(a){let b=a.chapter.sections?.length||0,c=(a.chapter.sections||[]).filter(b=>a.evidence.some(a=>(0,u.Lk)(a,b)||`${a.sectionTitle||""} ${a.content}`.includes(b))).length,d=a.chapter.requiredFacts.length,e=a.chapter.requiredFacts.filter(b=>a.evidence.some(a=>(0,u.Lk)(a,b))).length;return{chapterId:a.chapter.id,chapterTitle:a.chapter.title,risk:a.risk,evidenceCount:a.evidence.length,evidenceFiles:new Set(a.evidence.map(a=>a.filePath)).size,sectionCovered:c,sectionTotal:b,requiredFactCovered:e,requiredFactTotal:d}}({chapter:c,evidence:am,risk:a6});ba.push(aN);let aO=new Set(am.map(a=>a.filePath)),aS=am.reduce((a,b)=>a+b.content.length,0),aZ=[...a6.highRisk?[`召回覆盖风险(${a6.riskReason||"切片未完全预加载"}):已加载 ${a6.loadedChunks}/${a6.totalChunks},已启用深召回`]:[],`项目理解缓存证据:${S.length} 条`,`深召回证据:${aq} 条`,`事实覆盖:${aN.requiredFactCovered}/${aN.requiredFactTotal}`,`小节覆盖:${aN.sectionCovered}/${aN.sectionTotal}`];J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:P.writerPrompts[0]?.id,status:"running",message:`${(0,t.GQ)(c.title)} 已选取 ${am.length} 条高相关证据,正在生成正文`,details:[`使用绑定文件:${aO.size} 份`,`上下文字符:${aS}`,`检索查询:${L.length} 组`,...aZ],progress:{current:g+1,total:bO.length,label:"正文生成"}},{subtitle:(0,t.GQ)(c.title),order:g}),C(),cc.evidence.contextChars+=aS;let a5=(j=aB,aj(j.flatMap(a=>a.facts))),a8=/概况|工程|项目|总体|部署|进度|工期|质量/u.test(c.title)?bu:[],a9=(0,aU.hZ)({chapter:c,plan:void 0,spec:ao,roleFacts:_,evidence:am,missingFacts:an,indexedFacts:[...a8,...a5],resolvedFactNeeds:aB,factNeedsPrompt:function(a){let b=a.map(a=>{let b=a.facts.slice(0,5).map(b=>`${b.key||b.fieldName||a.need.label}=${al(b.value)}${b.sourceFile?`(${e.basename(b.sourceFile)})`:""}`),c=a.facts.length?[]:(a.evidence||[]).slice(0,2).map(a=>`证据片段:${al(a.content).slice(0,160)}${a.filePath?`(${e.basename(a.filePath)})`:""}`);return`- ${a.need.required?"必须":"相关"}|${a.need.label}|${a.status}${b.length||c.length?`:${[...b,...c].join(";")}`:":未在已解析资料中确认"}`});return b.length?`事实需求覆盖卡片:
113
+ ${b.join("\n")}`:""}(aB)}),be=function(a){let b=Date.now(),c=a.plan.chapters.find(b=>b.chapterId===a.chapter.id)||a.plan.chapters.find(b=>b.title===a.chapter.title);if(!c)throw Error(`缺少章节计划:${a.chapter.title}`);let d=a.context.facts.filter(a=>c.evidenceQueries.some(b=>el(a,b))||c.requiredFacts.some(b=>el(a,b))),e=c.sections.map(b=>{let c=a.context.facts.filter(a=>b.evidenceQueries.some(b=>el(a,b))||b.requiredFacts.some(b=>el(a,b))).slice(0,24),d=a.evidence.filter(a=>b.evidenceQueries.some(b=>(function(a,b){let c=ei(`${a.sectionTitle||""} ${a.content||""} ${a.filePath||""}`);return b.split(/[\s、,,;;::()()【】[-]+/u).filter(a=>a.length>=2).some(a=>c.includes(ei(a)))})(a,b))).slice(0,24),e=b.requiredGraphNodes.flatMap(b=>em(a.context.baseProjectGraph,b)).slice(0,12),f=[];return/法律法规|法规|规章|规范标准|标准规范|行业标准|现行规范|编制依据/u.test(b.title)||0!==d.length||0!==c.length||0!==e.length||f.push({level:"error",severity:"blocker",category:"evidence_coverage",owner:"system",message:`${b.title} 缺少事实、图谱或证据支撑`,suggestion:"应先定向检索和抽取事实,不能生成占位正文。"}),{...b,factIds:c.map(a=>(0,z.c6)({key:a.key,value:(0,z.lG)(a.value),sourceFile:a.sourceFile}).slice(0,12)),evidenceIds:d.map(a=>(0,z.c6)({filePath:a.filePath,content:a.content.slice(0,160),score:a.score}).slice(0,12)),graphNodeIds:e.map(a=>(0,z.c6)(a).slice(0,12)),ready:0===f.length,issues:f}}),f=e.flatMap(a=>a.issues),g={taskId:`chapter-task-${(0,z.c6)({plan:a.plan.planId,chapter:a.chapter.id,evidence:a.evidence.map(a=>(0,z.c6)({filePath:a.filePath,content:a.content.slice(0,120),score:a.score}))}).slice(0,10)}`,chapterId:a.chapter.id,title:a.chapter.title,facts:d.slice(0,48),evidence:a.evidence.slice(0,48),graphContext:em(a.context.baseProjectGraph,a.chapter.title).slice(0,20).join("\n"),sections:e,ready:0===f.length,issues:f};return{task:g,node:{id:`chapter-task-${a.chapter.id}`,type:"chapter_task_planner",status:g.ready?"completed":"failed",startedAt:b,completedAt:Date.now(),outputSummary:`${g.sections.filter(a=>a.ready).length}/${g.sections.length} 条细目任务就绪`,metrics:{facts:g.facts.length,evidence:g.evidence.length,issues:f.length},issues:f}}}({plan:b8.plan,chapter:c,context:bz,evidence:am});if(bz.chapterTasks=[...(bz.chapterTasks||[]).filter(a=>a.chapterId!==c.id),be.task],bz.nodes.push(be.node),(0,c3.cN)(bz),(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:`agent-chapter-task-${c.id}`,status:be.task.ready||r?"success":"failed",message:be.task.ready?be.node.outputSummary||`${(0,t.GQ)(c.title)} 章节任务规划完成`:r?`${(0,t.GQ)(c.title)} 章节任务未完全就绪,已复用已有正文并交由 Reviewer/Repairer 处理`:be.node.outputSummary||`${(0,t.GQ)(c.title)} 章节任务规划完成`,details:be.task.issues.map(a=>a.message)},{subtitle:"Agent Chapter Task Planner",order:J.length})),C(A),!be.task.ready&&!r)throw Error(`${(0,t.GQ)(c.title)} 章节任务未就绪:${be.task.issues.map(a=>a.message).join(";")}`);let bj=[aw,ep(be.task)].filter(Boolean).join("\n\n"),bk={total:aB.length,satisfied:aB.filter(a=>"satisfied"===a.status).length,missing:aB.filter(a=>"missing"===a.status).length,lowConfidence:aB.filter(a=>"low_confidence"===a.status).length};for(let a of aC)bc.push(`${c.title}:事实需求未确认 ${a}`);let bl=ao?.chapterRules.find(a=>a.id===c.id||a.title===c.title),bn=b7.chapterTargets.get(c.id)||1200,br=c.sections?.filter(Boolean).length||0,bt=/[、,,;;]/u.test(c.title),bv=function(a){let{budgetTarget:b,sectionCount:c,title:d,longformStrict:e}=a,f=/[、,,;;]/u.test(d),g=/工期|进度|质量|安全|危大|资源|人材机|保障|措施|重难点/u.test(d),h=/概况|结语|附录|说明/u.test(d),i=c>0?c*(f?720:g?900:780):g?5200:3600,j=e?h?2600:g?5200:3600:Math.min(1200,b),k=e?Math.min(Math.max(4200,b),c>=30?9800:f?8800:g?9200:7200):b,l=e?Math.max(j,b):Math.max(j,Math.min(b,i,k));return{budgetTarget:b,roundTarget:l,structureTarget:i,maxWords:Math.ceil(l*(a.longformStrict?1.12:1.18)),label:`章节预算约 ${b} 字,本轮生成约 ${l} 字,结构目标约 ${i} 字`}}({budgetTarget:bn,sectionCount:br,title:c.title,longformStrict:b7.longformStrict}),bx=Math.ceil(bv.maxWords*(b7.maxChars?1.05:1)),bC=b7.targetChars?Math.min(1800,Math.max(600,Math.floor(.45*bv.roundTarget))):1200,bD=bv.roundTarget,bE=Math.max(Math.min(bl?.minWords||0,bD),Math.min(ao?.dynamicChapterRule.minWordsPerChapter||0,bD),Math.floor(.68*bD),bC),bF=(0,aU.uV)(bE,bD),bG=br>0?b7.longformStrict?bD:Math.min(bD,Math.max(1800,bv.structureTarget)):bD,bH=Math.max(4,Number(process.env.DOCUMENT_SECTION_FIRST_MAX_SECTIONS||8)),bI=process.env.DOCUMENT_SECTION_FIRST_GENERATION,bJ=void 0!==bI&&0===Number(bI),bK=void 0!==bI&&0!==Number(bI),bL=bD>=6e3&&br>=4&&br<=bH&&!bt,bM=!bJ&&br>=2&&(br>bH||bt||b7.longformStrict&&br>=6),bP=!bJ&&!bM&&br>=2&&br<=bH&&(bK||bL||b7.longformStrict),bQ=0,bS=a=>{let b=Date.now();if(b-bQ<3e3)return;bQ=b;let d=a.filter(Boolean).join("\n\n");d.trim()&&C([...A,{id:c.id,title:c.title,content:`## ${c.title}
114
114
 
115
- ${d}`,evidence:an,missingFacts:aq,sections:c.sections||[],tablePlans:c.tablePlans||[],inProgress:!0}])},bU=a=>{"complete"===a.phase&&a.partialSections&&bT(a.partialSections)};if(B)p=dt(B,c),f=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:aw.primaryPromptId,status:"success",message:`${(0,t.GQ)(c.title)} 已复用已有章节正文:当前 ${(0,w.V7)(p)} 字,跳过 Writer,直接进入 Reviewer/Repairer/Final Gate`,details:[`有效证据:${an.length} 条`,`事实需求:${bl.satisfied}/${bl.total} 已满足,缺失 ${bl.missing},低置信 ${bl.lowConfidence}`,"来源:resumeChapters/checkpointChapters"],progress:{current:g+1,total:bO.length,label:"复用章节"}},{subtitle:(0,t.GQ)(c.title),order:g}),J[i]=f,C(A);else{let e;if(J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:aw.primaryPromptId,status:"running",message:bP?`${(0,t.GQ)(c.title)} 正在规划主题块并准备并发成稿`:bQ?`${(0,t.GQ)(c.title)} 正在按小节并发成稿`:`${(0,t.GQ)(c.title)} 正在整章一次成稿`,details:bP||bQ?[...az,`有效证据:${an.length} 条`,`事实需求:${bl.satisfied}/${bl.total} 已满足,缺失 ${bl.missing},低置信 ${bl.lowConfidence}`,bx.label,`生成上限约 ${bC} 字`,`模板细目:${c.sections?.length||0} 条`,bP?"细目较多,先由章级 Planner 聚类为主题块并语义合并,再按主题块全并发出稿,避免逐小节碎片化":"按章节结构拆分小节自然并发生成,章节聚合后再审查修复"]:[...az,`有效证据:${an.length} 条`,`事实需求:${bl.satisfied}/${bl.total} 已满足,缺失 ${bl.missing},低置信 ${bl.lowConfidence}`,bx.label,`生成上限约 ${bC} 字`,`规划小节:${bt} 个`,"首次生成必须覆盖章节结构、小节和事实,篇幅目标仅作为规划参考"],progress:{current:g+1,total:bO.length,label:bP?"主题块并发":bQ?"小节并发":"整章成稿"}},{subtitle:(0,t.GQ)(c.title),order:g}),C(),bP){let f=(0,t.GQ)(c.title),h=b6.split("\n").filter(a=>a.includes(f)),j=h.length>0?h.join("\n"):b6,k=await E(()=>(0,aR.X6)(cc,`chapter-plan:${c.id}`,()=>a3({template:q,chapter:c,evidence:an,projectContext:bR,requirement:a.requirement,roleContext:av,targetWords:bH,graphContext:bj.task.graphContext,blueprintContext:j,signal:a.signal,diagnostics:cc})));if(k.blocks.length>0){b=k,m=function(a,b){let c={};for(let d of a)for(let a of b.blocks){let b=a.subPoints.filter(a=>a.sources.some(a=>a_(a,d))||a_(a.title,d));if(b.length>0){c[d]=b.map(a=>a.title);break}}return c}(a$(c),k);let f=[ay,function(a,b){let c=a.facts.slice(0,18).map(a=>`- ${a.key}:${ek(a)}${a.sourceFile?`(来源:${a.sourceFile})`:""}`).join("\n"),d=b.blocks.map((a,b)=>{let c=a.subPoints.map(a=>a.sources.length>1?` - #### ${a.title}(覆盖评分细目:${a.sources.join("、")})`:` - #### ${a.title}`).join("\n");return`${b+1}. 必须输出三级标题:### ${a.title}
115
+ ${d}`,evidence:am,missingFacts:an,sections:c.sections||[],tablePlans:c.tablePlans||[],inProgress:!0}])},bT=a=>{"complete"===a.phase&&a.partialSections&&bS(a.partialSections)};if(r)m=dt(r,c),f=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:av.primaryPromptId,status:"success",message:`${(0,t.GQ)(c.title)} 已复用已有章节正文:当前 ${(0,w.V7)(m)} 字,跳过 Writer,直接进入 Reviewer/Repairer/Final Gate`,details:[`有效证据:${am.length} 条`,`事实需求:${bk.satisfied}/${bk.total} 已满足,缺失 ${bk.missing},低置信 ${bk.lowConfidence}`,"来源:resumeChapters/checkpointChapters"],progress:{current:g+1,total:bO.length,label:"复用章节"}},{subtitle:(0,t.GQ)(c.title),order:g}),J[i]=f,C(A);else{let e;if(J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:av.primaryPromptId,status:"running",message:bM?`${(0,t.GQ)(c.title)} 正在规划主题块并准备并发成稿`:bP?`${(0,t.GQ)(c.title)} 正在按小节并发成稿`:`${(0,t.GQ)(c.title)} 正在整章一次成稿`,details:bM||bP?[...ay,`有效证据:${am.length} 条`,`事实需求:${bk.satisfied}/${bk.total} 已满足,缺失 ${bk.missing},低置信 ${bk.lowConfidence}`,bv.label,`生成上限约 ${bx} 字`,`模板细目:${c.sections?.length||0} 条`,bM?"细目较多,先由章级 Planner 聚类为主题块并语义合并,再按主题块全并发出稿,避免逐小节碎片化":"按章节结构拆分小节自然并发生成,章节聚合后再审查修复"]:[...ay,`有效证据:${am.length} 条`,`事实需求:${bk.satisfied}/${bk.total} 已满足,缺失 ${bk.missing},低置信 ${bk.lowConfidence}`,bv.label,`生成上限约 ${bx} 字`,`规划小节:${br} 个`,"首次生成必须覆盖章节结构、小节和事实,篇幅目标仅作为规划参考"],progress:{current:g+1,total:bO.length,label:bM?"主题块并发":bP?"小节并发":"整章成稿"}},{subtitle:(0,t.GQ)(c.title),order:g}),C(),bM){let f=(0,t.GQ)(c.title),h=b6.split("\n").filter(a=>a.includes(f)),j=h.length>0?h.join("\n"):b6,l=await E(()=>(0,aR.X6)(cc,`chapter-plan:${c.id}`,()=>a3({template:q,chapter:c,evidence:am,projectContext:bR,requirement:a.requirement,roleContext:au,targetWords:bG,graphContext:be.task.graphContext,blueprintContext:j,signal:a.signal,diagnostics:cc})));if(l.blocks.length>0){b=l,k=function(a,b){let c={};for(let d of a)for(let a of b.blocks){let b=a.subPoints.filter(a=>a.sources.some(a=>a_(a,d))||a_(a.title,d));if(b.length>0){c[d]=b.map(a=>a.title);break}}return c}(a$(c),l);let f=[aw,function(a,b){let c=a.facts.slice(0,18).map(a=>`- ${a.key}:${ek(a)}${a.sourceFile?`(来源:${a.sourceFile})`:""}`).join("\n"),d=b.blocks.map((a,b)=>{let c=a.subPoints.map(a=>a.sources.length>1?` - #### ${a.title}(覆盖评分细目:${a.sources.join("、")})`:` - #### ${a.title}`).join("\n");return`${b+1}. 必须输出三级标题:### ${a.title}
116
116
  ${c}`}).join("\n");return["【Agent 章节任务】(主题块成稿模式)",`任务ID:${a.taskId}`,`章节:${a.title}`,a.graphContext?`图谱上下文:
117
117
  ${a.graphContext}`:"",c?`事实卡:
118
118
  ${c}`:"",`主题块与 H4 要点(必须严格按此两层结构成稿):
119
- ${d}`,"写作要求:必须严格按“主题块→H4 要点”两层结构输出,三级标题与 H4 要点标题必须与给定标题完全一致,不得改名、合并或遗漏 H4 要点;每个 H4 要点必须覆盖其标注的全部评分细目内容,但不得为这些评分细目单独开设小节标题;项目专属事实只使用事实卡、图谱上下文和绑定证据,法律法规、标准规范等公共知识可直接引用;不得输出后台话术、兜底措辞、待确认、不适用;缺少项目事实的小节不得编造。"].filter(Boolean).join("\n\n")}(bj.task,k)].filter(Boolean).join("\n\n");d=f;let h=k.blocks.reduce((a,b)=>a+b.subPoints.length,0),j=k.blocks.reduce((a,b)=>a+b.subPoints.reduce((a,b)=>a+Math.max(0,b.sources.length-1),0),0),l=k.llmPlanned?k.llmFailure?`(部分主题块降级:${k.llmFailure.slice(0,80)})`:k.fallbackSections.length>0?`(${k.fallbackSections.length} 条细目由覆盖校验挂回主题块)`:"":`(LLM 规划未命中:${(k.llmFailure||"未返回有效结构").slice(0,80)},已按语义域确定性分组)`;J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:aw.primaryPromptId,status:"running",message:`${(0,t.GQ)(c.title)} 已规划 ${k.blocks.length} 个主题块,正在按主题块并发成稿${l}`,details:[...az,`有效证据:${an.length} 条`,`输入细目 ${bt} 条 → 主题块 ${k.blocks.length} 个(每块 2~4 个 H4 要点)`,`语义合并 ${j} 条细目,目录级 H4 合计 ${h} 个`,"单块 1200~2200 字,主题块间全并发,单节深度与整体耗时双优"],progress:{current:g+1,total:bO.length,label:"主题块并发"}},{subtitle:(0,t.GQ)(c.title),order:g});let n=J.find(a=>a.roleId===`agent-chapter-task-${c.id}`);n&&(n.message=`${bj.task.sections.filter(a=>a.ready).length}/${bj.task.sections.length} 条细目任务就绪(已规划为 ${k.blocks.length} 个主题块)`),C(A),e=await E(()=>(0,aR.X6)(cc,`chapter-planned-block-draft:${c.id}`,()=>(0,aU.nl)({template:q,chapter:c,evidence:an,missingFacts:aq,promptTexts:f,projectContext:bR,requirement:a.requirement,roleContext:av,targetWords:bH,maxWords:bC,forbidDrawingImages:!1,factCoverageContext:be,compactProjectContext:!0,sectionEvidenceProvider:aM,onSectionProgress:bU,diagnostics:cc,signal:a.signal},k)))}}else e=bQ?await E(()=>(0,aR.X6)(cc,`chapter-section-draft:${c.id}`,()=>(0,aU.N1)({template:q,chapter:c,evidence:an,missingFacts:aq,promptTexts:bk,projectContext:bR,requirement:a.requirement,roleContext:av,targetWords:bH,maxWords:bC,forbidDrawingImages:!1,factCoverageContext:be,projectRoot:o,modelName:(0,N.$y)()?.model.name,materialContextHash:(0,z.c6)({materialFilePaths:U,promptTexts:ay}),allowPartialResult:!1,compactProjectContext:!0,sectionEvidenceProvider:aM,onSectionProgress:bU,diagnostics:cc,signal:a.signal}))):await E(()=>(0,aR.X6)(cc,`chapter-draft:${c.id}`,()=>(0,aU.eu)(q,c,an,aq,bk,bR,a.requirement,av,{forbidDrawingImages:!1,minWords:bF,targetWords:bE,maxWords:bC,maxTokens:bG,factCoverageContext:be,signal:a.signal,diagnostics:cc,supplementEvidenceProvider:aN,evidenceFloorChars:cb.evidenceFloorChars,evidenceCeilingChars:cb.evidenceCeilingChars})));if(!e&&(bP||bQ)&&(bP&&(b=void 0,d=void 0,m=void 0),J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:aw.primaryPromptId,status:"running",message:`${(0,t.GQ)(c.title)} ${bP?"主题块成稿未完成":"小节成稿未完成"},正在切换为整章紧凑备用成稿`,details:[`LLM 最近错误:${cc.llm.lastError||"成稿空响应或超时"}`,`有效证据:${an.length} 条`],progress:{current:g+1,total:bO.length,label:"整章备用"}},{subtitle:(0,t.GQ)(c.title),order:g}),C(A),e=await E(()=>(0,aR.X6)(cc,`chapter-compact-fallback:${c.id}`,()=>(0,aU.eu)(q,c,an,aq,bk,bR,a.requirement,av,{forbidDrawingImages:!1,minWords:Math.floor(.65*bF),targetWords:Math.floor(.75*bH),maxWords:bC,maxTokens:bG,factCoverageContext:be,signal:a.signal,diagnostics:cc,supplementEvidenceProvider:aN,evidenceFloorChars:cb.evidenceFloorChars,evidenceCeilingChars:cb.evidenceCeilingChars}).catch(a=>{cc.llm.lastError=a instanceof Error?a.message:String(a)})))),!e&&an.length>0){J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:aw.primaryPromptId,status:"running",message:`${(0,t.GQ)(c.title)} LLM 多路径未返回有效正文,正在反馈失败原因重试紧凑整章生成`,details:[`LLM 最近错误:${cc.llm.lastError||"空响应或超时"}`,`证据条数:${an.length}`],progress:{current:g+1,total:bO.length,label:"失败原因重试"}},{subtitle:(0,t.GQ)(c.title),order:g}),C(A);let b=[av,`【上一轮 LLM 生成失败,请先分析失败原因,再调整策略重新输出完整章节正文】失败原因:${cc.llm.lastError||"空响应或超时"}`].filter(Boolean).join("\n");e=await E(()=>(0,aR.X6)(cc,`chapter-lastretry:${c.id}`,()=>(0,aU.eu)(q,c,an,aq,bk,bR,a.requirement,b,{forbidDrawingImages:!1,minWords:Math.floor(.55*bF),targetWords:Math.floor(.6*bH),maxWords:bC,maxTokens:bG,factCoverageContext:be,signal:a.signal,diagnostics:cc,supplementEvidenceProvider:aN,evidenceFloorChars:cb.evidenceFloorChars,evidenceCeilingChars:cb.evidenceCeilingChars}).catch(a=>{cc.llm.lastError=a instanceof Error?a.message:String(a)})))}if(!e&&an.length>0&&(J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:aw.primaryPromptId,status:"running",message:`${(0,t.GQ)(c.title)} LLM 全故障,正在用当前项目证据生成带阻断标记的可审查骨架草稿`,details:[`LLM 最近错误:${cc.llm.lastError||"空响应或超时"}`,`证据条数:${an.length}`,"骨架草稿将带 [EVIDENCE_SKELETON] 标记并由 Review 门禁强制拦截,不允许静默通过"],progress:{current:g+1,total:bO.length,label:"证据骨架"}},{subtitle:(0,t.GQ)(c.title),order:g}),C(A),e=`[EVIDENCE_SKELETON]
119
+ ${d}`,"写作要求:必须严格按“主题块→H4 要点”两层结构输出,三级标题与 H4 要点标题必须与给定标题完全一致,不得改名、合并或遗漏 H4 要点;每个 H4 要点必须覆盖其标注的全部评分细目内容,但不得为这些评分细目单独开设小节标题;项目专属事实只使用事实卡、图谱上下文和绑定证据,法律法规、标准规范等公共知识可直接引用;不得输出后台话术、兜底措辞、待确认、不适用;缺少项目事实的小节不得编造。"].filter(Boolean).join("\n\n")}(be.task,l)].filter(Boolean).join("\n\n");d=f;let h=l.blocks.reduce((a,b)=>a+b.subPoints.length,0),j=l.blocks.reduce((a,b)=>a+b.subPoints.reduce((a,b)=>a+Math.max(0,b.sources.length-1),0),0),m=l.llmPlanned?l.llmFailure?`(部分主题块降级:${l.llmFailure.slice(0,80)})`:l.fallbackSections.length>0?`(${l.fallbackSections.length} 条细目由覆盖校验挂回主题块)`:"":`(LLM 规划未命中:${(l.llmFailure||"未返回有效结构").slice(0,80)},已按语义域确定性分组)`;J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:av.primaryPromptId,status:"running",message:`${(0,t.GQ)(c.title)} 已规划 ${l.blocks.length} 个主题块,正在按主题块并发成稿${m}`,details:[...ay,`有效证据:${am.length} 条`,`输入细目 ${br} 条 → 主题块 ${l.blocks.length} 个(每块 2~4 个 H4 要点)`,`语义合并 ${j} 条细目,目录级 H4 合计 ${h} 个`,"单块 1200~2200 字,主题块间全并发,单节深度与整体耗时双优"],progress:{current:g+1,total:bO.length,label:"主题块并发"}},{subtitle:(0,t.GQ)(c.title),order:g});let n=J.find(a=>a.roleId===`agent-chapter-task-${c.id}`);n&&(n.message=`${be.task.sections.filter(a=>a.ready).length}/${be.task.sections.length} 条细目任务就绪(已规划为 ${l.blocks.length} 个主题块)`),C(A),e=await E(()=>(0,aR.X6)(cc,`chapter-planned-block-draft:${c.id}`,()=>(0,aU.nl)({template:q,chapter:c,evidence:am,missingFacts:an,promptTexts:f,projectContext:bR,requirement:a.requirement,roleContext:au,targetWords:bG,maxWords:bx,forbidDrawingImages:!1,factCoverageContext:a9,compactProjectContext:!0,sectionEvidenceProvider:aL,onSectionProgress:bT,diagnostics:cc,signal:a.signal},l)))}}else e=bP?await E(()=>(0,aR.X6)(cc,`chapter-section-draft:${c.id}`,()=>(0,aU.N1)({template:q,chapter:c,evidence:am,missingFacts:an,promptTexts:bj,projectContext:bR,requirement:a.requirement,roleContext:au,targetWords:bG,maxWords:bx,forbidDrawingImages:!1,factCoverageContext:a9,projectRoot:o,modelName:(0,N.$y)()?.model.name,materialContextHash:(0,z.c6)({materialFilePaths:U,promptTexts:aw}),allowPartialResult:!1,compactProjectContext:!0,sectionEvidenceProvider:aL,onSectionProgress:bT,diagnostics:cc,signal:a.signal}))):await E(()=>(0,aR.X6)(cc,`chapter-draft:${c.id}`,()=>(0,aU.eu)(q,c,am,an,bj,bR,a.requirement,au,{forbidDrawingImages:!1,minWords:bE,targetWords:bD,maxWords:bx,maxTokens:bF,factCoverageContext:a9,signal:a.signal,diagnostics:cc,supplementEvidenceProvider:aM,evidenceFloorChars:cb.evidenceFloorChars,evidenceCeilingChars:cb.evidenceCeilingChars})));if(!e&&(bM||bP)&&(bM&&(b=void 0,d=void 0,k=void 0),J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:av.primaryPromptId,status:"running",message:`${(0,t.GQ)(c.title)} ${bM?"主题块成稿未完成":"小节成稿未完成"},正在切换为整章紧凑备用成稿`,details:[`LLM 最近错误:${cc.llm.lastError||"成稿空响应或超时"}`,`有效证据:${am.length} 条`],progress:{current:g+1,total:bO.length,label:"整章备用"}},{subtitle:(0,t.GQ)(c.title),order:g}),C(A),e=await E(()=>(0,aR.X6)(cc,`chapter-compact-fallback:${c.id}`,()=>(0,aU.eu)(q,c,am,an,bj,bR,a.requirement,au,{forbidDrawingImages:!1,minWords:Math.floor(.65*bE),targetWords:Math.floor(.75*bG),maxWords:bx,maxTokens:bF,factCoverageContext:a9,signal:a.signal,diagnostics:cc,supplementEvidenceProvider:aM,evidenceFloorChars:cb.evidenceFloorChars,evidenceCeilingChars:cb.evidenceCeilingChars}).catch(a=>{cc.llm.lastError=a instanceof Error?a.message:String(a)})))),!e&&am.length>0){J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:av.primaryPromptId,status:"running",message:`${(0,t.GQ)(c.title)} LLM 多路径未返回有效正文,正在反馈失败原因重试紧凑整章生成`,details:[`LLM 最近错误:${cc.llm.lastError||"空响应或超时"}`,`证据条数:${am.length}`],progress:{current:g+1,total:bO.length,label:"失败原因重试"}},{subtitle:(0,t.GQ)(c.title),order:g}),C(A);let b=[au,`【上一轮 LLM 生成失败,请先分析失败原因,再调整策略重新输出完整章节正文】失败原因:${cc.llm.lastError||"空响应或超时"}`].filter(Boolean).join("\n");e=await E(()=>(0,aR.X6)(cc,`chapter-lastretry:${c.id}`,()=>(0,aU.eu)(q,c,am,an,bj,bR,a.requirement,b,{forbidDrawingImages:!1,minWords:Math.floor(.55*bE),targetWords:Math.floor(.6*bG),maxWords:bx,maxTokens:bF,factCoverageContext:a9,signal:a.signal,diagnostics:cc,supplementEvidenceProvider:aM,evidenceFloorChars:cb.evidenceFloorChars,evidenceCeilingChars:cb.evidenceCeilingChars}).catch(a=>{cc.llm.lastError=a instanceof Error?a.message:String(a)})))}if(!e&&am.length>0&&(J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:av.primaryPromptId,status:"running",message:`${(0,t.GQ)(c.title)} LLM 全故障,正在用当前项目证据生成带阻断标记的可审查骨架草稿`,details:[`LLM 最近错误:${cc.llm.lastError||"空响应或超时"}`,`证据条数:${am.length}`,"骨架草稿将带 [EVIDENCE_SKELETON] 标记并由 Review 门禁强制拦截,不允许静默通过"],progress:{current:g+1,total:bO.length,label:"证据骨架"}},{subtitle:(0,t.GQ)(c.title),order:g}),C(A),e=`[EVIDENCE_SKELETON]
120
120
  ${function(a){let b=(a.chapter.sections?.length?a.chapter.sections:["资料依据与施工对象","主要控制措施","检查验收与闭环管理"]).flatMap(b=>{let c=(function(a,b,c){let d=[a,b.title,...a.split(/[、,,;;\s]+/u)].filter(a=>a.length>=2),e=c.map(a=>{let b=(0,s.eE)(a.content||"").replace(/\s+/gu," ").trim(),c=d.reduce((c,d)=>c+(b.includes(d)||(a.sectionTitle||"").includes(d)?1:0),0)+a.score;return{content:b,score:c}}).filter(a=>a.content.length>=30).sort((a,b)=>b.score-a.score),f=[];for(let a of e.slice(0,8)){for(let b of a.content.split(/[。;;\n]/u).map(a=>a.trim()).filter(Boolean))if(!(b.length<18||b.length>180||/报价|单价|税率|利润|后台|知识库|提示词|OCR|文件路径/u.test(b))&&!(/^(?:本节围绕|本小节依据|项目实施时应|实施过程中应|当前绑定资料|当前项目绑定资料)/u.test(b)||/确保各项措施与本工程实施条件相匹配/u.test(b)||/形成责任明确、过程可控、资料完整的管理闭环/u.test(b)||/确保现场管理要求与施工进度、资源组织和验收节点同步推进/u.test(b)||/^管理闭环[。;;]?$/u.test(b)||/资料参数行摘要|房建市政施工评定分离招标示范文本|我方已仔细研究|中标通知书|签订合同|投标函|招标公告|开标时间|开标地点|评标委员会|评标办法|投标保证金|保证金账户|电子交易系统|公共资源交易|监管部门|专用账户监管协议书|资金托管专用账号/u.test(b)||/^#+\s*/u.test(b)||/^(?\d+)/u.test(b))&&(f.some(a=>a.includes(b)||b.includes(a))||f.push(b),f.length>=10))break;if(f.length>=10)break}return f})(b,a.chapter,a.evidence).slice(0,8);return 0===c.length?[]:[[`### ${b}`,"",...c.map(a=>`- ${a}。`)].join("\n")]});return 0===b.length?"":(0,v.kT)((0,v.FD)(`## ${a.chapter.title}
121
121
 
122
- ${b.join("\n\n")}`,a.forbidDrawingImages))}({chapter:c,evidence:an,targetWords:bH,forbidDrawingImages:!1})}`),(0,z.Te)(a.signal),!e){let a=`${(0,t.GQ)(c.title)} 大模型未返回有效正文,已阻断生成`;throw J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:aw.primaryPromptId,status:"failed",message:a,details:[`LLM 最近错误:${cc.llm.lastError||"空响应或超时"}`,`证据条数:${an.length}`],progress:{current:g+1,total:bO.length,label:"章节阻断"}},{subtitle:(0,t.GQ)(c.title),order:g}),C(A),Error(a)}let f=e;if(!f.trim())throw Error(`${(0,t.GQ)(c.title)} 首次生成失败,未获得可用于定稿的正文`);p=dt(f,c)}let bV=a4({chapter:c,content:p,evidence:an}),bW=(0,w.V7)(p),bX=(0,v.r4)(p),bY=bX.length>0?bX:c.sections||[],bZ=(0,x.qK)(p,[{title:c.title,content:p,sections:bY}]).map(a=>a.message),b$=bV.slice(0,6).map(a=>`小节事实密度需优化:${a}`),b_=[...bZ,...b$],b0=p.includes("[EVIDENCE_SKELETON]")?"failed":function(a,b,c=[]){return a<=0||c.some(a=>/未返回有效章节正文|生成失败/u.test(a))?"failed":"success"}(bW,0,b_);return f=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:aw.primaryPromptId,status:b0,message:(0,aQ.AQ)(`${(0,t.GQ)(c.title)} 已由大模型成稿:当前 ${bW} 字;章节预算约 ${bx.budgetTarget} 字,本轮目标约 ${bx.roundTarget} 字${b_.length?`;待优化:${b_.slice(0,8).join("、")}`:""}`,h),details:[`本轮完成率:${Math.round(bW/Math.max(1,bx.roundTarget)*100)}%`,`结构目标约 ${bx.structureTarget} 字`,...az,`二级小节:${bY.length} 个`],progress:{current:g+1,total:bO.length,label:b_.length?"章节已生成":"章节达标"}},{subtitle:(0,t.GQ)(c.title),order:g}),bg[g]=f,async()=>{try{let e={id:c.id,title:c.title,content:p,evidence:an,missingFacts:aq,sections:bY,tablePlans:c.tablePlans||[]},f=er({task:bj.task,draft:e,context:bz,plannedCoverage:m});bz.reviewResults={...bz.reviewResults||{},[c.id]:f};let h=f.issues.filter(a=>"blocker"===a.severity||"error"===a.level),i=h.some(a=>/Writer 未完成/u.test(a.message)),j=h.some(a=>/正文不足,未达到任务最小深度/u.test(a.message)),k=f.issues.some(a=>"error"!==a.level&&"blocker"!==a.severity&&/正文不足,未达到任务最小深度/u.test(a.message)),l=f.issues.filter(a=>"warning"===a.level&&/未匹配到独立小节标题|工序顺序表达缺失/u.test(a.message)),n=!1,o=h.length>0&&(f.repairable||i||j)||k||0===h.length&&l.length>0,r=cb.repairRoundBudget,s=0,u=0,v=h.length,x=new Set,y=new Map;bz.nodes.push({id:`chapter-reviewer-${c.id}`,type:"chapter_reviewer",status:h.length?o?"running":"failed":"completed",startedAt:Date.now(),completedAt:Date.now(),outputSummary:f.issues.length?`${f.issues.length} 个 Reviewer 提示`:"Reviewer 通过",metrics:{supportedFacts:f.supportedFacts},issues:f.issues}),(0,c3.cN)(bz),(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:`agent-reviewer-${c.id}`,status:h.length?o?"running":"failed":"success",message:h.length?`${(0,t.GQ)(c.title)} Reviewer 发现 ${h.length} 个阻断问题,等待 Repairer 修复(轮次预算 ${r} 轮)`:`${(0,t.GQ)(c.title)} Reviewer 通过${f.issues.length?`(${f.issues.length} 个优化提示)`:""}`,details:f.issues.map(a=>a.message)},{subtitle:"Agent Reviewer",order:J.length})),C(A);let B=new Map;for(let a of bj.task.sections){let b=c5(m,a.title);B.set(b,Math.max(B.get(b)||0,a.minChars))}let D=a=>a.replace(/\s*Writer 未完成.*$/u,"").replace(/\s*正文不足,未达到任务最小深度.*$/u,"").trim();for(;o&&cn.remaining>0&&s<r+2&&!(u>=4);){s+=1,cn.remaining-=1;let g={...f,issues:h},p=u>=2&&h.length>0,F=0===h.length&&l.length>0&&!n,G=F?["【Agent 定向精修任务】",`章节:${bj.task.title}`,"仅处理下列结构类问题,不重写其他内容:标题未对齐的小节仅调整标题使之与规划标题一致(正文保持不变);工序顺序表达缺失的小节在方法/流程叙述中补写工序顺序表达(形式由模型自然选择:顺序词叙述、编号步骤、有序/无序列表或箭头链均可),每处不少于 3 个环节。",...l.map(a=>`- ${a.message};${a.suggestion||""}`),"【结构约束】保持现有小节结构与正文内容不变,不得新增/删除/合并小节,不得改写无关正文。"].join("\n"):f.repairable?p?["【Agent 升级深修任务】",`章节:${bj.task.title}`,`该章前 ${s-1} 轮局部修复后仍有 ${h.length} 个阻断问题未收敛,本轮升级修复力度:对每个问题小节允许大段重写(保持章节结构、已通过小节与事实数据不变),必须全部修复。`,...h.map(a=>`- ${a.message};${a.suggestion||""}`)].join("\n"):[function(a){if(!a.review.repairable)return"";let b=a.plannedMode?"【结构约束】本章采用主题块成稿模式,必须保持现有三级主题块与 H4 要点标题不变;只修复列出的问题,不得新增小节、不得拆分或合并现有小节、不得把评分细目展开为独立标题。":ep(a.task);return["【Agent 定向修复任务】",`章节:${a.task.title}`,"只修复下列问题,不重写无关内容;如果问题是小节正文不足,必须按原小节标题完整补足该小节正式正文,每个小节不得少于任务最小深度:",...a.review.issues.map(a=>`- ${a.message};${a.suggestion||""}`),b].join("\n")}({task:bj.task,review:g,plannedMode:!!b}),...l.length>0&&!n?["【附带结构精修】同时处理下列结构类问题(正文与事实数据保持不变,仅调整标题/补写工序顺序表达):",...l.map(a=>`- ${a.message};${a.suggestion||""}`)]:[]].join("\n"):["【Agent 定向修复任务】",`章节:${bj.task.title}`,"Reviewer 发现 Writer 未完成小节。必须基于对应小节事实卡和证据生成正式正文,替换并删除 WRITER_MISSING_SECTION 标记;不得跳过这些小节,不得保留占位说明。",...h.map(a=>`- ${a.message};${a.suggestion||""}`)].join("\n"),H=J.length,I=f.issues.filter(a=>/Writer 未完成/u.test(a.message)),K=f.issues.filter(a=>/正文不足,未达到任务最小深度/u.test(a.message)),L=[...I,...K.filter(a=>!I.some(b=>b.message===a.message))].filter(a=>!x.has(D(a.message))),M=[];(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:`agent-repairer-${c.id}`,status:"running",message:h.length>0?`${(0,t.GQ)(c.title)} Reviewer 发现 ${h.length} 个阻断问题,正在定向修复`:F?`${(0,t.GQ)(c.title)} 正在定向精修 ${l.length} 个结构类问题`:`${(0,t.GQ)(c.title)} 正在定向补写 ${L.length} 个深度不足小节`,details:L.length>0?L.map(a=>a.message):F?l.map(a=>a.message):h.map(a=>a.message)},{subtitle:"Agent Repairer",order:H})),C(A);let N=(a,b,c,d)=>{let e=a=>a.replace(/[\u00a0\u3000]/gu," ").replace(/^\d+(?:\.\d+)*\s+/u,"").trim(),f=a=>[b,d].filter(a=>"string"==typeof a).some(b=>a===b||a.includes(b)||(0,z.VX)(a,b)),g=a=>a.trim().replace(/^#{2,6}\s+(?:\d+(?:\.\d+)*\s+)?[^\n]+\n+/u,"").trim(),h=a.split("\n"),i=[],j=[];for(let a=0;a<h.length;a+=1){let b=h[a],c=/^(#{3,4})\s+(.+)$/u.exec(b.trim());if(!c)continue;let d=e(c[2]);f(d)&&(3===c[1].length?i.push(a):j.push(a))}let k=i[0]??j[0];if(void 0!==k){let d=h[k],e=h.slice(0,k).join("\n").length+ +(k>0),f=/^(#{3,4})\s+(.+)$/u.exec(d.trim()),i=h.slice(k+1).find(a=>a.trim()),j=3===f[1].length&&(z.V.test(b)||i&&/^#{4}\s+/u.test(i.trim()))?/^#{2,3}\s+/u:/^#{2,4}\s+/u,l=h.length;for(let a=k+1;a<h.length;a+=1)if(j.test(h[a].trim())){l=a;break}let m=l<h.length?h.slice(0,l).join("\n").length:a.length,n=g(c);return`${a.slice(0,e)}${d.trim()}
122
+ ${b.join("\n\n")}`,a.forbidDrawingImages))}({chapter:c,evidence:am,targetWords:bG,forbidDrawingImages:!1})}`),(0,z.Te)(a.signal),!e){let a=`${(0,t.GQ)(c.title)} 大模型未返回有效正文,已阻断生成`;throw J[i]=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:av.primaryPromptId,status:"failed",message:a,details:[`LLM 最近错误:${cc.llm.lastError||"空响应或超时"}`,`证据条数:${am.length}`],progress:{current:g+1,total:bO.length,label:"章节阻断"}},{subtitle:(0,t.GQ)(c.title),order:g}),C(A),Error(a)}let f=e;if(!f.trim())throw Error(`${(0,t.GQ)(c.title)} 首次生成失败,未获得可用于定稿的正文`);m=dt(f,c)}let bU=a4({chapter:c,content:m,evidence:am}),bV=(0,w.V7)(m),bW=(0,v.r4)(m),bX=bW.length>0?bW:c.sections||[],bY=(0,x.qK)(m,[{title:c.title,content:m,sections:bX}]).map(a=>a.message),bZ=bU.slice(0,6).map(a=>`小节事实密度需优化:${a}`),b$=[...bY,...bZ],b_=m.includes("[EVIDENCE_SKELETON]")?"failed":function(a,b,c=[]){return a<=0||c.some(a=>/未返回有效章节正文|生成失败/u.test(a))?"failed":"success"}(bV,0,b$);return f=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",promptId:av.primaryPromptId,status:b_,message:(0,aQ.AQ)(`${(0,t.GQ)(c.title)} 已由大模型成稿:当前 ${bV} 字;章节预算约 ${bv.budgetTarget} 字,本轮目标约 ${bv.roundTarget} 字${b$.length?`;待优化:${b$.slice(0,8).join("、")}`:""}`,h),details:[`本轮完成率:${Math.round(bV/Math.max(1,bv.roundTarget)*100)}%`,`结构目标约 ${bv.structureTarget} 字`,...ay,`二级小节:${bX.length} 个`],progress:{current:g+1,total:bO.length,label:b$.length?"章节已生成":"章节达标"}},{subtitle:(0,t.GQ)(c.title),order:g}),bg[g]=f,async()=>{try{let e={id:c.id,title:c.title,content:m,evidence:am,missingFacts:an,sections:bX,tablePlans:c.tablePlans||[]},f=er({task:be.task,draft:e,context:bz,plannedCoverage:k});bz.reviewResults={...bz.reviewResults||{},[c.id]:f};let h=f.issues.filter(a=>"blocker"===a.severity||"error"===a.level),i=h.some(a=>/Writer 未完成/u.test(a.message)),j=h.some(a=>/正文不足,未达到任务最小深度/u.test(a.message)),l=f.issues.some(a=>"error"!==a.level&&"blocker"!==a.severity&&/正文不足,未达到任务最小深度/u.test(a.message)),n=f.issues.filter(a=>"warning"===a.level&&/未匹配到独立小节标题|工序顺序表达缺失/u.test(a.message)),o=!1,p=h.length>0&&(f.repairable||i||j)||l||0===h.length&&n.length>0,r=cb.repairRoundBudget,s=0,u=0,v=h.length,x=new Set,y=new Map;bz.nodes.push({id:`chapter-reviewer-${c.id}`,type:"chapter_reviewer",status:h.length?p?"running":"failed":"completed",startedAt:Date.now(),completedAt:Date.now(),outputSummary:f.issues.length?`${f.issues.length} 个 Reviewer 提示`:"Reviewer 通过",metrics:{supportedFacts:f.supportedFacts},issues:f.issues}),(0,c3.cN)(bz),(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:`agent-reviewer-${c.id}`,status:h.length?p?"running":"failed":"success",message:h.length?`${(0,t.GQ)(c.title)} Reviewer 发现 ${h.length} 个阻断问题,等待 Repairer 修复(轮次预算 ${r} 轮)`:`${(0,t.GQ)(c.title)} Reviewer 通过${f.issues.length?`(${f.issues.length} 个优化提示)`:""}`,details:f.issues.map(a=>a.message)},{subtitle:"Agent Reviewer",order:J.length})),C(A);let B=new Map;for(let a of be.task.sections){let b=c5(k,a.title);B.set(b,Math.max(B.get(b)||0,a.minChars))}let D=a=>a.replace(/\s*Writer 未完成.*$/u,"").replace(/\s*正文不足,未达到任务最小深度.*$/u,"").trim();for(;p&&cn.remaining>0&&s<r+2&&!(u>=4);){s+=1,cn.remaining-=1;let g={...f,issues:h},m=u>=2&&h.length>0,F=0===h.length&&n.length>0&&!o,G=F?["【Agent 定向精修任务】",`章节:${be.task.title}`,"仅处理下列结构类问题,不重写其他内容:标题未对齐的小节仅调整标题使之与规划标题一致(正文保持不变);工序顺序表达缺失的小节在方法/流程叙述中补写工序顺序表达(形式由模型自然选择:顺序词叙述、编号步骤、有序/无序列表或箭头链均可),每处不少于 3 个环节。",...n.map(a=>`- ${a.message};${a.suggestion||""}`),"【结构约束】保持现有小节结构与正文内容不变,不得新增/删除/合并小节,不得改写无关正文。"].join("\n"):f.repairable?m?["【Agent 升级深修任务】",`章节:${be.task.title}`,`该章前 ${s-1} 轮局部修复后仍有 ${h.length} 个阻断问题未收敛,本轮升级修复力度:对每个问题小节允许大段重写(保持章节结构、已通过小节与事实数据不变),必须全部修复。`,...h.map(a=>`- ${a.message};${a.suggestion||""}`)].join("\n"):[function(a){if(!a.review.repairable)return"";let b=a.plannedMode?"【结构约束】本章采用主题块成稿模式,必须保持现有三级主题块与 H4 要点标题不变;只修复列出的问题,不得新增小节、不得拆分或合并现有小节、不得把评分细目展开为独立标题。":ep(a.task);return["【Agent 定向修复任务】",`章节:${a.task.title}`,"只修复下列问题,不重写无关内容;如果问题是小节正文不足,必须按原小节标题完整补足该小节正式正文,每个小节不得少于任务最小深度:",...a.review.issues.map(a=>`- ${a.message};${a.suggestion||""}`),b].join("\n")}({task:be.task,review:g,plannedMode:!!b}),...n.length>0&&!o?["【附带结构精修】同时处理下列结构类问题(正文与事实数据保持不变,仅调整标题/补写工序顺序表达):",...n.map(a=>`- ${a.message};${a.suggestion||""}`)]:[]].join("\n"):["【Agent 定向修复任务】",`章节:${be.task.title}`,"Reviewer 发现 Writer 未完成小节。必须基于对应小节事实卡和证据生成正式正文,替换并删除 WRITER_MISSING_SECTION 标记;不得跳过这些小节,不得保留占位说明。",...h.map(a=>`- ${a.message};${a.suggestion||""}`)].join("\n"),H=J.length,I=f.issues.filter(a=>/Writer 未完成/u.test(a.message)),K=f.issues.filter(a=>/正文不足,未达到任务最小深度/u.test(a.message)),L=[...I,...K.filter(a=>!I.some(b=>b.message===a.message))].filter(a=>!x.has(D(a.message))),M=[];(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:`agent-repairer-${c.id}`,status:"running",message:h.length>0?`${(0,t.GQ)(c.title)} Reviewer 发现 ${h.length} 个阻断问题,正在定向修复`:F?`${(0,t.GQ)(c.title)} 正在定向精修 ${n.length} 个结构类问题`:`${(0,t.GQ)(c.title)} 正在定向补写 ${L.length} 个深度不足小节`,details:L.length>0?L.map(a=>a.message):F?n.map(a=>a.message):h.map(a=>a.message)},{subtitle:"Agent Repairer",order:H})),C(A);let N=(a,b,c,d)=>{let e=a=>a.replace(/[\u00a0\u3000]/gu," ").replace(/^\d+(?:\.\d+)*\s+/u,"").trim(),f=a=>[b,d].filter(a=>"string"==typeof a).some(b=>a===b||a.includes(b)||(0,z.VX)(a,b)),g=a=>a.trim().replace(/^#{2,6}\s+(?:\d+(?:\.\d+)*\s+)?[^\n]+\n+/u,"").trim(),h=a.split("\n"),i=[],j=[];for(let a=0;a<h.length;a+=1){let b=h[a],c=/^(#{3,4})\s+(.+)$/u.exec(b.trim());if(!c)continue;let d=e(c[2]);f(d)&&(3===c[1].length?i.push(a):j.push(a))}let k=i[0]??j[0];if(void 0!==k){let d=h[k],e=h.slice(0,k).join("\n").length+ +(k>0),f=/^(#{3,4})\s+(.+)$/u.exec(d.trim()),i=h.slice(k+1).find(a=>a.trim()),j=3===f[1].length&&(z.V.test(b)||i&&/^#{4}\s+/u.test(i.trim()))?/^#{2,3}\s+/u:/^#{2,4}\s+/u,l=h.length;for(let a=k+1;a<h.length;a+=1)if(j.test(h[a].trim())){l=a;break}let m=l<h.length?h.slice(0,l).join("\n").length:a.length,n=g(c);return`${a.slice(0,e)}${d.trim()}
123
123
 
124
- ${n}${a.slice(m)}`}let l=bj.task.sections.findIndex(a=>(0,z.tU)(a.title)===(0,z.tU)(b));if(l>=0){let d=bj.task.sections.slice(l+1).map(a=>(0,z.tU)(a.title));for(let e=0;e<h.length;e+=1){let f=/^(#{3,4})\s+(.+)$/u.exec(h[e].trim());if(!f||!d.includes((0,z.tU)(f[2])))continue;let i=h.slice(0,e).join("\n").length+ +(e>0),j=g(c);return j?`${a.slice(0,i).trimEnd()}
124
+ ${n}${a.slice(m)}`}let l=be.task.sections.findIndex(a=>(0,z.tU)(a.title)===(0,z.tU)(b));if(l>=0){let d=be.task.sections.slice(l+1).map(a=>(0,z.tU)(a.title));for(let e=0;e<h.length;e+=1){let f=/^(#{3,4})\s+(.+)$/u.exec(h[e].trim());if(!f||!d.includes((0,z.tU)(f[2])))continue;let i=h.slice(0,e).join("\n").length+ +(e>0),j=g(c);return j?`${a.slice(0,i).trimEnd()}
125
125
 
126
126
  ### ${b}
127
127
 
@@ -131,6 +131,6 @@ ${a.slice(i).trimStart()}`:a}}let m=g(c);return m?`${a.trimEnd()}
131
131
 
132
132
  ### ${b}
133
133
 
134
- ${m}`:a},O=async b=>{var e;(0,z.Te)(a.signal);let f=D(b.message),g=/Writer 未完成/u.test(b.message)?"缺失小节":"深度不足小节",h=bj.task.sections.find(a=>a.title===f),i=B.get(c5(m,f))||0,j=(e=h?.minChars,Math.max(e||0,i&&i>0?Math.ceil(i/.8):0,/项目主要施工内容/u.test(f)?2200:/主要分部分项工程施工方案|主要施工方法/u.test(f)?1800:/项目特点.*重点.*难点|重点.*难点.*分析/u.test(f)?1500:/原材料进场复试|见证取样|危大工程专项施工方案审批流程/u.test(f)?900:760)),k=/正文不足,未达到任务最小深度/u.test(b.message),l=bm(await aM(f).catch(()=>[]),a1);bo(l.length?l:an,a1,`repair:${c.id}:${f}`),cc.llm.lastError=void 0;let n=await E(()=>(0,aR.X6)(cc,`agent-repairer-section:${c.id}:${f}`,()=>(0,aU.mF)({template:q,chapter:c,sectionTitle:f,evidence:l.length?l:an,missingFacts:aq,promptTexts:[d||bk,G].filter(Boolean).join("\n\n"),projectContext:bR,requirement:a.requirement,roleContext:av,targetWords:j,maxWords:1.25*j,forbidDrawingImages:!1,factCoverageContext:be,qualityFeedback:`Repairer 定向补写“${f}”。必须输出该小节正式正文并彻底删除 WRITER_MISSING_SECTION 标记。`,diagnostics:cc,signal:a.signal,allowLenientStructureGate:!0})));if(!n||n.includes("WRITER_MISSING_SECTION")){let b=cc.llm.lastError;cc.llm.lastError=void 0,n=await E(()=>(0,aR.X6)(cc,`agent-repairer-section-retry:${c.id}:${f}`,()=>(0,aU.mF)({template:q,chapter:c,sectionTitle:f,evidence:l.length?l:an,missingFacts:aq,promptTexts:G,projectContext:bR,requirement:a.requirement,roleContext:av,targetWords:j,maxWords:1.15*j,forbidDrawingImages:!1,factCoverageContext:be,qualityFeedback:`第二次定向补写“${f}”:只写该小节正式正文,不写解释,不保留 WRITER_MISSING_SECTION。${b?`上次失败原因:${b},必须逐条修正。`:""}`,diagnostics:cc,signal:a.signal,allowLenientStructureGate:!0})))}if(n&&!n.includes("WRITER_MISSING_SECTION")){let a=/^#{3,4}\s+/u.test(n.trim())?n.trim():`### ${f}
134
+ ${m}`:a},O=async b=>{var e;(0,z.Te)(a.signal);let f=D(b.message),g=/Writer 未完成/u.test(b.message)?"缺失小节":"深度不足小节",h=be.task.sections.find(a=>a.title===f),i=B.get(c5(k,f))||0,j=(e=h?.minChars,Math.max(e||0,i&&i>0?Math.ceil(i/.8):0,/项目主要施工内容/u.test(f)?2200:/主要分部分项工程施工方案|主要施工方法/u.test(f)?1800:/项目特点.*重点.*难点|重点.*难点.*分析/u.test(f)?1500:/原材料进场复试|见证取样|危大工程专项施工方案审批流程/u.test(f)?900:760)),l=/正文不足,未达到任务最小深度/u.test(b.message),m=bm(await aL(f).catch(()=>[]),a1);bo(m.length?m:am,a1,`repair:${c.id}:${f}`),cc.llm.lastError=void 0;let n=await E(()=>(0,aR.X6)(cc,`agent-repairer-section:${c.id}:${f}`,()=>(0,aU.mF)({template:q,chapter:c,sectionTitle:f,evidence:m.length?m:am,missingFacts:an,promptTexts:[d||bj,G].filter(Boolean).join("\n\n"),projectContext:bR,requirement:a.requirement,roleContext:au,targetWords:j,maxWords:1.25*j,forbidDrawingImages:!1,factCoverageContext:a9,qualityFeedback:`Repairer 定向补写“${f}”。必须输出该小节正式正文并彻底删除 WRITER_MISSING_SECTION 标记。`,diagnostics:cc,signal:a.signal,allowLenientStructureGate:!0})));if(!n||n.includes("WRITER_MISSING_SECTION")){let b=cc.llm.lastError;cc.llm.lastError=void 0,n=await E(()=>(0,aR.X6)(cc,`agent-repairer-section-retry:${c.id}:${f}`,()=>(0,aU.mF)({template:q,chapter:c,sectionTitle:f,evidence:m.length?m:am,missingFacts:an,promptTexts:G,projectContext:bR,requirement:a.requirement,roleContext:au,targetWords:j,maxWords:1.15*j,forbidDrawingImages:!1,factCoverageContext:a9,qualityFeedback:`第二次定向补写“${f}”:只写该小节正式正文,不写解释,不保留 WRITER_MISSING_SECTION。${b?`上次失败原因:${b},必须逐条修正。`:""}`,diagnostics:cc,signal:a.signal,allowLenientStructureGate:!0})))}if(n&&!n.includes("WRITER_MISSING_SECTION")){let a=/^#{3,4}\s+/u.test(n.trim())?n.trim():`### ${f}
135
135
 
136
- ${n.trim()}`,b=(0,w.V7)(a),c=Math.min(Math.max(Math.floor(.7*j),(0,aU.ap)(f)),Math.max(500,j)),d=!k||b>=c;return{sectionTitle:f,rewriteReason:g,normalizedSection:a,normalizedLength:b,enoughDepth:d,evidenceCount:l.length||an.length,repairTargetWords:j}}return{sectionTitle:f,rewriteReason:g,normalizedLength:0,enoughDepth:!1,evidenceCount:0,repairTargetWords:j,failed:n?"仍包含 WRITER_MISSING_SECTION":cc.llm.lastError||"空响应"}};for(let b=0;b<L.length;b+=3){let d=L.slice(b,b+3);for(let b of(await Promise.allSettled(d.map(a=>O(a))))){if("rejected"===b.status){if(a.signal?.aborted)throw b.reason;M.push(`失败:${b.reason instanceof Error?b.reason.message:"未知异常"}`);continue}if(!b.value)continue;if(b.value.failed){M.push(`失败:${b.value.sectionTitle}(${b.value.failed})`);let a=(y.get(b.value.sectionTitle)||0)+1;y.set(b.value.sectionTitle,a),a>=2&&x.add(b.value.sectionTitle);continue}let c=c5(m,b.value.sectionTitle),d=b.value.enoughDepth?N(e.content,b.value.sectionTitle,b.value.normalizedSection||"",c):e.content,f=d!==e.content;if(f&&(e={...e,content:d}),f)y.delete(b.value.sectionTitle),x.delete(b.value.sectionTitle);else if(!b.value.enoughDepth){let a=(y.get(b.value.sectionTitle)||0)+1;y.set(b.value.sectionTitle,a),a>=2&&x.add(b.value.sectionTitle)}M.push(f?`成功:${b.value.sectionTitle}(${b.value.normalizedLength}字,证据 ${b.value.evidenceCount} 条)`:`失败:${b.value.sectionTitle}(${b.value.enoughDepth?"未定位到原小节块":`补写不足 ${b.value.normalizedLength}/${b.value.repairTargetWords} 字`})`)}(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:`agent-repairer-${c.id}`,status:"running",message:`${(0,t.GQ)(c.title)} 已补写深度不足小节 ${Math.min(b+3,L.length)}/${L.length}`,details:M},{subtitle:"Agent Repairer",order:H})),C(A)}let P={content:e.content,appliedCount:0};F?(n=!0,P=await E(()=>(0,aR.X6)(cc,`agent-polisher:${c.id}`,()=>(0,aR.l8)({template:q,chapter:{id:c.id,title:c.title,content:e.content,evidence:an,missingFacts:aq,sections:bY},issues:l.map(a=>`${a.message};${a.suggestion||""}`),promptTexts:[d||bk,G].filter(Boolean).join("\n\n"),requirement:a.requirement,forbidDrawingImages:!1,diagnostics:cc,signal:a.signal})))):h.some(a=>!/Writer 未完成|正文不足,未达到任务最小深度/u.test(a.message))&&(P=await E(()=>(0,aR.X6)(cc,`agent-repairer:${c.id}`,()=>(0,aR.l8)({template:q,chapter:{id:c.id,title:c.title,content:e.content,evidence:an,missingFacts:aq,sections:bY},issues:[...h.map(a=>`${a.message};${a.suggestion||""}`),...l.length>0&&!n?l.map(a=>`${a.message};${a.suggestion||""}`):[]],promptTexts:[d||bk,G].filter(Boolean).join("\n\n"),requirement:a.requirement,forbidDrawingImages:!1,diagnostics:cc,signal:a.signal,maxTokens:p?3200:void 0})))),e={...e,content:dt(P.content||e.content,c)},f=er({task:bj.task,draft:e,context:bz,plannedCoverage:m}),bz.reviewResults={...bz.reviewResults||{},[c.id]:f},i=(h=f.issues.filter(a=>"blocker"===a.severity||"error"===a.level)).some(a=>/Writer 未完成/u.test(a.message)),j=h.some(a=>/正文不足,未达到任务最小深度/u.test(a.message)),k=f.issues.some(a=>"error"!==a.level&&"blocker"!==a.severity&&/正文不足,未达到任务最小深度/u.test(a.message)&&!x.has(D(a.message))),l=f.issues.filter(a=>"warning"===a.level&&/未匹配到独立小节标题|工序顺序表达缺失/u.test(a.message)),o=h.length>0&&(f.repairable||i||j)||k||0===h.length&&l.length>0&&!n,h.length<v?u=0:h.length>0&&(u+=1),v=h.length;let Q=h.length>0,R=`chapter-repairer-${c.id}`,S=bz.nodes.find(a=>a.id===R);S?(S.status=Q?"failed":"completed",S.completedAt=Date.now(),S.outputSummary=f.issues.length?`修复后仍有 ${f.issues.length} 个问题`:"定向修复通过",S.issues=f.issues):bz.nodes.push({id:R,type:"chapter_repairer",status:Q?"failed":"completed",startedAt:Date.now(),completedAt:Date.now(),outputSummary:f.issues.length?`修复后仍有 ${f.issues.length} 个问题`:"定向修复通过",metrics:{supportedFacts:f.supportedFacts},issues:f.issues});let T=bz.nodes.find(a=>a.id===`chapter-reviewer-${c.id}`);T&&"running"===T.status&&(T.status=Q?"failed":"completed",T.completedAt=Date.now(),T.outputSummary=f.issues.length?`${f.issues.length} 个 Reviewer 提示`:"Reviewer 通过"),(0,c3.cN)(bz),(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:`agent-reviewer-${c.id}`,status:Q?"failed":"success",message:Q?`${(0,t.GQ)(c.title)} Reviewer 第 ${s} 轮复审仍有 ${h.length} 个阻断问题${o&&cn.remaining>0&&s<r+2?",继续下一轮修复":""}`:`${(0,t.GQ)(c.title)} Reviewer 第 ${s} 轮复审通过`,details:f.issues.map(a=>a.message)},{subtitle:"Agent Reviewer",order:H-1})),(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:`agent-repairer-${c.id}`,status:Q?"failed":"success",message:f.issues.length?`${(0,t.GQ)(c.title)} 第 ${s} 轮定向修复后仍有 ${f.issues.length} 个问题`:`${(0,t.GQ)(c.title)} 定向修复通过`,details:[...M,...f.issues.map(a=>`剩余:${a.message}`)]},{subtitle:"Agent Repairer",order:H})),C(A)}f.issues.some(a=>"blocker"===a.severity||"error"===a.level)&&bd.push(`${(0,t.GQ)(c.title)} Reviewer 未通过:${f.issues.map(a=>a.message).join(";")}(已修复 ${s} 轮,${cn.remaining<=0?"文档级修复总池已耗尽":"本章修复轮次达上限"};问题已标记并转入门禁阻断,可在记录详情查看后决定继续修复或调整模板)`),bf[g]=e,A=bf.filter(a=>!!a),C(A),cc.quality.blockingCount+=f.issues.filter(a=>"error"===a.level).length,cc.quality.importantCount+=f.issues.filter(a=>"warning"===a.level).length}catch(b){if(a.signal?.aborted)throw b;console.error(`[gen] chapter ${c.title} review failed:`,b),bd.push(`${(0,t.GQ)(c.title)}:审查修复阶段失败:${b instanceof Error?b.message:"未知错误"}`)}}}catch(d){if(a.signal?.aborted)throw d;console.error(`[gen] chapter ${c.title} failed:`,d);let b=`${c.title}:${d instanceof Error?d.message:"生成失败"}`;bd.push(b),f=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",status:"failed",message:`${(0,t.GQ)(c.title)} 生成失败:${b}`},{subtitle:(0,t.GQ)(c.title),order:g}),bg[g]=f}f&&(J[i]=f),C(A)}))))d&&cm.push(cl.run(d))}await Promise.all(cm);let cr=bf.filter(a=>!!a);be.push(...bg.filter(a=>!!a));let cs=[];if(ca.enableGlobalReview)try{let b=ca.globalReviewSamplingRate??1,c=b>=1||cr.length<=2?cr:cr.filter((a,c)=>c%Math.max(2,Math.round(1/b))==0),d=c.length,e=()=>E(()=>a8({template:q,chapters:c,chapterReviews:[],promptTexts:aL,requirement:a.requirement,projectContext:bR,diagnostics:cc,signal:a.signal})),f=()=>{let a=cr.map(a=>a.content).join("\n\n");return[...(0,x.qm)(a,by,bB.scopeConflicts).filter(a=>/跨章一致性冲突/u.test(a.message)),...(0,x.hr)(a,by).filter(a=>"error"===a.level)].map(a=>`${a.message};${a.suggestion||""}`)},g=await e();cs=[...new Set([...g.issues,...f()])];for(let b=0;b<2&&cs.length>0;b+=1){(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"global-consistency-repair",status:"running",message:`跨章一致性冲突第 ${b+1} 轮定向修复(${cs.length} 个冲突)`},{subtitle:"跨章一致性修复"})),C(cr);let c=0;for(let b of cr){let d=b.content.replace(/\s+/gu,"").replace(/平方米|m²|m2/giu,"㎡"),e=cs.filter(a=>{if(a.includes(b.title)||(a.match(/不一致的表述\s*([^;;。\n]+)/u)?.[1]||"").split(/[、,,]/u).some(a=>{let b=a.trim().replace(/\s+/gu,"").replace(/平方米|m²|m2/giu,"㎡");return b.length>=3&&d.includes(b)}))return!0;let c=a.match(/正文([^配比厚度\s]{1,6}?)(?:配比|厚度)/u)?.[1];return!!(c&&b.content.includes(c))});if(0===e.length)continue;let f=await E(()=>(0,aR.X6)(cc,`global-consistency-repair:${b.id}`,()=>(0,aR.l8)({template:q,chapter:{id:b.id,title:b.title,content:b.content,evidence:b.evidence||[],missingFacts:b.missingFacts||[],sections:b.sections},issues:e.map(a=>`${a};请严格按冲突描述中给出的资料口径修正本章对应表述,不得引入新的数值;与资料口径一致的既有表述(含分层/子项数值)不得改动。`),promptTexts:aL,requirement:a.requirement,forbidDrawingImages:!0,diagnostics:cc,signal:a.signal})));f.content&&f.content!==b.content&&(b.content=f.content,c+=1)}if(0===c)break;C(cr);let d=await e();cs=[...new Set([...d.issues,...f()])],(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"global-consistency-review",status:cs.length>0?"failed":"success",message:cs.length>0?`跨章一致性复检:仍有 ${cs.length} 个冲突`:"跨章一致性复检通过"},{subtitle:"全局一致性审查"})),C(cr)}let h=(0,x.KI)(cr,by,bB.scopeConflicts);h.fixedCount>0&&(cs=[...new Set([...cs.filter(a=>!/^跨章一致性冲突|^工序规格冲突/u.test(a)),...f()])],(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"global-consistency-deterministic-fix",status:"success",message:`跨章一致性数值定点修复:${h.fixedCount} 处(${h.details.slice(0,4).join("、")})`,details:h.details.slice(4)},{subtitle:"跨章一致性修复"})),C(cr));let i=d<cr.length?{...g.stage,message:`${g.stage.message||"全局一致性审查完成"}(抽检 ${d}/${cr.length} 章)`}:g.stage;(0,aQ.fx)(J,i),C(cr)}catch(b){if(a.signal?.aborted)throw b;console.error("[gen] global consistency review failed:",b)}let ct=(0,aO.Xi)(bO,cr);if(ct.length>0)for(let b=0;b<2&&ct.length>0;b+=1){(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"table-execution-repair",status:"running",message:`表格执行率修复第 ${b+1} 轮(${ct.length} 个章节缺表)`},{subtitle:"表格执行率修复"})),C(cr);let c=0;for(let b of ct){let d=cr.find(a=>a.title===b.chapterTitle||b.chapterTitle.includes(a.title)||a.title.includes(b.chapterTitle));if(!d)continue;let e=await E(()=>(0,aR.X6)(cc,`table-execution-repair:${d.id}`,()=>(0,aR.l8)({template:q,chapter:{id:d.id,title:d.title,content:d.content,evidence:d.evidence||[],missingFacts:d.missingFacts||[],sections:d.sections},issues:[`计划表格缺失(计划 ${b.planned} 张,实际仅 ${b.actual} 张):${b.plans.map(a=>`${a.title}(表头:${a.fields.map(a=>a.name).join("、")})`).join(";")}。必须按表头字段补齐这些 markdown 表格并紧跟相关小节输出,不得删除已有正文;每个表格前须有 1~2 句引导叙述说明表格作用与关键结论,表格不能替代小节正文;deriveFromProject 字段基于项目工程量、总工期与工序流水按定额工效推导具体数值,projectFactOnly 字段不得编造。`],promptTexts:aL,requirement:a.requirement,forbidDrawingImages:!0,diagnostics:cc,signal:a.signal,maxTokens:Math.min(12e3,Math.max(6e3,1200*b.plans.length))})));e.content&&e.content!==d.content&&(d.content=e.content,c+=1)}if(0===c){(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"table-execution-repair",status:"failed",message:`表格执行率修复第 ${b+1} 轮:补表 patch 未应用(${ct.length} 个章节缺表)`},{subtitle:"表格执行率修复"})),C(cr);break}C(cr),ct=(0,aO.Xi)(bO,cr),(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"table-execution-repair",status:ct.length>0?"failed":"success",message:ct.length>0?`表格执行率修复第 ${b+1} 轮完成,仍有 ${ct.length} 个章节缺表`:`表格执行率修复第 ${b+1} 轮完成`},{subtitle:"表格执行率修复"})),(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"table-execution-review",status:ct.length>0?"failed":"success",message:ct.length>0?`表格执行率复检:仍有 ${ct.length} 个章节缺表`:"表格执行率复检通过"},{subtitle:"表格执行率核验"}))}{let a=cc.evidence,b=cc.llm;(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"budget-trim-report",status:"success",message:`预算裁剪报告:证据 ${a.raw} 条 → 采用 ${a.used} 条(噪声过滤 ${a.filteredNoise} 条、预算兜底裁剪 ${a.budgetDropped} 条),证据上下文 ${a.contextChars} 字`,details:[`证据质量:平均噪声分 ${a.avgNoiseScore},平均事实密度 ${a.avgFactDensity}`,`检索:${a.searchQueries} 组查询,耗时 ${Math.round(a.searchMs/1e3)} 秒`,`LLM:${b.calls} 次调用,失败 ${b.failures} 次,重试 ${b.retries} 次,schema 校验失败 ${b.schemaFailures} 次`,"防爆兜底类软限制(保留并逐项记录裁剪量):selectEvidenceByBudget 的 maxItems/maxChars、uniqueEvidence 噪声过滤、evidenceBundlePrompt 的 maxChars、块级证据 top-k 截断、块级 facts 截断","语义取舍类软限制(已迁移本地语义模型):evaluationTexts 词面过滤→条目对象化、criterionFeatures 二字滑窗→bge-small 余弦、章节证据字符硬截→语义排序取 top-k","LLM 输出侧:schema 校验(截断位置可诊断)、空响应重试提示词收敛、块成稿 maxTokens 按目标字数 1:1.2(不走 thinking \xd76 放大)"]},{subtitle:"预算裁剪审计"})),C(cr)}return ee({chapterDrafts:cr,chapterDraftsByOrder:bf,chapterGenerationStagesByOrder:bg,chapterGenerationStages:be,effectiveChapters:bO,template:q,allEvidence:a7,projectMaterialScope:a1,progressStages:J,documentSpec:ao,projectMaterialProfile:V,projectMaterialSummary:ae,domainProfile:ap,documentBudget:b7,promptTexts:aJ,reviewPromptTexts:aL,input:a,generationStrategy:ca,generationDiagnostics:cc,promptBindings:Q,promptDocumentRules:aH,projectUnderstanding:W,projectContext:bR,projectRoot:o,projectId:p,readiness:ar,factExtractionPromptTexts:aK,hasExplicitOutline:ad,missingItems:bc,retrievalCoverageReports:ba,failedChapterMessages:bd,webResearchReport:bb,indexHealth:aZ,promptPlan:P,globalConsistencyIssues:cs,scopeConflicts:bB.scopeConflicts,writingTaskBrief:b4,evaluationCriteriaItems:bF.map(a=>a.title).filter(Boolean),tenderRequirements:bK,requirementsSimilarity:b0,factTokenScopeClassifier:b2,professionalDepthClassifier:b3,agentWorkflow:bz,emitProgress:C,withProgressHeartbeat:E})}},79227:(a,b,c)=>{c.d(b,{C:()=>f,previewGenerationBudgetForTemplate:()=>g});var d=c(34680),e=c(95734);function f(a){let b=Math.max(1,a.chapters.length),c=a.targetWords>0?Math.round(a.targetWords/b):1200,d=a.strategy,f=[],g=a.materialFileCount<4&&a.evidenceCount<6,h=Math.max(1,Math.min(b,(Number.isFinite(a.configuredChapterConcurrency)&&a.configuredChapterConcurrency>0?Math.floor(a.configuredChapterConcurrency):void 0)??b)),i=(0,e.Qf)(a.targetWords),j="fast"===d.mode?1:Math.max(1,b),{floorChars:k,ceilingChars:l}=c>=6e3?{floorChars:14e3,ceilingChars:52e3}:c>=3e3?{floorChars:11e3,ceilingChars:36e3}:{floorChars:8e3,ceilingChars:24e3},m=d.repairRoundBudget?d.repairRoundBudget:Math.max(2,Math.min(4,2+ +(a.targetWords>=2e4)+ +!!g)),n=Math.min(m*b,Math.max(12,2*b));return"strict"===d.mode&&f.push("strict:风险领域关键词命中(专项/安全/质量/验收/合同/合规等)"),a.targetWords>=4e4&&f.push("strict:目标篇幅超长(≥4 万字)"),g&&f.push("strict:资料稀疏(资料包文件 <4 且可用证据 <6 条)"),"fast"===d.mode&&f.push("fast:小文档(≤6000 字且 ≤4 章)全局审查降级为 35% 抽检"),"longform"===d.mode&&f.push("longform:长文档(≥3 万字或 ≥8 章)"),"balanced"===d.mode&&f.push("balanced:常规篇幅文档,标准审查深度"),f.push(`全章节并行生成(${h}/${b} 章同批),审查流水线 ${j} 路,全局 LLM 并发不设上限,每章证据预算 ${Math.round(k/1e3)}k-${Math.round(l/1e3)}k 字符,修复轮次预算每章 ${m} 轮(文档级总池 ${n} 轮,收敛判定优先)`),{strategy:d,chapterConcurrency:h,reviewConcurrency:j,llmConcurrency:i,evidenceFloorChars:k,evidenceCeilingChars:l,repairRoundBudget:m,repairPoolBudget:n,triggers:f}}function g(a){let b=Math.max(1,a.chapters.length),c=Math.max(0,Math.round(a.targetWords??0)),e=(0,d.JP)({template:a.template,targetWords:c,requirement:a.requirement,materialFileCount:a.materialFileCount,evidenceCount:a.evidenceCount}),g=f({template:a.template,chapters:a.chapters,targetWords:c,requirement:a.requirement,materialFileCount:a.materialFileCount,evidenceCount:a.evidenceCount,hasVeryLargeExplicitChapter:a.hasVeryLargeExplicitChapter??!1,configuredChapterConcurrency:a.configuredChapterConcurrency??0,strategy:e});return{mode:e.mode,enableGlobalReview:e.enableGlobalReview,globalReviewSamplingRate:e.globalReviewSamplingRate??1,repairRoundBudget:g.repairRoundBudget,chapterConcurrency:g.chapterConcurrency,reviewConcurrency:g.reviewConcurrency,evidenceFloorChars:g.evidenceFloorChars,evidenceCeilingChars:g.evidenceCeilingChars,targetWords:c,chapterCount:b,triggers:g.triggers}}},87942:(a,b,c)=>{c.d(b,{x:()=>d});let d={version:"professional-document-workflow-v5",rules:["complete-local-knowledge-assumption","knowledge-coverage-recovery","fact-trace-placement","chapter-coverage-gate","structured-quality-report","post-repair-verification"]}}};
136
+ ${n.trim()}`,b=(0,w.V7)(a),c=Math.min(Math.max(Math.floor(.7*j),(0,aU.ap)(f)),Math.max(500,j)),d=!l||b>=c;return{sectionTitle:f,rewriteReason:g,normalizedSection:a,normalizedLength:b,enoughDepth:d,evidenceCount:m.length||am.length,repairTargetWords:j}}return{sectionTitle:f,rewriteReason:g,normalizedLength:0,enoughDepth:!1,evidenceCount:0,repairTargetWords:j,failed:n?"仍包含 WRITER_MISSING_SECTION":cc.llm.lastError||"空响应"}};for(let b=0;b<L.length;b+=3){let d=L.slice(b,b+3);for(let b of(await Promise.allSettled(d.map(a=>O(a))))){if("rejected"===b.status){if(a.signal?.aborted)throw b.reason;M.push(`失败:${b.reason instanceof Error?b.reason.message:"未知异常"}`);continue}if(!b.value)continue;if(b.value.failed){M.push(`失败:${b.value.sectionTitle}(${b.value.failed})`);let a=(y.get(b.value.sectionTitle)||0)+1;y.set(b.value.sectionTitle,a),a>=2&&x.add(b.value.sectionTitle);continue}let c=c5(k,b.value.sectionTitle),d=b.value.enoughDepth?N(e.content,b.value.sectionTitle,b.value.normalizedSection||"",c):e.content,f=d!==e.content;if(f&&(e={...e,content:d}),f)y.delete(b.value.sectionTitle),x.delete(b.value.sectionTitle);else if(!b.value.enoughDepth){let a=(y.get(b.value.sectionTitle)||0)+1;y.set(b.value.sectionTitle,a),a>=2&&x.add(b.value.sectionTitle)}M.push(f?`成功:${b.value.sectionTitle}(${b.value.normalizedLength}字,证据 ${b.value.evidenceCount} 条)`:`失败:${b.value.sectionTitle}(${b.value.enoughDepth?"未定位到原小节块":`补写不足 ${b.value.normalizedLength}/${b.value.repairTargetWords} 字`})`)}(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:`agent-repairer-${c.id}`,status:"running",message:`${(0,t.GQ)(c.title)} 已补写深度不足小节 ${Math.min(b+3,L.length)}/${L.length}`,details:M},{subtitle:"Agent Repairer",order:H})),C(A)}let P={content:e.content,appliedCount:0};F?(o=!0,P=await E(()=>(0,aR.X6)(cc,`agent-polisher:${c.id}`,()=>(0,aR.l8)({template:q,chapter:{id:c.id,title:c.title,content:e.content,evidence:am,missingFacts:an,sections:bX},issues:n.map(a=>`${a.message};${a.suggestion||""}`),promptTexts:[d||bj,G].filter(Boolean).join("\n\n"),requirement:a.requirement,forbidDrawingImages:!1,diagnostics:cc,signal:a.signal})))):h.some(a=>!/Writer 未完成|正文不足,未达到任务最小深度/u.test(a.message))&&(P=await E(()=>(0,aR.X6)(cc,`agent-repairer:${c.id}`,()=>(0,aR.l8)({template:q,chapter:{id:c.id,title:c.title,content:e.content,evidence:am,missingFacts:an,sections:bX},issues:[...h.map(a=>`${a.message};${a.suggestion||""}`),...n.length>0&&!o?n.map(a=>`${a.message};${a.suggestion||""}`):[]],promptTexts:[d||bj,G].filter(Boolean).join("\n\n"),requirement:a.requirement,forbidDrawingImages:!1,diagnostics:cc,signal:a.signal,maxTokens:m?3200:void 0})))),e={...e,content:dt(P.content||e.content,c)},f=er({task:be.task,draft:e,context:bz,plannedCoverage:k}),bz.reviewResults={...bz.reviewResults||{},[c.id]:f},i=(h=f.issues.filter(a=>"blocker"===a.severity||"error"===a.level)).some(a=>/Writer 未完成/u.test(a.message)),j=h.some(a=>/正文不足,未达到任务最小深度/u.test(a.message)),l=f.issues.some(a=>"error"!==a.level&&"blocker"!==a.severity&&/正文不足,未达到任务最小深度/u.test(a.message)&&!x.has(D(a.message))),n=f.issues.filter(a=>"warning"===a.level&&/未匹配到独立小节标题|工序顺序表达缺失/u.test(a.message)),p=h.length>0&&(f.repairable||i||j)||l||0===h.length&&n.length>0&&!o,h.length<v?u=0:h.length>0&&(u+=1),v=h.length;let Q=h.length>0,R=`chapter-repairer-${c.id}`,S=bz.nodes.find(a=>a.id===R);S?(S.status=Q?"failed":"completed",S.completedAt=Date.now(),S.outputSummary=f.issues.length?`修复后仍有 ${f.issues.length} 个问题`:"定向修复通过",S.issues=f.issues):bz.nodes.push({id:R,type:"chapter_repairer",status:Q?"failed":"completed",startedAt:Date.now(),completedAt:Date.now(),outputSummary:f.issues.length?`修复后仍有 ${f.issues.length} 个问题`:"定向修复通过",metrics:{supportedFacts:f.supportedFacts},issues:f.issues});let T=bz.nodes.find(a=>a.id===`chapter-reviewer-${c.id}`);T&&"running"===T.status&&(T.status=Q?"failed":"completed",T.completedAt=Date.now(),T.outputSummary=f.issues.length?`${f.issues.length} 个 Reviewer 提示`:"Reviewer 通过"),(0,c3.cN)(bz),(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:`agent-reviewer-${c.id}`,status:Q?"failed":"success",message:Q?`${(0,t.GQ)(c.title)} Reviewer 第 ${s} 轮复审仍有 ${h.length} 个阻断问题${p&&cn.remaining>0&&s<r+2?",继续下一轮修复":""}`:`${(0,t.GQ)(c.title)} Reviewer 第 ${s} 轮复审通过`,details:f.issues.map(a=>a.message)},{subtitle:"Agent Reviewer",order:H-1})),(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:`agent-repairer-${c.id}`,status:Q?"failed":"success",message:f.issues.length?`${(0,t.GQ)(c.title)} 第 ${s} 轮定向修复后仍有 ${f.issues.length} 个问题`:`${(0,t.GQ)(c.title)} 定向修复通过`,details:[...M,...f.issues.map(a=>`剩余:${a.message}`)]},{subtitle:"Agent Repairer",order:H})),C(A)}f.issues.some(a=>"blocker"===a.severity||"error"===a.level)&&bd.push(`${(0,t.GQ)(c.title)} Reviewer 未通过:${f.issues.map(a=>a.message).join(";")}(已修复 ${s} 轮,${cn.remaining<=0?"文档级修复总池已耗尽":"本章修复轮次达上限"};问题已标记并转入门禁阻断,可在记录详情查看后决定继续修复或调整模板)`),bf[g]=e,A=bf.filter(a=>!!a),C(A),cc.quality.blockingCount+=f.issues.filter(a=>"error"===a.level).length,cc.quality.importantCount+=f.issues.filter(a=>"warning"===a.level).length}catch(b){if(a.signal?.aborted)throw b;console.error(`[gen] chapter ${c.title} review failed:`,b),bd.push(`${(0,t.GQ)(c.title)}:审查修复阶段失败:${b instanceof Error?b.message:"未知错误"}`)}}}catch(d){if(a.signal?.aborted)throw d;console.error(`[gen] chapter ${c.title} failed:`,d);let b=`${c.title}:${d instanceof Error?d.message:"生成失败"}`;bd.push(b),f=(0,aQ.X5)({type:"chapter_generation",roleId:"chapter_generation",status:"failed",message:`${(0,t.GQ)(c.title)} 生成失败:${b}`},{subtitle:(0,t.GQ)(c.title),order:g}),bg[g]=f}f&&(J[i]=f),C(A)}))))d&&cm.push(cl.run(d))}await Promise.all(cm);let cr=bf.filter(a=>!!a);be.push(...bg.filter(a=>!!a));let cs=[];if(ca.enableGlobalReview)try{let b=ca.globalReviewSamplingRate??1,c=b>=1||cr.length<=2?cr:cr.filter((a,c)=>c%Math.max(2,Math.round(1/b))==0),d=c.length,e=()=>E(()=>a8({template:q,chapters:c,chapterReviews:[],promptTexts:aL,requirement:a.requirement,projectContext:bR,diagnostics:cc,signal:a.signal})),f=()=>{let a=cr.map(a=>a.content).join("\n\n");return[...(0,x.qm)(a,by,bB.scopeConflicts).filter(a=>/跨章一致性冲突/u.test(a.message)),...(0,x.hr)(a,by).filter(a=>"error"===a.level)].map(a=>`${a.message};${a.suggestion||""}`)},g=await e();cs=[...new Set([...g.issues,...f()])];for(let b=0;b<2&&cs.length>0;b+=1){(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"global-consistency-repair",status:"running",message:`跨章一致性冲突第 ${b+1} 轮定向修复(${cs.length} 个冲突)`},{subtitle:"跨章一致性修复"})),C(cr);let c=0;for(let b of cr){let d=b.content.replace(/\s+/gu,"").replace(/平方米|m²|m2/giu,"㎡"),e=cs.filter(a=>{if(a.includes(b.title)||(a.match(/不一致的表述\s*([^;;。\n]+)/u)?.[1]||"").split(/[、,,]/u).some(a=>{let b=a.trim().replace(/\s+/gu,"").replace(/平方米|m²|m2/giu,"㎡");return b.length>=3&&d.includes(b)}))return!0;let c=a.match(/正文([^配比厚度\s]{1,6}?)(?:配比|厚度)/u)?.[1];return!!(c&&b.content.includes(c))});if(0===e.length)continue;let f=await E(()=>(0,aR.X6)(cc,`global-consistency-repair:${b.id}`,()=>(0,aR.l8)({template:q,chapter:{id:b.id,title:b.title,content:b.content,evidence:b.evidence||[],missingFacts:b.missingFacts||[],sections:b.sections},issues:e.map(a=>`${a};请严格按冲突描述中给出的资料口径修正本章对应表述,不得引入新的数值;与资料口径一致的既有表述(含分层/子项数值)不得改动。`),promptTexts:aL,requirement:a.requirement,forbidDrawingImages:!0,diagnostics:cc,signal:a.signal})));f.content&&f.content!==b.content&&(b.content=f.content,c+=1)}if(0===c)break;C(cr);let d=await e();cs=[...new Set([...d.issues,...f()])],(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"global-consistency-review",status:cs.length>0?"failed":"success",message:cs.length>0?`跨章一致性复检:仍有 ${cs.length} 个冲突`:"跨章一致性复检通过"},{subtitle:"全局一致性审查"})),C(cr)}let h=(0,x.KI)(cr,by,bB.scopeConflicts);h.fixedCount>0&&(cs=[...new Set([...cs.filter(a=>!/^跨章一致性冲突|^工序规格冲突/u.test(a)),...f()])],(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"global-consistency-deterministic-fix",status:"success",message:`跨章一致性数值定点修复:${h.fixedCount} 处(${h.details.slice(0,4).join("、")})`,details:h.details.slice(4)},{subtitle:"跨章一致性修复"})),C(cr));let i=d<cr.length?{...g.stage,message:`${g.stage.message||"全局一致性审查完成"}(抽检 ${d}/${cr.length} 章)`}:g.stage;(0,aQ.fx)(J,i),C(cr)}catch(b){if(a.signal?.aborted)throw b;console.error("[gen] global consistency review failed:",b)}let ct=(0,aO.Xi)(bO,cr);if(ct.length>0)for(let b=0;b<2&&ct.length>0;b+=1){(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"table-execution-repair",status:"running",message:`表格执行率修复第 ${b+1} 轮(${ct.length} 个章节缺表)`},{subtitle:"表格执行率修复"})),C(cr);let c=0;for(let b of ct){let d=cr.find(a=>a.title===b.chapterTitle||b.chapterTitle.includes(a.title)||a.title.includes(b.chapterTitle));if(!d)continue;let e=await E(()=>(0,aR.X6)(cc,`table-execution-repair:${d.id}`,()=>(0,aR.l8)({template:q,chapter:{id:d.id,title:d.title,content:d.content,evidence:d.evidence||[],missingFacts:d.missingFacts||[],sections:d.sections},issues:[`计划表格缺失(计划 ${b.planned} 张,实际仅 ${b.actual} 张):${b.plans.map(a=>`${a.title}(表头:${a.fields.map(a=>a.name).join("、")})`).join(";")}。必须按表头字段补齐这些 markdown 表格并紧跟相关小节输出,不得删除已有正文;每个表格前须有 1~2 句引导叙述说明表格作用与关键结论,表格不能替代小节正文;deriveFromProject 字段基于项目工程量、总工期与工序流水按定额工效推导具体数值,projectFactOnly 字段不得编造。`],promptTexts:aL,requirement:a.requirement,forbidDrawingImages:!0,diagnostics:cc,signal:a.signal,maxTokens:Math.min(12e3,Math.max(6e3,1200*b.plans.length))})));e.content&&e.content!==d.content&&(d.content=e.content,c+=1)}if(0===c){(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"table-execution-repair",status:"failed",message:`表格执行率修复第 ${b+1} 轮:补表 patch 未应用(${ct.length} 个章节缺表)`},{subtitle:"表格执行率修复"})),C(cr);break}C(cr),ct=(0,aO.Xi)(bO,cr),(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"table-execution-repair",status:ct.length>0?"failed":"success",message:ct.length>0?`表格执行率修复第 ${b+1} 轮完成,仍有 ${ct.length} 个章节缺表`:`表格执行率修复第 ${b+1} 轮完成`},{subtitle:"表格执行率修复"})),(0,aQ.fx)(J,(0,aQ.X5)({type:"llm_review",roleId:"table-execution-review",status:ct.length>0?"failed":"success",message:ct.length>0?`表格执行率复检:仍有 ${ct.length} 个章节缺表`:"表格执行率复检通过"},{subtitle:"表格执行率核验"}))}{let a=cc.evidence,b=cc.llm;(0,aQ.fx)(J,(0,aQ.X5)({type:"validation",roleId:"budget-trim-report",status:"success",message:`预算裁剪报告:证据 ${a.raw} 条 → 采用 ${a.used} 条(噪声过滤 ${a.filteredNoise} 条、预算兜底裁剪 ${a.budgetDropped} 条),证据上下文 ${a.contextChars} 字`,details:[`证据质量:平均噪声分 ${a.avgNoiseScore},平均事实密度 ${a.avgFactDensity}`,`检索:${a.searchQueries} 组查询,耗时 ${Math.round(a.searchMs/1e3)} 秒`,`LLM:${b.calls} 次调用,失败 ${b.failures} 次,重试 ${b.retries} 次,schema 校验失败 ${b.schemaFailures} 次`,"防爆兜底类软限制(保留并逐项记录裁剪量):selectEvidenceByBudget 的 maxItems/maxChars、uniqueEvidence 噪声过滤、evidenceBundlePrompt 的 maxChars、块级证据 top-k 截断、块级 facts 截断","语义取舍类软限制(已迁移本地语义模型):evaluationTexts 词面过滤→条目对象化、criterionFeatures 二字滑窗→bge-small 余弦、章节证据字符硬截→语义排序取 top-k","LLM 输出侧:schema 校验(截断位置可诊断)、空响应重试提示词收敛、块成稿 maxTokens 按目标字数 1:1.2(不走 thinking \xd76 放大)"]},{subtitle:"预算裁剪审计"})),C(cr)}return ee({chapterDrafts:cr,chapterDraftsByOrder:bf,chapterGenerationStagesByOrder:bg,chapterGenerationStages:be,effectiveChapters:bO,template:q,allEvidence:a7,projectMaterialScope:a1,progressStages:J,documentSpec:ao,projectMaterialProfile:V,projectMaterialSummary:ae,domainProfile:ap,documentBudget:b7,promptTexts:aJ,reviewPromptTexts:aL,input:a,generationStrategy:ca,generationDiagnostics:cc,promptBindings:Q,promptDocumentRules:aH,projectUnderstanding:W,projectContext:bR,projectRoot:o,projectId:p,readiness:ar,factExtractionPromptTexts:aK,hasExplicitOutline:ad,missingItems:bc,retrievalCoverageReports:ba,failedChapterMessages:bd,webResearchReport:bb,indexHealth:aZ,promptPlan:P,globalConsistencyIssues:cs,scopeConflicts:bB.scopeConflicts,writingTaskBrief:b4,evaluationCriteriaItems:bF.map(a=>a.title).filter(Boolean),tenderRequirements:bK,requirementsSimilarity:b0,factTokenScopeClassifier:b2,professionalDepthClassifier:b3,agentWorkflow:bz,emitProgress:C,withProgressHeartbeat:E})}},79227:(a,b,c)=>{c.d(b,{C:()=>f,previewGenerationBudgetForTemplate:()=>g});var d=c(34680),e=c(95734);function f(a){let b=Math.max(1,a.chapters.length),c=a.targetWords>0?Math.round(a.targetWords/b):1200,d=a.strategy,f=[],g=a.materialFileCount<4&&a.evidenceCount<6,h=Math.max(1,Math.min(b,(Number.isFinite(a.configuredChapterConcurrency)&&a.configuredChapterConcurrency>0?Math.floor(a.configuredChapterConcurrency):void 0)??b)),i=(0,e.Qf)(a.targetWords),j="fast"===d.mode?1:Math.max(1,b),{floorChars:k,ceilingChars:l}=c>=6e3?{floorChars:14e3,ceilingChars:52e3}:c>=3e3?{floorChars:11e3,ceilingChars:36e3}:{floorChars:8e3,ceilingChars:24e3},m=d.repairRoundBudget?d.repairRoundBudget:Math.max(2,Math.min(4,2+ +(a.targetWords>=2e4)+ +!!g)),n=Math.min(m*b,Math.max(12,2*b));return"strict"===d.mode&&f.push("strict:风险领域关键词命中(专项/安全/质量/验收/合同/合规等)"),a.targetWords>=4e4&&f.push("strict:目标篇幅超长(≥4 万字)"),g&&f.push("strict:资料稀疏(资料包文件 <4 且可用证据 <6 条)"),"fast"===d.mode&&f.push("fast:小文档(≤6000 字且 ≤4 章)全局审查降级为 35% 抽检"),"longform"===d.mode&&f.push("longform:长文档(≥3 万字或 ≥8 章)"),"balanced"===d.mode&&f.push("balanced:常规篇幅文档,标准审查深度"),f.push(`全章节并行生成(${h}/${b} 章同批),审查流水线 ${j} 路,全局 LLM 并发不设上限,每章证据预算 ${Math.round(k/1e3)}k-${Math.round(l/1e3)}k 字符,修复轮次预算每章 ${m} 轮(文档级总池 ${n} 轮,收敛判定优先)`),{strategy:d,chapterConcurrency:h,reviewConcurrency:j,llmConcurrency:i,evidenceFloorChars:k,evidenceCeilingChars:l,repairRoundBudget:m,repairPoolBudget:n,triggers:f}}function g(a){let b=Math.max(1,a.chapters.length),c=Math.max(0,Math.round(a.targetWords??0)),e=(0,d.JP)({template:a.template,targetWords:c,requirement:a.requirement,materialFileCount:a.materialFileCount,evidenceCount:a.evidenceCount}),g=f({template:a.template,chapters:a.chapters,targetWords:c,requirement:a.requirement,materialFileCount:a.materialFileCount,evidenceCount:a.evidenceCount,hasVeryLargeExplicitChapter:a.hasVeryLargeExplicitChapter??!1,configuredChapterConcurrency:a.configuredChapterConcurrency??0,strategy:e});return{mode:e.mode,enableGlobalReview:e.enableGlobalReview,globalReviewSamplingRate:e.globalReviewSamplingRate??1,repairRoundBudget:g.repairRoundBudget,chapterConcurrency:g.chapterConcurrency,reviewConcurrency:g.reviewConcurrency,evidenceFloorChars:g.evidenceFloorChars,evidenceCeilingChars:g.evidenceCeilingChars,targetWords:c,chapterCount:b,triggers:g.triggers}}},87942:(a,b,c)=>{c.d(b,{x:()=>d});let d={version:"professional-document-workflow-v7",rules:["complete-local-knowledge-assumption","knowledge-coverage-recovery","fact-trace-placement","chapter-coverage-gate","structured-quality-report","post-repair-verification"]}}};
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/3854c6b3c59c0c44.css" as="style"/><link rel="stylesheet" href="/_next/static/css/3854c6b3c59c0c44.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-4224e970a97a4a86.js" defer=""></script><script src="/_next/static/chunks/framework-161be364fd69a7ce.js" defer=""></script><script src="/_next/static/chunks/main-91fb767ebd74c9c1.js" defer=""></script><script src="/_next/static/chunks/pages/_app-3e8b35112a00821a.js" defer=""></script><script src="/_next/static/chunks/pages/_error-282257fbdcc167b4.js" defer=""></script><script src="/_next/static/VjnnYofDY3M78o8fFsHkc/_buildManifest.js" defer=""></script><script src="/_next/static/VjnnYofDY3M78o8fFsHkc/_ssgManifest.js" defer=""></script></head><body><div id="__next"><script>((e,i,s,u,m,a,l,h)=>{let d=document.documentElement,w=["light","dark"];function p(n){(Array.isArray(e)?e:[e]).forEach(y=>{let k=y==="class",S=k&&a?m.map(f=>a[f]||f):m;k?(d.classList.remove(...S),d.classList.add(a&&a[n]?a[n]:n)):d.setAttribute(y,n)}),R(n)}function R(n){h&&w.includes(n)&&(d.style.colorScheme=n)}function c(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(u)p(u);else try{let n=localStorage.getItem(i)||s,y=l&&n==="system"?c():n;p(y)}catch(n){}})("class","theme","system",null,["light","dark"],null,true,true)</script><div class="css-1pi45l5 ant-app css-var-_R_16_"><aside class="sidebar"><a href="/overview"><div class="sidebarLogo"><div class="w-8 h-8 rounded-lg bg-black dark:bg-white flex items-center justify-center shrink-0"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-moon text-white dark:text-black"><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"></path></svg></div><div class="sidebarLogoTitle"><span class="logoGradient">Customize Agent</span></div></div></a><nav class="sidebarNav mt-2"><a href="/overview"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-layout-dashboard"><rect width="7" height="9" x="3" y="3" rx="1"></rect><rect width="7" height="5" x="14" y="3" rx="1"></rect><rect width="7" height="9" x="14" y="12" rx="1"></rect><rect width="7" height="5" x="3" y="16" rx="1"></rect></svg><span class="sidebarLabel">总览</span></div></a><div><div class="sidebarItem sidebarParent"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-database"><ellipse cx="12" cy="5" rx="9" ry="3"></ellipse><path d="M3 5V19A9 3 0 0 0 21 19V5"></path><path d="M3 12A9 3 0 0 0 21 12"></path></svg><span class="sidebarLabel">知识库</span><span class="sidebarChevron"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right"><path d="m9 18 6-6-6-6"></path></svg></span></div></div><a href="/models"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-cpu"><rect width="16" height="16" x="4" y="4" rx="2"></rect><rect width="6" height="6" x="9" y="9" rx="1"></rect><path d="M15 2v2"></path><path d="M15 20v2"></path><path d="M2 15h2"></path><path d="M2 9h2"></path><path d="M20 15h2"></path><path d="M20 9h2"></path><path d="M9 2v2"></path><path d="M9 20v2"></path></svg><span class="sidebarLabel">模型配置</span></div></a><a href="/prompt"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-square"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg><span class="sidebarLabel">提示词管理</span></div></a><a href="/document-roles"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-settings"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"></path><circle cx="12" cy="12" r="3"></circle></svg><span class="sidebarLabel">角色配置</span></div></a><a href="/documents"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-files"><path d="M20 7h-3a2 2 0 0 1-2-2V2"></path><path d="M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z"></path><path d="M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8"></path></svg><span class="sidebarLabel">工作流模版库</span></div></a><a href="/template-references"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-library-big"><rect width="8" height="18" x="3" y="3" rx="1"></rect><path d="M7 3v18"></path><path d="M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z"></path></svg><span class="sidebarLabel">模板参考</span></div></a><a href="/asset-library"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-folder-open"><path d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"></path></svg><span class="sidebarLabel">生成资源</span></div></a><a href="/system/logs"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-bug"><path d="m8 2 1.88 1.88"></path><path d="M14.12 3.88 16 2"></path><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"></path><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"></path><path d="M12 20v-9"></path><path d="M6.53 9C4.6 8.8 3 7.1 3 5"></path><path d="M6 13H2"></path><path d="M3 21c0-2.1 1.7-3.9 3.8-4"></path><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"></path><path d="M22 13h-4"></path><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"></path></svg><span class="sidebarLabel">系统日志</span></div></a><a href="/guide"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-open"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"></path><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"></path></svg><span class="sidebarLabel">指引</span></div></a><a href="/settings"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-settings"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"></path><circle cx="12" cy="12" r="3"></circle></svg><span class="sidebarLabel">设置</span></div></a></nav><div class="sidebarCollapseWrapper"><button class="sidebarCollapseBtn" aria-label="收起侧边栏"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-panel-left-close"><rect width="18" height="18" x="3" y="3" rx="2"></rect><path d="M9 3v18"></path><path d="m16 15-3-3 3-3"></path></svg></button></div></aside><div class="mainContent"><header class="topbar"><div class="flex-1"></div><span class="ant-badge css-1pi45l5 css-var-_R_16_"><button type="button" class="ant-btn css-1pi45l5 css-var-_R_16_ ant-btn-default ant-btn-color-default ant-btn-variant-outlined topbarBtn"><span class="ant-btn-icon"><span role="img" aria-label="clock-circle" class="anticon anticon-clock-circle"><svg viewBox="64 64 896 896" focusable="false" data-icon="clock-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"></path><path d="M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"></path></svg></span></span><span>后台任务</span></button></span><button class="topbarBtn"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-moon"><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"></path></svg><span>深色</span></button><button class="topbarBtn"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-languages"><path d="m5 8 6 6"></path><path d="m4 14 6-6 2-3"></path><path d="M2 5h12"></path><path d="M7 2h1"></path><path d="m22 22-5-10-5 10"></path><path d="M14 18h6"></path></svg><span>English</span></button></header><main class="mainInner"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></main></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"VjnnYofDY3M78o8fFsHkc","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" data-next-head=""/><title data-next-head="">404: This page could not be found</title><link rel="preload" href="/_next/static/css/3854c6b3c59c0c44.css" as="style"/><link rel="stylesheet" href="/_next/static/css/3854c6b3c59c0c44.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-4224e970a97a4a86.js" defer=""></script><script src="/_next/static/chunks/framework-161be364fd69a7ce.js" defer=""></script><script src="/_next/static/chunks/main-91fb767ebd74c9c1.js" defer=""></script><script src="/_next/static/chunks/pages/_app-3e8b35112a00821a.js" defer=""></script><script src="/_next/static/chunks/pages/_error-282257fbdcc167b4.js" defer=""></script><script src="/_next/static/jmjW6n6sEDweVYIA6m2SL/_buildManifest.js" defer=""></script><script src="/_next/static/jmjW6n6sEDweVYIA6m2SL/_ssgManifest.js" defer=""></script></head><body><div id="__next"><script>((e,i,s,u,m,a,l,h)=>{let d=document.documentElement,w=["light","dark"];function p(n){(Array.isArray(e)?e:[e]).forEach(y=>{let k=y==="class",S=k&&a?m.map(f=>a[f]||f):m;k?(d.classList.remove(...S),d.classList.add(a&&a[n]?a[n]:n)):d.setAttribute(y,n)}),R(n)}function R(n){h&&w.includes(n)&&(d.style.colorScheme=n)}function c(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(u)p(u);else try{let n=localStorage.getItem(i)||s,y=l&&n==="system"?c():n;p(y)}catch(n){}})("class","theme","system",null,["light","dark"],null,true,true)</script><div class="css-1pi45l5 ant-app css-var-_R_16_"><aside class="sidebar"><a href="/overview"><div class="sidebarLogo"><div class="w-8 h-8 rounded-lg bg-black dark:bg-white flex items-center justify-center shrink-0"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-moon text-white dark:text-black"><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"></path></svg></div><div class="sidebarLogoTitle"><span class="logoGradient">Customize Agent</span></div></div></a><nav class="sidebarNav mt-2"><a href="/overview"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-layout-dashboard"><rect width="7" height="9" x="3" y="3" rx="1"></rect><rect width="7" height="5" x="14" y="3" rx="1"></rect><rect width="7" height="9" x="14" y="12" rx="1"></rect><rect width="7" height="5" x="3" y="16" rx="1"></rect></svg><span class="sidebarLabel">总览</span></div></a><div><div class="sidebarItem sidebarParent"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-database"><ellipse cx="12" cy="5" rx="9" ry="3"></ellipse><path d="M3 5V19A9 3 0 0 0 21 19V5"></path><path d="M3 12A9 3 0 0 0 21 12"></path></svg><span class="sidebarLabel">知识库</span><span class="sidebarChevron"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right"><path d="m9 18 6-6-6-6"></path></svg></span></div></div><a href="/models"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-cpu"><rect width="16" height="16" x="4" y="4" rx="2"></rect><rect width="6" height="6" x="9" y="9" rx="1"></rect><path d="M15 2v2"></path><path d="M15 20v2"></path><path d="M2 15h2"></path><path d="M2 9h2"></path><path d="M20 15h2"></path><path d="M20 9h2"></path><path d="M9 2v2"></path><path d="M9 20v2"></path></svg><span class="sidebarLabel">模型配置</span></div></a><a href="/prompt"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-square"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg><span class="sidebarLabel">提示词管理</span></div></a><a href="/document-roles"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-settings"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"></path><circle cx="12" cy="12" r="3"></circle></svg><span class="sidebarLabel">角色配置</span></div></a><a href="/documents"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-files"><path d="M20 7h-3a2 2 0 0 1-2-2V2"></path><path d="M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z"></path><path d="M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8"></path></svg><span class="sidebarLabel">工作流模版库</span></div></a><a href="/template-references"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-library-big"><rect width="8" height="18" x="3" y="3" rx="1"></rect><path d="M7 3v18"></path><path d="M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z"></path></svg><span class="sidebarLabel">模板参考</span></div></a><a href="/asset-library"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-folder-open"><path d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"></path></svg><span class="sidebarLabel">生成资源</span></div></a><a href="/system/logs"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-bug"><path d="m8 2 1.88 1.88"></path><path d="M14.12 3.88 16 2"></path><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"></path><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"></path><path d="M12 20v-9"></path><path d="M6.53 9C4.6 8.8 3 7.1 3 5"></path><path d="M6 13H2"></path><path d="M3 21c0-2.1 1.7-3.9 3.8-4"></path><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"></path><path d="M22 13h-4"></path><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"></path></svg><span class="sidebarLabel">系统日志</span></div></a><a href="/guide"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-open"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"></path><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"></path></svg><span class="sidebarLabel">指引</span></div></a><a href="/settings"><div class="sidebarItem"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-settings"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"></path><circle cx="12" cy="12" r="3"></circle></svg><span class="sidebarLabel">设置</span></div></a></nav><div class="sidebarCollapseWrapper"><button class="sidebarCollapseBtn" aria-label="收起侧边栏"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-panel-left-close"><rect width="18" height="18" x="3" y="3" rx="2"></rect><path d="M9 3v18"></path><path d="m16 15-3-3 3-3"></path></svg></button></div></aside><div class="mainContent"><header class="topbar"><div class="flex-1"></div><span class="ant-badge css-1pi45l5 css-var-_R_16_"><button type="button" class="ant-btn css-1pi45l5 css-var-_R_16_ ant-btn-default ant-btn-color-default ant-btn-variant-outlined topbarBtn"><span class="ant-btn-icon"><span role="img" aria-label="clock-circle" class="anticon anticon-clock-circle"><svg viewBox="64 64 896 896" focusable="false" data-icon="clock-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"></path><path d="M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"></path></svg></span></span><span>后台任务</span></button></span><button class="topbarBtn"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-moon"><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"></path></svg><span>深色</span></button><button class="topbarBtn"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-languages"><path d="m5 8 6 6"></path><path d="m4 14 6-6 2-3"></path><path d="M2 5h12"></path><path d="M7 2h1"></path><path d="m22 22-5-10-5 10"></path><path d="M14 18h6"></path></svg><span>English</span></button></header><main class="mainInner"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></main></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"jmjW6n6sEDweVYIA6m2SL","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>