@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,18 @@
1
+ export type JsonPrimitive = boolean | null | number | string;
2
+ export type JsonValue = JsonPrimitive | JsonArray | JsonObject;
3
+ export interface JsonArray extends ReadonlyArray<JsonValue> {
4
+ readonly [index: number]: JsonValue;
5
+ }
6
+ export interface JsonObject {
7
+ readonly [key: string]: JsonValue;
8
+ }
9
+ export declare const JsonValueSchema: import("typebox").TUnsafe<JsonValue>;
10
+ export declare function isJsonBoolean(value: JsonValue | undefined): value is boolean;
11
+ export declare function isJsonNumber(value: JsonValue | undefined): value is number;
12
+ export declare function isJsonString(value: JsonValue | undefined): value is string;
13
+ export declare function isJsonArray(value: JsonValue | undefined): value is JsonArray;
14
+ export declare function isJsonObject(value: JsonValue | undefined): value is JsonObject;
15
+ export declare function cloneJson<Value extends JsonValue>(value: Value): Value;
16
+ export declare function parseJson(text: string): JsonValue | undefined;
17
+ export declare function formatJson(value: JsonValue): string;
18
+ //# sourceMappingURL=json-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-value.d.ts","sourceRoot":"","sources":["../src/json-value.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAE7D,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,UAAU,CAAC;AAE/D,MAAM,WAAW,SAAU,SAAQ,aAAa,CAAC,SAAS,CAAC;IACvD,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,WAAW,UAAU;IACvB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAgBD,eAAO,MAAM,eAAe,sCAc3B,CAAC;AAMF,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,KAAK,IAAI,OAAO,CAE5E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,KAAK,IAAI,MAAM,CAE1E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,KAAK,IAAI,MAAM,CAE1E;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,KAAK,IAAI,SAAS,CAE5E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,KAAK,IAAI,UAAU,CAE9E;AAED,wBAAgB,SAAS,CAAC,KAAK,SAAS,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAEtE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAM7D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAEnD"}
@@ -0,0 +1,56 @@
1
+ import { Typebox, Value } from "./typebox-runtime.js";
2
+ const { Array: ArrayType, Boolean: BooleanType, Cyclic, Null, Number: NumberType, Record: RecordType, Ref, Refine, String: StringType, Union, Unknown, Unsafe, } = Typebox;
3
+ const JsonObjectCandidateSchema = RecordType(StringType(), Unknown());
4
+ function isPlainJsonObject(value) {
5
+ if (!Value.Check(JsonObjectCandidateSchema, value))
6
+ return false;
7
+ const prototype = Reflect.getPrototypeOf(value);
8
+ return ((prototype === Object.prototype || prototype === null) &&
9
+ Object.getOwnPropertySymbols(value).length === 0);
10
+ }
11
+ // SAFETY: TypeBox widens deeply recursive Cyclic static types. This schema exactly mirrors the
12
+ // JsonValue recursion, rejects non-plain and symbol-keyed objects, and Value.Parse validates every
13
+ // nested value before it receives the JsonValue type.
14
+ export const JsonValueSchema = Unsafe(Cyclic({
15
+ JsonValue: Union([
16
+ Null(),
17
+ BooleanType(),
18
+ NumberType(),
19
+ StringType(),
20
+ ArrayType(Ref("JsonValue")),
21
+ Refine(RecordType(StringType(), Ref("JsonValue")), isPlainJsonObject),
22
+ ]),
23
+ }, "JsonValue"));
24
+ const JsonBooleanSchema = BooleanType();
25
+ const JsonNumberSchema = NumberType();
26
+ const JsonStringSchema = StringType();
27
+ export function isJsonBoolean(value) {
28
+ return Value.Check(JsonBooleanSchema, value);
29
+ }
30
+ export function isJsonNumber(value) {
31
+ return Value.Check(JsonNumberSchema, value);
32
+ }
33
+ export function isJsonString(value) {
34
+ return Value.Check(JsonStringSchema, value);
35
+ }
36
+ export function isJsonArray(value) {
37
+ return Array.isArray(value);
38
+ }
39
+ export function isJsonObject(value) {
40
+ return value !== undefined && isPlainJsonObject(value);
41
+ }
42
+ export function cloneJson(value) {
43
+ return structuredClone(value);
44
+ }
45
+ export function parseJson(text) {
46
+ try {
47
+ return Value.Parse(JsonValueSchema, JSON.parse(text));
48
+ }
49
+ catch {
50
+ return undefined;
51
+ }
52
+ }
53
+ export function formatJson(value) {
54
+ return `${JSON.stringify(value, undefined, 2)}\n`;
55
+ }
56
+ //# sourceMappingURL=json-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-value.js","sourceRoot":"","sources":["../src/json-value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,EACF,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,WAAW,EACpB,MAAM,EACN,IAAI,EACJ,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,EAClB,GAAG,EACH,MAAM,EACN,MAAM,EAAE,UAAU,EAClB,KAAK,EACL,OAAO,EACP,MAAM,GACT,GAAG,OAAO,CAAC;AAcZ,MAAM,yBAAyB,GAAG,UAAU,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAEtE,SAAS,iBAAiB,CAAC,KAAgB;IACvC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACjE,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAChD,OAAO,CACH,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC;QACtD,MAAM,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CACnD,CAAC;AACN,CAAC;AAED,+FAA+F;AAC/F,mGAAmG;AACnG,sDAAsD;AACtD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CACjC,MAAM,CACF;IACI,SAAS,EAAE,KAAK,CAAC;QACb,IAAI,EAAE;QACN,WAAW,EAAE;QACb,UAAU,EAAE;QACZ,UAAU,EAAE;QACZ,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC3B,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,iBAAiB,CAAC;KACxE,CAAC;CACL,EACD,WAAW,CACd,CACJ,CAAC;AAEF,MAAM,iBAAiB,GAAG,WAAW,EAAE,CAAC;AACxC,MAAM,gBAAgB,GAAG,UAAU,EAAE,CAAC;AACtC,MAAM,gBAAgB,GAAG,UAAU,EAAE,CAAC;AAEtC,MAAM,UAAU,aAAa,CAAC,KAA4B;IACtD,OAAO,KAAK,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAA4B;IACrD,OAAO,KAAK,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAA4B;IACrD,OAAO,KAAK,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAA4B;IACpD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAA4B;IACrD,OAAO,KAAK,KAAK,SAAS,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,SAAS,CAA0B,KAAY;IAC3D,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAY;IAClC,IAAI,CAAC;QACD,OAAO,KAAK,CAAC,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,SAAS,CAAC;IACrB,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAgB;IACvC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC","sourcesContent":["import { Typebox, Value } from \"./typebox-runtime.ts\";\n\nconst {\n Array: ArrayType,\n Boolean: BooleanType,\n Cyclic,\n Null,\n Number: NumberType,\n Record: RecordType,\n Ref,\n Refine,\n String: StringType,\n Union,\n Unknown,\n Unsafe,\n} = Typebox;\n\nexport type JsonPrimitive = boolean | null | number | string;\n\nexport type JsonValue = JsonPrimitive | JsonArray | JsonObject;\n\nexport interface JsonArray extends ReadonlyArray<JsonValue> {\n readonly [index: number]: JsonValue;\n}\n\nexport interface JsonObject {\n readonly [key: string]: JsonValue;\n}\n\nconst JsonObjectCandidateSchema = RecordType(StringType(), Unknown());\n\nfunction isPlainJsonObject(value: JsonValue): value is JsonObject {\n if (!Value.Check(JsonObjectCandidateSchema, value)) return false;\n const prototype = Reflect.getPrototypeOf(value);\n return (\n (prototype === Object.prototype || prototype === null) &&\n Object.getOwnPropertySymbols(value).length === 0\n );\n}\n\n// SAFETY: TypeBox widens deeply recursive Cyclic static types. This schema exactly mirrors the\n// JsonValue recursion, rejects non-plain and symbol-keyed objects, and Value.Parse validates every\n// nested value before it receives the JsonValue type.\nexport const JsonValueSchema = Unsafe<JsonValue>(\n Cyclic(\n {\n JsonValue: Union([\n Null(),\n BooleanType(),\n NumberType(),\n StringType(),\n ArrayType(Ref(\"JsonValue\")),\n Refine(RecordType(StringType(), Ref(\"JsonValue\")), isPlainJsonObject),\n ]),\n },\n \"JsonValue\",\n ),\n);\n\nconst JsonBooleanSchema = BooleanType();\nconst JsonNumberSchema = NumberType();\nconst JsonStringSchema = StringType();\n\nexport function isJsonBoolean(value: JsonValue | undefined): value is boolean {\n return Value.Check(JsonBooleanSchema, value);\n}\n\nexport function isJsonNumber(value: JsonValue | undefined): value is number {\n return Value.Check(JsonNumberSchema, value);\n}\n\nexport function isJsonString(value: JsonValue | undefined): value is string {\n return Value.Check(JsonStringSchema, value);\n}\n\nexport function isJsonArray(value: JsonValue | undefined): value is JsonArray {\n return Array.isArray(value);\n}\n\nexport function isJsonObject(value: JsonValue | undefined): value is JsonObject {\n return value !== undefined && isPlainJsonObject(value);\n}\n\nexport function cloneJson<Value extends JsonValue>(value: Value): Value {\n return structuredClone(value);\n}\n\nexport function parseJson(text: string): JsonValue | undefined {\n try {\n return Value.Parse(JsonValueSchema, JSON.parse(text));\n } catch {\n return undefined;\n }\n}\n\nexport function formatJson(value: JsonValue): string {\n return `${JSON.stringify(value, undefined, 2)}\\n`;\n}\n"]}
@@ -0,0 +1,11 @@
1
+ export declare const EXTENSION_SETTINGS_DIRECTORY = "extension-settings";
2
+ export declare const EXTENSION_SETTINGS_SCHEMA_DIRECTORY = "schemas";
3
+ export type ExtensionSettingsPaths = {
4
+ readonly configPath: string;
5
+ readonly schemaPath: string;
6
+ readonly schemaReference: string;
7
+ };
8
+ export declare function resolveGlobalSettingsPaths(agentDir: string, settingsId: string): ExtensionSettingsPaths;
9
+ export declare function resolveProjectSettingsPaths(cwd: string, configDirName: string, settingsId: string): ExtensionSettingsPaths;
10
+ export declare function defaultGlobalSettingsDisplayPath(settingsId: string): string;
11
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,4BAA4B,uBAAuB,CAAC;AACjE,eAAO,MAAM,mCAAmC,YAAY,CAAC;AAE7D,MAAM,MAAM,sBAAsB,GAAG;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,wBAAgB,0BAA0B,CACtC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACnB,sBAAsB,CAWxB;AAED,wBAAgB,2BAA2B,CACvC,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,GACnB,sBAAsB,CAWxB;AAED,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE3E"}
@@ -0,0 +1,23 @@
1
+ import { join } from "node:path";
2
+ export const EXTENSION_SETTINGS_DIRECTORY = "extension-settings";
3
+ export const EXTENSION_SETTINGS_SCHEMA_DIRECTORY = "schemas";
4
+ export function resolveGlobalSettingsPaths(agentDir, settingsId) {
5
+ const settingsDirectory = join(agentDir, EXTENSION_SETTINGS_DIRECTORY);
6
+ return {
7
+ configPath: join(settingsDirectory, `${settingsId}.json`),
8
+ schemaPath: join(settingsDirectory, EXTENSION_SETTINGS_SCHEMA_DIRECTORY, `${settingsId}.schema.json`),
9
+ schemaReference: `./${EXTENSION_SETTINGS_SCHEMA_DIRECTORY}/${settingsId}.schema.json`,
10
+ };
11
+ }
12
+ export function resolveProjectSettingsPaths(cwd, configDirName, settingsId) {
13
+ const settingsDirectory = join(cwd, configDirName, EXTENSION_SETTINGS_DIRECTORY);
14
+ return {
15
+ configPath: join(settingsDirectory, `${settingsId}.json`),
16
+ schemaPath: join(settingsDirectory, EXTENSION_SETTINGS_SCHEMA_DIRECTORY, `${settingsId}.schema.json`),
17
+ schemaReference: `./${EXTENSION_SETTINGS_SCHEMA_DIRECTORY}/${settingsId}.schema.json`,
18
+ };
19
+ }
20
+ export function defaultGlobalSettingsDisplayPath(settingsId) {
21
+ return `~/.pi/agent/${EXTENSION_SETTINGS_DIRECTORY}/${settingsId}.json`;
22
+ }
23
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AACjE,MAAM,CAAC,MAAM,mCAAmC,GAAG,SAAS,CAAC;AAQ7D,MAAM,UAAU,0BAA0B,CACtC,QAAgB,EAChB,UAAkB;IAElB,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,EAAE,4BAA4B,CAAC,CAAC;IACvE,OAAO;QACH,UAAU,EAAE,IAAI,CAAC,iBAAiB,EAAE,GAAG,UAAU,OAAO,CAAC;QACzD,UAAU,EAAE,IAAI,CACZ,iBAAiB,EACjB,mCAAmC,EACnC,GAAG,UAAU,cAAc,CAC9B;QACD,eAAe,EAAE,KAAK,mCAAmC,IAAI,UAAU,cAAc;KACxF,CAAC;AACN,CAAC;AAED,MAAM,UAAU,2BAA2B,CACvC,GAAW,EACX,aAAqB,EACrB,UAAkB;IAElB,MAAM,iBAAiB,GAAG,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,4BAA4B,CAAC,CAAC;IACjF,OAAO;QACH,UAAU,EAAE,IAAI,CAAC,iBAAiB,EAAE,GAAG,UAAU,OAAO,CAAC;QACzD,UAAU,EAAE,IAAI,CACZ,iBAAiB,EACjB,mCAAmC,EACnC,GAAG,UAAU,cAAc,CAC9B;QACD,eAAe,EAAE,KAAK,mCAAmC,IAAI,UAAU,cAAc;KACxF,CAAC;AACN,CAAC;AAED,MAAM,UAAU,gCAAgC,CAAC,UAAkB;IAC/D,OAAO,eAAe,4BAA4B,IAAI,UAAU,OAAO,CAAC;AAC5E,CAAC","sourcesContent":["import { join } from \"node:path\";\n\nexport const EXTENSION_SETTINGS_DIRECTORY = \"extension-settings\";\nexport const EXTENSION_SETTINGS_SCHEMA_DIRECTORY = \"schemas\";\n\nexport type ExtensionSettingsPaths = {\n readonly configPath: string;\n readonly schemaPath: string;\n readonly schemaReference: string;\n};\n\nexport function resolveGlobalSettingsPaths(\n agentDir: string,\n settingsId: string,\n): ExtensionSettingsPaths {\n const settingsDirectory = join(agentDir, EXTENSION_SETTINGS_DIRECTORY);\n return {\n configPath: join(settingsDirectory, `${settingsId}.json`),\n schemaPath: join(\n settingsDirectory,\n EXTENSION_SETTINGS_SCHEMA_DIRECTORY,\n `${settingsId}.schema.json`,\n ),\n schemaReference: `./${EXTENSION_SETTINGS_SCHEMA_DIRECTORY}/${settingsId}.schema.json`,\n };\n}\n\nexport function resolveProjectSettingsPaths(\n cwd: string,\n configDirName: string,\n settingsId: string,\n): ExtensionSettingsPaths {\n const settingsDirectory = join(cwd, configDirName, EXTENSION_SETTINGS_DIRECTORY);\n return {\n configPath: join(settingsDirectory, `${settingsId}.json`),\n schemaPath: join(\n settingsDirectory,\n EXTENSION_SETTINGS_SCHEMA_DIRECTORY,\n `${settingsId}.schema.json`,\n ),\n schemaReference: `./${EXTENSION_SETTINGS_SCHEMA_DIRECTORY}/${settingsId}.schema.json`,\n };\n}\n\nexport function defaultGlobalSettingsDisplayPath(settingsId: string): string {\n return `~/.pi/agent/${EXTENSION_SETTINGS_DIRECTORY}/${settingsId}.json`;\n}\n"]}
@@ -0,0 +1,5 @@
1
+ /** Pi's public project configuration directory for the supported upstream runtime. */
2
+ export declare const PI_CONFIG_DIR_NAME = ".pi";
3
+ /** Resolves Pi's agent directory without evaluating the full coding-agent runtime graph. */
4
+ export declare function getPiAgentDir(env?: NodeJS.ProcessEnv, homeDirectory?: string): string;
5
+ //# sourceMappingURL=pi-host-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi-host-paths.d.ts","sourceRoot":"","sources":["../src/pi-host-paths.ts"],"names":[],"mappings":"AAGA,sFAAsF;AACtF,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAIxC,4FAA4F;AAC5F,wBAAgB,aAAa,CACzB,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,aAAa,GAAE,MAAkB,GAClC,MAAM,CAeR"}
@@ -0,0 +1,21 @@
1
+ import { homedir } from "node:os";
2
+ import { join } from "node:path";
3
+ /** Pi's public project configuration directory for the supported upstream runtime. */
4
+ export const PI_CONFIG_DIR_NAME = ".pi";
5
+ const PI_AGENT_DIR_ENV = "PI_CODING_AGENT_DIR";
6
+ /** Resolves Pi's agent directory without evaluating the full coding-agent runtime graph. */
7
+ export function getPiAgentDir(env = process.env, homeDirectory = homedir()) {
8
+ const configured = env[PI_AGENT_DIR_ENV];
9
+ if (configured === undefined || configured.length === 0) {
10
+ return join(homeDirectory, PI_CONFIG_DIR_NAME, "agent");
11
+ }
12
+ if (configured === "~") {
13
+ return homeDirectory;
14
+ }
15
+ if (configured.startsWith("~/") ||
16
+ (process.platform === "win32" && configured.startsWith("~\\"))) {
17
+ return join(homeDirectory, configured.slice(2));
18
+ }
19
+ return configured;
20
+ }
21
+ //# sourceMappingURL=pi-host-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi-host-paths.js","sourceRoot":"","sources":["../src/pi-host-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,sFAAsF;AACtF,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAExC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAE/C,4FAA4F;AAC5F,MAAM,UAAU,aAAa,CACzB,MAAyB,OAAO,CAAC,GAAG,EACpC,gBAAwB,OAAO,EAAE;IAEjC,MAAM,UAAU,GAAG,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACzC,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtD,OAAO,IAAI,CAAC,aAAa,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;QACrB,OAAO,aAAa,CAAC;IACzB,CAAC;IACD,IACI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC;QAC3B,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAChE,CAAC;QACC,OAAO,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\n/** Pi's public project configuration directory for the supported upstream runtime. */\nexport const PI_CONFIG_DIR_NAME = \".pi\";\n\nconst PI_AGENT_DIR_ENV = \"PI_CODING_AGENT_DIR\";\n\n/** Resolves Pi's agent directory without evaluating the full coding-agent runtime graph. */\nexport function getPiAgentDir(\n env: NodeJS.ProcessEnv = process.env,\n homeDirectory: string = homedir(),\n): string {\n const configured = env[PI_AGENT_DIR_ENV];\n if (configured === undefined || configured.length === 0) {\n return join(homeDirectory, PI_CONFIG_DIR_NAME, \"agent\");\n }\n if (configured === \"~\") {\n return homeDirectory;\n }\n if (\n configured.startsWith(\"~/\") ||\n (process.platform === \"win32\" && configured.startsWith(\"~\\\\\"))\n ) {\n return join(homeDirectory, configured.slice(2));\n }\n return configured;\n}\n"]}
@@ -0,0 +1,106 @@
1
+ import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+ import type { TObject } from "typebox";
3
+ import type { ExtensionSettingsDefinition } from "./definition.ts";
4
+ import { type BundledSchemaSource, type LoadedSettings, type SettingsDiagnostic, type SettingsDiagnosticCode } from "./settings-loader.ts";
5
+ import type { PiSettingsRevision } from "./settings-revision.ts";
6
+ import type { PiSettingsUpdateIssue, PiSettingsUpdateScope, UpdatePiExtensionSettingsOptions, UpdatePiExtensionSettingsResult } from "./settings-transaction.ts";
7
+ /**
8
+ * Portion of Pi's extension context required to locate and authorize project settings.
9
+ *
10
+ * Pass the current `ExtensionContext` directly; callers do not need to construct this object.
11
+ */
12
+ export type PiSettingsContext = Pick<ExtensionContext, "cwd" | "isProjectTrusted">;
13
+ /** Options for {@link loadPiExtensionSettings}. */
14
+ export type LoadPiExtensionSettingsOptions = {
15
+ /** Generated schema bundled with the extension package. */
16
+ readonly bundledSchema: BundledSchemaSource;
17
+ };
18
+ /**
19
+ * Settings resolution result returned by {@link loadPiExtensionSettings}.
20
+ *
21
+ * @template Schema The TypeBox object schema from the supplied extension definition.
22
+ */
23
+ export type LoadedPiExtensionSettings<Schema extends TObject> = LoadedSettings<Schema>;
24
+ export type { BundledSchemaSource, PiSettingsRevision, PiSettingsUpdateIssue, PiSettingsUpdateScope, SettingsDiagnostic, SettingsDiagnosticCode, UpdatePiExtensionSettingsOptions, UpdatePiExtensionSettingsResult, };
25
+ /**
26
+ * Returns the absolute global settings path for an extension.
27
+ *
28
+ * The path is `<getAgentDir()>/extension-settings/<extensionId>.json`. This function does not access
29
+ * the filesystem.
30
+ *
31
+ * @param extensionId The definition ID used in the settings filename.
32
+ */
33
+ export declare function getPiGlobalSettingsPath(extensionId: string): string;
34
+ /**
35
+ * Returns the absolute project-settings path for an extension.
36
+ *
37
+ * The path is `<cwd>/<CONFIG_DIR_NAME>/extension-settings/<extensionId>.json`. This function does
38
+ * not check project trust or access the filesystem.
39
+ *
40
+ * @param extensionId The definition ID used in the settings filename.
41
+ * @param cwd The project directory, normally `ctx.cwd`.
42
+ */
43
+ export declare function getPiProjectSettingsPath(extensionId: string, cwd: string): string;
44
+ /**
45
+ * Loads an extension's resolved settings using Pi's standard directories and trust state.
46
+ *
47
+ * Resolution starts with schema defaults, recursively merges the global layer, then recursively
48
+ * merges the project layer only when Pi reports the project as trusted. Arrays and scalar values
49
+ * replace earlier values. Unreadable, malformed, invalid, or undecodable layers are ignored and
50
+ * reported in `diagnostics`.
51
+ *
52
+ * Loading is synchronous. When the bundled schema matches the definition, the function atomically
53
+ * installs the editor schema and creates the global settings file if it does not exist. Existing
54
+ * settings files are never overwritten, and project settings files are never created.
55
+ *
56
+ * Keep this call out of module import and the extension factory. Cache its result once per session
57
+ * and invoke it from the first lifecycle callback that needs settings. If enabled behavior must
58
+ * begin during `session_start`, that handler is the correct first-use boundary.
59
+ *
60
+ * @template Schema The TypeBox object schema used to infer the decoded `settings` value.
61
+ * @param definition A validated definition created by `defineExtensionSettings`.
62
+ * @param context The current Pi extension context.
63
+ * @param options The generated schema bundled with the extension.
64
+ * @returns Decoded settings, encoded layers, source revisions, paths, installation state, and diagnostics.
65
+ * @throws If a custom TypeBox transform decoder throws while decoding the resolved settings.
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * import { loadPiExtensionSettings } from "@zigai/pi-extension-settings/pi";
70
+ * import settingsDefinition from "./settings.ts";
71
+ *
72
+ * const loaded = loadPiExtensionSettings(settingsDefinition, ctx, {
73
+ * bundledSchema: {
74
+ * kind: "url",
75
+ * url: new URL("../config.schema.json", import.meta.url),
76
+ * },
77
+ * });
78
+ * ```
79
+ */
80
+ export declare function loadPiExtensionSettings<const Schema extends TObject>(definition: ExtensionSettingsDefinition<Schema>, context: PiSettingsContext, options: LoadPiExtensionSettingsOptions): LoadedPiExtensionSettings<Schema>;
81
+ /**
82
+ * Transactionally updates an extension's encoded global or project settings layer.
83
+ *
84
+ * The latest layer is read, validated, cloned, and passed once to `options.update` while the target
85
+ * settings sources are protected by Pi's in-process mutation queue and a cooperative inter-process
86
+ * lock. The returned layer is validated both independently and after resolution over defaults and
87
+ * earlier layers, then atomically published. Existing malformed or invalid settings are never
88
+ * overwritten.
89
+ *
90
+ * Call `loadPiExtensionSettings` before updating so the generated editor schema is installed and
91
+ * verified for the active definition.
92
+ *
93
+ * Pass `expectedRevision` for snapshot-based editors that must reject changes made after opening.
94
+ * Omit it for semantic updates that should apply to the latest valid layer. Project updates are
95
+ * blocked unless Pi reports the project as trusted; calling this function is an explicit write and
96
+ * may create a missing trusted-project settings file.
97
+ *
98
+ * @template Schema The TypeBox object schema from the supplied extension definition.
99
+ * @param definition A validated definition created by `defineExtensionSettings`.
100
+ * @param context The current Pi extension context used for paths and project trust.
101
+ * @param options Scope, optional optimistic revision, and synchronous encoded-layer updater.
102
+ * @returns A typed update outcome; filesystem and validation failures do not expose settings values.
103
+ * @throws The original error when `options.update` throws an `Error`.
104
+ */
105
+ export declare function updatePiExtensionSettings<const Schema extends TObject>(definition: ExtensionSettingsDefinition<Schema>, context: PiSettingsContext, options: UpdatePiExtensionSettingsOptions<Schema>): Promise<UpdatePiExtensionSettingsResult>;
106
+ //# sourceMappingURL=pi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../src/pi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAGnE,OAAO,EAEH,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EACR,qBAAqB,EACrB,qBAAqB,EACrB,gCAAgC,EAChC,+BAA+B,EAClC,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,kBAAkB,CAAC,CAAC;AAEnF,mDAAmD;AACnD,MAAM,MAAM,8BAA8B,GAAG;IACzC,2DAA2D;IAC3D,QAAQ,CAAC,aAAa,EAAE,mBAAmB,CAAC;CAC/C,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,CAAC,MAAM,SAAS,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AACvF,YAAY,EACR,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,gCAAgC,EAChC,+BAA+B,GAClC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,CAAC,MAAM,SAAS,OAAO,EAChE,UAAU,EAAE,2BAA2B,CAAC,MAAM,CAAC,EAC/C,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,8BAA8B,GACxC,yBAAyB,CAAC,MAAM,CAAC,CAUnC;AAoBD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,yBAAyB,CAAC,KAAK,CAAC,MAAM,SAAS,OAAO,EACxE,UAAU,EAAE,2BAA2B,CAAC,MAAM,CAAC,EAC/C,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,gCAAgC,CAAC,MAAM,CAAC,GAClD,OAAO,CAAC,+BAA+B,CAAC,CAuB1C"}
@@ -0,0 +1,122 @@
1
+ import { getPiAgentDir, PI_CONFIG_DIR_NAME } from "./pi-host-paths.js";
2
+ import { resolveGlobalSettingsPaths, resolveProjectSettingsPaths } from "./paths.js";
3
+ import { loadSettings, } from "./settings-loader.js";
4
+ /**
5
+ * Returns the absolute global settings path for an extension.
6
+ *
7
+ * The path is `<getAgentDir()>/extension-settings/<extensionId>.json`. This function does not access
8
+ * the filesystem.
9
+ *
10
+ * @param extensionId The definition ID used in the settings filename.
11
+ */
12
+ export function getPiGlobalSettingsPath(extensionId) {
13
+ return resolveGlobalSettingsPaths(getPiAgentDir(), extensionId).configPath;
14
+ }
15
+ /**
16
+ * Returns the absolute project-settings path for an extension.
17
+ *
18
+ * The path is `<cwd>/<CONFIG_DIR_NAME>/extension-settings/<extensionId>.json`. This function does
19
+ * not check project trust or access the filesystem.
20
+ *
21
+ * @param extensionId The definition ID used in the settings filename.
22
+ * @param cwd The project directory, normally `ctx.cwd`.
23
+ */
24
+ export function getPiProjectSettingsPath(extensionId, cwd) {
25
+ return resolveProjectSettingsPaths(cwd, PI_CONFIG_DIR_NAME, extensionId).configPath;
26
+ }
27
+ /**
28
+ * Loads an extension's resolved settings using Pi's standard directories and trust state.
29
+ *
30
+ * Resolution starts with schema defaults, recursively merges the global layer, then recursively
31
+ * merges the project layer only when Pi reports the project as trusted. Arrays and scalar values
32
+ * replace earlier values. Unreadable, malformed, invalid, or undecodable layers are ignored and
33
+ * reported in `diagnostics`.
34
+ *
35
+ * Loading is synchronous. When the bundled schema matches the definition, the function atomically
36
+ * installs the editor schema and creates the global settings file if it does not exist. Existing
37
+ * settings files are never overwritten, and project settings files are never created.
38
+ *
39
+ * Keep this call out of module import and the extension factory. Cache its result once per session
40
+ * and invoke it from the first lifecycle callback that needs settings. If enabled behavior must
41
+ * begin during `session_start`, that handler is the correct first-use boundary.
42
+ *
43
+ * @template Schema The TypeBox object schema used to infer the decoded `settings` value.
44
+ * @param definition A validated definition created by `defineExtensionSettings`.
45
+ * @param context The current Pi extension context.
46
+ * @param options The generated schema bundled with the extension.
47
+ * @returns Decoded settings, encoded layers, source revisions, paths, installation state, and diagnostics.
48
+ * @throws If a custom TypeBox transform decoder throws while decoding the resolved settings.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * import { loadPiExtensionSettings } from "@zigai/pi-extension-settings/pi";
53
+ * import settingsDefinition from "./settings.ts";
54
+ *
55
+ * const loaded = loadPiExtensionSettings(settingsDefinition, ctx, {
56
+ * bundledSchema: {
57
+ * kind: "url",
58
+ * url: new URL("../config.schema.json", import.meta.url),
59
+ * },
60
+ * });
61
+ * ```
62
+ */
63
+ export function loadPiExtensionSettings(definition, context, options) {
64
+ return loadSettings(definition, {
65
+ agentDir: getPiAgentDir(),
66
+ bundledSchema: options.bundledSchema,
67
+ project: {
68
+ cwd: context.cwd,
69
+ configDirName: PI_CONFIG_DIR_NAME,
70
+ trusted: context.isProjectTrusted(),
71
+ },
72
+ });
73
+ }
74
+ async function withFileMutationQueues(paths, operation, withFileMutationQueue, index = 0) {
75
+ const path = paths[index];
76
+ if (path === undefined)
77
+ return operation();
78
+ return withFileMutationQueue(path, () => withFileMutationQueues(paths, operation, withFileMutationQueue, index + 1));
79
+ }
80
+ /**
81
+ * Transactionally updates an extension's encoded global or project settings layer.
82
+ *
83
+ * The latest layer is read, validated, cloned, and passed once to `options.update` while the target
84
+ * settings sources are protected by Pi's in-process mutation queue and a cooperative inter-process
85
+ * lock. The returned layer is validated both independently and after resolution over defaults and
86
+ * earlier layers, then atomically published. Existing malformed or invalid settings are never
87
+ * overwritten.
88
+ *
89
+ * Call `loadPiExtensionSettings` before updating so the generated editor schema is installed and
90
+ * verified for the active definition.
91
+ *
92
+ * Pass `expectedRevision` for snapshot-based editors that must reject changes made after opening.
93
+ * Omit it for semantic updates that should apply to the latest valid layer. Project updates are
94
+ * blocked unless Pi reports the project as trusted; calling this function is an explicit write and
95
+ * may create a missing trusted-project settings file.
96
+ *
97
+ * @template Schema The TypeBox object schema from the supplied extension definition.
98
+ * @param definition A validated definition created by `defineExtensionSettings`.
99
+ * @param context The current Pi extension context used for paths and project trust.
100
+ * @param options Scope, optional optimistic revision, and synchronous encoded-layer updater.
101
+ * @returns A typed update outcome; filesystem and validation failures do not expose settings values.
102
+ * @throws The original error when `options.update` throws an `Error`.
103
+ */
104
+ export async function updatePiExtensionSettings(definition, context, options) {
105
+ // Read-only consumers should not initialize the lock library or its process signal handlers.
106
+ const [{ updateSettingsTransaction }, { withFileMutationQueue }] = await Promise.all([
107
+ import("./settings-transaction.js"),
108
+ import("@earendil-works/pi-coding-agent"),
109
+ ]);
110
+ const global = resolveGlobalSettingsPaths(getPiAgentDir(), definition.id);
111
+ const project = resolveProjectSettingsPaths(context.cwd, PI_CONFIG_DIR_NAME, definition.id);
112
+ const projectTrusted = context.isProjectTrusted();
113
+ const paths = options.scope === "global"
114
+ ? [global.configPath]
115
+ : [global.configPath, project.configPath].sort();
116
+ return withFileMutationQueues(paths, () => updateSettingsTransaction(definition, {
117
+ ...options,
118
+ paths: { global, project },
119
+ projectTrusted,
120
+ }), withFileMutationQueue);
121
+ }
122
+ //# sourceMappingURL=pi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.js","sourceRoot":"","sources":["../src/pi.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AACrF,OAAO,EACH,YAAY,GAKf,MAAM,sBAAsB,CAAC;AAuC9B;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAmB;IACvD,OAAO,0BAA0B,CAAC,aAAa,EAAE,EAAE,WAAW,CAAC,CAAC,UAAU,CAAC;AAC/E,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAmB,EAAE,GAAW;IACrE,OAAO,2BAA2B,CAAC,GAAG,EAAE,kBAAkB,EAAE,WAAW,CAAC,CAAC,UAAU,CAAC;AACxF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,uBAAuB,CACnC,UAA+C,EAC/C,OAA0B,EAC1B,OAAuC;IAEvC,OAAO,YAAY,CAAC,UAAU,EAAE;QAC5B,QAAQ,EAAE,aAAa,EAAE;QACzB,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,OAAO,EAAE;YACL,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,aAAa,EAAE,kBAAkB;YACjC,OAAO,EAAE,OAAO,CAAC,gBAAgB,EAAE;SACtC;KACJ,CAAC,CAAC;AACP,CAAC;AAOD,KAAK,UAAU,sBAAsB,CACjC,KAAwB,EACxB,SAAgC,EAChC,qBAAwC,EACxC,KAAK,GAAG,CAAC;IAET,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,EAAE,CAAC;IAC3C,OAAO,qBAAqB,CAAC,IAAI,EAAE,GAAG,EAAE,CACpC,sBAAsB,CAAC,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,KAAK,GAAG,CAAC,CAAC,CAC7E,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC3C,UAA+C,EAC/C,OAA0B,EAC1B,OAAiD;IAEjD,6FAA6F;IAC7F,MAAM,CAAC,EAAE,yBAAyB,EAAE,EAAE,EAAE,qBAAqB,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACjF,MAAM,CAAC,2BAA2B,CAAC;QACnC,MAAM,CAAC,iCAAiC,CAAC;KAC5C,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,0BAA0B,CAAC,aAAa,EAAE,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IAC1E,MAAM,OAAO,GAAG,2BAA2B,CAAC,OAAO,CAAC,GAAG,EAAE,kBAAkB,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IAC5F,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAClD,MAAM,KAAK,GACP,OAAO,CAAC,KAAK,KAAK,QAAQ;QACtB,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;QACrB,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;IACzD,OAAO,sBAAsB,CACzB,KAAK,EACL,GAAG,EAAE,CACD,yBAAyB,CAAC,UAAU,EAAE;QAClC,GAAG,OAAO;QACV,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE;QAC1B,cAAc;KACjB,CAAC,EACN,qBAAqB,CACxB,CAAC;AACN,CAAC","sourcesContent":["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport type { TObject } from \"typebox\";\n\nimport type { ExtensionSettingsDefinition } from \"./definition.ts\";\nimport { getPiAgentDir, PI_CONFIG_DIR_NAME } from \"./pi-host-paths.ts\";\nimport { resolveGlobalSettingsPaths, resolveProjectSettingsPaths } from \"./paths.ts\";\nimport {\n loadSettings,\n type BundledSchemaSource,\n type LoadedSettings,\n type SettingsDiagnostic,\n type SettingsDiagnosticCode,\n} from \"./settings-loader.ts\";\nimport type { PiSettingsRevision } from \"./settings-revision.ts\";\nimport type {\n PiSettingsUpdateIssue,\n PiSettingsUpdateScope,\n UpdatePiExtensionSettingsOptions,\n UpdatePiExtensionSettingsResult,\n} from \"./settings-transaction.ts\";\n\n/**\n * Portion of Pi's extension context required to locate and authorize project settings.\n *\n * Pass the current `ExtensionContext` directly; callers do not need to construct this object.\n */\nexport type PiSettingsContext = Pick<ExtensionContext, \"cwd\" | \"isProjectTrusted\">;\n\n/** Options for {@link loadPiExtensionSettings}. */\nexport type LoadPiExtensionSettingsOptions = {\n /** Generated schema bundled with the extension package. */\n readonly bundledSchema: BundledSchemaSource;\n};\n\n/**\n * Settings resolution result returned by {@link loadPiExtensionSettings}.\n *\n * @template Schema The TypeBox object schema from the supplied extension definition.\n */\nexport type LoadedPiExtensionSettings<Schema extends TObject> = LoadedSettings<Schema>;\nexport type {\n BundledSchemaSource,\n PiSettingsRevision,\n PiSettingsUpdateIssue,\n PiSettingsUpdateScope,\n SettingsDiagnostic,\n SettingsDiagnosticCode,\n UpdatePiExtensionSettingsOptions,\n UpdatePiExtensionSettingsResult,\n};\n\n/**\n * Returns the absolute global settings path for an extension.\n *\n * The path is `<getAgentDir()>/extension-settings/<extensionId>.json`. This function does not access\n * the filesystem.\n *\n * @param extensionId The definition ID used in the settings filename.\n */\nexport function getPiGlobalSettingsPath(extensionId: string): string {\n return resolveGlobalSettingsPaths(getPiAgentDir(), extensionId).configPath;\n}\n\n/**\n * Returns the absolute project-settings path for an extension.\n *\n * The path is `<cwd>/<CONFIG_DIR_NAME>/extension-settings/<extensionId>.json`. This function does\n * not check project trust or access the filesystem.\n *\n * @param extensionId The definition ID used in the settings filename.\n * @param cwd The project directory, normally `ctx.cwd`.\n */\nexport function getPiProjectSettingsPath(extensionId: string, cwd: string): string {\n return resolveProjectSettingsPaths(cwd, PI_CONFIG_DIR_NAME, extensionId).configPath;\n}\n\n/**\n * Loads an extension's resolved settings using Pi's standard directories and trust state.\n *\n * Resolution starts with schema defaults, recursively merges the global layer, then recursively\n * merges the project layer only when Pi reports the project as trusted. Arrays and scalar values\n * replace earlier values. Unreadable, malformed, invalid, or undecodable layers are ignored and\n * reported in `diagnostics`.\n *\n * Loading is synchronous. When the bundled schema matches the definition, the function atomically\n * installs the editor schema and creates the global settings file if it does not exist. Existing\n * settings files are never overwritten, and project settings files are never created.\n *\n * Keep this call out of module import and the extension factory. Cache its result once per session\n * and invoke it from the first lifecycle callback that needs settings. If enabled behavior must\n * begin during `session_start`, that handler is the correct first-use boundary.\n *\n * @template Schema The TypeBox object schema used to infer the decoded `settings` value.\n * @param definition A validated definition created by `defineExtensionSettings`.\n * @param context The current Pi extension context.\n * @param options The generated schema bundled with the extension.\n * @returns Decoded settings, encoded layers, source revisions, paths, installation state, and diagnostics.\n * @throws If a custom TypeBox transform decoder throws while decoding the resolved settings.\n *\n * @example\n * ```ts\n * import { loadPiExtensionSettings } from \"@zigai/pi-extension-settings/pi\";\n * import settingsDefinition from \"./settings.ts\";\n *\n * const loaded = loadPiExtensionSettings(settingsDefinition, ctx, {\n * bundledSchema: {\n * kind: \"url\",\n * url: new URL(\"../config.schema.json\", import.meta.url),\n * },\n * });\n * ```\n */\nexport function loadPiExtensionSettings<const Schema extends TObject>(\n definition: ExtensionSettingsDefinition<Schema>,\n context: PiSettingsContext,\n options: LoadPiExtensionSettingsOptions,\n): LoadedPiExtensionSettings<Schema> {\n return loadSettings(definition, {\n agentDir: getPiAgentDir(),\n bundledSchema: options.bundledSchema,\n project: {\n cwd: context.cwd,\n configDirName: PI_CONFIG_DIR_NAME,\n trusted: context.isProjectTrusted(),\n },\n });\n}\n\ntype FileMutationQueue = <Result>(\n path: string,\n operation: () => Promise<Result>,\n) => Promise<Result>;\n\nasync function withFileMutationQueues<Result>(\n paths: readonly string[],\n operation: () => Promise<Result>,\n withFileMutationQueue: FileMutationQueue,\n index = 0,\n): Promise<Result> {\n const path = paths[index];\n if (path === undefined) return operation();\n return withFileMutationQueue(path, () =>\n withFileMutationQueues(paths, operation, withFileMutationQueue, index + 1),\n );\n}\n\n/**\n * Transactionally updates an extension's encoded global or project settings layer.\n *\n * The latest layer is read, validated, cloned, and passed once to `options.update` while the target\n * settings sources are protected by Pi's in-process mutation queue and a cooperative inter-process\n * lock. The returned layer is validated both independently and after resolution over defaults and\n * earlier layers, then atomically published. Existing malformed or invalid settings are never\n * overwritten.\n *\n * Call `loadPiExtensionSettings` before updating so the generated editor schema is installed and\n * verified for the active definition.\n *\n * Pass `expectedRevision` for snapshot-based editors that must reject changes made after opening.\n * Omit it for semantic updates that should apply to the latest valid layer. Project updates are\n * blocked unless Pi reports the project as trusted; calling this function is an explicit write and\n * may create a missing trusted-project settings file.\n *\n * @template Schema The TypeBox object schema from the supplied extension definition.\n * @param definition A validated definition created by `defineExtensionSettings`.\n * @param context The current Pi extension context used for paths and project trust.\n * @param options Scope, optional optimistic revision, and synchronous encoded-layer updater.\n * @returns A typed update outcome; filesystem and validation failures do not expose settings values.\n * @throws The original error when `options.update` throws an `Error`.\n */\nexport async function updatePiExtensionSettings<const Schema extends TObject>(\n definition: ExtensionSettingsDefinition<Schema>,\n context: PiSettingsContext,\n options: UpdatePiExtensionSettingsOptions<Schema>,\n): Promise<UpdatePiExtensionSettingsResult> {\n // Read-only consumers should not initialize the lock library or its process signal handlers.\n const [{ updateSettingsTransaction }, { withFileMutationQueue }] = await Promise.all([\n import(\"./settings-transaction.ts\"),\n import(\"@earendil-works/pi-coding-agent\"),\n ]);\n const global = resolveGlobalSettingsPaths(getPiAgentDir(), definition.id);\n const project = resolveProjectSettingsPaths(context.cwd, PI_CONFIG_DIR_NAME, definition.id);\n const projectTrusted = context.isProjectTrusted();\n const paths =\n options.scope === \"global\"\n ? [global.configPath]\n : [global.configPath, project.configPath].sort();\n return withFileMutationQueues(\n paths,\n () =>\n updateSettingsTransaction(definition, {\n ...options,\n paths: { global, project },\n projectTrusted,\n }),\n withFileMutationQueue,\n );\n}\n"]}