Skip to content

Commit 5f9d0b8

Browse files
authored
Merge the 1.0.0-preview.6 release branch back to main (#399)
- Increment the versions for AIShell application and the AIShell module. - Update the check in AIShell module to look for PSReadLine v2.4.3-beta3 and above. - Hide the `run_command_in_terminal` tool in macOS. - Update the installation script to find the right PSReadLine dependency for a particular version of AIShell module.
2 parents 1acd0e0 + ed59699 commit 5f9d0b8

File tree

5 files changed

+34
-8
lines changed

5 files changed

+34
-8
lines changed

shell/AIShell.Integration/AIShell.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@{
22
RootModule = 'AIShell.psm1'
33
NestedModules = @("AIShell.Integration.dll")
4-
ModuleVersion = '1.0.5'
4+
ModuleVersion = '1.0.6'
55
GUID = 'ECB8BEE0-59B9-4DAE-9D7B-A990B480279A'
66
Author = 'Microsoft Corporation'
77
CompanyName = 'Microsoft Corporation'
@@ -14,5 +14,5 @@
1414
VariablesToExport = '*'
1515
AliasesToExport = @('aish', 'askai', 'fixit', 'airun')
1616
HelpInfoURI = 'https://aka.ms/aishell-help'
17-
PrivateData = @{ PSData = @{ Prerelease = 'preview5'; ProjectUri = 'https://github.com/PowerShell/AIShell' } }
17+
PrivateData = @{ PSData = @{ Prerelease = 'preview6'; ProjectUri = 'https://github.com/PowerShell/AIShell' } }
1818
}

shell/AIShell.Integration/AIShell.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ if ($IsMacOS -and $env:TERM_PROGRAM -ne "iTerm.app") {
33
}
44

55
$module = Get-Module -Name PSReadLine
6-
if ($null -eq $module -or $module.Version -lt [version]"2.4.2") {
7-
throw "The PSReadLine v2.4.2-beta2 or higher is required for the AIShell module to work properly."
6+
if ($null -eq $module -or $module.Version -lt [version]"2.4.3") {
7+
throw "The PSReadLine v2.4.3-beta3 or higher is required for the AIShell module to work properly."
88
}
99

1010
$runspace = $Host.Runspace

shell/AIShell.Kernel/MCP/BuiltInTool.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,10 +447,15 @@ internal static Dictionary<string, BuiltInTool> GetBuiltInTools(Shell shell)
447447
{
448448
ArgumentNullException.ThrowIfNull(shell);
449449

450-
int toolCount = (int)ToolType.NumberOfBuiltInTools;
451450
Debug.Assert(s_toolDescription.Length == (int)ToolType.NumberOfBuiltInTools, "Number of tool descriptions doesn't match the number of tools.");
452451
Debug.Assert(s_toolSchema.Length == (int)ToolType.NumberOfBuiltInTools, "Number of tool schemas doesn't match the number of tools.");
453452

453+
// TODO: 'run_command_in_terminal' and 'get_command_output' don't work on macOS yet.
454+
// On macOS, we need to use the iTerm2's python API to send the 'Enter' key to accept the command.
455+
int toolCount = OperatingSystem.IsWindows()
456+
? (int)ToolType.NumberOfBuiltInTools
457+
: (int)ToolType.run_command_in_terminal;
458+
454459
if (shell.Channel is null || !shell.Channel.Connected)
455460
{
456461
return null;

shell/shell.common.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<TargetFramework>net8.0</TargetFramework>
99
<ImplicitUsings>enable</ImplicitUsings>
1010
<LangVersion>12.0</LangVersion>
11-
<Version>1.0.0-preview.5</Version>
11+
<Version>1.0.0-preview.6</Version>
1212

1313
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1414
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

tools/scripts/install-aishell.ps1

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ $Script:InstallLocation = $null
2020
$Script:PackageURL = $null
2121
$Script:ModuleVersion = $null
2222
$Script:NewPSRLInstalled = $false
23-
$Script:PSRLDependencyMap = @{ '1.0.4-preview4' = '2.4.2-beta2' }
23+
$Script:PSRLDependencyMap = @{
24+
'1.0.4-preview4' = '2.4.2-beta2'
25+
'1.0.6-preview6' = '2.4.3-beta3'
26+
}
2427

2528
function Resolve-Environment {
2629
if ($PSVersionTable.PSVersion -lt [version]"7.4.6") {
@@ -211,7 +214,8 @@ function Install-AIShellModule {
211214
Write-Host "Installing the PowerShell module 'AIShell' $modVersion ..."
212215
Install-PSResource -Name AIShell -Repository PSGallery -Prerelease -TrustRepository -Version $modVersion -ErrorAction Stop -WarningAction SilentlyContinue
213216

214-
$psrldep = $Script:PSRLDependencyMap[$modVersion]
217+
$psrldep = GetPSRLDependency -modVersion $modVersion
218+
215219
if ($psrldep) {
216220
$psrlModule = Get-Module -Name PSReadLine
217221
$psrlVer = $psrldep.Contains('-') ? $psrldep.Split('-')[0] : $psrldep
@@ -228,6 +232,23 @@ function Install-AIShellModule {
228232
}
229233
}
230234

235+
function GetPSRLDependency {
236+
param([string] $modVersion)
237+
238+
$keys = $Script:PSRLDependencyMap.Keys
239+
$curVer = [version]($modVersion.Contains('-') ? $modVersion.Split('-')[0] : $modVersion)
240+
241+
$psrldep = $null
242+
foreach ($key in $keys) {
243+
$ver = $key.Contains('-') ? $key.Split('-')[0] : $key
244+
if ($curVer -ge [version]$ver) {
245+
$psrldep = $Script:PSRLDependencyMap[$key]
246+
}
247+
}
248+
249+
return $psrldep
250+
}
251+
231252
function Uninstall-AIShellModule {
232253
if (Get-InstalledPSResource -Name "AIShell" -ErrorAction SilentlyContinue) {
233254
try {

0 commit comments

Comments
 (0)