hermes-desktop-os1-native-macos-client

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Hermes Desktop OS1 Native macOS Client

Hermes Desktop OS1 原生macOS客户端

Skill by ara.so — Hermes Skills collection.
Hermes Desktop - OS1 Edition is a native macOS application that provides a unified workspace for AI agents running on Orgo cloud computers or SSH hosts. It offers direct VM provisioning, automatic agent installation, a real-time websocket terminal, session management, kanban boards, file editing, and WebRTC voice mode powered by OpenAI Realtime.
ara.so 开发的Skill — 属于Hermes Skills集合。
Hermes Desktop - OS1版本是一款原生macOS应用,为运行在Orgo云计算机或SSH主机上的AI Agent提供统一工作区。它支持直接配置虚拟机、自动安装Agent、实时WebSocket终端、会话管理、看板、文件编辑,以及基于OpenAI Realtime的WebRTC语音模式。

What OS1 Does

OS1的功能

  • Direct cloud computer integration: Connects to Orgo VMs via HTTP API and websocket terminal without SSH
  • One-click agent install: Automatically installs Hermes Agent on fresh cloud computers
  • Native workspace: Sessions browser, kanban board, file editor, skills viewer, cron manager
  • Real terminal: Interactive shell over websocket with full resize and reflow support
  • Voice mode: WebRTC voice interface using OpenAI Realtime with Orgo MCP tool integration
  • SSH fallback: Traditional SSH connections for existing hosts
  • 直接云计算机集成:通过HTTP API和WebSocket终端连接Orgo虚拟机,无需SSH
  • 一键安装Agent:在全新云计算机上自动安装Hermes Agent
  • 原生工作区:会话浏览器、看板、文件编辑器、技能查看器、定时任务管理器
  • 实时终端:基于WebSocket的交互式shell,支持全屏调整和回流
  • 语音模式:使用OpenAI Realtime的WebRTC语音界面,集成Orgo MCP工具
  • SSH备用方案:为现有主机提供传统SSH连接

Installation

安装

Download Pre-built

下载预构建版本

  1. Download
    OS1.app.zip
    from the GitHub releases page
  2. Unzip and move
    OS1.app
    to
    /Applications
  3. Right-click → Open (first launch only to bypass macOS Gatekeeper)
  1. 从GitHub发布页面下载
    OS1.app.zip
  2. 解压并将
    OS1.app
    移动到
    /Applications
    目录
  3. 右键点击 → 打开(首次启动时绕过macOS Gatekeeper)

Build from Source

从源码构建

sh
git clone https://github.com/nickvasilescu/hermes-desktop-os1.git
cd hermes-desktop-os1
./scripts/build-macos-app.sh
The app bundle will be at
dist/OS1.app
.
sh
git clone https://github.com/nickvasilescu/hermes-desktop-os1.git
cd hermes-desktop-os1
./scripts/build-macos-app.sh
应用包将生成在
dist/OS1.app
路径下。

Run Tests

运行测试

swift
swift test
For live integration tests against a real Orgo computer:
sh
ORGO_LIVE_TESTS=1 \
ORGO_API_KEY="sk_live_..." \
ORGO_DEFAULT_COMPUTER_ID="<uuid>" \
swift test --filter OrgoTransportLiveTests
swift
swift test
针对真实Orgo计算机运行实时集成测试:
sh
ORGO_LIVE_TESTS=1 \
ORGO_API_KEY="sk_live_..." \
ORGO_DEFAULT_COMPUTER_ID="<uuid>" \
swift test --filter OrgoTransportLiveTests

Configuration

配置

Setting Up an Orgo Cloud Computer

