@dev-sergeev/datalab-kit 0.1.1 → 0.1.3

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 (339) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +26 -8
  3. package/THIRD_PARTY_NOTICES.md +6 -2
  4. package/dist/extension.js +8 -1
  5. package/dist/recap.d.ts +2 -0
  6. package/dist/recap.js +31 -0
  7. package/docs/adr/0002-package-delivery.md +2 -0
  8. package/node_modules/@gotgenes/pi-permission-system/src/authority/permission-prompt-component.ts +0 -11
  9. package/node_modules/@gotgenes/pi-permission-system/src/config/config-store.ts +0 -5
  10. package/node_modules/@gotgenes/pi-permission-system/src/index.ts +3 -15
  11. package/node_modules/@pi-plugins/elapsed/LICENSE +21 -0
  12. package/node_modules/@pi-plugins/elapsed/README.md +45 -0
  13. package/node_modules/@pi-plugins/elapsed/dist/index.d.mts +8 -0
  14. package/node_modules/@pi-plugins/elapsed/dist/index.d.mts.map +1 -0
  15. package/node_modules/@pi-plugins/elapsed/dist/index.mjs +47 -0
  16. package/node_modules/@pi-plugins/elapsed/dist/index.mjs.map +1 -0
  17. package/node_modules/@pi-plugins/elapsed/package.json +65 -0
  18. package/node_modules/@tifan/pi-recap/README.md +61 -0
  19. package/node_modules/@tifan/pi-recap/package.json +43 -0
  20. package/node_modules/@tifan/pi-recap/src/index.ts +584 -0
  21. package/node_modules/@tifan/pi-recap/src/model-picker.ts +233 -0
  22. package/node_modules/@tifan/pi-recap/src/models.ts +183 -0
  23. package/node_modules/@tifan/pi-recap/src/sanitize.ts +119 -0
  24. package/node_modules/@tifan/pi-recap/src/tui.ts +155 -0
  25. package/node_modules/@zigai/pi-extension-internals/README.md +24 -0
  26. package/node_modules/@zigai/pi-extension-internals/dist/editor-enhancer-registry.d.ts +21 -0
  27. package/node_modules/@zigai/pi-extension-internals/dist/editor-enhancer-registry.js +233 -0
  28. package/node_modules/@zigai/pi-extension-internals/dist/index.d.ts +6 -0
  29. package/node_modules/@zigai/pi-extension-internals/dist/index.js +3 -0
  30. package/node_modules/@zigai/pi-extension-internals/dist/linked-method-patch.d.ts +34 -0
  31. package/node_modules/@zigai/pi-extension-internals/dist/linked-method-patch.js +272 -0
  32. package/node_modules/@zigai/pi-extension-internals/dist/pi-internal-import.d.ts +11 -0
  33. package/node_modules/@zigai/pi-extension-internals/dist/pi-internal-import.js +139 -0
  34. package/node_modules/@zigai/pi-extension-internals/package.json +41 -0
  35. package/node_modules/@zigai/pi-extension-settings/LICENSE +21 -0
  36. package/node_modules/@zigai/pi-extension-settings/README.md +36 -0
  37. package/node_modules/@zigai/pi-extension-settings/dist/artifacts.d.ts +23 -0
  38. package/node_modules/@zigai/pi-extension-settings/dist/artifacts.d.ts.map +1 -0
  39. package/node_modules/@zigai/pi-extension-settings/dist/artifacts.js +75 -0
  40. package/node_modules/@zigai/pi-extension-settings/dist/artifacts.js.map +1 -0
  41. package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.d.ts +3 -0
  42. package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.d.ts.map +1 -0
  43. package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.js +5 -0
  44. package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.js.map +1 -0
  45. package/node_modules/@zigai/pi-extension-settings/dist/cli.d.ts +6 -0
  46. package/node_modules/@zigai/pi-extension-settings/dist/cli.d.ts.map +1 -0
  47. package/node_modules/@zigai/pi-extension-settings/dist/cli.js +87 -0
  48. package/node_modules/@zigai/pi-extension-settings/dist/cli.js.map +1 -0
  49. package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.d.ts +2 -0
  50. package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.d.ts.map +1 -0
  51. package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.js +2 -0
  52. package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.js.map +1 -0
  53. package/node_modules/@zigai/pi-extension-settings/dist/definition.d.ts +159 -0
  54. package/node_modules/@zigai/pi-extension-settings/dist/definition.d.ts.map +1 -0
  55. package/node_modules/@zigai/pi-extension-settings/dist/definition.js +248 -0
  56. package/node_modules/@zigai/pi-extension-settings/dist/definition.js.map +1 -0
  57. package/node_modules/@zigai/pi-extension-settings/dist/file-system.d.ts +10 -0
  58. package/node_modules/@zigai/pi-extension-settings/dist/file-system.d.ts.map +1 -0
  59. package/node_modules/@zigai/pi-extension-settings/dist/file-system.js +115 -0
  60. package/node_modules/@zigai/pi-extension-settings/dist/file-system.js.map +1 -0
  61. package/node_modules/@zigai/pi-extension-settings/dist/index.d.ts +2 -0
  62. package/node_modules/@zigai/pi-extension-settings/dist/index.d.ts.map +1 -0
  63. package/node_modules/@zigai/pi-extension-settings/dist/index.js +2 -0
  64. package/node_modules/@zigai/pi-extension-settings/dist/index.js.map +1 -0
  65. package/node_modules/@zigai/pi-extension-settings/dist/json-value.d.ts +18 -0
  66. package/node_modules/@zigai/pi-extension-settings/dist/json-value.d.ts.map +1 -0
  67. package/node_modules/@zigai/pi-extension-settings/dist/json-value.js +56 -0
  68. package/node_modules/@zigai/pi-extension-settings/dist/json-value.js.map +1 -0
  69. package/node_modules/@zigai/pi-extension-settings/dist/paths.d.ts +11 -0
  70. package/node_modules/@zigai/pi-extension-settings/dist/paths.d.ts.map +1 -0
  71. package/node_modules/@zigai/pi-extension-settings/dist/paths.js +23 -0
  72. package/node_modules/@zigai/pi-extension-settings/dist/paths.js.map +1 -0
  73. package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.d.ts +5 -0
  74. package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.d.ts.map +1 -0
  75. package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.js +21 -0
  76. package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.js.map +1 -0
  77. package/node_modules/@zigai/pi-extension-settings/dist/pi.d.ts +106 -0
  78. package/node_modules/@zigai/pi-extension-settings/dist/pi.d.ts.map +1 -0
  79. package/node_modules/@zigai/pi-extension-settings/dist/pi.js +122 -0
  80. package/node_modules/@zigai/pi-extension-settings/dist/pi.js.map +1 -0
  81. package/node_modules/@zigai/pi-extension-settings/dist/pi.ts +2537 -0
  82. package/node_modules/@zigai/pi-extension-settings/dist/pi.ts.map +7 -0
  83. package/node_modules/@zigai/pi-extension-settings/dist/projects.d.ts +10 -0
  84. package/node_modules/@zigai/pi-extension-settings/dist/projects.d.ts.map +1 -0
  85. package/node_modules/@zigai/pi-extension-settings/dist/projects.js +177 -0
  86. package/node_modules/@zigai/pi-extension-settings/dist/projects.js.map +1 -0
  87. package/node_modules/@zigai/pi-extension-settings/dist/runtime.d.ts +40 -0
  88. package/node_modules/@zigai/pi-extension-settings/dist/runtime.d.ts.map +1 -0
  89. package/node_modules/@zigai/pi-extension-settings/dist/runtime.js +158 -0
  90. package/node_modules/@zigai/pi-extension-settings/dist/runtime.js.map +1 -0
  91. package/node_modules/@zigai/pi-extension-settings/dist/runtime.ts +158 -0
  92. package/node_modules/@zigai/pi-extension-settings/dist/runtime.ts.map +7 -0
  93. package/node_modules/@zigai/pi-extension-settings/dist/schema-document.d.ts +19 -0
  94. package/node_modules/@zigai/pi-extension-settings/dist/schema-document.d.ts.map +1 -0
  95. package/node_modules/@zigai/pi-extension-settings/dist/schema-document.js +168 -0
  96. package/node_modules/@zigai/pi-extension-settings/dist/schema-document.js.map +1 -0
  97. package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.d.ts +9 -0
  98. package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.d.ts.map +1 -0
  99. package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.js +242 -0
  100. package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.js.map +1 -0
  101. package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.d.ts +59 -0
  102. package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.d.ts.map +1 -0
  103. package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.js +98 -0
  104. package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.js.map +1 -0
  105. package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.d.ts +80 -0
  106. package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.d.ts.map +1 -0
  107. package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.js +144 -0
  108. package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.js.map +1 -0
  109. package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.d.ts +5 -0
  110. package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.d.ts.map +1 -0
  111. package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.js +30 -0
  112. package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.js.map +1 -0
  113. package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.d.ts +10 -0
  114. package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.d.ts.map +1 -0
  115. package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.js +16 -0
  116. package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.js.map +1 -0
  117. package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.d.ts +54 -0
  118. package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.d.ts.map +1 -0
  119. package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.js +202 -0
  120. package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.js.map +1 -0
  121. package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.d.ts +5 -0
  122. package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.d.ts.map +1 -0
  123. package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.js +9 -0
  124. package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.js.map +1 -0
  125. package/node_modules/@zigai/pi-extension-settings/docs/generation.md +71 -0
  126. package/node_modules/@zigai/pi-extension-settings/docs/manual-setup.md +98 -0
  127. package/node_modules/@zigai/pi-extension-settings/docs/runtime.md +100 -0
  128. package/node_modules/@zigai/pi-extension-settings/docs/ui-controls.md +31 -0
  129. package/node_modules/@zigai/pi-extension-settings/package.json +97 -0
  130. package/node_modules/@zigai/pi-mention-anything/README.md +113 -0
  131. package/node_modules/@zigai/pi-mention-anything/config.schema.json +313 -0
  132. package/node_modules/@zigai/pi-mention-anything/docs/command-protocol.md +106 -0
  133. package/node_modules/@zigai/pi-mention-anything/docs/providers.md +128 -0
  134. package/node_modules/@zigai/pi-mention-anything/examples/query-command.mjs +96 -0
  135. package/node_modules/@zigai/pi-mention-anything/examples/recursive-tree.ts +28 -0
  136. package/node_modules/@zigai/pi-mention-anything/examples/static.ts +28 -0
  137. package/node_modules/@zigai/pi-mention-anything/examples/tmux.ts +90 -0
  138. package/node_modules/@zigai/pi-mention-anything/examples/tree-settings.json +25 -0
  139. package/node_modules/@zigai/pi-mention-anything/package.json +58 -0
  140. package/node_modules/@zigai/pi-mention-anything/src/api.ts +75 -0
  141. package/node_modules/@zigai/pi-mention-anything/src/autocomplete.ts +231 -0
  142. package/node_modules/@zigai/pi-mention-anything/src/chain-autocomplete.ts +596 -0
  143. package/node_modules/@zigai/pi-mention-anything/src/chain-syntax.ts +345 -0
  144. package/node_modules/@zigai/pi-mention-anything/src/command-provider.ts +291 -0
  145. package/node_modules/@zigai/pi-mention-anything/src/configured-source.ts +66 -0
  146. package/node_modules/@zigai/pi-mention-anything/src/editor.ts +180 -0
  147. package/node_modules/@zigai/pi-mention-anything/src/expand-mentions.ts +162 -0
  148. package/node_modules/@zigai/pi-mention-anything/src/index.ts +54 -0
  149. package/node_modules/@zigai/pi-mention-anything/src/initial-suggestions.ts +190 -0
  150. package/node_modules/@zigai/pi-mention-anything/src/list-provider.ts +71 -0
  151. package/node_modules/@zigai/pi-mention-anything/src/mention-hub.ts +307 -0
  152. package/node_modules/@zigai/pi-mention-anything/src/mention-resolution.ts +374 -0
  153. package/node_modules/@zigai/pi-mention-anything/src/mention-syntax.ts +105 -0
  154. package/node_modules/@zigai/pi-mention-anything/src/register-mention.ts +89 -0
  155. package/node_modules/@zigai/pi-mention-anything/src/rendering.ts +53 -0
  156. package/node_modules/@zigai/pi-mention-anything/src/selected-items.ts +21 -0
  157. package/node_modules/@zigai/pi-mention-anything/src/selection-history.ts +135 -0
  158. package/node_modules/@zigai/pi-mention-anything/src/settings-input.ts +317 -0
  159. package/node_modules/@zigai/pi-mention-anything/src/settings.prevalidated.ts +57 -0
  160. package/node_modules/@zigai/pi-mention-anything/src/settings.ts +52 -0
  161. package/node_modules/@zigai/pi-mention-anything/src/source-contract.ts +174 -0
  162. package/node_modules/@zigai/pi-mention-anything/src/source-controller.ts +1070 -0
  163. package/node_modules/@zigai/pi-mention-anything/src/source-runtime.ts +99 -0
  164. package/node_modules/@zigai/pi-mention-skill/README.md +60 -0
  165. package/node_modules/@zigai/pi-mention-skill/config.schema.json +81 -0
  166. package/node_modules/@zigai/pi-mention-skill/package.json +56 -0
  167. package/node_modules/@zigai/pi-mention-skill/src/index.ts +60 -0
  168. package/node_modules/@zigai/pi-mention-skill/src/settings-input.ts +74 -0
  169. package/node_modules/@zigai/pi-mention-skill/src/settings.prevalidated.ts +18 -0
  170. package/node_modules/@zigai/pi-mention-skill/src/settings.ts +54 -0
  171. package/node_modules/@zigai/pi-mention-skill/src/skill-commands.ts +18 -0
  172. package/node_modules/@zigai/pi-mention-skill/src/skill-content.ts +60 -0
  173. package/node_modules/@zigai/pi-mention-skill/src/skill-provider.ts +105 -0
  174. package/node_modules/@zigai/pi-mention-skill/src/slash-skill-filter.ts +29 -0
  175. package/node_modules/argparse/LICENSE +21 -0
  176. package/node_modules/argparse/README.md +257 -0
  177. package/node_modules/argparse/index.js +3 -0
  178. package/node_modules/argparse/lib/action/append/constant.js +47 -0
  179. package/node_modules/argparse/lib/action/append.js +53 -0
  180. package/node_modules/argparse/lib/action/count.js +40 -0
  181. package/node_modules/argparse/lib/action/help.js +47 -0
  182. package/node_modules/argparse/lib/action/store/constant.js +43 -0
  183. package/node_modules/argparse/lib/action/store/false.js +27 -0
  184. package/node_modules/argparse/lib/action/store/true.js +26 -0
  185. package/node_modules/argparse/lib/action/store.js +50 -0
  186. package/node_modules/argparse/lib/action/subparsers.js +149 -0
  187. package/node_modules/argparse/lib/action/version.js +47 -0
  188. package/node_modules/argparse/lib/action.js +146 -0
  189. package/node_modules/argparse/lib/action_container.js +482 -0
  190. package/node_modules/argparse/lib/argparse.js +14 -0
  191. package/node_modules/argparse/lib/argument/error.js +50 -0
  192. package/node_modules/argparse/lib/argument/exclusive.js +54 -0
  193. package/node_modules/argparse/lib/argument/group.js +75 -0
  194. package/node_modules/argparse/lib/argument_parser.js +1161 -0
  195. package/node_modules/argparse/lib/const.js +21 -0
  196. package/node_modules/argparse/lib/help/added_formatters.js +87 -0
  197. package/node_modules/argparse/lib/help/formatter.js +795 -0
  198. package/node_modules/argparse/lib/namespace.js +76 -0
  199. package/node_modules/argparse/lib/utils.js +57 -0
  200. package/node_modules/argparse/package.json +34 -0
  201. package/node_modules/esprima/LICENSE.BSD +21 -0
  202. package/node_modules/esprima/README.md +46 -0
  203. package/node_modules/esprima/bin/esparse.js +139 -0
  204. package/node_modules/esprima/bin/esvalidate.js +236 -0
  205. package/node_modules/esprima/dist/esprima.js +6709 -0
  206. package/node_modules/esprima/package.json +112 -0
  207. package/node_modules/extend-shallow/LICENSE +21 -0
  208. package/node_modules/extend-shallow/README.md +61 -0
  209. package/node_modules/extend-shallow/index.js +33 -0
  210. package/node_modules/extend-shallow/package.json +56 -0
  211. package/node_modules/graceful-fs/LICENSE +15 -0
  212. package/node_modules/graceful-fs/README.md +143 -0
  213. package/node_modules/graceful-fs/clone.js +23 -0
  214. package/node_modules/graceful-fs/graceful-fs.js +448 -0
  215. package/node_modules/graceful-fs/legacy-streams.js +118 -0
  216. package/node_modules/graceful-fs/package.json +53 -0
  217. package/node_modules/graceful-fs/polyfills.js +355 -0
  218. package/node_modules/gray-matter/LICENSE +21 -0
  219. package/node_modules/gray-matter/README.md +565 -0
  220. package/node_modules/gray-matter/gray-matter.d.ts +114 -0
  221. package/node_modules/gray-matter/index.js +228 -0
  222. package/node_modules/gray-matter/lib/defaults.js +18 -0
  223. package/node_modules/gray-matter/lib/engine.js +30 -0
  224. package/node_modules/gray-matter/lib/engines.js +54 -0
  225. package/node_modules/gray-matter/lib/excerpt.js +32 -0
  226. package/node_modules/gray-matter/lib/parse.js +13 -0
  227. package/node_modules/gray-matter/lib/stringify.js +56 -0
  228. package/node_modules/gray-matter/lib/to-file.js +43 -0
  229. package/node_modules/gray-matter/lib/utils.js +66 -0
  230. package/node_modules/gray-matter/package.json +127 -0
  231. package/node_modules/is-extendable/LICENSE +21 -0
  232. package/node_modules/is-extendable/README.md +72 -0
  233. package/node_modules/is-extendable/index.js +13 -0
  234. package/node_modules/is-extendable/package.json +51 -0
  235. package/node_modules/js-yaml/LICENSE +21 -0
  236. package/node_modules/js-yaml/README.md +302 -0
  237. package/node_modules/js-yaml/bin/js-yaml.js +132 -0
  238. package/node_modules/js-yaml/dist/js-yaml.js +4024 -0
  239. package/node_modules/js-yaml/dist/js-yaml.min.js +1 -0
  240. package/node_modules/js-yaml/index.js +7 -0
  241. package/node_modules/js-yaml/lib/js-yaml/common.js +59 -0
  242. package/node_modules/js-yaml/lib/js-yaml/dumper.js +850 -0
  243. package/node_modules/js-yaml/lib/js-yaml/exception.js +43 -0
  244. package/node_modules/js-yaml/lib/js-yaml/loader.js +1679 -0
  245. package/node_modules/js-yaml/lib/js-yaml/mark.js +76 -0
  246. package/node_modules/js-yaml/lib/js-yaml/schema/core.js +18 -0
  247. package/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +25 -0
  248. package/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +28 -0
  249. package/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +17 -0
  250. package/node_modules/js-yaml/lib/js-yaml/schema/json.js +25 -0
  251. package/node_modules/js-yaml/lib/js-yaml/schema.js +108 -0
  252. package/node_modules/js-yaml/lib/js-yaml/type/binary.js +138 -0
  253. package/node_modules/js-yaml/lib/js-yaml/type/bool.js +35 -0
  254. package/node_modules/js-yaml/lib/js-yaml/type/float.js +116 -0
  255. package/node_modules/js-yaml/lib/js-yaml/type/int.js +173 -0
  256. package/node_modules/js-yaml/lib/js-yaml/type/js/function.js +93 -0
  257. package/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +60 -0
  258. package/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +28 -0
  259. package/node_modules/js-yaml/lib/js-yaml/type/map.js +8 -0
  260. package/node_modules/js-yaml/lib/js-yaml/type/merge.js +12 -0
  261. package/node_modules/js-yaml/lib/js-yaml/type/null.js +34 -0
  262. package/node_modules/js-yaml/lib/js-yaml/type/omap.js +44 -0
  263. package/node_modules/js-yaml/lib/js-yaml/type/pairs.js +53 -0
  264. package/node_modules/js-yaml/lib/js-yaml/type/seq.js +8 -0
  265. package/node_modules/js-yaml/lib/js-yaml/type/set.js +29 -0
  266. package/node_modules/js-yaml/lib/js-yaml/type/str.js +8 -0
  267. package/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +88 -0
  268. package/node_modules/js-yaml/lib/js-yaml/type.js +61 -0
  269. package/node_modules/js-yaml/lib/js-yaml.js +39 -0
  270. package/node_modules/js-yaml/package.json +52 -0
  271. package/node_modules/kind-of/LICENSE +21 -0
  272. package/node_modules/kind-of/README.md +367 -0
  273. package/node_modules/kind-of/index.js +129 -0
  274. package/node_modules/kind-of/package.json +88 -0
  275. package/node_modules/pi-toggle-skills/README.md +213 -0
  276. package/node_modules/pi-toggle-skills/package.json +60 -0
  277. package/node_modules/pi-toggle-skills/src/index.ts +112 -0
  278. package/node_modules/pi-toggle-skills/src/skill-discovery.ts +258 -0
  279. package/node_modules/pi-toggle-skills/src/skill-selector.ts +435 -0
  280. package/node_modules/pi-toggle-skills/toggle-skills.ts +316 -0
  281. package/node_modules/pi-toggle-skills/vitest.config.ts +15 -0
  282. package/node_modules/proper-lockfile/LICENSE +21 -0
  283. package/node_modules/proper-lockfile/README.md +183 -0
  284. package/node_modules/proper-lockfile/index.js +40 -0
  285. package/node_modules/proper-lockfile/lib/adapter.js +85 -0
  286. package/node_modules/proper-lockfile/lib/lockfile.js +342 -0
  287. package/node_modules/proper-lockfile/lib/mtime-precision.js +55 -0
  288. package/node_modules/proper-lockfile/node_modules/retry/.npmignore +3 -0
  289. package/node_modules/proper-lockfile/node_modules/retry/.travis.yml +15 -0
  290. package/node_modules/proper-lockfile/node_modules/retry/License +21 -0
  291. package/node_modules/proper-lockfile/node_modules/retry/Makefile +18 -0
  292. package/node_modules/proper-lockfile/node_modules/retry/README.md +227 -0
  293. package/node_modules/proper-lockfile/node_modules/retry/equation.gif +0 -0
  294. package/node_modules/proper-lockfile/node_modules/retry/example/dns.js +31 -0
  295. package/node_modules/proper-lockfile/node_modules/retry/example/stop.js +40 -0
  296. package/node_modules/proper-lockfile/node_modules/retry/index.js +1 -0
  297. package/node_modules/proper-lockfile/node_modules/retry/lib/retry.js +100 -0
  298. package/node_modules/proper-lockfile/node_modules/retry/lib/retry_operation.js +158 -0
  299. package/node_modules/proper-lockfile/node_modules/retry/package.json +32 -0
  300. package/node_modules/proper-lockfile/node_modules/retry/test/common.js +10 -0
  301. package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-forever.js +24 -0
  302. package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-retry-operation.js +258 -0
  303. package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-retry-wrap.js +101 -0
  304. package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-timeouts.js +69 -0
  305. package/node_modules/proper-lockfile/package.json +71 -0
  306. package/node_modules/section-matter/LICENSE +21 -0
  307. package/node_modules/section-matter/README.md +236 -0
  308. package/node_modules/section-matter/index.js +136 -0
  309. package/node_modules/section-matter/package.json +55 -0
  310. package/node_modules/signal-exit/LICENSE.txt +16 -0
  311. package/node_modules/signal-exit/README.md +39 -0
  312. package/node_modules/signal-exit/index.js +202 -0
  313. package/node_modules/signal-exit/package.json +38 -0
  314. package/node_modules/signal-exit/signals.js +53 -0
  315. package/node_modules/sprintf-js/.npmignore +1 -0
  316. package/node_modules/sprintf-js/LICENSE +24 -0
  317. package/node_modules/sprintf-js/README.md +88 -0
  318. package/node_modules/sprintf-js/bower.json +14 -0
  319. package/node_modules/sprintf-js/demo/angular.html +20 -0
  320. package/node_modules/sprintf-js/dist/angular-sprintf.min.js +4 -0
  321. package/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +1 -0
  322. package/node_modules/sprintf-js/dist/angular-sprintf.min.map +1 -0
  323. package/node_modules/sprintf-js/dist/sprintf.min.js +4 -0
  324. package/node_modules/sprintf-js/dist/sprintf.min.js.map +1 -0
  325. package/node_modules/sprintf-js/dist/sprintf.min.map +1 -0
  326. package/node_modules/sprintf-js/gruntfile.js +36 -0
  327. package/node_modules/sprintf-js/package.json +22 -0
  328. package/node_modules/sprintf-js/src/angular-sprintf.js +18 -0
  329. package/node_modules/sprintf-js/src/sprintf.js +208 -0
  330. package/node_modules/sprintf-js/test/test.js +82 -0
  331. package/node_modules/strip-bom-string/LICENSE +21 -0
  332. package/node_modules/strip-bom-string/README.md +66 -0
  333. package/node_modules/strip-bom-string/index.js +15 -0
  334. package/node_modules/strip-bom-string/package.json +60 -0
  335. package/package.json +13 -4
  336. package/dist/confirmation.d.ts +0 -33
  337. package/dist/confirmation.js +0 -64
  338. package/dist/yolo.d.ts +0 -6
  339. package/dist/yolo.js +0 -33
