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 -5
View File
@@ -70,9 +70,9 @@ test('a cancellation signal alone cannot label an unconfirmed runtime failure as
await new Promise(resolve=>setImmediate(resolve));service.cancel(c.id,admin);await service.running.get(turn.id).task;
assert.equal(store.conversation(c.id,admin.user.id).turns[0].status,'error');
});
test('only a matching installed runtime is discovered, without enabling the model',async t=>{
const {AssistantStore}=require('../../src/modules/assistant/store.cjs'),crypto=require('node:crypto'),root=await fs.mkdtemp(path.join(os.tmpdir(),'order-zcode-discovery-')),dir=path.join(root,'assistant'),install=path.join(root,'zcode-runtime'),runtimePath=path.join(install,'3.14.3/package/resources/glm/zcode.cjs');t.after(()=>fs.rm(root,{recursive:true,force:true}));
await fs.mkdir(path.dirname(runtimePath),{recursive:true});await fs.writeFile(runtimePath,'fixture');await fs.writeFile(path.join(install,'manifest.json'),JSON.stringify({releaseVersion:'3.14.3',cliVersion:'0.16.9',runtimePath,runtimeSha256:'sha256:'+crypto.createHash('sha256').update('fixture').digest('hex')}));
const store=new AssistantStore(dir);assert.equal(store.settings().runtimePath,runtimePath);assert.equal(store.settings().enabled,false);assert.equal(store.settings().hasApiKey,false);store.close();
await fs.writeFile(runtimePath,'modified');const changed=new AssistantStore(dir);try{assert.equal(changed.settings().runtimePath,'');}finally{changed.close();}
test('only a pinned DSH runtime is discovered without enabling a model',async t=>{
const {AssistantStore}=require('../../src/modules/assistant/store.cjs');
const root=await fs.mkdtemp(path.join(os.tmpdir(),'order-dsh-discovery-')),old=process.env.LOCALAPPDATA;process.env.LOCALAPPDATA=root;t.after(async()=>{if(old===undefined)delete process.env.LOCALAPPDATA;else process.env.LOCALAPPDATA=old;await fs.rm(root,{recursive:true,force:true});});
const base=path.join(root,'OrderNotificationAutomationRuntimes/dsh-0.2.1-rc.2/node_modules/@deepseek-ai/dsh'),runtimePath=path.join(base,'lib/bin.js');await fs.mkdir(path.dirname(runtimePath),{recursive:true});await fs.writeFile(runtimePath,'fixture');await fs.writeFile(path.join(base,'package.json'),JSON.stringify({name:'@deepseek-ai/dsh',version:'0.2.1-rc.2'}));
const store=new AssistantStore(path.join(root,'assistant'));assert.equal(store.settings().runtimePath,runtimePath);assert.equal(store.settings().enabled,false);assert.equal(store.settings().hasApiKey,false);store.close();await fs.writeFile(path.join(base,'package.json'),JSON.stringify({name:'@deepseek-ai/dsh',version:'unverified'}));const changed=new AssistantStore(path.join(root,'assistant'));try{assert.equal(changed.settings().runtimePath,'');}finally{changed.close();}
});