feat: integrate DSH with audited isolated Git repairs

This commit is contained in:
abaishu0730 committed 2026-10-27 10:53:47 +08:00
1 parent 7104b6745c
commit e2b3e66a5b
29 files changed
+381 -50

No files matched your search

+5 -4
View File
@@ -17,7 +17,8 @@ const {BpmAccessClient}=require('../modules/bpm/access-client.cjs');
const {BpmArrivalMonitor}=require('../modules/bpm/arrival-monitor.cjs');
const { AssistantStore } = require('../modules/assistant/store.cjs');
const { AssistantService } = require('../modules/assistant/service.cjs');
const { ZcodeRuntime } = require('../modules/assistant/zcode-runtime.cjs');
const { DshRuntime } = require('../modules/assistant/dsh-runtime.cjs');
const { OperationJournal } = require('../modules/assistant/operation-journal.cjs');
const { RuntimeHealth } = require('../modules/health/runtime-health.cjs');
const { StorageStore } = require('../modules/storage/store.cjs');
const { StorageService } = require('../modules/storage/service.cjs');
@@ -64,7 +65,7 @@ async function main(options = {}) {
if(errors.length)throw new AggregateError(errors,'关闭服务时部分资源清理失败。');
})();
let server,dashboard,store,workspace,bpmSessions,custodian;
let mailStore,mail,scanStore,scanner,storageStore,storage,notificationStore,notifications,orderRules,orderDispatcher,orderExecution,orderProvider,orderArchive,assistantStore,assistant,health,bpmMonitor;
let mailStore,mail,scanStore,scanner,storageStore,storage,notificationStore,notifications,orderRules,orderDispatcher,orderExecution,orderProvider,orderArchive,assistantStore,assistantJournal,assistant,health,bpmMonitor;
try {
const tokenPath = path.join(stateDir,'pairing.key');
let token;
@@ -84,7 +85,7 @@ async function main(options = {}) {
cleanup.push(()=>closeServer(server));
cleanup.push(()=>bpmMonitor?.stop(),()=>health?.close(),()=>assistant?.stop(),()=>orderDispatcher?.stop(),()=>orderExecution?.stop(),()=>storage?.stop(),()=>scanner?.stop(),()=>mail?.stop(),()=>custodian?.stop(),()=>bpmSessions?.shutdown());
cleanup.push(()=>closeServer(dashboard),()=>workspace.close());
cleanup.push(()=>mailStore?.close(),()=>scanStore?.close(),()=>storageStore?.close(),()=>notificationStore?.close(),()=>orderRules?.close(),()=>assistantStore?.close());
cleanup.push(()=>mailStore?.close(),()=>scanStore?.close(),()=>storageStore?.close(),()=>notificationStore?.close(),()=>orderRules?.close(),()=>assistantStore?.close(),()=>assistantJournal?.close());
bpmSessions=new BpmSessionManager({stateDir:path.join(stateDir,'bpm-sessions'),accessClient:new BpmAccessClient()});
custodian=new BpmCustodian({workspace,manager:bpmSessions});
mailStore=new MailStore(path.join(stateDir,'mail'));mail=new MailService({store:mailStore});
@@ -98,7 +99,7 @@ async function main(options = {}) {
orderDispatcher=new OrderRuleDispatcher({store:orderRules,mail,settings:()=>store.settings(),calendar:()=>workspace.meta('calendar').overrides,providersReady:()=>{const cap=orderExecution.snapshot().capabilities;return ['liveTodo','pdfExport','automaticArchive'].every(key=>cap?.[key]===true);},templateResolver:(categoryId,rule,mode='normal')=>require('../modules/mail/rule-template.cjs').ruleTemplate(mailStore,categoryId,rule,mode),attachmentReader:file=>orderArchive.read(file)});
orderRules.deliveryBlockers=allowed=>scanStore.deliveries.pendingSources().filter(allowed);
bpmMonitor=new BpmArrivalMonitor({workspace,manager:bpmSessions,scanner,provider:orderProvider,settings:()=>store.settings(),onTodoReconciled:payload=>orderExecution.notifyDiscovery(payload)});
assistantStore=new AssistantStore(path.join(stateDir,'assistant'));assistantStore.recover();assistant=new AssistantService({store:assistantStore,runtime:new ZcodeRuntime({stateDir:path.join(stateDir,'assistant','runtime')}),dashboard:store,workspace,scanner,storage,orderRules,orderExecution});
assistantStore=new AssistantStore(path.join(stateDir,'assistant'));assistantStore.recover();assistantJournal=new OperationJournal({file:path.join(stateDir,'assistant','operations.sqlite')});assistantJournal.recoverRunning();assistant=new AssistantService({store:assistantStore,journal:assistantJournal,runtime:new DshRuntime({stateDir:path.join(stateDir,'assistant','runtime')}),dashboard:store,workspace,scanner,storage,orderRules,orderExecution});
health=new RuntimeHealth({stateDir,startedAt,instanceId:watchdog.instanceId,workspace,scanner,storage,mail,execution:orderExecution,monitor:bpmMonitor,bpmSessions});
await bpmSessions.migrateAccounts(workspace.snapshot().connections);
workspace.markSessionChecksPending();
+1
View File
@@ -45,6 +45,7 @@ function createAssets(){
'/order-notifications.js':{path:path.join(webRoot,'modules/order-notifications/view.js'),type:'text/javascript'},
'/order-rules.js':{path:path.join(webRoot,'modules/order-rules/view.js'),type:'text/javascript'},
'/notifications.js':{path:path.join(webRoot,'modules/notifications/view.js'),type:'text/javascript'},
'/assistant-operations.js':{path:path.join(webRoot,'modules/assistant/operations.js'),type:'text/javascript'},
'/assistant.js':{path:path.join(webRoot,'modules/assistant/view.js'),type:'text/javascript'},
'/health.js':{path:path.join(webRoot,'modules/health/view.js'),type:'text/javascript'},
'/app.css':{path:path.join(webRoot,'app.css'),type:'text/css'},