设置Orgo云计算机

  1. Get API Key: Visit orgo.ai/settings/api-keys
  2. Open Connections Tab → Click Add Host
  3. Select Orgo VM transport
  4. Paste API Key → Click Verify & Save
    • Key is stored in macOS Keychain for reuse
  5. Pick Workspace from dropdown
  6. Pick or Create Computer:
    • Select existing computer, OR
    • Click Create new computer… (defaults: Linux, 8GB RAM, 4 CPU, 50GB disk)
  7. Save connection
  8. Install Agent: If agent isn't installed, Overview screen shows install banner
    • Click to run official Hermes Agent installer (~60-90 seconds)
  1. 获取API密钥:访问 orgo.ai/settings/api-keys
  2. 打开连接标签页 → 点击 添加主机
  3. 选择Orgo VM传输方式
  4. 粘贴API密钥 → 点击 验证并保存
    • 密钥将存储在macOS钥匙串中以便重复使用
  5. 从下拉菜单中选择工作区
  6. 选择或创建计算机:
    • 选择现有计算机,或
    • 点击 创建新计算机…(默认配置:Linux系统、8GB内存、4核CPU、50GB磁盘)
  7. 保存连接
  8. 安装Agent:如果未安装Agent,概览页面会显示安装横幅
    • 点击运行官方Hermes Agent安装程序(约60-90秒)

Setting Up SSH Connection

设置SSH连接

  1. Add Host → Select SSH transport
  2. Enter Details:
    • Host alias or address
    • Optional: user, port, Hermes profile
  3. Prerequisites:
    • SSH accessible from your Mac without interactive prompts
    • python3
      on non-interactive SSH PATH
    • Hermes Agent already installed
  1. 添加主机 → 选择 SSH传输方式
  2. 输入详细信息:
    • 主机别名或地址
    • 可选:用户名、端口、Hermes配置文件
  3. 前提条件:
    • Mac可无交互提示访问SSH
    • 非交互式SSH PATH中包含
      python3
    • 已在远程主机上安装Hermes Agent

API and Transport Architecture

API与传输架构

Orgo Transport Routing

Orgo传输路由

The transport intelligently routes requests:
swift
// HTTP operations try platform proxy first
// https://www.orgo.ai/api/computers/{id}/...
// Falls back to direct VM URL on 5xx routing failures
// https://<fly_instance_id>.orgo.dev/...

// Terminal websocket connects directly
// wss://<fly_instance_id>.orgo.dev/terminal?token=<vncPassword>
传输层会智能路由请求:
swift
// HTTP操作优先尝试平台代理
// https://www.orgo.ai/api/computers/{id}/...
// 遇到5xx路由失败时回退到直接VM URL
// https://<fly_instance_id>.orgo.dev/...

// 终端WebSocket直接连接
// wss://<fly_instance_id>.orgo.dev/terminal?token=<vncPassword>

Key HTTP Endpoints

核心HTTP端点

POST /bash           - Execute bash command
POST /exec           - Execute arbitrary command
GET  /files          - List files
PUT  /files          - Write file
GET  /sessions       - List agent sessions
GET  /tasks          - Get kanban tasks
GET  /skills         - List available skills
GET  /cron           - List cron jobs
POST /bash           - 执行bash命令
POST /exec           - 执行任意命令
GET  /files          - 列出文件
PUT  /files          - 写入文件
GET  /sessions       - 列出Agent会话
GET  /tasks          - 获取看板任务
GET  /skills         - 列出可用技能
GET  /cron           - 列出定时任务

Connection Configuration Example

连接配置示例

swift
// Orgo connection persists API key in Keychain
// Access pattern in Swift:
import Security

func saveOrgoAPIKey(_ key: String) {
    let query: [String: Any] = [
        kSecClass as String: kSecClassGenericPassword,
        kSecAttrService as String: "com.elementsoftware.os1.orgo",
        kSecAttrAccount as String: "api-key",
        kSecValueData as String: key.data(using: .utf8)!
    ]
    SecItemAdd(query as CFDictionary, nil)
}
swift
// Orgo连接将API密钥持久化到钥匙串
// Swift中的访问模式:
import Security

func saveOrgoAPIKey(_ key: String) {
    let query: [String: Any] = [
        kSecClass as String: kSecClassGenericPassword,
        kSecAttrService as String: "com.elementsoftware.os1.orgo",
        kSecAttrAccount as String: "api-key",
        kSecValueData as String: key.data(using: .utf8)!
    ]
    SecItemAdd(query as CFDictionary, nil)
}

Voice Mode Configuration

语音模式配置

OS1 includes WebRTC voice mode using OpenAI Realtime API.
OS1包含使用OpenAI Realtime API的WebRTC语音模式。

Setting Up Voice Mode

