diff --git a/shell/AIShell.Integration/AIShell.psd1 b/shell/AIShell.Integration/AIShell.psd1 index 3d40b6d6..7b7542e1 100644 --- a/shell/AIShell.Integration/AIShell.psd1 +++ b/shell/AIShell.Integration/AIShell.psd1 @@ -1,7 +1,7 @@ @{ RootModule = 'AIShell.psm1' NestedModules = @("AIShell.Integration.dll") - ModuleVersion = '1.0.5' + ModuleVersion = '1.0.6' GUID = 'ECB8BEE0-59B9-4DAE-9D7B-A990B480279A' Author = 'Microsoft Corporation' CompanyName = 'Microsoft Corporation' @@ -14,5 +14,5 @@ VariablesToExport = '*' AliasesToExport = @('aish', 'askai', 'fixit', 'airun') HelpInfoURI = 'https://aka.ms/aishell-help' - PrivateData = @{ PSData = @{ Prerelease = 'preview5'; ProjectUri = 'https://github.com/PowerShell/AIShell' } } + PrivateData = @{ PSData = @{ Prerelease = 'preview6'; ProjectUri = 'https://github.com/PowerShell/AIShell' } } } diff --git a/shell/AIShell.Integration/AIShell.psm1 b/shell/AIShell.Integration/AIShell.psm1 index 42910723..51805634 100644 --- a/shell/AIShell.Integration/AIShell.psm1 +++ b/shell/AIShell.Integration/AIShell.psm1 @@ -3,8 +3,8 @@ if ($IsMacOS -and $env:TERM_PROGRAM -ne "iTerm.app") { } $module = Get-Module -Name PSReadLine -if ($null -eq $module -or $module.Version -lt [version]"2.4.2") { - throw "The PSReadLine v2.4.2-beta2 or higher is required for the AIShell module to work properly." +if ($null -eq $module -or $module.Version -lt [version]"2.4.3") { + throw "The PSReadLine v2.4.3-beta3 or higher is required for the AIShell module to work properly." } $runspace = $Host.Runspace diff --git a/shell/AIShell.Kernel/MCP/BuiltInTool.cs b/shell/AIShell.Kernel/MCP/BuiltInTool.cs index 49580da7..2c71487f 100644 --- a/shell/AIShell.Kernel/MCP/BuiltInTool.cs +++ b/shell/AIShell.Kernel/MCP/BuiltInTool.cs @@ -447,10 +447,15 @@ internal static Dictionary GetBuiltInTools(Shell shell) { ArgumentNullException.ThrowIfNull(shell); - int toolCount = (int)ToolType.NumberOfBuiltInTools; Debug.Assert(s_toolDescription.Length == (int)ToolType.NumberOfBuiltInTools, "Number of tool descriptions doesn't match the number of tools."); Debug.Assert(s_toolSchema.Length == (int)ToolType.NumberOfBuiltInTools, "Number of tool schemas doesn't match the number of tools."); + // TODO: 'run_command_in_terminal' and 'get_command_output' don't work on macOS yet. + // On macOS, we need to use the iTerm2's python API to send the 'Enter' key to accept the command. + int toolCount = OperatingSystem.IsWindows() + ? (int)ToolType.NumberOfBuiltInTools + : (int)ToolType.run_command_in_terminal; + if (shell.Channel is null || !shell.Channel.Connected) { return null; diff --git a/shell/shell.common.props b/shell/shell.common.props index f09f25b0..823ef2ea 100644 --- a/shell/shell.common.props +++ b/shell/shell.common.props @@ -8,7 +8,7 @@ net8.0 enable 12.0 - 1.0.0-preview.5 + 1.0.0-preview.6 true true diff --git a/tools/scripts/install-aishell.ps1 b/tools/scripts/install-aishell.ps1 index 4a24a57c..2375afc4 100644 --- a/tools/scripts/install-aishell.ps1 +++ b/tools/scripts/install-aishell.ps1 @@ -20,7 +20,10 @@ $Script:InstallLocation = $null $Script:PackageURL = $null $Script:ModuleVersion = $null $Script:NewPSRLInstalled = $false -$Script:PSRLDependencyMap = @{ '1.0.4-preview4' = '2.4.2-beta2' } +$Script:PSRLDependencyMap = @{ + '1.0.4-preview4' = '2.4.2-beta2' + '1.0.6-preview6' = '2.4.3-beta3' +} function Resolve-Environment { if ($PSVersionTable.PSVersion -lt [version]"7.4.6") { @@ -211,7 +214,8 @@ function Install-AIShellModule { Write-Host "Installing the PowerShell module 'AIShell' $modVersion ..." Install-PSResource -Name AIShell -Repository PSGallery -Prerelease -TrustRepository -Version $modVersion -ErrorAction Stop -WarningAction SilentlyContinue - $psrldep = $Script:PSRLDependencyMap[$modVersion] + $psrldep = GetPSRLDependency -modVersion $modVersion + if ($psrldep) { $psrlModule = Get-Module -Name PSReadLine $psrlVer = $psrldep.Contains('-') ? $psrldep.Split('-')[0] : $psrldep @@ -228,6 +232,23 @@ function Install-AIShellModule { } } +function GetPSRLDependency { + param([string] $modVersion) + + $keys = $Script:PSRLDependencyMap.Keys + $curVer = [version]($modVersion.Contains('-') ? $modVersion.Split('-')[0] : $modVersion) + + $psrldep = $null + foreach ($key in $keys) { + $ver = $key.Contains('-') ? $key.Split('-')[0] : $key + if ($curVer -ge [version]$ver) { + $psrldep = $Script:PSRLDependencyMap[$key] + } + } + + return $psrldep +} + function Uninstall-AIShellModule { if (Get-InstalledPSResource -Name "AIShell" -ErrorAction SilentlyContinue) { try {