@jayyuen66/dsh-dir-prep-organize 0.1.12 → 0.1.13
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/CHANGELOG.md +22 -0
- package/README.md +3 -3
- package/README.zh-CN.md +3 -3
- package/client.js +80 -23
- package/host.js +15 -7
- package/package.json +16 -15
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@
|
|
|
4
4
|
[语义化版本](https://semver.org/lang/zh-CN/)。最新版本在最上。这里的偏离是刻意的:版本标题
|
|
5
5
|
不写发布日期,各版发布时间以 npm registry 为准(`npm view <包名> time` 取得到)。
|
|
6
6
|
|
|
7
|
+
## 0.1.13
|
|
8
|
+
|
|
9
|
+
market 热挂与 bundle 层双路径装载时第二份 `apply` 整份让路(此前第二遍会撞「同名服务已注册」把 fiber 打成 failed);卡片样式改用 shared 的共享 `<style>`;shared 抬到 `^0.2.9`,输入框不再撑出容器、小节内补上纵向间距;宿主 peer 窗口抬到 `^0.2.2-rc.2`。默认模板与整理行为不变。
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **单实例锁**:`apply` 最前面用 shared 的 `claimInstance` 抢 `INSTANCE_LOCK_KEY = "@jayyuen66/dsh-dir-prep-organize/instance"`,抢不到就 `console.warn` 一行「本次装配让路,设置卡与工具由在册的那一份提供」并直接返回。成因是 dshmarket 运行期热装会在 `<profile>/.dsh-market/` 下造一棵它自己的 Include 子树(条目 id 形如 `mkt-<包>`),把同一份 `host.js` 再挂一次,而 profile 的 `dsh.profile.bundles` 那条行仍会被宿主按 patch 重新组装 ⇒ 同一进程里 `apply` 跑两遍,第二遍的 Typert Remote「构造即注册」撞「同名已注册」而抛。锁随在册那一份的 fiber 卸载自动释放。
|
|
14
|
+
- **`get` 与 `reflect` 的取法有讲究**:`get` 走 `isServiceGetter` 守卫(本包的 apply 契约是「上下文只给一半也不炸」,缺 `get` 面时按能力缺席放行);`reflect` **整个传对象本身**、不另包一层 `{ provide }` —— 包出来的箭头恒是函数,会让「这台上下文根本没有注册口」伪装成「有注册口但 provide 抛错」,让路判据误判而把插件整个关掉。
|
|
15
|
+
- **回归测试 `test/routes.test.ts`** 新增「同一作用域第二次装配让路:不重复注册、不抛错」,判据落在 `warn` 恰好一次、`routes` / `configureCalls` / `disposers` 三者数量不变。
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- **`src/templates.ts` 的私有 `truncateCodePoints` 换成 shared 的 `lib/text` 里那一份**:按码点预算截断的语义不变(`String#slice` 数的是码元,会把 emoji 劈成半个),两处消费方(frontmatter 解析与 `sanitizeTemplateList`)现在共用同一份实现。`scripts/gen-defaults-lib.mjs` 仍带着同源镜像——它不能 import 运行期包。
|
|
20
|
+
- **`@deepseek-ai/dsh-output-retention` 进 devDependencies(`0.2.2-rc.2`,与其余 dsh 开发钉同版)**:shared 的 `lib/text` 顶层 import 了它,而本仓 `autoInstallPeers: false` 不会替 shared 装那枚 optional peer;CI 的 `--frozen-lockfile` 严格布局下解析不到,打包器把说明符当外置留在 `client.js` 里,宿主模块表给不出它(`UNRESOLVED_IMPORT` → `missed the module table`)。它只进构建期,不进 `dependencies` / `peerDependencies`,消费方不新增运行期依赖;`test/publish-manifest.test.ts` 的免检表登记它「本仓不直接按名引用、构建期解析 shared 顶层 import」这一事实。
|
|
21
|
+
- **卡片样式改用 shared 的 `ensureCardUiCss()`**:不再把 `CARD_UI_CSS` 整段拼进本仓自己的 `<style>` 标签,改为固定 id `dsh-card-ui-css` 的幂等注入 + 引用计数,本仓标签只留 `CARD_STYLES`。产物里因此同时留下 `style-tag.ts` 与它依赖的样式表(后者不能被 tree-shaking 去掉),实测 `client.js` 94,865 B(CI 严格布局口径;工作区软链布局下模块路径注释更短,本机读数为 94,781 B),比已发布的 0.1.12(93,396 B)多 1,469 B;`test/dist-size.test.ts` 的 `CLIENT_BUDGET_BYTES` 按实量上沿从 94,500 调到 97,000。
|
|
22
|
+
- **运行时依赖 shared 抬到 `^0.2.9`**;**宿主 peer 窗口 `^0.2.2-rc.1` → `^0.2.2-rc.2`**(十二枚 `@deepseek-ai/dsh*` peer 与整组 `dsh*` devDependency 一起抬),两份 README 的徽章跟着改。
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **输入控件撑出容器**(shared 侧):`.dsu-input` 是 `width:100%` + 左右各 12px padding + 1px 边框,默认 `content-box` 让每个输入框比容器宽 26px;`.dsu-form` 整棵子树现在统一 `border-box`。`src/client-styles.ts` 里那条「行头三项为什么写成复合选择器」的注释同步改口径——原来说「`.dsu-input` 的 `width:100%` 在注入顺序上晚于本表」,实际原因是**同权重**,靠复合选择器稳压它。
|
|
27
|
+
- **小节内相邻元素间距为 0**(shared 侧):`.dsu-form .dsu-section>*+*` 给 10px,`.dsu-sectionHint` 4px,`.dsu-field` 之间仍 0,`.dsu-savebar` 24px。
|
|
28
|
+
|
|
7
29
|
## 0.1.12
|
|
8
30
|
|
|
9
31
|
设置卡的下拉候选与说明浮层不再漂到浏览器最左边;shared 抬到 `^0.2.8`(含运行时几何自检),CI 的 action 钉版升到最新。默认模板与行为不变。
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<a href="https://github.com/JayYuen666/dsh-dir-prep-organize/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/JayYuen666/dsh-dir-prep-organize/ci.yml?branch=main&style=flat-square&label=ci" alt="ci" /></a>
|
|
13
13
|
<img src="https://img.shields.io/badge/license-MIT-4c1?style=flat-square" alt="MIT" />
|
|
14
14
|
<img src="https://img.shields.io/badge/node-%3E%3D24.9-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
|
|
15
|
-
<img src="https://img.shields.io/badge/dsh-%5E0.2.2--rc.
|
|
15
|
+
<img src="https://img.shields.io/badge/dsh-%5E0.2.2--rc.2-658EFF?style=flat-square" alt="dsh" />
|
|
16
16
|
<a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/powered_by_dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white" alt="powered by dsh" /></a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
@@ -72,8 +72,8 @@ dsh plugin --profile web add @jayyuen66/dsh-dir-prep-organize
|
|
|
72
72
|
Remove with `dsh plugin --profile web remove @jayyuen66/dsh-dir-prep-organize`. The package is on the public npm registry, so installation needs no credentials and no scoped-registry line.
|
|
73
73
|
|
|
74
74
|
- **Requires Node.js `>= 24.9`.** This is an ESM-only package. Use the **named** exports (`import { apply } from "@jayyuen66/dsh-dir-prep-organize"`); there is **no default export**, so `import pkg from …` fails with `does not provide an export named 'default'`. That Node floor is what makes `require()` of an ESM entry work at all, which is why `engines.node` is declared.
|
|
75
|
-
- **Requires host `dsh` on the `0.2.2-rc.
|
|
76
|
-
- **The `@deepseek-ai/dsh-*` development pins are at `0.2.2-rc.2`** - the host line this package is built and tested against. `engines.dsh` and the optional peer ranges carry the separately checked support window (`^0.2.2-rc.
|
|
75
|
+
- **Requires host `dsh` on the `0.2.2-rc.2` host line or later.** The requirement the host actually reads is `engines.dsh` (`^0.2.2-rc.2`), and it **decides alone**: `evaluatePluginCompatibility` returns on the `engines.dsh` branch before it ever looks at `peerDependencies`. Measured against the real host code: `0.2.0-rc.2`, `0.2.1-rc.5`, `0.2.2-alpha.3` and `0.2.2-rc.1` are **refused**, `0.2.2-rc.2`, `0.2.2` and `0.2.3` pass, `0.3.0` is refused. A refused host needs the explicit risk grant `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk`. The support window rolls: this package is verified against every released host version inside the window at publish time and re-verified once the window moves, so the version number in this bullet is not a standing promise.
|
|
76
|
+
- **The `@deepseek-ai/dsh-*` development pins are at `0.2.2-rc.2`** - the host line this package is built and tested against. `engines.dsh` and the optional peer ranges carry the separately checked support window (`^0.2.2-rc.2`); the pin is a fact about which host version it was *compiled* against, not a restatement of that window. Mixing the two is why the publish gate checks them separately.
|
|
77
77
|
- **No `@deepseek-ai/*` under `dependencies`, by contract** (`test/publish-manifest.test.ts` enforces it). Consumer profiles install with `nodeLinker: hoisted` and `autoInstallPeers: false`, so a host package under `dependencies` is materialized as a **real directory** next to the copy the running host already loaded. `@deepseek-ai/dsh-tools` keys its tool-runtime scheduler with a plain `Symbol` (not `Symbol.for`), so symbol identity is per module instance: the host reads the scheduler off the profile copy, gets `undefined`, and **every native tool call throws** - while this package's build, typecheck and coverage gates stay green right up to that moment.
|
|
78
78
|
- **The two host packages `host.js` imports as values are required peers**: `@deepseek-ai/schemastery` (the host's fork - only it resolves the `.volatile()` fields) and `@deepseek-ai/dsh-brand`. `build-host.mjs` externalizes `dependencies` **and** `peerDependencies`, so the bare specifiers stay in the artifact; a devDependencies-only entry would let the bundler inline the official function body. `test/build-host.test.ts` pins both "specifier present" and "function body absent".
|
|
79
79
|
- **Every host package the emitted declarations name is declared under `peerDependencies`**, and each one reached only there is *optional* (`@deepseek-ai/cordis`, `cosmokit`, and the `dsh-agent-default-model` / client-ui / `fs` / `llm` / `session` family). Declaring them is not ceremony: under pnpm's strict layout a bare specifier in `types/host.d.ts` that no manifest table names is unresolvable on the consumer's side, while this repository's own typecheck stays green. The test reads that roster off `types/**/*.d.ts` rather than off this paragraph, so the two cannot drift apart.
|
package/README.zh-CN.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<a href="https://github.com/JayYuen666/dsh-dir-prep-organize/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/JayYuen666/dsh-dir-prep-organize/ci.yml?branch=main&style=flat-square&label=ci" alt="ci" /></a>
|
|
13
13
|
<img src="https://img.shields.io/badge/license-MIT-4c1?style=flat-square" alt="MIT" />
|
|
14
14
|
<img src="https://img.shields.io/badge/node-%3E%3D24.9-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
|
|
15
|
-
<img src="https://img.shields.io/badge/dsh-%5E0.2.2--rc.
|
|
15
|
+
<img src="https://img.shields.io/badge/dsh-%5E0.2.2--rc.2-658EFF?style=flat-square" alt="dsh" />
|
|
16
16
|
<a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/powered_by_dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white" alt="powered by dsh" /></a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
@@ -72,8 +72,8 @@ dsh plugin --profile web add @jayyuen66/dsh-dir-prep-organize
|
|
|
72
72
|
卸载:`dsh plugin --profile web remove @jayyuen66/dsh-dir-prep-organize`。包在公共 npm 上,安装不需要凭据,也不需要配作用域源。
|
|
73
73
|
|
|
74
74
|
- **要求 Node.js `>= 24.9`。** 本包是纯 ESM。用**具名**导出(`import { apply } from "@jayyuen66/dsh-dir-prep-organize"`);**没有 default 导出**,所以 `import pkg from …` 会报 `does not provide an export named 'default'`。正是这个 Node 下限让 ESM 入口的 `require()` 形式可用,所以声明了 `engines.node`。
|
|
75
|
-
- **要求宿主 `dsh` 在 `0.2.2-rc.
|
|
76
|
-
- **`@deepseek-ai/dsh-*` 的开发依赖钉在 `0.2.2-rc.2`**——本包编译与测试所对着的那条宿主线。`engines.dsh` 与 optional peer 范围承载单独判读的支持窗口(`^0.2.2-rc.
|
|
75
|
+
- **要求宿主 `dsh` 在 `0.2.2-rc.2` 这条宿主线上或更晚。** 宿主真正读的是 `engines.dsh`(`^0.2.2-rc.2`),而且它**单独决定**:`evaluatePluginCompatibility` 在 `engines.dsh` 那一支就返回了,根本走不到读 `peerDependencies` 的那段。对宿主真实代码实测:`0.2.0-rc.2`、`0.2.1-rc.5`、`0.2.2-alpha.3` 与 `0.2.2-rc.1` **被拒**,`0.2.2-rc.2`、`0.2.2` 与 `0.2.3` 通过,`0.3.0` 被拒。被拒的宿主需要走显式担责的授权 `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk`。支持窗口是滚动的:本包在发布时把窗口内的每个已发布宿主版本逐版取证,窗口滚动后重新取证,不把这一句里的版本号当长期承诺。
|
|
76
|
+
- **`@deepseek-ai/dsh-*` 的开发依赖钉在 `0.2.2-rc.2`**——本包编译与测试所对着的那条宿主线。`engines.dsh` 与 optional peer 范围承载单独判读的支持窗口(`^0.2.2-rc.2`);钉版是关于「它是对着哪个宿主版本**编译**的」的事实,不是那个窗口的复述。把两者混为一谈,正是发布门禁分开检查它们的原因。
|
|
77
77
|
- **`dependencies` 里不放任何 `@deepseek-ai/*`,这是约定**(`test/publish-manifest.test.ts` 钉着)。消费方 profile 用 `nodeLinker: hoisted` 且 `autoInstallPeers: false` 安装,于是写在 `dependencies` 里的宿主包会被落成**真实目录**,与运行中的宿主已加载的那份并存。`@deepseek-ai/dsh-tools` 的工具运行期调度键是普通 `Symbol`(不是 `Symbol.for`),符号身份按模块实例算:宿主从 profile 副本上读那个键拿到 `undefined`,于是**每一次原生工具调用都抛**——而本包的构建、类型检查、覆盖率检查在此之前全部照绿。
|
|
78
78
|
- **`host.js` 按值导入的那两枚宿主包是必需 peer**:`@deepseek-ai/schemastery`(宿主 fork——只有它能把 `.volatile()` 字段解析成活引用)与 `@deepseek-ai/dsh-brand`。`build-host.mjs` 外部化 `dependencies` **与** `peerDependencies`,所以裸说明符留在产物里;只写 `devDependencies` 会让打包器把官方函数体内联进去。`test/build-host.test.ts` 同时钉「说明符在」与「函数体不在」。
|
|
79
79
|
- **声明里点到的每一枚宿主包都落在 `peerDependencies`**,凡是只能从那里到达的都是 *optional*(`@deepseek-ai/cordis`、`cosmokit`,以及 `dsh-agent-default-model` / client-ui / `fs` / `llm` / `session` 那一族)。声明它们不是仪式:pnpm 严格布局下,`types/host.d.ts` 里一枚没有被任何 manifest 表点名的裸说明符在消费方侧解析不到,而本仓自己的类型检查照样绿。那条清单由测试从 `types/**/*.d.ts` 现量读,不从这段文字读,所以两边不会漂移。
|
package/client.js
CHANGED
|
@@ -12,19 +12,24 @@ let zod = require("zod");
|
|
|
12
12
|
function e$1(e) {
|
|
13
13
|
return typeof e == `object` && !!e && !Array.isArray(e);
|
|
14
14
|
}
|
|
15
|
+
new TextEncoder();
|
|
16
|
+
new TextDecoder();
|
|
17
|
+
// node_modules/@jayyuen66/dsh-plugin-shared/dist/text.js
|
|
18
|
+
function n$2(e, t) {
|
|
19
|
+
if (t < 1 || Number.isNaN(t)) return ``;
|
|
20
|
+
let n = 0, r = 0;
|
|
21
|
+
for (let i of e) {
|
|
22
|
+
if (r >= t) break;
|
|
23
|
+
n += i.length, r += 1;
|
|
24
|
+
}
|
|
25
|
+
return e.slice(0, n);
|
|
26
|
+
}
|
|
15
27
|
// src/templates.ts
|
|
16
28
|
/** 一条提示引导词/角色模板(settings 持久化形状:全 string 字段的普通对象,
|
|
17
29
|
* 满足 dsh-settings cloneJsonShaped 的 JSON 白名单)。description/group/emoji
|
|
18
30
|
* 为必填(空串表示未设置),保证下拉与设置卡无缺字段分支。 */
|
|
19
31
|
/** 视觉标记进入下拉前缀的最大字符数。 */
|
|
20
32
|
const EMOJI_MAX_LENGTH = 12;
|
|
21
|
-
/** 按 Unicode 码点截断:`String#slice` 数的是 UTF-16 码元,会把一个 emoji(代理对)或
|
|
22
|
-
* 组合字符劈成半个,落进模板后显示成空白方块。两个截断点(frontmatter 解析与 `sanitizeTemplateList`)
|
|
23
|
-
* 共用这一份实现,scripts/gen-defaults-lib.mjs 有同源镜像。 */
|
|
24
|
-
function truncateCodePoints(value, max) {
|
|
25
|
-
const points = Array.from(value);
|
|
26
|
-
return points.length > max ? points.slice(0, max).join("") : value;
|
|
27
|
-
}
|
|
28
33
|
/** id 缺失或与已收集 id 撞名 → 确定性补 `tpl-<index>`(仍撞则追加 `-<index>` 直到唯一)。
|
|
29
34
|
* 只负责取名,不登记 `seen`——登记由调用方在装配条目时按装配顺序做。 */
|
|
30
35
|
function uniqueEntryId(candidate, index, seen) {
|
|
@@ -78,7 +83,7 @@ function normalizeEntry(item, index, seen) {
|
|
|
78
83
|
description: trimField(description),
|
|
79
84
|
text: nextText,
|
|
80
85
|
group: trimField(group),
|
|
81
|
-
emoji:
|
|
86
|
+
emoji: n$2(trimField(emoji), EMOJI_MAX_LENGTH)
|
|
82
87
|
};
|
|
83
88
|
}
|
|
84
89
|
}
|
|
@@ -409,10 +414,15 @@ const UI_MESSAGES = {
|
|
|
409
414
|
builtinRetry: "Retry"
|
|
410
415
|
}
|
|
411
416
|
};
|
|
412
|
-
// node_modules/@jayyuen66/dsh-plugin-shared/dist/card-ui-
|
|
417
|
+
// node_modules/@jayyuen66/dsh-plugin-shared/dist/card-ui-ikodobgI.js
|
|
413
418
|
const c = `
|
|
414
419
|
.dsu-form{display:flex;flex-direction:column}
|
|
420
|
+
.dsu-form,.dsu-form *,.dsu-form *::before,.dsu-form *::after{box-sizing:border-box}
|
|
415
421
|
.dsu-section{margin-top:24px;padding-top:24px;border-top:.5px solid var(--dsw-alias-border-l1)}
|
|
422
|
+
.dsu-form .dsu-section>*+*{margin-top:10px}
|
|
423
|
+
.dsu-form .dsu-section>.dsu-sectionHint{margin-top:4px}
|
|
424
|
+
.dsu-form .dsu-section>*+.dsu-field{margin-top:0}
|
|
425
|
+
.dsu-form .dsu-section>.dsu-savebar{margin-top:24px}
|
|
416
426
|
.dsu-form>.dsu-section:first-child{margin-top:0;padding-top:0;border-top:0}
|
|
417
427
|
.dsu-sectionTitle{margin:0;font-size:15px;font-weight:600;line-height:1.4;color:var(--dsw-alias-label-primary)}
|
|
418
428
|
.dsu-sectionHint{margin:4px 0 0;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}
|
|
@@ -463,8 +473,8 @@ const c = `
|
|
|
463
473
|
.dsu-optionGroup{padding:6px 10px 2px;font-size:11px;font-weight:600;color:var(--dsw-alias-label-tertiary)}
|
|
464
474
|
.dsu-check{opacity:0;flex:none}
|
|
465
475
|
.dsu-option[aria-selected="true"] .dsu-check{opacity:1}
|
|
466
|
-
.dsu-savebar{display:flex;align-items:center;gap:8px;padding:12px 0;margin-top:24px;border-top:.5px solid var(--dsw-alias-border-l2)
|
|
467
|
-
.dsu-savebar[data-dirty="true"]{position:sticky;bottom:0;z-index:2;box-shadow:0 -12px 24px rgb(0 0 0 / 35%)}
|
|
476
|
+
.dsu-savebar{display:flex;align-items:center;gap:8px;padding:12px 0;margin-top:24px;border-top:.5px solid var(--dsw-alias-border-l2)}
|
|
477
|
+
.dsu-savebar[data-dirty="true"]{position:sticky;bottom:0;z-index:2;background:var(--dsw-alias-bg-base);box-shadow:0 -12px 24px rgb(0 0 0 / 35%)}
|
|
468
478
|
.dsu-btn{appearance:none;border:.5px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:1.5;border-radius:var(--dsw-radius-md);padding:5px 14px;cursor:pointer;transition:background-color .12s,border-color .12s,color .12s,filter .12s}
|
|
469
479
|
.dsu-btn:hover:not(:disabled){background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-border-l3)}
|
|
470
480
|
.dsu-btn:active:not(:disabled){background:var(--dsw-alias-bg-layer-1)}
|
|
@@ -489,33 +499,78 @@ const c = `
|
|
|
489
499
|
.dsu-switch,.dsu-knob,.dsu-chevron,.dsu-btn{transition:none}
|
|
490
500
|
}
|
|
491
501
|
`;
|
|
492
|
-
|
|
502
|
+
const l = `dsh-card-ui-css`;
|
|
503
|
+
const u = Symbol.for(`@jayyuen66/dsh-plugin-shared/card-ui-css/refs`);
|
|
504
|
+
function d() {}
|
|
505
|
+
function f(e) {
|
|
506
|
+
if (typeof e != `object` || !e) return !1;
|
|
507
|
+
let t = Reflect.get(e, `head`);
|
|
508
|
+
return typeof Reflect.get(e, `querySelector`) == `function` && typeof Reflect.get(e, `createElement`) == `function` && typeof t == `object` && !!t && typeof Reflect.get(t, `append`) == `function`;
|
|
509
|
+
}
|
|
510
|
+
function p(e) {
|
|
511
|
+
if (e !== void 0) return f(e) ? e : void 0;
|
|
512
|
+
let t = typeof document > `u` ? void 0 : document;
|
|
513
|
+
return f(t) ? t : void 0;
|
|
514
|
+
}
|
|
515
|
+
function m(e) {
|
|
516
|
+
return typeof Reflect.get(e, `remove`) == `function`;
|
|
517
|
+
}
|
|
518
|
+
function h(e) {
|
|
519
|
+
let t = Reflect.get(e, u);
|
|
520
|
+
return typeof t == `number` && t > 0 ? t : 0;
|
|
521
|
+
}
|
|
522
|
+
function g(e) {
|
|
523
|
+
let t = e.createElement(`style`);
|
|
524
|
+
return t.id = l, t.textContent = c, e.head.append(t), t;
|
|
525
|
+
}
|
|
526
|
+
function _(e) {
|
|
527
|
+
let t = !1;
|
|
528
|
+
return () => {
|
|
529
|
+
if (t) return;
|
|
530
|
+
t = !0;
|
|
531
|
+
let n = h(e);
|
|
532
|
+
n <= 1 ? (Reflect.deleteProperty(e, u), e.remove()) : Reflect.set(e, u, n - 1);
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
function v(e) {
|
|
536
|
+
let t = p(e);
|
|
537
|
+
if (t === void 0) return d;
|
|
538
|
+
let n = t.querySelector(`#${l}`);
|
|
539
|
+
if (n != null) {
|
|
540
|
+
if (typeof n != `object` || !m(n)) return d;
|
|
541
|
+
let e = h(n);
|
|
542
|
+
return e === 0 ? d : (Reflect.set(n, u, e + 1), _(n));
|
|
543
|
+
}
|
|
544
|
+
let r = g(t);
|
|
545
|
+
return Reflect.set(r, u, 1), _(r);
|
|
546
|
+
}
|
|
547
|
+
function S(t) {
|
|
493
548
|
return (0, react.createElement)(`div`, { className: `dsu-form` }, t.children);
|
|
494
549
|
}
|
|
495
|
-
function
|
|
550
|
+
function C(t) {
|
|
496
551
|
return (0, react.createElement)(`section`, { className: `dsu-section` }, (0, react.createElement)(`h2`, { className: `dsu-sectionTitle` }, t.title), t.hint === void 0 ? null : (0, react.createElement)(`p`, { className: `dsu-sectionHint` }, t.hint), t.children);
|
|
497
552
|
}
|
|
498
|
-
function
|
|
499
|
-
let n = !t.writable || t.busy || !t.dirty, r;
|
|
500
|
-
return
|
|
553
|
+
function I(t) {
|
|
554
|
+
let n = t.blocked === !0, r = !t.writable || t.busy, i = r || !t.dirty || n, a = r || !t.dirty && !n, o;
|
|
555
|
+
return o = t.error === null ? t.writable ? t.dirty ? t.dirtyLabel : t.cleanLabel : t.readOnlyLabel : t.error, (0, react.createElement)(`div`, {
|
|
501
556
|
className: `dsu-savebar`,
|
|
502
|
-
"data-dirty": t.dirty
|
|
557
|
+
"data-dirty": t.dirty || n
|
|
503
558
|
}, (0, react.createElement)(`button`, {
|
|
504
559
|
type: `button`,
|
|
505
560
|
className: `dsu-btn dsu-btnPrimary`,
|
|
506
561
|
"data-field": `save`,
|
|
507
|
-
disabled:
|
|
562
|
+
disabled: i,
|
|
508
563
|
onClick: t.onSave
|
|
509
564
|
}, t.busy ? t.savingLabel : t.saveLabel), (0, react.createElement)(`button`, {
|
|
510
565
|
type: `button`,
|
|
511
566
|
className: `dsu-btn`,
|
|
512
567
|
"data-field": `discard`,
|
|
513
|
-
disabled:
|
|
568
|
+
disabled: a,
|
|
514
569
|
onClick: t.onDiscard
|
|
515
570
|
}, t.revertLabel), (0, react.createElement)(`span`, {
|
|
516
571
|
role: `status`,
|
|
517
572
|
className: t.error === null ? `dsu-status` : `dsu-status dsu-statusError`
|
|
518
|
-
},
|
|
573
|
+
}, o));
|
|
519
574
|
}
|
|
520
575
|
// node_modules/@jayyuen66/dsh-plugin-shared/dist/errors.js
|
|
521
576
|
function t(e) {
|
|
@@ -1964,7 +2019,7 @@ function createCardBody(view) {
|
|
|
1964
2019
|
const { onCommit, onDelete, onAdd, onImported, onRootChange, onRootDelete, onRootAdd } = view.draftActions;
|
|
1965
2020
|
const { onSave, onDiscard, onReset } = view.persistActions;
|
|
1966
2021
|
const footHint = (0, react.createElement)("p", { className: "dpic-hint" }, t("footHint"));
|
|
1967
|
-
const saveBar = (0, react.createElement)(
|
|
2022
|
+
const saveBar = (0, react.createElement)(I, {
|
|
1968
2023
|
dirty: anythingDirty,
|
|
1969
2024
|
busy,
|
|
1970
2025
|
writable: editable,
|
|
@@ -1980,7 +2035,7 @@ function createCardBody(view) {
|
|
|
1980
2035
|
},
|
|
1981
2036
|
onDiscard
|
|
1982
2037
|
});
|
|
1983
|
-
return (0, react.createElement)(
|
|
2038
|
+
return (0, react.createElement)(S, null, statusHint === "" ? null : (0, react.createElement)("p", { className: "dpic-hint" }, statusHint), (0, react.createElement)(C, {
|
|
1984
2039
|
title: t("rolesSection"),
|
|
1985
2040
|
hint: t("rolesHint")
|
|
1986
2041
|
}, (0, react.createElement)(CardToolbar, {
|
|
@@ -2149,12 +2204,14 @@ function apply(ctx) {
|
|
|
2149
2204
|
if (dirPrepReader === reader) dirPrepReader = void 0;
|
|
2150
2205
|
}, "dir-prep-organize: remote reader");
|
|
2151
2206
|
ctx.effect(() => {
|
|
2207
|
+
const disposeShared = v();
|
|
2152
2208
|
const tag = document.createElement("style");
|
|
2153
2209
|
tag.id = "dir-prep-organize-css";
|
|
2154
|
-
tag.textContent =
|
|
2210
|
+
tag.textContent = CARD_STYLES;
|
|
2155
2211
|
document.head.append(tag);
|
|
2156
2212
|
return () => {
|
|
2157
2213
|
tag.remove();
|
|
2214
|
+
disposeShared();
|
|
2158
2215
|
};
|
|
2159
2216
|
}, "dir-prep-organize: styles");
|
|
2160
2217
|
const scope = ctx.configForms.get(NS);
|
package/host.js
CHANGED
|
@@ -5,7 +5,9 @@ import { brandString } from "@deepseek-ai/dsh-brand";
|
|
|
5
5
|
import { Remote, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
6
6
|
import { LOCALE_SETTINGS_NAMESPACE, messagesFor, resolveLocalePreference } from "@jayyuen66/dsh-plugin-shared/lib/locale";
|
|
7
7
|
import { isRecord } from "@jayyuen66/dsh-plugin-shared/lib/record";
|
|
8
|
+
import { truncateCodePoints } from "@jayyuen66/dsh-plugin-shared/lib/text";
|
|
8
9
|
import { errorText } from "@jayyuen66/dsh-plugin-shared/lib/errors";
|
|
10
|
+
import { claimInstance } from "@jayyuen66/dsh-plugin-shared/lib/instance-lock";
|
|
9
11
|
// src/host-messages.ts
|
|
10
12
|
const HOST_MESSAGES = {
|
|
11
13
|
zh: {
|
|
@@ -187,13 +189,6 @@ function readFrontmatterPair(line) {
|
|
|
187
189
|
}
|
|
188
190
|
return result;
|
|
189
191
|
}
|
|
190
|
-
/** 按 Unicode 码点截断:`String#slice` 数的是 UTF-16 码元,会把一个 emoji(代理对)或
|
|
191
|
-
* 组合字符劈成半个,落进模板后显示成空白方块。两个截断点(frontmatter 解析与 `sanitizeTemplateList`)
|
|
192
|
-
* 共用这一份实现,scripts/gen-defaults-lib.mjs 有同源镜像。 */
|
|
193
|
-
function truncateCodePoints(value, max) {
|
|
194
|
-
const points = Array.from(value);
|
|
195
|
-
return points.length > max ? points.slice(0, max).join("") : value;
|
|
196
|
-
}
|
|
197
192
|
/** 键 → 目标位:防重复(已有值不覆盖,取首个同名键);emoji 截断至 EMOJI_MAX_LENGTH(按码点)。 */
|
|
198
193
|
function takeFrontmatterField(fields, key, value) {
|
|
199
194
|
if (key === "name" && fields.name === "" && value.length > 0) fields.name = value;
|
|
@@ -1618,6 +1613,11 @@ function installDirPrepRemote(ctx, scope) {
|
|
|
1618
1613
|
new DirPrepRemoteService(ctx, scope);
|
|
1619
1614
|
return true;
|
|
1620
1615
|
}
|
|
1616
|
+
/**
|
|
1617
|
+
* 单实例锁的服务名。取包名形态而**不带随机后缀**:名字必须每一份实例都算出同一个串才可能
|
|
1618
|
+
* 互斥,随机后缀等于谁都能抢到。判据与边界见 shared 的 lib/instance-lock 头注释。
|
|
1619
|
+
*/
|
|
1620
|
+
const INSTANCE_LOCK_KEY = "@jayyuen66/dsh-dir-prep-organize/instance";
|
|
1621
1621
|
/** settings 注册的占位清理(无额外拆卸动作,注册随插件生命周期存续)。 */
|
|
1622
1622
|
function noopDisposer() {}
|
|
1623
1623
|
/** host apply:登记设置页策略 + 注册官方 Remote 服务(注入子上下文,卸载即撤)。
|
|
@@ -1625,6 +1625,14 @@ function noopDisposer() {}
|
|
|
1625
1625
|
* 不再向 settings 注册任何东西;配置值由 cordis 校验并填过默认后按 volatile 引用交进来
|
|
1626
1626
|
* (第二参数 config),读当前值一律 `.get()`。 */
|
|
1627
1627
|
function apply(ctx, config) {
|
|
1628
|
+
const lockContext = {
|
|
1629
|
+
get: (name) => isServiceGetter(ctx) ? ctx.get(name) : void 0,
|
|
1630
|
+
reflect: ctx.reflect
|
|
1631
|
+
};
|
|
1632
|
+
if (!claimInstance(lockContext, INSTANCE_LOCK_KEY)) {
|
|
1633
|
+
console.warn("[dir-prep-organize] 检测到本插件已在同一作用域内装载:本次装配让路,设置卡与工具由在册的那一份提供。");
|
|
1634
|
+
return;
|
|
1635
|
+
}
|
|
1628
1636
|
const getService = (name) => {
|
|
1629
1637
|
let result;
|
|
1630
1638
|
if (isServiceGetter(ctx)) result = ctx.get(name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jayyuen66/dsh-dir-prep-organize",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "dsh 插件:对话输入框「润色」按钮(主键直接润色/▾ 以角色风格润色,结合当前目录 + session 模型润色草稿)+「模板」下拉(内置精选角色集生成自插件 agents/ 角色库,可按部门分组;设置卡可增删改/一键导入内置全部/导入本地角色 .md)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cordis",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"registry": "https://registry.npmjs.org"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@jayyuen66/dsh-plugin-shared": "^0.2.
|
|
64
|
+
"@jayyuen66/dsh-plugin-shared": "^0.2.9",
|
|
65
65
|
"zod": "4.6.7"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"@deepseek-ai/dsh-home-paths": "0.2.2-rc.2",
|
|
85
85
|
"@deepseek-ai/dsh-launch-environment": "0.2.2-rc.2",
|
|
86
86
|
"@deepseek-ai/dsh-llm": "0.2.2-rc.2",
|
|
87
|
+
"@deepseek-ai/dsh-output-retention": "0.2.2-rc.2",
|
|
87
88
|
"@deepseek-ai/dsh-sandbox": "0.2.2-rc.2",
|
|
88
89
|
"@deepseek-ai/dsh-scope": "0.2.2-rc.2",
|
|
89
90
|
"@deepseek-ai/dsh-session": "0.2.2-rc.2",
|
|
@@ -113,18 +114,18 @@
|
|
|
113
114
|
"peerDependencies": {
|
|
114
115
|
"@deepseek-ai/cordis": "^4.0.5 || ^4.0.6-alpha.2",
|
|
115
116
|
"@deepseek-ai/cosmokit": "^1.8.6 || ^1.8.7-alpha.2",
|
|
116
|
-
"@deepseek-ai/dsh": "^0.2.2-rc.
|
|
117
|
-
"@deepseek-ai/dsh-agent-default-model": "^0.2.2-rc.
|
|
118
|
-
"@deepseek-ai/dsh-brand": "^0.2.2-rc.
|
|
119
|
-
"@deepseek-ai/dsh-client-locale": "^0.2.2-rc.
|
|
120
|
-
"@deepseek-ai/dsh-client-ui-conversation": "^0.2.2-rc.
|
|
121
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.
|
|
122
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.
|
|
123
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.
|
|
124
|
-
"@deepseek-ai/dsh-fs": "^0.2.2-rc.
|
|
125
|
-
"@deepseek-ai/dsh-llm": "^0.2.2-rc.
|
|
126
|
-
"@deepseek-ai/dsh-session": "^0.2.2-rc.
|
|
127
|
-
"@deepseek-ai/dsh-typert-protocol": "^0.2.2-rc.
|
|
117
|
+
"@deepseek-ai/dsh": "^0.2.2-rc.2",
|
|
118
|
+
"@deepseek-ai/dsh-agent-default-model": "^0.2.2-rc.2",
|
|
119
|
+
"@deepseek-ai/dsh-brand": "^0.2.2-rc.2",
|
|
120
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.2-rc.2",
|
|
121
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.2.2-rc.2",
|
|
122
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.2",
|
|
123
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.2",
|
|
124
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.2",
|
|
125
|
+
"@deepseek-ai/dsh-fs": "^0.2.2-rc.2",
|
|
126
|
+
"@deepseek-ai/dsh-llm": "^0.2.2-rc.2",
|
|
127
|
+
"@deepseek-ai/dsh-session": "^0.2.2-rc.2",
|
|
128
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.2.2-rc.2",
|
|
128
129
|
"@deepseek-ai/schemastery": "^3.19.0"
|
|
129
130
|
},
|
|
130
131
|
"peerDependenciesMeta": {
|
|
@@ -170,7 +171,7 @@
|
|
|
170
171
|
},
|
|
171
172
|
"icon": "icon.svg",
|
|
172
173
|
"engines": {
|
|
173
|
-
"dsh": "^0.2.2-rc.
|
|
174
|
+
"dsh": "^0.2.2-rc.2",
|
|
174
175
|
"node": ">=24.9.0"
|
|
175
176
|
},
|
|
176
177
|
"dsh": {
|