@lerianstudio/matcher-mcp 1.0.0-beta.5

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 (220) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +281 -0
  3. package/dist/auth/request-token.js +117 -0
  4. package/dist/auth/request-token.js.map +1 -0
  5. package/dist/config.js +95 -0
  6. package/dist/config.js.map +1 -0
  7. package/dist/matcher/client.js +168 -0
  8. package/dist/matcher/client.js.map +1 -0
  9. package/dist/observability/otel.js +223 -0
  10. package/dist/observability/otel.js.map +1 -0
  11. package/dist/server.js +245 -0
  12. package/dist/server.js.map +1 -0
  13. package/dist/spec/curated-operations.js +145 -0
  14. package/dist/spec/curated-operations.js.map +1 -0
  15. package/dist/spec/index.js +155 -0
  16. package/dist/spec/index.js.map +1 -0
  17. package/dist/spec/load.js +76 -0
  18. package/dist/spec/load.js.map +1 -0
  19. package/dist/spec/openapi.yaml +15217 -0
  20. package/dist/tools/context/create.js +100 -0
  21. package/dist/tools/context/create.js.map +1 -0
  22. package/dist/tools/context/get.js +31 -0
  23. package/dist/tools/context/get.js.map +1 -0
  24. package/dist/tools/context/index.js +21 -0
  25. package/dist/tools/context/index.js.map +1 -0
  26. package/dist/tools/context/list.js +78 -0
  27. package/dist/tools/context/list.js.map +1 -0
  28. package/dist/tools/context/shared.js +61 -0
  29. package/dist/tools/context/shared.js.map +1 -0
  30. package/dist/tools/context/update.js +105 -0
  31. package/dist/tools/context/update.js.map +1 -0
  32. package/dist/tools/dashboard/aggregates.js +34 -0
  33. package/dist/tools/dashboard/aggregates.js.map +1 -0
  34. package/dist/tools/dashboard/cash-impact.js +36 -0
  35. package/dist/tools/dashboard/cash-impact.js.map +1 -0
  36. package/dist/tools/dashboard/index.js +27 -0
  37. package/dist/tools/dashboard/index.js.map +1 -0
  38. package/dist/tools/dashboard/match-rate.js +35 -0
  39. package/dist/tools/dashboard/match-rate.js.map +1 -0
  40. package/dist/tools/dashboard/metrics.js +36 -0
  41. package/dist/tools/dashboard/metrics.js.map +1 -0
  42. package/dist/tools/dashboard/shared.js +122 -0
  43. package/dist/tools/dashboard/shared.js.map +1 -0
  44. package/dist/tools/dashboard/sla.js +33 -0
  45. package/dist/tools/dashboard/sla.js.map +1 -0
  46. package/dist/tools/dashboard/source-breakdown.js +36 -0
  47. package/dist/tools/dashboard/source-breakdown.js.map +1 -0
  48. package/dist/tools/dashboard/volume.js +35 -0
  49. package/dist/tools/dashboard/volume.js.map +1 -0
  50. package/dist/tools/dispute/close.js +49 -0
  51. package/dist/tools/dispute/close.js.map +1 -0
  52. package/dist/tools/dispute/get.js +27 -0
  53. package/dist/tools/dispute/get.js.map +1 -0
  54. package/dist/tools/dispute/index.js +17 -0
  55. package/dist/tools/dispute/index.js.map +1 -0
  56. package/dist/tools/dispute/list.js +137 -0
  57. package/dist/tools/dispute/list.js.map +1 -0
  58. package/dist/tools/dispute/shared.js +66 -0
  59. package/dist/tools/dispute/shared.js.map +1 -0
  60. package/dist/tools/dispute/submit-evidence.js +58 -0
  61. package/dist/tools/dispute/submit-evidence.js.map +1 -0
  62. package/dist/tools/exception/add-comment.js +50 -0
  63. package/dist/tools/exception/add-comment.js.map +1 -0
  64. package/dist/tools/exception/adjust-entry.js +71 -0
  65. package/dist/tools/exception/adjust-entry.js.map +1 -0
  66. package/dist/tools/exception/bulk-assign.js +47 -0
  67. package/dist/tools/exception/bulk-assign.js.map +1 -0
  68. package/dist/tools/exception/bulk-dispatch.js +69 -0
  69. package/dist/tools/exception/bulk-dispatch.js.map +1 -0
  70. package/dist/tools/exception/bulk-resolve.js +64 -0
  71. package/dist/tools/exception/bulk-resolve.js.map +1 -0
  72. package/dist/tools/exception/delete-comment.js +40 -0
  73. package/dist/tools/exception/delete-comment.js.map +1 -0
  74. package/dist/tools/exception/dispatch.js +64 -0
  75. package/dist/tools/exception/dispatch.js.map +1 -0
  76. package/dist/tools/exception/force-match.js +55 -0
  77. package/dist/tools/exception/force-match.js.map +1 -0
  78. package/dist/tools/exception/get.js +34 -0
  79. package/dist/tools/exception/get.js.map +1 -0
  80. package/dist/tools/exception/history.js +61 -0
  81. package/dist/tools/exception/history.js.map +1 -0
  82. package/dist/tools/exception/index.js +39 -0
  83. package/dist/tools/exception/index.js.map +1 -0
  84. package/dist/tools/exception/list-comments.js +35 -0
  85. package/dist/tools/exception/list-comments.js.map +1 -0
  86. package/dist/tools/exception/list.js +169 -0
  87. package/dist/tools/exception/list.js.map +1 -0
  88. package/dist/tools/exception/open-dispute.js +53 -0
  89. package/dist/tools/exception/open-dispute.js.map +1 -0
  90. package/dist/tools/exception/shared.js +98 -0
  91. package/dist/tools/exception/shared.js.map +1 -0
  92. package/dist/tools/fee-rule/create.js +106 -0
  93. package/dist/tools/fee-rule/create.js.map +1 -0
  94. package/dist/tools/fee-rule/delete.js +27 -0
  95. package/dist/tools/fee-rule/delete.js.map +1 -0
  96. package/dist/tools/fee-rule/get.js +27 -0
  97. package/dist/tools/fee-rule/get.js.map +1 -0
  98. package/dist/tools/fee-rule/index.js +21 -0
  99. package/dist/tools/fee-rule/index.js.map +1 -0
  100. package/dist/tools/fee-rule/list.js +64 -0
  101. package/dist/tools/fee-rule/list.js.map +1 -0
  102. package/dist/tools/fee-rule/shared.js +67 -0
  103. package/dist/tools/fee-rule/shared.js.map +1 -0
  104. package/dist/tools/fee-rule/update.js +70 -0
  105. package/dist/tools/fee-rule/update.js.map +1 -0
  106. package/dist/tools/fee-schedule/create.js +105 -0
  107. package/dist/tools/fee-schedule/create.js.map +1 -0
  108. package/dist/tools/fee-schedule/delete.js +32 -0
  109. package/dist/tools/fee-schedule/delete.js.map +1 -0
  110. package/dist/tools/fee-schedule/get.js +30 -0
  111. package/dist/tools/fee-schedule/get.js.map +1 -0
  112. package/dist/tools/fee-schedule/index.js +22 -0
  113. package/dist/tools/fee-schedule/index.js.map +1 -0
  114. package/dist/tools/fee-schedule/list.js +56 -0
  115. package/dist/tools/fee-schedule/list.js.map +1 -0
  116. package/dist/tools/fee-schedule/shared.js +58 -0
  117. package/dist/tools/fee-schedule/shared.js.map +1 -0
  118. package/dist/tools/fee-schedule/simulate.js +54 -0
  119. package/dist/tools/fee-schedule/simulate.js.map +1 -0
  120. package/dist/tools/fee-schedule/update.js +69 -0
  121. package/dist/tools/fee-schedule/update.js.map +1 -0
  122. package/dist/tools/generic/describe-operation.js +157 -0
  123. package/dist/tools/generic/describe-operation.js.map +1 -0
  124. package/dist/tools/generic/invoke.js +343 -0
  125. package/dist/tools/generic/invoke.js.map +1 -0
  126. package/dist/tools/generic/list-operations.js +73 -0
  127. package/dist/tools/generic/list-operations.js.map +1 -0
  128. package/dist/tools/ingestion/index.js +29 -0
  129. package/dist/tools/ingestion/index.js.map +1 -0
  130. package/dist/tools/ingestion/job-errors-list.js +45 -0
  131. package/dist/tools/ingestion/job-errors-list.js.map +1 -0
  132. package/dist/tools/ingestion/job-get.js +42 -0
  133. package/dist/tools/ingestion/job-get.js.map +1 -0
  134. package/dist/tools/ingestion/job-transactions-list.js +93 -0
  135. package/dist/tools/ingestion/job-transactions-list.js.map +1 -0
  136. package/dist/tools/ingestion/jobs-list.js +89 -0
  137. package/dist/tools/ingestion/jobs-list.js.map +1 -0
  138. package/dist/tools/ingestion/shared.js +84 -0
  139. package/dist/tools/ingestion/shared.js.map +1 -0
  140. package/dist/tools/ingestion/transaction-ignore.js +51 -0
  141. package/dist/tools/ingestion/transaction-ignore.js.map +1 -0
  142. package/dist/tools/ingestion/transactions-search.js +143 -0
  143. package/dist/tools/ingestion/transactions-search.js.map +1 -0
  144. package/dist/tools/match-rule/create.js +64 -0
  145. package/dist/tools/match-rule/create.js.map +1 -0
  146. package/dist/tools/match-rule/delete.js +35 -0
  147. package/dist/tools/match-rule/delete.js.map +1 -0
  148. package/dist/tools/match-rule/get.js +32 -0
  149. package/dist/tools/match-rule/get.js.map +1 -0
  150. package/dist/tools/match-rule/index.js +22 -0
  151. package/dist/tools/match-rule/index.js.map +1 -0
  152. package/dist/tools/match-rule/list.js +72 -0
  153. package/dist/tools/match-rule/list.js.map +1 -0
  154. package/dist/tools/match-rule/reorder.js +45 -0
  155. package/dist/tools/match-rule/reorder.js.map +1 -0
  156. package/dist/tools/match-rule/shared.js +71 -0
  157. package/dist/tools/match-rule/shared.js.map +1 -0
  158. package/dist/tools/match-rule/update.js +68 -0
  159. package/dist/tools/match-rule/update.js.map +1 -0
  160. package/dist/tools/matching/get.js +48 -0
  161. package/dist/tools/matching/get.js.map +1 -0
  162. package/dist/tools/matching/groups.js +98 -0
  163. package/dist/tools/matching/groups.js.map +1 -0
  164. package/dist/tools/matching/index.js +19 -0
  165. package/dist/tools/matching/index.js.map +1 -0
  166. package/dist/tools/matching/list.js +76 -0
  167. package/dist/tools/matching/list.js.map +1 -0
  168. package/dist/tools/matching/shared.js +77 -0
  169. package/dist/tools/matching/shared.js.map +1 -0
  170. package/dist/tools/matching/start.js +55 -0
  171. package/dist/tools/matching/start.js.map +1 -0
  172. package/dist/tools/report/count-exceptions.js +45 -0
  173. package/dist/tools/report/count-exceptions.js.map +1 -0
  174. package/dist/tools/report/count-matched.js +46 -0
  175. package/dist/tools/report/count-matched.js.map +1 -0
  176. package/dist/tools/report/count-transactions.js +44 -0
  177. package/dist/tools/report/count-transactions.js.map +1 -0
  178. package/dist/tools/report/count-unmatched.js +44 -0
  179. package/dist/tools/report/count-unmatched.js.map +1 -0
  180. package/dist/tools/report/export-exceptions.js +46 -0
  181. package/dist/tools/report/export-exceptions.js.map +1 -0
  182. package/dist/tools/report/export-matched.js +47 -0
  183. package/dist/tools/report/export-matched.js.map +1 -0
  184. package/dist/tools/report/export-summary.js +47 -0
  185. package/dist/tools/report/export-summary.js.map +1 -0
  186. package/dist/tools/report/export-unmatched.js +47 -0
  187. package/dist/tools/report/export-unmatched.js.map +1 -0
  188. package/dist/tools/report/export-variance.js +46 -0
  189. package/dist/tools/report/export-variance.js.map +1 -0
  190. package/dist/tools/report/index.js +40 -0
  191. package/dist/tools/report/index.js.map +1 -0
  192. package/dist/tools/report/matched.js +44 -0
  193. package/dist/tools/report/matched.js.map +1 -0
  194. package/dist/tools/report/shared.js +176 -0
  195. package/dist/tools/report/shared.js.map +1 -0
  196. package/dist/tools/report/summary.js +41 -0
  197. package/dist/tools/report/summary.js.map +1 -0
  198. package/dist/tools/report/unmatched.js +44 -0
  199. package/dist/tools/report/unmatched.js.map +1 -0
  200. package/dist/tools/report/variance.js +44 -0
  201. package/dist/tools/report/variance.js.map +1 -0
  202. package/dist/tools/source/create.js +84 -0
  203. package/dist/tools/source/create.js.map +1 -0
  204. package/dist/tools/source/get.js +41 -0
  205. package/dist/tools/source/get.js.map +1 -0
  206. package/dist/tools/source/index.js +22 -0
  207. package/dist/tools/source/index.js.map +1 -0
  208. package/dist/tools/source/list.js +72 -0
  209. package/dist/tools/source/list.js.map +1 -0
  210. package/dist/tools/source/shared.js +63 -0
  211. package/dist/tools/source/shared.js.map +1 -0
  212. package/dist/tools/source/update.js +73 -0
  213. package/dist/tools/source/update.js.map +1 -0
  214. package/dist/tools/tool-error.js +74 -0
  215. package/dist/tools/tool-error.js.map +1 -0
  216. package/dist/transport/body-limit.js +82 -0
  217. package/dist/transport/body-limit.js.map +1 -0
  218. package/dist/transport/http.js +154 -0
  219. package/dist/transport/http.js.map +1 -0
  220. package/package.json +68 -0