设置语音模式

  1. Configure OpenAI Key:
    • Open Providers tab → Save OpenAI API key to Keychain, OR
    • Set environment variable for runtime
  2. Environment Variables:
sh
undefined
  1. 配置OpenAI密钥:
    • 打开 提供商标签页 → 将OpenAI API密钥保存到钥匙串,或
    • 在运行时设置环境变量
  2. 环境变量:
sh
undefined

Required: OpenAI API key

必填:OpenAI API密钥

OPENAI_API_KEY="sk-..."
OPENAI_API_KEY="sk-..."

Optional: Orgo MCP configuration

可选:Orgo MCP配置

OS1_ORGO_MCP_JS_PATH="/absolute/path/to/dist/index.js" OS1_ORGO_MCP_PACKAGE="@orgo-ai/mcp" OS1_REALTIME_ORGO_TOOLSETS="core,screen,files" OS1_REALTIME_ORGO_DISABLED_TOOLS="orgo_upload_file" OS1_REALTIME_ORGO_READ_ONLY="true"

3. **Running with Voice Mode**:

```sh
OS1_ORGO_MCP_JS_PATH="/absolute/path/to/dist/index.js" OS1_ORGO_MCP_PACKAGE="@orgo-ai/mcp" OS1_REALTIME_ORGO_TOOLSETS="core,screen,files" OS1_REALTIME_ORGO_DISABLED_TOOLS="orgo_upload_file" OS1_REALTIME_ORGO_READ_ONLY="true"

3. **启用语音模式运行**:

```sh

From source

从源码运行

OPENAI_API_KEY="sk-..." swift run OS1
OPENAI_API_KEY="sk-..." swift run OS1

Packaged app

打包应用运行

./scripts/build-macos-app.sh OPENAI_API_KEY="sk-..." ./dist/OS1.app/Contents/MacOS/OS1
undefined
./scripts/build-macos-app.sh OPENAI_API_KEY="sk-..." ./dist/OS1.app/Contents/MacOS/OS1
undefined

Voice Mode Architecture

语音模式架构

The voice system:
  • Starts a loopback WebRTC session endpoint after boot animation
  • Sends SDP to
    POST /session
    endpoint
  • Swift backend forwards to
    https://api.openai.com/v1/realtime/calls
  • Exposes Orgo MCP tools to the voice model as Realtime function tools
  • Runs local MCP server (
    npx -y @orgo-ai/mcp
    )
  • Forwards tool calls between model and Orgo
语音系统:
  • 启动动画后启动环回WebRTC会话端点
  • POST /session
    端点发送SDP
  • Swift后端转发到
    https://api.openai.com/v1/realtime/calls
  • 将Orgo MCP工具作为实时函数工具暴露给语音模型
  • 运行本地MCP服务器 (
    npx -y @orgo-ai/mcp
    )
  • 在模型与Orgo之间转发工具调用

Orgo Toolsets

Orgo工具集

Default toolsets:
core,screen,files
Opt-in toolsets (use with caution):
shell,admin
sh
undefined
默认工具集:
core,screen,files
可选工具集(谨慎使用):
shell,admin
sh
undefined

Enable shell and admin toolsets (WARNING: gives voice model system access)

启用shell和admin工具集(警告:授予语音模型系统访问权限)

OS1_REALTIME_ORGO_TOOLSETS="core,screen,files,shell,admin"
undefined
OS1_REALTIME_ORGO_TOOLSETS="core,screen,files,shell,admin"
undefined

Building and Packaging

构建与打包

Basic Build

基础构建

sh
./scripts/build-macos-app.sh
Creates universal binary (Apple Silicon + Intel) at
dist/OS1.app
.
sh
./scripts/build-macos-app.sh
dist/OS1.app
生成通用二进制包(Apple Silicon + Intel)。

Code Signing

代码签名

The default build is ad-hoc signed with designated requirement for
com.elementsoftware.os1
.
Custom Signing Identity:
sh
undefined
默认构建使用针对
com.elementsoftware.os1
的指定要求进行临时签名。
自定义签名身份:
sh
undefined

Use specific identity

使用特定身份

OS1_CODESIGN_IDENTITY="Developer ID Application: Your Name (TEAM123)"
./scripts/build-macos-app.sh
OS1_CODESIGN_IDENTITY="Developer ID Application: Your Name (TEAM123)"
./scripts/build-macos-app.sh

