@kubbisec/ai-linux-x64 0.1.21 → 0.1.23

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 (362) hide show
  1. package/bin/kubbisec +0 -0
  2. package/bundled/components/kubbisec-model-selector.d.ts +47 -34
  3. package/bundled/components/kubbisec-model-selector.js +187 -177
  4. package/bundled/components/kubbisec-model-selector.js.map +1 -1
  5. package/bundled/config/config.d.ts +6 -6
  6. package/bundled/config/config.d.ts.map +1 -1
  7. package/bundled/config/config.js +55 -55
  8. package/bundled/config/config.js.map +1 -1
  9. package/bundled/config/detect-local-llm-providers.d.ts +26 -16
  10. package/bundled/config/detect-local-llm-providers.js +130 -142
  11. package/bundled/config/ensure-kbs-project-settings.d.ts +20 -0
  12. package/bundled/config/ensure-kbs-project-settings.d.ts.map +1 -0
  13. package/bundled/config/ensure-kbs-project-settings.js +45 -0
  14. package/bundled/config/ensure-kbs-project-settings.js.map +1 -0
  15. package/bundled/config/ensure-kubbisec-project-settings.d.ts +11 -9
  16. package/bundled/config/ensure-kubbisec-project-settings.d.ts.map +1 -1
  17. package/bundled/config/ensure-kubbisec-project-settings.js +67 -48
  18. package/bundled/config/ensure-kubbisec-project-settings.js.map +1 -1
  19. package/bundled/config/extended-context.d.ts +5 -6
  20. package/bundled/config/extended-context.js +23 -22
  21. package/bundled/config/feature-flags.d.ts +10 -2
  22. package/bundled/config/feature-flags.js +8 -2
  23. package/bundled/config/format-kubbisec-footer-status.d.ts +1 -1
  24. package/bundled/config/format-kubbisec-footer-status.js +26 -31
  25. package/bundled/config/kubbisec-extension-manifest.d.ts +21 -2
  26. package/bundled/config/kubbisec-extension-manifest.d.ts.map +1 -1
  27. package/bundled/config/kubbisec-extension-manifest.js +19 -20
  28. package/bundled/config/kubbisec-extension-manifest.js.map +1 -1
  29. package/bundled/config/llm-config-mutations.d.ts +51 -25
  30. package/bundled/config/llm-config-mutations.js +173 -182
  31. package/bundled/config/llm-config.d.ts +54 -41
  32. package/bundled/config/llm-config.js +199 -199
  33. package/bundled/config/llm-provider-catalog.d.ts +18 -15
  34. package/bundled/config/llm-provider-catalog.js +45 -46
  35. package/bundled/config/materialize-kubbisec-pi-resources.d.ts +1 -1
  36. package/bundled/config/materialize-kubbisec-pi-resources.d.ts.map +1 -1
  37. package/bundled/config/materialize-kubbisec-pi-resources.js +173 -183
  38. package/bundled/config/materialize-kubbisec-pi-resources.js.map +1 -1
  39. package/bundled/config/register-custom-llm-providers.d.ts +11 -5
  40. package/bundled/config/register-custom-llm-providers.js +17 -15
  41. package/bundled/config/register-kubbisec-llm-provider.d.ts +14 -10
  42. package/bundled/config/register-kubbisec-llm-provider.js +50 -42
  43. package/bundled/config/resolve-agents-context-file.d.ts +1 -1
  44. package/bundled/config/resolve-agents-context-file.js +33 -34
  45. package/bundled/config/resource-budget.d.ts +12 -12
  46. package/bundled/config/resource-budget.js +28 -28
  47. package/bundled/config/sync-kubbisec-pi-models.d.ts +6 -3
  48. package/bundled/config/sync-kubbisec-pi-models.js +58 -58
  49. package/bundled/copy/cli-reference-index.d.ts +2 -6
  50. package/bundled/copy/cli-reference-index.d.ts.map +1 -1
  51. package/bundled/copy/cli-reference-index.js +2 -62
  52. package/bundled/copy/cli-reference-index.js.map +1 -1
  53. package/bundled/copy/kubbisec-shell-copy.d.ts +11 -6
  54. package/bundled/copy/kubbisec-shell-copy.js +1 -1
  55. package/bundled/extensions/cli-local-shared.d.ts +60 -26
  56. package/bundled/extensions/cli-local-shared.d.ts.map +1 -1
  57. package/bundled/extensions/cli-local-shared.js +139 -118
  58. package/bundled/extensions/cli-local-shared.js.map +1 -1
  59. package/bundled/extensions/kubbisec-aspm-local.extension.d.ts +18 -15
  60. package/bundled/extensions/kubbisec-aspm-local.extension.d.ts.map +1 -1
  61. package/bundled/extensions/kubbisec-aspm-local.extension.js +109 -117
  62. package/bundled/extensions/kubbisec-aspm-local.extension.js.map +1 -1
  63. package/bundled/extensions/kubbisec-brand.extension.d.ts +1 -1
  64. package/bundled/extensions/kubbisec-brand.extension.js +25 -25
  65. package/bundled/extensions/kubbisec-byok-provider.extension.d.ts +1 -1
  66. package/bundled/extensions/kubbisec-byok-provider.extension.js +2 -2
  67. package/bundled/extensions/kubbisec-clarify.extension.d.ts +64 -35
  68. package/bundled/extensions/kubbisec-clarify.extension.d.ts.map +1 -1
  69. package/bundled/extensions/kubbisec-clarify.extension.js +323 -305
  70. package/bundled/extensions/kubbisec-clarify.extension.js.map +1 -1
  71. package/bundled/extensions/kubbisec-exit.extension.d.ts +1 -1
  72. package/bundled/extensions/kubbisec-exit.extension.js +29 -32
  73. package/bundled/extensions/kubbisec-extended-context.extension.d.ts +1 -1
  74. package/bundled/extensions/kubbisec-extended-context.extension.js +56 -43
  75. package/bundled/extensions/kubbisec-footer.extension.d.ts +14 -14
  76. package/bundled/extensions/kubbisec-footer.extension.d.ts.map +1 -1
  77. package/bundled/extensions/kubbisec-footer.extension.js +205 -215
  78. package/bundled/extensions/kubbisec-footer.extension.js.map +1 -1
  79. package/bundled/extensions/kubbisec-github-local.extension.d.ts +26 -21
  80. package/bundled/extensions/kubbisec-github-local.extension.d.ts.map +1 -1
  81. package/bundled/extensions/kubbisec-github-local.extension.js +470 -122
  82. package/bundled/extensions/kubbisec-github-local.extension.js.map +1 -1
  83. package/bundled/extensions/kubbisec-llm-config.extension.d.ts +1 -1
  84. package/bundled/extensions/kubbisec-llm-config.extension.js +200 -181
  85. package/bundled/extensions/kubbisec-memory.extension.d.ts +9 -7
  86. package/bundled/extensions/kubbisec-memory.extension.d.ts.map +1 -1
  87. package/bundled/extensions/kubbisec-memory.extension.js +88 -95
  88. package/bundled/extensions/kubbisec-naus-local.extension.d.ts +18 -15
  89. package/bundled/extensions/kubbisec-naus-local.extension.d.ts.map +1 -1
  90. package/bundled/extensions/kubbisec-naus-local.extension.js +123 -114
  91. package/bundled/extensions/kubbisec-naus-local.extension.js.map +1 -1
  92. package/bundled/extensions/kubbisec-platform-tools.extension.d.ts +31 -21
  93. package/bundled/extensions/kubbisec-platform-tools.extension.d.ts.map +1 -1
  94. package/bundled/extensions/kubbisec-platform-tools.extension.js +152 -152
  95. package/bundled/extensions/kubbisec-platform-tools.extension.js.map +1 -1
  96. package/bundled/extensions/kubbisec-runtime-status.extension.d.ts +10 -8
  97. package/bundled/extensions/kubbisec-runtime-status.extension.js +15 -13
  98. package/bundled/extensions/kubbisec-scope.extension.d.ts +12 -7
  99. package/bundled/extensions/kubbisec-scope.extension.js +13 -13
  100. package/bundled/extensions/kubbisec-skill-mentions.extension.d.ts +27 -16
  101. package/bundled/extensions/kubbisec-skill-mentions.extension.d.ts.map +1 -1
  102. package/bundled/extensions/kubbisec-skill-mentions.extension.js +74 -63
  103. package/bundled/extensions/kubbisec-skill-mentions.extension.js.map +1 -1
  104. package/bundled/extensions/kubbisec-skill-telemetry.extension.d.ts +2 -3
  105. package/bundled/extensions/kubbisec-skill-telemetry.extension.js +59 -64
  106. package/bundled/extensions/kubbisec-theme-lock.extension.d.ts +1 -1
  107. package/bundled/extensions/kubbisec-theme-lock.extension.js +33 -34
  108. package/bundled/extensions/kubbisec-ui.extension.d.ts +1 -1
  109. package/bundled/extensions/kubbisec-ui.extension.d.ts.map +1 -1
  110. package/bundled/extensions/kubbisec-ui.extension.js +118 -109
  111. package/bundled/extensions/kubbisec-ui.extension.js.map +1 -1
  112. package/bundled/extensions/kubbisec-workflow.extension.d.ts +20 -18
  113. package/bundled/extensions/kubbisec-workflow.extension.d.ts.map +1 -1
  114. package/bundled/extensions/kubbisec-workflow.extension.js +138 -140
  115. package/bundled/node_modules/@aspm/shared/dist/ai/index.d.ts +1 -0
  116. package/bundled/node_modules/@aspm/shared/dist/ai/index.d.ts.map +1 -1
  117. package/bundled/node_modules/@aspm/shared/dist/ai/index.js +1 -0
  118. package/bundled/node_modules/@aspm/shared/dist/ai/index.js.map +1 -1
  119. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/build-assistant-system-prompt.d.ts +7 -0
  120. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/build-assistant-system-prompt.d.ts.map +1 -0
  121. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/build-assistant-system-prompt.js +30 -0
  122. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/build-assistant-system-prompt.js.map +1 -0
  123. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/build-chat-system-prompt.d.ts +7 -0
  124. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/build-chat-system-prompt.d.ts.map +1 -0
  125. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/build-chat-system-prompt.js +14 -0
  126. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/build-chat-system-prompt.js.map +1 -0
  127. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/cli-reference-index.d.ts +6 -0
  128. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/cli-reference-index.d.ts.map +1 -0
  129. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/cli-reference-index.js +65 -0
  130. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/cli-reference-index.js.map +1 -0
  131. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/format-mcp-knowledge.d.ts +8 -0
  132. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/format-mcp-knowledge.d.ts.map +1 -0
  133. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/format-mcp-knowledge.js +29 -0
  134. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/format-mcp-knowledge.js.map +1 -0
  135. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/index.d.ts +7 -0
  136. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/index.d.ts.map +1 -0
  137. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/index.js +16 -0
  138. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/index.js.map +1 -0
  139. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/mcp-instructions.d.ts +2 -0
  140. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/mcp-instructions.d.ts.map +1 -0
  141. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/mcp-instructions.js +36 -0
  142. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/mcp-instructions.js.map +1 -0
  143. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/mental-map.d.ts +6 -0
  144. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/mental-map.d.ts.map +1 -0
  145. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/mental-map.js +32 -0
  146. package/bundled/node_modules/@aspm/shared/dist/ai/product-knowledge/mental-map.js.map +1 -0
  147. package/bundled/node_modules/@aspm/shared/dist/api-key/api-key-scope-groups.d.ts +12 -0
  148. package/bundled/node_modules/@aspm/shared/dist/api-key/api-key-scope-groups.d.ts.map +1 -0
  149. package/bundled/node_modules/@aspm/shared/dist/api-key/api-key-scope-groups.js +93 -0
  150. package/bundled/node_modules/@aspm/shared/dist/api-key/api-key-scope-groups.js.map +1 -0
  151. package/bundled/node_modules/@aspm/shared/dist/api-key/api-key-scope-presets.d.ts +13 -0
  152. package/bundled/node_modules/@aspm/shared/dist/api-key/api-key-scope-presets.d.ts.map +1 -0
  153. package/bundled/node_modules/@aspm/shared/dist/api-key/api-key-scope-presets.js +79 -0
  154. package/bundled/node_modules/@aspm/shared/dist/api-key/api-key-scope-presets.js.map +1 -0
  155. package/bundled/node_modules/@aspm/shared/dist/api-key/index.d.ts +4 -0
  156. package/bundled/node_modules/@aspm/shared/dist/api-key/index.d.ts.map +1 -0
  157. package/bundled/node_modules/@aspm/shared/dist/api-key/index.js +20 -0
  158. package/bundled/node_modules/@aspm/shared/dist/api-key/index.js.map +1 -0
  159. package/bundled/node_modules/@aspm/shared/dist/api-key/migrate-api-key-metadata.d.ts +20 -0
  160. package/bundled/node_modules/@aspm/shared/dist/api-key/migrate-api-key-metadata.d.ts.map +1 -0
  161. package/bundled/node_modules/@aspm/shared/dist/api-key/migrate-api-key-metadata.js +78 -0
  162. package/bundled/node_modules/@aspm/shared/dist/api-key/migrate-api-key-metadata.js.map +1 -0
  163. package/bundled/node_modules/@aspm/shared/dist/assistant/assistant-thread.d.ts +19 -0
  164. package/bundled/node_modules/@aspm/shared/dist/assistant/assistant-thread.d.ts.map +1 -0
  165. package/bundled/node_modules/@aspm/shared/dist/assistant/assistant-thread.js +126 -0
  166. package/bundled/node_modules/@aspm/shared/dist/assistant/assistant-thread.js.map +1 -0
  167. package/bundled/node_modules/@aspm/shared/dist/assistant/index.d.ts +1 -0
  168. package/bundled/node_modules/@aspm/shared/dist/assistant/index.d.ts.map +1 -1
  169. package/bundled/node_modules/@aspm/shared/dist/assistant/index.js +1 -0
  170. package/bundled/node_modules/@aspm/shared/dist/assistant/index.js.map +1 -1
  171. package/bundled/node_modules/@aspm/shared/dist/billing/index.d.ts +2 -0
  172. package/bundled/node_modules/@aspm/shared/dist/billing/index.d.ts.map +1 -0
  173. package/bundled/node_modules/@aspm/shared/dist/billing/index.js +18 -0
  174. package/bundled/node_modules/@aspm/shared/dist/billing/index.js.map +1 -0
  175. package/bundled/node_modules/@aspm/shared/dist/billing/plan-limits.d.ts +17 -0
  176. package/bundled/node_modules/@aspm/shared/dist/billing/plan-limits.d.ts.map +1 -0
  177. package/bundled/node_modules/@aspm/shared/dist/billing/plan-limits.js +30 -0
  178. package/bundled/node_modules/@aspm/shared/dist/billing/plan-limits.js.map +1 -0
  179. package/bundled/node_modules/@aspm/shared/dist/ci/ci-job-dependencies.d.ts +42 -0
  180. package/bundled/node_modules/@aspm/shared/dist/ci/ci-job-dependencies.d.ts.map +1 -0
  181. package/bundled/node_modules/@aspm/shared/dist/ci/ci-job-dependencies.js +147 -0
  182. package/bundled/node_modules/@aspm/shared/dist/ci/ci-job-dependencies.js.map +1 -0
  183. package/bundled/node_modules/@aspm/shared/dist/ci/git-checkout-log-policy.d.ts +12 -0
  184. package/bundled/node_modules/@aspm/shared/dist/ci/git-checkout-log-policy.d.ts.map +1 -0
  185. package/bundled/node_modules/@aspm/shared/dist/ci/git-checkout-log-policy.js +70 -0
  186. package/bundled/node_modules/@aspm/shared/dist/ci/git-checkout-log-policy.js.map +1 -0
  187. package/bundled/node_modules/@aspm/shared/dist/ci/index.d.ts +4 -0
  188. package/bundled/node_modules/@aspm/shared/dist/ci/index.d.ts.map +1 -0
  189. package/bundled/node_modules/@aspm/shared/dist/ci/index.js +20 -0
  190. package/bundled/node_modules/@aspm/shared/dist/ci/index.js.map +1 -0
  191. package/bundled/node_modules/@aspm/shared/dist/ci/kubbisec-ci-execution-env.d.ts +16 -0
  192. package/bundled/node_modules/@aspm/shared/dist/ci/kubbisec-ci-execution-env.d.ts.map +1 -0
  193. package/bundled/node_modules/@aspm/shared/dist/ci/kubbisec-ci-execution-env.js +45 -0
  194. package/bundled/node_modules/@aspm/shared/dist/ci/kubbisec-ci-execution-env.js.map +1 -0
  195. package/bundled/node_modules/@aspm/shared/dist/dto/create-report.dto.d.ts +1 -0
  196. package/bundled/node_modules/@aspm/shared/dist/dto/create-report.dto.d.ts.map +1 -1
  197. package/bundled/node_modules/@aspm/shared/dist/dto/create-report.dto.js +6 -0
  198. package/bundled/node_modules/@aspm/shared/dist/dto/create-report.dto.js.map +1 -1
  199. package/bundled/node_modules/@aspm/shared/dist/dto/index.d.ts +5 -3
  200. package/bundled/node_modules/@aspm/shared/dist/dto/index.d.ts.map +1 -1
  201. package/bundled/node_modules/@aspm/shared/dist/dto/index.js +5 -3
  202. package/bundled/node_modules/@aspm/shared/dist/dto/index.js.map +1 -1
  203. package/bundled/node_modules/@aspm/shared/dist/dto/update-project.dto.d.ts +9 -0
  204. package/bundled/node_modules/@aspm/shared/dist/dto/update-project.dto.d.ts.map +1 -0
  205. package/bundled/node_modules/@aspm/shared/dist/dto/update-project.dto.js +52 -0
  206. package/bundled/node_modules/@aspm/shared/dist/dto/update-project.dto.js.map +1 -0
  207. package/bundled/node_modules/@aspm/shared/dist/enums.d.ts +3 -1
  208. package/bundled/node_modules/@aspm/shared/dist/enums.d.ts.map +1 -1
  209. package/bundled/node_modules/@aspm/shared/dist/enums.js +4 -0
  210. package/bundled/node_modules/@aspm/shared/dist/enums.js.map +1 -1
  211. package/bundled/node_modules/@aspm/shared/dist/index.d.ts +8 -2
  212. package/bundled/node_modules/@aspm/shared/dist/index.d.ts.map +1 -1
  213. package/bundled/node_modules/@aspm/shared/dist/index.js +8 -2
  214. package/bundled/node_modules/@aspm/shared/dist/index.js.map +1 -1
  215. package/bundled/node_modules/@aspm/shared/dist/mcp/constants.d.ts +22 -0
  216. package/bundled/node_modules/@aspm/shared/dist/mcp/constants.d.ts.map +1 -0
  217. package/bundled/node_modules/@aspm/shared/dist/mcp/constants.js +52 -0
  218. package/bundled/node_modules/@aspm/shared/dist/mcp/constants.js.map +1 -0
  219. package/bundled/node_modules/@aspm/shared/dist/mcp/oauth-metadata.d.ts +37 -0
  220. package/bundled/node_modules/@aspm/shared/dist/mcp/oauth-metadata.d.ts.map +1 -0
  221. package/bundled/node_modules/@aspm/shared/dist/mcp/oauth-metadata.js +54 -0
  222. package/bundled/node_modules/@aspm/shared/dist/mcp/oauth-metadata.js.map +1 -0
  223. package/bundled/node_modules/@aspm/shared/dist/project-scanner-summary.d.ts +7 -4
  224. package/bundled/node_modules/@aspm/shared/dist/project-scanner-summary.d.ts.map +1 -1
  225. package/bundled/node_modules/@aspm/shared/dist/project-scanner-summary.js +15 -7
  226. package/bundled/node_modules/@aspm/shared/dist/project-scanner-summary.js.map +1 -1
  227. package/bundled/node_modules/@aspm/shared/dist/rbac/index.d.ts +1 -0
  228. package/bundled/node_modules/@aspm/shared/dist/rbac/index.d.ts.map +1 -1
  229. package/bundled/node_modules/@aspm/shared/dist/rbac/index.js +1 -0
  230. package/bundled/node_modules/@aspm/shared/dist/rbac/index.js.map +1 -1
  231. package/bundled/node_modules/@aspm/shared/dist/rbac/kubbisec-permission-descriptions.d.ts.map +1 -1
  232. package/bundled/node_modules/@aspm/shared/dist/rbac/kubbisec-permission-descriptions.js +2 -0
  233. package/bundled/node_modules/@aspm/shared/dist/rbac/kubbisec-permission-descriptions.js.map +1 -1
  234. package/bundled/node_modules/@aspm/shared/dist/rbac/kubbisec-permissions.d.ts +1 -1
  235. package/bundled/node_modules/@aspm/shared/dist/rbac/kubbisec-permissions.d.ts.map +1 -1
  236. package/bundled/node_modules/@aspm/shared/dist/rbac/kubbisec-permissions.js +2 -0
  237. package/bundled/node_modules/@aspm/shared/dist/rbac/kubbisec-permissions.js.map +1 -1
  238. package/bundled/node_modules/@aspm/shared/dist/rbac/member-quota.d.ts +8 -0
  239. package/bundled/node_modules/@aspm/shared/dist/rbac/member-quota.d.ts.map +1 -0
  240. package/bundled/node_modules/@aspm/shared/dist/rbac/member-quota.js +19 -0
  241. package/bundled/node_modules/@aspm/shared/dist/rbac/member-quota.js.map +1 -0
  242. package/bundled/node_modules/@aspm/shared/dist/rbac/resolve-org-permissions.d.ts.map +1 -1
  243. package/bundled/node_modules/@aspm/shared/dist/rbac/resolve-org-permissions.js +4 -0
  244. package/bundled/node_modules/@aspm/shared/dist/rbac/resolve-org-permissions.js.map +1 -1
  245. package/bundled/node_modules/@aspm/shared/dist/redaction.d.ts +1 -0
  246. package/bundled/node_modules/@aspm/shared/dist/redaction.d.ts.map +1 -1
  247. package/bundled/node_modules/@aspm/shared/dist/redaction.js +1 -0
  248. package/bundled/node_modules/@aspm/shared/dist/redaction.js.map +1 -1
  249. package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts +2 -0
  250. package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts.map +1 -0
  251. package/bundled/node_modules/@aspm/shared/dist/redaction.test.js +626 -0
  252. package/bundled/node_modules/@aspm/shared/dist/redaction.test.js.map +1 -0
  253. package/bundled/node_modules/@aspm/shared/dist/security/aspm-gate-rules.d.ts.map +1 -1
  254. package/bundled/node_modules/@aspm/shared/dist/security/aspm-gate-rules.js.map +1 -1
  255. package/bundled/node_modules/@aspm/shared/dist/security/build-aspm-security-matrix-pipeline-yaml.d.ts.map +1 -1
  256. package/bundled/node_modules/@aspm/shared/dist/security/build-aspm-security-matrix-pipeline-yaml.js.map +1 -1
  257. package/bundled/node_modules/@aspm/shared/dist/security/build-github-security-workflow-yaml.d.ts.map +1 -1
  258. package/bundled/node_modules/@aspm/shared/dist/security/build-github-security-workflow-yaml.js +2 -2
  259. package/bundled/node_modules/@aspm/shared/dist/security/build-github-security-workflow-yaml.js.map +1 -1
  260. package/bundled/node_modules/@aspm/shared/dist/security/index.d.ts +2 -2
  261. package/bundled/node_modules/@aspm/shared/dist/security/index.d.ts.map +1 -1
  262. package/bundled/node_modules/@aspm/shared/dist/security/index.js +2 -2
  263. package/bundled/node_modules/@aspm/shared/dist/security/index.js.map +1 -1
  264. package/bundled/node_modules/@aspm/shared/dist/shared-project/constants.d.ts +4 -0
  265. package/bundled/node_modules/@aspm/shared/dist/shared-project/constants.d.ts.map +1 -0
  266. package/bundled/node_modules/@aspm/shared/dist/shared-project/constants.js +10 -0
  267. package/bundled/node_modules/@aspm/shared/dist/shared-project/constants.js.map +1 -0
  268. package/bundled/node_modules/@aspm/shared/dist/shared-project/index.d.ts +4 -0
  269. package/bundled/node_modules/@aspm/shared/dist/shared-project/index.d.ts.map +1 -0
  270. package/bundled/node_modules/@aspm/shared/dist/shared-project/index.js +20 -0
  271. package/bundled/node_modules/@aspm/shared/dist/shared-project/index.js.map +1 -0
  272. package/bundled/node_modules/@aspm/shared/dist/shared-project/redact-log-lines.d.ts +2 -0
  273. package/bundled/node_modules/@aspm/shared/dist/shared-project/redact-log-lines.d.ts.map +1 -0
  274. package/bundled/node_modules/@aspm/shared/dist/shared-project/redact-log-lines.js +9 -0
  275. package/bundled/node_modules/@aspm/shared/dist/shared-project/redact-log-lines.js.map +1 -0
  276. package/bundled/node_modules/@aspm/shared/dist/shared-project/share-prefix.d.ts +3 -0
  277. package/bundled/node_modules/@aspm/shared/dist/shared-project/share-prefix.d.ts.map +1 -0
  278. package/bundled/node_modules/@aspm/shared/dist/shared-project/share-prefix.js +18 -0
  279. package/bundled/node_modules/@aspm/shared/dist/shared-project/share-prefix.js.map +1 -0
  280. package/bundled/node_modules/@aspm/shared/package.json +27 -5
  281. package/bundled/node_modules/@kubbisec/chat-memory/dist/sanitizer.js +2 -2
  282. package/bundled/node_modules/@kubbisec/chat-memory/dist/sanitizer.js.map +1 -1
  283. package/bundled/node_modules/@kubbisec/chat-memory/package.json +4 -4
  284. package/bundled/node_modules/@kubbisec/home/dist/migrate.d.ts.map +1 -1
  285. package/bundled/node_modules/@kubbisec/home/dist/migrate.js +1 -1
  286. package/bundled/node_modules/@kubbisec/home/dist/migrate.js.map +1 -1
  287. package/bundled/node_modules/@kubbisec/home/package.json +3 -3
  288. package/bundled/resolve-bundled-dist-root.js +121 -131
  289. package/bundled/resolve-bundled-dist-root.js.map +1 -1
  290. package/bundled/skills/aspm-platform/SKILL.md +3 -1
  291. package/bundled/skills/at-path-mentions.d.ts +1 -1
  292. package/bundled/skills/at-path-mentions.js +146 -153
  293. package/bundled/skills/chat-mention-render.d.ts +2 -2
  294. package/bundled/skills/chat-mention-render.js +121 -126
  295. package/bundled/skills/chat-mentions.d.ts +17 -8
  296. package/bundled/skills/chat-mentions.js +76 -76
  297. package/bundled/skills/github-local/SKILL.md +5 -5
  298. package/bundled/skills/kubbisec-resource-router/SKILL.md +3 -0
  299. package/bundled/skills/list-bundled-skills.d.ts +3 -3
  300. package/bundled/skills/list-bundled-skills.js +33 -35
  301. package/bundled/skills/naus-pipelines/SKILL.md +11 -10
  302. package/bundled/skills/remediation/SKILL.md +1 -1
  303. package/bundled/skills/skill-mention.d.ts +10 -2
  304. package/bundled/skills/skill-mention.js +10 -2
  305. package/bundled/theme/clear-terminal.d.ts +1 -1
  306. package/bundled/theme/clear-terminal.js +3 -4
  307. package/bundled/theme/footer-render-hook.d.ts +1 -1
  308. package/bundled/theme/footer-render-hook.js +3 -3
  309. package/bundled/theme/kubbisec-brand-fg.d.ts +1 -1
  310. package/bundled/theme/kubbisec-brand-fg.js +2 -2
  311. package/bundled/theme/kubbisec-menu-themes.d.ts +7 -7
  312. package/bundled/theme/kubbisec-menu-themes.js +30 -31
  313. package/bundled/theme/kubbisec-theme-name.d.ts +1 -1
  314. package/bundled/theme/kubbisec-theme-name.js +1 -1
  315. package/bundled/theme/patch-pi-settings-theme.runtime.d.ts +1 -1
  316. package/bundled/theme/patch-pi-settings-theme.runtime.js +11 -10
  317. package/bundled/theme/render-compact-header.d.ts +13 -5
  318. package/bundled/theme/render-compact-header.js +127 -129
  319. package/bundled/theme/render-compact-header.js.map +1 -1
  320. package/bundled/workflow/session-workflow-mode.d.ts +1 -1
  321. package/bundled/workflow/session-workflow-mode.js +33 -33
  322. package/package.json +1 -1
  323. package/bundled/clarify/clarify-gate-state.d.ts +0 -3
  324. package/bundled/clarify/clarify-gate-state.d.ts.map +0 -1
  325. package/bundled/clarify/clarify-gate-state.js +0 -9
  326. package/bundled/clarify/clarify-gate-state.js.map +0 -1
  327. package/bundled/clarify/clarify-gate.d.ts +0 -28
  328. package/bundled/clarify/clarify-gate.d.ts.map +0 -1
  329. package/bundled/clarify/clarify-gate.js +0 -152
  330. package/bundled/clarify/clarify-gate.js.map +0 -1
  331. package/bundled/clarify/clarify-select-panel.d.ts +0 -14
  332. package/bundled/clarify/clarify-select-panel.d.ts.map +0 -1
  333. package/bundled/clarify/clarify-select-panel.js +0 -82
  334. package/bundled/clarify/clarify-select-panel.js.map +0 -1
  335. package/bundled/clarify/clarify-ui-state.d.ts +0 -21
  336. package/bundled/clarify/clarify-ui-state.d.ts.map +0 -1
  337. package/bundled/clarify/clarify-ui-state.js +0 -48
  338. package/bundled/clarify/clarify-ui-state.js.map +0 -1
  339. package/bundled/clarify/parse-clarify-answer.d.ts +0 -21
  340. package/bundled/clarify/parse-clarify-answer.d.ts.map +0 -1
  341. package/bundled/clarify/parse-clarify-answer.js +0 -57
  342. package/bundled/clarify/parse-clarify-answer.js.map +0 -1
  343. package/bundled/clarify/question-format.d.ts +0 -39
  344. package/bundled/clarify/question-format.d.ts.map +0 -1
  345. package/bundled/clarify/question-format.js +0 -144
  346. package/bundled/clarify/question-format.js.map +0 -1
  347. package/bundled/clarify/questionnaire-tool.d.ts +0 -25
  348. package/bundled/clarify/questionnaire-tool.d.ts.map +0 -1
  349. package/bundled/clarify/questionnaire-tool.js +0 -161
  350. package/bundled/clarify/questionnaire-tool.js.map +0 -1
  351. package/bundled/clarify/scope-discovery.d.ts +0 -9
  352. package/bundled/clarify/scope-discovery.d.ts.map +0 -1
  353. package/bundled/clarify/scope-discovery.js +0 -130
  354. package/bundled/clarify/scope-discovery.js.map +0 -1
  355. package/bundled/clarify/session-questionnaire.d.ts +0 -26
  356. package/bundled/clarify/session-questionnaire.d.ts.map +0 -1
  357. package/bundled/clarify/session-questionnaire.js +0 -372
  358. package/bundled/clarify/session-questionnaire.js.map +0 -1
  359. package/bundled/clarify/session-questionnaire.types.d.ts +0 -47
  360. package/bundled/clarify/session-questionnaire.types.d.ts.map +0 -1
  361. package/bundled/clarify/session-questionnaire.types.js +0 -13
  362. package/bundled/clarify/session-questionnaire.types.js.map +0 -1
