# PsycheSDK for iOS

Swift SDK for integrating Psyche AI virtual assistants into iOS applications.

## Requirements

- iOS 16.0+ / macOS 13.0+ / visionOS 1.0+
- Swift 5.9+
- Xcode 15.0+

## Installation

### Swift Package Manager

Add PsycheSDK to your `Package.swift`:

```swift
dependencies: [
    .package(url: "https://github.com/GreyChimp/oshun", from: "0.1.0"),
],
targets: [
    .target(
        name: "YourApp",
        dependencies: [
            .product(name: "PsycheSDK", package: "oshun"),
        ]
    ),
]
```

Or in Xcode: File → Add Package Dependencies → Enter the repository URL.

## Quick Start

```swift
import PsycheSDK

// Initialize the client
let psyche = PsycheClient(apiKey: "psk_your_api_key_here_32chars_min")
try await psyche.initialize()

// Create an avatar session
let session = try await psyche.sessions.create(avatarId: "avatar-001")

// Send a message
let response = try await psyche.conversations.send(
    sessionId: session.id,
    message: "Hello, can you help me?"
)
print(response.content)
```

## Architecture

```
Sources/PsycheSDK/
├── Configuration.swift    # SDK config, errors, logging
├── Types.swift            # Core types (avatar, message, WebRTC, etc.)
├── HTTPClient.swift       # HTTP client with retry logic
└── PsycheClient.swift     # Main entry point
```

## API Reference

### PsycheClient

Main SDK entry point. Provides access to:

- `sessions` — Avatar session management (create, get, list, end)
- `conversations` — Message sending and history retrieval

### Configuration

```swift
let config = PsycheConfiguration(
    apiKey: "psk_...",
    baseURL: URL(string: "https://api.psyche.oshun.ai/v1")!,
    timeout: 30.0,
    maxRetries: 3,
    logLevel: .debug
)
let client = PsycheClient(configuration: config)
```

### WebRTC

```swift
let webrtcConfig = WebRTCConfig(
    iceServers: [ICEServer(urls: ["stun:stun.l.google.com:19302"])],
    enableAudio: true,
    enableVideo: true,
    videoCodec: .h264,
    maxVideoBitrate: 2500
)
```

## License

Proprietary — Oshun Ecosystem
