dsh-cooper-memory 0.0.0-stage → 0.1.0

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/lib/llm.mjs ADDED
@@ -0,0 +1,184 @@
1
+ // lib/llm.mjs —— 给服务进程用的最小 LLM 客户端
2
+ //
3
+ // 本机实际用的不是 api.deepseek.com,而是 profile 里配的网关:
4
+ // baseURL: https://api.ai8yx.com/v1 apiKeyEnv: CT_API_KEY model: deepseek-v4.1-flash-1017
5
+ // 实测该地址在白名单内(沙箱内 fetch 返回 200)。
6
+ //
7
+ // 两个坑:
8
+ // 1. 凭据文件是 flow mapping,值后面带逗号(`CT_API_KEY: sk-xxx,`),必须剥掉
9
+ // 2. 该模型是推理模型,max_tokens 太小会被 reasoning 吃光,content 返回空串
10
+
11
+ import fs from 'node:fs';
12
+ import os from 'node:os';
13
+ import path from 'node:path';
14
+
15
+ const DEFAULTS = {
16
+ base: 'https://api.ai8yx.com/v1',
17
+ model: 'deepseek-v4.1-flash-1017',
18
+ keyEnv: 'CT_API_KEY',
19
+ };
20
+
21
+ function readText(p) {
22
+ try { return fs.readFileSync(p, 'utf8'); } catch { return ''; }
23
+ }
24
+
25
+ function profilePatchPath() {
26
+ const profile = process.env.DSH_PROFILE || 'desktop';
27
+ return path.join(os.homedir(), '.dsh', 'profiles', profile, 'cordis.patch.yml');
28
+ }
29
+
30
+ /** 从 profile patch 里取 provider 的 baseURL / apiKeyEnv / 默认模型 */
31
+ function readProviderConfig() {
32
+ const yaml = readText(profilePatchPath());
33
+ const out = {};
34
+ if (!yaml) return out;
35
+ const baseM = yaml.match(/^\s*baseURL:\s*(\S+)\s*$/m);
36
+ if (baseM) out.base = baseM[1].replace(/['"]/g, '').replace(/\/+$/, '');
37
+ const keyM = yaml.match(/^\s*apiKeyEnv:\s*(\S+)\s*$/m);
38
+ if (keyM) out.keyEnv = keyM[1].replace(/['"]/g, '');
39
+ // agent-default-model 那段里的 model:
40
+ const idx = yaml.indexOf('agent-default-model');
41
+ if (idx >= 0) {
42
+ const block = yaml.slice(idx, idx + 600);
43
+ const m = block.match(/^\s*model:\s*(\S+)\s*$/m);
44
+ if (m) out.model = m[1].replace(/['"]/g, '');
45
+ }
46
+ return out;
47
+ }
48
+
49
+ /** 凭据:refs 是 flow mapping,值可能带尾巴的逗号或右花括号 */
50
+ function readCredentials() {
51
+ const yaml = readText(path.join(os.homedir(), '.dsh', '.credentials.yaml'));
52
+ const refs = {};
53
+ if (!yaml) return refs;
54
+ for (const line of yaml.split('\n')) {
55
+ const m = line.match(/^\s*([A-Za-z0-9_.-]+)\s*:\s*(\S+)\s*$/);
56
+ if (!m) continue;
57
+ const v = m[2].replace(/[,}]+$/, '');
58
+ if (/^sk-/.test(v) || v.length > 20) refs[m[1]] = v;
59
+ }
60
+ return refs;
61
+ }
62
+
63
+ export function resolveConfig() {
64
+ const prov = readProviderConfig();
65
+ const refs = readCredentials();
66
+ const keyEnv = process.env.LLM_KEY_ENV || prov.keyEnv || DEFAULTS.keyEnv;
67
+ const key = process.env[keyEnv] || refs[keyEnv] || refs.DEEPSEEK_API_KEY || null;
68
+ const base = (process.env.DEEPSEEK_BASE_URL || prov.base || DEFAULTS.base).replace(/\/+$/, '');
69
+ const model = process.env.LLM_MODEL || prov.model || DEFAULTS.model;
70
+ return { key, base, model, keyEnv, keyFrom: process.env[keyEnv] ? 'env' : (refs[keyEnv] ? 'file' : 'none') };
71
+ }
72
+
73
+ /** 探测:只回答"这个进程能不能用 LLM" */
74
+ export async function probe({ timeoutMs = 30000 } = {}) {
75
+ const cfg = resolveConfig();
76
+ if (!cfg.key) return { ok: false, stage: 'credential', error: `未找到 ${cfg.keyEnv}`, base: cfg.base };
77
+ const ctl = new AbortController();
78
+ const t = setTimeout(() => ctl.abort(), timeoutMs);
79
+ try {
80
+ const r = await fetch(cfg.base + '/chat/completions', {
81
+ method: 'POST',
82
+ signal: ctl.signal,
83
+ headers: { 'content-type': 'application/json', authorization: 'Bearer ' + cfg.key },
84
+ body: JSON.stringify({
85
+ model: cfg.model,
86
+ messages: [{ role: 'user', content: '只回答两个字:可用' }],
87
+ max_tokens: 64,
88
+ stream: false,
89
+ }),
90
+ });
91
+ const text = await r.text();
92
+ if (r.ok) {
93
+ let content = '';
94
+ try { content = JSON.parse(text).choices?.[0]?.message?.content ?? ''; } catch {}
95
+ return { ok: true, stage: 'ok', status: r.status, base: cfg.base, model: cfg.model, keyFrom: cfg.keyFrom, sample: content.slice(0, 40) };
96
+ }
97
+ if (r.status === 401 || r.status === 403) {
98
+ return { ok: false, stage: 'auth', status: r.status, base: cfg.base, keyFrom: cfg.keyFrom, error: text.slice(0, 200) };
99
+ }
100
+ return { ok: false, stage: 'http', status: r.status, base: cfg.base, error: text.slice(0, 200) };
101
+ } catch (e) {
102
+ const code = e?.cause?.code || e?.name || 'unknown';
103
+ return {
104
+ ok: false, stage: 'network', code,
105
+ error: code === 'EACCES' ? '出网被拦(沙箱/白名单)' : String(e.message || e),
106
+ base: cfg.base, keyFrom: cfg.keyFrom,
107
+ };
108
+ } finally { clearTimeout(t); }
109
+ }
110
+
111
+ /** 一次非流式对话,返回文本 */
112
+ export async function chat(messages, { model, maxTokens = 3000, timeoutMs = 90000, temperature = 0 } = {}) {
113
+ const cfg = resolveConfig();
114
+ if (!cfg.key) throw new Error(`未找到凭据 ${cfg.keyEnv}`);
115
+ const ctl = new AbortController();
116
+ const t = setTimeout(() => ctl.abort(), timeoutMs);
117
+ try {
118
+ const r = await fetch(cfg.base + '/chat/completions', {
119
+ method: 'POST',
120
+ signal: ctl.signal,
121
+ headers: { 'content-type': 'application/json', authorization: 'Bearer ' + cfg.key },
122
+ body: JSON.stringify({
123
+ model: model || cfg.model,
124
+ messages,
125
+ max_tokens: maxTokens,
126
+ temperature,
127
+ stream: false,
128
+ }),
129
+ });
130
+ const raw = await r.text();
131
+ if (!r.ok) throw new Error(`LLM HTTP ${r.status}: ${raw.slice(0, 300)}`);
132
+ const j = JSON.parse(raw);
133
+ const msg = j.choices?.[0]?.message ?? {};
134
+ // 推理模型可能把额度全花在 reasoning 上
135
+ if (!msg.content && msg.reasoning_content) throw new Error('模型只返回了 reasoning,没有正文;请调大 max_tokens');
136
+ return msg.content ?? '';
137
+ } catch (e) {
138
+ const code = e?.cause?.code;
139
+ if (code === 'EACCES') throw new Error('LLM 出网被拦(EACCES):' + cfg.base);
140
+ throw e;
141
+ } finally { clearTimeout(t); }
142
+ }
143
+
144
+ /** 哪些失败值得重试:连接类错误与 429/5xx;鉴权错、参数错不重试 */
145
+ export function isTransient(err) {
146
+ const m = String(err?.message || err || '');
147
+ return /ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|EPIPE|socket hang up|fetch failed|HTTP 429|HTTP 5\d\d/i.test(m);
148
+ }
149
+
150
+ /**
151
+ * 带指数退避的对话调用
152
+ * @param {object} retry {retries, baseDelayMs, maxDelayMs}
153
+ */
154
+ export async function chatWithRetry(messages, opts = {}, retry = {}) {
155
+ const retries = retry.retries ?? 2;
156
+ const baseDelayMs = retry.baseDelayMs ?? 800;
157
+ const maxDelayMs = retry.maxDelayMs ?? 8000;
158
+ let lastErr;
159
+ const attempts = [];
160
+ for (let attempt = 0; attempt <= retries; attempt++) {
161
+ const t0 = Date.now();
162
+ try {
163
+ const out = await chat(messages, opts);
164
+ attempts.push({ attempt: attempt + 1, ms: Date.now() - t0, ok: true });
165
+ if (process.env.DEBUG_DISTILL && attempt > 0) {
166
+ process.stderr.write(`RETRY_OK>>>attempt ${attempt + 1} after ${attempts.length - 1} failures\n`);
167
+ }
168
+ return out;
169
+ } catch (e) {
170
+ lastErr = e;
171
+ attempts.push({ attempt: attempt + 1, ms: Date.now() - t0, ok: false, error: String(e.message || e).slice(0, 120) });
172
+ const canRetry = attempt < retries && isTransient(e);
173
+ if (process.env.DEBUG_DISTILL) {
174
+ process.stderr.write(`ATTEMPT ${attempt + 1} failed: ${String(e.message || e).slice(0, 120)} | retry=${canRetry}\n`);
175
+ }
176
+ if (!canRetry) break;
177
+ const delay = Math.min(maxDelayMs, baseDelayMs * 2 ** attempt);
178
+ await new Promise((r) => setTimeout(r, delay));
179
+ }
180
+ }
181
+ const err = new Error(String(lastErr?.message || lastErr));
182
+ err.attempts = attempts;
183
+ throw err;
184
+ }
package/locale/en.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Local memory",
4
+ "description": "Cross-session memory and a folder knowledge base stored in a local SQLite file. Extracts preferences and facts from session logs, indexes folders with structure preserved, and lets you edit, diff, and roll back retrieval chunks.",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "本地记忆",
4
+ "description": "跨会话长期记忆 + 文件夹知识库,数据存在本地 SQLite 文件里。支持从会话日志自动提取偏好与事实、按原目录结构索引文件夹、对检索分块做编辑/比对/回滚。",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/mcp.mjs ADDED
@@ -0,0 +1,293 @@
1
+ #!/usr/bin/env node
2
+ // mcp.mjs —— stdio MCP 服务:DSH 通过子进程直接调用,不走任何网络
3
+ // 协议:JSON-RPC 2.0,stdin/stdout 每行一个消息(MCP stdio transport)
4
+ import readline from 'node:readline';
5
+ import { openDb } from './lib/db.mjs';
6
+ import {
7
+ ingestFolder, searchChunks, getChunk, editChunk, chunkHistory,
8
+ chunkVersionText, rollbackChunk, diffTexts, tree,
9
+ remember, confirmMemory, rejectMemory, editMemory, listMemories, recall,
10
+ } from './lib/core.mjs';
11
+ import { runAutoExtract, recentTurns, llmDistill } from './lib/extract.mjs';
12
+ import { probe as llmProbe } from './lib/llm.mjs';
13
+
14
+ const db = openDb();
15
+ const SERVER = { name: 'dsh-cooper-memory', version: '0.1.0' };
16
+ const PROTOCOL = '2024-11-05';
17
+
18
+ const TOOLS = [
19
+ {
20
+ name: 'memory_recall',
21
+ description: '召回长期记忆(跨会话)。返回常驻资料/偏好 + 与本轮问题相关的事实/事项。',
22
+ inputSchema: {
23
+ type: 'object',
24
+ properties: {
25
+ query: { type: 'string', description: '当前问题,用于匹配事实类记忆' },
26
+ budget_chars: { type: 'number', description: '字符预算,默认 1200' },
27
+ },
28
+ },
29
+ },
30
+ {
31
+ name: 'memory_remember',
32
+ description: '写入一条记忆。status=pending 时不参与召回,需用户确认后生效。',
33
+ inputSchema: {
34
+ type: 'object',
35
+ properties: {
36
+ kind: { type: 'string', enum: ['profile', 'preference', 'fact', 'todo', 'interest'] },
37
+ text: { type: 'string' },
38
+ subject: { type: 'string' },
39
+ status: { type: 'string', enum: ['pending', 'active'], description: '默认 pending' },
40
+ confidence: { type: 'number' },
41
+ tags: { type: 'string' },
42
+ supersedes: { type: 'number', description: '要替代的旧记忆 id;省略则自动探测同主题旧条目' },
43
+ },
44
+ required: ['kind', 'text'],
45
+ },
46
+ },
47
+ {
48
+ name: 'memory_confirm',
49
+ description: '确认一条待确认记忆,使其进入召回。',
50
+ inputSchema: { type: 'object', properties: { id: { type: 'number' } }, required: ['id'] },
51
+ },
52
+ {
53
+ name: 'memory_reject',
54
+ description: '拒绝一条记忆(保留抑制记录,不再召回)。',
55
+ inputSchema: { type: 'object', properties: { id: { type: 'number' }, note: { type: 'string' } }, required: ['id'] },
56
+ },
57
+ {
58
+ name: 'memory_list',
59
+ description: '列出记忆,可按状态/类别过滤。',
60
+ inputSchema: {
61
+ type: 'object',
62
+ properties: { status: { type: 'string' }, kind: { type: 'string' }, limit: { type: 'number' } },
63
+ },
64
+ },
65
+ {
66
+ name: 'memory_edit',
67
+ description: '编辑记忆正文(生成新版本)。',
68
+ inputSchema: {
69
+ type: 'object',
70
+ properties: { id: { type: 'number' }, text: { type: 'string' }, note: { type: 'string' } },
71
+ required: ['id', 'text'],
72
+ },
73
+ },
74
+ {
75
+ name: 'kb_search',
76
+ description: '知识库检索。可传 variants 数组(查询改写结果),服务端会用加权 RRF 融合多路结果,并用 MMR 去冗余。',
77
+ inputSchema: {
78
+ type: 'object',
79
+ properties: {
80
+ query: { type: 'string' },
81
+ variants: { type: 'array', items: { type: 'string' }, description: '同义改写/扩展查询' },
82
+ limit: { type: 'number' },
83
+ },
84
+ required: ['query'],
85
+ },
86
+ },
87
+ {
88
+ name: 'kb_get',
89
+ description: '读取单个分块全文。',
90
+ inputSchema: { type: 'object', properties: { chunk_id: { type: 'number' } }, required: ['chunk_id'] },
91
+ },
92
+ {
93
+ name: 'kb_edit',
94
+ description: '编辑分块正文,生成新版本。base_version 用于乐观锁:与当前版本不一致时拒绝。',
95
+ inputSchema: {
96
+ type: 'object',
97
+ properties: {
98
+ chunk_id: { type: 'number' },
99
+ text: { type: 'string' },
100
+ note: { type: 'string' },
101
+ base_version: { type: 'number' },
102
+ },
103
+ required: ['chunk_id', 'text'],
104
+ },
105
+ },
106
+ {
107
+ name: 'kb_history',
108
+ description: '分块版本历史。',
109
+ inputSchema: { type: 'object', properties: { chunk_id: { type: 'number' } }, required: ['chunk_id'] },
110
+ },
111
+ {
112
+ name: 'kb_diff',
113
+ description: '分块两版本逐行比对。',
114
+ inputSchema: {
115
+ type: 'object',
116
+ properties: { chunk_id: { type: 'number' }, from: { type: 'number' }, to: { type: 'number' } },
117
+ required: ['chunk_id', 'from'],
118
+ },
119
+ },
120
+ {
121
+ name: 'kb_rollback',
122
+ description: '把分块回滚到指定版本(生成新版本,不删除历史)。',
123
+ inputSchema: {
124
+ type: 'object',
125
+ properties: { chunk_id: { type: 'number' }, version: { type: 'number' } },
126
+ required: ['chunk_id', 'version'],
127
+ },
128
+ },
129
+ {
130
+ name: 'kb_tree',
131
+ description: '已入库文档的目录树(保留原始目录结构)。',
132
+ inputSchema: { type: 'object', properties: {} },
133
+ },
134
+ {
135
+ name: 'kb_ingest',
136
+ description: '导入一个目录(递归,保留相对路径),按三层策略自动分块。',
137
+ inputSchema: {
138
+ type: 'object',
139
+ properties: {
140
+ path: { type: 'string' },
141
+ chunk_size: { type: 'number' },
142
+ chunk_overlap: { type: 'number' },
143
+ strategy: { type: 'string', enum: ['auto', 'heading', 'heuristic', 'legacy'] },
144
+ },
145
+ required: ['path'],
146
+ },
147
+ },
148
+ {
149
+ name: 'memory_extract',
150
+ description: '自动提取:扫描 DSH 会话日志,把检测到的偏好/事实/画像写成「待确认」记忆。水位线去重,重复调用不会重复写入。',
151
+ inputSchema: {
152
+ type: 'object',
153
+ properties: {
154
+ sessions_dir: { type: 'string', description: '默认 ~/.dsh/sessions' },
155
+ limit: { type: 'number', description: '本轮最多新增条数,默认 30' },
156
+ dry_run: { type: 'boolean', description: '只看候选、不落库' },
157
+ },
158
+ },
159
+ },
160
+ {
161
+ name: 'memory_probe_llm',
162
+ description: '探测本服务进程能否调用 LLM。区分三种情况:network=出网被拦、auth=凭据不对、ok=可用。用于决定走 LLM 蒸馏还是规则提取。',
163
+ inputSchema: { type: 'object', properties: {} },
164
+ },
165
+ {
166
+ name: 'memory_distill',
167
+ description: '用 LLM 蒸馏最近的用户发言,提取长期记忆并写入待确认队列(比规则提取准)。若探针返回 network/auth 失败,请改用 memory_extract 或直接 memory_remember。',
168
+ inputSchema: {
169
+ type: 'object',
170
+ properties: {
171
+ turns_limit: { type: 'number', description: '取最近多少条用户发言,默认 60' },
172
+ limit: { type: 'number', description: '最多写入条数,默认 30' },
173
+ dry_run: { type: 'boolean' },
174
+ sessions_dir: { type: 'string' },
175
+ },
176
+ },
177
+ },
178
+ ];
179
+
180
+ async function callTool(name, a = {}) {
181
+ switch (name) {
182
+ case 'memory_recall': return recall(db, a.query || '', { budgetChars: a.budget_chars || 1200 });
183
+ case 'memory_remember': return remember(db, {
184
+ kind: a.kind, text: a.text, subject: a.subject || '',
185
+ status: a.status || 'pending', confidence: a.confidence ?? 0.6, source: 'mcp',
186
+ supersedes: a.supersedes ?? null,
187
+ });
188
+ case 'memory_confirm': return confirmMemory(db, Number(a.id));
189
+ case 'memory_reject': return rejectMemory(db, Number(a.id), { note: a.note || '' });
190
+ case 'memory_list': return listMemories(db, { status: a.status || null, kind: a.kind || null, limit: a.limit || 100 });
191
+ case 'memory_edit': return editMemory(db, Number(a.id), a.text, { note: a.note || '' });
192
+ case 'kb_search': {
193
+ const r = searchChunks(db, { query: a.query, variants: a.variants || [], limit: a.limit || 8 });
194
+ return {
195
+ fused: r.fused,
196
+ results: r.results.map((x) => ({
197
+ chunk_id: x.id, path: x.rel_path, ordinal: x.ordinal,
198
+ score: Number(x.score.toFixed(4)), heading: x.heading, text: x.text,
199
+ })),
200
+ };
201
+ }
202
+ case 'kb_get': return getChunk(db, Number(a.chunk_id));
203
+ case 'kb_edit': return editChunk(db, Number(a.chunk_id), a.text, {
204
+ note: a.note || '', baseVersion: a.base_version ?? null,
205
+ });
206
+ case 'kb_history': return chunkHistory(db, Number(a.chunk_id));
207
+ case 'kb_diff': {
208
+ const va = chunkVersionText(db, Number(a.chunk_id), Number(a.from));
209
+ const vb = a.to ? chunkVersionText(db, Number(a.chunk_id), Number(a.to)) : getChunk(db, Number(a.chunk_id));
210
+ if (!va || !vb) throw new Error('版本不存在');
211
+ return diffTexts(va.text, vb.text);
212
+ }
213
+ case 'kb_rollback': return rollbackChunk(db, Number(a.chunk_id), Number(a.version));
214
+ case 'kb_tree': return { tree: tree(db) };
215
+ case 'kb_ingest': return ingestFolder(db, a.path, {
216
+ chunk_size: a.chunk_size ?? 512,
217
+ chunk_overlap: a.chunk_overlap ?? 80,
218
+ strategy: a.strategy || 'auto',
219
+ });
220
+ case 'memory_extract': return runAutoExtract(db, {
221
+ sessionsDir: a.sessions_dir || undefined,
222
+ limit: a.limit ?? 30,
223
+ dryRun: !!a.dry_run,
224
+ });
225
+ case 'memory_probe_llm': return await llmProbe();
226
+ case 'memory_distill': {
227
+ const turns = Array.isArray(a.turns) && a.turns.length
228
+ ? a.turns.map((t) => (typeof t === 'string' ? { text: t } : t))
229
+ : recentTurns(a.sessions_dir || undefined, a.turns_limit ?? 60);
230
+ if (!turns.length) return { candidates: [], added: [], note: '没有可蒸馏的用户发言' };
231
+ return await llmDistill(db, { turns, limit: a.limit ?? 30, dryRun: !!a.dry_run });
232
+ }
233
+ default: throw new Error(`unknown tool: ${name}`);
234
+ }
235
+ }
236
+
237
+ function send(msg) {
238
+ process.stdout.write(JSON.stringify(msg) + '\n');
239
+ }
240
+
241
+ async function handle(req) {
242
+ const { id, method, params } = req;
243
+ if (method === undefined) return; // notification
244
+ try {
245
+ if (method === 'initialize') {
246
+ send({
247
+ jsonrpc: '2.0', id,
248
+ result: {
249
+ protocolVersion: PROTOCOL,
250
+ capabilities: { tools: { listChanged: false } },
251
+ serverInfo: SERVER,
252
+ },
253
+ });
254
+ return;
255
+ }
256
+ if (method === 'tools/list') {
257
+ send({ jsonrpc: '2.0', id, result: { tools: TOOLS } });
258
+ return;
259
+ }
260
+ if (method === 'tools/call') {
261
+ const { name, arguments: args } = params || {};
262
+ try {
263
+ const data = await callTool(name, args || {});
264
+ send({
265
+ jsonrpc: '2.0', id,
266
+ result: { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] },
267
+ });
268
+ } catch (e) {
269
+ send({
270
+ jsonrpc: '2.0', id,
271
+ result: { content: [{ type: 'text', text: 'ERROR: ' + (e.message || e) }], isError: true },
272
+ });
273
+ }
274
+ return;
275
+ }
276
+ if (method === 'ping') { send({ jsonrpc: '2.0', id, result: {} }); return; }
277
+ send({ jsonrpc: '2.0', id, error: { code: -32601, message: `method not found: ${method}` } });
278
+ } catch (e) {
279
+ send({ jsonrpc: '2.0', id, error: { code: -32603, message: String(e.message || e) } });
280
+ }
281
+ }
282
+
283
+ const rl = readline.createInterface({ input: process.stdin, terminal: false });
284
+ let queue = Promise.resolve();
285
+ rl.on('line', (line) => {
286
+ const s = line.trim();
287
+ if (!s) return;
288
+ let req;
289
+ try { req = JSON.parse(s); } catch { return; }
290
+ const run = async () => { if (Array.isArray(req)) { for (const r of req) await handle(r); } else await handle(req); };
291
+ queue = queue.then(run).catch(() => {});
292
+ });
293
+ process.on('SIGINT', () => process.exit(0));
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
2
  "name": "dsh-cooper-memory",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Cross-session memory and a folder knowledge base for DeepSeek Harness — local SQLite, no Docker, no vector service.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "engines": { "node": ">=22.5" },
8
+ "keywords": ["dsh", "dsh-plugin", "memory", "knowledge-base", "sqlite", "mcp", "rag", "cross-session"],
9
+ "bin": {
10
+ "dsh-cooper-memory": "./cli.mjs",
11
+ "dsh-cooper-memory-web": "./web.mjs",
12
+ "dsh-cooper-memory-mcp": "./mcp.mjs"
13
+ },
14
+ "exports": {
15
+ ".": "./mcp.mjs",
16
+ "./cli": "./cli.mjs",
17
+ "./web": "./web.mjs",
18
+ "./lib/*": "./lib/*",
19
+ "./locale/*.json": "./locale/*.json",
20
+ "./icon": "./icon.svg"
21
+ },
22
+ "files": [
23
+ "mcp.mjs",
24
+ "cli.mjs",
25
+ "web.mjs",
26
+ "lib",
27
+ "cordis.patch.yml",
28
+ "locale/*.json",
29
+ "docs",
30
+ "icon.svg",
31
+ "README.md",
32
+ "LICENSE"
33
+ ],
34
+ "dsh": {
35
+ "bundle": { "patch": "./cordis.patch.yml" }
36
+ },
37
+ "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" }
6
38
  }