@@ -4,360 +4,378 @@
4
4
  import { randomUUID } from "node:crypto";
5
5
  import * as fs from "node:fs";
6
6
  import { getKubbisecConfigPath } from "@kubbisec/home";
7
- import { shouldClarify, } from "../clarify/clarify-gate.js";
7
+ import { shouldClarify } from "../clarify/clarify-gate.js";
8
8
  import { setClarifyGateActive } from "../clarify/clarify-gate-state.js";
9
9
  import { renderClarifySelectPanel } from "../clarify/clarify-select-panel.js";
10
- import { getClarifyUiSnapshot, resetClarifyUiSnapshot, setClarifyUiChangeListener, setClarifyUiSnapshot, } from "../clarify/clarify-ui-state.js";
10
+ import {
11
+ getClarifyUiSnapshot,
12
+ resetClarifyUiSnapshot,
13
+ setClarifyUiChangeListener,
14
+ setClarifyUiSnapshot,
15
+ } from "../clarify/clarify-ui-state.js";
11
16
  import { parseClarifyAnswer } from "../clarify/parse-clarify-answer.js";
12
17
  import { inferScenarioFromMessage } from "../clarify/question-format.js";
13
- import { applyParsedUserAnswerIfPending, executeQuestionnaireTool, questionnaireToolParametersSchema, } from "../clarify/questionnaire-tool.js";
18
+ import {
19
+ applyParsedUserAnswerIfPending,
20
+ executeQuestionnaireTool,
21
+ questionnaireToolParametersSchema,
22
+ } from "../clarify/questionnaire-tool.js";
14
23
  import { discoverScopeHints } from "../clarify/scope-discovery.js";
