@kingingwang/pi-linux-arm64 0.99.2 → 1.0.0

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/bin/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.0] - 2026-10-01
4
+
5
+ ### New Features
6
+
7
+ - **Fullscreen by default** — The TUI now runs fullscreen. Set `tuiMode` to `"regular"` to keep the terminal's normal scrollback. See [Terminal and display](docs/settings.md#terminal-and-display).
8
+ - **Leaner codemode** — About 40% fewer prompt tokens, and errors that tell the model how to recover. See [Codemode](docs/codemode.md).
9
+ - **Image generation in codemode** — Scripts call `models.generateImages()` with the session's credentials. See [Generate images](docs/codemode.md#generate-images) and [Use image models](docs/models.md#use-image-models).
10
+ - **Radius in `/login`** — Sign in with Radius and set up its MCP server in one step. See [Radius](docs/providers.md#radius).
11
+ - **Anthropic copy code login** — Sign in when the browser runs on another machine. See [Authenticate interactively](docs/providers.md#authenticate-interactively).
12
+ - **MCP OAuth hardening** — `oauth.authServerMetadataUrl`, RFC 9207 `iss` checks, credentials per server, and step-up sign-in that keeps granted scopes. See [Authenticate with OAuth](docs/mcp.md#authenticate-with-oauth).
13
+ - **Header-only quiet startup** — `quietStartup: "header"` keeps the version and key hints and hides the rest. See [Terminal and display](docs/settings.md#terminal-and-display).
14
+
15
+ ### Added
16
+
17
+ - Added an `oauth.authServerMetadataUrl` setting for MCP servers that advertise a wrong OAuth authorization server or none. Pi uses the configured metadata document instead of discovery ([#10172](https://github.com/earendil-works/pi/issues/10172)).
18
+ - Added `quietStartup: "header"`, which keeps the startup header with version and key hints but hides the model scope line and loaded-resource listing.
19
+ - Added `models.generateImages()` to codemode scripts. It runs image models such as OpenRouter's with the session's credentials and returns base64 image blocks that `image()` attaches to the result; usage counts toward the session cost like `models.classify()`. Extensions can call `ctx.modelRegistry.generateImages()`. See [Use image models](docs/models.md#use-image-models).
20
+ - Added a copy code login method to Anthropic `/login` for headless setups where the browser runs on another machine ([#10194](https://github.com/earendil-works/pi/pull/10194) by [@lucasmeijer](https://github.com/lucasmeijer)).
21
+
22
+ ### Changed
23
+
24
+ - Changed the default TUI mode to fullscreen. Set `tuiMode` to `"regular"` or pass `--tui-mode regular` to keep the terminal's normal scrollback.
25
+ - `/login` now offers "Sign in with Radius" at the top level, as the last option, with its status. After a Radius sign-in, `/login` offers to configure the Radius MCP server in the global `mcp.json` with `"auth": { "provider": "radius" }` and reloads. Cancelling a login returns to the menu it was started from.
26
+ - The provider docs page is renamed to [Providers](docs/providers.md), its "Cloud Providers" section is now "Provider Specific Config", and it documents Radius first.
27
+ - MCP OAuth credentials are now stored per server name and URL, so MCP servers with the same URL can sign in with different accounts. Credentials stored by URL alone move to the first server that uses them ([#10252](https://github.com/earendil-works/pi/issues/10252)).
28
+ - Codemode costs far fewer prompt tokens: with the default tools and codemode active, a GPT-5.6 request shrinks from about 5,300 to 3,300 tokens. The `codemode` description lists the script globals in one line each and points to the new [Codemode](docs/codemode.md) reference for the `models` API, which the model reads when it needs it. Declared tools say in one line how scripts call them and what the call resolves to, instead of repeating their full declaration, and the system prompt's codemode guidance and MCP server section are shorter.
29
+ - Codemode errors now say how to recover: reading a tool or `models` member that does not exist names the close matches (`tools.Bash` suggests `tools.bash`), `models.classify()` and `models.generateImages()` reject malformed arguments with the expected shape, an unknown model points to `models.getAvailableOfType()`, an oversized `store()` value explains what the store is for, and a script that generates images without showing them gets a note. Scripts that probed for a tool with `typeof tools.name` must use `"name" in tools`.
30
+ - `/login` and `/logout` now label providers without credentials as "not configured" instead of "unconfigured".
31
+ - OAuth browser pages now show the color Pi logo.
32
+
33
+ ### Fixed
34
+
35
+ - Fixed MCP OAuth sign-in accepting an authorization response whose `iss` parameter names another authorization server; the code is now rejected before it is exchanged (RFC 9207).
36
+ - Fixed MCP OAuth sign-in failing with `Invalid scope` when the token response contains `"scope": ""`, and similar failures for other empty or `null` optional OAuth fields ([#10266](https://github.com/earendil-works/pi/issues/10266)).
37
+ - Fixed the sign-in URL printed by `/mcp login` not being clickable when it wraps ([#10186](https://github.com/earendil-works/pi/issues/10186)).
38
+ - Fixed `--provider` without `--model` being silently ignored and running the default model from another provider; it now fails with an error ([#10236](https://github.com/earendil-works/pi/issues/10236)).
39
+ - Fixed MCP servers that ask for more scope (`insufficient_scope`) requesting sign-in over and over. The new sign-in requested only the missing scopes, so the new token lost access the previous one had; it now keeps the granted scopes.
40
+ - Fixed user messages in the transcript keeping two full-width copies of every rendered line; they keep one, with identical output.
41
+ - Fixed `/login` and `/logout` labeling every OAuth sign-in, including Radius, as a subscription; only subscription-backed providers say "subscription", other OAuth sign-ins say "account".
42
+ - Fixed the startup header logo rendering with gaps in Apple Terminal; it now shows a colored "Pi" with the version instead.
43
+ - Fixed deferred MCP tools that `tool_search` loaded being dropped on resume and `/reload` even when their server reconnected before the next prompt, because the session restored its tools before the MCP servers reconnected.
44
+ - Fixed the system theme making pastel palettes such as Catppuccin Frappe much more vivid; palette colors now keep their chroma ([#10255](https://github.com/earendil-works/pi/issues/10255), [#10293](https://github.com/earendil-works/pi/pull/10293) by [@dgtlntv](https://github.com/dgtlntv)).
45
+ - Fixed slash command autocompletion not triggering when the input starts with whitespace ([#10218](https://github.com/earendil-works/pi/pull/10218) by [@haoqixu](https://github.com/haoqixu)).
46
+ - Fixed color bleeding past mouse selections and search highlights in fullscreen mode when a styled token ends at the highlight boundary ([#10169](https://github.com/earendil-works/pi/issues/10169)).
47
+ - Fixed memory retained per rendered message in the transcript; a long assistant message keeps about a fifth of the heap it kept before.
48
+
3
49
  ## [0.99.2] - 2026-09-30
4
50
 
5
51
  ### New Features
package/bin/docs/cli.md CHANGED
@@ -58,10 +58,10 @@ RPC mode rejects `@file` arguments. JSON and RPC modes reserve stdout for protoc
58
58
  pi --model sonnet:high
59
59
  ```
60
60
 
61
- See [Choose a Model](models.md) for model selection and [Provider Authentication](providers.md) for credentials.
61
+ See [Choose a Model](models.md) for model selection and [Providers](providers.md) for credentials.
62
62
 
63
63
  - `--provider <name>`<br>
64
- Restricts `--model` lookup to one provider.
64
+ Restricts `--model` lookup to one provider. It requires `--model`.
65
65
  - `--model <pattern>`<br>
66
66
  Selects by exact ID or fuzzy ID/name match. It accepts `provider/id` and an optional `:<thinking>` suffix.
67
67
  - `--api-key <key>`<br>
@@ -161,21 +161,11 @@ This keeps `read`, `bash`, `edit`, and `write` and adds `codemode`. For one invo
161
161
  pi --tools read,bash,edit,write,codemode
162
162
  ```
163
163
 
164
- Codemode is useful without MCP: scripts can run several tool calls in parallel, filter large output before it reaches the model, and call classifier models such as TypeSafe's Jev through `models.classify()` (see [Classifier models](models.md#use-classifier-models)).
164
+ Codemode is useful without MCP: scripts can run several tool calls in parallel, filter large output before it reaches the model, call classifier models such as TypeSafe's Jev through `models.classify()` (see [Classifier models](models.md#use-classifier-models)), and generate images through `models.generateImages()` (see [Image models](models.md#use-image-models)).
165
165
 
166
166
  ### How codemode works
167
167
 
168
- Codemode scripts run in a QuickJS sandbox that can only reach the other tools, through `tools.<name>(args)`; `ALL_TOOLS` lists them. Output comes from `text(value)`, `image(dataUrlOrImageContent)`, `console.*`, and a top-level `return value`; `exit()` ends the script early. The result starts with `Script completed` or `Script failed`, the wall time, and the output; a failed script keeps its partial output, followed by `Script error:` and the error.
169
-
170
- A script may start with an options line such as `// @options: {"max_output_tokens": 2000, "timeout_ms": 60000}`. `max_output_tokens` (default 10000) limits the output: longer output keeps its start and end, and the full text is written to a temp file whose path is included in the result. `timeout_ms` is a hard deadline, unset by default.
171
-
172
- While `codemode` is active, `codemode.mode` in [settings](settings.md#tools) decides how the other tools are presented. With `on` (default) declared tools keep being declared and their descriptions show how to call them from scripts. With `only` they are hidden from the model and listed in the `codemode` description instead, so the model calls them through scripts.
173
-
174
- The `codemode` description lists the callable tools with their TypeScript declarations, grouped by namespace (for example one MCP server). Tools with `deferred` exposure, which includes MCP tools with the default `codemode` exposure, are not listed and do not affect the description, so it stays the same while MCP servers connect. Declarations share a budget of 3000 estimated tokens (`codemode.inlineBudget` in [settings](settings.md#tools)). Scripts find the rest with `await searchTools(query, { limit, namespace })`, which ranks tools with BM25, and `await describeTool(name)`, or by filtering `ALL_TOOLS`. `await describeNamespace(name)` returns a namespace's description, its instructions (for MCP servers, the server instructions), and the names of its tools.
175
-
176
- Tools with an output schema resolve to structured values: `bash` to `{ output, truncated, full_output_path?, exit_code, wall_time_seconds }`, also for non-zero exit codes, and MCP tools to their `CallToolResult`. Other tools resolve to their text output. The `output` of `bash` is not limited to the 2000 lines or 50KB the model sees: it holds up to 1 MiB, and longer output keeps its first and last 512 KiB around an omission marker, with `truncated` set and the full output in `full_output_path`.
177
-
178
- `store(key, value)` and `load(key)` keep JSON values across `codemode` calls: each successful script that stores values appends a `codemode-store` custom entry to the session, so resumed sessions keep the values and each branch sees only the values written on its path. Scripts can also use `models`: `getModelsOfType`, `getAvailableOfType`, and `getModelOfType` list the model catalog, and `classify(model, context)` runs a classifier model with the session's credentials, at most four at a time per script.
168
+ Scripts run in a QuickJS sandbox and reach the other tools through `tools.<name>(args)`. [Codemode](codemode.md) describes the script API, how tools are listed and found, the `store()` and `models` globals, and the limits.
179
169
 
180
170
  ### Tool search
181
171
 
@@ -229,7 +219,7 @@ See [Configuration](configuration.md) for saved configuration, [Security](securi
229
219
  - `--append-system-prompt <text|path>`<br>
230
220
  Appends text or an existing file to the system prompt and is repeatable.
231
221
  - `--tui-mode <mode>`<br>
232
- Uses `regular` or `fullscreen` terminal mode.
222
+ Uses `fullscreen` (default) or `regular` terminal mode.
233
223
  - `--verbose`<br>
234
224
  Shows verbose interactive startup information, overriding `quietStartup`.
235
225
  - `-a`, `--approve`<br>
@@ -292,7 +282,7 @@ Add `--force` to reinstall Pi when the selected update includes Pi.
292
282
  pi auth check --provider openai --json
293
283
  ```
294
284
 
295
- Authentication commands require `--provider <provider>` or `--model <model>`. See [Provider Authentication](providers.md) for supported methods.
285
+ Authentication commands require `--provider <provider>` or `--model <model>`. See [Providers](providers.md) for supported methods.
296
286
 
297
287
  | Command | Description |
298
288
  |---|---|
@@ -0,0 +1,207 @@
1
+ # Codemode
2
+
3
+ The `codemode` tool lets the model write a JavaScript script that calls pi's other tools and runs non-LLM models, such as classifiers and image models. Only the script's output reaches the model, so a script can run calls in parallel and filter large results before the model sees them. To turn it on, see [Enable codemode](cli.md#enable-codemode).
4
+
5
+ ## Scripts
6
+
7
+ The tool input is raw JavaScript source, not JSON and not a markdown code fence. It runs as the body of an async function in a QuickJS sandbox, so top-level `await` and `return` work. The sandbox has no Node APIs, file system, network, or timers; scripts reach the outside world only through tools and `models`.
8
+
9
+ A script may start with an options line:
10
+
11
+ ```js
12
+ // @options: {"max_output_tokens": 2000, "timeout_ms": 60000}
13
+ ```
14
+
15
+ - `max_output_tokens` (default 10000) limits the output. Longer output keeps its start and end, and the full text is written to a temp file whose path is included in the result.
16
+ - `timeout_ms` is a hard deadline for the whole script. It is unset by default. Image generation can take minutes, so do not set a short deadline for scripts that generate images.
17
+
18
+ The result starts with `Script completed` or `Script failed`, the wall time, and the output. A failed script keeps its partial output, followed by `Script error:` and the error. Tool calls are real: calls made before a failure are not undone. Calls still running when the script ends are cancelled, and unawaited promises are discarded.
19
+
20
+ ## Globals
21
+
22
+ | Global | Purpose |
23
+ |---|---|
24
+ | `tools.<name>(args)` | Call a tool. See [Call tools](#call-tools). |
25
+ | `text(value)` | Add a text item to the output. Strings are added as is, other values as JSON. |
26
+ | `image(value)` | Add an image to the output: a base64 `data:` URL, an `{ image_url }` object, or an image block `{ type: "image", data, mimeType }` such as those returned by MCP tools and `models.generateImages()`. Remote URLs are not supported. PNG, JPEG, GIF, and WebP are accepted. |
27
+ | `console.log(...)` | Like `text()`; `info`, `warn`, `error`, and `debug` do the same. |
28
+ | `return value` | A top-level `return` adds the value like `text()`. |
29
+ | `exit()` | End the script successfully. |
30
+ | `store(key, value)` / `load(key)` | Keep small JSON values across `codemode` calls. See [Store values](#store-values). |
31
+ | `ALL_TOOLS` | Every callable tool as `{ name, description }`, including tools the description does not list. |
32
+ | `searchTools(query, { limit?, namespace? })` | Rank callable tools by relevance (BM25, default limit 8). Resolves to `{ name, description }[]`. |
33
+ | `describeTool(name)` | Resolves to a tool's description and TypeScript declaration, or `undefined`. |
34
+ | `describeNamespace(name)` | Resolves to `{ name, description?, instructions?, tools }` for a namespace such as an MCP server, or `undefined`. |
35
+ | `models` | List and run non-LLM models. See [Models](#models). |
36
+
37
+ ## Call tools
38
+
39
+ Every tool the session can call is a method of `tools`, named by its identifier: characters that are not valid in a JavaScript identifier become `_`, so the MCP tool `mcp__dev-radius__search` is `tools.mcp__dev_radius__search`. Each method takes one object with the tool's arguments.
40
+
41
+ What a call resolves to depends on the tool:
42
+
43
+ - Tools with an output schema resolve to a structured value. `bash` resolves to `{ output, truncated, full_output_path?, exit_code, wall_time_seconds }`, also for non-zero exit codes. Its `output` is not limited to the 2000 lines or 50KB the model sees: it holds up to 1 MiB, and longer output keeps its first and last 512 KiB around an omission marker, with `truncated` set and the full output in `full_output_path`.
44
+ - MCP tools resolve to their `CallToolResult`, including `isError` and `structuredContent`.
45
+ - Other tools, such as `read`, `edit`, and `write`, resolve to their text output.
46
+
47
+ A call that fails, is blocked, or gets invalid arguments rejects with an `Error` that carries the tool's error text. Use `Promise.allSettled()` to keep the results of the calls that succeed.
48
+
49
+ The `codemode` description lists tools with their TypeScript declarations, grouped by namespace (for example one MCP server). Tools with `deferred` exposure, which includes MCP tools with the default `codemode` exposure, are not listed, so the description stays the same while MCP servers connect. Listed declarations share a budget of 3000 estimated tokens (`codemode.inlineBudget` in [settings](settings.md#tools)). Scripts find the other tools with `searchTools()`, `describeTool()`, `describeNamespace()`, or by filtering `ALL_TOOLS`.
50
+
51
+ While `codemode` is active, `codemode.mode` in [settings](settings.md#tools) decides how the other tools are presented. With `on` (default) declared tools stay declared, and their descriptions say how to call them from scripts. With `only` they are hidden from the model and listed in the `codemode` description instead, so the model calls them through scripts.
52
+
53
+ ## Store values
54
+
55
+ `store(key, value)` keeps a JSON value under a string key for later `codemode` calls; storing `undefined` deletes the key. `load(key)` returns the value, or `undefined`. Writes are kept only when the script succeeds: each successful script that stores values appends a `codemode-store` custom entry to the session, so resumed sessions keep the values and each branch sees only the values written on its path.
56
+
57
+ The store is for small state such as IDs, cursors, or summaries. One value may have at most 262144 characters of JSON and all values together at most 1048576. Do not store image data; show images with `image()` or write them to a file with a tool.
58
+
59
+ ## Models
60
+
61
+ `models` reaches the model catalog and runs non-LLM models with the session's credentials: classifiers, which answer typed questions about JSON state, and image models, which generate images. Chat models are listed but cannot be run from scripts. Which classifier and image models exist is described in [Use classifier models](models.md#use-classifier-models) and [Use image models](models.md#use-image-models).
62
+
63
+ ```ts
64
+ type ModelType = "chat" | "image" | "classifier";
65
+
66
+ /** A catalog entry. `provider` and `id` identify it; other fields depend on the type. */
67
+ interface ModelInfo {
68
+ type?: ModelType;
69
+ provider: string;
70
+ id: string;
71
+ name: string;
72
+ api: string;
73
+ input: ("text" | "image")[];
74
+ contextWindow?: number;
75
+ [key: string]: unknown;
76
+ }
77
+
78
+ declare const models: {
79
+ /** Every known model of a type, optionally for one provider. */
80
+ getModelsOfType(type: ModelType, provider?: string): Promise<ModelInfo[]>;
81
+ /** Models of a type whose provider has working credentials. */
82
+ getAvailableOfType(type: ModelType, provider?: string): Promise<ModelInfo[]>;
83
+ /** One catalog entry, or undefined. */
84
+ getModelOfType(type: ModelType, provider: string, id: string): Promise<ModelInfo | undefined>;
85
+ /** Answer `context.questions` about `context.state`; answers are in `result.answers` by question ID. */
86
+ classify(model: ModelInfo, context: ClassifierContext): Promise<ClassifierResult>;
87
+ /** Generate images from `context.input` text and image blocks; show `result.output` blocks with image(). Can take minutes. */
88
+ generateImages(model: ModelInfo, context: ImagesContext): Promise<ImagesResult>;
89
+ };
90
+ ```
91
+
92
+ `classify()` and `generateImages()` use only the `provider` and `id` of `model`, so `{ provider, id }` works as well. They do not throw on provider errors: check `stopReason` and `errorMessage`. At most four such calls run at once per script; more calls wait for a free slot, so `Promise.all()` over many items is fine. Their usage is added to the `codemode` tool result and counts toward the session cost.
93
+
94
+ Model IDs differ between providers, for example `typesafe/jev-latest` and `openrouter/typesafe/jev-1.13`. Use `models.getAvailableOfType(type)` to find the IDs that work with the current credentials.
95
+
96
+ ### Classify
97
+
98
+ ```ts
99
+ interface ClassifierContext {
100
+ /** The data to classify. */
101
+ state: Record<string, unknown>;
102
+ /** Questions by ID. One call answers all of them. */
103
+ questions: Record<string, ClassifierQuestion>;
104
+ }
105
+
106
+ type ClassifierQuestion =
107
+ /** Pick one label. `criteria` maps each label to what it means. */
108
+ | { type: "choice"; instructions: string; criteria: Record<string, string> }
109
+ /** Score on an ordered scale. `criteria` describes each level, lowest first. */
110
+ | { type: "score"; instructions: string; criteria: string[] }
111
+ /** Yes or no. */
112
+ | { type: "bool"; instructions: string; criteria: { true: string; false: string } };
113
+
114
+ interface ClassifierResult {
115
+ provider: string;
116
+ model: string;
117
+ /** Answers by question ID. */
118
+ answers: Record<string, ClassifierAnswer>;
119
+ usage?: ModelUsage;
120
+ stopReason: "stop" | "error" | "aborted";
121
+ errorMessage?: string;
122
+ }
123
+
124
+ type ClassifierAnswer =
125
+ | { type: "choice"; choice: string; probabilities: Record<string, number>; confidence: number }
126
+ /** `score` is the expected level index, from 0 to `criteria.length - 1`. */
127
+ | { type: "score"; score: number; confidence: number }
128
+ /** Probability of `true`. */
129
+ | { type: "bool"; probability: number };
130
+
131
+ /** Token counts and cost in USD, when the service reports them. */
132
+ type ModelUsage = { input: number; output: number; totalTokens: number; cost: { total: number } };
133
+ ```
134
+
135
+ Classify several items by calling `classify()` once per item. This script sorts feedback messages, for example ones a tool returned earlier in the script:
136
+
137
+ ```js
138
+ const jev = await models.getModelOfType("classifier", "typesafe", "jev-latest");
139
+ const results = await Promise.all(
140
+ messages.map((message) =>
141
+ models.classify(jev, {
142
+ state: { message },
143
+ questions: {
144
+ sentiment: {
145
+ type: "choice",
146
+ instructions: "How does the user feel about the product?",
147
+ criteria: { positive: "Satisfied or happy", negative: "Unhappy or frustrated", neutral: "Neither" },
148
+ },
149
+ urgency: {
150
+ type: "score",
151
+ instructions: "How urgently does this need a reply?",
152
+ criteria: ["no reply needed", "reply this week", "reply today"],
153
+ },
154
+ },
155
+ }),
156
+ ),
157
+ );
158
+ return results.map((result, i) =>
159
+ result.stopReason === "stop"
160
+ ? { message: messages[i], sentiment: result.answers.sentiment.choice, urgency: result.answers.urgency.score }
161
+ : { message: messages[i], error: result.errorMessage },
162
+ );
163
+ ```
164
+
165
+ ### Generate images
166
+
167
+ ```ts
168
+ interface ImagesContext {
169
+ /** The prompt as text blocks, plus image blocks to edit or use as references. */
170
+ input: (TextBlock | ImageBlock)[];
171
+ }
172
+
173
+ interface ImagesResult {
174
+ provider: string;
175
+ model: string;
176
+ /** Generated images, and text blocks for models that also return text. */
177
+ output: (TextBlock | ImageBlock)[];
178
+ usage?: ModelUsage;
179
+ stopReason: "stop" | "error" | "aborted";
180
+ errorMessage?: string;
181
+ }
182
+
183
+ type TextBlock = { type: "text"; text: string };
184
+ /** `data` is base64. */
185
+ type ImageBlock = { type: "image"; data: string; mimeType: string };
186
+ ```
187
+
188
+ Show generated images with `image(block)`. Do not print `data` with `text()`, `console`, or `return`: it is large and the model cannot read it as text. Generated images are not saved to disk; to keep one, write it to a file with a tool.
189
+
190
+ ```js
191
+ // @options: {"timeout_ms": 300000}
192
+ const painter = await models.getModelOfType("image", "openrouter", "google/gemini-2.5-flash-image");
193
+ const result = await models.generateImages(painter, {
194
+ input: [{ type: "text", text: "A red fox in the snow, watercolor" }],
195
+ });
196
+ if (result.stopReason !== "stop") return result.errorMessage;
197
+ for (const block of result.output) {
198
+ if (block.type === "image") image(block);
199
+ else text(block.text);
200
+ }
201
+ ```
202
+
203
+ ## Limits
204
+
205
+ - A script's VM has 256 MB of memory. Running out throws `InternalError: out of memory`; filter or aggregate large data instead of accumulating it.
206
+ - A script that waits on a promise that can never settle (no tool call pending) fails immediately, since there are no timers.
207
+ - Scripts cannot start other `codemode` scripts.
@@ -136,6 +136,10 @@
136
136
  "title": "CLI",
137
137
  "path": "cli.md"
138
138
  },
139
+ {
140
+ "title": "Codemode",
141
+ "path": "codemode.md"
142
+ },
139
143
  {
140
144
  "title": "Slash Commands",
141
145
  "path": "slash-commands.md"
@@ -153,7 +157,7 @@
153
157
  "path": "keybindings.md"
154
158
  },
155
159
  {
156
- "title": "Provider Authentication",
160
+ "title": "Providers",
157
161
  "path": "providers.md"
158
162
  },
159
163
  {
@@ -6,7 +6,7 @@ Pi uses environment variables in three ways:
6
6
  - Pi sets process markers so child processes can identify Pi as the launching agent.
7
7
  - Commands run by the LLM-callable shell tools receive `PI_*` variables describing the current session.
8
8
 
9
- Provider API-key variables are documented separately in [Provider Authentication](providers.md#use-an-api-key-from-the-environment).
9
+ Provider API-key variables are documented separately in [Providers](providers.md#use-an-api-key-from-the-environment).
10
10
 
11
11
  ## Process Marker
12
12
 
@@ -95,4 +95,4 @@ These variables are read by Pi itself:
95
95
  | `VISUAL`, `EDITOR` | External editor fallback when `externalEditor` is unset |
96
96
  | `HTTP_PROXY`, `HTTPS_PROXY` | Proxy outbound HTTP requests |
97
97
 
98
- Provider credentials such as `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, and cloud-provider configuration are listed in [Provider Authentication](providers.md#use-an-api-key-from-the-environment).
98
+ Provider credentials such as `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, and provider-specific configuration are listed in [Providers](providers.md#use-an-api-key-from-the-environment).
package/bin/docs/index.md CHANGED
@@ -30,7 +30,7 @@ Use the [Quickstart customization chooser](quickstart.md#choose-how-to-customize
30
30
 
31
31
  ## Find reference and setup information
32
32
 
33
- Use the reference pages to look up [CLI options](cli.md), [settings](settings.md), [provider authentication](providers.md), [keybindings](keybindings.md), and [environment variables](environment-variables.md).
33
+ Use the reference pages to look up [CLI options](cli.md), [settings](settings.md), [providers](providers.md), [keybindings](keybindings.md), and [environment variables](environment-variables.md).
34
34
 
35
35
  For platform-specific help, see [Terminal Setup](terminal-setup.md), [Windows](windows.md), [tmux](tmux.md), [Termux on Android](termux.md), or [Containerization](containerization.md).
36
36
 
package/bin/docs/mcp.md CHANGED
@@ -118,6 +118,8 @@ When the server rejects an unauthenticated connection, `/mcp` shows that it need
118
118
 
119
119
  Pi registers itself with the authorization server, stores tokens in `~/.pi/agent/mcp-auth.json`, and refreshes access tokens when they expire or the server rejects them. If a server later requests additional scope, Pi asks for sign-in again. Signing out deletes the stored credentials.
120
120
 
121
+ Credentials belong to a server name and URL. Servers with the same URL under different names, such as one per account, sign in separately; servers with the same name and URL in different `mcp.json` files share one sign-in.
122
+
121
123
  OAuth applies to HTTP servers without an `Authorization` header. For a server that does not support dynamic client registration, configure a registered client:
122
124
 
123
125
  ```json
@@ -147,6 +149,21 @@ Pi registers as `pi`. Some servers only accept registrations from known clients.
147
149
 
148
150
  The name is only sent when Pi registers a client. To register again under a new name, sign out first.
149
151
 
152
+ Pi finds the authorization server through the server's protected resource metadata (RFC 9728) and checks that the authorization server's metadata names the expected issuer (RFC 8414). Some servers advertise the wrong authorization server or none, so sign-in opens a page that does not exist. Set `authServerMetadataUrl` to the metadata document of the right authorization server:
153
+
154
+ ```json
155
+ {
156
+ "mcpServers": {
157
+ "example": {
158
+ "url": "https://mcp.example.com/mcp",
159
+ "oauth": { "authServerMetadataUrl": "https://example.okta.com/.well-known/openid-configuration" }
160
+ }
161
+ }
162
+ }
163
+ ```
164
+
165
+ Pi uses that document instead of discovery and trusts it as configured, so only point it at a document you trust. The URL must use HTTPS, except on `localhost`, `127.0.0.1`, or `[::1]`.
166
+
150
167
  ## Control tool exposure
151
168
 
152
169
  Each server tool is registered as `mcp__<server>__<tool>`. The server's `exposure` determines how the model reaches it:
@@ -18,7 +18,7 @@ Browse the [model catalog](https://pi.dev/models) for current providers, model I
18
18
 
19
19
  Run `/login` and select a provider. Pi stores credentials in [`auth.json`](configuration.md#agent-directory). Run `/logout` to remove stored credentials for a provider.
20
20
 
21
- You can instead provide an API key through the provider's environment variable. This is useful in CI and other environments where Pi should not write credentials. [Provider Authentication](providers.md) lists the variables and cloud-provider setup.
21
+ You can instead provide an API key through the provider's environment variable. This is useful in CI and other environments where Pi should not write credentials. [Providers](providers.md) lists the variables and provider-specific setup.
22
22
 
23
23
  When several credential sources are configured, Pi uses a runtime `--api-key` first, then a stored `auth.json` credential, an `apiKey` from `models.json`, and finally the provider's environment variables or ambient cloud credentials. Provider extensions can define their own authentication behavior.
24
24
 
@@ -131,10 +131,31 @@ const result = await models.classify(jev, {
131
131
  return result.answers;
132
132
  ```
133
133
 
134
+ [Codemode](codemode.md#classify) describes the question and answer types.
135
+
134
136
  When the service reports token counts, as all System One services do, `result.usage` carries them with their cost. Pi adds the usage of a script's classifier calls to the `codemode` tool result, so it counts toward the session cost in the footer and `/session`. The cost uses the model's catalog price; models without one, such as TypeSafe's direct `jev-latest`, report tokens at no cost.
135
137
 
136
138
  Extensions call classifiers through `ctx.modelRegistry.classify()`, without codemode. [Virtual models](virtual-models.md#route-requests) can use them to route requests; see the `jev-router.ts` example.
137
139
 
140
+ ## Use image models
141
+
142
+ Image models generate images from a prompt and optional input images. Pi lists OpenRouter's image models, such as `google/gemini-2.5-flash-image` and `black-forest-labs/flux.2-pro`, under the `openrouter` provider; they use the same `OPENROUTER_API_KEY` or `/login` credential as its chat models.
143
+
144
+ Like classifier models, image models do not appear in `/model`; the model reaches them through the [`codemode`](cli.md#enable-codemode) tool. Scripts list them with `models.getAvailableOfType("image")` and call `models.generateImages(model, { input })`. The result's `output` holds base64 image blocks, which `image()` attaches to the `codemode` result so the model sees them:
145
+
146
+ ```js
147
+ const painter = await models.getModelOfType("image", "openrouter", "google/gemini-2.5-flash-image");
148
+ const result = await models.generateImages(painter, {
149
+ input: [{ type: "text", text: "A red fox in the snow, watercolor" }],
150
+ });
151
+ if (result.stopReason !== "stop") return result.errorMessage;
152
+ for (const block of result.output) if (block.type === "image") image(block);
153
+ ```
154
+
155
+ `input` can also contain `{ type: "image", data, mimeType }` blocks to edit or use as references. Pi adds the usage of a script's image calls to the `codemode` tool result, like classifier calls. Generated images are not saved to disk. [Codemode](codemode.md#generate-images) describes the full API.
156
+
157
+ Extensions generate images through `ctx.modelRegistry.generateImages()`, without codemode.
158
+
138
159
  ## Add a custom provider
139
160
 
140
161
  Use an extension when the provider needs custom streaming, model discovery, or authentication behavior. See [Custom Providers](custom-provider.md) for the extension workflow.
@@ -1,4 +1,4 @@
1
- # Provider Authentication
1
+ # Providers
2
2
 
3
3
  Most hosted providers support one or both of these authentication methods:
4
4
 
@@ -17,8 +17,6 @@ Run `/logout` and select a provider to remove its stored credential. This does n
17
17
 
18
18
  `auth.json` can contain API keys and OAuth tokens. Keep it private and do not commit it.
19
19
 
20
- Radius authentication uses its gateway catalog and caches refreshed model metadata for later offline startup. A custom Radius gateway configured in `models.json` uses its own catalog rather than inheriting the public `radius.pi.dev` catalog.
21
-
22
20
  ## Use an API key from the environment
23
21
 
24
22
  Environment variables are useful in CI and anywhere Pi should not store the key. Set the variable before starting Pi:
@@ -28,7 +26,7 @@ export ANTHROPIC_API_KEY=sk-ant-...
28
26
  pi
29
27
  ```
30
28
 
31
- This table covers providers with a single primary API-key variable. Providers that need additional configuration or support ambient credentials are covered under [Cloud providers](#cloud-providers).
29
+ This table covers providers with a single primary API-key variable. Providers that need additional configuration or support ambient credentials are covered under [Provider Specific Config](#provider-specific-config).
32
30
 
33
31
  | Provider | Environment variable |
34
32
  |---|---|
@@ -85,9 +83,9 @@ To use a secret manager without writing the resolved key to disk, set a provider
85
83
 
86
84
  Pi runs the command when the key is first needed and caches its standard output for the process lifetime. Empty output, a timeout, or a nonzero exit leaves the key unresolved until Pi restarts.
87
85
 
88
- ## Cloud Providers
86
+ ## Provider Specific Config
89
87
 
90
- The providers below need additional settings or can use credentials supplied by their cloud platform.
88
+ The providers below have additional setup, need additional settings, or can use credentials supplied by their platform.
91
89
 
92
90
  A stored API-key credential can include an `env` object. Its values take priority over the process environment for that provider:
93
91
 
@@ -103,6 +101,18 @@ A stored API-key credential can include an `env` object. Its values take priorit
103
101
  }
104
102
  ```
105
103
 
104
+ ### Radius
105
+
106
+ Radius is a service crafted for Pi by the builders of Pi, Earendil Works. It provides a customizable AI gateway with organization-level controls and analytics built in, and artifacts for sharing what you create with Pi.
107
+
108
+ To get started, run `/login radius` in Pi. This adds Radius as a provider, and its models appear in `/model` like any other provider's.
109
+
110
+ Radius also has an MCP server, so Pi can manage Radius for you.
111
+
112
+ Radius is currently in early alpha and evolving quickly. See [radius.earendil.com](https://radius.earendil.com) for more.
113
+
114
+ Radius authentication uses its gateway catalog and caches refreshed model metadata for later offline startup. A custom Radius gateway configured in `models.json` uses its own catalog rather than inheriting the public `radius.pi.dev` catalog.
115
+
106
116
  ### Azure OpenAI
107
117
 
108
118
  Set an API key plus either a base URL or resource name:
package/bin/docs/sdk.md CHANGED
@@ -140,7 +140,7 @@ See the focused examples for [models](../examples/sdk/02-custom-model.ts), [tool
140
140
 
141
141
  ## Resources
142
142
 
143
- - [Choose a Model](models.md) covers model selection and compatible endpoints; [Provider Authentication](providers.md) covers credentials and cloud-provider setup.
143
+ - [Choose a Model](models.md) covers model selection and compatible endpoints; [Providers](providers.md) covers credentials and provider-specific setup.
144
144
  - [Configuration](configuration.md) explains normal discovery and settings; [Settings](settings.md) lists every setting.
145
145
  - [Sessions and Context](sessions.md) explains session behavior; [Session Format](session-format.md) defines persisted entries; [Message Types](message-types.md) defines shared transcript values.
146
146
  - [Extensions](extensions.md), [Skills](skills.md), and [Prompt Templates](prompt-templates.md) document resources supplied through a `ResourceLoader`.
@@ -38,7 +38,7 @@ See [Choose a Model](models.md) for model selection and thinking controls.
38
38
  | Setting | Type | Default | Description |
39
39
  |---|---|---|---|
40
40
  | `defaultTools` | `string[]` | `read`, `bash`, `edit`, `write` | Tools enabled at startup. Plain names replace the defaults; `+name` adds a tool and `-name` removes one. An empty array disables all built-in tools but not extension or SDK tools. |
41
- | `codemode.mode` | `"on"` \| `"only"` | `"on"` | How the `codemode` tool presents tools while it is active. `on`: declared tools get their `codemode` declaration appended to their description, and `codemode` lists only tools that are not declared. `only`: `codemode` lists every tool scripts can call, and active built-in and extension tools are hidden from the model, so it reaches them through `codemode`. |
41
+ | `codemode.mode` | `"on"` \| `"only"` | `"on"` | How the `codemode` tool presents tools while it is active. `on`: declared tools get a note on calling them from scripts appended to their description, and `codemode` lists only tools that are not declared. `only`: `codemode` lists every tool scripts can call, and active built-in and extension tools are hidden from the model, so it reaches them through `codemode`. |
42
42
  | `codemode.inlineBudget` | number | `3000` | Estimated tokens (characters / 4) the `codemode` tool's description may spend on tool declarations. Tools that do not fit are left out and found with `searchTools()`. `0` lists only namespaces. |
43
43
 
44
44
  Available built-in tools are `read`, `bash`, `powershell`, `edit`, `write`, `grep`, `find`, and `ls`. `defaultTools` can also name `codemode` and `tool_search`, which built-in extensions register inactive, and other extension tools registered inactive.
@@ -90,8 +90,8 @@ See [Compaction Reference](compaction.md) for trigger, summarization, and valida
90
90
  | Setting | Type | Default | Description |
91
91
  |---|---|---|---|
92
92
  | `theme` | string | `"system"` | Built-in or custom theme name. `system` derives colors from the terminal theme. |
93
- | `quietStartup` | boolean | `false` | Hide the startup header. |
94
- | `tuiMode` | `"regular" \| "fullscreen"` | `"regular"` | Interactive terminal UI mode. |
93
+ | `quietStartup` | boolean \| `"header"` | `false` | `true` hides the startup header and loaded-resource listing. `"header"` keeps the header (version and key hints) but hides the model scope line and loaded-resource listing. |
94
+ | `tuiMode` | `"regular" \| "fullscreen"` | `"fullscreen"` | Interactive terminal UI mode. |
95
95
  | `fullscreenExitOutput` | `"transcript" \| "resume-hint"` | `"transcript"` | Output printed when fullscreen mode exits. |
96
96
  | `fullscreenScrollbar` | `"auto" \| "always" \| "hidden"` | `"auto"` | Fullscreen transcript scrollbar behavior. |
97
97
  | `fullscreenCopyOnSelect` | boolean | `true` | Copy selected text automatically in fullscreen mode. |
package/bin/docs/usage.md CHANGED
@@ -83,7 +83,7 @@ Use `/share` to upload the session and get a viewer link. With Radius authentica
83
83
 
84
84
  ## Adjust the terminal
85
85
 
86
- Regular mode uses the terminal's normal scrollback. Fullscreen mode keeps the editor and status area fixed while the transcript scrolls within the terminal window. Choose a mode through `/settings` or `--tui-mode`.
86
+ Fullscreen mode, the default, keeps the editor and status area fixed while the transcript scrolls within the terminal window. Regular mode uses the terminal's normal scrollback. Choose a mode through `/settings` or `--tui-mode`.
87
87
 
88
88
  Terminal support for mouse input, keyboard shortcuts, and inline images varies. See [Terminal Setup](terminal-setup.md) for platform-specific configuration and [Keybindings](keybindings.md) for every configurable shortcut. Run `/hotkeys` to inspect the shortcuts active in your current session.
89
89
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "0.99.2",
3
+ "version": "1.0.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "0.99.2",
9
+ "version": "1.0.0",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "0.99.2",
4
+ "version": "1.0.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "0.99.2",
4
+ "version": "1.0.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-gondolin",
3
- "version": "0.99.2",
3
+ "version": "1.0.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-gondolin",
9
- "version": "0.99.2",
9
+ "version": "1.0.0",
10
10
  "dependencies": {
11
11
  "@earendil-works/gondolin": "0.12.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-gondolin",
3
3
  "private": true,
4
- "version": "0.99.2",
4
+ "version": "1.0.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
- "version": "0.99.2",
3
+ "version": "1.0.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-sandbox",
9
- "version": "0.99.2",
9
+ "version": "1.0.0",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sandbox-runtime": "^0.0.26"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
3
  "private": true,
4
- "version": "0.99.2",
4
+ "version": "1.0.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
- "version": "0.99.2",
3
+ "version": "1.0.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-with-deps",
9
- "version": "0.99.2",
9
+ "version": "1.0.0",
10
10
  "dependencies": {
11
11
  "ms": "^2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
3
  "private": true,
4
- "version": "0.99.2",
4
+ "version": "1.0.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
package/bin/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earendil-works/pi-coding-agent",
3
- "version": "0.99.2",
3
+ "version": "1.0.0",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {
@@ -49,12 +49,12 @@
49
49
  "prepublishOnly": "npm run clean && npm run build && npm run shrinkwrap"
50
50
  },
51
51
  "dependencies": {
52
- "@earendil-works/chord": "^0.99.2",
53
- "@earendil-works/pi-agent-core": "^0.99.2",
54
- "@earendil-works/pi-ai": "^0.99.2",
55
- "@earendil-works/pi-codemode": "^0.99.2",
56
- "@earendil-works/pi-mcp": "^0.99.2",
57
- "@earendil-works/pi-tui": "^0.99.2",
52
+ "@earendil-works/chord": "^1.0.0",
53
+ "@earendil-works/pi-agent-core": "^1.0.0",
54
+ "@earendil-works/pi-ai": "^1.0.0",
55
+ "@earendil-works/pi-codemode": "^1.0.0",
56
+ "@earendil-works/pi-mcp": "^1.0.0",
57
+ "@earendil-works/pi-tui": "^1.0.0",
58
58
  "@silvia-odwyer/photon-node": "0.3.4",
59
59
  "chalk": "6.0.0",
60
60
  "cross-spawn": "7.0.6",
@@ -76,9 +76,9 @@
76
76
  "protobufjs": "7.6.6"
77
77
  },
78
78
  "devDependencies": {
79
- "@earendil-works/pi-client": "^0.99.2",
80
- "@earendil-works/pi-protocol": "^0.99.2",
81
- "@earendil-works/pi-server": "^0.99.2",
79
+ "@earendil-works/pi-client": "^1.0.0",
80
+ "@earendil-works/pi-protocol": "^1.0.0",
81
+ "@earendil-works/pi-server": "^1.0.0",
82
82
  "@types/cross-spawn": "6.0.6",
83
83
  "@types/hosted-git-info": "3.0.5",
84
84
  "@types/node": "22.19.19",
package/bin/pi CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bin/pi
3
- size: 107325584 bytes
4
- sha256: e99d73b46b55a4a9612f5c63939df9930d0f9a050b95a3cf2d4016c7f37438eb
3
+ size: 106932368 bytes
4
+ sha256: 05a641925d5796e83fbf875572b997f749a9fed35bc65aeb9377e39e2542063e
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingingwang/pi-linux-arm64",
3
- "version": "0.99.2",
3
+ "version": "1.0.0",
4
4
  "description": "Pi standalone binary for linux-arm64 (fork distribution)",
5
5
  "license": "MIT",
6
6
  "os": [