arc-1 1.2.0 → 1.3.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 (292) hide show
  1. package/README.md +7 -5
  2. package/dist/adt/atc-batch.d.ts +71 -0
  3. package/dist/adt/atc-batch.d.ts.map +1 -0
  4. package/dist/adt/atc-batch.js +182 -0
  5. package/dist/adt/atc-batch.js.map +1 -0
  6. package/dist/adt/atc.d.ts +34 -0
  7. package/dist/adt/atc.d.ts.map +1 -1
  8. package/dist/adt/atc.js +58 -12
  9. package/dist/adt/atc.js.map +1 -1
  10. package/dist/adt/aunit.d.ts.map +1 -1
  11. package/dist/adt/aunit.js +50 -7
  12. package/dist/adt/aunit.js.map +1 -1
  13. package/dist/adt/bounded-response.d.ts +4 -1
  14. package/dist/adt/bounded-response.d.ts.map +1 -1
  15. package/dist/adt/bounded-response.js +33 -7
  16. package/dist/adt/bounded-response.js.map +1 -1
  17. package/dist/adt/ci-quality-xml.d.ts +44 -0
  18. package/dist/adt/ci-quality-xml.d.ts.map +1 -0
  19. package/dist/adt/ci-quality-xml.js +98 -0
  20. package/dist/adt/ci-quality-xml.js.map +1 -0
  21. package/dist/adt/ci-quality.d.ts +64 -0
  22. package/dist/adt/ci-quality.d.ts.map +1 -0
  23. package/dist/adt/ci-quality.js +132 -0
  24. package/dist/adt/ci-quality.js.map +1 -0
  25. package/dist/adt/client.d.ts +20 -16
  26. package/dist/adt/client.d.ts.map +1 -1
  27. package/dist/adt/client.js +35 -70
  28. package/dist/adt/client.js.map +1 -1
  29. package/dist/adt/data-source-policy.d.ts +6 -15
  30. package/dist/adt/data-source-policy.d.ts.map +1 -1
  31. package/dist/adt/data-source-policy.js +18 -11
  32. package/dist/adt/data-source-policy.js.map +1 -1
  33. package/dist/adt/ddic-xml.d.ts +78 -4
  34. package/dist/adt/ddic-xml.d.ts.map +1 -1
  35. package/dist/adt/ddic-xml.js +647 -54
  36. package/dist/adt/ddic-xml.js.map +1 -1
  37. package/dist/adt/devtools.d.ts +1 -0
  38. package/dist/adt/devtools.d.ts.map +1 -1
  39. package/dist/adt/devtools.js +24 -4
  40. package/dist/adt/devtools.js.map +1 -1
  41. package/dist/adt/http-deadline.d.ts +5 -0
  42. package/dist/adt/http-deadline.d.ts.map +1 -1
  43. package/dist/adt/http-deadline.js +2 -2
  44. package/dist/adt/http-deadline.js.map +1 -1
  45. package/dist/adt/http.d.ts +6 -3
  46. package/dist/adt/http.d.ts.map +1 -1
  47. package/dist/adt/http.js +57 -15
  48. package/dist/adt/http.js.map +1 -1
  49. package/dist/adt/internal-data-operations.d.ts +9 -4
  50. package/dist/adt/internal-data-operations.d.ts.map +1 -1
  51. package/dist/adt/internal-data-operations.js +11 -7
  52. package/dist/adt/internal-data-operations.js.map +1 -1
  53. package/dist/adt/package-contents.d.ts +12 -0
  54. package/dist/adt/package-contents.d.ts.map +1 -0
  55. package/dist/adt/package-contents.js +19 -0
  56. package/dist/adt/package-contents.js.map +1 -0
  57. package/dist/adt/relation-objects.d.ts +385 -0
  58. package/dist/adt/relation-objects.d.ts.map +1 -0
  59. package/dist/adt/relation-objects.js +262 -0
  60. package/dist/adt/relation-objects.js.map +1 -0
  61. package/dist/adt/repository-relations.d.ts +41 -0
  62. package/dist/adt/repository-relations.d.ts.map +1 -0
  63. package/dist/adt/repository-relations.js +246 -0
  64. package/dist/adt/repository-relations.js.map +1 -0
  65. package/dist/adt/request-attempt-budget.d.ts +26 -0
  66. package/dist/adt/request-attempt-budget.d.ts.map +1 -0
  67. package/dist/adt/request-attempt-budget.js +63 -0
  68. package/dist/adt/request-attempt-budget.js.map +1 -0
  69. package/dist/adt/result-limits.d.ts +3 -0
  70. package/dist/adt/result-limits.d.ts.map +1 -0
  71. package/dist/adt/result-limits.js +7 -0
  72. package/dist/adt/result-limits.js.map +1 -0
  73. package/dist/adt/server-driven.d.ts +6 -1
  74. package/dist/adt/server-driven.d.ts.map +1 -1
  75. package/dist/adt/server-driven.js +24 -20
  76. package/dist/adt/server-driven.js.map +1 -1
  77. package/dist/adt/table-query.d.ts +2 -0
  78. package/dist/adt/table-query.d.ts.map +1 -1
  79. package/dist/adt/table-query.js +61 -0
  80. package/dist/adt/table-query.js.map +1 -1
  81. package/dist/adt/text-elements.d.ts +48 -0
  82. package/dist/adt/text-elements.d.ts.map +1 -0
  83. package/dist/adt/text-elements.js +116 -0
  84. package/dist/adt/text-elements.js.map +1 -0
  85. package/dist/adt/types.d.ts +16 -0
  86. package/dist/adt/types.d.ts.map +1 -1
  87. package/dist/adt/uiad.d.ts +19 -0
  88. package/dist/adt/uiad.d.ts.map +1 -0
  89. package/dist/adt/uiad.js +173 -0
  90. package/dist/adt/uiad.js.map +1 -0
  91. package/dist/adt/xml-parser.d.ts +2 -0
  92. package/dist/adt/xml-parser.d.ts.map +1 -1
  93. package/dist/adt/xml-parser.js +20 -1
  94. package/dist/adt/xml-parser.js.map +1 -1
  95. package/dist/authz/policy.d.ts.map +1 -1
  96. package/dist/authz/policy.js +4 -1
  97. package/dist/authz/policy.js.map +1 -1
  98. package/dist/cache/cache.d.ts +3 -23
  99. package/dist/cache/cache.d.ts.map +1 -1
  100. package/dist/cache/cache.js +2 -3
  101. package/dist/cache/cache.js.map +1 -1
  102. package/dist/cache/caching-layer.d.ts +6 -25
  103. package/dist/cache/caching-layer.d.ts.map +1 -1
  104. package/dist/cache/caching-layer.js +3 -45
  105. package/dist/cache/caching-layer.js.map +1 -1
  106. package/dist/cache/memory.d.ts +1 -4
  107. package/dist/cache/memory.d.ts.map +1 -1
  108. package/dist/cache/memory.js +1 -10
  109. package/dist/cache/memory.js.map +1 -1
  110. package/dist/cache/sqlite.d.ts +1 -3
  111. package/dist/cache/sqlite.d.ts.map +1 -1
  112. package/dist/cache/sqlite.js +2 -17
  113. package/dist/cache/sqlite.js.map +1 -1
  114. package/dist/cli-checks.d.ts +3 -0
  115. package/dist/cli-checks.d.ts.map +1 -1
  116. package/dist/cli-checks.js +16 -0
  117. package/dist/cli-checks.js.map +1 -1
  118. package/dist/cli.d.ts.map +1 -1
  119. package/dist/cli.js +5 -2
  120. package/dist/cli.js.map +1 -1
  121. package/dist/context/compressor.d.ts +2 -3
  122. package/dist/context/compressor.d.ts.map +1 -1
  123. package/dist/context/compressor.js +30 -49
  124. package/dist/context/compressor.js.map +1 -1
  125. package/dist/context/contract.d.ts +5 -0
  126. package/dist/context/contract.d.ts.map +1 -1
  127. package/dist/context/contract.js +2 -2
  128. package/dist/context/contract.js.map +1 -1
  129. package/dist/context/deps.d.ts +11 -0
  130. package/dist/context/deps.d.ts.map +1 -1
  131. package/dist/context/deps.js +2 -2
  132. package/dist/context/deps.js.map +1 -1
  133. package/dist/context/parse-cache.d.ts +23 -0
  134. package/dist/context/parse-cache.d.ts.map +1 -0
  135. package/dist/context/parse-cache.js +71 -0
  136. package/dist/context/parse-cache.js.map +1 -0
  137. package/dist/context/relation-walk.d.ts +48 -0
  138. package/dist/context/relation-walk.d.ts.map +1 -0
  139. package/dist/context/relation-walk.js +137 -0
  140. package/dist/context/relation-walk.js.map +1 -0
  141. package/dist/context/types.d.ts +4 -4
  142. package/dist/context/types.d.ts.map +1 -1
  143. package/dist/handlers/activate.d.ts +1 -1
  144. package/dist/handlers/activate.d.ts.map +1 -1
  145. package/dist/handlers/activate.js +33 -56
  146. package/dist/handlers/activate.js.map +1 -1
  147. package/dist/handlers/activation-results.d.ts +3 -0
  148. package/dist/handlers/activation-results.d.ts.map +1 -0
  149. package/dist/handlers/activation-results.js +8 -0
  150. package/dist/handlers/activation-results.js.map +1 -0
  151. package/dist/handlers/context.d.ts.map +1 -1
  152. package/dist/handlers/context.js +8 -32
  153. package/dist/handlers/context.js.map +1 -1
  154. package/dist/handlers/data-element-fields.d.ts +26 -0
  155. package/dist/handlers/data-element-fields.d.ts.map +1 -0
  156. package/dist/handlers/data-element-fields.js +27 -0
  157. package/dist/handlers/data-element-fields.js.map +1 -0
  158. package/dist/handlers/diagnose-ci.d.ts +9 -0
  159. package/dist/handlers/diagnose-ci.d.ts.map +1 -0
  160. package/dist/handlers/diagnose-ci.js +120 -0
  161. package/dist/handlers/diagnose-ci.js.map +1 -0
  162. package/dist/handlers/diagnose-fields.d.ts +51 -0
  163. package/dist/handlers/diagnose-fields.d.ts.map +1 -0
  164. package/dist/handlers/diagnose-fields.js +48 -0
  165. package/dist/handlers/diagnose-fields.js.map +1 -0
  166. package/dist/handlers/diagnose.d.ts +4 -1
  167. package/dist/handlers/diagnose.d.ts.map +1 -1
  168. package/dist/handlers/diagnose.js +28 -6
  169. package/dist/handlers/diagnose.js.map +1 -1
  170. package/dist/handlers/dispatch.d.ts.map +1 -1
  171. package/dist/handlers/dispatch.js +22 -5
  172. package/dist/handlers/dispatch.js.map +1 -1
  173. package/dist/handlers/feature-cache.d.ts +4 -3
  174. package/dist/handlers/feature-cache.d.ts.map +1 -1
  175. package/dist/handlers/feature-cache.js +4 -3
  176. package/dist/handlers/feature-cache.js.map +1 -1
  177. package/dist/handlers/hyperfocused.js +1 -1
  178. package/dist/handlers/live-relations.d.ts +5 -0
  179. package/dist/handlers/live-relations.d.ts.map +1 -0
  180. package/dist/handlers/live-relations.js +89 -0
  181. package/dist/handlers/live-relations.js.map +1 -0
  182. package/dist/handlers/manage.d.ts.map +1 -1
  183. package/dist/handlers/manage.js +7 -4
  184. package/dist/handlers/manage.js.map +1 -1
  185. package/dist/handlers/navigate.d.ts +1 -1
  186. package/dist/handlers/navigate.d.ts.map +1 -1
  187. package/dist/handlers/navigate.js +11 -5
  188. package/dist/handlers/navigate.js.map +1 -1
  189. package/dist/handlers/object-types.d.ts +2 -0
  190. package/dist/handlers/object-types.d.ts.map +1 -1
  191. package/dist/handlers/object-types.js +41 -6
  192. package/dist/handlers/object-types.js.map +1 -1
  193. package/dist/handlers/query-errors.d.ts +9 -1
  194. package/dist/handlers/query-errors.d.ts.map +1 -1
  195. package/dist/handlers/query-errors.js +40 -28
  196. package/dist/handlers/query-errors.js.map +1 -1
  197. package/dist/handlers/query.d.ts +1 -1
  198. package/dist/handlers/query.d.ts.map +1 -1
  199. package/dist/handlers/query.js +2 -2
  200. package/dist/handlers/query.js.map +1 -1
  201. package/dist/handlers/read.d.ts +1 -1
  202. package/dist/handlers/read.d.ts.map +1 -1
  203. package/dist/handlers/read.js +48 -15
  204. package/dist/handlers/read.js.map +1 -1
  205. package/dist/handlers/relation-input.d.ts +42 -0
  206. package/dist/handlers/relation-input.d.ts.map +1 -0
  207. package/dist/handlers/relation-input.js +22 -0
  208. package/dist/handlers/relation-input.js.map +1 -0
  209. package/dist/handlers/relation-tool.d.ts +5 -0
  210. package/dist/handlers/relation-tool.d.ts.map +1 -0
  211. package/dist/handlers/relation-tool.js +36 -0
  212. package/dist/handlers/relation-tool.js.map +1 -0
  213. package/dist/handlers/schemas.d.ts +119 -62
  214. package/dist/handlers/schemas.d.ts.map +1 -1
  215. package/dist/handlers/schemas.js +150 -13
  216. package/dist/handlers/schemas.js.map +1 -1
  217. package/dist/handlers/search.d.ts +1 -1
  218. package/dist/handlers/search.d.ts.map +1 -1
  219. package/dist/handlers/search.js +18 -5
  220. package/dist/handlers/search.js.map +1 -1
  221. package/dist/handlers/tool-descriptions.d.ts.map +1 -1
  222. package/dist/handlers/tool-descriptions.js +12 -13
  223. package/dist/handlers/tool-descriptions.js.map +1 -1
  224. package/dist/handlers/tool-registry.d.ts +1 -0
  225. package/dist/handlers/tool-registry.d.ts.map +1 -1
  226. package/dist/handlers/tool-registry.js +4 -0
  227. package/dist/handlers/tool-registry.js.map +1 -1
  228. package/dist/handlers/tools.d.ts +2 -3
  229. package/dist/handlers/tools.d.ts.map +1 -1
  230. package/dist/handlers/tools.js +127 -72
  231. package/dist/handlers/tools.js.map +1 -1
  232. package/dist/handlers/write/batch-results.d.ts +28 -0
  233. package/dist/handlers/write/batch-results.d.ts.map +1 -0
  234. package/dist/handlers/write/batch-results.js +106 -0
  235. package/dist/handlers/write/batch-results.js.map +1 -0
  236. package/dist/handlers/write/create-transport.d.ts +7 -0
  237. package/dist/handlers/write/create-transport.d.ts.map +1 -0
  238. package/dist/handlers/write/create-transport.js +38 -0
  239. package/dist/handlers/write/create-transport.js.map +1 -0
  240. package/dist/handlers/write/create.d.ts.map +1 -1
  241. package/dist/handlers/write/create.js +276 -413
  242. package/dist/handlers/write/create.js.map +1 -1
  243. package/dist/handlers/write/uiad.d.ts +8 -0
  244. package/dist/handlers/write/uiad.d.ts.map +1 -0
  245. package/dist/handlers/write/uiad.js +115 -0
  246. package/dist/handlers/write/uiad.js.map +1 -0
  247. package/dist/handlers/write/update-delete.d.ts +6 -6
  248. package/dist/handlers/write/update-delete.d.ts.map +1 -1
  249. package/dist/handlers/write/update-delete.js +46 -15
  250. package/dist/handlers/write/update-delete.js.map +1 -1
  251. package/dist/handlers/write-helpers.d.ts +0 -6
  252. package/dist/handlers/write-helpers.d.ts.map +1 -1
  253. package/dist/handlers/write-helpers.js +88 -80
  254. package/dist/handlers/write-helpers.js.map +1 -1
  255. package/dist/handlers/write.d.ts.map +1 -1
  256. package/dist/handlers/write.js +5 -1
  257. package/dist/handlers/write.js.map +1 -1
  258. package/dist/public/ui/app.js +0 -2
  259. package/dist/server/audit.d.ts +1 -1
  260. package/dist/server/audit.d.ts.map +1 -1
  261. package/dist/server/http.d.ts +1 -1
  262. package/dist/server/http.d.ts.map +1 -1
  263. package/dist/server/http.js +1 -0
  264. package/dist/server/http.js.map +1 -1
  265. package/dist/server/logger.d.ts.map +1 -1
  266. package/dist/server/logger.js +4 -1
  267. package/dist/server/logger.js.map +1 -1
  268. package/dist/server/multi-target-tools.d.ts.map +1 -1
  269. package/dist/server/multi-target-tools.js +3 -1
  270. package/dist/server/multi-target-tools.js.map +1 -1
  271. package/dist/server/server-instructions.d.ts.map +1 -1
  272. package/dist/server/server-instructions.js +11 -5
  273. package/dist/server/server-instructions.js.map +1 -1
  274. package/dist/server/server.d.ts +1 -1
  275. package/dist/server/server.d.ts.map +1 -1
  276. package/dist/server/server.js +18 -44
  277. package/dist/server/server.js.map +1 -1
  278. package/dist/server/shutdown.d.ts +6 -0
  279. package/dist/server/shutdown.d.ts.map +1 -0
  280. package/dist/server/shutdown.js +52 -0
  281. package/dist/server/shutdown.js.map +1 -0
  282. package/dist/server/sinks/btp-auditlog.d.ts +10 -8
  283. package/dist/server/sinks/btp-auditlog.d.ts.map +1 -1
  284. package/dist/server/sinks/btp-auditlog.js +76 -68
  285. package/dist/server/sinks/btp-auditlog.js.map +1 -1
  286. package/dist/server/sinks/file.d.ts +1 -1
  287. package/dist/server/sinks/file.d.ts.map +1 -1
  288. package/dist/server/sinks/file.js +12 -21
  289. package/dist/server/sinks/file.js.map +1 -1
  290. package/dist/server/ui.js +0 -2
  291. package/dist/server/ui.js.map +1 -1
  292. package/package.json +15 -13
