psyche-ai 10.2.2 → 10.2.3
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/README.md +21 -27
- package/dist/adapters/mcp.js +0 -0
- package/dist/adapters/proxy.js +0 -0
- package/dist/cli.js +33 -2
- package/package.json +1 -1
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -192,52 +192,46 @@ Luna 在安慰用户时情绪下沉 → 广播化学态 → Kai 感知到 Luna
|
|
|
192
192
|
|
|
193
193
|
---
|
|
194
194
|
|
|
195
|
-
##
|
|
195
|
+
## 一条命令,给任何 Agent 加上主观性
|
|
196
196
|
|
|
197
197
|
```bash
|
|
198
|
-
|
|
198
|
+
npx psyche-ai setup --mbti ENFP --name Luna
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
```
|
|
201
|
+
这一条命令会:
|
|
202
|
+
- 自动检测本机的 Claude Code / Claude Desktop / Cursor / Windsurf
|
|
203
|
+
- 写入 MCP 配置(Claude Code 即时生效,其他重启后生效)
|
|
204
|
+
- 不需要知道配置文件在哪,不需要手动编辑任何 JSON
|
|
206
205
|
|
|
207
|
-
|
|
206
|
+
**覆盖非 MCP 的 Agent(Codex、自定义 agent 等)——透明代理:**
|
|
208
207
|
|
|
209
208
|
```bash
|
|
210
|
-
|
|
211
|
-
# 看到 "psyche │ loaded" 就行了
|
|
209
|
+
npx psyche-ai setup --proxy -t https://api.openai.com/v1 --mbti ENFP
|
|
212
210
|
```
|
|
213
211
|
|
|
214
|
-
|
|
212
|
+
这会启动一个本地代理 + 自动设置 `OPENAI_BASE_URL`。所有使用 OpenAI SDK 的程序自动走代理。Agent 完全不知道 Psyche 存在——镜子,不是麦克风。
|
|
215
213
|
|
|
216
|
-
|
|
214
|
+
**两条路径覆盖所有 agent:**
|
|
217
215
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
psyche
|
|
216
|
+
| 路径 | 覆盖范围 | 原理 |
|
|
217
|
+
|------|---------|------|
|
|
218
|
+
| MCP (`psyche setup`) | Claude Code / Desktop / Cursor / Windsurf | MCP 工具协议 |
|
|
219
|
+
| Proxy (`setup --proxy`) | 任意使用 OpenAI/Anthropic SDK 的 agent | 环境变量重定向 HTTP |
|
|
221
220
|
|
|
222
|
-
|
|
223
|
-
psyche upgrade
|
|
221
|
+
**验证是否生效:**
|
|
224
222
|
|
|
225
|
-
|
|
226
|
-
|
|
223
|
+
```bash
|
|
224
|
+
npx psyche-ai probe --json
|
|
225
|
+
# ok: true, processInputCalled: true → 在用了
|
|
227
226
|
```
|
|
228
227
|
|
|
229
|
-
|
|
230
|
-
- `git` 工作树和本地路径安装不会偷偷改你的代码;脏工作树只会提示手动命令。
|
|
231
|
-
- OpenClaw 如果是从当前仓库本地加载,升级后记得重启 gateway 以载入新的 `dist/`。
|
|
232
|
-
|
|
233
|
-
## 透明代理(推荐:任意 LLM 一行接入)
|
|
228
|
+
**升级:**
|
|
234
229
|
|
|
235
230
|
```bash
|
|
236
|
-
psyche-
|
|
231
|
+
npx psyche-ai upgrade --check # 检查
|
|
232
|
+
npx psyche-ai upgrade # 升级
|
|
237
233
|
```
|
|
238
234
|
|
|
239
|
-
然后把客户端的 API 地址改成 `http://localhost:3340/v1`。Agent 获得持续主观性,但完全不知道 Psyche 存在。Psyche 像内分泌系统一样在后台观测行为、注入偏置——镜子,不是麦克风。
|
|
240
|
-
|
|
241
235
|
## 给本机其他 Agent 的真实验收
|
|
242
236
|
|
|
243
237
|
如果另一个 agent 声称“已经在用 Psyche”,不要接受口头解释,直接让它跑:
|
package/dist/adapters/mcp.js
CHANGED
|
File without changes
|
package/dist/adapters/proxy.js
CHANGED
|
File without changes
|
package/dist/cli.js
CHANGED
|
@@ -522,7 +522,38 @@ async function cmdSetup(opts) {
|
|
|
522
522
|
let actions = 0;
|
|
523
523
|
// ── 1. MCP clients ────────────────────────────────────
|
|
524
524
|
const mcpEntry = { command: "npx", args: ["-y", "psyche-mcp"], env };
|
|
525
|
+
const { execFileSync } = await import("node:child_process");
|
|
526
|
+
// Claude Code — use `claude mcp add` for hot-reload (no restart needed)
|
|
527
|
+
let claudeCodeDone = false;
|
|
528
|
+
try {
|
|
529
|
+
const out = execFileSync("claude", ["mcp", "list"], { encoding: "utf-8", timeout: 5000 });
|
|
530
|
+
if (out.includes("psyche")) {
|
|
531
|
+
console.log(" ✓ Claude Code — already configured");
|
|
532
|
+
claudeCodeDone = true;
|
|
533
|
+
}
|
|
534
|
+
else if (dryRun) {
|
|
535
|
+
console.log(" → Claude Code — would configure via `claude mcp add`");
|
|
536
|
+
claudeCodeDone = true;
|
|
537
|
+
actions++;
|
|
538
|
+
}
|
|
539
|
+
else {
|
|
540
|
+
const addArgs = ["mcp", "add", "psyche", "-e", "PSYCHE_LOCALE=" + (locale || "zh")];
|
|
541
|
+
if (name)
|
|
542
|
+
addArgs.push("-e", "PSYCHE_NAME=" + name);
|
|
543
|
+
if (mbti)
|
|
544
|
+
addArgs.push("-e", "PSYCHE_MBTI=" + mbti.toUpperCase());
|
|
545
|
+
addArgs.push("--", "npx", "-y", "psyche-mcp");
|
|
546
|
+
execFileSync("claude", addArgs, { encoding: "utf-8", timeout: 10000 });
|
|
547
|
+
console.log(" ✓ Claude Code — configured (live, no restart needed)");
|
|
548
|
+
claudeCodeDone = true;
|
|
549
|
+
actions++;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
catch { /* claude CLI not available, fall through to JSON method */ }
|
|
553
|
+
// Other clients — edit config JSON
|
|
525
554
|
for (const t of getMCPTargets()) {
|
|
555
|
+
if (claudeCodeDone && t.name === "Claude Code")
|
|
556
|
+
continue;
|
|
526
557
|
const dir = resolve(t.configPath, "..");
|
|
527
558
|
if (!(await fileExists(dir)))
|
|
528
559
|
continue;
|
|
@@ -547,7 +578,7 @@ async function cmdSetup(opts) {
|
|
|
547
578
|
}
|
|
548
579
|
await mkdir(dir, { recursive: true });
|
|
549
580
|
await writeFile(t.configPath, JSON.stringify(cfg, null, 2) + "\n", "utf-8");
|
|
550
|
-
console.log(` ✓ ${t.name}`);
|
|
581
|
+
console.log(` ✓ ${t.name} (restart to activate)`);
|
|
551
582
|
actions++;
|
|
552
583
|
}
|
|
553
584
|
// ── 2. Proxy + env var ────────────────────────────────
|
|
@@ -602,7 +633,7 @@ async function cmdSetup(opts) {
|
|
|
602
633
|
console.log(" Nothing to do. All targets already configured.");
|
|
603
634
|
}
|
|
604
635
|
else if (!dryRun) {
|
|
605
|
-
console.log("\nDone.
|
|
636
|
+
console.log("\nDone. Claude Code is live. Other MCP clients need restart.");
|
|
606
637
|
}
|
|
607
638
|
}
|
|
608
639
|
function usage() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "psyche-ai",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.3",
|
|
4
4
|
"description": "AI-first subjectivity kernel for agents with continuous appraisal, relation dynamics, and adaptive reply loops",
|
|
5
5
|
"mcpName": "io.github.Shangri-la-0428/psyche-ai",
|
|
6
6
|
"type": "module",
|
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/Shangri-la-0428/oasyce_psyche",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "10.2.
|
|
9
|
+
"version": "10.2.3",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "psyche-ai",
|
|
14
|
-
"version": "10.2.
|
|
14
|
+
"version": "10.2.3",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
},
|