@customize-agent/server 4.0.51 → 4.0.53
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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +32 -26
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/chunks/432.js +1 -1
- package/.next/server/chunks/6697.js +31 -31
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/api/health.js +1 -1
- package/.next/server/pages/asset-library.html +1 -1
- package/.next/server/pages/context/long-term.html +1 -1
- package/.next/server/pages/context/short-term.html +1 -1
- package/.next/server/pages/document-roles.html +1 -1
- package/.next/server/pages/documents.html +1 -1
- package/.next/server/pages/guide.html +1 -1
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/knowledge/file-detail.html +1 -1
- package/.next/server/pages/knowledge/files.html +1 -1
- package/.next/server/pages/knowledge/manage.html +1 -1
- package/.next/server/pages/knowledge/search.html +1 -1
- package/.next/server/pages/knowledge.html +1 -1
- package/.next/server/pages/models.html +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages/prompt.html +1 -1
- package/.next/server/pages/settings.html +1 -1
- package/.next/server/pages/system/logs.html +1 -1
- package/.next/server/pages-manifest.json +24 -24
- package/.next/static/7BxPmRQXi-2VWFugrlQk8/_buildManifest.js +1 -0
- package/.next/static/chunks/{150-134099bf526e9292.js → 102-881dcc464f983c89.js} +14 -14
- package/.next/static/chunks/{20-00147a779147a5a4.js → 20-86ac6910225cce4e.js} +3 -3
- package/.next/static/chunks/289-0031e62ca424247b.js +38 -0
- package/.next/static/chunks/{749-83476f9bcd014a5a.js → 317-18aac52df5551e76.js} +1 -1
- package/.next/static/chunks/375-4a1c73eb22d653d2.js +1 -0
- package/.next/static/chunks/499-d6bcc76195b28550.js +4 -0
- package/.next/static/chunks/{412-b9c854c6a76db67d.js → 940-7cb66111eee2f9fb.js} +1 -1
- package/.next/static/chunks/pages/{asset-library-e9ddfe1cbaac42d9.js → asset-library-8ba41e8bc4644f41.js} +1 -1
- package/.next/static/chunks/pages/context/{long-term-6b9a9683a4d6ea86.js → long-term-994425812e118c6c.js} +1 -1
- package/.next/static/chunks/pages/context/{short-term-6078efae6e3a905c.js → short-term-fcae99e1744d998a.js} +1 -1
- package/.next/static/chunks/pages/documents-d7ea38fc2e590069.js +1 -0
- package/.next/static/chunks/pages/{guide-cba4ca0b28bb9b64.js → guide-0a3cdfa79c037307.js} +1 -1
- package/.next/static/chunks/pages/knowledge/{file-detail-2e874c92d01b1c14.js → file-detail-87669392540614e4.js} +1 -1
- package/.next/static/chunks/pages/knowledge/{files-9d30d5f23d78f46b.js → files-14ef1012fd201e47.js} +1 -1
- package/.next/static/chunks/pages/system/{logs-3826fa44a76b12fc.js → logs-cbeeb77dc70086ae.js} +1 -1
- package/package.json +4 -4
- package/scripts/verify-next-static.js +9 -1
- package/.next/static/Ki0fhhnkp5kCGWyYdaCEa/_buildManifest.js +0 -1
- package/.next/static/chunks/289-30e7c55f49a896b7.js +0 -38
- package/.next/static/chunks/304-7bc5b1cd0b9315a1.js +0 -1
- package/.next/static/chunks/pages/documents-9967f1fdf3fb6d03.js +0 -1
- /package/.next/static/{Ki0fhhnkp5kCGWyYdaCEa → 7BxPmRQXi-2VWFugrlQk8}/_ssgManifest.js +0 -0
package/.next/BUILD_ID
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
7BxPmRQXi-2VWFugrlQk8
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"devFiles": [],
|
|
6
6
|
"ampDevFiles": [],
|
|
7
7
|
"lowPriorityFiles": [
|
|
8
|
-
"static/
|
|
9
|
-
"static/
|
|
8
|
+
"static/7BxPmRQXi-2VWFugrlQk8/_buildManifest.js",
|
|
9
|
+
"static/7BxPmRQXi-2VWFugrlQk8/_ssgManifest.js"
|
|
10
10
|
],
|
|
11
11
|
"rootMainFiles": [],
|
|
12
12
|
"rootMainFilesTree": {},
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"static/chunks/main-91fb767ebd74c9c1.js",
|
|
41
41
|
"static/chunks/433-233659be69169c19.js",
|
|
42
42
|
"static/chunks/787-c18af810af3433f6.js",
|
|
43
|
-
"static/chunks/
|
|
44
|
-
"static/chunks/
|
|
45
|
-
"static/chunks/pages/asset-library-
|
|
43
|
+
"static/chunks/102-881dcc464f983c89.js",
|
|
44
|
+
"static/chunks/317-18aac52df5551e76.js",
|
|
45
|
+
"static/chunks/pages/asset-library-8ba41e8bc4644f41.js"
|
|
46
46
|
],
|
|
47
47
|
"/context/long-term": [
|
|
48
48
|
"static/chunks/webpack-77d10b4726f13aa5.js",
|
|
@@ -53,11 +53,12 @@
|
|
|
53
53
|
"static/chunks/576-6699fed6c88502fe.js",
|
|
54
54
|
"static/chunks/195-2c0168eacab722d2.js",
|
|
55
55
|
"static/chunks/985-4b4a3ed36ada16eb.js",
|
|
56
|
-
"static/chunks/
|
|
57
|
-
"static/chunks/
|
|
56
|
+
"static/chunks/375-4a1c73eb22d653d2.js",
|
|
57
|
+
"static/chunks/102-881dcc464f983c89.js",
|
|
58
|
+
"static/chunks/289-0031e62ca424247b.js",
|
|
58
59
|
"static/chunks/455-97ad88d6604f54b7.js",
|
|
59
60
|
"static/chunks/932-2f195f4200ce9378.js",
|
|
60
|
-
"static/chunks/pages/context/long-term-
|
|
61
|
+
"static/chunks/pages/context/long-term-994425812e118c6c.js"
|
|
61
62
|
],
|
|
62
63
|
"/context/short-term": [
|
|
63
64
|
"static/chunks/webpack-77d10b4726f13aa5.js",
|
|
@@ -68,11 +69,12 @@
|
|
|
68
69
|
"static/chunks/576-6699fed6c88502fe.js",
|
|
69
70
|
"static/chunks/195-2c0168eacab722d2.js",
|
|
70
71
|
"static/chunks/985-4b4a3ed36ada16eb.js",
|
|
71
|
-
"static/chunks/
|
|
72
|
-
"static/chunks/
|
|
72
|
+
"static/chunks/375-4a1c73eb22d653d2.js",
|
|
73
|
+
"static/chunks/102-881dcc464f983c89.js",
|
|
74
|
+
"static/chunks/289-0031e62ca424247b.js",
|
|
73
75
|
"static/chunks/455-97ad88d6604f54b7.js",
|
|
74
76
|
"static/chunks/932-2f195f4200ce9378.js",
|
|
75
|
-
"static/chunks/pages/context/short-term-
|
|
77
|
+
"static/chunks/pages/context/short-term-fcae99e1744d998a.js"
|
|
76
78
|
],
|
|
77
79
|
"/document-roles": [
|
|
78
80
|
"static/chunks/webpack-77d10b4726f13aa5.js",
|
|
@@ -94,11 +96,12 @@
|
|
|
94
96
|
"static/chunks/787-c18af810af3433f6.js",
|
|
95
97
|
"static/chunks/576-6699fed6c88502fe.js",
|
|
96
98
|
"static/chunks/195-2c0168eacab722d2.js",
|
|
99
|
+
"static/chunks/375-4a1c73eb22d653d2.js",
|
|
97
100
|
"static/chunks/455-97ad88d6604f54b7.js",
|
|
98
101
|
"static/chunks/506-93f730bc149d0dce.js",
|
|
99
|
-
"static/chunks/
|
|
100
|
-
"static/chunks/
|
|
101
|
-
"static/chunks/pages/documents-
|
|
102
|
+
"static/chunks/940-7cb66111eee2f9fb.js",
|
|
103
|
+
"static/chunks/499-d6bcc76195b28550.js",
|
|
104
|
+
"static/chunks/pages/documents-d7ea38fc2e590069.js"
|
|
102
105
|
],
|
|
103
106
|
"/guide": [
|
|
104
107
|
"static/chunks/webpack-77d10b4726f13aa5.js",
|
|
@@ -106,9 +109,9 @@
|
|
|
106
109
|
"static/chunks/main-91fb767ebd74c9c1.js",
|
|
107
110
|
"static/chunks/433-233659be69169c19.js",
|
|
108
111
|
"static/chunks/787-c18af810af3433f6.js",
|
|
109
|
-
"static/chunks/
|
|
110
|
-
"static/chunks/20-
|
|
111
|
-
"static/chunks/pages/guide-
|
|
112
|
+
"static/chunks/940-7cb66111eee2f9fb.js",
|
|
113
|
+
"static/chunks/20-86ac6910225cce4e.js",
|
|
114
|
+
"static/chunks/pages/guide-0a3cdfa79c037307.js"
|
|
112
115
|
],
|
|
113
116
|
"/knowledge": [
|
|
114
117
|
"static/chunks/webpack-77d10b4726f13aa5.js",
|
|
@@ -124,12 +127,13 @@
|
|
|
124
127
|
"static/chunks/787-c18af810af3433f6.js",
|
|
125
128
|
"static/chunks/576-6699fed6c88502fe.js",
|
|
126
129
|
"static/chunks/985-4b4a3ed36ada16eb.js",
|
|
127
|
-
"static/chunks/
|
|
128
|
-
"static/chunks/
|
|
130
|
+
"static/chunks/375-4a1c73eb22d653d2.js",
|
|
131
|
+
"static/chunks/102-881dcc464f983c89.js",
|
|
132
|
+
"static/chunks/289-0031e62ca424247b.js",
|
|
129
133
|
"static/chunks/506-93f730bc149d0dce.js",
|
|
130
134
|
"static/chunks/861-91cbdd34b8e23151.js",
|
|
131
135
|
"static/css/09be1fdeab8595ab.css",
|
|
132
|
-
"static/chunks/pages/knowledge/file-detail-
|
|
136
|
+
"static/chunks/pages/knowledge/file-detail-87669392540614e4.js"
|
|
133
137
|
],
|
|
134
138
|
"/knowledge/files": [
|
|
135
139
|
"static/chunks/webpack-77d10b4726f13aa5.js",
|
|
@@ -139,10 +143,11 @@
|
|
|
139
143
|
"static/chunks/787-c18af810af3433f6.js",
|
|
140
144
|
"static/chunks/576-6699fed6c88502fe.js",
|
|
141
145
|
"static/chunks/985-4b4a3ed36ada16eb.js",
|
|
142
|
-
"static/chunks/
|
|
143
|
-
"static/chunks/
|
|
146
|
+
"static/chunks/375-4a1c73eb22d653d2.js",
|
|
147
|
+
"static/chunks/102-881dcc464f983c89.js",
|
|
148
|
+
"static/chunks/289-0031e62ca424247b.js",
|
|
144
149
|
"static/css/09be1fdeab8595ab.css",
|
|
145
|
-
"static/chunks/pages/knowledge/files-
|
|
150
|
+
"static/chunks/pages/knowledge/files-14ef1012fd201e47.js"
|
|
146
151
|
],
|
|
147
152
|
"/knowledge/manage": [
|
|
148
153
|
"static/chunks/webpack-77d10b4726f13aa5.js",
|
|
@@ -218,10 +223,11 @@
|
|
|
218
223
|
"static/chunks/576-6699fed6c88502fe.js",
|
|
219
224
|
"static/chunks/195-2c0168eacab722d2.js",
|
|
220
225
|
"static/chunks/985-4b4a3ed36ada16eb.js",
|
|
221
|
-
"static/chunks/
|
|
222
|
-
"static/chunks/
|
|
226
|
+
"static/chunks/375-4a1c73eb22d653d2.js",
|
|
227
|
+
"static/chunks/102-881dcc464f983c89.js",
|
|
228
|
+
"static/chunks/289-0031e62ca424247b.js",
|
|
223
229
|
"static/chunks/861-91cbdd34b8e23151.js",
|
|
224
|
-
"static/chunks/pages/system/logs-
|
|
230
|
+
"static/chunks/pages/system/logs-cbeeb77dc70086ae.js"
|
|
225
231
|
]
|
|
226
232
|
},
|
|
227
233
|
"ampFirstPages": []
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"routes": {},
|
|
4
4
|
"dynamicRoutes": {},
|
|
5
5
|
"preview": {
|
|
6
|
-
"previewModeId": "
|
|
7
|
-
"previewModeSigningKey": "
|
|
8
|
-
"previewModeEncryptionKey": "
|
|
6
|
+
"previewModeId": "667744026c1b1a359be59dd0c3f33819",
|
|
7
|
+
"previewModeSigningKey": "d50ef2c0424960de555e4c600a7211b9f02270a97221f02d13943111589128c0",
|
|
8
|
+
"previewModeEncryptionKey": "2b85a707d53d27e8d0959f84d114f551cbe4b9369b04da18f065166fb0d90a3d"
|
|
9
9
|
},
|
|
10
10
|
"notFoundRoutes": []
|
|
11
11
|
}
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
`,"utf8")}function k(a,b){let c=Date.now(),d=i(a),e=d.findIndex(a=>a.id===b.id),f=e>=0?d[e]:void 0,g={id:b.id,type:b.type,title:b.title,stage:b.stage??f?.stage??"uploading",status:b.status??f?.status??"processing",message:b.message??f?.message??"",percent:b.percent??f?.percent??0,fileName:b.fileName??f?.fileName,filePath:b.filePath??f?.filePath,chunkCount:b.chunkCount??f?.chunkCount,textLength:b.textLength??f?.textLength,extractionMode:b.extractionMode??f?.extractionMode,error:b.error??f?.error,createdAt:f?.createdAt??c,updatedAt:c};return e>=0?d[e]=g:d.push(g),j(a,d),g}function l(a,b=50){return i(a).sort((a,b)=>b.updatedAt-a.updatedAt).slice(0,b)}function m(a,b){return i(a).find(a=>a.id===b)}function n(a,b){return i(a).filter(a=>!b||a.type===b).sort((a,b)=>b.updatedAt-a.updatedAt)[0]}function o(a){return i(a).filter(a=>"processing"===a.status).sort((a,b)=>b.updatedAt-a.updatedAt)}function p(a){let b=i(a),c=h(a);return d.existsSync(c)&&d.unlinkSync(c),b.length}function q(a,b){let c=i(a),d=c.filter(a=>a.id!==b);return d.length!==c.length&&(j(a,d),!0)}},23328:(a,b,c)=>{c.d(b,{Qh:()=>l,VS:()=>p,Yy:()=>o,aY:()=>n});var d=c(19898),e=c(87550),f=c.n(e),g=c(33873),h=c(21820),i=c(29021);let j=null;function k(){return g.join(h.homedir(),".customize-agent")}function l(){return j||(j=new d.MultiProjectManager(k())),j}function m(a){let b=g.resolve(a),c=g.resolve(g.join(h.homedir(),".customize-agent"));return!(i.existsSync(g.join(b,"pnpm-workspace.yaml"))&&i.existsSync(g.join(b,"apps","server")))&&(b===c||b.includes(`${g.sep}.customize-agent${g.sep}`)||b.endsWith(`${g.sep}apps${g.sep}server`)||b.endsWith(`${g.sep}apps${g.sep}cli`))}function n(){let a=process.env.CUSTOMIZE_PROJECT_ROOT??process.env.INIT_CWD;if(a&&i.existsSync(a)&&!m(a))return g.resolve(a);let b=function(){let a=g.join(k(),"projects","registry.db");if(!i.existsSync(a))return[];let b=new(f())(a,{readonly:!0});try{return b.prepare("SELECT project_root FROM project_registry ORDER BY last_opened_at DESC").all().map(a=>g.resolve(a.project_root)).filter(a=>!m(a))}finally{b.close()}}();return b.length>0?b[0]:process.env.INIT_CWD&&!m(process.env.INIT_CWD)?process.env.INIT_CWD:g.resolve(process.cwd(),"../..")}function o(a,b={}){let c=new Map;for(let b of function(a){let b=g.join(h.homedir(),".customize-agent","projects",(0,d.computeProjectId)(g.resolve(a)),"kb.db");if(!i.existsSync(b))return[];let c=new d.IndexStateStore(b);try{return c.listRecords().map(a=>({...a,matchedBy:"metadata"}))}finally{c.close()}}(a))c.set(b.relativePath,b);for(let b of function(a){let b=g.join(a,"knowledgeBase");if(!i.existsSync(b))return[];let c=[],d=a=>{for(let e of i.readdirSync(a,{withFileTypes:!0})){let f=g.join(a,e.name);if(e.isDirectory()){d(f);continue}if(e.name.endsWith(".source.txt"))continue;let h=i.statSync(f),j=g.relative(b,f).split(g.sep).join("/");c.push({relativePath:j,category:j.includes("表格数据/")?"spreadsheet":j.includes("图片素材/")?"image":j.includes("图纸文件/")?"cad":j.includes("文档资料/")?"document":"other",format:g.extname(j).slice(1).toLowerCase()||"text",contentHash:"",fileSize:h.size,mtime:h.mtimeMs,chunkCount:0,collectionName:"",indexedAt:0,lastVerifiedAt:0,status:"disk",matchedBy:"disk"})}};return d(b),c}(a)){let a=c.get(b.relativePath);c.set(b.relativePath,a?{...a,fileSize:b.fileSize,mtime:b.mtime,matchedBy:"metadata"}:b)}return Array.from(c.values()).filter(a=>!b.category||a.category===b.category).sort((a,b)=>b.mtime-a.mtime||a.relativePath.localeCompare(b.relativePath,"zh-CN"))}async function p(a,b={}){let c=(b.query||"").trim(),d=Math.max(1,Math.min(500,b.limit??50)),e=new Map,f=o(a,{category:b.category});for(let a of f)(!c||`${a.relativePath}
|
|
3
3
|
${a.category}
|
|
4
4
|
${a.format}
|
|
5
|
-
${a.status}`.toLowerCase().includes(c.toLowerCase()))&&e.set(a.relativePath,{...a,matchedBy:c?"path":a.matchedBy});if(c&&!1!==b.includeContent)try{for(let b of(await l().search(a,c,{limit:Math.max(20,d)})).results){let a=b.filePath,c=e.get(a)||f.find(b=>b.relativePath===a);e.set(a,{...c||{relativePath:a,category:"content",format:"knowledge",fileSize:0,mtime:0,chunkCount:0,indexedAt:0,lastVerifiedAt:0,status:"active"},matchedBy:"content",score:b.score})}}catch{}let g=Array.from(e.values()).sort((a,b)=>{let c=a=>"content"===a.matchedBy?3:"path"===a.matchedBy?2:+("metadata"===a.matchedBy);return c(b)-c(a)||(b.score??0)-(a.score??0)||b.mtime-a.mtime||a.relativePath.localeCompare(b.relativePath,"zh-CN")});return{files:g.slice(0,d),total:g.length}}},70432:(a,b,c)=>{c.d(b,{DA:()=>
|
|
5
|
+
${a.status}`.toLowerCase().includes(c.toLowerCase()))&&e.set(a.relativePath,{...a,matchedBy:c?"path":a.matchedBy});if(c&&!1!==b.includeContent)try{for(let b of(await l().search(a,c,{limit:Math.max(20,d)})).results){let a=b.filePath,c=e.get(a)||f.find(b=>b.relativePath===a);e.set(a,{...c||{relativePath:a,category:"content",format:"knowledge",fileSize:0,mtime:0,chunkCount:0,indexedAt:0,lastVerifiedAt:0,status:"active"},matchedBy:"content",score:b.score})}}catch{}let g=Array.from(e.values()).sort((a,b)=>{let c=a=>"content"===a.matchedBy?3:"path"===a.matchedBy?2:+("metadata"===a.matchedBy);return c(b)-c(a)||(b.score??0)-(a.score??0)||b.mtime-a.mtime||a.relativePath.localeCompare(b.relativePath,"zh-CN")});return{files:g.slice(0,d),total:g.length}}},70432:(a,b,c)=>{c.d(b,{DA:()=>l,ls:()=>m});var d=c(79646),e=c(33873),f=c.n(e),g=c(23328),h=c(6708);let i=new Map;function j(a){return String(a).split(/\r?\n/u).map(a=>a.trim()).filter(a=>a&&!/^Image too small to scale!!/u.test(a)&&"Line cannot be recognized!!"!==a).join("\n")}async function k(a,b,c,d){let e;try{e=await (0,g.Qh)().getProject(a.projectRoot);let f=e=>{var f;return(0,h.Qf)(a.projectRoot,{id:b,type:c,title:d,stage:(f=e.stage,"parsing"===f||"chunking"===f||"vectorizing"===f||"done"===f||"error"===f?f:"indexing"===f?"chunking":"scanning"===f?"uploading":"vectorizing"),status:"error"===e.stage?"error":"processing",percent:e.percent,message:e.message,filePath:e.filePath||a.relativePath,chunkCount:e.chunkCount,error:e.vectorStatus?.error})},i=a.relativePath?await e.reindexFile(a.relativePath,{vectorMode:a.vectorMode,onProgress:f}):a.forceReindexAll?await e.forceReindexAll({vectorMode:a.vectorMode,onProgress:f}):await e.consumePendingIndexJobs({vectorMode:a.vectorMode,onProgress:f,waitForUploadId:a.uploadOperationId}),j=0;for(;!a.relativePath&&(e.countPendingIndexJobs()>0||a.uploadOperationId&&e.uploadSessionIsOpen(a.uploadOperationId)&&j<120);){if(0===e.countPendingIndexJobs()){j+=1,await new Promise(a=>setTimeout(a,1e3));continue}j=0;let b=await e.consumePendingIndexJobs({vectorMode:a.vectorMode,onProgress:f,waitForUploadId:a.uploadOperationId});i={newFiles:[...i.newFiles,...b.newFiles],modifiedFiles:[...i.modifiedFiles,...b.modifiedFiles],deletedFiles:[...i.deletedFiles,...b.deletedFiles],unchangedCount:i.unchangedCount+b.unchangedCount,mtimeOnlyCount:i.mtimeOnlyCount+b.mtimeOnlyCount,skippedFiles:[...i.skippedFiles,...b.skippedFiles],hasChanges:i.hasChanges||b.hasChanges,diffTimeMs:i.diffTimeMs+b.diffTimeMs}}let k=e.getVectorStatus();if("error"===k.status){let f=k.error||"HNSWLib 向量入库失败";return(0,h.Qf)(a.projectRoot,{id:b,type:c,title:d,stage:"error",status:"error",percent:100,message:f,error:f}),{success:!1,error:f,stats:{...e.getStats(),vectorStatus:k}}}return(0,h.Qf)(a.projectRoot,{id:b,type:c,title:d,stage:"done",status:"success",percent:100,message:a.relativePath?"单文件重新解析完成":"知识库后台索引完成",filePath:a.relativePath,fileName:a.relativePath?.split("/").pop()}),{success:!0,stats:{...e.getStats(),vectorStatus:k}}}catch(g){let f=g instanceof Error?g.stack||g.message:String(g);return e?.failPendingIndexJobs?.(f),(0,h.Qf)(a.projectRoot,{id:b,type:c,title:d,stage:"error",status:"error",percent:100,message:f,error:f}),{success:!1,error:f}}}function l(a){!function(a){let b=i.get(a.projectRoot);if(b)return b.promise;let c=a.uploadOperationId??a.id,e=a.uploadOperationId?"upload":"reindex",g=a.uploadOperationId?`上传 ${a.uploadTitle??"文件"}`:a.relativePath?`重新解析 ${a.relativePath}`:"知识库后台索引";(0,h.Qf)(a.projectRoot,{id:c,type:e,title:g,stage:"uploading",status:"processing",percent:5,message:"索引任务已进入后台队列",filePath:a.relativePath,fileName:a.relativePath?.split("/").pop()});let l=("1"===process.env.CUSTOMIZE_AGENT_DISABLE_KB_CHILD_PROCESS?k(a,c,e,g):function(a,b,c,e){let g=f().resolve(process.cwd(),"scripts/kb-index-worker.cjs");return new Promise(f=>{let i=(0,d.fork)(g,[JSON.stringify({...a,operationId:b})],{cwd:process.cwd(),stdio:["ignore","pipe","pipe","ipc"],env:process.env});i.stdout?.on("data",d=>{let f=j(d);f&&(0,h.Qf)(a.projectRoot,{id:b,type:c,title:e,stage:"parsing",status:"processing",percent:5,message:`后台索引输出:${f.slice(-1e3)}`})}),i.stderr?.on("data",d=>{let f=j(d);f&&(0,h.Qf)(a.projectRoot,{id:b,type:c,title:e,stage:"parsing",status:"processing",percent:5,message:`后台索引错误输出:${f.slice(-1e3)}`})}),i.on("error",d=>{let g=d instanceof Error?d.message:String(d);(0,h.Qf)(a.projectRoot,{id:b,type:c,title:e,stage:"error",status:"error",percent:100,message:g,error:g}),f({success:!1,error:g})}),i.on("exit",d=>{if(0===d)f({success:!0});else{let g=`知识库后台进程退出,退出码 ${d??"unknown"}`;(0,h.Qf)(a.projectRoot,{id:b,type:c,title:e,stage:"error",status:"error",percent:100,message:g,error:g}),f({success:!1,error:g})}})})}(a,c,e,g)).finally(()=>i.delete(a.projectRoot));i.set(a.projectRoot,{operationId:c,promise:l,startedAt:Date.now()})}(a)}function m(a){let b=i.get(a);return b?{operationId:b.operationId,startedAt:b.startedAt}:void 0}}};
|