@@ -0,0 +1,233 @@
1
+ import type { ExtensionContext, Theme } from "@earendil-works/pi-coding-agent"
2
+ import {
3
+ Input,
4
+ Key,
5
+ matchesKey,
6
+ truncateToWidth,
7
+ type Component,
8
+ type Focusable,
9
+ } from "@earendil-works/pi-tui"
10
+ import {
11
+ DEFAULT_RECAP_MODEL,
12
+ formatRecapModelKey,
13
+ type RecapModelPreference,
14
+ } from "./models.js"
15
+
16
+ const MAX_VISIBLE_ITEMS = 10
17
+
18
+ export type ModelPickerResult =
19
+ | { action: "default" }
20
+ | { action: "model"; model: RecapModelPreference }
21
+ | { action: "cancel" }
22
+
23
+ interface ModelPickerItem {
24
+ readonly label: string
25
+ readonly description?: string
26
+ readonly model?: RecapModelPreference
27
+ }
28
+
29
+ class RecapModelPicker implements Component, Focusable {
30
+ private readonly theme: Theme
31
+ private readonly items: ModelPickerItem[]
32
+ private readonly onDone: (result: ModelPickerResult) => void
33
+ private readonly searchInput = new Input()
34
+ private selectedIndex = 0
35
+
36
+ constructor(
37
+ theme: Theme,
38
+ models: readonly RecapModelPreference[],
39
+ onDone: (result: ModelPickerResult) => void,
40
+ ) {
41
+ this.theme = theme
42
+ this.items = [
43
+ {
44
+ label: "Use default",
45
+ description: formatRecapModelKey(DEFAULT_RECAP_MODEL),
46
+ },
47
+ ...models.map((model) => ({
48
+ label: formatRecapModelKey(model),
49
+ model,
50
+ })),
51
+ ]
52
+ this.onDone = onDone
53
+ }
54
+
55
+ get focused(): boolean {
56
+ return this.searchInput.focused
57
+ }
58
+
59
+ set focused(value: boolean) {
60
+ this.searchInput.focused = value
61
+ }
62
+
63
+ invalidate(): void {
64
+ this.searchInput.invalidate()
65
+ }
66
+
67
+ render(width: number): string[] {
68
+ const filteredItems = this.getFilteredItems()
69
+ const startIndex = getVisibleStartIndex(
70
+ this.selectedIndex,
71
+ filteredItems.length,
72
+ )
73
+ const visibleItems = filteredItems.slice(
74
+ startIndex,
75
+ startIndex + MAX_VISIBLE_ITEMS,
76
+ )
77
+ const lines = [
78
+ this.theme.fg("accent", this.theme.bold("Recap model")),
79
+ this.theme.fg("dim", "Search"),
80
+ ...this.searchInput.render(width),
81
+ "",
82
+ ]
83
+
84
+ if (visibleItems.length === 0) {
85
+ lines.push(this.theme.fg("warning", "No matching models"))
86
+ } else {
87
+ for (const [index, item] of visibleItems.entries()) {
88
+ lines.push(
89
+ this.renderItem(item, startIndex + index === this.selectedIndex),
90
+ )
91
+ }
92
+ }
93
+
94
+ if (filteredItems.length > MAX_VISIBLE_ITEMS) {
95
+ lines.push(
96
+ this.theme.fg(
97
+ "dim",
98
+ truncateToWidth(
99
+ `${this.selectedIndex + 1}/${filteredItems.length}`,
100
+ width,
101
+ ),
102
+ ),
103
+ )
104
+ }
105
+
106
+ lines.push(
107
+ "",
108
+ this.theme.fg("dim", "↑↓ navigate • enter select • esc cancel"),
109
+ )
110
+ return lines.map((line) => truncateToWidth(line, width))
111
+ }
112
+
113
+ handleInput(data: string): void {
114
+ if (matchesKey(data, Key.escape) || matchesKey(data, Key.ctrl("c"))) {
115
+ this.onDone({ action: "cancel" })
116
+ return
117
+ }
118
+
119
+ if (matchesKey(data, Key.enter)) {
120
+ this.selectCurrent()
121
+ return
122
+ }
123
+
124
+ if (matchesKey(data, Key.up)) {
125
+ this.moveSelection(-1)
126
+ return
127
+ }
128
+
129
+ if (matchesKey(data, Key.down)) {
130
+ this.moveSelection(1)
131
+ return
132
+ }
133
+
134
+ const previousFilter = this.getFilter()
135
+ this.searchInput.handleInput(data)
136
+ if (this.getFilter() !== previousFilter) {
137
+ this.selectedIndex = 0
138
+ }
139
+ }
140
+
141
+ private renderItem(item: ModelPickerItem, isSelected: boolean): string {
142
+ const prefix = isSelected ? "→ " : " "
143
+ const label = isSelected
144
+ ? this.theme.fg("accent", item.label)
145
+ : this.theme.fg("text", item.label)
146
+ const description = item.description
147
+ ? this.theme.fg("dim", ` ${item.description}`)
148
+ : ""
149
+ return `${prefix}${label}${description}`
150
+ }
151
+
152
+ private moveSelection(delta: number): void {
153
+ const count = this.getFilteredItems().length
154
+ if (count === 0) return
155
+ this.selectedIndex = (this.selectedIndex + delta + count) % count
156
+ }
157
+
158
+ private selectCurrent(): void {
159
+ const item = this.getFilteredItems()[this.selectedIndex]
160
+ if (!item) return
161
+
162
+ const model = item.model
163
+ if (!model) {
164
+ this.onDone({ action: "default" })
165
+ return
166
+ }
167
+
168
+ this.onDone({ action: "model", model })
169
+ }
170
+
171
+ private getFilter(): string {
172
+ return this.searchInput.getValue().trim().toLowerCase()
173
+ }
174
+
175
+ private getFilteredItems(): ModelPickerItem[] {
176
+ const filter = this.getFilter()
177
+ if (!filter) return this.items
178
+ return this.items.filter(
179
+ (item) =>
180
+ item.label.toLowerCase().includes(filter) ||
181
+ item.description?.toLowerCase().includes(filter),
182
+ )
183
+ }
184
+ }
185
+
186
+ function getVisibleStartIndex(
187
+ selectedIndex: number,
188
+ itemCount: number,
189
+ ): number {
190
+ return Math.max(
191
+ 0,
192
+ Math.min(
193
+ selectedIndex - Math.floor(MAX_VISIBLE_ITEMS / 2),
194
+ itemCount - MAX_VISIBLE_ITEMS,
195
+ ),
196
+ )
197
+ }
198
+
199
+ class HiddenFooter implements Component {
200
+ invalidate(): void {}
201
+
202
+ render(): string[] {
203
+ return []
204
+ }
205
+ }
206
+
207
+ export async function pickRecapModel(
208
+ ctx: ExtensionContext,
209
+ models: readonly RecapModelPreference[],
210
+ ): Promise<ModelPickerResult> {
211
+ if (!ctx.hasUI) return { action: "cancel" }
212
+
213
+ ctx.ui.setFooter(() => new HiddenFooter())
214
+ return ctx.ui
215
+ .custom<ModelPickerResult>((tui, theme, _keybindings, done) => {
216
+ const picker = new RecapModelPicker(theme, models, done)
217
+ return {
218
+ get focused() {
219
+ return picker.focused
220
+ },
221
+ set focused(value: boolean) {
222
+ picker.focused = value
223
+ },
224
+ render: (width) => picker.render(width),
225
+ invalidate: () => picker.invalidate(),
226
+ handleInput: (data) => {
227
+ picker.handleInput(data)
228
+ tui.requestRender()
229
+ },
230
+ }
231
+ })
232
+ .finally(() => ctx.ui.setFooter(undefined))
233
+ }
@@ -0,0 +1,183 @@
1
+ // Datalab Kit adaptation
2
+
3
+ import {
4
+ existsSync,
5
+ mkdirSync,
6
+ readFileSync,
7
+ rmSync,
8
+ writeFileSync,
9
+ } from "node:fs"
10
+ import path from "node:path"
11
+ import type { Api, Model } from "@earendil-works/pi-ai"
12
+ import {
13
+ getAgentDir,
14
+ type ExtensionContext,
15
+ } from "@earendil-works/pi-coding-agent"
16
+
17
+ const CONFIG_PATH = path.join(getAgentDir(), "extensions", "pi-recap.json")
18
+ const CONFIG_DIR = path.dirname(CONFIG_PATH)
19
+
20
+ export interface RecapModelPreference {
21
+ readonly provider: string
22
+ readonly id: string
23
+ }
24
+
25
+ export type RecapModelConfig =
26
+ | { readonly kind: "missing" }
27
+ | { readonly kind: "invalid" }
28
+ | { readonly kind: "configured"; readonly model: RecapModelPreference }
29
+
30
+ export type ResolvedRecapModelAuth =
31
+ | {
32
+ readonly status: "ok"
33
+ readonly auth: Model<Api>
34
+ readonly source: "configured" | "default"
35
+ }
36
+ | { readonly status: "invalid-config" }
37
+ | {
38
+ readonly status: "unauthenticated"
39
+ readonly model: RecapModelPreference | undefined
40
+ readonly source: "configured" | "default"
41
+ }
42
+
43
+ export const DEFAULT_RECAP_MODEL: RecapModelPreference = {
44
+ provider: "gigachat",
45
+ id: "Qwen3.5-397b",
46
+ }
47
+
48
+ interface RecapConfig extends Record<string, unknown> {
49
+ model?: unknown
50
+ }
51
+
52
+ export function formatModelPreference(config: RecapModelConfig): string {
53
+ if (config.kind === "configured") return formatRecapModelKey(config.model)
54
+ if (config.kind === "invalid") return "invalid"
55
+ return "default"
56
+ }
57
+
58
+ export function formatRecapModelKey({
59
+ provider,
60
+ id,
61
+ }: RecapModelPreference): string {
62
+ return `${provider}/${id}`
63
+ }
64
+
65
+ export function formatAuthModelKey(auth: Model<Api>): string {
66
+ return `${auth.provider}/${auth.id}`
67
+ }
68
+
69
+ export function parseModelSpec(
70
+ value: string,
71
+ ): RecapModelPreference | undefined {
72
+ const trimmed = value.trim()
73
+ const separator = trimmed.indexOf("/")
74
+ if (separator <= 0 || separator === trimmed.length - 1) return undefined
75
+
76
+ return {
77
+ provider: trimmed.slice(0, separator),
78
+ id: trimmed.slice(separator + 1),
79
+ }
80
+ }
81
+
82
+ function readConfig(): RecapConfig {
83
+ const content = readFileSync(CONFIG_PATH, "utf-8")
84
+ const config = JSON.parse(content) as unknown
85
+ return config && typeof config === "object" && !Array.isArray(config)
86
+ ? (config as RecapConfig)
87
+ : {}
88
+ }
89
+
90
+ export function saveModelPreference(
91
+ modelPreference: RecapModelPreference,
92
+ ): void {
93
+ const config: RecapConfig = {
94
+ model: formatRecapModelKey(modelPreference),
95
+ }
96
+ mkdirSync(CONFIG_DIR, { recursive: true })
97
+ writeFileSync(CONFIG_PATH, `${JSON.stringify(config, null, 2)}\n`, "utf-8")
98
+ }
99
+
100
+ export function deleteRecapConfig(): void {
101
+ rmSync(CONFIG_PATH, { force: true })
102
+ }
103
+
104
+ export function resolveInitialModelConfig(): RecapModelConfig {
105
+ if (!existsSync(CONFIG_PATH)) return { kind: "missing" }
106
+
107
+ try {
108
+ const config = readConfig()
109
+ if (typeof config.model !== "string") return { kind: "invalid" }
110
+
111
+ const model = parseModelSpec(config.model)
112
+ return model ? { kind: "configured", model } : { kind: "invalid" }
113
+ } catch {
114
+ return { kind: "invalid" }
115
+ }
116
+ }
117
+
118
+ async function getModelAuth(
119
+ ctx: ExtensionContext,
120
+ modelPreference: RecapModelPreference,
121
+ ): Promise<Model<Api> | undefined> {
122
+ const model = ctx.modelRegistry.find(
123
+ modelPreference.provider,
124
+ modelPreference.id,
125
+ )
126
+ if (!model) return undefined
127
+
128
+ const auth = await ctx.modelRegistry.getProviderAuth(model.provider)
129
+ return auth?.auth.apiKey ? model : undefined
130
+ }
131
+
132
+ export async function getRecapModelAuth(
133
+ ctx: ExtensionContext,
134
+ config: RecapModelConfig,
135
+ ): Promise<ResolvedRecapModelAuth> {
136
+ if (config.kind === "invalid") return { status: "invalid-config" }
137
+
138
+ if (config.kind === "configured") {
139
+ const auth = await getModelAuth(ctx, config.model)
140
+ return auth
141
+ ? { status: "ok", auth, source: "configured" }
142
+ : {
143
+ status: "unauthenticated",
144
+ model: config.model,
145
+ source: "configured",
146
+ }
147
+ }
148
+
149
+ const defaultAuth = await getModelAuth(ctx, DEFAULT_RECAP_MODEL)
150
+ if (defaultAuth) {
151
+ return { status: "ok", auth: defaultAuth, source: "default" }
152
+ }
153
+
154
+ return {
155
+ status: "unauthenticated",
156
+ model: DEFAULT_RECAP_MODEL,
157
+ source: "default",
158
+ }
159
+ }
160
+
161
+ export async function getAuthenticatedTextModelPreferences(
162
+ ctx: ExtensionContext,
163
+ ): Promise<RecapModelPreference[]> {
164
+ const models = ctx.modelRegistry
165
+ .getAll()
166
+ .filter((model) => model.input.includes("text"))
167
+ const authenticatedModels = await Promise.all(
168
+ models.map(async (model) => {
169
+ const auth = await ctx.modelRegistry.getProviderAuth(model.provider)
170
+ return auth?.auth.apiKey ? toModelPreference(model) : undefined
171
+ }),
172
+ )
173
+
174
+ return authenticatedModels
175
+ .filter((model): model is RecapModelPreference => model !== undefined)
176
+ .toSorted((left, right) =>
177
+ formatRecapModelKey(left).localeCompare(formatRecapModelKey(right)),
178
+ )
179
+ }
180
+
181
+ function toModelPreference(model: Model<Api>): RecapModelPreference {
182
+ return { provider: model.provider, id: model.id }
183
+ }
@@ -0,0 +1,119 @@
1
+ export const MAX_SAFE_RECAP_CHARS = 320
2
+
3
+ const ESC = 0x1b
4
+ const BEL = 0x07
5
+ const ST = 0x9c
6
+
7
+ function isControlCharacter(code: number): boolean {
8
+ return (code >= 0x00 && code <= 0x1f) || (code >= 0x7f && code <= 0x9f)
9
+ }
10
+
11
+ function isWhitespaceControl(code: number): boolean {
12
+ return (
13
+ code === 0x09 ||
14
+ code === 0x0a ||
15
+ code === 0x0b ||
16
+ code === 0x0c ||
17
+ code === 0x0d
18
+ )
19
+ }
20
+
21
+ function skipCsiSequence(text: string, startIndex: number): number {
22
+ for (let index = startIndex; index < text.length; index++) {
23
+ const code = text.charCodeAt(index)
24
+ if (code >= 0x40 && code <= 0x7e) return index + 1
25
+ }
26
+
27
+ return text.length
28
+ }
29
+
30
+ function skipStringControl(text: string, startIndex: number): number {
31
+ for (let index = startIndex; index < text.length; index++) {
32
+ const code = text.charCodeAt(index)
33
+ if (code === BEL || code === ST) return index + 1
34
+ if (code === ESC && text.charCodeAt(index + 1) === 0x5c) {
35
+ return index + 2
36
+ }
37
+ }
38
+
39
+ return text.length
40
+ }
41
+
42
+ function skipEscapeSequence(text: string, escapeIndex: number): number {
43
+ const nextCode = text.charCodeAt(escapeIndex + 1)
44
+ if (Number.isNaN(nextCode)) return escapeIndex + 1
45
+
46
+ switch (nextCode) {
47
+ case 0x5b:
48
+ return skipCsiSequence(text, escapeIndex + 2)
49
+ case 0x5d:
50
+ case 0x50:
51
+ case 0x58:
52
+ case 0x5e:
53
+ case 0x5f:
54
+ return skipStringControl(text, escapeIndex + 2)
55
+ default:
56
+ if (
57
+ nextCode === 0x20 ||
58
+ nextCode === 0x23 ||
59
+ nextCode === 0x25 ||
60
+ (nextCode >= 0x28 && nextCode <= 0x2f)
61
+ ) {
62
+ return Math.min(text.length, escapeIndex + 3)
63
+ }
64
+
65
+ return Math.min(text.length, escapeIndex + 2)
66
+ }
67
+ }
68
+
69
+ function truncatePrintableText(text: string, maxChars: number): string {
70
+ if (maxChars <= 0) return ""
71
+
72
+ const chars = Array.from(text)
73
+ if (chars.length <= maxChars) return text
74
+ if (maxChars === 1) return "…"
75
+ return `${chars.slice(0, maxChars - 1).join("")}…`
76
+ }
77
+
78
+ export function sanitizeRecapText(
79
+ text: string,
80
+ maxChars = MAX_SAFE_RECAP_CHARS,
81
+ ): string {
82
+ let stripped = ""
83
+
84
+ for (let index = 0; index < text.length;) {
85
+ const code = text.charCodeAt(index)
86
+
87
+ if (code === ESC) {
88
+ index = skipEscapeSequence(text, index)
89
+ continue
90
+ }
91
+
92
+ if (code === 0x9b) {
93
+ index = skipCsiSequence(text, index + 1)
94
+ continue
95
+ }
96
+
97
+ if (
98
+ code === 0x90 ||
99
+ code === 0x98 ||
100
+ code === 0x9d ||
101
+ code === 0x9e ||
102
+ code === 0x9f
103
+ ) {
104
+ index = skipStringControl(text, index + 1)
105
+ continue
106
+ }
107
+
108
+ if (isControlCharacter(code)) {
109
+ if (isWhitespaceControl(code)) stripped += " "
110
+ index++
111
+ continue
112
+ }
113
+
114
+ stripped += text[index]
115
+ index++
116
+ }
117
+
118
+ return truncatePrintableText(stripped.replace(/\s+/gu, " ").trim(), maxChars)
119
+ }
@@ -0,0 +1,155 @@
1
+ import type { ExtensionContext, Theme } from "@earendil-works/pi-coding-agent"
2
+ import type { Component, TUI } from "@earendil-works/pi-tui"
3
+ import {
4
+ truncateToWidth,
5
+ visibleWidth,
6
+ wrapTextWithAnsi,
7
+ } from "@earendil-works/pi-tui"
8
+ import { sanitizeRecapText } from "./sanitize.js"
9
+
10
+ const WIDGET_KEY = "pi-recap"
11
+ const MODEL_WARNING_WIDGET_KEY = "pi-recap-model-warning"
12
+ const NO_RECAP_MODEL_AUTH_MESSAGE = "no recap model authenticated"
13
+ const ICON = "※ "
14
+ const LABEL = `${ICON}recap: `
15
+ const LOADING_TEXT = "generating..."
16
+ const LOADING_FRAMES = ["⡿", "⣟", "⣯", "⣷", "⣾", "⣽", "⣻", "⢿"] as const
17
+ const LOADING_INTERVAL_MS = 70
18
+ const MIN_RECAP_WIDTH = 12
19
+
20
+ class WarningLine implements Component {
21
+ private readonly theme: Theme
22
+ private readonly message: string
23
+
24
+ constructor(theme: Theme, message: string) {
25
+ this.theme = theme
26
+ this.message = message
27
+ }
28
+
29
+ invalidate(): void {}
30
+
31
+ render(width: number): string[] {
32
+ return [this.theme.fg("warning", truncateToWidth(this.message, width))]
33
+ }
34
+ }
35
+
36
+ class LoadingRecapLine implements Component {
37
+ private readonly tui: TUI
38
+ private readonly theme: Theme
39
+ private readonly timer: ReturnType<typeof setInterval>
40
+ private frameIndex = 0
41
+
42
+ constructor(tui: TUI, theme: Theme) {
43
+ this.tui = tui
44
+ this.theme = theme
45
+ this.timer = setInterval(() => {
46
+ this.frameIndex++
47
+ this.tui.requestRender()
48
+ }, LOADING_INTERVAL_MS)
49
+ }
50
+
51
+ dispose(): void {
52
+ clearInterval(this.timer)
53
+ }
54
+
55
+ invalidate(): void {}
56
+
57
+ render(width: number): string[] {
58
+ const frame =
59
+ LOADING_FRAMES[this.frameIndex % LOADING_FRAMES.length] ??
60
+ LOADING_FRAMES[0]
61
+ return [
62
+ truncateToWidth(
63
+ this.theme.fg("dim", `${LABEL}${frame} ${LOADING_TEXT}`),
64
+ width,
65
+ ),
66
+ ]
67
+ }
68
+ }
69
+
70
+ class PiRecapLine implements Component {
71
+ private readonly theme: Theme
72
+ private readonly recap: string
73
+
74
+ constructor(theme: Theme, recap: string) {
75
+ this.theme = theme
76
+ this.recap = recap
77
+ }
78
+
79
+ invalidate(): void {}
80
+
81
+ render(width: number): string[] {
82
+ const labelWidth = visibleWidth(LABEL)
83
+ const label = this.renderLabel()
84
+
85
+ if (width < MIN_RECAP_WIDTH) {
86
+ return [
87
+ truncateToWidth(this.theme.fg("muted", `${LABEL}${this.recap}`), width),
88
+ ]
89
+ }
90
+
91
+ const contentWidth = width - labelWidth
92
+ const wrappedLines = wrapTextWithAnsi(this.recap, contentWidth)
93
+ const contentLines = wrappedLines.length === 0 ? [""] : wrappedLines
94
+
95
+ const continuationIndent = " ".repeat(visibleWidth(ICON))
96
+
97
+ return contentLines.map((line, index) => {
98
+ const prefix = index === 0 ? label : continuationIndent
99
+ return truncateToWidth(this.theme.fg("muted", `${prefix}${line}`), width)
100
+ })
101
+ }
102
+
103
+ private renderLabel(): string {
104
+ return `※ ${this.theme.bold("recap:")} `
105
+ }
106
+ }
107
+
108
+ export function clearWidget(ctx: ExtensionContext): void {
109
+ if (!ctx.hasUI) return
110
+ ctx.ui.setWidget(WIDGET_KEY, undefined)
111
+ }
112
+
113
+ export function clearNoModelWarning(ctx: ExtensionContext): void {
114
+ if (!ctx.hasUI) return
115
+ ctx.ui.setWidget(MODEL_WARNING_WIDGET_KEY, undefined)
116
+ }
117
+
118
+ export function showNoModelWarning(ctx: ExtensionContext): void {
119
+ if (!ctx.hasUI) return
120
+ ctx.ui.setWidget(
121
+ MODEL_WARNING_WIDGET_KEY,
122
+ (_tui, theme) => new WarningLine(theme, NO_RECAP_MODEL_AUTH_MESSAGE),
123
+ { placement: "aboveEditor" },
124
+ )
125
+ }
126
+
127
+ export function showLoadingWidget(ctx: ExtensionContext): void {
128
+ if (!ctx.hasUI) return
129
+
130
+ ctx.ui.setWidget(WIDGET_KEY, (tui, theme) => new LoadingRecapLine(tui, theme))
131
+ }
132
+
133
+ export function showWidget(ctx: ExtensionContext, recap: string): void {
134
+ if (!ctx.hasUI) return
135
+
136
+ const safeRecap = sanitizeRecapText(recap)
137
+ if (!safeRecap) {
138
+ clearWidget(ctx)
139
+ return
140
+ }
141
+
142
+ ctx.ui.setWidget(
143
+ WIDGET_KEY,
144
+ (_tui, theme) => new PiRecapLine(theme, safeRecap),
145
+ )
146
+ }
147
+
148
+ export function notifyUser(
149
+ ctx: ExtensionContext,
150
+ message: string,
151
+ level: "info" | "error",
152
+ ): void {
153
+ if (!ctx.hasUI) return
154
+ ctx.ui.notify(message, level)
155
+ }
@@ -0,0 +1,24 @@
1
+ # Pi Extension Internals
2
+
3
+ Shared composition protocols and guarded Pi-internal loading for extensions that patch the same Pi UI internals.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install @zigai/pi-extension-internals
9
+ ```
10
+
11
+ Declare the exact supported version in `dependencies`. Keep Pi host packages in `peerDependencies`.
12
+
13
+ ## API
14
+
15
+ - `registerEditorEnhancer` composes keyed editor transformations.
16
+ - `installLinkedMethodPatch` and `installLinkedRenderPatch` install removable method patches.
17
+ - `installKeyedLinkedMethodPatch` updates an existing keyed patch instead of stacking another wrapper.
18
+ - `loadPiInternalModule` imports and validates a Pi-internal module, returning `undefined` with a scoped warning when unavailable.
19
+
20
+ Use `Symbol.for(...)` for enhancer keys and patch markers so independently installed extensions share the same registration.
21
+
22
+ ## License
23
+
24
+ MIT