@capyclaw/ppt-suite 2.4.10 → 2.5.68

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 (651) hide show
  1. package/README.md +45 -42
  2. package/composition.lock.json +46 -70
  3. package/contract/ppt-contract.json +310 -11
  4. package/cordis.patch.yml +5 -25
  5. package/dsh-suite.json +108 -194
  6. package/lib/index.mjs +1 -1
  7. package/node_modules/@capyclaw/asset-service/README.md +48 -0
  8. package/node_modules/@capyclaw/asset-service/cordis.patch.yml +4 -0
  9. package/node_modules/@capyclaw/asset-service/dsh-suite.json +29 -0
  10. package/node_modules/@capyclaw/asset-service/lib/host.mjs +14 -0
  11. package/node_modules/@capyclaw/asset-service/package.json +59 -0
  12. package/node_modules/@capyclaw/asset-service/src/index.mjs +304 -0
  13. package/node_modules/@capyclaw/document-workbench/README.md +125 -0
  14. package/node_modules/@capyclaw/document-workbench/package.json +44 -0
  15. package/node_modules/@capyclaw/document-workbench/src/bridge/index.mjs +321 -0
  16. package/node_modules/@capyclaw/document-workbench/src/client/index.mjs +625 -0
  17. package/node_modules/@capyclaw/document-workbench/src/client/screenshot.mjs +98 -0
  18. package/node_modules/@capyclaw/document-workbench/src/index.mjs +9 -0
  19. package/node_modules/@capyclaw/document-workbench/src/model/audit.mjs +101 -0
  20. package/node_modules/@capyclaw/document-workbench/src/model/conformance.mjs +92 -0
  21. package/node_modules/@capyclaw/document-workbench/src/model/ids.mjs +56 -0
  22. package/node_modules/@capyclaw/document-workbench/src/model/index.mjs +18 -0
  23. package/node_modules/@capyclaw/document-workbench/src/model/locate.mjs +118 -0
  24. package/node_modules/@capyclaw/document-workbench/src/model/manifest.mjs +148 -0
  25. package/node_modules/@capyclaw/document-workbench/src/model/ops.mjs +160 -0
  26. package/node_modules/@capyclaw/document-workbench/src/model/validate.mjs +72 -0
  27. package/node_modules/@capyclaw/document-workbench/src/ops/index.mjs +93 -0
  28. package/node_modules/@capyclaw/document-workbench/src/session/context.mjs +103 -0
  29. package/node_modules/@capyclaw/document-workbench/src/session/index.mjs +394 -0
  30. package/node_modules/@capyclaw/document-workbench/src/session/lease.mjs +105 -0
  31. package/node_modules/@capyclaw/document-workbench/src/session/mode.mjs +80 -0
  32. package/node_modules/@capyclaw/document-workbench/src/session/sanitize.mjs +107 -0
  33. package/node_modules/@capyclaw/document-workbench/src/session/state.mjs +159 -0
  34. package/node_modules/@capyclaw/document-workbench/src/session/watch.mjs +63 -0
  35. package/node_modules/@capyclaw/document-workbench/src/store/file-backend.mjs +158 -0
  36. package/node_modules/@capyclaw/document-workbench/src/testing/index.mjs +75 -0
  37. package/node_modules/@capyclaw/editor-host/README.md +37 -0
  38. package/node_modules/@capyclaw/editor-host/cordis.patch.yml +4 -0
  39. package/node_modules/@capyclaw/editor-host/dsh-suite.json +29 -0
  40. package/node_modules/@capyclaw/editor-host/lib/host.mjs +14 -0
  41. package/node_modules/@capyclaw/editor-host/package.json +59 -0
  42. package/node_modules/@capyclaw/editor-host/src/index.mjs +164 -0
  43. package/node_modules/@capyclaw/foundation/README.md +51 -0
  44. package/node_modules/@capyclaw/foundation/abi/bridge.mjs +86 -0
  45. package/node_modules/@capyclaw/foundation/abi/errors.mjs +63 -0
  46. package/node_modules/@capyclaw/foundation/abi/index.mjs +35 -0
  47. package/node_modules/@capyclaw/foundation/abi/kinds.mjs +271 -0
  48. package/node_modules/@capyclaw/foundation/abi/loader.mjs +345 -0
  49. package/node_modules/@capyclaw/foundation/abi/schema.mjs +98 -0
  50. package/node_modules/@capyclaw/foundation/abi/spec.mjs +255 -0
  51. package/node_modules/@capyclaw/foundation/abi/validate.mjs +24 -0
  52. package/node_modules/@capyclaw/foundation/abi/version.mjs +82 -0
  53. package/node_modules/@capyclaw/foundation/cordis.patch.yml +5 -0
  54. package/node_modules/@capyclaw/foundation/kit/index.mjs +6 -0
  55. package/node_modules/@capyclaw/foundation/lib/adapters/client-panel.mjs +98 -0
  56. package/node_modules/@capyclaw/foundation/lib/adapters/host-event.mjs +35 -0
  57. package/node_modules/@capyclaw/foundation/lib/adapters/http-router.mjs +69 -0
  58. package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +55 -0
  59. package/node_modules/@capyclaw/foundation/lib/adapters/own-server.mjs +113 -0
  60. package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +69 -0
  61. package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +120 -0
  62. package/node_modules/@capyclaw/foundation/lib/adapters/service-provider.mjs +77 -0
  63. package/node_modules/@capyclaw/foundation/lib/adapters/skill-provider.mjs +56 -0
  64. package/node_modules/@capyclaw/foundation/lib/adapters/tool-provider.mjs +50 -0
  65. package/node_modules/@capyclaw/foundation/lib/adapters/ui-panel.mjs +64 -0
  66. package/node_modules/@capyclaw/foundation/lib/ctx-service.mjs +42 -0
  67. package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +34 -0
  68. package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +85 -0
  69. package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +50 -0
  70. package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +160 -0
  71. package/node_modules/@capyclaw/foundation/lib/host.mjs +23 -0
  72. package/node_modules/@capyclaw/foundation/lib/kernel.mjs +185 -0
  73. package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +115 -0
  74. package/node_modules/@capyclaw/foundation/lib/subsystems/events.mjs +60 -0
  75. package/node_modules/@capyclaw/foundation/lib/subsystems/log.mjs +51 -0
  76. package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +188 -0
  77. package/node_modules/@capyclaw/foundation/package.json +53 -0
  78. package/node_modules/@capyclaw/foundation/runtime/index.mjs +20 -0
  79. package/node_modules/@capyclaw/plugin-kit/INTEGRATION.md +100 -0
  80. package/node_modules/@capyclaw/plugin-kit/README.md +70 -0
  81. package/node_modules/@capyclaw/plugin-kit/bin/sync.mjs +103 -0
  82. package/node_modules/@capyclaw/plugin-kit/package.json +69 -0
  83. package/node_modules/@capyclaw/plugin-kit/src/cli.mjs +56 -0
  84. package/node_modules/@capyclaw/plugin-kit/src/config.mjs +142 -0
  85. package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +129 -0
  86. package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +58 -0
  87. package/node_modules/@capyclaw/plugin-kit/src/editor/shadow.mjs +219 -0
  88. package/node_modules/@capyclaw/plugin-kit/src/editor/transport.js +13 -0
  89. package/node_modules/@capyclaw/plugin-kit/src/index.mjs +13 -0
  90. package/node_modules/@capyclaw/plugin-kit/src/pack.mjs +230 -0
  91. package/node_modules/@capyclaw/plugin-kit/src/runtime/context.mjs +128 -0
  92. package/node_modules/@capyclaw/plugin-kit/src/self-contained.mjs +307 -0
  93. package/node_modules/@capyclaw/plugin-kit/src/service/api.mjs +45 -0
  94. package/node_modules/@capyclaw/plugin-kit/src/service/http.mjs +113 -0
  95. package/node_modules/@capyclaw/plugin-kit/src/service/mcp-http.mjs +150 -0
  96. package/node_modules/@capyclaw/plugin-kit/src/service/server.mjs +131 -0
  97. package/node_modules/@capyclaw/plugin-kit/src/skills/provider.mjs +82 -0
  98. package/node_modules/@capyclaw/plugin-kit/src/store/blob-store.mjs +109 -0
  99. package/node_modules/@capyclaw/plugin-kit/src/store/content-store.mjs +17 -0
  100. package/node_modules/@capyclaw/plugin-kit/src/store/journal-store.mjs +89 -0
  101. package/node_modules/@capyclaw/plugin-kit/src/tools/result.mjs +57 -0
  102. package/node_modules/@capyclaw/plugin-kit/src/tools/validate.mjs +150 -0
  103. package/node_modules/@capyclaw/plugin-kit/src/tuning.mjs +82 -0
  104. package/node_modules/@capyclaw/plugin-kit/src/util/fs-lock.mjs +132 -0
  105. package/node_modules/@capyclaw/plugin-kit/src/util/http.mjs +130 -0
  106. package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +656 -0
  107. package/node_modules/@capyclaw/plugin-kit/src/zip.mjs +181 -0
  108. package/node_modules/@capyclaw/portal/README.md +70 -0
  109. package/node_modules/@capyclaw/portal/lib/index.mjs +387 -0
  110. package/node_modules/@capyclaw/portal/lib/ledger.mjs +194 -0
  111. package/node_modules/@capyclaw/portal/lib/portal-agent.ps1 +811 -0
  112. package/node_modules/@capyclaw/portal/lib/portal-darwin.mjs +183 -0
  113. package/node_modules/@capyclaw/portal/package.json +40 -0
  114. package/node_modules/@capyclaw/ppt-editor/LICENSE +661 -0
  115. package/node_modules/@capyclaw/ppt-editor/README.md +86 -0
  116. package/node_modules/@capyclaw/ppt-editor/THIRD_PARTY_NOTICES.md +21 -0
  117. package/node_modules/@capyclaw/ppt-editor/app.js +6298 -0
  118. package/node_modules/@capyclaw/ppt-editor/contract/ppt-contract.json +1828 -0
  119. package/node_modules/@capyclaw/ppt-editor/heartbeat-worker.js +129 -0
  120. package/node_modules/@capyclaw/ppt-editor/index.html +176 -0
  121. package/node_modules/@capyclaw/ppt-editor/lib/index.mjs +8 -0
  122. package/node_modules/@capyclaw/ppt-editor/package.json +57 -0
  123. package/node_modules/@capyclaw/ppt-editor/ppt-full-app.js +381 -0
  124. package/node_modules/@capyclaw/ppt-skill-api/README.md +3 -0
  125. package/node_modules/@capyclaw/ppt-skill-api/contract/ppt-contract.json +1828 -0
  126. package/node_modules/@capyclaw/ppt-skill-api/cordis.patch.yml +4 -0
  127. package/node_modules/@capyclaw/ppt-skill-api/package.json +49 -0
  128. package/node_modules/@capyclaw/ppt-skill-api/plugin.mjs +15 -0
  129. package/node_modules/@capyclaw/ppt-skill-api/skills/pptist-api/SKILL.md +137 -0
  130. package/node_modules/@capyclaw/ppt-skill-api/skills/pptist-api/references/tool-contract.md +1646 -0
  131. package/node_modules/@capyclaw/ppt-skill-api/skills/pptist-api/references/visual-qa.md +28 -0
  132. package/node_modules/@capyclaw/ppt-skill-proposal/README.md +3 -0
  133. package/node_modules/@capyclaw/ppt-skill-proposal/contract/ppt-contract.json +1828 -0
  134. package/node_modules/@capyclaw/ppt-skill-proposal/cordis.patch.yml +4 -0
  135. package/node_modules/@capyclaw/ppt-skill-proposal/package.json +49 -0
  136. package/node_modules/@capyclaw/ppt-skill-proposal/plugin.mjs +15 -0
  137. package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/SKILL.md +83 -0
  138. package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/references/anti-ai-slop.md +18 -0
  139. package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/references/deck-structure.md +42 -0
  140. package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/references/design-tokens.md +36 -0
  141. package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/references/layout-system.md +30 -0
  142. package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/references/page-craft.md +31 -0
  143. package/node_modules/@capyclaw/ppt-skill-proposal/skills/pptmaster-proposal/references/scqa-pyramid.md +26 -0
  144. package/node_modules/@capyclaw/ppt-workbench/LICENSE +661 -0
  145. package/node_modules/@capyclaw/ppt-workbench/README.md +173 -0
  146. package/node_modules/@capyclaw/ppt-workbench/THIRD_PARTY_NOTICES.md +21 -0
  147. package/node_modules/@capyclaw/ppt-workbench/contract/ppt-contract.json +1828 -0
  148. package/node_modules/@capyclaw/ppt-workbench/core/audit.js +507 -0
  149. package/node_modules/@capyclaw/ppt-workbench/core/chart.js +199 -0
  150. package/node_modules/@capyclaw/ppt-workbench/core/color.js +170 -0
  151. package/node_modules/@capyclaw/ppt-workbench/core/deck-layout.js +375 -0
  152. package/node_modules/@capyclaw/ppt-workbench/core/formula.js +80 -0
  153. package/node_modules/@capyclaw/ppt-workbench/core/hfmath/hershey.js +1763 -0
  154. package/node_modules/@capyclaw/ppt-workbench/core/hfmath/index.js +1176 -0
  155. package/node_modules/@capyclaw/ppt-workbench/core/hfmath/stretch.js +41 -0
  156. package/node_modules/@capyclaw/ppt-workbench/core/hfmath/symbols.js +408 -0
  157. package/node_modules/@capyclaw/ppt-workbench/core/inspect.js +366 -0
  158. package/node_modules/@capyclaw/ppt-workbench/core/manuscript/compare.mjs +103 -0
  159. package/node_modules/@capyclaw/ppt-workbench/core/manuscript/compile.mjs +322 -0
  160. package/node_modules/@capyclaw/ppt-workbench/core/manuscript/edit.mjs +239 -0
  161. package/node_modules/@capyclaw/ppt-workbench/core/manuscript/parse.mjs +346 -0
  162. package/node_modules/@capyclaw/ppt-workbench/core/manuscript/render-html.mjs +84 -0
  163. package/node_modules/@capyclaw/ppt-workbench/core/manuscript/sync.mjs +101 -0
  164. package/node_modules/@capyclaw/ppt-workbench/core/measure.js +104 -0
  165. package/node_modules/@capyclaw/ppt-workbench/core/ops/browser.js +28 -0
  166. package/node_modules/@capyclaw/ppt-workbench/core/ops/chart.js +64 -0
  167. package/node_modules/@capyclaw/ppt-workbench/core/ops/deck.js +21 -0
  168. package/node_modules/@capyclaw/ppt-workbench/core/ops/element.js +55 -0
  169. package/node_modules/@capyclaw/ppt-workbench/core/ops/history.js +11 -0
  170. package/node_modules/@capyclaw/ppt-workbench/core/ops/import.js +95 -0
  171. package/node_modules/@capyclaw/ppt-workbench/core/ops/index.js +39 -0
  172. package/node_modules/@capyclaw/ppt-workbench/core/ops/playback.js +9 -0
  173. package/node_modules/@capyclaw/ppt-workbench/core/ops/recolor.js +87 -0
  174. package/node_modules/@capyclaw/ppt-workbench/core/ops/slide.js +66 -0
  175. package/node_modules/@capyclaw/ppt-workbench/core/ops/table.js +85 -0
  176. package/node_modules/@capyclaw/ppt-workbench/core/ops/text.js +35 -0
  177. package/node_modules/@capyclaw/ppt-workbench/core/ops/view.js +13 -0
  178. package/node_modules/@capyclaw/ppt-workbench/core/ops.js +12 -0
  179. package/node_modules/@capyclaw/ppt-workbench/core/quick.js +52 -0
  180. package/node_modules/@capyclaw/ppt-workbench/core/shape-library.js +122 -0
  181. package/node_modules/@capyclaw/ppt-workbench/core/table.js +178 -0
  182. package/node_modules/@capyclaw/ppt-workbench/core/text.js +200 -0
  183. package/node_modules/@capyclaw/ppt-workbench/lib/host.mjs +1 -0
  184. package/node_modules/@capyclaw/ppt-workbench/package.json +73 -0
  185. package/node_modules/@capyclaw/ppt-workbench/plugin.mjs +1 -0
  186. package/node_modules/@capyclaw/ppt-workbench/server/audit.mjs +2 -0
  187. package/node_modules/@capyclaw/ppt-workbench/server/bridge-client.mjs +308 -0
  188. package/node_modules/@capyclaw/ppt-workbench/server/constants.mjs +21 -0
  189. package/node_modules/@capyclaw/ppt-workbench/server/contract-snapshots.mjs +89 -0
  190. package/node_modules/@capyclaw/ppt-workbench/server/contract.mjs +24 -0
  191. package/node_modules/@capyclaw/ppt-workbench/server/deck-layout.mjs +2 -0
  192. package/node_modules/@capyclaw/ppt-workbench/server/editor-assets.mjs +132 -0
  193. package/node_modules/@capyclaw/ppt-workbench/server/embedded-host.mjs +252 -0
  194. package/node_modules/@capyclaw/ppt-workbench/server/http-utils.mjs +2 -0
  195. package/node_modules/@capyclaw/ppt-workbench/server/infra/http.mjs +2 -0
  196. package/node_modules/@capyclaw/ppt-workbench/server/infra/runtime/context.mjs +2 -0
  197. package/node_modules/@capyclaw/ppt-workbench/server/infra/store/blob-store.mjs +2 -0
  198. package/node_modules/@capyclaw/ppt-workbench/server/infra/tuning.mjs +2 -0
  199. package/node_modules/@capyclaw/ppt-workbench/server/infra/util/fs-lock.mjs +2 -0
  200. package/node_modules/@capyclaw/ppt-workbench/server/infra/workspace/manager.mjs +2 -0
  201. package/node_modules/@capyclaw/ppt-workbench/server/mcp/dispatch.mjs +2 -0
  202. package/node_modules/@capyclaw/ppt-workbench/server/mcp/handler.mjs +2 -0
  203. package/node_modules/@capyclaw/ppt-workbench/server/mcp/instructions.mjs +66 -0
  204. package/node_modules/@capyclaw/ppt-workbench/server/ppt-shim.mjs +168 -0
  205. package/node_modules/@capyclaw/ppt-workbench/server/relay.mjs +282 -0
  206. package/node_modules/@capyclaw/ppt-workbench/server/routes/assets.mjs +2 -0
  207. package/node_modules/@capyclaw/ppt-workbench/server/routes/bridge.mjs +74 -0
  208. package/node_modules/@capyclaw/ppt-workbench/server/routes/editor.mjs +9 -0
  209. package/node_modules/@capyclaw/ppt-workbench/server/routes/import.mjs +260 -0
  210. package/node_modules/@capyclaw/ppt-workbench/server/routes/manuscript.mjs +414 -0
  211. package/node_modules/@capyclaw/ppt-workbench/server/routes/mcp.mjs +17 -0
  212. package/node_modules/@capyclaw/ppt-workbench/server/routes/session.mjs +36 -0
  213. package/node_modules/@capyclaw/ppt-workbench/server/runtime/recovery.mjs +9 -0
  214. package/node_modules/@capyclaw/ppt-workbench/server/runtime/watch.mjs +17 -0
  215. package/node_modules/@capyclaw/ppt-workbench/server/session-context.mjs +5 -0
  216. package/node_modules/@capyclaw/ppt-workbench/server/shared/SHARED_MANIFEST.json +70 -0
  217. package/node_modules/@capyclaw/ppt-workbench/server/shared/asset-service.mjs +2 -0
  218. package/node_modules/@capyclaw/ppt-workbench/server/shared/editor-host.mjs +2 -0
  219. package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/editor/lease.mjs +2 -0
  220. package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/service/api.mjs +2 -0
  221. package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/service/http.mjs +2 -0
  222. package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/service/mcp-http.mjs +2 -0
  223. package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/tools/validate.mjs +2 -0
  224. package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/tuning.mjs +2 -0
  225. package/node_modules/@capyclaw/ppt-workbench/server/shared/kit/util/fs-lock.mjs +2 -0
  226. package/node_modules/@capyclaw/ppt-workbench/server/shared/service-host.mjs +2 -0
  227. package/node_modules/@capyclaw/ppt-workbench/server/shared/tool-host.mjs +2 -0
  228. package/node_modules/@capyclaw/ppt-workbench/server/shared/tuning.mjs +2 -0
  229. package/node_modules/@capyclaw/ppt-workbench/server/store/backends/file-backend.mjs +13 -0
  230. package/node_modules/@capyclaw/ppt-workbench/server/store/checkpoints.mjs +28 -0
  231. package/node_modules/@capyclaw/ppt-workbench/server/store/deck-sanitize.mjs +68 -0
  232. package/node_modules/@capyclaw/ppt-workbench/server/store/doc.mjs +56 -0
  233. package/node_modules/@capyclaw/ppt-workbench/server/store/index.mjs +34 -0
  234. package/node_modules/@capyclaw/ppt-workbench/server/store/journal.mjs +9 -0
  235. package/node_modules/@capyclaw/ppt-workbench/server/store/lease.mjs +2 -0
  236. package/node_modules/@capyclaw/ppt-workbench/server/store/sanitize.mjs +33 -0
  237. package/node_modules/@capyclaw/ppt-workbench/server/store/sessions.mjs +314 -0
  238. package/node_modules/@capyclaw/ppt-workbench/server/store.mjs +2 -0
  239. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/apply.mjs +33 -0
  240. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/audit.mjs +28 -0
  241. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/chart.mjs +83 -0
  242. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/compose.mjs +97 -0
  243. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/contract.mjs +38 -0
  244. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/deck.mjs +27 -0
  245. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/element.mjs +67 -0
  246. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/export.mjs +99 -0
  247. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/formula.mjs +72 -0
  248. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/history.mjs +29 -0
  249. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/image.mjs +174 -0
  250. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/imagesearch.mjs +203 -0
  251. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/import.mjs +180 -0
  252. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/index.mjs +64 -0
  253. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/inspect.mjs +46 -0
  254. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/line.mjs +58 -0
  255. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/manuscript.mjs +208 -0
  256. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/notes.mjs +33 -0
  257. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/present.mjs +34 -0
  258. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/recolor.mjs +62 -0
  259. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/screenshot.mjs +191 -0
  260. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/shape.mjs +64 -0
  261. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/slide.mjs +81 -0
  262. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/style.mjs +48 -0
  263. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/table.mjs +127 -0
  264. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/task.mjs +52 -0
  265. package/node_modules/@capyclaw/ppt-workbench/server/tools/capabilities/text.mjs +82 -0
  266. package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/color.mjs +4 -0
  267. package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/image.mjs +78 -0
  268. package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/index.mjs +7 -0
  269. package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/manuscript-media.mjs +159 -0
  270. package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/offline-render.mjs +256 -0
  271. package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/pptx-export.mjs +577 -0
  272. package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/recolor.mjs +25 -0
  273. package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/remote-image.mjs +443 -0
  274. package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/slide.mjs +21 -0
  275. package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/text-style.mjs +11 -0
  276. package/node_modules/@capyclaw/ppt-workbench/server/tools/domains/tooling.mjs +13 -0
  277. package/node_modules/@capyclaw/ppt-workbench/server/tools/index.mjs +14 -0
  278. package/node_modules/@capyclaw/ppt-workbench/server/tools/kernel/define.mjs +5 -0
  279. package/node_modules/@capyclaw/ppt-workbench/server/tools/kernel/ports.mjs +52 -0
  280. package/node_modules/@capyclaw/ppt-workbench/server/tools/kernel/registry.mjs +17 -0
  281. package/node_modules/@capyclaw/ppt-workbench/server/tools/model/deck-schema.mjs +105 -0
  282. package/node_modules/@capyclaw/ppt-workbench/server/tools.mjs +18 -0
  283. package/node_modules/@capyclaw/ppt-workbench/server/tuning.mjs +93 -0
  284. package/node_modules/@capyclaw/ppt-workbench/server/validate.mjs +2 -0
  285. package/node_modules/@capyclaw/ppt-workbench/server/workbench-framework.mjs +305 -0
  286. package/node_modules/@capyclaw/service-broker/README.md +104 -0
  287. package/node_modules/@capyclaw/service-broker/cordis.patch.yml +8 -0
  288. package/node_modules/@capyclaw/service-broker/dsh-suite.json +21 -0
  289. package/node_modules/@capyclaw/service-broker/lib/control.mjs +193 -0
  290. package/node_modules/@capyclaw/service-broker/lib/discovery.mjs +109 -0
  291. package/node_modules/@capyclaw/service-broker/lib/engine.mjs +1236 -0
  292. package/node_modules/@capyclaw/service-broker/lib/host.mjs +182 -0
  293. package/node_modules/@capyclaw/service-broker/lib/manifest.mjs +249 -0
  294. package/node_modules/@capyclaw/service-broker/lib/recovery.mjs +275 -0
  295. package/node_modules/@capyclaw/service-broker/lib/skills-client.mjs +28 -0
  296. package/node_modules/@capyclaw/service-broker/lib/spec.mjs +78 -0
  297. package/node_modules/@capyclaw/service-broker/package.json +65 -0
  298. package/node_modules/@capyclaw/service-broker/server.mjs +81 -0
  299. package/node_modules/@capyclaw/service-broker/service.schema.json +62 -0
  300. package/node_modules/@capyclaw/service-broker/services.json +3 -0
  301. package/node_modules/@capyclaw/service-host/README.md +86 -0
  302. package/node_modules/@capyclaw/service-host/cordis.patch.yml +4 -0
  303. package/node_modules/@capyclaw/service-host/dsh-suite.json +29 -0
  304. package/node_modules/@capyclaw/service-host/lib/host.mjs +22 -0
  305. package/node_modules/@capyclaw/service-host/package.json +60 -0
  306. package/node_modules/@capyclaw/service-host/src/index.mjs +571 -0
  307. package/node_modules/@capyclaw/service-host/src/tuning.mjs +63 -0
  308. package/node_modules/@capyclaw/skills-service/README.md +31 -0
  309. package/node_modules/@capyclaw/skills-service/package.json +30 -0
  310. package/node_modules/@capyclaw/skills-service/server.mjs +237 -0
  311. package/node_modules/@capyclaw/tool-host/README.md +56 -0
  312. package/node_modules/@capyclaw/tool-host/cordis.patch.yml +4 -0
  313. package/node_modules/@capyclaw/tool-host/dsh-suite.json +30 -0
  314. package/node_modules/@capyclaw/tool-host/lib/host.mjs +16 -0
  315. package/node_modules/@capyclaw/tool-host/package.json +59 -0
  316. package/node_modules/@capyclaw/tool-host/src/descriptors.mjs +166 -0
  317. package/node_modules/@capyclaw/tool-host/src/index.mjs +416 -0
  318. package/node_modules/@types/node/LICENSE +21 -0
  319. package/node_modules/@types/node/README.md +15 -0
  320. package/node_modules/@types/node/assert/strict.d.ts +8 -0
  321. package/node_modules/@types/node/assert.d.ts +1005 -0
  322. package/node_modules/@types/node/async_hooks.d.ts +586 -0
  323. package/node_modules/@types/node/buffer.buffer.d.ts +457 -0
  324. package/node_modules/@types/node/buffer.d.ts +1901 -0
  325. package/node_modules/@types/node/child_process.d.ts +1453 -0
  326. package/node_modules/@types/node/cluster.d.ts +578 -0
  327. package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
  328. package/node_modules/@types/node/compatibility/index.d.ts +9 -0
  329. package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  330. package/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
  331. package/node_modules/@types/node/console.d.ts +452 -0
  332. package/node_modules/@types/node/constants.d.ts +21 -0
  333. package/node_modules/@types/node/crypto.d.ts +4504 -0
  334. package/node_modules/@types/node/dgram.d.ts +596 -0
  335. package/node_modules/@types/node/diagnostics_channel.d.ts +551 -0
  336. package/node_modules/@types/node/dns/promises.d.ts +477 -0
  337. package/node_modules/@types/node/dns.d.ts +860 -0
  338. package/node_modules/@types/node/domain.d.ts +170 -0
  339. package/node_modules/@types/node/events.d.ts +863 -0
  340. package/node_modules/@types/node/fs/promises.d.ts +1208 -0
  341. package/node_modules/@types/node/fs.d.ts +4332 -0
  342. package/node_modules/@types/node/globals.d.ts +170 -0
  343. package/node_modules/@types/node/globals.typedarray.d.ts +21 -0
  344. package/node_modules/@types/node/http.d.ts +1919 -0
  345. package/node_modules/@types/node/http2.d.ts +2580 -0
  346. package/node_modules/@types/node/https.d.ts +549 -0
  347. package/node_modules/@types/node/index.d.ts +92 -0
  348. package/node_modules/@types/node/inspector.generated.d.ts +2775 -0
  349. package/node_modules/@types/node/module.d.ts +503 -0
  350. package/node_modules/@types/node/net.d.ts +924 -0
  351. package/node_modules/@types/node/os.d.ts +480 -0
  352. package/node_modules/@types/node/package.json +145 -0
  353. package/node_modules/@types/node/path.d.ts +191 -0
  354. package/node_modules/@types/node/perf_hooks.d.ts +860 -0
  355. package/node_modules/@types/node/process.d.ts +1632 -0
  356. package/node_modules/@types/node/punycode.d.ts +117 -0
  357. package/node_modules/@types/node/querystring.d.ts +140 -0
  358. package/node_modules/@types/node/readline/promises.d.ts +154 -0
  359. package/node_modules/@types/node/readline.d.ts +715 -0
  360. package/node_modules/@types/node/repl.d.ts +430 -0
  361. package/node_modules/@types/node/stream/consumers.d.ts +38 -0
  362. package/node_modules/@types/node/stream/promises.d.ts +90 -0
  363. package/node_modules/@types/node/stream/web.d.ts +527 -0
  364. package/node_modules/@types/node/stream.d.ts +1680 -0
  365. package/node_modules/@types/node/string_decoder.d.ts +67 -0
  366. package/node_modules/@types/node/test.d.ts +1208 -0
  367. package/node_modules/@types/node/timers/promises.d.ts +108 -0
  368. package/node_modules/@types/node/timers.d.ts +286 -0
  369. package/node_modules/@types/node/tls.d.ts +1204 -0
  370. package/node_modules/@types/node/trace_events.d.ts +171 -0
  371. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +455 -0
  372. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +19 -0
  373. package/node_modules/@types/node/ts5.6/index.d.ts +92 -0
  374. package/node_modules/@types/node/tty.d.ts +206 -0
  375. package/node_modules/@types/node/url.d.ts +957 -0
  376. package/node_modules/@types/node/util.d.ts +2083 -0
  377. package/node_modules/@types/node/v8.d.ts +753 -0
  378. package/node_modules/@types/node/vm.d.ts +704 -0
  379. package/node_modules/@types/node/wasi.d.ts +160 -0
  380. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  381. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  382. package/node_modules/@types/node/web-globals/events.d.ts +81 -0
  383. package/node_modules/@types/node/web-globals/fetch.d.ts +38 -0
  384. package/node_modules/@types/node/worker_threads.d.ts +698 -0
  385. package/node_modules/@types/node/zlib.d.ts +517 -0
  386. package/node_modules/core-util-is/LICENSE +19 -0
  387. package/node_modules/core-util-is/README.md +3 -0
  388. package/node_modules/core-util-is/lib/util.js +107 -0
  389. package/node_modules/core-util-is/package.json +38 -0
  390. package/node_modules/https/package.json +15 -0
  391. package/node_modules/image-size/LICENSE +9 -0
  392. package/node_modules/image-size/Readme.md +184 -0
  393. package/node_modules/image-size/bin/image-size.js +53 -0
  394. package/node_modules/image-size/dist/detector.d.ts +2 -0
  395. package/node_modules/image-size/dist/detector.js +30 -0
  396. package/node_modules/image-size/dist/index.d.ts +10 -0
  397. package/node_modules/image-size/dist/index.js +129 -0
  398. package/node_modules/image-size/dist/types/bmp.d.ts +2 -0
  399. package/node_modules/image-size/dist/types/bmp.js +11 -0
  400. package/node_modules/image-size/dist/types/cur.d.ts +2 -0
  401. package/node_modules/image-size/dist/types/cur.js +17 -0
  402. package/node_modules/image-size/dist/types/dds.d.ts +2 -0
  403. package/node_modules/image-size/dist/types/dds.js +11 -0
  404. package/node_modules/image-size/dist/types/gif.d.ts +2 -0
  405. package/node_modules/image-size/dist/types/gif.js +12 -0
  406. package/node_modules/image-size/dist/types/heif.d.ts +2 -0
  407. package/node_modules/image-size/dist/types/heif.js +40 -0
  408. package/node_modules/image-size/dist/types/icns.d.ts +2 -0
  409. package/node_modules/image-size/dist/types/icns.js +101 -0
  410. package/node_modules/image-size/dist/types/ico.d.ts +2 -0
  411. package/node_modules/image-size/dist/types/ico.js +68 -0
  412. package/node_modules/image-size/dist/types/index.d.ts +23 -0
  413. package/node_modules/image-size/dist/types/index.js +46 -0
  414. package/node_modules/image-size/dist/types/interface.d.ts +13 -0
  415. package/node_modules/image-size/dist/types/interface.js +2 -0
  416. package/node_modules/image-size/dist/types/j2c.d.ts +2 -0
  417. package/node_modules/image-size/dist/types/j2c.js +12 -0
  418. package/node_modules/image-size/dist/types/jp2.d.ts +2 -0
  419. package/node_modules/image-size/dist/types/jp2.js +27 -0
  420. package/node_modules/image-size/dist/types/jpg.d.ts +2 -0
  421. package/node_modules/image-size/dist/types/jpg.js +123 -0
  422. package/node_modules/image-size/dist/types/jxl-stream.d.ts +2 -0
  423. package/node_modules/image-size/dist/types/jxl-stream.js +45 -0
  424. package/node_modules/image-size/dist/types/jxl.d.ts +2 -0
  425. package/node_modules/image-size/dist/types/jxl.js +59 -0
  426. package/node_modules/image-size/dist/types/ktx.d.ts +2 -0
  427. package/node_modules/image-size/dist/types/ktx.js +19 -0
  428. package/node_modules/image-size/dist/types/png.d.ts +2 -0
  429. package/node_modules/image-size/dist/types/png.js +35 -0
  430. package/node_modules/image-size/dist/types/pnm.d.ts +2 -0
  431. package/node_modules/image-size/dist/types/pnm.js +72 -0
  432. package/node_modules/image-size/dist/types/psd.d.ts +2 -0
  433. package/node_modules/image-size/dist/types/psd.js +11 -0
  434. package/node_modules/image-size/dist/types/svg.d.ts +2 -0
  435. package/node_modules/image-size/dist/types/svg.js +90 -0
  436. package/node_modules/image-size/dist/types/tga.d.ts +2 -0
  437. package/node_modules/image-size/dist/types/tga.js +15 -0
  438. package/node_modules/image-size/dist/types/tiff.d.ts +2 -0
  439. package/node_modules/image-size/dist/types/tiff.js +95 -0
  440. package/node_modules/image-size/dist/types/utils.d.ts +15 -0
  441. package/node_modules/image-size/dist/types/utils.js +75 -0
  442. package/node_modules/image-size/dist/types/webp.d.ts +2 -0
  443. package/node_modules/image-size/dist/types/webp.js +60 -0
  444. package/node_modules/image-size/dist/utils/bit-reader.d.ts +10 -0
  445. package/node_modules/image-size/dist/utils/bit-reader.js +44 -0
  446. package/node_modules/image-size/package.json +81 -0
  447. package/node_modules/immediate/LICENSE.txt +20 -0
  448. package/node_modules/immediate/README.md +93 -0
  449. package/node_modules/immediate/dist/immediate.js +75 -0
  450. package/node_modules/immediate/dist/immediate.min.js +1 -0
  451. package/node_modules/immediate/lib/browser.js +69 -0
  452. package/node_modules/immediate/lib/index.js +73 -0
  453. package/node_modules/immediate/package.json +42 -0
  454. package/node_modules/inherits/LICENSE +16 -0
  455. package/node_modules/inherits/README.md +42 -0
  456. package/node_modules/inherits/inherits.js +9 -0
  457. package/node_modules/inherits/inherits_browser.js +27 -0
  458. package/node_modules/inherits/package.json +29 -0
  459. package/node_modules/isarray/.npmignore +1 -0
  460. package/node_modules/isarray/.travis.yml +4 -0
  461. package/node_modules/isarray/Makefile +6 -0
  462. package/node_modules/isarray/README.md +60 -0
  463. package/node_modules/isarray/component.json +19 -0
  464. package/node_modules/isarray/index.js +5 -0
  465. package/node_modules/isarray/package.json +45 -0
  466. package/node_modules/isarray/test.js +20 -0
  467. package/node_modules/jszip/.codeclimate.yml +16 -0
  468. package/node_modules/jszip/.editorconfig +8 -0
  469. package/node_modules/jszip/.eslintrc.js +43 -0
  470. package/node_modules/jszip/CHANGES.md +210 -0
  471. package/node_modules/jszip/LICENSE.markdown +651 -0
  472. package/node_modules/jszip/README.markdown +33 -0
  473. package/node_modules/jszip/dist/jszip.js +11586 -0
  474. package/node_modules/jszip/dist/jszip.min.js +13 -0
  475. package/node_modules/jszip/index.d.ts +344 -0
  476. package/node_modules/jszip/lib/base64.js +106 -0
  477. package/node_modules/jszip/lib/compressedObject.js +74 -0
  478. package/node_modules/jszip/lib/compressions.js +14 -0
  479. package/node_modules/jszip/lib/crc32.js +77 -0
  480. package/node_modules/jszip/lib/defaults.js +11 -0
  481. package/node_modules/jszip/lib/external.js +18 -0
  482. package/node_modules/jszip/lib/flate.js +85 -0
  483. package/node_modules/jszip/lib/generate/ZipFileWorker.js +539 -0
  484. package/node_modules/jszip/lib/generate/index.js +57 -0
  485. package/node_modules/jszip/lib/index.js +55 -0
  486. package/node_modules/jszip/lib/license_header.js +11 -0
  487. package/node_modules/jszip/lib/load.js +88 -0
  488. package/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +74 -0
  489. package/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +42 -0
  490. package/node_modules/jszip/lib/nodejsUtils.js +57 -0
  491. package/node_modules/jszip/lib/object.js +384 -0
  492. package/node_modules/jszip/lib/readable-stream-browser.js +10 -0
  493. package/node_modules/jszip/lib/reader/ArrayReader.js +57 -0
  494. package/node_modules/jszip/lib/reader/DataReader.js +116 -0
  495. package/node_modules/jszip/lib/reader/NodeBufferReader.js +19 -0
  496. package/node_modules/jszip/lib/reader/StringReader.js +38 -0
  497. package/node_modules/jszip/lib/reader/Uint8ArrayReader.js +22 -0
  498. package/node_modules/jszip/lib/reader/readerFor.js +28 -0
  499. package/node_modules/jszip/lib/signature.js +7 -0
  500. package/node_modules/jszip/lib/stream/ConvertWorker.js +26 -0
  501. package/node_modules/jszip/lib/stream/Crc32Probe.js +24 -0
  502. package/node_modules/jszip/lib/stream/DataLengthProbe.js +29 -0
  503. package/node_modules/jszip/lib/stream/DataWorker.js +116 -0
  504. package/node_modules/jszip/lib/stream/GenericWorker.js +263 -0
  505. package/node_modules/jszip/lib/stream/StreamHelper.js +214 -0
  506. package/node_modules/jszip/lib/support.js +38 -0
  507. package/node_modules/jszip/lib/utf8.js +275 -0
  508. package/node_modules/jszip/lib/utils.js +510 -0
  509. package/node_modules/jszip/lib/zipEntries.js +261 -0
  510. package/node_modules/jszip/lib/zipEntry.js +293 -0
  511. package/node_modules/jszip/lib/zipObject.js +133 -0
  512. package/node_modules/jszip/package.json +67 -0
  513. package/node_modules/jszip/sponsors.md +21 -0
  514. package/node_modules/jszip/tsconfig.json +101 -0
  515. package/node_modules/jszip/vendor/FileSaver.js +247 -0
  516. package/node_modules/lie/README.md +62 -0
  517. package/node_modules/lie/dist/lie.js +350 -0
  518. package/node_modules/lie/dist/lie.min.js +1 -0
  519. package/node_modules/lie/dist/lie.polyfill.js +358 -0
  520. package/node_modules/lie/dist/lie.polyfill.min.js +1 -0
  521. package/node_modules/lie/lib/browser.js +273 -0
  522. package/node_modules/lie/lib/index.js +298 -0
  523. package/node_modules/lie/license.md +7 -0
  524. package/node_modules/lie/lie.d.ts +244 -0
  525. package/node_modules/lie/package.json +69 -0
  526. package/node_modules/lie/polyfill.js +4 -0
  527. package/node_modules/pako/LICENSE +21 -0
  528. package/node_modules/pako/README.md +191 -0
  529. package/node_modules/pako/dist/pako.js +6818 -0
  530. package/node_modules/pako/dist/pako.min.js +1 -0
  531. package/node_modules/pako/dist/pako_deflate.js +3997 -0
  532. package/node_modules/pako/dist/pako_deflate.min.js +1 -0
  533. package/node_modules/pako/dist/pako_inflate.js +3300 -0
  534. package/node_modules/pako/dist/pako_inflate.min.js +1 -0
  535. package/node_modules/pako/index.js +14 -0
  536. package/node_modules/pako/lib/deflate.js +400 -0
  537. package/node_modules/pako/lib/inflate.js +423 -0
  538. package/node_modules/pako/lib/utils/common.js +105 -0
  539. package/node_modules/pako/lib/utils/strings.js +187 -0
  540. package/node_modules/pako/lib/zlib/README +59 -0
  541. package/node_modules/pako/lib/zlib/adler32.js +51 -0
  542. package/node_modules/pako/lib/zlib/constants.js +68 -0
  543. package/node_modules/pako/lib/zlib/crc32.js +59 -0
  544. package/node_modules/pako/lib/zlib/deflate.js +1874 -0
  545. package/node_modules/pako/lib/zlib/gzheader.js +58 -0
  546. package/node_modules/pako/lib/zlib/inffast.js +345 -0
  547. package/node_modules/pako/lib/zlib/inflate.js +1556 -0
  548. package/node_modules/pako/lib/zlib/inftrees.js +343 -0
  549. package/node_modules/pako/lib/zlib/messages.js +32 -0
  550. package/node_modules/pako/lib/zlib/trees.js +1222 -0
  551. package/node_modules/pako/lib/zlib/zstream.js +47 -0
  552. package/node_modules/pako/package.json +44 -0
  553. package/node_modules/pptxgenjs/LICENSE +21 -0
  554. package/node_modules/pptxgenjs/README.md +284 -0
  555. package/node_modules/pptxgenjs/dist/pptxgen.bundle.js +3 -0
  556. package/node_modules/pptxgenjs/dist/pptxgen.bundle.js.map +1 -0
  557. package/node_modules/pptxgenjs/dist/pptxgen.cjs.js +7445 -0
  558. package/node_modules/pptxgenjs/dist/pptxgen.es.js +7439 -0
  559. package/node_modules/pptxgenjs/dist/pptxgen.min.js +3 -0
  560. package/node_modules/pptxgenjs/dist/pptxgen.min.js.map +1 -0
  561. package/node_modules/pptxgenjs/package.json +89 -0
  562. package/node_modules/pptxgenjs/types/index.d.ts +2670 -0
  563. package/node_modules/process-nextick-args/index.js +45 -0
  564. package/node_modules/process-nextick-args/license.md +19 -0
  565. package/node_modules/process-nextick-args/package.json +25 -0
  566. package/node_modules/process-nextick-args/readme.md +18 -0
  567. package/node_modules/queue/LICENSE +8 -0
  568. package/node_modules/queue/index.d.ts +173 -0
  569. package/node_modules/queue/index.js +195 -0
  570. package/node_modules/queue/package.json +43 -0
  571. package/node_modules/queue/readme.md +221 -0
  572. package/node_modules/readable-stream/.travis.yml +34 -0
  573. package/node_modules/readable-stream/CONTRIBUTING.md +38 -0
  574. package/node_modules/readable-stream/GOVERNANCE.md +136 -0
  575. package/node_modules/readable-stream/LICENSE +47 -0
  576. package/node_modules/readable-stream/README.md +58 -0
  577. package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +60 -0
  578. package/node_modules/readable-stream/duplex-browser.js +1 -0
  579. package/node_modules/readable-stream/duplex.js +1 -0
  580. package/node_modules/readable-stream/lib/_stream_duplex.js +131 -0
  581. package/node_modules/readable-stream/lib/_stream_passthrough.js +47 -0
  582. package/node_modules/readable-stream/lib/_stream_readable.js +1019 -0
  583. package/node_modules/readable-stream/lib/_stream_transform.js +214 -0
  584. package/node_modules/readable-stream/lib/_stream_writable.js +685 -0
  585. package/node_modules/readable-stream/lib/internal/streams/BufferList.js +78 -0
  586. package/node_modules/readable-stream/lib/internal/streams/destroy.js +84 -0
  587. package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
  588. package/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
  589. package/node_modules/readable-stream/package.json +52 -0
  590. package/node_modules/readable-stream/passthrough.js +1 -0
  591. package/node_modules/readable-stream/readable-browser.js +7 -0
  592. package/node_modules/readable-stream/readable.js +19 -0
  593. package/node_modules/readable-stream/transform.js +1 -0
  594. package/node_modules/readable-stream/writable-browser.js +1 -0
  595. package/node_modules/readable-stream/writable.js +8 -0
  596. package/node_modules/safe-buffer/LICENSE +21 -0
  597. package/node_modules/safe-buffer/README.md +584 -0
  598. package/node_modules/safe-buffer/index.d.ts +187 -0
  599. package/node_modules/safe-buffer/index.js +62 -0
  600. package/node_modules/safe-buffer/package.json +37 -0
  601. package/node_modules/setimmediate/LICENSE.txt +20 -0
  602. package/node_modules/setimmediate/package.json +30 -0
  603. package/node_modules/setimmediate/setImmediate.js +186 -0
  604. package/node_modules/string_decoder/.travis.yml +50 -0
  605. package/node_modules/string_decoder/LICENSE +48 -0
  606. package/node_modules/string_decoder/README.md +47 -0
  607. package/node_modules/string_decoder/lib/string_decoder.js +296 -0
  608. package/node_modules/string_decoder/package.json +31 -0
  609. package/node_modules/undici-types/README.md +6 -0
  610. package/node_modules/undici-types/agent.d.ts +31 -0
  611. package/node_modules/undici-types/api.d.ts +43 -0
  612. package/node_modules/undici-types/balanced-pool.d.ts +18 -0
  613. package/node_modules/undici-types/cache.d.ts +36 -0
  614. package/node_modules/undici-types/client.d.ts +97 -0
  615. package/node_modules/undici-types/connector.d.ts +34 -0
  616. package/node_modules/undici-types/content-type.d.ts +21 -0
  617. package/node_modules/undici-types/cookies.d.ts +28 -0
  618. package/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
  619. package/node_modules/undici-types/dispatcher.d.ts +241 -0
  620. package/node_modules/undici-types/errors.d.ts +128 -0
  621. package/node_modules/undici-types/fetch.d.ts +209 -0
  622. package/node_modules/undici-types/file.d.ts +39 -0
  623. package/node_modules/undici-types/filereader.d.ts +54 -0
  624. package/node_modules/undici-types/formdata.d.ts +108 -0
  625. package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  626. package/node_modules/undici-types/global-origin.d.ts +7 -0
  627. package/node_modules/undici-types/handlers.d.ts +9 -0
  628. package/node_modules/undici-types/header.d.ts +4 -0
  629. package/node_modules/undici-types/index.d.ts +63 -0
  630. package/node_modules/undici-types/interceptors.d.ts +5 -0
  631. package/node_modules/undici-types/mock-agent.d.ts +50 -0
  632. package/node_modules/undici-types/mock-client.d.ts +25 -0
  633. package/node_modules/undici-types/mock-errors.d.ts +12 -0
  634. package/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  635. package/node_modules/undici-types/mock-pool.d.ts +25 -0
  636. package/node_modules/undici-types/package.json +55 -0
  637. package/node_modules/undici-types/patch.d.ts +71 -0
  638. package/node_modules/undici-types/pool-stats.d.ts +19 -0
  639. package/node_modules/undici-types/pool.d.ts +28 -0
  640. package/node_modules/undici-types/proxy-agent.d.ts +30 -0
  641. package/node_modules/undici-types/readable.d.ts +61 -0
  642. package/node_modules/undici-types/webidl.d.ts +220 -0
  643. package/node_modules/undici-types/websocket.d.ts +131 -0
  644. package/node_modules/util-deprecate/History.md +16 -0
  645. package/node_modules/util-deprecate/LICENSE +24 -0
  646. package/node_modules/util-deprecate/README.md +53 -0
  647. package/node_modules/util-deprecate/browser.js +67 -0
  648. package/node_modules/util-deprecate/node.js +6 -0
  649. package/node_modules/util-deprecate/package.json +27 -0
  650. package/package.json +54 -21
  651. package/services.json +1 -20