@@ -6,9 +6,7 @@
6
6
  * - description: Rich LLM-friendly description
7
7
  * - inputSchema: JSON Schema for tool arguments
8
8
  *
9
- * The 12 intent-based design is ARC-1's key differentiator:
10
- * instead of 200+ individual tools (one per object type per operation),
11
- * we group by *intent* with a `type` parameter for routing.
9
+ * Group operations by intent, with a `type` parameter for object routing.
12
10
  * This keeps the LLM's tool selection simple and the context window small.
13
11
  *
14
12
  * Tool definitions adapt based on system type (BTP vs on-premise):
@@ -16,12 +14,19 @@
16
14
  * TEXT_ELEMENTS, VARIANTS), adjusts descriptions for restricted features
17
15
  * - On-premise: full tool set with all types and descriptions
18
16
  */
17
+ import { ATC_BATCH_MAX_OBJECTS, ATC_BATCH_NAME_MAX_LENGTH, ATC_BATCH_NAME_PATTERN, ATC_BATCH_TYPES, } from '../adt/atc-batch.js';
18
+ import { KTD_SHORT_TEXT_MAX_LENGTH } from '../adt/ddic-xml.js';
19
+ import { TEXT_ELEMENT_PARTS } from '../adt/text-elements.js';
19
20
  import { MAX_GREP_PATTERN_LENGTH } from '../context/grep.js';
