@ffschrattenecker/tm1-mcp-server 6.0.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 (475) hide show
  1. package/CHANGELOG.md +1211 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +34 -0
  4. package/README.md +276 -0
  5. package/dist/config.d.ts +35 -0
  6. package/dist/config.js +238 -0
  7. package/dist/http-transport.d.ts +8 -0
  8. package/dist/http-transport.js +132 -0
  9. package/dist/index.d.ts +18 -0
  10. package/dist/index.js +164 -0
  11. package/dist/lib/callgraph/callGraph.d.ts +124 -0
  12. package/dist/lib/callgraph/callGraph.js +334 -0
  13. package/dist/lib/callgraph/choreGraph.d.ts +23 -0
  14. package/dist/lib/callgraph/choreGraph.js +102 -0
  15. package/dist/lib/callgraph/dataFlow.d.ts +74 -0
  16. package/dist/lib/callgraph/dataFlow.js +271 -0
  17. package/dist/lib/callgraph/datasourceMembership.d.ts +31 -0
  18. package/dist/lib/callgraph/datasourceMembership.js +142 -0
  19. package/dist/lib/callgraph/lintTypes.d.ts +28 -0
  20. package/dist/lib/callgraph/lintTypes.js +2 -0
  21. package/dist/lib/callgraph/mdxMembers.d.ts +29 -0
  22. package/dist/lib/callgraph/mdxMembers.js +97 -0
  23. package/dist/lib/callgraph/referenceIndex.d.ts +179 -0
  24. package/dist/lib/callgraph/referenceIndex.js +584 -0
  25. package/dist/lib/callgraph/rulesLinter.d.ts +55 -0
  26. package/dist/lib/callgraph/rulesLinter.js +776 -0
  27. package/dist/lib/callgraph/rulesParser.d.ts +26 -0
  28. package/dist/lib/callgraph/rulesParser.js +71 -0
  29. package/dist/lib/callgraph/subsetUsage.d.ts +16 -0
  30. package/dist/lib/callgraph/subsetUsage.js +134 -0
  31. package/dist/lib/callgraph/tiParser.d.ts +21 -0
  32. package/dist/lib/callgraph/tiParser.js +672 -0
  33. package/dist/lib/callgraph/tiSignatures.d.ts +32 -0
  34. package/dist/lib/callgraph/tiSignatures.js +6185 -0
  35. package/dist/lib/callgraph/tm1-adapter.d.ts +32 -0
  36. package/dist/lib/callgraph/tm1-adapter.js +159 -0
  37. package/dist/lib/callgraph/types.d.ts +53 -0
  38. package/dist/lib/callgraph/types.js +2 -0
  39. package/dist/lib/callgraph/variableEnv.d.ts +86 -0
  40. package/dist/lib/callgraph/variableEnv.js +214 -0
  41. package/dist/lib/cell-address.d.ts +12 -0
  42. package/dist/lib/cell-address.js +71 -0
  43. package/dist/lib/complexity/antipatterns.d.ts +22 -0
  44. package/dist/lib/complexity/antipatterns.js +302 -0
  45. package/dist/lib/complexity/comment-classifier.d.ts +24 -0
  46. package/dist/lib/complexity/comment-classifier.js +43 -0
  47. package/dist/lib/complexity/cross-process.d.ts +78 -0
  48. package/dist/lib/complexity/cross-process.js +114 -0
  49. package/dist/lib/complexity/process-metrics.d.ts +78 -0
  50. package/dist/lib/complexity/process-metrics.js +278 -0
  51. package/dist/lib/complexity/rules-metrics.d.ts +31 -0
  52. package/dist/lib/complexity/rules-metrics.js +99 -0
  53. package/dist/lib/concurrency.d.ts +11 -0
  54. package/dist/lib/concurrency.js +27 -0
  55. package/dist/lib/control-name.d.ts +10 -0
  56. package/dist/lib/control-name.js +10 -0
  57. package/dist/lib/coordinate-error.d.ts +3 -0
  58. package/dist/lib/coordinate-error.js +29 -0
  59. package/dist/lib/credential-format.d.ts +23 -0
  60. package/dist/lib/credential-format.js +25 -0
  61. package/dist/lib/cube-stats/fetcher.d.ts +106 -0
  62. package/dist/lib/cube-stats/fetcher.js +194 -0
  63. package/dist/lib/feeders/brackets.d.ts +47 -0
  64. package/dist/lib/feeders/brackets.js +195 -0
  65. package/dist/lib/feeders/element-type-cache.d.ts +42 -0
  66. package/dist/lib/feeders/element-type-cache.js +86 -0
  67. package/dist/lib/feeders/static-heuristics.d.ts +101 -0
  68. package/dist/lib/feeders/static-heuristics.js +202 -0
  69. package/dist/lib/git-process.d.ts +67 -0
  70. package/dist/lib/git-process.js +243 -0
  71. package/dist/lib/mask-secrets.d.ts +10 -0
  72. package/dist/lib/mask-secrets.js +99 -0
  73. package/dist/lib/mdx.d.ts +3 -0
  74. package/dist/lib/mdx.js +13 -0
  75. package/dist/lib/naming/odata-filter.d.ts +15 -0
  76. package/dist/lib/naming/odata-filter.js +81 -0
  77. package/dist/lib/naming/rules.d.ts +34 -0
  78. package/dist/lib/naming/rules.js +215 -0
  79. package/dist/lib/pro-parser.d.ts +19 -0
  80. package/dist/lib/pro-parser.js +260 -0
  81. package/dist/lib/pro-serializer.d.ts +19 -0
  82. package/dist/lib/pro-serializer.js +170 -0
  83. package/dist/lib/process-parts-schema.d.ts +45 -0
  84. package/dist/lib/process-parts-schema.js +46 -0
  85. package/dist/lib/process-refs.d.ts +88 -0
  86. package/dist/lib/process-refs.js +441 -0
  87. package/dist/lib/rules-outline.d.ts +29 -0
  88. package/dist/lib/rules-outline.js +68 -0
  89. package/dist/lib/rules-patch.d.ts +6 -0
  90. package/dist/lib/rules-patch.js +59 -0
  91. package/dist/lib/safe-regex.d.ts +15 -0
  92. package/dist/lib/safe-regex.js +37 -0
  93. package/dist/lib/sample-cells.d.ts +48 -0
  94. package/dist/lib/sample-cells.js +146 -0
  95. package/dist/lib/slim-json-schema.d.ts +20 -0
  96. package/dist/lib/slim-json-schema.js +68 -0
  97. package/dist/lib/strip-comments.d.ts +23 -0
  98. package/dist/lib/strip-comments.js +61 -0
  99. package/dist/lib/tm1-events.d.ts +16 -0
  100. package/dist/lib/tm1-events.js +29 -0
  101. package/dist/lib/v12-compat/deprecated-ti.d.ts +17 -0
  102. package/dist/lib/v12-compat/deprecated-ti.js +257 -0
  103. package/dist/lib/v12-compat/scanner.d.ts +10 -0
  104. package/dist/lib/v12-compat/scanner.js +43 -0
  105. package/dist/lib/variables-ui-data.d.ts +26 -0
  106. package/dist/lib/variables-ui-data.js +77 -0
  107. package/dist/load-env.d.ts +2 -0
  108. package/dist/load-env.js +29 -0
  109. package/dist/logger.d.ts +4 -0
  110. package/dist/logger.js +60 -0
  111. package/dist/prompts/index.d.ts +3 -0
  112. package/dist/prompts/index.js +141 -0
  113. package/dist/resources/index.d.ts +5 -0
  114. package/dist/resources/index.js +237 -0
  115. package/dist/resources/list-handler.d.ts +40 -0
  116. package/dist/resources/list-handler.js +86 -0
  117. package/dist/resources/subscriptions.d.ts +19 -0
  118. package/dist/resources/subscriptions.js +80 -0
  119. package/dist/schemas/cells.d.ts +17 -0
  120. package/dist/schemas/cells.js +13 -0
  121. package/dist/schemas/common.d.ts +16 -0
  122. package/dist/schemas/common.js +14 -0
  123. package/dist/schemas/index.d.ts +10 -0
  124. package/dist/schemas/index.js +23 -0
  125. package/dist/schemas/metadata.d.ts +70 -0
  126. package/dist/schemas/metadata.js +47 -0
  127. package/dist/schemas/monitoring.d.ts +95 -0
  128. package/dist/schemas/monitoring.js +69 -0
  129. package/dist/schemas/processes.d.ts +74 -0
  130. package/dist/schemas/processes.js +66 -0
  131. package/dist/schemas/scheduling.d.ts +13 -0
  132. package/dist/schemas/scheduling.js +13 -0
  133. package/dist/schemas/security.d.ts +19 -0
  134. package/dist/schemas/security.js +16 -0
  135. package/dist/schemas/subsets.d.ts +12 -0
  136. package/dist/schemas/subsets.js +12 -0
  137. package/dist/schemas/views.d.ts +9 -0
  138. package/dist/schemas/views.js +9 -0
  139. package/dist/session-manager.d.ts +79 -0
  140. package/dist/session-manager.js +281 -0
  141. package/dist/tm1-client/connection/profile.d.ts +13 -0
  142. package/dist/tm1-client/connection/profile.js +99 -0
  143. package/dist/tm1-client/dispatcher.d.ts +5 -0
  144. package/dist/tm1-client/dispatcher.js +31 -0
  145. package/dist/tm1-client/http.d.ts +81 -0
  146. package/dist/tm1-client/http.js +547 -0
  147. package/dist/tm1-client/services/batch-service.d.ts +123 -0
  148. package/dist/tm1-client/services/batch-service.js +455 -0
  149. package/dist/tm1-client/services/cell-service.d.ts +71 -0
  150. package/dist/tm1-client/services/cell-service.js +333 -0
  151. package/dist/tm1-client/services/cellset-transform.d.ts +26 -0
  152. package/dist/tm1-client/services/cellset-transform.js +80 -0
  153. package/dist/tm1-client/services/chore-service.d.ts +68 -0
  154. package/dist/tm1-client/services/chore-service.js +179 -0
  155. package/dist/tm1-client/services/chore-status.d.ts +11 -0
  156. package/dist/tm1-client/services/chore-status.js +127 -0
  157. package/dist/tm1-client/services/cube-service.d.ts +134 -0
  158. package/dist/tm1-client/services/cube-service.js +294 -0
  159. package/dist/tm1-client/services/dimension-service.d.ts +118 -0
  160. package/dist/tm1-client/services/dimension-service.js +249 -0
  161. package/dist/tm1-client/services/element-service.d.ts +245 -0
  162. package/dist/tm1-client/services/element-service.js +809 -0
  163. package/dist/tm1-client/services/fallback.d.ts +44 -0
  164. package/dist/tm1-client/services/fallback.js +72 -0
  165. package/dist/tm1-client/services/file-service.d.ts +53 -0
  166. package/dist/tm1-client/services/file-service.js +218 -0
  167. package/dist/tm1-client/services/hierarchy-service.d.ts +129 -0
  168. package/dist/tm1-client/services/hierarchy-service.js +332 -0
  169. package/dist/tm1-client/services/monitoring-service.d.ts +34 -0
  170. package/dist/tm1-client/services/monitoring-service.js +123 -0
  171. package/dist/tm1-client/services/odata-page.d.ts +71 -0
  172. package/dist/tm1-client/services/odata-page.js +87 -0
  173. package/dist/tm1-client/services/process-service.d.ts +278 -0
  174. package/dist/tm1-client/services/process-service.js +874 -0
  175. package/dist/tm1-client/services/process-status.d.ts +21 -0
  176. package/dist/tm1-client/services/process-status.js +89 -0
  177. package/dist/tm1-client/services/security-service.d.ts +50 -0
  178. package/dist/tm1-client/services/security-service.js +93 -0
  179. package/dist/tm1-client/services/server-service.d.ts +116 -0
  180. package/dist/tm1-client/services/server-service.js +504 -0
  181. package/dist/tm1-client/services/subset-service.d.ts +37 -0
  182. package/dist/tm1-client/services/subset-service.js +122 -0
  183. package/dist/tm1-client/services/view-service.d.ts +46 -0
  184. package/dist/tm1-client/services/view-service.js +287 -0
  185. package/dist/tm1-client.d.ts +56 -0
  186. package/dist/tm1-client.js +126 -0
  187. package/dist/tools/analysis/analyze-callgraph.d.ts +28 -0
  188. package/dist/tools/analysis/analyze-callgraph.js +350 -0
  189. package/dist/tools/analysis/analyze-chore-graph.d.ts +2 -0
  190. package/dist/tools/analysis/analyze-chore-graph.js +148 -0
  191. package/dist/tools/analysis/analyze-object-usage.d.ts +2 -0
  192. package/dist/tools/analysis/analyze-object-usage.js +143 -0
  193. package/dist/tools/analysis/audit-complexity.d.ts +2 -0
  194. package/dist/tools/analysis/audit-complexity.js +255 -0
  195. package/dist/tools/analysis/audit-feeders.d.ts +2 -0
  196. package/dist/tools/analysis/audit-feeders.js +417 -0
  197. package/dist/tools/analysis/audit-naming.d.ts +2 -0
  198. package/dist/tools/analysis/audit-naming.js +379 -0
  199. package/dist/tools/analysis/check-v12-readiness.d.ts +2 -0
  200. package/dist/tools/analysis/check-v12-readiness.js +136 -0
  201. package/dist/tools/analysis/find-orphan-dimensions.d.ts +2 -0
  202. package/dist/tools/analysis/find-orphan-dimensions.js +55 -0
  203. package/dist/tools/analysis/invalidate-callgraph-cache.d.ts +2 -0
  204. package/dist/tools/analysis/invalidate-callgraph-cache.js +40 -0
  205. package/dist/tools/analysis/trace-data-flow.d.ts +2 -0
  206. package/dist/tools/analysis/trace-data-flow.js +138 -0
  207. package/dist/tools/annotations.d.ts +12 -0
  208. package/dist/tools/annotations.js +61 -0
  209. package/dist/tools/celldata/check-feeders.d.ts +2 -0
  210. package/dist/tools/celldata/check-feeders.js +48 -0
  211. package/dist/tools/celldata/check-writable-coords.d.ts +2 -0
  212. package/dist/tools/celldata/check-writable-coords.js +126 -0
  213. package/dist/tools/celldata/execute-mdx.d.ts +17 -0
  214. package/dist/tools/celldata/execute-mdx.js +126 -0
  215. package/dist/tools/celldata/get-cell-value.d.ts +2 -0
  216. package/dist/tools/celldata/get-cell-value.js +30 -0
  217. package/dist/tools/celldata/get-view-definition.d.ts +2 -0
  218. package/dist/tools/celldata/get-view-definition.js +29 -0
  219. package/dist/tools/celldata/get-view.d.ts +2 -0
  220. package/dist/tools/celldata/get-view.js +55 -0
  221. package/dist/tools/celldata/sample-cells.d.ts +2 -0
  222. package/dist/tools/celldata/sample-cells.js +101 -0
  223. package/dist/tools/celldata/trace-cell-calculation.d.ts +2 -0
  224. package/dist/tools/celldata/trace-cell-calculation.js +53 -0
  225. package/dist/tools/celldata/trace-feeders.d.ts +2 -0
  226. package/dist/tools/celldata/trace-feeders.js +44 -0
  227. package/dist/tools/celldata/write-cells.d.ts +2 -0
  228. package/dist/tools/celldata/write-cells.js +65 -0
  229. package/dist/tools/confirm.d.ts +10 -0
  230. package/dist/tools/confirm.js +64 -0
  231. package/dist/tools/define-tool.d.ts +51 -0
  232. package/dist/tools/define-tool.js +49 -0
  233. package/dist/tools/dimension-management/bulk-upsert-elements.d.ts +2 -0
  234. package/dist/tools/dimension-management/bulk-upsert-elements.js +103 -0
  235. package/dist/tools/dimension-management/create-dimension.d.ts +2 -0
  236. package/dist/tools/dimension-management/create-dimension.js +22 -0
  237. package/dist/tools/dimension-management/create-element-attribute.d.ts +2 -0
  238. package/dist/tools/dimension-management/create-element-attribute.js +26 -0
  239. package/dist/tools/dimension-management/create-element.d.ts +2 -0
  240. package/dist/tools/dimension-management/create-element.js +31 -0
  241. package/dist/tools/dimension-management/create-hierarchy.d.ts +2 -0
  242. package/dist/tools/dimension-management/create-hierarchy.js +22 -0
  243. package/dist/tools/dimension-management/delete-dimension.d.ts +2 -0
  244. package/dist/tools/dimension-management/delete-dimension.js +25 -0
  245. package/dist/tools/dimension-management/delete-element.d.ts +2 -0
  246. package/dist/tools/dimension-management/delete-element.js +26 -0
  247. package/dist/tools/dimension-management/delete-elements.d.ts +2 -0
  248. package/dist/tools/dimension-management/delete-elements.js +44 -0
  249. package/dist/tools/dimension-management/delete-hierarchy.d.ts +2 -0
  250. package/dist/tools/dimension-management/delete-hierarchy.js +35 -0
  251. package/dist/tools/dimension-management/get-element-attribute-values.d.ts +2 -0
  252. package/dist/tools/dimension-management/get-element-attribute-values.js +77 -0
  253. package/dist/tools/dimension-management/list-element-attributes.d.ts +2 -0
  254. package/dist/tools/dimension-management/list-element-attributes.js +31 -0
  255. package/dist/tools/dimension-management/move-element.d.ts +2 -0
  256. package/dist/tools/dimension-management/move-element.js +28 -0
  257. package/dist/tools/dimension-management/update-element-attribute-value.d.ts +2 -0
  258. package/dist/tools/dimension-management/update-element-attribute-value.js +80 -0
  259. package/dist/tools/dimension-management/update-element.d.ts +2 -0
  260. package/dist/tools/dimension-management/update-element.js +35 -0
  261. package/dist/tools/error-format.d.ts +22 -0
  262. package/dist/tools/error-format.js +130 -0
  263. package/dist/tools/fileops/delete-file.d.ts +2 -0
  264. package/dist/tools/fileops/delete-file.js +32 -0
  265. package/dist/tools/fileops/get-file-content.d.ts +2 -0
  266. package/dist/tools/fileops/get-file-content.js +76 -0
  267. package/dist/tools/fileops/list-files.d.ts +2 -0
  268. package/dist/tools/fileops/list-files.js +43 -0
  269. package/dist/tools/fileops/search-files.d.ts +2 -0
  270. package/dist/tools/fileops/search-files.js +76 -0
  271. package/dist/tools/fileops/upload-file.d.ts +2 -0
  272. package/dist/tools/fileops/upload-file.js +69 -0
  273. package/dist/tools/format.d.ts +57 -0
  274. package/dist/tools/format.js +157 -0
  275. package/dist/tools/hierarchy.d.ts +6 -0
  276. package/dist/tools/hierarchy.js +27 -0
  277. package/dist/tools/index.d.ts +4 -0
  278. package/dist/tools/index.js +263 -0
  279. package/dist/tools/local-file.d.ts +16 -0
  280. package/dist/tools/local-file.js +88 -0
  281. package/dist/tools/metadata/get-ancestors.d.ts +2 -0
  282. package/dist/tools/metadata/get-ancestors.js +36 -0
  283. package/dist/tools/metadata/get-descendants.d.ts +2 -0
  284. package/dist/tools/metadata/get-descendants.js +64 -0
  285. package/dist/tools/metadata/get-hierarchy.d.ts +2 -0
  286. package/dist/tools/metadata/get-hierarchy.js +130 -0
  287. package/dist/tools/metadata/list-chores.d.ts +2 -0
  288. package/dist/tools/metadata/list-chores.js +62 -0
  289. package/dist/tools/metadata/list-cubes.d.ts +2 -0
  290. package/dist/tools/metadata/list-cubes.js +128 -0
  291. package/dist/tools/metadata/list-dimensions.d.ts +2 -0
  292. package/dist/tools/metadata/list-dimensions.js +131 -0
  293. package/dist/tools/metadata/list-processes-grouped.d.ts +2 -0
  294. package/dist/tools/metadata/list-processes-grouped.js +96 -0
  295. package/dist/tools/metadata/list-processes.d.ts +2 -0
  296. package/dist/tools/metadata/list-processes.js +108 -0
  297. package/dist/tools/metadata/resolve-default-members.d.ts +2 -0
  298. package/dist/tools/metadata/resolve-default-members.js +46 -0
  299. package/dist/tools/model-building/check-cube-rule.d.ts +2 -0
  300. package/dist/tools/model-building/check-cube-rule.js +51 -0
  301. package/dist/tools/model-building/clear-cube.d.ts +2 -0
  302. package/dist/tools/model-building/clear-cube.js +46 -0
  303. package/dist/tools/model-building/create-cube.d.ts +2 -0
  304. package/dist/tools/model-building/create-cube.js +34 -0
  305. package/dist/tools/model-building/delete-cube.d.ts +2 -0
  306. package/dist/tools/model-building/delete-cube.js +27 -0
  307. package/dist/tools/model-building/get-all-cube-rules.d.ts +2 -0
  308. package/dist/tools/model-building/get-all-cube-rules.js +149 -0
  309. package/dist/tools/model-building/get-cube-rules.d.ts +2 -0
  310. package/dist/tools/model-building/get-cube-rules.js +69 -0
  311. package/dist/tools/model-building/rules-source.d.ts +21 -0
  312. package/dist/tools/model-building/rules-source.js +49 -0
  313. package/dist/tools/model-building/search-rules.d.ts +2 -0
  314. package/dist/tools/model-building/search-rules.js +132 -0
  315. package/dist/tools/model-building/set-cube-rules.d.ts +2 -0
  316. package/dist/tools/model-building/set-cube-rules.js +81 -0
  317. package/dist/tools/model-building/unload-cube.d.ts +2 -0
  318. package/dist/tools/model-building/unload-cube.js +23 -0
  319. package/dist/tools/operations/diagnose-process-error.d.ts +2 -0
  320. package/dist/tools/operations/diagnose-process-error.js +178 -0
  321. package/dist/tools/operations/error-log-helpers.d.ts +25 -0
  322. package/dist/tools/operations/error-log-helpers.js +57 -0
  323. package/dist/tools/operations/get-audit-log.d.ts +2 -0
  324. package/dist/tools/operations/get-audit-log.js +70 -0
  325. package/dist/tools/operations/get-cube-stats.d.ts +2 -0
  326. package/dist/tools/operations/get-cube-stats.js +107 -0
  327. package/dist/tools/operations/get-error-log-content.d.ts +2 -0
  328. package/dist/tools/operations/get-error-log-content.js +164 -0
  329. package/dist/tools/operations/get-jobs.d.ts +3 -0
  330. package/dist/tools/operations/get-jobs.js +51 -0
  331. package/dist/tools/operations/get-message-log.d.ts +2 -0
  332. package/dist/tools/operations/get-message-log.js +63 -0
  333. package/dist/tools/operations/get-server-info.d.ts +2 -0
  334. package/dist/tools/operations/get-server-info.js +180 -0
  335. package/dist/tools/operations/get-server-state.d.ts +2 -0
  336. package/dist/tools/operations/get-server-state.js +129 -0
  337. package/dist/tools/operations/get-sessions.d.ts +2 -0
  338. package/dist/tools/operations/get-sessions.js +76 -0
  339. package/dist/tools/operations/get-threads.d.ts +3 -0
  340. package/dist/tools/operations/get-threads.js +50 -0
  341. package/dist/tools/operations/get-transaction-log.d.ts +2 -0
  342. package/dist/tools/operations/get-transaction-log.js +63 -0
  343. package/dist/tools/operations/list-error-logs.d.ts +8 -0
  344. package/dist/tools/operations/list-error-logs.js +157 -0
  345. package/dist/tools/operations/save-data.d.ts +2 -0
  346. package/dist/tools/operations/save-data.js +50 -0
  347. package/dist/tools/pagination.d.ts +32 -0
  348. package/dist/tools/pagination.js +116 -0
  349. package/dist/tools/scheduling/create-chore.d.ts +2 -0
  350. package/dist/tools/scheduling/create-chore.js +93 -0
  351. package/dist/tools/scheduling/delete-chore.d.ts +2 -0
  352. package/dist/tools/scheduling/delete-chore.js +22 -0
  353. package/dist/tools/scheduling/execute-chore.d.ts +2 -0
  354. package/dist/tools/scheduling/execute-chore.js +52 -0
  355. package/dist/tools/scheduling/toggle-chore.d.ts +2 -0
  356. package/dist/tools/scheduling/toggle-chore.js +22 -0
  357. package/dist/tools/scheduling/update-chore.d.ts +2 -0
  358. package/dist/tools/scheduling/update-chore.js +71 -0
  359. package/dist/tools/schemas/common.d.ts +10 -0
  360. package/dist/tools/schemas/common.js +23 -0
  361. package/dist/tools/schemas/items-analysis.d.ts +394 -0
  362. package/dist/tools/schemas/items-analysis.js +419 -0
  363. package/dist/tools/schemas/items-cells.d.ts +70 -0
  364. package/dist/tools/schemas/items-cells.js +65 -0
  365. package/dist/tools/schemas/items-common.d.ts +18 -0
  366. package/dist/tools/schemas/items-common.js +39 -0
  367. package/dist/tools/schemas/items-fileops.d.ts +11 -0
  368. package/dist/tools/schemas/items-fileops.js +13 -0
  369. package/dist/tools/schemas/items-metadata.d.ts +262 -0
  370. package/dist/tools/schemas/items-metadata.js +184 -0
  371. package/dist/tools/schemas/items-monitoring.d.ts +79 -0
  372. package/dist/tools/schemas/items-monitoring.js +78 -0
  373. package/dist/tools/schemas/items-processes.d.ts +279 -0
  374. package/dist/tools/schemas/items-processes.js +235 -0
  375. package/dist/tools/schemas/items-scheduling.d.ts +25 -0
  376. package/dist/tools/schemas/items-scheduling.js +26 -0
  377. package/dist/tools/schemas/items-security.d.ts +19 -0
  378. package/dist/tools/schemas/items-security.js +12 -0
  379. package/dist/tools/schemas/items-subsets.d.ts +2 -0
  380. package/dist/tools/schemas/items-subsets.js +4 -0
  381. package/dist/tools/schemas/items-views.d.ts +38 -0
  382. package/dist/tools/schemas/items-views.js +26 -0
  383. package/dist/tools/schemas/items.d.ts +12 -0
  384. package/dist/tools/schemas/items.js +23 -0
  385. package/dist/tools/schemas/markdown-capable.d.ts +21 -0
  386. package/dist/tools/schemas/markdown-capable.js +58 -0
  387. package/dist/tools/schemas/output-schema.d.ts +24 -0
  388. package/dist/tools/schemas/output-schema.js +25 -0
  389. package/dist/tools/security/assign-client-group.d.ts +2 -0
  390. package/dist/tools/security/assign-client-group.js +20 -0
  391. package/dist/tools/security/create-client.d.ts +2 -0
  392. package/dist/tools/security/create-client.js +28 -0
  393. package/dist/tools/security/delete-client.d.ts +2 -0
  394. package/dist/tools/security/delete-client.js +22 -0
  395. package/dist/tools/security/get-client.d.ts +2 -0
  396. package/dist/tools/security/get-client.js +20 -0
  397. package/dist/tools/security/list-clients.d.ts +2 -0
  398. package/dist/tools/security/list-clients.js +86 -0
  399. package/dist/tools/security/list-groups.d.ts +2 -0
  400. package/dist/tools/security/list-groups.js +43 -0
  401. package/dist/tools/security/remove-client-group.d.ts +2 -0
  402. package/dist/tools/security/remove-client-group.js +27 -0
  403. package/dist/tools/security/update-client.d.ts +2 -0
  404. package/dist/tools/security/update-client.js +22 -0
  405. package/dist/tools/subsets/create-subset.d.ts +2 -0
  406. package/dist/tools/subsets/create-subset.js +44 -0
  407. package/dist/tools/subsets/delete-subset.d.ts +2 -0
  408. package/dist/tools/subsets/delete-subset.js +26 -0
  409. package/dist/tools/subsets/get-subset.d.ts +2 -0
  410. package/dist/tools/subsets/get-subset.js +29 -0
  411. package/dist/tools/subsets/list-subsets.d.ts +2 -0
  412. package/dist/tools/subsets/list-subsets.js +36 -0
  413. package/dist/tools/subsets/update-subset.d.ts +2 -0
  414. package/dist/tools/subsets/update-subset.js +33 -0
  415. package/dist/tools/ti-development/check-process-code.d.ts +2 -0
  416. package/dist/tools/ti-development/check-process-code.js +96 -0
  417. package/dist/tools/ti-development/compile-process.d.ts +2 -0
  418. package/dist/tools/ti-development/compile-process.js +32 -0
  419. package/dist/tools/ti-development/copy-process.d.ts +2 -0
  420. package/dist/tools/ti-development/copy-process.js +32 -0
  421. package/dist/tools/ti-development/delete-process.d.ts +2 -0
  422. package/dist/tools/ti-development/delete-process.js +26 -0
  423. package/dist/tools/ti-development/diff-process-with-file.d.ts +2 -0
  424. package/dist/tools/ti-development/diff-process-with-file.js +208 -0
  425. package/dist/tools/ti-development/diff-processes.d.ts +2 -0
  426. package/dist/tools/ti-development/diff-processes.js +312 -0
  427. package/dist/tools/ti-development/execute-process.d.ts +8 -0
  428. package/dist/tools/ti-development/execute-process.js +109 -0
  429. package/dist/tools/ti-development/export-process-to-git.d.ts +2 -0
  430. package/dist/tools/ti-development/export-process-to-git.js +113 -0
  431. package/dist/tools/ti-development/export-process-to-pro.d.ts +2 -0
  432. package/dist/tools/ti-development/export-process-to-pro.js +117 -0
  433. package/dist/tools/ti-development/get-all-processes-code.d.ts +2 -0
  434. package/dist/tools/ti-development/get-all-processes-code.js +131 -0
  435. package/dist/tools/ti-development/get-process-code.d.ts +2 -0
  436. package/dist/tools/ti-development/get-process-code.js +100 -0
  437. package/dist/tools/ti-development/get-process-datasource.d.ts +2 -0
  438. package/dist/tools/ti-development/get-process-datasource.js +20 -0
  439. package/dist/tools/ti-development/get-process-parameters.d.ts +2 -0
  440. package/dist/tools/ti-development/get-process-parameters.js +25 -0
  441. package/dist/tools/ti-development/get-process-variables.d.ts +2 -0
  442. package/dist/tools/ti-development/get-process-variables.js +38 -0
  443. package/dist/tools/ti-development/get-process.d.ts +2 -0
  444. package/dist/tools/ti-development/get-process.js +163 -0
  445. package/dist/tools/ti-development/import-pro-file.d.ts +2 -0
  446. package/dist/tools/ti-development/import-pro-file.js +153 -0
  447. package/dist/tools/ti-development/import-process-from-git.d.ts +2 -0
  448. package/dist/tools/ti-development/import-process-from-git.js +198 -0
  449. package/dist/tools/ti-development/install-pro-bundle.d.ts +2 -0
  450. package/dist/tools/ti-development/install-pro-bundle.js +288 -0
  451. package/dist/tools/ti-development/preflight.d.ts +39 -0
  452. package/dist/tools/ti-development/preflight.js +56 -0
  453. package/dist/tools/ti-development/process-backup.d.ts +29 -0
  454. package/dist/tools/ti-development/process-backup.js +118 -0
  455. package/dist/tools/ti-development/search-code.d.ts +2 -0
  456. package/dist/tools/ti-development/search-code.js +208 -0
  457. package/dist/tools/ti-development/upsert-process.d.ts +2 -0
  458. package/dist/tools/ti-development/upsert-process.js +167 -0
  459. package/dist/tools/ti-development/validate-process-refs.d.ts +2 -0
  460. package/dist/tools/ti-development/validate-process-refs.js +73 -0
  461. package/dist/tools/views/create-mdx-view.d.ts +2 -0
  462. package/dist/tools/views/create-mdx-view.js +21 -0
  463. package/dist/tools/views/create-native-view.d.ts +2 -0
  464. package/dist/tools/views/create-native-view.js +81 -0
  465. package/dist/tools/views/delete-view.d.ts +2 -0
  466. package/dist/tools/views/delete-view.js +23 -0
  467. package/dist/tools/views/list-views.d.ts +2 -0
  468. package/dist/tools/views/list-views.js +32 -0
  469. package/dist/tools/with-annotations.d.ts +6 -0
  470. package/dist/tools/with-annotations.js +339 -0
  471. package/dist/types.d.ts +409 -0
  472. package/dist/types.js +91 -0
  473. package/dist/version.d.ts +4 -0
  474. package/dist/version.js +18 -0
  475. package/package.json +107 -0
