@dev-sergeev/datalab-kit 0.1.2 → 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 (355) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +23 -5
  3. package/THIRD_PARTY_NOTICES.md +6 -2
  4. package/docs/adr/0001-user-settings-priority.md +2 -0
  5. package/docs/adr/0002-package-delivery.md +8 -0
  6. package/node_modules/@pi-plugins/elapsed/LICENSE +21 -0
  7. package/node_modules/@pi-plugins/elapsed/README.md +45 -0
  8. package/node_modules/@pi-plugins/elapsed/dist/index.d.mts +8 -0
  9. package/node_modules/@pi-plugins/elapsed/dist/index.d.mts.map +1 -0
  10. package/node_modules/@pi-plugins/elapsed/dist/index.mjs +47 -0
  11. package/node_modules/@pi-plugins/elapsed/dist/index.mjs.map +1 -0
  12. package/node_modules/@pi-plugins/elapsed/package.json +65 -0
  13. package/node_modules/@tifan/pi-recap/README.md +61 -0
  14. package/node_modules/@tifan/pi-recap/package.json +43 -0
  15. package/node_modules/@tifan/pi-recap/src/index.ts +586 -0
  16. package/node_modules/@tifan/pi-recap/src/model-picker.ts +234 -0
  17. package/node_modules/@tifan/pi-recap/src/models.ts +180 -0
  18. package/node_modules/@tifan/pi-recap/src/sanitize.ts +119 -0
  19. package/node_modules/@tifan/pi-recap/src/tui.ts +155 -0
  20. package/node_modules/@zigai/pi-extension-internals/README.md +24 -0
  21. package/node_modules/@zigai/pi-extension-internals/dist/editor-enhancer-registry.d.ts +21 -0
  22. package/node_modules/@zigai/pi-extension-internals/dist/editor-enhancer-registry.js +233 -0
  23. package/node_modules/@zigai/pi-extension-internals/dist/index.d.ts +6 -0
  24. package/node_modules/@zigai/pi-extension-internals/dist/index.js +3 -0
  25. package/node_modules/@zigai/pi-extension-internals/dist/linked-method-patch.d.ts +34 -0
  26. package/node_modules/@zigai/pi-extension-internals/dist/linked-method-patch.js +272 -0
  27. package/node_modules/@zigai/pi-extension-internals/dist/pi-internal-import.d.ts +11 -0
  28. package/node_modules/@zigai/pi-extension-internals/dist/pi-internal-import.js +139 -0
  29. package/node_modules/@zigai/pi-extension-internals/package.json +41 -0
  30. package/node_modules/@zigai/pi-extension-settings/LICENSE +21 -0
  31. package/node_modules/@zigai/pi-extension-settings/README.md +36 -0
  32. package/node_modules/@zigai/pi-extension-settings/dist/artifacts.d.ts +23 -0
  33. package/node_modules/@zigai/pi-extension-settings/dist/artifacts.d.ts.map +1 -0
  34. package/node_modules/@zigai/pi-extension-settings/dist/artifacts.js +75 -0
  35. package/node_modules/@zigai/pi-extension-settings/dist/artifacts.js.map +1 -0
  36. package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.d.ts +3 -0
  37. package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.d.ts.map +1 -0
  38. package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.js +5 -0
  39. package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.js.map +1 -0
  40. package/node_modules/@zigai/pi-extension-settings/dist/cli.d.ts +6 -0
  41. package/node_modules/@zigai/pi-extension-settings/dist/cli.d.ts.map +1 -0
  42. package/node_modules/@zigai/pi-extension-settings/dist/cli.js +87 -0
  43. package/node_modules/@zigai/pi-extension-settings/dist/cli.js.map +1 -0
  44. package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.d.ts +2 -0
  45. package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.d.ts.map +1 -0
  46. package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.js +2 -0
  47. package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.js.map +1 -0
  48. package/node_modules/@zigai/pi-extension-settings/dist/definition.d.ts +159 -0
  49. package/node_modules/@zigai/pi-extension-settings/dist/definition.d.ts.map +1 -0
  50. package/node_modules/@zigai/pi-extension-settings/dist/definition.js +248 -0
  51. package/node_modules/@zigai/pi-extension-settings/dist/definition.js.map +1 -0
  52. package/node_modules/@zigai/pi-extension-settings/dist/file-system.d.ts +10 -0
  53. package/node_modules/@zigai/pi-extension-settings/dist/file-system.d.ts.map +1 -0
  54. package/node_modules/@zigai/pi-extension-settings/dist/file-system.js +115 -0
  55. package/node_modules/@zigai/pi-extension-settings/dist/file-system.js.map +1 -0
  56. package/node_modules/@zigai/pi-extension-settings/dist/index.d.ts +2 -0
  57. package/node_modules/@zigai/pi-extension-settings/dist/index.d.ts.map +1 -0
  58. package/node_modules/@zigai/pi-extension-settings/dist/index.js +2 -0
  59. package/node_modules/@zigai/pi-extension-settings/dist/index.js.map +1 -0
  60. package/node_modules/@zigai/pi-extension-settings/dist/json-value.d.ts +18 -0
  61. package/node_modules/@zigai/pi-extension-settings/dist/json-value.d.ts.map +1 -0
  62. package/node_modules/@zigai/pi-extension-settings/dist/json-value.js +56 -0
  63. package/node_modules/@zigai/pi-extension-settings/dist/json-value.js.map +1 -0
  64. package/node_modules/@zigai/pi-extension-settings/dist/paths.d.ts +11 -0
  65. package/node_modules/@zigai/pi-extension-settings/dist/paths.d.ts.map +1 -0
  66. package/node_modules/@zigai/pi-extension-settings/dist/paths.js +23 -0
  67. package/node_modules/@zigai/pi-extension-settings/dist/paths.js.map +1 -0
  68. package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.d.ts +5 -0
  69. package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.d.ts.map +1 -0
  70. package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.js +21 -0
  71. package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.js.map +1 -0
  72. package/node_modules/@zigai/pi-extension-settings/dist/pi.d.ts +106 -0
  73. package/node_modules/@zigai/pi-extension-settings/dist/pi.d.ts.map +1 -0
  74. package/node_modules/@zigai/pi-extension-settings/dist/pi.js +122 -0
  75. package/node_modules/@zigai/pi-extension-settings/dist/pi.js.map +1 -0
  76. package/node_modules/@zigai/pi-extension-settings/dist/pi.ts +2537 -0
  77. package/node_modules/@zigai/pi-extension-settings/dist/pi.ts.map +7 -0
  78. package/node_modules/@zigai/pi-extension-settings/dist/projects.d.ts +10 -0
  79. package/node_modules/@zigai/pi-extension-settings/dist/projects.d.ts.map +1 -0
  80. package/node_modules/@zigai/pi-extension-settings/dist/projects.js +177 -0
  81. package/node_modules/@zigai/pi-extension-settings/dist/projects.js.map +1 -0
  82. package/node_modules/@zigai/pi-extension-settings/dist/runtime.d.ts +40 -0
  83. package/node_modules/@zigai/pi-extension-settings/dist/runtime.d.ts.map +1 -0
  84. package/node_modules/@zigai/pi-extension-settings/dist/runtime.js +158 -0
  85. package/node_modules/@zigai/pi-extension-settings/dist/runtime.js.map +1 -0
  86. package/node_modules/@zigai/pi-extension-settings/dist/runtime.ts +158 -0
  87. package/node_modules/@zigai/pi-extension-settings/dist/runtime.ts.map +7 -0
  88. package/node_modules/@zigai/pi-extension-settings/dist/schema-document.d.ts +19 -0
  89. package/node_modules/@zigai/pi-extension-settings/dist/schema-document.d.ts.map +1 -0
  90. package/node_modules/@zigai/pi-extension-settings/dist/schema-document.js +168 -0
  91. package/node_modules/@zigai/pi-extension-settings/dist/schema-document.js.map +1 -0
  92. package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.d.ts +9 -0
  93. package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.d.ts.map +1 -0
  94. package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.js +242 -0
  95. package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.js.map +1 -0
  96. package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.d.ts +59 -0
  97. package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.d.ts.map +1 -0
  98. package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.js +98 -0
  99. package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.js.map +1 -0
  100. package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.d.ts +80 -0
  101. package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.d.ts.map +1 -0
  102. package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.js +144 -0
  103. package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.js.map +1 -0
  104. package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.d.ts +5 -0
  105. package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.d.ts.map +1 -0
  106. package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.js +30 -0
  107. package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.js.map +1 -0
  108. package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.d.ts +10 -0
  109. package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.d.ts.map +1 -0
  110. package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.js +16 -0
  111. package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.js.map +1 -0
  112. package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.d.ts +54 -0
  113. package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.d.ts.map +1 -0
  114. package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.js +202 -0
  115. package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.js.map +1 -0
  116. package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.d.ts +5 -0
  117. package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.d.ts.map +1 -0
  118. package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.js +9 -0
  119. package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.js.map +1 -0
  120. package/node_modules/@zigai/pi-extension-settings/docs/generation.md +71 -0
  121. package/node_modules/@zigai/pi-extension-settings/docs/manual-setup.md +98 -0
  122. package/node_modules/@zigai/pi-extension-settings/docs/runtime.md +100 -0
  123. package/node_modules/@zigai/pi-extension-settings/docs/ui-controls.md +31 -0
  124. package/node_modules/@zigai/pi-extension-settings/package.json +97 -0
  125. package/node_modules/@zigai/pi-mention-anything/README.md +113 -0
  126. package/node_modules/@zigai/pi-mention-anything/config.schema.json +313 -0
  127. package/node_modules/@zigai/pi-mention-anything/docs/command-protocol.md +106 -0
  128. package/node_modules/@zigai/pi-mention-anything/docs/providers.md +128 -0
  129. package/node_modules/@zigai/pi-mention-anything/examples/query-command.mjs +96 -0
  130. package/node_modules/@zigai/pi-mention-anything/examples/recursive-tree.ts +28 -0
  131. package/node_modules/@zigai/pi-mention-anything/examples/static.ts +28 -0
  132. package/node_modules/@zigai/pi-mention-anything/examples/tmux.ts +90 -0
  133. package/node_modules/@zigai/pi-mention-anything/examples/tree-settings.json +25 -0
  134. package/node_modules/@zigai/pi-mention-anything/package.json +58 -0
  135. package/node_modules/@zigai/pi-mention-anything/src/api.ts +75 -0
  136. package/node_modules/@zigai/pi-mention-anything/src/autocomplete.ts +231 -0
  137. package/node_modules/@zigai/pi-mention-anything/src/chain-autocomplete.ts +596 -0
  138. package/node_modules/@zigai/pi-mention-anything/src/chain-syntax.ts +345 -0
  139. package/node_modules/@zigai/pi-mention-anything/src/command-provider.ts +291 -0
  140. package/node_modules/@zigai/pi-mention-anything/src/configured-source.ts +66 -0
  141. package/node_modules/@zigai/pi-mention-anything/src/editor.ts +180 -0
  142. package/node_modules/@zigai/pi-mention-anything/src/expand-mentions.ts +162 -0
  143. package/node_modules/@zigai/pi-mention-anything/src/index.ts +54 -0
  144. package/node_modules/@zigai/pi-mention-anything/src/initial-suggestions.ts +190 -0
  145. package/node_modules/@zigai/pi-mention-anything/src/list-provider.ts +71 -0
  146. package/node_modules/@zigai/pi-mention-anything/src/mention-hub.ts +307 -0
  147. package/node_modules/@zigai/pi-mention-anything/src/mention-resolution.ts +374 -0
  148. package/node_modules/@zigai/pi-mention-anything/src/mention-syntax.ts +105 -0
  149. package/node_modules/@zigai/pi-mention-anything/src/register-mention.ts +89 -0
  150. package/node_modules/@zigai/pi-mention-anything/src/rendering.ts +53 -0
  151. package/node_modules/@zigai/pi-mention-anything/src/selected-items.ts +21 -0
  152. package/node_modules/@zigai/pi-mention-anything/src/selection-history.ts +135 -0
  153. package/node_modules/@zigai/pi-mention-anything/src/settings-input.ts +317 -0
  154. package/node_modules/@zigai/pi-mention-anything/src/settings.prevalidated.ts +57 -0
  155. package/node_modules/@zigai/pi-mention-anything/src/settings.ts +52 -0
  156. package/node_modules/@zigai/pi-mention-anything/src/source-contract.ts +174 -0
  157. package/node_modules/@zigai/pi-mention-anything/src/source-controller.ts +1070 -0
  158. package/node_modules/@zigai/pi-mention-anything/src/source-runtime.ts +99 -0
  159. package/node_modules/@zigai/pi-mention-skill/README.md +60 -0
  160. package/node_modules/@zigai/pi-mention-skill/config.schema.json +81 -0
  161. package/node_modules/@zigai/pi-mention-skill/package.json +56 -0
  162. package/node_modules/@zigai/pi-mention-skill/src/index.ts +60 -0
  163. package/node_modules/@zigai/pi-mention-skill/src/settings-input.ts +74 -0
  164. package/node_modules/@zigai/pi-mention-skill/src/settings.prevalidated.ts +18 -0
  165. package/node_modules/@zigai/pi-mention-skill/src/settings.ts +54 -0
  166. package/node_modules/@zigai/pi-mention-skill/src/skill-commands.ts +18 -0
  167. package/node_modules/@zigai/pi-mention-skill/src/skill-content.ts +60 -0
  168. package/node_modules/@zigai/pi-mention-skill/src/skill-provider.ts +105 -0
  169. package/node_modules/@zigai/pi-mention-skill/src/slash-skill-filter.ts +29 -0
  170. package/node_modules/argparse/LICENSE +21 -0
  171. package/node_modules/argparse/README.md +257 -0
  172. package/node_modules/argparse/index.js +3 -0
  173. package/node_modules/argparse/lib/action/append/constant.js +47 -0
  174. package/node_modules/argparse/lib/action/append.js +53 -0
  175. package/node_modules/argparse/lib/action/count.js +40 -0
  176. package/node_modules/argparse/lib/action/help.js +47 -0
  177. package/node_modules/argparse/lib/action/store/constant.js +43 -0
  178. package/node_modules/argparse/lib/action/store/false.js +27 -0
  179. package/node_modules/argparse/lib/action/store/true.js +26 -0
  180. package/node_modules/argparse/lib/action/store.js +50 -0
  181. package/node_modules/argparse/lib/action/subparsers.js +149 -0
  182. package/node_modules/argparse/lib/action/version.js +47 -0
  183. package/node_modules/argparse/lib/action.js +146 -0
  184. package/node_modules/argparse/lib/action_container.js +482 -0
  185. package/node_modules/argparse/lib/argparse.js +14 -0
  186. package/node_modules/argparse/lib/argument/error.js +50 -0
  187. package/node_modules/argparse/lib/argument/exclusive.js +54 -0
  188. package/node_modules/argparse/lib/argument/group.js +75 -0
  189. package/node_modules/argparse/lib/argument_parser.js +1161 -0
  190. package/node_modules/argparse/lib/const.js +21 -0
  191. package/node_modules/argparse/lib/help/added_formatters.js +87 -0
  192. package/node_modules/argparse/lib/help/formatter.js +795 -0
  193. package/node_modules/argparse/lib/namespace.js +76 -0
  194. package/node_modules/argparse/lib/utils.js +57 -0
  195. package/node_modules/argparse/package.json +34 -0
  196. package/node_modules/esprima/LICENSE.BSD +21 -0
  197. package/node_modules/esprima/README.md +46 -0
  198. package/node_modules/esprima/bin/esparse.js +139 -0
  199. package/node_modules/esprima/bin/esvalidate.js +236 -0
  200. package/node_modules/esprima/dist/esprima.js +6709 -0
  201. package/node_modules/esprima/package.json +112 -0
  202. package/node_modules/extend-shallow/LICENSE +21 -0
  203. package/node_modules/extend-shallow/README.md +61 -0
  204. package/node_modules/extend-shallow/index.js +33 -0
  205. package/node_modules/extend-shallow/package.json +56 -0
  206. package/node_modules/graceful-fs/LICENSE +15 -0
  207. package/node_modules/graceful-fs/README.md +143 -0
  208. package/node_modules/graceful-fs/clone.js +23 -0
  209. package/node_modules/graceful-fs/graceful-fs.js +448 -0
  210. package/node_modules/graceful-fs/legacy-streams.js +118 -0
  211. package/node_modules/graceful-fs/package.json +53 -0
  212. package/node_modules/graceful-fs/polyfills.js +355 -0
  213. package/node_modules/gray-matter/LICENSE +21 -0
  214. package/node_modules/gray-matter/README.md +565 -0
  215. package/node_modules/gray-matter/gray-matter.d.ts +114 -0
  216. package/node_modules/gray-matter/index.js +228 -0
  217. package/node_modules/gray-matter/lib/defaults.js +18 -0
  218. package/node_modules/gray-matter/lib/engine.js +30 -0
  219. package/node_modules/gray-matter/lib/engines.js +54 -0
  220. package/node_modules/gray-matter/lib/excerpt.js +32 -0
  221. package/node_modules/gray-matter/lib/parse.js +13 -0
  222. package/node_modules/gray-matter/lib/stringify.js +56 -0
  223. package/node_modules/gray-matter/lib/to-file.js +43 -0
  224. package/node_modules/gray-matter/lib/utils.js +66 -0
  225. package/node_modules/gray-matter/package.json +127 -0
  226. package/node_modules/is-extendable/LICENSE +21 -0
  227. package/node_modules/is-extendable/README.md +72 -0
  228. package/node_modules/is-extendable/index.js +13 -0
  229. package/node_modules/is-extendable/package.json +51 -0
  230. package/node_modules/js-yaml/LICENSE +21 -0
  231. package/node_modules/js-yaml/README.md +302 -0
  232. package/node_modules/js-yaml/bin/js-yaml.js +132 -0
  233. package/node_modules/js-yaml/dist/js-yaml.js +4024 -0
  234. package/node_modules/js-yaml/dist/js-yaml.min.js +1 -0
  235. package/node_modules/js-yaml/index.js +7 -0
  236. package/node_modules/js-yaml/lib/js-yaml/common.js +59 -0
  237. package/node_modules/js-yaml/lib/js-yaml/dumper.js +850 -0
  238. package/node_modules/js-yaml/lib/js-yaml/exception.js +43 -0
  239. package/node_modules/js-yaml/lib/js-yaml/loader.js +1679 -0
  240. package/node_modules/js-yaml/lib/js-yaml/mark.js +76 -0
  241. package/node_modules/js-yaml/lib/js-yaml/schema/core.js +18 -0
  242. package/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +25 -0
  243. package/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +28 -0
  244. package/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +17 -0
  245. package/node_modules/js-yaml/lib/js-yaml/schema/json.js +25 -0
  246. package/node_modules/js-yaml/lib/js-yaml/schema.js +108 -0
  247. package/node_modules/js-yaml/lib/js-yaml/type/binary.js +138 -0
  248. package/node_modules/js-yaml/lib/js-yaml/type/bool.js +35 -0
  249. package/node_modules/js-yaml/lib/js-yaml/type/float.js +116 -0
  250. package/node_modules/js-yaml/lib/js-yaml/type/int.js +173 -0
  251. package/node_modules/js-yaml/lib/js-yaml/type/js/function.js +93 -0
  252. package/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +60 -0
  253. package/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +28 -0
  254. package/node_modules/js-yaml/lib/js-yaml/type/map.js +8 -0
  255. package/node_modules/js-yaml/lib/js-yaml/type/merge.js +12 -0
  256. package/node_modules/js-yaml/lib/js-yaml/type/null.js +34 -0
  257. package/node_modules/js-yaml/lib/js-yaml/type/omap.js +44 -0
  258. package/node_modules/js-yaml/lib/js-yaml/type/pairs.js +53 -0
  259. package/node_modules/js-yaml/lib/js-yaml/type/seq.js +8 -0
  260. package/node_modules/js-yaml/lib/js-yaml/type/set.js +29 -0
  261. package/node_modules/js-yaml/lib/js-yaml/type/str.js +8 -0
  262. package/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +88 -0
  263. package/node_modules/js-yaml/lib/js-yaml/type.js +61 -0
  264. package/node_modules/js-yaml/lib/js-yaml.js +39 -0
  265. package/node_modules/js-yaml/package.json +52 -0
  266. package/node_modules/kind-of/LICENSE +21 -0
  267. package/node_modules/kind-of/README.md +367 -0
  268. package/node_modules/kind-of/index.js +129 -0
  269. package/node_modules/kind-of/package.json +88 -0
  270. package/node_modules/node-addon-api/common 2.gypi +21 -0
  271. package/node_modules/node-addon-api/except 2.gypi +25 -0
  272. package/node_modules/node-addon-api/napi 2.h +3463 -0
  273. package/node_modules/node-addon-api/napi-inl 2.h +7250 -0
  274. package/node_modules/node-addon-api/napi-inl.deprecated 2.h +186 -0
  275. package/node_modules/node-addon-api/node_addon_api 2.gyp +42 -0
  276. package/node_modules/node-addon-api/node_api 2.gyp +9 -0
  277. package/node_modules/node-addon-api/noexcept 2.gypi +26 -0
  278. package/node_modules/node-addon-api/nothing 2.c +0 -0
  279. package/node_modules/pi-toggle-skills/README.md +213 -0
  280. package/node_modules/pi-toggle-skills/package.json +60 -0
  281. package/node_modules/pi-toggle-skills/src/index.ts +112 -0
  282. package/node_modules/pi-toggle-skills/src/skill-discovery.ts +258 -0
  283. package/node_modules/pi-toggle-skills/src/skill-selector.ts +435 -0
  284. package/node_modules/pi-toggle-skills/toggle-skills 2.ts +316 -0
  285. package/node_modules/pi-toggle-skills/toggle-skills.ts +316 -0
  286. package/node_modules/pi-toggle-skills/vitest.config 2.ts +15 -0
  287. package/node_modules/pi-toggle-skills/vitest.config.ts +15 -0
  288. package/node_modules/proper-lockfile/LICENSE +21 -0
  289. package/node_modules/proper-lockfile/README.md +183 -0
  290. package/node_modules/proper-lockfile/index.js +40 -0
  291. package/node_modules/proper-lockfile/lib/adapter.js +85 -0
  292. package/node_modules/proper-lockfile/lib/lockfile.js +342 -0
  293. package/node_modules/proper-lockfile/lib/mtime-precision.js +55 -0
  294. package/node_modules/proper-lockfile/node_modules/retry/.npmignore +3 -0
  295. package/node_modules/proper-lockfile/node_modules/retry/.travis.yml +15 -0
  296. package/node_modules/proper-lockfile/node_modules/retry/License +21 -0
  297. package/node_modules/proper-lockfile/node_modules/retry/Makefile +18 -0
  298. package/node_modules/proper-lockfile/node_modules/retry/README.md +227 -0
  299. package/node_modules/proper-lockfile/node_modules/retry/equation.gif +0 -0
  300. package/node_modules/proper-lockfile/node_modules/retry/example/dns.js +31 -0
  301. package/node_modules/proper-lockfile/node_modules/retry/example/stop.js +40 -0
  302. package/node_modules/proper-lockfile/node_modules/retry/index.js +1 -0
  303. package/node_modules/proper-lockfile/node_modules/retry/lib/retry.js +100 -0
  304. package/node_modules/proper-lockfile/node_modules/retry/lib/retry_operation.js +158 -0
  305. package/node_modules/proper-lockfile/node_modules/retry/package.json +32 -0
  306. package/node_modules/proper-lockfile/node_modules/retry/test/common.js +10 -0
  307. package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-forever.js +24 -0
  308. package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-retry-operation.js +258 -0
  309. package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-retry-wrap.js +101 -0
  310. package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-timeouts.js +69 -0
  311. package/node_modules/proper-lockfile/package.json +71 -0
  312. package/node_modules/section-matter/LICENSE +21 -0
  313. package/node_modules/section-matter/README.md +236 -0
  314. package/node_modules/section-matter/index.js +136 -0
  315. package/node_modules/section-matter/package.json +55 -0
  316. package/node_modules/signal-exit/LICENSE.txt +16 -0
  317. package/node_modules/signal-exit/README.md +39 -0
  318. package/node_modules/signal-exit/index.js +202 -0
  319. package/node_modules/signal-exit/package.json +38 -0
  320. package/node_modules/signal-exit/signals.js +53 -0
  321. package/node_modules/sprintf-js/.npmignore +1 -0
  322. package/node_modules/sprintf-js/.npmignore 2 +1 -0
  323. package/node_modules/sprintf-js/LICENSE +24 -0
  324. package/node_modules/sprintf-js/LICENSE 2 +24 -0
  325. package/node_modules/sprintf-js/README 2.md +88 -0
  326. package/node_modules/sprintf-js/README.md +88 -0
  327. package/node_modules/sprintf-js/bower 2.json +14 -0
  328. package/node_modules/sprintf-js/bower.json +14 -0
  329. package/node_modules/sprintf-js/demo/angular.html +20 -0
  330. package/node_modules/sprintf-js/dist/angular-sprintf.min.js +4 -0
  331. package/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +1 -0
  332. package/node_modules/sprintf-js/dist/angular-sprintf.min.map +1 -0
  333. package/node_modules/sprintf-js/dist/sprintf.min.js +4 -0
  334. package/node_modules/sprintf-js/dist/sprintf.min.js.map +1 -0
  335. package/node_modules/sprintf-js/dist/sprintf.min.map +1 -0
  336. package/node_modules/sprintf-js/gruntfile 2.js +36 -0
  337. package/node_modules/sprintf-js/gruntfile.js +36 -0
  338. package/node_modules/sprintf-js/package 2.json +22 -0
  339. package/node_modules/sprintf-js/package.json +22 -0
  340. package/node_modules/sprintf-js/src/angular-sprintf.js +18 -0
  341. package/node_modules/sprintf-js/src/sprintf.js +208 -0
  342. package/node_modules/sprintf-js/test/test.js +82 -0
  343. package/node_modules/strip-bom-string/LICENSE +21 -0
  344. package/node_modules/strip-bom-string/README.md +66 -0
  345. package/node_modules/strip-bom-string/index.js +15 -0
  346. package/node_modules/strip-bom-string/package.json +60 -0
  347. package/node_modules/tree-sitter-bash/tree-sitter-bash 2.wasm +0 -0
  348. package/node_modules/typebox/license 2 +23 -0
  349. package/node_modules/typebox/package 2.json +87 -0
  350. package/node_modules/typebox/readme 2.md +370 -0
  351. package/node_modules/zod/compile 2.cjs +96 -0
  352. package/node_modules/zod/compile 2.js +52 -0
  353. package/node_modules/zod/index 2.cjs +52 -0
  354. package/node_modules/zod/index 2.js +7 -0
  355. package/package.json +13 -4
