kiku-agent 1.0.0

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.
Files changed (45) hide show
  1. package/README.md +122 -0
  2. package/package.json +85 -0
  3. package/server/agent/agentCore.js +782 -0
  4. package/server/agent/agentState.js +140 -0
  5. package/server/agent/audioPlayer.js +673 -0
  6. package/server/agent/cli.js +1111 -0
  7. package/server/agent/commandRegistry.js +58 -0
  8. package/server/agent/commands.js +788 -0
  9. package/server/agent/config.js +90 -0
  10. package/server/agent/errors.js +9 -0
  11. package/server/agent/eventBus.js +103 -0
  12. package/server/agent/llmClient.js +200 -0
  13. package/server/agent/memory.js +566 -0
  14. package/server/agent/sanitizer.js +314 -0
  15. package/server/agent/session.js +239 -0
  16. package/server/agent/theme.js +124 -0
  17. package/server/agent/tools.js +1528 -0
  18. package/server/agent/ui.js +469 -0
  19. package/server/agent/webSearch.js +719 -0
  20. package/server/agent/youtubeAuth.js +299 -0
  21. package/server/mcp/claude-desktop-config.example.json +9 -0
  22. package/server/mcp/data/awards.js +14 -0
  23. package/server/mcp/data/brands.js +9 -0
  24. package/server/mcp/data/discography.js +36 -0
  25. package/server/mcp/data/gallery.js +25 -0
  26. package/server/mcp/data/index.js +7 -0
  27. package/server/mcp/data/profile.js +44 -0
  28. package/server/mcp/data/timeline.js +16 -0
  29. package/server/mcp/data/works.js +104 -0
  30. package/server/mcp/handler.js +159 -0
  31. package/server/mcp/prompts.js +143 -0
  32. package/server/mcp/resources.js +54 -0
  33. package/server/mcp/security.js +138 -0
  34. package/server/mcp/server.js +100 -0
  35. package/server/mcp/stdio.js +33 -0
  36. package/server/mcp/tools.js +126 -0
  37. package/src/data/awardsData.js +146 -0
  38. package/src/data/brandsData.js +249 -0
  39. package/src/data/discographyData.js +874 -0
  40. package/src/data/galleryData.js +666 -0
  41. package/src/data/musicVideoData.js +406 -0
  42. package/src/data/profileData.js +156 -0
  43. package/src/data/socialUpdatesData.js +381 -0
  44. package/src/data/timelineData.js +172 -0
  45. package/src/data/worksData.js +516 -0
