dsh-powertools 0.0.0-stage → 0.2.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.
Files changed (251) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -2
  3. package/client.js +2179 -0
  4. package/cordis.patch.yml +3 -0
  5. package/icon.svg +9 -0
  6. package/index.js +79 -0
  7. package/lib/enhance.js +159 -0
  8. package/lib/errors.js +11 -0
  9. package/lib/mcp.js +124 -0
  10. package/lib/platform.js +70 -0
  11. package/lib/sessions.js +377 -0
  12. package/lib/skill-repositories.js +152 -0
  13. package/lib/skills.js +280 -0
  14. package/licenses/lucide.txt +43 -0
  15. package/licenses/magi-code.txt +203 -0
  16. package/locale/en.json +1 -0
  17. package/locale/zh.json +1 -0
  18. package/node_modules/yaml/LICENSE +13 -0
  19. package/node_modules/yaml/README.md +172 -0
  20. package/node_modules/yaml/bin.mjs +11 -0
  21. package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
  22. package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
  23. package/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
  24. package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
  25. package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
  26. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
  27. package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
  28. package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
  29. package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
  30. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
  31. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +226 -0
  32. package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
  33. package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
  34. package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
  35. package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
  36. package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
  37. package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
  38. package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
  39. package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
  40. package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
  41. package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
  42. package/node_modules/yaml/browser/dist/errors.js +57 -0
  43. package/node_modules/yaml/browser/dist/index.js +17 -0
  44. package/node_modules/yaml/browser/dist/log.js +11 -0
  45. package/node_modules/yaml/browser/dist/nodes/Alias.js +118 -0
  46. package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
  47. package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
  48. package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
  49. package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
  50. package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
  51. package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
  52. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
  53. package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
  54. package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
  55. package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
  56. package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
  57. package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
  58. package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
  59. package/node_modules/yaml/browser/dist/parse/lexer.js +721 -0
  60. package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
  61. package/node_modules/yaml/browser/dist/parse/parser.js +975 -0
  62. package/node_modules/yaml/browser/dist/public-api.js +102 -0
  63. package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
  64. package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
  65. package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
  66. package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
  67. package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
  68. package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
  69. package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
  70. package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
  71. package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
  72. package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
  73. package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
  74. package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
  75. package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
  76. package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
  77. package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
  78. package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +67 -0
  79. package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
  80. package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
  81. package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
  82. package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
  83. package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
  84. package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
  85. package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
  86. package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
  87. package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
  88. package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
  89. package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +25 -0
  90. package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
  91. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
  92. package/node_modules/yaml/browser/dist/util.js +11 -0
  93. package/node_modules/yaml/browser/dist/visit.js +233 -0
  94. package/node_modules/yaml/browser/index.js +5 -0
  95. package/node_modules/yaml/browser/package.json +3 -0
  96. package/node_modules/yaml/dist/cli.d.ts +8 -0
  97. package/node_modules/yaml/dist/cli.mjs +201 -0
  98. package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
  99. package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
  100. package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
  101. package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
  102. package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
  103. package/node_modules/yaml/dist/compose/compose-node.js +112 -0
  104. package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
  105. package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
  106. package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
  107. package/node_modules/yaml/dist/compose/composer.js +224 -0
  108. package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
  109. package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
  110. package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
  111. package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
  112. package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
  113. package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
  114. package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
  115. package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
  116. package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
  117. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
  118. package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
  119. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +228 -0
  120. package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
  121. package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
  122. package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
  123. package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
  124. package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
  125. package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
  126. package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
  127. package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
  128. package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
  129. package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
  130. package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
  131. package/node_modules/yaml/dist/doc/Document.js +337 -0
  132. package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
  133. package/node_modules/yaml/dist/doc/anchors.js +76 -0
  134. package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
  135. package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
  136. package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
  137. package/node_modules/yaml/dist/doc/createNode.js +90 -0
  138. package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
  139. package/node_modules/yaml/dist/doc/directives.js +178 -0
  140. package/node_modules/yaml/dist/errors.d.ts +21 -0
  141. package/node_modules/yaml/dist/errors.js +62 -0
  142. package/node_modules/yaml/dist/index.d.ts +25 -0
  143. package/node_modules/yaml/dist/index.js +50 -0
  144. package/node_modules/yaml/dist/log.d.ts +3 -0
  145. package/node_modules/yaml/dist/log.js +19 -0
  146. package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
  147. package/node_modules/yaml/dist/nodes/Alias.js +120 -0
  148. package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
  149. package/node_modules/yaml/dist/nodes/Collection.js +151 -0
  150. package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
  151. package/node_modules/yaml/dist/nodes/Node.js +40 -0
  152. package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
  153. package/node_modules/yaml/dist/nodes/Pair.js +39 -0
  154. package/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
  155. package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
  156. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
  157. package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
  158. package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
  159. package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
  160. package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
  161. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
  162. package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
  163. package/node_modules/yaml/dist/nodes/identity.js +53 -0
  164. package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
  165. package/node_modules/yaml/dist/nodes/toJS.js +39 -0
  166. package/node_modules/yaml/dist/options.d.ts +350 -0
  167. package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
  168. package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
  169. package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
  170. package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
  171. package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
  172. package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
  173. package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
  174. package/node_modules/yaml/dist/parse/cst.js +112 -0
  175. package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
  176. package/node_modules/yaml/dist/parse/lexer.js +723 -0
  177. package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
  178. package/node_modules/yaml/dist/parse/line-counter.js +41 -0
  179. package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
  180. package/node_modules/yaml/dist/parse/parser.js +980 -0
  181. package/node_modules/yaml/dist/public-api.d.ts +44 -0
  182. package/node_modules/yaml/dist/public-api.js +107 -0
  183. package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
  184. package/node_modules/yaml/dist/schema/Schema.js +39 -0
  185. package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
  186. package/node_modules/yaml/dist/schema/common/map.js +19 -0
  187. package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
  188. package/node_modules/yaml/dist/schema/common/null.js +17 -0
  189. package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
  190. package/node_modules/yaml/dist/schema/common/seq.js +19 -0
  191. package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
  192. package/node_modules/yaml/dist/schema/common/string.js +16 -0
  193. package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
  194. package/node_modules/yaml/dist/schema/core/bool.js +21 -0
  195. package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
  196. package/node_modules/yaml/dist/schema/core/float.js +47 -0
  197. package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
  198. package/node_modules/yaml/dist/schema/core/int.js +42 -0
  199. package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
  200. package/node_modules/yaml/dist/schema/core/schema.js +25 -0
  201. package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
  202. package/node_modules/yaml/dist/schema/json/schema.js +64 -0
  203. package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
  204. package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
  205. package/node_modules/yaml/dist/schema/tags.js +99 -0
  206. package/node_modules/yaml/dist/schema/types.d.ts +92 -0
  207. package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
  208. package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
  209. package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
  210. package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
  211. package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
  212. package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
  213. package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
  214. package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
  215. package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
  216. package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
  217. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
  218. package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
  219. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
  220. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
  221. package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
  222. package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
  223. package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
  224. package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
  225. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
  226. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
  227. package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
  228. package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
  229. package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
  230. package/node_modules/yaml/dist/stringify/stringify.js +132 -0
  231. package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
  232. package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
  233. package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
  234. package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
  235. package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
  236. package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
  237. package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
  238. package/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
  239. package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
  240. package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
  241. package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
  242. package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
  243. package/node_modules/yaml/dist/test-events.d.ts +4 -0
  244. package/node_modules/yaml/dist/test-events.js +134 -0
  245. package/node_modules/yaml/dist/util.d.ts +16 -0
  246. package/node_modules/yaml/dist/util.js +28 -0
  247. package/node_modules/yaml/dist/visit.d.ts +102 -0
  248. package/node_modules/yaml/dist/visit.js +236 -0
  249. package/node_modules/yaml/package.json +97 -0
  250. package/node_modules/yaml/util.js +2 -0
  251. package/package.json +73 -4
