@sandagent/runner-cli 0.6.0 → 0.6.2

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.
Files changed (2) hide show
  1. package/dist/bundle.mjs +26 -4
  2. package/package.json +3 -3
package/dist/bundle.mjs CHANGED
@@ -1159,7 +1159,7 @@ function createOpenCodeRunner(options = {}) {
1159
1159
  import { appendFileSync as appendFileSync2, existsSync as existsSync3, unlinkSync as unlinkSync2 } from "node:fs";
1160
1160
  import { join as join3 } from "node:path";
1161
1161
  import { getModel } from "@mariozechner/pi-ai";
1162
- import { SessionManager, createAgentSession } from "@mariozechner/pi-coding-agent";
1162
+ import { AuthStorage, ModelRegistry, SessionManager, createAgentSession } from "@mariozechner/pi-coding-agent";
1163
1163
  function parseModelSpec(model) {
1164
1164
  const trimmed = model.trim();
1165
1165
  const separator = trimmed.indexOf(":");
@@ -1252,9 +1252,30 @@ function createPiRunner(options = {}) {
1252
1252
  }
1253
1253
  const { provider, modelName } = parseModelSpec(modelSpec.trim());
1254
1254
  const cwd = options.cwd || process.cwd();
1255
- const model = getModel(provider, modelName);
1255
+ const modelRegistry = new ModelRegistry(AuthStorage.create());
1256
+ let model = getModel(provider, modelName);
1256
1257
  if (model == null) {
1257
- throw new Error(`Pi runner: unsupported model "${modelSpec}". getModel("${provider}", "${modelName}") returned undefined. Use a model from the pi-ai catalog; supported providers are typically: google, openai.`);
1258
+ const baseUrlEnvKey = `${provider.toUpperCase().replace(/-/g, "_")}_BASE_URL`;
1259
+ const apiKeyEnvKey = `${provider.toUpperCase().replace(/-/g, "_")}_API_KEY`;
1260
+ const baseUrl = process.env[baseUrlEnvKey] ?? process.env.OPENAI_BASE_URL;
1261
+ if (!baseUrl) {
1262
+ throw new Error(`Pi runner: model "${modelSpec}" not found in built-in catalog. Set ${baseUrlEnvKey} (or OPENAI_BASE_URL) to auto-register it.`);
1263
+ }
1264
+ modelRegistry.registerProvider(provider, {
1265
+ baseUrl,
1266
+ apiKey: apiKeyEnvKey,
1267
+ api: "openai-completions",
1268
+ models: [{
1269
+ id: modelName,
1270
+ name: modelName,
1271
+ reasoning: false,
1272
+ input: ["text"],
1273
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
1274
+ contextWindow: 128e3,
1275
+ maxTokens: 8192
1276
+ }]
1277
+ });
1278
+ model = modelRegistry.find(provider, modelName);
1258
1279
  }
1259
1280
  applyModelOverrides(model, provider, options.env);
1260
1281
  return {
@@ -1274,7 +1295,8 @@ function createPiRunner(options = {}) {
1274
1295
  const { session } = await createAgentSession({
1275
1296
  cwd,
1276
1297
  model,
1277
- sessionManager
1298
+ sessionManager,
1299
+ modelRegistry
1278
1300
  });
1279
1301
  if (options.systemPrompt != null && options.systemPrompt !== "") {
1280
1302
  session.agent.setSystemPrompt(options.systemPrompt);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sandagent/runner-cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "SandAgent Runner CLI - Like gemini-cli or claude-code, runs in your local terminal with AI SDK UI streaming",
5
5
  "type": "module",
6
6
  "bin": {
@@ -54,11 +54,11 @@
54
54
  "esbuild": "^0.27.2",
55
55
  "typescript": "^5.3.0",
56
56
  "vitest": "^1.6.1",
57
- "@sandagent/runner-codex": "0.1.0",
58
57
  "@sandagent/runner-claude": "0.1.2",
58
+ "@sandagent/runner-codex": "0.1.0",
59
59
  "@sandagent/runner-gemini": "0.1.0",
60
60
  "@sandagent/runner-opencode": "0.1.0",
61
- "@sandagent/runner-pi": "0.6.0"
61
+ "@sandagent/runner-pi": "0.6.2"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "tsc && pnpm bundle",