6
6
$metadata = Get-Content $PSScriptRoot / tools/ metadata.json | ConvertFrom-Json
7
7
$dotnetSDKVersion = $ (Get-Content $PSScriptRoot / global.json | ConvertFrom-Json ).Sdk.Version
8
8
$dotnetLocalDir = if ($IsWindows ) { " $env: LocalAppData \Microsoft\dotnet" } else { " $env: HOME /.dotnet" }
9
+ $windowsOnlyAgents = @ (' phisilica' )
9
10
10
11
function Start-Build
11
12
{
@@ -20,7 +21,7 @@ function Start-Build
20
21
[string ] $Runtime = [NullString ]::Value,
21
22
22
23
[Parameter ()]
23
- [ValidateSet (' openai-gpt' , ' msaz' , ' interpreter' , ' ollama' )]
24
+ [ValidateSet (' openai-gpt' , ' msaz' , ' interpreter' , ' ollama' , ' phisilica ' )]
24
25
[string []] $AgentToInclude ,
25
26
26
27
[Parameter ()]
@@ -43,13 +44,18 @@ function Start-Build
43
44
$MyInvocation.MyCommand.Parameters [" AgentToInclude" ].Attributes |
44
45
Where-Object { $_ -is [ValidateSet ] } |
45
46
Select-Object - First 1 |
46
- ForEach-Object ValidValues
47
+ ForEach-Object ValidValues |
48
+ Skip-Unapplicable
47
49
} else {
48
50
$agents.Split (" ," , [System.StringSplitOptions ]::TrimEntries)
49
51
Write-Verbose " Include agents specified in Metadata.json"
50
52
}
51
53
}
52
54
55
+ if (HasUnapplicableAgent $AgentToInclude ) {
56
+ throw " The following specified agent(s) cannot be built on the current platform: $ ( $windowsOnlyAgents -join ' , ' ) ."
57
+ }
58
+
53
59
$RID = $Runtime ?? (dotnet -- info |
54
60
Select-String ' ^\s*RID:\s+(\w+-\w+)$' |
55
61
Select-Object - First 1 |
@@ -69,6 +75,7 @@ function Start-Build
69
75
$msaz_dir = Join-Path $agent_dir " Microsoft.Azure.Agent"
70
76
$interpreter_agent_dir = Join-Path $agent_dir " AIShell.Interpreter.Agent"
71
77
$ollama_agent_dir = Join-Path $agent_dir " AIShell.Ollama.Agent"
78
+ $phisilica_agent_dir = Join-Path $agent_dir " AIShell.PhiSilica.Agent"
72
79
73
80
$config = $Configuration.ToLower ()
74
81
$out_dir = Join-Path $PSScriptRoot " out"
@@ -79,6 +86,7 @@ function Start-Build
79
86
$msaz_out_dir = Join-Path $app_out_dir " agents" " Microsoft.Azure.Agent"
80
87
$interpreter_out_dir = Join-Path $app_out_dir " agents" " AIShell.Interpreter.Agent"
81
88
$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"
82
90
83
91
if ($Clean ) {
84
92
if (Test-Path $out_dir ) {
@@ -152,6 +160,12 @@ function Start-Build
152
160
dotnet publish $ollama_csproj - c $Configuration - o $ollama_out_dir
153
161
}
154
162
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
+
155
169
if ($LASTEXITCODE -eq 0 -and -not $NotIncludeModule ) {
156
170
Write-Host " `n [Build the AIShell module ...]`n " - ForegroundColor Green
157
171
$aish_module_csproj = GetProjectFile $module_dir
@@ -175,6 +189,26 @@ function Start-Build
175
189
}
176
190
}
177
191
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
+
178
212
function GetProjectFile ($dir )
179
213
{
180
214
return Get-Item " $dir /*.csproj" | ForEach-Object FullName
0 commit comments