Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,75 @@

## Unreleased

## 2026.3.1 - 2026-09-29

OpenClawKit 2026.3.1 adds [Sign in with ChatGPT](https://developers.openai.com/siwc)
(SIWC): people sign in with their ChatGPT account and run eligible inference on
their ChatGPT plan instead of an API key. The release is additive; there are no
breaking changes, and the upstream parity target stays OpenClaw `2026.9.6`
(upstream has no SIWC client, so this is an SDK-native feature).

### Added

- `SignInWithChatGPTSession` (`OpenClawCore`, Apple platforms and Linux): the
open-source "ChatGPT plan usage" flow. The first sign-in of an account
registers with `client_id=dynamic_agent_client` and `agent_name_hint`, later
sign-ins reuse the issued `oaiapp_…` client id with `id_token_hint` and
`login_hint`, and `consent: .forceReconsent` / `.consent` re-enable plan usage.
Every authorization sends PKCE `S256`, `state`, `nonce`,
`resource=https://api.openai.com/v1` and a persisted `ext_agent_host_id`.
- `SignInWithChatGPTLoopbackListener`: a one-shot `127.0.0.1` callback server
on `/auth/callback` (port 1455, or an ephemeral port when busy) that ignores
callbacks with the wrong `state`; not built for tvOS and watchOS.
- RS256 ID-token validation (`SignInWithChatGPTIDTokenValidator`, JWKS cache
with key-rotation refresh): signature, `iss`, `aud`, `azp`, `exp`, `iat`,
`nbf`, `nonce` and `sub`; keys under 2048 bits are rejected. Verification
uses Security.framework on Apple platforms and swift-crypto's `_CryptoExtras`
on Linux (a new Linux-only dependency of `OpenClawCore`).
- Token lifecycle: code exchange, refresh five minutes before expiry (never
before `earliest_refresh_at`), one refresh per account at a time with rotated
refresh tokens replaced together with the access token, and a forced refresh
when inference returns `401`. Rejected refresh tokens clear the tokens and
throw `reauthenticationRequired` while keeping the account's client id.
- Accounts: `SignInWithChatGPTAccountStore` keeps multiple accounts (separate
registrations, never mixed), the active account, the one-time plan-welcome
flag and the documented credential record (`client_id`, `access_token`,
`refresh_token`, `id_token`, `expires_in`, ISO 8601 `saved_at`,
`ext_agent_host_id`) in any `CredentialStore`. Sign-out revokes the refresh
token with retries and keeps the client id and host id; credential records can
be exported and imported (for example to a self-hosted VM).
- `SignInWithChatGPTHostIdentifier`: `urn:uuid:`, RFC 9278 JWK-thumbprint and
`did:key:` host ids, including `init(deviceIdentity:)` from the gateway device
key.
- `ChatGPTPlanModelProvider` (`OpenClawModels`): Responses inference on the
plan with `store: false`, `stream: true`, `instructions`, developer-role
system messages, namespaced function tools, `tool_choice` mapping, and no
unsupported fields (`temperature`, `top_p`, `max_output_tokens`, …);
`listModels()` returns the `visibility == "list"` models in server order.
- `ChatGPTPlanError`: typed plan errors for the `subscription_sharing_*` and
`chatpass_v2_*` codes and direct-admission responses, with a `recovery`
(`manageUsage`, `signInAgain`, `retryLater`, `changeRequest`) and
`Retry-After`.
- Apple presenters: `SignInWithChatGPTWebAuthenticationBrowser`
(`ASWebAuthenticationSession` on iOS, macOS and visionOS) and
`SignInWithChatGPTExternalBrowser.systemDefault` on macOS.
- `OpenClawChatUI`: `SignInWithChatGPTButton` ("Continue with ChatGPT" /
"Sign in with ChatGPT", black or white, host-supplied logo),
`ChatGPTPlanWelcomeView`, `ChatGPTPlanUsageIndicator`,
`ChatGPTPlanUsageLimitView`, the `chatGPTPlanWelcomeSheet` and
`chatGPTPlanUsageLimitSheet` modifiers, and the `SignInWithChatGPTModel`
observable.
- DocC article "Sign in with ChatGPT".

### Changed

- `FileCredentialStore` now writes through `OpenClawFileSystem.writePrivateData`:
the file is created with `0600` before any secret is written and atomically
renamed into place (previously it was written, then `chmod`ed), and a missing
parent directory is created with `0700`.
- The Responses stream parser records the error code of `response.failed` and
`error` events.

## 2026.3.0 - 2026-09-29

OpenClawKit 2026.3.0 brings the SDK to feasible parity with upstream OpenClaw
Expand Down
2 changes: 2 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ var targets: [Target] = [
dependencies: [
"OpenClawProtocol",
.product(name: "Crypto", package: "swift-crypto"),
// RS256 verification of Sign in with ChatGPT ID tokens on Linux (Apple platforms use Security).
.product(name: "_CryptoExtras", package: "swift-crypto", condition: .when(platforms: [.linux])),
],
swiftSettings: [
.enableUpcomingFeature("StrictConcurrency"),
Expand Down
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ The repository currently ships:
- layered SwiftPM products for protocol, core runtime, gateway, agents, plugins, channels, memory, media, models, skills and MCP
- an Apple-facing `OpenClawKit` facade for app and gateway-node integrations, plus Apple-only products for native state, App Intents, SwiftUI chat and an offline chat store
- an in-process gateway with a public method-registration API, and a gateway client that speaks OpenClaw protocol v4
- Sign in with ChatGPT, so people can run agents on their ChatGPT plan instead of an API key
- provider routing across OpenAI (Platform and ChatGPT/Codex OAuth), OpenAI-compatible, Anthropic, Google Gemini/Vertex, xAI, Bedrock, Ollama, local runtimes and Apple Foundation Models (on-device and Private Cloud Compute)
- channel adapters with upstream access policy and DM pairing, secret-aware lossless config, session transcripts, diagnostics, replay and security audit tooling
- a published Swift-DocC site plus CI, SwiftLint, and release automation

Current baseline:

- latest release: `2026.3.0`
- latest release: `2026.3.1`
- upstream parity target: OpenClaw `v2026.9.6` at `.codex/openclaw` commit `eb377ac59e`
- gateway protocol: v4 (operator clients negotiate 4; node sessions accept 3...4)
- toolchain: Xcode 27.1 / Swift 6.4 for Apple platforms; the cross-platform modules stay compatible with Swift 6.2 on Linux (`swift-tools-version` 6.2)
Expand All @@ -44,7 +45,7 @@ Add the package with Swift Package Manager:

```swift
dependencies: [
.package(url: "https://github.com/MarcoDotIO/OpenClawKit.git", from: "2026.3.0")
.package(url: "https://github.com/MarcoDotIO/OpenClawKit.git", from: "2026.3.1")
]
```

Expand Down Expand Up @@ -73,7 +74,7 @@ The experimental App Intents model-delegation surface (built on the underscored
```swift
.package(
url: "https://github.com/MarcoDotIO/OpenClawKit.git",
from: "2026.3.0",
from: "2026.3.1",
traits: [.defaults, "ExperimentalAppleModelDelegation"]
)
```
Expand Down Expand Up @@ -141,6 +142,24 @@ For a persistent embedded agent (session and transcript stores, the tool-calling
- Swift tools: `6.2`. Build with Xcode 27.1 (Swift 6.4) on Apple platforms; Xcode's own toolchain is required to use the 27 SDKs.
- Apple 27 APIs (FoundationModels 27, Private Cloud Compute, StateReporting, NowPlaying, App Intents 27, TrustInsights, LinkSecurity, BackgroundTasks async submission, MediaIntelligence, MusicUnderstanding, CoreAI, ScreenCaptureKit on iOS) sit behind `#if compiler(>=6.4)` and per-OS `@available`, so apps with the floors above launch on older systems. `Scripts/check-apple-weak-links.sh` enforces this.

## Highlights in 2026.3.1

- [Sign in with ChatGPT](https://developers.openai.com/siwc): `SignInWithChatGPTSession` runs OpenAI's open-source "ChatGPT plan usage" flow (loopback PKCE sign-in with `dynamic_agent_client` registration, RS256 ID-token validation, multi-account storage, single-flight token refresh, revocation on sign-out) on Apple platforms and Linux.
- `ChatGPTPlanModelProvider` runs inference on the user's ChatGPT plan through the Responses API (`store: false`, streaming, namespaced function tools) and throws typed `ChatGPTPlanError`s such as "usage limit reached".
- `OpenClawChatUI` adds the "Continue with ChatGPT" button, the one-time plan welcome, the "Using ChatGPT plan" indicator and the usage-limit prompt, following OpenAI's UI guidelines.

```swift
let session = SignInWithChatGPTSession(
configuration: SignInWithChatGPTClientConfiguration(agentName: "MyAgent"),
credentialStore: KeychainCredentialStore()
)
let result = try await session.signIn(using: SignInWithChatGPTWebAuthenticationBrowser())
let models = try await ChatGPTPlanModelProvider(tokenProvider: session).listModels()
let provider = ChatGPTPlanModelProvider(tokenProvider: session, defaultModelID: models.first?.slug)
```

See the DocC article "Sign in with ChatGPT" for accounts, errors and UI.

## Highlights in 2026.3.0

- OpenClaw `v2026.9.6` parity: protocol v4 models and method catalog, the upstream gateway client (socket generations, challenge-signed device proof, scoped device tokens, defensive hello-ok), native SQLite state with one-time identity import, and the in-process gateway's registration API, events and startup gating.
Expand Down
Loading
Loading