dsh-maoying 0.1.8 → 0.1.9
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/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/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
|