@@ -0,0 +1,230 @@
1
+ /** 插件打包:按 package.json files 收集文件、自检(含 manifest 语义校验)、写 ZIP。 */
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+ import { writeZipFromDir, listZipEntries } from './zip.mjs'
5
+
6
+ /**
7
+ * suite/domain manifest 的语义校验器由外部注入。
8
+ *
9
+ * 为什么不在本模块静态 import:`@capyclaw/plugin-kit` 是**可独立发布**的插件 SDK,
10
+ * 而语义校验规则住在 `@capyclaw/suite-kit`(编排层)。硬 import 会让本包在 npm 上
11
+ * 必须连带发布 suite-kit,并把它内部的相对路径问题一起暴露给消费者。
12
+ *
13
+ * 用法(打包工具侧):
14
+ * import { setManifestValidators } from '@capyclaw/plugin-kit/packaging/pack'
15
+ * setManifestValidators({ validateSuiteManifest, validateDomainManifest })
16
+ * 未注入时只做结构校验,并在 warnings 里明确说明语义校验被跳过。
17
+ */
18
+ let injectedValidators = null
19
+
20
+ export function setManifestValidators(validators) {
21
+ injectedValidators = validators && typeof validators === 'object' ? validators : null
22
+ }
23
+
24
+ export function getManifestValidators() {
25
+ return injectedValidators
26
+ }
27
+
28
+ const ALWAYS_INCLUDE = ['package.json', 'README.md', 'LICENSE', 'LICENSE.md', 'THIRD_PARTY_NOTICES.md']
29
+ const DEFAULT_EXCLUDES = [
30
+ 'node_modules', '.git', '.DS_Store', 'dist', 'build', 'coverage', '.temp-pack',
31
+ /* 运行时状态绝不可进发布包:`.host` 里是 discovery.json / .relay-instance.lock,
32
+ * 打进去等于把"上一台机器上跑过的实例"带走——新机器首次启动会以为端口被占、
33
+ * 单实例锁被持有,服务起不来。日志同理。 */
34
+ '.host', '*.log',
35
+ ]
36
+
37
+ function normalize(value) {
38
+ return value.replace(/\\/g, '/').replace(/^\.\//, '').replace(/\/+$/, '')
39
+ }
40
+
41
+ function globToRegExp(glob) {
42
+ let out = '^'
43
+ for (let i = 0; i < glob.length; i++) {
44
+ const char = glob[i]
45
+ if (char === '*') {
46
+ if (glob[i + 1] === '*') {
47
+ out += '.*'
48
+ i++
49
+ if (glob[i + 1] === '/') i++
50
+ } else {
51
+ out += '[^/]*'
52
+ }
53
+ } else if (char === '?') out += '[^/]'
54
+ else out += char.replace(/[.+^${}()|[\]\\]/g, '\\$&')
55
+ }
56
+ return new RegExp(out + '$')
57
+ }
58
+
59
+ function matches(rel, pattern) {
60
+ const p = normalize(pattern)
61
+ if (!p.includes('*') && !p.includes('?')) return rel === p || rel.startsWith(p + '/')
62
+ return globToRegExp(p).test(rel)
63
+ }
64
+
65
+ function exists(dir, rel) {
66
+ return fs.existsSync(path.join(dir, rel))
67
+ }
68
+
69
+ function walk(dir, base = dir) {
70
+ const out = []
71
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
72
+ const full = path.join(dir, entry.name)
73
+ if (entry.isDirectory()) out.push(...walk(full, base))
74
+ else if (entry.isFile()) out.push(path.relative(base, full).replace(/\\/g, '/'))
75
+ }
76
+ return out.sort()
77
+ }
78
+
79
+ function expandEntry(srcDir, entry) {
80
+ const rel = normalize(entry)
81
+ if (rel.includes('*') || rel.includes('?')) {
82
+ return walk(srcDir).filter((file) => matches(file, rel))
83
+ }
84
+ if (!exists(srcDir, rel)) return []
85
+ const full = path.join(srcDir, rel)
86
+ if (fs.statSync(full).isDirectory()) return walk(full).map((file) => `${rel}/${file}`)
87
+ return [rel]
88
+ }
89
+
90
+ export function collectPluginFiles(srcDir, pkg, { keepNodeModules = false } = {}) {
91
+ const includes = []
92
+ const excludes = [
93
+ ...DEFAULT_EXCLUDES.filter((item) => !(keepNodeModules && item === 'node_modules')),
94
+ ...(pkg.files || []).filter((item) => String(item).startsWith('!')).map((item) => normalize(String(item).slice(1))),
95
+ ]
96
+ const declared = (pkg.files || []).filter((item) => !String(item).startsWith('!')).map(String)
97
+
98
+ for (const item of ALWAYS_INCLUDE) if (exists(srcDir, item) && !includes.includes(item)) includes.push(item)
99
+ if (!declared.length || keepNodeModules) {
100
+ /* keepNodeModules:整目录收集(拼装产物 node_modules 里的成员必须随包走)。 */
101
+ for (const item of fs.readdirSync(srcDir)) {
102
+ const rel = normalize(item)
103
+ if (excludes.some((ex) => matches(rel, ex))) continue
104
+ for (const file of expandEntry(srcDir, rel)) if (!includes.includes(file)) includes.push(file)
105
+ }
106
+ } else {
107
+ for (const item of declared) {
108
+ const expanded = expandEntry(srcDir, item)
109
+ if (!expanded.length) throw new Error(`package.json files 条目不存在: ${item}`)
110
+ for (const file of expanded) if (!includes.includes(file)) includes.push(file)
111
+ }
112
+ }
113
+
114
+ const files = includes
115
+ .filter((rel) => !excludes.some((ex) => matches(rel, ex)))
116
+ .sort()
117
+ if (!files.includes('package.json')) throw new Error('打包结果缺少 package.json')
118
+ return files
119
+ }
120
+
121
+ function copyFile(srcDir, destDir, rel) {
122
+ const src = path.join(srcDir, rel)
123
+ const dest = path.join(destDir, rel)
124
+ fs.mkdirSync(path.dirname(dest), { recursive: true })
125
+ fs.copyFileSync(src, dest)
126
+ }
127
+
128
+ export function validateStaged(stagedDir, pkg) {
129
+ const errors = []
130
+ if (!fs.existsSync(path.join(stagedDir, 'package.json'))) errors.push('缺少 package.json')
131
+ if (pkg.main && !fs.existsSync(path.join(stagedDir, pkg.main))) errors.push(`缺少入口文件: ${pkg.main}`)
132
+ const patch = pkg.dsh?.bundle?.patch
133
+ /* 成员包(dsh.member: true)随套件分发,本就不该带补丁;带了会和套件重复声明同一行,
134
+ * 那个行归属冲突会直接卡死卸载(bundle-in-use)。 */
135
+ if (pkg.dsh?.member === true) {
136
+ if (patch) errors.push('成员包(dsh.member: true)不应声明 dsh.bundle.patch')
137
+ } else if (pkg.dsh && !patch) {
138
+ errors.push('缺少 dsh.bundle.patch 配置')
139
+ } else if (patch && !fs.existsSync(path.join(stagedDir, patch))) {
140
+ errors.push(`缺少 cordis patch: ${patch}`)
141
+ }
142
+ if (pkg.dsh?.suite && !fs.existsSync(path.join(stagedDir, pkg.dsh.suite))) {
143
+ errors.push(`缺少 suite manifest: ${pkg.dsh.suite}`)
144
+ }
145
+ if (errors.length) throw new Error(`打包自检失败:\n- ${errors.join('\n- ')}`)
146
+ return true
147
+ }
148
+
149
+ /** manifest 语义校验:若已注入 @capyclaw/suite-kit 的校验器则用同一套规则(与安装侧一致),
150
+ * 否则只做结构校验并在 warnings 里说明。返回 { errors, warnings };不传 baseDir——
151
+ * ZIP 内引用的兄弟包路径在包外,存在性检查留给安装侧。 */
152
+ export function validateManifests(stagedDir, pkg) {
153
+ const errors = []
154
+ const warnings = []
155
+ const readJson = (rel) => JSON.parse(fs.readFileSync(path.join(stagedDir, rel), 'utf8'))
156
+ const suiteRel = pkg.dsh?.suite
157
+ if (suiteRel) {
158
+ if (!injectedValidators?.validateSuiteManifest) {
159
+ warnings.push(`未注入 suite 语义校验器,已跳过 ${suiteRel} 的语义检查(仅校验存在性)`)
160
+ } else {
161
+ try {
162
+ const result = injectedValidators.validateSuiteManifest(readJson(suiteRel))
163
+ errors.push(...result.errors)
164
+ warnings.push(...result.warnings)
165
+ } catch (error) {
166
+ errors.push(`suite manifest 解析失败 (${suiteRel}): ${error.message}`)
167
+ }
168
+ }
169
+ }
170
+ const domainRel = pkg.dsh?.domain || (fs.existsSync(path.join(stagedDir, 'dsh-domain.json')) ? 'dsh-domain.json' : null)
171
+ if (domainRel) {
172
+ if (!injectedValidators?.validateDomainManifest) {
173
+ warnings.push(`未注入 domain 语义校验器,已跳过 ${domainRel} 的语义检查(仅校验存在性)`)
174
+ } else {
175
+ try {
176
+ const result = injectedValidators.validateDomainManifest(readJson(domainRel))
177
+ errors.push(...result.errors)
178
+ warnings.push(...result.warnings)
179
+ } catch (error) {
180
+ errors.push(`domain manifest 解析失败 (${domainRel}): ${error.message}`)
181
+ }
182
+ }
183
+ }
184
+ return { errors, warnings }
185
+ }
186
+
187
+ /**
188
+ * 把插件复制到 staging 目录。
189
+ *
190
+ * keepNodeModules:拼装产物(dist/suites/<bridge>/package)的成员就装在包内
191
+ * node_modules 里,打包时必须整目录带走,否则 zip 解压后成员全丢。
192
+ *
193
+ * @param {{srcDir:string,destDir:string,keepNodeModules?:boolean}} options
194
+ */
195
+ export function stagePlugin({ srcDir, destDir, keepNodeModules = false }) {
196
+ const pkg = JSON.parse(fs.readFileSync(path.join(srcDir, 'package.json'), 'utf8'))
197
+ const files = collectPluginFiles(srcDir, pkg, { keepNodeModules })
198
+ fs.rmSync(destDir, { recursive: true, force: true })
199
+ for (const file of files) copyFile(srcDir, destDir, file)
200
+ validateStaged(destDir, pkg)
201
+ const { errors, warnings } = validateManifests(destDir, pkg)
202
+ if (errors.length) throw new Error(`打包自检失败(manifest 语义校验):\n- ${errors.join('\n- ')}`)
203
+ return { pkg, files, warnings }
204
+ }
205
+
206
+ /**
207
+ * 生成插件 ZIP —— 本仓唯一的「插件 → zip」实现。
208
+ *
209
+ * 命名约定与源索引一致:`<包名去 scope>-<version>.zip`(如
210
+ * `@capyclaw/ppt-suite@2.5.0` → `capyclaw-ppt-suite-2.5.0.zip`)。
211
+ * `releasePlugin`(发布闸 + vendor)与 `pack-plugin` CLI 都走这里,不再各写一份。
212
+ *
213
+ * @param {{srcDir:string,outDir:string,name?:string,version?:string,keepNodeModules?:boolean,
214
+ * beforeZip?:(stagingDir:string)=>void}} options
215
+ */
216
+ export function packPlugin({ srcDir, outDir, name, version, keepNodeModules = false, beforeZip }) {
217
+ const pkg = JSON.parse(fs.readFileSync(path.join(srcDir, 'package.json'), 'utf8'))
218
+ const safeName = String(name || pkg.name).replace(/^@/, '').replace(/[\\/]/g, '-')
219
+ const outFile = path.join(outDir, `${safeName}-${version || pkg.version}.zip`)
220
+ const staging = path.join(outDir, `.stage-${safeName}-${process.pid}`)
221
+ fs.mkdirSync(outDir, { recursive: true })
222
+ try {
223
+ const staged = stagePlugin({ srcDir, destDir: staging, keepNodeModules })
224
+ if (beforeZip) beforeZip(staging)
225
+ writeZipFromDir(staging, outFile)
226
+ return { outFile, files: staged.files, entries: listZipEntries(outFile), pkg: staged.pkg, warnings: staged.warnings }
227
+ } finally {
228
+ fs.rmSync(staging, { recursive: true, force: true })
229
+ }
230
+ }
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Runtime context:插件启动时读取本次 DSH runtime 的端口、目录、namespace。
3
+ *
4
+ * 优先级:
5
+ * 1. 显式 runtimeFile / config.runtimeFile
6
+ * 2. DSH_RUNTIME_FILE
7
+ * 3. DSH_RUNTIME_ID + DSH_STORE_ROOT + DSH_STORE_TOKEN 环境变量
8
+ *
9
+ * 插件不应再读全局插件目录或写死端口;所有持久化内容都走
10
+ * WorkspaceClient,确保只作用于当前 runtime 的 namespace。
11
+ */
12
+ import fs from 'node:fs'
13
+ import path from 'node:path'
14
+ import { WorkspaceManager, WorkspaceClient } from '../workspace/manager.mjs'
15
+
16
+ function readJson(file, fallback = null) {
17
+ try { return JSON.parse(fs.readFileSync(file, 'utf8')) } catch { return fallback }
18
+ }
19
+
20
+ export function runtimeFileFromEnv(env = process.env) {
21
+ return env.DSH_RUNTIME_FILE || ''
22
+ }
23
+
24
+ export function loadRuntimeContext({ runtimeFile, env = process.env } = {}) {
25
+ const file = runtimeFile || runtimeFileFromEnv(env)
26
+ if (file && fs.existsSync(file)) {
27
+ const runtime = readJson(file, null)
28
+ if (!runtime) throw new Error(`runtime 文件损坏: ${file}`)
29
+ return normalizeRuntime(runtime, { runtimeFile: path.resolve(file), env })
30
+ }
31
+ if (env.DSH_RUNTIME_ID && env.DSH_STORE_ROOT) {
32
+ return normalizeRuntime({
33
+ runtimeId: env.DSH_RUNTIME_ID,
34
+ storeRoot: env.DSH_STORE_ROOT,
35
+ ports: {
36
+ harness: Number(env.DSH_PROXY_PORT) || 0,
37
+ dsh: Number(env.DSH_UP_PORT) || 0,
38
+ content: Number(env.DSH_CONTENT_PORT) || 0,
39
+ },
40
+ paths: {
41
+ root: env.DSH_RUNTIME_ROOT || '',
42
+ dshHome: env.DSH_HOME || '',
43
+ workspace: env.DSH_WORKSPACE || '',
44
+ logs: env.DSH_LOG_DIR || '',
45
+ tmp: env.DSH_TMP_DIR || '',
46
+ contentState: env.DSH_CONTENT_STATE || '',
47
+ },
48
+ store: {
49
+ root: env.DSH_STORE_ROOT,
50
+ namespace: env.DSH_STORE_NAMESPACE || env.DSH_RUNTIME_ID,
51
+ token: env.DSH_STORE_TOKEN || '',
52
+ },
53
+ workId: env.DSH_WORK_ID || 'main',
54
+ profile: env.DSH_PROFILE || '',
55
+ domain: env.DSH_DOMAIN || '',
56
+ }, { runtimeFile: null, env })
57
+ }
58
+ return null
59
+ }
60
+
61
+ function normalizeRuntime(runtime, { runtimeFile = null, env = process.env } = {}) {
62
+ const store = runtime.store || {}
63
+ const paths = runtime.paths || {}
64
+ const ports = runtime.ports || {}
65
+ return {
66
+ ...runtime,
67
+ runtimeFile,
68
+ runtimeId: runtime.runtimeId || env.DSH_RUNTIME_ID || '',
69
+ storeRoot: runtime.storeRoot || store.root || env.DSH_STORE_ROOT || '',
70
+ store: {
71
+ root: store.root || runtime.storeRoot || env.DSH_STORE_ROOT || '',
72
+ namespace: store.namespace || runtime.runtimeId || env.DSH_RUNTIME_ID || '',
73
+ token: store.token || env.DSH_STORE_TOKEN || '',
74
+ },
75
+ ports: {
76
+ harness: Number(ports.harness) || Number(env.DSH_PROXY_PORT) || 0,
77
+ dsh: Number(ports.dsh) || Number(env.DSH_UP_PORT) || 0,
78
+ content: Number(ports.content) || Number(env.DSH_CONTENT_PORT) || 0,
79
+ ...ports,
80
+ },
81
+ paths: {
82
+ root: paths.root || '',
83
+ dshHome: paths.dshHome || env.DSH_HOME || '',
84
+ workspace: paths.workspace || env.DSH_WORKSPACE || '',
85
+ logs: paths.logs || env.DSH_LOG_DIR || '',
86
+ tmp: paths.tmp || env.DSH_TMP_DIR || '',
87
+ contentState: paths.contentState || env.DSH_CONTENT_STATE || '',
88
+ ...paths,
89
+ },
90
+ workId: runtime.workId || env.DSH_WORK_ID || 'main',
91
+ }
92
+ }
93
+
94
+ export function runtimeContextFromConfig(config = {}, options = {}) {
95
+ if (config && config.runtimeContext && typeof config.runtimeContext === 'object') {
96
+ return normalizeRuntime(config.runtimeContext, options)
97
+ }
98
+ if (config && config.runtimeFile) return loadRuntimeContext({ ...options, runtimeFile: config.runtimeFile })
99
+ return loadRuntimeContext(options)
100
+ }
101
+
102
+ export function createRuntimeStoreClient(context, { workId } = {}) {
103
+ if (!context || !context.store || !context.store.root || !context.store.token) {
104
+ return null
105
+ }
106
+ const store = new WorkspaceManager({ storeRoot: context.store.root })
107
+ return new WorkspaceClient({
108
+ manager: store,
109
+ runtimeId: context.store.namespace || context.runtimeId,
110
+ token: context.store.token,
111
+ workId: workId || context.workId || 'main',
112
+ })
113
+ }
114
+
115
+ export function runtimePaths(context) {
116
+ return (context && context.paths) || {}
117
+ }
118
+
119
+ export function isPathInside(root, target) {
120
+ if (!root || !target) return false
121
+ const rel = path.relative(path.resolve(root), path.resolve(target))
122
+ return rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel))
123
+ }
124
+
125
+ export function assertPathInside(root, target, label = 'path') {
126
+ if (!isPathInside(root, target)) throw new Error(`${label} 越出 runtime 根目录: ${target}`)
127
+ return path.resolve(target)
128
+ }
@@ -0,0 +1,307 @@
1
+ /**
2
+ * 自包含打包(vendoring)—— 全流水线唯一实现。
3
+ *
4
+ * 背景:本仓的插件既要走 **zip 分发**(dist/plugins/*.zip),也要走 **npm 分发**
5
+ * (`dsh plugin add @capyclaw/xxx`)。两条通道的「自包含」语义此前不一致:
6
+ *
7
+ * - zip 通道:plugin-kit 的 packPlugin 会保留 node_modules,产物自带成员 → 自包含;
8
+ * - npm 通道:`npm pack` / `npm publish` **默认剥离 node_modules**,只有包内
9
+ * `bundledDependencies` 列出的依赖才会被打进 tarball → 不自包含。
10
+ *
11
+ * 结果:同一个包,zip 装完是自包含的,npm 装完却要回头去 registry 逐个解析依赖。
12
+ * 用户侧表现为「明明包里带了 skill,换个机器 npm 装出来却还要联网拉一堆东西」。
13
+ *
14
+ * 本模块把 npm 语义收敛到与 zip 一致:给定一个 staging 目录,
15
+ * 1. 从根 package.json 的 dependencies 出发求**传递闭包**;
16
+ * 2. 闭包里每个包都解析到实体目录并拷进 `<staging>/node_modules/`;
17
+ * 3. 把闭包写进根 package.json 的 `bundledDependencies`。
18
+ *
19
+ * 三条约束(实测 npm 行为,见 scripts/test 里的用例):
20
+ * - `bundledDependencies` 会**覆盖** `files` 白名单:列出的包一定进 tarball;
21
+ * - 不在 bundledDependencies 里的 node_modules 目录会被**剥离**;
22
+ * - 必须同时满足「在 bundledDependencies 里」且「在依赖图可达」两个条件,
23
+ * 否则 npm 会丢弃(孤立的 pako 实验即此)。故闭包口径 = 可达 ∩ 有实体。
24
+ *
25
+ * `files` 不需要改:npm 对 bundledDependencies 另有通道。
26
+ * `dependencies` 也不要删:bundledDependencies 要求包在依赖图里可达。
27
+ */
28
+ import fs from 'node:fs'
29
+ import path from 'node:path'
30
+
31
+ /** 拷贝依赖时跳过的目录(运行时状态、VCS、测试与非分发内容)。
32
+ * 注意:**不能跳 `dist`**。我们自己的包把源码放 src/,但第三方依赖常常只有 dist/
33
+ * (pptxgenjs 的 main 就是 `dist/pptxgen.cjs.js`)——跳过它等于把依赖拷成一个空壳,
34
+ * 装出来的包里 `ppt_export_pptx` 会报「没有安装 pptxgenjs」,而目录明明存在。 */
35
+ const VENDOR_SKIP_DIRS = new Set([
36
+ 'node_modules', '.git', '.github', 'test', 'tests', '__tests__',
37
+ 'coverage', '.host', '__pycache__', '.cache', '.temp-pack',
38
+ ])
39
+
40
+ function readJson(file) {
41
+ return JSON.parse(fs.readFileSync(file, 'utf8'))
42
+ }
43
+
44
+ function hasPackage(dir) {
45
+ return Boolean(dir) && fs.existsSync(path.join(dir, 'package.json'))
46
+ }
47
+
48
+ /**
49
+ * 目录里的包是否**真的可用**:package.json 声明的入口文件必须存在。
50
+ *
51
+ * 为什么不能只看 package.json:曾经 `dist` 被当成「非分发内容」跳过,
52
+ * 于是 pptxgenjs 拷进来只有 package.json + types,`hasPackage()` 为真、
53
+ * 拼装闸放行,安装后 `import('pptxgenjs')` 才炸。空壳包必须能被识别出来重拷。
54
+ */
55
+ export function isUsablePackage(dir) {
56
+ if (!hasPackage(dir)) return false
57
+ let pkg
58
+ try { pkg = readJson(path.join(dir, 'package.json')) } catch { return false }
59
+ const entries = []
60
+ const exportsField = pkg.exports
61
+ if (typeof exportsField === 'string') entries.push(exportsField)
62
+ else if (exportsField && typeof exportsField === 'object') {
63
+ const root = exportsField['.'] ?? exportsField
64
+ if (typeof root === 'string') entries.push(root)
65
+ else if (root && typeof root === 'object') {
66
+ for (const value of Object.values(root)) {
67
+ if (typeof value === 'string') entries.push(value)
68
+ else if (value && typeof value === 'object') {
69
+ for (const deep of Object.values(value)) if (typeof deep === 'string') entries.push(deep)
70
+ }
71
+ }
72
+ }
73
+ }
74
+ if (typeof pkg.main === 'string') entries.push(pkg.main)
75
+ if (typeof pkg.module === 'string') entries.push(pkg.module)
76
+ /* 没有入口声明(纯资源包):只要目录里有文件就算可用。 */
77
+ if (!entries.length) {
78
+ try {
79
+ return fs.readdirSync(dir).some((name) => name !== 'package.json')
80
+ } catch { return false }
81
+ }
82
+ return entries.some((rel) => fs.existsSync(path.join(dir, rel.replace(/^\.\//, ''))))
83
+ }
84
+
85
+ /**
86
+ * 工作区包解析器:按本仓布局把包名解析到实体目录。
87
+ *
88
+ * 查找顺序(先近后远,staging 内已有的优先,避免重复劳动):
89
+ * 1. `<staging>/node_modules/<name>` —— 已拼装/已 vendor 的成员
90
+ * 2. `<root>/node_modules/<name>` —— 仓库已安装的第三方依赖与 workspace 链接
91
+ * 3. `<root>/packages/<dir名>` —— 公共基建包
92
+ * 4. `<root>/B/official/<dir名>`
93
+ * 5. `<root>/projects/<项目>/artifacts/plugin/<dir名>` —— 各项目的构建产物
94
+ *
95
+ * `@scope/name` → 目录名候选 `@scope/name` 与 `scope-name` 两种形态都试。
96
+ */
97
+ export function createWorkspaceResolver({ root, stagingDir }) {
98
+ const dirNameCandidates = (name) => {
99
+ const out = new Set([name])
100
+ if (name.startsWith('@') && name.includes('/')) {
101
+ const [scope, base] = name.slice(1).split('/')
102
+ out.add(`${scope}-${base}`)
103
+ out.add(base)
104
+ }
105
+ return [...out]
106
+ }
107
+
108
+ /** 项目产物目录:projects/<任意>/artifacts/plugin。 */
109
+ const projectArtifactDirs = () => {
110
+ const out = []
111
+ const projectsDir = path.join(root, 'A/projects')
112
+ let projects = []
113
+ try { projects = fs.readdirSync(projectsDir, { withFileTypes: true }) } catch { return out }
114
+ for (const entry of projects) {
115
+ if (!entry.isDirectory()) continue
116
+ out.push(path.join(projectsDir, entry.name, 'artifacts', 'plugin'))
117
+ }
118
+ return out
119
+ }
120
+
121
+ return function resolve(name) {
122
+ for (const candidate of dirNameCandidates(name)) {
123
+ const direct = [
124
+ path.join(stagingDir, 'node_modules', candidate),
125
+ path.join(root, 'node_modules', candidate),
126
+ path.join(root, 'C/packages', candidate),
127
+ path.join(root, 'B', 'official', candidate),
128
+ ]
129
+ for (const dir of direct) {
130
+ if (hasPackage(dir)) return dir
131
+ }
132
+ for (const base of projectArtifactDirs()) {
133
+ const dir = path.join(base, candidate)
134
+ if (hasPackage(dir)) return dir
135
+ }
136
+ }
137
+ return null
138
+ }
139
+ }
140
+
141
+ /**
142
+ * 从根 package.json 求**可达依赖闭包**,并标注每个包是否已有实体。
143
+ *
144
+ * @returns {{names:string[], present:string[], missing:string[]}}
145
+ */
146
+ export function computeDependencyClosure(pkg, resolve) {
147
+ const present = []
148
+ const missing = []
149
+ const seen = new Set()
150
+ const queue = [
151
+ ...Object.keys(pkg.dependencies || {}),
152
+ ...Object.keys(pkg.optionalDependencies || {}),
153
+ ]
154
+
155
+ while (queue.length) {
156
+ const name = queue.shift()
157
+ if (seen.has(name)) continue
158
+ seen.add(name)
159
+
160
+ const dir = resolve(name)
161
+ if (!dir) { missing.push(name); continue }
162
+
163
+ present.push(name)
164
+ let depPkg = {}
165
+ try { depPkg = readJson(path.join(dir, 'package.json')) } catch { /* 坏清单:仍保留实体,不阻断 */ }
166
+ for (const dep of Object.keys(depPkg.dependencies || {})) {
167
+ if (!seen.has(dep)) queue.push(dep)
168
+ }
169
+ for (const dep of Object.keys(depPkg.optionalDependencies || {})) {
170
+ if (!seen.has(dep)) queue.push(dep)
171
+ }
172
+ /* peerDependencies 不作为传递展开项:npm 语义里 peer 由上层提供,
173
+ * 但若上层确实装了实体,它已在 dependencies 链路里;不额外强拉。 */
174
+ }
175
+
176
+ return { names: [...seen].sort(), present: present.sort(), missing: [...new Set(missing)].sort() }
177
+ }
178
+
179
+ /** 把目录内容递归拷到目标(跳过 VENDOR_SKIP_DIRS)。返回拷贝的文件数。 */
180
+ export function copyDirContents(srcDir, destDir) {
181
+ let count = 0
182
+ const walk = (from, to) => {
183
+ for (const entry of fs.readdirSync(from, { withFileTypes: true })) {
184
+ if (VENDOR_SKIP_DIRS.has(entry.name)) continue
185
+ const s = path.join(from, entry.name)
186
+ const d = path.join(to, entry.name)
187
+ if (entry.isDirectory()) {
188
+ fs.mkdirSync(d, { recursive: true })
189
+ walk(s, d)
190
+ } else if (entry.isFile()) {
191
+ fs.mkdirSync(path.dirname(d), { recursive: true })
192
+ fs.copyFileSync(s, d)
193
+ count++
194
+ }
195
+ }
196
+ }
197
+ walk(srcDir, destDir)
198
+ return count
199
+ }
200
+
201
+ /** 覆写根 package.json 的 bundledDependencies(数组已排序、去重)。 */
202
+ export function writeBundledDependencies(pkgFile, names) {
203
+ const pkg = readJson(pkgFile)
204
+ const unique = [...new Set(names)].sort()
205
+ pkg.bundledDependencies = unique
206
+ fs.writeFileSync(pkgFile, `${JSON.stringify(pkg, null, 2)}\n`)
207
+ return unique
208
+ }
209
+
210
+ /**
211
+ * 让一个 staging 目录变成自包含包。
212
+ *
213
+ * 幂等:已存在于 `<staging>/node_modules/<name>` 的包不会被重复拷贝,
214
+ * 因此对 C 段拼装产物(成员已就位)调用只是补第三方依赖 + 写清单。
215
+ *
216
+ * @param {{stagingDir:string, root:string, verbose?:boolean}} options
217
+ * @returns {{bundled:string[], missing:string[], copied:number}}
218
+ */
219
+ export function makeSelfContained({ stagingDir, root, verbose = false }) {
220
+ const pkgFile = path.join(stagingDir, 'package.json')
221
+ if (!fs.existsSync(pkgFile)) throw new Error(`自包含打包缺少 package.json: ${stagingDir}`)
222
+
223
+ const pkg = readJson(pkgFile)
224
+ const resolve = createWorkspaceResolver({ root, stagingDir })
225
+ const closure = computeDependencyClosure(pkg, resolve)
226
+
227
+ const modulesDir = path.join(stagingDir, 'node_modules')
228
+ /* 重拷空壳时不能再解析到 staging 自己(解析器优先 staging,删掉后就 ENOENT)。 */
229
+ const resolveOutside = createWorkspaceResolver({ root, stagingDir: path.join(stagingDir, '__not_a_staging__') })
230
+ let copied = 0
231
+ let repaired = 0
232
+ for (const name of closure.present) {
233
+ const dest = path.join(modulesDir, name)
234
+ /* 已存在且入口完整 → 跳过;存在但缺入口(历史空壳)→ 删掉重拷。 */
235
+ if (isUsablePackage(dest)) continue
236
+ let src = resolve(name)
237
+ if (hasPackage(dest)) {
238
+ fs.rmSync(dest, { recursive: true, force: true })
239
+ repaired++
240
+ if (verbose) console.log(` ~ 重拷空壳依赖 ${name}`)
241
+ src = resolveOutside(name)
242
+ }
243
+ if (!src) continue
244
+ copied += copyDirContents(src, dest)
245
+ if (verbose) console.log(` + vendor ${name} ← ${path.relative(root, src).replace(/\\/g, '/')}`)
246
+ }
247
+
248
+ const bundled = writeBundledDependencies(pkgFile, closure.present)
249
+ return { bundled, missing: closure.missing, copied, repaired }
250
+ }
251
+
252
+ /**
253
+ * 校验闸:给定 staging 目录,断言它「自包含」——
254
+ * 根依赖闭包里每个包都能在**包内** node_modules 解析到实体,
255
+ * 且 bundledDependencies 与之一致。返回错误数组(空数组 = 通过)。
256
+ */
257
+ export function selfContainedErrors({ stagingDir, root }) {
258
+ const errors = []
259
+ const pkgFile = path.join(stagingDir, 'package.json')
260
+ if (!fs.existsSync(pkgFile)) return [`缺少 package.json: ${stagingDir}`]
261
+ const pkg = readJson(pkgFile)
262
+
263
+ const declared = Array.isArray(pkg.bundledDependencies)
264
+ ? pkg.bundledDependencies
265
+ : Array.isArray(pkg.bundleDependencies) ? pkg.bundleDependencies : []
266
+
267
+ const declaredDeps = Object.keys(pkg.dependencies || {})
268
+ if (!declaredDeps.length) return [] // 无运行时依赖:天然自包含
269
+
270
+ if (!declared.length) {
271
+ errors.push('缺少 bundledDependencies:npm/pnpm 打包会剥离 node_modules,安装后需回 registry 逐个解析')
272
+ return errors
273
+ }
274
+
275
+ /* 包内实体必须齐:这是「解压即用」的硬条件。
276
+ * 注意要查**整个闭包**而非只有直接依赖——传递依赖缺一个,安装后照样要联网。
277
+ * 解析器会回退到仓库根目录,所以这里必须显式只看包内 node_modules。 */
278
+ const resolve = createWorkspaceResolver({ root, stagingDir })
279
+ const closure = computeDependencyClosure(pkg, resolve)
280
+ if (closure.missing.length) {
281
+ errors.push(`依赖闭包无法解析到实体(会迫使安装侧联网): ${closure.missing.join(', ')}`)
282
+ }
283
+
284
+ const missingInPackage = closure.present.filter(
285
+ (name) => !hasPackage(path.join(stagingDir, 'node_modules', name)),
286
+ )
287
+ if (missingInPackage.length) {
288
+ errors.push(`依赖未随包携带(安装后需从 registry 拉取): ${missingInPackage.join(', ')}`)
289
+ }
290
+
291
+ /* 有目录但没入口 = 空壳:比缺目录更隐蔽,必须单独报。 */
292
+ const hollow = closure.present.filter((name) => {
293
+ const dir = path.join(stagingDir, 'node_modules', name)
294
+ return hasPackage(dir) && !isUsablePackage(dir)
295
+ })
296
+ if (hollow.length) {
297
+ errors.push(`依赖是空壳(package.json 在、入口文件缺): ${hollow.join(', ')}`)
298
+ }
299
+
300
+ /* bundledDependencies 必须覆盖闭包。 */
301
+ const notBundled = closure.present.filter((name) => !declared.includes(name))
302
+ if (notBundled.length) {
303
+ errors.push(`传递依赖未列入 bundledDependencies(npm 会丢弃): ${notBundled.join(', ')}`)
304
+ }
305
+
306
+ return errors
307
+ }