dsh-skill-pool 0.3.8 → 0.4.0

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/CONTRACTS-v3.md CHANGED
@@ -66,7 +66,6 @@
66
66
  "settings": {
67
67
  "enabled": true, // 总开关;false 时完全不干预任何会话
68
68
  "mcpGate": true, // MCP 命名空间门控
69
- "injectSummary": true, // 是否注入系统提示摘要
70
69
  "gateDefaultSkills": false // 是否连系统自带技能一起严格隐藏(默认关)
71
70
  },
72
71
  "skills": {
package/README.md CHANGED
@@ -134,7 +134,7 @@ plugin_manager(action: "install_bundle", target: "/path/to/dsh-skill-pool-0.3.8.
134
134
  > 不要用 `link:` / 软链安装:Host 在 profile 目录下按 importer 路径做包解析,
135
135
  > 软链会让 `@deepseek-ai/dsh-tools` 解析到 profile 之外而启动失败(`ERR_MODULE_NOT_FOUND`)。
136
136
 
137
- 配置项(`cordis.patch.yml` 的 `config`):`file`(状态文件路径)、`promptLanguage`(`zh`/`en`)、
137
+ 配置项(`cordis.patch.yml` 的 `config`):`file`(状态文件路径)、
138
138
  `enabled`(插件级总开关)。插件级 `enabled=false` 是刻意的"不门控":此时状态文件损坏不会阻止新 Agent
139
139
  创建(面板与状态工具仍会报告文件错误)。
140
140
 
@@ -153,7 +153,7 @@ plugin_manager(action: "install_bundle", target: "/path/to/dsh-skill-pool-0.3.8.
153
153
  ```jsonc
154
154
  {
155
155
  "version": 4,
156
- "settings": { "enabled": true, "mcpGate": true, "injectSummary": true, "gateDefaultSkills": false },
156
+ "settings": { "enabled": true, "mcpGate": true, "gateDefaultSkills": false },
157
157
  "groups": {
158
158
  "repo:larksuite/cli": { "key": "repo:larksuite/cli", "kind": "repo", "enabled": true, "modes": ["standard"], "workspaces": [] }
159
159
  },
package/client.js CHANGED
@@ -211,8 +211,6 @@ window.__ModuleLoader__.load({
211
211
  setEnabledHint: '关闭后完全不干预任何会话。',
212
212
  setMcpGate: 'MCP 门控',
213
213
  setMcpGateHint: '隐藏未命中条件的 MCP 工具。',
214
- setInjectSummary: '注入资源摘要',
215
- setInjectSummaryHint: '在系统提示中说明可用技能与 MCP。',
216
214
  setGateDefaultSkills: '系统技能严格隐藏',
217
215
  setGateDefaultSkillsHint: '暂未启用(系统技能始终可用)。',
218
216
  stateFile: '状态文件',
@@ -411,8 +409,6 @@ window.__ModuleLoader__.load({
411
409
  setEnabledHint: 'Off leaves every session completely untouched.',
412
410
  setMcpGate: 'MCP gate',
413
411
  setMcpGateHint: 'Hide the tools of MCP servers that do not match.',
414
- setInjectSummary: 'Inject resource summary',
415
- setInjectSummaryHint: 'State the available skills and MCP servers in the system prompt.',
416
412
  setGateDefaultSkills: 'Strictly hide system skills',
417
413
  setGateDefaultSkillsHint: 'Not enabled yet (system skills are always available).',
418
414
  stateFile: 'State file',
@@ -450,7 +446,6 @@ window.__ModuleLoader__.load({
450
446
  const DEFAULT_SETTINGS = Object.freeze({
451
447
  enabled: true,
452
448
  mcpGate: true,
453
- injectSummary: true,
454
449
  gateDefaultSkills: false,
455
450
  })
456
451
  const EMPTY_INVENTORY = Object.freeze({
@@ -649,7 +644,6 @@ window.__ModuleLoader__.load({
649
644
  return {
650
645
  enabled: source.enabled !== false,
651
646
  mcpGate: source.mcpGate !== false,
652
- injectSummary: source.injectSummary !== false,
653
647
  gateDefaultSkills: source.gateDefaultSkills === true,
654
648
  }
655
649
  }
@@ -3983,13 +3977,6 @@ window.__ModuleLoader__.load({
3983
3977
  disabled: savingSettings,
3984
3978
  onChange: (value) => void saveSettings({ mcpGate: value }),
3985
3979
  }),
3986
- h(SwitchRow, {
3987
- label: TEXT.setInjectSummary,
3988
- hint: TEXT.setInjectSummaryHint,
3989
- checked: settings.injectSummary === true,
3990
- disabled: savingSettings,
3991
- onChange: (value) => void saveSettings({ injectSummary: value }),
3992
- }),
3993
3980
  h(SwitchRow, {
3994
3981
  label: `${TEXT.setGateDefaultSkills} · ${TEXT.notAvailable}`,
3995
3982
  hint: TEXT.setGateDefaultSkillsHint,
package/index.js CHANGED
@@ -52,20 +52,18 @@ const VERSION = (() => {
52
52
  /** Schemastery schema surfaced by `Config.listConfigs` and the profile patch. */
53
53
  export const Config = z.object({
54
54
  file: z.string().default('').description('Absolute state file path; empty uses $DSH_HOME/resource-pool/state.json.'),
55
- promptLanguage: z.string().default('zh').description("Language of the injected pool summary: 'zh' | 'en'."),
56
55
  enabled: z.boolean().default(true).description('Master switch; false keeps the panel but never gates a session.'),
57
56
  })
58
57
 
59
58
  /**
60
59
  * Mount the plugin.
61
60
  * @param {import('@deepseek-ai/cordis').Context} ctx - plugin context.
62
- * @param {{ file?: string, promptLanguage?: string, enabled?: boolean }} [config] - validated configuration.
61
+ * @param {{ file?: string, enabled?: boolean }} [config] - validated configuration.
63
62
  */
64
63
  export function apply(ctx, config = {}) {
65
64
  const logger = ctx.logger ?? undefined
66
65
  const file = typeof config.file === 'string' && config.file.trim().length > 0 ? config.file.trim() : statePath()
67
66
  const store = new StateStore({ file, logger, version: VERSION })
68
- const promptLanguage = config.promptLanguage === 'en' ? 'en' : 'zh'
69
67
  const masterEnabled = config.enabled !== false
70
68
 
71
69
  /** Read the stored document with fail-closed validation (diagnostics too). */
@@ -93,9 +91,9 @@ export function apply(ctx, config = {}) {
93
91
  return readStoredState()
94
92
  }
95
93
 
96
- const activation = createActivation({ ctx, getState, logger, promptLanguage: () => promptLanguage })
94
+ const activation = createActivation({ ctx, getState, logger })
97
95
 
98
- const meta = { version: VERSION, file, pluginName: 'dsh-skill-pool', promptLanguage }
96
+ const meta = { version: VERSION, file, pluginName: 'dsh-skill-pool' }
99
97
 
100
98
  // Apply to existing Agents too: a plugin reload must not leave live sessions
101
99
  // ungated until they are recreated.
@@ -184,7 +182,6 @@ export function apply(ctx, config = {}) {
184
182
  plugin: 'dsh-skill-pool',
185
183
  version: VERSION,
186
184
  stateFile: file,
187
- promptLanguage,
188
185
  masterEnabled,
189
186
  stateStatus: {
190
187
  ok: false,
@@ -204,7 +201,6 @@ export function apply(ctx, config = {}) {
204
201
  plugin: 'dsh-skill-pool',
205
202
  version: VERSION,
206
203
  stateFile: file,
207
- promptLanguage,
208
204
  masterEnabled,
209
205
  stateStatus: { ok: true },
210
206
  mode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-skill-pool",
3
- "version": "0.3.8",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "One pool for all your DSH skills: import from files, ZIP, GitHub or GitLab, then scope each skill to Agent modes and workspaces from the Settings panel — no code editing required.",
6
6
  "license": "MIT",
package/src/activation.js CHANGED
@@ -29,8 +29,6 @@ import { librarySkillsRoot } from './library.js'
29
29
  import { createLibraryProvider } from './provider.js'
30
30
  import { isAmbiguousMcpToolName, mcpServerOf, MCP_TOOL_PREFIX, resolvePool } from './rules.js'
31
31
 
32
- const SECTION_NAME = 'resource-pool:active'
33
-
34
32
  /** Labels of effects that restrict the MCP tool surface (normal or fallback). */
35
33
  const RESTRICT_LABELS = new Set(['mcp-restrict', 'mcp-restrict-fallback'])
36
34
 
@@ -97,69 +95,16 @@ export function workspaceOf(agent) {
97
95
  return process.cwd()
98
96
  }
99
97
 
100
- /** Chinese prompt summary. */
101
- function summaryTextZh({ mode, cwd, skillNames, servers, skillGated, mcpGated }) {
102
- const lines = ['## 技能池已激活', '', `Agent 模式:\`${mode}\`,工作区:\`${cwd}\`。`]
103
- if (skillGated) {
104
- lines.push(
105
- skillNames.length > 0
106
- ? `技能池在本会话提供了这些技能:${skillNames.join('、')}。`
107
- : '技能池在本会话没有提供任何技能。',
108
- )
109
- }
110
- if (mcpGated) {
111
- if (servers.length > 0) {
112
- // The authoritative list of admitted connections: every other MCP tool
113
- // is hidden in this session.
114
- lines.push(`本会话可用的 MCP 连接只有:${servers.join('、')};其它 MCP 工具已被隐藏。`)
115
- } else {
116
- lines.push('本会话没有任何可用 MCP 连接;所有 MCP 工具已被隐藏。')
117
- }
118
- }
119
- lines.push(
120
- '未列出的技能池资源在本模式/工作区下确实不可用:不要尝试调用,也不要凭记忆复述它们的内容。',
121
- '如果任务确实需要某个不可用的资源,请让用户在「设置 → 技能池」里为它加上当前的 Agent 模式或工作区条件。',
122
- )
123
- return lines.join('\n')
124
- }
125
-
126
- /** English prompt summary. */
127
- function summaryTextEn({ mode, cwd, skillNames, servers, skillGated, mcpGated }) {
128
- const lines = ['## Resource pool active', '', `Agent mode \`${mode}\`, workspace \`${cwd}\`.`]
129
- if (skillGated) {
130
- lines.push(
131
- skillNames.length > 0
132
- ? `The resource pool supplies these skills in this session: ${skillNames.join(', ')}.`
133
- : 'The resource pool supplies no skills in this session.',
134
- )
135
- }
136
- if (mcpGated) {
137
- if (servers.length > 0) {
138
- lines.push(
139
- `The only MCP connections available in this session are: ${servers.join('; ')}; every other MCP tool is hidden.`,
140
- )
141
- } else {
142
- lines.push('No MCP connections are available in this session; all MCP tools are hidden.')
143
- }
144
- }
145
- lines.push(
146
- 'Resource-pool resources that are not listed are genuinely unavailable in this mode/workspace: do not try to call them and do not recall their content from memory.',
147
- 'If a task really needs an unavailable resource, ask the user to add the current Agent mode or workspace to its condition in Settings → Resource pool.',
148
- )
149
- return lines.join('\n')
150
- }
151
-
152
98
  /**
153
99
  * Create the activation manager.
154
100
  * @param {object} options - manager options.
155
101
  * @param {object} options.ctx - plugin context.
156
102
  * @param {(fresh?: boolean) => Promise<object>} options.getState - read the current document.
157
103
  * @param {{ debug?: Function, warn?: Function }} [options.logger] - logger.
158
- * @param {() => string} [options.promptLanguage] - 'zh' | 'en'.
159
104
  * @param {() => string} [options.libraryRoot] - library skills root override.
160
105
  * @returns {object} manager with applyToAgent/reapplyAll/disposeAgent/disposeAll.
161
106
  */
162
- export function createActivation({ ctx, getState, logger, promptLanguage = () => 'zh', libraryRoot = () => librarySkillsRoot() }) {
107
+ export function createActivation({ ctx, getState, logger, libraryRoot = () => librarySkillsRoot() }) {
163
108
  /** @type {WeakMap<object, {disposers: {dispose: Function, label: string}[], signature: string, activated: boolean, chain: Promise<void>}>} */
164
109
  const agents = new WeakMap()
165
110
 
@@ -672,33 +617,6 @@ export function createActivation({ ctx, getState, logger, promptLanguage = () =>
672
617
  }
673
618
  }
674
619
 
675
- const systemPrompt = ctx.get('systemPrompt')
676
- if (
677
- settings.injectSummary !== false &&
678
- pool.gated &&
679
- systemPrompt !== undefined &&
680
- typeof systemPrompt.getSectionOrder === 'function'
681
- ) {
682
- const skillNames = allowedSkills.size > 0 ? [...allowedSkills].sort() : []
683
- const summary = (promptLanguage() === 'en' ? summaryTextEn : summaryTextZh)({
684
- mode,
685
- cwd,
686
- skillNames,
687
- servers,
688
- skillGated: pool.gateSkills,
689
- mcpGated: pool.gateMcp,
690
- })
691
- addEffect(
692
- () =>
693
- agent.ctx.systemPrompt.section({
694
- name: SECTION_NAME,
695
- order: systemPrompt.getSectionOrder('TOOL_READ') - 30,
696
- text: summary,
697
- }),
698
- 'summary',
699
- )
700
- }
701
-
702
620
  if (!pool.gateMcp) {
703
621
  // Explicit no-gate intent: release every layer, including names that
704
622
  // are not currently visible.
package/src/store.js CHANGED
@@ -80,7 +80,7 @@ export const GIT_PROVIDERS = ['github', 'gitlab']
80
80
  export const CHECK_STATUSES = ['up-to-date', 'update-available', 'error']
81
81
 
82
82
  /** Switches the panel may patch. */
83
- export const SETTING_KEYS = ['enabled', 'mcpGate', 'injectSummary', 'gateDefaultSkills']
83
+ export const SETTING_KEYS = ['enabled', 'mcpGate', 'gateDefaultSkills']
84
84
 
85
85
  /** Conservative identifier grammar for resource names and mode ids. */
86
86
  const NAME_RE = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$/
@@ -193,7 +193,7 @@ function cleanSubdir(value) {
193
193
 
194
194
  /** Default settings of a fresh document (§2.1). */
195
195
  export function defaultSettings() {
196
- return { enabled: true, mcpGate: true, injectSummary: true, gateDefaultSkills: false }
196
+ return { enabled: true, mcpGate: true, gateDefaultSkills: false }
197
197
  }
198
198
 
199
199
  /** A fresh, empty document. */
@@ -517,7 +517,6 @@ function migrateV3(source) {
517
517
  const settings = {
518
518
  enabled: rawSettings.enabled !== false,
519
519
  mcpGate: rawSettings.mcpGate !== false,
520
- injectSummary: rawSettings.injectSummary !== false,
521
520
  gateDefaultSkills: rawSettings.gateDefaultSkills === true,
522
521
  }
523
522
  const sources = {}
@@ -582,7 +581,6 @@ export function normalizeState(raw) {
582
581
  const settings = {
583
582
  enabled: rawSettings.enabled !== false,
584
583
  mcpGate: rawSettings.mcpGate !== false,
585
- injectSummary: rawSettings.injectSummary !== false,
586
584
  gateDefaultSkills: rawSettings.gateDefaultSkills === true,
587
585
  }
588
586
 
package/src/web-api.js CHANGED
@@ -670,7 +670,7 @@ export function registerWebApi({ ctx, store, meta, onChanged, logger, mountProbe
670
670
  const body = await readBody(request)
671
671
  const patch = isObject(body.patch) ? body.patch : isObject(body.settings) ? body.settings : null
672
672
  if (patch === null) return failure('resource-pool/bad-settings', '缺少 patch 对象')
673
- for (const key of ['enabled', 'mcpGate', 'injectSummary', 'gateDefaultSkills']) {
673
+ for (const key of ['enabled', 'mcpGate', 'gateDefaultSkills']) {
674
674
  if (patch[key] !== undefined && typeof patch[key] !== 'boolean') {
675
675
  return failure('resource-pool/bad-settings', `${key} 必须是布尔值`)
676
676
  }