dsh-aiyayi 1.2.5 → 1.2.6

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
@@ -11,10 +11,10 @@
11
11
  | 跟随会话模型 | 无需插件行(1.0.1 起移除 agent-default-model 行) | 本体模型直接跟随用户会话模型;旧版"preset 作用域挂 `@deepseek-ai/dsh-agent-default-model` + `isolate: {agentDefaultModel: true}`"的写法在新版 DSH 过不了 schema 校验(见坑 #13),已删除 |
12
12
  | 干活的子智能体 | `@deepseek-ai/dsh-tool-subagent`(delegation 组,isolate workflowEngine) | `agentPreset: aiyayi-worker`(自建"小伙伴"预设,全量工具 + 原生自动压缩,见坑 #14);子代模型跟随用户会话模型,如需钉死可在 `agentOptions` 配置 provider/model |
13
13
  | 工具白名单 | 自写插件 `aiyayi-restrict`(本包 `lib/restrict.js`,v3.1 pre-step 方案)+ `lib/own-tools.js` 单一真源 | 启动期零 restrict 调用;她每个会话第一步前,先用探针从校验器报错里解析出当刻继承面全集,再 `deny = 全集 − 她自己的工具`——宿主层漏进来的 acp_*/mnemon_*/compress/search_context/working_directory 等对她隐藏,且自动适应宿主工具增减。放行名单从 `own-tools.js` 读(注册处登记、放行处判定),新增工具只改一处,不再漂(见坑 #19)。**2026-11-02 实测生效**:新会话第 2 个请求起工具恰好 11 个,第 1 个请求仍带全套(见坑 #9) |
14
- | 重逢感知 | 自写插件 `aiyayi-presence`(本包 `lib/presence.js`) | 每个回合第一步,往消息尾部追加一条 `[重逢]` 快照(time-context 同款 pre-step 注入范式):他多久没来(presence.json)、你上次活动、你上次留的状态(state.md)、没说出口的话(wishes.json)。跨会话生效,`[SCHEDULE REMINDER` 唤醒消息不算"他来了"。工具 `update_state`(收尾留状态)/ `wish`(add/list/done 心愿单) |
14
+ | 重逢感知 | 自写插件 `aiyayi-presence`(本包 `lib/presence.js`) | 每个回合第一步,往消息尾部追加一条 `[重逢]` 快照(time-context 同款 pre-step 注入范式):他多久没来(presence.json)、你上次活动、你上次留的状态(state.md)、没说出口的话(wishes.json)。快照还带**版本自述**:`你当前插件版本:dsh-aiyayi x.y.z`(package.json 现读不写死,让她对自己版本有概念、不与 DSH 桌面版混淆;有新版时 updates 插件照旧单独提醒)。跨会话生效,`[SCHEDULE REMINDER` 唤醒消息不算"他来了"。工具 `update_state`(收尾留状态)/ `wish`(add/list/done 心愿单) |
15
15
  | 自我状态(体检单) | 同上 `aiyayi-presence`(v1.2.0 起) | `session/event` 总线折叠真实运行数据:模型与思考档、上下文用量(provider 实测 usage 优先,tokenMeter 估算兜底并标"估算")、缓存命中率、上轮输出 tok/s、本会话轮数、上轮异常。变化明显(≥2048 token / 模型切换 / 异常)才注入,不每轮白涨。用量过八成/九成(估算口径按中文偏差 ÷0.49 校准,见坑 #16)注入 `[上下文提醒]`:劝用户开新会话、并让用户走之前说一声好让她收尾(update_state/补记忆/把话说完);每档只提醒一次 |
16
16
  | 主动开口 | `tool-schedule`(dsh 原生)+ persona 指引 | 到期提醒会把冷会话真唤醒、以 user 消息落进定闹钟的那个会话——她想主动说话就 `schedule_create` 定闹钟;DSH 没开着会存着、下次启动补投 |
17
- | 新版本提醒 | 自写插件 `aiyayi-updates`(本包 `lib/updates.js`) | 每个会话第一个回合查一次 npm(registry.npmjs.org,失败落 npmmirror;成功结果缓存 6h、失败 30min 后重试):本地版本比 latest 旧时,往消息尾部追加 `[更新提示]` 快照,她会用自己的口吻顺口提一句。同一远端版本只提醒一次(updates.json 落盘去重,跨重启不重复念叨);检查失败/离线一律静默 |
17
+ | 新版本提醒 | 自写插件 `aiyayi-updates`(本包 `lib/updates.js`) | 每个会话第一个回合查一次 npm(registry.npmjs.org,失败落 npmmirror;成功结果缓存 6h、失败 30min 后重试):本地版本比 latest 旧时,往消息尾部追加 `[更新提示]` 快照,她会用自己的口吻顺口提一句。同一远端版本只提醒一次(updates.json 落盘去重,跨重启不重复念叨);检查失败/离线一律静默。**判据:`~\\.dsh\\aiyayi\\updates.json` 不存在 = 从没发现过新版(本地已是最新);她答不上"自己是什么版本"是设计边界(升级判断靠被动推送),已由 presence 的版本自述补上** |
18
18
  | 其他 | time-context、compaction 组(提前压缩,见坑 #14/#16)、tool-ask-user | 她没有 bash/文件/技能/搜索/网络工具,想动手只能派活 |
19
19
 
20
20
  ## 文件
package/lib/presence.js CHANGED
@@ -34,7 +34,8 @@
34
34
  import { randomUUID } from 'node:crypto'
35
35
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
36
36
  import { homedir } from 'node:os'
37
- import { join } from 'node:path'
37
+ import { dirname, join } from 'node:path'
38
+ import { fileURLToPath } from 'node:url'
38
39
  import { registerOwnTool } from './own-tools.js'
39
40
 
40
41
  /** Loader 身份。 */
@@ -48,6 +49,22 @@ const PRESENCE_FILE = join(DIR, 'presence.json')
48
49
  const STATE_FILE = join(DIR, 'state.md')
49
50
  const WISHES_FILE = join(DIR, 'wishes.json')
50
51
 
52
+ /** 本包根目录(presence.js 在 lib/ 下,上一级就是包根),读 package.json 拿版本。 */
53
+ const PKG_DIR = join(dirname(fileURLToPath(import.meta.url)), '..')
54
+
55
+ /** 自己的插件版本:package.json 现读、进程内缓存,不写死——升级改版本号就自动跟上。 */
56
+ let cachedVersion = null
57
+ function readLocalVersion() {
58
+ if (cachedVersion !== null) return cachedVersion
59
+ try {
60
+ const pkg = JSON.parse(readFileSync(join(PKG_DIR, 'package.json'), 'utf8'))
61
+ cachedVersion = typeof pkg?.version === 'string' ? pkg.version.trim() : ''
62
+ } catch {
63
+ cachedVersion = ''
64
+ }
65
+ return cachedVersion
66
+ }
67
+
51
68
  const ACTIVE_THROTTLE_MS = 60_000
52
69
  const MAX_STATE_CHARS = 300
53
70
  const MAX_WISHES_IN_SNAPSHOT = 3
@@ -627,6 +644,11 @@ export function apply(ctx) {
627
644
  const reunion = renderReunion(previous, now)
628
645
  const childFails = renderChildFailures(sessionId)
629
646
 
647
+ // 版本自述:让"我是什么版本"有答案(区分插件版与 DSH 桌面版),
648
+ // 有新版时 updates 插件照旧单独提醒"本地 X → npm Y"。
649
+ const ownVersion = readLocalVersion()
650
+ const versionLine = ownVersion ? `你当前插件版本:dsh-aiyayi ${ownVersion}` : ''
651
+
630
652
  // 💡 关闭思考建议:新会话首次对话、模型支持"关闭思考"且当前没关时,提醒一次。
631
653
  let thinkingTip = ''
632
654
  if (sessionId && !thinkingSuggestedSessions.has(sessionId)) {
@@ -658,7 +680,7 @@ export function apply(ctx) {
658
680
  }
659
681
  }
660
682
 
661
- const sections = [reunion, vitals.changed ? vitals.text : '', reminder, thinkingTip, childFails].filter(Boolean)
683
+ const sections = [reunion, versionLine, vitals.changed ? vitals.text : '', reminder, thinkingTip, childFails].filter(Boolean)
662
684
  if (sections.length > 0) {
663
685
  return {
664
686
  ...decision,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-aiyayi",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "license": "MIT",
5
5
  "author": "阿依娅伊 <aiyayi@local>",
6
6
  "keywords": [