Or use first available Apple Development identity

或使用第一个可用的Apple Development身份

OS1_AUTO_CODESIGN=1 ./scripts/build-macos-app.sh
undefined
OS1_AUTO_CODESIGN=1 ./scripts/build-macos-app.sh
undefined

Environment Variables for Build

构建环境变量

sh
undefined
sh
undefined

Legacy name (also supported)

旧名称(同样支持)

HERMES_CODESIGN_IDENTITY="Developer ID Application: Your Name"
HERMES_CODESIGN_IDENTITY="Developer ID Application: Your Name"

Custom identity

自定义身份

OS1_CODESIGN_IDENTITY="Developer ID Application: Your Name"
OS1_CODESIGN_IDENTITY="Developer ID Application: Your Name"

Auto-select first Apple Development cert

自动选择第一个Apple Development证书

OS1_AUTO_CODESIGN=1
undefined
OS1_AUTO_CODESIGN=1
undefined

Common Usage Patterns

常见使用场景

Installing Agent on Fresh VM

在全新虚拟机上安装Agent

swift
// After connecting to a VM without agent
// 1. Overview screen detects missing agent
// 2. Shows "Install Hermes Agent" button
// 3. Installation handles:
//    - VM clock drift synchronization
//    - System git installation
//    - Stale apt lock cleanup
//    - Hermes agent installation (~60-90s)
swift
// 连接到未安装Agent的虚拟机后
// 1. 概览页面检测到缺失Agent
// 2. 显示“安装Hermes Agent”按钮
// 3. 安装流程处理:
//    - 虚拟机时钟漂移同步
//    - 系统git安装
//    - 清理过期apt锁
//    - Hermes Agent安装(约60-90秒)

Working with Sessions

会话管理

Sessions are AI agent task sessions stored on the VM.
swift
// Sessions view provides:
// - Full-text search across all sessions
// - Session browser with metadata
// - Direct navigation to session details
// - Export/archive capabilities
会话是存储在虚拟机上的AI Agent任务会话。
swift
// 会话视图提供:
// - 所有会话的全文搜索
// - 带元数据的会话浏览器
// - 直接导航到会话详情
// - 导出/归档功能

Managing Files

文件管理

swift
// File editor includes:
// - Syntax highlighting
// - Conflict detection (checks mtime before save)
// - Profile-aware path resolution
// - Direct VM filesystem access via HTTP API
swift
// 文件编辑器包含:
// - 语法高亮
// - 冲突检测(保存前检查mtime)
// - 配置文件感知路径解析
// - 通过HTTP API直接访问虚拟机文件系统

Using the Terminal

终端使用

swift
// Terminal features:
// - Real-time websocket connection
// - Full TTY resize support
// - Output reflow on window resize
// - History persistence
// - Direct byte streaming (no SSH overhead)
swift
// 终端特性:
// - 实时WebSocket连接
// - 完整TTY调整支持
// - 窗口调整时输出回流
// - 历史记录持久化
// - 直接字节流(无SSH开销)

Troubleshooting

故障排除

Connection Issues

连接问题

Problem: Can't connect to Orgo VM
Solutions:
1. Verify API key at orgo.ai/settings/api-keys
2. Check workspace has active computers
3. Ensure computer is running (not stopped/suspended)
4. Check Connections tab shows green status indicator
Problem: 5xx errors from platform proxy
Behavior: Transport automatically falls back to direct VM URL
Check: Look for fallback message in logs
Note: Long-running ops (installer) skip proxy to avoid 30s timeout
问题:无法连接到Orgo虚拟机
解决方案:
1. 在orgo.ai/settings/api-keys验证API密钥
2. 检查工作区是否有活跃计算机
3. 确保计算机正在运行(未停止/暂停)
4. 检查连接标签页显示绿色状态指示器
问题:平台代理返回5xx错误
行为:传输层自动回退到直接VM URL
检查:在日志中查找回退消息
注意:长时间运行的操作(如安装程序)会跳过代理以避免30秒超时

Agent Installation Failures

Agent安装失败