15
- import { buildClarifyProgressLabel, finalizeQuestionnaireAtRoundLimit, hasMinimumScopeForScenario, readDefaultProjectId, readSessionQuestionnaire, shouldAcceptClarifyAnswer, writeSessionQuestionnaire, } from "../clarify/session-questionnaire.js";
24
+ import {
25
+ buildClarifyProgressLabel,
26
+ finalizeQuestionnaireAtRoundLimit,
27
+ hasMinimumScopeForScenario,
28
+ readDefaultProjectId,
29
+ readSessionQuestionnaire,
30
+ shouldAcceptClarifyAnswer,
31
+ writeSessionQuestionnaire,
32
+ } from "../clarify/session-questionnaire.js";
16
33
  import { resolveResourceBudget } from "../config/resource-budget.js";
17
34
  import { getSessionWorkflowMode } from "../workflow/session-workflow-mode.js";
18
35
  export const CLARIFY_MUTATION_TOOLS = new Set([
19
- "edit",
20
- "write",
21
- "bash",
22
- "delete",
23
- "patch",
24
- "apply_patch",
25
- "set_pipeline_yaml",
36
+ "edit",
37
+ "write",
38
+ "bash",
39
+ "delete",
40
+ "patch",
41
+ "apply_patch",
42
+ "set_pipeline_yaml",
26
43
  ]);
