@furongjun1999/dsh-memory 0.2.0 → 0.2.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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## 特性
11
11
 
12
- - **工具桥接**:Agent 可直接调用 `lingxu_remember / recall / search / think` 等灵枢能力
12
+ - **工具桥接**:Agent 可直接调用 `lingshu_remember / recall / search / think` 等灵枢能力
13
13
  (默认精选 12 个核心工具,可切换全部或自定义集合)
14
14
  - **自动记忆**:DSH 对话自动沉淀进灵枢记忆库——用户消息带重要性写入、去重,随会话累积
15
15
  - **动态 schema**:工具清单运行时从灵枢 `tools/list` 实时拉取,灵枢升级新增工具 DSH 侧零改动
@@ -22,7 +22,7 @@
22
22
  ┌─────────────────────────────────────────────┐
23
23
  │ DeepSeek Harness (cordis) │
24
24
  │ │
25
- │ Agent Loop ──┬── lingxu_remember/recall… │
25
+ │ Agent Loop ──┬── lingshu_remember/recall… │
26
26
  │ │ (ctx.tools 注册) │
27
27
  │ session/event│ │
28
28
  │ (自动记忆钩子)│ │
@@ -70,10 +70,10 @@ dsh plugin --profile <name> add <本插件本地路径或 git 地址>
70
70
  在 profile 的 `cordis.yml`(或 `cordis.patch.yml`)中追加:
71
71
 
