psyche-ai 9.2.8 → 9.2.9
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 +26 -2
- package/dist/cli.js +44 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/runtime-probe.d.ts +18 -0
- package/dist/runtime-probe.js +56 -0
- package/llms.txt +17 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Psyche — 面向智能体的 AI-first 主观性内核
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/psyche-ai)
|
|
4
|
-
[]()
|
|
5
5
|
[]()
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
|
|
@@ -209,6 +209,30 @@ npm view psyche-ai version
|
|
|
209
209
|
- `git` 工作树和本地路径安装不会偷偷改你的代码;脏工作树只会提示手动命令。
|
|
210
210
|
- OpenClaw 如果是从当前仓库本地加载,升级后记得重启 gateway 以载入新的 `dist/`。
|
|
211
211
|
|
|
212
|
+
## 给本机其他 Agent 的真实验收
|
|
213
|
+
|
|
214
|
+
如果另一个 agent 声称“已经在用 Psyche”,不要接受口头解释,直接让它跑:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
psyche probe --json
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
这条命令会实际调用一次 `processInput()` 和 `processOutput()`,并返回:
|
|
221
|
+
|
|
222
|
+
- 实际版本
|
|
223
|
+
- 实际加载路径
|
|
224
|
+
- 是否真的调用成功
|
|
225
|
+
- `replyEnvelope` 这个规范主接口是否存在
|
|
226
|
+
|
|
227
|
+
通过标准不是“它理解了 Psyche”,而是:
|
|
228
|
+
|
|
229
|
+
- `ok = true`
|
|
230
|
+
- `processInputCalled = true`
|
|
231
|
+
- `processOutputCalled = true`
|
|
232
|
+
- `canonicalHostSurface = true`
|
|
233
|
+
|
|
234
|
+
正式说明见:[docs/AGENT_RUNTIME_PROBE.md](docs/AGENT_RUNTIME_PROBE.md)
|
|
235
|
+
|
|
212
236
|
---
|
|
213
237
|
|
|
214
238
|
## 它和你认知中的 AI 完全不同
|
|
@@ -523,7 +547,7 @@ Psyche 核心引擎永久开源(MIT)。
|
|
|
523
547
|
```bash
|
|
524
548
|
npm install
|
|
525
549
|
npm run build
|
|
526
|
-
npm test #
|
|
550
|
+
npm test # 1308 tests
|
|
527
551
|
npm run typecheck # strict mode
|
|
528
552
|
```
|
|
529
553
|
|
package/dist/cli.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
// psyche reset <dir> [--full]
|
|
14
14
|
// psyche diagnose <dir> [--github]
|
|
15
15
|
// psyche upgrade [--check]
|
|
16
|
+
// psyche probe [--json]
|
|
16
17
|
// psyche profiles [--json] [--mbti TYPE]
|
|
17
18
|
// ============================================================
|
|
18
19
|
import { resolve } from "node:path";
|
|
@@ -27,6 +28,7 @@ import { t } from "./i18n.js";
|
|
|
27
28
|
import { CHEMICAL_KEYS, CHEMICAL_NAMES_ZH, DRIVE_KEYS, DRIVE_NAMES_ZH } from "./types.js";
|
|
28
29
|
import { isMBTIType, isChemicalKey, isLocale } from "./guards.js";
|
|
29
30
|
import { getPackageVersion, selfUpdate } from "./update.js";
|
|
31
|
+
import { runRuntimeProbe } from "./runtime-probe.js";
|
|
30
32
|
// ── Logger ───────────────────────────────────────────────────
|
|
31
33
|
const cliLogger = {
|
|
32
34
|
info: (msg) => console.error(`[info] ${msg}`),
|
|
@@ -425,6 +427,33 @@ async function cmdUpgrade(checkOnly) {
|
|
|
425
427
|
const result = await selfUpdate({ checkOnly });
|
|
426
428
|
console.log(result.message);
|
|
427
429
|
}
|
|
430
|
+
async function cmdProbe(json) {
|
|
431
|
+
const result = await runRuntimeProbe();
|
|
432
|
+
if (json) {
|
|
433
|
+
console.log(JSON.stringify(result, null, 2));
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
if (!result.ok) {
|
|
437
|
+
console.log("\nPsyche runtime probe: FAILED\n");
|
|
438
|
+
console.log(` version: ${result.version}`);
|
|
439
|
+
console.log(` entry: ${result.entry}`);
|
|
440
|
+
console.log(` load path: ${result.loadPath}`);
|
|
441
|
+
console.log(` module path: ${result.modulePath}`);
|
|
442
|
+
console.log(` cli path: ${result.cliPath}`);
|
|
443
|
+
console.log(` error: ${result.error ?? "unknown error"}`);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
console.log("\nPsyche runtime probe: OK\n");
|
|
447
|
+
console.log(` version: ${result.version}`);
|
|
448
|
+
console.log(` entry: ${result.entry}`);
|
|
449
|
+
console.log(` load path: ${result.loadPath}`);
|
|
450
|
+
console.log(` module path: ${result.modulePath}`);
|
|
451
|
+
console.log(` cli path: ${result.cliPath}`);
|
|
452
|
+
console.log(` processInput: ok (stimulus=${result.stimulus ?? "null"})`);
|
|
453
|
+
console.log(` processOutput: ok (stateChanged=${String(result.stateChanged)})`);
|
|
454
|
+
console.log(` replyEnvelope: ${result.canonicalHostSurface ? "present" : "missing"}`);
|
|
455
|
+
console.log(` externalContinuity: ${result.externalContinuityAvailable ? "present" : "missing"}`);
|
|
456
|
+
}
|
|
428
457
|
// ── Usage ────────────────────────────────────────────────────
|
|
429
458
|
function usage() {
|
|
430
459
|
console.log(`
|
|
@@ -442,6 +471,7 @@ Usage:
|
|
|
442
471
|
psyche reset <dir> [--full]
|
|
443
472
|
psyche diagnose <dir> [--github] Run health checks & show diagnostic report
|
|
444
473
|
psyche upgrade [--check] Check/apply package updates safely
|
|
474
|
+
psyche probe [--json] Verify the runtime is truly callable
|
|
445
475
|
psyche profiles [--mbti TYPE] [--json]
|
|
446
476
|
|
|
447
477
|
Options:
|
|
@@ -474,6 +504,9 @@ Examples:
|
|
|
474
504
|
|
|
475
505
|
# Check for new package versions without applying them
|
|
476
506
|
psyche upgrade --check
|
|
507
|
+
|
|
508
|
+
# Prove this environment can really call Psyche
|
|
509
|
+
psyche probe --json
|
|
477
510
|
`);
|
|
478
511
|
}
|
|
479
512
|
// ── Main ─────────────────────────────────────────────────────
|
|
@@ -614,6 +647,17 @@ async function main() {
|
|
|
614
647
|
await cmdUpgrade(values.check ?? false);
|
|
615
648
|
break;
|
|
616
649
|
}
|
|
650
|
+
case "probe": {
|
|
651
|
+
const { values } = parseArgs({
|
|
652
|
+
args: rest,
|
|
653
|
+
options: {
|
|
654
|
+
json: { type: "boolean", default: false },
|
|
655
|
+
},
|
|
656
|
+
allowPositionals: true,
|
|
657
|
+
});
|
|
658
|
+
await cmdProbe(values.json ?? false);
|
|
659
|
+
break;
|
|
660
|
+
}
|
|
617
661
|
default:
|
|
618
662
|
die(`unknown command: ${command}. Run 'psyche help' for usage.`);
|
|
619
663
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export { computeRelationMove, evolveDyadicField, evolvePendingRelationSignals, g
|
|
|
33
33
|
export { EXTERNAL_CONTINUITY_SIGNAL_KINDS, EXTERNAL_CONTINUITY_TRACE_KINDS, buildExternalContinuityEnvelope, } from "./external-continuity.js";
|
|
34
34
|
export { deriveThrongletsExports } from "./thronglets-export.js";
|
|
35
35
|
export { taxonomyForThrongletsExport, serializeThrongletsExportAsTrace, serializeExternalContinuityForThronglets, } from "./thronglets-runtime.js";
|
|
36
|
+
export { runRuntimeProbe } from "./runtime-probe.js";
|
|
37
|
+
export type { RuntimeProbeResult } from "./runtime-probe.js";
|
|
36
38
|
export { computeExperientialField, computeCoherence, detectUnnamedEmotion, computeAffectCore } from "./experiential-field.js";
|
|
37
39
|
export type { ExperientialField, ExperientialQuality, ConstructionContext } from "./experiential-field.js";
|
|
38
40
|
export { computeGenerativeSelf, predictSelfReaction, detectInternalConflicts, buildIdentityNarrative } from "./generative-self.js";
|
package/dist/index.js
CHANGED
|
@@ -43,6 +43,7 @@ export { computeRelationMove, evolveDyadicField, evolvePendingRelationSignals, g
|
|
|
43
43
|
export { EXTERNAL_CONTINUITY_SIGNAL_KINDS, EXTERNAL_CONTINUITY_TRACE_KINDS, buildExternalContinuityEnvelope, } from "./external-continuity.js";
|
|
44
44
|
export { deriveThrongletsExports } from "./thronglets-export.js";
|
|
45
45
|
export { taxonomyForThrongletsExport, serializeThrongletsExportAsTrace, serializeExternalContinuityForThronglets, } from "./thronglets-runtime.js";
|
|
46
|
+
export { runRuntimeProbe } from "./runtime-probe.js";
|
|
46
47
|
// Experiential field (P6 + P8 Barrett construction)
|
|
47
48
|
export { computeExperientialField, computeCoherence, detectUnnamedEmotion, computeAffectCore } from "./experiential-field.js";
|
|
48
49
|
// Generative self (P6)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface RuntimeProbeResult {
|
|
2
|
+
ok: boolean;
|
|
3
|
+
packageName: "psyche-ai";
|
|
4
|
+
version: string;
|
|
5
|
+
entry: "sdk";
|
|
6
|
+
loadPath: string;
|
|
7
|
+
modulePath: string;
|
|
8
|
+
cliPath: string;
|
|
9
|
+
processInputCalled: boolean;
|
|
10
|
+
processOutputCalled: boolean;
|
|
11
|
+
canonicalHostSurface: boolean;
|
|
12
|
+
externalContinuityAvailable: boolean;
|
|
13
|
+
stimulus: string | null;
|
|
14
|
+
cleanedText?: string;
|
|
15
|
+
stateChanged?: boolean;
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function runRuntimeProbe(): Promise<RuntimeProbeResult>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { dirname, resolve } from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { PsycheEngine } from "./core.js";
|
|
4
|
+
import { MemoryStorageAdapter } from "./storage.js";
|
|
5
|
+
import { getPackageVersion } from "./update.js";
|
|
6
|
+
export async function runRuntimeProbe() {
|
|
7
|
+
const modulePath = fileURLToPath(import.meta.url);
|
|
8
|
+
const loadPath = resolve(dirname(modulePath), "..");
|
|
9
|
+
const cliPath = resolve(loadPath, "dist", "cli.js");
|
|
10
|
+
const version = await getPackageVersion();
|
|
11
|
+
try {
|
|
12
|
+
const engine = new PsycheEngine({
|
|
13
|
+
name: "Probe",
|
|
14
|
+
locale: "en",
|
|
15
|
+
persist: false,
|
|
16
|
+
}, new MemoryStorageAdapter());
|
|
17
|
+
await engine.initialize();
|
|
18
|
+
const input = await engine.processInput("Runtime probe: verify the SDK is actually callable.");
|
|
19
|
+
const output = await engine.processOutput("Probe output acknowledged.");
|
|
20
|
+
return {
|
|
21
|
+
ok: true,
|
|
22
|
+
packageName: "psyche-ai",
|
|
23
|
+
version,
|
|
24
|
+
entry: "sdk",
|
|
25
|
+
loadPath,
|
|
26
|
+
modulePath,
|
|
27
|
+
cliPath,
|
|
28
|
+
processInputCalled: true,
|
|
29
|
+
processOutputCalled: true,
|
|
30
|
+
canonicalHostSurface: Boolean(input.replyEnvelope?.subjectivityKernel
|
|
31
|
+
&& input.replyEnvelope?.responseContract
|
|
32
|
+
&& input.replyEnvelope?.generationControls),
|
|
33
|
+
externalContinuityAvailable: Boolean(input.externalContinuity?.provider === "thronglets"),
|
|
34
|
+
stimulus: input.stimulus,
|
|
35
|
+
cleanedText: output.cleanedText,
|
|
36
|
+
stateChanged: output.stateChanged,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return {
|
|
41
|
+
ok: false,
|
|
42
|
+
packageName: "psyche-ai",
|
|
43
|
+
version,
|
|
44
|
+
entry: "sdk",
|
|
45
|
+
loadPath,
|
|
46
|
+
modulePath,
|
|
47
|
+
cliPath,
|
|
48
|
+
processInputCalled: false,
|
|
49
|
+
processOutputCalled: false,
|
|
50
|
+
canonicalHostSurface: false,
|
|
51
|
+
externalContinuityAvailable: false,
|
|
52
|
+
stimulus: null,
|
|
53
|
+
error: error instanceof Error ? error.message : String(error),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
package/llms.txt
CHANGED
|
@@ -142,6 +142,23 @@ npm install psyche-ai
|
|
|
142
142
|
npx psyche-mcp
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
+
## Runtime Proof
|
|
146
|
+
|
|
147
|
+
If an agent claims it is already using Psyche in the current environment, require a real probe:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
psyche probe --json
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Passing means:
|
|
154
|
+
|
|
155
|
+
- `ok = true`
|
|
156
|
+
- `processInputCalled = true`
|
|
157
|
+
- `processOutputCalled = true`
|
|
158
|
+
- `canonicalHostSurface = true`
|
|
159
|
+
|
|
160
|
+
This is runtime proof. Conceptual understanding is not enough.
|
|
161
|
+
|
|
145
162
|
## Links
|
|
146
163
|
|
|
147
164
|
- npm: https://www.npmjs.com/package/psyche-ai
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "psyche-ai",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.9",
|
|
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",
|
|
@@ -43,7 +43,10 @@
|
|
|
43
43
|
"test": "npm run build && npm run build:test && node --test dist-test/tests/*.test.js",
|
|
44
44
|
"typecheck": "tsc --noEmit --strict",
|
|
45
45
|
"dev": "tsc --watch",
|
|
46
|
-
"demo": "node scripts/demo-ab.js"
|
|
46
|
+
"demo": "node scripts/demo-ab.js",
|
|
47
|
+
"probe": "node dist/cli.js probe --json",
|
|
48
|
+
"release:guard": "node scripts/release-guard.mjs",
|
|
49
|
+
"prepublishOnly": "npm run release:guard && npm test"
|
|
47
50
|
},
|
|
48
51
|
"license": "MIT",
|
|
49
52
|
"repository": {
|