package/lib/skills.js ADDED
@@ -0,0 +1,280 @@
1
+ import { skillRepositories } from './skill-repositories.js'
2
+ import { constants } from 'node:fs'
3
+ import { access, copyFile, lstat, mkdir, mkdtemp, open, readdir, rm, writeFile } from 'node:fs/promises'
4
+ import path from 'node:path'
5
+ import { createHash, randomUUID } from 'node:crypto'
6
+ import { parseDocument } from 'yaml'
7
+ import { requireValue } from './errors.js'
8
+ import { confinedPath, homeRoot, inside, moveLocal, readOpenFlags, statOrMissing } from './platform.js'
9
+
10
+ const maxMarkdown = 512 * 1024
11
+ const filesystemSources = new Set(['project-dsh', 'project-agents', 'user-dsh', 'user-agents'])
12
+ const validName = name => typeof name === 'string' && name.length <= 100 && /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name)
13
+ const digest = text => createHash('sha256').update(text).digest('hex')
14
+
15
+ export function parseSkill(text) {
16
+ const match = /^---\r?\n([\s\S]*?)^---(?:\r?\n|$)/m.exec(text)
17
+ requireValue(match?.index === 0, 'SKILL.md 缺少 YAML frontmatter。')
18
+ const document = parseDocument(match[1])
19
+ requireValue(!document.errors.length, 'SKILL.md 的 YAML frontmatter 无效。')
20
+ const data = document.toJS()
21
+ requireValue(data && validName(data.name) && typeof data.description === 'string' && data.description.trim(), 'Skill 须有有效的 name 和 description。')
22
+ requireValue(!['disableModelInvocation', 'modelInvocable', 'userInvocable'].some(key => Object.hasOwn(data, key)), '请使用 disable-model-invocation 和 user-invocable。')
23
+ for (const key of ['disable-model-invocation', 'user-invocable']) {
24
+ if (!Object.hasOwn(data, key)) continue
25
+ requireValue(['true', 'false', '1', '0', 'yes', 'no', 'on', 'off'].includes(String(data[key]).toLowerCase()), `${key} 值无效。`)
26
+ }
27
+ return { document, data, body: text.slice(match[0].length), eol: text.startsWith('---\r\n') ? '\r\n' : '\n' }
28
+ }
29
+
30
+ async function readSkillFile(file) {
31
+ const info = await lstat(file)
32
+ requireValue(info.isFile() && info.nlink === 1 && info.size <= maxMarkdown, 'SKILL.md 须为普通文件,且不超过 512 KiB。', 409)
33
+ const handle = await open(file, readOpenFlags())
34
+ try {
35
+ const opened = await handle.stat()
36
+ requireValue(opened.isFile() && opened.ino === info.ino && opened.dev === info.dev && opened.nlink === 1 && opened.size <= maxMarkdown, 'SKILL.md 已变化,请刷新。', 409)
37
+ const buffer = Buffer.alloc(maxMarkdown + 1)
38
+ const { bytesRead } = await handle.read({ buffer, length: buffer.length })
39
+ requireValue(bytesRead <= maxMarkdown, 'SKILL.md 超过 512 KiB。', 409)
40
+ return { text: buffer.subarray(0, bytesRead).toString('utf8'), mode: opened.mode & 0o777 }
41
+ } finally { await handle.close() }
42
+ }
43
+
44
+ async function projectRoot(cwd) {
45
+ for (let current = cwd; ; current = path.dirname(current)) {
46
+ if (await statOrMissing(path.join(current, '.git'))) return current
47
+ if (path.dirname(current) === current) return cwd
48
+ }
49
+ }
50
+
51
+ async function rootsFor(home, cwd) {
52
+ const project = cwd ? await projectRoot(cwd) : undefined
53
+ return {
54
+ 'user-dsh': path.join(home ?? homeRoot(process.env.DSH_HOME, '.dsh'), 'skills'),
55
+ 'user-agents': path.join(homeRoot(process.env.DSH_AGENTS_HOME, '.agents'), 'skills'),
56
+ ...(project && {
57
+ 'project-dsh': path.join(project, '.dsh', 'skills'),
58
+ 'project-agents': path.join(project, '.agents', 'skills'),
59
+ }),
60
+ }
61
+ }
62
+
63
+ async function editableFile(skill, roots) {
64
+ const root = roots[skill.source]
65
+ if (skill.provider !== 'filesystem' || !root || !skill.path || !inside(root, skill.path)) return undefined
66
+ const segments = path.relative(root, skill.path).split(path.sep)
67
+ if (segments[0] === '.system') return undefined
68
+ if (!(segments.length === 1 || segments.length === 2 && segments[1] === 'SKILL.md')) return undefined
69
+ const target = segments.length === 1 ? skill.path : path.dirname(skill.path)
70
+ try {
71
+ if (!(await lstat(root)).isDirectory() || !(await lstat(path.dirname(root))).isDirectory()) return undefined
72
+ const info = await lstat(skill.path)
73
+ const targetInfo = await lstat(target)
74
+ if (info.isFile() && info.nlink === 1 && !targetInfo.isSymbolicLink() && await confinedPath(root, skill.path)) {
75
+ await access(skill.path, constants.W_OK)
76
+ await access(path.dirname(skill.path), constants.W_OK)
77
+ return { file: skill.path, target, root }
78
+ }
79
+ } catch (error) {
80
+ if (!['ENOENT', 'EACCES', 'EPERM', 'EROFS'].includes(error.code)) throw error
81
+ }
82
+ return undefined
83
+ }
84
+
85
+ async function safeSkillRoot(root) {
86
+ // The resolved workspace/home may itself be a link. New discovery folders
87
+ // below it must be real directories, so an import cannot escape that anchor.
88
+ const parent = path.dirname(root)
89
+ await mkdir(parent, { recursive: true })
90
+ requireValue((await lstat(parent)).isDirectory(), 'Skill 目录的上级必须是本地目录。', 409)
91
+ await mkdir(root, { recursive: true })
92
+ requireValue((await lstat(root)).isDirectory(), 'Skill 根目录必须是本地目录。', 409)
93
+ }
94
+
95
+ async function importFolder(source, destination) {
96
+ let size = 0
97
+ let count = 0
98
+ async function copy(from, to, depth) {
99
+ requireValue(depth <= 20, 'Skill 目录层级过深。')
100
+ for (const item of await readdir(from, { withFileTypes: true })) {
101
+ requireValue(++count <= 500, 'Skill 文件数量超过 500。')
102
+ if (item.name === '.git') continue
103
+ const input = path.join(from, item.name)
104
+ const output = path.join(to, item.name)
105
+ if (item.isDirectory()) {
106
+ await mkdir(output)
107
+ await copy(input, output, depth + 1)
108
+ } else {
109
+ requireValue(item.isFile(), 'Skill 导入目录仅支持普通文件和目录。')
110
+ const info = await lstat(input)
111
+ requireValue(info.isFile() && info.nlink === 1, 'Skill 导入目录仅支持独立的普通文件。')
112
+ size += info.size
113
+ requireValue(size <= 32 * 1024 * 1024, 'Skill 导入目录超过 32 MiB。')
114
+ await copyFile(input, output, constants.COPYFILE_EXCL)
115
+ }
116
+ }
117
+ }
118
+ await copy(source, destination, 0)
119
+ }
120
+
121
+ async function listSkillFiles(target, skillFile) {
122
+ const info = await statOrMissing(target)
123
+ if (!info?.isDirectory()) return []
124
+ const files = []
125
+ async function walk(dir, prefix, depth) {
126
+ if (depth > 5 || files.length >= 100) return
127
+ const entries = (await readdir(dir, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name))
128
+ for (const item of entries) {
129
+ if (files.length >= 100) break
130
+ if (item.name.startsWith('.powertools-')) continue
131
+ const full = path.join(dir, item.name)
132
+ const rel = prefix ? `${prefix}/${item.name}` : item.name
133
+ if (item.isDirectory()) {
134
+ await walk(full, rel, depth + 1)
135
+ } else if (item.isFile() && full !== skillFile) {
136
+ const stat = await statOrMissing(full)
137
+ if (stat?.isFile()) files.push({ path: rel, size: stat.size })
138
+ }
139
+ }
140
+ }
141
+ await walk(target, '', 0)
142
+ return files
143
+ }
144
+
145
+ function summarizeFrontmatter(data) {
146
+ if (!data || typeof data !== 'object') return []
147
+ const skip = new Set(['name', 'description', 'disable-model-invocation', 'user-invocable'])
148
+ return Object.entries(data)
149
+ .filter(([key]) => !skip.has(key))
150
+ .map(([key, value]) => ({
151
+ key,
152
+ value: typeof value === 'string' ? value : JSON.stringify(value),
153
+ }))
154
+ }
155
+
156
+ export function skillOperations(ctx) {
157
+ const repository = skillRepositories(ctx.profileContext.dir, readSkillFile, parseSkill)
158
+ let tail = Promise.resolve()
159
+ let invalidate = () => {}
160
+ if (typeof ctx.skills.registerProvider === 'function') {
161
+ ctx.skills.registerProvider(control => {
162
+ invalidate = control.invalidate
163
+ return { name: 'dsh-powertools-changes', list: async () => [], get: async () => undefined }
164
+ })
165
+ }
166
+ async function withCatalog(body, signal, operation) {
167
+ const workspace = body.workspaceId ? ctx.workspaceRegistry.get(body.workspaceId) : undefined
168
+ requireValue(!body.workspaceId || workspace, '工作区已移除,请刷新。', 404)
169
+ const session = workspace?.sessionIds.includes(body.sessionId) ? ctx.agents.get(body.sessionId) : undefined
170
+ const presets = ctx.agentPresets
171
+ const registry = (session && presets?.serviceFor?.(session, 'skills')) ?? ctx.skills
172
+ const lease = session ? undefined : await presets?.acquireScope?.()
173
+ try {
174
+ const lookup = { cwd: workspace?.path, scope: session ?? lease?.key, signal }
175
+ const roots = await rootsFor(ctx.profileContext?.home, lookup.cwd)
176
+ return await operation(registry, lookup, roots)
177
+ } finally { await lease?.[Symbol.asyncDispose]() }
178
+ }
179
+ return (body, signal) => {
180
+ const run = () => {
181
+ signal.throwIfAborted()
182
+ if (typeof body.action === 'string' && body.action.startsWith('repository-') && body.action !== 'repository-install') {
183
+ return repository(body, signal)
184
+ }
185
+ return withCatalog(body, signal, async (registry, lookup, roots) => {
186
+ signal.throwIfAborted()
187
+ if (body.action === 'list') {
188
+ const skills = await registry.list(lookup)
189
+ const rows = await Promise.all(skills.map(async skill => ({
190
+ name: skill.name, description: skill.description, source: skill.source,
191
+ provider: skill.provider, ...skill.invocation,
192
+ editable: filesystemSources.has(skill.source) && Boolean(await editableFile(skill, roots)),
193
+ })))
194
+ return { skills: rows }
195
+ }
196
+ if (body.action === 'import' || body.action === 'repository-install') {
197
+ const root = body.destination === 'project' ? roots['project-dsh'] : body.destination === 'personal' ? roots['user-dsh'] : undefined
198
+ requireValue(root, '请选择可用的导入位置。')
199
+ const fromRepository = body.action === 'repository-install'
200
+ const directory = fromRepository ? (await repository(body, signal)).directory : body.directory
201
+ requireValue(typeof directory === 'string' && path.isAbsolute(directory), '请输入本地 Skill 目录的绝对路径。')
202
+ const source = path.resolve(directory)
203
+ requireValue((await lstat(source)).isDirectory(), '请选择包含 SKILL.md 的普通目录。')
204
+ const { text } = await readSkillFile(path.join(source, 'SKILL.md'))
205
+ const { data } = parseSkill(text)
206
+ requireValue(!(await registry.list(lookup)).some(skill => skill.name === data.name), '当前目录范围中已有同名 Skill。', 409)
207
+ const destination = path.join(root, data.name)
208
+ requireValue(!inside(source, destination) && source !== destination, '导入目标不能在源目录内。')
209
+ await safeSkillRoot(root)
210
+ const staging = await mkdtemp(path.join(path.dirname(root), '.powertools-import-'))
211
+ try {
212
+ await importFolder(source, staging)
213
+ const copied = await readSkillFile(path.join(staging, 'SKILL.md'))
214
+ requireValue(copied.text === text, '导入时 SKILL.md 已变化,请重试。', 409)
215
+ signal.throwIfAborted()
216
+ requireValue(!await statOrMissing(destination), '目标目录已存在。', 409)
217
+ await moveLocal(staging, destination)
218
+ } finally { await rm(staging, { recursive: true, force: true }) }
219
+ invalidate()
220
+ return { name: data.name }
221
+ }
222
+ requireValue(validName(body.name), 'Skill 名称无效。')
223
+ const skill = await registry.get(body.name, lookup)
224
+ requireValue(skill, 'Skill 已变化,请刷新。', 404)
225
+ const writable = await editableFile(skill, roots)
226
+ if (body.action === 'preview' && !writable) {
227
+ const content = skill.content ?? ''
228
+ return { name: skill.name, markdown: content, bytes: Buffer.byteLength(content), raw: false, editable: false, files: [], meta: [], ...skill.invocation }
229
+ }
230
+ requireValue(writable, '此 Skill 的来源不支持写入。', 409)
231
+ const { text, mode } = await readSkillFile(writable.file)
232
+ const { document, data, body: markdown, eol } = parseSkill(text)
233
+ requireValue(data.name === body.name, 'Skill 已变化,请刷新。', 409)
234
+ const revision = digest(text)
235
+ if (body.action === 'preview') {
236
+ const files = await listSkillFiles(writable.target, writable.file)
237
+ return { name: skill.name, markdown: text, bytes: Buffer.byteLength(text), raw: true, editable: true, revision,
238
+ description: data.description, body: markdown, files, meta: summarizeFrontmatter(data), ...skill.invocation }
239
+ }
240
+ requireValue(body.revision === revision, '文件已被修改,请重新打开 Skill。', 409)
241
+ if (body.action === 'remove') {
242
+ requireValue(body.confirm === skill.name, '请确认要移除的 Skill。', 409)
243
+ const recovery = await mkdtemp(path.join(path.dirname(writable.root), 'powertools-recovery-'))
244
+ try {
245
+ signal.throwIfAborted()
246
+ await moveLocal(writable.target, path.join(recovery, path.basename(writable.target)))
247
+ } catch (error) {
248
+ await rm(recovery, { recursive: true, force: true })
249
+ throw error
250
+ }
251
+ invalidate()
252
+ return { recovery }
253
+ }
254
+ requireValue(body.action === 'edit', 'Skill 操作无效。')
255
+ requireValue(typeof body.description === 'string' && body.description.trim() && body.description.length <= 8000, '请输入 Skill 描述。')
256
+ requireValue(typeof body.body === 'string' && typeof body.modelInvocable === 'boolean' && typeof body.userInvocable === 'boolean', 'Skill 内容或调用权限无效。')
257
+ if (body.description !== data.description) document.set('description', body.description)
258
+ if (body.modelInvocable !== skill.invocation.modelInvocable) document.set('disable-model-invocation', !body.modelInvocable)
259
+ if (body.userInvocable !== skill.invocation.userInvocable) document.set('user-invocable', body.userInvocable)
260
+ const yaml = document.toString({ lineWidth: 0 }).replace(/\n/g, eol)
261
+ const frontmatter = yaml.endsWith(eol) ? yaml : `${yaml}${eol}`
262
+ const next = `---${eol}${frontmatter}---${eol}${body.body}`
263
+ requireValue(Buffer.byteLength(next) <= maxMarkdown, 'SKILL.md 超过 512 KiB。')
264
+ const temporary = path.join(path.dirname(writable.file), `.powertools-${randomUUID()}.tmp`)
265
+ try {
266
+ await writeFile(temporary, next, { flag: 'wx', mode })
267
+ signal.throwIfAborted()
268
+ requireValue((await readSkillFile(writable.file)).text === text, '文件已被修改,请重新打开 Skill。', 409)
269
+ await moveLocal(temporary, writable.file)
270
+ } finally { await rm(temporary, { force: true }) }
271
+ invalidate()
272
+ return {}
273
+ })
274
+ }
275
+ if (['list', 'preview', 'repository-list'].includes(body.action)) return run()
276
+ const pending = tail.then(run)
277
+ tail = pending.catch(() => {})
278
+ return pending
279
+ }
280
+ }
@@ -0,0 +1,43 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026 Lucide Icons and Contributors
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+
17
+ ---
18
+
19
+ The following Lucide icons are derived from the Feather project:
20
+
21
+ airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
22
+
23
+ The MIT License (MIT) (for the icons listed above)
24
+
25
+ Copyright (c) 2013-present Cole Bemis
26
+
27
+ Permission is hereby granted, free of charge, to any person obtaining a copy
28
+ of this software and associated documentation files (the "Software"), to deal
29
+ in the Software without restriction, including without limitation the rights
30
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
31
+ copies of the Software, and to permit persons to whom the Software is
32
+ furnished to do so, subject to the following conditions:
33
+
34
+ The above copyright notice and this permission notice shall be included in all
35
+ copies or substantial portions of the Software.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
43
+ SOFTWARE.
@@ -0,0 +1,203 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright (c) 2026 MistRipple
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [yyyy] [name of copyright owner]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
package/locale/en.json ADDED
@@ -0,0 +1 @@
1
+ {"meta":{"title":"DSH PowerTools","description":"Browse sessions, manage MCP servers and skills, and rewrite drafts in the composer before sending."}}
package/locale/zh.json ADDED
@@ -0,0 +1 @@
1
+ {"meta":{"title":"DSH 工具箱","description":"浏览和归档会话,管理 MCP 与 Skill,在原生输入框中改写草稿并支持撤销。"}}
@@ -0,0 +1,13 @@
1
+ Copyright Eemeli Aro <eemeli@gmail.com>
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any purpose
4
+ with or without fee is hereby granted, provided that the above copyright notice
5
+ and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
11
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
12
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
13
+ THIS SOFTWARE.