21
+ import * as DtelFields from './data-element-fields.js';
22
+ import { SAPDIAGNOSE_ADDITIONAL_INPUTS } from './diagnose-fields.js';
20
23
  import * as FuncProcessing from './function-processing.js';
21
24
  import { getHyperfocusedToolDefinition } from './hyperfocused.js';
22
25
  import { CLASS_WRITE_INCLUDES } from './object-types.js';
26
+ import { addLiveRelationsDefinition } from './relation-tool.js';
23
27
  import { SAPWRITE_DESC_BTP, SAPWRITE_DESC_ONPREM } from './tool-descriptions.js';
24
- import { isGitToolVisible, SAPCONTEXT_TYPES_BTP, SAPCONTEXT_TYPES_ONPREM, SAPREAD_TYPES_BTP, SAPREAD_TYPES_ONPREM, SAPWRITE_TYPES_BTP, SAPWRITE_TYPES_ONPREM, } from './tool-registry.js';
28
+ import { ATC_BATCH_TYPES_BTP, isGitToolVisible, SAPCONTEXT_TYPES_BTP, SAPCONTEXT_TYPES_ONPREM, SAPREAD_TYPES_BTP, SAPREAD_TYPES_ONPREM, SAPWRITE_TYPES_BTP, SAPWRITE_TYPES_ONPREM, } from './tool-registry.js';
29
+ import { BATCH_CREATE_MAX_OBJECTS } from './write/batch-results.js';
25
30
  /**
26
31
  * Read-only / destructive hints for the 12 standard tools. Clients use them to badge tools
27
32
  * and to decide auto-approval (read-only tools are safe to auto-run); they are also required
@@ -56,37 +61,37 @@ const TOOL_ANNOTATIONS = {
56
61
  function isBtpMode(config) {
57
62
  return config.systemType === 'btp';
58
63
  }
59
- const SAPREAD_DESC_ONPREM = 'Read SAP ABAP objects — exact raw source, a method body, grep output, inactive drafts, revision history, or metadata. For "what does this object do?", explanations, spec work, reviews, or pre-change orientation, prefer SAPContext first (intent-level context before raw source). ' +
64
+ const SAPREAD_DESC_ONPREM = 'Read SAP ABAP source or metadata. For purpose, explanations, specs, reviews or pre-change context, prefer SAPContext first. DDIC metadata: omit format (default text); structured is CLAS-only for ordinary reads. ' +
60
65
  'Types: PROG, CLAS, INTF, FUNC, FUGR (expand_includes=true for all include sources), INCL, DDLS, DCLS, DDLX, BDEF, SRVD, SRVB, SKTD/KTD (KTD aliases SKTD), TABL (covers both transparent tables AND DDIC structures — no separate STRU type), TTYP, VIEW, DOMA, DTEL, TRAN, TABLE_CONTENTS (single-column filter), TABLE_QUERY (multi-column WHERE via the freestyle endpoint; gated by allowDataPreview; CDS views need SAP_BASIS 752+), DEVC, SOBJ (BOR — method param reads one method), SYSTEM, COMPONENTS, MSAG, TEXT_ELEMENTS, VARIANTS, BSP, BSP_DEPLOY, API_STATE (contract states C0-C4; objectType for non-class), INACTIVE_OBJECTS (no name; pending-activation list), AUTH, FEATURE_TOGGLE, ENHO, VERSIONS, VERSION_SOURCE. AUTH/FEATURE_TOGGLE/ENHO/VERSIONS/VERSION_SOURCE are on-prem only. ' +
61
- 'CLAS: to save tokens, prefer method="*" (all signatures), method="NAME" (one body, ~95% fewer tokens than the full class), or grep over reading the full source. Omit include for the full source, or include=definitions|implementations|macros|testclasses for a local section. Full per-type detail: docs_page SAPRead. ' +
62
- 'Optional grep: case-insensitive regex returning only matching source lines (+context, line numbers); for CLAS, matches are annotated with the owning class/method. ' +
63
- 'Optional version parameter (default "active"): "inactive" reads the user\'s draft, "auto" the developer view. Active reads note when an inactive draft exists.';
64
- const SAPREAD_DESC_BTP = 'Read SAP ABAP objects (BTP ABAP Environment) — exact raw source, a method body, grep output, inactive drafts, or metadata. For "what does this object do?", explanations, spec work, reviews, or pre-change orientation, prefer SAPContext first (intent-level context before raw source). ' +
66
+ 'CLAS: method="*" for signatures, method="NAME" for one body, or grep. Global class declaration/implementation: MAIN (omit include). definitions/implementations contain local helpers. Details: docs_page SAPRead. ' +
67
+ 'grep: case-insensitive regex; returns matching lines, context and line numbers, with owning class/method for CLAS. ' +
68
+ 'Optional version parameter: source types default active; "inactive" requests the draft (SAP may return active if none); "auto" uses the developer view. DTEL omitted/auto uses its developer view; explicit values pass through. Active source reads note when a draft exists.';
69
+ const SAPREAD_DESC_BTP = 'Read SAP ABAP source or metadata (BTP ABAP Environment). For purpose, explanations, specs, reviews or pre-change context, prefer SAPContext first. DDIC metadata: omit format (default text); structured is CLAS-only for ordinary reads. ' +
65
70
  'Types: CLAS, INTF, FUNC (released/custom only), FUGR (released/custom only), DDLS (primary data model on BTP), DCLS, DDLX, BDEF, SRVD, SRVB, SKTD/KTD (KTD aliases SKTD), TABL (custom tables AND structures — no separate STRU type), DOMA, DTEL, TABLE_CONTENTS (custom tables + released CDS only; standard tables blocked), TABLE_QUERY (multi-column WHERE on custom tables + released CDS; needs SAP_BASIS 752+), DEVC, SYSTEM, COMPONENTS, MSAG (custom only), BSP, BSP_DEPLOY, API_STATE (contract states C0-C4; objectType for non-class), INACTIVE_OBJECTS (no name; pending-activation list). PROG/INCL/VIEW/TRAN/TEXT_ELEMENTS/VARIANTS and VERSIONS/VERSION_SOURCE are not available on BTP (use CLAS with IF_OO_ADT_CLASSRUN for console apps, DDLS for data models). ' +
66
- 'CLAS: to save tokens, prefer method="*" (all signatures), method="NAME" (one body, ~95% fewer tokens than the full class), or grep over reading the full source. Omit include for the full source, or include=definitions|implementations|macros|testclasses for a local section. Full per-type detail: docs_page SAPRead. ' +
67
- 'Optional grep: case-insensitive regex returning only matching source lines (+context, line numbers); for CLAS, matches are annotated with the owning class/method. ' +
68
- 'Optional version parameter (default "active"): "inactive" reads the user\'s draft, "auto" the developer view.';
71
+ 'CLAS: method="*" for signatures, method="NAME" for one body, or grep. Global class declaration/implementation: MAIN (omit include). definitions/implementations contain local helpers. Details: docs_page SAPRead. ' +
72
+ 'grep: case-insensitive regex; returns matching lines, context and line numbers, with owning class/method for CLAS. ' +
73
+ 'Optional version parameter: source types default active; "inactive" requests the draft (SAP may return active if none); "auto" uses the developer view. DTEL omitted/auto uses its developer view; explicit values pass through.';
69
74
  // ─── SAPContext Types ───────────────────────────────────────────────
70
75
  const SAPCONTEXT_DESC_ONPREM = 'Primary tool for understanding ABAP/CDS objects before specs, reviews, explanations, or changes — use instead of SAPRead when the user asks what an object does. Returns intent first (the object KTD when available) then compressed dependency contracts. Use SAPRead after SAPContext for exact source/method bodies/grep/drafts.\n\n' +
71
76
  "Decision rule — pick the action from the user's question:\n" +
72
77
  '- "What breaks if I change <CDS>?" / "Who consumes <I_*>?" / "Blast radius" → action="impact" (DDLS only).\n' +
73
78
  '- "Which includes/appends extend <TABL>?" → action="structure", type="TABL".\n' +
74
- '- "What does <object> do?" / "Explain" / "deps before editing" → action="deps" (default).\n' +
79
+ '- "What does <object> do?" / "Explain" / "deps before editing" → action="deps" (default); type+name required.\n' +
75
80
  '- "Find all callers of <object>" → action="usages" (live SAP where-used lookup).\n\n' +
76
81
  'impact (CDS blast-radius): upstream AST deps + downstream where-used, classified into RAP buckets (projectionViews, bdefs, serviceDefinitions, serviceBindings, accessControls, metadataExtensions, abapConsumers, documentation, tables, other) + sibling-consistency hints. Use this instead of text-scanning DDDDLSRC/ACMDCLSRC with SAPQuery (it filters the noise). Optional includeIndirect, siblingCheck, siblingMaxCandidates.\n' +
77
- 'deps (default): target KTD + the public API contracts of its dependencies (not full source) one compact response vs N SAPRead calls (7-30x fewer tokens); SAP standard objects filtered out. For CDS, includes dependency DDL/field catalogs for cl_cds_test_environment.\n' +
82
+ 'deps: target KTD when available + selected dependency contracts, derived from source (not SAP-native relationships or a complete inventory). Counts distinguish root candidates from recursive attempts. Standard helper names are filtered. For CDS, includes dependency DDL/field catalogs for cl_cds_test_environment.\n' +
78
83
  'structure (TABL only): the DDIC include/append tree.\n\n' +
79
- 'Use SAPContext BEFORE editing existing objects. For non-CDS reverse-lookup use SAPNavigate(references); for CDS prefer impact. Full detail: docs_page SAPContext.';
84
+ 'Non-CDS reverse-lookup: SAPNavigate(references); CDS: impact. Full detail: docs_page SAPContext.';
80
85
  const SAPCONTEXT_DESC_BTP = 'Primary tool for understanding ABAP/CDS objects before specs, reviews, explanations, or changes (BTP ABAP Environment) — use instead of SAPRead when the user asks what an object does. Returns intent first (object KTD when available) then compressed dependency contracts.\n\n' +
81
86
  "Decision rule — pick the action from the user's question:\n" +
82
87
  '- "What breaks if I change <CDS>?" / "Who consumes <I_*>?" / "Blast radius" → action="impact" (DDLS only).\n' +
83
88
  '- "Which includes/appends extend <TABL>?" → action="structure", type="TABL".\n' +
84
- '- "What does <object> do?" / "Explain" / "deps before editing" → action="deps" (default).\n\n' +
89
+ '- "What does <object> do?" / "Explain" / "deps before editing" → action="deps" (default); type+name required.\n\n' +
85
90
  '- "Find all callers of <object>" → action="usages" (live SAP where-used lookup).\n\n' +
86
91
  'impact (CDS blast-radius): upstream AST deps + downstream where-used classified into RAP buckets (projectionViews, bdefs, serviceDefinitions, serviceBindings, accessControls, metadataExtensions, abapConsumers, documentation, tables, other) + sibling-consistency hints; filters the noise that text-scanning with SAPQuery produces. Optional includeIndirect, siblingCheck, siblingMaxCandidates.\n' +
87
- 'deps (default): target KTD + the public API contracts of its dependencies (not full source). On BTP, released SAP objects (CL_ABAP_*/IF_ABAP_*) and custom Z/Y are included.\n' +
92
+ 'deps: target KTD when available + selected dependency contracts, derived from source (not SAP-native relationships or a complete inventory). Counts distinguish root candidates from recursive attempts. On BTP, CL_ABAP_*/IF_ABAP_* and custom Z/Y are included.\n' +
88
93
  'structure (TABL only): the DDIC include/append tree.\n\n' +
