@octopusdeploy/mcp-server 1.0.1 → 2.1.0

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 (290) hide show
  1. package/README.md +237 -46
  2. package/dist/helpers/activeToolsetConfig.d.ts +4 -0
  3. package/dist/helpers/activeToolsetConfig.d.ts.map +1 -0
  4. package/dist/helpers/activeToolsetConfig.js +18 -0
  5. package/dist/helpers/activeToolsetConfig.js.map +1 -0
  6. package/dist/helpers/errorHandling.d.ts +38 -0
  7. package/dist/helpers/errorHandling.d.ts.map +1 -0
  8. package/dist/helpers/errorHandling.js +75 -0
  9. package/dist/helpers/errorHandling.js.map +1 -0
  10. package/dist/helpers/getClientConfigurationFromEnvironment.d.ts +2 -0
  11. package/dist/helpers/getClientConfigurationFromEnvironment.d.ts.map +1 -1
  12. package/dist/helpers/getClientConfigurationFromEnvironment.js +21 -5
  13. package/dist/helpers/getClientConfigurationFromEnvironment.js.map +1 -1
  14. package/dist/helpers/grepLines.d.ts +38 -0
  15. package/dist/helpers/grepLines.d.ts.map +1 -0
  16. package/dist/helpers/grepLines.js +65 -0
  17. package/dist/helpers/grepLines.js.map +1 -0
  18. package/dist/helpers/methodTier.d.ts +15 -0
  19. package/dist/helpers/methodTier.d.ts.map +1 -0
  20. package/dist/helpers/methodTier.js +25 -0
  21. package/dist/helpers/methodTier.js.map +1 -0
  22. package/dist/helpers/pathAllowlist.d.ts +27 -0
  23. package/dist/helpers/pathAllowlist.d.ts.map +1 -0
  24. package/dist/helpers/pathAllowlist.js +177 -0
  25. package/dist/helpers/pathAllowlist.js.map +1 -0
  26. package/dist/helpers/pathGlob.d.ts +15 -0
  27. package/dist/helpers/pathGlob.d.ts.map +1 -0
  28. package/dist/helpers/pathGlob.js +47 -0
  29. package/dist/helpers/pathGlob.js.map +1 -0
  30. package/dist/helpers/requireConfirmation.d.ts +119 -0
  31. package/dist/helpers/requireConfirmation.d.ts.map +1 -0
  32. package/dist/helpers/requireConfirmation.js +148 -0
  33. package/dist/helpers/requireConfirmation.js.map +1 -0
  34. package/dist/helpers/sensitivePathDenylist.d.ts +32 -0
  35. package/dist/helpers/sensitivePathDenylist.d.ts.map +1 -0
  36. package/dist/helpers/sensitivePathDenylist.js +49 -0
  37. package/dist/helpers/sensitivePathDenylist.js.map +1 -0
  38. package/dist/helpers/spaceResolver.d.ts +4 -0
  39. package/dist/helpers/spaceResolver.d.ts.map +1 -0
  40. package/dist/helpers/spaceResolver.js +18 -0
  41. package/dist/helpers/spaceResolver.js.map +1 -0
  42. package/dist/helpers/stripLinks.d.ts +15 -0
  43. package/dist/helpers/stripLinks.d.ts.map +1 -0
  44. package/dist/helpers/stripLinks.js +19 -0
  45. package/dist/helpers/stripLinks.js.map +1 -0
  46. package/dist/helpers/urlParser.d.ts +16 -0
  47. package/dist/helpers/urlParser.d.ts.map +1 -0
  48. package/dist/helpers/urlParser.js +83 -0
  49. package/dist/helpers/urlParser.js.map +1 -0
  50. package/dist/helpers/userCache.d.ts +14 -0
  51. package/dist/helpers/userCache.d.ts.map +1 -0
  52. package/dist/helpers/userCache.js +16 -0
  53. package/dist/helpers/userCache.js.map +1 -0
  54. package/dist/helpers/validateExecutePath.d.ts +29 -0
  55. package/dist/helpers/validateExecutePath.d.ts.map +1 -0
  56. package/dist/helpers/validateExecutePath.js +62 -0
  57. package/dist/helpers/validateExecutePath.js.map +1 -0
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +64 -15
  60. package/dist/index.js.map +1 -1
  61. package/dist/resources/catalog/capabilities.d.ts +36 -0
  62. package/dist/resources/catalog/capabilities.d.ts.map +1 -0
  63. package/dist/resources/catalog/capabilities.js +90 -0
  64. package/dist/resources/catalog/capabilities.js.map +1 -0
  65. package/dist/resources/catalog/llmsTxt.d.ts +8 -0
  66. package/dist/resources/catalog/llmsTxt.d.ts.map +1 -0
  67. package/dist/resources/catalog/llmsTxt.js +44 -0
  68. package/dist/resources/catalog/llmsTxt.js.map +1 -0
  69. package/dist/resources/dispatch.d.ts +30 -0
  70. package/dist/resources/dispatch.d.ts.map +1 -0
  71. package/dist/resources/dispatch.js +81 -0
  72. package/dist/resources/dispatch.js.map +1 -0
  73. package/dist/resources/featureToggle.d.ts +2 -0
  74. package/dist/resources/featureToggle.d.ts.map +1 -0
  75. package/dist/resources/featureToggle.js +34 -0
  76. package/dist/resources/featureToggle.js.map +1 -0
  77. package/dist/resources/index.d.ts +12 -0
  78. package/dist/resources/index.d.ts.map +1 -0
  79. package/dist/resources/index.js +44 -0
  80. package/dist/resources/index.js.map +1 -0
  81. package/dist/resources/interruption.d.ts +2 -0
  82. package/dist/resources/interruption.d.ts.map +1 -0
  83. package/dist/resources/interruption.js +34 -0
  84. package/dist/resources/interruption.js.map +1 -0
  85. package/dist/resources/release.d.ts +2 -0
  86. package/dist/resources/release.d.ts.map +1 -0
  87. package/dist/resources/release.js +33 -0
  88. package/dist/resources/release.js.map +1 -0
  89. package/dist/resources/rolloutGroup.d.ts +2 -0
  90. package/dist/resources/rolloutGroup.d.ts.map +1 -0
  91. package/dist/resources/rolloutGroup.js +35 -0
  92. package/dist/resources/rolloutGroup.js.map +1 -0
  93. package/dist/resources/runbook.d.ts +2 -0
  94. package/dist/resources/runbook.d.ts.map +1 -0
  95. package/dist/resources/runbook.js +34 -0
  96. package/dist/resources/runbook.js.map +1 -0
  97. package/dist/resources/task.d.ts +2 -0
  98. package/dist/resources/task.d.ts.map +1 -0
  99. package/dist/resources/task.js +68 -0
  100. package/dist/resources/task.js.map +1 -0
  101. package/dist/tools/createRelease.d.ts +3 -0
  102. package/dist/tools/createRelease.d.ts.map +1 -0
  103. package/dist/tools/createRelease.js +151 -0
  104. package/dist/tools/createRelease.js.map +1 -0
  105. package/dist/tools/deployRelease.d.ts +3 -0
  106. package/dist/tools/deployRelease.d.ts.map +1 -0
  107. package/dist/tools/deployRelease.js +227 -0
  108. package/dist/tools/deployRelease.js.map +1 -0
  109. package/dist/tools/execute.d.ts +3 -0
  110. package/dist/tools/execute.d.ts.map +1 -0
  111. package/dist/tools/execute.js +261 -0
  112. package/dist/tools/execute.js.map +1 -0
  113. package/dist/tools/findAccounts.d.ts +3 -0
  114. package/dist/tools/findAccounts.d.ts.map +1 -0
  115. package/dist/tools/findAccounts.js +90 -0
  116. package/dist/tools/findAccounts.js.map +1 -0
  117. package/dist/tools/findCertificates.d.ts +3 -0
  118. package/dist/tools/findCertificates.d.ts.map +1 -0
  119. package/dist/tools/findCertificates.js +98 -0
  120. package/dist/tools/findCertificates.js.map +1 -0
  121. package/dist/tools/findDeploymentTargets.d.ts +3 -0
  122. package/dist/tools/findDeploymentTargets.d.ts.map +1 -0
  123. package/dist/tools/findDeploymentTargets.js +161 -0
  124. package/dist/tools/findDeploymentTargets.js.map +1 -0
  125. package/dist/tools/findFeatureToggles.d.ts +37 -0
  126. package/dist/tools/findFeatureToggles.d.ts.map +1 -0
  127. package/dist/tools/findFeatureToggles.js +139 -0
  128. package/dist/tools/findFeatureToggles.js.map +1 -0
  129. package/dist/tools/findInterruptions.d.ts +79 -0
  130. package/dist/tools/findInterruptions.d.ts.map +1 -0
  131. package/dist/tools/findInterruptions.js +273 -0
  132. package/dist/tools/findInterruptions.js.map +1 -0
  133. package/dist/tools/findReleases.d.ts +3 -0
  134. package/dist/tools/findReleases.d.ts.map +1 -0
  135. package/dist/tools/findReleases.js +138 -0
  136. package/dist/tools/findReleases.js.map +1 -0
  137. package/dist/tools/findRunbooks.d.ts +3 -0
  138. package/dist/tools/findRunbooks.d.ts.map +1 -0
  139. package/dist/tools/findRunbooks.js +139 -0
  140. package/dist/tools/findRunbooks.js.map +1 -0
  141. package/dist/tools/findTenants.d.ts +19 -0
  142. package/dist/tools/findTenants.d.ts.map +1 -0
  143. package/dist/tools/findTenants.js +133 -0
  144. package/dist/tools/findTenants.js.map +1 -0
  145. package/dist/tools/getBranches.d.ts.map +1 -1
  146. package/dist/tools/getBranches.js +51 -33
  147. package/dist/tools/getBranches.js.map +1 -1
  148. package/dist/tools/getCurrentUser.d.ts.map +1 -1
  149. package/dist/tools/getCurrentUser.js +34 -25
  150. package/dist/tools/getCurrentUser.js.map +1 -1
  151. package/dist/tools/getDeploymentFromUrl.d.ts +57 -0
  152. package/dist/tools/getDeploymentFromUrl.d.ts.map +1 -0
  153. package/dist/tools/getDeploymentFromUrl.js +162 -0
  154. package/dist/tools/getDeploymentFromUrl.js.map +1 -0
  155. package/dist/tools/getDeploymentProcess.d.ts.map +1 -1
  156. package/dist/tools/getDeploymentProcess.js +57 -19
  157. package/dist/tools/getDeploymentProcess.js.map +1 -1
  158. package/dist/tools/getKubernetesLiveStatus.d.ts.map +1 -1
  159. package/dist/tools/getKubernetesLiveStatus.js +70 -48
  160. package/dist/tools/getKubernetesLiveStatus.js.map +1 -1
  161. package/dist/tools/getMissingTenantVariables.d.ts.map +1 -1
  162. package/dist/tools/getMissingTenantVariables.js +58 -26
  163. package/dist/tools/getMissingTenantVariables.js.map +1 -1
  164. package/dist/tools/getTaskFromUrl.d.ts +18 -0
  165. package/dist/tools/getTaskFromUrl.d.ts.map +1 -0
  166. package/dist/tools/getTaskFromUrl.js +90 -0
  167. package/dist/tools/getTaskFromUrl.js.map +1 -0
  168. package/dist/tools/getTenantVariables.d.ts.map +1 -1
  169. package/dist/tools/getTenantVariables.js +58 -38
  170. package/dist/tools/getTenantVariables.js.map +1 -1
  171. package/dist/tools/getVariables.d.ts.map +1 -1
  172. package/dist/tools/getVariables.js +12 -9
  173. package/dist/tools/getVariables.js.map +1 -1
  174. package/dist/tools/grepLlmsTxt.d.ts +13 -0
  175. package/dist/tools/grepLlmsTxt.d.ts.map +1 -0
  176. package/dist/tools/grepLlmsTxt.js +105 -0
  177. package/dist/tools/grepLlmsTxt.js.map +1 -0
  178. package/dist/tools/grepTaskLog.d.ts +30 -0
  179. package/dist/tools/grepTaskLog.d.ts.map +1 -0
  180. package/dist/tools/grepTaskLog.js +116 -0
  181. package/dist/tools/grepTaskLog.js.map +1 -0
  182. package/dist/tools/index.d.ts +22 -18
  183. package/dist/tools/index.d.ts.map +1 -1
  184. package/dist/tools/index.js +33 -21
  185. package/dist/tools/index.js.map +1 -1
  186. package/dist/tools/listDeployments.d.ts.map +1 -1
  187. package/dist/tools/listDeployments.js +77 -37
  188. package/dist/tools/listDeployments.js.map +1 -1
  189. package/dist/tools/listEnvironments.d.ts.map +1 -1
  190. package/dist/tools/listEnvironments.js +63 -37
  191. package/dist/tools/listEnvironments.js.map +1 -1
  192. package/dist/tools/listProjects.d.ts.map +1 -1
  193. package/dist/tools/listProjects.js +64 -38
  194. package/dist/tools/listProjects.js.map +1 -1
  195. package/dist/tools/listSpaces.d.ts.map +1 -1
  196. package/dist/tools/listSpaces.js +56 -30
  197. package/dist/tools/listSpaces.js.map +1 -1
  198. package/dist/tools/readResource.d.ts +3 -0
  199. package/dist/tools/readResource.d.ts.map +1 -0
  200. package/dist/tools/readResource.js +50 -0
  201. package/dist/tools/readResource.js.map +1 -0
  202. package/dist/tools/runRunbook.d.ts +3 -0
  203. package/dist/tools/runRunbook.d.ts.map +1 -0
  204. package/dist/tools/runRunbook.js +174 -0
  205. package/dist/tools/runRunbook.js.map +1 -0
  206. package/dist/tools/updateFeatureToggle.d.ts +94 -0
  207. package/dist/tools/updateFeatureToggle.d.ts.map +1 -0
  208. package/dist/tools/updateFeatureToggle.js +308 -0
  209. package/dist/tools/updateFeatureToggle.js.map +1 -0
  210. package/dist/types/featureToggleTypes.d.ts +47 -0
  211. package/dist/types/featureToggleTypes.d.ts.map +1 -0
  212. package/dist/types/featureToggleTypes.js +10 -0
  213. package/dist/types/featureToggleTypes.js.map +1 -0
  214. package/dist/types/resourceConfig.d.ts +17 -0
  215. package/dist/types/resourceConfig.d.ts.map +1 -0
  216. package/dist/types/resourceConfig.js +6 -0
  217. package/dist/types/resourceConfig.js.map +1 -0
  218. package/dist/types/toolAnnotations.d.ts +8 -0
  219. package/dist/types/toolAnnotations.d.ts.map +1 -0
  220. package/dist/types/toolAnnotations.js +28 -0
  221. package/dist/types/toolAnnotations.js.map +1 -0
  222. package/dist/types/toolConfig.d.ts +7 -1
  223. package/dist/types/toolConfig.d.ts.map +1 -1
  224. package/dist/types/toolConfig.js +4 -1
  225. package/dist/types/toolConfig.js.map +1 -1
  226. package/dist/utils/parseConfig.d.ts +1 -1
  227. package/dist/utils/parseConfig.d.ts.map +1 -1
  228. package/dist/utils/parseConfig.js +3 -2
  229. package/dist/utils/parseConfig.js.map +1 -1
  230. package/dist/utils/version.d.ts +2 -0
  231. package/dist/utils/version.d.ts.map +1 -0
  232. package/dist/utils/version.js +3 -0
  233. package/dist/utils/version.js.map +1 -0
  234. package/package.json +9 -3
  235. package/dist/tools/getAccount.d.ts +0 -3
  236. package/dist/tools/getAccount.d.ts.map +0 -1
  237. package/dist/tools/getAccount.js +0 -40
  238. package/dist/tools/getAccount.js.map +0 -1
  239. package/dist/tools/getCertificate.d.ts +0 -3
  240. package/dist/tools/getCertificate.d.ts.map +0 -1
  241. package/dist/tools/getCertificate.js +0 -40
  242. package/dist/tools/getCertificate.js.map +0 -1
  243. package/dist/tools/getDeploymentTarget.d.ts +0 -3
  244. package/dist/tools/getDeploymentTarget.d.ts.map +0 -1
  245. package/dist/tools/getDeploymentTarget.js +0 -66
  246. package/dist/tools/getDeploymentTarget.js.map +0 -1
  247. package/dist/tools/getReleaseById.d.ts +0 -3
  248. package/dist/tools/getReleaseById.d.ts.map +0 -1
  249. package/dist/tools/getReleaseById.js +0 -45
  250. package/dist/tools/getReleaseById.js.map +0 -1
  251. package/dist/tools/getTaskById.d.ts +0 -9
  252. package/dist/tools/getTaskById.d.ts.map +0 -1
  253. package/dist/tools/getTaskById.js +0 -44
  254. package/dist/tools/getTaskById.js.map +0 -1
  255. package/dist/tools/getTaskDetails.d.ts +0 -9
  256. package/dist/tools/getTaskDetails.d.ts.map +0 -1
  257. package/dist/tools/getTaskDetails.js +0 -44
  258. package/dist/tools/getTaskDetails.js.map +0 -1
  259. package/dist/tools/getTaskRaw.d.ts +0 -9
  260. package/dist/tools/getTaskRaw.d.ts.map +0 -1
  261. package/dist/tools/getTaskRaw.js +0 -43
  262. package/dist/tools/getTaskRaw.js.map +0 -1
  263. package/dist/tools/getTenantById.d.ts +0 -3
  264. package/dist/tools/getTenantById.d.ts.map +0 -1
  265. package/dist/tools/getTenantById.js +0 -50
  266. package/dist/tools/getTenantById.js.map +0 -1
  267. package/dist/tools/listAccounts.d.ts +0 -3
  268. package/dist/tools/listAccounts.d.ts.map +0 -1
  269. package/dist/tools/listAccounts.js +0 -54
  270. package/dist/tools/listAccounts.js.map +0 -1
  271. package/dist/tools/listCertificates.d.ts +0 -3
  272. package/dist/tools/listCertificates.d.ts.map +0 -1
  273. package/dist/tools/listCertificates.js +0 -62
  274. package/dist/tools/listCertificates.js.map +0 -1
  275. package/dist/tools/listDeploymentTargets.d.ts +0 -3
  276. package/dist/tools/listDeploymentTargets.d.ts.map +0 -1
  277. package/dist/tools/listDeploymentTargets.js +0 -98
  278. package/dist/tools/listDeploymentTargets.js.map +0 -1
  279. package/dist/tools/listReleases.d.ts +0 -3
  280. package/dist/tools/listReleases.d.ts.map +0 -1
  281. package/dist/tools/listReleases.js +0 -54
  282. package/dist/tools/listReleases.js.map +0 -1
  283. package/dist/tools/listReleasesForProject.d.ts +0 -3
  284. package/dist/tools/listReleasesForProject.d.ts.map +0 -1
  285. package/dist/tools/listReleasesForProject.js +0 -60
  286. package/dist/tools/listReleasesForProject.js.map +0 -1
  287. package/dist/tools/listTenants.d.ts +0 -3
  288. package/dist/tools/listTenants.d.ts.map +0 -1
  289. package/dist/tools/listTenants.js +0 -69
  290. package/dist/tools/listTenants.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"getClientConfigurationFromEnvironment.js","sourceRoot":"","sources":["../../src/helpers/getClientConfigurationFromEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAO7C,SAAS,OAAO,CAAC,KAAyB;IACxC,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,kBAAkB;IACzB,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,MAAM,SAAS,GAAG,GAAG,eAAe,IAAI,cAAc,KAAK,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,OAAO,GAAG,CAAC;IAEpG,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,sBAAsB,CAAC,UAAgC,EAAE;IAChE,IAAI,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CACb,6KAA6K,CAC9K,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;IAEvC,OAAO;QACL,YAAY,EAAE,SAAS;QACvB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qCAAqC;IACnD,OAAO,sBAAsB,CAAC;QAC5B,WAAW,EAAE,GAAG,CAAC,gBAAgB,CAAC,IAAI,GAAG,CAAC,oBAAoB,CAAC;QAC/D,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,iBAAiB,CAAC;KACrD,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"getClientConfigurationFromEnvironment.js","sourceRoot":"","sources":["../../src/helpers/getClientConfigurationFromEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,MAAM,2BAA2B,CAAC;A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AAW;SACjC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IAC3C,OAAO;QACL,YAAY,EAAE,SAAS;QACvB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qCAAqC;IACnD,OAAO,sBAAsB,CAAC;QAC5B,WAAW,EAAE,GAAG,CAAC,gBAAgB,CAAC,IAAI,GAAG,CAAC,oBAAoB,CAAC;QAC/D,MAAM,EAAE,GAAG,CAAC,iBAAiB,CAAC;QAC9B,WAAW,EAAE,GAAG,CAAC,sBAAsB,CAAC;KACzC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * GNU-grep-shaped line search over a multi-line string. Pure function, used by
3
+ * grep_task_log (task activity logs) and grep_llms_txt (catalog markdown). Each
4
+ * line is tested independently; matching lines are emitted with optional
5
+ * symmetric context windows. Overlapping context between adjacent matches is
6
+ * NOT deduplicated — each match carries its own complete context window so the
7
+ * consumer can reason about each match in isolation. This is a deliberate
8
+ * departure from GNU grep's `--`-separated output but it is the right shape
9
+ * for a JSON tool response.
10
+ */
11
+ export interface GrepLinesParams {
12
+ pattern: string;
13
+ caseInsensitive?: boolean;
14
+ invertMatch?: boolean;
15
+ fixedString?: boolean;
16
+ beforeContext?: number;
17
+ afterContext?: number;
18
+ maxCount?: number;
19
+ }
20
+ export interface ContextLine {
21
+ lineNumber: number;
22
+ line: string;
23
+ }
24
+ export interface GrepMatch {
25
+ lineNumber: number;
26
+ line: string;
27
+ before?: ContextLine[];
28
+ after?: ContextLine[];
29
+ }
30
+ export interface GrepLinesResult {
31
+ totalLines: number;
32
+ totalMatches: number;
33
+ matches: GrepMatch[];
34
+ }
35
+ export declare const MAX_CONTEXT = 50;
36
+ export declare const MAX_COUNT_HARD_CAP = 500;
37
+ export declare function grepLines(rawText: string, params: GrepLinesParams): GrepLinesResult;
38
+ //# sourceMappingURL=grepLines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grepLines.d.ts","sourceRoot":"","sources":["../../src/helpers/grepLines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAED,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAuBtC,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,eAAe,GACtB,eAAe,CAoDjB"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * GNU-grep-shaped line search over a multi-line string. Pure function, used by
3
+ * grep_task_log (task activity logs) and grep_llms_txt (catalog markdown). Each
4
+ * line is tested independently; matching lines are emitted with optional
5
+ * symmetric context windows. Overlapping context between adjacent matches is
6
+ * NOT deduplicated — each match carries its own complete context window so the
7
+ * consumer can reason about each match in isolation. This is a deliberate
8
+ * departure from GNU grep's `--`-separated output but it is the right shape
9
+ * for a JSON tool response.
10
+ */
11
+ export const MAX_CONTEXT = 50;
12
+ export const MAX_COUNT_HARD_CAP = 500;
13
+ function escapeRegExp(value) {
14
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
15
+ }
16
+ function compilePattern(pattern, caseInsensitive, fixedString) {
17
+ const source = fixedString ? escapeRegExp(pattern) : pattern;
18
+ const flags = caseInsensitive ? "i" : "";
19
+ try {
20
+ return new RegExp(source, flags);
21
+ }
22
+ catch (error) {
23
+ throw new Error(`Invalid pattern: ${error instanceof Error ? error.message : String(error)}. ` +
24
+ "Set fixedString:true to treat the pattern as a literal substring instead of a regex.");
25
+ }
26
+ }
27
+ export function grepLines(rawText, params) {
28
+ const { pattern, caseInsensitive = false, invertMatch = false, fixedString = false, beforeContext = 0, afterContext = 0, maxCount = 100, } = params;
29
+ const lines = rawText.split("\n");
30
+ // Drop the trailing empty element produced by a final newline.
31
+ if (lines.length > 0 && lines[lines.length - 1] === "")
32
+ lines.pop();
33
+ const regex = compilePattern(pattern, caseInsensitive, fixedString);
34
+ const matches = [];
35
+ let totalMatches = 0;
36
+ for (let i = 0; i < lines.length; i++) {
37
+ const isMatch = regex.test(lines[i]) !== invertMatch;
38
+ if (!isMatch)
39
+ continue;
40
+ totalMatches++;
41
+ if (matches.length >= maxCount)
42
+ continue;
43
+ const match = {
44
+ lineNumber: i + 1,
45
+ line: lines[i],
46
+ };
47
+ if (beforeContext > 0) {
48
+ const start = Math.max(0, i - beforeContext);
49
+ match.before = lines.slice(start, i).map((line, idx) => ({
50
+ lineNumber: start + idx + 1,
51
+ line,
52
+ }));
53
+ }
54
+ if (afterContext > 0) {
55
+ const end = Math.min(lines.length, i + 1 + afterContext);
56
+ match.after = lines.slice(i + 1, end).map((line, idx) => ({
57
+ lineNumber: i + 2 + idx,
58
+ line,
59
+ }));
60
+ }
61
+ matches.push(match);
62
+ }
63
+ return { totalLines: lines.length, totalMatches, matches };
64
+ }
65
+ //# sourceMappingURL=grepLines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grepLines.js","sourceRoot":"","sources":["../../src/helpers/grepLines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA8BH,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,cAAc,CACrB,OAAe,EACf,eAAwB,EACxB,WAAoB;IAEpB,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAC7D,MAAM,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACzC,IAAI,CAAC;QACH,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,oBAAoB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI;YAC5E,sFAAsF,CACzF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,OAAe,EACf,MAAuB;IAEvB,MAAM,EACJ,OAAO,EACP,eAAe,GAAG,KAAK,EACvB,WAAW,GAAG,KAAK,EACnB,WAAW,GAAG,KAAK,EACnB,aAAa,GAAG,CAAC,EACjB,YAAY,GAAG,CAAC,EAChB,QAAQ,GAAG,GAAG,GACf,GAAG,MAAM,CAAC;IAEX,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,+DAA+D;I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,GAAG,YAAY,CAAC,CAAC;YACzD,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;gBACxD,UAAU,EAAE,CAAC,GAAG,CAAC,GAAG,GAAG;gBACvB,IAAI;aACL,CAAC,CAAC,CAAC;QACN,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Hard-coded read/write/delete classification for HTTP methods used by the
3
+ * `execute` backstop tool. The HTTP method is the authoritative classifier —
4
+ * never something the LLM gets to set independently of the actual call.
5
+ *
6
+ * Tiers:
7
+ * - read → GET (always allowed, subject to allow/denylists)
8
+ * - write → POST, PUT, PATCH (blocked when --read-only is set)
9
+ * - delete → DELETE (blocked when --read-only is set; also requires --allow-deletes)
10
+ */
11
+ export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
12
+ export type MethodTier = "read" | "write" | "delete";
13
+ export declare const HTTP_METHODS: readonly HttpMethod[];
14
+ export declare function classifyMethod(method: HttpMethod): MethodTier;
15
+ //# sourceMappingURL=methodTier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methodTier.d.ts","sourceRoot":"","sources":["../../src/helpers/methodTier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AACrE,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAErD,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EAMpC,CAAC;AAEX,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAI7D"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Hard-coded read/write/delete classification for HTTP methods used by the
3
+ * `execute` backstop tool. The HTTP method is the authoritative classifier —
4
+ * never something the LLM gets to set independently of the actual call.
5
+ *
6
+ * Tiers:
7
+ * - read → GET (always allowed, subject to allow/denylists)
8
+ * - write → POST, PUT, PATCH (blocked when --read-only is set)
9
+ * - delete → DELETE (blocked when --read-only is set; also requires --allow-deletes)
10
+ */
11
+ export const HTTP_METHODS = [
12
+ "GET",
13
+ "POST",
14
+ "PUT",
15
+ "PATCH",
16
+ "DELETE",
17
+ ];
18
+ export function classifyMethod(method) {
19
+ if (method === "GET")
20
+ return "read";
21
+ if (method === "DELETE")
22
+ return "delete";
23
+ return "write";
24
+ }
25
+ //# sourceMappingURL=methodTier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methodTier.js","sourceRoot":"","sources":["../../src/helpers/methodTier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,MAAM,CAAC,MAAM,YAAY,GAA0B;IACjD,KAAK;IACL,MAAM;IACN,KAAK;IACL,OAAO;IACP,QAAQ;CACA,CAAC;AAEX,MAAM,UAAU,cAAc,CAAC,MAAkB;IAC/C,IAAI,MAAM,KAAK,KAAK;QAAE,OAAO,MAAM,CAAC;IACpC,IAAI,MAAM,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IACzC,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { type Toolset } from "../types/toolConfig.js";
2
+ export interface AllowlistMatch {
3
+ matched: boolean;
4
+ toolset?: Toolset;
5
+ }
6
+ /**
7
+ * Find which toolset owns `path`. Most-specific-match-wins: if multiple
8
+ * toolsets have patterns matching the path, the toolset whose pattern has
9
+ * more literal segments wins ownership. Returns undefined if no toolset
10
+ * claims the path at all.
11
+ *
12
+ * This is the basis for both `matchPath` (allowlist enforcement) and the
13
+ * "which toolset do I need to enable?" error message in `execute`.
14
+ */
15
+ export declare function findOwningToolset(path: string): Toolset | undefined;
16
+ /**
17
+ * Check whether `path` falls under the allowlist given which toolsets are
18
+ * currently enabled. The `core` toolset is implicitly always enabled.
19
+ *
20
+ * The owning toolset (most-specific match) must be the one enabled — a
21
+ * less-specific toolset whose wildcard happens to also match cannot shadow
22
+ * a disabled, more-specific owner. So `featureToggles` paths require the
23
+ * `featureToggles` toolset, even when `projects` (whose `/projects/**`
24
+ * wildcard also matches) is enabled.
25
+ */
26
+ export declare function matchPath(path: string, enabledToolsets: readonly Toolset[]): AllowlistMatch;
27
+ //# sourceMappingURL=pathAllowlist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathAllowlist.d.ts","sourceRoot":"","sources":["../../src/helpers/pathAllowlist.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,wBAAwB,CAAC;AA4GtD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAYnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,SAAS,OAAO,EAAE,GAClC,cAAc,CAQhB"}
@@ -0,0 +1,177 @@
1
+ // Path allowlist for the `execute` backstop tool, scoped per toolset.
2
+ //
3
+ // The mapping says: "if toolset X is enabled, these path patterns are
4
+ // reachable through execute". When a toolset is disabled, all of its patterns
5
+ // disappear — turning off `releases` makes the release endpoints unreachable
6
+ // regardless of HTTP method or read-only mode. This is the kill-switch model.
7
+ //
8
+ // **`core` is intentionally narrow.** It only covers space discovery,
9
+ // server-level metadata, and the API catalog. It does NOT contain a wildcard
10
+ // over space sub-paths — every per-resource path under a space must be
11
+ // registered against its owning toolset. Anything else would let `core`
12
+ // (which is always enabled and consulted first) defeat per-toolset filtering
13
+ // for every space-scoped endpoint.
14
+ //
15
+ // **Each toolset registers BOTH space-prefix forms.** Octopus accepts
16
+ // `/api/{spaceId}/X` and `/api/spaces/{spaceIdentifier}/X` interchangeably, so
17
+ // each toolset declares both — `/api/<single>/projects` covers the
18
+ // bare-space-ID form, and `/api/spaces/<single>/projects` covers the
19
+ // `/spaces/{slug-or-id}` form. The shared glob engine treats `*` as a single
20
+ // segment, so both patterns are needed.
21
+ //
22
+ // Pattern syntax is the shared `compilePathGlob` engine — `*` matches one
23
+ // segment, `**` matches across segments. Patterns are anchored to the full
24
+ // path: `/api/projects` does NOT match `/api/projects/Projects-1`; use
25
+ // `/api/projects/**` for the latter.
26
+ //
27
+ // The allowlist is deliberately conservative at launch — it enumerates paths
28
+ // the existing curated tools already cover plus the obvious neighbours.
29
+ // Expand based on real usage; do not pre-emptively enumerate every Octopus
30
+ // endpoint up front.
31
+ import {} from "../types/toolConfig.js";
32
+ import { pathMatchesGlob } from "./pathGlob.js";
33
+ /**
34
+ * Helper: produce the two prefix forms for a space-scoped path suffix.
35
+ * spacePrefixed("projects") → ["/api/* /projects", "/api/spaces/* /projects"]
36
+ * Returns the bare endpoint and the wildcard sub-path variants for both.
37
+ */
38
+ function spaceScoped(suffix) {
39
+ return [
40
+ `/api/*/${suffix}`,
41
+ `/api/*/${suffix}/**`,
42
+ `/api/spaces/*/${suffix}`,
43
+ `/api/spaces/*/${suffix}/**`,
44
+ ];
45
+ }
46
+ const TOOLSET_PATH_PATTERNS = {
47
+ core: [
48
+ "/api",
49
+ "/api/users/me",
50
+ "/api/users/me/permissions/**",
51
+ "/api/spaces",
52
+ // Top-level Space metadata only — single segment after `/api/spaces`.
53
+ // Per-resource paths beneath a space (`/api/spaces/{id}/projects`, etc.)
54
+ // are NOT in core; they live under their owning toolset.
55
+ "/api/spaces/*",
56
+ "/api/serverstatus/**",
57
+ "/api/experimental/**",
58
+ ],
59
+ projects: [
60
+ ...spaceScoped("projects"),
61
+ ...spaceScoped("projectgroups"),
62
+ ...spaceScoped("lifecycles"),
63
+ ],
64
+ deployments: [
65
+ ...spaceScoped("deployments"),
66
+ ...spaceScoped("deploymentprocesses"),
67
+ ...spaceScoped("dashboard"),
68
+ ],
69
+ releases: [
70
+ ...spaceScoped("releases"),
71
+ ...spaceScoped("channels"),
72
+ ],
73
+ runbooks: [
74
+ ...spaceScoped("runbooks"),
75
+ ...spaceScoped("runbookruns"),
76
+ ...spaceScoped("runbookprocesses"),
77
+ ...spaceScoped("runbooksnapshots"),
78
+ ],
79
+ tasks: ["/api/tasks", "/api/tasks/**"],
80
+ tenants: [
81
+ ...spaceScoped("tenants"),
82
+ ...spaceScoped("tenantvariables"),
83
+ ],
84
+ kubernetes: [
85
+ "/api/*/machines/*/livestatus/**",
86
+ "/api/*/machines/*/connection/**",
87
+ "/api/spaces/*/machines/*/livestatus/**",
88
+ "/api/spaces/*/machines/*/connection/**",
89
+ ],
90
+ machines: [
91
+ ...spaceScoped("machines"),
92
+ ...spaceScoped("workers"),
93
+ ...spaceScoped("workerpools"),
94
+ ],
95
+ context: [
96
+ ...spaceScoped("environments"),
97
+ ...spaceScoped("variables"),
98
+ ],
99
+ certificates: [
100
+ ...spaceScoped("certificates"),
101
+ ],
102
+ accounts: [
103
+ ...spaceScoped("accounts"),
104
+ ],
105
+ interruptions: [
106
+ ...spaceScoped("interruptions"),
107
+ ],
108
+ featureToggles: [
109
+ // Customer feature toggles are project-scoped, so the paths nest under
110
+ // /projects/*/featuretoggles rather than directly under the space. The
111
+ // `projects` toolset's `/api/*/projects/**` wildcard ALSO matches these,
112
+ // but the most-specific-match-wins logic in matchPath/findOwningToolset
113
+ // (below) attributes them to `featureToggles` because these patterns
114
+ // have more literal segments. So disabling `featureToggles` is a real
115
+ // kill switch — the path becomes unreachable through `execute` even
116
+ // when `projects` is still enabled.
117
+ "/api/*/projects/*/featuretoggles",
118
+ "/api/*/projects/*/featuretoggles/**",
119
+ "/api/spaces/*/projects/*/featuretoggles",
120
+ "/api/spaces/*/projects/*/featuretoggles/**",
121
+ ],
122
+ };
123
+ // Specificity = count of literal (non-wildcard) segments in the pattern.
124
+ // "/api/<wildcard>/projects/<doublewildcard>" has 2 literal segments
125
+ // (api, projects). "/api/<wildcard>/projects/<wildcard>/featuretoggles"
126
+ // has 3 (api, projects, featuretoggles). The more-literal pattern wins
127
+ // ownership when multiple toolsets claim the same path. This makes nested
128
+ // concerns (feature toggles under projects, kubernetes live-status under
129
+ // machines) into real kill switches rather than honour-system overlays.
130
+ function patternSpecificity(pattern) {
131
+ return pattern
132
+ .split("/")
133
+ .filter((seg) => seg.length > 0 && seg !== "*" && seg !== "**").length;
134
+ }
135
+ /**
136
+ * Find which toolset owns `path`. Most-specific-match-wins: if multiple
137
+ * toolsets have patterns matching the path, the toolset whose pattern has
138
+ * more literal segments wins ownership. Returns undefined if no toolset
139
+ * claims the path at all.
140
+ *
141
+ * This is the basis for both `matchPath` (allowlist enforcement) and the
142
+ * "which toolset do I need to enable?" error message in `execute`.
143
+ */
144
+ export function findOwningToolset(path) {
145
+ let best = null;
146
+ for (const toolset of Object.keys(TOOLSET_PATH_PATTERNS)) {
147
+ for (const pattern of TOOLSET_PATH_PATTERNS[toolset]) {
148
+ if (!pathMatchesGlob(path, pattern))
149
+ continue;
150
+ const specificity = patternSpecificity(pattern);
151
+ if (!best || specificity > best.specificity) {
152
+ best = { toolset, specificity };
153
+ }
154
+ }
155
+ }
156
+ return best?.toolset;
157
+ }
158
+ /**
159
+ * Check whether `path` falls under the allowlist given which toolsets are
160
+ * currently enabled. The `core` toolset is implicitly always enabled.
161
+ *
162
+ * The owning toolset (most-specific match) must be the one enabled — a
163
+ * less-specific toolset whose wildcard happens to also match cannot shadow
164
+ * a disabled, more-specific owner. So `featureToggles` paths require the
165
+ * `featureToggles` toolset, even when `projects` (whose `/projects/**`
166
+ * wildcard also matches) is enabled.
167
+ */
168
+ export function matchPath(path, enabledToolsets) {
169
+ const owner = findOwningToolset(path);
170
+ if (!owner)
171
+ return { matched: false };
172
+ const isEnabled = owner === "core" || enabledToolsets.includes(owner);
173
+ return isEnabled
174
+ ? { matched: true, toolset: owner }
175
+ : { matched: false, toolset: owner };
176
+ }
177
+ //# sourceMappingURL=pathAllowlist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathAllowlist.js","sourceRoot":"","sources":["../../src/helpers/pathAllowlist.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,sEAAsE;AACtE,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,EAAE;AACF,sEAAsE;AACtE,6EAA6E;AAC7E,uEAAuE;AACvE,wEAAwE;AACxE,6EAA6E;AAC7E,mCAAmC;AACnC,EAAE;AACF,sEAAsE;AACtE,+EAA+E;AAC/E,mEAAmE;AACnE,qEAAqE;AACrE,6EAA6E;AAC7E,wCAAwC;AACxC,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,uEAAuE;AACvE,qCAAqC;AACrC,EAAE;AACF,6EAA6E;AAC7E,wEAAwE;AACxE,2EAA2E;AAC3E,qBAAqB;AAErB,OAAO,EAAgB,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;GAIG;AACH,SAAS,WAAW,CAAC,MAAc;IACjC,OAAO;QACL,UAAU,MAAM,EAAE;QAClB,UAAU,MAAM,KAAK;QACrB,iBAAiB,MAAM,EAAE;QACzB,iBAAiB,MAAM,KAAK;KAC7B,CAAC;AACJ,CAAC;AAED,MAAM,qBAAqB,GAAuC;IAChE,IAAI,EAAE;QACJ,MAAM;QACN,eAAe;QACf,8BAA8B;QAC9B,aAAa;QACb,sEAAsE;QACtE,yEAAyE;QACzE,yDAAyD;QACzD,eAAe;QACf,sBAAsB;QACtB,sBAAsB;KACvB;IACD,QAAQ,EAAE;QACR,GAAG,WAAW,CAAC,UAAU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AAM,SAAS,GAAG,KAAK,KAAK,MAAM,IAAI,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtE,OAAO,SAAS;QACd,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;QACnC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACzC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Tiny safe glob engine for matching Octopus REST paths in the `execute`
3
+ * tool's allowlist and sensitive denylist. Two wildcard tokens:
4
+ *
5
+ * - `*` matches a single path segment (no `/` allowed)
6
+ * - `**` matches any sequence of characters, including `/`
7
+ *
8
+ * Every other character is treated literally — regex metacharacters are
9
+ * escaped at compile time, so denylist and allowlist entries cannot be turned
10
+ * into regex injection by a clever path. Patterns are anchored to the full
11
+ * input via `^…$`, so `/api/projects` does NOT match `/api/projects/Projects-1`.
12
+ */
13
+ export declare function compilePathGlob(pattern: string): RegExp;
14
+ export declare function pathMatchesGlob(path: string, pattern: string): boolean;
15
+ //# sourceMappingURL=pathGlob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathGlob.d.ts","sourceRoot":"","sources":["../../src/helpers/pathGlob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA6BvD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Tiny safe glob engine for matching Octopus REST paths in the `execute`
3
+ * tool's allowlist and sensitive denylist. Two wildcard tokens:
4
+ *
5
+ * - `*` matches a single path segment (no `/` allowed)
6
+ * - `**` matches any sequence of characters, including `/`
7
+ *
8
+ * Every other character is treated literally — regex metacharacters are
9
+ * escaped at compile time, so denylist and allowlist entries cannot be turned
10
+ * into regex injection by a clever path. Patterns are anchored to the full
11
+ * input via `^…$`, so `/api/projects` does NOT match `/api/projects/Projects-1`.
12
+ */
13
+ const COMPILED = new Map();
14
+ export function compilePathGlob(pattern) {
15
+ const cached = COMPILED.get(pattern);
16
+ if (cached)
17
+ return cached;
18
+ let regexSource = "";
19
+ let i = 0;
20
+ while (i < pattern.length) {
21
+ const ch = pattern[i];
22
+ if (ch === "*") {
23
+ if (pattern[i + 1] === "*") {
24
+ regexSource += ".*";
25
+ i += 2;
26
+ continue;
27
+ }
28
+ regexSource += "[^/]+";
29
+ i += 1;
30
+ continue;
31
+ }
32
+ if (/[.+?^${}()|[\]\\]/.test(ch)) {
33
+ regexSource += "\\" + ch;
34
+ }
35
+ else {
36
+ regexSource += ch;
37
+ }
38
+ i += 1;
39
+ }
40
+ const compiled = new RegExp("^" + regexSource + "$");
41
+ COMPILED.set(pattern, compiled);
42
+ return compiled;
43
+ }
44
+ export function pathMatchesGlob(path, pattern) {
45
+ return compilePathGlob(pattern).test(path);
46
+ }
47
+ //# sourceMappingURL=pathGlob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathGlob.js","sourceRoot":"","sources":["../../src/helpers/pathGlob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;AAE3C,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;YACf,IAAI,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;gBAC3B,WAAW,IAAI,IAAI,CAAC;gBACpB,CAAC,IAAI,CAAC,CAAC;gBACP,SAAS;YACX,CAAC;YACD,WAAW,IAAI,OAAO,CAAC;YACvB,CAAC,IAAI,CAAC,CAAC;YACP,SAAS;QACX,CAAC;QACD,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YACjC,WAAW,IAAI,IAAI,GAAG,EAAE,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,WAAW,IAAI,EAAE,CAAC;QACpB,CAAC;QACD,CAAC,IAAI,CAAC,CAAC;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,WAAW,GAAG,GAAG,CAAC,CAAC;IACrD,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,OAAe;IAC3D,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,119 @@
1
+ import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export interface RequireConfirmationOptions {
3
+ /** Human-readable summary of what will happen, shown to the user. */
4
+ message: string;
5
+ /**
6
+ * Yes/no value from the calling tool's own args. Used only when the client
7
+ * does not advertise elicitation capability. Tool input schemas should add
8
+ * `confirm: z.boolean().optional()` and pass it through here.
9
+ *
10
+ * Resolution when the elicitation capability is absent:
11
+ * - `true` → confirmed (the LLM asserts the user approved out-of-band)
12
+ * - `false` → declined (the LLM asserts the user said no out-of-band)
13
+ * - `undefined`→ confirmationRequired (the user hasn't been asked yet — the
14
+ * caller should report this back to the LLM as a hard error
15
+ * so it asks the user before retrying)
16
+ */
17
+ fallbackConfirm?: boolean;
18
+ /**
19
+ * Optional structured before/after view of the operation. Rendered as a
20
+ * key-level diff (with `+` / `-` markers) and appended to `message`, so the
21
+ * user sees exactly what's changing — including modifiers like scheduled
22
+ * run time, skipped steps, machine filters, prompted variables, and
23
+ * deployment-freeze overrides that don't fit the prose summary.
24
+ *
25
+ * - Create operations: pass `{ source: {}, target: <command body> }`. Every
26
+ * target field renders as a `+` line (everything is being added).
27
+ * - Modify operations: `source` is the current state; `target` is the
28
+ * proposed state. Only keys whose values differ appear in the output.
29
+ *
30
+ * Kept inside `message` rather than surfaced as a `requestedSchema` so the
31
+ * rendering is identical across clients regardless of which elicitation
32
+ * modes they support.
33
+ */
34
+ change?: {
35
+ source: Record<string, unknown>;
36
+ target: Record<string, unknown>;
37
+ };
38
+ }
39
+ /**
40
+ * Why the helper resolved the way it did. Tools branch on this so the LLM
41
+ * (and any humans reading logs) can tell an explicit user "no" apart from a
42
+ * confirmation that was never reachable in the first place.
43
+ */
44
+ export type ConfirmationReason =
45
+ /** OCTOPUS_SKIP_ELICITATION=true bypass. */
46
+ "envSkip"
47
+ /** User clicked Accept on the elicitation prompt. */
48
+ | "accepted"
49
+ /** Caller passed fallbackConfirm: true (no elicitation capability). */
50
+ | "fallbackConfirm"
51
+ /** User clicked Decline on the elicitation prompt, or fallbackConfirm was explicitly false. */
52
+ | "declined"
53
+ /** User dismissed the elicitation prompt without choosing. */
54
+ | "cancelled"
55
+ /**
56
+ * Client does not advertise elicitation capability AND fallbackConfirm was
57
+ * not provided. The user has NOT been asked. Tools should surface this as a
58
+ * hard error and tell the LLM to ask the user before retrying.
59
+ */
60
+ | "confirmationRequired";
61
+ export type ConfirmationResult = {
62
+ confirmed: true;
63
+ reason: "envSkip" | "accepted" | "fallbackConfirm";
64
+ } | {
65
+ confirmed: false;
66
+ reason: "declined" | "cancelled" | "confirmationRequired";
67
+ };
68
+ /**
69
+ * Gate a write/destructive tool call on explicit user confirmation.
70
+ *
71
+ * Resolution order:
72
+ * 1. `OCTOPUS_SKIP_ELICITATION=true` env var → bypass (automation/CI).
73
+ * 2. Client advertises elicitation capability → SDK emits `elicitation/create`
74
+ * and we map `result.action` to accepted/declined/cancelled.
75
+ * 3. Client does not advertise elicitation → fall back to the `confirm` arg
76
+ * the tool surfaced in its own input schema. Distinguishes between
77
+ * explicit `false` (declined) and missing (confirmationRequired) so the
78
+ * caller can surface the latter as a hard error.
79
+ */
80
+ export declare function requireConfirmation(server: McpServer, opts: RequireConfirmationOptions): Promise<ConfirmationResult>;
81
+ export interface UnconfirmedResponseOptions {
82
+ /**
83
+ * Lowercase noun phrase describing the gated action — e.g. "release
84
+ * creation", "deployment", "runbook run". Embedded mid-sentence in the
85
+ * `confirmationRequired` message and capitalized for the cancelled message.
86
+ */
87
+ action: string;
88
+ }
89
+ /**
90
+ * Build the standard tool response for a non-confirmed gate result.
91
+ *
92
+ * - `confirmationRequired` → `isError: true` with directive prose telling the
93
+ * LLM to ask the user before retrying with `confirm: true`. This is the
94
+ * "user was never asked" branch — distinct from a real cancellation, and
95
+ * marked as an error so the LLM doesn't paper over it.
96
+ * - `declined` / `cancelled` → soft cancellation shape with the original
97
+ * reason preserved for telemetry.
98
+ *
99
+ * Centralized here so every gated tool produces identical responses; the only
100
+ * thing a caller varies is the `action` noun. Return type is inferred so it
101
+ * stays compatible with the SDK's tool-handler return shape (which carries an
102
+ * `[key: string]: unknown` index signature we don't want to redeclare).
103
+ */
104
+ export declare function unconfirmedResponse(result: Extract<ConfirmationResult, {
105
+ confirmed: false;
106
+ }>, opts: UnconfirmedResponseOptions): {
107
+ content: {
108
+ type: "text";
109
+ text: string;
110
+ }[];
111
+ isError: boolean;
112
+ } | {
113
+ content: {
114
+ type: "text";
115
+ text: string;
116
+ }[];
117
+ isError?: undefined;
118
+ };
119
+ //# sourceMappingURL=requireConfirmation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requireConfirmation.d.ts","sourceRoot":"","sources":["../../src/helpers/requireConfirmation.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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