@kibibot/cli 1.0.0 → 1.0.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.
- package/dist/commands/llm.js +41 -42
- package/dist/lib/api.js +1 -1
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.js +1 -1
- package/package.json +1 -1
package/dist/commands/llm.js
CHANGED
|
@@ -111,8 +111,8 @@ export function registerLlm(program) {
|
|
|
111
111
|
// ── llm setup ─────────────────────────────────────────
|
|
112
112
|
llmCmd
|
|
113
113
|
.command('setup <target>')
|
|
114
|
-
.description('Generate config for
|
|
115
|
-
.option('--install', 'Write config directly
|
|
114
|
+
.description('Generate config for OpenClaw')
|
|
115
|
+
.option('--install', 'Write config directly to ~/.openclaw/openclaw.json')
|
|
116
116
|
.action(async (target, opts, cmd) => {
|
|
117
117
|
const config = readConfig();
|
|
118
118
|
const apiKey = config.apiKey || process.env['KIBI_API_KEY'];
|
|
@@ -122,57 +122,41 @@ export function registerLlm(program) {
|
|
|
122
122
|
process.exit(1);
|
|
123
123
|
}
|
|
124
124
|
switch (target.toLowerCase()) {
|
|
125
|
-
case 'cursor': {
|
|
126
|
-
console.log();
|
|
127
|
-
console.log(chalk.bold.cyan('Cursor IDE Configuration'));
|
|
128
|
-
console.log(chalk.dim('─'.repeat(40)));
|
|
129
|
-
console.log();
|
|
130
|
-
console.log('Add this to your Cursor settings (Settings → Models → OpenAI API Key):');
|
|
131
|
-
console.log();
|
|
132
|
-
console.log(` ${chalk.bold('API Base URL:')} ${llmUrl}`);
|
|
133
|
-
console.log(` ${chalk.bold('API Key:')} ${apiKey}`);
|
|
134
|
-
console.log();
|
|
135
|
-
console.log(chalk.yellow('⚠ Your API key is shown above. Do not share this output.'));
|
|
136
|
-
console.log(chalk.dim('Then select a Kibi model from the model dropdown.'));
|
|
137
|
-
console.log();
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
case 'claude': {
|
|
141
|
-
console.log();
|
|
142
|
-
console.log(chalk.bold.cyan('Claude Code Configuration'));
|
|
143
|
-
console.log(chalk.dim('─'.repeat(40)));
|
|
144
|
-
console.log();
|
|
145
|
-
console.log('Set these environment variables:');
|
|
146
|
-
console.log();
|
|
147
|
-
console.log(` export ANTHROPIC_BASE_URL="${llmUrl}"`);
|
|
148
|
-
console.log(` export ANTHROPIC_API_KEY="${apiKey}"`);
|
|
149
|
-
console.log();
|
|
150
|
-
console.log(chalk.yellow('⚠ Your API key is shown above. Do not share this output.'));
|
|
151
|
-
console.log(chalk.dim('Then run `claude` as usual.'));
|
|
152
|
-
console.log();
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
125
|
case 'openclaw': {
|
|
126
|
+
const baseUrl = llmUrl.replace(/\/v1\/?$/, '');
|
|
156
127
|
const openclawConfig = {
|
|
157
128
|
models: {
|
|
158
129
|
mode: 'merge',
|
|
159
130
|
providers: {
|
|
160
131
|
kibi: {
|
|
161
|
-
baseUrl
|
|
132
|
+
baseUrl,
|
|
162
133
|
apiKey: apiKey,
|
|
163
134
|
api: 'openai-completions',
|
|
164
135
|
models: [
|
|
165
|
-
{ id: '
|
|
166
|
-
{ id: '
|
|
167
|
-
{ id: '
|
|
168
|
-
{ id: '
|
|
169
|
-
{ id: '
|
|
170
|
-
{ id: 'gemini-
|
|
171
|
-
{ id: 'gemini-
|
|
136
|
+
{ id: 'kibi-haiku', name: 'Claude Haiku · Kibi', api: 'anthropic-messages', contextWindow: 200000, maxTokens: 4096 },
|
|
137
|
+
{ id: 'kibi-sonnet', name: 'Claude Sonnet · Kibi', api: 'anthropic-messages', contextWindow: 200000, maxTokens: 8192 },
|
|
138
|
+
{ id: 'kibi-opus', name: 'Claude Opus · Kibi', api: 'anthropic-messages', contextWindow: 200000, maxTokens: 32000 },
|
|
139
|
+
{ id: 'kibi-gpt4o', name: 'GPT-4o · Kibi', contextWindow: 128000, maxTokens: 16384 },
|
|
140
|
+
{ id: 'kibi-gpt4o-mini', name: 'GPT-4o Mini · Kibi', contextWindow: 128000, maxTokens: 16384 },
|
|
141
|
+
{ id: 'kibi-gemini-flash', name: 'Gemini Flash · Kibi', contextWindow: 1048576, maxTokens: 8192 },
|
|
142
|
+
{ id: 'kibi-gemini-pro', name: 'Gemini Pro · Kibi', contextWindow: 2097152, maxTokens: 8192 },
|
|
172
143
|
],
|
|
173
144
|
},
|
|
174
145
|
},
|
|
175
146
|
},
|
|
147
|
+
agents: {
|
|
148
|
+
defaults: {
|
|
149
|
+
models: {
|
|
150
|
+
'kibi/kibi-haiku': { alias: 'kibi-haiku' },
|
|
151
|
+
'kibi/kibi-sonnet': { alias: 'kibi-sonnet' },
|
|
152
|
+
'kibi/kibi-opus': { alias: 'kibi-opus' },
|
|
153
|
+
'kibi/kibi-gpt4o': { alias: 'kibi-gpt4o' },
|
|
154
|
+
'kibi/kibi-gpt4o-mini': { alias: 'kibi-gpt4o-mini' },
|
|
155
|
+
'kibi/kibi-gemini-flash': { alias: 'kibi-gemini-flash' },
|
|
156
|
+
'kibi/kibi-gemini-pro': { alias: 'kibi-gemini-pro' },
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
176
160
|
};
|
|
177
161
|
if (opts.install) {
|
|
178
162
|
try {
|
|
@@ -193,11 +177,26 @@ export function registerLlm(program) {
|
|
|
193
177
|
else {
|
|
194
178
|
mkdirSync(configDir, { recursive: true });
|
|
195
179
|
}
|
|
196
|
-
// Deep merge
|
|
180
|
+
// Deep merge providers
|
|
197
181
|
existing.models = existing.models || {};
|
|
198
182
|
existing.models.mode = 'merge';
|
|
199
183
|
existing.models.providers = existing.models.providers || {};
|
|
200
184
|
existing.models.providers.kibi = openclawConfig.models.providers.kibi;
|
|
185
|
+
// Remove old kibi-oai provider if present (migrating from v1.3.0)
|
|
186
|
+
if (existing.models.providers['kibi-oai']) {
|
|
187
|
+
delete existing.models.providers['kibi-oai'];
|
|
188
|
+
}
|
|
189
|
+
// Deep merge agents.defaults.models (allowlist + aliases)
|
|
190
|
+
existing.agents = existing.agents || {};
|
|
191
|
+
existing.agents.defaults = existing.agents.defaults || {};
|
|
192
|
+
existing.agents.defaults.models = existing.agents.defaults.models || {};
|
|
193
|
+
Object.assign(existing.agents.defaults.models, openclawConfig.agents.defaults.models);
|
|
194
|
+
// Clean up old kibi-oai/* allowlist entries
|
|
195
|
+
for (const key of Object.keys(existing.agents.defaults.models)) {
|
|
196
|
+
if (key.startsWith('kibi-oai/')) {
|
|
197
|
+
delete existing.agents.defaults.models[key];
|
|
198
|
+
}
|
|
199
|
+
}
|
|
201
200
|
writeFileSync(configPath, JSON.stringify(existing, null, 2) + '\n', 'utf-8');
|
|
202
201
|
success(`Kibi provider added to ${configPath}`);
|
|
203
202
|
console.log(chalk.dim(' Restart OpenClaw: openclaw gateway restart'));
|
|
@@ -222,7 +221,7 @@ export function registerLlm(program) {
|
|
|
222
221
|
break;
|
|
223
222
|
}
|
|
224
223
|
default:
|
|
225
|
-
console.error(`Error: Unknown target '${target}'. Supported:
|
|
224
|
+
console.error(`Error: Unknown target '${target}'. Supported: openclaw`);
|
|
226
225
|
process.exit(1);
|
|
227
226
|
}
|
|
228
227
|
});
|
package/dist/lib/api.js
CHANGED
|
@@ -69,7 +69,7 @@ async function request(path, opts = {}) {
|
|
|
69
69
|
const config = readConfig();
|
|
70
70
|
const baseUrl = baseLlm
|
|
71
71
|
? (config.llmUrl || 'https://llm.kibi.bot/v1')
|
|
72
|
-
: (config.apiUrl || 'https://kibi.bot');
|
|
72
|
+
: (config.apiUrl || 'https://api.kibi.bot');
|
|
73
73
|
const url = `${baseUrl}${path}`;
|
|
74
74
|
const headers = {
|
|
75
75
|
'Accept': 'application/json',
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { KibiConfig } from '../types.js';
|
|
2
2
|
declare const CONFIG_DIR: string;
|
|
3
3
|
declare const CONFIG_PATH: string;
|
|
4
|
-
declare const DEFAULT_API_URL = "https://kibi.bot";
|
|
4
|
+
declare const DEFAULT_API_URL = "https://api.kibi.bot";
|
|
5
5
|
declare const DEFAULT_LLM_URL = "https://llm.kibi.bot/v1";
|
|
6
6
|
/**
|
|
7
7
|
* Read config from disk. Returns defaults for missing values.
|
package/dist/lib/config.js
CHANGED
|
@@ -6,7 +6,7 @@ import { join } from 'node:path';
|
|
|
6
6
|
import { homedir } from 'node:os';
|
|
7
7
|
const CONFIG_DIR = join(homedir(), '.kibi');
|
|
8
8
|
const CONFIG_PATH = join(CONFIG_DIR, 'config.json');
|
|
9
|
-
const DEFAULT_API_URL = 'https://kibi.bot';
|
|
9
|
+
const DEFAULT_API_URL = 'https://api.kibi.bot';
|
|
10
10
|
const DEFAULT_LLM_URL = 'https://llm.kibi.bot/v1';
|
|
11
11
|
/**
|
|
12
12
|
* Read config from disk. Returns defaults for missing values.
|