@@ -0,0 +1,312 @@
1
+ import { z } from "zod";
2
+ import { maskCode, resolveMaskSecrets } from "../../lib/mask-secrets.js";
3
+ import { DiffProcessesResultSchema } from "../schemas/items.js";
4
+ import { READ_ONLY } from "../annotations.js";
5
+ import { defineTool } from "../define-tool.js";
6
+ function computeEditScript(a, b) {
7
+ const m = a.length;
8
+ const n = b.length;
9
+ const w = n + 1;
10
+ const dp = new Uint32Array((m + 1) * w);
11
+ for (let i = m - 1; i >= 0; i--) {
12
+ for (let j = n - 1; j >= 0; j--) {
13
+ if (a[i] === b[j]) {
14
+ dp[i * w + j] = 1 + (dp[(i + 1) * w + (j + 1)] ?? 0);
15
+ }
16
+ else {
17
+ const skipA = dp[(i + 1) * w + j] ?? 0;
18
+ const skipB = dp[i * w + (j + 1)] ?? 0;
19
+ dp[i * w + j] = skipA >= skipB ? skipA : skipB;
20
+ }
21
+ }
22
+ }
23
+ const ops = [];
24
+ let i = 0, j = 0;
25
+ while (i < m || j < n) {
26
+ const ai = a[i], bj = b[j];
27
+ if (i < m && j < n && ai === bj) {
28
+ ops.push({ op: "eq", line: ai });
29
+ i++;
30
+ j++;
31
+ }
32
+ else if (i < m &&
33
+ (j >= n || (dp[(i + 1) * w + j] ?? 0) >= (dp[i * w + (j + 1)] ?? 0))) {
34
+ ops.push({ op: "del", line: ai });
35
+ i++;
36
+ }
37
+ else {
38
+ ops.push({ op: "add", line: bj });
39
+ j++;
40
+ }
41
+ }
42
+ return ops;
43
+ }
44
+ function buildHunks(ops, contextLines) {
45
+ const pos = [];
46
+ let lA = 1, lB = 1;
47
+ for (const op of ops) {
48
+ pos.push({ ...op, lineA: lA, lineB: lB });
49
+ if (op.op === "eq") {
50
+ lA++;
51
+ lB++;
52
+ }
53
+ else if (op.op === "del") {
54
+ lA++;
55
+ }
56
+ else {
57
+ lB++;
58
+ }
59
+ }
60
+ const inHunk = new Set();
61
+ for (let i = 0; i < pos.length; i++) {
62
+ if (pos[i].op !== "eq") {
63
+ for (let k = Math.max(0, i - contextLines); k <= Math.min(pos.length - 1, i + contextLines); k++) {
64
+ inHunk.add(k);
65
+ }
66
+ }
67
+ }
68
+ if (inHunk.size === 0)
69
+ return [];
70
+ const indices = [...inHunk].sort((a, b) => a - b);
71
+ const ranges = [];
72
+ let s = indices[0], p = indices[0];
73
+ for (let i = 1; i < indices.length; i++) {
74
+ if (indices[i] > p + 1) {
75
+ ranges.push([s, p]);
76
+ s = indices[i];
77
+ }
78
+ p = indices[i];
79
+ }
80
+ ranges.push([s, p]);
81
+ return ranges.map(([from, to]) => {
82
+ const lines = [];
83
+ let startA = -1, startB = -1, countA = 0, countB = 0;
84
+ for (let i = from; i <= to; i++) {
85
+ const px = pos[i];
86
+ if (startA === -1) {
87
+ startA = px.lineA;
88
+ startB = px.lineB;
89
+ }
90
+ if (px.op === "eq") {
91
+ lines.push({ type: " ", text: px.line });
92
+ countA++;
93
+ countB++;
94
+ }
95
+ else if (px.op === "del") {
96
+ lines.push({ type: "-", text: px.line });
97
+ countA++;
98
+ }
99
+ else {
100
+ lines.push({ type: "+", text: px.line });
101
+ countB++;
102
+ }
103
+ }
104
+ return { startA, countA, startB, countB, lines };
105
+ });
106
+ }
107
+ const NORM = (s) => s.replace(/\r\n/g, "\n").trimEnd();
108
+ function tabCodeDiff(codeA, codeB, contextLines) {
109
+ const na = NORM(codeA);
110
+ const nb = NORM(codeB);
111
+ if (na === nb) {
112
+ const lc = na ? na.split("\n").length : 0;
113
+ return { identical: true, linesA: lc, linesB: lc, hunks: [] };
114
+ }
115
+ const a = na ? na.split("\n") : [];
116
+ const b = nb ? nb.split("\n") : [];
117
+ const ops = computeEditScript(a, b);
118
+ const hunks = buildHunks(ops, contextLines);
119
+ return { identical: false, linesA: a.length, linesB: b.length, hunks };
120
+ }
121
+ // ── param / var / datasource diff ────────────────────────────────────────────
122
+ function diffParams(a, b) {
123
+ const ma = new Map(a.map((p) => [p.name, p]));
124
+ const mb = new Map(b.map((p) => [p.name, p]));
125
+ const added = [];
126
+ const removed = [];
127
+ const changed = [];
128
+ for (const [name, pb] of mb) {
129
+ const pa = ma.get(name);
130
+ if (!pa) {
131
+ added.push(name);
132
+ continue;
133
+ }
134
+ if (pa.type !== pb.type ||
135
+ String(pa.defaultValue ?? "") !== String(pb.defaultValue ?? "") ||
136
+ (pa.prompt ?? "") !== (pb.prompt ?? "")) {
137
+ changed.push({ name, a: pa, b: pb });
138
+ }
139
+ }
140
+ for (const name of ma.keys())
141
+ if (!mb.has(name))
142
+ removed.push(name);
143
+ return {
144
+ identical: added.length === 0 && removed.length === 0 && changed.length === 0,
145
+ added,
146
+ removed,
147
+ changed,
148
+ };
149
+ }
150
+ function diffVars(a, b) {
151
+ const ma = new Map(a.map((v) => [v.name, v]));
152
+ const mb = new Map(b.map((v) => [v.name, v]));
153
+ const added = [];
154
+ const removed = [];
155
+ const changed = [];
156
+ for (const [name, vb] of mb) {
157
+ const va = ma.get(name);
158
+ if (!va) {
159
+ added.push(name);
160
+ continue;
161
+ }
162
+ if (va.type !== vb.type || va.position !== vb.position)
163
+ changed.push({ name, a: va, b: vb });
164
+ }
165
+ for (const name of ma.keys())
166
+ if (!mb.has(name))
167
+ removed.push(name);
168
+ return {
169
+ identical: added.length === 0 && removed.length === 0 && changed.length === 0,
170
+ added,
171
+ removed,
172
+ changed,
173
+ };
174
+ }
175
+ // Columns set to "Ignore" carry no variable, so diffVars above cannot see
176
+ // them: two processes differing only in which columns they skip would otherwise
177
+ // come back identical.
178
+ function diffIgnoredColumns(a, b) {
179
+ const ma = new Map(a.map((c) => [c.position, c]));
180
+ const mb = new Map(b.map((c) => [c.position, c]));
181
+ const added = [];
182
+ const removed = [];
183
+ const renamed = [];
184
+ for (const [position, cb] of mb) {
185
+ const ca = ma.get(position);
186
+ if (!ca) {
187
+ added.push(position);
188
+ continue;
189
+ }
190
+ if (ca.name !== cb.name)
191
+ renamed.push({
192
+ position,
193
+ ...(ca.name !== undefined ? { a: ca.name } : {}),
194
+ ...(cb.name !== undefined ? { b: cb.name } : {}),
195
+ });
196
+ }
197
+ for (const position of ma.keys())
198
+ if (!mb.has(position))
199
+ removed.push(position);
200
+ return {
201
+ identical: added.length === 0 && removed.length === 0 && renamed.length === 0,
202
+ added,
203
+ removed,
204
+ renamed,
205
+ };
206
+ }
207
+ function diffDs(a, b) {
208
+ const diffs = [];
209
+ const fields = [
210
+ "type",
211
+ "dataSourceNameForServer",
212
+ "dataSourceNameForClient",
213
+ "asciiDelimiterChar",
214
+ "asciiQuoteCharacter",
215
+ "asciiDecimalSeparator",
216
+ "asciiThousandSeparator",
217
+ "asciiHeaderRecords",
218
+ "view",
219
+ "subset",
220
+ "userName",
221
+ // The SQL is the substance of an ODBC source: two processes that differ
222
+ // only in their query are not the same process. `password` stays out —
223
+ // both sides read back redacted, so it can only produce noise.
224
+ "query",
225
+ ];
226
+ for (const f of fields) {
227
+ if ((a[f] ?? "") !== (b[f] ?? ""))
228
+ diffs.push(`${String(f)}: ${JSON.stringify(a[f])} → ${JSON.stringify(b[f])}`);
229
+ }
230
+ return { identical: diffs.length === 0, differences: diffs };
231
+ }
232
+ // ── tool ──────────────────────────────────────────────────────────────────────
233
+ const ALL_TABS = ["prolog", "metadata", "data", "epilog"];
234
+ export const registerDiffProcesses = defineTool({
235
+ name: "tm1_diff_processes",
236
+ description: [
237
+ "Compare two installed TI processes tab-by-tab (Prolog/Metadata/Data/Epilog).",
238
+ "Returns per-tab identical flag, line counts, and unified diff hunks for changed tabs.",
239
+ "Also diffs parameters, variables, and datasource.",
240
+ "Analogue of tm1_diff_process_with_file but server-side — no .pro file needed.",
241
+ ],
242
+ annotations: READ_ONLY,
243
+ output: DiffProcessesResultSchema,
244
+ input: {
245
+ processA: z.string().describe("First process name (case-sensitive)"),
246
+ processB: z.string().describe("Second process name (case-sensitive)"),
247
+ tabs: z
248
+ .array(z.enum(["prolog", "metadata", "data", "epilog"]))
249
+ .optional()
250
+ .describe("Tabs to diff (default: all four)"),
251
+ contextLines: z
252
+ .number()
253
+ .int()
254
+ .min(0)
255
+ .max(10)
256
+ .optional()
257
+ .default(3)
258
+ .describe("Lines of context around each changed hunk (default 3, max 10)"),
259
+ maskSecrets: z
260
+ .boolean()
261
+ .optional()
262
+ .default(true)
263
+ .describe("Redact credential literals on BOTH sides before diffing (so a cred present on only one side can't leak via the diff). " +
264
+ "Masks the password arg of ODBCOpen() and quoted values assigned to credential-named identifiers (pPwd, sToken, …). " +
265
+ "Default: true. Set false only when explicitly auditing credentials."),
266
+ },
267
+ handler: async ({ processA, processB, tabs, contextLines, maskSecrets }, tm1Client) => {
268
+ const diffTabs = tabs && tabs.length > 0 ? tabs : ALL_TABS;
269
+ const mask = resolveMaskSecrets(maskSecrets) ? maskCode : (s) => s;
270
+ const [codeA, codeB, paramsA, paramsB, varsA, varsB, dsA, dsB] = await Promise.all([
271
+ tm1Client.processes.getCode(processA),
272
+ tm1Client.processes.getCode(processB),
273
+ tm1Client.processes.getParameters(processA),
274
+ tm1Client.processes.getParameters(processB),
275
+ tm1Client.processes.getVariableLayout(processA),
276
+ tm1Client.processes.getVariableLayout(processB),
277
+ tm1Client.processes.getDataSource(processA),
278
+ tm1Client.processes.getDataSource(processB),
279
+ ]);
280
+ const tabResults = {};
281
+ for (const tab of diffTabs) {
282
+ tabResults[tab] = tabCodeDiff(mask(codeA[tab] ?? ""), mask(codeB[tab] ?? ""), contextLines);
283
+ }
284
+ const parameters = diffParams(paramsA, paramsB);
285
+ const variables = diffVars(varsA.variables, varsB.variables);
286
+ const ignoredColumns = diffIgnoredColumns(varsA.ignoredColumns, varsB.ignoredColumns);
287
+ const dataSource = diffDs(dsA, dsB);
288
+ const identical = Object.values(tabResults).every((t) => t.identical) &&
289
+ parameters.identical &&
290
+ variables.identical &&
291
+ ignoredColumns.identical &&
292
+ dataSource.identical;
293
+ return {
294
+ content: [
295
+ {
296
+ type: "text",
297
+ text: JSON.stringify({
298
+ processA,
299
+ processB,
300
+ identical,
301
+ tabs: tabResults,
302
+ parameters,
303
+ variables,
304
+ ignoredColumns,
305
+ dataSource,
306
+ }, null, 2),
307
+ },
308
+ ],
309
+ };
310
+ },
311
+ });
312
+ //# sourceMappingURL=diff-processes.js.map
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Client-abort recovery hint, branched by TM1 major version: v11 exposes
3
+ * server threads (tm1_list_threads / tm1_cancel_thread), v12 exposes jobs
4
+ * (tm1_list_jobs / tm1_cancel_job) instead.
5
+ */
6
+ export declare function abortHint(version: 11 | 12): string;
7
+ export declare const registerExecuteProcess: import("../define-tool.js").ToolRegistrar;
8
+ //# sourceMappingURL=execute-process.d.ts.map
@@ -0,0 +1,109 @@
1
+ import { z } from "zod";
2
+ import { TM1Error, TM1ErrorCode } from "../../types.js";
3
+ import { withToolHint } from "../error-format.js";
4
+ import { CONFIRM_SCHEMA, requireConfirm } from "../confirm.js";
5
+ import { DESTRUCTIVE } from "../annotations.js";
6
+ import { ProcessResultSchema } from "../schemas/items.js";
7
+ import { defineTool } from "../define-tool.js";
8
+ /**
9
+ * Client-abort recovery hint, branched by TM1 major version: v11 exposes
10
+ * server threads (tm1_list_threads / tm1_cancel_thread), v12 exposes jobs
11
+ * (tm1_list_jobs / tm1_cancel_job) instead.
12
+ */
13
+ export function abortHint(version) {
14
+ const monitor = version === 12 ? "tm1_list_jobs" : "tm1_list_threads";
15
+ const cancel = version === 12 ? "tm1_cancel_job" : "tm1_cancel_thread";
16
+ return `Request aborted by the client — the process was NOT confirmed failed and may still be executing. Use ${monitor} to check for it and ${cancel} to stop it. Do NOT blindly re-run: that risks a duplicate execution.`;
17
+ }
18
+ export const registerExecuteProcess = defineTool({
19
+ name: "tm1_execute_process",
20
+ description: [
21
+ "Execute a TurboIntegrator process on the TM1 server with optional parameters.",
22
+ "Non-idempotent: each call re-runs the process — do not retry blindly on transport errors without checking server state.",
23
+ "Before: tm1_check_process_code (syntax) and/or tm1_compile_process (full compile). Discover required params with tm1_get_process_parameters.",
24
+ "On failure: use tm1_diagnose_process_error for combined log + cascade fetch.",
25
+ ],
26
+ annotations: DESTRUCTIVE,
27
+ output: ProcessResultSchema,
28
+ input: {
29
+ processName: z.string().describe("Name of the TI process to execute"),
30
+ parameters: z
31
+ .record(z.string(), z.union([z.string(), z.number()]))
32
+ .optional()
33
+ .describe("Optional key-value map of process parameters"),
34
+ timeoutMs: z
35
+ .number()
36
+ .int()
37
+ .min(1000)
38
+ .max(3600000)
39
+ .optional()
40
+ .describe("Override the default 30s request timeout for this call (ms, 1000–3600000). Use for long-running TI runs."),
41
+ ...CONFIRM_SCHEMA,
42
+ },
43
+ handler: async ({ processName, parameters, timeoutMs, confirm }, tm1Client, extra) => {
44
+ // A TI run writes through to cubes, and undoing the call does not undo
45
+ // its effects. Guards against an auto-approve client firing it
46
+ // speculatively — NOT a security control: whatever can call the tool can
47
+ // also supply `confirm`.
48
+ requireConfirm(confirm, processName, "process");
49
+ // R2-02: TM1 REST exposes no mid-run progress for tm1.Execute, so we
50
+ // emit periodic heartbeat notifications (every 5s) instead. Keeps
51
+ // client UI alive during long TI runs and lets users distinguish
52
+ // "still working" from "hung". Heartbeat-only; total stays undefined
53
+ // since TI duration is unknown ahead of time.
54
+ const progressToken = extra?._meta?.progressToken;
55
+ const start = Date.now();
56
+ let heartbeatTimer;
57
+ if (progressToken !== undefined) {
58
+ const tick = () => {
59
+ const elapsedSec = Math.round((Date.now() - start) / 1000);
60
+ void extra
61
+ .sendNotification({
62
+ method: "notifications/progress",
63
+ params: {
64
+ progressToken,
65
+ progress: elapsedSec,
66
+ message: `${processName} still running (${elapsedSec}s elapsed)`,
67
+ },
68
+ })
69
+ .catch(() => undefined);
70
+ };
71
+ heartbeatTimer = setInterval(tick, 5000);
72
+ }
73
+ try {
74
+ const result = await withToolHint(tm1Client.processes.execute(processName, parameters, {
75
+ signal: extra?.signal,
76
+ ...(timeoutMs ? { timeoutMs } : {}),
77
+ }), `Process '${processName}' failed at runtime. Inspect cascade with tm1_diagnose_process_error(processName='${processName}', includeRelated=true). Verify parameter shape via tm1_get_process_parameters; check syntax with tm1_compile_process before re-running.`);
78
+ return {
79
+ content: [{ type: "text", text: JSON.stringify(result) }],
80
+ // A TI process that ran but reported failure is a tool failure, not a
81
+ // successful call carrying success:false. Flag isError so agents that
82
+ // branch on the MCP error signal don't silently treat it as success;
83
+ // the full payload (processErrorStatus, errorLogFile) is preserved by
84
+ // normalizeErrorResult for diagnosis.
85
+ ...(result.success === false ? { isError: true } : {}),
86
+ };
87
+ }
88
+ catch (err) {
89
+ // Client-side cancellation (notifications/cancelled) aborts the fetch,
90
+ // but the TI process keeps running server-side — TM1 REST has no
91
+ // mid-run abort. withToolHint's runtime-failure hint ("diagnose then
92
+ // re-run") is actively wrong here: it invites a duplicate execution.
93
+ // Detect the abort via the MCP signal and point at the live thread.
94
+ if (extra?.signal?.aborted) {
95
+ throw new TM1Error({
96
+ code: TM1ErrorCode.TM1_ERROR,
97
+ message: `Execution of '${processName}' was cancelled client-side before it returned; the TI process may still be running on the TM1 server.`,
98
+ hint: abortHint(tm1Client.version),
99
+ });
100
+ }
101
+ throw err;
102
+ }
103
+ finally {
104
+ if (heartbeatTimer !== undefined)
105
+ clearInterval(heartbeatTimer);
106
+ }
107
+ },
108
+ });
109
+ //# sourceMappingURL=execute-process.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerExportProcessToGit: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=export-process-to-git.d.ts.map
@@ -0,0 +1,113 @@
1
+ import { promises as fs } from "node:fs";
2
+ import path from "node:path";
3
+ import { z } from "zod";
4
+ import { supportsCredentialExport } from "../../lib/credential-format.js";
5
+ import { TM1Error, TM1ErrorCode } from "../../types.js";
6
+ import { resolveLocalPath } from "../local-file.js";
7
+ import { maskCode, resolveMaskSecrets } from "../../lib/mask-secrets.js";
8
+ import { ExportProcessToGitResultSchema } from "../schemas/items.js";
9
+ import { READ_ONLY } from "../annotations.js";
10
+ import { defineTool } from "../define-tool.js";
11
+ import { readProcessAsGit } from "./process-backup.js";
12
+ export const registerExportProcessToGit = defineTool({
13
+ name: "tm1_export_process_to_git",
14
+ description: [
15
+ "Serialize a TM1 process to the tm1-git two-file layout: a '{name}.json' (parameters, variables, ignored datasource columns, datasource) plus a '{name}.ti' (Prolog/Metadata/Data/Epilog as plain code).",
16
+ "The .ti holds the code in TM1's native `Code` representation (#region <Tab> / #endregion, CRLF, empty tabs omitted); the .json holds the structure. Code lives outside the JSON so Git diffs stay readable.",
17
+ "Returns both file bodies (json + ti) inline by default. Pass writeToDir to persist them to disk instead: the code is then written to files and omitted from the response to avoid duplicating it into the context window; only metadata (filenames, counts, writtenTo paths) comes back. Round-trip safe with tm1_import_process_from_git.",
18
+ "Security: the ODBC datasource password is stripped unless includeDataSourcePassword is set (which also requires writeToDir); credential literals in the TI code are masked when maskSecrets is on; credentialsOmitted=true flags when a password was stripped.",
19
+ "includeDataSourcePassword is v12-only: what v11 hands out expires with the server run, so exporting it would produce a file that looks complete and fails later.",
20
+ ],
21
+ annotations: READ_ONLY,
22
+ output: ExportProcessToGitResultSchema,
23
+ input: {
24
+ processName: z.string().describe("Name of the TI process to export"),
25
+ writeToDir: z
26
+ .string()
27
+ .optional()
28
+ .describe("Optional absolute host directory to write '{name}.json' and '{name}.ti' into. Disabled unless TM1_LOCAL_FILE_ROOT is set; the path must resolve within that directory. If omitted, content is only returned inline."),
29
+ maskSecrets: z
30
+ .boolean()
31
+ .optional()
32
+ .default(true)
33
+ .describe("Redact credential literals in the exported .ti code (inline and written file) and credential pairs (PWD=, UID=) in the datasource's ODBC connection string in the .json. " +
34
+ "Masks the password arg of ODBCOpen() and quoted values assigned to credential-named identifiers (pPwd, sToken, …). Default: true. Set false only when explicitly auditing credentials."),
35
+ includeDataSourcePassword: z
36
+ .boolean()
37
+ .optional()
38
+ .default(false)
39
+ .describe("Write the ODBC datasource password into the .json. Off by default, and v12 ONLY — on v11 it is refused, because the credential v11 hands out expires with the server run and would leave a .json that looks complete and fails at connect time; clone with tm1_copy_process instead, or deploy with tm1_import_process_from_git's dataSourcePassword. On v12 the value written is the PLAIN password, in a layout meant for version control — requires writeToDir, and do not commit the result."),
40
+ },
41
+ handler: async ({ processName, writeToDir, maskSecrets, includeDataSourcePassword }, tm1Client) => {
42
+ if (includeDataSourcePassword && !writeToDir) {
43
+ throw new TM1Error({
44
+ code: TM1ErrorCode.VALIDATION_ERROR,
45
+ message: "includeDataSourcePassword requires writeToDir — the credential must go to a file, not into the inline response.",
46
+ });
47
+ }
48
+ // See src/lib/credential-format.ts: a v11 credential is scoped to one
49
+ // server run, so an exported one rots without any visible sign.
50
+ if (includeDataSourcePassword &&
51
+ !supportsCredentialExport(tm1Client.version)) {
52
+ throw new TM1Error({
53
+ code: TM1ErrorCode.VALIDATION_ERROR,
54
+ message: "includeDataSourcePassword is v12-only. On v11 the exported credential stops working when the TM1 service restarts, and the .json gives no sign of it. To clone a process with its password inside this instance use tm1_copy_process; to deploy elsewhere or later, export without the password and pass dataSourcePassword to tm1_import_process_from_git.",
55
+ });
56
+ }
57
+ const pair = await readProcessAsGit(tm1Client, processName, {
58
+ includePassword: includeDataSourcePassword === true,
59
+ });
60
+ const mask = resolveMaskSecrets(maskSecrets) ? maskCode : (s) => s;
61
+ const ti = mask(pair.ti);
62
+ const { json, credentialsOmitted } = pair;
63
+ const jsonFileName = `${processName}.json`;
64
+ const tiFileName = `${processName}.ti`;
65
+ const writtenTo = {
66
+ json: null,
67
+ ti: null,
68
+ };
69
+ if (writeToDir) {
70
+ // Reject path separators in the process name so the join below cannot
71
+ // climb out of the target directory (resolveLocalPath also confines it).
72
+ if (/[\\/]|\.\./.test(processName)) {
73
+ throw new TM1Error({
74
+ code: TM1ErrorCode.VALIDATION_ERROR,
75
+ message: `Process name '${processName}' contains path separators; cannot derive safe file names`,
76
+ });
77
+ }
78
+ const dir = resolveLocalPath(writeToDir, "writeToDir");
79
+ const jsonPath = resolveLocalPath(path.join(dir, jsonFileName), "writeToDir");
80
+ const tiPath = resolveLocalPath(path.join(dir, tiFileName), "writeToDir");
81
+ // Create the target directory only AFTER confinement above, so the
82
+ // symlink-aware realpath check ran against the pre-existing tree.
83
+ await fs.mkdir(dir, { recursive: true });
84
+ await fs.writeFile(jsonPath, json, "utf8");
85
+ await fs.writeFile(tiPath, ti, "utf8");
86
+ writtenTo.json = jsonPath;
87
+ writtenTo.ti = tiPath;
88
+ }
89
+ return {
90
+ content: [
91
+ {
92
+ type: "text",
93
+ text: JSON.stringify({
94
+ processName,
95
+ jsonFileName,
96
+ tiFileName,
97
+ parameterCount: pair.parameterCount,
98
+ variableCount: pair.variableCount,
99
+ dataSourceType: pair.dataSourceType,
100
+ credentialsOmitted,
101
+ hasSecurityAccess: pair.hasSecurityAccess,
102
+ writtenTo,
103
+ // Echo the file bodies inline only when NOT persisting to disk. With
104
+ // writeToDir the caller already has the files, so returning the code
105
+ // would just duplicate thousands of tokens into the context window.
106
+ ...(writeToDir ? {} : { json, ti }),
107
+ }),
108
+ },
109
+ ],
110
+ };
111
+ },
112
+ });
113
+ //# sourceMappingURL=export-process-to-git.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerExportProcessToPro: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=export-process-to-pro.d.ts.map
@@ -0,0 +1,117 @@
1
+ import { promises as fs } from "node:fs";
2
+ import path from "node:path";
3
+ import { z } from "zod";
4
+ import { resolveLocalPath } from "../local-file.js";
5
+ import { serializeToPro } from "../../lib/pro-serializer.js";
6
+ import { maskCode, resolveMaskSecrets } from "../../lib/mask-secrets.js";
7
+ import { supportsCredentialExport } from "../../lib/credential-format.js";
8
+ import { TM1Error, TM1ErrorCode } from "../../types.js";
9
+ import { ExportProcessToProResultSchema } from "../schemas/items.js";
10
+ import { READ_ONLY, withVersion } from "../annotations.js";
11
+ import { defineTool } from "../define-tool.js";
12
+ export const registerExportProcessToPro = defineTool({
13
+ name: "tm1_export_process_to_pro",
14
+ description: [
15
+ "Reverse of tm1_import_pro_file: serialize a TM1 process back to a .pro file body.",
16
+ "Fetches code (Prolog/Metadata/Data/Epilog), parameters, variables (including the columns set to Ignore), and datasource in parallel.",
17
+ "Returns the .pro content inline by default; pass writeToFile to also persist to an absolute path on the MCP host.",
18
+ "Round-trip safe with tm1_import_pro_file — useful for syncing live server state into a Git repo.",
19
+ "NOT a drop-in replacement for the .pro file in TM1's Datadir: the output omits TM1's BOM, its '601' version header and CRLF line endings. Measured on 11.8: TM1 does load such a file at startup and rewrites it in its own dialect, but it decodes slot 565 with its own scheme — a password written here becomes garbage that TM1 then persists, so the process looks configured and fails at runtime. Deploy via tm1_import_pro_file, not by copying into the Datadir.",
20
+ ],
21
+ annotations: withVersion(READ_ONLY, "v11"),
22
+ output: ExportProcessToProResultSchema,
23
+ input: {
24
+ processName: z.string().describe("Name of the TI process to export"),
25
+ writeToFile: z
26
+ .string()
27
+ .optional()
28
+ .describe("Optional absolute host path to write the .pro file to. Disabled unless TM1_LOCAL_FILE_ROOT is set; the path must resolve within that directory. If omitted, content is only returned inline."),
29
+ maskSecrets: z
30
+ .boolean()
31
+ .optional()
32
+ .default(true)
33
+ .describe("Redact credential literals in the exported code (inline and written file). Masks the password arg of ODBCOpen() and quoted values " +
34
+ "assigned to credential-named identifiers (pPwd, sToken, …). Default: true. Set false only when explicitly auditing credentials."),
35
+ includeDataSourcePassword: z
36
+ .boolean()
37
+ .optional()
38
+ .default(false)
39
+ .describe("Write the ODBC datasource password into the file (slot 565). Off by default, and v12 ONLY — on v11 it is refused, because the " +
40
+ "credential v11 hands out expires with the server run and would leave a file that looks complete and fails at connect time; clone " +
41
+ "with tm1_copy_process instead, or deploy with tm1_import_pro_file's dataSourcePassword. On v12 the value written is the PLAIN " +
42
+ "password. Requires writeToFile, so it never enters the inline response. Do not commit such a file."),
43
+ },
44
+ handler: async ({ processName, writeToFile, maskSecrets, includeDataSourcePassword }, tm1Client) => {
45
+ if (includeDataSourcePassword && !writeToFile) {
46
+ throw new TM1Error({
47
+ code: TM1ErrorCode.VALIDATION_ERROR,
48
+ message: "includeDataSourcePassword requires writeToFile — the credential must go to a file, not into the inline response.",
49
+ });
50
+ }
51
+ // See src/lib/credential-format.ts: a v11 credential is scoped to one
52
+ // server run, so an exported one rots without any visible sign.
53
+ if (includeDataSourcePassword &&
54
+ !supportsCredentialExport(tm1Client.version)) {
55
+ throw new TM1Error({
56
+ code: TM1ErrorCode.VALIDATION_ERROR,
57
+ message: "includeDataSourcePassword is v12-only. On v11 the exported credential stops working when the TM1 service restarts, and the file gives no sign of it. To clone a process with its password inside this instance use tm1_copy_process; to deploy elsewhere or later, export without the password and pass dataSourcePassword to tm1_import_pro_file.",
58
+ });
59
+ }
60
+ const [code, parameters, layout, dataSource] = await Promise.all([
61
+ tm1Client.processes.getCode(processName),
62
+ tm1Client.processes.getParameters(processName),
63
+ tm1Client.processes.getVariableLayout(processName),
64
+ tm1Client.processes.getDataSource(processName, {
65
+ includeSecrets: includeDataSourcePassword === true,
66
+ }),
67
+ ]);
68
+ // Without the opt-in the service hands back a "[redacted]" marker, which
69
+ // must not be written into the file as if it were the credential.
70
+ if (!includeDataSourcePassword)
71
+ delete dataSource.password;
72
+ const credentialsIncluded = Boolean(includeDataSourcePassword && dataSource.password);
73
+ const mask = resolveMaskSecrets(maskSecrets) ? maskCode : (s) => s;
74
+ const proContent = serializeToPro({
75
+ name: processName,
76
+ prolog: mask(code.prolog),
77
+ metadata: mask(code.metadata),
78
+ data: mask(code.data),
79
+ epilog: mask(code.epilog),
80
+ parameters,
81
+ variables: layout.variables,
82
+ ...(layout.variablesUIData !== undefined
83
+ ? { variablesUIData: layout.variablesUIData }
84
+ : {}),
85
+ dataSource,
86
+ });
87
+ let writtenTo = null;
88
+ if (writeToFile) {
89
+ const target = resolveLocalPath(writeToFile, "writeToFile");
90
+ // Create the parent directory only AFTER confinement above, so the
91
+ // symlink-aware realpath check ran against the pre-existing tree.
92
+ await fs.mkdir(path.dirname(target), { recursive: true });
93
+ await fs.writeFile(target, proContent, "utf8");
94
+ writtenTo = target;
95
+ }
96
+ return {
97
+ content: [
98
+ {
99
+ type: "text",
100
+ text: JSON.stringify({
101
+ processName,
102
+ byteLength: Buffer.byteLength(proContent, "utf8"),
103
+ writtenTo,
104
+ parameterCount: parameters.length,
105
+ variableCount: layout.variables.length,
106
+ dataSourceType: dataSource.type,
107
+ credentialsIncluded,
108
+ // Written to disk only when credentials are in play — otherwise
109
+ // the caller already has the body and it stays out of the context.
110
+ ...(includeDataSourcePassword ? {} : { content: proContent }),
111
+ }),
112
+ },
113
+ ],
114
+ };
115
+ },
116
+ });
117
+ //# sourceMappingURL=export-process-to-pro.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerGetAllProcessesCode: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=get-all-processes-code.d.ts.map