@weibaohui/skills-management 0.3.0 → 0.4.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.
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。
@@ -39,7 +40,8 @@ window.__ModuleLoader__.load({
39
40
  var doFetch = options.fetch || (typeof fetch !== 'undefined' ? fetch : null)
40
41
  var inputStyle = { width: '100%', minHeight: 190, resize: 'vertical', fontFamily: 'var(--dsw-font-family)', lineHeight: 1.6, fontSize: 12, background: 'var(--dsw-alias-bg-layer-2,transparent)', color: 'inherit', border: '1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.3))', borderRadius: '8px', padding: '10px', boxSizing: 'border-box' }
41
42
  var btnStyle = { background: 'transparent', color: 'inherit', border: '1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.3))', borderRadius: '8px', padding: '5px 12px', fontSize: 13, cursor: 'pointer', font: 'inherit' }
42
- var primaryStyle = Object.assign({}, btnStyle, { background: 'var(--dsw-alias-brand-primary,#4a7dff)', borderColor: 'var(--dsw-alias-brand-primary,#4a7dff)', color: '#fff' })
43
+ // 主按钮亮暗跟随:与 skills-management .sk-btn-primary 同款 token 组合
44
+ var primaryStyle = Object.assign({}, btnStyle, { background: 'var(--dsw-alias-state-business-primary,var(--dsw-alias-brand-primary,#4a7dff))', borderColor: 'transparent', color: 'var(--dsw-alias-label-primary-inverted,#fff)' })
43
45
 
44
46
  return function ActionShareDialog(props) {
45
47
  var title = props.title
@@ -80,6 +82,8 @@ window.__ModuleLoader__.load({
80
82
  setJob({ jobId: r.jobId, status: 'running', output: '', code: null })
81
83
  }).catch(function (e) { setError(String(e && e.message)) }).finally(function () { setBusy(false) })
82
84
  }
85
+ var canOpenSession = typeof props.onOpenSession === 'function' && job !== null && job.sessionId
86
+ var openSession = function () { props.onOpenSession(job.sessionId) }
83
87
  var copy = function () {
84
88
  if (typeof navigator !== 'undefined' && navigator.clipboard && navigator.clipboard.writeText) {
85
89
  navigator.clipboard.writeText(prompt).then(function () { setCopied(true); setTimeout(function () { setCopied(false) }, 1500) }).catch(function () {})
@@ -103,6 +107,7 @@ window.__ModuleLoader__.load({
103
107
  h('div', { style: { fontSize: 12, opacity: .7, margin: '4px 0' } }, (labels.outputLabel || 'Output') + ' · ' + statusText),
104
108
  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
109
  h('div', { style: { display: 'flex', gap: 8 } },
110
+ canOpenSession ? h('button', { onClick: openSession, style: btnStyle }, labels.openSession || 'Open chat') : null,
106
111
  h('button', { onClick: copy, style: btnStyle }, copied ? (labels.copied || 'Copied') : (labels.copy || 'Copy')),
107
112
  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
113
  }
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.1",
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