Problem: Install hangs or times out
Common causes:
- VM clock drift (installer syncs automatically)
- Missing system git (installer apt-gets it)
- Stale apt locks (installer cleans them)

Solution: Let installer run full course (~90s)
Manual check: Use terminal tab to inspect /tmp/hermes-install.log
问题:安装卡住或超时
常见原因:
- 虚拟机时钟漂移(安装程序会自动同步)
- 缺少系统git(安装程序会通过apt安装)
- 过期apt锁(安装程序会清理)

解决方案:让安装程序运行完整流程(约90秒)
手动检查:使用终端标签页查看/tmp/hermes-install.log

SSH Connection Problems

SSH连接问题

Problem: SSH connection fails
Checklist:
- Can you `ssh user@host` from terminal without password prompt?
- Is python3 in non-interactive PATH? (ssh user@host 'which python3')
- Is Hermes already installed on remote host?
- Does ~/.ssh/config have correct settings for host?
问题:SSH连接失败
检查清单:
- 能否从终端无密码提示执行 `ssh user@host`?
- 非交互式PATH中是否包含python3?(执行ssh user@host 'which python3')
- 远程主机是否已安装Hermes?
- ~/.ssh/config是否有该主机的正确设置?

Voice Mode Issues

语音模式问题

Problem: Microphone not accessible
1. Check System Settings → Privacy & Security → Microphone
2. Grant OS1.app microphone access
3. Restart app after granting permission
Problem: Voice mode not starting
Check:
1. OPENAI_API_KEY is set (env or Providers tab)
2. No firewall blocking WebRTC
3. Console.app for OS1 logs
4. Look for "oai-events data channel ready" in logs
Problem: MCP tools not available in voice
Check:
1. ORGO_API_KEY is set or saved in OS1
2. ORGO_DEFAULT_COMPUTER_ID matches active connection
3. OS1_REALTIME_ORGO_TOOLSETS includes desired toolsets
4. MCP server can start: npx -y @orgo-ai/mcp --version
问题:麦克风无法访问
1. 检查系统设置 → 隐私与安全性 → 麦克风
2. 授予OS1.app麦克风访问权限
3. 授予权限后重启应用
问题:语音模式无法启动
检查:
1. 是否已设置OPENAI_API_KEY(环境变量或提供商标签页)
2. 防火墙是否阻止WebRTC
3. 在Console.app中查看OS1日志
4. 在日志中查找"oai-events data channel ready"
问题:语音模式中MCP工具不可用
检查:
1. 是否已设置ORGO_API_KEY或在OS1中保存
2. ORGO_DEFAULT_COMPUTER_ID是否匹配活跃连接
3. OS1_REALTIME_ORGO_TOOLSETS是否包含所需工具集
4. MCP服务器能否启动:执行npx -y @orgo-ai/mcp --version

Development Workflow

开发工作流

Local Development Loop

本地开发循环

sh
undefined
sh
undefined

1. Make code changes

1. 修改代码

2. Run tests

2. 运行测试

swift test
swift test

3. Run from source

3. 从源码运行

swift run OS1
swift run OS1

4. Build and test packaged app

4. 构建并测试打包应用

./scripts/build-macos-app.sh open dist/OS1.app
undefined
./scripts/build-macos-app.sh open dist/OS1.app
undefined

Debugging Transport Layer

调试传输层

swift
// Enable verbose logging in OrgoTransport.swift
print("[OrgoTransport] Attempting proxy: \(proxyURL)")
print("[OrgoTransport] Fallback to direct: \(directURL)")

// Check websocket handshake
print("[Terminal] WebSocket connecting to: \(wsURL)")
print("[Terminal] WebSocket state: \(webSocket.readyState)")
swift
// 在OrgoTransport.swift中启用详细日志
print("[OrgoTransport] Attempting proxy: \(proxyURL)")
print("[OrgoTransport] Fallback to direct: \(directURL)")

// 检查WebSocket握手
print("[Terminal] WebSocket connecting to: \(wsURL)")
print("[Terminal] WebSocket state: \(webSocket.readyState)")

Testing Against Live Orgo

针对真实Orgo测试

sh
undefined
sh
undefined

Get computer ID from Orgo dashboard or API

从Orgo控制台或API获取计算机ID

