@shgroup/dsh-serenity-hooks 1.70.0 → 1.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -19
- package/dsh.plugin.json +2 -2
- package/lib/{ccc-C33QWoWZ.js → ccc-Dkoa2oW3.js} +16 -2
- package/lib/{ccc-roots-RzasspMr.js → ccc-roots-jZYR2GVE.js} +16 -10
- package/lib/client.js +2 -2
- package/lib/{gateway-auth.d.ts → gateway/auth.d.ts} +3 -3
- package/lib/{gateway-dsh-auth.d.ts → gateway/dsh-auth.d.ts} +1 -1
- package/lib/{gateway-proxy.d.ts → gateway/proxy.d.ts} +3 -3
- package/lib/{gateway.d.ts → gateway/server.d.ts} +5 -5
- package/lib/{totp.d.ts → gateway/totp.d.ts} +1 -1
- package/lib/{output-guard.d.ts → guard/filter.d.ts} +2 -2
- package/lib/{output-guard-seam.d.ts → guard/seam.d.ts} +2 -2
- package/lib/{weixin-api-BrRcPiQs.js → ilink-DEpmE3yi.js} +6 -6
- package/lib/im/accounts.d.ts +105 -0
- package/lib/{weixin-bridge.d.ts → im/bridge.d.ts} +16 -9
- package/lib/{im-bridge.d.ts → im/channels.d.ts} +3 -3
- package/lib/{weixin-send-endpoint.d.ts → im/endpoint.d.ts} +2 -2
- package/lib/{weixin-output-guard.d.ts → im/guard.d.ts} +1 -1
- package/lib/{weixin-hook.d.ts → im/hook.d.ts} +1 -1
- package/lib/{weixin-api.d.ts → im/ilink.d.ts} +3 -3
- package/lib/{human-channel.d.ts → im/inbound.d.ts} +4 -4
- package/lib/{weixin-route.d.ts → im/route.d.ts} +52 -11
- package/lib/{weixin-send-api.d.ts → im/send.d.ts} +3 -3
- package/lib/im/weixin-account.d.ts +45 -0
- package/lib/{im-weixin.d.ts → im/weixin-channel.d.ts} +2 -2
- package/lib/index.js +1008 -815
- package/lib/invariant.js +2 -2
- package/lib/{ccc-roots.d.ts → kernel/ccc-roots.d.ts} +10 -10
- package/lib/{ccc.d.ts → kernel/ccc.d.ts} +114 -44
- package/lib/{config-ops.d.ts → kernel/config.d.ts} +2 -2
- package/lib/kernel/constants.d.ts +20 -0
- package/lib/{invariant.d.ts → kernel/invariant.d.ts} +1 -1
- package/lib/{json.d.ts → kernel/json.d.ts} +1 -1
- package/lib/{message-source.d.ts → kernel/message-source.d.ts} +1 -1
- package/lib/{ports.d.ts → kernel/ports.d.ts} +1 -1
- package/lib/{time.d.ts → kernel/time.d.ts} +1 -1
- package/lib/message-source-kVoNK0C5.js +432 -0
- package/lib/{deepseek-vision-patch.d.ts → patches/deepseek-vision.d.ts} +3 -3
- package/lib/{opencode-provider.d.ts → patches/opencode-provider.d.ts} +1 -1
- package/lib/{web-fetch-provider.d.ts → patches/web-fetch.d.ts} +1 -1
- package/lib/{message-source-DhA1dVBi.js → profile-DyMJ_bfr.js} +277 -463
- package/lib/role/skiff/config.d.ts +79 -0
- package/lib/role/skiff/core.d.ts +155 -0
- package/lib/{skiff-debug.d.ts → role/skiff/debug.d.ts} +4 -4
- package/lib/role/skiff/profile.d.ts +115 -0
- package/lib/role/skiff/registry.d.ts +41 -0
- package/lib/{cheap-worker-ops.d.ts → role/worker/core.d.ts} +1 -1
- package/lib/{agent-idle.d.ts → role/worker/idle.d.ts} +2 -2
- package/lib/{cheap-worker-preset-inherit.d.ts → role/worker/preset.d.ts} +2 -2
- package/lib/{weixin-route-D_DvgPqy.js → route-f7JlinIt.js} +132 -47
- package/lib/seams/context.d.ts +3 -3
- package/lib/seams/guards.d.ts +18 -12
- package/lib/seams/keeper.d.ts +1 -1
- package/lib/seams/system-prompt.d.ts +3 -1
- package/lib/settings-lt1i3OZv.js +403 -0
- package/lib/{skills-discovery.d.ts → skills/discovery.d.ts} +1 -1
- package/lib/skills/resource-index.d.ts +2 -2
- package/lib/{face-host.d.ts → surface/faces.d.ts} +4 -4
- package/lib/{api.d.ts → surface/http.d.ts} +2 -2
- package/lib/{container-status.d.ts → surface/observation.d.ts} +16 -16
- package/lib/{settings-section.d.ts → surface/settings.d.ts} +1 -1
- package/lib/{status.d.ts → surface/status.d.ts} +2 -2
- package/lib/{usage-stats.d.ts → surface/usage.d.ts} +4 -4
- package/lib/{voyage-page.d.ts → surface/voyage/page.d.ts} +2 -2
- package/lib/{voyage-vocab.d.ts → surface/voyage/vocab.d.ts} +1 -1
- package/lib/tools/cognitive-trajectory.d.ts +2 -2
- package/lib/tools/{acc-diag.d.ts → diag/index.d.ts} +2 -2
- package/lib/{diag-ops.d.ts → tools/diag/service.d.ts} +7 -7
- package/lib/tools/eap.d.ts +1 -1
- package/lib/tools/fs/index.d.ts +7 -0
- package/lib/{fs-ops.d.ts → tools/fs/service.d.ts} +2 -2
- package/lib/tools/git/index.d.ts +4 -0
- package/lib/{git-ops.d.ts → tools/git/service.d.ts} +2 -2
- package/lib/tools/im-bridge.d.ts +2 -2
- package/lib/tools/{kit.d.ts → kit/index.d.ts} +1 -1
- package/lib/{kit-ops.d.ts → tools/kit/service.d.ts} +6 -6
- package/lib/tools/{localstore.d.ts → localstore/index.d.ts} +1 -1
- package/lib/{localstore-ops.d.ts → tools/localstore/service.d.ts} +2 -2
- package/lib/tools/{msm.d.ts → msm/index.d.ts} +1 -1
- package/lib/{msm-ops.d.ts → tools/msm/service.d.ts} +2 -2
- package/lib/tools/skiff-admin.d.ts +19 -14
- package/lib/{cognitive-trajectory-assistant.d.ts → trajectory/assistant.d.ts} +2 -2
- package/lib/{cognitive-trajectory-bound.d.ts → trajectory/bound.d.ts} +2 -2
- package/lib/{session-cleanup.d.ts → trajectory/cleanup.d.ts} +1 -1
- package/lib/{cognitive-trajectory-ops.d.ts → trajectory/core.d.ts} +55 -25
- package/lib/{live-sessions.d.ts → trajectory/live.d.ts} +1 -1
- package/lib/trajectory/prompt.d.ts +101 -0
- package/lib/{rebuild.d.ts → trajectory/rebuild.d.ts} +1 -1
- package/lib/{cognitive-trajectory-skills.d.ts → trajectory/skills.d.ts} +1 -1
- package/lib/{clock-runtime.d.ts → wake/clock.d.ts} +3 -3
- package/lib/{cro-guide.d.ts → wake/cro-guide.d.ts} +1 -1
- package/lib/{cro-log.d.ts → wake/cro-log.d.ts} +3 -3
- package/lib/{cro-turns.d.ts → wake/cro-turns.d.ts} +5 -5
- package/lib/{cro.d.ts → wake/cro.d.ts} +6 -6
- package/lib/{wake-registry.d.ts → wake/registry.d.ts} +2 -2
- package/lib/{wake-scheduler.d.ts → wake/scheduler.d.ts} +3 -3
- package/package.json +2 -2
- package/lib/constants.d.ts +0 -6
- package/lib/settings-section-0TPYWug9.js +0 -238
- package/lib/skiff-core.d.ts +0 -145
- package/lib/skiff-registry.d.ts +0 -26
- package/lib/skiff-role-cwxAt0gE.js +0 -203
- package/lib/skiff-role.d.ts +0 -89
- package/lib/tools/cc-fs.d.ts +0 -7
- package/lib/tools/git.d.ts +0 -4
|
@@ -1,11 +1,11 @@
|
|
|
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-Dkoa2oW3.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";
|
|
6
|
-
//#region src/localstore
|
|
6
|
+
//#region src/tools/localstore/service.ts
|
|
7
7
|
/**
|
|
8
|
-
* localstore
|
|
8
|
+
* tools/localstore/service.ts — localstore 纯逻辑层(零 DSH 依赖,可独立单测)
|
|
9
9
|
*
|
|
10
10
|
* S134 重设计(v1.16.7):存储从 ~/.serenity/ 迁到 **CCC 根根目录 localstore.json**
|
|
11
11
|
* (JSON 格式——方便 MSM 直接 read + JSON.parse 读取,零解析依赖)。
|
|
@@ -281,9 +281,9 @@ function runLocalStore(root, args) {
|
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
//#endregion
|
|
284
|
-
//#region src/
|
|
284
|
+
//#region src/im/route.ts
|
|
285
285
|
/**
|
|
286
|
-
*
|
|
286
|
+
* im/route.ts — 微信桥 CCC 配置层纯逻辑(F4c-3,v1.27.0 实验性)
|
|
287
287
|
*
|
|
288
288
|
* 职责(零 DSH 依赖,可独立单测):
|
|
289
289
|
* - 读取 CCC 的 weixin 配置(.opencode/serenity.json weixin 段——结构/路由/开关)
|
|
@@ -295,13 +295,14 @@ function runLocalStore(root, args) {
|
|
|
295
295
|
* 配置归属(S142 用户拍板):**CCC 级**——serenity.json 结构 + localstore 凭据分离;
|
|
296
296
|
* 不绑定具体 role(用户自选路由目标)。
|
|
297
297
|
*/
|
|
298
|
-
var
|
|
298
|
+
var route_exports = /* @__PURE__ */ __exportAll({
|
|
299
299
|
clearWeixinCredential: () => clearWeixinCredential,
|
|
300
300
|
extractWeixinMedia: () => extractWeixinMedia,
|
|
301
301
|
extractWeixinText: () => extractWeixinText,
|
|
302
302
|
hasVoiceItem: () => hasVoiceItem,
|
|
303
303
|
matchWeixinRoute: () => matchWeixinRoute,
|
|
304
304
|
nextWeixinAccountId: () => nextWeixinAccountId,
|
|
305
|
+
readImSettings: () => readImSettings,
|
|
305
306
|
readWeixinCredential: () => readWeixinCredential,
|
|
306
307
|
readWeixinSettings: () => readWeixinSettings,
|
|
307
308
|
removeWeixinAccount: () => removeWeixinAccount,
|
|
@@ -310,7 +311,7 @@ var weixin_route_exports = /* @__PURE__ */ __exportAll({
|
|
|
310
311
|
setWeixinEnabled: () => setWeixinEnabled,
|
|
311
312
|
upsertWeixinAccount: () => upsertWeixinAccount,
|
|
312
313
|
weixinInboundDir: () => weixinInboundDir,
|
|
313
|
-
|
|
314
|
+
weixinSessionIdForTrajectory: () => weixinSessionIdForTrajectory,
|
|
314
315
|
writeWeixinCredential: () => writeWeixinCredential
|
|
315
316
|
});
|
|
316
317
|
/** localstore 凭据键前缀(**credential scope**——token 是凭据,走 UPPER_SNAKE 键;
|
|
@@ -320,51 +321,135 @@ const LS_PREFIX = "WEIXIN_";
|
|
|
320
321
|
function accountKeyPart(accountId) {
|
|
321
322
|
return accountId.toUpperCase().replace(/[^A-Z0-9]+/g, "_");
|
|
322
323
|
}
|
|
323
|
-
/**
|
|
324
|
+
/**
|
|
325
|
+
* 微信桥 skiff 会话 id 前缀(守卫识别"外部面"用)。
|
|
326
|
+
*
|
|
327
|
+
* ⚠️ **2026-10-19 起它只是命名习惯,不再是判据** —— skiff 的身份是**轨迹**,
|
|
328
|
+
* 判据 = 「绑定的轨迹有 `skiff.json`」(`role/skiff/profile.ts` 的 `isSkiffSession`)。
|
|
329
|
+
* 保留前缀只为:① 日志/会话列表里一眼认出这是外部面;② 存量会话目录名不变。
|
|
330
|
+
*/
|
|
324
331
|
const WEIXIN_SESSION_PREFIX = "skiff-weixin-";
|
|
325
|
-
/**
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
+
/**
|
|
333
|
+
* **轨迹编码 → 固定的 dsh 会话 id**(2026-10-19 重做:身份挂在轨迹上,不挂在用户上)。
|
|
334
|
+
*
|
|
335
|
+
* ## 为什么改(owner 重做令的实际含义)
|
|
336
|
+
*
|
|
337
|
+
* 旧派生 = `skiff-weixin-<sha256(微信用户 id)>`:**同一条轨迹换一个用户就是另一条会话**,
|
|
338
|
+
* 而**同一个用户换一条轨迹也还是原来那条会话**(后者的症状:改路由之后,新轨迹的约束
|
|
339
|
+
* 对不上旧会话的历史工具清单)。⇒ 那不是"轨迹是一等公民",那是"用户是一等公民"。
|
|
340
|
+
*
|
|
341
|
+
* 新派生 = **由轨迹编码决定**:同一条轨迹 ⇒ 恒同一条 dsh 会话(无论谁在跟它说话);
|
|
342
|
+
* 换轨迹 ⇒ 新会话。这正是"skiff 是认知轨迹的一种"。
|
|
343
|
+
*
|
|
344
|
+
* ## 连带删掉的东西
|
|
345
|
+
*
|
|
346
|
+
* 旧实现有 `.weixin-session-gen.json` 换代计数器(`baseId-g<n>`),存在的唯一理由是
|
|
347
|
+
* "身份绑在用户上、载体(SESSION.md)可能先被归档" ⇒ 只能靠换代续命。
|
|
348
|
+
* 现在**身份就是轨迹**:轨迹没了就该报"目标不存在"(响亮),**不该静默续命**
|
|
349
|
+
* ⇒ 计数器整件删除。
|
|
350
|
+
*
|
|
351
|
+
* ⚠️ 会话 id 里保留 `skiff-weixin-` 前缀只为可读性;**它不含用户身份**,
|
|
352
|
+
* 因此也不会泄漏"谁在跟它说话"(旧形态的哈希虽是伪名,但它是**可复算的稳定标识**,
|
|
353
|
+
* 见 `privacy-scan` 的 `weixin-session-pseudonym` 规则 —— 新形态连这个问题都没有了)。
|
|
354
|
+
*/
|
|
355
|
+
function weixinSessionIdForTrajectory(code) {
|
|
356
|
+
return `${WEIXIN_SESSION_PREFIX}${code}`;
|
|
332
357
|
}
|
|
333
358
|
/**
|
|
334
|
-
*
|
|
335
|
-
*
|
|
359
|
+
* 路由行的**目标编码**(过渡别名解析,单一处)。
|
|
360
|
+
*
|
|
361
|
+
* 🔴 2026-10-19:目标从「角色名」改为**认知轨迹编码**。存量 CCC 的配置里写的是
|
|
362
|
+
* `{user, role}` —— **不强制同批迁移**(配置是 CCC 的数据,改它不该要求同步发版)。
|
|
363
|
+
* ⇒ 读侧接受三种写法,按确定性顺序:`trajectory`(新)→ `role`(旧值,语义已等同编码)
|
|
364
|
+
* → 空(该行作废,由调用方按"未命中"处理)。
|
|
336
365
|
*/
|
|
337
|
-
function
|
|
366
|
+
function routeTarget(row) {
|
|
367
|
+
for (const v of [row.trajectory, row.role]) if (typeof v === "string" && v.trim() !== "") return v.trim();
|
|
368
|
+
return "";
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* **统一 IM 配置的单一读取入口**(2026-10-19 owner 定向:微信与飞书只是账号实现不同,
|
|
372
|
+
* 整合到统一配置)。
|
|
373
|
+
*
|
|
374
|
+
* 读取顺序(**确定性,只有这一处**):
|
|
375
|
+
* ① `im` 段 —— 但**判据是 `accounts` 是数组**,不是"段存在"(见下 🔴)
|
|
376
|
+
* ② 旧 `weixin` 段 —— 存量 CCC 零迁移
|
|
377
|
+
* ③ 都没有 ⇒ 归一默认(`enabled:false`、空数组)
|
|
378
|
+
*
|
|
379
|
+
* 🔴 **为什么判据是「`accounts` 是数组」**:本 CCC 的配置里**曾经**有过一个 `im` 段
|
|
380
|
+
* (退役的 ACP 形态:`{channel:"acp", acp:{enabled, accounts:[…]}}`)。若只判"段存在",
|
|
381
|
+
* 那份残留会被当成新配置读 ⇒ 得到一个没有 `accounts` 数组 / 或 `accounts` 形状完全不同的对象
|
|
382
|
+
* ⇒ 表现为**"配置没生效"且不报错**。⇒ 用可判别的形状把它排除掉(退役残留继续被静默忽略,
|
|
383
|
+
* 与 v1.59.0 的裁决一致)。
|
|
384
|
+
*
|
|
385
|
+
* ⚠️ 本函数**只做归一**,不判断"这个通道实现有没有"——那是装配处的事
|
|
386
|
+
* (`syncMachinePollers` 里有"未实现的 channel 出声但不静默跳过")。
|
|
387
|
+
*/
|
|
388
|
+
function readImSettings(root, paths = DEFAULT_SERENITY_CONFIG_PATHS) {
|
|
389
|
+
const empty = () => ({
|
|
390
|
+
enabled: false,
|
|
391
|
+
accounts: [],
|
|
392
|
+
routes: []
|
|
393
|
+
});
|
|
338
394
|
try {
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
return {
|
|
346
|
-
enabled: w.enabled === true,
|
|
347
|
-
botType: typeof w.botType === "string" && w.botType !== "" ? w.botType : void 0,
|
|
348
|
-
hook: typeof w.hook === "string" && w.hook.trim() !== "" ? w.hook.trim() : void 0,
|
|
349
|
-
autoReplyWithLastMessage: w.autoReplyWithLastMessage !== false,
|
|
350
|
-
fallbackOnNoSend: w.fallbackOnNoSend === true,
|
|
351
|
-
accounts: Array.isArray(w.accounts) ? w.accounts.filter((a) => typeof a === "object" && a !== null && typeof a.accountId === "string" && a.accountId !== "").map((a) => ({
|
|
352
|
-
accountId: a.accountId,
|
|
353
|
-
name: typeof a.name === "string" ? a.name : void 0,
|
|
354
|
-
enabled: a.enabled !== false
|
|
355
|
-
})) : [],
|
|
356
|
-
routes: Array.isArray(w.routes) ? w.routes.filter((r) => typeof r === "object" && r !== null && typeof r.user === "string" && r.user !== "" && typeof r.role === "string" && r.role !== "") : [],
|
|
357
|
-
aliases: readAliases(w)
|
|
358
|
-
};
|
|
395
|
+
const cfg = loadSerenityConfig(root, paths);
|
|
396
|
+
const unified = cfg.im;
|
|
397
|
+
if (isUnifiedImSection(unified)) return normalizeImSection(unified, empty());
|
|
398
|
+
const legacy = cfg.weixin;
|
|
399
|
+
if (!legacy || typeof legacy !== "object") return empty();
|
|
400
|
+
return normalizeImSection(legacy, empty());
|
|
359
401
|
} catch {
|
|
360
|
-
return
|
|
361
|
-
enabled: false,
|
|
362
|
-
accounts: [],
|
|
363
|
-
routes: []
|
|
364
|
-
};
|
|
402
|
+
return empty();
|
|
365
403
|
}
|
|
366
404
|
}
|
|
367
405
|
/**
|
|
406
|
+
* 判别一个 `im` 段是不是**新的统一形态**。
|
|
407
|
+
*
|
|
408
|
+
* 判据 = `accounts` 是数组 **且** 每行(若有)不带退役 ACP 的 `accountId` 之外的 ACP 形状;
|
|
409
|
+
* 退役 ACP 形态的特征是顶层有 `channel:"acp"` 或 `acp` 对象。
|
|
410
|
+
* ⇒ 两者**任一命中**即判为"退役残留",不认。
|
|
411
|
+
*/
|
|
412
|
+
function isUnifiedImSection(v) {
|
|
413
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return false;
|
|
414
|
+
const obj = v;
|
|
415
|
+
if (obj.acp !== void 0 && (typeof obj.acp === "object" || typeof obj.acp === "string")) return false;
|
|
416
|
+
if (obj.channel === "acp") return false;
|
|
417
|
+
return Array.isArray(obj.accounts);
|
|
418
|
+
}
|
|
419
|
+
/** 段 → 归一形态(统一段与旧段**共用同一套归一语义**,避免两条读法各漂) */
|
|
420
|
+
function normalizeImSection(w, d) {
|
|
421
|
+
const src = w;
|
|
422
|
+
const accountsIn = Array.isArray(src.accounts) ? src.accounts : [];
|
|
423
|
+
return {
|
|
424
|
+
enabled: src.enabled === true,
|
|
425
|
+
botType: typeof src.botType === "string" && src.botType !== "" ? src.botType : void 0,
|
|
426
|
+
hook: typeof src.hook === "string" && src.hook.trim() !== "" ? src.hook.trim() : void 0,
|
|
427
|
+
autoReplyWithLastMessage: src.autoReplyWithLastMessage !== false,
|
|
428
|
+
fallbackOnNoSend: src.fallbackOnNoSend === true,
|
|
429
|
+
accounts: accountsIn.filter((a) => typeof a === "object" && a !== null && typeof a.accountId === "string" && a.accountId !== "").map((a) => ({
|
|
430
|
+
accountId: a.accountId,
|
|
431
|
+
channel: typeof a.channel === "string" && a.channel.trim() !== "" ? a.channel.trim() : "weixin",
|
|
432
|
+
name: typeof a.name === "string" ? a.name : void 0,
|
|
433
|
+
enabled: a.enabled !== false
|
|
434
|
+
})),
|
|
435
|
+
routes: Array.isArray(src.routes) ? src.routes.filter((r) => typeof r === "object" && r !== null && typeof r.user === "string" && r.user !== "" && typeof routeTarget(r) === "string").map((r) => ({
|
|
436
|
+
user: r.user,
|
|
437
|
+
trajectory: routeTarget(r)
|
|
438
|
+
})) : [],
|
|
439
|
+
aliases: readAliases(src)
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* 读取 CCC 微信桥配置(未配置/未启用 → 归一默认)。
|
|
444
|
+
*
|
|
445
|
+
* ⚠️ 2026-10-19 起它是 {@link readImSettings} 的**薄别名**(签名与返回形状不变):
|
|
446
|
+
* 旧调用点无需改动,但**配置来源已经统一**——`im` 段优先、`weixin` 段回退。
|
|
447
|
+
* 保留名字是为了让既有调用点与测试**逐字不动**(P1 是纯重构,读数必须不变)。
|
|
448
|
+
*/
|
|
449
|
+
function readWeixinSettings(root, paths = DEFAULT_SERENITY_CONFIG_PATHS) {
|
|
450
|
+
return readImSettings(root, paths);
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
368
453
|
* 别名表清洗(v1.56.10):键归一为小写、值必须是非空字符串;非法项静默丢弃。
|
|
369
454
|
* 空/缺省 → `{}`(此时别名解析不可用,只能用裸 iLink 用户 id)。
|
|
370
455
|
*/
|
|
@@ -409,12 +494,12 @@ function clearWeixinCredential(root, accountId) {
|
|
|
409
494
|
}
|
|
410
495
|
/**
|
|
411
496
|
* 路由匹配:exact user 优先,通配 `*` 兜底。
|
|
412
|
-
* @returns
|
|
497
|
+
* @returns 命中的**轨迹编码**;未命中 → null(无路由 → 消息不回复/忽略)
|
|
413
498
|
*/
|
|
414
499
|
function matchWeixinRoute(routes, fromUserId) {
|
|
415
500
|
if (!Array.isArray(routes) || routes.length === 0) return null;
|
|
416
|
-
for (const r of routes) if (r.user === fromUserId) return r.
|
|
417
|
-
for (const r of routes) if (r.user === "*") return r.
|
|
501
|
+
for (const r of routes) if (r.user === fromUserId) return r.trajectory;
|
|
502
|
+
for (const r of routes) if (r.user === "*") return r.trajectory;
|
|
418
503
|
return null;
|
|
419
504
|
}
|
|
420
505
|
/**
|
|
@@ -555,4 +640,4 @@ function setWeixinEnabled(root, enabled) {
|
|
|
555
640
|
return next;
|
|
556
641
|
}
|
|
557
642
|
//#endregion
|
|
558
|
-
export { readWeixinCredential as a,
|
|
643
|
+
export { readWeixinCredential as a, sanitizeFileName as c, LOCALSTORE_SCOPES as d, checkLocalstoreGitCompliance as f, runLocalStore as g, readStore as h, matchWeixinRoute as i, weixinInboundDir as l, readGitTrack as m, extractWeixinText as n, readWeixinSettings as o, localstorePath as p, hasVoiceItem as r, route_exports as s, extractWeixinMedia as t, weixinSessionIdForTrajectory as u };
|
package/lib/seams/context.d.ts
CHANGED
|
@@ -29,13 +29,13 @@ export declare function accMessage(root: string, configPaths: string[], entrySki
|
|
|
29
29
|
* - cheap-worker 杂工:sessionId 固定 `cheap-worker-` 前缀(tools/cheap-worker.ts 生成)
|
|
30
30
|
* 三者都不恢复(避免把主会话激活注入子上下文,违背 v1.16.2 scope 隔离)。
|
|
31
31
|
*/
|
|
32
|
-
export declare function shouldAutoRestore(agent: Agent): boolean;
|
|
32
|
+
export declare function shouldAutoRestore(agent: Agent, root?: string | null): boolean;
|
|
33
33
|
/**
|
|
34
34
|
* 恢复触发判定(S134 泄漏修复 v1.16.13):根会话 **且已有对话历史**(续跑/恢复的会话)
|
|
35
|
-
*
|
|
35
|
+
* 才自动恢复上次激活的宁静号会话——全新会话(新任务)无历史 → 不恢复,
|
|
36
36
|
* 避免把过去的 SESSION 上下文注入新任务(跨任务污染)。
|
|
37
37
|
*/
|
|
38
|
-
export declare function shouldRestoreActive(agent: Agent): boolean;
|
|
38
|
+
export declare function shouldRestoreActive(agent: Agent, root?: string | null): boolean;
|
|
39
39
|
interface ContextRegistration {
|
|
40
40
|
configPaths?: string[];
|
|
41
41
|
/** session-start 播种 */
|
package/lib/seams/guards.d.ts
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { Context } from 'cordis';
|
|
10
10
|
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
11
|
-
import { type BlacklistRule } from '../ccc.js';
|
|
11
|
+
import { type BlacklistRule } from '../kernel/ccc.js';
|
|
12
|
+
import { type SkiffProfile } from '../role/skiff/profile.js';
|
|
12
13
|
export interface GuardInput {
|
|
13
14
|
root: string;
|
|
14
15
|
toolName: string;
|
|
@@ -18,8 +19,14 @@ export interface GuardInput {
|
|
|
18
19
|
pathArg?: string;
|
|
19
20
|
/** container_fs 等复合工具的子命令 action(只读子命令不查黑名单) */
|
|
20
21
|
action?: string;
|
|
21
|
-
/**
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* 该会话的 skiff 约束面(`null`/`undefined` = 不是 skiff 会话 ⇒ 不判定)。
|
|
24
|
+
*
|
|
25
|
+
* 🔴 2026-10-19 起传**已解析好的约束面**,不传 sessionId:解判据("这条轨迹有没有
|
|
26
|
+
* `skiff.json`")留在唯一入口 `profile.ts`,守卫只消费结果 ⇒ 纯函数里不再做 IO,
|
|
27
|
+
* 也不可能出现"守卫的判据与 schema 收窄的判据不一致"。
|
|
28
|
+
*/
|
|
29
|
+
skiffProfile?: SkiffProfile | null;
|
|
23
30
|
}
|
|
24
31
|
interface GuardDecisionResult {
|
|
25
32
|
deny?: string;
|
|
@@ -101,26 +108,25 @@ export declare function getSkiffRoleVisibilityDiagnostics(): {
|
|
|
101
108
|
denyByKey: Record<string, string[]>;
|
|
102
109
|
};
|
|
103
110
|
/**
|
|
104
|
-
* 同步 **
|
|
111
|
+
* 同步 **skiff 会话的工具面**:把白名单之外的工具**从 schema 移除**(不是"看得到但被拒")。
|
|
105
112
|
*
|
|
106
113
|
* ## 为什么必须有这条(owner 2026-10-19:「工具清单也要热加载」)
|
|
107
114
|
*
|
|
108
|
-
* 在它之前,skiff
|
|
109
|
-
* 工具全部出现在模型 schema
|
|
110
|
-
* ⇒ 两个真实后果:
|
|
115
|
+
* 在它之前,skiff 白名单**只由运行时守卫拦截**(`decideGuard` 的 skiff 分支):
|
|
116
|
+
* 工具全部出现在模型 schema 里,调用时才被打回。⇒ 两个真实后果:
|
|
111
117
|
* ① **模型看得见它不该有的工具** —— 它会去试,试了才撞墙(一轮白烧,且错误文案泛化,
|
|
112
118
|
* 看不出"是不在清单里"还是"临时性拒绝");
|
|
113
|
-
* ② **配置变动在 schema 上永远不生效** —— 改 `skiff.
|
|
114
|
-
* 不影响"模型看得见什么"。这正是 owner 报的"工具清单不热加载"。
|
|
119
|
+
* ② **配置变动在 schema 上永远不生效** —— 改 `skiff.json` 的 `tools` 只影响"调用是否放行"。
|
|
115
120
|
*
|
|
116
121
|
* ## 判据与降级
|
|
117
122
|
*
|
|
118
|
-
* - deny 集合 = **`REGISTERED_TOOLS` −
|
|
123
|
+
* - deny 集合 = **`REGISTERED_TOOLS` − 白名单**(只对**我们自己注册的**工具算,
|
|
119
124
|
* 不去动宿主的工具 —— 宿主的工具由各自的条件同步管)。
|
|
120
125
|
* - ⚠️ **未注册的名字会让整次 restrict 失败**(宿主契约逐字 "unknown names … fail"),
|
|
121
126
|
* 而 `diagram` 是按开关注册的 ⇒ 与 `hideAllFor` 同款**两档尝试**(先全覆盖,失败退常驻段)。
|
|
122
|
-
* -
|
|
123
|
-
*
|
|
127
|
+
* - 读不到约束面(不是 skiff / 配置删了)⇒ **撤销既有隐藏**(回到"无约束"):
|
|
128
|
+
* ⛔ 不能只是 `return` —— 那会把上一步的隐藏**永久留在**一个已不再是 skiff 的会话上
|
|
129
|
+
* (这正是 owner 说的"删掉 `skiff.json` 就该立刻恢复")。
|
|
124
130
|
* - 幂等:算出来的 deny 签名不变就跳过(不每步重建 schema)。
|
|
125
131
|
*
|
|
126
132
|
* @param agent 目标会话
|
package/lib/seams/keeper.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare function reminderText(code: string): string;
|
|
|
48
48
|
* 使用者若要查看当前占用/阈值:看面板(`rebuildThresholdK` 滑块 + 状态显示)——那是给人看的。
|
|
49
49
|
*
|
|
50
50
|
* v1.31.1 交接协议(S142 用户需求"要求 LLM 将当前手头事项写在 SESSION.md 尾部,并要求
|
|
51
|
-
* rebuild 后去读并处理"):**写侧** = 这里;**读侧** = rebuild 锚点(rebuild.ts)。
|
|
51
|
+
* rebuild 后去读并处理"):**写侧** = 这里;**读侧** = rebuild 锚点(trajectory/rebuild.ts)。
|
|
52
52
|
* 两侧共用 cognitive-trajectory-assistant 的常量(单一真相源)。
|
|
53
53
|
*
|
|
54
54
|
* 🔴 **v1.49.0(owner 2026-09-26 裁决:"砍掉 in-flight,这正是目的")**:写侧**不再**指向
|
|
@@ -109,7 +109,9 @@ export declare function sessionBlock(root: string, scope?: string): string;
|
|
|
109
109
|
* Principles 剥离 MSM 原则段(指令遵循约束)——用户文本承接两处风格;本体论/关系段/
|
|
110
110
|
* 操作边界(安全硬约束)永远保留。未配置 → 与 v1.23.0 逐字节一致(零影响)。
|
|
111
111
|
*/
|
|
112
|
-
export declare function serenitySystemPrompt(root: string, scope?: string
|
|
112
|
+
export declare function serenitySystemPrompt(root: string, scope?: string,
|
|
113
|
+
/** 活跃轨迹目录名(给了才有第 ⑧ 段;未绑定轨迹 ⇒ undefined,不注入) */
|
|
114
|
+
dirName?: string): string;
|
|
113
115
|
/**
|
|
114
116
|
* Code Mode 适配行:当前 scope 以 Code Mode 呈现工具时(run_code 可见),
|
|
115
117
|
* ACC 块按 native 语义指引"直接调用工具"会与"只有 run_code 可直接调用"的执行
|