dsh-maoying 0.1.8 → 0.1.10
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/index.mjs +22 -2
- package/lib/base.css +1 -1
- package/lib/client.js +14 -2
- package/package.json +1 -1
- package/presets/maoying/agent.cordis.v2.yml +4 -0
package/index.mjs
CHANGED
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
|
|
54
54
|
import { closeSync, copyFileSync, existsSync, mkdirSync, openSync, readdirSync, readFileSync, readSync, rmSync, writeFileSync } from 'node:fs'
|
|
55
55
|
import { createHash } from 'node:crypto'
|
|
56
|
+
import { pathToFileURL } from 'node:url'
|
|
56
57
|
import { readFile } from 'node:fs/promises'
|
|
57
58
|
import { createRequire } from 'node:module'
|
|
58
59
|
import os from 'node:os'
|
|
@@ -459,6 +460,24 @@ export function parsePresetRows(yaml, agentCordisV2Text) {
|
|
|
459
460
|
* reason 区分 'yaml-unavailable' / 'compose-failed'),由调用方走既有的「只落
|
|
460
461
|
* 文件、跳过声明行并 warn、下次自愈」分支。
|
|
461
462
|
*/
|
|
463
|
+
/**
|
|
464
|
+
* preset 声明行里的本地插件名换成 file:// 绝对地址。相对名按「声明方 baseUrl」
|
|
465
|
+
* 解析——home 托管块的声明基座在宿主 asar 内部,'./x.mjs' 在桌面应用里永远
|
|
466
|
+
* 落空(注册表审计报 never started,0.1.8 host-debug 实测坐实)。Node ESM 对
|
|
467
|
+
* file:// URL 是合法模块说明符,指向 <home>/.agent-presets/maoying/ 安装副本
|
|
468
|
+
* (真实文件系统,任何进程可读)。
|
|
469
|
+
*/
|
|
470
|
+
function absolutizeLocalPluginNames(rows, presetDir) {
|
|
471
|
+
for (const row of rows ?? []) {
|
|
472
|
+
for (const p of row?.config?.plugins ?? []) {
|
|
473
|
+
if (typeof p?.name === 'string' && p.name.startsWith('./')) {
|
|
474
|
+
p.name = pathToFileURL(path.join(presetDir, p.name.slice(2))).href
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
return rows
|
|
479
|
+
}
|
|
480
|
+
|
|
462
481
|
export function composeManagedRows(home, logger = console) {
|
|
463
482
|
const hostVersion = readHostVersion(home)
|
|
464
483
|
const useV2 = hostVersion !== null && hostRejectsInlineDelegation(hostVersion)
|
|
@@ -466,16 +485,17 @@ export function composeManagedRows(home, logger = console) {
|
|
|
466
485
|
const yaml = loadYamlLib(home)
|
|
467
486
|
if (!yaml) return { shape, rows: null, hostVersion, yaml: null, reason: 'yaml-unavailable' }
|
|
468
487
|
try {
|
|
488
|
+
const installedDir = path.join(home, '.agent-presets', PRESET_ID)
|
|
469
489
|
if (useV2) {
|
|
470
490
|
const text = readFileSync(path.join(PLUGIN_ROOT, 'presets', PRESET_ID, AGENT_CORDIS_V2_FILE), 'utf8')
|
|
471
|
-
return { shape, rows: parsePresetRows(yaml, text), hostVersion, yaml, reason: null }
|
|
491
|
+
return { shape, rows: absolutizeLocalPluginNames(parsePresetRows(yaml, text), installedDir), hostVersion, yaml, reason: null }
|
|
472
492
|
}
|
|
473
493
|
const sourceDir = path.join(PLUGIN_ROOT, 'presets', PRESET_ID)
|
|
474
494
|
const meta = parsePresetMeta(yaml, readFileSync(path.join(sourceDir, 'preset.yml'), 'utf8'))
|
|
475
495
|
const plugins = parseAgentPlugins(yaml, readFileSync(path.join(sourceDir, 'agent.cordis.yml'), 'utf8'))
|
|
476
496
|
// rows 统一为 insert 列表(stringifyManagedBlock 据此渲染同一 - insert: 结构;
|
|
477
497
|
// 与 v1 历史产物逐字节同形,老 home 升级零抖动)
|
|
478
|
-
return { shape, rows: buildPresetRow({ meta, plugins }).insert, hostVersion, yaml, reason: null }
|
|
498
|
+
return { shape, rows: absolutizeLocalPluginNames(buildPresetRow({ meta, plugins }).insert, installedDir), hostVersion, yaml, reason: null }
|
|
479
499
|
} catch (err) {
|
|
480
500
|
logger.warn?.(`maoying-installer: 组合源解析失败(${shape} 形态,已跳过声明行): ${err?.message ?? err}`)
|
|
481
501
|
return { shape, rows: null, hostVersion, yaml, reason: 'compose-failed' }
|
package/lib/base.css
CHANGED
|
@@ -573,7 +573,7 @@ html[data-dsh-maoying-active]:not([data-dsh-mnemon-active]):not([data-dsh-taskbo
|
|
|
573
573
|
.myt-fsCard { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 12px; background: var(--dsw-alias-bg-layer-3); }
|
|
574
574
|
.myt-fsTitle { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-primary); overflow-wrap: anywhere; }
|
|
575
575
|
.myt-fsMeta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11px; color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; }
|
|
576
|
-
.myt-fsNotes { font-size: 11px; line-height: 16px; color: var(--dsw-alias-label-tertiary); overflow
|
|
576
|
+
.myt-fsNotes { font-size: 11px; line-height: 16px; color: var(--dsw-alias-label-tertiary); overflow-wrap: anywhere; }
|
|
577
577
|
.myt-fsActions { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
578
578
|
.myt-fsActions .myt-btn { padding: 2px 8px; font-size: 11px; line-height: 16px; }
|
|
579
579
|
|
package/lib/client.js
CHANGED
|
@@ -712,6 +712,18 @@ window.__ModuleLoader__.load({
|
|
|
712
712
|
ic(open ? "IconChevronDownOutlineRegular" : "IconChevronRightOutlineRegular", 14))),
|
|
713
713
|
open ? h("pre", { className: "myt-outlineBody" }, body) : null);
|
|
714
714
|
}
|
|
715
|
+
// 抽屉/弹层专用 Portal:面板容器挂在宿主会话中栏里,中栏的 transform/
|
|
716
|
+
// overflow 会把 position:fixed 劫持成相对自身并连同裁剪——抽屉渲染了也
|
|
717
|
+
// 看不见(桌面端「点了没反应」实测病灶)。挂 document.body 后 fixed 恒
|
|
718
|
+
// 等于视口、z-index 直接对齐文档层。老宿主无 createPortal 退回原地渲染。
|
|
719
|
+
function MaskPortal(props) {
|
|
720
|
+
var node = h("div", props);
|
|
721
|
+
if (ReactDOMClient && typeof ReactDOMClient.createPortal === "function" && typeof document !== "undefined" && document.body) {
|
|
722
|
+
return ReactDOMClient.createPortal(node, document.body);
|
|
723
|
+
}
|
|
724
|
+
return node;
|
|
725
|
+
}
|
|
726
|
+
|
|
715
727
|
function ChaptersTab(props) {
|
|
716
728
|
var snap = props.snap;
|
|
717
729
|
var reload = props.reload;
|
|
@@ -814,7 +826,7 @@ window.__ModuleLoader__.load({
|
|
|
814
826
|
h("td", null, h("div", { className: "myt-summaryCell myt-muted" }, orDash(ch.summary))));
|
|
815
827
|
}))))
|
|
816
828
|
: (chapters.length ? h(Empty, { text: "该状态下没有章节" }) : h(Empty, { text: "chapters/ 目录还没有章节文件" })),
|
|
817
|
-
openFile ? h(
|
|
829
|
+
openFile ? h(MaskPortal, {
|
|
818
830
|
className: "myt-drawerMask",
|
|
819
831
|
onMouseDown: function (e) { if (e.target === e.currentTarget) setOpenFile(null); },
|
|
820
832
|
},
|
|
@@ -878,7 +890,7 @@ window.__ModuleLoader__.load({
|
|
|
878
890
|
c.personality ? h("div", { className: "myt-charLine" }, h("span", { className: "myt-charLabel" }, "性格 "), truncate(c.personality, 60)) : null,
|
|
879
891
|
c.motivation ? h("div", { className: "myt-charLine" }, h("span", { className: "myt-charLabel" }, "动机 "), truncate(c.motivation, 60)) : null);
|
|
880
892
|
})) : h(Empty, { text: "characters/ 目录还没有角色卡" }),
|
|
881
|
-
modal ? h(
|
|
893
|
+
modal ? h(MaskPortal, {
|
|
882
894
|
className: "myt-modalMask",
|
|
883
895
|
onMouseDown: function (e) { if (e.target === e.currentTarget) setModalFile(null); },
|
|
884
896
|
},
|
package/package.json
CHANGED
|
@@ -393,6 +393,8 @@
|
|
|
393
393
|
name: "@deepseek-ai/dsh-tool-ask-user"
|
|
394
394
|
- id: tool-todo
|
|
395
395
|
name: "@deepseek-ai/dsh-tool-todo"
|
|
396
|
+
config:
|
|
397
|
+
allowParallelInProgress: true
|
|
396
398
|
# ── 角色 preset:设定管理员(continuable)─────────────────────────────────
|
|
397
399
|
# persona 逐字复制 v1 delegation-lore;工具面同大纲师。
|
|
398
400
|
- id: preset-maoying-lore
|
|
@@ -491,3 +493,5 @@
|
|
|
491
493
|
name: "@deepseek-ai/dsh-tool-ask-user"
|
|
492
494
|
- id: tool-todo
|
|
493
495
|
name: "@deepseek-ai/dsh-tool-todo"
|
|
496
|
+
config:
|
|
497
|
+
allowParallelInProgress: true
|