@waq666/pneuma 0.7.0 → 0.7.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.
Files changed (41) hide show
  1. package/README.md +206 -145
  2. package/lib/app/App.d.ts +3 -1
  3. package/lib/app/App.js +324 -172
  4. package/lib/app/App.js.nv-backup +1650 -0
  5. package/lib/app/ChatView.d.ts +40 -9
  6. package/lib/app/ChatView.js +150 -38
  7. package/lib/app/StatusBar.js +21 -92
  8. package/lib/app/TimelineRail.d.ts +22 -0
  9. package/lib/app/TimelineRail.js +160 -0
  10. package/lib/app/TimelineRail.js.negbak +98 -0
  11. package/lib/app/TimelineRail.js.nv-backup +160 -0
  12. package/lib/app/ToolCard.d.ts +7 -1
  13. package/lib/app/ToolCard.js +30 -6
  14. package/lib/app/ToolCard.js.nv-backup +64 -0
  15. package/lib/app/TranscriptOverlay.d.ts +23 -8
  16. package/lib/app/TranscriptOverlay.js +29 -10
  17. package/lib/app/TranscriptViewport.d.ts +78 -0
  18. package/lib/app/TranscriptViewport.js +218 -0
  19. package/lib/app/Welcome.js +13 -8
  20. package/lib/app/click.d.ts +15 -2
  21. package/lib/app/click.js +20 -6
  22. package/lib/app/keymap.d.ts +56 -0
  23. package/lib/app/keymap.js +56 -0
  24. package/lib/app/mouse.d.ts +33 -0
  25. package/lib/app/mouse.js +35 -0
  26. package/lib/app/pointer.d.ts +16 -0
  27. package/lib/app/pointer.js +60 -0
  28. package/lib/app/scroll-model.d.ts +240 -0
  29. package/lib/app/scroll-model.js +347 -0
  30. package/lib/app/snapshot-subscribe.d.ts +34 -0
  31. package/lib/app/snapshot-subscribe.js +110 -0
  32. package/lib/app/theme.d.ts +29 -1
  33. package/lib/app/theme.js +46 -1
  34. package/lib/app/ticker.d.ts +7 -0
  35. package/lib/app/ticker.js +53 -0
  36. package/lib/core/llm.d.ts +11 -0
  37. package/lib/core/llm.js +19 -2
  38. package/lib/plugins/subagent.js +36 -2
  39. package/lib/plugins/tool-search.js +11 -2
  40. package/lib/plugins/tool-search.js.nv-backup +434 -0
  41. package/package.json +1 -1