@@ -0,0 +1,168 @@
1
+ import { cloneJson, isJsonArray, isJsonObject, isJsonString, parseJson, } from "./json-value.js";
2
+ export const JSON_SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
3
+ const SCHEMA_MAP_KEYWORDS = new Set([
4
+ "$defs",
5
+ "definitions",
6
+ "dependentSchemas",
7
+ "patternProperties",
8
+ "properties",
9
+ ]);
10
+ const SCHEMA_ARRAY_KEYWORDS = new Set(["allOf", "anyOf", "oneOf", "prefixItems"]);
11
+ const SCHEMA_VALUE_KEYWORDS = new Set([
12
+ "additionalProperties",
13
+ "contains",
14
+ "else",
15
+ "if",
16
+ "items",
17
+ "not",
18
+ "propertyNames",
19
+ "then",
20
+ "unevaluatedItems",
21
+ "unevaluatedProperties",
22
+ ]);
23
+ function makeSettingsObjectPartial(schema) {
24
+ const transformed = {};
25
+ for (const [key, value] of Object.entries(schema)) {
26
+ if (key === "required")
27
+ continue;
28
+ if (key === "properties" && isJsonObject(value)) {
29
+ const properties = {};
30
+ for (const [name, child] of Object.entries(value)) {
31
+ properties[name] =
32
+ isJsonObject(child) && child.type === "object" && isJsonObject(child.properties)
33
+ ? makeSettingsObjectPartial(child)
34
+ : cloneJson(child);
35
+ }
36
+ transformed[key] = properties;
37
+ continue;
38
+ }
39
+ transformed[key] = cloneJson(value);
40
+ }
41
+ return transformed;
42
+ }
43
+ function stripTypeBoxMetadata(value) {
44
+ if (Array.isArray(value))
45
+ return value.map(stripTypeBoxMetadata);
46
+ if (!isJsonObject(value))
47
+ return value;
48
+ const sanitized = {};
49
+ for (const [key, child] of Object.entries(value)) {
50
+ if (key.startsWith("~"))
51
+ continue;
52
+ sanitized[key] = stripTypeBoxMetadata(child);
53
+ }
54
+ return sanitized;
55
+ }
56
+ function schemaRecord(schema) {
57
+ const serialized = JSON.stringify(schema);
58
+ if (serialized === undefined) {
59
+ throw new TypeError("The TypeBox schema is not JSON serializable.");
60
+ }
61
+ const parsed = parseJson(serialized);
62
+ if (!isJsonObject(parsed)) {
63
+ throw new TypeError("The TypeBox settings schema must serialize to a JSON object.");
64
+ }
65
+ return stripTypeBoxMetadata(parsed);
66
+ }
67
+ function visitChildSchemas(schema, path, visit) {
68
+ for (const [key, value] of Object.entries(schema)) {
69
+ if (SCHEMA_MAP_KEYWORDS.has(key) && isJsonObject(value)) {
70
+ for (const [name, child] of Object.entries(value)) {
71
+ if (isJsonObject(child))
72
+ visit(child, `${path}/${key}/${name}`);
73
+ }
74
+ continue;
75
+ }
76
+ if (SCHEMA_ARRAY_KEYWORDS.has(key) && isJsonArray(value)) {
77
+ for (const [index, child] of value.entries()) {
78
+ if (isJsonObject(child))
79
+ visit(child, `${path}/${key}/${index}`);
80
+ }
81
+ continue;
82
+ }
83
+ if (SCHEMA_VALUE_KEYWORDS.has(key) && isJsonObject(value)) {
84
+ visit(value, `${path}/${key}`);
85
+ }
86
+ }
87
+ }
88
+ export function hasReservedSchemaProperty(schema) {
89
+ const root = schemaRecord(schema);
90
+ return isJsonObject(root.properties) && "$schema" in root.properties;
91
+ }
92
+ export function findUndocumentedSettings(schema) {
93
+ const root = schemaRecord(schema);
94
+ if (!isJsonObject(root.properties))
95
+ return ["<root>"];
96
+ const issues = [];
97
+ function visit(properties, prefix) {
98
+ for (const [key, value] of Object.entries(properties)) {
99
+ const path = prefix === "" ? key : `${prefix}.${key}`;
100
+ if (isJsonObject(value) && value.type === "object" && isJsonObject(value.properties)) {
101
+ visit(value.properties, path);
102
+ continue;
103
+ }
104
+ if (!isJsonObject(value) ||
105
+ !isJsonString(value.description) ||
106
+ value.description.trim() === "") {
107
+ issues.push(path);
108
+ }
109
+ }
110
+ }
111
+ visit(root.properties, "");
112
+ return issues;
113
+ }
114
+ export function findNonStrictObjectSchemas(schema) {
115
+ const issues = [];
116
+ function visit(value, path) {
117
+ if (value.type === "object" && isJsonObject(value.properties)) {
118
+ if (value.additionalProperties !== false)
119
+ issues.push(path);
120
+ }
121
+ visitChildSchemas(value, path, visit);
122
+ }
123
+ visit(schemaRecord(schema), "#");
124
+ return issues;
125
+ }
126
+ export function createSettingsFileSchema(input) {
127
+ const partial = makeSettingsObjectPartial(schemaRecord(input.schema));
128
+ if (!isJsonObject(partial.properties)) {
129
+ throw new TypeError("The TypeBox settings schema must be an object with properties.");
130
+ }
131
+ const properties = {};
132
+ properties.$schema = {
133
+ type: "string",
134
+ default: `./schemas/${input.id}.schema.json`,
135
+ description: "JSON Schema used by editors for this settings file.",
136
+ };
137
+ for (const [key, value] of Object.entries(partial.properties)) {
138
+ properties[key] = cloneJson(value);
139
+ }
140
+ const schemaKeywords = {};
141
+ for (const [key, value] of Object.entries(partial)) {
142
+ if (["$schema", "$id", "title", "description", "properties", "required"].includes(key)) {
143
+ continue;
144
+ }
145
+ schemaKeywords[key] = cloneJson(value);
146
+ }
147
+ return {
148
+ $schema: JSON_SCHEMA_DIALECT,
149
+ $id: input.schemaId,
150
+ title: `${input.title} settings`,
151
+ description: input.description,
152
+ ...schemaKeywords,
153
+ type: "object",
154
+ properties,
155
+ additionalProperties: false,
156
+ };
157
+ }
158
+ export function createSettingsDocument(id, settings, schemaReference = `./schemas/${id}.schema.json`) {
159
+ const settingsEntries = Object.entries(settings).map(([key, value]) => [key, cloneJson(value)]);
160
+ return {
161
+ $schema: schemaReference,
162
+ ...Object.fromEntries(settingsEntries),
163
+ };
164
+ }
165
+ export function createDefaultSettingsDocument(input) {
166
+ return createSettingsDocument(input.id, input.defaultSettings);
167
+ }
168
+ //# sourceMappingURL=schema-document.js.map
@@ -0,0 +1 @@
1
+ {"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AAG,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO;QACH,OAAO,EAAE,mBAAmB;QAC5B,GAAG,EAAE,KAAK,CAAC,QAAQ;QACnB,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,WAAW;QAChC,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,GAAG,cAAc;QACjB,IAAI,EAAE,QAAQ;QACd,UAAU;QACV,oBAAoB,EAAE,KAAK;KACT,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,sBAAsB,CAClC,EAAU,EACV,QAAoB,EACpB,eAAe,GAAG,aAAa,EAAE,cAAc;IAE/C,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAChD,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,CAAU,CACrD,CAAC;IACF,OAAO;QACH,OAAO,EAAE,eAAe;QACxB,GAAG,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC;KACpB,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,6BAA6B,CACzC,KAAqE;IAErE,OAAO,sBAAsB,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import type { TSchema } from \"typebox\";\n\nimport {\n cloneJson,\n isJsonArray,\n isJsonObject,\n isJsonString,\n type JsonObject,\n type JsonValue,\n parseJson,\n} from \"./json-value.ts\";\n\nexport const JSON_SCHEMA_DIALECT = \"https://json-schema.org/draft/2020-12/schema\";\n\nexport type SchemaDocumentInput = {\n readonly id: string;\n readonly title: string;\n readonly description: string;\n readonly schemaId: string;\n readonly schema: TSchema;\n};\n\nconst SCHEMA_MAP_KEYWORDS = new Set([\n \"$defs\",\n \"definitions\",\n \"dependentSchemas\",\n \"patternProperties\",\n \"properties\",\n]);\nconst SCHEMA_ARRAY_KEYWORDS = new Set([\"allOf\", \"anyOf\", \"oneOf\", \"prefixItems\"]);\nconst SCHEMA_VALUE_KEYWORDS = new Set([\n \"additionalProperties\",\n \"contains\",\n \"else\",\n \"if\",\n \"items\",\n \"not\",\n \"propertyNames\",\n \"then\",\n \"unevaluatedItems\",\n \"unevaluatedProperties\",\n]);\n\nfunction makeSettingsObjectPartial(schema: JsonObject): JsonObject {\n const transformed: Record<string, JsonValue> = {};\n for (const [key, value] of Object.entries(schema)) {\n if (key === \"required\") continue;\n if (key === \"properties\" && isJsonObject(value)) {\n const properties: Record<string, JsonValue> = {};\n for (const [name, child] of Object.entries(value)) {\n properties[name] =\n isJsonObject(child) && child.type === \"object\" && isJsonObject(child.properties)\n ? makeSettingsObjectPartial(child)\n : cloneJson(child);\n }\n transformed[key] = properties;\n continue;\n }\n transformed[key] = cloneJson(value);\n }\n return transformed;\n}\n\nfunction stripTypeBoxMetadata(value: JsonObject): JsonObject;\nfunction stripTypeBoxMetadata(value: JsonValue): JsonValue;\nfunction stripTypeBoxMetadata(value: JsonValue): JsonValue {\n if (Array.isArray(value)) return value.map(stripTypeBoxMetadata);\n if (!isJsonObject(value)) return value;\n\n const sanitized: Record<string, JsonValue> = {};\n for (const [key, child] of Object.entries(value)) {\n if (key.startsWith(\"~\")) continue;\n sanitized[key] = stripTypeBoxMetadata(child);\n }\n return sanitized;\n}\n\nfunction schemaRecord(schema: TSchema): JsonObject {\n const serialized = JSON.stringify(schema);\n if (serialized === undefined) {\n throw new TypeError(\"The TypeBox schema is not JSON serializable.\");\n }\n\n const parsed = parseJson(serialized);\n if (!isJsonObject(parsed)) {\n throw new TypeError(\"The TypeBox settings schema must serialize to a JSON object.\");\n }\n return stripTypeBoxMetadata(parsed);\n}\n\nfunction visitChildSchemas(\n schema: JsonObject,\n path: string,\n visit: (schema: JsonObject, path: string) => void,\n): void {\n for (const [key, value] of Object.entries(schema)) {\n if (SCHEMA_MAP_KEYWORDS.has(key) && isJsonObject(value)) {\n for (const [name, child] of Object.entries(value)) {\n if (isJsonObject(child)) visit(child, `${path}/${key}/${name}`);\n }\n continue;\n }\n if (SCHEMA_ARRAY_KEYWORDS.has(key) && isJsonArray(value)) {\n for (const [index, child] of value.entries()) {\n if (isJsonObject(child)) visit(child, `${path}/${key}/${index}`);\n }\n continue;\n }\n if (SCHEMA_VALUE_KEYWORDS.has(key) && isJsonObject(value)) {\n visit(value, `${path}/${key}`);\n }\n }\n}\n\nexport function hasReservedSchemaProperty(schema: TSchema): boolean {\n const root = schemaRecord(schema);\n return isJsonObject(root.properties) && \"$schema\" in root.properties;\n}\n\nexport function findUndocumentedSettings(schema: TSchema): readonly string[] {\n const root = schemaRecord(schema);\n if (!isJsonObject(root.properties)) return [\"<root>\"];\n\n const issues: string[] = [];\n function visit(properties: JsonObject, prefix: string): void {\n for (const [key, value] of Object.entries(properties)) {\n const path = prefix === \"\" ? key : `${prefix}.${key}`;\n if (isJsonObject(value) && value.type === \"object\" && isJsonObject(value.properties)) {\n visit(value.properties, path);\n continue;\n }\n if (\n !isJsonObject(value) ||\n !isJsonString(value.description) ||\n value.description.trim() === \"\"\n ) {\n issues.push(path);\n }\n }\n }\n\n visit(root.properties, \"\");\n return issues;\n}\n\nexport function findNonStrictObjectSchemas(schema: TSchema): readonly string[] {\n const issues: string[] = [];\n\n function visit(value: JsonObject, path: string): void {\n if (value.type === \"object\" && isJsonObject(value.properties)) {\n if (value.additionalProperties !== false) issues.push(path);\n }\n visitChildSchemas(value, path, visit);\n }\n\n visit(schemaRecord(schema), \"#\");\n return issues;\n}\n\nexport function createSettingsFileSchema(input: SchemaDocumentInput): JsonObject {\n const partial = makeSettingsObjectPartial(schemaRecord(input.schema));\n if (!isJsonObject(partial.properties)) {\n throw new TypeError(\"The TypeBox settings schema must be an object with properties.\");\n }\n\n const properties: Record<string, JsonValue> = {};\n properties.$schema = {\n type: \"string\",\n default: `./schemas/${input.id}.schema.json`,\n description: \"JSON Schema used by editors for this settings file.\",\n };\n for (const [key, value] of Object.entries(partial.properties)) {\n properties[key] = cloneJson(value);\n }\n\n const schemaKeywords: Record<string, JsonValue> = {};\n for (const [key, value] of Object.entries(partial)) {\n if ([\"$schema\", \"$id\", \"title\", \"description\", \"properties\", \"required\"].includes(key)) {\n continue;\n }\n schemaKeywords[key] = cloneJson(value);\n }\n\n return {\n $schema: JSON_SCHEMA_DIALECT,\n $id: input.schemaId,\n title: `${input.title} settings`,\n description: input.description,\n ...schemaKeywords,\n type: \"object\",\n properties,\n additionalProperties: false,\n } satisfies JsonObject;\n}\n\nexport function createSettingsDocument(\n id: string,\n settings: JsonObject,\n schemaReference = `./schemas/${id}.schema.json`,\n): JsonObject {\n const settingsEntries = Object.entries(settings).map(\n ([key, value]) => [key, cloneJson(value)] as const,\n );\n return {\n $schema: schemaReference,\n ...Object.fromEntries(settingsEntries),\n } satisfies JsonObject;\n}\n\nexport function createDefaultSettingsDocument(\n input: SchemaDocumentInput & { readonly defaultSettings: JsonObject },\n): JsonObject {\n return createSettingsDocument(input.id, input.defaultSettings);\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { ExtensionSettingsDefinition } from "./definition.ts";
2
+ export declare const README_GENERATED_START = "<!-- pi-extension-settings:start -->";
3
+ export declare const README_GENERATED_END = "<!-- pi-extension-settings:end -->";
4
+ export type RenderReadmeOptions = {
5
+ readonly globalPath?: string;
6
+ };
7
+ export declare function renderReadmeSettingsSection(definition: ExtensionSettingsDefinition, options?: RenderReadmeOptions): string;
8
+ export declare function replaceGeneratedReadmeSection(readme: string, generatedSection: string): string | undefined;
9
+ //# sourceMappingURL=settings-documentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-documentation.d.ts","sourceRoot":"","sources":["../src/settings-documentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAiBnE,eAAO,MAAM,sBAAsB,yCAAyC,CAAC;AAC7E,eAAO,MAAM,oBAAoB,uCAAuC,CAAC;AAmNzE,MAAM,MAAM,mBAAmB,GAAG;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,wBAAgB,2BAA2B,CACvC,UAAU,EAAE,2BAA2B,EACvC,OAAO,GAAE,mBAAwB,GAClC,MAAM,CA2CR;AAED,wBAAgB,6BAA6B,CACzC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,GACzB,MAAM,GAAG,SAAS,CAapB"}
@@ -0,0 +1,242 @@
1
+ import { isJsonArray, isJsonBoolean, isJsonNumber, isJsonObject, isJsonString, } from "./json-value.js";
2
+ import { defaultGlobalSettingsDisplayPath } from "./paths.js";
3
+ import { createDefaultSettingsDocument, createSettingsDocument, createSettingsFileSchema, } from "./schema-document.js";
4
+ export const README_GENERATED_START = "<!-- pi-extension-settings:start -->";
5
+ export const README_GENERATED_END = "<!-- pi-extension-settings:end -->";
6
+ const MAX_INLINE_DEFAULT_CHARACTERS = 48;
7
+ const MAX_INLINE_TYPE_CHARACTERS = 120;
8
+ const TYPE_NAME_PATTERN = /^[A-Z][A-Za-z0-9]{0,39}$/;
9
+ function valueAtPath(root, path) {
10
+ let current = root;
11
+ for (const segment of path) {
12
+ if (!isJsonObject(current))
13
+ return undefined;
14
+ const next = current[segment];
15
+ if (next === undefined)
16
+ return undefined;
17
+ current = next;
18
+ }
19
+ return current;
20
+ }
21
+ function markdownCode(value) {
22
+ if (value === "")
23
+ return "<code></code>";
24
+ let longestBacktickRun = 0;
25
+ for (const match of value.matchAll(/`+/g)) {
26
+ longestBacktickRun = Math.max(longestBacktickRun, match[0].length);
27
+ }
28
+ const fence = "`".repeat(longestBacktickRun + 1);
29
+ const needsPadding = value.startsWith("`") ||
30
+ value.endsWith("`") ||
31
+ value.startsWith(" ") ||
32
+ value.endsWith(" ");
33
+ const content = needsPadding ? ` ${value} ` : value;
34
+ return `${fence}${content}${fence}`;
35
+ }
36
+ function literalType(value) {
37
+ if (isJsonString(value))
38
+ return markdownCode(value === "" ? '""' : value);
39
+ return markdownCode(JSON.stringify(value));
40
+ }
41
+ function directPrimitiveType(schema) {
42
+ if (schema.const !== undefined || isJsonArray(schema.enum))
43
+ return undefined;
44
+ if (!isJsonString(schema.type))
45
+ return undefined;
46
+ if (["boolean", "integer", "null", "number", "string"].includes(schema.type)) {
47
+ return schema.type;
48
+ }
49
+ return undefined;
50
+ }
51
+ function valueCoveredByPrimitiveTypes(value, types) {
52
+ if (value === null)
53
+ return types.has("null");
54
+ if (isJsonNumber(value)) {
55
+ if (types.has("number"))
56
+ return true;
57
+ return Number.isInteger(value) && types.has("integer");
58
+ }
59
+ if (isJsonBoolean(value))
60
+ return types.has("boolean");
61
+ if (isJsonString(value))
62
+ return types.has("string");
63
+ return false;
64
+ }
65
+ function schemaCoveredByPrimitiveTypes(schema, types) {
66
+ if (schema.const !== undefined) {
67
+ return valueCoveredByPrimitiveTypes(schema.const, types);
68
+ }
69
+ if (isJsonArray(schema.enum)) {
70
+ return (schema.enum.length > 0 &&
71
+ schema.enum.every((value) => valueCoveredByPrimitiveTypes(value, types)));
72
+ }
73
+ const alternatives = schema.anyOf ?? schema.oneOf;
74
+ if (!isJsonArray(alternatives) || alternatives.length === 0)
75
+ return false;
76
+ return alternatives.every((alternative) => isJsonObject(alternative) && schemaCoveredByPrimitiveTypes(alternative, types));
77
+ }
78
+ function schemaTypeTitle(schema) {
79
+ if (!isJsonString(schema.title))
80
+ return undefined;
81
+ const title = schema.title.trim();
82
+ return TYPE_NAME_PATTERN.test(title) ? title : undefined;
83
+ }
84
+ function schemaType(schema) {
85
+ if (schema.const !== undefined)
86
+ return literalType(schema.const);
87
+ if (isJsonArray(schema.enum)) {
88
+ return schema.enum.map(literalType).join(" | ");
89
+ }
90
+ const alternatives = schema.anyOf ?? schema.oneOf;
91
+ if (isJsonArray(alternatives)) {
92
+ const schemas = alternatives.filter(isJsonObject);
93
+ const primitiveTypes = new Set(schemas
94
+ .map(directPrimitiveType)
95
+ .filter((value) => value !== undefined));
96
+ const numberSubsumesInteger = primitiveTypes.has("number");
97
+ return schemas
98
+ .filter((alternative) => {
99
+ const directType = directPrimitiveType(alternative);
100
+ if (directType !== undefined) {
101
+ return !(directType === "integer" && numberSubsumesInteger);
102
+ }
103
+ return !schemaCoveredByPrimitiveTypes(alternative, primitiveTypes);
104
+ })
105
+ .map(schemaType)
106
+ .filter((value, index, values) => values.indexOf(value) === index)
107
+ .join(" | ");
108
+ }
109
+ if (schema.type === "array") {
110
+ if (!isJsonObject(schema.items))
111
+ return "array";
112
+ const itemType = schemaType(schema.items);
113
+ if (itemType.includes(" | "))
114
+ return `(${itemType})[]`;
115
+ return `${itemType}[]`;
116
+ }
117
+ if (schema.type === "object") {
118
+ const title = schemaTypeTitle(schema);
119
+ if (title !== undefined)
120
+ return title;
121
+ if (isJsonObject(schema.properties)) {
122
+ const required = new Set(isJsonArray(schema.required) ? schema.required.filter(isJsonString) : []);
123
+ const fields = Object.entries(schema.properties).map(([key, value]) => {
124
+ const optional = required.has(key) ? "" : "?";
125
+ const type = isJsonObject(value) ? schemaType(value) : "JSON value";
126
+ return `${key}${optional}: ${type}`;
127
+ });
128
+ return `{ ${fields.join("; ")} }`;
129
+ }
130
+ if (isJsonObject(schema.patternProperties)) {
131
+ const valueTypes = Object.values(schema.patternProperties)
132
+ .map((value) => (isJsonObject(value) ? schemaType(value) : "JSON value"))
133
+ .filter((value, index, values) => values.indexOf(value) === index);
134
+ if (valueTypes.length > 0)
135
+ return `Record<string, ${valueTypes.join(" | ")}>`;
136
+ }
137
+ return "object";
138
+ }
139
+ if (isJsonArray(schema.type)) {
140
+ return schema.type
141
+ .filter(isJsonString)
142
+ .filter((value, index, values) => values.indexOf(value) === index)
143
+ .join(" | ");
144
+ }
145
+ if (isJsonString(schema.type))
146
+ return schema.type;
147
+ if (isJsonString(schema.$ref)) {
148
+ const segments = schema.$ref.split(/[/#]/).filter((segment) => segment !== "");
149
+ return segments.at(-1) ?? "referenced value";
150
+ }
151
+ return "JSON value";
152
+ }
153
+ function collectRows(properties, defaults, prefix = []) {
154
+ const rows = [];
155
+ for (const [key, value] of Object.entries(properties)) {
156
+ if (key === "$schema" || !isJsonObject(value))
157
+ continue;
158
+ const path = [...prefix, key];
159
+ if (value.type === "object" && isJsonObject(value.properties)) {
160
+ rows.push(...collectRows(value.properties, defaults, path));
161
+ continue;
162
+ }
163
+ const type = schemaType(value);
164
+ if (type.length > MAX_INLINE_TYPE_CHARACTERS) {
165
+ throw new TypeError(`Generated README type for "${path.join(".")}" is too long; add a concise PascalCase title to the complex item or record-value schema.`);
166
+ }
167
+ rows.push({
168
+ path: path.join("."),
169
+ type,
170
+ defaultValue: valueAtPath(defaults, path),
171
+ description: isJsonString(value.description) ? value.description : "",
172
+ });
173
+ }
174
+ return rows;
175
+ }
176
+ function markdownCell(value) {
177
+ return value.replaceAll("|", "\\|").replaceAll("\n", " ");
178
+ }
179
+ function canRenderDefaultInline(value) {
180
+ if (value === null || isJsonBoolean(value) || isJsonNumber(value))
181
+ return true;
182
+ if (isJsonString(value)) {
183
+ return (!value.includes("\n") && JSON.stringify(value).length <= MAX_INLINE_DEFAULT_CHARACTERS);
184
+ }
185
+ if (Array.isArray(value))
186
+ return value.length === 0;
187
+ return Object.keys(value).length === 0;
188
+ }
189
+ function formatDefault(value) {
190
+ if (value === undefined)
191
+ return "—";
192
+ if (!canRenderDefaultInline(value))
193
+ return "*See JSON below*";
194
+ return markdownCode(markdownCell(JSON.stringify(value)));
195
+ }
196
+ export function renderReadmeSettingsSection(definition, options = {}) {
197
+ const fileSchema = createSettingsFileSchema(definition);
198
+ /* v8 ignore next -- createSettingsFileSchema always returns an object properties map */
199
+ if (!isJsonObject(fileSchema.properties)) {
200
+ throw new TypeError("Generated settings schema does not contain properties.");
201
+ }
202
+ const rows = collectRows(fileSchema.properties, definition.defaultSettings);
203
+ const tableRows = rows.map((row) => `| ${markdownCell(markdownCode(row.path))} | ${markdownCell(row.type)} | ${formatDefault(row.defaultValue)} | ${markdownCell(row.description)} |`);
204
+ const globalPath = options.globalPath ?? defaultGlobalSettingsDisplayPath(definition.id);
205
+ const defaultDocument = createDefaultSettingsDocument(definition);
206
+ const documentation = [
207
+ "## Configuration",
208
+ "",
209
+ `Global settings are stored in ${markdownCode(globalPath)}.`,
210
+ "",
211
+ "| Option | Type | Default | Description |",
212
+ "| --- | --- | --- | --- |",
213
+ ...tableRows,
214
+ "",
215
+ ];
216
+ if (definition.exampleSettings !== undefined) {
217
+ documentation.push("### Defaults", "");
218
+ }
219
+ documentation.push("```json", JSON.stringify(defaultDocument, undefined, 2), "```");
220
+ if (definition.exampleSettings !== undefined) {
221
+ const exampleDocument = createSettingsDocument(definition.id, definition.exampleSettings);
222
+ documentation.push("", "### Advanced example", "", "```json", JSON.stringify(exampleDocument, undefined, 2), "```");
223
+ }
224
+ return documentation.join("\n");
225
+ }
226
+ export function replaceGeneratedReadmeSection(readme, generatedSection) {
227
+ const start = readme.indexOf(README_GENERATED_START);
228
+ const end = readme.indexOf(README_GENERATED_END);
229
+ if (start < 0 && end < 0) {
230
+ return `${readme.trimEnd()}\n\n${README_GENERATED_START}\n${generatedSection.trim()}\n${README_GENERATED_END}\n`;
231
+ }
232
+ if (start < 0 || end < start)
233
+ return undefined;
234
+ if (readme.indexOf(README_GENERATED_START, start + 1) >= 0)
235
+ return undefined;
236
+ if (readme.indexOf(README_GENERATED_END, end + 1) >= 0)
237
+ return undefined;
238
+ const before = readme.slice(0, start + README_GENERATED_START.length);
239
+ const after = readme.slice(end);
240
+ return `${before}\n${generatedSection.trim()}\n${after}`;
241
+ }
242
+ //# sourceMappingURL=settings-documentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-documentation.js","sourceRoot":"","sources":["../src/settings-documentation.ts"],"names":[],"mappings":"AACA,OAAO,EACH,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,GAGf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gCAAgC,EAAE,M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";\nimport {\n isJsonArray,\n isJsonBoolean,\n isJsonNumber,\n isJsonObject,\n isJsonString,\n type JsonObject,\n type JsonValue,\n} from \"./json-value.ts\";\nimport { defaultGlobalSettingsDisplayPath } from \"./paths.ts\";\nimport {\n createDefaultSettingsDocument,\n createSettingsDocument,\n createSettingsFileSchema,\n} from \"./schema-document.ts\";\n\nexport const README_GENERATED_START = \"<!-- pi-extension-settings:start -->\";\nexport const README_GENERATED_END = \"<!-- pi-extension-settings:end -->\";\n\nconst MAX_INLINE_DEFAULT_CHARACTERS = 48;\nconst MAX_INLINE_TYPE_CHARACTERS = 120;\nconst TYPE_NAME_PATTERN = /^[A-Z][A-Za-z0-9]{0,39}$/;\n\ntype SettingsRow = {\n readonly path: string;\n readonly type: string;\n readonly defaultValue: JsonValue | undefined;\n readonly description: string;\n};\n\nfunction valueAtPath(root: JsonObject, path: readonly string[]): JsonValue | undefined {\n let current: JsonValue = root;\n for (const segment of path) {\n if (!isJsonObject(current)) return undefined;\n const next: JsonValue | undefined = current[segment];\n if (next === undefined) return undefined;\n current = next;\n }\n return current;\n}\n\nfunction markdownCode(value: string): string {\n if (value === \"\") return \"<code></code>\";\n\n let longestBacktickRun = 0;\n for (const match of value.matchAll(/`+/g)) {\n longestBacktickRun = Math.max(longestBacktickRun, match[0].length);\n }\n const fence = \"`\".repeat(longestBacktickRun + 1);\n const needsPadding =\n value.startsWith(\"`\") ||\n value.endsWith(\"`\") ||\n value.startsWith(\" \") ||\n value.endsWith(\" \");\n const content = needsPadding ? ` ${value} ` : value;\n return `${fence}${content}${fence}`;\n}\n\nfunction literalType(value: JsonValue): string {\n if (isJsonString(value)) return markdownCode(value === \"\" ? '\"\"' : value);\n return markdownCode(JSON.stringify(value));\n}\n\nfunction directPrimitiveType(schema: JsonObject): string | undefined {\n if (schema.const !== undefined || isJsonArray(schema.enum)) return undefined;\n if (!isJsonString(schema.type)) return undefined;\n if ([\"boolean\", \"integer\", \"null\", \"number\", \"string\"].includes(schema.type)) {\n return schema.type;\n }\n return undefined;\n}\n\nfunction valueCoveredByPrimitiveTypes(value: JsonValue, types: ReadonlySet<string>): boolean {\n if (value === null) return types.has(\"null\");\n if (isJsonNumber(value)) {\n if (types.has(\"number\")) return true;\n return Number.isInteger(value) && types.has(\"integer\");\n }\n if (isJsonBoolean(value)) return types.has(\"boolean\");\n if (isJsonString(value)) return types.has(\"string\");\n return false;\n}\n\nfunction schemaCoveredByPrimitiveTypes(schema: JsonObject, types: ReadonlySet<string>): boolean {\n if (schema.const !== undefined) {\n return valueCoveredByPrimitiveTypes(schema.const, types);\n }\n if (isJsonArray(schema.enum)) {\n return (\n schema.enum.length > 0 &&\n schema.enum.every((value) => valueCoveredByPrimitiveTypes(value, types))\n );\n }\n const alternatives = schema.anyOf ?? schema.oneOf;\n if (!isJsonArray(alternatives) || alternatives.length === 0) return false;\n return alternatives.every(\n (alternative) =>\n isJsonObject(alternative) && schemaCoveredByPrimitiveTypes(alternative, types),\n );\n}\n\nfunction schemaTypeTitle(schema: JsonObject): string | undefined {\n if (!isJsonString(schema.title)) return undefined;\n const title = schema.title.trim();\n return TYPE_NAME_PATTERN.test(title) ? title : undefined;\n}\n\nfunction schemaType(schema: JsonObject): string {\n if (schema.const !== undefined) return literalType(schema.const);\n if (isJsonArray(schema.enum)) {\n return schema.enum.map(literalType).join(\" | \");\n }\n\n const alternatives = schema.anyOf ?? schema.oneOf;\n if (isJsonArray(alternatives)) {\n const schemas = alternatives.filter(isJsonObject);\n const primitiveTypes = new Set(\n schemas\n .map(directPrimitiveType)\n .filter((value): value is string => value !== undefined),\n );\n const numberSubsumesInteger = primitiveTypes.has(\"number\");\n\n return schemas\n .filter((alternative) => {\n const directType = directPrimitiveType(alternative);\n if (directType !== undefined) {\n return !(directType === \"integer\" && numberSubsumesInteger);\n }\n return !schemaCoveredByPrimitiveTypes(alternative, primitiveTypes);\n })\n .map(schemaType)\n .filter((value, index, values) => values.indexOf(value) === index)\n .join(\" | \");\n }\n\n if (schema.type === \"array\") {\n if (!isJsonObject(schema.items)) return \"array\";\n const itemType = schemaType(schema.items);\n if (itemType.includes(\" | \")) return `(${itemType})[]`;\n return `${itemType}[]`;\n }\n if (schema.type === \"object\") {\n const title = schemaTypeTitle(schema);\n if (title !== undefined) return title;\n if (isJsonObject(schema.properties)) {\n const required = new Set(\n isJsonArray(schema.required) ? schema.required.filter(isJsonString) : [],\n );\n const fields = Object.entries(schema.properties).map(([key, value]) => {\n const optional = required.has(key) ? \"\" : \"?\";\n const type = isJsonObject(value) ? schemaType(value) : \"JSON value\";\n return `${key}${optional}: ${type}`;\n });\n return `{ ${fields.join(\"; \")} }`;\n }\n if (isJsonObject(schema.patternProperties)) {\n const valueTypes = Object.values(schema.patternProperties)\n .map((value) => (isJsonObject(value) ? schemaType(value) : \"JSON value\"))\n .filter((value, index, values) => values.indexOf(value) === index);\n if (valueTypes.length > 0) return `Record<string, ${valueTypes.join(\" | \")}>`;\n }\n return \"object\";\n }\n if (isJsonArray(schema.type)) {\n return schema.type\n .filter(isJsonString)\n .filter((value, index, values) => values.indexOf(value) === index)\n .join(\" | \");\n }\n if (isJsonString(schema.type)) return schema.type;\n if (isJsonString(schema.$ref)) {\n const segments = schema.$ref.split(/[/#]/).filter((segment) => segment !== \"\");\n return segments.at(-1) ?? \"referenced value\";\n }\n return \"JSON value\";\n}\n\nfunction collectRows(\n properties: JsonObject,\n defaults: JsonObject,\n prefix: readonly string[] = [],\n): readonly SettingsRow[] {\n const rows: SettingsRow[] = [];\n for (const [key, value] of Object.entries(properties)) {\n if (key === \"$schema\" || !isJsonObject(value)) continue;\n const path = [...prefix, key];\n if (value.type === \"object\" && isJsonObject(value.properties)) {\n rows.push(...collectRows(value.properties, defaults, path));\n continue;\n }\n const type = schemaType(value);\n if (type.length > MAX_INLINE_TYPE_CHARACTERS) {\n throw new TypeError(\n `Generated README type for \"${path.join(\".\")}\" is too long; add a concise PascalCase title to the complex item or record-value schema.`,\n );\n }\n rows.push({\n path: path.join(\".\"),\n type,\n defaultValue: valueAtPath(defaults, path),\n description: isJsonString(value.description) ? value.description : \"\",\n });\n }\n return rows;\n}\n\nfunction markdownCell(value: string): string {\n return value.replaceAll(\"|\", \"\\\\|\").replaceAll(\"\\n\", \" \");\n}\n\nfunction canRenderDefaultInline(value: JsonValue): boolean {\n if (value === null || isJsonBoolean(value) || isJsonNumber(value)) return true;\n if (isJsonString(value)) {\n return (\n !value.includes(\"\\n\") && JSON.stringify(value).length <= MAX_INLINE_DEFAULT_CHARACTERS\n );\n }\n if (Array.isArray(value)) return value.length === 0;\n return Object.keys(value).length === 0;\n}\n\nfunction formatDefault(value: JsonValue | undefined): string {\n if (value === undefined) return \"—\";\n if (!canRenderDefaultInline(value)) return \"*See JSON below*\";\n return markdownCode(markdownCell(JSON.stringify(value)));\n}\n\nexport type RenderReadmeOptions = {\n readonly globalPath?: string;\n};\n\nexport function renderReadmeSettingsSection(\n definition: ExtensionSettingsDefinition,\n options: RenderReadmeOptions = {},\n): string {\n const fileSchema = createSettingsFileSchema(definition);\n /* v8 ignore next -- createSettingsFileSchema always returns an object properties map */\n if (!isJsonObject(fileSchema.properties)) {\n throw new TypeError(\"Generated settings schema does not contain properties.\");\n }\n\n const rows = collectRows(fileSchema.properties, definition.defaultSettings);\n const tableRows = rows.map(\n (row) =>\n `| ${markdownCell(markdownCode(row.path))} | ${markdownCell(row.type)} | ${formatDefault(row.defaultValue)} | ${markdownCell(row.description)} |`,\n );\n const globalPath = options.globalPath ?? defaultGlobalSettingsDisplayPath(definition.id);\n const defaultDocument = createDefaultSettingsDocument(definition);\n const documentation = [\n \"## Configuration\",\n \"\",\n `Global settings are stored in ${markdownCode(globalPath)}.`,\n \"\",\n \"| Option | Type | Default | Description |\",\n \"| --- | --- | --- | --- |\",\n ...tableRows,\n \"\",\n ];\n\n if (definition.exampleSettings !== undefined) {\n documentation.push(\"### Defaults\", \"\");\n }\n documentation.push(\"```json\", JSON.stringify(defaultDocument, undefined, 2), \"```\");\n\n if (definition.exampleSettings !== undefined) {\n const exampleDocument = createSettingsDocument(definition.id, definition.exampleSettings);\n documentation.push(\n \"\",\n \"### Advanced example\",\n \"\",\n \"```json\",\n JSON.stringify(exampleDocument, undefined, 2),\n \"```\",\n );\n }\n\n return documentation.join(\"\\n\");\n}\n\nexport function replaceGeneratedReadmeSection(\n readme: string,\n generatedSection: string,\n): string | undefined {\n const start = readme.indexOf(README_GENERATED_START);\n const end = readme.indexOf(README_GENERATED_END);\n if (start < 0 && end < 0) {\n return `${readme.trimEnd()}\\n\\n${README_GENERATED_START}\\n${generatedSection.trim()}\\n${README_GENERATED_END}\\n`;\n }\n if (start < 0 || end < start) return undefined;\n if (readme.indexOf(README_GENERATED_START, start + 1) >= 0) return undefined;\n if (readme.indexOf(README_GENERATED_END, end + 1) >= 0) return undefined;\n\n const before = readme.slice(0, start + README_GENERATED_START.length);\n const after = readme.slice(end);\n return `${before}\\n${generatedSection.trim()}\\n${after}`;\n}\n"]}
@@ -0,0 +1,59 @@
1
+ import type { TObject, TSchema } from "typebox";
2
+ import { type JsonObject, type JsonValue } from "./json-value.ts";
3
+ export type SettingsScope = "global" | "project";
4
+ /**
5
+ * Stable machine-readable category for a non-fatal settings problem.
6
+ *
7
+ * Callers should branch on this value rather than diagnostic text:
8
+ *
9
+ * - `bundled-schema-read-failed`: the generated schema could not be read.
10
+ * - `bundled-schema-stale`: the bundled schema does not match the definition.
11
+ * - `config-decode-failed`: a validated layer could not be decoded by TypeBox.
12
+ * - `config-invalid`: a layer failed validation or conflicted with an earlier layer.
13
+ * - `config-malformed`: a settings file contains malformed JSON.
14
+ * - `config-read-failed`: a settings file could not be read.
15
+ * - `config-scaffold-failed`: the initial global settings file could not be created.
16
+ * - `schema-install-failed`: the editor schema could not be installed.
17
+ */
18
+ export type SettingsDiagnosticCode = "bundled-schema-read-failed" | "bundled-schema-stale" | "config-decode-failed" | "config-invalid" | "config-malformed" | "config-read-failed" | "config-scaffold-failed" | "schema-install-failed";
19
+ export type SettingsValidationIssue = {
20
+ /** JSON Pointer to the invalid setting, or `/` for the document root. */
21
+ readonly path: string;
22
+ /** TypeBox validation message for this issue. */
23
+ readonly message: string;
24
+ };
25
+ /**
26
+ * A non-fatal problem encountered while loading settings.
27
+ *
28
+ * The affected schema or settings layer is ignored. Messages and validation issues contain no
29
+ * settings values, making them suitable for display through Pi's UI.
30
+ */
31
+ export type SettingsDiagnostic = {
32
+ /** Stable category intended for programmatic handling. */
33
+ readonly code: SettingsDiagnosticCode;
34
+ /** All current diagnostics are errors; the field allows direct use with `ctx.ui.notify`. */
35
+ readonly severity: "error";
36
+ /** The settings layer or editor-schema operation that failed. */
37
+ readonly scope: SettingsScope | "schema";
38
+ /** Absolute path of the affected settings or schema file. */
39
+ readonly path: string;
40
+ /** User-facing summary that does not include settings values. */
41
+ readonly message: string;
42
+ /** JSON Pointer paths and validator messages when schema validation failed. */
43
+ readonly issues?: readonly SettingsValidationIssue[];
44
+ };
45
+ export type ParsedSettingsLayer = {
46
+ /** Encoded JSON settings after editor-only metadata is removed. */
47
+ readonly settings: JsonObject | undefined;
48
+ /** Editor schema reference from the file, when present and valid. */
49
+ readonly schemaReference: string | undefined;
50
+ readonly diagnostics: readonly SettingsDiagnostic[];
51
+ };
52
+ export declare function settingsValidationIssues(schema: TSchema, value: JsonValue): readonly SettingsValidationIssue[];
53
+ export declare function parseSettingsLayer(path: string, scope: SettingsScope, text: string, layerSchema: TSchema): ParsedSettingsLayer;
54
+ export type AppliedSettingsLayer = {
55
+ readonly settings: JsonObject;
56
+ readonly diagnostic?: SettingsDiagnostic;
57
+ };
58
+ export declare function applySettingsLayer<Schema extends TObject>(schema: Schema, current: JsonObject, layer: Pick<ParsedSettingsLayer, "settings">, path: string, scope: SettingsScope): AppliedSettingsLayer;
59
+ //# sourceMappingURL=settings-layer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-layer.d.ts","sourceRoot":"","sources":["../src/settings-layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,O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