package/README.md ADDED
@@ -0,0 +1,122 @@
1
+ # 🌸 Ju Jingyi (鞠婧祎) Portal & Kiku AI Agent
2
+
3
+ > Full-stack fan archive, REST API Suite v1.0, and Autonomous AI Agent CLI powered by **LM Studio** (`gemma-4-e4b` / Gemma models).
4
+
5
+ ---
6
+
7
+ ## 🚀 Kiku AI Agent CLI
8
+
9
+ The **Kiku AI Agent** is an autonomous ReAct agent and specialized encyclopedia for Ju Jingyi. It connects to your local **LM Studio** instance and has access to catalog, web, media, filesystem, and music tools.
10
+
11
+ ### Global installation
12
+
13
+ ```bash
14
+ npm install -g kiku-agent
15
+ kiku-agent
16
+ ```
17
+
18
+ The same package also installs the stdio MCP server command:
19
+
20
+ ```bash
21
+ kiku-mcp
22
+ ```
23
+
24
+ For a local checkout before the package is published, use `npm pack` followed by `npm install -g ./kiku-agent-1.0.0.tgz`.
25
+
26
+ ### ✨ Features
27
+ - **LM Studio Integration**: Connects seamlessly to LM Studio's OpenAI-compatible server at `http://127.0.0.1:1234/v1` (with support for `gemma-4-e4b`, `gemma-3-4b`, and auto-detection of loaded models).
28
+ - **Validated Tool Calling**: Schema validation, argument coercion, timeouts, duplicate-call caching, normalized results, and complete catalog/media integrations.
29
+ - **Multilingual Support**: Automatically detects and responds in Thai, Chinese, or English based on user input language.
30
+ - **Multi-turn Memory**: Retains conversation context with clear memory controls (`/clear`).
31
+ - **Resilient ReAct Loop**: Supports OpenAI function calling as well as structured JSON tool parsing optimized for Gemma models.
32
+ - **Graceful Diagnostics**: Displays real-time connection status, loaded model names, and fallback search modes if LM Studio is offline.
33
+ - **Clean Thinking Display**: Shows reasoning process without markdown artifacts for better readability.
34
+
35
+ ---
36
+
37
+ ## 🛠️ LM Studio Quick Setup
38
+
39
+ 1. Open **LM Studio** on your computer.
40
+ 2. In the Search tab, download or load **Gemma** (e.g. `gemma-4-e4b`, `gemma-3-4b-it`, `gemma-2-9b-it`).
41
+ 3. Click the **Developer / Local Server** tab (icon with `<->`) on the left bar.
42
+ 4. Select your loaded Gemma model and click **Start Server** on port `1234` (`http://localhost:1234`).
43
+ 5. In this terminal, run:
44
+ ```bash
45
+ npm run kiku-agent
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 💻 CLI Usage & Commands
51
+
52
+ ### Interactive Chat Mode
53
+ ```bash
54
+ npm run kiku-agent
55
+ ```
56
+
57
+ ### One-shot Question Query
58
+ ```bash
59
+ npm run kiku-agent -- --query "ผลงานซีรีส์ปี 2026 มีเรื่องอะไรบ้างและรับบทเป็นใคร"
60
+ ```
61
+
62
+ ### Specify Custom Model or LM Studio URL
63
+ ```bash
64
+ npm run kiku-agent -- --model gemma-4-e4b --url http://127.0.0.1:1234/v1
65
+ ```
66
+
67
+ ### View Catalog Overview Statistics
68
+ ```bash
69
+ npm run kiku-agent -- --stats
70
+ ```
71
+
72
+ ### View All Registered Tools
73
+ ```bash
74
+ npm run kiku-agent -- --tools
75
+ ```
76
+
77
+ ### Interactive Chat Slash Commands
78
+ - `/help` — Display list of commands
79
+ - `/tools` — View all tool names and parameter descriptions
80
+ - `/details [Qn]` — Expand the recorded thinking and tool results for a question (`F2` opens the latest)
81
+ - `/stats` — Print summary counts of dramas, songs, brands, and awards
82
+ - `/model` — Inspect active models currently loaded in LM Studio
83
+ - `/thinking [show|hide]` — Toggle reasoning process visibility
84
+ - `/save` — Export session transcript to Markdown file
85
+ - `/clear` — Reset conversation history
86
+ - `/exit` — Exit the agent
87
+
88
+ ---
89
+
90
+ ## 📚 Available API Tools in Kiku Agent
91
+
92
+ | # | Tool Name | Description |
93
+ |---|---|---|
94
+ | 1 | `get_profile_and_fandom` | Bio, Thai/Chinese/Pinyin names, Miju (蜜橘) fan community, slogans, socials |
95
+ | 2 | `get_quotes` | Inspiring quotes with Thai translation and original Chinese text |
96
+ | 3 | `search_works` | Filter filmography by year (2013-2026), category, keywords |
97
+ | 4 | `get_work_detail` | Detailed synopsis, roles, ratings, streaming platform, and OST |
98
+ | 5 | `get_character_roles` | Portrayed roles (Yang Caiwei, Lu Wuyi, Bai Suzhen, Han Yunxi, etc.) |
99
+ | 6 | `search_discography` | Deduplicated music catalog, singles, OSTs, and albums |
100
+ | 7 | `get_music_videos` | MVs, stage performances, dance practices, and special stages |
101
+ | 8 | `get_brand_endorsements`| Commercial endorsements, luxury brands (PRSR, FRED), Milan fashion week |
102
+ | 9 | `get_career_timeline` | Milestone eras from SNH48 debut (2013) to solo studio to present |
103
+ | 10 | `get_awards` | Honors in music, television acting, and fashion influence |
104
+ | 11 | `get_social_feed` | Recent Weibo & Douyin social media updates and metrics |
105
+ | 12 | `get_gallery_photos` | High-res fashion sets, red carpet, photoshoot, and drama stills |
106
+ | 13 | `global_search` | Universal fuzzy search across all entities in the database |
107
+ | 14 | `web_search` | Live internet search for up-to-date news and info |
108
+ | 15 | `fetch_webpage` | Extract and read content from live URLs |
109
+ | 16 | `fetch_api` | Query the official Ju Jingyi REST API for structured JSON data |
110
+ | 17 | `get_system_stats` | High-level summary metrics of the entire Ju Jingyi archive |
111
+
112
+ ---
113
+
114
+ ## 🌐 Web App & API Development
115
+
116
+ ```bash
117
+ # Start frontend dev server
118
+ npm run dev
119
+
120
+ # Run API verification tests
121
+ powershell -ExecutionPolicy Bypass -File test_api.ps1
122
+ ```
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "kiku-agent",
3
+ "version": "1.0.0",
4
+ "description": "Kiku AI terminal agent and MCP server for Ju Jingyi knowledge, media, and career data.",
5
+ "type": "module",
6
+ "bin": {
7
+ "kiku-agent": "server/agent/cli.js",
8
+ "kiku-mcp": "server/mcp/stdio.js"
9
+ },
10
+ "exports": {
11
+ ".": "./server/agent/agentCore.js",
12
+ "./mcp": "./server/mcp/server.js",
13
+ "./tools": "./server/agent/tools.js"
14
+ },
15
+ "files": [
16
+ "server/agent/*.js",
17
+ "server/mcp/*.js",
18
+ "server/mcp/data/*.js",
19
+ "server/mcp/**/*.json",
20
+ "src/data/**/*.js",
21
+ "README.md"
22
+ ],
23
+ "engines": {
24
+ "node": ">=20.0.0"
25
+ },
26
+ "keywords": [
27
+ "kiku",
28
+ "ju-jingyi",
29
+ "cli",
30
+ "ai-agent",
31
+ "mcp",
32
+ "model-context-protocol",
33
+ "lm-studio"
34
+ ],
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/ThemeHackers/jujingyi_kikuuu.git"
38
+ },
39
+ "homepage": "https://jujingyi-kikuuu.vercel.app/",
40
+ "bugs": {
41
+ "url": "https://github.com/ThemeHackers/jujingyi_kikuuu/issues"
42
+ },
43
+ "license": "UNLICENSED",
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "scripts": {
48
+ "dev": "vite",
49
+ "build": "vite build",
50
+ "preview": "vite preview",
51
+ "kiku-agent": "node server/agent/cli.js",
52
+ "kiku-mcp": "node server/mcp/stdio.js",
53
+ "kiku-ink": "npx tsx server/agent/ink/main.jsx",
54
+ "test": "node --test server/agent/tests/*.test.js server/mcp/tests/*.test.js",
55
+ "prepublishOnly": "npm test"
56
+ },
57
+ "dependencies": {
58
+ "@distube/ytdl-core": "^4.16.12",
59
+ "@modelcontextprotocol/sdk": "^1.30.0",
60
+ "clsx": "^2.1.1",
61
+ "ffmpeg-static": "^5.3.0",
62
+ "fluent-ffmpeg": "^2.1.3",
63
+ "framer-motion": "^12.4.7",
64
+ "ink": "^7.1.1",
65
+ "ink-select-input": "^6.2.0",
66
+ "ink-spinner": "^5.0.0",
67
+ "ink-text-input": "^6.0.0",
68
+ "lucide-react": "^1.16.0",
69
+ "react": "^19.0.0",
70
+ "react-dom": "^19.0.0",
71
+ "speaker": "^0.5.5",
72
+ "tailwind-merge": "^3.0.2",
73
+ "yt-search": "^2.13.1",
74
+ "zod": "^4.4.3"
75
+ },
76
+ "devDependencies": {
77
+ "@tailwindcss/vite": "^4.0.9",
78
+ "@types/react": "^19.0.10",
79
+ "@types/react-dom": "^19.0.4",
80
+ "@vitejs/plugin-react": "^4.3.4",
81
+ "tailwindcss": "^4.0.9",
82
+ "tsx": "^4.23.12",
83
+ "vite": "^6.2.0"
84
+ }
85
+ }