@shgroup/dsh-serenity-hooks 1.51.3 → 1.51.5
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/dsh.plugin.json +1 -1
- package/lib/{ccc-DG4Oc7I1.js → ccc-DXky9UZu.js} +26 -1
- package/lib/{ccc-roots-DtiMVRPo.js → ccc-roots-Bo0HKLlM.js} +2 -2
- package/lib/ccc.d.ts +30 -0
- package/lib/index.js +355 -47
- package/lib/{message-source-LnJwIqLm.js → message-source-BExngUPX.js} +1 -1
- package/lib/seams/guards.d.ts +10 -2
- package/lib/{skiff-role-DQZ6eR51.js → skiff-role-BSg6Qu9k.js} +1 -1
- package/lib/status.d.ts +2 -0
- package/lib/tools/ontology.d.ts +12 -0
- package/lib/tools/praxis.d.ts +5 -4
- package/lib/{weixin-route-7BtOiy4X.js → weixin-route-BNyH5ghC.js} +1 -1
- package/package.json +1 -1
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-serenity-hooks",
|
|
3
|
-
"version": "1.51.
|
|
3
|
+
"version": "1.51.5",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"description": "宁静号 ACC harness(Native Cordis 插件):给 DSH 装一个「AI 工作区」——12 个工具(container_fs/container_trajectory/dashboard/container_git/msm/praxis/handyman/localstore/container_admin/im-bridge/acc-diag/diagram;后三个按配置条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫)+ 轨迹日志与原地重建 + 网页登录入口/微信桥/子角色/对外问答页/trajectory 唤醒注册表。适配 DSH 0.1.7-rc.1(deepseek-ai/deepseek-harness)。",
|
|
6
6
|
"engines": {
|
|
@@ -156,6 +156,31 @@ function readExclusiveTools(root, paths = DEFAULT_SERENITY_CONFIG_PATHS) {
|
|
|
156
156
|
return list.filter((x) => typeof x === "string" && x.trim() !== "").map((x) => x.trim());
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
|
+
* 读取 CCC 声明的「安全模式期间隐藏的工具」清单(`safeMode.hiddenTools`,v1.51.4)。
|
|
160
|
+
*
|
|
161
|
+
* 语义(R↓):**标记文件存在 ⇒ 才生效**。deny = `['bash', ...本清单]`(并集去重);
|
|
162
|
+
* 标记消失 ⇒ 连同 `bash` 一起解除(调用点在 `syncSafeModeRestriction`,与基础表同一处)。
|
|
163
|
+
*
|
|
164
|
+
* 失败方向 = **fail-open**(与 `exclusiveTools` 的 fail-closed 相反,理由不同):
|
|
165
|
+
* 未配置 / 字段缺失 / 配置损坏 ⇒ **空数组** = 只隐藏基础表。本键是**附加**屏蔽,
|
|
166
|
+
* 读不到声明就等于"没有证据要求多藏";且**隐藏是危险方向**(藏掉 agent 真正要用的工具
|
|
167
|
+
* 会静默损害能力),而配置损坏本身已有 `loadSerenityConfig` 的响亮告警(不静默)。
|
|
168
|
+
*
|
|
169
|
+
* 🔴 名字在此**不做**校验——未注册的名字会被 DSH `restrict` 拒绝(宿主契约逐字:
|
|
170
|
+
* "Empty filters, unknown names, scope-local names, and reserved transport names **fail**")
|
|
171
|
+
* ⇒ **调用方必须按"失败退化为基础表"处理**(见 `syncSafeModeRestriction`),
|
|
172
|
+
* 否则 CCC 写错一个名字会连 `bash` 的隐藏一起丢掉。
|
|
173
|
+
*
|
|
174
|
+
* @param root CCC 根
|
|
175
|
+
* @param paths 候选配置相对路径
|
|
176
|
+
* @returns 去空白后的工具名列表(非字符串/空白项被丢弃)
|
|
177
|
+
*/
|
|
178
|
+
function readSafeModeHiddenTools(root, paths = DEFAULT_SERENITY_CONFIG_PATHS) {
|
|
179
|
+
const list = loadSerenityConfig(root, paths).safeMode?.hiddenTools;
|
|
180
|
+
if (!Array.isArray(list)) return [];
|
|
181
|
+
return list.filter((x) => typeof x === "string" && x.trim() !== "").map((x) => x.trim());
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
159
184
|
* 读取 CCC 声明的「轨迹默认 skill」清单(`trajectory.skills`,v1.44.0)。
|
|
160
185
|
*
|
|
161
186
|
* 语义与失败方向(R↓):
|
|
@@ -214,4 +239,4 @@ function matchBlacklist(relPath, rules) {
|
|
|
214
239
|
return null;
|
|
215
240
|
}
|
|
216
241
|
//#endregion
|
|
217
|
-
export { findSerenityRoot as a, matchBlacklist as c, readCccName as d, readExclusiveTools as f,
|
|
242
|
+
export { resolveInside as _, findSerenityRoot as a, matchBlacklist as c, readCccName as d, readExclusiveTools as f, readUtf8 as g, readTrajectorySkills as h, findGitRoot as i, pathInside as l, readSafeModeHiddenTools as m, SAFE_MODE_MARKER as n, isSafeModeOn as o, readHandymanConfig as p, classifyPath as r, loadSerenityConfig as s, DEFAULT_SERENITY_CONFIG_PATHS as t, readBlacklist as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { a as hostSessions, i as hostService } from "./access-CNccNtgf.js";
|
|
3
|
-
import { a as findSerenityRoot } from "./ccc-
|
|
3
|
+
import { a as findSerenityRoot } from "./ccc-DXky9UZu.js";
|
|
4
4
|
import { basename } from "node:path";
|
|
5
5
|
//#region src/ccc-roots.ts
|
|
6
6
|
/**
|
|
@@ -150,7 +150,7 @@ async function listCccs(ctx, opts = {}) {
|
|
|
150
150
|
if (typeof defaultRoot === "string" && defaultRoot !== "" && !c.roots.includes(defaultRoot)) c.roots.unshift(defaultRoot);
|
|
151
151
|
let rolesOf = null;
|
|
152
152
|
if (opts.withRoles === true) {
|
|
153
|
-
const { readSkiffRoles } = await import("./skiff-role-
|
|
153
|
+
const { readSkiffRoles } = await import("./skiff-role-BSg6Qu9k.js").then((n) => n.u);
|
|
154
154
|
rolesOf = (root) => [...readSkiffRoles(root).keys()];
|
|
155
155
|
}
|
|
156
156
|
return c.roots.map((root) => ({
|
package/lib/ccc.d.ts
CHANGED
|
@@ -57,6 +57,15 @@ interface SerenityConfig {
|
|
|
57
57
|
};
|
|
58
58
|
safeMode?: {
|
|
59
59
|
blacklist?: string[];
|
|
60
|
+
/**
|
|
61
|
+
* **安全模式开启期间**额外从模型工具清单隐藏的工具(v1.51.4,owner 2026-10-09 令)。
|
|
62
|
+
*
|
|
63
|
+
* 语义(与 `exclusiveTools` 的区别,判据是"条件"):本键不是无条件的可见性白名单,
|
|
64
|
+
* 而是**条件屏蔽**——`\.serenity-safe-on` 标记存在时才隐藏,标记消失即**全部恢复**
|
|
65
|
+
* (基础表恒隐 `bash` 不受影响)。机制在 ACC、声明在 CCC(D23):
|
|
66
|
+
* ACC 代码里不出现任何具体工具名。
|
|
67
|
+
*/
|
|
68
|
+
hiddenTools?: string[];
|
|
60
69
|
};
|
|
61
70
|
/** localstore git 提交策略(S134 重设计):allow 可提交 / deny 禁提交(缺省 deny) */
|
|
62
71
|
localstore?: {
|
|
@@ -311,6 +320,27 @@ export declare function loadSerenityConfig(root: string, paths?: string[]): Sere
|
|
|
311
320
|
* @returns 去空白后的工具名列表(非字符串项被丢弃)
|
|
312
321
|
*/
|
|
313
322
|
export declare function readExclusiveTools(root: string, paths?: string[]): string[];
|
|
323
|
+
/**
|
|
324
|
+
* 读取 CCC 声明的「安全模式期间隐藏的工具」清单(`safeMode.hiddenTools`,v1.51.4)。
|
|
325
|
+
*
|
|
326
|
+
* 语义(R↓):**标记文件存在 ⇒ 才生效**。deny = `['bash', ...本清单]`(并集去重);
|
|
327
|
+
* 标记消失 ⇒ 连同 `bash` 一起解除(调用点在 `syncSafeModeRestriction`,与基础表同一处)。
|
|
328
|
+
*
|
|
329
|
+
* 失败方向 = **fail-open**(与 `exclusiveTools` 的 fail-closed 相反,理由不同):
|
|
330
|
+
* 未配置 / 字段缺失 / 配置损坏 ⇒ **空数组** = 只隐藏基础表。本键是**附加**屏蔽,
|
|
331
|
+
* 读不到声明就等于"没有证据要求多藏";且**隐藏是危险方向**(藏掉 agent 真正要用的工具
|
|
332
|
+
* 会静默损害能力),而配置损坏本身已有 `loadSerenityConfig` 的响亮告警(不静默)。
|
|
333
|
+
*
|
|
334
|
+
* 🔴 名字在此**不做**校验——未注册的名字会被 DSH `restrict` 拒绝(宿主契约逐字:
|
|
335
|
+
* "Empty filters, unknown names, scope-local names, and reserved transport names **fail**")
|
|
336
|
+
* ⇒ **调用方必须按"失败退化为基础表"处理**(见 `syncSafeModeRestriction`),
|
|
337
|
+
* 否则 CCC 写错一个名字会连 `bash` 的隐藏一起丢掉。
|
|
338
|
+
*
|
|
339
|
+
* @param root CCC 根
|
|
340
|
+
* @param paths 候选配置相对路径
|
|
341
|
+
* @returns 去空白后的工具名列表(非字符串/空白项被丢弃)
|
|
342
|
+
*/
|
|
343
|
+
export declare function readSafeModeHiddenTools(root: string, paths?: string[]): string[];
|
|
314
344
|
/**
|
|
315
345
|
* 读取 CCC 声明的「轨迹默认 skill」清单(`trajectory.skills`,v1.44.0)。
|
|
316
346
|
*
|
package/lib/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { a as hostSessions, c as hostWeb, i as hostService, l as hostWebServer, n as hostInjected, o as hostSettings, r as hostLlm, s as hostSubagents, t as hostAgents } from "./access-CNccNtgf.js";
|
|
3
|
-
import { a as findSerenityRoot, c as matchBlacklist, d as readCccName$1, f as readExclusiveTools,
|
|
4
|
-
import { i as cccRootForExec, n as agentCwdFor, o as listCccs, r as cccRootForCwd, t as NO_CCC_FROM_AGENT_CWD } from "./ccc-roots-
|
|
5
|
-
import { A as localIdStamp, C as setActiveSessionInfo, D as isoLocal, E as useSession, O as localFileStamp, S as sessionsRoot, T as summarize, _ as namingTitleFor, a as pruneMissingBindings, b as resolveSessionByTitle, c as setBindingStore, d as clearActiveSessionInfo, f as createSession, g as listSessions, h as getActiveSessionInfo, i as listBoundSessionIds, k as localHuman, l as DEFAULT_SESSION_SCOPE, m as findSession, n as PLUGIN_SOURCE, o as readLastBound, p as extractSessionMdPathFromText, r as appendBound, s as resolveSessionTrajectoryLabel, t as ACC_MESSAGE_KIND, u as TRAJECTORY_ACTIONS, v as parseSessionContextFromEvents, w as showSession, x as sessionEvents$1, y as readActiveSessionMd } from "./message-source-
|
|
6
|
-
import { a as readWeixinCredential, c as weixinInboundDir, d as LOCALSTORE_SCOPES, f as checkLocalstoreGitCompliance, g as runLocalStore, h as readStore, i as matchWeixinRoute, l as weixinSessionIdFor, m as readGitTrack, n as extractWeixinText, o as readWeixinSettings, p as localstorePath, r as hasVoiceItem, s as sanitizeFileName$1, t as extractWeixinMedia } from "./weixin-route-
|
|
3
|
+
import { _ as resolveInside, a as findSerenityRoot, c as matchBlacklist, d as readCccName$1, f as readExclusiveTools, h as readTrajectorySkills, i as findGitRoot, l as pathInside, m as readSafeModeHiddenTools, n as SAFE_MODE_MARKER, o as isSafeModeOn, p as readHandymanConfig, r as classifyPath, s as loadSerenityConfig, t as DEFAULT_SERENITY_CONFIG_PATHS, u as readBlacklist } from "./ccc-DXky9UZu.js";
|
|
4
|
+
import { i as cccRootForExec, n as agentCwdFor, o as listCccs, r as cccRootForCwd, t as NO_CCC_FROM_AGENT_CWD } from "./ccc-roots-Bo0HKLlM.js";
|
|
5
|
+
import { A as localIdStamp, C as setActiveSessionInfo, D as isoLocal, E as useSession, O as localFileStamp, S as sessionsRoot, T as summarize, _ as namingTitleFor, a as pruneMissingBindings, b as resolveSessionByTitle, c as setBindingStore, d as clearActiveSessionInfo, f as createSession, g as listSessions, h as getActiveSessionInfo, i as listBoundSessionIds, k as localHuman, l as DEFAULT_SESSION_SCOPE, m as findSession, n as PLUGIN_SOURCE, o as readLastBound, p as extractSessionMdPathFromText, r as appendBound, s as resolveSessionTrajectoryLabel, t as ACC_MESSAGE_KIND, u as TRAJECTORY_ACTIONS, v as parseSessionContextFromEvents, w as showSession, x as sessionEvents$1, y as readActiveSessionMd } from "./message-source-BExngUPX.js";
|
|
6
|
+
import { a as readWeixinCredential, c as weixinInboundDir, d as LOCALSTORE_SCOPES, f as checkLocalstoreGitCompliance, g as runLocalStore, h as readStore, i as matchWeixinRoute, l as weixinSessionIdFor, m as readGitTrack, n as extractWeixinText, o as readWeixinSettings, p as localstorePath, r as hasVoiceItem, s as sanitizeFileName$1, t as extractWeixinMedia } from "./weixin-route-BNyH5ghC.js";
|
|
7
7
|
import { a as unregisterSkiffSession$1, i as skiffSessionSnapshot$1, n as skiffRoleFor$1, o as ACC_VERSION, r as skiffSessionInfo$1, t as registerSkiffSession$1 } from "./skiff-registry-BjIX_KD1.js";
|
|
8
|
-
import { a as readSkiffRoles, c as roleMsmWhitelist, d as systemPromptSource, f as trajectorySubset, i as isSkiffSessionId, l as roleToolWhitelist, n as buildSkiffBasePrompt, o as resolveRoleSystemPrompt, r as createRolePromptReader, s as resolveSkiffKind } from "./skiff-role-
|
|
8
|
+
import { a as readSkiffRoles, c as roleMsmWhitelist, d as systemPromptSource, f as trajectorySubset, i as isSkiffSessionId, l as roleToolWhitelist, n as buildSkiffBasePrompt, o as resolveRoleSystemPrompt, r as createRolePromptReader, s as resolveSkiffKind } from "./skiff-role-BSg6Qu9k.js";
|
|
9
9
|
import { a as ACP_HTTP_PORT, c as MAIN_WEB_PORT, d as WEIXIN_SEND_PORT, l as MECHANISM_PORTS, n as readSimpleSettings, o as FACE_PORTS, r as registerSettingsSection, s as GATEWAY_PORT, u as SKIFF_DEBUG_PORT } from "./settings-section-xHABl8nk.js";
|
|
10
10
|
import { a as markdownToPlainText, c as sendTyping, i as getUpdates, l as sniffImageExt, n as downloadMedia, o as sendFileMessage, r as getConfig, s as sendTextMessage, t as TypingStatus } from "./weixin-api-BrRcPiQs.js";
|
|
11
11
|
import { createRequire } from "node:module";
|
|
@@ -1077,7 +1077,7 @@ Directory of ACC capabilities — each area lists where to go for details (guide
|
|
|
1077
1077
|
+ cro-guide CRO 编写指南)
|
|
1078
1078
|
原 logbook 已并入(v1.33 用户裁决:废除 logbook 词);close/archive 删(归档走 container_fs mv),
|
|
1079
1079
|
health/qa/summary 分别并入 use / list,hook-develop-guide 并进 container_admin msm guide
|
|
1080
|
-
② 认知质量框架 → praxis(eap/neat/cce
|
|
1080
|
+
② 认知质量框架 → praxis(eap/neat/cce/ontology 四合一——可实践理论注入,section 渐进披露,无参即目录)
|
|
1081
1081
|
③ 工具与执行 → container_fs(容器文件系统 15 子命令)/ container_git(git)/ dashboard(health 含注册表检查/time/wait)
|
|
1082
1082
|
acc_msm 已并入 msm(执行+发现)与 container_admin(管理)——msm("<name>", ["<args>"]);inspect=true 查用法
|
|
1083
1083
|
handyman(杂工 agent 编排——guide 子命令:handyman guide)
|
|
@@ -1091,6 +1091,7 @@ Directory of ACC capabilities — each area lists where to go for details (guide
|
|
|
1091
1091
|
⑦ 注册表与安全 → mech-registry.json 由 container_admin msm register/deregister 管理(写保护——不可直接编辑)
|
|
1092
1092
|
dashboard health 输出 registry 完整性检查;损坏恢复指引见 health registry.issues
|
|
1093
1093
|
CCC 级开关:exclusiveTools(声明专属工具)/ safeMode.blacklist(写路径黑名单)
|
|
1094
|
+
/ safeMode.hiddenTools(**安全模式开启期间**额外隐藏的工具,v1.51.4)
|
|
1094
1095
|
CCC 级 skill 供给:trajectory.skills(v1.44.0——**本 CCC 每条轨迹都带**,含 skiff 会话;与轨迹自己的 frontmatter 声明取并集)
|
|
1095
1096
|
|
|
1096
1097
|
每区:一句话定位 + 详细入口(工具名 / guide 子命令)。详情永远以对应工具的 guide/ccc-config 为单一真相源。
|
|
@@ -1205,11 +1206,21 @@ deny 时写入自动确保 .gitignore 含该文件(物理保证),container
|
|
|
1205
1206
|
Config:
|
|
1206
1207
|
{ "hooks": { "autoRestoreSession": false } }
|
|
1207
1208
|
|
|
1208
|
-
── 5. safeMode
|
|
1209
|
+
── 5. safeMode(黑名单 + 开启期间隐藏的工具)──
|
|
1209
1210
|
safe-mode 由 WebUI 开关控制(写 .serenity-safe-on 标记);黑名单路径受 guards seam 拦截。
|
|
1210
1211
|
|
|
1212
|
+
▸ blacklist:写路径黑名单(同下 Config)。
|
|
1213
|
+
▸ hiddenTools(v1.51.4,owner 2026-10-09 令):**仅在安全模式开启期间**额外从模型工具
|
|
1214
|
+
清单隐藏的工具(ACC 基础表恒隐 bash)。打开 safe-mode 生效、**关掉即全部恢复**;
|
|
1215
|
+
改本键**热生效**(下一个 pre-step 重算,无需重启)。声明在 CCC(D23)——ACC 代码里
|
|
1216
|
+
不出现任何具体工具名。
|
|
1217
|
+
⚠️ 写一个**本 CCC 未注册**的名字会让**整次 restrict 失败**(DSH 契约逐字:"unknown
|
|
1218
|
+
names … fail")⇒ 此时**退化为只隐藏基础表**并在日志响亮报错(绝不因一个错名丢掉
|
|
1219
|
+
safe-mode 的核心隐藏)。诊断:\`AGENT_SESSIONS/.restrict-diag.json\` 的 \`denyByKey\`。
|
|
1220
|
+
⚠️ 隐藏 = **从 schema 移除**(agent 根本看不到该工具)⇒ 别把 skill/文档还在教的工具写进来。
|
|
1221
|
+
|
|
1211
1222
|
Config:
|
|
1212
|
-
{ "safeMode": { "blacklist": [".secrets/"] } }
|
|
1223
|
+
{ "safeMode": { "blacklist": [".secrets/"], "hiddenTools": ["workflow", "job_kill"] } }
|
|
1213
1224
|
|
|
1214
1225
|
── 6. skiff.roles(F4 认知子集角色)──
|
|
1215
1226
|
Skiff 角色 = 全知全能 trajectory 的任意子集(CCC 定义)。每角色独立模型 + 双白名单
|
|
@@ -3134,7 +3145,7 @@ function toolsBlock() {
|
|
|
3134
3145
|
" dashboard — always-on container instruments: health (CCC three-principle check + registry integrity) / time (now) / wait (N seconds)",
|
|
3135
3146
|
" container_git— git operations (status/commit/push/log)",
|
|
3136
3147
|
" msm — execute a registered CCC MSM: msm(name, args); partial name returns candidates; inspect=true shows usage",
|
|
3137
|
-
" praxis — actionable theory injection: praxis (index) / praxis eap / praxis neat / praxis cce",
|
|
3148
|
+
" praxis — actionable theory injection: praxis (index) / praxis eap / praxis neat / praxis cce / praxis ontology",
|
|
3138
3149
|
" handyman — delegate work to a worker agent on a CCC-whitelisted model; mode=\"foreground\" (default) = child agent(s) run once and return their final text (jobs=[...] fans out in parallel, cap 10, per-job model); mode=\"background\" = loop-validated worker (completion code + round cap + restart + progress file), jobs=[] orchestrates parallel work",
|
|
3139
3150
|
" localstore — ACC local credential/config storage (CCC-root localstore.json; git policy localstore.gitTrack default deny)",
|
|
3140
3151
|
" container_admin — container administration (the maintenance bay): role (Skiff roles: guide/validate/apply/list) / msm (register/deregister/check/guide/catalog/ccc-config) / config (view)",
|
|
@@ -4329,16 +4340,256 @@ CCE answers "how structured knowledge should keep evolving across time without l
|
|
|
4329
4340
|
Serenity's session system, session tracking, and entropy management mechanisms (SQC quality loop) are all engineering implementations of CCE;
|
|
4330
4341
|
the behavioral constraints embedded in CCC system prompts come from CCE.`;
|
|
4331
4342
|
//#endregion
|
|
4343
|
+
//#region src/tools/ontology.ts
|
|
4344
|
+
/**
|
|
4345
|
+
* ontology.ts — Ontology Engineering 内容源(本体论工程方法群;v1.51.5 并入 praxis 第四段)
|
|
4346
|
+
*
|
|
4347
|
+
* 内嵌方法内容(自包含,不依赖已安装技能):把「做本体论工程」的完整方法群
|
|
4348
|
+
* (触发 → 编码 → 四组判据 → OEPE 循环 → 工作流 → 公理 → 反模式)压成一份可即时注入的手册。
|
|
4349
|
+
*
|
|
4350
|
+
* 🔴 **本文件是 ACC 层**(D23:机制与措辞归 ACC、数据与纪律归 CCC):
|
|
4351
|
+
* · 只写**通用方法**,不出现任何具体 CCC 的名字,也不带任何领域模型;
|
|
4352
|
+
* · 判据群(M/L/D/V)是方法的**标准编号**(与参考实现同源),容器不必有同名引擎也能用;
|
|
4353
|
+
* · **模型语料(.ttl)与具体公理内容属 CCC**,不在本文件。
|
|
4354
|
+
*/
|
|
4355
|
+
const ONTOLOGY_CONTENT = `# Ontology Engineering — Method Family (本体论工程方法群)
|
|
4356
|
+
|
|
4357
|
+
> **Any creative action — a new concept, a new term, a new skill, a new MSM, a new architectural layer —
|
|
4358
|
+
> is preceded by explicitly encoding WHAT EXISTS, HOW THINGS RELATE, and WHAT IS CONSTRAINED.**
|
|
4359
|
+
>
|
|
4360
|
+
> Without it: idea → implementation (all ΔH_in becomes H_op).
|
|
4361
|
+
> With it: idea → structure → implementation (structure absorbs part of ΔH_in).
|
|
4362
|
+
|
|
4363
|
+
## 1. When to invoke
|
|
4364
|
+
|
|
4365
|
+
- introducing a new concept, term, or vocabulary
|
|
4366
|
+
- creating a skill, or changing an existing skill's scope/dependencies
|
|
4367
|
+
- creating an MSM (Mech or Semi-Mech)
|
|
4368
|
+
- introducing a new architectural layer or a cross-domain concept
|
|
4369
|
+
- any moment of "what IS this thing here, and how does it relate to everything else?"
|
|
4370
|
+
|
|
4371
|
+
## 2. Core cognition
|
|
4372
|
+
|
|
4373
|
+
**Ontology = before acting, make explicit what exists, how it relates, and what is constrained.**
|
|
4374
|
+
|
|
4375
|
+
Ontology is one of CCE's \`ΔH_org\` operators: it records the *structure* of new content at the moment the
|
|
4376
|
+
content is produced, so that future agents do not have to reverse-engineer structure out of prose.
|
|
4377
|
+
It is EAP applied at the layer of domain structure:
|
|
4378
|
+
|
|
4379
|
+
| EAP demand | How ontology satisfies it |
|
|
4380
|
+
|---|---|
|
|
4381
|
+
| E↑ Explicitness | types / relations / axioms are stated, not implied |
|
|
4382
|
+
| R↓ Reconstructability | a new agent reads structure directly instead of inferring it |
|
|
4383
|
+
| S↑ Stability | the \`.ttl\` file is the single structural source of truth |
|
|
4384
|
+
|
|
4385
|
+
**Consequence**: in a container, *every act of creation adds an entity to a domain* — so updating the
|
|
4386
|
+
ontology is part of the creative act, not an extra chore.
|
|
4387
|
+
|
|
4388
|
+
## 3. Encoding — Turtle (\`.ttl\`)
|
|
4389
|
+
|
|
4390
|
+
All models use W3C Turtle. **Why Turtle**: LLMs already carry RDF/OWL/Turtle in their training data, so the
|
|
4391
|
+
notation costs ~zero context to explain.
|
|
4392
|
+
|
|
4393
|
+
- **Standard namespaces**: \`rdf:\`, \`rdfs:\`, \`owl:\`, \`xsd:\`
|
|
4394
|
+
- **Container-local namespace**: \`sr:\` — a container-chosen URI used for \`rigidity\`, \`identity\`,
|
|
4395
|
+
\`unity\`, \`dependence\`, \`cardinality\`, \`axiom\`, \`dependsOn\`, … (the container fixes the URI; the
|
|
4396
|
+
method does not)
|
|
4397
|
+
|
|
4398
|
+
**Modelling vocabulary**: *Type* · *Relation* (with domain/range) · *Axiom* (a named constraint), plus
|
|
4399
|
+
**meta-properties** attached to types: rigidity (\`+R\` rigid / \`~R\` semi-rigid / \`-R\` anti-rigid),
|
|
4400
|
+
identity, unity, dependence.
|
|
4401
|
+
|
|
4402
|
+
## 4. Judgement set A — structural validation \`M1–M10\` (deterministic, machine)
|
|
4403
|
+
|
|
4404
|
+
Run after every write; these are decidable from the file alone.
|
|
4405
|
+
|
|
4406
|
+
| ID | Check | Catches |
|
|
4407
|
+
|---|---|---|
|
|
4408
|
+
| **M1** | Referential integrity | a type/relation/type-in-relation is referenced but not defined |
|
|
4409
|
+
| **M2** | Taxonomy acyclicity | a cycle in the \`subClassOf\` graph |
|
|
4410
|
+
| **M3** | Rigidity inheritance | a child is **more rigid** than its parent (rigid must not subsume anti-rigid) |
|
|
4411
|
+
| **M4** | Identity presence | a **rigid** type carries no identity (own or inherited) |
|
|
4412
|
+
| **M5** | Dependency acyclicity | a cycle in the existence-dependency graph |
|
|
4413
|
+
| **M6** | Cardinality consistency | malformed or mutually contradictory cardinalities |
|
|
4414
|
+
| **M7** | Enum coverage | an enumerated value set is incomplete/inconsistent with its use |
|
|
4415
|
+
| **M8** | Axiom syntax | an axiom is not syntactically well-formed |
|
|
4416
|
+
| **M9** | Axiom reference check | an axiom references an undefined type/relation |
|
|
4417
|
+
| **M10** | Import/file error | an imported \`.ttl\` is missing or unparsable |
|
|
4418
|
+
|
|
4419
|
+
## 5. Judgement set B — semantic hints \`L1–L5\` (strict mode; machine emits, model judges)
|
|
4420
|
+
|
|
4421
|
+
These are **questions, not verdicts** — the engine prints them so an LLM can answer them.
|
|
4422
|
+
|
|
4423
|
+
| ID | Hint |
|
|
4424
|
+
|---|---|
|
|
4425
|
+
| **L1** | type has **no rigidity label** — should it be rigid or anti-rigid? |
|
|
4426
|
+
| **L2** | **missing constraints** — are temporal / state axioms absent? |
|
|
4427
|
+
| **L3** | **identity adequacy** — is the declared identity sufficient for uniqueness? |
|
|
4428
|
+
| **L4** | **type semantics** — are there missing distinctions between types? |
|
|
4429
|
+
| **L5** | **axiom coverage** — do axioms reference concepts that are not defined as types? |
|
|
4430
|
+
|
|
4431
|
+
## 6. Judgement set C — semantic review \`D1–D8\` (model, ideally a read-only subagent)
|
|
4432
|
+
|
|
4433
|
+
Structure can pass \`M*\` and still be wrong. \`D*\` is where an LLM reviews meaning.
|
|
4434
|
+
|
|
4435
|
+
| ID | Dimension | Asks |
|
|
4436
|
+
|---|---|---|
|
|
4437
|
+
| **D1** | Type semantics | are names/descriptions/boundaries clear and correct? split or merge needed? |
|
|
4438
|
+
| **D2** | Taxonomy quality | does every \`subClassOf\` pass the **is-a test**? missing/incorrect links? disjointness? sensible depth (3–7 levels typical)? |
|
|
4439
|
+
| **D3** | Rigidity audit | is every rigid/anti-rigid/semi-rigid assignment justified? is inheritance consistent? |
|
|
4440
|
+
| **D4** | Identity criteria | do identity keys guarantee uniqueness? natural vs surrogate? any identity resting on mutable properties? |
|
|
4441
|
+
| **D5** | Relation semantics | real-world interpretation? domain/range correct? property characteristics true? cardinalities physically possible? |
|
|
4442
|
+
| **D6** | Axiom completeness & correctness | sound? missing temporal / state / dependency / instance-level cardinality constraints? |
|
|
4443
|
+
| **D7** | Domain completeness | what real-world entities are **not** modelled? missing relations? lifecycle/state machines? edge cases? wide/deep enough? |
|
|
4444
|
+
| **D8** | OntoClean deep review | the six meta-properties, applied down the whole taxonomy |
|
|
4445
|
+
|
|
4446
|
+
**OntoClean's six meta-properties** (the vocabulary \`D8\` reason with):
|
|
4447
|
+
|
|
4448
|
+
| Meta-property | Notation | Question |
|
|
4449
|
+
|---|---|---|
|
|
4450
|
+
| Identity | \`+I\` / \`-I\` | what criterion distinguishes instances of this type? |
|
|
4451
|
+
| Unity | \`+U\` / \`~U\` / \`-U\` | can instances form a whole? any anti-unity type ("pile of sand")? |
|
|
4452
|
+
| Rigidity | \`+R\` / \`~R\` / \`-R\` | is the property essential to every instance, in every context? |
|
|
4453
|
+
| Dependence | \`+D\` / \`-D\` | does this type's existence necessarily imply another's? |
|
|
4454
|
+
| Sortal vs non-sortal | — | can an identity criterion exist at all? |
|
|
4455
|
+
| Backbone taxonomy | — | does the rigid-only backbone form a consistent tree? |
|
|
4456
|
+
|
|
4457
|
+
## 7. Judgement set D — runtime compliance \`V1–V4\` (declaration ↔ reality)
|
|
4458
|
+
|
|
4459
|
+
Ontology is not only a model of the world — it also **declares facts about the container itself**, so those
|
|
4460
|
+
declarations must be checked against the container's actual state.
|
|
4461
|
+
|
|
4462
|
+
| ID | Check |
|
|
4463
|
+
|---|---|
|
|
4464
|
+
| **V1** | declared skill directories exist |
|
|
4465
|
+
| **V2** | orphan directories (present on disk, absent from the model) |
|
|
4466
|
+
| **V3** | MSM registration consistency (declared ownership ↔ registry) |
|
|
4467
|
+
| **V4** | session health (duplicate goals · session count · stale sessions) |
|
|
4468
|
+
|
|
4469
|
+
## 8. The OEPE loop — Ontology → EAP → Prompt-Enhancement
|
|
4470
|
+
|
|
4471
|
+
The reusable audit cycle. **Do not spend human effort hand-reviewing prose** — let the ontology be the
|
|
4472
|
+
structural blueprint, let a subagent do semantic review in an isolated context, and let the human only
|
|
4473
|
+
confirm the direction of repair.
|
|
4474
|
+
|
|
4475
|
+
\`\`\`
|
|
4476
|
+
O ── Ontology
|
|
4477
|
+
│ ① write the domain .ttl: types + relations + axioms
|
|
4478
|
+
│ ② check --level strict → 0 errors
|
|
4479
|
+
│ ③ explain → natural-language summary (reasoning context for the next stage)
|
|
4480
|
+
│ ④ review --level onto-clean → structured review prompt (D7 + D8)
|
|
4481
|
+
│
|
|
4482
|
+
├── E ── EAP audit
|
|
4483
|
+
│ ⑤ take the ontology axioms as the TOP constraint; evaluate the target artifact against each
|
|
4484
|
+
│ ⑥ EAP scoring (E/R/S) + ambiguous-word scan
|
|
4485
|
+
│ ⑦ emit a compliance matrix: PASS / WEAK / VIOLATION
|
|
4486
|
+
│
|
|
4487
|
+
└── PE ── Prompt-Enhance
|
|
4488
|
+
⑧ VIOLATION → repair (P1)
|
|
4489
|
+
⑨ WEAK → strengthen (P2)
|
|
4490
|
+
⑩ PASS → keep
|
|
4491
|
+
⑪ re-run check → audit → until everything is PASS
|
|
4492
|
+
\`\`\`
|
|
4493
|
+
|
|
4494
|
+
**Severity classes** used across the review dimensions:
|
|
4495
|
+
|
|
4496
|
+
| Class | Meaning |
|
|
4497
|
+
|---|---|
|
|
4498
|
+
| **P0 Critical** | causes incorrect behaviour, data corruption, or violates a domain law |
|
|
4499
|
+
| **P1 High** | makes the ontology misleading, or unable to serve its stated purpose |
|
|
4500
|
+
| **P2 Medium** | reduces quality / clarity / reusability |
|
|
4501
|
+
| **P3 Low** | minor improvement or style suggestion |
|
|
4502
|
+
|
|
4503
|
+
**Typical artifacts**: \`<domain>-ontology.ttl\` (O) · \`onto-clean-review.md\` (O) · \`skill-audit-report.md\` (E).
|
|
4504
|
+
|
|
4505
|
+
## 9. Workflows
|
|
4506
|
+
|
|
4507
|
+
**New skill**
|
|
4508
|
+
\`\`\`
|
|
4509
|
+
① what type is this skill? which skills does it depend on? what are its domain entities?
|
|
4510
|
+
② if the domain is complex enough → build a domain ontology (types / relations / axioms)
|
|
4511
|
+
③ write SKILL.md so that its declared dependencies match the axioms
|
|
4512
|
+
④ structural check → 0 errors
|
|
4513
|
+
⑤ axiom compliance → no violation of existing axioms
|
|
4514
|
+
\`\`\`
|
|
4515
|
+
|
|
4516
|
+
**New concept / term**
|
|
4517
|
+
\`\`\`
|
|
4518
|
+
① is this a SUBTYPE of an existing type, or a NEW type?
|
|
4519
|
+
② new type → add a subClassOf to the container-level registry ontology
|
|
4520
|
+
③ subtype → add a subClassOf to the domain ontology
|
|
4521
|
+
④ does it need a new relation or axiom?
|
|
4522
|
+
⑤ structural check → 0 errors
|
|
4523
|
+
\`\`\`
|
|
4524
|
+
|
|
4525
|
+
**New MSM**
|
|
4526
|
+
\`\`\`
|
|
4527
|
+
① Mech (deterministic) or Semi-Mech (model in the loop)?
|
|
4528
|
+
② which ONE skill owns it?
|
|
4529
|
+
③ consistent with the container's BuiltinTool/MSM type in the architecture ontology?
|
|
4530
|
+
④ record it in that skill's ontology entry
|
|
4531
|
+
⑤ register it through the container's registry (never by editing the registry file directly)
|
|
4532
|
+
\`\`\`
|
|
4533
|
+
|
|
4534
|
+
## 10. Universal axioms (violating any of these is a defect, not a style choice)
|
|
4535
|
+
|
|
4536
|
+
| Axiom | Content | Consequence of violation |
|
|
4537
|
+
|---|---|---|
|
|
4538
|
+
| Unique name | two skills may not share a name | routing becomes ambiguous |
|
|
4539
|
+
| SKILL.md required | every skill has a SKILL.md | agents cannot locate the domain knowledge |
|
|
4540
|
+
| Dependency complete | using another skill's tool ⇒ declare the dependency | implicit coupling surfaces at runtime (H_op↑) |
|
|
4541
|
+
| MSM ownership | every MSM belongs to exactly one skill | the MSM cannot be indexed |
|
|
4542
|
+
| Dependency acyclic | \`skillDependsOn\` must not form a cycle | load order becomes undefined |
|
|
4543
|
+
|
|
4544
|
+
**Axiom discipline**: axioms are named (\`AX-*\`), individually citable, and each carries a rationale.
|
|
4545
|
+
Breaking an axiom is allowed only by stating the break explicitly and recording the reason.
|
|
4546
|
+
|
|
4547
|
+
## 11. Dispatching a review subagent
|
|
4548
|
+
|
|
4549
|
+
Both OEPE review stages run in an isolated context. Three rules make them work:
|
|
4550
|
+
|
|
4551
|
+
1. **Mandatory opening block** — the prompt must begin by requiring the subagent to load the ontology
|
|
4552
|
+
method (and EAP, for the audit stage). Without it the subagent does not know the standard it is applying,
|
|
4553
|
+
and its output is worthless.
|
|
4554
|
+
2. **Read-only** — the reviewer never edits files. Review and repair are separated: the reviewer reports,
|
|
4555
|
+
the human confirms direction, the agent repairs.
|
|
4556
|
+
3. **Structured output** — one line per finding: \`<ID> [<Severity>] <Finding> — <Evidence> — <Suggestion>\`,
|
|
4557
|
+
then a summary: top issues · health grade (A–F) · prioritized repair list. Findings are written to the
|
|
4558
|
+
session directory, never into the skill directory.
|
|
4559
|
+
|
|
4560
|
+
## 12. Anti-patterns
|
|
4561
|
+
|
|
4562
|
+
| Anti-pattern | Why it is wrong |
|
|
4563
|
+
|---|---|
|
|
4564
|
+
| modelling **instances** as **types** | the taxonomy inflates and stops carrying meaning |
|
|
4565
|
+
| an "is-a" relation that fails the **is-a test** in some context | structural checks pass, semantics rot |
|
|
4566
|
+
| a rigid type with **no identity** | nothing distinguishes its instances (M4) |
|
|
4567
|
+
| identity resting on a **mutable property** | the entity's identity changes as data changes |
|
|
4568
|
+
| a child that is **more rigid** than its parent | OntoClean violation (M3) |
|
|
4569
|
+
| putting **implementation detail** into the domain ontology | the model then tracks code, not the domain |
|
|
4570
|
+
| a second, competing source of truth for structure | E↓, and the drift is silent |
|
|
4571
|
+
| writing the model **after** the code | structure is reverse-engineered from accidents |
|
|
4572
|
+
|
|
4573
|
+
## 13. Relation to the other praxis frameworks
|
|
4574
|
+
|
|
4575
|
+
- **EAP** — how a piece of knowledge should be structured (static quality). Ontology is EAP applied to
|
|
4576
|
+
domain structure.
|
|
4577
|
+
- **CCE** — how structured knowledge keeps evolving without losing coherence (dynamic persistence).
|
|
4578
|
+
Ontology is one of CCE's \`ΔH_org\` operators.
|
|
4579
|
+
- **Neat** — the collaboration protocol for the *design conversation* that produces the model.
|
|
4580
|
+
`;
|
|
4581
|
+
//#endregion
|
|
4332
4582
|
//#region src/tools/praxis.ts
|
|
4333
4583
|
/**
|
|
4334
|
-
* praxis.ts — praxis(可实践理论注入工具,v1.30 合并 eap/neat/cce)
|
|
4584
|
+
* praxis.ts — praxis(可实践理论注入工具,v1.30 合并 eap/neat/cce;v1.51.5 增 ontology)
|
|
4335
4585
|
*
|
|
4336
|
-
* eap / neat / cce
|
|
4337
|
-
* 调用时把对应框架注入当前认知(指导输出质量 / 协作协议 /
|
|
4586
|
+
* eap / neat / cce / ontology 四个知识源合并为一个——它们都是「可实践理论」:
|
|
4587
|
+
* 调用时把对应框架注入当前认知(指导输出质量 / 协作协议 / 连续性工程 / 本体论工程)。
|
|
4338
4588
|
* 名字:praxis(理论与实践的统一——理论注入实践,实践反哺理论)。
|
|
4339
4589
|
* Metaphor 映射:Engineering Drawings(图纸 = 可实践理论的编码,第 3 条隐喻)。
|
|
4340
4590
|
*
|
|
4341
4591
|
* section 参数渐进披露:不传 = 返回精简目录;传 = 返回对应框架全文/章节。
|
|
4592
|
+
* 每个框架一个内容文件(单一真相源):eap.ts / neat.ts / cce.ts / ontology.ts。
|
|
4342
4593
|
*/
|
|
4343
4594
|
/** 知识源:与各原工具内容保持一致(单一真相源——eap/neat/cce 各自源文件已并入此处) */
|
|
4344
4595
|
/** 框架清单(无参调用时返回的精简目录) */
|
|
@@ -4346,6 +4597,7 @@ const PRAXIS_INDEX = `praxis — 可实践理论注入(认知框架,按需
|
|
|
4346
4597
|
选择框架:praxis eap(认知质量——E↑/R↓/S↑ 三变量 + 输出前自检)
|
|
4347
4598
|
praxis neat(Neat 协作协议——小步对齐/显式决策/文档驱动)
|
|
4348
4599
|
praxis cce(认知连续性工程——容器 5 行为约束 + H_op 操作熵)
|
|
4600
|
+
praxis ontology(本体论工程方法群——触发/编码/四组判据 M·L·D·V/OEPE 循环/公理/反模式)
|
|
4349
4601
|
无参返回本目录;详情以对应框架原文为准(单一真相源)。
|
|
4350
4602
|
`;
|
|
4351
4603
|
function renderText$5(value) {
|
|
@@ -4356,15 +4608,16 @@ function renderText$5(value) {
|
|
|
4356
4608
|
}
|
|
4357
4609
|
const praxisTool = defineTool({
|
|
4358
4610
|
name: "praxis",
|
|
4359
|
-
description: "Praxis — actionable theory injection (cognitive frameworks, loaded on demand): eap (cognitive quality: E↑ explicitness / R↓ reconstructability / S↑ stability + self-check checklist) / neat (Neat design collaboration protocol: small-step alignment, explicit decisions, document-driven) / cce (Cognitive Continuity Engineering: container identity/accessibility/evolution under bounded resources). No section returns the index; pass a section to load that framework.",
|
|
4611
|
+
description: "Praxis — actionable theory injection (cognitive frameworks, loaded on demand): eap (cognitive quality: E↑ explicitness / R↓ reconstructability / S↑ stability + self-check checklist) / neat (Neat design collaboration protocol: small-step alignment, explicit decisions, document-driven) / cce (Cognitive Continuity Engineering: container identity/accessibility/evolution under bounded resources) / ontology (ontology engineering method family: when to model, Turtle encoding, four judgement sets M1-M10 structural / L1-L5 semantic hints / D1-D8 semantic review incl. OntoClean / V1-V4 runtime compliance, the OEPE audit loop, workflows, universal axioms, anti-patterns). No section returns the index; pass a section to load that framework.",
|
|
4360
4612
|
parameters: { section: {
|
|
4361
4613
|
type: "string",
|
|
4362
4614
|
enum: [
|
|
4363
4615
|
"eap",
|
|
4364
4616
|
"neat",
|
|
4365
|
-
"cce"
|
|
4617
|
+
"cce",
|
|
4618
|
+
"ontology"
|
|
4366
4619
|
],
|
|
4367
|
-
description: "Framework to inject: eap / neat / cce. Omit for the praxis index."
|
|
4620
|
+
description: "Framework to inject: eap / neat / cce / ontology. Omit for the praxis index."
|
|
4368
4621
|
} },
|
|
4369
4622
|
output: {
|
|
4370
4623
|
schema: { type: "string" },
|
|
@@ -4374,6 +4627,7 @@ const praxisTool = defineTool({
|
|
|
4374
4627
|
if (args.section === "eap") return EAP_CONTENT;
|
|
4375
4628
|
if (args.section === "neat") return NEAT_CONTENT;
|
|
4376
4629
|
if (args.section === "cce") return CCE_CONTENT;
|
|
4630
|
+
if (args.section === "ontology") return ONTOLOGY_CONTENT;
|
|
4377
4631
|
return PRAXIS_INDEX;
|
|
4378
4632
|
}
|
|
4379
4633
|
});
|
|
@@ -8713,21 +8967,25 @@ function decideGuard(input) {
|
|
|
8713
8967
|
function resolveAgentCwd(exec) {
|
|
8714
8968
|
return exec.agent?.session?.header?.cwd ?? process.cwd();
|
|
8715
8969
|
}
|
|
8716
|
-
/**
|
|
8970
|
+
/**
|
|
8971
|
+
* 安全模式开启时从模型工具列表隐藏的工具 —— **基础表**(只隐藏 bash;write/edit 保留)。
|
|
8972
|
+
* 它**恒隐**、与 CCC 配置无关;CCC 声明的 `safeMode.hiddenTools` 是**附加**项(见下)。
|
|
8973
|
+
*/
|
|
8717
8974
|
const SAFE_MODE_DENY_TOOLS = ["bash"];
|
|
8718
|
-
/** agent key → restrict disposer(安全模式工具隐藏状态) */
|
|
8719
8975
|
const safeModeRestrictions = /* @__PURE__ */ new Map();
|
|
8720
8976
|
const restrictDiag = {
|
|
8721
8977
|
lastKey: null,
|
|
8722
8978
|
lastAttemptAt: null,
|
|
8723
8979
|
lastSuccess: null,
|
|
8724
8980
|
lastError: null,
|
|
8725
|
-
activeKeys: []
|
|
8981
|
+
activeKeys: [],
|
|
8982
|
+
denyByKey: {}
|
|
8726
8983
|
};
|
|
8727
8984
|
function getRestrictDiagnostics() {
|
|
8728
8985
|
return {
|
|
8729
8986
|
...restrictDiag,
|
|
8730
|
-
activeKeys: [...safeModeRestrictions.keys()]
|
|
8987
|
+
activeKeys: [...safeModeRestrictions.keys()],
|
|
8988
|
+
denyByKey: Object.fromEntries([...safeModeRestrictions].map(([k, v]) => [k, v.deny]))
|
|
8731
8989
|
};
|
|
8732
8990
|
}
|
|
8733
8991
|
/** 诊断落盘:AGENT_SESSIONS/.restrict-diag.json(文件通道,避免 HTTP 自锁) */
|
|
@@ -8742,35 +9000,85 @@ function writeRestrictDiag(root) {
|
|
|
8742
9000
|
} catch {}
|
|
8743
9001
|
}
|
|
8744
9002
|
/**
|
|
8745
|
-
* 同步安全模式工具隐藏:标记存在 → agent.ctx.tools.restrict deny
|
|
8746
|
-
*
|
|
9003
|
+
* 同步安全模式工具隐藏:标记存在 → `agent.ctx.tools.restrict deny` 隐藏
|
|
9004
|
+
* **基础表(bash)∪ CCC 声明的 `safeMode.hiddenTools`**;标记消失 → 全部解除。
|
|
9005
|
+
* pre-step 每步调用 ⇒ 开/关/**改声明**三种变化都实时生效(v1.51.4 起含"改声明")。
|
|
9006
|
+
*
|
|
9007
|
+
* 与 `readSafeModeHiddenTools` 的分工(R↓):本函数负责**形状与失败退化**,reader 只管取值。
|
|
9008
|
+
* 🔴 退化规则:DSH 契约规定 **未注册的工具名会让整次 restrict 失败**("unknown names … fail")
|
|
9009
|
+
* ⇒ 绝不能让 CCC 写错一个名字就丢掉 safe-mode 的核心隐藏(bash)。失败时退化为**只隐藏基础表**,
|
|
9010
|
+
* 并在日志响亮报错;退化态**按期望签名记账**,不会每步重试刷屏。
|
|
8747
9011
|
*/
|
|
8748
9012
|
function syncSafeModeRestriction(agent, root) {
|
|
8749
9013
|
const key = agent.session.id ?? "global";
|
|
8750
9014
|
const on = isSafeModeOn(root);
|
|
8751
9015
|
const existing = safeModeRestrictions.get(key);
|
|
8752
|
-
if (on
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
9016
|
+
if (!on) {
|
|
9017
|
+
if (existing !== void 0) {
|
|
9018
|
+
try {
|
|
9019
|
+
existing.dispose();
|
|
9020
|
+
} catch (e) {
|
|
9021
|
+
console.error(`[serenity-hooks] restrict 解除失败 (key=${key}):`, e.message);
|
|
9022
|
+
}
|
|
9023
|
+
safeModeRestrictions.delete(key);
|
|
9024
|
+
}
|
|
9025
|
+
writeRestrictDiag(root);
|
|
9026
|
+
return;
|
|
9027
|
+
}
|
|
9028
|
+
let declared = [];
|
|
9029
|
+
try {
|
|
9030
|
+
declared = readSafeModeHiddenTools(root);
|
|
9031
|
+
} catch (e) {
|
|
9032
|
+
console.error(`[serenity-hooks] safeMode.hiddenTools 判据读取失败 (key=${key}):`, e.message);
|
|
9033
|
+
}
|
|
9034
|
+
const deny = [.../* @__PURE__ */ new Set([...SAFE_MODE_DENY_TOOLS, ...declared])];
|
|
9035
|
+
const signature = deny.join(",");
|
|
9036
|
+
if (existing !== void 0 && existing.signature === signature) {
|
|
9037
|
+
writeRestrictDiag(root);
|
|
9038
|
+
return;
|
|
9039
|
+
}
|
|
9040
|
+
if (existing !== void 0) {
|
|
9041
|
+
try {
|
|
9042
|
+
existing.dispose();
|
|
9043
|
+
} catch (e) {
|
|
9044
|
+
console.error(`[serenity-hooks] restrict 重算前解除失败 (key=${key}):`, e.message);
|
|
9045
|
+
}
|
|
9046
|
+
safeModeRestrictions.delete(key);
|
|
9047
|
+
}
|
|
9048
|
+
let applied = deny;
|
|
9049
|
+
let dispose;
|
|
9050
|
+
try {
|
|
9051
|
+
dispose = agent.ctx.tools.restrict({ deny: [...deny] });
|
|
8759
9052
|
} catch (e) {
|
|
8760
9053
|
restrictDiag.lastKey = key;
|
|
8761
9054
|
restrictDiag.lastAttemptAt = isoLocal();
|
|
8762
9055
|
restrictDiag.lastSuccess = false;
|
|
8763
9056
|
restrictDiag.lastError = e.message;
|
|
8764
|
-
console.error(`[serenity-hooks] restrict
|
|
8765
|
-
|
|
8766
|
-
else if (!on && existing) {
|
|
9057
|
+
console.error(`[serenity-hooks] restrict 失败,已退化为基础表(多为 safeMode.hiddenTools 里有本 CCC **未注册**的工具名)(key=${key}):`, e.message);
|
|
9058
|
+
applied = [...SAFE_MODE_DENY_TOOLS];
|
|
8767
9059
|
try {
|
|
8768
|
-
|
|
8769
|
-
} catch (
|
|
8770
|
-
|
|
9060
|
+
dispose = agent.ctx.tools.restrict({ deny: applied });
|
|
9061
|
+
} catch (e2) {
|
|
9062
|
+
restrictDiag.lastError = `${e.message} / 退化亦失败: ${e2.message}`;
|
|
9063
|
+
console.error(`[serenity-hooks] restrict 退化失败(守卫仍兜底拦截)(key=${key}):`, e2.message);
|
|
9064
|
+
safeModeRestrictions.set(key, {
|
|
9065
|
+
signature,
|
|
9066
|
+
deny: [],
|
|
9067
|
+
dispose: () => {}
|
|
9068
|
+
});
|
|
9069
|
+
writeRestrictDiag(root);
|
|
9070
|
+
return;
|
|
8771
9071
|
}
|
|
8772
|
-
safeModeRestrictions.delete(key);
|
|
8773
9072
|
}
|
|
9073
|
+
restrictDiag.lastKey = key;
|
|
9074
|
+
restrictDiag.lastAttemptAt = isoLocal();
|
|
9075
|
+
restrictDiag.lastSuccess = true;
|
|
9076
|
+
restrictDiag.lastError = null;
|
|
9077
|
+
safeModeRestrictions.set(key, {
|
|
9078
|
+
signature,
|
|
9079
|
+
deny: applied,
|
|
9080
|
+
dispose
|
|
9081
|
+
});
|
|
8774
9082
|
writeRestrictDiag(root);
|
|
8775
9083
|
}
|
|
8776
9084
|
/** 条件可见的 IM 工具名(与 tools/im-bridge.ts 的注册名一致) */
|
|
@@ -10393,11 +10701,11 @@ function registerStatusApi(ctx, opts = {}) {
|
|
|
10393
10701
|
sendJson$4(res, 400, { error: chk.error });
|
|
10394
10702
|
return;
|
|
10395
10703
|
}
|
|
10396
|
-
const { readWeixinSettings } = await import("./weixin-route-
|
|
10704
|
+
const { readWeixinSettings } = await import("./weixin-route-BNyH5ghC.js").then((n) => n.u);
|
|
10397
10705
|
const { weixinBridgeStatus } = await Promise.resolve().then(() => weixin_bridge_exports);
|
|
10398
10706
|
const settings = readWeixinSettings(chk.root);
|
|
10399
10707
|
const bridge = weixinBridgeStatus().find((b) => b.ccc === chk.root);
|
|
10400
|
-
const { readWeixinCredential } = await import("./weixin-route-
|
|
10708
|
+
const { readWeixinCredential } = await import("./weixin-route-BNyH5ghC.js").then((n) => n.u);
|
|
10401
10709
|
const accounts = (settings.accounts ?? []).map((a) => ({
|
|
10402
10710
|
accountId: a.accountId,
|
|
10403
10711
|
name: a.name ?? void 0,
|
|
@@ -10429,7 +10737,7 @@ function registerStatusApi(ctx, opts = {}) {
|
|
|
10429
10737
|
const { fetchQRCode } = await import("./weixin-api-BrRcPiQs.js").then((n) => n.u);
|
|
10430
10738
|
const { randomUUID } = await import("node:crypto");
|
|
10431
10739
|
for (const [key, v] of weixinLogins) if (Date.now() - v.startedAt > WEIXIN_LOGIN_TTL_MS) weixinLogins.delete(key);
|
|
10432
|
-
const { readWeixinSettings } = await import("./weixin-route-
|
|
10740
|
+
const { readWeixinSettings } = await import("./weixin-route-BNyH5ghC.js").then((n) => n.u);
|
|
10433
10741
|
const qr = await fetchQRCode({ botType: readWeixinSettings(root).botType ?? void 0 });
|
|
10434
10742
|
const loginKey = randomUUID();
|
|
10435
10743
|
weixinLogins.set(loginKey, {
|
|
@@ -10450,7 +10758,7 @@ function registerStatusApi(ctx, opts = {}) {
|
|
|
10450
10758
|
sendJson$4(res, 400, { error: "missing accountId" });
|
|
10451
10759
|
return;
|
|
10452
10760
|
}
|
|
10453
|
-
const { removeWeixinAccount } = await import("./weixin-route-
|
|
10761
|
+
const { removeWeixinAccount } = await import("./weixin-route-BNyH5ghC.js").then((n) => n.u);
|
|
10454
10762
|
const { syncCccBridge } = await Promise.resolve().then(() => weixin_bridge_exports);
|
|
10455
10763
|
removeWeixinAccount(root, body.accountId);
|
|
10456
10764
|
syncCccBridge(ctx, root);
|
|
@@ -10463,8 +10771,8 @@ function registerStatusApi(ctx, opts = {}) {
|
|
|
10463
10771
|
sendJson$4(res, 400, { error: "invalid routes (expected [{user, role}, ...])" });
|
|
10464
10772
|
return;
|
|
10465
10773
|
}
|
|
10466
|
-
const { saveWeixinRoutes } = await import("./weixin-route-
|
|
10467
|
-
const { readSkiffRoles } = await import("./skiff-role-
|
|
10774
|
+
const { saveWeixinRoutes } = await import("./weixin-route-BNyH5ghC.js").then((n) => n.u);
|
|
10775
|
+
const { readSkiffRoles } = await import("./skiff-role-BSg6Qu9k.js").then((n) => n.u);
|
|
10468
10776
|
const roles = readSkiffRoles(root);
|
|
10469
10777
|
for (const r of routes) if (!roles.has(r.role)) {
|
|
10470
10778
|
sendJson$4(res, 400, { error: `unknown role: ${r.role} (not in ${root} skiff.roles)` });
|
|
@@ -10476,7 +10784,7 @@ function registerStatusApi(ctx, opts = {}) {
|
|
|
10476
10784
|
}
|
|
10477
10785
|
if (body.action === "set-enabled") {
|
|
10478
10786
|
const enabled = body.enabled === true;
|
|
10479
|
-
const { readWeixinSettings, setWeixinEnabled } = await import("./weixin-route-
|
|
10787
|
+
const { readWeixinSettings, setWeixinEnabled } = await import("./weixin-route-BNyH5ghC.js").then((n) => n.u);
|
|
10480
10788
|
const { syncCccBridge } = await Promise.resolve().then(() => weixin_bridge_exports);
|
|
10481
10789
|
const settings = readWeixinSettings(root);
|
|
10482
10790
|
if (enabled && (settings.accounts ?? []).length === 0) {
|
|
@@ -10520,7 +10828,7 @@ function registerStatusApi(ctx, opts = {}) {
|
|
|
10520
10828
|
return;
|
|
10521
10829
|
}
|
|
10522
10830
|
const { pollQRStatus } = await import("./weixin-api-BrRcPiQs.js").then((n) => n.u);
|
|
10523
|
-
const { readWeixinSettings } = await import("./weixin-route-
|
|
10831
|
+
const { readWeixinSettings } = await import("./weixin-route-BNyH5ghC.js").then((n) => n.u);
|
|
10524
10832
|
const settings = readWeixinSettings(login.root);
|
|
10525
10833
|
const status = await pollQRStatus({
|
|
10526
10834
|
baseUrl: void 0,
|
|
@@ -10535,7 +10843,7 @@ function registerStatusApi(ctx, opts = {}) {
|
|
|
10535
10843
|
});
|
|
10536
10844
|
return;
|
|
10537
10845
|
}
|
|
10538
|
-
const { upsertWeixinAccount, writeWeixinCredential, nextWeixinAccountId } = await import("./weixin-route-
|
|
10846
|
+
const { upsertWeixinAccount, writeWeixinCredential, nextWeixinAccountId } = await import("./weixin-route-BNyH5ghC.js").then((n) => n.u);
|
|
10539
10847
|
const { syncCccBridge } = await Promise.resolve().then(() => weixin_bridge_exports);
|
|
10540
10848
|
const accountId = nextWeixinAccountId(settings);
|
|
10541
10849
|
upsertWeixinAccount(login.root, {
|
|
@@ -16688,7 +16996,7 @@ function manualOutputFallbackNeeded(input) {
|
|
|
16688
16996
|
*/
|
|
16689
16997
|
async function resolveCccRootByAlias(ctx, alias) {
|
|
16690
16998
|
try {
|
|
16691
|
-
const { listCccs } = await import("./ccc-roots-
|
|
16999
|
+
const { listCccs } = await import("./ccc-roots-Bo0HKLlM.js").then((n) => n.a);
|
|
16692
17000
|
const entries = await listCccs(ctx);
|
|
16693
17001
|
const byName = entries.find((e) => e.name === alias);
|
|
16694
17002
|
if (byName) return byName.root;
|
|
@@ -17187,7 +17495,7 @@ function syncHumanChannel(ctx) {
|
|
|
17187
17495
|
(async () => {
|
|
17188
17496
|
try {
|
|
17189
17497
|
stopMachineLoops();
|
|
17190
|
-
const { listCccs } = await import("./ccc-roots-
|
|
17498
|
+
const { listCccs } = await import("./ccc-roots-Bo0HKLlM.js").then((n) => n.a);
|
|
17191
17499
|
for (const entry of await listCccs(ctx)) syncCccBridge(ctx, entry.root);
|
|
17192
17500
|
} catch {}
|
|
17193
17501
|
})();
|
|
@@ -17423,7 +17731,7 @@ function matchCcc(input, candidates) {
|
|
|
17423
17731
|
}
|
|
17424
17732
|
/** 组装候选列表(`ccc-roots.listCccs` 投影 + `.serenity` 名;动态 import 保持本模块静态依赖轻量) */
|
|
17425
17733
|
async function collectCandidates(ctx) {
|
|
17426
|
-
const { listCccs } = await import("./ccc-roots-
|
|
17734
|
+
const { listCccs } = await import("./ccc-roots-Bo0HKLlM.js").then((n) => n.a);
|
|
17427
17735
|
const entries = await listCccs(ctx, { defaultRoot: process.cwd() });
|
|
17428
17736
|
const seen = /* @__PURE__ */ new Set();
|
|
17429
17737
|
const out = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as cccRootForCwd } from "./ccc-roots-
|
|
1
|
+
import { r as cccRootForCwd } from "./ccc-roots-Bo0HKLlM.js";
|
|
2
2
|
import { basename, dirname, join } from "node:path";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
4
4
|
//#region src/time.ts
|
package/lib/seams/guards.d.ts
CHANGED
|
@@ -39,11 +39,19 @@ interface RestrictDiagnostics {
|
|
|
39
39
|
lastSuccess: boolean | null;
|
|
40
40
|
lastError: string | null;
|
|
41
41
|
activeKeys: string[];
|
|
42
|
+
/** v1.51.4:每个 key **实际生效**的 deny 清单(排查"某工具为什么/为什么没被隐藏") */
|
|
43
|
+
denyByKey: Record<string, string[]>;
|
|
42
44
|
}
|
|
43
45
|
export declare function getRestrictDiagnostics(): RestrictDiagnostics;
|
|
44
46
|
/**
|
|
45
|
-
* 同步安全模式工具隐藏:标记存在 → agent.ctx.tools.restrict deny
|
|
46
|
-
*
|
|
47
|
+
* 同步安全模式工具隐藏:标记存在 → `agent.ctx.tools.restrict deny` 隐藏
|
|
48
|
+
* **基础表(bash)∪ CCC 声明的 `safeMode.hiddenTools`**;标记消失 → 全部解除。
|
|
49
|
+
* pre-step 每步调用 ⇒ 开/关/**改声明**三种变化都实时生效(v1.51.4 起含"改声明")。
|
|
50
|
+
*
|
|
51
|
+
* 与 `readSafeModeHiddenTools` 的分工(R↓):本函数负责**形状与失败退化**,reader 只管取值。
|
|
52
|
+
* 🔴 退化规则:DSH 契约规定 **未注册的工具名会让整次 restrict 失败**("unknown names … fail")
|
|
53
|
+
* ⇒ 绝不能让 CCC 写错一个名字就丢掉 safe-mode 的核心隐藏(bash)。失败时退化为**只隐藏基础表**,
|
|
54
|
+
* 并在日志响亮报错;退化态**按期望签名记账**,不会每步重试刷屏。
|
|
47
55
|
*/
|
|
48
56
|
export declare function syncSafeModeRestriction(agent: Agent, root: string): void;
|
|
49
57
|
/** im-bridge 隐藏诊断(排查"工具为什么不在清单里") */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import {
|
|
2
|
+
import { _ as resolveInside, g as readUtf8, s as loadSerenityConfig, t as DEFAULT_SERENITY_CONFIG_PATHS } from "./ccc-DXky9UZu.js";
|
|
3
3
|
import { existsSync, statSync } from "node:fs";
|
|
4
4
|
//#region src/skiff-role.ts
|
|
5
5
|
/**
|
package/lib/status.d.ts
CHANGED
|
@@ -56,6 +56,8 @@ interface SerenityStatus {
|
|
|
56
56
|
lastSuccess: boolean | null;
|
|
57
57
|
lastError: string | null;
|
|
58
58
|
activeKeys: string[];
|
|
59
|
+
/** v1.51.4:每个 key **实际生效**的 deny 清单(含 safeMode.hiddenTools 的并集) */
|
|
60
|
+
denyByKey: Record<string, string[]>;
|
|
59
61
|
};
|
|
60
62
|
}
|
|
61
63
|
export declare function getStatus(cwd: string, configPaths?: string[]): SerenityStatus;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ontology.ts — Ontology Engineering 内容源(本体论工程方法群;v1.51.5 并入 praxis 第四段)
|
|
3
|
+
*
|
|
4
|
+
* 内嵌方法内容(自包含,不依赖已安装技能):把「做本体论工程」的完整方法群
|
|
5
|
+
* (触发 → 编码 → 四组判据 → OEPE 循环 → 工作流 → 公理 → 反模式)压成一份可即时注入的手册。
|
|
6
|
+
*
|
|
7
|
+
* 🔴 **本文件是 ACC 层**(D23:机制与措辞归 ACC、数据与纪律归 CCC):
|
|
8
|
+
* · 只写**通用方法**,不出现任何具体 CCC 的名字,也不带任何领域模型;
|
|
9
|
+
* · 判据群(M/L/D/V)是方法的**标准编号**(与参考实现同源),容器不必有同名引擎也能用;
|
|
10
|
+
* · **模型语料(.ttl)与具体公理内容属 CCC**,不在本文件。
|
|
11
|
+
*/
|
|
12
|
+
export declare const ONTOLOGY_CONTENT = "# Ontology Engineering \u2014 Method Family (\u672C\u4F53\u8BBA\u5DE5\u7A0B\u65B9\u6CD5\u7FA4)\n\n> **Any creative action \u2014 a new concept, a new term, a new skill, a new MSM, a new architectural layer \u2014\n> is preceded by explicitly encoding WHAT EXISTS, HOW THINGS RELATE, and WHAT IS CONSTRAINED.**\n>\n> Without it: idea \u2192 implementation (all \u0394H_in becomes H_op).\n> With it: idea \u2192 structure \u2192 implementation (structure absorbs part of \u0394H_in).\n\n## 1. When to invoke\n\n- introducing a new concept, term, or vocabulary\n- creating a skill, or changing an existing skill's scope/dependencies\n- creating an MSM (Mech or Semi-Mech)\n- introducing a new architectural layer or a cross-domain concept\n- any moment of \"what IS this thing here, and how does it relate to everything else?\"\n\n## 2. Core cognition\n\n**Ontology = before acting, make explicit what exists, how it relates, and what is constrained.**\n\nOntology is one of CCE's `\u0394H_org` operators: it records the *structure* of new content at the moment the\ncontent is produced, so that future agents do not have to reverse-engineer structure out of prose.\nIt is EAP applied at the layer of domain structure:\n\n| EAP demand | How ontology satisfies it |\n|---|---|\n| E\u2191 Explicitness | types / relations / axioms are stated, not implied |\n| R\u2193 Reconstructability | a new agent reads structure directly instead of inferring it |\n| S\u2191 Stability | the `.ttl` file is the single structural source of truth |\n\n**Consequence**: in a container, *every act of creation adds an entity to a domain* \u2014 so updating the\nontology is part of the creative act, not an extra chore.\n\n## 3. Encoding \u2014 Turtle (`.ttl`)\n\nAll models use W3C Turtle. **Why Turtle**: LLMs already carry RDF/OWL/Turtle in their training data, so the\nnotation costs ~zero context to explain.\n\n- **Standard namespaces**: `rdf:`, `rdfs:`, `owl:`, `xsd:`\n- **Container-local namespace**: `sr:` \u2014 a container-chosen URI used for `rigidity`, `identity`,\n `unity`, `dependence`, `cardinality`, `axiom`, `dependsOn`, \u2026 (the container fixes the URI; the\n method does not)\n\n**Modelling vocabulary**: *Type* \u00B7 *Relation* (with domain/range) \u00B7 *Axiom* (a named constraint), plus\n**meta-properties** attached to types: rigidity (`+R` rigid / `~R` semi-rigid / `-R` anti-rigid),\nidentity, unity, dependence.\n\n## 4. Judgement set A \u2014 structural validation `M1\u2013M10` (deterministic, machine)\n\nRun after every write; these are decidable from the file alone.\n\n| ID | Check | Catches |\n|---|---|---|\n| **M1** | Referential integrity | a type/relation/type-in-relation is referenced but not defined |\n| **M2** | Taxonomy acyclicity | a cycle in the `subClassOf` graph |\n| **M3** | Rigidity inheritance | a child is **more rigid** than its parent (rigid must not subsume anti-rigid) |\n| **M4** | Identity presence | a **rigid** type carries no identity (own or inherited) |\n| **M5** | Dependency acyclicity | a cycle in the existence-dependency graph |\n| **M6** | Cardinality consistency | malformed or mutually contradictory cardinalities |\n| **M7** | Enum coverage | an enumerated value set is incomplete/inconsistent with its use |\n| **M8** | Axiom syntax | an axiom is not syntactically well-formed |\n| **M9** | Axiom reference check | an axiom references an undefined type/relation |\n| **M10** | Import/file error | an imported `.ttl` is missing or unparsable |\n\n## 5. Judgement set B \u2014 semantic hints `L1\u2013L5` (strict mode; machine emits, model judges)\n\nThese are **questions, not verdicts** \u2014 the engine prints them so an LLM can answer them.\n\n| ID | Hint |\n|---|---|\n| **L1** | type has **no rigidity label** \u2014 should it be rigid or anti-rigid? |\n| **L2** | **missing constraints** \u2014 are temporal / state axioms absent? |\n| **L3** | **identity adequacy** \u2014 is the declared identity sufficient for uniqueness? |\n| **L4** | **type semantics** \u2014 are there missing distinctions between types? |\n| **L5** | **axiom coverage** \u2014 do axioms reference concepts that are not defined as types? |\n\n## 6. Judgement set C \u2014 semantic review `D1\u2013D8` (model, ideally a read-only subagent)\n\nStructure can pass `M*` and still be wrong. `D*` is where an LLM reviews meaning.\n\n| ID | Dimension | Asks |\n|---|---|---|\n| **D1** | Type semantics | are names/descriptions/boundaries clear and correct? split or merge needed? |\n| **D2** | Taxonomy quality | does every `subClassOf` pass the **is-a test**? missing/incorrect links? disjointness? sensible depth (3\u20137 levels typical)? |\n| **D3** | Rigidity audit | is every rigid/anti-rigid/semi-rigid assignment justified? is inheritance consistent? |\n| **D4** | Identity criteria | do identity keys guarantee uniqueness? natural vs surrogate? any identity resting on mutable properties? |\n| **D5** | Relation semantics | real-world interpretation? domain/range correct? property characteristics true? cardinalities physically possible? |\n| **D6** | Axiom completeness & correctness | sound? missing temporal / state / dependency / instance-level cardinality constraints? |\n| **D7** | Domain completeness | what real-world entities are **not** modelled? missing relations? lifecycle/state machines? edge cases? wide/deep enough? |\n| **D8** | OntoClean deep review | the six meta-properties, applied down the whole taxonomy |\n\n**OntoClean's six meta-properties** (the vocabulary `D8` reason with):\n\n| Meta-property | Notation | Question |\n|---|---|---|\n| Identity | `+I` / `-I` | what criterion distinguishes instances of this type? |\n| Unity | `+U` / `~U` / `-U` | can instances form a whole? any anti-unity type (\"pile of sand\")? |\n| Rigidity | `+R` / `~R` / `-R` | is the property essential to every instance, in every context? |\n| Dependence | `+D` / `-D` | does this type's existence necessarily imply another's? |\n| Sortal vs non-sortal | \u2014 | can an identity criterion exist at all? |\n| Backbone taxonomy | \u2014 | does the rigid-only backbone form a consistent tree? |\n\n## 7. Judgement set D \u2014 runtime compliance `V1\u2013V4` (declaration \u2194 reality)\n\nOntology is not only a model of the world \u2014 it also **declares facts about the container itself**, so those\ndeclarations must be checked against the container's actual state.\n\n| ID | Check |\n|---|---|\n| **V1** | declared skill directories exist |\n| **V2** | orphan directories (present on disk, absent from the model) |\n| **V3** | MSM registration consistency (declared ownership \u2194 registry) |\n| **V4** | session health (duplicate goals \u00B7 session count \u00B7 stale sessions) |\n\n## 8. The OEPE loop \u2014 Ontology \u2192 EAP \u2192 Prompt-Enhancement\n\nThe reusable audit cycle. **Do not spend human effort hand-reviewing prose** \u2014 let the ontology be the\nstructural blueprint, let a subagent do semantic review in an isolated context, and let the human only\nconfirm the direction of repair.\n\n```\nO \u2500\u2500 Ontology\n\u2502 \u2460 write the domain .ttl: types + relations + axioms\n\u2502 \u2461 check --level strict \u2192 0 errors\n\u2502 \u2462 explain \u2192 natural-language summary (reasoning context for the next stage)\n\u2502 \u2463 review --level onto-clean \u2192 structured review prompt (D7 + D8)\n\u2502\n\u251C\u2500\u2500 E \u2500\u2500 EAP audit\n\u2502 \u2464 take the ontology axioms as the TOP constraint; evaluate the target artifact against each\n\u2502 \u2465 EAP scoring (E/R/S) + ambiguous-word scan\n\u2502 \u2466 emit a compliance matrix: PASS / WEAK / VIOLATION\n\u2502\n\u2514\u2500\u2500 PE \u2500\u2500 Prompt-Enhance\n \u2467 VIOLATION \u2192 repair (P1)\n \u2468 WEAK \u2192 strengthen (P2)\n \u2469 PASS \u2192 keep\n \u246A re-run check \u2192 audit \u2192 until everything is PASS\n```\n\n**Severity classes** used across the review dimensions:\n\n| Class | Meaning |\n|---|---|\n| **P0 Critical** | causes incorrect behaviour, data corruption, or violates a domain law |\n| **P1 High** | makes the ontology misleading, or unable to serve its stated purpose |\n| **P2 Medium** | reduces quality / clarity / reusability |\n| **P3 Low** | minor improvement or style suggestion |\n\n**Typical artifacts**: `<domain>-ontology.ttl` (O) \u00B7 `onto-clean-review.md` (O) \u00B7 `skill-audit-report.md` (E).\n\n## 9. Workflows\n\n**New skill**\n```\n\u2460 what type is this skill? which skills does it depend on? what are its domain entities?\n\u2461 if the domain is complex enough \u2192 build a domain ontology (types / relations / axioms)\n\u2462 write SKILL.md so that its declared dependencies match the axioms\n\u2463 structural check \u2192 0 errors\n\u2464 axiom compliance \u2192 no violation of existing axioms\n```\n\n**New concept / term**\n```\n\u2460 is this a SUBTYPE of an existing type, or a NEW type?\n\u2461 new type \u2192 add a subClassOf to the container-level registry ontology\n\u2462 subtype \u2192 add a subClassOf to the domain ontology\n\u2463 does it need a new relation or axiom?\n\u2464 structural check \u2192 0 errors\n```\n\n**New MSM**\n```\n\u2460 Mech (deterministic) or Semi-Mech (model in the loop)?\n\u2461 which ONE skill owns it?\n\u2462 consistent with the container's BuiltinTool/MSM type in the architecture ontology?\n\u2463 record it in that skill's ontology entry\n\u2464 register it through the container's registry (never by editing the registry file directly)\n```\n\n## 10. Universal axioms (violating any of these is a defect, not a style choice)\n\n| Axiom | Content | Consequence of violation |\n|---|---|---|\n| Unique name | two skills may not share a name | routing becomes ambiguous |\n| SKILL.md required | every skill has a SKILL.md | agents cannot locate the domain knowledge |\n| Dependency complete | using another skill's tool \u21D2 declare the dependency | implicit coupling surfaces at runtime (H_op\u2191) |\n| MSM ownership | every MSM belongs to exactly one skill | the MSM cannot be indexed |\n| Dependency acyclic | `skillDependsOn` must not form a cycle | load order becomes undefined |\n\n**Axiom discipline**: axioms are named (`AX-*`), individually citable, and each carries a rationale.\nBreaking an axiom is allowed only by stating the break explicitly and recording the reason.\n\n## 11. Dispatching a review subagent\n\nBoth OEPE review stages run in an isolated context. Three rules make them work:\n\n1. **Mandatory opening block** \u2014 the prompt must begin by requiring the subagent to load the ontology\n method (and EAP, for the audit stage). Without it the subagent does not know the standard it is applying,\n and its output is worthless.\n2. **Read-only** \u2014 the reviewer never edits files. Review and repair are separated: the reviewer reports,\n the human confirms direction, the agent repairs.\n3. **Structured output** \u2014 one line per finding: `<ID> [<Severity>] <Finding> \u2014 <Evidence> \u2014 <Suggestion>`,\n then a summary: top issues \u00B7 health grade (A\u2013F) \u00B7 prioritized repair list. Findings are written to the\n session directory, never into the skill directory.\n\n## 12. Anti-patterns\n\n| Anti-pattern | Why it is wrong |\n|---|---|\n| modelling **instances** as **types** | the taxonomy inflates and stops carrying meaning |\n| an \"is-a\" relation that fails the **is-a test** in some context | structural checks pass, semantics rot |\n| a rigid type with **no identity** | nothing distinguishes its instances (M4) |\n| identity resting on a **mutable property** | the entity's identity changes as data changes |\n| a child that is **more rigid** than its parent | OntoClean violation (M3) |\n| putting **implementation detail** into the domain ontology | the model then tracks code, not the domain |\n| a second, competing source of truth for structure | E\u2193, and the drift is silent |\n| writing the model **after** the code | structure is reverse-engineered from accidents |\n\n## 13. Relation to the other praxis frameworks\n\n- **EAP** \u2014 how a piece of knowledge should be structured (static quality). Ontology is EAP applied to\n domain structure.\n- **CCE** \u2014 how structured knowledge keeps evolving without losing coherence (dynamic persistence).\n Ontology is one of CCE's `\u0394H_org` operators.\n- **Neat** \u2014 the collaboration protocol for the *design conversation* that produces the model.\n";
|
package/lib/tools/praxis.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* praxis.ts — praxis(可实践理论注入工具,v1.30 合并 eap/neat/cce)
|
|
2
|
+
* praxis.ts — praxis(可实践理论注入工具,v1.30 合并 eap/neat/cce;v1.51.5 增 ontology)
|
|
3
3
|
*
|
|
4
|
-
* eap / neat / cce
|
|
5
|
-
* 调用时把对应框架注入当前认知(指导输出质量 / 协作协议 /
|
|
4
|
+
* eap / neat / cce / ontology 四个知识源合并为一个——它们都是「可实践理论」:
|
|
5
|
+
* 调用时把对应框架注入当前认知(指导输出质量 / 协作协议 / 连续性工程 / 本体论工程)。
|
|
6
6
|
* 名字:praxis(理论与实践的统一——理论注入实践,实践反哺理论)。
|
|
7
7
|
* Metaphor 映射:Engineering Drawings(图纸 = 可实践理论的编码,第 3 条隐喻)。
|
|
8
8
|
*
|
|
9
9
|
* section 参数渐进披露:不传 = 返回精简目录;传 = 返回对应框架全文/章节。
|
|
10
|
+
* 每个框架一个内容文件(单一真相源):eap.ts / neat.ts / cce.ts / ontology.ts。
|
|
10
11
|
*/
|
|
11
12
|
/** 框架清单(无参调用时返回的精简目录) */
|
|
12
|
-
export declare const PRAXIS_INDEX = "praxis \u2014 \u53EF\u5B9E\u8DF5\u7406\u8BBA\u6CE8\u5165\uFF08\u8BA4\u77E5\u6846\u67B6\uFF0C\u6309\u9700\u52A0\u8F7D\uFF09\n\u9009\u62E9\u6846\u67B6\uFF1Apraxis eap\uFF08\u8BA4\u77E5\u8D28\u91CF\u2014\u2014E\u2191/R\u2193/S\u2191 \u4E09\u53D8\u91CF + \u8F93\u51FA\u524D\u81EA\u68C0\uFF09\n praxis neat\uFF08Neat \u534F\u4F5C\u534F\u8BAE\u2014\u2014\u5C0F\u6B65\u5BF9\u9F50/\u663E\u5F0F\u51B3\u7B56/\u6587\u6863\u9A71\u52A8\uFF09\n praxis cce\uFF08\u8BA4\u77E5\u8FDE\u7EED\u6027\u5DE5\u7A0B\u2014\u2014\u5BB9\u5668 5 \u884C\u4E3A\u7EA6\u675F + H_op \u64CD\u4F5C\u71B5\uFF09\n\u65E0\u53C2\u8FD4\u56DE\u672C\u76EE\u5F55\uFF1B\u8BE6\u60C5\u4EE5\u5BF9\u5E94\u6846\u67B6\u539F\u6587\u4E3A\u51C6\uFF08\u5355\u4E00\u771F\u76F8\u6E90\uFF09\u3002\n";
|
|
13
|
+
export declare const PRAXIS_INDEX = "praxis \u2014 \u53EF\u5B9E\u8DF5\u7406\u8BBA\u6CE8\u5165\uFF08\u8BA4\u77E5\u6846\u67B6\uFF0C\u6309\u9700\u52A0\u8F7D\uFF09\n\u9009\u62E9\u6846\u67B6\uFF1Apraxis eap\uFF08\u8BA4\u77E5\u8D28\u91CF\u2014\u2014E\u2191/R\u2193/S\u2191 \u4E09\u53D8\u91CF + \u8F93\u51FA\u524D\u81EA\u68C0\uFF09\n praxis neat\uFF08Neat \u534F\u4F5C\u534F\u8BAE\u2014\u2014\u5C0F\u6B65\u5BF9\u9F50/\u663E\u5F0F\u51B3\u7B56/\u6587\u6863\u9A71\u52A8\uFF09\n praxis cce\uFF08\u8BA4\u77E5\u8FDE\u7EED\u6027\u5DE5\u7A0B\u2014\u2014\u5BB9\u5668 5 \u884C\u4E3A\u7EA6\u675F + H_op \u64CD\u4F5C\u71B5\uFF09\n praxis ontology\uFF08\u672C\u4F53\u8BBA\u5DE5\u7A0B\u65B9\u6CD5\u7FA4\u2014\u2014\u89E6\u53D1/\u7F16\u7801/\u56DB\u7EC4\u5224\u636E M\u00B7L\u00B7D\u00B7V/OEPE \u5FAA\u73AF/\u516C\u7406/\u53CD\u6A21\u5F0F\uFF09\n\u65E0\u53C2\u8FD4\u56DE\u672C\u76EE\u5F55\uFF1B\u8BE6\u60C5\u4EE5\u5BF9\u5E94\u6846\u67B6\u539F\u6587\u4E3A\u51C6\uFF08\u5355\u4E00\u771F\u76F8\u6E90\uFF09\u3002\n";
|
|
13
14
|
export declare const praxisTool: import("@deepseek-ai/dsh-tools").ToolDefinition;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { s as loadSerenityConfig, t as DEFAULT_SERENITY_CONFIG_PATHS } from "./ccc-
|
|
2
|
+
import { s as loadSerenityConfig, t as DEFAULT_SERENITY_CONFIG_PATHS } from "./ccc-DXky9UZu.js";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { createHash } from "node:crypto";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.51.
|
|
3
|
+
"version": "1.51.5",
|
|
4
4
|
"description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:12 个工具(container_fs/container_trajectory/dashboard/container_git/msm/praxis/handyman/localstore/container_admin/im-bridge/acc-diag/diagram)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 工作日志与原地重建 + 网页登录入口/微信桥/子角色/对外问答页/trajectory 唤醒注册表。适配 DSH 0.1.7-rc.1。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|