@ai-wendao/ant 0.3.18 → 0.3.20

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.
Files changed (3) hide show
  1. package/client.js +35 -24
  2. package/index.js +5 -1
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -382,7 +382,7 @@ window.__ModuleLoader__.load({
382
382
  if (generation !== refreshGeneration.current) return
383
383
  setSkills(result.skills)
384
384
  setLoadError(false)
385
- setMessage(result.warning || (result.skills.length ? '' : '暂无已发布的全市场或本企业技能。候选技能需由管理员先导入、审核并发布;下方仍可查看 DSH 官方技能。'))
385
+ setMessage(result.warning || (result.skills.length ? '' : '当前没有可显示的全市场或本企业技能。管理员可能尚未启用,或已隐藏待启用的市场技能;下方仍可查看 DSH 官方技能。'))
386
386
  } catch (error) {
387
387
  if (generation !== refreshGeneration.current) return
388
388
  setSkills([])
@@ -398,7 +398,7 @@ window.__ModuleLoader__.load({
398
398
  ? skill.conflict_reason === 'other-source'
399
399
  ? '这台 DSH 已安装另一个来源的同名技能。确认卸载本机旧来源?已修改的本地文件不会被删除。'
400
400
  : `从这台 DSH 卸载 ${skill.title}?已修改的本地文件不会被删除。`
401
- : `将 ${skill.title} ${action}到这台 DSH?\n\n本机依赖:${skill.requirements}\n\n技能可能让 DSH 读取文件或执行脚本,仍受 DSH 的工具授权控制。ANT 不会自动安装系统依赖。`
401
+ : `将 ${skill.title} ${action}到这台 DSH?\n\n外部数据交互:${skill.data_interactions || '待管理员补充;使用前请先核实数据去向。'}\n\n本机依赖:${skill.requirements}\n\n技能可能让 DSH 读取文件或执行脚本,仍受 DSH 的工具授权控制。ANT 不会自动安装系统依赖。`
402
402
  if (!window.confirm(prompt)) return
403
403
  setWorkingId(skill.id)
404
404
  setMessage(`正在${action} ${skill.title}…`)
@@ -526,6 +526,7 @@ window.__ModuleLoader__.load({
526
526
  ...visible.map((skill) => {
527
527
  const marketPending = skill.scope === 'market' && skill.team_enabled !== true
528
528
  const description = skillIntroduction(skill)
529
+ const dataInteractions = skill.data_interactions?.trim() || '待管理员补充。使用前请核实这项技能是否调用外部服务,以及会发送哪些数据。'
529
530
  const originalEnglish = Boolean(curatedSkillIntroduction(skill)) || !hasChineseIntroduction(skill.description)
530
531
  const englishSource = skillEnglishSource(skill)
531
532
  const sourceRef = skill.source_ref || ''
@@ -533,6 +534,14 @@ window.__ModuleLoader__.load({
533
534
  const sourceLabel = /^https:\/\/github\.com\//u.test(skill.source_url || '') ? 'GitHub'
534
535
  : /^https:\/\/clawhub\.ai\//u.test(skill.source_url || '') ? 'ClawHub'
535
536
  : skill.source_kind === 'upload' ? '管理员上传' : '原作者来源'
537
+ const actions = !marketPending && skill.local_status !== 'conflict'
538
+ ? h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 8 } },
539
+ skill.local_status === 'installed' ? null : h('button', { type: 'button', disabled: Boolean(workingId),
540
+ onClick: () => void changeInstall(skill), style: primaryButtonStyle },
541
+ skill.local_status === 'update-available' ? '更新技能' : '安装到这台 DSH'),
542
+ skill.local_status === 'not-installed' ? null : h('button', { type: 'button', disabled: Boolean(workingId),
543
+ onClick: () => void changeInstall(skill, true), style: secondaryButtonStyle }, '卸载'))
544
+ : null
536
545
  return h('article', { key: skill.id, style: { ...panelStyle, gap: 13 } },
537
546
  h('div', { style: { display: 'flex', flexWrap: 'wrap', justifyContent: 'space-between', alignItems: 'baseline', gap: 8 } },
538
547
  h('div', { style: { display: 'flex', alignItems: 'baseline', flexWrap: 'wrap', gap: 8 } },
@@ -543,25 +552,32 @@ window.__ModuleLoader__.load({
543
552
  ? skill.team_connected ? '待企业启用' : '连接企业后查看启用状态'
544
553
  : statusLabel[skill.local_status] || '状态未知')),
545
554
  h('p', { style: mutedTextStyle }, description.length > 180 ? `${description.slice(0, 180)}…` : description),
546
- englishSource ? h('a', { href: englishSource, target: '_blank', rel: 'noopener noreferrer',
547
- style: { color: 'var(--dsw-alias-link)', fontSize: 13 } }, originalEnglish ? '查看英文原文 ↗' : '查看原始说明 ↗')
548
- : h('button', { type: 'button', onClick: () => void openOriginal(skill),
549
- style: { border: 0, padding: 0, background: 'transparent', cursor: 'pointer',
550
- color: 'var(--dsw-alias-link)', fontSize: 13, textAlign: 'left' } },
551
- originalEnglish ? '查看英文原文 →' : '查看原始说明 →'),
552
- h('p', { style: mutedTextStyle }, `来源:${sourceLabel} · 许可:${skill.license}`),
555
+ h('section', { style: { display: 'grid', gap: 5, padding: '10px 12px', borderRadius: 8,
556
+ border: '0.5px solid var(--dsw-alias-border-l2)', backgroundColor: 'var(--dsw-alias-bg-layer-2)' } },
557
+ h('strong', { style: { fontSize: 13 } }, '外部数据交互'),
558
+ h('p', { style: { ...mutedTextStyle, whiteSpace: 'pre-wrap', overflowWrap: 'anywhere' } }, dataInteractions)),
553
559
  description.length > 180 ? h('details', null,
554
560
  h('summary', { style: { cursor: 'pointer', fontSize: 13 } }, '查看完整说明'),
555
561
  h('p', { style: { ...mutedTextStyle, marginTop: 8, whiteSpace: 'pre-wrap' } }, description)) : null,
556
- h('details', null,
557
- h('summary', { style: { cursor: 'pointer', fontSize: 13 } }, '查看来源、文件与使用条件'),
558
- h('div', { style: { display: 'grid', gap: 5, marginTop: 9, overflowWrap: 'anywhere' } },
559
- h('p', { style: mutedTextStyle }, `${fileCountFormat.format(skill.file_count)} 个文件`),
560
- h('p', { style: mutedTextStyle }, `本机条件:${skill.requirements}`),
561
- h('p', { style: mutedTextStyle, title: sourceRef }, `固定版本:${versionLabel || '已锁定制品'}`),
562
- /^https:\/\//u.test(skill.source_url || '')
563
- ? h('a', { href: skill.source_url, target: '_blank', rel: 'noopener noreferrer', style: { fontSize: 13, color: 'var(--dsw-alias-link)' } }, '查看原始来源 ↗')
564
- : h('p', { style: mutedTextStyle }, '来源:管理员上传并审核'))),
562
+ h('div', { style: { display: 'grid', gap: 5 } },
563
+ h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', flexWrap: 'wrap', gap: 8 } },
564
+ h('p', { style: { ...mutedTextStyle, flex: '1 1 180px' } }, `来源:${sourceLabel} · 许可:${skill.license}`),
565
+ actions),
566
+ h('details', null,
567
+ h('summary', { style: { cursor: 'pointer', fontSize: 13 } }, '查看来源、文件与使用条件'),
568
+ h('div', { style: { display: 'grid', gap: 5, marginTop: 9, overflowWrap: 'anywhere' } },
569
+ englishSource ? h('a', { href: englishSource, target: '_blank', rel: 'noopener noreferrer',
570
+ style: { color: 'var(--dsw-alias-link)', fontSize: 13 } }, originalEnglish ? '查看英文原文 ↗' : '查看原始说明 ↗')
571
+ : h('button', { type: 'button', onClick: () => void openOriginal(skill),
572
+ style: { border: 0, padding: 0, background: 'transparent', cursor: 'pointer',
573
+ color: 'var(--dsw-alias-link)', fontSize: 13, textAlign: 'left' } },
574
+ originalEnglish ? '查看英文原文 →' : '查看原始说明 →'),
575
+ h('p', { style: mutedTextStyle }, `${fileCountFormat.format(skill.file_count)} 个文件`),
576
+ h('p', { style: mutedTextStyle }, `本机条件:${skill.requirements}`),
577
+ h('p', { style: mutedTextStyle, title: sourceRef }, `固定版本:${versionLabel || '已锁定制品'}`),
578
+ /^https:\/\//u.test(skill.source_url || '')
579
+ ? h('a', { href: skill.source_url, target: '_blank', rel: 'noopener noreferrer', style: { fontSize: 13, color: 'var(--dsw-alias-link)' } }, '查看原始来源 ↗')
580
+ : h('p', { style: mutedTextStyle }, '来源:管理员上传并审核')))),
565
581
  marketPending
566
582
  ? h('div', { style: { display: 'grid', gap: 8, marginTop: 'auto' } },
567
583
  h('p', { role: 'status', style: mutedTextStyle }, skill.team_connected
@@ -584,12 +600,7 @@ window.__ModuleLoader__.load({
584
600
  ? h('button', { type: 'button', disabled: Boolean(workingId),
585
601
  onClick: () => void changeInstall(skill, true), style: { ...secondaryButtonStyle, width: 'fit-content' } }, '卸载旧来源')
586
602
  : null)
587
- : h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 8, marginTop: 'auto' } },
588
- skill.local_status === 'installed' ? null : h('button', { type: 'button', disabled: Boolean(workingId),
589
- onClick: () => void changeInstall(skill), style: primaryButtonStyle },
590
- skill.local_status === 'update-available' ? '更新技能' : '安装到这台 DSH'),
591
- skill.local_status !== 'not-installed' ? h('button', { type: 'button', disabled: Boolean(workingId),
592
- onClick: () => void changeInstall(skill, true), style: secondaryButtonStyle }, '卸载') : null))
603
+ : null)
593
604
  })) : !includePlugins && !loading && (skills.length || officialOfficeSkills.length) && !visibleOfficial.length ? h('p', { style: mutedTextStyle }, '没有符合筛选条件的技能。') : null,
594
605
  visibleOfficial.length ? h('section', { 'aria-label': 'DSH 官方 Office 技能', style: { display: 'grid', gap: 12 } },
595
606
  h('div', null,
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export const name = 'ant'
2
2
 
3
3
  import { createHash } from 'node:crypto'
4
+ import { createRequire } from 'node:module'
4
5
  import { installSkill, listSkills, uninstallSkill } from './skill-install.js'
5
6
 
6
7
  export const inject = []
@@ -18,6 +19,7 @@ const SKILL_INSTALL_PATH = '/api/ant-teams/skills/install'
18
19
  const SKILL_UNINSTALL_PATH = '/api/ant-teams/skills/uninstall'
19
20
  const PLUGINS_PATH = '/api/ant-teams/plugins'
20
21
  const ANT_NPM_PACKAGE_NAME = '@ai-wendao/ant'
22
+ const BUNDLE_VERSION = createRequire(import.meta.url)('./package.json').version
21
23
  const MAX_MODEL_RESPONSE_BYTES = 1024 * 1024
22
24
  const MODEL_TOKEN_REF = 'ANT_MODEL_API_KEY'
23
25
  const SERVICE_RECORD_KEY = 'ant/team-service'
@@ -105,9 +107,11 @@ async function readMemberConnection(credentials, settings) {
105
107
  }
106
108
 
107
109
  async function updateModelSession(serviceUrl, token, action) {
110
+ const headers = { authorization: `Bearer ${token}`, accept: 'application/json' }
111
+ if (action === 'heartbeat') headers['x-ant-bundle-version'] = BUNDLE_VERSION
108
112
  return fetch(new URL(`/auth/dsh-session/${action}`, serviceUrl), {
109
113
  method: 'POST',
110
- headers: { authorization: `Bearer ${token}`, accept: 'application/json' },
114
+ headers,
111
115
  redirect: 'manual',
112
116
  signal: AbortSignal.timeout(10_000),
113
117
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-wendao/ant",
3
- "version": "0.3.18",
3
+ "version": "0.3.20",
4
4
  "description": "ANT (AI-native Teams) connects a DeepSeek Harness Desktop profile to team identity and approved models.",
5
5
  "type": "module",
6
6
  "scripts": {