72
72
  ```yaml
73
- - id: lingxu-memory
73
+ - id: lingshu-memory
74
74
  name: '@furongjun1999/dsh-memory'
75
75
  config:
76
- dbPath: 'D:/data/lingxu.db' # 灵枢记忆库路径(目录自动创建)
76
+ dbPath: 'D:/data/lingshu.db' # 灵枢记忆库路径(目录自动创建)
77
77
  identity: '灵枢'
78
78
  tools: 'core'
79
79
  memory:
@@ -90,10 +90,10 @@ dsh plugin --profile <name> add <本插件本地路径或 git 地址>
90
90
 
91
91
  | 字段 | 类型 | 默认值 | 说明 |
92
92
  |------|------|--------|------|
93
- | `serverName` | string | `lingxu` | 工具命名空间前缀(工具名 `lingxu_<name>`) |
93
+ | `serverName` | string | `lingshu` | 工具命名空间前缀(工具名 `lingshu_<name>`) |
94
94
  | `python` | string | `python` | Python 可执行文件 |
95
95
  | `moduleArgs` | string[] | `['-m', 'aeis.mcp.server']` | 灵枢 server 启动参数 |
96
- | `dbPath` | string | `data/lingxu.db` | 记忆库 SQLite 路径(自动建目录) |
96
+ | `dbPath` | string | `data/lingshu.db` | 记忆库 SQLite 路径(自动建目录) |
97
97
  | `identity` | string | `灵枢` | 灵枢身份标识 |
98
98
  | `env` | object | `{}` | 追加环境变量(`BOCHA_API_KEY` / `AEIS_DESIGNER_KEY`…) |
99
99
  | `tools` | `'core' \| 'all' \| string[]` | `'core'` | 暴露的工具集合 |
@@ -109,18 +109,18 @@ dsh plugin --profile <name> add <本插件本地路径或 git 地址>
109
109
 
110
110
  | 工具 | 说明 |
111
111
  |------|------|
112
- | `lingxu_remember` | 写入记忆(内容/重要性/标签/实体) |
113
- | `lingxu_recall` | 组合联想召回(相似+重要性+近因加权) |
114
- | `lingxu_search` | 内容检索(二元组 Jaccard) |
115
- | `lingxu_timeline` | 记忆时间线 |
116
- | `lingxu_think` | 推理前记忆注入(检索相关记忆构造上下文) |
117
- | `lingxu_relate` | 建立关系边(causal/similar/sequential…) |
118
- | `lingxu_predict_routes` | 生成式预测(未来路线集合) |
119
- | `lingxu_ingest_text` | 外部知识摄取(文本) |
120
- | `lingxu_ingest_url` | URL 页面摄取 |
121
- | `lingxu_session_note` | 会话要点外部化 |
122
- | `lingxu_self_check` | 完整性自检 |
123
- | `lingxu_service_info` | 灵枢服务状态 |
112
+ | `lingshu_remember` | 写入记忆(内容/重要性/标签/实体) |
113
+ | `lingshu_recall` | 组合联想召回(相似+重要性+近因加权) |
114
+ | `lingshu_search` | 内容检索(二元组 Jaccard) |
115
+ | `lingshu_timeline` | 记忆时间线 |
116
+ | `lingshu_think` | 推理前记忆注入(检索相关记忆构造上下文) |
117
+ | `lingshu_relate` | 建立关系边(causal/similar/sequential…) |
118
+ | `lingshu_predict_routes` | 生成式预测(未来路线集合) |
119
+ | `lingshu_ingest_text` | 外部知识摄取(文本) |
120
+ | `lingshu_ingest_url` | URL 页面摄取 |
121
+ | `lingshu_session_note` | 会话要点外部化 |
122
+ | `lingshu_self_check` | 完整性自检 |
123
+ | `lingshu_service_info` | 灵枢服务状态 |
124
124
 
125
125
  配置 `tools: 'all'` 可暴露全部 38 个工具(含视觉/自我认知/设计者裁决等)。
126
126
 
@@ -5,14 +5,14 @@
5
5
  # - !!js process.env.X 语法在加载期求值,密钥不入库
6
6
  # - dbPath 建议用绝对路径;目录不存在会自动创建
7
7
 
8
- - id: lingxu-memory
8
+ - id: lingshu-memory
9
9
  name: '@furongjun1999/dsh-memory'
10
10
  config:
11
- # 工具命名空间:Agent 看到的工具名是 lingxu_remember / lingxu_recall ...
12
- serverName: 'lingxu'
11
+ # 工具命名空间:Agent 看到的工具名是 lingshu_remember / lingshu_recall ...
12
+ serverName: 'lingshu'
13
13
 
14
14
  # 灵枢记忆库持久化路径(SQLite)
15
- dbPath: 'D:/data/lingxu.db'
15
+ dbPath: 'D:/data/lingshu.db'
16
16
 
17
17
  # 灵枢身份标识
18
18
  identity: '灵枢'
@@ -42,10 +42,10 @@
42
42
  failOnStartupError: false
43
43
 
44
44
  # 多实例示例:第二个灵枢(不同记忆库/身份/命名空间)
45
- # - id: lingxu-memory-2
45
+ # - id: lingshu-memory-2
46
46
  # name: '@furongjun1999/dsh-memory'
47
47
  # config:
48
- # serverName: 'lingxu2'
49
- # dbPath: 'D:/data/lingxu2.db'
48
+ # serverName: 'lingshu2'
49
+ # dbPath: 'D:/data/lingshu2.db'
50
50
  # identity: '灵枢二号'
51
51
  # tools: ['remember', 'recall']
package/lib/bridge.d.ts CHANGED
@@ -36,7 +36,7 @@ export interface BridgeOptions {
36
36
  /** 断线重连的最大间隔(毫秒),默认 30s。 */
37
37
  maxRetryDelayMs: number;
38
38
  }
39
- export declare class LingxuBridge {
39
+ export declare class LingshuBridge {
40
40
  private readonly options;
41
41
  private proc;
42
42
  private rl;
package/lib/bridge.js CHANGED
@@ -10,7 +10,7 @@ import { spawn } from 'node:child_process';
10
10
  import { createInterface } from 'node:readline';
11
11
  import { mkdirSync } from 'node:fs';
12
12
  import { dirname } from 'node:path';
13
- export class LingxuBridge {
13
+ export class LingshuBridge {
14
14
  options;
15
15
  proc = null;
16
16
  rl = null;
@@ -102,7 +102,7 @@ export class LingxuBridge {
102
102
  // stderr 透传日志(灵枢把日志写在 stderr,避免污染协议流)
103
103
  const text = chunk.toString('utf8').trim();
104
104
  if (text)
105
- console.error(`[lingxu-bridge] ${text}`);
105
+ console.error(`[lingshu-bridge] ${text}`);
106
106
  });
107
107
  this.rl.on('line', (line) => {
108
108
  if (!line.trim())
@@ -112,7 +112,7 @@ export class LingxuBridge {
112
112
  msg = JSON.parse(line);
113
113
  }
114
114
  catch {
115
- console.error(`[lingxu-bridge] 非 JSON 输出: ${line.slice(0, 200)}`);
115
+ console.error(`[lingshu-bridge] 非 JSON 输出: ${line.slice(0, 200)}`);
116
116
  return;
117
117
  }
118
118
  if (typeof msg['id'] === 'number') {
@@ -122,14 +122,14 @@ export class LingxuBridge {
122
122
  proc.on('error', (err) => {
123
123
  // 进程无法启动(python 不存在等)——响亮失败
124
124
  if (!this.disposed) {
125
- console.error(`[lingxu-bridge] 灵枢进程启动失败: ${err.message}`);
125
+ console.error(`[lingshu-bridge] 灵枢进程启动失败: ${err.message}`);
126
126
  this.readyState = 'failed';
127
127
  this.flushBootQueue(false);
128
128
  this.scheduleRetry();
129
129
  }
130
130
  });
131
131
  proc.on('exit', (code, signal) => {
132
- console.error(`[lingxu-bridge] 灵枢进程退出 code=${code} signal=${signal}`);
132
+ console.error(`[lingshu-bridge] 灵枢进程退出 code=${code} signal=${signal}`);
133
133
  this.rl?.close();
134
134
  this.rl = null;
135
135
  this.rejectAll(new Error(`灵枢进程已退出(code=${code} signal=${signal ?? 'none'})`));
@@ -157,7 +157,7 @@ export class LingxuBridge {
157
157
  }
158
158
  catch (err) {
159
159
  if (!this.disposed) {
160
- console.error(`[lingxu-bridge] 握手失败: ${err.message}`);
160
+ console.error(`[lingshu-bridge] 握手失败: ${err.message}`);
161
161
  this.readyState = 'failed';
162
162
  this.flushBootQueue(false);
163
163
  this.scheduleRetry();
package/lib/hooks.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import '@deepseek-ai/dsh-session';
9
9
  import type { Context } from '@deepseek-ai/cordis';
10
- import type { LingxuBridge } from './bridge.js';
10
+ import type { LingshuBridge } from './bridge.js';
11
11
  /** 自动记忆开关。 */
12
12
  export interface MemoryHooksOptions {
13
13
  /** 用户消息 → remember(默认 true)。 */
@@ -20,4 +20,4 @@ export interface MemoryHooksOptions {
20
20
  importance: number;
21
21
  }
22
22
  /** 安装自动记忆钩子(effect 作用域内,随插件卸载自动移除)。 */
23
- export declare function installMemoryHooks(ctx: Context, bridge: LingxuBridge, opts: MemoryHooksOptions): void;
23
+ export declare function installMemoryHooks(ctx: Context, bridge: LingshuBridge, opts: MemoryHooksOptions): void;
package/lib/index.d.ts CHANGED
@@ -2,15 +2,15 @@
2
2
  * @furongjun1999/dsh-memory —— 灵枢(AEIS)DeepSeek Harness 插件
3
3
  *
4
4
  * 把灵枢的时空记忆/知识飞轮/自我认知接入 DSH:
5
- * - 工具桥接:Agent 可调用 lingxu_remember / recall / search / think 等
5
+ * - 工具桥接:Agent 可调用 lingshu_remember / recall / search / think 等
6
6
  * - 自动记忆:DSH 对话自动沉淀进灵枢记忆库(去重+重要性)
7
7
  *
8
8
  * 用法(cordis.yml):
9
9
  * ```yaml
