|
|
@@ -119,7 +119,7 @@ it('persists the separate host option, checks the Runner grant and refuses chang
|
|
|
const path=`/api/app/agents/${agent.id}/computer-selection`
|
|
|
const response=await request(app.callback()).put(path).send({computer:'vm',allowHostEnvironment:true}).expect(200)
|
|
|
expect(response.body.agent).toMatchObject({computer:'vm',execution:'computer',allowHostEnvironment:true})
|
|
|
- expect(target).toHaveBeenCalledWith('owner','local',expect.objectContaining({agentId:agent.id,hostAccess:true}))
|
|
|
+ const granted=target.mock.calls.at(-1)?.[2];expect(granted).toMatchObject({agentId:agent.id});expect(granted).not.toHaveProperty('hostAccess')
|
|
|
await request(app.callback()).put(path).set('x-user','other').send({computer:'vm',allowHostEnvironment:true}).expect(404)
|
|
|
store.put('owner','turn','active-hybrid',{agentId:agent.id,status:'running'})
|
|
|
await request(app.callback()).put(path).send({computer:'vm',allowHostEnvironment:false}).expect(409)
|
|
|
@@ -135,7 +135,9 @@ it('persists the separate Profile execution mode, checks its Runner capability a
|
|
|
const path=`/api/app/agents/${agent.id}/computer-selection`
|
|
|
const changed=await request(app.callback()).put(path).send({computer:'vm',vmExecution:'profile'}).expect(200)
|
|
|
expect(changed.body.agent).toMatchObject({computer:'vm',execution:'computer',vmExecution:'profile',allowHostEnvironment:true})
|
|
|
- expect(target).toHaveBeenCalledWith('owner','local',expect.objectContaining({profileSession:true,hostAccess:true}))
|
|
|
+ const opened=target.mock.calls.at(-1)?.[2]
|
|
|
+ expect(opened).not.toHaveProperty('profileSession')
|
|
|
+ expect(opened).not.toHaveProperty('hostAccess')
|
|
|
store.put('owner','turn','active-profile',{agentId:agent.id,status:'running'})
|
|
|
await request(app.callback()).put(path).send({computer:'vm',vmExecution:'worker'}).expect(409)
|
|
|
expect(()=>store.updateAgent('owner',agent.id,{vmExecution:'worker'})).toThrow('先停止当前任务')
|
|
|
@@ -173,8 +175,8 @@ it('allows the host option for cloud and VM only and clears it when selecting an
|
|
|
expect(returned.body.agent.allowHostEnvironment).toBe(false)
|
|
|
}
|
|
|
await request(app.callback()).put(path).send({computer:'hybrid'}).expect(400)
|
|
|
- expect(grokComputerRules(true)).toContain('基础 Profile 已授权的本机文件和终端工具')
|
|
|
- expect(grokComputerRules(false)).toContain('本轮不要使用本机终端')
|
|
|
+ expect(grokComputerRules(true)).toContain('cloud_computer_*')
|
|
|
+ expect(grokComputerRules(false)).not.toContain('允许本机环境')
|
|
|
})
|
|
|
it('clears inapplicable host grants through generic updates and migrates the previous combined choice once',()=>{
|
|
|
const agent=store.createAgent('owner',{name:'权限迁移',profile:'default',computer:'vm',execution:'computer',allowHostEnvironment:true})
|