89
- 'Use SAPContext BEFORE editing existing objects; SAPRead afterwards for exact source. Full detail: docs_page SAPContext.';
94
+ 'Full detail: docs_page SAPContext.';
90
95
  // ─── SAPQuery ───────────────────────────────────────────────────────
91
96
  const SAPQUERY_DIALECT_GUIDE = 'ADT freestyle ABAP SQL: one read-only SELECT. Use AS aliases, alias~field/alias~*, ASCENDING/DESCENDING, single-quoted literals (no @/:/? parameters), and maxRows (not TOP/LIMIT/OFFSET/FETCH). JOINs, GROUP BY, aggregates, UNION and subqueries work. CTEs, FULL JOIN, derived/window tables, INTERSECT/EXCEPT, comments, semicolons and schema prefixes do not. ARC-1 auto-chunks long literal IN-lists in plain projection SELECTs. ';
92
97
  const SAPQUERY_DESC_ONPREM = 'Query SAP tables with ABAP SQL; returns columns + rows. For reverse-engineering metadata: DD02L, DD03L, TADIR, TFDIR, SWOTLV. Unknown tables get suggestions. ' +
@@ -228,7 +233,8 @@ function buildSAPSearchTool(btp, textSearchAvailable) {
228
233
  };
229
234
  properties.objectType = {
230
235
  type: 'string',
231
- description: 'For source_code search: filter by object type (e.g., PROG, CLAS, FUNC). For tadir_lookup: single type filter; use objectTypes for multiple.',
236
+ maxLength: 64,
237
+ description: 'Object search: SAP-side type filter before the result limit (e.g., UIAC, CLAS, CLAS/OC). Source search: type filter (e.g., PROG, CLAS, FUNC). For tadir_lookup: single type filter; use objectTypes for multiple.',
232
238
  };
233
239
  properties.source = {
234
240
  type: 'string',
@@ -350,9 +356,11 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
350
356
  },