@@ -0,0 +1,50 @@
1
+ // `exception_add_comment` — curated POST /v1/exceptions/{exceptionId}/comments.
2
+ //
3
+ // Adds a discussion comment to one exception. Mirrors the spec's
4
+ // AddCommentRequest (a single required `content`, 1–5000 chars). The author is
5
+ // taken from the JWT context server-side — there is no author field here, and
6
+ // no tenant field. exceptionId is a path param; matcher validates it belongs to
7
+ // the relayed token's tenant.
8
+ import { z } from 'zod';
9
+ import { dispatchException, exceptionCommentsPath } from './shared.js';
10
+ /** Zod raw shape for `exception_add_comment` input — path id + comment content. */
11
+ export const addCommentInputShape = {
12
+ exceptionId: z
13
+ .string()
14
+ .min(1)
15
+ .describe('The exception id (UUID) to comment on.'),
16
+ content: z
17
+ .string()
18
+ .min(1)
19
+ .max(5000)
20
+ .describe('The comment body (1–5000 chars). The author is taken from your JWT ' +
21
+ 'server-side — do not pass an author or tenant field.'),
22
+ };
23
+ /**
24
+ * Build the POST body from the input minus the path-only `exceptionId`. Only the
25
+ * AddCommentRequest field (`content`) is sent; exceptionId travels in the path.
26
+ */
27
+ export function buildAddCommentBody(args) {
28
+ return { content: args.content };
29
+ }
30
+ /**
31
+ * Register `exception_add_comment`. Substitutes the id into the path, builds the
32
+ * body from the typed input, and dispatches a POST through the shared
33
+ * fail-closed relay; a matcher error surfaces via the shared toToolError.
34
+ */
35
+ export function registerExceptionAddCommentTool(server) {
36
+ server.registerTool('exception_add_comment', {
37
+ description: 'Add a discussion comment to a reconciliation exception. Provide ' +
38
+ 'exceptionId (UUID path param) and content (1–5000 chars). The author is ' +
39
+ 'derived from your JWT server-side — no author or tenant field is ' +
40
+ 'accepted. Returns the created comment, or a structured RFC 9457 error.',
41
+ inputSchema: addCommentInputShape,
42
+ }, async (args, extra) => {
43
+ return dispatchException({
44
+ method: 'POST',
45
+ path: exceptionCommentsPath(args.exceptionId),
46
+ body: buildAddCommentBody(args),
47
+ }, extra);
48
+ });
49
+ }
50
+ //# sourceMappingURL=add-comment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-comment.js","sourceRoot":"","sources":["../../../src/tools/exception/add-comment.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,iEAAiE;AACjE,+EAA+E;AAC/E,8EAA8E;AAC9E,gFAAgF;AAChF,8BAA8B;AAE9B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEtE,mFAAmF;AACnF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,wCAAwC,CAAC;IACrD,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,CACP,qEAAqE;QACnE,sDAAsD,CACzD;CACJ,CAAA;AAKD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAqB;IAErB,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAA;AAClC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAAC,MAAiB;IAC/D,MAAM,CAAC,YAAY,CACjB,uBAAuB,EACvB;QACE,WAAW,EACT,kEAAkE;YAClE,0EAA0E;YAC1E,mEAAmE;YACnE,wEAAwE;QAC1E,WAAW,EAAE,oBAAoB;KAClC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,iBAAiB,CACtB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,qBAAqB,CAAC,IAAI,CAAC,WAAW,CAAC;YAC7C,IAAI,EAAE,mBAAmB,CAAC,IAAI,CAAC;SAChC,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,71 @@
1
+ // `exception_adjust_entry` — curated POST /v1/exceptions/{exceptionId}/adjust-entry.
2
+ //
3
+ // A resolution action: resolves one exception by creating a balancing
4
+ // adjustment entry, used when a monetary correction is needed to reconcile the
5
+ // transaction. Mirrors the spec's AdjustEntryRequest — reasonCode, notes, amount
6
+ // (decimal STRING, positive), currency (ISO 4217, 3 letters) and effectiveAt
7
+ // (RFC 3339), all required. exceptionId is a path param; no tenant field is
8
+ // accepted.
9
+ import { z } from 'zod';
10
+ import { dispatchException, exceptionAdjustEntryPath } from './shared.js';
11
+ /** Zod raw shape for `exception_adjust_entry` input — path id + adjustment body. */
12
+ export const adjustEntryInputShape = {
13
+ exceptionId: z
14
+ .string()
15
+ .min(1)
16
+ .describe('The exception id (UUID) to resolve with an adjustment entry.'),
17
+ reasonCode: z
18
+ .string()
19
+ .min(1)
20
+ .max(255)
21
+ .describe('Reason code for the adjustment (1–255 chars, e.g. "FEE_ADJUSTMENT").'),
22
+ notes: z
23
+ .string()
24
+ .min(1)
25
+ .max(1000)
26
+ .describe('Notes explaining the adjustment (1–1000 chars).'),
27
+ amount: z
28
+ .string()
29
+ .describe('Adjustment amount as a positive decimal STRING in the given currency, ' +
30
+ 'e.g. "150.50" (a string, not a number, to preserve precision).'),
31
+ currency: z
32
+ .string()
33
+ .min(3)
34
+ .max(3)
35
+ .describe('ISO 4217 currency code (exactly 3 letters) the amount is denominated in.'),
36
+ effectiveAt: z
37
+ .string()
38
+ .describe('When the adjustment takes effect, as an RFC 3339 timestamp (e.g. ' +
39
+ '"2025-01-20T10:30:00Z").'),
40
+ };
41
+ /**
42
+ * Build the POST body from the input minus the path-only `exceptionId`. Only the
43
+ * AdjustEntryRequest fields are sent; exceptionId travels in the path.
44
+ */
45
+ export function buildAdjustEntryBody(args) {
46
+ const { exceptionId: _exceptionId, ...body } = args;
47
+ void _exceptionId;
48
+ return body;
49
+ }
50
+ /**
51
+ * Register `exception_adjust_entry`. Substitutes the id into the path, builds the
52
+ * body from the typed input, and dispatches a POST through the shared
53
+ * fail-closed relay; a matcher error surfaces via the shared toToolError.
54
+ */
55
+ export function registerExceptionAdjustEntryTool(server) {
56
+ server.registerTool('exception_adjust_entry', {
57
+ description: 'Resolve a reconciliation exception by creating a balancing adjustment ' +
58
+ 'entry. Provide exceptionId (UUID path param), reasonCode (1–255), notes ' +
59
+ '(1–1000), amount (positive decimal string, e.g. "150.50"), currency (ISO ' +
60
+ '4217, 3 letters), and effectiveAt (RFC 3339). No tenant field is ' +
61
+ 'accepted. Returns the updated exception, or a structured RFC 9457 error.',
62
+ inputSchema: adjustEntryInputShape,
63
+ }, async (args, extra) => {
64
+ return dispatchException({
65
+ method: 'POST',
66
+ path: exceptionAdjustEntryPath(args.exceptionId),
67
+ body: buildAdjustEntryBody(args),
68
+ }, extra);
69
+ });
70
+ }
71
+ //# sourceMappingURL=adjust-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adjust-entry.js","sourceRoot":"","sources":["../../../src/tools/exception/adjust-entry.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,EAAE;AACF,sEAAsE;AACtE,+EAA+E;AAC/E,iFAAiF;AACjF,6EAA6E;AAC7E,4EAA4E;AAC5E,YAAY;AAEZ,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAEzE,oFAAoF;AACpF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,8DAA8D,CAAC;IAC3E,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,CAAC,sEAAsE,CAAC;IACnF,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,CAAC,iDAAiD,CAAC;IAC9D,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,CACP,wEAAwE;QACtE,gEAAgE,CACnE;IACH,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,0EAA0E,CAAC;IACvF,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,QAAQ,CACP,mEAAmE;QACjE,0BAA0B,CAC7B;CACJ,CAAA;AAKD;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAsB;IAEtB,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAA;IACnD,KAAK,YAAY,CAAA;IACjB,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAAC,MAAiB;IAChE,MAAM,CAAC,YAAY,CACjB,wBAAwB,EACxB;QACE,WAAW,EACT,wEAAwE;YACxE,0EAA0E;YAC1E,2EAA2E;YAC3E,mEAAmE;YACnE,0EAA0E;QAC5E,WAAW,EAAE,qBAAqB;KACnC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,iBAAiB,CACtB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,wBAAwB,CAAC,IAAI,CAAC,WAAW,CAAC;YAChD,IAAI,EAAE,oBAAoB,CAAC,IAAI,CAAC;SACjC,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,47 @@
1
+ // `exception_bulk_assign` — curated POST /v1/exceptions/bulk/assign.
2
+ //
3
+ // A cross-exception action: assigns many exceptions to a single assignee in one
4
+ // call. Mirrors the spec's BulkAssignRequest — exceptionIds (1–100 UUIDs) and
5
+ // assignee (1–255), both required. Partial success is supported server-side (the
6
+ // response reports per-exception successes/failures). No path param and no
7
+ // tenant field; matcher scopes to the relayed token's tenant.
8
+ import { z } from 'zod';
9
+ import { dispatchException, EXCEPTIONS_BULK_ASSIGN_PATH } from './shared.js';
10
+ /** Zod raw shape for `exception_bulk_assign` input — ids + assignee. */
11
+ export const bulkAssignInputShape = {
12
+ exceptionIds: z
13
+ .array(z.string().min(1))
14
+ .min(1)
15
+ .max(100)
16
+ .describe('Exception ids (UUIDs) to assign (1–100).'),
17
+ assignee: z
18
+ .string()
19
+ .min(1)
20
+ .max(255)
21
+ .describe('User to assign the exceptions to (1–255, e.g. "user@example.com").'),
22
+ };
23
+ /** Build the bulk-assign POST body verbatim from the typed input. */
24
+ export function buildBulkAssignBody(args) {
25
+ return { exceptionIds: args.exceptionIds, assignee: args.assignee };
26
+ }
27
+ /**
28
+ * Register `exception_bulk_assign`. Dispatches a POST with the ids + assignee
29
+ * through the shared fail-closed relay and returns matcher's per-exception
30
+ * result envelope; a matcher error surfaces via the shared toToolError.
31
+ */
32
+ export function registerExceptionBulkAssignTool(server) {
33
+ server.registerTool('exception_bulk_assign', {
34
+ description: 'Assign many reconciliation exceptions to one assignee in a single call. ' +
35
+ 'Provide exceptionIds (1–100 UUIDs) and assignee (1–255). Partial success ' +
36
+ 'is supported — the response reports per-exception successes and failures. ' +
37
+ 'No tenant field is accepted. Errors surface as structured RFC 9457 problems.',
38
+ inputSchema: bulkAssignInputShape,
39
+ }, async (args, extra) => {
40
+ return dispatchException({
41
+ method: 'POST',
42
+ path: EXCEPTIONS_BULK_ASSIGN_PATH,
43
+ body: buildBulkAssignBody(args),
44
+ }, extra);
45
+ });
46
+ }
47
+ //# sourceMappingURL=bulk-assign.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk-assign.js","sourceRoot":"","sources":["../../../src/tools/exception/bulk-assign.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,iFAAiF;AACjF,2EAA2E;AAC3E,8DAA8D;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAE5E,wEAAwE;AACxE,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,YAAY,EAAE,CAAC;SACZ,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACxB,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,CAAC,0CAA0C,CAAC;IACvD,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,CAAC,oEAAoE,CAAC;CAClF,CAAA;AAKD,qEAAqE;AACrE,MAAM,UAAU,mBAAmB,CACjC,IAAqB;IAErB,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAA;AACrE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAAC,MAAiB;IAC/D,MAAM,CAAC,YAAY,CACjB,uBAAuB,EACvB;QACE,WAAW,EACT,0EAA0E;YAC1E,2EAA2E;YAC3E,4EAA4E;YAC5E,8EAA8E;QAChF,WAAW,EAAE,oBAAoB;KAClC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,iBAAiB,CACtB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,2BAA2B;YACjC,IAAI,EAAE,mBAAmB,CAAC,IAAI,CAAC;SAChC,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,69 @@
1
+ // `exception_bulk_dispatch` — curated POST /v1/exceptions/bulk/dispatch.
2
+ //
3
+ // A cross-exception action: dispatches many exceptions to a target external
4
+ // system in one call. Mirrors the spec's BulkDispatchRequest — exceptionIds
5
+ // (1–100 UUIDs) and targetSystem are required; queue (≤255) is optional. NOTE:
6
+ // unlike the single-exception dispatch (DispatchRequest, a closed enum), the
7
+ // bulk variant's targetSystem is a FREE STRING (≤255) per the spec — we honor
8
+ // that and do NOT constrain it to an enum here. Partial success is supported
9
+ // server-side. No path param and no tenant field; matcher scopes to the relayed
10
+ // token's tenant.
11
+ import { z } from 'zod';
12
+ import { dispatchException, EXCEPTIONS_BULK_DISPATCH_PATH } from './shared.js';
13
+ /** Zod raw shape for `exception_bulk_dispatch` input — ids + target + optional queue. */
14
+ export const bulkDispatchInputShape = {
15
+ exceptionIds: z
16
+ .array(z.string().min(1))
17
+ .min(1)
18
+ .max(100)
19
+ .describe('Exception ids (UUIDs) to dispatch (1–100).'),
20
+ targetSystem: z
21
+ .string()
22
+ .min(1)
23
+ .max(255)
24
+ .describe('Target system to dispatch all of them to (1–255). A free string here ' +
25
+ '(the bulk endpoint does not constrain it to an enum), e.g. "JIRA".'),
26
+ queue: z
27
+ .string()
28
+ .max(255)
29
+ .optional()
30
+ .describe('Optional queue or team assignment (≤255, e.g. "RECON-TEAM").'),
31
+ };
32
+ /**
33
+ * Build the bulk-dispatch POST body, omitting the optional `queue` when unset so
34
+ * the request stays minimal.
35
+ */
36
+ export function buildBulkDispatchBody(args) {
37
+ const body = {
38
+ exceptionIds: args.exceptionIds,
39
+ targetSystem: args.targetSystem,
40
+ };
41
+ if (args.queue !== undefined) {
42
+ body.queue = args.queue;
43
+ }
44
+ return body;
45
+ }
46
+ /**
47
+ * Register `exception_bulk_dispatch`. Dispatches a POST with the ids +
48
+ * targetSystem through the shared fail-closed relay and returns matcher's
49
+ * per-exception result envelope; a matcher error surfaces via the shared
50
+ * toToolError.
51
+ */
52
+ export function registerExceptionBulkDispatchTool(server) {
53
+ server.registerTool('exception_bulk_dispatch', {
54
+ description: 'Dispatch many reconciliation exceptions to a target external system in a ' +
55
+ 'single call. Provide exceptionIds (1–100 UUIDs) and targetSystem (free ' +
56
+ 'string, 1–255 — not constrained to an enum here), and optionally a ' +
57
+ 'queue/team (≤255). Partial success is supported — the response reports ' +
58
+ 'per-exception successes and failures. No tenant field is accepted. Errors ' +
59
+ 'surface as structured RFC 9457 problems.',
60
+ inputSchema: bulkDispatchInputShape,
61
+ }, async (args, extra) => {
62
+ return dispatchException({
63
+ method: 'POST',
64
+ path: EXCEPTIONS_BULK_DISPATCH_PATH,
65
+ body: buildBulkDispatchBody(args),
66
+ }, extra);
67
+ });
68
+ }
69
+ //# sourceMappingURL=bulk-dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk-dispatch.js","sourceRoot":"","sources":["../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yBAAyB,EACzB;QACE,WAAW,EACT,2EAA2E;YAC3E,yEAAyE;YACzE,qEAAqE;YACrE,yEAAyE;YACzE,4EAA4E;YAC5E,0CAA0C;QAC5C,WAAW,EAAE,sBAAsB;KACpC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,iBAAiB,CACtB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,6BAA6B;YACnC,IAAI,EAAE,qBAAqB,CAAC,IAAI,CAAC;SAClC,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,64 @@
1
+ // `exception_bulk_resolve` — curated POST /v1/exceptions/bulk/resolve.
2
+ //
3
+ // A cross-exception action: resolves many exceptions with a shared resolution in
4
+ // one call. Mirrors the spec's BulkResolveRequest — exceptionIds (1–100 UUIDs)
5
+ // and resolution (1–255) are required; reason (≤1000) is optional. Partial
6
+ // success is supported server-side (the response reports per-exception
7
+ // successes/failures). No path param and no tenant field; matcher scopes to the
8
+ // relayed token's tenant.
9
+ import { z } from 'zod';
10
+ import { dispatchException, EXCEPTIONS_BULK_RESOLVE_PATH } from './shared.js';
11
+ /** Zod raw shape for `exception_bulk_resolve` input — ids + resolution + optional reason. */
12
+ export const bulkResolveInputShape = {
13
+ exceptionIds: z
14
+ .array(z.string().min(1))
15
+ .min(1)
16
+ .max(100)
17
+ .describe('Exception ids (UUIDs) to resolve (1–100).'),
18
+ resolution: z
19
+ .string()
20
+ .min(1)
21
+ .max(255)
22
+ .describe('Resolution type applied to all of them (1–255, e.g. "ACCEPTED").'),
23
+ reason: z
24
+ .string()
25
+ .max(1000)
26
+ .optional()
27
+ .describe('Optional reason for the resolution (≤1000 chars).'),
28
+ };
29
+ /**
30
+ * Build the bulk-resolve POST body, omitting the optional `reason` when unset so
31
+ * the request stays minimal.
32
+ */
33
+ export function buildBulkResolveBody(args) {
34
+ const body = {
35
+ exceptionIds: args.exceptionIds,
36
+ resolution: args.resolution,
37
+ };
38
+ if (args.reason !== undefined) {
39
+ body.reason = args.reason;
40
+ }
41
+ return body;
42
+ }
43
+ /**
44
+ * Register `exception_bulk_resolve`. Dispatches a POST with the ids + resolution
45
+ * through the shared fail-closed relay and returns matcher's per-exception
46
+ * result envelope; a matcher error surfaces via the shared toToolError.
47
+ */
48
+ export function registerExceptionBulkResolveTool(server) {
49
+ server.registerTool('exception_bulk_resolve', {
50
+ description: 'Resolve many reconciliation exceptions with a shared resolution in a ' +
51
+ 'single call. Provide exceptionIds (1–100 UUIDs) and resolution (1–255), ' +
52
+ 'and optionally a reason (≤1000). Partial success is supported — the ' +
53
+ 'response reports per-exception successes and failures. No tenant field is ' +
54
+ 'accepted. Errors surface as structured RFC 9457 problems.',
55
+ inputSchema: bulkResolveInputShape,
56
+ }, async (args, extra) => {
57
+ return dispatchException({
58
+ method: 'POST',
59
+ path: EXCEPTIONS_BULK_RESOLVE_PATH,
60
+ body: buildBulkResolveBody(args),
61
+ }, extra);
62
+ });
63
+ }
64
+ //# sourceMappingURL=bulk-resolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk-resolve.js","sourceRoot":"","sources":["../../../src/tools/exception/bulk-resolve.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,2EAA2E;AAC3E,uEAAuE;AACvE,gFAAgF;AAChF,0BAA0B;AAE1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAE7E,6FAA6F;AAC7F,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,YAAY,EAAE,CAAC;SACZ,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACxB,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,CAAC,2CAA2C,CAAC;IACxD,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,CAAC,kEAAkE,CAAC;IAC/E,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,mDAAmD,CAAC;CACjE,CAAA;AAKD;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAsB;IAEtB,MAAM,IAAI,GAA4B;QACpC,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAA;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAC3B,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAAC,MAAiB;IAChE,MAAM,CAAC,YAAY,CACjB,wBAAwB,EACxB;QACE,WAAW,EACT,uEAAuE;YACvE,0EAA0E;YAC1E,sEAAsE;YACtE,4EAA4E;YAC5E,2DAA2D;QAC7D,WAAW,EAAE,qBAAqB;KACnC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,iBAAiB,CACtB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,4BAA4B;YAClC,IAAI,EAAE,oBAAoB,CAAC,IAAI,CAAC;SACjC,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,40 @@
1
+ // `exception_delete_comment` — curated DELETE
2
+ // /v1/exceptions/{exceptionId}/comments/{commentId}.
3
+ //
4
+ // Removes a single discussion comment from an exception. A successful delete
5
+ // returns 204 (no content), which the relay renders as null. Any matcher
6
+ // rejection surfaces verbatim through the shared toToolError. Both exceptionId
7
+ // and commentId are path params; no tenant field is accepted.
8
+ import { z } from 'zod';
9
+ import { dispatchException, exceptionCommentPath } from './shared.js';
10
+ /** Zod raw shape for `exception_delete_comment` input — both path ids. */
11
+ export const deleteCommentInputShape = {
12
+ exceptionId: z
13
+ .string()
14
+ .min(1)
15
+ .describe('The exception id (UUID) the comment belongs to.'),
16
+ commentId: z
17
+ .string()
18
+ .min(1)
19
+ .describe('The comment id (UUID) to delete.'),
20
+ };
21
+ /**
22
+ * Register `exception_delete_comment`. Substitutes both ids into the path and
23
+ * dispatches a DELETE through the shared fail-closed relay; a matcher error
24
+ * surfaces via the shared toToolError.
25
+ */
26
+ export function registerExceptionDeleteCommentTool(server) {
27
+ server.registerTool('exception_delete_comment', {
28
+ description: 'Delete a single discussion comment from a reconciliation exception. ' +
29
+ 'Provide both exceptionId and commentId (UUID path params). The exception ' +
30
+ "must belong to your token's tenant (no tenant field is accepted). Returns " +
31
+ 'no content on success, or a structured RFC 9457 error.',
32
+ inputSchema: deleteCommentInputShape,
33
+ }, async (args, extra) => {
34
+ return dispatchException({
35
+ method: 'DELETE',
36
+ path: exceptionCommentPath(args.exceptionId, args.commentId),
37
+ }, extra);
38
+ });
39
+ }
40
+ //# sourceMappingURL=delete-comment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-comment.js","sourceRoot":"","sources":["../../../src/tools/exception/delete-comment.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,qDAAqD;AACrD,EAAE;AACF,6EAA6E;AAC7E,yEAAyE;AACzE,+EAA+E;AAC/E,8DAA8D;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAErE,0EAA0E;AAC1E,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,iDAAiD,CAAC;IAC9D,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,kCAAkC,CAAC;CAChD,CAAA;AAOD;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAAC,MAAiB;IAClE,MAAM,CAAC,YAAY,CACjB,0BAA0B,EAC1B;QACE,WAAW,EACT,sEAAsE;YACtE,2EAA2E;YAC3E,4EAA4E;YAC5E,wDAAwD;QAC1D,WAAW,EAAE,uBAAuB;KACrC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,iBAAiB,CACtB;YACE,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,oBAAoB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC;SAC7D,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,64 @@
1
+ // `exception_dispatch` — curated POST /v1/exceptions/{exceptionId}/dispatch.
2
+ //
3
+ // A custom action (not CRUD): pushes one exception to an external ticketing
4
+ // system for tracking/resolution. Mirrors the spec's DispatchRequest —
5
+ // targetSystem (a CLOSED enum here, unlike the bulk variant which is a free
6
+ // string) plus an optional queue/team. exceptionId is a path param; no tenant
7
+ // field is accepted.
8
+ import { z } from 'zod';
9
+ import { dispatchException, exceptionDispatchPath } from './shared.js';
10
+ /** External target systems a single exception can be dispatched to (closed enum per spec). */
11
+ export const DISPATCH_TARGET_SYSTEMS = [
12
+ 'JIRA',
13
+ 'SERVICENOW',
14
+ 'WEBHOOK',
15
+ 'MANUAL',
16
+ ];
17
+ /** Zod raw shape for `exception_dispatch` input — path id + dispatch target. */
18
+ export const dispatchExceptionInputShape = {
19
+ exceptionId: z
20
+ .string()
21
+ .min(1)
22
+ .describe('The exception id (UUID) to dispatch.'),
23
+ targetSystem: z
24
+ .enum(DISPATCH_TARGET_SYSTEMS)
25
+ .describe('Target system to dispatch to (JIRA|SERVICENOW|WEBHOOK|MANUAL).'),
26
+ queue: z
27
+ .string()
28
+ .max(255)
29
+ .optional()
30
+ .describe('Optional queue or team assignment (e.g. "RECON-TEAM").'),
31
+ };
32
+ /**
33
+ * Build the POST body from the input minus the path-only `exceptionId`, omitting
34
+ * the optional `queue` when unset so the request stays minimal.
35
+ */
36
+ export function buildDispatchBody(args) {
37
+ const body = { targetSystem: args.targetSystem };
38
+ if (args.queue !== undefined) {
39
+ body.queue = args.queue;
40
+ }
41
+ return body;
42
+ }
43
+ /**
44
+ * Register `exception_dispatch`. Substitutes the id into the path, builds the
45
+ * body from the typed input, and dispatches a POST through the shared
46
+ * fail-closed relay; a matcher error surfaces via the shared toToolError.
47
+ */
48
+ export function registerExceptionDispatchTool(server) {
49
+ server.registerTool('exception_dispatch', {
50
+ description: 'Dispatch a reconciliation exception to an external ticketing system. ' +
51
+ 'Provide exceptionId (UUID path param), targetSystem ' +
52
+ '(JIRA|SERVICENOW|WEBHOOK|MANUAL), and optionally a queue/team. No tenant ' +
53
+ 'field is accepted. Returns the dispatch acknowledgement, or a structured ' +
54
+ 'RFC 9457 error.',
55
+ inputSchema: dispatchExceptionInputShape,
56
+ }, async (args, extra) => {
57
+ return dispatchException({
58
+ method: 'POST',
59
+ path: exceptionDispatchPath(args.exceptionId),
60
+ body: buildDispatchBody(args),
61
+ }, extra);
62
+ });
63
+ }
64
+ //# sourceMappingURL=dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../../src/tools/exception/dispatch.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,4EAA4E;AAC5E,uEAAuE;AACvE,4EAA4E;AAC5E,8EAA8E;AAC9E,qBAAqB;AAErB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEtE,8FAA8F;AAC9F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-0,0 +1,55 @@
1
+ // `exception_force_match` — curated POST /v1/exceptions/{exceptionId}/force-match.
2
+ //
3
+ // A resolution action: resolves one exception by forcing a match with an
4
+ // override reason, used when manual intervention decides the transaction should
5
+ // count as matched despite discrepancies. Mirrors the spec's ForceMatchRequest —
6
+ // overrideReason (1–255) and notes (1–1000), both required. exceptionId is a
7
+ // path param; no tenant field is accepted.
8
+ import { z } from 'zod';
9
+ import { dispatchException, exceptionForceMatchPath } from './shared.js';
10
+ /** Zod raw shape for `exception_force_match` input — path id + override body. */
11
+ export const forceMatchInputShape = {
12
+ exceptionId: z
13
+ .string()
14
+ .min(1)
15
+ .describe('The exception id (UUID) to resolve by forcing a match.'),
16
+ overrideReason: z
17
+ .string()
18
+ .min(1)
19
+ .max(255)
20
+ .describe('Reason for overriding the normal matching process (1–255 chars, e.g. ' +
21
+ '"BUSINESS_DECISION").'),
22
+ notes: z
23
+ .string()
24
+ .min(1)
25
+ .max(1000)
26
+ .describe('Additional notes explaining the force-match decision (1–1000 chars).'),
27
+ };
28
+ /**
29
+ * Build the POST body from the input minus the path-only `exceptionId`. Only the
30
+ * ForceMatchRequest fields are sent; exceptionId travels in the path.
31
+ */
32
+ export function buildForceMatchBody(args) {
33
+ return { overrideReason: args.overrideReason, notes: args.notes };
34
+ }
35
+ /**
36
+ * Register `exception_force_match`. Substitutes the id into the path, builds the
37
+ * body from the typed input, and dispatches a POST through the shared
38
+ * fail-closed relay; a matcher error surfaces via the shared toToolError.
39
+ */
40
+ export function registerExceptionForceMatchTool(server) {
41
+ server.registerTool('exception_force_match', {
42
+ description: 'Resolve a reconciliation exception by forcing a match with an override ' +
43
+ 'reason. Provide exceptionId (UUID path param), overrideReason (1–255), ' +
44
+ 'and notes (1–1000). No tenant field is accepted. Returns the updated ' +
45
+ 'exception, or a structured RFC 9457 error.',
46
+ inputSchema: forceMatchInputShape,
47
+ }, async (args, extra) => {
48
+ return dispatchException({
49
+ method: 'POST',
50
+ path: exceptionForceMatchPath(args.exceptionId),
51
+ body: buildForceMatchBody(args),
52
+ }, extra);
53
+ });
54
+ }
55
+ //# sourceMappingURL=force-match.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"force-match.js","sourceRoot":"","sources":["../../../src/tools/exception/force-match.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,EAAE;AACF,yEAAyE;AACzE,gFAAgF;AAChF,iFAAiF;AACjF,6EAA6E;AAC7E,2CAA2C;AAE3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAExE,iFAAiF;AACjF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,wDAAwD,CAAC;IACrE,cAAc,EAAE,CAAC;SACd,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,CACP,uEAAuE;QACrE,uBAAuB,CAC1B;IACH,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,CAAC,sEAAsE,CAAC;CACpF,CAAA;AAKD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAqB;IAErB,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAA;AACnE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAAC,MAAiB;IAC/D,MAAM,CAAC,YAAY,CACjB,uBAAuB,EACvB;QACE,WAAW,EACT,yEAAyE;YACzE,yEAAyE;YACzE,uEAAuE;YACvE,4CAA4C;QAC9C,WAAW,EAAE,oBAAoB;KAClC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,iBAAiB,CACtB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,uBAAuB,CAAC,IAAI,CAAC,WAAW,CAAC;YAC/C,IAAI,EAAE,mBAAmB,CAAC,IAAI,CAAC;SAChC,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,34 @@
1
+ // `exception_get` — curated GET /v1/exceptions/{exceptionId}.
2
+ //
3
+ // Reads a single reconciliation exception by id. The exception must belong to
4
+ // the relayed token's tenant — matcher enforces that; no tenant field is
5
+ // accepted.
6
+ import { z } from 'zod';
7
+ import { dispatchException, exceptionPath } from './shared.js';
8
+ /** Zod raw shape for `exception_get` input — the exception path id. */
9
+ export const getExceptionInputShape = {
10
+ exceptionId: z
11
+ .string()
12
+ .min(1)
13
+ .describe('The exception id (UUID) to fetch.'),
14
+ };
15
+ /**
16
+ * Register `exception_get`. Substitutes the id into the path and dispatches a
17
+ * GET through the shared fail-closed relay; a matcher error (e.g. 404) surfaces
18
+ * via the shared toToolError.
19
+ */
20
+ export function registerExceptionGetTool(server) {
21
+ server.registerTool('exception_get', {
22
+ description: 'Fetch a single reconciliation exception by id (UUID). The exception ' +
23
+ "must belong to your token's tenant (no tenant field is accepted). " +
24
+ 'Returns the exception, or a structured RFC 9457 error (e.g. 404 if it ' +
25
+ 'does not exist or is not yours).',
26
+ inputSchema: getExceptionInputShape,
27
+ }, async (args, extra) => {
28
+ return dispatchException({
29
+ method: 'GET',
30
+ path: exceptionPath(args.exceptionId),
31
+ }, extra);
32
+ });
33
+ }
34
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/tools/exception/get.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,8EAA8E;AAC9E,yEAAyE;AACzE,YAAY;AAEZ,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE9D,uEAAuE;AACvE,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,mCAAmC,CAAC;CACjD,CAAA;AAOD;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,WAAW,EACT,sEAAsE;YACtE,oEAAoE;YACpE,wEAAwE;YACxE,kCAAkC;QACpC,WAAW,EAAE,sBAAsB;KACpC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,iBAAiB,CACtB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC;SACtC,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,61 @@
1
+ // `exception_history` — curated GET /v1/exceptions/{exceptionId}/history.
2
+ //
3
+ // Cursor-paginated audit trail of every action taken on one exception.
4
+ // Pagination is forward-only (no prevCursor); the model re-calls with the
5
+ // returned nextCursor. exceptionId is a path param; the exception must belong to
6
+ // the relayed token's tenant, and no tenant field is accepted.
7
+ import { z } from 'zod';
8
+ import { dispatchException, exceptionHistoryPath } from './shared.js';
9
+ /** Zod raw shape for `exception_history` input — path id + pagination. */
10
+ export const getExceptionHistoryInputShape = {
11
+ exceptionId: z
12
+ .string()
13
+ .min(1)
14
+ .describe('The exception id (UUID) whose audit history to fetch.'),
15
+ cursor: z
16
+ .string()
17
+ .optional()
18
+ .describe('Opaque pagination cursor from a prior response. Re-call with the ' +
19
+ 'returned nextCursor to page forward (pagination is forward-only).'),
20
+ limit: z
21
+ .number()
22
+ .int()
23
+ .min(1)
24
+ .max(200)
25
+ .optional()
26
+ .describe('Maximum number of records to return (1–200, default 20).'),
27
+ };
28
+ /** Build the history query, omitting unset pagination knobs. */
29
+ export function buildHistoryQuery(args) {
30
+ const query = {};
31
+ if (args.cursor !== undefined) {
32
+ query.cursor = args.cursor;
33
+ }
34
+ if (args.limit !== undefined) {
35
+ query.limit = args.limit;
36
+ }
37
+ return Object.keys(query).length > 0 ? query : undefined;
38
+ }
39
+ /**
40
+ * Register `exception_history`. Substitutes the id into the path, passes the
41
+ * pagination knobs through, and dispatches a GET through the shared fail-closed
42
+ * relay; a matcher error surfaces via the shared toToolError.
43
+ */
44
+ export function registerExceptionHistoryTool(server) {
45
+ server.registerTool('exception_history', {
46
+ description: 'Fetch the audit history of a reconciliation exception (cursor-paginated, ' +
47
+ 'forward-only). Provide exceptionId (UUID), and optionally limit (1–200) ' +
48
+ "and/or cursor. The exception must belong to your token's tenant (no " +
49
+ 'tenant field is accepted). The response carries { items, nextCursor } — ' +
50
+ 'paginate by re-calling with the returned nextCursor.',
51
+ inputSchema: getExceptionHistoryInputShape,
52
+ }, async (args, extra) => {
53
+ const query = buildHistoryQuery(args);
54
+ return dispatchException({
55
+ method: 'GET',
56
+ path: exceptionHistoryPath(args.exceptionId),
57
+ ...(query !== undefined ? { query } : {}),
58
+ }, extra);
59
+ });
60
+ }
61
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/tools/exception/history.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,uEAAuE;AACvE,0EAA0E;AAC1E,iFAAiF;AACjF,+DAA+D;AAE/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAErE,0EAA0E;AAC1E,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,uD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