@@ -0,0 +1,434 @@
1
+ import { resolvePluginConfig, writePluginConfig } from '../core/plugin-registry.js';
2
+ import { callFacts } from '../core/tools.js';
3
+ import { ToolSearchIndex, TOOL_SEARCH_CONFIG_KEY, TOOL_SEARCH_LIMITS, parseNameListText, resolveToolSearchConfig, shouldDeferTool, summarizeToolDescription, } from '../core/tool-search.js';
4
+ import { dscPath } from '../core/path-policy.js';
5
+ /** 三个桥接工具的固定名字(它们自己不许被撤下,也不许再经 tool_call 包一层)。 */
6
+ const BRIDGE_TOOL_NAMES = new Set(['tool_search', 'tool_describe', 'tool_call']);
7
+ /** 配置与设置提示里要写清的来源文件(手改它同样生效)。 */
8
+ const PLUGINS_FILE = dscPath('plugins.json');
9
+ export const toolSearchPlugin = {
10
+ name: 'tool-search',
11
+ inject: ['tools', 'guards', 'settings'],
12
+ apply(ctx, passed) {
13
+ // 先把配置校验一遍:写错了插件就挂不上(错在哪、去哪儿改由 readConfig 的消息说清),
14
+ // 别带着一份坏配置跑起来、等模型调工具时才炸。
15
+ readConfig();
16
+ /** 本插件从注册表撤下的工具:撤下后只活在这里,`tool_call` 直接 run 它。 */
17
+ const held = new Map();
18
+ /** 注册过的东西都留退订函数,插件卸载时原样撤掉。 */
19
+ const disposers = [];
20
+ /** 取 MCP 客户端。它是可选服务(插件没开时不存在),所以必须走 ctx.get,不能写 ctx.mcp。 */
21
+ const mcpService = () => ctx.get('mcp');
22
+ function readConfig() {
23
+ return resolveToolSearchConfig(resolvePluginConfig(TOOL_SEARCH_CONFIG_KEY, passed));
24
+ }
25
+ /**
26
+ * 把一条注册表工具从每轮请求里撤下。
27
+ *
28
+ * ToolService 只有 register / list,没有「按名字删」这个方法;注册表按 name 存,
29
+ * 退订函数判等的是「这个名字底下还是不是我这一条」,所以把同一条 ToolEntry 再注册一次
30
+ * 随即退订,效果就是按名字把它拿下来。撤下的条目留在 held 里,`tool_call` 直接 run 它。
31
+ * 将来 ToolService 长出真正的 unregister,改这一处即可。
32
+ */
33
+ function withhold(entry) {
34
+ ctx.tools.register(entry)();
35
+ held.set(entry.name, entry);
36
+ }
37
+ /** 把撤下的注册表工具全部放回注册表(配置换挡与插件卸载都要先还原再重算)。 */
38
+ function restoreHeld() {
39
+ if (held.size === 0)
40
+ return;
41
+ // 不放回退订函数:这些工具的所有者是注册它们的那个插件,本插件只是替它扣了一阵子
42
+ for (const entry of held.values())
43
+ ctx.tools.register(entry);
44
+ held.clear();
45
+ }
46
+ /**
47
+ * 按当前配置重算该撤谁。
48
+ *
49
+ * 先还原再撤:设置页保存后立刻生效,不必重启宿主。代价是被放回的工具会排到
50
+ * `ctx.tools.list()` 的末尾(顺序只在改配置这一次变),改完这一轮之后又稳定下来。
51
+ */
52
+ function syncDeferral() {
53
+ const config = readConfig();
54
+ restoreHeld();
55
+ // tier 1 只动 MCP,注册表里的一条都不撤
56
+ if (config.tier !== 1) {
57
+ for (const entry of ctx.tools.list()) {
58
+ if (BRIDGE_TOOL_NAMES.has(entry.name))
59
+ continue;
60
+ if (!shouldDeferTool(entry, config))
61
+ continue;
62
+ withhold(entry);
63
+ }
64
+ }
65
+ const mcp = mcpService();
66
+ if (config.deferMcpSchemas && mcp !== undefined)
67
+ mcp.deferSchemas();
68
+ }
69
+ /** 现在能检索、能调用的目录:MCP 工具(`mcp.tools()`)+ 本插件撤下的注册表工具。 */
70
+ function catalogItems() {
71
+ const items = [];
72
+ const mcp = mcpService();
73
+ if (mcp !== undefined) {
74
+ for (const info of mcp.tools()) {
75
+ items.push({
76
+ name: info.name,
77
+ summary: summarizeToolDescription(info.description),
78
+ description: `(MCP server:${info.server})${info.description}`,
79
+ parameters: info.parameters,
80
+ risk: info.risk,
81
+ where: `MCP server ${info.server} 的工具,schema 已从每轮请求里撤下,调用走 tool_call`,
82
+ invoke: (callArgs, runCtx) => mcp.call(info.name, callArgs, runCtx.signal),
83
+ });
84
+ }
85
+ }
86
+ for (const entry of held.values()) {
87
+ items.push({
88
+ name: entry.name,
89
+ summary: summarizeToolDescription(entry.description),
90
+ description: entry.description,
91
+ parameters: entry.parameters,
92
+ risk: entry.risk,
93
+ where: '已从台面上撤下,调用走 tool_call(调用时会按这个真名过一遍审批与安全钩子)',
94
+ invoke: (callArgs, runCtx) => entry.run(callArgs, {
95
+ cwd: runCtx.cwd,
96
+ signal: runCtx.signal,
97
+ sessionId: runCtx.sessionId,
98
+ sessionPath: runCtx.sessionPath,
99
+ }),
100
+ });
101
+ }
102
+ return items;
103
+ }
104
+ /**
105
+ * 按真名找一条工具:先看撤下的目录,再退回台面上的注册表。
106
+ * 两条路都用真名索引,所以模型看到的工具名与守卫链看到的工具名始终是同一个。
107
+ */
108
+ function resolveTool(name) {
109
+ const fromCatalog = catalogItems().find((item) => item.name === name);
110
+ if (fromCatalog !== undefined)
111
+ return fromCatalog;
112
+ const live = ctx.tools.list().find((entry) => entry.name === name);
113
+ if (live === undefined)
114
+ return undefined;
115
+ return {
116
+ name: live.name,
117
+ summary: summarizeToolDescription(live.description),
118
+ description: live.description,
119
+ parameters: live.parameters,
120
+ risk: live.risk,
121
+ where: '就在台面上,可以直接调用(经 tool_call 走等于多过一道审批)',
122
+ invoke: (callArgs, runCtx) => live.run(callArgs, {
123
+ cwd: runCtx.cwd,
124
+ signal: runCtx.signal,
125
+ sessionId: runCtx.sessionId,
126
+ sessionPath: runCtx.sessionPath,
127
+ }),
128
+ };
129
+ }
130
+ /**
131
+ * 取 `arguments` 参数:对象直接用;字符串当 JSON 解析(模型偶尔把对象写成字符串)。
132
+ *
133
+ * @param value - 模型给的 arguments。
134
+ * @returns 传给目标工具的参数对象;空值当空对象。
135
+ * @throws 串不是合法 JSON、或解析出来不是对象时抛错,让模型自己改。
136
+ */
137
+ function readCallArgs(value) {
138
+ if (value === undefined || value === null)
139
+ return {};
140
+ if (typeof value === 'string') {
141
+ if (value.trim() === '')
142
+ return {};
143
+ let parsed;
144
+ try {
145
+ parsed = JSON.parse(value);
146
+ }
147
+ catch (error) {
148
+ // 模型把参数写成了非 JSON 的串:把解析器的原因一并带出去,它才知道改哪儿
149
+ const reason = error instanceof Error ? error.message : String(error);
150
+ throw new Error(`arguments 不是合法 JSON:${reason}`);
151
+ }
152
+ if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
153
+ throw new Error('arguments 解析出来不是对象,照 tool_describe 给出的 JSON Schema 填');
154
+ }
155
+ return parsed;
156
+ }
157
+ if (typeof value !== 'object' || Array.isArray(value))
158
+ throw new Error('arguments 要是一个对象');
159
+ return value;
160
+ }
161
+ // ── 三个桥接工具 ──────────────────────────────────────────────────────────
162
+ const searchTool = {
163
+ name: 'tool_search',
164
+ description: '在「已从台面上撤下」的工具里检索:按关键词返回工具真名、一句话说明与匹配分数。' +
165
+ '中文与英文都能搜(中文按相邻两字切词)。搜到之后先用 tool_describe 看参数,' +
166
+ '再用 tool_call 按真名调用;台面上已有的工具直接用,不必搜。' +
167
+ '注意本工具不是全局工具目录:台面上的工具不会出现在结果里,' +
168
+ '这里搜不到**不等于**这台机器没有这个工具(实测有模型这么误读过)。',
169
+ parameters: {
170
+ type: 'object',
171
+ properties: {
172
+ query: { type: 'string', description: '关键词,中文英文都行,例如「创建工单」「github issue」' },
173
+ limit: { type: 'number', description: '最多返回几条;不写就用配置里的条数' },
174
+ },
175
+ required: ['query'],
176
+ },
177
+ risk: 'read',
178
+ async run(args) {
179
+ const query = String(args.query ?? '').trim();
180
+ if (query === '')
181
+ throw new Error('query 不能为空:写几个关键词,中文英文都行');
182
+ const config = readConfig();
183
+ const num = Number(args.limit);
184
+ const limit = Number.isFinite(num)
185
+ ? Math.min(Math.max(Math.round(num), TOOL_SEARCH_LIMITS.searchLimit.min), TOOL_SEARCH_LIMITS.searchLimit.max)
186
+ : config.searchLimit;
187
+ const catalog = catalogItems();
188
+ const index = new ToolSearchIndex();
189
+ for (const item of catalog) {
190
+ index.add({ name: item.name, summary: item.summary, description: item.description });
191
+ }
192
+ const hits = index.search(query, limit);
193
+ if (hits.length === 0) {
194
+ // 空手而归时把「这里是什么目录」与「台面上有什么」一并说清:实测模型会把这句
195
+ // 「没搜到」读成「这台机器上没有这个工具」(会话里据此回答用户「没有网页搜索工具」),
196
+ // 其实它只是没在**撤下的**目录里。台面清单取 visible()——模型面前那份(预设投影过)。
197
+ const table = ctx.tools.visible().map((entry) => entry.name).sort();
198
+ const shown = table.length > 80 ? `${table.slice(0, 80).join('、')}…` : table.join('、');
199
+ return (`「${query}」没搜到匹配的工具:撤下的目录${catalog.length === 0 ? '是空的' : `里有 ${String(catalog.length)} 条`}。` +
200
+ '这个目录只装**被撤下**的工具(MCP 的动手类工具 + 命中渐进披露规则的注册表工具),' +
201
+ `台面上的工具不在里面,搜不到不等于这台机器没有这个工具。台面上现有 ${String(table.length)} 条,直接按真名调用:${shown}`);
202
+ }
203
+ const lines = hits.map((hit, position) => `${String(position + 1)}. ${hit.name} 分数 ${hit.score.toFixed(3)}\n ${hit.summary}`);
204
+ return (`检索「${query}」命中 ${String(hits.length)} 条(撤下的目录共 ${String(catalog.length)} 条):\n` +
205
+ `${lines.join('\n')}\n` +
206
+ '要看参数用 tool_describe,要调用用 tool_call(按上面的真名填)。');
207
+ },
208
+ };
209
+ const describeTool = {
210
+ name: 'tool_describe',
211
+ description: '取一条工具的完整参数 JSON Schema:撤下的与台面上的都能取。' +
212
+ '参数填错多半是没先看它;调用撤下的工具前先看这一眼再 tool_call。',
213
+ parameters: {
214
+ type: 'object',
215
+ properties: { name: { type: 'string', description: '工具真名,例如 mcp__github__create_issue' } },
216
+ required: ['name'],
217
+ },
218
+ risk: 'read',
219
+ async run(args) {
220
+ const name = String(args.name ?? '').trim();
221
+ if (name === '')
222
+ throw new Error('name 不能为空:填工具的真名(tool_search 给出的那个)');
223
+ const target = resolveTool(name);
224
+ if (target === undefined) {
225
+ throw new Error(`没有这个工具:${name}。先用 tool_search 搜名字,或者确认这个名字拼对了。`);
226
+ }
227
+ return (`${target.name}(风险 ${target.risk};${target.where})\n` +
228
+ `${JSON.stringify(target.parameters, null, 2)}`);
229
+ },
230
+ };
231
+ const callTool = {
232
+ name: 'tool_call',
233
+ description: '按真名调用一条工具(撤下的工具只能这样调)。真名与参数照 tool_search / tool_describe 给出的填,别自己猜。' +
234
+ '执行前会按真实工具名重走一遍审批与安全钩子,所以被撤下的写操作照样会弹卡、也照样能被规则拦下。',
235
+ parameters: {
236
+ type: 'object',
237
+ properties: {
238
+ name: { type: 'string', description: '要调用的工具真名(tool_search 或 tool_describe 给出的那个)' },
239
+ arguments: {
240
+ type: 'object',
241
+ description: '传给该工具的参数对象,字段照 tool_describe 给出的 JSON Schema 填',
242
+ },
243
+ },
244
+ required: ['name'],
245
+ },
246
+ risk: 'exec',
247
+ async run(args, runCtx) {
248
+ const name = String(args.name ?? '').trim();
249
+ if (name === '')
250
+ throw new Error('name 不能为空:填工具的真名(tool_search 给出的那个)');
251
+ if (BRIDGE_TOOL_NAMES.has(name)) {
252
+ throw new Error(`${name} 本来就在台面上,直接调用它就行,不用经 tool_call 再包一层`);
253
+ }
254
+ const target = resolveTool(name);
255
+ if (target === undefined) {
256
+ throw new Error(`没有这个工具:${name}。先用 tool_search 搜名字(例如「创建工单」或 github issue)。`);
257
+ }
258
+ const callArgs = readCallArgs(args.arguments);
259
+ // 关键一条:工具是被撤下之后经桥接层执行的,但守卫链必须按真实工具名与真实风险判定——
260
+ // 否则模式闸门、安全钩子、审批卡看到的都是 tool_call,会话日志里也记不出到底批准了谁。
261
+ const verdict = await ctx.guards.gate({
262
+ toolName: name,
263
+ risk: target.risk,
264
+ cwd: runCtx.cwd,
265
+ args: callArgs,
266
+ signal: runCtx.signal,
267
+ sessionId: runCtx.sessionId,
268
+ sessionPath: runCtx.sessionPath,
269
+ ...callFacts(callArgs, runCtx.cwd),
270
+ });
271
+ // 守卫说拒:理由原文回给模型(由循环记成这次工具失败),不静默、也不改写成别的话
272
+ if (verdict.action === 'deny')
273
+ throw new Error(verdict.reason);
274
+ return target.invoke(callArgs, runCtx);
275
+ },
276
+ };
277
+ for (const tool of [searchTool, describeTool, callTool])
278
+ disposers.push(ctx.tools.register(tool));
279
+ // ── 设置分区 ──────────────────────────────────────────────────────────────
280
+ /** 现在撤下了哪些工具(设置分区里那张现状清单)。 */
281
+ function withheldText(config) {
282
+ const mcp = mcpService();
283
+ // 开关关着时 MCP 的 schema 根本没撤,不能把它算进这张清单
284
+ const mcpNames = config.deferMcpSchemas && mcp !== undefined ? mcp.tools().map((tool) => tool.name).sort() : [];
285
+ const heldNames = [...held.keys()].sort();
286
+ if (mcpNames.length === 0 && heldNames.length === 0) {
287
+ const mcpNote = config.deferMcpSchemas ? '' : '(MCP 那把开关关着,MCP 工具的 schema 没撤)';
288
+ return `现在没有撤下任何工具:台面上就是注册表里的全部工具。${mcpNote}`;
289
+ }
290
+ const lines = [];
291
+ if (config.deferMcpSchemas) {
292
+ lines.push(`MCP 工具 ${String(mcpNames.length)} 条${mcpNames.length === 0 ? '' : `:${mcpNames.join('、')}`}`);
293
+ }
294
+ else {
295
+ lines.push('MCP 工具的 schema 没撤(开关关着)');
296
+ }
297
+ lines.push(`注册表工具 ${String(heldNames.length)} 条${heldNames.length === 0 ? '' : `:${heldNames.join('、')}`}`);
298
+ lines.push('read 工具不会出现在这两行里:它们必须留在台面上,否则每次只读都要过一张审批卡。');
299
+ return lines.join('\n');
300
+ }
301
+ const section = {
302
+ id: TOOL_SEARCH_CONFIG_KEY,
303
+ title: '工具渐进披露',
304
+ subtitle: '每轮只为用得上的工具付 schema:撤下的工具用 tool_search / tool_describe / tool_call 找回来',
305
+ order: 47,
306
+ fields() {
307
+ const config = readConfig();
308
+ return [
309
+ {
310
+ type: 'info',
311
+ label: '常驻台面的三个工具',
312
+ text: 'tool_search:按关键词(中文按相邻两字切,英文按单词)在撤下的目录里检索;\n' +
313
+ 'tool_describe:取某条工具的完整参数 JSON Schema;\n' +
314
+ 'tool_call:按真名调用它,调用前按真名重走审批与安全钩子。',
315
+ },
316
+ {
317
+ type: 'switch',
318
+ key: 'deferMcpSchemas',
319
+ label: '撤下 MCP 工具的 schema',
320
+ help: 'MCP 一接进来就是几十个工具的参数表,撤下收益最大。撤下由 MCP 客户端一次性执行,关掉要重启宿主才恢复。',
321
+ },
322
+ {
323
+ type: 'select',
324
+ key: 'tier',
325
+ label: '渐进披露档位',
326
+ options: [
327
+ { value: '1', label: '1:只撤 MCP 工具' },
328
+ { value: '2', label: '2:再撤下面规则命中的工具(缺省)' },
329
+ { value: '3', label: '3:除保留名单外,会改东西的工具全撤' },
330
+ ],
331
+ help: '只有 write / exec 风险的工具会被撤下;read 工具一律留在台面上。',
332
+ },
333
+ {
334
+ type: 'text',
335
+ key: 'deferRules',
336
+ label: '延后规则(一行一条,支持 *)',
337
+ placeholder: 'mcp__github__*\nedit',
338
+ mono: true,
339
+ help: '只在档位 2 生效。命中的工具被撤下后要用 tool_call 调,每次调用都会过审批卡。',
340
+ },
341
+ {
342
+ type: 'text',
343
+ key: 'keepTools',
344
+ label: '永远留在台面上的工具(一行一条)',
345
+ placeholder: 'bash',
346
+ mono: true,
347
+ help: '档位 2、3 都生效。常用且不想每次都过 tool_call 的工具写在这里。',
348
+ },
349
+ {
350
+ type: 'number',
351
+ key: 'searchLimit',
352
+ label: '一次检索最多返回几条',
353
+ min: TOOL_SEARCH_LIMITS.searchLimit.min,
354
+ max: TOOL_SEARCH_LIMITS.searchLimit.max,
355
+ step: 1,
356
+ help: '模型调 tool_search 时也能自己指定,上限就是这里。',
357
+ },
358
+ { type: 'info', label: '现在撤下了这些', text: withheldText(config), help: `配置存在 ${PLUGINS_FILE} 的 ${TOOL_SEARCH_CONFIG_KEY} 条目里,手改同样生效。` },
359
+ {
360
+ type: 'info',
361
+ label: '当前配置',
362
+ text: `规则 ${config.deferRules.length === 0 ? '(空)' : config.deferRules.join('、')}|保留 ${config.keepTools.length === 0 ? '(空)' : config.keepTools.join('、')}`,
363
+ },
364
+ ];
365
+ },
366
+ values() {
367
+ const config = readConfig();
368
+ return {
369
+ deferMcpSchemas: config.deferMcpSchemas,
370
+ // 下拉框回的是字符串,这里也回字符串,免得界面认不出当前选中项
371
+ tier: String(config.tier),
372
+ deferRules: config.deferRules.join('\n'),
373
+ keepTools: config.keepTools.join('\n'),
374
+ searchLimit: config.searchLimit,
375
+ };
376
+ },
377
+ save(key, value) {
378
+ try {
379
+ switch (key) {
380
+ case 'deferMcpSchemas': {
381
+ if (typeof value !== 'boolean')
382
+ return '这个开关只能是开或关';
383
+ writePluginConfig(TOOL_SEARCH_CONFIG_KEY, { deferMcpSchemas: value });
384
+ break;
385
+ }
386
+ case 'tier': {
387
+ const tier = Number(value);
388
+ if (!Number.isInteger(tier) || tier < TOOL_SEARCH_LIMITS.tier.min || tier > TOOL_SEARCH_LIMITS.tier.max) {
389
+ return `档位只能是 1、2 或 3,收到 ${String(value)}`;
390
+ }
391
+ writePluginConfig(TOOL_SEARCH_CONFIG_KEY, { tier });
392
+ break;
393
+ }
394
+ case 'deferRules': {
395
+ writePluginConfig(TOOL_SEARCH_CONFIG_KEY, { deferRules: parseNameListText(String(value)) });
396
+ break;
397
+ }
398
+ case 'keepTools': {
399
+ writePluginConfig(TOOL_SEARCH_CONFIG_KEY, { keepTools: parseNameListText(String(value)) });
400
+ break;
401
+ }
402
+ case 'searchLimit': {
403
+ const limit = Number(value);
404
+ if (!Number.isInteger(limit) || limit < TOOL_SEARCH_LIMITS.searchLimit.min || limit > TOOL_SEARCH_LIMITS.searchLimit.max) {
405
+ return `条数要在 ${TOOL_SEARCH_LIMITS.searchLimit.min}~${TOOL_SEARCH_LIMITS.searchLimit.max} 之间,收到 ${String(value)}`;
406
+ }
407
+ writePluginConfig(TOOL_SEARCH_CONFIG_KEY, { searchLimit: limit });
408
+ break;
409
+ }
410
+ default:
411
+ return `这个分区没有这项:${key}`;
412
+ }
413
+ }
414
+ catch (error) {
415
+ // parseNameListText 会为「名字里带空格」抛错:这类输入是用户填错了,把原因回显给他改
416
+ return error instanceof Error ? error.message : String(error);
417
+ }
418
+ // 配置存完立刻换挡,不必重启宿主
419
+ syncDeferral();
420
+ return undefined;
421
+ },
422
+ };
423
+ const offSection = ctx.settings.registerSection(section);
424
+ disposers.push(offSection);
425
+ // 三个桥接工具已经挂上,现在按配置撤一轮
426
+ syncDeferral();
427
+ return () => {
428
+ for (const off of disposers)
429
+ off();
430
+ // 卸载时把撤下的工具放回注册表:撤下只是替宿主省 token,卸载了就不该再扣着别人的工具
431
+ restoreHeld();
432
+ };
433
+ },
434
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waq666/pneuma",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Pneuma(numa)— 独立的终端 AI harness(自研 ReAct loop + ink TUI)",
5
5
  "type": "module",
6
6
  "license": "MIT",