351
357
  include: {
352
358
  type: 'string',
353
- description: 'For CLAS: omit include for full MAIN; otherwise select definitions, implementations, macros, or testclasses. With method=, an explicit include (including main) selects the source before extraction. ' +
359
+ description: 'CLAS: omit include or use main for the global declaration + implementation; definitions/implementations select local helper classes, macros/testclasses their own sections. Explicit include wins over method auto-routing. ' +
354
360
  'For DDLS: use include="elements" for the CDS field catalog (key fields, aliases, associations, expression types) instead of raw DDL. ' +
355
- 'For VERSIONS (CLAS): include selects the class include history to query (main, definitions, implementations, macros, testclasses). BSP: case-sensitive path; name may also be APP/path.',
361
+ 'For VERSIONS (CLAS): include selects the class include history to query (main, definitions, implementations, macros, testclasses). BSP: case-sensitive path; name may also be APP/path.' +
362
+ // TEXT_ELEMENTS does not exist on BTP — keep the BTP surface byte-identical.
363
+ (btp ? '' : ' TEXT_ELEMENTS: symbols|selections|headings; omit for pool (CLAS: symbols).'),
356
364
  },
357
365
  group: {
358
366
  type: 'string',
@@ -384,12 +392,12 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
384
392
  format: {
385
393
  type: 'string',
386
394
  enum: ['text', 'structured'],
387
- description: 'Output format. For action="diff", "structured" returns JSON {hasDifferences, identical, added, removed, diff, version labels}; default remains the human-readable patch. For ordinary reads, "text" (default) is raw source; "structured" (CLAS only) returns JSON metadata + EVERY class include a superset of "text", so it always costs MORE (measured +10% to +1685%). Use only to split test from production code; otherwise method="*" / method="name" / grep=.',
395
+ description: 'Default "text" (TABL/TTYP/DTEL/DOMA/INTF metadata included). DEVC: array in first text block + listing metadata in second; "structured" returns {objects, listing}. CLAS "structured": metadata + all includes; prefer method/grep for targeted reads. action="diff": "structured" returns JSON {hasDifferences, identical, added, removed, diff, version labels}; default is a patch.',
388
396
  },
389
397
  version: {
390
398
  type: 'string',
391
399
  enum: ['active', 'inactive', 'auto'],
392
- description: 'Source version to read. "active" (default) returns the last activated version. "inactive" returns the user\'s unactivated draft or active if no draft exists. "auto" returns the draft if one exists, else active.',
400
+ description: 'Version to read. Source: "active" (default); "inactive" requests the draft (SAP may return active if none); "auto" uses the developer view. DTEL: omitted/"auto" uses its developer view; explicit values pass through.',
393
401
  },
394
402
  includeSignature: {
395
403
  type: 'boolean',
@@ -405,7 +413,7 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
405
413
  },
406
414
  maxResults: {
407
415
  type: 'number',
408
- description: 'For DEVC: max number of objects to list (default 200, clamped to [1, 1000]). Larger packages may be silently truncated by SAP at this limit; raise it if needed.',
416
+ description: 'DEVC object limit (default 200, clamped to [1, 1000]). Listing metadata reports the effective limit and possible truncation. Total and full repository completeness remain unknown.',
409
417
  },
410
418
  sqlFilter: {
411
419
  type: 'string',
@@ -413,7 +421,8 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
413
421
  },
414
422
  objectType: {
415
423
  type: 'string',
416
- description: 'For API_STATE and VERSIONS: SAP object type (CLAS, INTF, PROG, FUNC, INCL, DDLS, DCLS, BDEF, SRVD, etc.). For API_STATE: auto-detected from name if omitted. For VERSIONS: required to pick the correct revisions endpoint (e.g., "FUNC" + group for function modules); inferred from CL_/IF_/CX_ name prefixes when possible, defaults to PROG.',
424
+ description: 'For API_STATE and VERSIONS: SAP object type (CLAS, INTF, PROG, FUNC, INCL, DDLS, DCLS, BDEF, SRVD, etc.). For API_STATE: auto-detected from name if omitted. For VERSIONS: required to pick the correct revisions endpoint (e.g., "FUNC" + group for function modules); inferred from CL_/IF_/CX_ name prefixes when possible, defaults to PROG.' +
425
+ (btp ? '' : ' TEXT_ELEMENTS: PROG (default), CLAS or FUGR.'),
417
426
  },
418
427
  versionUri: {
419
428
  type: 'string',
@@ -496,14 +505,14 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
496
505
  'scaffold_rap_handlers / generate_behavior_implementation: derive behavior-pool handlers from a BDEF (the latter is the equivalent of Eclipse\'s "Generate Behavior Implementation").' +
497
506
  (btp
498
507
  ? ''
499
- : " edit_text_symbols: write a global class's text symbols (immediately active, no SAPActivate)."),
508
+ : ' edit_text_symbols: replace a CLAS/PROG/FUGR textpool part; read first, retain other entries. source="" clears it.'),
500
509
  },
501
510
  type: {
502
511
  type: 'string',
503
512
  enum: btp ? SAPWRITE_TYPES_BTP : SAPWRITE_TYPES_ONPREM,
504
513
  description: btp
505
- ? 'Object type (for create/update/delete/edit_method/edit_class_definition/add_method/edit_method_signature/delete_method/change_method_visibility). Supported on BTP: CLAS, INTF, DDLS, DCLS, DDLX, BDEF, SRVD, SRVB, SKTD or KTD (Knowledge Transfer Documents), TABL, TABL/DT, TABL/DS, DOMA, DTEL, MSAG. Class-section surgery actions require type=CLAS. Server-driven objects (discovery-gated): DESD/CSNM/EVTB/EVTO/COTA/UIAD take AFF JSON in "source"; DTSC/DSFD/DTDC take DDL text — create/update/delete, then SAPActivate.'
506
- : 'Object type (for create/update/delete/edit_method/edit_unit/edit_class_definition/add_method/edit_method_signature/delete_method/change_method_visibility). Supported on-prem: PROG, CLAS, INTF, FUNC, FUGR, INCL, DDLS, DCLS, DDLX, BDEF, SRVD, SRVB, SKTD or KTD (Knowledge Transfer Documents), TABL, TABL/DT, TABL/DS, DOMA, DTEL, MSAG. Class-section surgery actions require CLAS. Server-driven objects (discovery-gated): DESD/CSNM/EVTB/EVTO/COTA take AFF JSON in "source"; DTSC/DSFD/DTDC take DDL text — create/update/delete, then SAPActivate. UIAD is read-only outside ABAP Cloud.',
514
+ ? 'Object type (for create/update/delete/edit_method/edit_class_definition/add_method/edit_method_signature/delete_method/change_method_visibility). Supported on BTP: CLAS, INTF, DDLS, DCLS, DDLX, BDEF, SRVD, SRVB, SKTD or KTD (Knowledge Transfer Documents), TABL, TABL/DT, TABL/DS, DOMA, DTEL, MSAG. Class-section surgery actions require type=CLAS. Server-driven objects (discovery-gated): DESD/CSNM/EVTB/EVTO/COTA take AFF JSON in "source"; DTSC/DSFD/DTDC take DDL text — create/update/delete, then SAPActivate. UIAD: checks AFF JSON; create honors header.abapLanguageVersion. Manual cloudDevelopment items are editable; generated items may be read-only.'
515
+ : 'Object type (for create/update/delete/edit_method/edit_unit/edit_class_definition/add_method/edit_method_signature/delete_method/change_method_visibility). Supported on-prem: PROG, CLAS, INTF, FUNC, FUGR, INCL, DDLS, DCLS, DDLX, BDEF, SRVD, SRVB, SKTD or KTD (Knowledge Transfer Documents), TABL, TABL/DT, TABL/DS, DOMA, DTEL, MSAG. Class-section surgery actions require CLAS. Server-driven objects (discovery-gated): DESD/CSNM/EVTB/EVTO/COTA take AFF JSON in "source"; DTSC/DSFD/DTDC take DDL text — create/update/delete, then SAPActivate. UIAD: validates AFF JSON and saves active; create honors header.abapLanguageVersion. Manual cloudDevelopment items are editable; generated items can be read-only.',
507
516
  },