27
44
  export const CLARIFY_READ_ONLY_TOOLS = new Set([
28
- "read",
29
- "grep",
30
- "find",
31
- "ls",
32
- "glob",
33
- "questionnaire",
34
- "aspm_docs",
35
- "naus_pipeline_docs",
36
- "list_findings",
45
+ "read",
46
+ "grep",
47
+ "find",
48
+ "ls",
49
+ "glob",
50
+ "questionnaire",
51
+ "aspm_docs",
52
+ "naus_pipeline_docs",
53
+ "list_findings",
37
54
  ]);
38
- export const CLARIFY_TOOL_BLOCK_REASON = "Complete o questionário de escopo (use o painel acima ou escreva a resposta) antes de editar ficheiros.";
55
+ export const CLARIFY_TOOL_BLOCK_REASON =
56
+ "Complete o questionário de escopo (use o painel acima ou escreva a resposta) antes de editar ficheiros.";
39
57
  export function isClarifyMutationTool(toolName) {
40
- if (CLARIFY_READ_ONLY_TOOLS.has(toolName))
41
- return false;
42
- return CLARIFY_MUTATION_TOOLS.has(toolName);
58
+ if (CLARIFY_READ_ONLY_TOOLS.has(toolName)) return false;
59
+ return CLARIFY_MUTATION_TOOLS.has(toolName);
43
60
  }
