@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,48 @@
1
+ // `match_run_get` — curated GET /v1/matching/runs/{runId}?contextId=<id>.
2
+ //
3
+ // Reads one match run's detail by id: status, timing, aggregate stats, and the
4
+ // per-rule matched-group counts (ruleStats). The matcher payload is returned
5
+ // verbatim — this is how an operator polls a run started by `match_run_start`.
6
+ //
7
+ // Path/query split (per the spec): `runId` is the PATH param, but `contextId` is
8
+ // a REQUIRED QUERY param (not part of the path), so matcher can scope the run to
9
+ // the right context. `contextId` is a routing param matcher validates ownership
10
+ // of, NOT a tenant field; no tenant field is accepted.
11
+ import { z } from 'zod';
12
+ import { dispatchMatching, runPath } from './shared.js';
13
+ /** Zod raw shape for `match_run_get` input — runId (path) + contextId (query, required). */
14
+ export const getMatchRunInputShape = {
15
+ runId: z
16
+ .string()
17
+ .min(1)
18
+ .describe('The match run id (UUID) to fetch.'),
19
+ contextId: z
20
+ .string()
21
+ .min(1)
22
+ .describe('The reconciliation context id (UUID) the run belongs to. Sent as a query ' +
23
+ 'param (required); routing param scoped to your token.'),
24
+ };
25
+ /**
26
+ * Register `match_run_get`. Substitutes runId into the path and sends contextId
27
+ * as a query param; dispatches a GET through the shared fail-closed relay. The
28
+ * run payload (status/stats/ruleStats) is returned verbatim; a matcher error
29
+ * (e.g. 404) surfaces via the shared toToolError.
30
+ */
31
+ export function registerMatchRunGetTool(server) {
32
+ server.registerTool('match_run_get', {
33
+ description: 'Fetch a single match run by id, including status, timing, aggregate ' +
34
+ 'statistics, and per-rule matched-group counts. Use this to poll a run ' +
35
+ 'started by match_run_start. Requires runId and contextId (contextId is ' +
36
+ 'sent as a query param). Both are routing params scoped to your token; no ' +
37
+ 'tenant field is accepted. Returns the run detail, or a structured RFC ' +
38
+ '9457 error (e.g. 404).',
39
+ inputSchema: getMatchRunInputShape,
40
+ }, async (args, extra) => {
41
+ return dispatchMatching({
42
+ method: 'GET',
43
+ path: runPath(args.runId),
44
+ query: { contextId: args.contextId },
45
+ }, extra);
46
+ });
47
+ }
48
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/tools/matching/get.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAC/E,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,gFAAgF;AAChF,uDAAuD;AAEvD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAEvD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,mCAAmC,CAAC;IAChD,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,2EAA2E;QACzE,uDAAuD,CAC1D;CACJ,CAAA;AAOD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IACvD,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,WAAW,EACT,sEAAsE;YACtE,wEAAwE;YACxE,yEAAyE;YACzE,2EAA2E;YAC3E,wEAAwE;YACxE,wBAAwB;QAC1B,WAAW,EAAE,qBAAqB;KACnC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,gBAAgB,CACrB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YACzB,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE;SACrC,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,98 @@
1
+ // `match_run_groups` — curated GET /v1/matching/runs/{runId}/groups?contextId=<id>.
2
+ //
3
+ // Cursor-paginated list of the match groups produced by a run: each group holds
4
+ // the matched transaction pairs and a confidence score. limit/cursor/sort_order/
5
+ // sort_by pass through untouched and matcher's pagination envelope is returned
6
+ // as-is — no auto-pagination (a run can produce unbounded groups; the model
7
+ // pages by re-calling with the returned cursor).
8
+ //
9
+ // Path/query split (per the spec): `runId` is the PATH param, while `contextId`
10
+ // is a REQUIRED QUERY param. `contextId` is a routing param matcher validates
11
+ // ownership of, NOT a tenant field; no tenant field is accepted.
12
+ import { z } from 'zod';
13
+ import { SORT_ORDERS } from './list.js';
14
+ import { dispatchMatching, runGroupsPath } from './shared.js';
15
+ /** Sort fields matcher accepts for the run-groups listing. */
16
+ export const GROUP_SORT_FIELDS = ['id', 'created_at', 'status'];
17
+ /**
18
+ * Zod raw shape for `match_run_groups` input — runId (path) + contextId (query,
19
+ * required) + pagination/sort knobs.
20
+ */
21
+ export const getMatchRunGroupsInputShape = {
22
+ runId: z
23
+ .string()
24
+ .min(1)
25
+ .describe('The match run id (UUID) whose groups to list.'),
26
+ contextId: z
27
+ .string()
28
+ .min(1)
29
+ .describe('The reconciliation context id (UUID) the run belongs to. Sent as a query ' +
30
+ 'param (required); routing param scoped to your token.'),
31
+ limit: z
32
+ .number()
33
+ .int()
34
+ .min(1)
35
+ .max(200)
36
+ .optional()
37
+ .describe('Maximum number of records to return (1–200, default 20).'),
38
+ cursor: z
39
+ .string()
40
+ .optional()
41
+ .describe('Opaque pagination cursor from a prior response. Re-call with the ' +
42
+ 'returned nextCursor to page forward (there is no auto-pagination).'),
43
+ sort_order: z
44
+ .enum(SORT_ORDERS)
45
+ .optional()
46
+ .describe('Sort order: asc (oldest first) or desc (newest first).'),
47
+ sort_by: z
48
+ .enum(GROUP_SORT_FIELDS)
49
+ .optional()
50
+ .describe('Sort field: id, created_at, or status.'),
51
+ };
52
+ /**
53
+ * Build the groups query. contextId is always present (required); the pagination
54
+ * and sort knobs are added only when the caller set them.
55
+ */
56
+ function buildGroupsQuery(args) {
57
+ const query = {
58
+ contextId: args.contextId,
59
+ };
60
+ if (args.limit !== undefined) {
61
+ query.limit = args.limit;
62
+ }
63
+ if (args.cursor !== undefined) {
64
+ query.cursor = args.cursor;
65
+ }
66
+ if (args.sort_order !== undefined) {
67
+ query.sort_order = args.sort_order;
68
+ }
69
+ if (args.sort_by !== undefined) {
70
+ query.sort_by = args.sort_by;
71
+ }
72
+ return query;
73
+ }
74
+ /**
75
+ * Register `match_run_groups`. Substitutes runId into the path, sends contextId
76
+ * (plus any pagination/sort knobs) as query params, and returns matcher's
77
+ * pagination envelope verbatim; a matcher error surfaces via the shared
78
+ * toToolError.
79
+ */
80
+ export function registerMatchRunGroupsTool(server) {
81
+ server.registerTool('match_run_groups', {
82
+ description: "List a match run's result groups (cursor-paginated). Each group holds " +
83
+ 'the matched transaction pairs and a confidence score. Requires runId and ' +
84
+ 'contextId (contextId is sent as a query param); optionally limit (1–200), ' +
85
+ 'cursor, sort_order (asc|desc), and sort_by (id|created_at|status). The ' +
86
+ 'response carries { items, nextCursor } — paginate by re-calling with the ' +
87
+ 'returned nextCursor. Routing params are scoped to your token; no tenant ' +
88
+ 'field is accepted.',
89
+ inputSchema: getMatchRunGroupsInputShape,
90
+ }, async (args, extra) => {
91
+ return dispatchMatching({
92
+ method: 'GET',
93
+ path: runGroupsPath(args.runId),
94
+ query: buildGroupsQuery(args),
95
+ }, extra);
96
+ });
97
+ }
98
+ //# sourceMappingURL=groups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups.js","sourceRoot":"","sources":["../../../src/tools/matching/groups.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,EAAE;AACF,gFAAgF;AAChF,iFAAiF;AACjF,+EAA+E;AAC/E,4EAA4E;AAC5E,iDAAiD;AACjD,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,iEAAiE;AAEjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE7D,8DAA8D;AAC9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,CAAU,CAAA;AAExE;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,+CAA+C,CAAC;IAC5D,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,2EAA2E;QACzE,uDAAuD,CAC1D;IACH,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,0DAA0D,CAAC;IACvE,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,mEAAmE;QACjE,oEAAoE,CACvE;IACH,UAAU,EAAE,CAAC;SACV,IAAI,CAAC,WAAW,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CAAC,wDAAwD,CAAC;IACrE,OAAO,EAAE,CAAC;SACP,IAAI,CAAC,iBAAiB,CAAC;SACvB,QAAQ,EAAE;SACV,QAAQ,CAAC,wCAAwC,CAAC;CACtD,CAAA;AAOD;;;GAGG;AACH,SAAS,gBAAgB,CACvB,IAA4B;IAE5B,MAAM,KAAK,GAAoC;QAC7C,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAA;IACD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC7B,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;IAC1B,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC9B,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAC5B,CAAC;IACD,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QAClC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;IACpC,CAAC;IACD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC/B,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;IAC9B,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAiB;IAC1D,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,WAAW,EACT,wEAAwE;YACxE,2EAA2E;YAC3E,4EAA4E;YAC5E,yEAAyE;YACzE,2EAA2E;YAC3E,0EAA0E;YAC1E,oBAAoB;QACtB,WAAW,EAAE,2BAA2B;KACzC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,gBAAgB,CACrB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;YAC/B,KAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC;SAC9B,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,19 @@
1
+ // Curated match-run vertical (task 2.2.3): four typed action/read tools over the
2
+ // matcher matching engine — start a run, list a context's runs, read one run's
3
+ // detail, and page its result groups. These are NOT CRUD: they are verbs over
4
+ // `/v1/matching/...`. Each tool shares the fail-closed relay (shared.ts) and the
5
+ // RFC 9457 → tool-error mapping (toToolError) with every other curated surface,
6
+ // so they map matcher errors identically. No tool carries a tenant field;
7
+ // contextId is a routing param matcher validates ownership of.
8
+ import { registerMatchRunGroupsTool } from './groups.js';
9
+ import { registerMatchRunGetTool } from './get.js';
10
+ import { registerMatchRunListTool } from './list.js';
11
+ import { registerMatchRunStartTool } from './start.js';
12
+ /** Register all four curated match-run tools on the given server. */
13
+ export function registerMatchingTools(server) {
14
+ registerMatchRunStartTool(server);
15
+ registerMatchRunListTool(server);
16
+ registerMatchRunGetTool(server);
17
+ registerMatchRunGroupsTool(server);
18
+ }
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/matching/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,+EAA+E;AAC/E,8EAA8E;AAC9E,iFAAiF;AACjF,gFAAgF;AAChF,0EAA0E;AAC1E,+DAA+D;AAI/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAEtD,qEAAqE;AACrE,MAAM,UAAU,qBAAqB,CAAC,MAAiB;IACrD,yBAAyB,CAAC,MAAM,CAAC,CAAA;IACjC,wBAAwB,CAAC,MAAM,CAAC,CAAA;IAChC,uBAAuB,CAAC,MAAM,CAAC,CAAA;IAC/B,0BAA0B,CAAC,MAAM,CAAC,CAAA;AACpC,CAAC"}
@@ -0,0 +1,76 @@
1
+ // `match_run_list` — curated GET /v1/matching/contexts/{contextId}/runs.
2
+ //
3
+ // Cursor-paginated history of a context's match runs, sorted by creation time
4
+ // (descending by default; `sort_order` flips it). limit/cursor/sort_order pass
5
+ // through untouched and matcher's { items, nextCursor, ... } envelope is returned
6
+ // as-is — no auto-pagination (the model re-calls with the returned cursor).
7
+ //
8
+ // `contextId` is a routing path param matcher scopes to the relayed token's
9
+ // tenant; no tenant field is accepted.
10
+ import { z } from 'zod';
11
+ import { contextRunsPath, dispatchMatching } from './shared.js';
12
+ /** Sort orders matcher accepts for the run-history listing. */
13
+ export const SORT_ORDERS = ['asc', 'desc'];
14
+ /** Zod raw shape for `match_run_list` input — contextId (path) + pagination/sort. */
15
+ export const listMatchRunsInputShape = {
16
+ contextId: z
17
+ .string()
18
+ .min(1)
19
+ .describe('The reconciliation context id (UUID) whose run history to list. Routing ' +
20
+ 'param; matcher validates it belongs to your tenant.'),
21
+ limit: z
22
+ .number()
23
+ .int()
24
+ .min(1)
25
+ .max(200)
26
+ .optional()
27
+ .describe('Maximum number of records to return (1–200, default 20).'),
28
+ cursor: z
29
+ .string()
30
+ .optional()
31
+ .describe('Opaque pagination cursor from a prior response. Re-call with the ' +
32
+ 'returned nextCursor to page forward (there is no auto-pagination).'),
33
+ sort_order: z
34
+ .enum(SORT_ORDERS)
35
+ .optional()
36
+ .describe('Sort order by creation time. desc (default) lists newest first; asc lists ' +
37
+ 'oldest first.'),
38
+ };
39
+ /** Build the list query, omitting unset knobs so the request stays minimal. */
40
+ function buildListQuery(args) {
41
+ const query = {};
42
+ if (args.limit !== undefined) {
43
+ query.limit = args.limit;
44
+ }
45
+ if (args.cursor !== undefined) {
46
+ query.cursor = args.cursor;
47
+ }
48
+ if (args.sort_order !== undefined) {
49
+ query.sort_order = args.sort_order;
50
+ }
51
+ return Object.keys(query).length > 0 ? query : undefined;
52
+ }
53
+ /**
54
+ * Register `match_run_list`. Passes limit/cursor/sort_order through and returns
55
+ * matcher's pagination envelope verbatim; a matcher error surfaces via the shared
56
+ * toToolError.
57
+ */
58
+ export function registerMatchRunListTool(server) {
59
+ server.registerTool('match_run_list', {
60
+ description: "List a reconciliation context's match-run history (cursor-paginated, " +
61
+ 'newest first). Pass contextId (required), and optionally limit (1–200), ' +
62
+ 'cursor, and sort_order (asc|desc). The response carries { items, ' +
63
+ 'nextCursor } — paginate by re-calling with the returned nextCursor. ' +
64
+ 'contextId is a routing param scoped to your token; no tenant field is ' +
65
+ 'accepted.',
66
+ inputSchema: listMatchRunsInputShape,
67
+ }, async (args, extra) => {
68
+ const query = buildListQuery(args);
69
+ return dispatchMatching({
70
+ method: 'GET',
71
+ path: contextRunsPath(args.contextId),
72
+ ...(query !== undefined ? { query } : {}),
73
+ }, extra);
74
+ });
75
+ }
76
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/tools/matching/list.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,kFAAkF;AAClF,4EAA4E;AAC5E,EAAE;AACF,4EAA4E;AAC5E,uCAAuC;AAEvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE/D,+DAA+D;AAC/D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU,CAAA;AAEnD,qFAAqF;AACrF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,0EAA0E;QACxE,qDAAqD,CACxD;IACH,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,0DAA0D,CAAC;IACvE,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,mEAAmE;QACjE,oEAAoE,CACvE;IACH,UAAU,EAAE,CAAC;SACV,IAAI,CAAC,WAAW,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CACP,4EAA4E;QAC1E,eAAe,CAClB;CACJ,CAAA;AAOD,+EAA+E;AAC/E,SAAS,cAAc,CAAC,IAAwB;IAC9C,MAAM,KAAK,GAAoC,EAAE,CAAA;IACjD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC7B,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;IAC1B,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC9B,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAC5B,CAAC;IACD,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QAClC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;IACpC,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;AAC1D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,CACjB,gBAAgB,EAChB;QACE,WAAW,EACT,uEAAuE;YACvE,0EAA0E;YAC1E,mEAAmE;YACnE,sEAAsE;YACtE,wEAAwE;YACxE,WAAW;QACb,WAAW,EAAE,uBAAuB;KACrC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;QAClC,OAAO,gBAAgB,CACrB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC;YACrC,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,77 @@
1
+ // Shared plumbing for the curated match-run tools.
2
+ //
3
+ // Unlike the configuration resources (fee schedules, rules, contexts, sources),
4
+ // the match-run family is NOT CRUD — it is a set of action/read verbs over the
5
+ // matcher engine: start a run, list a context's runs, read one run's results,
6
+ // and page its match groups. They share the same relay shape as every other
7
+ // curated tool: fail-closed auth via requireMatcherClient, dispatch one
8
+ // assembled MatcherRequest, then return matcher's JSON on success or the SHARED
9
+ // toToolError on a MatcherApiError. This module factors that boilerplate once so
10
+ // the four tools stay thin (just "build the request") and so curated + generic
11
+ // surfaces map matcher errors through the identical path (toToolError).
12
+ //
13
+ // Two path families exist (mirroring the spec): runs are triggered/listed under
14
+ // the context (`/v1/matching/contexts/{contextId}/...`), while a run's detail and
15
+ // groups are read by run id (`/v1/matching/runs/{runId}/...`) — and on those
16
+ // detail reads `contextId` is carried as a REQUIRED QUERY param, not in the path.
17
+ //
18
+ // Security: the bearer token is never read here directly — requireMatcherClient
19
+ // owns the request-scoped relay and fails closed when no usable credential was
20
+ // provided. No tenant identifier is ever read or injected (matcher derives
21
+ // tenant from the relayed JWT); no match-run tool input carries one. `contextId`
22
+ // is a routing param matcher validates ownership of, not a tenant field.
23
+ import { requireMatcherClient, UnauthenticatedError, } from '../../auth/request-token.js';
24
+ import { isMatcherApiError, toToolError } from '../tool-error.js';
25
+ /** Trigger path for a context's matching run: POST starts a run. */
26
+ export function contextRunPath(contextId) {
27
+ return `/v1/matching/contexts/${encodeURIComponent(contextId)}/run`;
28
+ }
29
+ /** List path for a context's match-run history. */
30
+ export function contextRunsPath(contextId) {
31
+ return `/v1/matching/contexts/${encodeURIComponent(contextId)}/runs`;
32
+ }
33
+ /** Detail path for a single run by id (contextId travels as a query param). */
34
+ export function runPath(runId) {
35
+ return `/v1/matching/runs/${encodeURIComponent(runId)}`;
36
+ }
37
+ /** Groups path for a run's results (contextId travels as a query param). */
38
+ export function runGroupsPath(runId) {
39
+ return `/v1/matching/runs/${encodeURIComponent(runId)}/groups`;
40
+ }
41
+ /**
42
+ * Run one assembled request through the relay: fail-closed auth, dispatch, and
43
+ * RFC 9457 → tool-error mapping — identical to the generic invoke's dispatch so
44
+ * both surfaces produce the same structured error shape.
45
+ *
46
+ * `clientFor` is injectable for tests; production callers pass nothing and get
47
+ * the request-scoped, fail-closed `requireMatcherClient`.
48
+ */
49
+ export async function dispatchMatching(request, extra, clientFor = requireMatcherClient) {
50
+ let client;
51
+ try {
52
+ // Fail-closed on a missing / empty / non-Bearer credential.
53
+ client = clientFor(extra);
54
+ }
55
+ catch (err) {
56
+ if (err instanceof UnauthenticatedError) {
57
+ return { isError: true, content: [{ type: 'text', text: err.message }] };
58
+ }
59
+ throw err;
60
+ }
61
+ try {
62
+ const result = await client.request(request);
63
+ // Success → matcher's run payload returned as-is (202 { runId, status },
64
+ // run detail status/stats/ruleStats, or the group pagination envelope).
65
+ return { content: [{ type: 'text', text: JSON.stringify(result ?? null) }] };
66
+ }
67
+ catch (err) {
68
+ // RFC 9457 problem → the SHARED structured tool error (status/title/detail/
69
+ // code preserved). A non-matcher error is a bug, not a matcher failure, and
70
+ // is re-thrown rather than masqueraded as one.
71
+ if (isMatcherApiError(err)) {
72
+ return toToolError(err);
73
+ }
74
+ throw err;
75
+ }
76
+ }
77
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/tools/matching/shared.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,wEAAwE;AACxE,gFAAgF;AAChF,iFAAiF;AACjF,+EAA+E;AAC/E,wEAAwE;AACxE,EAAE;AACF,gFAAgF;AAChF,kFAAkF;AAClF,6EAA6E;AAC7E,kFAAkF;AAClF,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,2EAA2E;AAC3E,iFAAiF;AACjF,yEAAyE;AAIzE,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAErB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEjE,oEAAoE;AACpE,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,OAAO,yBAAyB,kBAAkB,CAAC,SAAS,CAAC,MAAM,CAAA;AACrE,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,OAAO,yBAAyB,kBAAkB,CAAC,SAAS,CAAC,OAAO,CAAA;AACtE,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,OAAO,qBAAqB,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAA;AACzD,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,qBAAqB,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAA;AAChE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAuB,EACvB,KAAmC,EACnC,YAAyD,oBAAoB;IAE7E,IAAI,MAAqB,CAAA;IACzB,IAAI,CAAC;QACH,4DAA4D;QAC5D,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,oBAAoB,EAAE,CAAC;YACxC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,CAAA;QAC1E,CAAC;QACD,MAAM,GAAG,CAAA;IACX,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC5C,yEAAyE;QACzE,wEAAwE;QACxE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,EAAE,CAAC,EAAE,CAAA;IAC9E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,4EAA4E;QAC5E,4EAA4E;QAC5E,+CAA+C;QAC/C,IAAI,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,WAAW,CAAC,GAAG,CAAC,CAAA;QACzB,CAAC;QACD,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,55 @@
1
+ // `match_run_start` — curated POST /v1/matching/contexts/{contextId}/run.
2
+ //
3
+ // Triggers a matching run for a reconciliation context. This is an async action:
4
+ // matcher responds 202 with { runId, status } and processes in the background —
5
+ // the operator polls `match_run_get` with the returned runId to follow progress.
6
+ // This tool does NOT auto-poll; it returns the 202 acceptance body verbatim.
7
+ //
8
+ // `contextId` is a routing path param (matcher validates it belongs to the
9
+ // relayed token's tenant), NOT a tenant field. No tenant field is accepted.
10
+ import { z } from 'zod';
11
+ import { contextRunPath, dispatchMatching } from './shared.js';
12
+ /**
13
+ * Execution modes for a matching run.
14
+ * - DRY_RUN tests the context's rules and reports what WOULD match without
15
+ * committing any results.
16
+ * - COMMIT executes the rules and persists the resulting matches.
17
+ */
18
+ export const RUN_MODES = ['DRY_RUN', 'COMMIT'];
19
+ /** Zod raw shape for `match_run_start` input — contextId (path) + required mode. */
20
+ export const startMatchRunInputShape = {
21
+ contextId: z
22
+ .string()
23
+ .min(1)
24
+ .describe('The reconciliation context id (UUID) to run matching for. Routing param; ' +
25
+ 'matcher validates it belongs to your tenant.'),
26
+ mode: z
27
+ .enum(RUN_MODES)
28
+ .describe('Execution mode. DRY_RUN tests the rules without committing any matches; ' +
29
+ 'COMMIT executes the rules and persists the resulting matches.'),
30
+ };
31
+ /**
32
+ * Register `match_run_start`. Substitutes contextId into the path and sends only
33
+ * `{ mode }` as the body (per RunMatchRequest, which forbids extra properties).
34
+ * Dispatches through the shared fail-closed relay; a matcher error surfaces via
35
+ * the shared toToolError.
36
+ */
37
+ export function registerMatchRunStartTool(server) {
38
+ server.registerTool('match_run_start', {
39
+ description: 'Trigger a matching run for a reconciliation context. Async: returns 202 ' +
40
+ 'with { runId, status } and processes in the background — poll ' +
41
+ 'match_run_get with the runId to follow progress (this tool does not ' +
42
+ 'auto-poll). mode is required: DRY_RUN tests rules without committing, ' +
43
+ 'COMMIT persists the matches. contextId is a routing param scoped to your ' +
44
+ 'token (no tenant field is accepted). Returns the acceptance body, or a ' +
45
+ 'structured RFC 9457 error.',
46
+ inputSchema: startMatchRunInputShape,
47
+ }, async (args, extra) => {
48
+ return dispatchMatching({
49
+ method: 'POST',
50
+ path: contextRunPath(args.contextId),
51
+ body: { mode: args.mode },
52
+ }, extra);
53
+ });
54
+ }
55
+ //# sourceMappingURL=start.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/tools/matching/start.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,iFAAiF;AACjF,gFAAgF;AAChF,iFAAiF;AACjF,6EAA6E;AAC7E,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAE5E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAU,CAAA;AAEvD,oFAAoF;AACpF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,2EAA2E;QACzE,8CAA8C,CACjD;IACH,IAAI,EAAE,CAAC;SACJ,IAAI,CAAC,SAAS,CAAC;SACf,QAAQ,CACP,0EAA0E;QACxE,+DAA+D,CAClE;CACJ,CAAA;AAOD;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,WAAW,EACT,0EAA0E;YAC1E,gEAAgE;YAChE,sEAAsE;YACtE,wEAAwE;YACxE,2EAA2E;YAC3E,yEAAyE;YACzE,4BAA4B;QAC9B,WAAW,EAAE,uBAAuB;KACrC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,gBAAgB,CACrB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC;YACpC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;SAC1B,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,45 @@
1
+ // `report_count_exceptions` — curated GET
2
+ // /v1/reports/contexts/{contextId}/exceptions/count.
3
+ //
4
+ // Returns the total count of exceptions for the given filters — used to decide
5
+ // between a sync download (<1000 rows) and an async export job. Here the date
6
+ // filter applies to the exception's created_at (not the underlying transaction
7
+ // date). Takes only the common date filter and returns matcher's
8
+ // ExportCountResponse as-is. The count is implicitly tenant-scoped by the
9
+ // relayed token; contextId is a routing path param, not a tenant field, and no
10
+ // tenant field is accepted.
11
+ import { z } from 'zod';
12
+ import { buildReportFilterQuery, contextReportPath, dispatchReport, reportFilterInputShape, } from './shared.js';
13
+ /** Zod raw shape for `report_count_exceptions` input — contextId path + date filter. */
14
+ export const countExceptionsInputShape = {
15
+ contextId: z
16
+ .string()
17
+ .min(1)
18
+ .describe('The reconciliation context id (UUID) whose exceptions to count. Routing ' +
19
+ 'path param, not a tenant field.'),
20
+ ...reportFilterInputShape,
21
+ };
22
+ /**
23
+ * Register `report_count_exceptions`. Passes the date filter through and returns
24
+ * matcher's count envelope verbatim; a matcher error surfaces via the shared
25
+ * toToolError.
26
+ */
27
+ export function registerReportCountExceptionsTool(server) {
28
+ server.registerTool('report_count_exceptions', {
29
+ description: 'Count exceptions for a context within a date window — use it to decide ' +
30
+ 'between a sync download (<1000 rows) and an async export. The date ' +
31
+ "filter applies to each exception's created_at. Pass contextId (UUID " +
32
+ 'path param — not a tenant field), and optionally date_from/date_to ' +
33
+ '(YYYY-MM-DD, window ≤ 90 days) and source_id. No tenant field is ' +
34
+ 'accepted.',
35
+ inputSchema: countExceptionsInputShape,
36
+ }, async (args, extra) => {
37
+ const query = buildReportFilterQuery(args);
38
+ return dispatchReport({
39
+ method: 'GET',
40
+ path: contextReportPath(args.contextId, 'exceptions/count'),
41
+ ...(query !== undefined ? { query } : {}),
42
+ }, extra);
43
+ });
44
+ }
45
+ //# sourceMappingURL=count-exceptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"count-exceptions.js","sourceRoot":"","sources":["../../../src/tools/report/count-exceptions.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,qDAAqD;AACrD,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,+EAA+E;AAC/E,iEAAiE;AACjE,0EAA0E;AAC1E,+EAA+E;AAC/E,4BAA4B;AAE5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,GACvB,MAAM,aAAa,CAAA;AAEpB,wFAAwF;AACxF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,0EAA0E;QACxE,iCAAiC,CACpC;IACH,GAAG,sBAAsB;CAC1B,CAAA;AAOD;;;;GAIG;AACH,MAAM,UAAU,iCAAiC,CAAC,MAAiB;IACjE,MAAM,CAAC,YAAY,CACjB,yBAAyB,EACzB;QACE,WAAW,EACT,yEAAyE;YACzE,qEAAqE;YACrE,sEAAsE;YACtE,qEAAqE;YACrE,mEAAmE;YACnE,WAAW;QACb,WAAW,EAAE,yBAAyB;KACvC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,MAAM,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAA;QAC1C,OAAO,cAAc,CACnB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC;YAC3D,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,46 @@
1
+ // `report_count_matched` — curated GET
2
+ // /v1/reports/contexts/{contextId}/matches/count.
3
+ //
4
+ // Returns the total count of matched records for the given filters — used to
5
+ // decide between a sync download (<1000 rows) and an async export job. NOTE the
6
+ // spec path is `matches/count` (plural "matches"), distinct from the report
7
+ // path `matched` — that asymmetry is encoded in the suffix below. The date
8
+ // filter applies to the transaction date. Takes only the common date filter and
9
+ // returns matcher's ExportCountResponse as-is. The count is implicitly
10
+ // tenant-scoped by the relayed token; contextId is a routing path param, not a
11
+ // tenant field, and no tenant field is accepted.
12
+ import { z } from 'zod';
13
+ import { buildReportFilterQuery, contextReportPath, dispatchReport, reportFilterInputShape, } from './shared.js';
14
+ /** Zod raw shape for `report_count_matched` input — contextId path + date filter. */
15
+ export const countMatchedInputShape = {
16
+ contextId: z
17
+ .string()
18
+ .min(1)
19
+ .describe('The reconciliation context id (UUID) whose matched records to count. ' +
20
+ 'Routing path param, not a tenant field.'),
21
+ ...reportFilterInputShape,
22
+ };
23
+ /**
24
+ * Register `report_count_matched`. Passes the date filter through and returns
25
+ * matcher's count envelope verbatim; a matcher error surfaces via the shared
26
+ * toToolError. The path suffix is `matches/count` (plural), per the spec.
27
+ */
28
+ export function registerReportCountMatchedTool(server) {
29
+ server.registerTool('report_count_matched', {
30
+ description: 'Count matched records for a context within a date window — use it to ' +
31
+ 'decide between a sync download (<1000 rows) and an async export. The ' +
32
+ 'date filter applies to the transaction date. Pass contextId (UUID path ' +
33
+ 'param — not a tenant field), and optionally date_from/date_to ' +
34
+ '(YYYY-MM-DD, window ≤ 90 days) and source_id. No tenant field is ' +
35
+ 'accepted.',
36
+ inputSchema: countMatchedInputShape,
37
+ }, async (args, extra) => {
38
+ const query = buildReportFilterQuery(args);
39
+ return dispatchReport({
40
+ method: 'GET',
41
+ path: contextReportPath(args.contextId, 'matches/count'),
42
+ ...(query !== undefined ? { query } : {}),
43
+ }, extra);
44
+ });
45
+ }
46
+ //# sourceMappingURL=count-matched.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"count-matched.js","sourceRoot":"","sources":["../../../src/tools/report/count-matched.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,gFAAgF;AAChF,4EAA4E;AAC5E,2EAA2E;AAC3E,gFAAgF;AAChF,uEAAuE;AACvE,+EAA+E;AAC/E,iDAAiD;AAEjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,GACvB,MAAM,aAAa,CAAA;AAEpB,qFAAqF;AACrF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,uEAAuE;QACrE,yCAAyC,CAC5C;IACH,GAAG,sBAAsB;CAC1B,CAAA;AAOD;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAiB;IAC9D,MAAM,CAAC,YAAY,CACjB,sBAAsB,EACtB;QACE,WAAW,EACT,uEAAuE;YACvE,uEAAuE;YACvE,yEAAyE;YACzE,gEAAgE;YAChE,mEAAmE;YACnE,WAAW;QACb,WAAW,EAAE,sBAAsB;KACpC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,MAAM,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAA;QAC1C,OAAO,cAAc,CACnB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC;YACxD,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,44 @@
1
+ // `report_count_transactions` — curated GET
2
+ // /v1/reports/contexts/{contextId}/transactions/count.
3
+ //
4
+ // Returns the total count of ALL transactions for the given filters — used to
5
+ // decide between a sync download (<1000 rows) and an async export job. The date
6
+ // filter applies to the transaction date. Takes only the common date filter and
7
+ // returns matcher's ExportCountResponse as-is. The count is implicitly
8
+ // tenant-scoped by the relayed token; contextId is a routing path param, not a
9
+ // tenant field, and no tenant field is accepted.
10
+ import { z } from 'zod';
11
+ import { buildReportFilterQuery, contextReportPath, dispatchReport, reportFilterInputShape, } from './shared.js';
12
+ /** Zod raw shape for `report_count_transactions` input — contextId path + date filter. */
13
+ export const countTransactionsInputShape = {
14
+ contextId: z
15
+ .string()
16
+ .min(1)
17
+ .describe('The reconciliation context id (UUID) whose transactions to count. ' +
18
+ 'Routing path param, not a tenant field.'),
19
+ ...reportFilterInputShape,
20
+ };
21
+ /**
22
+ * Register `report_count_transactions`. Passes the date filter through and
23
+ * returns matcher's count envelope verbatim; a matcher error surfaces via the
24
+ * shared toToolError.
25
+ */
26
+ export function registerReportCountTransactionsTool(server) {
27
+ server.registerTool('report_count_transactions', {
28
+ description: 'Count all transactions for a context within a date window — use it to ' +
29
+ 'decide between a sync download (<1000 rows) and an async export. The ' +
30
+ 'date filter applies to the transaction date. Pass contextId (UUID path ' +
31
+ 'param — not a tenant field), and optionally date_from/date_to ' +
32
+ '(YYYY-MM-DD, window ≤ 90 days) and source_id. No tenant field is ' +
33
+ 'accepted.',
34
+ inputSchema: countTransactionsInputShape,
35
+ }, async (args, extra) => {
36
+ const query = buildReportFilterQuery(args);
37
+ return dispatchReport({
38
+ method: 'GET',
39
+ path: contextReportPath(args.contextId, 'transactions/count'),
40
+ ...(query !== undefined ? { query } : {}),
41
+ }, extra);
42
+ });
43
+ }
44
+ //# sourceMappingURL=count-transactions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"count-transactions.js","sourceRoot":"","sources":["../../../src/tools/report/count-transactions.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,uDAAuD;AACvD,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF,uEAAuE;AACvE,+EAA+E;AAC/E,iDAAiD;AAEjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,GACvB,MAAM,aAAa,CAAA;AAEpB,0FAA0F;AAC1F,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,oEAAoE;QAClE,yCAAyC,CAC5C;IACH,GAAG,sBAAsB;CAC1B,CAAA;AAOD;;;;GAIG;AACH,MAAM,UAAU,mCAAmC,CAAC,MAAiB;IACnE,MAAM,CAAC,YAAY,CACjB,2BAA2B,EAC3B;QACE,WAAW,EACT,wEAAwE;YACxE,uEAAuE;YACvE,yEAAyE;YACzE,gEAAgE;YAChE,mEAAmE;YACnE,WAAW;QACb,WAAW,EAAE,2BAA2B;KACzC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,MAAM,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAA;QAC1C,OAAO,cAAc,CACnB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC;YAC7D,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,44 @@
1
+ // `report_count_unmatched` — curated GET
2
+ // /v1/reports/contexts/{contextId}/unmatched/count.
3
+ //
4
+ // Returns the total count of unmatched records for the given filters — used to
5
+ // decide between a sync download (<1000 rows) and an async export job. The date
6
+ // filter applies to the transaction date. Takes only the common date filter and
7
+ // returns matcher's ExportCountResponse as-is. The count is implicitly
8
+ // tenant-scoped by the relayed token; contextId is a routing path param, not a
9
+ // tenant field, and no tenant field is accepted.
10
+ import { z } from 'zod';
11
+ import { buildReportFilterQuery, contextReportPath, dispatchReport, reportFilterInputShape, } from './shared.js';
12
+ /** Zod raw shape for `report_count_unmatched` input — contextId path + date filter. */
13
+ export const countUnmatchedInputShape = {
14
+ contextId: z
15
+ .string()
16
+ .min(1)
17
+ .describe('The reconciliation context id (UUID) whose unmatched records to count. ' +
18
+ 'Routing path param, not a tenant field.'),
19
+ ...reportFilterInputShape,
20
+ };
21
+ /**
22
+ * Register `report_count_unmatched`. Passes the date filter through and returns
23
+ * matcher's count envelope verbatim; a matcher error surfaces via the shared
24
+ * toToolError.
25
+ */
26
+ export function registerReportCountUnmatchedTool(server) {
27
+ server.registerTool('report_count_unmatched', {
28
+ description: 'Count unmatched records for a context within a date window — use it to ' +
29
+ 'decide between a sync download (<1000 rows) and an async export. The ' +
30
+ 'date filter applies to the transaction date. Pass contextId (UUID path ' +
31
+ 'param — not a tenant field), and optionally date_from/date_to ' +
32
+ '(YYYY-MM-DD, window ≤ 90 days) and source_id. No tenant field is ' +
33
+ 'accepted.',
34
+ inputSchema: countUnmatchedInputShape,
35
+ }, async (args, extra) => {
36
+ const query = buildReportFilterQuery(args);
37
+ return dispatchReport({
38
+ method: 'GET',
39
+ path: contextReportPath(args.contextId, 'unmatched/count'),
40
+ ...(query !== undefined ? { query } : {}),
41
+ }, extra);
42
+ });
43
+ }
44
+ //# sourceMappingURL=count-unmatched.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"count-unmatched.js","sourceRoot":"","sources":["../../../src/tools/report/count-unmatched.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oDAAoD;AACpD,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,gFAAgF;AAChF,uEAAuE;AACvE,+EAA+E;AAC/E,iDAAiD;AAEjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,GACvB,MAAM,aAAa,CAAA;AAEpB,uFAAuF;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,yEAAyE;QACvE,yCAAyC,CAC5C;IACH,GAAG,sBAAsB;CAC1B,CAAA;AAOD;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAAC,MAAiB;IAChE,MAAM,CAAC,YAAY,CACjB,wBAAwB,EACxB;QACE,WAAW,EACT,yEAAyE;YACzE,uEAAuE;YACvE,yEAAyE;YACzE,gEAAgE;YAChE,mEAAmE;YACnE,WAAW;QACb,WAAW,EAAE,wBAAwB;KACtC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,MAAM,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAA;QAC1C,OAAO,cAAc,CACnB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC;YAC1D,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}