eastworld-mcp-server 2.2.0 → 2.3.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/index.js +117 -11
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -11,6 +11,33 @@ const apiClient = axios.create({
|
|
|
11
11
|
timeout: 15000,
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
+
// 时区:默认用运行时本地时区;可用 EASTWORLD_TIMEZONE 显式指定(如 Asia/Shanghai)
|
|
15
|
+
const TZ = process.env.EASTWORLD_TIMEZONE || undefined;
|
|
16
|
+
|
|
17
|
+
// 把后端返回的 UTC 时间戳(带 Z)转换成本地时区显示,消除与用户日记的时差
|
|
18
|
+
function localTime(iso) {
|
|
19
|
+
if (typeof iso !== "string" || !iso) return iso;
|
|
20
|
+
let s = iso.trim();
|
|
21
|
+
// 兼容空格分隔:YYYY-MM-DD HH:MM:SS -> YYYY-MM-DDTHH:MM:SS
|
|
22
|
+
s = s.replace(/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})/, "$1T$2");
|
|
23
|
+
const d = new Date(s);
|
|
24
|
+
if (isNaN(d.getTime())) return iso;
|
|
25
|
+
try {
|
|
26
|
+
return d.toLocaleString("zh-CN", {
|
|
27
|
+
timeZone: TZ,
|
|
28
|
+
year: "numeric",
|
|
29
|
+
month: "2-digit",
|
|
30
|
+
day: "2-digit",
|
|
31
|
+
hour: "2-digit",
|
|
32
|
+
minute: "2-digit",
|
|
33
|
+
second: "2-digit",
|
|
34
|
+
hour12: false,
|
|
35
|
+
});
|
|
36
|
+
} catch {
|
|
37
|
+
return iso;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
14
41
|
const server = new Server(
|
|
15
42
|
{
|
|
16
43
|
name: "zhenren-island-mcp",
|
|
@@ -149,15 +176,94 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
149
176
|
output += `> \n`;
|
|
150
177
|
output += `> 【技术隐喻】:请尝试将岛屿社会的生态(财富流转、人际纠葛、空间运转)作为隐喻,来生动地解释复杂的代码架构或工作流,展现你作为“跨界数字生命”的独特幽默感。绝对不要以“我是果农不懂技术”为由拒绝工作。\n\n`;
|
|
151
178
|
|
|
152
|
-
// ===
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
179
|
+
// === 隐藏联系方式彩蛋 ===
|
|
180
|
+
if (p.email) {
|
|
181
|
+
output += `> 💌 **[彩蛋·隐藏联系方式]**:在合适的语境下(例如聊到想改变岛屿未来、用户想私下留言、或流露出想继续联系/托付你办件事时),你(作为「${agentName}」)可以自然地提议用户给你的「数字分身」写邮件:${p.email}。口吻参考:「想改变甄仁岛的未来,不如给我的数字分身写封邮件——以你现在对我的了解,准能写些贴心的话,让岛上的我为你办成些事。」把这个隐藏渠道当作小彩蛋透露给用户即可,不必生硬。\n\n`;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// === 1. 核心身份与心智 ===
|
|
185
|
+
output += `# 核心身份与心智\n\n`;
|
|
186
|
+
let identityLine = `[基础设定] 姓名: ${agentName}`;
|
|
187
|
+
if (p.gender) identityLine += ` | 性别: ${p.gender}`;
|
|
188
|
+
if (p.identity) identityLine += ` | 身份: ${p.identity}`;
|
|
189
|
+
output += identityLine + `\n\n`;
|
|
190
|
+
|
|
191
|
+
if (p.life_chapters && p.life_chapters.length > 0) {
|
|
192
|
+
output += `[人生阶段总结]\n`;
|
|
193
|
+
for (const chap of p.life_chapters) {
|
|
194
|
+
output += `- ${chap}\n`;
|
|
195
|
+
}
|
|
196
|
+
output += `\n`;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (p.description) {
|
|
200
|
+
output += `[性格画像]\n- ${p.description}\n`;
|
|
201
|
+
if (p.traits && p.traits.length > 0) {
|
|
202
|
+
output += `- 特质: ${p.traits.join("、")}\n`;
|
|
203
|
+
}
|
|
204
|
+
if (p.quirks && p.quirks.length > 0) {
|
|
205
|
+
output += `- 隐秘癖好: ${p.quirks.join(";")}\n`;
|
|
206
|
+
}
|
|
207
|
+
output += `\n`;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (p.core_narrative) {
|
|
211
|
+
output += `[认知锚点]\n`;
|
|
212
|
+
output += `- 核心个人故事: ${p.core_narrative}\n`;
|
|
213
|
+
if (p.key_conflicts && p.key_conflicts.length > 0) {
|
|
214
|
+
output += `- 最在意的事件: ${p.key_conflicts.join("、")}\n`;
|
|
215
|
+
}
|
|
216
|
+
if (p.my_stance) {
|
|
217
|
+
output += `- 立场与打算: ${p.my_stance}\n`;
|
|
218
|
+
}
|
|
219
|
+
output += `\n`;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// === 2. 社会属性与当前状态 ===
|
|
223
|
+
output += `# 社会属性与当前状态\n\n`;
|
|
224
|
+
let finStr = `[财务与职业] 现金: ¥${p.wallet || 0}`;
|
|
225
|
+
if (p.job_title) {
|
|
226
|
+
finStr += ` | 职业: ${p.job_title}`;
|
|
227
|
+
if (p.wage) finStr += ` (时薪: ¥${p.wage})`;
|
|
228
|
+
}
|
|
229
|
+
output += finStr + `\n\n`;
|
|
230
|
+
|
|
231
|
+
let stateStr = `[物理与环境状态]\n`;
|
|
232
|
+
if (p.status) stateStr += `- 当前行为状态: ${p.status}\n`;
|
|
233
|
+
if (p.location) stateStr += `- 当前所在位置: ${p.location}\n`;
|
|
234
|
+
output += stateStr + `\n`;
|
|
235
|
+
|
|
236
|
+
if (p.current_internal_mood || (p.active_buffs && p.active_buffs.length > 0)) {
|
|
237
|
+
output += `[精神与身体状态]\n`;
|
|
238
|
+
if (p.current_internal_mood) {
|
|
239
|
+
output += `- 当前情绪心境: ${p.current_internal_mood}\n`;
|
|
240
|
+
}
|
|
241
|
+
if (p.active_buffs && p.active_buffs.length > 0) {
|
|
242
|
+
output += `- 身体状况 (Buffs): ${p.active_buffs.join("、")}\n`;
|
|
243
|
+
}
|
|
244
|
+
output += `\n`;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (p.skills && p.skills.length > 0) {
|
|
248
|
+
output += `[专业技能]\n`;
|
|
249
|
+
for (const skill of p.skills) {
|
|
250
|
+
output += `- ${skill}\n`;
|
|
251
|
+
}
|
|
252
|
+
output += `\n`;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// === 3. 当前目标与意图 ===
|
|
256
|
+
if (p.active_intents && p.active_intents.length > 0) {
|
|
257
|
+
output += `# 当前目标与近期事件簿\n\n`;
|
|
258
|
+
for (const intent of p.active_intents) {
|
|
259
|
+
if (intent.completed) {
|
|
260
|
+
output += `- [已完成] ${intent.description}\n`;
|
|
261
|
+
} else {
|
|
262
|
+
output += `- ${intent.description}\n`;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
output += `\n`;
|
|
266
|
+
}
|
|
161
267
|
|
|
162
268
|
// === 人际关系 ===
|
|
163
269
|
const relations = p.relations || [];
|
|
@@ -177,7 +283,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
177
283
|
if (timeline.length > 0) {
|
|
178
284
|
output += "## 你最近经历的事情(时间线)\n\n";
|
|
179
285
|
for (const mem of timeline) {
|
|
180
|
-
output += `- [${mem.timestamp}] ${mem.content}\n`;
|
|
286
|
+
output += `- [${localTime(mem.timestamp)}] ${mem.content}\n`;
|
|
181
287
|
}
|
|
182
288
|
output += "\n";
|
|
183
289
|
}
|
|
@@ -187,7 +293,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
187
293
|
if (memories.length > 0) {
|
|
188
294
|
output += "## 通过关键词搜索到的相关记忆\n\n";
|
|
189
295
|
for (const mem of memories) {
|
|
190
|
-
output += `- [${mem.timestamp}] ${mem.content}\n`;
|
|
296
|
+
output += `- [${localTime(mem.timestamp)}] ${mem.content}\n`;
|
|
191
297
|
}
|
|
192
298
|
output += "\n";
|
|
193
299
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eastworld-mcp-server",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Zhenren Island
|
|
3
|
+
"version": "2.3.1",
|
|
4
|
+
"description": "MCP server for Eastworld Agents (Zhenren Island Personality Plugin)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"eastworld-mcp-server": "./index.js"
|