44
61
  export function shouldBlockClarifyTool(toolName, gateActive, questionnaire) {
45
- if (!gateActive)
46
- return false;
47
- if (!questionnaire || questionnaire.status === "ready")
48
- return false;
49
- if (!isClarifyMutationTool(toolName))
50
- return false;
51
- return true;
62
+ if (!gateActive) return false;
63
+ if (!questionnaire || questionnaire.status === "ready") return false;
64
+ if (!isClarifyMutationTool(toolName)) return false;
65
+ return true;
52
66
  }
53
67
  function readDefaultProjectConfigured() {
54
- if (readDefaultProjectId())
55
- return true;
56
- try {
57
- const raw = fs.readFileSync(getKubbisecConfigPath(), "utf8");
58
- const parsed = JSON.parse(raw);
59
- return Boolean(parsed.defaultProject?.trim());
60
- }
61
- catch {
62
- return false;
63
- }
68
+ if (readDefaultProjectId()) return true;
69
+ try {
70
+ const raw = fs.readFileSync(getKubbisecConfigPath(), "utf8");
71
+ const parsed = JSON.parse(raw);
72
+ return Boolean(parsed.defaultProject?.trim());
73
+ } catch {
74
+ return false;
75
+ }
64
76
  }
65
77
  export function detectChatMode(prompt) {
66
- if (getSessionWorkflowMode() === "plan") {
67
- return "plan";
68
- }
69
- const trimmed = prompt.trim();
70
- if (trimmed.startsWith("/mode:plan") ||
71
- /@plan\b/i.test(trimmed) ||
72
- /@planejar\b/i.test(trimmed)) {
73
- return "plan";
74
- }
75
- const envMode = process.env.KUBBISEC_CHAT_MODE?.trim().toLowerCase();
76
- if (envMode === "plan")
77
- return "plan";
78
- return "default";
78
+ if (getSessionWorkflowMode() === "plan") {
79
+ return "plan";
80
+ }
81
+ const trimmed = prompt.trim();
82
+ if (
83
+ trimmed.startsWith("/mode:plan") ||
84
+ /@plan\b/i.test(trimmed) ||
85
+ /@planejar\b/i.test(trimmed)
86
+ ) {
87
+ return "plan";
88
+ }
89
+ const envMode = process.env.KUBBISEC_CHAT_MODE?.trim().toLowerCase();
90
+ if (envMode === "plan") return "plan";
91
+ return "default";
79
92
  }
