pi-anthropic-oauth 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  Use Claude Pro/Max in Pi with browser OAuth.
6
6
 
7
7
  > [!IMPORTANT]
8
- > This release requires Pi 0.80.8 or later in the 0.80.x release line.
8
+ > This extension supports Pi 0.80.8 or later.
9
9
 
10
10
  ## Features
11
11
 
@@ -13,8 +13,7 @@ Use Claude Pro/Max in Pi with browser OAuth.
13
13
  - Automatic token refresh
14
14
  - Claude Code-compatible OAuth headers and prompt shaping
15
15
  - No Anthropic API key needed
16
- - Uses Pi's Anthropic model registry
17
- - Adds Claude Opus 4.8 and Claude Fable 5 by default
16
+ - Uses the Anthropic models available in Pi's built-in model registry
18
17
  - Auto-creates `~/.Claude Code` → `~/.pi` symlink when missing
19
18
 
20
19
  ## Quick start
@@ -101,7 +100,7 @@ To add another Anthropic model, create `~/.pi/agent/models.json`:
101
100
  ```
102
101
 
103
102
  > [!NOTE]
104
- > Opus 4.8 and Fable 5 are included in Pi's built-in Anthropic model catalog.
103
+ > Opus 5 and Fable 5 are included in Pi's built-in Anthropic model catalog as `claude-opus-5` and `claude-fable-5`.
105
104
  >
106
105
  > Pi requires `baseUrl`, `apiKey`, and `api` when defining custom models in `models.json`. With this extension, requests normally authenticate through Claude Pro/Max OAuth after `/login`, so `apiKey` is only a placeholder to satisfy Pi's config requirements and does not need to be a valid Anthropic API key.
107
106
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-anthropic-oauth",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Claude Pro/Max OAuth extension for Pi",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,8 +38,8 @@
38
38
  "@anthropic-ai/sdk": "^0.52.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@earendil-works/pi-ai": "^0.80.8",
42
- "@earendil-works/pi-coding-agent": "^0.80.8"
41
+ "@earendil-works/pi-ai": ">=0.80.8",
42
+ "@earendil-works/pi-coding-agent": ">=0.80.8"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@earendil-works/pi-ai": "^0.80.8",
package/src/prompt.ts CHANGED
@@ -32,7 +32,15 @@ type MessageContentBlock = {
32
32
  };
33
33
 
34
34
  export function sanitizeSurrogates(text: string): string {
35
- return text.replace(/[\uD800-\uDFFF]/g, "\uFFFD");
35
+ // Replace only *unpaired* surrogates: a high surrogate not followed by a low
36
+ // surrogate, or a low surrogate not preceded by a high surrogate. Valid
37
+ // surrogate pairs (non-BMP characters such as emoji) must pass through
38
+ // untouched. Equivalent to String.prototype.toWellFormed(), which requires
39
+ // Node 20+ while this package supports Node >=18.
40
+ return text.replace(
41
+ /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,
42
+ "\uFFFD",
43
+ );
36
44
  }
37
45
 
38
46
  export function buildAnthropicSystemPrompt(