diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 15f9f1465b52..5d540b9afd9f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,6 +67,21 @@ you can talk to goose! You can now make changes in the code in ui/desktop to iterate on the GUI half of goose. +### Regenerating the OpenAPI schema + +The file `ui/desktop/openapi.json` is automatically generated during the build. +It is written by the `generate_schema` binary in `crates/goose-server`. +If you need to update the spec without starting the UI, run: + +``` +just generate-openapi +``` + +This command regenerates `ui/desktop/openapi.json` and then runs the UI's +`generate-api` script to rebuild the TypeScript client from that spec. + +Changes to the API should be made in the Rust source under `crates/goose-server/src/`. + ## Creating a fork To fork the repository: diff --git a/Justfile b/Justfile index 9641cf285d54..6b3543c4aab7 100644 --- a/Justfile +++ b/Justfile @@ -177,6 +177,13 @@ run-server: @echo "Running server..." cargo run -p goose-server +# Generate OpenAPI specification without starting the UI +generate-openapi: + @echo "Generating OpenAPI schema..." + cargo run -p goose-server --bin generate_schema + @echo "Generating frontend API..." + cd ui/desktop && npm run generate-api + # make GUI with latest binary lint-ui: cd ui/desktop && npm run lint:check diff --git a/crates/goose-cli/src/session/mod.rs b/crates/goose-cli/src/session/mod.rs index 429ceaa94d80..c6ccb09fe3b4 100644 --- a/crates/goose-cli/src/session/mod.rs +++ b/crates/goose-cli/src/session/mod.rs @@ -627,6 +627,10 @@ impl Session { &Message::assistant().with_text("Chat context cleared."), self.debug, ); + if let Some(file) = self.session_file.as_ref().filter(|f| f.exists()) { + std::fs::remove_file(file)?; + std::fs::File::create(file)?; + } continue; } input::InputResult::PromptCommand(opts) => { diff --git a/documentation/docs/mcp/cloudflare-mcp.md b/documentation/docs/mcp/cloudflare-mcp.md new file mode 100644 index 000000000000..4950e4ac5664 --- /dev/null +++ b/documentation/docs/mcp/cloudflare-mcp.md @@ -0,0 +1,292 @@ +--- +title: Cloudflare MCP Server +description: Add Cloudflare MCP Servers as Goose Extensions +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +This tutorial covers how to add [Cloudflare's MCP Servers](https://github.com/cloudflare/mcp-server-cloudflare) as Goose extensions to manage your Cloudflare infrastructure, debug applications, analyze traffic, and more using natural language. + +Cloudflare provides multiple specialized MCP servers for different aspects of their platform, allowing you to interact with Workers, DNS, security features, analytics, and development tools. + +:::tip TLDR + + + + [Launch the installer](goose://extension?cmd=npx&arg=mcp-remote&arg=https%3A%2F%2Fobservability.mcp.cloudflare.com%2Fsse&id=cloudflare-observability&name=Cloudflare%20Observability&description=Debug%20and%20get%20insight%20into%20your%20application%27s%20logs%20and%20analytics&env=CLOUDFLARE_API_TOKEN%3DCloudflare%20API%20Token) + + + **Command** + ```sh + npx mcp-remote https://observability.mcp.cloudflare.com/sse + ``` + + + **Environment Variable** + ``` + CLOUDFLARE_API_TOKEN: Your Cloudflare API token with appropriate permissions + ``` +::: + +## Available Cloudflare MCP Servers + +Cloudflare provides multiple specialized MCP servers for different use cases: + +| Server | Description | Use Cases | +|--------|-------------|-----------| +| **Documentation** | Get up-to-date reference information on Cloudflare | API reference, feature documentation, troubleshooting guides | +| **Workers Bindings** | Build Workers applications with storage, AI, and compute primitives | KV storage, R2 buckets, AI models, Durable Objects | +| **Workers Builds** | Get insights and manage your Cloudflare Workers builds | Deployment status, build logs, version management | +| **Observability** | Debug and get insight into your application's logs and analytics | Error tracking, performance monitoring, request analysis | +| **Radar** | Global Internet traffic insights, trends, URL scans, and utilities | Traffic analysis, threat intelligence, URL scanning | +| **Container** | Spin up sandbox development environments | Isolated testing, development containers | +| **Browser Rendering** | Fetch web pages, convert to markdown, take screenshots | Web scraping, content analysis, visual testing | +| **Logpush** | Get quick summaries for Logpush job health | Log management, data pipeline monitoring | +| **AI Gateway** | Search logs, get details about prompts and responses | AI usage analytics, prompt optimization | +| **AutoRAG** | List and search documents on your AutoRAGs | Document retrieval, knowledge base management | +| **Audit Logs** | Query audit logs and generate reports for review | Security monitoring, compliance reporting | +| **DNS Analytics** | Optimize DNS performance and debug issues | DNS troubleshooting, performance optimization | +| **Digital Experience Monitoring** | Get insight on critical applications for your organization | Application performance, user experience monitoring | +| **Cloudflare One CASB** | Identify security misconfigurations for SaaS applications | Security posture, compliance checking | +| **GraphQL** | Get analytics data using Cloudflare's GraphQL API | Custom analytics, data visualization | + +## Prerequisites + +- A [Cloudflare account](https://dash.cloudflare.com/sign-up) +- [Cloudflare API Token](https://dash.cloudflare.com/profile/api-tokens) with appropriate permissions +- Node.js installed (for `npx` command) + +## Configuration + +### Step 1: Create API Token + +1. Go to [Cloudflare API Tokens](https://dash.cloudflare.com/profile/api-tokens) +2. Click **"Create Token"** +3. Choose **"Custom token"** for specific permissions or **"Global API Key"** for full access +4. Configure permissions based on which MCP servers you plan to use: + - **Zone:Read** - For DNS, analytics, and general zone information + - **Zone:Edit** - For making configuration changes + - **Account:Read** - For account-level resources + - **Workers:Read/Edit** - For Workers-related servers + - **Logs:Read** - For observability and audit logs + +### Step 2: Add MCP Server to Goose + +Choose one or more servers based on your needs. Here are the most popular configurations: + +#### Observability Server (Recommended for debugging) + + + + 1. [Launch the installer](goose://extension?cmd=npx&arg=mcp-remote&arg=https%3A%2F%2Fobservability.mcp.cloudflare.com%2Fsse&id=cloudflare-observability&name=Cloudflare%20Observability&description=Debug%20and%20get%20insight%20into%20your%20application%27s%20logs%20and%20analytics&env=CLOUDFLARE_API_TOKEN%3DCloudflare%20API%20Token) + 2. Press `Yes` to confirm the installation + 3. Enter your Cloudflare API Token + 4. Click `Save Configuration` + 5. Scroll to the top and click `Exit` from the upper left corner + + + 1. Run the `configure` command: + ```sh + goose configure + ``` + + 2. Choose to add a `Command-line Extension` + 3. Give your extension a name: `cloudflare-observability` + 4. Enter the command: `npx mcp-remote https://observability.mcp.cloudflare.com/sse` + 5. Set timeout: `300` seconds + 6. Add environment variable: + - Name: `CLOUDFLARE_API_TOKEN` + - Value: Your Cloudflare API token + + + + +#### Workers Bindings Server (For Workers development) + + + + [Launch the installer](goose://extension?cmd=npx&arg=mcp-remote&arg=https%3A%2F%2Fbindings.mcp.cloudflare.com%2Fsse&id=cloudflare-bindings&name=Cloudflare%20Workers%20Bindings&description=Build%20Workers%20applications%20with%20storage%2C%20AI%2C%20and%20compute%20primitives&env=CLOUDFLARE_API_TOKEN%3DCloudflare%20API%20Token) + + + Command: `npx mcp-remote https://bindings.mcp.cloudflare.com/sse` + + + +#### Radar Server (For traffic insights) + + + + [Launch the installer](goose://extension?cmd=npx&arg=mcp-remote&arg=https%3A%2F%2Fradar.mcp.cloudflare.com%2Fsse&id=cloudflare-radar&name=Cloudflare%20Radar&description=Get%20global%20Internet%20traffic%20insights%2C%20trends%2C%20URL%20scans%2C%20and%20other%20utilities&env=CLOUDFLARE_API_TOKEN%3DCloudflare%20API%20Token) + + + Command: `npx mcp-remote https://radar.mcp.cloudflare.com/sse` + + + +## Example Usage + +### Debugging Application Issues + +Let's use the Observability server to debug performance issues with a Workers application: + +:::info LLM +Anthropic's Claude 3.5 Sonnet was used for this task. +::: + +#### Goose Prompt +``` +I'm seeing high error rates on my Workers application "my-api-worker". Can you help me: +1. Check the recent error logs +2. Identify the most common error types +3. Analyze the performance metrics +4. Suggest optimizations based on the data +``` + +#### Expected Goose Output +``` +I'll help you debug the issues with your "my-api-worker" application. Let me gather the observability data to identify the problems. + +First, let me check the recent error logs for your worker: + +[Goose uses the observability MCP server to fetch error logs] + +I found several issues with your worker: + +**Error Analysis:** +- 45% of errors are 500 Internal Server Errors +- 30% are timeout errors (exceeded 30s CPU limit) +- 25% are memory limit exceeded errors + +**Performance Metrics:** +- Average response time: 2.3s (up 150% from last week) +- CPU usage: 85% average (critical threshold) +- Memory usage: 92% average (near limit) + +**Root Causes Identified:** +1. Database connection pooling issues causing timeouts +2. Memory leaks in JSON parsing for large payloads +3. Inefficient regex operations in request validation + +**Recommended Optimizations:** +1. Implement connection pooling with proper cleanup +2. Stream large JSON payloads instead of loading into memory +3. Replace regex with more efficient string operations +4. Add caching for frequently accessed data + +Would you like me to help implement any of these fixes? +``` + +### Managing Workers Bindings + +Using the Workers Bindings server to set up storage and AI capabilities: + +#### Goose Prompt +``` +I need to set up a new Workers project with: +1. KV storage for caching +2. R2 bucket for file uploads +3. AI binding for text analysis +4. Durable Object for real-time features + +Can you help me configure these bindings? +``` + +### Analyzing Traffic with Radar + +Using the Radar server for security and traffic analysis: + +#### Goose Prompt +``` +Can you help me analyze the security posture of my domain example.com? I want to: +1. Check for any security threats or malicious traffic +2. Analyze global traffic patterns +3. Scan for vulnerabilities +4. Get recommendations for improving security +``` + +## Common Use Cases + +### 1. Application Debugging +- **Observability Server**: Monitor errors, performance, and user experience +- **Logpush Server**: Analyze log patterns and data pipeline health +- **DNS Analytics**: Debug DNS resolution issues + +### 2. Development & Deployment +- **Workers Bindings**: Configure storage, AI, and compute resources +- **Workers Builds**: Monitor deployment status and build health +- **Container Server**: Set up isolated development environments + +### 3. Security & Compliance +- **Audit Logs**: Track configuration changes and access patterns +- **Cloudflare One CASB**: Monitor SaaS application security +- **Radar Server**: Threat intelligence and URL scanning + +### 4. Analytics & Insights +- **GraphQL Server**: Custom analytics and reporting +- **Digital Experience Monitoring**: Application performance insights +- **AI Gateway**: AI usage analytics and optimization + +### 5. Content & Web Management +- **Browser Rendering**: Web scraping and content analysis +- **AutoRAG**: Document management and retrieval +- **Documentation Server**: API reference and troubleshooting + +## Best Practices + +### Security +- Use scoped API tokens with minimal required permissions +- Regularly rotate API tokens +- Monitor API usage through audit logs +- Set up alerts for unusual activity + +### Performance +- Use appropriate timeout values for different operations +- Cache frequently accessed data when possible +- Monitor rate limits and usage quotas +- Implement proper error handling and retries + +### Development Workflow +- Start with the Documentation server for API reference +- Use Container server for isolated testing +- Monitor with Observability server during development +- Analyze with Radar server before going live + +## Troubleshooting + +### Common Issues + +**Authentication Errors:** +- Verify API token has correct permissions +- Check token hasn't expired +- Ensure token is properly set in environment variables + +**Rate Limiting:** +- Monitor API usage in Cloudflare dashboard +- Implement exponential backoff for retries +- Consider upgrading plan for higher limits + +**Connection Issues:** +- Verify network connectivity to Cloudflare APIs +- Check firewall settings +- Ensure proper DNS resolution + +### Getting Help + +If you encounter issues: + +1. Check the [Cloudflare MCP Server repository](https://github.com/cloudflare/mcp-server-cloudflare) for documentation +2. Review [Cloudflare API documentation](https://developers.cloudflare.com/api/) +3. Join our [Discord community](https://discord.gg/block-opensource) for support +4. Check [Cloudflare Community](https://community.cloudflare.com/) for platform-specific help + +## Next Steps + +With Cloudflare MCP servers enabled in Goose, you can: + +- **Monitor and debug** your applications with natural language queries +- **Manage infrastructure** through conversational commands +- **Analyze security** and performance data effortlessly +- **Automate workflows** across Cloudflare's entire platform + +Try starting with the Observability server to get insights into your current applications, then expand to other servers based on your specific needs. diff --git a/documentation/docs/tutorials/mongodb-mcp.md b/documentation/docs/tutorials/mongodb-mcp.md new file mode 100644 index 000000000000..03c78cd1143c --- /dev/null +++ b/documentation/docs/tutorials/mongodb-mcp.md @@ -0,0 +1,260 @@ +--- +title: MongoDB Extension +description: Add MongoDB MCP Server as a Goose Extension +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +The MongoDB MCP Server extension allows Goose to interact directly with your MongoDB databases, enabling comprehensive database operations including querying, document manipulation, collection management, and database administration. This makes it easy to work with your MongoDB databases through natural language interactions. + +:::tip TLDR + + + [Launch the installer](goose://extension?cmd=npx&arg=-y&arg=mongodb-mcp-server&arg=--connection-string&arg=mongodb://localhost:27017&id=mongodb&name=MongoDB&description=MongoDB%20database%20integration) + + + **Command** + ```sh + npx -y mongodb-mcp-server --connection-string mongodb://localhost:27017 + ``` + + +::: + +## Customizing Your Connection + +The MongoDB MCP server connects to a single MongoDB database instance using a connection string. The connection string must be specified using the `--connection-string` flag. We're using `mongodb://localhost:27017` as an example here to access a local MongoDB instance, but you can configure this for your own environment. + +The MongoDB connection string follows this format: +``` +mongodb://username:password@hostname:27017/database +``` + +Where: +- `username`: Your MongoDB user (optional for local development) +- `password`: Your MongoDB password (optional for local development) +- `hostname`: The host where MongoDB is running (e.g., localhost, IP address, or domain) +- `27017`: The default MongoDB port (change if using a different port) +- `database`: The name of your database (optional, will connect to default) + +Examples: +- Local database: `mongodb://localhost:27017` +- Local with credentials: `mongodb://myuser:mypass@localhost:27017/mydb` +- MongoDB Atlas: `mongodb+srv://user:pass@cluster.mongodb.net/database` + +:::caution +Never commit connection strings with credentials to version control! Use environment variables or secure configuration management. For MongoDB Atlas, ensure your IP address is whitelisted and use strong passwords. +::: + +## Configuration + +:::info +Note that you'll need [Node.js](https://nodejs.org/) installed on your system to run this command, as it uses `npx`. You'll also need a running MongoDB instance or access to MongoDB Atlas. +::: + + + + 1. [Launch the installer](goose://extension?cmd=npx&arg=-y&arg=mongodb-mcp-server&arg=--connection-string&arg=mongodb://localhost:27017&id=mongodb&name=MongoDB&description=MongoDB%20database%20integration) + 2. Press `Yes` to confirm the installation + 3. Enter your MongoDB connection string in the format: `mongodb://username:password@hostname:27017/database` + 4. Click `Save Configuration` + 5. Scroll to the top and click `Exit` from the upper left corner + + + 1. Run the `configure` command: + ```sh + goose configure + ``` + + 2. Choose to add a `Command-line Extension` + ```sh + ┌ goose-configure + │ + ◇ What would you like to configure? + │ Add Extension (Connect to a new extension) + │ + ◆ What type of extension would you like to add? + │ ○ Built-in Extension + // highlight-start + │ ● Command-line Extension (Run a local command or script) + // highlight-end + │ ○ Remote Extension + └ + ``` + + 3. Name your extension + ```sh + ┌ goose-configure + │ + ◇ What would you like to configure? + │ Add Extension (Connect to a new extension) + │ + ◇ What type of extension would you like to add? + │ Command-line Extension + │ + // highlight-start + ◆ What would you like to call this extension? + │ MongoDB + // highlight-end + └ + ``` + + 4. Enter the command with your database connection string + ```sh + ┌ goose-configure + │ + ◇ What would you like to configure? + │ Add Extension (Connect to a new extension) + │ + ◇ What would you like to call this extension? + │ MongoDB + │ + // highlight-start + ◆ What command should be run? + │ npx -y mongodb-mcp-server --connection-string mongodb://localhost:27017 + // highlight-end + └ + ``` + + 5. Set the timeout (default 300s is usually sufficient) + ```sh + ┌ goose-configure + │ + ◇ What would you like to configure? + │ Add Extension (Connect to a new extension) + │ + ◇ What would you like to call this extension? + │ MongoDB + │ + ◇ What command should be run? + │ npx -y mongodb-mcp-server --connection-string mongodb://localhost:27017 + │ + // highlight-start + ◆ Please set the timeout for this tool (in secs): + │ 300 + // highlight-end + └ + ``` + + 6. Choose to add a description. If you select "Yes" here, you will be prompted to enter a description for the extension. + ```sh + ┌ goose-configure + │ + ◇ What would you like to configure? + │ Add Extension (Connect to a new extension) + │ + ◇ What would you like to call this extension? + │ MongoDB + │ + ◇ What command should be run? + │ npx -y mongodb-mcp-server --connection-string mongodb://localhost:27017 + │ + ◇ Please set the timeout for this tool (in secs): + │ 300 + │ + // highlight-start + ◆ Would you like to add a description? + │ No + // highlight-end + └ + ``` + + 7. Complete the configuration + ```sh + ┌ goose-configure + │ + ◇ What would you like to configure? + │ Add Extension (Connect to a new extension) + │ + ◇ What would you like to call this extension? + │ MongoDB + │ + ◇ What command should be run? + │ npx -y mongodb-mcp-server --connection-string mongodb://localhost:27017 + │ + ◇ Please set the timeout for this tool (in secs): + │ 300 + │ + ◇ Would you like to add a description? + │ No + │ + // highlight-start + ◆ Would you like to add environment variables? + │ No + // highlight-end + └ Added MongoDB extension + ``` + + + + +## Available Operations + +The MongoDB extension provides comprehensive database management capabilities through natural language interactions. You can perform a wide range of operations including: + +### **Query Operations** +- **Find documents** with complex filters and sorting +- **Aggregate data** using MongoDB's powerful aggregation pipeline +- **Count documents** in collections with optional filtering + +### **Document Management** +- **Insert** single or multiple documents +- **Update** one or many documents with specified criteria +- **Delete** specific documents or bulk deletions + +### **Collection & Database Administration** +- **Create indexes** to optimize query performance +- **Rename collections** for better organization +- **Drop collections** when no longer needed +- **Drop entire databases** (use with caution!) + +### **Schema & Analytics** +- **Analyze collection schemas** to understand document structure +- **List databases and collections** for exploration +- **View collection indexes** and their configurations +- **Check database statistics** and collection storage sizes + +Just describe what you want to accomplish in natural language, and Goose will help you execute the appropriate MongoDB operations safely and efficiently. + +## Example Usage + +#### Goose Prompt +``` +Update all users in the premium tier who haven't logged in for more than 90 days - set their status to 'inactive' and add a note about when this change was made. +``` + +#### Goose Output +``` +I've successfully updated inactive premium users using updateMany: + +db.users.updateMany( + { + subscriptionTier: "premium", + lastLogin: { $lt: new Date(Date.now() - 90 * 24 * 60 * 60 * 1000) } + }, + { + $set: { + status: "inactive", + inactiveNote: "Auto-updated to inactive on 2025-05-25 due to 90+ days of inactivity", + lastModified: new Date() + } + } +) + +Operation Result: +{ + acknowledged: true, + matchedCount: 23, + modifiedCount: 23, + upsertedId: null, + upsertedCount: 0 +} + +Updated 23 premium tier users who hadn't logged in since February 24, 2025. Each document now has: +• status: "inactive" +• inactiveNote: explains the automatic status change +• lastModified: timestamp of this operation + +Consider sending re-engagement emails to these users or reviewing their subscription status. +``` diff --git a/download_cli.ps1 b/download_cli.ps1 new file mode 100644 index 000000000000..57eca20f498b --- /dev/null +++ b/download_cli.ps1 @@ -0,0 +1,233 @@ +############################################################################## +# Goose CLI Install Script for Windows PowerShell +# +# This script downloads the latest stable 'goose' CLI binary from GitHub releases +# and installs it to your system. +# +# Supported OS: Windows +# Supported Architectures: x86_64 +# +# Usage: +# Invoke-WebRequest -Uri "https://github.com/block/goose/releases/download/stable/download_cli.ps1" -OutFile "download_cli.ps1"; .\download_cli.ps1 +# Or simply: .\download_cli.ps1 +# +# Environment variables: +# $env:GOOSE_BIN_DIR - Directory to which Goose will be installed (default: $env:USERPROFILE\.local\bin) +# $env:GOOSE_VERSION - Optional: specific version to install (e.g., "v1.0.25"). Can be in the format vX.Y.Z, vX.Y.Z-suffix, or X.Y.Z +# $env:GOOSE_PROVIDER - Optional: provider for goose +# $env:GOOSE_MODEL - Optional: model for goose +# $env:CANARY - Optional: if set to "true", downloads from canary release instead of stable +# $env:CONFIGURE - Optional: if set to "false", disables running goose configure interactively +############################################################################## + +# Set error action preference to stop on errors +$ErrorActionPreference = "Stop" + +# --- 1) Variables --- +$REPO = "block/goose" +$OUT_FILE = "goose.exe" + +# Set default bin directory if not specified +if (-not $env:GOOSE_BIN_DIR) { + $env:GOOSE_BIN_DIR = Join-Path $env:USERPROFILE ".local\bin" +} + +# Determine release type +$RELEASE = if ($env:CANARY -eq "true") { "true" } else { "false" } +$CONFIGURE = if ($env:CONFIGURE -eq "false") { "false" } else { "true" } + +# Determine release tag +if ($env:GOOSE_VERSION) { + # Validate version format + if ($env:GOOSE_VERSION -notmatch '^v?[0-9]+\.[0-9]+\.[0-9]+(-.*)?$') { + Write-Error "Invalid version '$env:GOOSE_VERSION'. Expected: semver format vX.Y.Z, vX.Y.Z-suffix, or X.Y.Z" + exit 1 + } + # Ensure version starts with 'v' + $RELEASE_TAG = if ($env:GOOSE_VERSION.StartsWith("v")) { $env:GOOSE_VERSION } else { "v$env:GOOSE_VERSION" } +} else { + # Use canary or stable based on RELEASE variable + $RELEASE_TAG = if ($RELEASE -eq "true") { "canary" } else { "stable" } +} + +# --- 2) Detect Architecture --- +$ARCH = $env:PROCESSOR_ARCHITECTURE +if ($ARCH -eq "AMD64") { + $ARCH = "x86_64" +} elseif ($ARCH -eq "ARM64") { + Write-Error "Windows ARM64 is not currently supported." + exit 1 +} else { + Write-Error "Unsupported architecture '$ARCH'. Only x86_64 is supported on Windows." + exit 1 +} + +# --- 3) Build download URL --- +$FILE = "goose-$ARCH-pc-windows-gnu.zip" +$DOWNLOAD_URL = "https://github.com/$REPO/releases/download/$RELEASE_TAG/$FILE" + +Write-Host "Downloading $RELEASE_TAG release: $FILE..." -ForegroundColor Green + +# --- 4) Download the file --- +try { + Invoke-WebRequest -Uri $DOWNLOAD_URL -OutFile $FILE -UseBasicParsing + Write-Host "Download completed successfully." -ForegroundColor Green +} catch { + Write-Error "Failed to download $DOWNLOAD_URL. Error: $($_.Exception.Message)" + exit 1 +} + +# --- 5) Create temporary directory for extraction --- +$TMP_DIR = Join-Path $env:TEMP "goose_install_$(Get-Random)" +try { + New-Item -ItemType Directory -Path $TMP_DIR -Force | Out-Null + Write-Host "Created temporary directory: $TMP_DIR" -ForegroundColor Yellow +} catch { + Write-Error "Could not create temporary extraction directory: $TMP_DIR" + exit 1 +} + +# --- 6) Extract the archive --- +Write-Host "Extracting $FILE to temporary directory..." -ForegroundColor Green +try { + Expand-Archive -Path $FILE -DestinationPath $TMP_DIR -Force + Write-Host "Extraction completed successfully." -ForegroundColor Green +} catch { + Write-Error "Failed to extract $FILE. Error: $($_.Exception.Message)" + Remove-Item -Path $TMP_DIR -Recurse -Force -ErrorAction SilentlyContinue + exit 1 +} + +# Clean up the downloaded archive +Remove-Item -Path $FILE -Force + +# --- 7) Determine extraction directory --- +$EXTRACT_DIR = $TMP_DIR +if (Test-Path (Join-Path $TMP_DIR "goose-package")) { + Write-Host "Found goose-package subdirectory, using that as extraction directory" -ForegroundColor Yellow + $EXTRACT_DIR = Join-Path $TMP_DIR "goose-package" +} + +# --- 8) Create bin directory if it doesn't exist --- +if (-not (Test-Path $env:GOOSE_BIN_DIR)) { + Write-Host "Creating directory: $env:GOOSE_BIN_DIR" -ForegroundColor Yellow + try { + New-Item -ItemType Directory -Path $env:GOOSE_BIN_DIR -Force | Out-Null + } catch { + Write-Error "Could not create directory: $env:GOOSE_BIN_DIR" + Remove-Item -Path $TMP_DIR -Recurse -Force -ErrorAction SilentlyContinue + exit 1 + } +} + +# --- 9) Install goose binary --- +$SOURCE_GOOSE = Join-Path $EXTRACT_DIR "goose.exe" +$DEST_GOOSE = Join-Path $env:GOOSE_BIN_DIR $OUT_FILE + +if (Test-Path $SOURCE_GOOSE) { + Write-Host "Moving goose to $DEST_GOOSE" -ForegroundColor Green + try { + # Remove existing file if it exists to avoid conflicts + if (Test-Path $DEST_GOOSE) { + Remove-Item -Path $DEST_GOOSE -Force + } + Move-Item -Path $SOURCE_GOOSE -Destination $DEST_GOOSE -Force + } catch { + Write-Error "Failed to move goose.exe to $DEST_GOOSE. Error: $($_.Exception.Message)" + Remove-Item -Path $TMP_DIR -Recurse -Force -ErrorAction SilentlyContinue + exit 1 + } +} else { + Write-Error "goose.exe not found in extracted files" + Remove-Item -Path $TMP_DIR -Recurse -Force -ErrorAction SilentlyContinue + exit 1 +} + +# --- 10) Install temporal-service if it exists --- +$SOURCE_TEMPORAL_SERVICE = Join-Path $EXTRACT_DIR "temporal-service.exe" +if (Test-Path $SOURCE_TEMPORAL_SERVICE) { + $DEST_TEMPORAL_SERVICE = Join-Path $env:GOOSE_BIN_DIR "temporal-service.exe" + Write-Host "Moving temporal-service to $DEST_TEMPORAL_SERVICE" -ForegroundColor Green + try { + # Remove existing file if it exists to avoid conflicts + if (Test-Path $DEST_TEMPORAL_SERVICE) { + Remove-Item -Path $DEST_TEMPORAL_SERVICE -Force + } + Move-Item -Path $SOURCE_TEMPORAL_SERVICE -Destination $DEST_TEMPORAL_SERVICE -Force + } catch { + Write-Warning "Failed to move temporal-service.exe: $($_.Exception.Message)" + } +} + +# --- 11) Install temporal CLI if it exists --- +$SOURCE_TEMPORAL = Join-Path $EXTRACT_DIR "temporal.exe" +if (Test-Path $SOURCE_TEMPORAL) { + $DEST_TEMPORAL = Join-Path $env:GOOSE_BIN_DIR "temporal.exe" + Write-Host "Moving temporal CLI to $DEST_TEMPORAL" -ForegroundColor Green + try { + # Remove existing file if it exists to avoid conflicts + if (Test-Path $DEST_TEMPORAL) { + Remove-Item -Path $DEST_TEMPORAL -Force + } + Move-Item -Path $SOURCE_TEMPORAL -Destination $DEST_TEMPORAL -Force + } catch { + Write-Warning "Failed to move temporal.exe: $($_.Exception.Message)" + } +} + +# --- 12) Copy Windows runtime DLLs if they exist --- +$DLL_FILES = Get-ChildItem -Path $EXTRACT_DIR -Filter "*.dll" -ErrorAction SilentlyContinue +foreach ($dll in $DLL_FILES) { + $DEST_DLL = Join-Path $env:GOOSE_BIN_DIR $dll.Name + Write-Host "Moving Windows runtime DLL: $($dll.Name)" -ForegroundColor Green + try { + # Remove existing file if it exists to avoid conflicts + if (Test-Path $DEST_DLL) { + Remove-Item -Path $DEST_DLL -Force + } + Move-Item -Path $dll.FullName -Destination $DEST_DLL -Force + } catch { + Write-Warning "Failed to move $($dll.Name): $($_.Exception.Message)" + } +} + +# --- 13) Clean up temporary directory --- +try { + Remove-Item -Path $TMP_DIR -Recurse -Force + Write-Host "Cleaned up temporary directory." -ForegroundColor Yellow +} catch { + Write-Warning "Could not clean up temporary directory: $TMP_DIR" +} + +# --- 14) Configure Goose (Optional) --- +if ($CONFIGURE -eq "true") { + Write-Host "" + Write-Host "Configuring Goose" -ForegroundColor Green + Write-Host "" + try { + & $DEST_GOOSE configure + } catch { + Write-Warning "Failed to run goose configure. You may need to run it manually later." + } +} else { + Write-Host "Skipping 'goose configure', you may need to run this manually later" -ForegroundColor Yellow +} + +# --- 15) Check PATH and give instructions if needed --- +$CURRENT_PATH = $env:PATH +if ($CURRENT_PATH -notlike "*$env:GOOSE_BIN_DIR*") { + Write-Host "" + Write-Host "Warning: Goose installed, but $env:GOOSE_BIN_DIR is not in your PATH." -ForegroundColor Yellow + Write-Host "To add it to your PATH permanently, run the following command as Administrator:" -ForegroundColor Yellow + Write-Host " [Environment]::SetEnvironmentVariable('PATH', `$env:PATH + ';$env:GOOSE_BIN_DIR', 'Machine')" -ForegroundColor Cyan + Write-Host "" + Write-Host "Or add it to your user PATH (no admin required):" -ForegroundColor Yellow + Write-Host " [Environment]::SetEnvironmentVariable('PATH', `$env:PATH + ';$env:GOOSE_BIN_DIR', 'User')" -ForegroundColor Cyan + Write-Host "" + Write-Host "For this session only, you can run:" -ForegroundColor Yellow + Write-Host " `$env:PATH += ';$env:GOOSE_BIN_DIR'" -ForegroundColor Cyan + Write-Host "" +} + +Write-Host "Goose CLI installation completed successfully!" -ForegroundColor Green +Write-Host "Goose is installed at: $DEST_GOOSE" -ForegroundColor Green diff --git a/ui/desktop/openapi.json b/ui/desktop/openapi.json index cc3ef3fd7e82..329ce854f84f 100644 --- a/ui/desktop/openapi.json +++ b/ui/desktop/openapi.json @@ -10,7 +10,7 @@ "license": { "name": "Apache-2.0" }, - "version": "1.0.35" + "version": "1.0.36" }, "paths": { "/agent/tools": { diff --git a/ui/desktop/src/components/BaseChat.tsx b/ui/desktop/src/components/BaseChat.tsx index 0b756dd028b7..50ad42f5164f 100644 --- a/ui/desktop/src/components/BaseChat.tsx +++ b/ui/desktop/src/components/BaseChat.tsx @@ -448,7 +448,7 @@ function BaseChatContent({ {renderAfterMessages && renderAfterMessages()} {/* Bottom padding to make space for the loading indicator */} -
+
{/* Fixed loading indicator at bottom left of chat container */} diff --git a/ui/desktop/src/components/ChatInput.tsx b/ui/desktop/src/components/ChatInput.tsx index c376a6f74972..a7f2aecc9a98 100644 --- a/ui/desktop/src/components/ChatInput.tsx +++ b/ui/desktop/src/components/ChatInput.tsx @@ -892,7 +892,7 @@ export default function ChatInput({ >
{/* Input row with inline action buttons */} -
+