80
93
  function resolveSurface() {
81
- const surface = process.env.KUBBISEC_CLARIFY_SURFACE?.trim().toLowerCase();
82
- if (surface === "fix" || surface === "watch" || surface === "task-consumer") {
83
- return surface;
84
- }
85
- if (process.env.KUBBISEC_FIX_MODE === "1" || process.env.KUBBISEC_WATCH_MODE === "1") {
86
- return process.env.KUBBISEC_WATCH_MODE === "1" ? "watch" : "fix";
87
- }
88
- return "chat";
94
+ const surface = process.env.KUBBISEC_CLARIFY_SURFACE?.trim().toLowerCase();
95
+ if (surface === "fix" || surface === "watch" || surface === "task-consumer") {
96
+ return surface;
97
+ }
98
+ if (process.env.KUBBISEC_FIX_MODE === "1" || process.env.KUBBISEC_WATCH_MODE === "1") {
99
+ return process.env.KUBBISEC_WATCH_MODE === "1" ? "watch" : "fix";
100
+ }
101
+ return "chat";
89
102
  }
90
103
  function buildGateInput(prompt, questionnaire) {
91
- const msg = prompt.trim();
92
- const budget = resolveResourceBudget();
93
- const scenario = questionnaire.scenario ?? inferScenarioFromMessage(msg);
94
- return {
95
- surface: resolveSurface(),
96
- userMessage: msg,
97
- hasProjectId: readDefaultProjectConfigured() || questionnaire.fields.projectIds.length > 0,
98
- hasVulnerabilityId: /\b(cve-|vuln|finding)/i.test(msg),
99
- hasSeverityFilter: Boolean(questionnaire.fields.severityMin) || /\b(severity|critical|high)\b/i.test(msg),
100
- mode: detectChatMode(msg),
101
- scenario,
102
- questionnaireStatus: questionnaire.status,
103
- fields: questionnaire.fields,
104
- historyCount: questionnaire.history.length,
105
- clarifyMaxRounds: budget.clarifyMaxRounds,
106
- };
104
+ const msg = prompt.trim();
105
+ const budget = resolveResourceBudget();
106
+ const scenario = questionnaire.scenario ?? inferScenarioFromMessage(msg);
107
+ return {
108
+ surface: resolveSurface(),
109
+ userMessage: msg,
110
+ hasProjectId: readDefaultProjectConfigured() || questionnaire.fields.projectIds.length > 0,
111
+ hasVulnerabilityId: /\b(cve-|vuln|finding)/i.test(msg),
112
+ hasSeverityFilter:
113
+ Boolean(questionnaire.fields.severityMin) || /\b(severity|critical|high)\b/i.test(msg),
114
+ mode: detectChatMode(msg),
115
+ scenario,
116
+ questionnaireStatus: questionnaire.status,
117
+ fields: questionnaire.fields,
118
+ historyCount: questionnaire.history.length,
119
+ clarifyMaxRounds: budget.clarifyMaxRounds,
120
+ };
107
121
  }
