@wu529778790/open-im 1.5.3-beta.0 → 1.5.3-beta.1
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/handler.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolveLatestPermission, getPendingCount } from '../hook/permission-server.js';
|
|
2
|
+
import { escapePathForMarkdown } from '../shared/utils.js';
|
|
2
3
|
import { getPermissionMode, setPermissionMode } from '../permission-mode/session-mode.js';
|
|
3
4
|
import { MODE_LABELS, MODE_DESCRIPTIONS, parsePermissionMode } from '../permission-mode/types.js';
|
|
4
5
|
import { TERMINAL_ONLY_COMMANDS } from '../constants.js';
|
|
@@ -105,7 +106,7 @@ export class CommandHandler {
|
|
|
105
106
|
}
|
|
106
107
|
async handlePwd(chatId, userId) {
|
|
107
108
|
const workDir = this.deps.sessionManager.getWorkDir(userId);
|
|
108
|
-
await this.deps.sender.sendTextReply(chatId, `当前工作目录: ${workDir}`);
|
|
109
|
+
await this.deps.sender.sendTextReply(chatId, `当前工作目录: ${escapePathForMarkdown(workDir)}`);
|
|
109
110
|
return true;
|
|
110
111
|
}
|
|
111
112
|
async handleStatus(chatId, userId) {
|
|
@@ -118,7 +119,7 @@ export class CommandHandler {
|
|
|
118
119
|
'',
|
|
119
120
|
`AI 工具: ${this.deps.config.aiCommand}`,
|
|
120
121
|
`版本: ${version}`,
|
|
121
|
-
`工作目录: ${workDir}`,
|
|
122
|
+
`工作目录: ${escapePathForMarkdown(workDir)}`,
|
|
122
123
|
`会话: ${sessionId ?? '无'}`,
|
|
123
124
|
];
|
|
124
125
|
await this.deps.sender.sendTextReply(chatId, lines.join('\n'));
|
|
@@ -132,13 +133,13 @@ export class CommandHandler {
|
|
|
132
133
|
await this.deps.sender.sendDirectorySelection(chatId, currentDir, userId);
|
|
133
134
|
}
|
|
134
135
|
else {
|
|
135
|
-
await this.deps.sender.sendTextReply(chatId, `当前目录: ${currentDir}\n使用 /cd <路径> 切换`);
|
|
136
|
+
await this.deps.sender.sendTextReply(chatId, `当前目录: ${escapePathForMarkdown(currentDir)}\n使用 /cd <路径> 切换`);
|
|
136
137
|
}
|
|
137
138
|
return true;
|
|
138
139
|
}
|
|
139
140
|
try {
|
|
140
141
|
const resolved = await this.deps.sessionManager.setWorkDir(userId, dir);
|
|
141
|
-
await this.deps.sender.sendTextReply(chatId, `📁 工作目录已切换到: ${resolved}\n\n` +
|
|
142
|
+
await this.deps.sender.sendTextReply(chatId, `📁 工作目录已切换到: ${escapePathForMarkdown(resolved)}\n\n` +
|
|
142
143
|
`🔄 AI 会话已重置,下一条消息将使用全新上下文。\n` +
|
|
143
144
|
this.getClearHistoryHint(platform));
|
|
144
145
|
}
|
|
@@ -231,7 +231,7 @@ export class SessionManager {
|
|
|
231
231
|
async resolveAndValidate(baseDir, targetDir) {
|
|
232
232
|
const resolved = resolveWorkDirInput(baseDir, targetDir);
|
|
233
233
|
if (!existsSync(resolved))
|
|
234
|
-
throw new Error(`目录不存在:
|
|
234
|
+
throw new Error(`目录不存在: \`${resolved}\``);
|
|
235
235
|
return realpath(resolved);
|
|
236
236
|
}
|
|
237
237
|
load() {
|
package/dist/shared/utils.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** 消息头部品牌后缀,用于飞书等平台展示 */
|
|
2
2
|
export declare const OPEN_IM_BRAND_SUFFIX = " \u00B7 \u901A\u8FC7 open-im \u63A7\u5236";
|
|
3
|
+
/** 转义路径供 Markdown 显示,防止 xxx.yyy.com 被解析为链接 */
|
|
4
|
+
export declare function escapePathForMarkdown(path: string): string;
|
|
3
5
|
/** AI 工具显示名称映射(aiCommand -> 用户友好名称) */
|
|
4
6
|
export declare const AI_TOOL_DISPLAY_NAMES: Record<string, string>;
|
|
5
7
|
/** 获取 AI 工具的显示名称 */
|
package/dist/shared/utils.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/** 消息头部品牌后缀,用于飞书等平台展示 */
|
|
2
2
|
export const OPEN_IM_BRAND_SUFFIX = ' · 通过 open-im 控制';
|
|
3
|
+
/** 转义路径供 Markdown 显示,防止 xxx.yyy.com 被解析为链接 */
|
|
4
|
+
export function escapePathForMarkdown(path) {
|
|
5
|
+
return `\`${path.replace(/`/g, '\\`')}\``;
|
|
6
|
+
}
|
|
3
7
|
/** AI 工具显示名称映射(aiCommand -> 用户友好名称) */
|
|
4
8
|
export const AI_TOOL_DISPLAY_NAMES = {
|
|
5
9
|
claude: 'Claude Code',
|