@exreve/exk 1.0.28 → 1.0.30

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.
@@ -178,12 +178,17 @@ function loadAiConfig() {
178
178
  const model = typeof config.model === 'string' && config.model.trim() ? config.model.trim() : DEFAULT_AI_MODEL;
179
179
  const proxy = typeof config.proxy === 'string' ? config.proxy.trim() : '';
180
180
  const minimaxApiKey = typeof config.minimaxApiKey === 'string' ? config.minimaxApiKey.trim() : '';
181
- return { apiKey, baseUrl, model, proxy, minimaxApiKey };
181
+ const openrouterApiKey = typeof config.openrouterApiKey === 'string' ? config.openrouterApiKey.trim() : '';
182
+ return { apiKey, baseUrl, model, proxy, minimaxApiKey, openrouterApiKey };
182
183
  }
183
184
  catch {
184
- return { apiKey: '', baseUrl: '', model: DEFAULT_AI_MODEL, proxy: '', minimaxApiKey: '' };
185
+ return { apiKey: '', baseUrl: '', model: DEFAULT_AI_MODEL, proxy: '', minimaxApiKey: '', openrouterApiKey: '' };
185
186
  }
186
187
  }
188
+ /** Get OpenRouter API key from ai-config.json (served by backend) */
189
+ export function getOpenrouterApiKey() {
190
+ return loadAiConfig().openrouterApiKey || process.env.OPENROUTER_API_KEY || '';
191
+ }
187
192
  /** Create (or reuse) an empty directory to use as CLAUDE_CONFIG_DIR.
188
193
  * Setting this prevents the spawned Claude CLI from reading ~/.claude/settings.json,
189
194
  * which may contain env.ANTHROPIC_BASE_URL pointing to z.ai and would override our
@@ -514,9 +519,7 @@ export class AgentSessionManager {
514
519
  apiKey: CLAUDE_CONFIG.apiKey,
515
520
  model: CLAUDE_CONFIG.model,
516
521
  tools: { type: 'preset', preset: 'claude_code' },
517
- disallowedTools: attachmentDir
518
- ? ['AskUserQuestion', 'analyze_image'] // Disable built-in analyze_image when we have our own
519
- : ['AskUserQuestion'],
522
+ disallowedTools: ['AskUserQuestion', 'analyze_image'], // Disable built-in analyze_image (we provide our own via MCP)
520
523
  settingSources: ['project'], // Enable CLAUDE.md loading
521
524
  permissionMode: 'bypassPermissions',
522
525
  allowDangerouslySkipPermissions: true,
@@ -10,6 +10,7 @@ import { z } from 'zod';
10
10
  import * as fs from 'fs';
11
11
  import * as path from 'path';
12
12
  import * as os from 'os';
13
+ import { getOpenrouterApiKey } from './agentSession.js';
13
14
  /**
14
15
  * Create a tool for the user-choice module
15
16
  */
@@ -99,7 +100,7 @@ function createAnalyzeImageTool(attachmentDir) {
99
100
  image_path: z.string().describe('Path to the image file to analyze (can be relative to working directory, e.g. "attachments/photo.jpg")'),
100
101
  question: z.string().describe('Question or instruction about the image. Be specific about what you want to know.'),
101
102
  }, async (args) => {
102
- const apiKey = process.env.OPENROUTER_API_KEY || '';
103
+ const apiKey = getOpenrouterApiKey();
103
104
  if (!apiKey) {
104
105
  return { content: [{ type: 'text', text: 'Error: OPENROUTER_API_KEY not configured.' }], isError: true };
105
106
  }
@@ -148,10 +149,8 @@ function getModuleTools(config) {
148
149
  if (config.enabledModules.includes('user-choice')) {
149
150
  tools.push(createUserChoiceTool(config.onChoiceRequest));
150
151
  }
151
- // Always add analyze_image tool if attachmentDir is provided (i.e. there are attachments)
152
- if (config.attachmentDir) {
153
- tools.push(createAnalyzeImageTool(config.attachmentDir));
154
- }
152
+ // Always add analyze_image tool (uses OpenRouter key from ai-config via backend)
153
+ tools.push(createAnalyzeImageTool(config.attachmentDir));
155
154
  // Add more module tools here as they are implemented
156
155
  return tools;
157
156
  }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exreve/exk",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "exk - Control Claude CLI with voice and programmable interfaces",
5
5
  "type": "module",
6
6
  "bin": {