@nightpainters/dsh-ling 1.6.2 → 1.7.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/CHANGELOG.md +130 -4
- package/DESIGN.md +89 -6
- package/PHILOSOPHY.md +14 -4
- package/README.md +102 -18
- package/cordis.patch.yml +32 -2
- package/lib/client.js +2520 -55
- package/lib/host/agent-tools.js +286 -0
- package/lib/host/api.js +592 -59
- package/lib/host/archive.js +3 -3
- package/lib/host/autotree.js +2 -2
- package/lib/host/clock-skill.js +1 -1
- package/lib/host/config.js +38 -0
- package/lib/host/deepsummary.js +75 -2
- package/lib/host/dsweb-summary.js +6 -3
- package/lib/host/guard.js +53 -0
- package/lib/host/inject.js +12 -2
- package/lib/host/l1.js +13 -8
- package/lib/host/library-checker.js +552 -0
- package/lib/host/library-import-engine.js +211 -0
- package/lib/host/library-import.js +911 -0
- package/lib/host/library-runtime.js +199 -0
- package/lib/host/library-sqlite.js +344 -0
- package/lib/host/library-store.js +1714 -0
- package/lib/host/memory.js +73 -19
- package/lib/host/persona.js +13 -2
- package/lib/host/rawlog.js +1 -1
- package/lib/host/recall-search.js +45 -8
- package/lib/host/snapshot.js +2 -1
- package/lib/host/surgery.js +6 -4
- package/lib/host/tools.js +460 -19
- package/lib/host/util.js +1 -1
- package/lib/index.js +120 -81
- package/package.json +10 -5
- package/tools/deep-import-docs.mjs +1210 -0
package/lib/index.js
CHANGED
|
@@ -14,11 +14,15 @@ import { registerModeService } from './host/mode-service.js';
|
|
|
14
14
|
import { registerApi } from './host/api.js';
|
|
15
15
|
import { summarizeDsh } from './host/summarizer.js';
|
|
16
16
|
import { registerFeedbackListener } from './host/feedback.js';
|
|
17
|
-
import { probeLLM, runDeepPass,
|
|
17
|
+
import { probeLLM, runDeepPass, resolveAuto } from './host/deepsummary.js';
|
|
18
18
|
import { registerLingTools } from './host/tools.js';
|
|
19
|
+
import { createAgentToolBinder } from './host/agent-tools.js';
|
|
19
20
|
import { registerClockSkill } from './host/clock-skill.js';
|
|
20
21
|
import { registerIndexSkill } from './host/deep-index-skill.js'; // 1.6 步 6:深层库索引层(一簇一行,走 skill)
|
|
21
22
|
import { installAccessLog } from './audit/index.js';
|
|
23
|
+
import { Config } from './host/config.js';
|
|
24
|
+
import { LibraryRuntime } from './host/library-runtime.js';
|
|
25
|
+
export { Config };
|
|
22
26
|
|
|
23
27
|
export const name = 'dsh-ling';
|
|
24
28
|
export const inject = [];
|
|
@@ -33,14 +37,20 @@ function readVersion() {
|
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
export function apply(ctx, config = {}) {
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
// Direct callers receive the same fail-loud config validation as Cordis.
|
|
41
|
+
// Validate registered roots/URLs before creating either database.
|
|
42
|
+
// ⚠️ F10(2026-10-15)后这句话要分两半读:**library 配置**写错不再从 `Config()` 抛出去
|
|
43
|
+
// (改为把原因带进 `cfg.library.configError`,只废掉图书馆那一块,见 host/config.js);
|
|
44
|
+
// 而 `normalizeLibraryConfig` 与 `new LibraryRuntime` 本身**照旧严格抛** ——
|
|
45
|
+
// 注册根目录/URL 在"开库之前"仍会被拦下(严格在里、降级在外)。
|
|
46
|
+
const cfg = { ...Config(config), version: readVersion() };
|
|
47
|
+
const dataDir = cfg.dataDir || defaultDataDir();
|
|
38
48
|
ensureDir(dataDir);
|
|
39
49
|
|
|
40
50
|
const settings = new SettingsFile(dataDir);
|
|
41
51
|
// ⚠️ F4(蓝队 2026-10-04 实测 + 主人 2026-10-04 拍板「按错误码分流」):这里此前**没有 try** ⇒
|
|
42
52
|
// 只要构造抛(典型:另一个进程持写锁 —— 升级形态实测 16,445ms 后抛 `database is locked`),
|
|
43
|
-
// 异常就一路冒到 `apply()` ⇒ **
|
|
53
|
+
// 异常就一路冒到 `apply()` ⇒ **11 个工具全不在、人格注入也没了**,而且**没有任何可指认面**。
|
|
44
54
|
// 那是 **fail-dead** 不是 fail-closed(本项目对 fail-closed 的定义 = 拒绝 + 给判据,见 B-05)。
|
|
45
55
|
// 分流规则:
|
|
46
56
|
// · errcode **5 / 6**(BUSY / LOCKED)= "等一会儿就能开" ⇒ 同步有界重试 3 次 × 2 秒;
|
|
@@ -71,6 +81,42 @@ export function apply(ctx, config = {}) {
|
|
|
71
81
|
+ '③ 若文件损坏,先从 ' + dataDir + ' 下的备份恢复。');
|
|
72
82
|
return;
|
|
73
83
|
}
|
|
84
|
+
let library = null;
|
|
85
|
+
let disposed = false;
|
|
86
|
+
const disposers = [];
|
|
87
|
+
let sumTimer = null;
|
|
88
|
+
let deepTimer = null;
|
|
89
|
+
let deepBootTimer = null;
|
|
90
|
+
let closing = null;
|
|
91
|
+
// Own resources before any fallible wiring. A late effect misses failures in
|
|
92
|
+
// runtime revalidation, route mounting or boot_at; Cordis can only roll back
|
|
93
|
+
// effects already registered when apply throws.
|
|
94
|
+
const dispose = () => {
|
|
95
|
+
if (closing) return closing;
|
|
96
|
+
disposed = true;
|
|
97
|
+
let resolveClose, rejectClose;
|
|
98
|
+
closing = new Promise((resolve, reject) => { resolveClose = resolve; rejectClose = reject; });
|
|
99
|
+
const pending = [];
|
|
100
|
+
try { pending.push(library?.close()); } catch (error) { pending.push(Promise.reject(error)); }
|
|
101
|
+
if (sumTimer) { clearTimeout(sumTimer); clearInterval(sumTimer); sumTimer = null; }
|
|
102
|
+
if (deepTimer) { clearInterval(deepTimer); deepTimer = null; }
|
|
103
|
+
if (deepBootTimer) { clearTimeout(deepBootTimer); deepBootTimer = null; }
|
|
104
|
+
for (const d of disposers.splice(0).reverse()) {
|
|
105
|
+
try { if (typeof d === 'function') pending.push(d()); } catch (error) { pending.push(Promise.reject(error)); }
|
|
106
|
+
}
|
|
107
|
+
try { memory.close(); } catch (error) { pending.push(Promise.reject(error)); }
|
|
108
|
+
Promise.allSettled(pending).then((results) => {
|
|
109
|
+
const failures = results.filter((result) => result.status === 'rejected').map((result) => result.reason);
|
|
110
|
+
if (failures.length) rejectClose(new AggregateError(failures, 'dsh-ling cleanup failed'));
|
|
111
|
+
else resolveClose();
|
|
112
|
+
});
|
|
113
|
+
return closing;
|
|
114
|
+
};
|
|
115
|
+
try {
|
|
116
|
+
if (typeof ctx.effect === 'function') ctx.effect(() => dispose, 'dsh-ling: lifecycle');
|
|
117
|
+
library = new LibraryRuntime(dataDir, cfg.library);
|
|
118
|
+
const libraryStatus = library.status();
|
|
119
|
+
if (!libraryStatus.ok) console.warn('[dsh-ling] %s', libraryStatus.message);
|
|
74
120
|
// invalidate 延迟绑定(避免环):onFlush 在事件时点才调用,彼时必已就绪
|
|
75
121
|
let invalidateNow = (sid) => {};
|
|
76
122
|
import('./host/inject.js').then((m) => {
|
|
@@ -89,8 +135,10 @@ export function apply(ctx, config = {}) {
|
|
|
89
135
|
},
|
|
90
136
|
});
|
|
91
137
|
|
|
92
|
-
|
|
93
|
-
|
|
138
|
+
// F5(1.7 修复批次):`cfg.injectEnabled === false` 是**记忆段**的逃生开关 —— 关到底 ⇒
|
|
139
|
+
// registerMemorySection 一段都不注册(此前这个键全仓零处读,承诺关得掉、实际关不掉)。
|
|
140
|
+
// 它**不管**人格段:那道闸是 `settings.persona.enabled`(persona.js:166),两者并列。
|
|
141
|
+
disposers.push(registerMemorySection(ctx, gate, memory, settings, { enabled: cfg.injectEnabled !== false }));
|
|
94
142
|
// E0「那一行跟着会话走」:只加一个 agent/pre-step 监听(全库目前没有别处用它)。
|
|
95
143
|
// 形态 A —— 只往 `decision.messages` 追加,**不碰** systemPrompt 的 section()/context(),
|
|
96
144
|
// 也绝不调用带 surfaceOp 的 session.append。关掉开关:settings.memory.sessionProgressLine=false。
|
|
@@ -99,11 +147,11 @@ export function apply(ctx, config = {}) {
|
|
|
99
147
|
// P3-A(2026-09-29):把「给某个会话设模式」暴露成跨插件服务 `dsh-ling/mode` ——
|
|
100
148
|
// 飞书桥建线时用它把新会话钉到生活挡位。软能力:注册失败只记日志,不影响其余功能。
|
|
101
149
|
disposers.push(registerModeService(ctx, { gate, memory, settings }));
|
|
102
|
-
disposers.push(registerApi(ctx, { gate, memory, settings }, cfg));
|
|
150
|
+
disposers.push(registerApi(ctx, { gate, memory, settings, library }, cfg));
|
|
103
151
|
// E4 可取证访问日志:只挂两个全局钩子,core 侧补丁留的调用点见 lib/audit/patch-spec.js。
|
|
104
152
|
// 补丁未打时钩子收不到调用 —— 安装器会在启动日志里明确喊出来,不允许静默不记。
|
|
105
153
|
disposers.push(installAccessLog(ctx, cfg.accessLog || {}));
|
|
106
|
-
// clock skill(精确时间按需查询,2026-09-23
|
|
154
|
+
// clock skill(精确时间按需查询,2026-09-23 用户定):取服务走与 tools 同款的三级兜底。
|
|
107
155
|
disposers.push(...registerClockSkill(ctx));
|
|
108
156
|
// 深层库索引层 skill(1.6 步 6,2026-10-04):主人拍过「索引层 ≤400 字 · 一簇一行」,
|
|
109
157
|
// 承载形态选定为**整个索引层一个 skill** —— 目录只常驻 name + description(11 行簇目录),
|
|
@@ -115,13 +163,16 @@ export function apply(ctx, config = {}) {
|
|
|
115
163
|
// 取服务用三级兜底(与 webServer 同一套路):直取 → ctx.inject 子 ctx → 定时重试。
|
|
116
164
|
// 2026-09-16 教训:本插件 apply 可能早于 tools 服务挂载,一次性直取会静默失败 —— 工具从未注册。
|
|
117
165
|
let toolsMounted = false;
|
|
166
|
+
let globalToolCount = 0; // 全局注册到的工具数:agent 侧判"部分失败"的基准
|
|
118
167
|
const mountTools = (c) => {
|
|
168
|
+
if (disposed) return { ok: false, reason: 'closed' };
|
|
119
169
|
if (toolsMounted) return { ok: true };
|
|
120
170
|
try {
|
|
121
|
-
const tr = registerLingTools(c || ctx, { gate, memory, settings });
|
|
171
|
+
const tr = registerLingTools(c || ctx, { gate, memory, settings, library });
|
|
122
172
|
if (tr && tr.ok) {
|
|
123
173
|
toolsMounted = true;
|
|
124
174
|
if (Array.isArray(tr.disposers)) disposers.push(...tr.disposers);
|
|
175
|
+
globalToolCount = Array.isArray(tr.disposers) ? tr.disposers.length : 0;
|
|
125
176
|
console.info('[dsh-ling] tools registered: %d', tr.disposers?.length ?? 0);
|
|
126
177
|
}
|
|
127
178
|
return tr || { ok: false, reason: 'unknown' };
|
|
@@ -146,7 +197,7 @@ export function apply(ctx, config = {}) {
|
|
|
146
197
|
disposers.push(() => clearInterval(toolTimer));
|
|
147
198
|
console.info('[dsh-ling] tools service not ready at apply (%s); retrying', firstMount.reason);
|
|
148
199
|
}
|
|
149
|
-
// 器灵侧工具 · agent 作用域补注册(2026-09-25
|
|
200
|
+
// 器灵侧工具 · agent 作用域补注册(2026-09-25 修;**2026-10-07 补上"存量 agent"这一半**)。
|
|
150
201
|
//
|
|
151
202
|
// 症状:工具"注册成功"(kv tools.registered=1、disposers 非空)但 agent 的
|
|
152
203
|
// 工具清单里一个都没有 —— 连 09-16 就有的 rule_add 也不在。
|
|
@@ -167,51 +218,52 @@ export function apply(ctx, config = {}) {
|
|
|
167
218
|
// 故:每个 agent 创建时,在**它自己的** ctx 上再注册一份。两处注册落在
|
|
168
219
|
// 不同层(全局层 vs agent 层),平台允许多层共存、近者遮蔽,不冲突。
|
|
169
220
|
// 全局那份**保留**:没有 restrict 的部署仍走它,且它是 apply 期的早绑。
|
|
170
|
-
//
|
|
171
|
-
//
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
//
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
const r = registerLingTools(agent?.ctx, { gate, memory, settings });
|
|
221
|
+
//
|
|
222
|
+
// ⚠️ 1.7 生命周期整改暴露的配套缺口(真机复现 + 隔离探针复现):
|
|
223
|
+
// 1.7 起 agent 侧注册产生的 disposer 被收进入口 disposers,卸载时**连同旧闭包一起撤销**
|
|
224
|
+
// —— 这是**对的**(旧闭包持有已关闭的 LibraryRuntime,留着只会返回 `reason:'closed'`)。
|
|
225
|
+
// 但补绑入口**只有 created 事件** ⇒ 热重载后**仍然活着的 agent 收不到事件**,
|
|
226
|
+
// 工具从此缺席(全局那份又被 preset 掩码挡住)⇒ 表现就是"器灵工具从清单里消失"。
|
|
227
|
+
// 修法(全在 `lib/host/agent-tools.js`,顶部注释给了实读锚点):
|
|
228
|
+
// ① **先挂监听** → ② 再 `ctx.agents.list()` 枚举存量补绑;
|
|
229
|
+
// ③ 身份按 **agent ctx 对象**(不是"sid + 3 秒窗口":同 sid 的两个 agent 必须各绑各的,
|
|
230
|
+
// 两个事件名同发时必须只绑一次);
|
|
231
|
+
// ④ 注册只走 `registerLingTools`(内部 guard 不许绕过);
|
|
232
|
+
// ⑤ 少注册了工具 ⇒ 记 `partial`,**不当全成功**;
|
|
233
|
+
// ⑥ 卸载即撤销自己的全部注册并锁死回绑;`agents` 服务迟到走既有 `ctx.inject`。
|
|
234
|
+
const agentTools = createAgentToolBinder({
|
|
235
|
+
ctx,
|
|
236
|
+
register: registerLingTools,
|
|
237
|
+
deps: { gate, memory, settings, library },
|
|
238
|
+
isDisposed: () => disposed,
|
|
239
|
+
expectedToolCount: () => globalToolCount,
|
|
240
|
+
// 留痕:除原有的 tools.agent_registered 之外,把"为什么没绑上/只绑了一部分"写进 kv,
|
|
241
|
+
// 免得下一次又是"工具悄悄没了、库外无迹可查"。
|
|
242
|
+
onNote: (level, message, data) => {
|
|
193
243
|
try {
|
|
194
|
-
memory.kvSet('tools.agent_registered',
|
|
244
|
+
memory.kvSet('tools.agent_registered', level === 'info' ? '1' : ('0:' + String((data && data.reason) || level)));
|
|
245
|
+
if (level !== 'info') {
|
|
246
|
+
memory.kvSet('tools.agent_rebind', JSON.stringify({ at: utcIso(), level, message: String(message).slice(0, 220), data: data || null }));
|
|
247
|
+
}
|
|
195
248
|
} catch { /* ignore */ }
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
disposers.push(() => agentTools.dispose()); // 卸载即撤销 + 清空绑定表 + 禁止回绑
|
|
252
|
+
agentTools.install(); // ① 监听先挂(否则"枚举—事件"之间创建的 agent 会漏)
|
|
253
|
+
{
|
|
254
|
+
const firstBind = agentTools.bindExisting(); // ② 再枚举存量
|
|
255
|
+
if (!firstBind.ok && firstBind.reason === 'no-agents-service') agentTools.hookLateService(); // ③ 服务迟到
|
|
256
|
+
const st = agentTools.status();
|
|
257
|
+
if (st.bound || st.failures.length || !st.serviceAvailable) {
|
|
258
|
+
console.info('[dsh-ling] agent 作用域工具补绑: bound=%d listed=%d already=%d partial=%d failures=%d agentsService=%s',
|
|
259
|
+
st.bound, st.listed, st.already, st.partial, st.failures.length, st.serviceAvailable ? 'on' : 'off');
|
|
201
260
|
}
|
|
202
|
-
};
|
|
203
|
-
try {
|
|
204
|
-
disposers.push(ctx.on?.('agent/created', onAgentCreated)); // DSH ≥0.1.7
|
|
205
|
-
disposers.push(ctx.on?.('agent/session-start', onAgentCreated)); // DSH ≤0.1.6(旧名,保留兼容)
|
|
206
|
-
} catch (e) {
|
|
207
|
-
console.debug('[dsh-ling] agent scope tool hooks failed', e);
|
|
208
261
|
}
|
|
209
262
|
|
|
210
263
|
memory.kvSet('boot_at', utcIso());
|
|
211
264
|
memory.kvSet('inject_enabled_config', cfg.injectEnabled === false ? '0' : '1');
|
|
212
265
|
|
|
213
266
|
// DSH 会话概述器:启动后 8s 跑一次,之后每 summarizeIntervalMin 分钟自动跑
|
|
214
|
-
let sumTimer = null;
|
|
215
267
|
const runSummarizer = () => {
|
|
216
268
|
try {
|
|
217
269
|
const st = summarizeDsh(memory);
|
|
@@ -230,14 +282,21 @@ export function apply(ctx, config = {}) {
|
|
|
230
282
|
}, 8000);
|
|
231
283
|
}
|
|
232
284
|
|
|
285
|
+
// 后台自动行为(自动深摘 / 探活延时 / 反馈回路)的三级优先级 —— settings.auto > 插件配置旧键 > 默认 ——
|
|
286
|
+
// **只在本行判一次**(resolveAuto,见 host/deepsummary.js):面板要显示"这个值是谁定的",就不能有两处各判一次。
|
|
287
|
+
// ⚠️ 这是**启动期**读取:面板改完要重启宿主才生效(定时器与探活延时都不回溯)。
|
|
288
|
+
// ⚠️ 传 **settings 实例本身**(不是 `settings.get()`):后者把默认值也合并了进来 ⇒ 代码默认会冒充用户设定,
|
|
289
|
+
// 插件配置里的旧键(feedbackAuto / deepSummaryAuto / deepIntervalMin / deepMaxPerRun)被整体压掉。
|
|
290
|
+
const auto = resolveAuto(settings, cfg);
|
|
291
|
+
|
|
233
292
|
// 反馈成长回路:事件驱动(U7 正解,2026-10-01)。
|
|
234
293
|
// ⚠️ 旧实现是"每 60 秒读一次 `~/.dsh/storages/message_feedback.json`",两处都错:
|
|
235
294
|
// ① 宿主**有推送** —— `dsh-message-feedback\lib\index.js:288` 在冷会话写入 flush 后
|
|
236
295
|
// 发 `feedback/committed`(活会话走 `session/event` 的 feedback 事件);
|
|
237
296
|
// ② 那个 sidecar 在 Web 组合下自 2026/9/11 起**零写入**(该组合只挂 message-feedback,
|
|
238
297
|
// 反馈已改写在会话日志里)⇒ 轮询每 60 秒读同一个死文件,纯空转。
|
|
239
|
-
// 现在:事件到达即处理;`feedbackAuto
|
|
240
|
-
if (
|
|
298
|
+
// 现在:事件到达即处理;`auto.feedbackAuto`(旧键 cfg.feedbackAuto)可整体关掉。
|
|
299
|
+
if (auto.feedbackAuto) {
|
|
241
300
|
try {
|
|
242
301
|
disposers.push(registerFeedbackListener(ctx, memory));
|
|
243
302
|
} catch (e) {
|
|
@@ -245,51 +304,31 @@ export function apply(ctx, config = {}) {
|
|
|
245
304
|
}
|
|
246
305
|
}
|
|
247
306
|
|
|
248
|
-
// LLM 深摘要:启动
|
|
249
|
-
let deepTimer = null;
|
|
307
|
+
// LLM 深摘要:启动 auto.bootProbeDelayMs 后先自检探针;通过才挂自动调度(保守上限,可配)
|
|
250
308
|
const bootDeep = async () => {
|
|
309
|
+
if (disposed) return;
|
|
251
310
|
try {
|
|
252
311
|
const p = await probeLLM(ctx, memory);
|
|
253
|
-
if (p.ok &&
|
|
254
|
-
runDeepPass(ctx, memory, { limit:
|
|
255
|
-
const intervalMin =
|
|
312
|
+
if (!disposed && p.ok && auto.deepSummary) {
|
|
313
|
+
runDeepPass(ctx, memory, { limit: auto.deepMaxPerRun });
|
|
314
|
+
const intervalMin = auto.deepIntervalMin; // clamp(10..1440)已在 resolveAuto 做过,这里不再设第二把尺
|
|
256
315
|
deepTimer = setInterval(() => {
|
|
257
|
-
runDeepPass(ctx, memory, { limit:
|
|
316
|
+
runDeepPass(ctx, memory, { limit: auto.deepMaxPerRun });
|
|
258
317
|
}, intervalMin * 60 * 1000);
|
|
259
318
|
}
|
|
260
319
|
} catch (e) {
|
|
261
320
|
console.debug('[dsh-ling] deep boot failed', e);
|
|
262
321
|
}
|
|
263
322
|
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const dispose = () => {
|
|
267
|
-
if (sumTimer) {
|
|
268
|
-
clearTimeout(sumTimer);
|
|
269
|
-
clearInterval(sumTimer);
|
|
270
|
-
sumTimer = null;
|
|
271
|
-
}
|
|
272
|
-
if (deepTimer) {
|
|
273
|
-
clearInterval(deepTimer);
|
|
274
|
-
deepTimer = null;
|
|
275
|
-
}
|
|
276
|
-
if (deepBootTimer) {
|
|
277
|
-
clearTimeout(deepBootTimer);
|
|
278
|
-
}
|
|
279
|
-
for (const d of disposers) {
|
|
280
|
-
try {
|
|
281
|
-
d();
|
|
282
|
-
} catch {}
|
|
283
|
-
}
|
|
284
|
-
try {
|
|
285
|
-
memory.close();
|
|
286
|
-
} catch {}
|
|
287
|
-
};
|
|
288
|
-
if (typeof ctx.effect === 'function') {
|
|
289
|
-
ctx.effect(() => dispose, 'dsh-ling: lifecycle');
|
|
290
|
-
}
|
|
323
|
+
deepBootTimer = setTimeout(bootDeep, auto.bootProbeDelayMs);
|
|
291
324
|
console.info('[dsh-ling] booted; dataDir=%s injection=%s api=%s',
|
|
292
325
|
dataDir,
|
|
293
326
|
typeof svc(ctx, 'systemPrompt')?.section === 'function' ? 'on' : 'off(unavailable)',
|
|
294
327
|
typeof svc(ctx, 'webServer')?.register === 'function' ? 'on' : 'off(unavailable)');
|
|
328
|
+
} catch (error) {
|
|
329
|
+
// Direct callers without Cordis also get rollback. Preserve the original
|
|
330
|
+
// activation error; the registered effect can await this same close promise.
|
|
331
|
+
void dispose().catch((cleanupError) => console.error('[dsh-ling] rollback failed', cleanupError));
|
|
332
|
+
throw error;
|
|
333
|
+
}
|
|
295
334
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nightpainters/dsh-ling",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "器灵 ·
|
|
3
|
+
"version": "1.7.0",
|
|
4
|
+
"description": "器灵 · 跑在你自己电脑上的记忆与人格助手插件(人机共生:各尽其责、各有边界、互不占有):以「人在循环」的双向复盘为核心回路,人格由共同记忆长出并有定型锁,记忆树可归并、可回溯、每次改动都留痕",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"lib",
|
|
14
14
|
"tools/apply-access-log-patch.mjs",
|
|
15
|
+
"tools/deep-import-docs.mjs",
|
|
15
16
|
"cordis.patch.yml",
|
|
16
17
|
"README.md",
|
|
17
18
|
"PHILOSOPHY.md",
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
"access": "public"
|
|
26
27
|
},
|
|
27
28
|
"scripts": {
|
|
28
|
-
"test": "node tests/unit.mjs && node tests/access-log.test.mjs && node tests/archive.test.mjs && node tests/autotree.test.mjs && node tests/backfill.test.mjs && node tests/branch.test.mjs && node tests/assistant.test.mjs && node tests/capture.test.mjs && node tests/clock.test.mjs && node tests/clock-skill.test.mjs && node tests/deep.test.mjs && node tests/deepitem.test.mjs && node tests/dswebsum.test.mjs && node tests/duty.test.mjs && node tests/export.test.mjs && node tests/feedback.test.mjs && node tests/forget-backfill.test.mjs && node tests/genesis.test.mjs && node tests/guard.test.mjs && node tests/habitgen.test.mjs && node tests/idle.test.mjs && node tests/importfile.test.mjs && node tests/importlog.test.mjs && node tests/injectlog.test.mjs && node tests/l1lines.test.mjs && node tests/memories.test.mjs && node tests/mode.test.mjs && node tests/mode-service.test.mjs && node tests/mustache.test.mjs && node tests/retitle.test.mjs && node tests/rules.test.mjs && node tests/sessionline.test.mjs && node tests/suggest.test.mjs && node tests/summarize.test.mjs && node tests/times.test.mjs && node tests/tone.test.mjs && node tests/tools.test.mjs && node tests/recall.test.mjs && node tests/recall-search.test.mjs && node tests/tree.test.mjs && node tests/patch-spec.test.mjs && node tests/bodylimit.test.mjs && node tests/client-batch.test.mjs",
|
|
29
|
+
"test": "node tests/unit.mjs && node tests/access-log.test.mjs && node tests/archive.test.mjs && node tests/autotree.test.mjs && node tests/backfill.test.mjs && node tests/branch.test.mjs && node tests/assistant.test.mjs && node tests/capture.test.mjs && node tests/clock.test.mjs && node tests/clock-skill.test.mjs && node tests/deep.test.mjs && node tests/deepitem.test.mjs && node tests/deep-import-docs.test.mjs && node tests/dswebsum.test.mjs && node tests/duty.test.mjs && node tests/export.test.mjs && node tests/feedback.test.mjs && node tests/forget-backfill.test.mjs && node tests/genesis.test.mjs && node tests/guard.test.mjs && node tests/habitgen.test.mjs && node tests/idle.test.mjs && node tests/importfile.test.mjs && node tests/importlog.test.mjs && node tests/injectlog.test.mjs && node tests/l1lines.test.mjs && node tests/memories.test.mjs && node tests/mode.test.mjs && node tests/mode-service.test.mjs && node tests/mustache.test.mjs && node tests/retitle.test.mjs && node tests/rules.test.mjs && node tests/sessionline.test.mjs && node tests/suggest.test.mjs && node tests/summarize.test.mjs && node tests/times.test.mjs && node tests/tone.test.mjs && node tests/tools.test.mjs && node tests/recall.test.mjs && node tests/recall-search.test.mjs && node tests/tree.test.mjs && node tests/patch-spec.test.mjs && node tests/bodylimit.test.mjs && node tests/client-batch.test.mjs && node tests/library-store.test.mjs && node tests/library-store-concurrency.test.mjs && node tests/library-checker.test.mjs && node tests/library-runtime.test.mjs && node tests/library-api-tools.test.mjs && node tests/library-import.test.mjs && node tests/library-sqlite.test.mjs && node tests/library-browse.test.mjs && node tests/library-client.test.mjs && node tests/tool-remount.test.mjs && node tests/auto-config.test.mjs",
|
|
29
30
|
"check": "node tools/check-install.mjs",
|
|
30
31
|
"check:publish": "node tools/check-publish.mjs"
|
|
31
32
|
},
|
|
@@ -50,7 +51,10 @@
|
|
|
50
51
|
"url": "https://github.com/NightPainters/DSH-Ling/issues"
|
|
51
52
|
},
|
|
52
53
|
"engines": {
|
|
53
|
-
"node": ">=22.
|
|
54
|
+
"node": ">=22.15.0 <23 || >=23.8.0"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@deepseek-ai/schemastery": "~3.18.4"
|
|
54
58
|
},
|
|
55
59
|
"peerDependencies": {
|
|
56
60
|
"@deepseek-ai/cordis": ">=4.0.4",
|
|
@@ -113,7 +117,8 @@
|
|
|
113
117
|
"inject": [
|
|
114
118
|
"@deepseek-ai/dsh-client-connection",
|
|
115
119
|
"@deepseek-ai/dsh-client-locale",
|
|
116
|
-
"@deepseek-ai/dsh-api-session-controller"
|
|
120
|
+
"@deepseek-ai/dsh-api-session-controller",
|
|
121
|
+
"@deepseek-ai/dsh-client-ui-slots"
|
|
117
122
|
],
|
|
118
123
|
"platform": "web"
|
|
119
124
|
}
|