v0.1.8: 万物皆是插件 + 全应用审计修复(60+ 缺陷歼灭)

插件协议:
- CotycPlugin Manifest(dependencies/conflicts/protected/install/uninstall)
- PluginManager:安装序确定性/依赖拒绝/异常回滚/追踪型上下文(卸载全摘钩子)
- 三核心插件常驻(Systems/Data/Events);插件清单/安装移除/启停广播
- EventPoolRegistry 多池合并;facade about/query('plugins')/plugin 订阅
- 设置页插件清单(含卸载按钮、核心保护);examplePlugin 开发范本入仓

全应用审计修复(引擎 39 + UI/主进程 40 双路清单,P0→P2 歼灭):
- P0:单亲 rollRoots 崩/插件事件软锁(findEvent 查池)/fire 覆盖幸存事件/
  facade 未赋值(act 目录 6/24 生效→全量接通)/packOverride 死实现真接管/
  4 能力卡无接线(trib/apprentice/tournament/season)/读档 rowid 方言崩溃/
  buildApprentice 空候选崩/插件安装无回滚/trait 加成从未消费/DEV 双跑破坏时序
- P1:定时器幸存/advance in-flight 闸/battle 暂停/tournament 点将真传/
  史书 memo 依赖/面板 hooks 顺序违规/远征 squad 残留 id/跨档状态残留/
  toast 自清除/读档错误提示/导入后重载世界/pendingEvent 读档回填
- P2:版本三处统一/NewGame 随机收编/学费错误文案/姓氏池去重/
  功法品阶错位(凡阶哨兵)/功法定价对齐/market 白名单校验/
  战利功法去重/回声漏封缄/clock 迭代快照/core 事件池保护/
  渡劫陨落走真突破/寄读 desc 诚实化/doas 死代码清理等 30 项

测试 239→256;金钟罩复验(防御批零漂移)
This commit is contained in:
2026-08-23 09:58:15 +08:00
parent 9e0b06e898
commit c09395a6d4
39 changed files with 932 additions and 157 deletions
+9 -4
View File
@@ -66,7 +66,7 @@ export const ACT_CATALOG: Record<ActName, { desc: string; fn: (w: World, p: ActP
'market.buy': { desc: '购货', fn: (w, p) => (p.item ? buyItem(w, p.item, p.count ?? 1) : false) },
'market.sell': { desc: '售货', fn: (w, p) => (p.item ? sellItem(w, p.item, p.count ?? 1) : false) },
'market.tech': { desc: '购法帖', fn: (w, p) => (p.tech ? buyTechnique(w, p.tech, p.stones ?? 0) : false) },
'craft.pill': { desc: '炼丹', fn: (w, p) => (p.item === 'ningyuan' ? w.craftPill('ningyuan') : w.craftPill('qiyuan')) },
'craft.pill': { desc: '炼丹', fn: (w, p) => (p.item === 'ningyuan' ? w.craftPill('ningyuan') : Boolean(p.item === 'qiyuan') && w.craftPill('qiyuan')) },
'diplomacy.gift': { desc: '赠礼', fn: (w, p) => (p.npcId ? giftNpc(w, p.npcId, p.stones ?? 0) : false) },
'diplomacy.peace': { desc: '议和', fn: (w, p) => (p.npcId ? makePeace(w, p.npcId) : false) },
'diplomacy.taunt': { desc: '寻衅', fn: (w, p) => (p.npcId ? w.tauntNpc(p.npcId) : false) },
@@ -108,6 +108,8 @@ export class GameFacade {
return { list: w.systemList() }
case 'finance':
return { stones: w.state.family.stones, accum: w.state.finance.accum, yearStats: w.state.yearStats }
case 'plugins':
return { list: w.pluginList() }
default:
return {}
}
@@ -121,7 +123,8 @@ export class GameFacade {
onPendingEvent: (id: string) => on({ type: 'pending', id }),
onGameOver: (reason: string) => on({ type: 'gameover', reason }),
onYearPaper: (report: YearlyReport) => on({ type: 'paper', report }),
onSystemChange: (id: string, enabled: boolean) => on({ type: 'sysChanged', id, enabled })
onSystemChange: (id: string, enabled: boolean) => on({ type: 'sysChanged', id, enabled }),
onPluginChange: (id: string, action: string) => on({ type: 'plugin', id, action })
}
this.world.out.push(bus)
return () => {
@@ -130,12 +133,13 @@ export class GameFacade {
}
}
about(): { title: string; version: string; modules: number; systems: number; packFingerprint: string } {
about(): { title: string; version: string; modules: number; systems: number; plugins: number; packFingerprint: string } {
return {
title: '仙途家族志',
version: '0.1.7',
version: '0.1.8',
modules: this.world.systemList().length,
systems: this.world.systemList().filter((s) => s.enabled).length,
plugins: this.world.pluginList().length,
packFingerprint: PACK.fingerprint()
}
}
@@ -149,6 +153,7 @@ export type FacadeEvent =
| { type: 'gameover'; reason: string }
| { type: 'paper'; report: YearlyReport }
| { type: 'sysChanged'; id: string; enabled: boolean }
| { type: 'plugin'; id: string; action: string }
export { marketPrice, computeLegacy }
export type { SaveMeta, LegacyArch }