@shgroup/dsh-serenity-hooks 1.139.3 → 1.139.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/{bind-file-Dy6Qmm7z.js → bind-file-C2VRuwAQ.js} +64 -1
- package/lib/{ccc-roots-B6dJON2X.js → ccc-roots-BiScEed8.js} +1 -1
- package/lib/{contract-DXaIXQvh.js → contract-BDRflYbM.js} +3 -3
- package/lib/{guards-is79hFAc.js → guards-BuIUwt2B.js} +2 -2
- package/lib/index.js +28 -20
- package/lib/{injection-ME-aoZVl.js → injection-D74-pSfA.js} +2 -2
- package/lib/{observation-BU6BZjsW.js → observation-CZc2zerb.js} +3 -3
- package/lib/{profile-CRcW3ifg.js → profile-Vw1zbdts.js} +1 -1
- package/lib/{rebuild-bySH_ZPq.js → rebuild-D61iR-K7.js} +11 -5
- package/lib/{scheduler-4EvElf11.js → scheduler-Bdc2UY9V.js} +10 -7
- package/lib/{service-C3vpKGcT.js → service-BXb4EQpw.js} +6 -6
- package/lib/{session-BTOngenk.js → session-COWVxBrx.js} +5 -5
- package/lib/{settings-YC-csZus.js → settings-DhMcTgYN.js} +1 -1
- package/lib/{subscriptions-BlxA1n2N.js → subscriptions-CB_eC37Q.js} +4 -4
- package/lib/tools/cognitive-trajectory.d.ts +9 -0
- package/lib/trajectory/core.d.ts +53 -0
- 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.139.
|
|
3
|
+
"version": "1.139.5",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"description": "宁静号 ACC harness(Native Cordis 插件):给 DSH 装一个「AI 工作区」——13 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/localstore/container_admin/browser_slot;另两个 im-bridge/diagram 按条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/IM 桥/认知轨迹唤醒注册表 + 浏览器槽位管理(≤20 个独立 profile 的 Chrome 槽位,带占用归属与异常时向所属会话反向注入提醒)。轨迹声明 = 轨迹目录下的 trajectory.json(约束面 + 旧标识 uid + CRO 机器绑定 cro.host;旧名 trajectory-constraint.json / skiff.json 仍在读取族里);轨迹提示词 = 轨迹目录下的 PROMPT.md(一条轨迹「是谁、按什么章程工作」,所有轨迹通用,追加在容器层与质量层之后,不替换它们)。适配 DSH 0.1.7-rc.1 / 0.2.0-rc.1 / 0.2.1-rc.1(三档,deepseek-ai/deepseek-harness)。",
|
|
6
6
|
"engines": {
|
|
@@ -682,6 +682,69 @@ function namingTitleFor(active, summary) {
|
|
|
682
682
|
}
|
|
683
683
|
return active.dirName;
|
|
684
684
|
}
|
|
685
|
+
/**
|
|
686
|
+
* 是否应当**跳过**重命名(用户手改过的标题优先级最高,不覆盖)。
|
|
687
|
+
*
|
|
688
|
+
* ## 需求来源(owner 2026-11-25 原话)
|
|
689
|
+
*
|
|
690
|
+
* 「就是上下文交接以后我得重命名会被覆盖」「按理说自己重命名的应该是优先级最高的吧」
|
|
691
|
+
* ⇒ 用户手工起的名字**必须压过**我们按 `编号-日期-概括` 自动生成的名字。
|
|
692
|
+
*
|
|
693
|
+
* ## 为什么⛔不能直接看宿主 `source.kind === 'user'`
|
|
694
|
+
*
|
|
695
|
+
* 宿主 `sessionTitle.rename()` —— **我们自己改名走的也是它** —— 落盘的来源**恒为**
|
|
696
|
+
* `{ kind: 'user' }`(`dsh-session-title` 逐字:`session.append('session/title', { … source: { kind: 'user' } })`)。
|
|
697
|
+
* ⇒ 若把"来源=user"当作"人改的",**连我们自己每次 regenerate 都会被自己挡住**,
|
|
698
|
+
* 概要再也更新不了(那是把功能焊死,不是尊重用户)。
|
|
699
|
+
*
|
|
700
|
+
* ## 判据:认**形状**,不认来源
|
|
701
|
+
*
|
|
702
|
+
* 我们生成的标题必然以 `<S编号>-<日期>` 开头(无日期时以 `<S编号>` 开头)。
|
|
703
|
+
* ⇒ **当前标题不符合这个前缀** ⟺ 用户改过 ⟺ 不动它。
|
|
704
|
+
* ⇒ 符合前缀 ⇒ 那(几乎必然)是我们上一轮写的,允许用新概括覆盖。
|
|
705
|
+
*
|
|
706
|
+
* 🔴 **"读不到"≠"用户改过"**(2026-11-25 首次实现写错的地方):
|
|
707
|
+
* 会话**还没有标题**时(新建载体、替身服务不提供读口)⇒ 我们起**第一个**名字,
|
|
708
|
+
* 那是"命名"而不是"覆盖",**必须允许**。
|
|
709
|
+
* 把它判成"保留"会让整条命名链在服务形态不完整时**整体失效**
|
|
710
|
+
* (实证:一次错误收窄让 11 条既有用例全红,功能等于被自己焊死)。
|
|
711
|
+
*
|
|
712
|
+
* @param currentTitle 会话当前标题(`undefined`/空串 = 尚无标题)
|
|
713
|
+
* @param expectedPrefix 我们这一轮本该生成的标题前缀(`namingTitleFor` 去掉概括部分)
|
|
714
|
+
* @returns true = 跳过重命名(保留用户的名字);false = 可以写
|
|
715
|
+
*/
|
|
716
|
+
function shouldKeepUserTitle(currentTitle, expectedPrefix, sourceKind) {
|
|
717
|
+
if (typeof currentTitle !== "string" || currentTitle.trim() === "") return false;
|
|
718
|
+
if (expectedPrefix === "") return false;
|
|
719
|
+
if (sourceKind === "fallback" || sourceKind === "provider") return false;
|
|
720
|
+
const t = currentTitle.trim();
|
|
721
|
+
if (t === expectedPrefix) return false;
|
|
722
|
+
return !t.startsWith(`${expectedPrefix}-`);
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* 读会话当前标题;**读口本身缺失时返回 `null`**(= 结构上无法判断,与"读到空标题"分开)。
|
|
726
|
+
*
|
|
727
|
+
* 🔴 这两种情形必须分开(2026-11-25 首次实现把它们混成一个值):
|
|
728
|
+
* - `null` ⇒ 宿主服务**没有读口** ⇒ 无法判断 ⇒ 调用方**按旧行为**直接写(不引入回归)
|
|
729
|
+
* - `''` ⇒ 读到了,但**尚无标题** ⇒ 不是覆盖 ⇒ 允许写
|
|
730
|
+
* @param titles 宿主 sessionTitle 服务对象(可能是替身/旧形态)
|
|
731
|
+
* @param session 目标会话
|
|
732
|
+
*/
|
|
733
|
+
function readCurrentTitle(titles, session) {
|
|
734
|
+
if (!titles || typeof titles.get !== "function") return { state: "unreadable" };
|
|
735
|
+
try {
|
|
736
|
+
const snap = titles.get(session);
|
|
737
|
+
const title = typeof snap?.title === "string" ? snap.title : void 0;
|
|
738
|
+
const kind = (snap?.source)?.kind;
|
|
739
|
+
return {
|
|
740
|
+
state: "ok",
|
|
741
|
+
title,
|
|
742
|
+
...typeof kind === "string" ? { sourceKind: kind } : {}
|
|
743
|
+
};
|
|
744
|
+
} catch {
|
|
745
|
+
return { state: "unreadable" };
|
|
746
|
+
}
|
|
747
|
+
}
|
|
685
748
|
/** 内存活跃会话:scope(dsh 会话 id)→ 会话信息(不落盘;并行多会话各自 key 隔离) */
|
|
686
749
|
const activeStore = /* @__PURE__ */ new Map();
|
|
687
750
|
/** 全局最近活跃(对齐 osp lastActive;供无 scope 上下文使用) */
|
|
@@ -1248,4 +1311,4 @@ function claimBinding(sessionsRoot, dirName, decl, opts = {}) {
|
|
|
1248
1311
|
};
|
|
1249
1312
|
}
|
|
1250
1313
|
//#endregion
|
|
1251
|
-
export {
|
|
1314
|
+
export { summarize as A, localIdStamp as B, readTrajectoryUid as C, setActiveSessionInfo as D, sessionsRoot as E, findTrajectoryFile as F, readTrajectoryFile as I, isoLocal as L, useSession as M, TRAJECTORY_FILENAME as N, shouldKeepUserTitle as O, TRAJECTORY_LEGACY_FILENAMES as P, localFileStamp as R, readCurrentTitle as S, sessionEvents as T, listSessions as _, readBindDeclaration as a, parseTrajectoryCode as b, UID_FILENAME as c, createSession as d, extractSessionMdPathFromText as f, listActiveTrajectories as g, getLastActiveSessionInfo as h, listBindDeclarations as i, trajectoryDescOf as j, showSession as k, archiveSession as l, getActiveSessionInfo as m, findTrajectoryHolding as n, COGNITIVE_TRAJECTORY_ACTIONS as o, findSession as p, isBindUsable as r, DEFAULT_SESSION_SCOPE as s, claimBinding as t, clearActiveSessionInfo as u, namingTitleFor as v, resolveSessionByTitle as w, readActiveSessionMd as x, parseSessionContextFromEvents as y, localHuman as z };
|
|
@@ -235,7 +235,7 @@ async function listCccs(ctx, opts = {}) {
|
|
|
235
235
|
if (typeof defaultRoot === "string" && defaultRoot !== "" && !c.roots.includes(defaultRoot)) c.roots.unshift(defaultRoot);
|
|
236
236
|
let rolesOf = null;
|
|
237
237
|
if (opts.withRoles === true) {
|
|
238
|
-
const { listTrajectoryConstraints } = await import("./profile-
|
|
238
|
+
const { listTrajectoryConstraints } = await import("./profile-Vw1zbdts.js").then((n) => n.a);
|
|
239
239
|
rolesOf = (root) => {
|
|
240
240
|
try {
|
|
241
241
|
return listTrajectoryConstraints(root).map((p) => p.code);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { l as hostInjected, r as cccRootForCwd, u as hostService } from "./ccc-roots-
|
|
1
|
+
import { l as hostInjected, r as cccRootForCwd, u as hostService } from "./ccc-roots-BiScEed8.js";
|
|
2
2
|
import { d as readCccName$1, n as SAFE_MODE_MARKER, o as isSafeModeOn, r as classifyPath, s as loadSerenityConfig, t as DEFAULT_SERENITY_CONFIG_PATHS, u as readBlacklist } from "./ccc-DSMqTrRU.js";
|
|
3
|
-
import {
|
|
4
|
-
import { S as ACC_VERSION, o as getRestrictDiagnostics } from "./guards-
|
|
3
|
+
import { L as isoLocal, g as listActiveTrajectories } from "./bind-file-C2VRuwAQ.js";
|
|
4
|
+
import { S as ACC_VERSION, o as getRestrictDiagnostics } from "./guards-BuIUwt2B.js";
|
|
5
5
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
6
6
|
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { execFile, execFileSync, spawnSync } from "node:child_process";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as cccRootForCwd } from "./ccc-roots-
|
|
1
|
+
import { r as cccRootForCwd } from "./ccc-roots-BiScEed8.js";
|
|
2
2
|
import { c as matchBlacklist, d as readCccName, g as resolveInside, h as readUtf8, l as pathInside, o as isSafeModeOn, u as readBlacklist } from "./ccc-DSMqTrRU.js";
|
|
3
3
|
import { c as readWeixinSettings, o as readImSettings } from "./route-BGKbuE3M.js";
|
|
4
|
-
import { l as trajectoryCodeForSession, u as trajectoryConstraintForSession } from "./profile-
|
|
4
|
+
import { l as trajectoryCodeForSession, u as trajectoryConstraintForSession } from "./profile-Vw1zbdts.js";
|
|
5
5
|
import { REGISTERED_TOOLS } from "./invariant.js";
|
|
6
6
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
7
7
|
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
package/lib/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
-
import { d as hostSessions, f as hostSettings, i as cccRootForExec, m as hostWebServer, n as agentCwdFor, o as listCccs, p as hostWeb, r as cccRootForCwd, t as NO_CCC_FROM_AGENT_CWD, u as hostService } from "./ccc-roots-
|
|
2
|
+
import { d as hostSessions, f as hostSettings, i as cccRootForExec, m as hostWebServer, n as agentCwdFor, o as listCccs, p as hostWeb, r as cccRootForCwd, t as NO_CCC_FROM_AGENT_CWD, u as hostService } from "./ccc-roots-BiScEed8.js";
|
|
3
3
|
import { a as findSerenityRoot$1, d as readCccName, g as resolveInside, l as pathInside, m as readUserQuotesEnabled, p as readTrajectorySubscriptions, s as loadSerenityConfig, t as DEFAULT_SERENITY_CONFIG_PATHS } from "./ccc-DSMqTrRU.js";
|
|
4
|
-
import { A as
|
|
4
|
+
import { A as summarize, C as readTrajectoryUid, D as setActiveSessionInfo, E as sessionsRoot, L as isoLocal, M as useSession, N as TRAJECTORY_FILENAME, O as shouldKeepUserTitle, P as TRAJECTORY_LEGACY_FILENAMES, R as localFileStamp, S as readCurrentTitle, T as sessionEvents, _ as listSessions, b as parseTrajectoryCode, c as UID_FILENAME, d as createSession, j as trajectoryDescOf, k as showSession, l as archiveSession, m as getActiveSessionInfo, o as COGNITIVE_TRAJECTORY_ACTIONS, p as findSession, u as clearActiveSessionInfo, v as namingTitleFor, w as resolveSessionByTitle, y as parseSessionContextFromEvents } from "./bind-file-C2VRuwAQ.js";
|
|
5
5
|
import { _ as readStore, a as readFeishuCredential, c as readWeixinSettings, d as weixinInboundDir, f as weixinSessionIdForTrajectory, i as matchWeixinRoute, m as checkLocalstoreGitCompliance, n as extractWeixinText, p as LOCALSTORE_SCOPES, r as hasVoiceItem, s as readWeixinCredential, t as extractWeixinMedia, u as sanitizeFileName$1, v as runLocalStore } from "./route-BGKbuE3M.js";
|
|
6
|
-
import { C as findPackageRoot, S as ACC_VERSION, _ as constraintCognitiveTrajectory, d as imChannelIds, f as isImWiredTrajectory, h as TRAJECTORY_CONSTRAINT_HINT, i as forgetNonCccToolVisibility, l as syncToolVisibility, m as runImBridge, p as registerImChannel, s as registerGuards, u as forgetToolVisibility, v as constraintSystemPromptSource, x as resolveConstraintSystemPrompt } from "./guards-
|
|
7
|
-
import { a as setSafeMode, c as ACC_CATALOG, d as findEntry, f as loadMsmEntries, g as setWeixinSendEndpoint, h as docsPointer, i as readDshVersion, l as CCC_CONFIG_REFERENCE, m as runMsmAsync, n as summarizeHostContract, o as listOpencodeSkillDirs, p as runMsm, r as getStatus, s as loadOpencodeSkill, t as hostContractReport } from "./contract-
|
|
8
|
-
import { c as replacesDefaultIdentity, i as listTrajectoryConstraints, l as trajectoryCodeForSession, n as findDirNameByCode, o as readTrajectoryConstraintAt, r as isTrajectoryConstrained, s as readTrajectoryConstraintByCode, t as TRAJECTORY_CONSTRAINT_FILENAME } from "./profile-
|
|
9
|
-
import { A as TRAJECTORY_PROMPT_FILENAME, C as recordToolUsage, D as buildResourceNameSuffix, E as buildResourceIndex, O as isSafeSkillName, S as verifyTotpCode, T as SKILL_ONTOLOGY_FILE, _ as projectKnownWorkspaces, a as trajectoryConstraintFor, b as FACE_PORTS, c as trajectoryWorkspaceMdPath, d as splitModel, f as registerCognitiveTrajectorySkillSection, g as migrateLegacyLocalstore, h as applyWirePatch, i as getTrajectoryAgent, j as hasTrajectoryPrompt, k as truncateContent, l as unregisterTrajectorySession, m as registerEntrySkillSectionGlobal, n as deliverToTrajectory, o as trajectoryConstraintMsmGate, p as registerEntrySkillSection, r as ensureWorkspacePromptSection, s as trajectoryConstraintParticipates, t as createTrajectoryAgent, u as workspaceCognitiveTrajectoryLine, v as readAdvancedSettings, w as REFERENCE_DIR, x as MECHANISM_PORTS, y as toWire } from "./session-
|
|
10
|
-
import { d as readLastBound, f as resolveSessionCognitiveTrajectoryLabel, i as toMessage, l as findTrajectoryOfSession, n as deliver, o as PLUGIN_SOURCE, r as makeInjection, s as appendBound, u as listBoundSessionIds } from "./injection-
|
|
11
|
-
import { c as withRouteDisposal, d as CARRIER_OPENING_MARK, f as WAKE_CATCH_UP_MS, i as sendToCognitiveTrajectory, l as buildCroSnapshot, n as registerWakeScheduler, o as registerCroTurnTracking, p as addWake, s as registerDisposer, t as createAndBindTarget } from "./scheduler-
|
|
12
|
-
import { i as hostAliveProbe, n as readSimpleSettings, r as registerSettingsSection } from "./settings-
|
|
13
|
-
import { a as ACK_PREFIX, c as eventToken, i as resolveSessionMdPath, l as DEFAULT_FAKE_INITIAL_MESSAGES, o as ASSISTANT_PREFIX, r as registerRebuildTurnHook, s as LOG_FILE_REL, t as buildRebuildAnchor, u as registerBootstrap } from "./rebuild-
|
|
14
|
-
import { i as subscriptionStats, n as registerTrajectorySubscriptions, r as subscriptionEval, t as defaultSubscriptionDeps } from "./subscriptions-
|
|
6
|
+
import { C as findPackageRoot, S as ACC_VERSION, _ as constraintCognitiveTrajectory, d as imChannelIds, f as isImWiredTrajectory, h as TRAJECTORY_CONSTRAINT_HINT, i as forgetNonCccToolVisibility, l as syncToolVisibility, m as runImBridge, p as registerImChannel, s as registerGuards, u as forgetToolVisibility, v as constraintSystemPromptSource, x as resolveConstraintSystemPrompt } from "./guards-BuIUwt2B.js";
|
|
7
|
+
import { a as setSafeMode, c as ACC_CATALOG, d as findEntry, f as loadMsmEntries, g as setWeixinSendEndpoint, h as docsPointer, i as readDshVersion, l as CCC_CONFIG_REFERENCE, m as runMsmAsync, n as summarizeHostContract, o as listOpencodeSkillDirs, p as runMsm, r as getStatus, s as loadOpencodeSkill, t as hostContractReport } from "./contract-BDRflYbM.js";
|
|
8
|
+
import { c as replacesDefaultIdentity, i as listTrajectoryConstraints, l as trajectoryCodeForSession, n as findDirNameByCode, o as readTrajectoryConstraintAt, r as isTrajectoryConstrained, s as readTrajectoryConstraintByCode, t as TRAJECTORY_CONSTRAINT_FILENAME } from "./profile-Vw1zbdts.js";
|
|
9
|
+
import { A as TRAJECTORY_PROMPT_FILENAME, C as recordToolUsage, D as buildResourceNameSuffix, E as buildResourceIndex, O as isSafeSkillName, S as verifyTotpCode, T as SKILL_ONTOLOGY_FILE, _ as projectKnownWorkspaces, a as trajectoryConstraintFor, b as FACE_PORTS, c as trajectoryWorkspaceMdPath, d as splitModel, f as registerCognitiveTrajectorySkillSection, g as migrateLegacyLocalstore, h as applyWirePatch, i as getTrajectoryAgent, j as hasTrajectoryPrompt, k as truncateContent, l as unregisterTrajectorySession, m as registerEntrySkillSectionGlobal, n as deliverToTrajectory, o as trajectoryConstraintMsmGate, p as registerEntrySkillSection, r as ensureWorkspacePromptSection, s as trajectoryConstraintParticipates, t as createTrajectoryAgent, u as workspaceCognitiveTrajectoryLine, v as readAdvancedSettings, w as REFERENCE_DIR, x as MECHANISM_PORTS, y as toWire } from "./session-COWVxBrx.js";
|
|
10
|
+
import { d as readLastBound, f as resolveSessionCognitiveTrajectoryLabel, i as toMessage, l as findTrajectoryOfSession, n as deliver, o as PLUGIN_SOURCE, r as makeInjection, s as appendBound, u as listBoundSessionIds } from "./injection-D74-pSfA.js";
|
|
11
|
+
import { c as withRouteDisposal, d as CARRIER_OPENING_MARK, f as WAKE_CATCH_UP_MS, i as sendToCognitiveTrajectory, l as buildCroSnapshot, n as registerWakeScheduler, o as registerCroTurnTracking, p as addWake, s as registerDisposer, t as createAndBindTarget } from "./scheduler-Bdc2UY9V.js";
|
|
12
|
+
import { i as hostAliveProbe, n as readSimpleSettings, r as registerSettingsSection } from "./settings-DhMcTgYN.js";
|
|
13
|
+
import { a as ACK_PREFIX, c as eventToken, i as resolveSessionMdPath, l as DEFAULT_FAKE_INITIAL_MESSAGES, o as ASSISTANT_PREFIX, r as registerRebuildTurnHook, s as LOG_FILE_REL, t as buildRebuildAnchor, u as registerBootstrap } from "./rebuild-D61iR-K7.js";
|
|
14
|
+
import { i as subscriptionStats, n as registerTrajectorySubscriptions, r as subscriptionEval, t as defaultSubscriptionDeps } from "./subscriptions-CB_eC37Q.js";
|
|
15
15
|
import { c as sendTextMessage, i as getUpdates, l as sendTyping, n as downloadMedia, o as markdownToPlainText, r as getConfig, s as sendFileMessage, t as TypingStatus, u as sniffImageExt } from "./ilink-CsZ-f64q.js";
|
|
16
16
|
import { a as registerImAccountImpl, i as normalizeAccountChannel, n as getImAccountImpl, r as imAccountChannels } from "./accounts-BHQbakUh.js";
|
|
17
17
|
import { createRequire } from "node:module";
|
|
@@ -512,7 +512,7 @@ const KIT_ACTIONS = [
|
|
|
512
512
|
async function runKit(root, args, hostCtx) {
|
|
513
513
|
switch (args.action) {
|
|
514
514
|
case "health": {
|
|
515
|
-
const { containerStatus } = await import("./observation-
|
|
515
|
+
const { containerStatus } = await import("./observation-CZc2zerb.js");
|
|
516
516
|
const s = containerStatus({
|
|
517
517
|
root,
|
|
518
518
|
hostCtx
|
|
@@ -558,7 +558,7 @@ async function runKit(root, args, hostCtx) {
|
|
|
558
558
|
}
|
|
559
559
|
case "diag": {
|
|
560
560
|
if (hostCtx === void 0) throw new Error("diag requires the plugin context (live session data unavailable without it)");
|
|
561
|
-
const { runDiag, renderDiag } = await import("./service-
|
|
561
|
+
const { runDiag, renderDiag } = await import("./service-BXb4EQpw.js");
|
|
562
562
|
return renderDiag(await runDiag(hostCtx, root ?? ""));
|
|
563
563
|
}
|
|
564
564
|
default: throw new Error(`Unknown action: ${args.action}`);
|
|
@@ -6415,6 +6415,13 @@ function renameDshSessionOnUse(deps, session, titles, active, summary) {
|
|
|
6415
6415
|
reason: "sessionTitle service unavailable"
|
|
6416
6416
|
};
|
|
6417
6417
|
const title = namingTitleFor(active, summary);
|
|
6418
|
+
const prefix = namingTitleFor(active);
|
|
6419
|
+
const read = readCurrentTitle(titles, session);
|
|
6420
|
+
if (read.state === "ok" && shouldKeepUserTitle(read.title, prefix, read.sourceKind)) return {
|
|
6421
|
+
ok: true,
|
|
6422
|
+
title: read.title ?? "",
|
|
6423
|
+
kept: true
|
|
6424
|
+
};
|
|
6418
6425
|
try {
|
|
6419
6426
|
titles.rename(session, title);
|
|
6420
6427
|
return {
|
|
@@ -6445,7 +6452,8 @@ function renameDshSessionForActive(ctx, exec, info, summary) {
|
|
|
6445
6452
|
return;
|
|
6446
6453
|
}
|
|
6447
6454
|
const result = renameDshSessionOnUse({ sessionTitleAvailable: true }, dshSession, titles, info, summary);
|
|
6448
|
-
if (result.ok) console.log(`[serenity-hooks]
|
|
6455
|
+
if (result.ok && result.kept) console.log(`[serenity-hooks] 保留用户自定义标题,不覆盖: ${result.title}`);
|
|
6456
|
+
else if (result.ok) console.log(`[serenity-hooks] dsh 会话已重命名: ${String(dshSession.id ?? "?")} → ${result.title}`);
|
|
6449
6457
|
else console.warn(`[serenity-hooks] dsh 会话重命名未执行: ${result.reason}`);
|
|
6450
6458
|
} catch (err) {
|
|
6451
6459
|
console.warn(`[serenity-hooks] dsh 会话重命名异常: ${String(err?.message ?? err)}`);
|
|
@@ -6698,7 +6706,7 @@ function createCognitiveTrajectoryTool(ctx) {
|
|
|
6698
6706
|
} catch {}
|
|
6699
6707
|
}
|
|
6700
6708
|
}
|
|
6701
|
-
const { queueRebuild } = await import("./rebuild-
|
|
6709
|
+
const { queueRebuild } = await import("./rebuild-D61iR-K7.js").then((n) => n.n);
|
|
6702
6710
|
const result = await queueRebuild(ctx, {
|
|
6703
6711
|
root,
|
|
6704
6712
|
note: args.note,
|
|
@@ -9974,7 +9982,7 @@ function registerStatusApi(ctx, opts = {}) {
|
|
|
9974
9982
|
});
|
|
9975
9983
|
}
|
|
9976
9984
|
const { saveWeixinRoutes } = await import("./route-BGKbuE3M.js").then((n) => n.l);
|
|
9977
|
-
const { findDirNameByCode } = await import("./profile-
|
|
9985
|
+
const { findDirNameByCode } = await import("./profile-Vw1zbdts.js").then((n) => n.a);
|
|
9978
9986
|
for (const r of routes) if (findDirNameByCode(root, r.trajectory) === null) {
|
|
9979
9987
|
sendJson$2(res, 400, { error: `unknown trajectory: ${r.trajectory} (no such trajectory code in ${root})` });
|
|
9980
9988
|
return;
|
|
@@ -14338,7 +14346,7 @@ const MEDIA_MAX_BYTES = 20971520;
|
|
|
14338
14346
|
*/
|
|
14339
14347
|
async function resolveCccRootByAlias(ctx, alias) {
|
|
14340
14348
|
try {
|
|
14341
|
-
const { listCccs } = await import("./ccc-roots-
|
|
14349
|
+
const { listCccs } = await import("./ccc-roots-BiScEed8.js").then((n) => n.a);
|
|
14342
14350
|
const entries = await listCccs(ctx);
|
|
14343
14351
|
const byName = entries.find((e) => e.name === alias);
|
|
14344
14352
|
if (byName) return byName.root;
|
|
@@ -14406,7 +14414,7 @@ async function resolveInboundTarget(ctx, input) {
|
|
|
14406
14414
|
});
|
|
14407
14415
|
return null;
|
|
14408
14416
|
}
|
|
14409
|
-
const { findDirNameByCode } = await import("./profile-
|
|
14417
|
+
const { findDirNameByCode } = await import("./profile-Vw1zbdts.js").then((n) => n.a);
|
|
14410
14418
|
if (findDirNameByCode(root, target.role) === null) {
|
|
14411
14419
|
const detail = `目标 CCC "${target.ccc}" 内没有编码为 "${target.role}" 的认知轨迹`;
|
|
14412
14420
|
console.error(`[serenity-hooks] ✗ human-channel: ${detail}(account=${input.account} user=${input.user})—— 该消息**未投递**,请改订阅表里的目标编码`);
|
|
@@ -15416,7 +15424,7 @@ function syncHumanChannel(ctx) {
|
|
|
15416
15424
|
(async () => {
|
|
15417
15425
|
try {
|
|
15418
15426
|
stopMachineLoops();
|
|
15419
|
-
const { listCccs } = await import("./ccc-roots-
|
|
15427
|
+
const { listCccs } = await import("./ccc-roots-BiScEed8.js").then((n) => n.a);
|
|
15420
15428
|
for (const entry of await listCccs(ctx)) syncCccBridge(ctx, entry.root);
|
|
15421
15429
|
} catch {}
|
|
15422
15430
|
})();
|
|
@@ -15709,7 +15717,7 @@ function matchCcc(input, candidates) {
|
|
|
15709
15717
|
}
|
|
15710
15718
|
/** 组装候选列表(`ccc-roots.listCccs` 投影 + `.serenity` 名;动态 import 保持本模块静态依赖轻量) */
|
|
15711
15719
|
async function collectCandidates(ctx) {
|
|
15712
|
-
const { listCccs } = await import("./ccc-roots-
|
|
15720
|
+
const { listCccs } = await import("./ccc-roots-BiScEed8.js").then((n) => n.a);
|
|
15713
15721
|
const entries = await listCccs(ctx, { defaultRoot: process.cwd() });
|
|
15714
15722
|
const seen = /* @__PURE__ */ new Set();
|
|
15715
15723
|
const out = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as cccRootForCwd } from "./ccc-roots-
|
|
2
|
-
import {
|
|
1
|
+
import { r as cccRootForCwd } from "./ccc-roots-BiScEed8.js";
|
|
2
|
+
import { E as sessionsRoot, T as sessionEvents, a as readBindDeclaration, b as parseTrajectoryCode, h as getLastActiveSessionInfo, i as listBindDeclarations, m as getActiveSessionInfo, n as findTrajectoryHolding, r as isBindUsable, t as claimBinding } from "./bind-file-C2VRuwAQ.js";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
5
5
|
//#region src/trajectory/bound.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { d as readCccName, i as findGitRoot, l as pathInside, s as loadSerenityConfig, t as DEFAULT_SERENITY_CONFIG_PATHS } from "./ccc-DSMqTrRU.js";
|
|
2
|
-
import { S as ACC_VERSION } from "./guards-
|
|
3
|
-
import { i as readDshVersion, t as hostContractReport, u as checkRegistryQuality } from "./contract-
|
|
4
|
-
import { a as wakeSchedulerState, m as listWakes } from "./scheduler-
|
|
2
|
+
import { S as ACC_VERSION } from "./guards-BuIUwt2B.js";
|
|
3
|
+
import { i as readDshVersion, t as hostContractReport, u as checkRegistryQuality } from "./contract-BDRflYbM.js";
|
|
4
|
+
import { a as wakeSchedulerState, m as listWakes } from "./scheduler-Bdc2UY9V.js";
|
|
5
5
|
import { resolve } from "node:path";
|
|
6
6
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
7
7
|
//#region src/surface/observation.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
2
|
import { g as resolveInside, h as readUtf8 } from "./ccc-DSMqTrRU.js";
|
|
3
|
-
import {
|
|
3
|
+
import { E as sessionsRoot, F as findTrajectoryFile, N as TRAJECTORY_FILENAME, b as parseTrajectoryCode, i as listBindDeclarations } from "./bind-file-C2VRuwAQ.js";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { readdirSync } from "node:fs";
|
|
6
6
|
//#region src/trajectory/policy/window.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
-
import { n as agentCwdFor, r as cccRootForCwd, u as hostService } from "./ccc-roots-
|
|
3
|
-
import {
|
|
4
|
-
import { c as replacesDefaultIdentity } from "./profile-
|
|
5
|
-
import { a as trajectoryConstraintFor } from "./session-
|
|
6
|
-
import { a as ACC_MESSAGE_KIND, d as readLastBound, n as deliver, r as makeInjection, s as appendBound } from "./injection-
|
|
2
|
+
import { n as agentCwdFor, r as cccRootForCwd, u as hostService } from "./ccc-roots-BiScEed8.js";
|
|
3
|
+
import { L as isoLocal, O as shouldKeepUserTitle, S as readCurrentTitle, T as sessionEvents, b as parseTrajectoryCode, f as extractSessionMdPathFromText, m as getActiveSessionInfo, v as namingTitleFor, y as parseSessionContextFromEvents } from "./bind-file-C2VRuwAQ.js";
|
|
4
|
+
import { c as replacesDefaultIdentity } from "./profile-Vw1zbdts.js";
|
|
5
|
+
import { a as trajectoryConstraintFor } from "./session-COWVxBrx.js";
|
|
6
|
+
import { a as ACC_MESSAGE_KIND, d as readLastBound, n as deliver, r as makeInjection, s as appendBound } from "./injection-D74-pSfA.js";
|
|
7
7
|
import { basename, dirname, join, resolve } from "node:path";
|
|
8
8
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
9
9
|
import { deriveEventMessage } from "@deepseek-ai/dsh-session";
|
|
@@ -1102,6 +1102,12 @@ function renameAfterRebuild(ctx, agent, pending) {
|
|
|
1102
1102
|
console.warn("[serenity-hooks] rebuild 后重命名跳过: sessionTitle 服务不可用");
|
|
1103
1103
|
return;
|
|
1104
1104
|
}
|
|
1105
|
+
const prefix = namingTitleFor(info);
|
|
1106
|
+
const read = readCurrentTitle(titles, agent.session);
|
|
1107
|
+
if (read.state === "ok" && shouldKeepUserTitle(read.title, prefix, read.sourceKind)) {
|
|
1108
|
+
console.log(`[serenity-hooks] rebuild 后保留用户自定义标题,不覆盖: ${read.title ?? ""}`);
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1105
1111
|
titles.rename(agent.session, title);
|
|
1106
1112
|
console.log(`[serenity-hooks] rebuild 后会话重命名: ${agent.id} → ${title}`);
|
|
1107
1113
|
} catch (error) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
-
import { c as hostAgents, o as listCccs, u as hostService } from "./ccc-roots-
|
|
2
|
+
import { c as hostAgents, o as listCccs, u as hostService } from "./ccc-roots-BiScEed8.js";
|
|
3
3
|
import { g as resolveInside } from "./ccc-DSMqTrRU.js";
|
|
4
|
-
import {
|
|
5
|
-
import { c as carrierState, i as toMessage, n as deliver, r as makeInjection, s as appendBound, t as assertInjection, u as listBoundSessionIds } from "./injection-
|
|
4
|
+
import { B as localIdStamp, E as sessionsRoot, I as readTrajectoryFile, L as isoLocal, N as TRAJECTORY_FILENAME, O as shouldKeepUserTitle, S as readCurrentTitle, b as parseTrajectoryCode, j as trajectoryDescOf, p as findSession, v as namingTitleFor, z as localHuman } from "./bind-file-C2VRuwAQ.js";
|
|
5
|
+
import { c as carrierState, i as toMessage, n as deliver, r as makeInjection, s as appendBound, t as assertInjection, u as listBoundSessionIds } from "./injection-D74-pSfA.js";
|
|
6
6
|
import { i as sessionsRootDir, n as findSessionLog } from "./cleanup-CPl1SSaK.js";
|
|
7
|
-
import { i as hostAliveProbe, n as readSimpleSettings } from "./settings-
|
|
7
|
+
import { i as hostAliveProbe, n as readSimpleSettings } from "./settings-DhMcTgYN.js";
|
|
8
8
|
import { basename, dirname, join } from "node:path";
|
|
9
9
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
10
10
|
import { spawn } from "node:child_process";
|
|
@@ -3277,12 +3277,15 @@ function renameCarrierTitle(ctx, agent, root, dirName) {
|
|
|
3277
3277
|
if (!titles || typeof titles.rename !== "function") return ", ⚠️ 标题未写(sessionTitle 不可用)";
|
|
3278
3278
|
const session = agent.session;
|
|
3279
3279
|
if (!session || typeof session !== "object") return ", ⚠️ 标题未写(无 session)";
|
|
3280
|
-
const
|
|
3280
|
+
const info = {
|
|
3281
3281
|
sessionId: parseTrajectoryCode(dirName) ?? dirName,
|
|
3282
3282
|
dirName,
|
|
3283
3283
|
mdPath: join(root, "AGENT_SESSIONS", dirName, "SESSION.md")
|
|
3284
|
-
}
|
|
3285
|
-
|
|
3284
|
+
};
|
|
3285
|
+
const prefix = namingTitleFor(info);
|
|
3286
|
+
const read = readCurrentTitle(titles, session);
|
|
3287
|
+
if (read.state === "ok" && shouldKeepUserTitle(read.title, prefix, read.sourceKind)) return ", 保留用户标题";
|
|
3288
|
+
titles.rename(session, namingTitleFor(info));
|
|
3286
3289
|
return ", titled";
|
|
3287
3290
|
} catch (err) {
|
|
3288
3291
|
return `, ⚠️ 标题未写(${String(err?.message ?? err)})`;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { d as hostSessions, r as cccRootForCwd } from "./ccc-roots-
|
|
1
|
+
import { d as hostSessions, r as cccRootForCwd } from "./ccc-roots-BiScEed8.js";
|
|
2
2
|
import { p as readTrajectorySubscriptions } from "./ccc-DSMqTrRU.js";
|
|
3
|
-
import {
|
|
4
|
-
import { f as WAKE_CATCH_UP_MS, u as listCroCognitiveTrajectories } from "./scheduler-
|
|
5
|
-
import { n as readSimpleSettings } from "./settings-
|
|
6
|
-
import { i as subscriptionStats, r as subscriptionEval } from "./subscriptions-
|
|
7
|
-
import { containerClocks, containerWakes } from "./observation-
|
|
3
|
+
import { L as isoLocal, T as sessionEvents } from "./bind-file-C2VRuwAQ.js";
|
|
4
|
+
import { f as WAKE_CATCH_UP_MS, u as listCroCognitiveTrajectories } from "./scheduler-Bdc2UY9V.js";
|
|
5
|
+
import { n as readSimpleSettings } from "./settings-DhMcTgYN.js";
|
|
6
|
+
import { i as subscriptionStats, r as subscriptionEval } from "./subscriptions-CB_eC37Q.js";
|
|
7
|
+
import { containerClocks, containerWakes } from "./observation-CZc2zerb.js";
|
|
8
8
|
//#region src/trajectory/live.ts
|
|
9
9
|
/**
|
|
10
10
|
* trajectory/live.ts — 进程内 live 会话取数 + 精简诊断
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as hostAgents, n as agentCwdFor, r as cccRootForCwd, s as hostAgentDefaultModel } from "./ccc-roots-
|
|
1
|
+
import { c as hostAgents, n as agentCwdFor, r as cccRootForCwd, s as hostAgentDefaultModel } from "./ccc-roots-BiScEed8.js";
|
|
2
2
|
import { f as readCognitiveTrajectorySkills, h as readUtf8, o as isSafeModeOn, u as readBlacklist } from "./ccc-DSMqTrRU.js";
|
|
3
|
-
import {
|
|
3
|
+
import { E as sessionsRoot, L as isoLocal, s as DEFAULT_SESSION_SCOPE, x as readActiveSessionMd } from "./bind-file-C2VRuwAQ.js";
|
|
4
4
|
import { g as readGitTrack, h as localstorePath } from "./route-BGKbuE3M.js";
|
|
5
|
-
import { S as ACC_VERSION, _ as constraintCognitiveTrajectory, b as profileMsmWhitelist, c as shellToolNameFor, g as buildTrajectoryBasePrompt, y as createProfilePromptReader } from "./guards-
|
|
6
|
-
import { d as registerTrajectorySession$1, f as trajectoryDirNameForSession, o as readTrajectoryConstraintAt, p as unregisterTrajectorySession$1, u as trajectoryConstraintForSession } from "./profile-
|
|
7
|
-
import { d as readLastBound, i as toMessage, r as makeInjection } from "./injection-
|
|
5
|
+
import { S as ACC_VERSION, _ as constraintCognitiveTrajectory, b as profileMsmWhitelist, c as shellToolNameFor, g as buildTrajectoryBasePrompt, y as createProfilePromptReader } from "./guards-BuIUwt2B.js";
|
|
6
|
+
import { d as registerTrajectorySession$1, f as trajectoryDirNameForSession, o as readTrajectoryConstraintAt, p as unregisterTrajectorySession$1, u as trajectoryConstraintForSession } from "./profile-Vw1zbdts.js";
|
|
7
|
+
import { d as readLastBound, i as toMessage, r as makeInjection } from "./injection-D74-pSfA.js";
|
|
8
8
|
import { basename, dirname, join, resolve } from "node:path";
|
|
9
9
|
import { chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
10
10
|
import { createHmac, randomBytes, randomUUID, scryptSync } from "node:crypto";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as hostAgents, f as hostSettings, u as hostService } from "./ccc-roots-
|
|
1
|
+
import { c as hostAgents, f as hostSettings, u as hostService } from "./ccc-roots-BiScEed8.js";
|
|
2
2
|
import { i as sessionsRootDir, r as hasSessionLogById } from "./cleanup-CPl1SSaK.js";
|
|
3
3
|
//#region src/trajectory/alive.ts
|
|
4
4
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as cccRootForCwd } from "./ccc-roots-
|
|
1
|
+
import { r as cccRootForCwd } from "./ccc-roots-BiScEed8.js";
|
|
2
2
|
import { p as readTrajectorySubscriptions } from "./ccc-DSMqTrRU.js";
|
|
3
|
-
import {
|
|
4
|
-
import { s as registerDisposer } from "./scheduler-
|
|
3
|
+
import { n as findTrajectoryHolding, z as localHuman } from "./bind-file-C2VRuwAQ.js";
|
|
4
|
+
import { s as registerDisposer } from "./scheduler-Bdc2UY9V.js";
|
|
5
5
|
//#region src/trajectory/subscriptions.ts
|
|
6
6
|
/**
|
|
7
7
|
* trajectory/subscriptions.ts — 轨迹消息订阅(v1.107.0,owner 2026-11-01 令)
|
|
@@ -306,7 +306,7 @@ function defaultSubscriptionDeps(ctx) {
|
|
|
306
306
|
readSubs: (root) => readTrajectorySubscriptions(root),
|
|
307
307
|
dirForSession: (root, sessionId) => findTrajectoryHolding(`${root}/AGENT_SESSIONS`, sessionId),
|
|
308
308
|
deliver: async (root, target, message) => {
|
|
309
|
-
const { sendToCognitiveTrajectory } = await import("./scheduler-
|
|
309
|
+
const { sendToCognitiveTrajectory } = await import("./scheduler-Bdc2UY9V.js").then((n) => n.r);
|
|
310
310
|
const res = await sendToCognitiveTrajectory(ctx, root, target, message, "trajectory-subscription");
|
|
311
311
|
return {
|
|
312
312
|
ok: res.ok,
|
|
@@ -61,9 +61,18 @@ interface RenameOnUseDeps {
|
|
|
61
61
|
*/
|
|
62
62
|
export declare function renameDshSessionOnUse(deps: RenameOnUseDeps, session: unknown, titles: {
|
|
63
63
|
rename: (session: unknown, title: string) => unknown;
|
|
64
|
+
get?: (session: unknown) => {
|
|
65
|
+
title?: unknown;
|
|
66
|
+
source?: unknown;
|
|
67
|
+
} | undefined;
|
|
64
68
|
} | undefined, active: ActiveSessionInfo, summary?: string): {
|
|
65
69
|
ok: true;
|
|
66
70
|
title: string;
|
|
71
|
+
kept?: false;
|
|
72
|
+
} | {
|
|
73
|
+
ok: true;
|
|
74
|
+
title: string;
|
|
75
|
+
kept: true;
|
|
67
76
|
} | {
|
|
68
77
|
ok: false;
|
|
69
78
|
reason: string;
|
package/lib/trajectory/core.d.ts
CHANGED
|
@@ -310,6 +310,59 @@ export declare function sanitizeSessionSummary(summary: string): string;
|
|
|
310
310
|
* @returns `S143-2026-08-26-概括` / `S143-2026-08-26` / 原目录名
|
|
311
311
|
*/
|
|
312
312
|
export declare function namingTitleFor(active: ActiveSessionInfo, summary?: string): string;
|
|
313
|
+
/**
|
|
314
|
+
* 是否应当**跳过**重命名(用户手改过的标题优先级最高,不覆盖)。
|
|
315
|
+
*
|
|
316
|
+
* ## 需求来源(owner 2026-11-25 原话)
|
|
317
|
+
*
|
|
318
|
+
* 「就是上下文交接以后我得重命名会被覆盖」「按理说自己重命名的应该是优先级最高的吧」
|
|
319
|
+
* ⇒ 用户手工起的名字**必须压过**我们按 `编号-日期-概括` 自动生成的名字。
|
|
320
|
+
*
|
|
321
|
+
* ## 为什么⛔不能直接看宿主 `source.kind === 'user'`
|
|
322
|
+
*
|
|
323
|
+
* 宿主 `sessionTitle.rename()` —— **我们自己改名走的也是它** —— 落盘的来源**恒为**
|
|
324
|
+
* `{ kind: 'user' }`(`dsh-session-title` 逐字:`session.append('session/title', { … source: { kind: 'user' } })`)。
|
|
325
|
+
* ⇒ 若把"来源=user"当作"人改的",**连我们自己每次 regenerate 都会被自己挡住**,
|
|
326
|
+
* 概要再也更新不了(那是把功能焊死,不是尊重用户)。
|
|
327
|
+
*
|
|
328
|
+
* ## 判据:认**形状**,不认来源
|
|
329
|
+
*
|
|
330
|
+
* 我们生成的标题必然以 `<S编号>-<日期>` 开头(无日期时以 `<S编号>` 开头)。
|
|
331
|
+
* ⇒ **当前标题不符合这个前缀** ⟺ 用户改过 ⟺ 不动它。
|
|
332
|
+
* ⇒ 符合前缀 ⇒ 那(几乎必然)是我们上一轮写的,允许用新概括覆盖。
|
|
333
|
+
*
|
|
334
|
+
* 🔴 **"读不到"≠"用户改过"**(2026-11-25 首次实现写错的地方):
|
|
335
|
+
* 会话**还没有标题**时(新建载体、替身服务不提供读口)⇒ 我们起**第一个**名字,
|
|
336
|
+
* 那是"命名"而不是"覆盖",**必须允许**。
|
|
337
|
+
* 把它判成"保留"会让整条命名链在服务形态不完整时**整体失效**
|
|
338
|
+
* (实证:一次错误收窄让 11 条既有用例全红,功能等于被自己焊死)。
|
|
339
|
+
*
|
|
340
|
+
* @param currentTitle 会话当前标题(`undefined`/空串 = 尚无标题)
|
|
341
|
+
* @param expectedPrefix 我们这一轮本该生成的标题前缀(`namingTitleFor` 去掉概括部分)
|
|
342
|
+
* @returns true = 跳过重命名(保留用户的名字);false = 可以写
|
|
343
|
+
*/
|
|
344
|
+
export declare function shouldKeepUserTitle(currentTitle: string | undefined, expectedPrefix: string, sourceKind?: string): boolean;
|
|
345
|
+
/**
|
|
346
|
+
* 读会话当前标题;**读口本身缺失时返回 `null`**(= 结构上无法判断,与"读到空标题"分开)。
|
|
347
|
+
*
|
|
348
|
+
* 🔴 这两种情形必须分开(2026-11-25 首次实现把它们混成一个值):
|
|
349
|
+
* - `null` ⇒ 宿主服务**没有读口** ⇒ 无法判断 ⇒ 调用方**按旧行为**直接写(不引入回归)
|
|
350
|
+
* - `''` ⇒ 读到了,但**尚无标题** ⇒ 不是覆盖 ⇒ 允许写
|
|
351
|
+
* @param titles 宿主 sessionTitle 服务对象(可能是替身/旧形态)
|
|
352
|
+
* @param session 目标会话
|
|
353
|
+
*/
|
|
354
|
+
export declare function readCurrentTitle(titles: {
|
|
355
|
+
get?: (session: unknown) => {
|
|
356
|
+
title?: unknown;
|
|
357
|
+
source?: unknown;
|
|
358
|
+
} | undefined;
|
|
359
|
+
} | undefined, session: unknown): {
|
|
360
|
+
state: 'unreadable';
|
|
361
|
+
} | {
|
|
362
|
+
state: 'ok';
|
|
363
|
+
title: string | undefined;
|
|
364
|
+
sourceKind?: string;
|
|
365
|
+
};
|
|
313
366
|
export declare function getActiveSessionInfo(scope: string): ActiveSessionInfo | null;
|
|
314
367
|
export declare function getLastActiveSessionInfo(): ActiveSessionInfo | null;
|
|
315
368
|
export declare function setActiveSessionInfo(scope: string, info: ActiveSessionInfo): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.139.
|
|
3
|
+
"version": "1.139.5",
|
|
4
4
|
"description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:13 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/localstore/container_admin/browser_slot;另两个 im-bridge/diagram 按条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/IM 桥/认知轨迹唤醒注册表 + 浏览器槽位管理(≤20 个独立 profile 的 Chrome 槽位,带占用归属与异常时向所属会话反向注入提醒)。轨迹声明 = 轨迹目录下的 trajectory.json(约束面 + 旧标识 uid + CRO 机器绑定 cro.host;旧名 trajectory-constraint.json / skiff.json 仍在读取族里);轨迹提示词 = 轨迹目录下的 PROMPT.md(一条轨迹「是谁、按什么章程工作」,所有轨迹通用,追加在容器层与质量层之后,不替换它们)。适配 DSH 0.1.7-rc.1 / 0.2.0-rc.1 / 0.2.1-rc.1(三档)。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|