@capyclaw/publisher 0.1.3 → 0.1.4

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 (367) hide show
  1. package/package.json +3 -11
  2. package/server/archive.mjs +69 -35
  3. package/server/drop.mjs +9 -3
  4. package/server/impl.mjs +133 -97
  5. package/server/tools.mjs +1 -1
  6. package/node_modules/@capyclaw/foundation/README.md +0 -51
  7. package/node_modules/@capyclaw/foundation/abi/bridge.mjs +0 -86
  8. package/node_modules/@capyclaw/foundation/abi/errors.mjs +0 -63
  9. package/node_modules/@capyclaw/foundation/abi/index.mjs +0 -35
  10. package/node_modules/@capyclaw/foundation/abi/kinds.mjs +0 -271
  11. package/node_modules/@capyclaw/foundation/abi/loader.mjs +0 -345
  12. package/node_modules/@capyclaw/foundation/abi/schema.mjs +0 -98
  13. package/node_modules/@capyclaw/foundation/abi/spec.mjs +0 -255
  14. package/node_modules/@capyclaw/foundation/abi/validate.mjs +0 -24
  15. package/node_modules/@capyclaw/foundation/abi/version.mjs +0 -82
  16. package/node_modules/@capyclaw/foundation/cordis.patch.yml +0 -5
  17. package/node_modules/@capyclaw/foundation/kit/index.mjs +0 -6
  18. package/node_modules/@capyclaw/foundation/lib/adapters/client-panel.mjs +0 -98
  19. package/node_modules/@capyclaw/foundation/lib/adapters/host-event.mjs +0 -35
  20. package/node_modules/@capyclaw/foundation/lib/adapters/http-router.mjs +0 -69
  21. package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +0 -55
  22. package/node_modules/@capyclaw/foundation/lib/adapters/own-server.mjs +0 -113
  23. package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +0 -68
  24. package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +0 -113
  25. package/node_modules/@capyclaw/foundation/lib/adapters/service-provider.mjs +0 -77
  26. package/node_modules/@capyclaw/foundation/lib/adapters/skill-provider.mjs +0 -56
  27. package/node_modules/@capyclaw/foundation/lib/adapters/tool-provider.mjs +0 -50
  28. package/node_modules/@capyclaw/foundation/lib/adapters/ui-panel.mjs +0 -64
  29. package/node_modules/@capyclaw/foundation/lib/ctx-service.mjs +0 -42
  30. package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +0 -34
  31. package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +0 -85
  32. package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +0 -50
  33. package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +0 -160
  34. package/node_modules/@capyclaw/foundation/lib/host.mjs +0 -23
  35. package/node_modules/@capyclaw/foundation/lib/kernel.mjs +0 -185
  36. package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +0 -87
  37. package/node_modules/@capyclaw/foundation/lib/subsystems/events.mjs +0 -60
  38. package/node_modules/@capyclaw/foundation/lib/subsystems/log.mjs +0 -51
  39. package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +0 -188
  40. package/node_modules/@capyclaw/foundation/package.json +0 -53
  41. package/node_modules/@capyclaw/foundation/runtime/index.mjs +0 -20
  42. package/node_modules/@capyclaw/plugin-kit/INTEGRATION.md +0 -100
  43. package/node_modules/@capyclaw/plugin-kit/README.md +0 -70
  44. package/node_modules/@capyclaw/plugin-kit/bin/sync.mjs +0 -103
  45. package/node_modules/@capyclaw/plugin-kit/package.json +0 -69
  46. package/node_modules/@capyclaw/plugin-kit/src/cli.mjs +0 -56
  47. package/node_modules/@capyclaw/plugin-kit/src/config.mjs +0 -142
  48. package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +0 -129
  49. package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +0 -139
  50. package/node_modules/@capyclaw/plugin-kit/src/editor/shadow.mjs +0 -219
  51. package/node_modules/@capyclaw/plugin-kit/src/editor/transport.js +0 -13
  52. package/node_modules/@capyclaw/plugin-kit/src/index.mjs +0 -13
  53. package/node_modules/@capyclaw/plugin-kit/src/pack.mjs +0 -230
  54. package/node_modules/@capyclaw/plugin-kit/src/runtime/context.mjs +0 -128
  55. package/node_modules/@capyclaw/plugin-kit/src/self-contained.mjs +0 -307
  56. package/node_modules/@capyclaw/plugin-kit/src/service/api.mjs +0 -45
  57. package/node_modules/@capyclaw/plugin-kit/src/service/http.mjs +0 -113
  58. package/node_modules/@capyclaw/plugin-kit/src/service/mcp-http.mjs +0 -150
  59. package/node_modules/@capyclaw/plugin-kit/src/service/server.mjs +0 -131
  60. package/node_modules/@capyclaw/plugin-kit/src/skills/provider.mjs +0 -82
  61. package/node_modules/@capyclaw/plugin-kit/src/store/blob-store.mjs +0 -109
  62. package/node_modules/@capyclaw/plugin-kit/src/store/content-store.mjs +0 -17
  63. package/node_modules/@capyclaw/plugin-kit/src/store/journal-store.mjs +0 -89
  64. package/node_modules/@capyclaw/plugin-kit/src/tools/result.mjs +0 -57
  65. package/node_modules/@capyclaw/plugin-kit/src/tools/validate.mjs +0 -150
  66. package/node_modules/@capyclaw/plugin-kit/src/tuning.mjs +0 -82
  67. package/node_modules/@capyclaw/plugin-kit/src/util/fs-lock.mjs +0 -132
  68. package/node_modules/@capyclaw/plugin-kit/src/util/http.mjs +0 -130
  69. package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +0 -656
  70. package/node_modules/@capyclaw/plugin-kit/src/zip.mjs +0 -181
  71. package/node_modules/@capyclaw/plugin-validator/bin/cli.mjs +0 -49
  72. package/node_modules/@capyclaw/plugin-validator/lib/index.mjs +0 -303
  73. package/node_modules/@capyclaw/plugin-validator/package.json +0 -28
  74. package/node_modules/@capyclaw/tool-host/README.md +0 -56
  75. package/node_modules/@capyclaw/tool-host/cordis.patch.yml +0 -4
  76. package/node_modules/@capyclaw/tool-host/dsh-suite.json +0 -30
  77. package/node_modules/@capyclaw/tool-host/lib/host.mjs +0 -16
  78. package/node_modules/@capyclaw/tool-host/package.json +0 -59
  79. package/node_modules/@capyclaw/tool-host/src/descriptors.mjs +0 -166
  80. package/node_modules/@capyclaw/tool-host/src/index.mjs +0 -416
  81. package/node_modules/semver/LICENSE +0 -15
  82. package/node_modules/semver/README.md +0 -680
  83. package/node_modules/semver/bin/semver.js +0 -195
  84. package/node_modules/semver/classes/comparator.js +0 -143
  85. package/node_modules/semver/classes/index.js +0 -7
  86. package/node_modules/semver/classes/range.js +0 -577
  87. package/node_modules/semver/classes/semver.js +0 -350
  88. package/node_modules/semver/functions/clean.js +0 -8
  89. package/node_modules/semver/functions/cmp.js +0 -54
  90. package/node_modules/semver/functions/coerce.js +0 -62
  91. package/node_modules/semver/functions/compare-build.js +0 -9
  92. package/node_modules/semver/functions/compare-loose.js +0 -5
  93. package/node_modules/semver/functions/compare.js +0 -7
  94. package/node_modules/semver/functions/diff.js +0 -60
  95. package/node_modules/semver/functions/eq.js +0 -5
  96. package/node_modules/semver/functions/gt.js +0 -5
  97. package/node_modules/semver/functions/gte.js +0 -5
  98. package/node_modules/semver/functions/inc.js +0 -21
  99. package/node_modules/semver/functions/lt.js +0 -5
  100. package/node_modules/semver/functions/lte.js +0 -5
  101. package/node_modules/semver/functions/major.js +0 -5
  102. package/node_modules/semver/functions/minor.js +0 -5
  103. package/node_modules/semver/functions/neq.js +0 -5
  104. package/node_modules/semver/functions/parse.js +0 -18
  105. package/node_modules/semver/functions/patch.js +0 -5
  106. package/node_modules/semver/functions/prerelease.js +0 -8
  107. package/node_modules/semver/functions/rcompare.js +0 -5
  108. package/node_modules/semver/functions/rsort.js +0 -5
  109. package/node_modules/semver/functions/satisfies.js +0 -12
  110. package/node_modules/semver/functions/sort.js +0 -5
  111. package/node_modules/semver/functions/truncate.js +0 -48
  112. package/node_modules/semver/functions/valid.js +0 -8
  113. package/node_modules/semver/index.js +0 -93
  114. package/node_modules/semver/internal/constants.js +0 -67
  115. package/node_modules/semver/internal/debug.js +0 -11
  116. package/node_modules/semver/internal/identifiers.js +0 -29
  117. package/node_modules/semver/internal/lrucache.js +0 -42
  118. package/node_modules/semver/internal/parse-options.js +0 -17
  119. package/node_modules/semver/internal/re.js +0 -223
  120. package/node_modules/semver/internal/trim-comparator-whitespace.js +0 -438
  121. package/node_modules/semver/package.json +0 -78
  122. package/node_modules/semver/preload.js +0 -4
  123. package/node_modules/semver/range.bnf +0 -17
  124. package/node_modules/semver/ranges/gtr.js +0 -6
  125. package/node_modules/semver/ranges/intersects.js +0 -9
  126. package/node_modules/semver/ranges/ltr.js +0 -6
  127. package/node_modules/semver/ranges/max-satisfying.js +0 -27
  128. package/node_modules/semver/ranges/min-satisfying.js +0 -26
  129. package/node_modules/semver/ranges/min-version.js +0 -63
  130. package/node_modules/semver/ranges/outside.js +0 -82
  131. package/node_modules/semver/ranges/simplify.js +0 -49
  132. package/node_modules/semver/ranges/subset.js +0 -249
  133. package/node_modules/semver/ranges/to-comparators.js +0 -10
  134. package/node_modules/semver/ranges/valid.js +0 -13
  135. package/node_modules/yaml/LICENSE +0 -13
  136. package/node_modules/yaml/README.md +0 -172
  137. package/node_modules/yaml/bin.mjs +0 -11
  138. package/node_modules/yaml/browser/dist/compose/compose-collection.js +0 -88
  139. package/node_modules/yaml/browser/dist/compose/compose-doc.js +0 -43
  140. package/node_modules/yaml/browser/dist/compose/compose-node.js +0 -109
  141. package/node_modules/yaml/browser/dist/compose/compose-scalar.js +0 -86
  142. package/node_modules/yaml/browser/dist/compose/composer.js +0 -219
  143. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +0 -115
  144. package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +0 -198
  145. package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +0 -49
  146. package/node_modules/yaml/browser/dist/compose/resolve-end.js +0 -37
  147. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +0 -207
  148. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +0 -226
  149. package/node_modules/yaml/browser/dist/compose/resolve-props.js +0 -146
  150. package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +0 -34
  151. package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +0 -26
  152. package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +0 -15
  153. package/node_modules/yaml/browser/dist/compose/util-map-includes.js +0 -13
  154. package/node_modules/yaml/browser/dist/doc/Document.js +0 -335
  155. package/node_modules/yaml/browser/dist/doc/anchors.js +0 -71
  156. package/node_modules/yaml/browser/dist/doc/applyReviver.js +0 -55
  157. package/node_modules/yaml/browser/dist/doc/createNode.js +0 -88
  158. package/node_modules/yaml/browser/dist/doc/directives.js +0 -176
  159. package/node_modules/yaml/browser/dist/errors.js +0 -57
  160. package/node_modules/yaml/browser/dist/index.js +0 -17
  161. package/node_modules/yaml/browser/dist/log.js +0 -11
  162. package/node_modules/yaml/browser/dist/nodes/Alias.js +0 -118
  163. package/node_modules/yaml/browser/dist/nodes/Collection.js +0 -147
  164. package/node_modules/yaml/browser/dist/nodes/Node.js +0 -38
  165. package/node_modules/yaml/browser/dist/nodes/Pair.js +0 -36
  166. package/node_modules/yaml/browser/dist/nodes/Scalar.js +0 -24
  167. package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +0 -144
  168. package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +0 -113
  169. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +0 -63
  170. package/node_modules/yaml/browser/dist/nodes/identity.js +0 -36
  171. package/node_modules/yaml/browser/dist/nodes/toJS.js +0 -37
  172. package/node_modules/yaml/browser/dist/parse/cst-scalar.js +0 -214
  173. package/node_modules/yaml/browser/dist/parse/cst-stringify.js +0 -61
  174. package/node_modules/yaml/browser/dist/parse/cst-visit.js +0 -97
  175. package/node_modules/yaml/browser/dist/parse/cst.js +0 -98
  176. package/node_modules/yaml/browser/dist/parse/lexer.js +0 -721
  177. package/node_modules/yaml/browser/dist/parse/line-counter.js +0 -39
  178. package/node_modules/yaml/browser/dist/parse/parser.js +0 -975
  179. package/node_modules/yaml/browser/dist/public-api.js +0 -102
  180. package/node_modules/yaml/browser/dist/schema/Schema.js +0 -37
  181. package/node_modules/yaml/browser/dist/schema/common/map.js +0 -17
  182. package/node_modules/yaml/browser/dist/schema/common/null.js +0 -15
  183. package/node_modules/yaml/browser/dist/schema/common/seq.js +0 -17
  184. package/node_modules/yaml/browser/dist/schema/common/string.js +0 -14
  185. package/node_modules/yaml/browser/dist/schema/core/bool.js +0 -19
  186. package/node_modules/yaml/browser/dist/schema/core/float.js +0 -43
  187. package/node_modules/yaml/browser/dist/schema/core/int.js +0 -38
  188. package/node_modules/yaml/browser/dist/schema/core/schema.js +0 -23
  189. package/node_modules/yaml/browser/dist/schema/json/schema.js +0 -62
  190. package/node_modules/yaml/browser/dist/schema/tags.js +0 -96
  191. package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +0 -58
  192. package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +0 -26
  193. package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +0 -46
  194. package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +0 -71
  195. package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +0 -67
  196. package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +0 -74
  197. package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +0 -78
  198. package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +0 -39
  199. package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +0 -93
  200. package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +0 -101
  201. package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +0 -146
  202. package/node_modules/yaml/browser/dist/stringify/stringify.js +0 -129
  203. package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +0 -153
  204. package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +0 -20
  205. package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +0 -85
  206. package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +0 -25
  207. package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +0 -150
  208. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +0 -336
  209. package/node_modules/yaml/browser/dist/util.js +0 -11
  210. package/node_modules/yaml/browser/dist/visit.js +0 -233
  211. package/node_modules/yaml/browser/index.js +0 -5
  212. package/node_modules/yaml/browser/package.json +0 -3
  213. package/node_modules/yaml/dist/cli.d.ts +0 -8
  214. package/node_modules/yaml/dist/cli.mjs +0 -201
  215. package/node_modules/yaml/dist/compose/compose-collection.d.ts +0 -11
  216. package/node_modules/yaml/dist/compose/compose-collection.js +0 -90
  217. package/node_modules/yaml/dist/compose/compose-doc.d.ts +0 -7
  218. package/node_modules/yaml/dist/compose/compose-doc.js +0 -45
  219. package/node_modules/yaml/dist/compose/compose-node.d.ts +0 -29
  220. package/node_modules/yaml/dist/compose/compose-node.js +0 -112
  221. package/node_modules/yaml/dist/compose/compose-scalar.d.ts +0 -5
  222. package/node_modules/yaml/dist/compose/compose-scalar.js +0 -88
  223. package/node_modules/yaml/dist/compose/composer.d.ts +0 -63
  224. package/node_modules/yaml/dist/compose/composer.js +0 -224
  225. package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +0 -6
  226. package/node_modules/yaml/dist/compose/resolve-block-map.js +0 -117
  227. package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +0 -11
  228. package/node_modules/yaml/dist/compose/resolve-block-scalar.js +0 -200
  229. package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +0 -6
  230. package/node_modules/yaml/dist/compose/resolve-block-seq.js +0 -51
  231. package/node_modules/yaml/dist/compose/resolve-end.d.ts +0 -6
  232. package/node_modules/yaml/dist/compose/resolve-end.js +0 -39
  233. package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +0 -7
  234. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +0 -209
  235. package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +0 -10
  236. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +0 -228
  237. package/node_modules/yaml/dist/compose/resolve-props.d.ts +0 -23
  238. package/node_modules/yaml/dist/compose/resolve-props.js +0 -148
  239. package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +0 -2
  240. package/node_modules/yaml/dist/compose/util-contains-newline.js +0 -36
  241. package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +0 -2
  242. package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +0 -28
  243. package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +0 -3
  244. package/node_modules/yaml/dist/compose/util-flow-indent-check.js +0 -17
  245. package/node_modules/yaml/dist/compose/util-map-includes.d.ts +0 -4
  246. package/node_modules/yaml/dist/compose/util-map-includes.js +0 -15
  247. package/node_modules/yaml/dist/doc/Document.d.ts +0 -141
  248. package/node_modules/yaml/dist/doc/Document.js +0 -337
  249. package/node_modules/yaml/dist/doc/anchors.d.ts +0 -24
  250. package/node_modules/yaml/dist/doc/anchors.js +0 -76
  251. package/node_modules/yaml/dist/doc/applyReviver.d.ts +0 -9
  252. package/node_modules/yaml/dist/doc/applyReviver.js +0 -57
  253. package/node_modules/yaml/dist/doc/createNode.d.ts +0 -17
  254. package/node_modules/yaml/dist/doc/createNode.js +0 -90
  255. package/node_modules/yaml/dist/doc/directives.d.ts +0 -49
  256. package/node_modules/yaml/dist/doc/directives.js +0 -178
  257. package/node_modules/yaml/dist/errors.d.ts +0 -21
  258. package/node_modules/yaml/dist/errors.js +0 -62
  259. package/node_modules/yaml/dist/index.d.ts +0 -25
  260. package/node_modules/yaml/dist/index.js +0 -50
  261. package/node_modules/yaml/dist/log.d.ts +0 -3
  262. package/node_modules/yaml/dist/log.js +0 -19
  263. package/node_modules/yaml/dist/nodes/Alias.d.ts +0 -29
  264. package/node_modules/yaml/dist/nodes/Alias.js +0 -120
  265. package/node_modules/yaml/dist/nodes/Collection.d.ts +0 -73
  266. package/node_modules/yaml/dist/nodes/Collection.js +0 -151
  267. package/node_modules/yaml/dist/nodes/Node.d.ts +0 -53
  268. package/node_modules/yaml/dist/nodes/Node.js +0 -40
  269. package/node_modules/yaml/dist/nodes/Pair.d.ts +0 -22
  270. package/node_modules/yaml/dist/nodes/Pair.js +0 -39
  271. package/node_modules/yaml/dist/nodes/Scalar.d.ts +0 -47
  272. package/node_modules/yaml/dist/nodes/Scalar.js +0 -27
  273. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +0 -53
  274. package/node_modules/yaml/dist/nodes/YAMLMap.js +0 -147
  275. package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +0 -60
  276. package/node_modules/yaml/dist/nodes/YAMLSeq.js +0 -115
  277. package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +0 -4
  278. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +0 -65
  279. package/node_modules/yaml/dist/nodes/identity.d.ts +0 -23
  280. package/node_modules/yaml/dist/nodes/identity.js +0 -53
  281. package/node_modules/yaml/dist/nodes/toJS.d.ts +0 -29
  282. package/node_modules/yaml/dist/nodes/toJS.js +0 -39
  283. package/node_modules/yaml/dist/options.d.ts +0 -350
  284. package/node_modules/yaml/dist/parse/cst-scalar.d.ts +0 -64
  285. package/node_modules/yaml/dist/parse/cst-scalar.js +0 -218
  286. package/node_modules/yaml/dist/parse/cst-stringify.d.ts +0 -8
  287. package/node_modules/yaml/dist/parse/cst-stringify.js +0 -63
  288. package/node_modules/yaml/dist/parse/cst-visit.d.ts +0 -39
  289. package/node_modules/yaml/dist/parse/cst-visit.js +0 -99
  290. package/node_modules/yaml/dist/parse/cst.d.ts +0 -109
  291. package/node_modules/yaml/dist/parse/cst.js +0 -112
  292. package/node_modules/yaml/dist/parse/lexer.d.ts +0 -87
  293. package/node_modules/yaml/dist/parse/lexer.js +0 -723
  294. package/node_modules/yaml/dist/parse/line-counter.d.ts +0 -22
  295. package/node_modules/yaml/dist/parse/line-counter.js +0 -41
  296. package/node_modules/yaml/dist/parse/parser.d.ts +0 -84
  297. package/node_modules/yaml/dist/parse/parser.js +0 -980
  298. package/node_modules/yaml/dist/public-api.d.ts +0 -44
  299. package/node_modules/yaml/dist/public-api.js +0 -107
  300. package/node_modules/yaml/dist/schema/Schema.d.ts +0 -17
  301. package/node_modules/yaml/dist/schema/Schema.js +0 -39
  302. package/node_modules/yaml/dist/schema/common/map.d.ts +0 -2
  303. package/node_modules/yaml/dist/schema/common/map.js +0 -19
  304. package/node_modules/yaml/dist/schema/common/null.d.ts +0 -4
  305. package/node_modules/yaml/dist/schema/common/null.js +0 -17
  306. package/node_modules/yaml/dist/schema/common/seq.d.ts +0 -2
  307. package/node_modules/yaml/dist/schema/common/seq.js +0 -19
  308. package/node_modules/yaml/dist/schema/common/string.d.ts +0 -2
  309. package/node_modules/yaml/dist/schema/common/string.js +0 -16
  310. package/node_modules/yaml/dist/schema/core/bool.d.ts +0 -4
  311. package/node_modules/yaml/dist/schema/core/bool.js +0 -21
  312. package/node_modules/yaml/dist/schema/core/float.d.ts +0 -4
  313. package/node_modules/yaml/dist/schema/core/float.js +0 -47
  314. package/node_modules/yaml/dist/schema/core/int.d.ts +0 -4
  315. package/node_modules/yaml/dist/schema/core/int.js +0 -42
  316. package/node_modules/yaml/dist/schema/core/schema.d.ts +0 -1
  317. package/node_modules/yaml/dist/schema/core/schema.js +0 -25
  318. package/node_modules/yaml/dist/schema/json/schema.d.ts +0 -2
  319. package/node_modules/yaml/dist/schema/json/schema.js +0 -64
  320. package/node_modules/yaml/dist/schema/json-schema.d.ts +0 -69
  321. package/node_modules/yaml/dist/schema/tags.d.ts +0 -48
  322. package/node_modules/yaml/dist/schema/tags.js +0 -99
  323. package/node_modules/yaml/dist/schema/types.d.ts +0 -92
  324. package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +0 -2
  325. package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +0 -70
  326. package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +0 -7
  327. package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +0 -29
  328. package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +0 -4
  329. package/node_modules/yaml/dist/schema/yaml-1.1/float.js +0 -50
  330. package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +0 -5
  331. package/node_modules/yaml/dist/schema/yaml-1.1/int.js +0 -76
  332. package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +0 -9
  333. package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +0 -71
  334. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +0 -22
  335. package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +0 -77
  336. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +0 -10
  337. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +0 -82
  338. package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +0 -1
  339. package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +0 -41
  340. package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +0 -28
  341. package/node_modules/yaml/dist/schema/yaml-1.1/set.js +0 -96
  342. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +0 -6
  343. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +0 -105
  344. package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +0 -34
  345. package/node_modules/yaml/dist/stringify/foldFlowLines.js +0 -151
  346. package/node_modules/yaml/dist/stringify/stringify.d.ts +0 -21
  347. package/node_modules/yaml/dist/stringify/stringify.js +0 -132
  348. package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +0 -17
  349. package/node_modules/yaml/dist/stringify/stringifyCollection.js +0 -155
  350. package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +0 -10
  351. package/node_modules/yaml/dist/stringify/stringifyComment.js +0 -24
  352. package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +0 -4
  353. package/node_modules/yaml/dist/stringify/stringifyDocument.js +0 -87
  354. package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +0 -2
  355. package/node_modules/yaml/dist/stringify/stringifyNumber.js +0 -27
  356. package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +0 -3
  357. package/node_modules/yaml/dist/stringify/stringifyPair.js +0 -152
  358. package/node_modules/yaml/dist/stringify/stringifyString.d.ts +0 -9
  359. package/node_modules/yaml/dist/stringify/stringifyString.js +0 -338
  360. package/node_modules/yaml/dist/test-events.d.ts +0 -4
  361. package/node_modules/yaml/dist/test-events.js +0 -134
  362. package/node_modules/yaml/dist/util.d.ts +0 -16
  363. package/node_modules/yaml/dist/util.js +0 -28
  364. package/node_modules/yaml/dist/visit.d.ts +0 -102
  365. package/node_modules/yaml/dist/visit.js +0 -236
  366. package/node_modules/yaml/package.json +0 -97
  367. package/node_modules/yaml/util.js +0 -2
