dsh-prompt-customizer 0.3.0 → 0.3.1

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.
@@ -1,31 +1,33 @@
1
- /** Tools preview: read-only whitelist-style list of the tools the current
2
- * preset will inject (the FINAL model-visible catalog after include/exclude).
3
- * A tool being listed means it is visible — there is no "blocked" state here.
4
- * This view never edits the blacklist/whitelist config. */
5
- import { createElement as h, type ReactElement } from 'react'
6
- import type { Translate } from './locales.ts'
7
- import { s } from './styles.ts'
8
-
9
- export type PreviewTool = { name: string; description: string } | string
10
-
11
- function norm(tool: PreviewTool): { name: string; description: string } {
12
- return typeof tool === 'string' ? { name: tool, description: '' } : tool
13
- }
14
-
15
- export function PreviewTools({ tools, t }: { tools: PreviewTool[]; t: Translate }): ReactElement {
16
- if (tools.length === 0) return h('div', { style: s.muted }, t('empty'))
17
- return h('div', { style: s.list }, [
18
- h('div', { style: s.rowTitle }, [
19
- h('span', { style: s.orderTag }, `${tools.length} ${t('previewToolCount')}`),
20
- ]),
21
- tools.map((tool) => {
22
- const { name, description } = norm(tool)
23
- return h('div', { key: name, style: s.row }, [
24
- h('div', { style: s.rowBody }, [
25
- h('div', { style: s.rowTitle }, h('span', { style: s.code }, name)),
26
- h('div', { style: s.preview }, String(description ?? '').slice(0, 140)),
27
- ]),
28
- ])
29
- }),
30
- ])
31
- }
1
+ /** 工具预览:当前定制(黑名单过滤之后)最终对模型可见的工具目录,
2
+ * 只读、清单式呈现:列出即代表模型看得见 —— 这里没有「已屏蔽」状态。
3
+ * 本视图绝不修改黑名单配置。 */
4
+ import { createElement as h, type ReactElement } from 'react'
5
+ import type { Translate } from './locales.ts'
6
+ import { s } from './styles.ts'
7
+
8
+ /** 预览工具条目:对象形态或纯字符串工具名(统一归一化为对象)。 */
9
+ export type PreviewTool = { name: string; description: string } | string
10
+
11
+ /** 把字符串形态的条目补全为 { name, description: '' }。 */
12
+
13
+ function norm(tool: PreviewTool): { name: string; description: string } {
14
+ return typeof tool === 'string' ? { name: tool, description: '' } : tool
15
+ }
16
+
17
+ export function PreviewTools({ tools, t }: { tools: PreviewTool[]; t: Translate }): ReactElement {
18
+ if (tools.length === 0) return h('div', { style: s.muted }, t('empty'))
19
+ return h('div', { style: s.list }, [
20
+ h('div', { style: s.rowTitle }, [
21
+ h('span', { style: s.orderTag }, `${tools.length} ${t('previewToolCount')}`),
22
+ ]),
23
+ tools.map((tool) => {
24
+ const { name, description } = norm(tool)
25
+ return h('div', { key: name, style: s.row }, [
26
+ h('div', { style: s.rowBody }, [
27
+ h('div', { style: s.rowTitle }, h('span', { style: s.code }, name)),
28
+ h('div', { style: s.preview }, String(description ?? '').slice(0, 140)),
29
+ ]),
30
+ ])
31
+ }),
32
+ ])
33
+ }