10
- * - id: lingxu-memory
10
+ * - id: lingshu-memory
11
11
  * name: '@furongjun1999/dsh-memory'
12
12
  * config:
13
- * dbPath: 'D:/path/to/lingxu.db'
13
+ * dbPath: 'D:/path/to/lingshu.db'
14
14
  * identity: '灵枢'
15
15
  * memory:
16
16
  * userMessage: true
@@ -25,7 +25,7 @@ export declare const name = "dsh-memory";
25
25
  export declare const inject: string[];
26
26
  /** 插件配置。 */
27
27
  export interface Config {
28
- /** 工具命名空间前缀(默认 lingxu → lingxu_remember)。 */
28
+ /** 工具命名空间前缀(默认 lingshu → lingshu_remember)。 */
29
29
  serverName: string;
30
30
  /** Python 可执行文件(或 aeis-mcp console script)。 */
31
31
  python: string;
package/lib/index.js CHANGED
@@ -2,32 +2,32 @@
2
2
  * @furongjun1999/dsh-memory —— 灵枢(AEIS)DeepSeek Harness 插件
3
3
  *
4
4
  * 把灵枢的时空记忆/知识飞轮/自我认知接入 DSH:
5
- * - 工具桥接:Agent 可调用 lingxu_remember / recall / search / think 等
5
+ * - 工具桥接:Agent 可调用 lingshu_remember / recall / search / think 等
6
6
  * - 自动记忆:DSH 对话自动沉淀进灵枢记忆库(去重+重要性)
7
7
  *
8
8
  * 用法(cordis.yml):
9
9
  * ```yaml
10
- * - id: lingxu-memory
10
+ * - id: lingshu-memory
11
11
  * name: '@furongjun1999/dsh-memory'
12
12
  * config:
13
- * dbPath: 'D:/path/to/lingxu.db'
13
+ * dbPath: 'D:/path/to/lingshu.db'
14
14
  * identity: '灵枢'
15
15
  * memory:
16
16
  * userMessage: true
17
17
  * ```
18
18
  */
19
19
  import z from '@deepseek-ai/schemastery';
20
- import { LingxuBridge } from './bridge.js';
21
- import { registerLingxuTools } from './tools.js';
20
+ import { LingshuBridge } from './bridge.js';
21
+ import { registerLingshuTools } from './tools.js';
22
22
  import { installMemoryHooks } from './hooks.js';
23
23
  export const name = 'dsh-memory';
24
24
  /** 本插件依赖的工具注册服务。 */
25
25
  export const inject = ['tools'];
26
26
  export const Config = z.object({
27
- serverName: z.string().default('lingxu'),
27
+ serverName: z.string().default('lingshu'),
28
28
  python: z.string().default('python'),
29
29
  moduleArgs: z.array(String).default(['-m', 'aeis.mcp.server']),
30
- dbPath: z.string().default('data/lingxu.db'),
30
+ dbPath: z.string().default('data/lingshu.db'),
31
31
  identity: z.string().default('灵枢'),
32
32
  env: z.dict(String).default({}),
33
33
  tools: z.union([z.const('core'), z.const('brain'), z.const('all'), z.array(String)]).default('brain'),
@@ -53,7 +53,7 @@ export async function apply(ctx, config) {
53
53
  // 宪章宣告(接入即接受宪章约束——docs/guardrail-charter.md v2.0-published)
54
54
  ctx.logger.info(`dsh-memory: 灵枢插件激活(大脑模式)· 接受护栏宪章 ${config.charter} —— ` +
55
55
  '接入即接受宪章约束(公开/可执行/可审计/设计者终裁)');
56
- const bridge = new LingxuBridge({
56
+ const bridge = new LingshuBridge({
57
57
  python: config.python,
58
58
  args: config.moduleArgs,
59
59
  env: {
@@ -76,7 +76,7 @@ export async function apply(ctx, config) {
76
76
  try {
77
77
  // 工具注册(就绪后执行;未就绪时 tools/list 会报错,由重连机制兜底)
78
78
  if (ready) {
79
- disposers.push(await registerLingxuTools(ctx, bridge, {
79
+ disposers.push(await registerLingshuTools(ctx, bridge, {
80
80
  selection: config.tools,
81
81
  toolPrefix: `${config.serverName}_`,
82
82
  }));
package/lib/tools.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import type { Context } from '@deepseek-ai/cordis';
8
8
  import { type ParameterSchemaSpec } from '@deepseek-ai/dsh-tools';
9
- import type { LingxuBridge } from './bridge.ts';
9
+ import type { LingshuBridge } from './bridge.ts';
10
10
  /** 默认暴露的核心工具集合(记忆/推理/摄取/元认知)。 */
11
11
  export declare const CORE_TOOLS: readonly ["remember", "recall", "search", "timeline", "think", "relate", "predict_routes", "ingest_text", "ingest_url", "session_note", "self_check", "service_info"];
12
12
  /**
@@ -28,7 +28,7 @@ export declare function extractText(content: Array<{
28
28
  [key: string]: unknown;
29
29
  }>): string;
30
30
  /** 注册灵枢工具到 ctx.tools;返回取消注册函数。 */
31
- export declare function registerLingxuTools(ctx: Context, bridge: LingxuBridge, opts: {
31
+ export declare function registerLingshuTools(ctx: Context, bridge: LingshuBridge, opts: {
32
32
  selection: ToolSelection;
33
33
  toolPrefix: string;
34
34
  }): Promise<() => void>;
package/lib/tools.js CHANGED
@@ -121,7 +121,7 @@ export function extractText(content) {
121
121
  .join('\n');
122
122
  }
123
123
  /** 注册灵枢工具到 ctx.tools;返回取消注册函数。 */
124
- export async function registerLingxuTools(ctx, bridge, opts) {
124
+ export async function registerLingshuTools(ctx, bridge, opts) {
125
125
  const tools = await bridge.listTools();
126
126
  const wanted = new Set(selectTools(tools.map((t) => t.name), opts.selection));
127
127
  const disposers = [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@furongjun1999/dsh-memory",
3
- "version": "0.2.0",
4
- "description": "灵枢(AEIS)DeepSeek Harness 插件:把灵枢的时空记忆/知识飞轮/自我认知接入 DSH,对话自动沉淀进记忆库",
3
+ "version": "0.2.1",
4
+ "description": "灵枢(Lingshu·líng shū)DeepSeek Harness 插件:完整大脑——长期记忆/知识飞轮/自我认知/递归反思接入 DSH,对话自动沉淀进记忆库",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "memory",
25
25
  "agent",
26
26
  "aeis",
27
- "lingxu"
27
+ "lingshu"
28
28
  ],
29
29
  "license": "MIT",
30
30
  "peerDependencies": {