@wu529778790/open-im 1.11.8-beta.4 → 1.11.8-beta.6

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.
@@ -26,6 +26,8 @@ export interface Config {
26
26
  codexCliPath: string;
27
27
  codebuddyCliPath: string;
28
28
  opencodeCliPath: string;
29
+ /** OpenCode SDK 使用的模型(格式: providerID/modelID,如 zhipuai-coding-plan/glm-5.1) */
30
+ opencodeModel?: string;
29
31
  /** Claude 访问 API 的代理(如 http://127.0.0.1:7890) */
30
32
  claudeProxy?: string;
31
33
  /** Codex 访问 chatgpt.com 的代理(如 http://127.0.0.1:7890) */
@@ -186,6 +188,8 @@ export interface FileToolCodeBuddy {
186
188
  }
187
189
  export interface FileToolOpenCode {
188
190
  cliPath?: string;
191
+ /** 模型(格式: providerID/modelID) */
192
+ model?: string;
189
193
  }
190
194
  export interface FileConfig {
191
195
  telegramBotToken?: string;
@@ -210,6 +210,10 @@ export declare const PAGE_TEXTS: {
210
210
  readonly wizardAuthApiKey: "API Key";
211
211
  readonly wizardAuthToken: "Auth Token";
212
212
  readonly wizardLoading: "Loading...";
213
+ readonly aiCommandPickerTitle: "🤖 AI Tool";
214
+ readonly aiCommandPickerHint: "Messages from this channel will be replied by the AI selected above";
215
+ readonly platformStatusOn: "Connected";
216
+ readonly platformStatusOff: "Not connected";
213
217
  };
214
218
  readonly zh: {
215
219
  readonly pageTitle: "open-im 本地控制台";
@@ -419,5 +423,9 @@ export declare const PAGE_TEXTS: {
419
423
  readonly wizardAuthApiKey: "API Key";
420
424
  readonly wizardAuthToken: "Auth Token";
421
425
  readonly wizardLoading: "加载中...";
426
+ readonly aiCommandPickerTitle: "🤖 AI 工具";
427
+ readonly aiCommandPickerHint: "这个渠道收到的消息会用上面的 AI 回复";
428
+ readonly platformStatusOn: "已连接";
429
+ readonly platformStatusOff: "未连接";
422
430
  };
423
431
  };
@@ -211,6 +211,10 @@ export const PAGE_TEXTS = {
211
211
  wizardAuthApiKey: "API Key",
212
212
  wizardAuthToken: "Auth Token",
213
213
  wizardLoading: "Loading...",
214
+ aiCommandPickerTitle: "🤖 AI Tool",
215
+ aiCommandPickerHint: "Messages from this channel will be replied by the AI selected above",
216
+ platformStatusOn: "Connected",
217
+ platformStatusOff: "Not connected",
214
218
  },
215
219
  zh: {
216
220
  pageTitle: "open-im \u672c\u5730\u63a7\u5236\u53f0",
@@ -421,5 +425,9 @@ export const PAGE_TEXTS = {
421
425
  wizardAuthApiKey: "API Key",
422
426
  wizardAuthToken: "Auth Token",
423
427
  wizardLoading: "\u52a0\u8f7d\u4e2d...",
428
+ aiCommandPickerTitle: "🤖 AI 工具",
429
+ aiCommandPickerHint: "这个渠道收到的消息会用上面的 AI 回复",
430
+ platformStatusOn: "已连接",
431
+ platformStatusOff: "未连接",
424
432
  }
425
433
  };
package/dist/config.js CHANGED
@@ -226,6 +226,7 @@ export function loadConfig() {
226
226
  const codebuddyCliPath = process.env.CODEBUDDY_CLI_PATH ?? tcb.cliPath ?? resolveWindowsCliPath(AI_TOOL_BY_ID.codebuddy.cliDefault ?? 'codebuddy');
227
227
  const topencode = file.tools?.opencode ?? {};
228
228
  const opencodeCliPath = process.env.OPENCODE_CLI_PATH ?? topencode.cliPath ?? resolveWindowsCliPath(AI_TOOL_BY_ID.opencode.cliDefault ?? 'opencode');
229
+ const opencodeModel = process.env.OPENCODE_MODEL ?? topencode.model;
229
230
  const claudeWorkDir = process.env.CLAUDE_WORK_DIR ?? tc.workDir ?? process.cwd();
230
231
  const skipPermissions = process.env.OPEN_IM_SKIP_PERMISSIONS === 'false'
231
232
  ? false
@@ -519,6 +520,7 @@ export function loadConfig() {
519
520
  codexCliPath,
520
521
  codebuddyCliPath,
521
522
  opencodeCliPath,
523
+ opencodeModel,
522
524
  claudeProxy,
523
525
  codexProxy,
524
526
  claudeWorkDir,
@@ -144,10 +144,33 @@ export async function runOpenCodeSdk(prompt, sessionId, workDir, callbacks, opti
144
144
  parts: [{ type: 'text', text: prompt }],
145
145
  ...(options?.model ? { model: parseModel(options.model) } : {}),
146
146
  });
147
+ // 调试:dump SDK 返回值结构
148
+ log.info(`SDK prompt raw result: hasData=${!!result.data}, hasError=${!!result.error}, keys=${Object.keys(result).join(',')}`);
149
+ if (result.error) {
150
+ const errStr = result.error instanceof Error ? result.error.message : JSON.stringify(result.error).substring(0, 500);
151
+ log.info(`SDK prompt error detail: ${errStr}`);
152
+ }
153
+ if (result.data) {
154
+ const d = result.data;
155
+ log.info(`SDK prompt data keys: ${Object.keys(d).join(',')}, parts count: ${Array.isArray(d.parts) ? d.parts.length : 'N/A'}, info keys: ${d.info && typeof d.info === 'object' ? Object.keys(d.info).join(',') : 'N/A'}`);
156
+ }
147
157
  abortController.abort();
148
158
  await background.catch(() => { });
149
159
  runSettled = true;
160
+ // SDK 返回 { data, error } 二元组;error 存在时 data 为 undefined
161
+ const sdkError = result.error;
162
+ if (sdkError) {
163
+ const errMsg = sdkError instanceof Error ? sdkError.message : JSON.stringify(sdkError);
164
+ log.error(`SDK prompt returned error: ${errMsg}`);
165
+ callbacks.onError(errMsg);
166
+ return { abort: () => { } };
167
+ }
150
168
  const data = result.data;
169
+ if (!data) {
170
+ log.error(`SDK prompt returned no data and no error — result keys: ${Object.keys(result).join(',')}`);
171
+ callbacks.onError('SDK 返回空数据');
172
+ return { abort: () => { } };
173
+ }
151
174
  const parts = data?.parts ?? [];
152
175
  const finalText = parts
153
176
  .filter((p) => p.type === 'text' && typeof p.text === 'string')
@@ -290,7 +290,9 @@ export function runAITask(deps, ctx, prompt, toolAdapter, platformAdapter) {
290
290
  }, {
291
291
  model: aiCommand === 'claude'
292
292
  ? (sessionManager.getModel(ctx.userId, ctx.threadId) ?? config.claudeModel)
293
- : undefined,
293
+ : aiCommand === 'opencode'
294
+ ? config.opencodeModel
295
+ : undefined,
294
296
  chatId: ctx.chatId,
295
297
  // 默认跳过权限确认,保持全自动执行(可通过 config 或环境变量关闭)
296
298
  skipPermissions: config.skipPermissions ?? true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wu529778790/open-im",
3
- "version": "1.11.8-beta.4",
3
+ "version": "1.11.8-beta.6",
4
4
  "description": "Your AI coding assistant, in every chat app. Multi-platform IM bridge for Claude Code, Codex, and CodeBuddy.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",