@shgroup/dsh-serenity-hooks 1.25.6 → 1.25.8
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/index.js +71 -4
- 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.25.
|
|
3
|
+
"version": "1.25.8",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"description": "宁静号 ACC harness(Native Cordis 插件):真实 DSH 工具 cc_fs/session/acc_msm/eap/neat/cce/handyman/session_rebuild/skiff_admin + 拦截缝机械约束(safe-mode/路径守卫)+ 高级设定面板(双端口网关/账号管理)+ Skiff 认知子集角色(实验性)。适配 DSH 公开版(0.1.0-rc,deepseek-ai/deepseek-harness)。",
|
|
6
6
|
"engines": {
|
package/lib/index.js
CHANGED
|
@@ -9418,7 +9418,7 @@ async function discoverCccs(ctx, defaultRoot) {
|
|
|
9418
9418
|
}
|
|
9419
9419
|
/** 问答页 HTML:CCC 切换器 + 角色下拉 + 输入 + 答案区 + 轨迹区(JS 渲染)+ WebUI 链接 */
|
|
9420
9420
|
function skiffDebugPage(cccs, defaultRoot, webPort) {
|
|
9421
|
-
const data = JSON.stringify(cccs);
|
|
9421
|
+
const data = JSON.stringify(cccs).replace(/</g, "\\u003c");
|
|
9422
9422
|
return `<!DOCTYPE html>
|
|
9423
9423
|
<html lang="zh">
|
|
9424
9424
|
<head>
|
|
@@ -9440,8 +9440,23 @@ function skiffDebugPage(cccs, defaultRoot, webPort) {
|
|
|
9440
9440
|
textarea { min-height: 72px; resize: vertical; }
|
|
9441
9441
|
button { margin-top: 12px; padding: 9px 18px; border-radius: 8px; border: 0; background: #0ba875; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
|
|
9442
9442
|
button:disabled { opacity: .55; cursor: wait; }
|
|
9443
|
-
#answer {
|
|
9443
|
+
#answer { background: #fff; border: 1px solid #d0d7de; border-radius: 8px; padding: 12px; margin-top: 16px; font-size: 14px; line-height: 1.6; min-height: 48px; word-break: break-word; }
|
|
9444
9444
|
@media (prefers-color-scheme: dark) { #answer { background: #26282c; border-color: #3a3d42; } }
|
|
9445
|
+
/* Markdown 渲染(v1.25.8):代码/标题/列表/引用/think 折叠 */
|
|
9446
|
+
#answer p { margin: 6px 0; }
|
|
9447
|
+
#answer h1, #answer h2, #answer h3 { margin: 12px 0 6px; font-size: 15px; line-height: 1.4; }
|
|
9448
|
+
#answer h1 { font-size: 17px; }
|
|
9449
|
+
#answer code { background: rgba(127,127,127,.14); border-radius: 4px; padding: 1px 5px; font-size: 13px; font-family: ui-monospace, SFMono-Regular, monospace; }
|
|
9450
|
+
#answer pre { background: rgba(127,127,127,.1); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 8px 0; }
|
|
9451
|
+
#answer pre code { background: none; padding: 0; font-size: 13px; line-height: 1.5; }
|
|
9452
|
+
#answer ul, #answer ol { margin: 6px 0; padding-left: 22px; }
|
|
9453
|
+
#answer li { margin: 2px 0; }
|
|
9454
|
+
#answer blockquote { margin: 6px 0; padding: 2px 12px; border-left: 3px solid rgba(127,127,127,.35); opacity: .88; }
|
|
9455
|
+
#answer a { color: #0ba875; text-decoration: underline; }
|
|
9456
|
+
details.think { margin: 8px 0; border: 1px solid rgba(210,153,34,.4); border-radius: 8px; background: rgba(210,153,34,.06); }
|
|
9457
|
+
details.think summary { cursor: pointer; padding: 6px 10px; font-size: 12px; color: #d29922; font-weight: 600; user-select: none; list-style-position: inside; }
|
|
9458
|
+
details.think summary:hover { opacity: .8; }
|
|
9459
|
+
details.think .think-body { padding: 2px 12px 10px; font-size: 13px; opacity: .78; white-space: normal; }
|
|
9445
9460
|
#trajectory { margin-top: 12px; font-size: 13px; }
|
|
9446
9461
|
.t-entry { border-left: 2px solid #d0d7de; padding: 6px 10px; margin: 6px 0; border-radius: 0 6px 6px 0; background: rgba(127,127,127,.06); white-space: pre-wrap; word-break: break-word; }
|
|
9447
9462
|
.t-user { border-left-color: #0ba875; }
|
|
@@ -9468,7 +9483,7 @@ function skiffDebugPage(cccs, defaultRoot, webPort) {
|
|
|
9468
9483
|
<div id="trajectory"></div>
|
|
9469
9484
|
<p class="muted"><a href="${`http://127.0.0.1:${webPort}`}" target="_blank" rel="noopener">在 dsh WebUI 查看完整会话</a>(会话列表搜索 sessionId;WebUI 有完整交互)</p>
|
|
9470
9485
|
</main>
|
|
9471
|
-
<script id="skiff-data" type="application/json" data-default="${escapeHtml(defaultRoot)}">${
|
|
9486
|
+
<script id="skiff-data" type="application/json" data-default="${escapeHtml(defaultRoot)}">${data}<\/script>
|
|
9472
9487
|
<script>
|
|
9473
9488
|
const CCCS = JSON.parse(document.getElementById('skiff-data').textContent)
|
|
9474
9489
|
const defaultRoot = document.getElementById('skiff-data').dataset.default
|
|
@@ -9513,7 +9528,7 @@ btn.addEventListener('click', async () => {
|
|
|
9513
9528
|
const data = await res.json()
|
|
9514
9529
|
if (!res.ok) throw new Error(data.error || ('HTTP ' + res.status))
|
|
9515
9530
|
answer.className = ''
|
|
9516
|
-
answer.
|
|
9531
|
+
answer.innerHTML = data.answer ? renderMd(data.answer) : '(空回答)'
|
|
9517
9532
|
renderTrajectory(data.trajectory || [], data.sessionId || '')
|
|
9518
9533
|
} catch (err) {
|
|
9519
9534
|
answer.className = 'err'
|
|
@@ -9530,6 +9545,58 @@ function renderTrajectory(entries, sessionId) {
|
|
|
9530
9545
|
return '<div class="t-entry ' + cls + '"><div class="t-role">' + role + '</div>' + esc(e.text) + '</div>'
|
|
9531
9546
|
}).join('')
|
|
9532
9547
|
}
|
|
9548
|
+
/* v1.25.8 Markdown 渲染(零依赖轻量)——标题/粗斜体/行内代码/代码块/列表/引用/链接;
|
|
9549
|
+
<think>…</think> 块提取为 <details> 折叠(🧠 思考过程,默认收起) */
|
|
9550
|
+
function renderMd(src) {
|
|
9551
|
+
const thinks = []
|
|
9552
|
+
let body = String(src || '')
|
|
9553
|
+
body = body.replace(/<think>([\s\S]*?)<\/think>/gi, (_m, inner) => {
|
|
9554
|
+
const idx = thinks.length
|
|
9555
|
+
thinks.push(esc(String(inner || '').trim()))
|
|
9556
|
+
return '\u0000T' + idx + '\u0000'
|
|
9557
|
+
})
|
|
9558
|
+
const lines = body.split('\n')
|
|
9559
|
+
let html = ''
|
|
9560
|
+
let inCode = false
|
|
9561
|
+
let codeBuf = []
|
|
9562
|
+
let inList = false
|
|
9563
|
+
for (const line of lines) {
|
|
9564
|
+
// 代码围栏检测:反引号用 \u0060 转义(页面 JS 内嵌于 TS 模板字符串,裸反引号会提前终止模板)
|
|
9565
|
+
const codeMatch = line.match(/^\u0060\u0060\u0060(\w*)\s*$/)
|
|
9566
|
+
if (codeMatch) {
|
|
9567
|
+
if (inCode) { html += '<pre><code>' + esc(codeBuf.join('\n')) + '</code></pre>'; codeBuf = []; inCode = false }
|
|
9568
|
+
else inCode = true
|
|
9569
|
+
continue
|
|
9570
|
+
}
|
|
9571
|
+
if (inCode) { codeBuf.push(line); continue }
|
|
9572
|
+
const t = line.trim()
|
|
9573
|
+
if (t === '') { inList = false; continue }
|
|
9574
|
+
if (line.indexOf('\u0000T') >= 0) { html += line.replace(/\u0000T(\d+)\u0000/g, (_m2, i) => thinkHtml(thinks[Number(i)])); inList = false; continue }
|
|
9575
|
+
const h = t.match(/^(#{1,3})\s+(.*)$/)
|
|
9576
|
+
if (h) { const lvl = h[1].length; html += '<h' + lvl + '>' + inlineMd(h[2]) + '</h' + lvl + '>'; inList = false; continue }
|
|
9577
|
+
const li = t.match(/^(?:[-*]|\d+[.)])\s+(.*)$/)
|
|
9578
|
+
if (li) { if (!inList) { html += '<ul>'; inList = true } html += '<li>' + inlineMd(li[1]) + '</li>'; continue }
|
|
9579
|
+
if (inList) { html += '</ul>'; inList = false }
|
|
9580
|
+
const qt = t.match(/^>\s?(.*)$/)
|
|
9581
|
+
if (qt) { html += '<blockquote>' + inlineMd(qt[1]) + '</blockquote>'; continue }
|
|
9582
|
+
html += '<p>' + inlineMd(line) + '</p>'
|
|
9583
|
+
}
|
|
9584
|
+
if (inCode) html += '<pre><code>' + esc(codeBuf.join('\n')) + '</code></pre>'
|
|
9585
|
+
if (inList) html += '</ul>'
|
|
9586
|
+
return html
|
|
9587
|
+
}
|
|
9588
|
+
function inlineMd(s) {
|
|
9589
|
+
let t = esc(s)
|
|
9590
|
+
// 行内代码:反引号 \u0060 转义(页面 JS 内嵌于 TS 模板字符串,裸反引号提前终止模板)
|
|
9591
|
+
t = t.replace(/[\u0060]([^\u0060]+)[\u0060]/g, '<code>$1</code>')
|
|
9592
|
+
t = t.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
|
|
9593
|
+
t = t.replace(/(^|[^*])\*([^*\n]+)\*/g, '$1<em>$2</em>')
|
|
9594
|
+
t = t.replace(/\[([^\]]+)\]\((https?:[^)\s]+)\)/g, '<a href="$2" target="_blank" rel="noopener">$1</a>')
|
|
9595
|
+
return t
|
|
9596
|
+
}
|
|
9597
|
+
function thinkHtml(inner) {
|
|
9598
|
+
return '<details class="think"><summary>🧠 思考过程</summary><div class="think-body">' + (inner ? inner.replace(/\n/g, '<br>') : '(空)') + '</div></details>'
|
|
9599
|
+
}
|
|
9533
9600
|
<\/script>
|
|
9534
9601
|
</body>
|
|
9535
9602
|
</html>`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.8",
|
|
4
4
|
"description": "宁静号 ACC harness — Native Cordis 插件(DeepSeek Harness 运行时)。真实 DSH 工具注册(cc_fs/session/acc_msm 等 9 工具)+ 拦截缝机械约束(safe-mode/路径守卫/会话落盘)+ 系统提示词注入(ACC/CCE/Constraints/SKILL/Session 五块)。适配 DSH 公开版(deepseek-ai/deepseek-harness 0.1.0-rc)。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|