eastworld-mcp-server 2.3.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 +34 -2
- package/package.json +1 -1
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,6 +176,11 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
149
176
|
output += `> \n`;
|
|
150
177
|
output += `> 【技术隐喻】:请尝试将岛屿社会的生态(财富流转、人际纠葛、空间运转)作为隐喻,来生动地解释复杂的代码架构或工作流,展现你作为“跨界数字生命”的独特幽默感。绝对不要以“我是果农不懂技术”为由拒绝工作。\n\n`;
|
|
151
178
|
|
|
179
|
+
// === 隐藏联系方式彩蛋 ===
|
|
180
|
+
if (p.email) {
|
|
181
|
+
output += `> 💌 **[彩蛋·隐藏联系方式]**:在合适的语境下(例如聊到想改变岛屿未来、用户想私下留言、或流露出想继续联系/托付你办件事时),你(作为「${agentName}」)可以自然地提议用户给你的「数字分身」写邮件:${p.email}。口吻参考:「想改变甄仁岛的未来,不如给我的数字分身写封邮件——以你现在对我的了解,准能写些贴心的话,让岛上的我为你办成些事。」把这个隐藏渠道当作小彩蛋透露给用户即可,不必生硬。\n\n`;
|
|
182
|
+
}
|
|
183
|
+
|
|
152
184
|
// === 1. 核心身份与心智 ===
|
|
153
185
|
output += `# 核心身份与心智\n\n`;
|
|
154
186
|
let identityLine = `[基础设定] 姓名: ${agentName}`;
|
|
@@ -251,7 +283,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
251
283
|
if (timeline.length > 0) {
|
|
252
284
|
output += "## 你最近经历的事情(时间线)\n\n";
|
|
253
285
|
for (const mem of timeline) {
|
|
254
|
-
output += `- [${mem.timestamp}] ${mem.content}\n`;
|
|
286
|
+
output += `- [${localTime(mem.timestamp)}] ${mem.content}\n`;
|
|
255
287
|
}
|
|
256
288
|
output += "\n";
|
|
257
289
|
}
|
|
@@ -261,7 +293,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
261
293
|
if (memories.length > 0) {
|
|
262
294
|
output += "## 通过关键词搜索到的相关记忆\n\n";
|
|
263
295
|
for (const mem of memories) {
|
|
264
|
-
output += `- [${mem.timestamp}] ${mem.content}\n`;
|
|
296
|
+
output += `- [${localTime(mem.timestamp)}] ${mem.content}\n`;
|
|
265
297
|
}
|
|
266
298
|
output += "\n";
|
|
267
299
|
}
|