66$metadata = Get-Content $PSScriptRoot / tools/ metadata.json | ConvertFrom-Json
77$dotnetSDKVersion = $ (Get-Content $PSScriptRoot / global.json | ConvertFrom-Json ).Sdk.Version
88$dotnetLocalDir = if ($IsWindows ) { " $env: LocalAppData \Microsoft\dotnet" } else { " $env: HOME /.dotnet" }
9+ $windowsOnlyAgents = @ (' phisilica' )
910
1011function Start-Build
1112{
@@ -20,7 +21,7 @@ function Start-Build
2021 [string ] $Runtime = [NullString ]::Value,
2122
2223 [Parameter ()]
23- [ValidateSet (' openai-gpt' , ' msaz' , ' interpreter' , ' ollama' )]
24+ [ValidateSet (' openai-gpt' , ' msaz' , ' interpreter' , ' ollama' , ' phisilica ' )]
2425 [string []] $AgentToInclude ,
2526
2627 [Parameter ()]
@@ -43,13 +44,18 @@ function Start-Build
4344 $MyInvocation.MyCommand.Parameters [" AgentToInclude" ].Attributes |
4445 Where-Object { $_ -is [ValidateSet ] } |
4546 Select-Object - First 1 |
46- ForEach-Object ValidValues
47+ ForEach-Object ValidValues |
48+ Skip-Unapplicable
4749 } else {
4850 $agents.Split (" ," , [System.StringSplitOptions ]::TrimEntries)
4951 Write-Verbose " Include agents specified in Metadata.json"
5052 }
5153 }
5254
55+ if (HasUnapplicableAgent $AgentToInclude ) {
56+ throw " The following specified agent(s) cannot be built on the current platform: $ ( $windowsOnlyAgents -join ' , ' ) ."
57+ }
58+
5359 $RID = $Runtime ?? (dotnet -- info |
5460 Select-String ' ^\s*RID:\s+(\w+-\w+)$' |
5561 Select-Object - First 1 |
@@ -69,6 +75,7 @@ function Start-Build
6975 $msaz_dir = Join-Path $agent_dir " Microsoft.Azure.Agent"
7076 $interpreter_agent_dir = Join-Path $agent_dir " AIShell.Interpreter.Agent"
7177 $ollama_agent_dir = Join-Path $agent_dir " AIShell.Ollama.Agent"
78+ $phisilica_agent_dir = Join-Path $agent_dir " AIShell.PhiSilica.Agent"
7279
7380 $config = $Configuration.ToLower ()
7481 $out_dir = Join-Path $PSScriptRoot " out"
@@ -79,6 +86,7 @@ function Start-Build
7986 $msaz_out_dir = Join-Path $app_out_dir " agents" " Microsoft.Azure.Agent"
8087 $interpreter_out_dir = Join-Path $app_out_dir " agents" " AIShell.Interpreter.Agent"
8188 $ollama_out_dir = Join-Path $app_out_dir " agents" " AIShell.Ollama.Agent"
89+ $phisilica_out_dir = Join-Path $app_out_dir " agents" " AIShell.PhiSilica.Agent"
8290
8391 if ($Clean ) {
8492 if (Test-Path $out_dir ) {
@@ -152,6 +160,12 @@ function Start-Build
152160 dotnet publish $ollama_csproj - c $Configuration - o $ollama_out_dir
153161 }
154162
163+ if ($LASTEXITCODE -eq 0 -and $AgentToInclude -contains ' phisilica' ) {
164+ Write-Host " `n [Build the PhiSilica agent ...]`n " - ForegroundColor Green
165+ $phisilica_csproj = GetProjectFile $phisilica_agent_dir
166+ dotnet publish $phisilica_csproj - c $Configuration - o $phisilica_out_dir
167+ }
168+
155169 if ($LASTEXITCODE -eq 0 -and -not $NotIncludeModule ) {
156170 Write-Host " `n [Build the AIShell module ...]`n " - ForegroundColor Green
157171 $aish_module_csproj = GetProjectFile $module_dir
@@ -175,6 +189,26 @@ function Start-Build
175189 }
176190}
177191
192+ filter Skip-Unapplicable {
193+ if ($IsWindows -or $windowsOnlyAgents -notcontains $_ ) {
194+ $_
195+ }
196+ }
197+
198+ function HasUnapplicableAgent ($specifiedAgents ) {
199+ if ($IsWindows ) {
200+ return $false
201+ }
202+
203+ foreach ($agent in $windowsOnlyAgents ) {
204+ if ($specifiedAgents -contains $agent ) {
205+ return $true
206+ }
207+ }
208+
209+ return $false
210+ }
211+
178212function GetProjectFile ($dir )
179213{
180214 return Get-Item " $dir /*.csproj" | ForEach-Object FullName
0 commit comments