508
517
  name: {
509
518
  type: 'string',
@@ -514,14 +523,23 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
514
523
  source: {
515
524
  type: 'string',
516
525
  description: btp
517
- ? 'ABAP source. create/update: full body. DDLS: type=DDLS; Cloud permits eligible `extend view entity`, not legacy `extend view`. edit_method: body. edit_class_definition without include=: only global CLASS…DEFINITION…ENDCLASS block (no IMPLEMENTATION); with include=: full replacement include. edit_method_signature: only new METHODS clause. Not used by add_method/delete_method/change_method_visibility (use `method`/`visibility`).'
518
- : 'Source. create/update: full body. DDLS: type=DDLS for `extend view`/`extend view entity`; legacy needs a Standard ABAP package. edit_method: body. edit_unit: complete FORM/MODULE. edit_class_definition without include=: only global CLASS…DEFINITION…ENDCLASS block (no IMPLEMENTATION); with include=: full replacement include. edit_method_signature: only METHODS clause. Not used by add_method/delete_method/change_method_visibility (use `method`/`visibility`).',
526
+ ? 'ABAP source. create/update: full body. DDLS: type=DDLS; Cloud permits eligible `extend view entity`, not legacy `extend view`. edit_method: body. edit_class_definition without include=: only global CLASS…DEFINITION…ENDCLASS block (no IMPLEMENTATION); with include=: full replacement include. edit_method_signature: only new METHODS clause. Not used by add_method/delete_method/change_method_visibility (use `method`/`visibility`). SKTD/KTD: one "## <node>" section per node (any name or id the SAPRead node index lists); update MERGES, so unaddressed nodes keep their text; an unmatched node-shaped heading aborts it.'
527
+ : 'Source. create/update: full body. DDLS: type=DDLS for `extend view`/`extend view entity`; legacy needs a Standard ABAP package. edit_method: body. edit_unit: complete FORM/MODULE. edit_class_definition without include=: only global CLASS…DEFINITION…ENDCLASS block (no IMPLEMENTATION); with include=: full replacement include. edit_method_signature: only METHODS clause. Not used by add_method/delete_method/change_method_visibility (use `method`/`visibility`). SKTD/KTD: one "## <node>" section per node (any name or id the SAPRead node index lists); update MERGES, so unaddressed nodes keep their text; an unmatched node-shaped heading aborts it.',
519
528
  },
520
529
  include: {
521
530
  type: 'string',
522
531
  enum: CLASS_WRITE_INCLUDES,
523
532
  description: 'CLAS-ONLY. Do NOT send unless type=CLAS AND action is update / edit_method / edit_class_definition. OMIT it entirely for every other type and for delete / batch_create / add_method / edit_method_signature / delete_method / change_method_visibility (those use /source/main). Targets a class-local include: definitions (CCDEF), implementations (CCIMP), macros, testclasses. edit_method auto-detects it from the method specifier (lhc_*/lcl_* → implementations, ltc_* → testclasses), so you rarely pass it; use include=testclasses to create a new local test class. Whole-include writes auto-create a missing include and produce an inactive draft (read with SAPRead version="inactive" before activation).',
524
533
  },
534
+ ...(btp
535
+ ? {}
536
+ : {
537
+ textPart: {
538
+ type: 'string',
539
+ enum: TEXT_ELEMENT_PARTS,
540
+ description: 'edit_text_symbols: symbols (default), selections (selection-screen labels), headings. CLAS: symbols only.',
541
+ },
542
+ }),
525
543
  method: {
526
544
  type: 'string',
527
545
  description: 'edit_method/edit_method_signature/delete_method/change_method_visibility: the method NAME (e.g. "get_name", "zif_order~process", "lhc_project~approve_project"). add_method: the full METHODS clause as ABAP source. Local-class methods auto-route by prefix (lhc_*/lcl_* → implementations, ltc_* → testclasses); use the qualified <localclass>~<method> form when a bare name is ambiguous.',
@@ -565,7 +583,7 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
565
583
  },
566
584
  dryRun: {
567
585
  type: 'boolean',
568
- description: 'For generate_behavior_implementation: when true, runs discovery + cross-validation + scaffold planning and returns the report without writing or activating. Use this to preview what would change.',
586
+ description: 'For generate_behavior_implementation: when true, runs discovery + cross-validation + scaffold planning and returns the report without writing or activating. Use this to preview what would change. SKTD/KTD update: reports which nodes would change, writing nothing.',
569
587
  },
570
588
  description: {
571
589
  type: 'string',
@@ -625,6 +643,7 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
625
643
  mediumLabel: { type: 'string', description: 'DTEL: medium field label' },
626
644
  longLabel: { type: 'string', description: 'DTEL: long field label' },
627
645
  headingLabel: { type: 'string', description: 'DTEL: heading field label' },
646
+ ...DtelFields.DATA_ELEMENT_TOOL_PROPERTIES,
628
647
  searchHelp: { type: 'string', description: 'DTEL: search help name' },
629
648
  searchHelpParameter: { type: 'string', description: 'DTEL: search help parameter' },
630
649
  setGetParameter: { type: 'string', description: 'DTEL: SET/GET parameter ID' },
@@ -711,8 +730,21 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
711
730
  type: 'string',
712
731
  description: 'SKTD/KTD create: description of the parent object (shown in Eclipse tooltips).',
713
732
  },
733
+ shortTexts: {
734
+ type: 'array',
735
+ description: `SKTD/KTD create/update: node = any name or id the SAPRead node index lists; text max ${KTD_SHORT_TEXT_MAX_LENGTH} UTF-16 units after whitespace normalization; empty clears; source optional.`,
736
+ items: {
737
+ type: 'object',
738
+ properties: {
739
+ node: { type: 'string', minLength: 1 },
740
+ text: { type: 'string' },
741
+ },
742
+ required: ['node', 'text'],
743
+ },
744
+ },
714
745
  objects: {
715
746
  type: 'array',
747
+ maxItems: BATCH_CREATE_MAX_OBJECTS,
716
748
  items: {
717
749
  type: 'object',
718
750
  properties: {
@@ -760,6 +792,7 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
760
792
  mediumLabel: { type: 'string' },
761
793
  longLabel: { type: 'string' },
762
794
  headingLabel: { type: 'string' },
795
+ ...DtelFields.DATA_ELEMENT_TOOL_PROPERTIES,
763
796
  searchHelp: { type: 'string' },
764
797
  searchHelpParameter: { type: 'string' },
765
798
  setGetParameter: { type: 'string' },
@@ -842,8 +875,8 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
842
875
  tools.push({
843
876
  name: 'SAPNavigate',
844
877
  description: btp
845
- ? 'Navigate code (BTP ABAP Environment): definitions, references (where-used), completion, class hierarchy. references uses the scope-based Where-Used API (line numbers, snippets, package); optional objectType filters by ADT slash type (e.g. CLAS/OC). type+name auto-normalized. Scope = released SAP + custom Z/Y. For CDS (DDLS), prefer SAPContext(action="impact") the same where-used pre-classified into RAP buckets.'
846
- : 'Navigate code: definitions, references (where-used), completion, class hierarchy. references uses the scope-based Where-Used API (line numbers, snippets, package); optional objectType filters by ADT slash type (e.g. CLAS/OC, PROG/P); pass type+name instead of uri. hierarchy returns superclass + interfaces + direct subclasses. For CDS (DDLS), prefer SAPContext(action="impact") the same where-used pre-classified into RAP buckets, answering "what breaks if I change this view".',
878
+ ? 'Navigate code (BTP ABAP Environment): definitions, references, completion, hierarchy. references: scope-based where-used with lines/snippets/package; objectType filters results (e.g. CLAS/OC); type+name replaces uri. Scope = released SAP + custom Z/Y. hierarchy queries SEOMETAREL: requires data/SQL opt-in + matching scope; otherwise inspect class MAIN with SAPRead. CDS (DDLS) impact: SAPContext(action="impact") classifies where-used into RAP buckets.'
879
+ : 'Navigate code: definitions, references, completion, hierarchy. references: scope-based where-used with lines/snippets/package; objectType filters results (e.g. CLAS/OC, PROG/P); type+name replaces uri. hierarchy queries SEOMETAREL for superclass/interfaces/direct subclasses: requires data/SQL opt-in + matching scope; otherwise inspect class MAIN with SAPRead. CDS (DDLS) impact: SAPContext(action="impact") classifies where-used into RAP buckets.',
847
880
  inputSchema: {
848
881
  type: 'object',
849
882
  properties: {
@@ -858,12 +891,12 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
858
891
  },
859
892
  type: {
860
893
  type: 'string',
861
- description: 'Object type (PROG, CLAS, INTF, FUNC, etc.) alternative to uri for references.',
894
+ description: 'Root object type, paired with name instead of uri (e.g. type="INTF"). Not the result-type filter.',
862
895
  },
863
896
  name: { type: 'string', description: 'Object name — alternative to uri for references.' },
864
897
  objectType: {
865
898
  type: 'string',
866
- description: 'references: keep only results of this ADT type, slash format (CLAS/OC, PROG/P, FUGR/FF). A bare prefix ("CLAS") matches every subtype.',
899
+ description: 'references RESULT filter, not the root type: CLAS/OC, PROG/P, FUGR/FF. Omit for all consumer types. A bare prefix ("CLAS") matches every subtype.',
867
900
  },
868
901
  maxResults: {
869
902
  type: 'number',
@@ -876,6 +909,8 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
876
909
  required: ['action'],
877
910
  },
878
911
  });
912
+ const navigation = tools.find((tool) => tool.name === 'SAPNavigate');
913
+ addLiveRelationsDefinition(navigation, config, options.discoveryMap ?? resolvedFeatures?.discoveryMap);
879
914
  // SAPQuery — only registered when free SQL is allowed
880
915
  if (config.allowFreeSQL) {
881
916
  tools.push({
@@ -934,16 +969,18 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
934
969
  },
935
970
  }, {
936
971
  name: 'SAPDiagnose',
937
- description: 'Run diagnostics on ABAP objects and analyze runtime errors. Actions:\n' +
972
+ description: 'ABAP diagnostics and runtime analysis. Actions:\n' +
938
973
  '- "syntax": syntax-check (name+type; optional version; optional source = pre-write dry-run, nothing written).\n' +
939
974
  '- "unittest": harmless ABAP Unit for CLAS/PROG/FUGR or DEVC (exact; includeSubpackages recurses).\n' +
940
- '- "atc": run ATC checks (name+type; omit variant to bind the system default; unknown variant = error). "atc_variants": list variants + that default (variant = name filter; read-only).\n' +
975
+ '- "unittest_ci": harmless package tests with source reconciliation; empty/incomplete runs fail.\n' +
976
+ '- "atc": run ATC checks (name+type or objects [{type,name}], max 20; omit variant to bind the system default; unknown variant = error). "atc_variants": list variants + that default (variant = name filter; read-only).\n' +
977
+ '- "atc_ci": package ATC CI; requires available API and verified selection.\n' +
941
978
  '- "cds_testcases": SAP-suggested ABAP Unit test cases for a CDS entity (name; read-only; SAP_BASIS 8.16+).\n' +
942
979
  '- "object_state": compare active vs inactive source versions (name+type; CLAS compares all includes). Returns ETags/hashes/divergence flags.\n' +
943
- '- "quickfix": get quick-fix proposals at a position (name+type+source+line; optional column, sourceUri).\n' +
944
- '- "apply_quickfix": apply one proposal, return text deltas, no write (name+type+source+line+proposalUri+proposalUserContent; pass proposalUserContent through exactly).\n' +
980
+ '- "quickfix": proposals at name+type+source+line (optional column/sourceUri).\n' +
981
+ '- "apply_quickfix": return proposal text deltas without writing; needs quickfix inputs + proposalUri/proposalUserContent.\n' +
945
982
  '- "dumps": list/read ST22 short dumps (no id = list; id = read; includeFullText, sections).\n' +
946
- '- "traces": list/analyze profiler traces (id+analysis: hitlist=hot spots, statements=call tree, dbAccesses=DB stats).\n' +
983
+ '- "traces": list profiler traces; id+analysis analyzes one.\n' +
947
984
  '- "trace_start": arm a profiler trace for the NEXT matching execution, then reproduce and read via "traces" (write scope; defaults: next HTTP request, SQL on).\n' +
948
985
  '- "trace_requests": list armed trace requests. "trace_cancel": cancel one by id (write scope).\n' +
949
986
  '- "system_messages": list SM02 messages. "gateway_errors": list /IWFND/ERROR_LOG (on-prem; detailUrl or id+errorType for detail).\n' +
@@ -960,7 +997,9 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
960
997
  enum: [
961
998
  'syntax',
962
999
  'unittest',
1000
+ 'unittest_ci',
963
1001
  'atc',
1002
+ 'atc_ci',
964
1003
  'atc_variants',
965
1004
  'cds_testcases',
966
1005
  'dumps',
@@ -983,36 +1022,56 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
983
1022
  },
984
1023
  name: {
985
1024
  type: 'string',
986
- description: 'Object name (for syntax/unittest/atc/object_state); the CDS entity / DDLS source name for cds_testcases and cds_sql',
1025
+ description: 'syntax/unittest/atc/object_state object name; cds_testcases/cds_sql CDS entity or DDLS name.',
987
1026
  },
988
1027
  url: {
989
1028
  type: 'string',
990
- description: 'For odata_perf: the host-relative OData path to probe, from the Fiori app\'s Network tab (e.g. "/sap/opu/odata4/sap/.../Entity?$filter=…"). Must be a path on the connected system — absolute URLs are rejected.',
1029
+ description: 'odata_perf: host-relative OData path from the app network request (e.g. /sap/opu/odata4/sap/.../Entity?$filter=…). Absolute URLs rejected.',
991
1030
  },
992
1031
  type: {
993
1032
  type: 'string',
994
1033
  description: 'Object type; unittest accepts CLAS, PROG, FUGR, or DEVC.',
995
1034
  },
1035
+ objects: {
1036
+ type: 'array',
1037
+ minItems: 1,
1038
+ maxItems: ATC_BATCH_MAX_OBJECTS,
1039
+ description: 'ATC only, instead of name/type/url. One batch + at most one verification. Returns coverage; unreported objects stay incomplete. No packages.',
1040
+ items: {
1041
+ type: 'object',
1042
+ required: ['type', 'name'],
1043
+ additionalProperties: false,
1044
+ properties: {
1045
+ type: { type: 'string', enum: btp ? ATC_BATCH_TYPES_BTP : [...ATC_BATCH_TYPES] },
1046
+ name: {
1047
+ type: 'string',
1048
+ minLength: 1,
1049
+ maxLength: ATC_BATCH_NAME_MAX_LENGTH,
1050
+ pattern: ATC_BATCH_NAME_PATTERN,
1051
+ },
1052
+ },
1053
+ },
1054
+ },
996
1055
  source: {
997
1056
  type: 'string',
998
1057
  description: 'Current source code (required for quickfix/apply_quickfix).',
999
1058
  },
1000
1059
  sourceUri: {
1001
1060
  type: 'string',
1002
- description: 'Exact ADT source URI for quickfix/apply_quickfix. Defaults to the type/name main source; use this for class includes such as /includes/definitions.',
1061
+ description: 'quickfix/apply_quickfix source URI; default type/name main source. Set for includes, e.g. /includes/definitions.',
1003
1062
  },
1004
1063
  line: {
1005
1064
  type: 'number',
1006
- description: 'Source line number for quickfix evaluation (required for quickfix/apply_quickfix).',
1065
+ description: 'Required quickfix/apply_quickfix source line.',
1007
1066
  },
1008
1067
  column: {
1009
1068
  type: 'number',
1010
- description: 'Source column number for quickfix evaluation (default 0 for quickfix actions).',
1069
+ description: 'Quickfix source column (default 0).',
1011
1070
  },
1012
1071
  version: {
1013
1072
  type: 'string',
1014
1073
  enum: ['active', 'inactive'],
1015
- description: 'Source version for syntax check (default "active"). Use "inactive" to validate pending changes.',
1074
+ description: 'syntax source version (default active); inactive checks pending changes.',
1016
1075
  },
1017
1076
  proposalUri: {
1018
1077
  type: 'string',
@@ -1024,7 +1083,7 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
1024
1083
  },
1025
1084
  proposalAffectedObjects: {
1026
1085
  type: 'array',
1027
- description: 'Optional affectedObjects array from quickfix action. Include content for each affected source unit when applying multi-object quickfixes.',
1086
+ description: 'quickfix affectedObjects; provide current content for each source unit when applying multi-object fixes.',
1028
1087
  items: {
1029
1088
  type: 'object',
1030
1089
  required: ['uri'],
@@ -1037,41 +1096,40 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
1037
1096
  },
1038
1097
  },
1039
1098
  },
1040
- variant: { type: 'string', description: 'atc: check variant; atc_variants: name filter (*=all)' },
1041
1099
  id: {
1042
1100
  type: 'string',
1043
1101
  description: 'Dump or trace ID (for dumps/traces actions); also the trace-request id to cancel (for trace_cancel). Omit to list, provide to get details.',
1044
1102
  },
1045
1103
  detailUrl: {
1046
1104
  type: 'string',
1047
- description: 'Canonical host-relative /sap/bc/adt/gw/errorlog/... path for detail mode; absolute URLs are rejected.',
1105
+ description: 'Detail path: canonical /sap/bc/adt/gw/errorlog/...; no absolute URLs.',
1048
1106
  },
1049
1107
  errorType: {
1050
1108
  type: 'string',
1051
- description: 'Gateway error type for gateway_errors detail by id (for example "Frontend Error"). Required when using id without detailUrl.',
1109
+ description: 'gateway_errors: required with id instead of detailUrl, e.g. "Frontend Error".',
1052
1110
  },
1053
1111
  user: { type: 'string', description: 'SAP-user filter for dumps, feeds, or authorization_trace.' },
1054
1112
  authObject: { type: 'string', description: 'Authorization object filter, e.g. S_TCODE.' },
1055
1113
  from: {
1056
1114
  type: 'string',
1057
- description: 'Optional lower time boundary for feed-based diagnostics actions (system_messages/gateway_errors).',
1115
+ description: 'system_messages/gateway_errors lower time bound.',
1058
1116
  },
1059
1117
  to: {
1060
1118
  type: 'string',
1061
- description: 'Optional upper time boundary for feed-based diagnostics actions (system_messages/gateway_errors).',
1119
+ description: 'system_messages/gateway_errors upper time bound.',
1062
1120
  },
1063
1121
  maxResults: {
1064
1122
  type: 'number',
1065
- description: 'Maximum results for dumps/system_messages/gateway_errors (default 50) or authorization_trace (default 100); bounded to a safe cap.',
1123
+ description: 'Result limit: dumps/system_messages/gateway_errors default 50; authorization_trace 100. Capped.',
1066
1124
  },
1067
1125
  sections: {
1068
1126
  type: 'array',
1069
1127
  items: { type: 'string' },
1070
- description: 'Dump chapter IDs to include for dumps detail mode (for example ["kap0","kap3","kap8"]). Omit to use focused defaults.',
1128
+ description: 'dumps detail chapter IDs, e.g. ["kap0","kap3","kap8"]; omit for focused defaults.',
1071
1129
  },
1072
1130
  includeFullText: {
1073
1131
  type: 'boolean',
1074
- description: 'For dumps detail mode only: include full formattedText blob. Default false to reduce token usage.',
1132
+ description: 'dumps detail: include full formattedText (default false).',
1075
1133
  },
1076
1134
  coverage: {
1077
1135
  type: 'boolean',
@@ -1083,57 +1141,54 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
1083
1141
  enum: ['legacy', 'structured', 'junit'],
1084
1142
  description: 'unittest: legacy|structured|junit; atc: legacy|structured; other actions reject it.',
1085
1143
  },
1086
- timeoutSeconds: {
1087
- type: 'number',
1088
- description: 'unittest/atc timeout: 1-3600s; default 300.',
1089
- },
1090
1144
  sqlOn: {
1091
1145
  type: 'boolean',
1092
- description: 'For action="set_sql_trace_state": true to arm the ST05 SQL trace, false to disarm. Combine with user to filter the trace to one SAP user.',
1146
+ description: 'set_sql_trace_state: true arms ST05 SQL trace, false disarms; user filters the SAP user.',
1093
1147
  },
1094
1148
  onlyFailures: {
1095
1149
  type: 'boolean',
1096
- description: 'For authorization_trace: return only denied checks (RC<>0), similar to the SU53 failure view.',
1150
+ description: 'authorization_trace: only denied checks (RC<>0), like SU53.',
1097
1151
  },
1098
1152
  analysis: {
1099
1153
  type: 'string',
1100
1154
  enum: ['hitlist', 'statements', 'dbAccesses'],
1101
- description: 'Trace analysis type (for traces action with id). hitlist = execution hot spots, statements = call tree, dbAccesses = database access stats.',
1155
+ description: 'traces with id: hitlist=hot spots, statements=call tree, dbAccesses=DB access stats.',
1102
1156
  },
1103
1157
  traceUser: {
1104
1158
  type: 'string',
1105
- description: 'For trace_start/trace_requests: the SAP user whose matching execution is traced/listed. Defaults to the connected user.',
1159
+ description: 'trace_start/trace_requests SAP user (default connected user).',
1106
1160
  },
1107
1161
  processType: {
1108
1162
  type: 'string',
1109
1163
  enum: ['any', 'http', 'dialog', 'batch', 'rfc'],
1110
- description: 'For trace_start: the kind of work process to capture. Default "http" (OData/Gateway). dialog = SAP GUI transaction, batch = background job, rfc = RFC call.',
1164
+ description: 'trace_start work process (default http/OData): dialog=SAP GUI, batch=background job, rfc=RFC.',
1111
1165
  },
1112
1166
  objectType: {
1113
1167
  type: 'string',
1114
1168
  enum: ['any', 'url', 'transaction', 'report', 'functionModule'],
1115
- description: 'For trace_start: what to match within the process. Defaults to the valid type for the process type (http→url, dialog→transaction, batch→report, rfc→functionModule).',
1169
+ description: 'trace_start match type; defaults: http→url, dialog→transaction, batch→report, rfc→functionModule.',
1116
1170
  },
1117
1171
  maxExecutions: {
1118
1172
  type: 'number',
1119
- description: 'For trace_start: how many matching executions to capture before the request is consumed (default 1).',
1173
+ description: 'trace_start executions to capture (default 1).',
1120
1174
  },
1121
1175
  expiresHours: {
1122
1176
  type: 'number',
1123
- description: 'For trace_start: hours until the armed request auto-expires (default 24).',
1177
+ description: 'trace_start expiry in hours (default 24).',
1124
1178
  },
1125
1179
  sqlTrace: {
1126
1180
  type: 'boolean',
1127
- description: 'For trace_start: capture SQL/DB accesses (default true required for analysis="dbAccesses").',
1181
+ description: 'trace_start SQL capture (default true; required for analysis="dbAccesses").',
1128
1182
  },
1129
1183
  aggregate: {
1130
1184
  type: 'boolean',
1131
- description: 'For trace_start: aggregate the trace (default true).',
1185
+ description: 'trace_start aggregation (default true).',
1132
1186
  },
1133
1187
  description: {
1134
1188
  type: 'string',
1135
- description: 'For trace_start: optional label for the trace request.',
1189
+ description: 'trace_start label.',
1136
1190
  },
1191
+ ...SAPDIAGNOSE_ADDITIONAL_INPUTS,
1137
1192
  },
1138
1193
  required: ['action'],
1139
1194
  },
@@ -1150,14 +1205,14 @@ export function getToolDefinitions(config, textSearchAvailable, resolvedFeatures
1150
1205
  enum: ['impact', 'deps', 'usages', 'structure'],
1151
1206
  description: 'Action:\n' +
1152
1207
  '"impact" = CDS blast-radius analysis (DDLS only). USE THIS for any question like "what breaks if I change <view>", "who consumes <I_*>", "impact analysis on <CDS>", "downstream of <view>". Returns upstream AST dependencies + downstream where-used classified into RAP buckets (projectionViews, bdefs, serviceDefinitions, serviceBindings, accessControls, metadataExtensions, abapConsumers, documentation, tables, other), plus additive sibling-consistency diagnostics (consistencyHints + siblingExtensionAnalysis) when related DDLS siblings show asymmetric DDLX coverage. ALWAYS prefer over SAPQuery against DDDDLSRC/ACMDCLSRC/DDLXSRC_SRC/SRVDSRC_SRC (those text-scans produce noise this classifier filters out). Non-DDLS input returns a guardrail error.\n' +
1153
- '"deps" (default, can be omitted) = object understanding / forward dependency context "what does <object> do?" or "what does <object> depend on?". Returns the object KTD when available plus public API contracts of dependencies.\n' +
1208
+ '"deps" (default) = source-derived dependency contracts plus KTD when available. Requires type+name, even with source. Not a complete inventory; read source for behavior.\n' +
1154
1209
  '"usages" = live SAP where-used lookup. Provide "type" when known; without it, the name must resolve uniquely. Prefer "impact" for CDS.\n' +
1155
1210
  '"structure" = TABL includes/appends.',
1156
1211
  },
1157
1212
  type: {
1158
1213
  type: 'string',
1159
1214
  enum: btp ? SAPCONTEXT_TYPES_BTP : SAPCONTEXT_TYPES_ONPREM,
1160
- description: 'Object type. Optional for action="impact" (defaults to DDLS) or action="usages"; required otherwise.',
1215
+ description: 'Root type. deps requires type+name, even with source. Optional for action="impact" (defaults to DDLS) or usages (unique name lookup); structure requires TABL.',
1161
1216
  },
1162
1217
  name: {
1163
1218
  type: 'string',