@@ -1,181 +0,0 @@
1
- /**
2
- * 极简跨平台 ZIP 读写(store + deflate 读,store 写;无外部依赖)——全仓单一真源。
3
- *
4
- * 之前三处实现各持一份(plugin-development 写 / tools-plugin-release 读 /
5
- * @capyclaw/suite-kit zip-read 读),本模块合并之。旧位置保留兼容 shim。
6
- *
7
- * 写入:store 模式(内容不压缩,跨平台稳定,产物可被任何标准读取器读)。
8
- * 读取:支持 store(0) 与 deflate(8);接受 Buffer 或文件路径——本地文件与
9
- * 远端下载源共用同一条校验/解包路径。
10
- */
11
- import fs from 'node:fs'
12
- import path from 'node:path'
13
- import zlib from 'node:zlib'
14
-
15
- /* ------------------------------------------------------------------ 写入 */
16
-
17
- const CRC_TABLE = (() => {
18
- const table = new Uint32Array(256)
19
- for (let n = 0; n < 256; n++) {
20
- let c = n
21
- for (let k = 0; k < 8; k++) c = (c & 1) ? (0xedb88320 ^ (c >>> 1)) : (c >>> 1)
22
- table[n] = c >>> 0
23
- }
24
- return table
25
- })()
26
-
27
- function crc32(buffer) {
28
- let crc = 0xffffffff
29
- for (let i = 0; i < buffer.length; i++) crc = CRC_TABLE[(crc ^ buffer[i]) & 0xff] ^ (crc >>> 8)
30
- return (crc ^ 0xffffffff) >>> 0
31
- }
32
-
33
- function dosDateTime(date = new Date()) {
34
- const year = Math.max(1980, date.getFullYear())
35
- const time = ((date.getHours() & 0x1f) << 11) | ((date.getMinutes() & 0x3f) << 5) | (Math.floor(date.getSeconds() / 2) & 0x1f)
36
- const day = (((year - 1980) & 0x7f) << 9) | (((date.getMonth() + 1) & 0x0f) << 5) | (date.getDate() & 0x1f)
37
- return { time, day }
38
- }
39
-
40
- function walkFiles(dir, base = dir) {
41
- const out = []
42
- for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
43
- const full = path.join(dir, entry.name)
44
- if (entry.isDirectory()) out.push(...walkFiles(full, base))
45
- else if (entry.isFile()) out.push(path.relative(base, full).replace(/\\/g, '/'))
46
- }
47
- return out.sort()
48
- }
49
-
50
- /** 把目录写成 store 模式 ZIP。返回打包的相对路径列表。 */
51
- export function writeZipFromDir(sourceDir, outFile) {
52
- const files = walkFiles(sourceDir)
53
- const now = dosDateTime()
54
- const localParts = []
55
- const centralParts = []
56
- let offset = 0
57
-
58
- for (const name of files) {
59
- const data = fs.readFileSync(path.join(sourceDir, name))
60
- const nameBytes = Buffer.from(name, 'utf8')
61
- const crc = crc32(data)
62
-
63
- const local = Buffer.alloc(30)
64
- local.writeUInt32LE(0x04034b50, 0)
65
- local.writeUInt16LE(20, 4)
66
- local.writeUInt16LE(0x0800, 6)
67
- local.writeUInt16LE(0, 8)
68
- local.writeUInt16LE(now.time, 10)
69
- local.writeUInt16LE(now.day, 12)
70
- local.writeUInt32LE(crc, 14)
71
- local.writeUInt32LE(data.length, 18)
72
- local.writeUInt32LE(data.length, 22)
73
- local.writeUInt16LE(nameBytes.length, 26)
74
- local.writeUInt16LE(0, 28)
75
- localParts.push(local, nameBytes, data)
76
-
77
- const central = Buffer.alloc(46)
78
- central.writeUInt32LE(0x02014b50, 0)
79
- central.writeUInt16LE(20, 4)
80
- central.writeUInt16LE(20, 6)
81
- central.writeUInt16LE(0x0800, 8)
82
- central.writeUInt16LE(0, 10)
83
- central.writeUInt16LE(now.time, 12)
84
- central.writeUInt16LE(now.day, 14)
85
- central.writeUInt32LE(crc, 16)
86
- central.writeUInt32LE(data.length, 20)
87
- central.writeUInt32LE(data.length, 24)
88
- central.writeUInt16LE(nameBytes.length, 28)
89
- central.writeUInt16LE(0, 30)
90
- central.writeUInt16LE(0, 32)
91
- central.writeUInt16LE(0, 34)
92
- central.writeUInt16LE(0, 36)
93
- central.writeUInt32LE(0, 38)
94
- central.writeUInt32LE(offset, 42)
95
- centralParts.push(central, nameBytes)
96
-
97
- offset += local.length + nameBytes.length + data.length
98
- }
99
-
100
- const centralBuffer = Buffer.concat(centralParts)
101
- const eocd = Buffer.alloc(22)
102
- eocd.writeUInt32LE(0x06054b50, 0)
103
- eocd.writeUInt16LE(0, 4)
104
- eocd.writeUInt16LE(0, 6)
105
- eocd.writeUInt16LE(files.length, 8)
106
- eocd.writeUInt16LE(files.length, 10)
107
- eocd.writeUInt32LE(centralBuffer.length, 12)
108
- eocd.writeUInt32LE(offset, 16)
109
- eocd.writeUInt16LE(0, 20)
110
-
111
- fs.mkdirSync(path.dirname(outFile), { recursive: true })
112
- fs.writeFileSync(outFile, Buffer.concat([...localParts, centralBuffer, eocd]))
113
- return files
114
- }
115
-
116
- /* ------------------------------------------------------------------ 读取 */
117
-
118
- function locateEocd(data, label) {
119
- for (let i = data.length - 22; i >= 0; i--) {
120
- if (data.readUInt32LE(i) === 0x06054b50) return i
121
- }
122
- throw new Error(`不是有效的 ZIP: ${label}`)
123
- }
124
-
125
- /**
126
- * 列出 ZIP 全部条目名。
127
- * @param {Buffer|string} input - ZIP 字节或文件路径
128
- */
129
- export function listZipEntryNames(input, label = 'zip') {
130
- const data = Buffer.isBuffer(input) ? input : fs.readFileSync(input)
131
- const eocd = locateEocd(data, label)
132
- const count = data.readUInt16LE(eocd + 10)
133
- let offset = data.readUInt32LE(eocd + 16)
134
- const names = []
135
- for (let i = 0; i < count; i++) {
136
- if (data.readUInt32LE(offset) !== 0x02014b50) throw new Error(`ZIP 中央目录损坏: ${label}`)
137
- const nameLength = data.readUInt16LE(offset + 28)
138
- const extraLength = data.readUInt16LE(offset + 30)
139
- const commentLength = data.readUInt16LE(offset + 32)
140
- names.push(data.subarray(offset + 46, offset + 46 + nameLength).toString('utf8'))
141
- offset += 46 + nameLength + extraLength + commentLength
142
- }
143
- return names
144
- }
145
-
146
- /**
147
- * 从 ZIP 读单个条目的原始字节;不存在返回 undefined。
148
- * @param {Buffer|string} input - ZIP 字节或文件路径
149
- */
150
- export function readZipEntryBuffer(input, entryName, label = 'zip') {
151
- const data = Buffer.isBuffer(input) ? input : fs.readFileSync(input)
152
- const eocd = locateEocd(data, label)
153
- const count = data.readUInt16LE(eocd + 10)
154
- let offset = data.readUInt32LE(eocd + 16)
155
- for (let i = 0; i < count; i++) {
156
- if (data.readUInt32LE(offset) !== 0x02014b50) throw new Error(`ZIP 中央目录损坏: ${label}`)
157
- const method = data.readUInt16LE(offset + 10)
158
- const compSize = data.readUInt32LE(offset + 20)
159
- const nameLength = data.readUInt16LE(offset + 28)
160
- const extraLength = data.readUInt16LE(offset + 30)
161
- const commentLength = data.readUInt16LE(offset + 32)
162
- const localOffset = data.readUInt32LE(offset + 42)
163
- const name = data.subarray(offset + 46, offset + 46 + nameLength).toString('utf8')
164
- if (name === entryName) {
165
- const localNameLength = data.readUInt16LE(localOffset + 26)
166
- const localExtraLength = data.readUInt16LE(localOffset + 28)
167
- const start = localOffset + 30 + localNameLength + localExtraLength
168
- const body = data.subarray(start, start + compSize)
169
- if (method === 0) return body
170
- if (method === 8) return zlib.inflateRawSync(body)
171
- throw new Error(`不支持的 ZIP 压缩方式 ${method}: ${label}`)
172
- }
173
- offset += 46 + nameLength + extraLength + commentLength
174
- }
175
- return undefined
176
- }
177
-
178
- /** 读取 ZIP 中央目录条目名(文件路径版;打包自检/测试用)。 */
179
- export function listZipEntries(file) {
180
- return listZipEntryNames(fs.readFileSync(file), file)
181
- }
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * DSH 插件验证 CLI
4
- * 用法: validate-plugin <plugin-path>
5
- */
6
-
7
- import { fileURLToPath } from 'node:url'
8
- import { dirname, resolve } from 'node:path'
9
- import { validatePlugin } from '../lib/index.mjs'
10
-
11
- const __filename = fileURLToPath(import.meta.url)
12
- const __dirname = dirname(__filename)
13
-
14
- const pluginPath = process.argv[2]
15
-
16
- if (!pluginPath) {
17
- console.error('用法: validate-plugin <plugin-path>')
18
- console.error('示例: validate-plugin B/official/capyclaw-port-sidebar')
19
- process.exit(1)
20
- }
21
-
22
- const absolutePath = resolve(process.cwd(), pluginPath)
23
-
24
- console.log('🔍 验证插件:', absolutePath)
25
- console.log('━'.repeat(60))
26
-
27
- try {
28
- const result = await validatePlugin(absolutePath)
29
-
30
- if (result.valid) {
31
- console.log('\n✅ 验证通过!所有检查项合规。\n')
32
- if (result.warnings.length > 0) {
33
- console.log('⚠️ 警告:')
34
- result.warnings.forEach(w => console.log(' -', w))
35
- }
36
- process.exit(0)
37
- } else {
38
- console.log('\n❌ 验证失败!发现以下问题:\n')
39
- result.errors.forEach((err, i) => {
40
- console.log(`${i + 1}. [${err.rule}] ${err.message}`)
41
- if (err.hint) console.log(` 提示: ${err.hint}`)
42
- })
43
- console.log()
44
- process.exit(1)
45
- }
46
- } catch (error) {
47
- console.error('\n💥 验证过程出错:', error.message)
48
- process.exit(1)
49
- }
@@ -1,303 +0,0 @@
1
- /**
2
- * DSH 插件验证器核心
3
- * 强制检查插件是否符合规范
4
- */
5
-
6
- import { readFileSync, existsSync, statSync, readdirSync } from 'node:fs'
7
- import { join, basename } from 'node:path'
8
- import semver from 'semver'
9
-
10
- /**
11
- * 验证规则定义
12
- */
13
- const RULES = {
14
- // 必需文件
15
- REQUIRED_FILES: ['package.json', 'README.md', 'lib'],
16
-
17
- // 包名规则:dsh-<name> / @org/dsh-<name>,或已发布作用域 @capyclaw/<name>
18
- PACKAGE_NAME_PATTERN: /^((@[\w.-]+\/)?dsh-[\w.-]+|@capyclaw\/[\w.-]+)$/,
19
-
20
- // 必需的 package.json 字段
21
- REQUIRED_PKG_FIELDS: ['name', 'version', 'description', 'type', 'main', 'dsh', 'meta'],
22
-
23
- // 必需的 dsh 字段
24
- REQUIRED_DSH_FIELDS: ['category', 'platform'],
25
-
26
- // 有效的插件分类
27
- VALID_CATEGORIES: ['ui', 'service', 'bridge', 'tool', 'suite', 'skills'],
28
-
29
- // 有效的平台
30
- VALID_PLATFORMS: ['web', 'desktop', 'both'],
31
-
32
- // 基础设施包的锁定版本范围(统一走 @capyclaw/* scope 名)
33
- INFRASTRUCTURE_VERSIONS: {
34
- '@capyclaw/foundation': '^0.1.1',
35
- '@capyclaw/plugin-kit': '^0.2.0',
36
- '@capyclaw/service-host': '^0.1.0',
37
- '@capyclaw/tool-host': '^0.1.0',
38
- '@capyclaw/asset-service': '^0.1.0',
39
- '@capyclaw/suite-kit': '^0.1.0'
40
- }
41
- }
42
-
43
- /**
44
- * 验证插件
45
- * @param {string} pluginPath - 插件目录的绝对路径
46
- * @returns {Promise<{valid: boolean, errors: Array, warnings: Array}>}
47
- */
48
- export async function validatePlugin(pluginPath) {
49
- const errors = []
50
- const warnings = []
51
-
52
- // 1. 检查目录存在
53
- if (!existsSync(pluginPath)) {
54
- return {
55
- valid: false,
56
- errors: [{ rule: 'PATH', message: `插件目录不存在: ${pluginPath}` }],
57
- warnings: []
58
- }
59
- }
60
-
61
- if (!statSync(pluginPath).isDirectory()) {
62
- return {
63
- valid: false,
64
- errors: [{ rule: 'PATH', message: `路径不是目录: ${pluginPath}` }],
65
- warnings: []
66
- }
67
- }
68
-
69
- // 2. 加载 package.json(必需文件检查需要区分 suite-only 组合包)
70
- let pkg
71
- try {
72
- const pkgPath = join(pluginPath, 'package.json')
73
- pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))
74
- } catch (error) {
75
- checkRequiredFiles(pluginPath, null, errors)
76
- if (!errors.some(e => e.rule === 'REQUIRED_FILES')) {
77
- errors.push({
78
- rule: 'PACKAGE_JSON',
79
- message: `package.json 格式错误: ${error.message}`
80
- })
81
- }
82
- return { valid: false, errors, warnings }
83
- }
84
-
85
- // 3. 检查必需文件
86
- checkRequiredFiles(pluginPath, pkg, errors)
87
-
88
- // 4. 验证 package.json 内容
89
- checkPackageJson(pkg, errors, warnings)
90
-
91
- // 5. 验证目录结构
92
- checkDirectoryStructure(pluginPath, pkg, errors, warnings)
93
-
94
- // 6. 验证依赖
95
- checkDependencies(pkg, errors, warnings)
96
-
97
- return {
98
- valid: errors.length === 0,
99
- errors,
100
- warnings
101
- }
102
- }
103
-
104
- /**
105
- * 检查必需文件
106
- */
107
- function checkRequiredFiles(pluginPath, pkg, errors) {
108
- const suiteOnly = pkg?.dsh?.suite && !pkg?.main
109
- /* 入口有两种合法形态:legacy 的 lib/ 目录,或 foundation ABI 的 plugin.mjs
110
- * (由 package.json main 指向)。只要 main 可达即可,不再强制 lib/。 */
111
- const hasEntry = Boolean(pkg?.main) && existsSync(join(pluginPath, pkg.main))
112
- for (const file of RULES.REQUIRED_FILES) {
113
- if (file === 'lib' && (suiteOnly || hasEntry)) continue
114
- const filePath = join(pluginPath, file)
115
- if (!existsSync(filePath)) {
116
- errors.push({
117
- rule: 'REQUIRED_FILES',
118
- message: `缺少必需文件: ${file}`,
119
- hint: file === 'lib' ? '创建 lib/ 目录并放入主入口文件' : `创建 ${file} 文件`
120
- })
121
- }
122
- }
123
- }
124
-
125
- /**
126
- * 验证 package.json
127
- */
128
- function checkPackageJson(pkg, errors, warnings) {
129
- // 检查必需字段
130
- for (const field of RULES.REQUIRED_PKG_FIELDS) {
131
- // suite 组合包(dsh.suite 且无代码入口)没有 main 字段
132
- if (field === 'main' && pkg.dsh?.suite && !pkg.main) continue
133
- if (!pkg[field]) {
134
- errors.push({
135
- rule: 'PACKAGE_FIELDS',
136
- message: `package.json 缺少必需字段: ${field}`,
137
- hint: `在 package.json 中添加 "${field}" 字段`
138
- })
139
- }
140
- }
141
-
142
- // 检查包名规范
143
- if (pkg.name && !RULES.PACKAGE_NAME_PATTERN.test(pkg.name)) {
144
- errors.push({
145
- rule: 'PACKAGE_NAME',
146
- message: `包名不符合规范: ${pkg.name}`,
147
- hint: '包名必须形如 "dsh-<name>"、"@org/dsh-<name>",或已发布作用域 "@capyclaw/<name>"'
148
- })
149
- }
150
-
151
- // 检查版本号格式
152
- if (pkg.version && !semver.valid(pkg.version)) {
153
- errors.push({
154
- rule: 'VERSION',
155
- message: `版本号格式错误: ${pkg.version}`,
156
- hint: '使用语义化版本,如 "1.0.0"'
157
- })
158
- }
159
-
160
- // 检查 type 字段
161
- if (pkg.type !== 'module') {
162
- errors.push({
163
- rule: 'MODULE_TYPE',
164
- message: `必须使用 ESM 模块: type="${pkg.type || 'commonjs'}"`,
165
- hint: '在 package.json 中设置 "type": "module"'
166
- })
167
- }
168
-
169
- // 检查 dsh 字段
170
- if (pkg.dsh) {
171
- for (const field of RULES.REQUIRED_DSH_FIELDS) {
172
- if (!pkg.dsh[field]) {
173
- errors.push({
174
- rule: 'DSH_FIELDS',
175
- message: `dsh 配置缺少必需字段: ${field}`,
176
- hint: `在 package.json 的 dsh 对象中添加 "${field}" 字段`
177
- })
178
- }
179
- }
180
-
181
- // 检查分类有效性
182
- if (pkg.dsh.category && !RULES.VALID_CATEGORIES.includes(pkg.dsh.category)) {
183
- errors.push({
184
- rule: 'DSH_CATEGORY',
185
- message: `无效的插件分类: ${pkg.dsh.category}`,
186
- hint: `category 必须是: ${RULES.VALID_CATEGORIES.join(', ')}`
187
- })
188
- }
189
-
190
- // 检查平台有效性
191
- if (pkg.dsh.platform && !RULES.VALID_PLATFORMS.includes(pkg.dsh.platform)) {
192
- errors.push({
193
- rule: 'DSH_PLATFORM',
194
- message: `无效的平台: ${pkg.dsh.platform}`,
195
- hint: `platform 必须是: ${RULES.VALID_PLATFORMS.join(', ')}`
196
- })
197
- }
198
- }
199
-
200
- // 检查 meta 字段
201
- if (pkg.meta) {
202
- if (!pkg.meta.title) {
203
- errors.push({
204
- rule: 'META_TITLE',
205
- message: 'meta.title 必需(用户可见的插件标题)',
206
- hint: '在 package.json 的 meta 对象中添加 "title" 字段'
207
- })
208
- }
209
- if (!pkg.meta.description) {
210
- warnings.push('meta.description 建议提供(用户可见的详细描述)')
211
- }
212
- }
213
- }
214
-
215
- /**
216
- * 检查目录结构
217
- */
218
- function checkDirectoryStructure(pluginPath, pkg, errors, warnings) {
219
- // 检查 lib/ 目录内容
220
- const libPath = join(pluginPath, 'lib')
221
- if (existsSync(libPath)) {
222
- const libFiles = readdirSync(libPath)
223
- if (libFiles.length === 0) {
224
- errors.push({
225
- rule: 'LIB_EMPTY',
226
- message: 'lib/ 目录为空',
227
- hint: '在 lib/ 中添加主入口文件(如 index.mjs)'
228
- })
229
- }
230
-
231
- // 检查 main 字段指向的文件是否存在
232
- if (pkg.main) {
233
- const mainPath = join(pluginPath, pkg.main)
234
- if (!existsSync(mainPath)) {
235
- errors.push({
236
- rule: 'MAIN_NOT_FOUND',
237
- message: `main 字段指向的文件不存在: ${pkg.main}`,
238
- hint: '确保 main 字段指向的文件存在'
239
- })
240
- }
241
- }
242
- }
243
-
244
- // 检查 README.md 内容
245
- const readmePath = join(pluginPath, 'README.md')
246
- if (existsSync(readmePath)) {
247
- const readme = readFileSync(readmePath, 'utf-8')
248
- if (readme.trim().length < 100) {
249
- warnings.push('README.md 内容过少,建议补充使用说明')
250
- }
251
- }
252
- }
253
-
254
- /**
255
- * 检查依赖
256
- */
257
- function checkDependencies(pkg, errors, warnings) {
258
- const deps = pkg.dependencies || {}
259
-
260
- // 强制:必须依赖 @capyclaw/foundation(新 ABI)或 @capyclaw/plugin-kit(legacy),suite 除外
261
- if (pkg.dsh?.category !== 'suite') {
262
- if (deps['@capyclaw/foundation']) {
263
- const expectedVersion = RULES.INFRASTRUCTURE_VERSIONS['@capyclaw/foundation']
264
- if (expectedVersion && !semver.satisfies(semver.coerce(deps['@capyclaw/foundation']), expectedVersion)) {
265
- warnings.push(`@capyclaw/foundation 版本建议使用 ${expectedVersion},当前: ${deps['@capyclaw/foundation']}`)
266
- }
267
- } else if (!deps['@capyclaw/plugin-kit']) {
268
- errors.push({
269
- rule: 'PLUGIN_KIT_REQUIRED',
270
- message: '必须依赖 @capyclaw/foundation 或 @capyclaw/plugin-kit',
271
- hint: '在 dependencies 中添加 "@capyclaw/foundation": "^0.1.0"(新插件)'
272
- })
273
- } else {
274
- // 检查版本范围
275
- const expectedVersion = RULES.INFRASTRUCTURE_VERSIONS['@capyclaw/plugin-kit']
276
- if (!semver.satisfies(semver.coerce(deps['@capyclaw/plugin-kit']), expectedVersion)) {
277
- warnings.push(`@capyclaw/plugin-kit 版本建议使用 ${expectedVersion},当前: ${deps['@capyclaw/plugin-kit']}`)
278
- }
279
- }
280
- }
281
-
282
- // 检查其他基础设施包的版本
283
- for (const [pkgName, expectedVersion] of Object.entries(RULES.INFRASTRUCTURE_VERSIONS)) {
284
- if (deps[pkgName]) {
285
- const actualVersion = deps[pkgName]
286
- if (!semver.intersects(actualVersion, expectedVersion)) {
287
- warnings.push(`${pkgName} 版本不匹配,建议: ${expectedVersion},当前: ${actualVersion}`)
288
- }
289
- }
290
- }
291
- }
292
-
293
- /**
294
- * 批量验证多个插件
295
- */
296
- export async function validatePlugins(pluginPaths) {
297
- const results = []
298
- for (const path of pluginPaths) {
299
- const result = await validatePlugin(path)
300
- results.push({ path, ...result })
301
- }
302
- return results
303
- }
@@ -1,28 +0,0 @@
1
- {
2
- "name": "@capyclaw/plugin-validator",
3
- "version": "1.0.0",
4
- "description": "DSH 插件强制验证工具:检查目录结构、依赖规范、代码质量",
5
- "type": "module",
6
- "main": "./lib/index.mjs",
7
- "bin": {
8
- "validate-plugin": "./bin/cli.mjs"
9
- },
10
- "scripts": {},
11
- "dependencies": {
12
- "semver": "^7.5.4",
13
- "yaml": "^2.3.4"
14
- },
15
- "publishConfig": {
16
- "access": "public"
17
- },
18
- "license": "MIT",
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/Maple496/capyclaw.git",
22
- "directory": "C/tools/capyclaw-plugin-validator"
23
- },
24
- "bugs": {
25
- "url": "https://github.com/Maple496/capyclaw/issues"
26
- },
27
- "homepage": "https://github.com/Maple496/capyclaw/tree/main/C/tools/capyclaw-plugin-validator#readme"
28
- }
@@ -1,56 +0,0 @@
1
- # @capyclaw/tool-host
2
-
3
- DSH 公共工具面插件。把每个插件都会重复写的工具声明、注册表、参数校验、契约报告、MCP 协议壳和 instructions 模板收成一套。
4
-
5
- ## 使用
6
-
7
- ```js
8
- export const inject = ['toolHost']
9
-
10
- const echo = ctx.toolHost.defineTool({
11
- name: 'demo_echo',
12
- description: '回显文本',
13
- inputSchema: { type: 'object', properties: { text: { type: 'string' } }, required: ['text'] },
14
- handler: ({ text }) => ({ content: [{ type: 'text', text }] }),
15
- })
16
-
17
- const capabilities = [
18
- ctx.toolHost.defineCapability({ id: 'demo', title: 'Demo', tools: [echo] }),
19
- ]
20
-
21
- const registry = ctx.toolHost.createRegistry(capabilities)
22
- const mcp = ctx.toolHost.createMcpHandler({
23
- registry,
24
- instructions: ctx.toolHost.buildInstructions({ title: 'Demo', capabilities: registry.CAPABILITIES }),
25
- })
26
- ```
27
-
28
- ## 原生 DSH 工具面
29
-
30
- ```js
31
- export const inject = ['toolHost']
32
-
33
- export function apply(ctx) {
34
- const registry = ctx.toolHost.createRegistry(capabilities)
35
- const dispose = ctx.toolHost.registerWithDsh(ctx, registry, { namespace: 'demo' })
36
- return dispose
37
- }
38
- ```
39
-
40
- 注册后工具直接出现在 `ctx.tools`,不需要 loopback `/mcp` 和 `dsh-mcp-client` row。
41
- MCP handler 仍保留给跨进程/外部客户端。
42
-
43
- ## 提供什么
44
-
45
- - `defineTool` / `defineCapability`:声明式能力 DSL
46
- - `createRegistry`:校验 id/工具名/依赖/服务唯一性,派生 `TOOLS / TOOL_IMPL / TOOL_META / FEATURES / CAPABILITIES`
47
- - `createToolDispatcher`:统一参数校验后分派
48
- - `createMcpHandler`:MCP Streamable HTTP(initialize / ping / tools/list / tools/call)
49
- - `createCapabilityReport`:契约报告
50
- - `buildInstructions`:MCP server instructions 模板
51
-
52
- ## 边界
53
-
54
- - 不绑定具体插件;PPT 只是第一个消费者
55
- - 不负责 HTTP 监听;和 `@capyclaw/service-host` 组合使用
56
- - 不负责契约快照文件;由构建脚本调用 `registry.ctx.contract.report()` 生成
@@ -1,4 +0,0 @@
1
- # 由 @capyclaw/tool-host 提供;功能插件通过 inject: ['toolHost'] 或 ctx.get('toolHost') 使用。
2
- - insert:
3
- - id: tool-host
4
- name: "@capyclaw/tool-host"
@@ -1,30 +0,0 @@
1
- {
2
- "$schema": "../capyclaw-suite-kit/suite.schema.json",
3
- "name": "dsh-tool-host-suite",
4
- "version": "0.2.0",
5
- "title": "Tool Host",
6
- "description": "通用工具面:能力 DSL、注册表、校验、契约、MCP 壳、跨套件能力描述符注册/发现。",
7
- "packages": {
8
- "@capyclaw/tool-host": {
9
- "role": "provider",
10
- "version": "^0.2.0",
11
- "path": ".",
12
- "provides": {
13
- "services": [
14
- "toolHost"
15
- ],
16
- "capabilities": {
17
- "tools.registry": "1.0.0",
18
- "tools.descriptors": "1.1.0"
19
- }
20
- }
21
- }
22
- },
23
- "rows": [
24
- {
25
- "id": "tool-host",
26
- "name": "@capyclaw/tool-host"
27
- }
28
- ],
29
- "checks": []
30
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * @capyclaw/tool-host 插件:向同进程插件提供 ctx.toolHost。
3
- */
4
- import { defineDriver } from '@capyclaw/foundation/abi'
5
- import { createToolHost } from '../src/index.mjs'
6
-
7
- export const { name, inject, apply } = defineDriver({
8
- name: 'tool-host',
9
- service: 'toolHost',
10
- apply(ctx, config = {}) {
11
- const service = createToolHost(config)
12
- const dispose = ctx.provide('toolHost', service)
13
- console.log('[tool-host] ready')
14
- return () => { if (typeof dispose === 'function') dispose() }
15
- },
16
- })