localpi 0.6.1 → 0.6.3

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
@@ -109,6 +109,10 @@ Localpi launches Pi with:
109
109
  - in-session `/thinking` (Pi's own command) and `/approval` (localpi's) for changing session settings
110
110
  - local state under `~/.local/state/localpi`
111
111
 
112
+ Pi owns stdout. Localpi writes its own diagnostics, including the connection summary and catalog
113
+ warnings, to stderr. A machine-readable Pi mode such as `--mode rpc` or `--mode json` therefore stays
114
+ parseable, and a batch run keeps a clean stdout.
115
+
112
116
  The approval gate makes failed or denied tool calls explicit to the model so the model does not claim that a blocked command ran.
113
117
 
114
118
  ## Skills
@@ -524,6 +528,7 @@ demowall record --session demowall-<timestamp> --out demo.mp4 --seconds 60
524
528
  - `--max-tokens <n>`: generated model max output tokens
525
529
  - `--continue-on-truncation <n>`: continue a reply cut off by the output limit, up to `n` times. Off by default, and `LOCALPI_CONTINUE_ON_TRUNCATION=<n>` sets the same limit
526
530
  - `--base-url <url>`: OpenAI-compatible endpoint for LM Studio or custom endpoints
531
+ - `--api-key <value>`: Pi provider API key for this run. A literal value, an environment reference such as `${NAME}`, or a `!command`. Default: `local`. `LOCALPI_API_KEY` sets the same value
527
532
  - `--server-command <path>`: `llama-server` executable path
528
533
  - `--llama-server <path>`: alias for `--server-command`
529
534
  - `--host <host>`: managed `llama-server` host. Default: `127.0.0.1`
@@ -583,6 +588,7 @@ explicit `PI_OFFLINE=0` or `PI_OFFLINE=1` always wins.
583
588
  - `LOCALPI_MODEL`
584
589
  - `LOCALPI_PROVIDER`
585
590
  - `LOCALPI_BASE_URL`
591
+ - `LOCALPI_API_KEY`
586
592
  - `LOCALPI_PROVIDERS_FILE`
587
593
  - `LOCALPI_MODEL_PROFILE`
588
594
  - `LOCALPI_MODEL_REASONING`
@@ -307,7 +307,13 @@ async function launchResolvedRuntime(app, connection) {
307
307
  if (code !== 0) {
308
308
  return { code, stdout: "", stderr: "" };
309
309
  }
310
- return ok(connection.warnings.length === 0 ? "" : connectionStatus(connection));
310
+ // Pi owns stdout. Localpi reports its own diagnostics on stderr, so a machine-readable Pi mode
311
+ // such as --mode rpc or --mode json stays parseable.
312
+ return {
313
+ code: 0,
314
+ stdout: "",
315
+ stderr: connection.warnings.length === 0 ? "" : connectionStatus(connection)
316
+ };
311
317
  }
312
318
  /**
313
319
  * ACP mode keeps stdout for the protocol only, so localpi reports its own diagnostics on stderr and
@@ -19,6 +19,7 @@ export function defaultOptions() {
19
19
  return {
20
20
  runtime: parseRuntime(envString("LOCALPI_RUNTIME", "auto")),
21
21
  baseUrl: envOptionalBaseUrl("LOCALPI_BASE_URL"),
22
+ apiKey: envString("LOCALPI_API_KEY", "local"),
22
23
  model: process.env["LOCALPI_MODEL"],
23
24
  provider: process.env["LOCALPI_PROVIDER"],
24
25
  customProviderId: envString("LOCALPI_PROVIDER_ID", "local-openai"),
@@ -100,6 +101,8 @@ export function usage() {
100
101
  " --provider <id> catalog provider id to use",
101
102
  " --model <alias|id|path> model alias, backend id, or GGUF path",
102
103
  " --base-url <url> OpenAI-compatible endpoint",
104
+ " --api-key <value> Pi provider API key: a literal, ${NAME}, or !command",
105
+ " (LOCALPI_API_KEY=<value>, default: local)",
103
106
  " --ctx <n> model context window",
104
107
  " --context-window <n> alias for --ctx",
105
108
  " --max-tokens <n> generated model max output tokens",
@@ -189,6 +192,7 @@ const booleanFlagUpdaters = {
189
192
  const valueFlagUpdaters = {
190
193
  "--runtime": (options, value) => ({ ...options, runtime: parseRuntime(value) }),
191
194
  "--base-url": (options, value) => ({ ...options, baseUrl: normalizeBaseUrl(value) }),
195
+ "--api-key": (options, value) => ({ ...options, apiKey: value }),
192
196
  "--model": (options, value) => ({ ...options, model: value }),
193
197
  "--provider": (options, value) => ({ ...options, provider: value }),
194
198
  "--provider-id": (options, value) => ({ ...options, customProviderId: value }),
@@ -86,7 +86,7 @@ function providersForConnection(options, connection) {
86
86
  id: group.providerId,
87
87
  baseUrl: group.baseUrl,
88
88
  api: "openai-completions",
89
- apiKey: "local",
89
+ apiKey: options.apiKey,
90
90
  compat: {
91
91
  supportsDeveloperRole: false,
92
92
  supportsReasoningEffort: false
@@ -110,6 +110,7 @@ Localpi:
110
110
  - can use `--provider <id>` to name the generated Pi provider
111
111
  - uses `/v1/models` for discovery
112
112
  - avoids assuming it can start, stop, or unload the backend
113
+ - writes the `--api-key` value as the generated Pi provider key, exactly as given, so an environment reference such as `${HF_TOKEN}` or a `!command` keeps the secret out of the Pi config. The default is `local`, which local engines accept and ignore
113
114
 
114
115
  ### Configured Providers
115
116
 
@@ -200,6 +201,10 @@ Localpi installs two default extensions:
200
201
  - tool approval gate: ask before each tool call, and tell the model clearly when a tool call was blocked
201
202
  - token status: show live generation speed while streaming, then final prefill and generation rates when usage data is available
202
203
 
204
+ Pi owns stdout. Localpi writes its own diagnostics, including the connection summary
205
+ and catalog warnings, to stderr, so a machine-readable Pi mode such as `--mode rpc`
206
+ or `--mode json` stays parseable and a batch run keeps a clean stdout.
207
+
203
208
  ## System Prompt
204
209
 
205
210
  Localpi appends a short system prompt that tells the model:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "localpi",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Swiss army knife for running Pi with local inference engines.",
5
5
  "type": "module",
6
6
  "license": "MIT",