ORGO_DEFAULT_COMPUTER_ID=$(curl -H "Authorization: Bearer $ORGO_API_KEY"
https://www.orgo.ai/api/computers | jq -r '.[0].id')
ORGO_DEFAULT_COMPUTER_ID=$(curl -H "Authorization: Bearer $ORGO_API_KEY"
https://www.orgo.ai/api/computers | jq -r '.[0].id')

Run live tests

运行实时测试

ORGO_LIVE_TESTS=1
ORGO_API_KEY="sk_live_..."
ORGO_DEFAULT_COMPUTER_ID="$ORGO_DEFAULT_COMPUTER_ID"
swift test --filter OrgoTransportLiveTests
undefined
ORGO_LIVE_TESTS=1
ORGO_API_KEY="sk_live_..."
ORGO_DEFAULT_COMPUTER_ID="$ORGO_DEFAULT_COMPUTER_ID"
swift test --filter OrgoTransportLiveTests
undefined

Real Code Examples

真实代码示例

Creating a Connection Programmatically

以编程方式创建连接

swift
import Foundation

struct OrgoConnection {
    let apiKey: String
    let workspaceId: String
    let computerId: String
    
    func saveToKeychain() {
        let query: [String: Any] = [
            kSecClass as String: kSecClassGenericPassword,
            kSecAttrService as String: "com.elementsoftware.os1.orgo",
            kSecAttrAccount as String: "api-key",
            kSecValueData as String: apiKey.data(using: .utf8)!,
            kSecAttrAccessible as String: kSecAttrAccessibleAfterFirstUnlock
        ]
        
        SecItemDelete(query as CFDictionary) // Remove old
        SecItemAdd(query as CFDictionary, nil)
    }
}

// Usage
let connection = OrgoConnection(
    apiKey: ProcessInfo.processInfo.environment["ORGO_API_KEY"] ?? "",
    workspaceId: "workspace-uuid",
    computerId: "computer-uuid"
)
connection.saveToKeychain()
swift
import Foundation

struct OrgoConnection {
    let apiKey: String
    let workspaceId: String
    let computerId: String
    
    func saveToKeychain() {
        let query: [String: Any] = [
            kSecClass as String: kSecClassGenericPassword,
            kSecAttrService as String: "com.elementsoftware.os1.orgo",
            kSecAttrAccount as String: "api-key",
            kSecValueData as String: apiKey.data(using: .utf8)!,
            kSecAttrAccessible as String: kSecAttrAccessibleAfterFirstUnlock
        ]
        
        SecItemDelete(query as CFDictionary) // 删除旧密钥
        SecItemAdd(query as CFDictionary, nil)
    }
}

// 使用示例
let connection = OrgoConnection(
    apiKey: ProcessInfo.processInfo.environment["ORGO_API_KEY"] ?? "",
    workspaceId: "workspace-uuid",
    computerId: "computer-uuid"
)
connection.saveToKeychain()

Executing Commands on VM

在虚拟机上执行命令

swift
import Foundation

func executeBashCommand(
    computerId: String,
    command: String,
    apiKey: String
) async throws -> String {
    let url = URL(string: "https://www.orgo.ai/api/computers/\(computerId)/bash")!
    var request = URLRequest(url: url)
    request.httpMethod = "POST"
    request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
    
    let body = ["command": command]
    request.httpBody = try JSONSerialization.data(withJSONObject: body)
    
    let (data, _) = try await URLSession.shared.data(for: request)
    
    struct Response: Codable {
        let stdout: String
        let stderr: String
        let exitCode: Int
    }
    
    let response = try JSONDecoder().decode(Response.self, from: data)
    return response.stdout
}

// Usage
Task {
    let output = try await executeBashCommand(
        computerId: "abc-123",
        command: "ls -la /home/agent",
        apiKey: ProcessInfo.processInfo.environment["ORGO_API_KEY"]!
    )
    print(output)
}
swift
import Foundation

func executeBashCommand(
    computerId: String,
    command: String,
    apiKey: String
) async throws -> String {
    let url = URL(string: "https://www.orgo.ai/api/computers/\(computerId)/bash")!
    var request = URLRequest(url: url)
    request.httpMethod = "POST"
    request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
    
    let body = ["command": command]
    request.httpBody = try JSONSerialization.data(withJSONObject: body)
    
    let (data, _) = try await URLSession.shared.data(for: request)
    
    struct Response: Codable {
        let stdout: String
        let stderr: String
        let exitCode: Int
    }
    
    let response = try JSONDecoder().decode(Response.self, from: data)
    return response.stdout
}

// 使用示例
Task {
    let output = try await executeBashCommand(
        computerId: "abc-123",
        command: "ls -la /home/agent",
        apiKey: ProcessInfo.processInfo.environment["ORGO_API_KEY"]!
    )
    print(output)
}

Reading Sessions from Agent

从Agent读取会话

swift
import Foundation

struct HermesSession: Codable {
    let id: String
    let title: String
    let createdAt: String
    let messages: [Message]
    
    struct Message: Codable {
        let role: String
        let content: String
        let timestamp: String
    }
}

func fetchSessions(
    computerId: String,
    apiKey: String
) async throws -> [HermesSession] {
    let url = URL(string: "https://www.orgo.ai/api/computers/\(computerId)/sessions")!
    var request = URLRequest(url: url)
    request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
    
    let (data, _) = try await URLSession.shared.data(for: request)
    return try JSONDecoder().decode([HermesSession].self, from: data)
}

// Usage with search
Task {
    let sessions = try await fetchSessions(
        computerId: "abc-123",
        apiKey: ProcessInfo.processInfo.environment["ORGO_API_KEY"]!
    )
    
    // Full-text search
    let searchTerm = "deployment"
    let matching = sessions.filter { session in
        session.messages.contains { message in
            message.content.localizedCaseInsensitiveContains(searchTerm)
        }
    }
    
    print("Found \(matching.count) sessions mentioning '\(searchTerm)'")
}
swift
import Foundation

struct HermesSession: Codable {
    let id: String
    let title: String
    let createdAt: String
    let messages: [Message]
    
    struct Message: Codable {
        let role: String
        let content: String
        let timestamp: String
    }
}

func fetchSessions(
    computerId: String,
    apiKey: String
) async throws -> [HermesSession] {
    let url = URL(string: "https://www.orgo.ai/api/computers/\(computerId)/sessions")!
    var request = URLRequest(url: url)
    request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
    
    let (data, _) = try await URLSession.shared.data(for: request)
    return try JSONDecoder().decode([HermesSession].self, from: data)
}

// 带搜索功能的使用示例
Task {
    let sessions = try await fetchSessions(
        computerId: "abc-123",
        apiKey: ProcessInfo.processInfo.environment["ORGO_API_KEY"]!
    )
    
    // 全文搜索
    let searchTerm = "deployment"
    let matching = sessions.filter { session in
        session.messages.contains { message in
            message.content.localizedCaseInsensitiveContains(searchTerm)
        }
    }
    
    print("找到 \(matching.count) 个提及'\(searchTerm)'的会话")
}

Requirements

系统要求

  • macOS 14+ (Sonoma or newer)
  • Universal Binary: Apple Silicon or Intel
  • Orgo Account: For cloud computer features (get API key at orgo.ai)
  • OR SSH Access: For traditional SSH connections
  • macOS 14+(Sonoma或更高版本)
  • 通用二进制:支持Apple Silicon或Intel架构
  • Orgo账户:使用云计算机功能(在orgo.ai获取API密钥)
  • SSH访问:用于传统SSH连接

Architecture Notes

架构说明

  • Swift + SwiftUI: Native macOS app, no Electron
  • Keychain Integration: Secure credential storage
  • WebSocket Terminal: Direct VM connection via SwiftTerm
  • HTTP API Client: First-class Orgo platform integration
  • MCP Integration: Voice mode exposes Orgo tools to OpenAI Realtime
  • Localization Ready: English, Simplified Chinese, Russian scaffolding
  • Swift + SwiftUI:原生macOS应用,非Electron架构
  • 钥匙串集成:安全存储凭证
  • WebSocket终端:通过SwiftTerm直接连接虚拟机
  • HTTP API客户端:深度集成Orgo平台
  • MCP集成:语音模式将Orgo工具暴露给OpenAI Realtime
  • 多语言支持:已搭建英文、简体中文、俄文框架

Project Links

项目链接