psyche-ai 10.2.2 → 10.2.4

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 CHANGED
@@ -192,51 +192,32 @@ Luna 在安慰用户时情绪下沉 → 广播化学态 → Kai 感知到 Luna
192
192
 
193
193
  ---
194
194
 
195
- ## 30 秒安装
195
+ ## 一条命令,给任何 Agent 加上主观性
196
196
 
197
197
  ```bash
198
- npm install psyche-ai
199
- ```
200
-
201
- 或者通过 OpenClaw 插件安装:
202
-
203
- ```bash
204
- openclaw plugins install psyche-ai
198
+ npx psyche-ai setup
205
199
  ```
206
200
 
207
- 验证:
208
-
209
- ```bash
210
- openclaw plugins list | grep psyche
211
- # 看到 "psyche │ loaded" 就行了
212
- ```
201
+ 自动检测本机的 Claude Code / Claude Desktop / Cursor / Windsurf,写入配置。Claude Code 即时生效,其他重启后生效。不需要知道配置文件在哪,不需要手动编辑任何 JSON。
213
202
 
214
- 然后正常聊天。试试夸它、骂它、冷落它——你会发现面前不再是一个工具。
203
+ 人格会从交互中自然涌现。如果想指定初始名字:`npx psyche-ai setup --name Luna`
215
204
 
216
- **安装后升级:**
205
+ **覆盖非 MCP 的 Agent(Codex、自定义 agent 等)——透明代理:**
217
206
 
218
207
  ```bash
219
- # 安全检查是否有新版本
220
- psyche upgrade --check
221
-
222
- # 显式升级(会按安装形态自动选择安全路径)
223
- psyche upgrade
224
-
225
- # 如需确认 npm 最新版
226
- npm view psyche-ai version
208
+ npx psyche-ai setup --proxy -t https://api.openai.com/v1
227
209
  ```
228
210
 
229
- - npm 管理的安装会后台安全检查更新,必要时才尝试自动升级。
230
- - `git` 工作树和本地路径安装不会偷偷改你的代码;脏工作树只会提示手动命令。
231
- - OpenClaw 如果是从当前仓库本地加载,升级后记得重启 gateway 以载入新的 `dist/`。
211
+ 启动本地代理 + 自动设置 `OPENAI_BASE_URL`。所有使用 OpenAI SDK 的程序自动走代理。Agent 完全不知道 Psyche 存在——镜子,不是麦克风。
232
212
 
233
- ## 透明代理(推荐:任意 LLM 一行接入)
213
+ | 路径 | 覆盖范围 | 原理 |
214
+ |------|---------|------|
215
+ | MCP (`setup`) | Claude Code / Desktop / Cursor / Windsurf | MCP 工具协议 |
216
+ | Proxy (`setup --proxy`) | 任意使用 OpenAI/Anthropic SDK 的 agent | 环境变量重定向 HTTP |
234
217
 
235
- ```bash
236
- psyche-proxy --target https://api.openai.com/v1 --name Luna --mbti ENFP
237
- ```
218
+ **验证:**`npx psyche-ai probe --json` — `ok: true` 就是在用了。
238
219
 
239
- 然后把客户端的 API 地址改成 `http://localhost:3340/v1`。Agent 获得持续主观性,但完全不知道 Psyche 存在。Psyche 像内分泌系统一样在后台观测行为、注入偏置——镜子,不是麦克风。
220
+ **升级:**`npx psyche-ai upgrade`
240
221
 
241
222
  ## 给本机其他 Agent 的真实验收
242
223
 
File without changes
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. Restart MCP clients to activate. Proxy is running.");
636
+ console.log("\nDone. Claude Code is live. Other MCP clients need restart.");
606
637
  }
607
638
  }
608
639
  function usage() {
@@ -653,11 +684,12 @@ Examples:
653
684
  psyche profiles
654
685
  psyche profiles --mbti ENFP
655
686
 
656
- # Auto-configure all MCP clients
657
- psyche setup --mbti ENFP --name Luna
687
+ # Auto-configure all MCP clients (one command, done)
688
+ psyche setup
689
+ psyche setup --name Luna
658
690
 
659
691
  # Universal proxy — works with any agent using OpenAI SDK
660
- psyche setup --proxy -t https://api.openai.com/v1 --mbti ENFP
692
+ psyche setup --proxy -t https://api.openai.com/v1
661
693
 
662
694
  # Check for new package versions without applying them
663
695
  psyche upgrade --check
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "psyche-ai",
3
- "version": "10.2.2",
3
+ "version": "10.2.4",
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.2",
9
+ "version": "10.2.4",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "psyche-ai",
14
- "version": "10.2.2",
14
+ "version": "10.2.4",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },