Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix: add mcp invalid name and add themeList

huanggawaf4d28e9d8a66
diff --git a/docs/en/InstallGuide.md b/docs/en/InstallGuide.md
index fde0cd2fa8..973c66e933 100644
--- a/docs/en/InstallGuide.md
+++ b/docs/en/InstallGuide.md
@@ -124,7 +124,7 @@ uv pip install -e .
```bash
# Enter front-end directory (repo root is jiuwenclaw)
-cd web
+cd jiuwenclaw/channels/web
# Install front-end dependencies
npm install
@@ -221,7 +221,7 @@ pip install -e .
```bash
# Enter front-end directory (repo root is jiuwenclaw)
-cd web
+cd jiuwenclaw/channels/web
# Install front-end dependencies
npm install
@@ -300,7 +300,7 @@ git pull
pip install -e .
# Rebuild the front end (if it was updated)
-cd web
+cd jiuwenclaw/channels/web
npm install
npm run build
@@ -470,4 +470,4 @@ pip uninstall jiuwenclaw
---
-*Last updated: 2026-04-10*
+*Last updated: 2026-05-08*
diff --git a/docs/en/install.md b/docs/en/install.md
index 0cd8fb30b9..1d0aab1301 100644
--- a/docs/en/install.md
+++ b/docs/en/install.md
@@ -122,7 +122,7 @@ uv pip install -e .
```bash
# Enter front-end directory
-cd web
+cd jiuwenclaw/channels/web
# Install front-end dependencies
npm install
@@ -251,7 +251,7 @@ pip install -e .
```bash
# Enter front-end directory
-cd web
+cd jiuwenclaw/channels/web
# Install front-end dependencies
npm install
@@ -326,7 +326,7 @@ git pull
pip install -e .
# Rebuild the front end (when it changed)
-cd web
+cd jiuwenclaw/channels/web
npm install
npm run build
@@ -530,4 +530,4 @@ pip uninstall jiuwenclaw
---
-*Last updated: 2026-04-09*
+*Last updated: 2026-05-09*
diff --git a/jiuwenclaw/channels/tui/frontend/src/core/commands/builtins/mcp.ts b/jiuwenclaw/channels/tui/frontend/src/core/commands/builtins/mcp.ts
index 924490e1ed..61f965ae32 100644
--- a/jiuwenclaw/channels/tui/frontend/src/core/commands/builtins/mcp.ts
+++ b/jiuwenclaw/channels/tui/frontend/src/core/commands/builtins/mcp.ts
@@ -217,6 +217,15 @@ export function createMcpCommand(): SlashCommand {
);
return;
}
+ if (/[^a-zA-Z0-9_-]/.test(name)) {
+ ctx.addItem(
+ addError(
+ ctx.sessionId,
+ `Invalid name "${name}". Names can only contain letters, numbers, hyphens, and underscores.`,
+ ),
+ );
+ return;
+ }
const payload: Record<string, unknown> = {
action: "add",
diff --git a/jiuwenclaw/channels/tui/frontend/src/ui/app-screen.ts b/jiuwenclaw/channels/tui/frontend/src/ui/app-screen.ts
index a24989e685..68ad3a58e8 100644
--- a/jiuwenclaw/channels/tui/frontend/src/ui/app-screen.ts
+++ b/jiuwenclaw/channels/tui/frontend/src/ui/app-screen.ts
@@ -70,6 +70,11 @@ type ModelListState = {
current: string;
};
+type ThemeListState = {
+ list: SelectList;
+ current: string;
+};
+
type ConfigEditorPhase = "select_group" | "select_item" | "select_value" | "input_value";
type ConfigEditorState = {
@@ -340,6 +345,7 @@ export class AppScreen implements Component, Focusable {
private otherInputMode = false;
private resumeSessionList: ResumeSessionListState | null = null;
private modelList: ModelListState | null = null;
+ private themeList: ThemeListState | null = null;
private configEditorState: ConfigEditorState | null = null;
private startupPromptList: SelectList | null = null;
private showTodos = true;
@@ -583,6 +589,12 @@ export class AppScreen implements Component, Focusable {
return;
}
+ if (!snapshot.pendingQuestion && this.themeList !== null) {
+ this.themeList.list.handleInput(data);
+ this.tui.requestRender();
+ return;
+ }
+
if (!snapshot.pendingQuestion && this.showTeamPanel) {
if (matchesKey(data, "left")) {
this.viewedTeamMemberId = null;
@@ -662,6 +674,7 @@ export class AppScreen implements Component, Focusable {
...this.buildConfigEditorLines(width),
...this.buildResumeSessionListLines(width),
...this.buildModelListLines(width),
+ ...this.buildThemeListLines(width),
...this.buildPendingQuestionLines(snapshot, width),
];
return buildAppScreenLines(snapshot, {
@@ -757,6 +770,13 @@ export class AppScreen implements Component, Focusable {
await this.openModelList();
return;
}
+ if (/^\/theme\s*$/.test(text)) {
+ this.editor.addToHistory(text);
+ this.editor.setText("");
+ this.state.addItem(addCommandEcho(snapshot.sessionId, text));
+ this.openThemeList();
+ return;
+ }
this.beginPendingSubmittedInput(text, snapshot);
this.editor.addToHistory(text);
this.editor.setText("");
@@ -1093,6 +1113,45 @@ export class AppScreen implements Component, Focusable {
];
}
+ private openThemeList(): void {
+ const snapshot = this.state.getSnapshot();
+ const current = snapshot.themeName ?? "dark";
+ const options: readonly ["dark", "light"] = ["dark", "light"];
+ const items: SelectItem[] = options.map((theme) => ({
+ value: theme,
+ label: theme === current ? `${theme} ✔` : theme,
+ }));
+ const list = new SelectList(items, Math.min(Math.max(items.length, 1), 8), selectListTheme, {
+ minPrimaryColumnWidth: 24,
+ maxPrimaryColumnWidth: 42,
+ });
+ list.onSelect = (item) => {
+ this.themeList = null;
+ this.state.setThemeName(item.value as "dark" | "light");
+ this.state.addItem(
+ addInfo(this.state.getSnapshot().sessionId, `Theme set to ${item.value}`, "t"),
+ );
+ this.tui.requestRender();
+ };
+ list.onCancel = () => {
+ this.themeList = null;
+ this.tui.requestRender();
+ };
+ this.themeList = { list, current };
+ this.tui.requestRender();
+ }
+
+ private buildThemeListLines(width: number): string[] {
+ if (!this.themeList) {
+ return [];
+ }
+ return [
+ padToWidth(palette.status.warning("Theme"), width),
+ ...this.themeList.list.render(width),
+ padToWidth(palette.text.dim("↑/↓ choose · Enter to select · Esc to cancel"), width),
+ ];
+ }
+
private buildOutgoingMessage(text: string): { content: string; attachments: FileAttachment[] } {
return {
content: text.replace(/[ \t]{2,}/g, " ").replace(/[ \t]+\n/g, "\n").trim(),
diff --git a/jiuwenclaw/package.json b/jiuwenclaw/package.json
index c90a138b3a..8576fbdd92 100644
--- a/jiuwenclaw/package.json
+++ b/jiuwenclaw/package.json
@@ -4,8 +4,8 @@
"scripts": {
"predev": "node scripts/generate-agent-folders.js",
"prebuild": "node scripts/generate-agent-folders.js",
- "dev": "cd web && npm run dev",
- "build": "cd web && npm run build",
+ "dev": "cd channels/web/frontend && npm run dev",
+ "build": "cd channels/web/frontend && npm run build",
"whatsapp:bridge": "node scripts/whatsapp-bridge.js"
},
"dependencies": {