108
122
  export function buildClarifyContextMessage(questionnaire) {
109
- const panelReady = questionnaire.awaitingUserAnswer && questionnaire.pending?.questionMarkdown;
110
- return `[SCOPE GATE — internal only, never repeat to user]
123
+ const panelReady = questionnaire.awaitingUserAnswer && questionnaire.pending?.questionMarkdown;
124
+ return `[SCOPE GATE — internal only, never repeat to user]
111
125
  ${panelReady ? "Questionnaire panel is visible — do NOT ask user to look at the panel." : "Scope still missing — questionnaire auto-ask may run."}
112
126
  Read-only until scope ready. User-facing replies: max 2 sentences; no chain-of-thought.
113
127
  ${questionnaire.awaitingUserAnswer ? "Wait for panel answer or free text." : "Use questionnaire record if user already gave scope in prose."}`;
114
128
  }
115
129
  function extractQuestionText(markdown) {
116
- for (const line of markdown.split("\n")) {
117
- const trimmed = line.trim();
118
- if (trimmed && !/^[A-D]\)/.test(trimmed))
119
- return trimmed;
120
- }
121
- return markdown.split("\n")[0]?.trim() ?? "";
130
+ for (const line of markdown.split("\n")) {
131
+ const trimmed = line.trim();
132
+ if (trimmed && !/^[A-D]\)/.test(trimmed)) return trimmed;
133
+ }
134
+ return markdown.split("\n")[0]?.trim() ?? "";
122
135
  }
123
136
  export function syncClarifyUi(questionnaire) {
124
- if (questionnaire.status === "ready") {
125
- setClarifyUiSnapshot({
126
- phase: "ready",
127
- progressLabel: null,
128
- questionMarkdown: null,
129
- questionText: null,
130
- optionLabels: [],
131
- selected: [],
132
- focusedIndex: 0,
133
- });
134
- return;
135
- }
136
- if (!questionnaire.awaitingUserAnswer || !questionnaire.pending?.questionMarkdown) {
137
- setClarifyUiSnapshot({
138
- phase: "idle",
139
- progressLabel: null,
140
- questionMarkdown: null,
141
- questionText: null,
142
- optionLabels: [],
143
- selected: [],
144
- focusedIndex: 0,
145
- });
146
- return;
147
- }
148
- const pending = questionnaire.pending;
137
+ if (questionnaire.status === "ready") {
149
138
  setClarifyUiSnapshot({
150
- phase: "asking",
151
- progressLabel: buildClarifyProgressLabel(questionnaire),
152
- questionMarkdown: pending.questionMarkdown,
153
- questionText: extractQuestionText(pending.questionMarkdown),
154
- optionLabels: pending.optionLabels,
155
- selectionMode: pending.selectionMode ?? "single",
156
- selected: [],
157
- focusedIndex: 0,
139
+ phase: "ready",
140
+ progressLabel: null,
141
+ questionMarkdown: null,
142
+ questionText: null,
143
+ optionLabels: [],
144
+ selected: [],
145
+ focusedIndex: 0,
158
146
  });
147
+ return;
148
+ }
149
+ if (!questionnaire.awaitingUserAnswer || !questionnaire.pending?.questionMarkdown) {
150
+ setClarifyUiSnapshot({
151
+ phase: "idle",
152
+ progressLabel: null,
153
+ questionMarkdown: null,
154
+ questionText: null,
155
+ optionLabels: [],
156
+ selected: [],
157
+ focusedIndex: 0,
158
+ });
159
+ return;
160
+ }
161
+ const pending = questionnaire.pending;
162
+ setClarifyUiSnapshot({
163
+ phase: "asking",
164
+ progressLabel: buildClarifyProgressLabel(questionnaire),
165
+ questionMarkdown: pending.questionMarkdown,
166
+ questionText: extractQuestionText(pending.questionMarkdown),
167
+ optionLabels: pending.optionLabels,
168
+ selectionMode: pending.selectionMode ?? "single",
169
+ selected: [],
170
+ focusedIndex: 0,
171
+ });
159
172
  }
160
173
  function applyDiscoveredScope(questionnaire, prompt, cwd) {
161
- const discovered = discoverScopeHints(cwd, prompt);
162
- if (!discovered.fields || Object.keys(discovered.fields).length === 0) {
163
- return questionnaire;
164
- }
165
- const result = executeQuestionnaireTool(questionnaire, {
166
- action: "record",
167
- scenario: discovered.scenario,
168
- fields: discovered.fields,
169
- });
170
- return result.questionnaire;
174
+ const discovered = discoverScopeHints(cwd, prompt);
175
+ if (!discovered.fields || Object.keys(discovered.fields).length === 0) {
176
+ return questionnaire;
177
+ }
178
+ const result = executeQuestionnaireTool(questionnaire, {
179
+ action: "record",
180
+ scenario: discovered.scenario,
181
+ fields: discovered.fields,
182
+ });
183
+ return result.questionnaire;
171
184
  }
172
185
  export function autoAskNextQuestion(questionnaire, prompt) {
173
- if (questionnaire.awaitingUserAnswer || questionnaire.status === "ready") {
174
- return questionnaire;
175
- }
176
- const scenario = questionnaire.scenario ?? inferScenarioFromMessage(prompt);
177
- const result = executeQuestionnaireTool(questionnaire, {
178
- action: "ask",
179
- scenario,
180
- });
181
- if (!result.ok)
182
- return questionnaire;
183
- return result.questionnaire;
186
+ if (questionnaire.awaitingUserAnswer || questionnaire.status === "ready") {
187
+ return questionnaire;
188
+ }
189
+ const scenario = questionnaire.scenario ?? inferScenarioFromMessage(prompt);
190
+ const result = executeQuestionnaireTool(questionnaire, {
191
+ action: "ask",
192
+ scenario,
193
+ });
194
+ if (!result.ok) return questionnaire;
195
+ return result.questionnaire;
184
196
  }
185
197
  function maybeMarkReady(questionnaire) {
186
- const scenario = questionnaire.scenario ?? "remediation";
187
- if (questionnaire.status === "collecting" &&
188
- !questionnaire.awaitingUserAnswer &&
189
- hasMinimumScopeForScenario(scenario, questionnaire.fields)) {
190
- return { ...questionnaire, status: "ready", pending: null };
191
- }
192
- return questionnaire;
198
+ const scenario = questionnaire.scenario ?? "remediation";
199
+ if (
200
+ questionnaire.status === "collecting" &&
201
+ !questionnaire.awaitingUserAnswer &&
202
+ hasMinimumScopeForScenario(scenario, questionnaire.fields)
203
+ ) {
204
+ return { ...questionnaire, status: "ready", pending: null };
205
+ }
206
+ return questionnaire;
193
207
  }
194
208
  export function updateClarifyStatus(ctx, questionnaire) {
195
- if (!ctx.hasUI)
196
- return;
197
- if (questionnaire.status === "ready") {
198
- ctx.ui.setStatus("kubbisec-clarify", undefined);
199
- return;
200
- }
201
- if (questionnaire.awaitingUserAnswer) {
202
- ctx.ui.setStatus("kubbisec-clarify", ctx.ui.theme.fg("warning", `questionário · ${questionnaire.status}`));
203
- return;
204
- }
209
+ if (!ctx.hasUI) return;
210
+ if (questionnaire.status === "ready") {
205
211
  ctx.ui.setStatus("kubbisec-clarify", undefined);
212
+ return;
213
+ }
214
+ if (questionnaire.awaitingUserAnswer) {
215
+ ctx.ui.setStatus(
216
+ "kubbisec-clarify",
217
+ ctx.ui.theme.fg("warning", `questionário · ${questionnaire.status}`),
218
+ );
219
+ return;
220
+ }
221
+ ctx.ui.setStatus("kubbisec-clarify", undefined);
206
222
  }
207
223
  export function processClarifyPrompt(questionnaire, prompt, cwd, clarifyMaxRounds) {
208
- let next = questionnaire;
209
- if (next.status === "collecting" && prompt.trim()) {
210
- const selectionMode = next.pending?.selectionMode ?? "single";
211
- const parsed = parseClarifyAnswer(prompt, selectionMode);
212
- if (shouldAcceptClarifyAnswer(next, parsed)) {
213
- next = applyParsedUserAnswerIfPending(next, parsed);
214
- next = finalizeQuestionnaireAtRoundLimit(next, clarifyMaxRounds);
215
- next = maybeMarkReady(next);
216
- }
224
+ let next = questionnaire;
225
+ if (next.status === "collecting" && prompt.trim()) {
226
+ const selectionMode = next.pending?.selectionMode ?? "single";
227
+ const parsed = parseClarifyAnswer(prompt, selectionMode);
228
+ if (shouldAcceptClarifyAnswer(next, parsed)) {
229
+ next = applyParsedUserAnswerIfPending(next, parsed);
230
+ next = finalizeQuestionnaireAtRoundLimit(next, clarifyMaxRounds);
231
+ next = maybeMarkReady(next);
217
232
  }
218
- next = applyDiscoveredScope(next, prompt, cwd);
219
- next = maybeMarkReady(next);
220
- return next;
233
+ }
234
+ next = applyDiscoveredScope(next, prompt, cwd);
235
+ next = maybeMarkReady(next);
236
+ return next;
221
237
  }
222
238
  export default function kubbisecClarify(api) {
223
- const sessionId = randomUUID();
224
- let questionnaire = readSessionQuestionnaire(process.cwd(), sessionId);
225
- let gateActive = false;
226
- let clarifyWidgetRegistered = false;
227
- let lastUserMessage = "";
228
- let sessionCwd = process.cwd();
229
- function persist(ctx, next) {
230
- questionnaire = next;
231
- try {
232
- writeSessionQuestionnaire(ctx.cwd, next);
233
- }
234
- catch (error) {
235
- console.warn("[kubbisec-clarify] Failed to persist session questionnaire:", error);
236
- }
237
- updateClarifyStatus(ctx, next);
238
- syncClarifyUi(next);
239
+ const sessionId = randomUUID();
240
+ let questionnaire = readSessionQuestionnaire(process.cwd(), sessionId);
241
+ let gateActive = false;
242
+ let clarifyWidgetRegistered = false;
243
+ let lastUserMessage = "";
244
+ let sessionCwd = process.cwd();
245
+ function persist(ctx, next) {
246
+ questionnaire = next;
247
+ try {
248
+ writeSessionQuestionnaire(ctx.cwd, next);
249
+ } catch (error) {
250
+ console.warn("[kubbisec-clarify] Failed to persist session questionnaire:", error);
239
251
  }
240
- function ensureClarifyWidget(ctx) {
241
- if (!ctx.hasUI || clarifyWidgetRegistered)
242
- return;
243
- clarifyWidgetRegistered = true;
244
- ctx.ui.setWidget("kubbisec-clarify-panel", (tui, theme) => {
245
- setClarifyUiChangeListener(() => {
246
- tui.requestRender();
247
- });
248
- return {
249
- dispose() {
250
- setClarifyUiChangeListener(undefined);
251
- },
252
- invalidate() {
253
- tui.requestRender();
254
- },
255
- render(w) {
256
- return renderClarifySelectPanel(w, getClarifyUiSnapshot(), theme);
257
- },
258
- };
259
- }, { placement: "aboveEditor" });
252
+ updateClarifyStatus(ctx, next);
253
+ syncClarifyUi(next);
254
+ }
255
+ function ensureClarifyWidget(ctx) {
256
+ if (!ctx.hasUI || clarifyWidgetRegistered) return;
257
+ clarifyWidgetRegistered = true;
258
+ ctx.ui.setWidget(
259
+ "kubbisec-clarify-panel",
260
+ (tui, theme) => {
261
+ setClarifyUiChangeListener(() => {
262
+ tui.requestRender();
263
+ });
264
+ return {
265
+ dispose() {
266
+ setClarifyUiChangeListener(undefined);
267
+ },
268
+ invalidate() {
269
+ tui.requestRender();
270
+ },
271
+ render(w) {
272
+ return renderClarifySelectPanel(w, getClarifyUiSnapshot(), theme);
273
+ },
274
+ };
275
+ },
276
+ { placement: "aboveEditor" },
277
+ );
278
+ }
279
+ api.registerTool({
280
+ name: "questionnaire",
281
+ label: "Scope questionnaire",
282
+ description:
283
+ "Format and track contextual scope questions (ask/record/status/complete). KubbiSec renders options in the panel above the editor.",
284
+ parameters: questionnaireToolParametersSchema(),
285
+ async execute(_toolCallId, params) {
286
+ const input = params;
287
+ const result = executeQuestionnaireTool(questionnaire, input, lastUserMessage);
288
+ questionnaire = result.questionnaire;
289
+ try {
290
+ writeSessionQuestionnaire(sessionCwd, questionnaire);
291
+ } catch {
292
+ // best effort
293
+ }
294
+ syncClarifyUi(questionnaire);
295
+ return {
296
+ content: [{ type: "text", text: result.message }],
297
+ details: { ok: result.ok, status: result.status, action: result.action },
298
+ };
299
+ },
300
+ });
301
+ api.on("session_start", async (_event, ctx) => {
302
+ sessionCwd = ctx.cwd;
303
+ questionnaire = readSessionQuestionnaire(ctx.cwd, sessionId);
304
+ gateActive = false;
305
+ setClarifyGateActive(false);
306
+ lastUserMessage = "";
307
+ resetClarifyUiSnapshot();
308
+ ensureClarifyWidget(ctx);
309
+ updateClarifyStatus(ctx, questionnaire);
310
+ syncClarifyUi(questionnaire);
311
+ });
312
+ api.on("session_shutdown", async () => {
313
+ resetClarifyUiSnapshot();
314
+ setClarifyGateActive(false);
315
+ });
316
+ api.on("before_agent_start", async (event, ctx) => {
317
+ const { prompt } = event;
318
+ lastUserMessage = prompt;
319
+ const surface = resolveSurface();
320
+ ensureClarifyWidget(ctx);
321
+ if (surface !== "chat") {
322
+ gateActive = false;
323
+ setClarifyGateActive(false);
324
+ resetClarifyUiSnapshot();
325
+ return undefined;
260
326
  }
261
- api.registerTool({
262
- name: "questionnaire",
263
- label: "Scope questionnaire",
264
- description: "Format and track contextual scope questions (ask/record/status/complete). KubbiSec renders options in the panel above the editor.",
265
- parameters: questionnaireToolParametersSchema(),
266
- async execute(_toolCallId, params) {
267
- const input = params;
268
- const result = executeQuestionnaireTool(questionnaire, input, lastUserMessage);
269
- questionnaire = result.questionnaire;
270
- try {
271
- writeSessionQuestionnaire(sessionCwd, questionnaire);
272
- }
273
- catch {
274
- // best effort
275
- }
276
- syncClarifyUi(questionnaire);
277
- return {
278
- content: [{ type: "text", text: result.message }],
279
- details: { ok: result.ok, status: result.status, action: result.action },
280
- };
281
- },
282
- });
283
- api.on("session_start", async (_event, ctx) => {
284
- sessionCwd = ctx.cwd;
285
- questionnaire = readSessionQuestionnaire(ctx.cwd, sessionId);
286
- gateActive = false;
287
- setClarifyGateActive(false);
288
- lastUserMessage = "";
289
- resetClarifyUiSnapshot();
290
- ensureClarifyWidget(ctx);
291
- updateClarifyStatus(ctx, questionnaire);
292
- syncClarifyUi(questionnaire);
293
- });
294
- api.on("session_shutdown", async () => {
295
- resetClarifyUiSnapshot();
296
- setClarifyGateActive(false);
297
- });
298
- api.on("before_agent_start", async (event, ctx) => {
299
- const { prompt } = event;
300
- lastUserMessage = prompt;
301
- const surface = resolveSurface();
302
- ensureClarifyWidget(ctx);
303
- if (surface !== "chat") {
304
- gateActive = false;
305
- setClarifyGateActive(false);
306
- resetClarifyUiSnapshot();
307
- return undefined;
308
- }
309
- const budget = resolveResourceBudget();
310
- let next = readSessionQuestionnaire(ctx.cwd, questionnaire.sessionId);
311
- next = processClarifyPrompt(next, prompt, ctx.cwd, budget.clarifyMaxRounds);
312
- const gateInput = buildGateInput(prompt, next);
313
- gateActive = shouldClarify(gateInput);
314
- setClarifyGateActive(gateActive);
315
- if (!gateActive) {
316
- next = maybeMarkReady(next);
317
- persist(ctx, next);
318
- return undefined;
319
- }
320
- if (next.status === "collecting" && !next.awaitingUserAnswer) {
321
- next = autoAskNextQuestion(next, prompt);
322
- next = maybeMarkReady(next);
323
- persist(ctx, next);
324
- if (next.awaitingUserAnswer) {
325
- return {
326
- message: {
327
- customType: "kubbisec-clarify",
328
- content: buildClarifyContextMessage(next),
329
- display: false,
330
- },
331
- };
332
- }
333
- return {
334
- message: {
335
- customType: "kubbisec-clarify",
336
- content: buildClarifyContextMessage(next),
337
- display: false,
338
- },
339
- };
340
- }
341
- persist(ctx, next);
342
- return undefined;
343
- });
344
- api.on("tool_call", async (event, ctx) => {
345
- const surface = resolveSurface();
346
- if (surface !== "chat") {
347
- return undefined;
348
- }
349
- questionnaire = readSessionQuestionnaire(ctx.cwd, questionnaire.sessionId);
350
- const { toolName } = event;
351
- if (toolName === "questionnaire") {
352
- return undefined;
353
- }
354
- if (!shouldBlockClarifyTool(toolName, gateActive, questionnaire)) {
355
- return undefined;
356
- }
327
+ const budget = resolveResourceBudget();
328
+ let next = readSessionQuestionnaire(ctx.cwd, questionnaire.sessionId);
329
+ next = processClarifyPrompt(next, prompt, ctx.cwd, budget.clarifyMaxRounds);
330
+ const gateInput = buildGateInput(prompt, next);
331
+ gateActive = shouldClarify(gateInput);
332
+ setClarifyGateActive(gateActive);
333
+ if (!gateActive) {
334
+ next = maybeMarkReady(next);
335
+ persist(ctx, next);
336
+ return undefined;
337
+ }
338
+ if (next.status === "collecting" && !next.awaitingUserAnswer) {
339
+ next = autoAskNextQuestion(next, prompt);
340
+ next = maybeMarkReady(next);
341
+ persist(ctx, next);
342
+ if (next.awaitingUserAnswer) {
357
343
  return {
358
- block: true,
359
- reason: CLARIFY_TOOL_BLOCK_REASON,
344
+ message: {
345
+ customType: "kubbisec-clarify",
346
+ content: buildClarifyContextMessage(next),
347
+ display: false,
348
+ },
360
349
  };
361
- });
350
+ }
351
+ return {
352
+ message: {
353
+ customType: "kubbisec-clarify",
354
+ content: buildClarifyContextMessage(next),
355
+ display: false,
356
+ },
357
+ };
358
+ }
359
+ persist(ctx, next);
360
+ return undefined;
361
+ });
362
+ api.on("tool_call", async (event, ctx) => {
363
+ const surface = resolveSurface();
364
+ if (surface !== "chat") {
365
+ return undefined;
366
+ }
367
+ questionnaire = readSessionQuestionnaire(ctx.cwd, questionnaire.sessionId);
368
+ const { toolName } = event;
369
+ if (toolName === "questionnaire") {
370
+ return undefined;
371
+ }
372
+ if (!shouldBlockClarifyTool(toolName, gateActive, questionnaire)) {
373
+ return undefined;
374
+ }
375
+ return {
376
+ block: true,
377
+ reason: CLARIFY_TOOL_BLOCK_REASON,
378
+ };
379
+ });
362
380
  }
363
- //# sourceMappingURL=kubbisec-clarify.extension.js.map
381
+ //# sourceMappingURL=kubbisec-clarify.extension.js.map