@weibaohui/skills-management 0.3.0 → 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/client/bundle.js CHANGED
@@ -19,7 +19,8 @@ window.__ModuleLoader__.load({
19
19
  * title / hint / rows: [[label, value], ...] / initialPrompt
20
20
  * run: async (prompt) => { jobId } — 发起执行
21
21
  * poll: async (jobId) => { status, output, code }
22
- * labels: { copy, copied, run, running, done, failed, outputLabel, close }
22
+ * labels: { copy, copied, run, running, done, failed, outputLabel, openSession, close }
23
+ * onOpenSession: (sessionId) => void — 可选;job 出现 sessionId 时渲染「打开会话」
23
24
  * onClose
24
25
  *
25
26
  * 全部样式内联(主题 token + 回退值),消费者无需自带 CSS。
@@ -80,6 +81,8 @@ window.__ModuleLoader__.load({
80
81
  setJob({ jobId: r.jobId, status: 'running', output: '', code: null })
81
82
  }).catch(function (e) { setError(String(e && e.message)) }).finally(function () { setBusy(false) })
82
83
  }
84
+ var canOpenSession = typeof props.onOpenSession === 'function' && job !== null && job.sessionId
85
+ var openSession = function () { props.onOpenSession(job.sessionId) }
83
86
  var copy = function () {
84
87
  if (typeof navigator !== 'undefined' && navigator.clipboard && navigator.clipboard.writeText) {
85
88
  navigator.clipboard.writeText(prompt).then(function () { setCopied(true); setTimeout(function () { setCopied(false) }, 1500) }).catch(function () {})
@@ -103,6 +106,7 @@ window.__ModuleLoader__.load({
103
106
  h('div', { style: { fontSize: 12, opacity: .7, margin: '4px 0' } }, (labels.outputLabel || 'Output') + ' · ' + statusText),
104
107
  h('pre', { style: { maxHeight: 220, margin: 0, overflow: 'auto', whiteSpace: 'pre-wrap', fontSize: 12, background: 'var(--dsw-alias-bg-layer-2,transparent)', border: '1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.2))', borderRadius: '8px', padding: '8px' } }, job.output || '…')) : null,
105
108
  h('div', { style: { display: 'flex', gap: 8 } },
109
+ canOpenSession ? h('button', { onClick: openSession, style: btnStyle }, labels.openSession || 'Open chat') : null,
106
110
  h('button', { onClick: copy, style: btnStyle }, copied ? (labels.copied || 'Copied') : (labels.copy || 'Copy')),
107
111
  h('button', { onClick: doRun, disabled: busy || (job !== null && job.status === 'running'), style: primaryStyle }, job !== null && job.status === 'running' ? (labels.running || 'Running…') : (labels.run || 'Run')))))
108
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weibaohui/skills-management",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "dsh 插件 · 技能市场:一个页面管理本机所有 coding agent 的技能(Claude、ZCode、Codex 等十余个执行器),一键收编进 DSH 用户库供 skill 工具调用;内置 6600+ ntd 技能市场可浏览搜索安装,支持模型可见性治理与市场每日自动同步。",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -43,7 +43,7 @@
43
43
  "node": ">=22.5"
44
44
  },
45
45
  "dependencies": {
46
- "@weibaohui/dsh-plugin-kit": "^0.1.0",
46
+ "@weibaohui/dsh-plugin-kit": "^0.2.0",
47
47
  "yaml": "^2.9.0"
48
48
  },
49
49
  "devDependencies": {
package/src/index.js CHANGED
@@ -486,7 +486,7 @@ function contentTypeFor(p) {
486
486
 
487
487
  module.exports = {
488
488
  name: 'skills-management',
489
- inject: ['skills', 'webServer', 'settings'],
489
+ inject: ['skills', 'webServer', 'settings', 'agents', 'agentDefaultModel', 'sessions'],
490
490
  __internals: { extractFrontmatter, parseSkillMd, invocationPolicy, installDirName, EXECUTOR_DEFS },
491
491
 
492
492
  apply(ctx, config = {}) {
@@ -759,14 +759,9 @@ module.exports = {
759
759
  }, 'skills-management: market auto-sync')
760
760
 
761
761
  const shareRunJobs = new Map()
762
- // Same-process Agent services (the web app's own): when available the
763
- // share run streams live; absent compositions fall back to headless spawn.
764
- let shareServices = null
765
- try {
766
- if (ctx.inject && typeof ctx.inject === 'function') {
767
- ctx.inject(['agents', 'agentDefaultModel', 'sessions'], (svcs) => { shareServices = svcs })
768
- }
769
- } catch {}
762
+ // Same-process Agent services(静态注入:apply 时已就绪;动态 ctx.inject
763
+ // apply 内不触发是平台 gotcha)。
764
+ const shareServices = { agents: ctx.agents, agentDefaultModel: ctx.agentDefaultModel, sessions: ctx.sessions }
770
765
  let providerControl
771
766
  const invalidate = () => { if (providerControl !== undefined) providerControl.invalidate() }
772
767