@lerianstudio/matcher-mcp 5.0.0-beta.67 → 5.0.0-beta.69
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.
- package/dist/spec/curated-operations.js +107 -95
- package/dist/spec/curated-operations.js.map +1 -1
- package/dist/spec/schema-parity.js +19 -10
- package/dist/spec/schema-parity.js.map +1 -1
- package/dist/tools/context/create.js +3 -2
- package/dist/tools/context/create.js.map +1 -1
- package/dist/tools/context/index.js +137 -17
- package/dist/tools/context/index.js.map +1 -1
- package/dist/tools/context/list.js +3 -2
- package/dist/tools/context/list.js.map +1 -1
- package/dist/tools/context/setup-progress.js +3 -2
- package/dist/tools/context/setup-progress.js.map +1 -1
- package/dist/tools/context/shared.js +7 -22
- package/dist/tools/context/shared.js.map +1 -1
- package/dist/tools/context/update.js +3 -2
- package/dist/tools/context/update.js.map +1 -1
- package/dist/tools/curated-tool.js +39 -0
- package/dist/tools/curated-tool.js.map +1 -0
- package/dist/tools/dashboard/index.js +124 -19
- package/dist/tools/dashboard/index.js.map +1 -1
- package/dist/tools/dashboard/shared.js +4 -42
- package/dist/tools/dashboard/shared.js.map +1 -1
- package/dist/tools/dispute/close.js +3 -2
- package/dist/tools/dispute/close.js.map +1 -1
- package/dist/tools/dispute/index.js +34 -6
- package/dist/tools/dispute/index.js.map +1 -1
- package/dist/tools/dispute/list.js +3 -2
- package/dist/tools/dispute/list.js.map +1 -1
- package/dist/tools/dispute/shared.js +4 -17
- package/dist/tools/dispute/shared.js.map +1 -1
- package/dist/tools/dispute/submit-evidence.js +3 -2
- package/dist/tools/dispute/submit-evidence.js.map +1 -1
- package/dist/tools/exception/add-comment.js +3 -2
- package/dist/tools/exception/add-comment.js.map +1 -1
- package/dist/tools/exception/adjust-entry.js +3 -2
- package/dist/tools/exception/adjust-entry.js.map +1 -1
- package/dist/tools/exception/bulk-assign.js +3 -2
- package/dist/tools/exception/bulk-assign.js.map +1 -1
- package/dist/tools/exception/bulk-dispatch.js +3 -2
- package/dist/tools/exception/bulk-dispatch.js.map +1 -1
- package/dist/tools/exception/bulk-resolve.js +3 -2
- package/dist/tools/exception/bulk-resolve.js.map +1 -1
- package/dist/tools/exception/dispatch.js +3 -2
- package/dist/tools/exception/dispatch.js.map +1 -1
- package/dist/tools/exception/force-match.js +3 -2
- package/dist/tools/exception/force-match.js.map +1 -1
- package/dist/tools/exception/history.js +3 -2
- package/dist/tools/exception/history.js.map +1 -1
- package/dist/tools/exception/index.js +88 -18
- package/dist/tools/exception/index.js.map +1 -1
- package/dist/tools/exception/list.js +3 -2
- package/dist/tools/exception/list.js.map +1 -1
- package/dist/tools/exception/open-dispute.js +3 -2
- package/dist/tools/exception/open-dispute.js.map +1 -1
- package/dist/tools/exception/shared.js +5 -20
- package/dist/tools/exception/shared.js.map +1 -1
- package/dist/tools/fee-rule/create.js +3 -2
- package/dist/tools/fee-rule/create.js.map +1 -1
- package/dist/tools/fee-rule/index.js +50 -8
- package/dist/tools/fee-rule/index.js.map +1 -1
- package/dist/tools/fee-rule/list.js +3 -2
- package/dist/tools/fee-rule/list.js.map +1 -1
- package/dist/tools/fee-rule/shared.js +5 -21
- package/dist/tools/fee-rule/shared.js.map +1 -1
- package/dist/tools/fee-rule/update.js +3 -2
- package/dist/tools/fee-rule/update.js.map +1 -1
- package/dist/tools/fee-schedule/create.js +3 -2
- package/dist/tools/fee-schedule/create.js.map +1 -1
- package/dist/tools/fee-schedule/index.js +62 -11
- package/dist/tools/fee-schedule/index.js.map +1 -1
- package/dist/tools/fee-schedule/list.js +3 -2
- package/dist/tools/fee-schedule/list.js.map +1 -1
- package/dist/tools/fee-schedule/shared.js +5 -18
- package/dist/tools/fee-schedule/shared.js.map +1 -1
- package/dist/tools/fee-schedule/simulate.js +3 -2
- package/dist/tools/fee-schedule/simulate.js.map +1 -1
- package/dist/tools/fee-schedule/update.js +3 -2
- package/dist/tools/fee-schedule/update.js.map +1 -1
- package/dist/tools/field-map/create.js +3 -2
- package/dist/tools/field-map/create.js.map +1 -1
- package/dist/tools/field-map/index.js +65 -11
- package/dist/tools/field-map/index.js.map +1 -1
- package/dist/tools/field-map/list.js +3 -2
- package/dist/tools/field-map/list.js.map +1 -1
- package/dist/tools/field-map/shared.js +6 -16
- package/dist/tools/field-map/shared.js.map +1 -1
- package/dist/tools/field-map/update.js +3 -2
- package/dist/tools/field-map/update.js.map +1 -1
- package/dist/tools/generic/invoke.js +3 -16
- package/dist/tools/generic/invoke.js.map +1 -1
- package/dist/tools/ingestion/index.js +100 -12
- package/dist/tools/ingestion/index.js.map +1 -1
- package/dist/tools/ingestion/job-transactions-list.js +3 -2
- package/dist/tools/ingestion/job-transactions-list.js.map +1 -1
- package/dist/tools/ingestion/jobs-list.js +3 -2
- package/dist/tools/ingestion/jobs-list.js.map +1 -1
- package/dist/tools/ingestion/shared.js +4 -15
- package/dist/tools/ingestion/shared.js.map +1 -1
- package/dist/tools/ingestion/transactions-search.js +3 -2
- package/dist/tools/ingestion/transactions-search.js.map +1 -1
- package/dist/tools/ingestion/upload.js +3 -2
- package/dist/tools/ingestion/upload.js.map +1 -1
- package/dist/tools/input-fields.js +15 -0
- package/dist/tools/input-fields.js.map +1 -1
- package/dist/tools/match-rule/index.js +130 -13
- package/dist/tools/match-rule/index.js.map +1 -1
- package/dist/tools/match-rule/list.js +3 -3
- package/dist/tools/match-rule/list.js.map +1 -1
- package/dist/tools/match-rule/shared.js +16 -20
- package/dist/tools/match-rule/shared.js.map +1 -1
- package/dist/tools/match-rule/update.js +3 -3
- package/dist/tools/match-rule/update.js.map +1 -1
- package/dist/tools/matching/get.js +5 -5
- package/dist/tools/matching/get.js.map +1 -1
- package/dist/tools/matching/groups.js +3 -2
- package/dist/tools/matching/groups.js.map +1 -1
- package/dist/tools/matching/index.js +77 -5
- package/dist/tools/matching/index.js.map +1 -1
- package/dist/tools/matching/list.js +3 -2
- package/dist/tools/matching/list.js.map +1 -1
- package/dist/tools/matching/shared.js +5 -18
- package/dist/tools/matching/shared.js.map +1 -1
- package/dist/tools/query-handler.js +2 -1
- package/dist/tools/query-handler.js.map +1 -1
- package/dist/tools/report/index.js +260 -30
- package/dist/tools/report/index.js.map +1 -1
- package/dist/tools/report/shared.js +15 -43
- package/dist/tools/report/shared.js.map +1 -1
- package/dist/tools/source/create.js +3 -2
- package/dist/tools/source/create.js.map +1 -1
- package/dist/tools/source/index.js +101 -13
- package/dist/tools/source/index.js.map +1 -1
- package/dist/tools/source/list.js +3 -2
- package/dist/tools/source/list.js.map +1 -1
- package/dist/tools/source/shared.js +5 -16
- package/dist/tools/source/shared.js.map +1 -1
- package/dist/tools/source/update.js +3 -2
- package/dist/tools/source/update.js.map +1 -1
- package/dist/tools/workspace/usage.js +12 -40
- package/dist/tools/workspace/usage.js.map +1 -1
- package/package.json +3 -3
- package/dist/copilot/test_helpers.js +0 -50
- package/dist/copilot/test_helpers.js.map +0 -1
- package/dist/tools/context/archive.js +0 -37
- package/dist/tools/context/archive.js.map +0 -1
- package/dist/tools/context/get.js +0 -31
- package/dist/tools/context/get.js.map +0 -1
- package/dist/tools/context/next-step.js +0 -99
- package/dist/tools/context/next-step.js.map +0 -1
- package/dist/tools/context/restore.js +0 -34
- package/dist/tools/context/restore.js.map +0 -1
- package/dist/tools/dashboard/aggregates.js +0 -38
- package/dist/tools/dashboard/aggregates.js.map +0 -1
- package/dist/tools/dashboard/cash-impact.js +0 -31
- package/dist/tools/dashboard/cash-impact.js.map +0 -1
- package/dist/tools/dashboard/match-rate.js +0 -31
- package/dist/tools/dashboard/match-rate.js.map +0 -1
- package/dist/tools/dashboard/metrics.js +0 -31
- package/dist/tools/dashboard/metrics.js.map +0 -1
- package/dist/tools/dashboard/sla.js +0 -28
- package/dist/tools/dashboard/sla.js.map +0 -1
- package/dist/tools/dashboard/source-breakdown.js +0 -31
- package/dist/tools/dashboard/source-breakdown.js.map +0 -1
- package/dist/tools/dashboard/volume.js +0 -31
- package/dist/tools/dashboard/volume.js.map +0 -1
- package/dist/tools/dispute/get.js +0 -27
- package/dist/tools/dispute/get.js.map +0 -1
- package/dist/tools/exception/delete-comment.js +0 -40
- package/dist/tools/exception/delete-comment.js.map +0 -1
- package/dist/tools/exception/get.js +0 -34
- package/dist/tools/exception/get.js.map +0 -1
- package/dist/tools/exception/list-comments.js +0 -35
- package/dist/tools/exception/list-comments.js.map +0 -1
- package/dist/tools/fee-rule/delete.js +0 -27
- package/dist/tools/fee-rule/delete.js.map +0 -1
- package/dist/tools/fee-rule/get.js +0 -27
- package/dist/tools/fee-rule/get.js.map +0 -1
- package/dist/tools/fee-schedule/delete.js +0 -32
- package/dist/tools/fee-schedule/delete.js.map +0 -1
- package/dist/tools/fee-schedule/get.js +0 -30
- package/dist/tools/fee-schedule/get.js.map +0 -1
- package/dist/tools/field-map/delete.js +0 -37
- package/dist/tools/field-map/delete.js.map +0 -1
- package/dist/tools/field-map/get.js +0 -40
- package/dist/tools/field-map/get.js.map +0 -1
- package/dist/tools/ingestion/job-errors-list.js +0 -42
- package/dist/tools/ingestion/job-errors-list.js.map +0 -1
- package/dist/tools/ingestion/job-get.js +0 -39
- package/dist/tools/ingestion/job-get.js.map +0 -1
- package/dist/tools/ingestion/transaction-ignore.js +0 -48
- package/dist/tools/ingestion/transaction-ignore.js.map +0 -1
- package/dist/tools/match-rule/create.js +0 -67
- package/dist/tools/match-rule/create.js.map +0 -1
- package/dist/tools/match-rule/delete.js +0 -33
- package/dist/tools/match-rule/delete.js.map +0 -1
- package/dist/tools/match-rule/get.js +0 -30
- package/dist/tools/match-rule/get.js.map +0 -1
- package/dist/tools/match-rule/reorder.js +0 -45
- package/dist/tools/match-rule/reorder.js.map +0 -1
- package/dist/tools/matching/start.js +0 -81
- package/dist/tools/matching/start.js.map +0 -1
- package/dist/tools/report/count-exceptions.js +0 -40
- package/dist/tools/report/count-exceptions.js.map +0 -1
- package/dist/tools/report/count-matched.js +0 -41
- package/dist/tools/report/count-matched.js.map +0 -1
- package/dist/tools/report/count-transactions.js +0 -39
- package/dist/tools/report/count-transactions.js.map +0 -1
- package/dist/tools/report/count-unmatched.js +0 -39
- package/dist/tools/report/count-unmatched.js.map +0 -1
- package/dist/tools/report/export-exceptions.js +0 -42
- package/dist/tools/report/export-exceptions.js.map +0 -1
- package/dist/tools/report/export-matched.js +0 -43
- package/dist/tools/report/export-matched.js.map +0 -1
- package/dist/tools/report/export-summary.js +0 -43
- package/dist/tools/report/export-summary.js.map +0 -1
- package/dist/tools/report/export-unmatched.js +0 -43
- package/dist/tools/report/export-unmatched.js.map +0 -1
- package/dist/tools/report/export-variance.js +0 -42
- package/dist/tools/report/export-variance.js.map +0 -1
- package/dist/tools/report/matched.js +0 -42
- package/dist/tools/report/matched.js.map +0 -1
- package/dist/tools/report/summary.js +0 -37
- package/dist/tools/report/summary.js.map +0 -1
- package/dist/tools/report/unmatched.js +0 -42
- package/dist/tools/report/unmatched.js.map +0 -1
- package/dist/tools/report/variance.js +0 -42
- package/dist/tools/report/variance.js.map +0 -1
- package/dist/tools/source/archive.js +0 -43
- package/dist/tools/source/archive.js.map +0 -1
- package/dist/tools/source/get.js +0 -54
- package/dist/tools/source/get.js.map +0 -1
- package/dist/tools/source/restore.js +0 -36
- package/dist/tools/source/restore.js.map +0 -1
|
@@ -1,40 +1,270 @@
|
|
|
1
|
-
// Curated report vertical: thirteen typed
|
|
1
|
+
// Curated report vertical: thirteen typed reads over the matcher synchronous
|
|
2
2
|
// reporting surface — the three paginated reads (matched/unmatched/variance),
|
|
3
3
|
// the summary read, the four counts (exceptions/matched/unmatched/transactions),
|
|
4
4
|
// and the five base64 exports (exceptions/matched/summary/unmatched/variance).
|
|
5
|
-
// Every op is a context-nested HTTP GET under /v1/reports/contexts/{contextId}
|
|
6
|
-
//
|
|
7
|
-
//
|
|
5
|
+
// Every op is a context-nested HTTP GET under /v1/reports/contexts/{contextId}
|
|
6
|
+
// and differs from its siblings only in its name, its path suffix, which query
|
|
7
|
+
// builder it picks and which input fragment it spreads, so the thirteen are
|
|
8
|
+
// declared as thirteen rows and registered by the one shared loop. Each row
|
|
9
|
+
// dispatches through the fail-closed relay (shared-dispatch.ts) and the RFC 9457
|
|
10
|
+
// → tool-error mapping (toToolError) the generic surface uses, so curated and
|
|
8
11
|
// generic map matcher errors identically. No tool carries a tenant field;
|
|
9
12
|
// contextId is a routing path param matcher validates against the relayed
|
|
10
13
|
// token's tenant.
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
import { registerCuratedTools, withQuery, } from '../curated-tool.js';
|
|
15
|
+
import { buildReportExportQuery, buildReportFilterQuery, buildReportPaginatedQuery, contextIdField, contextReportPath, reportFilterInputShape, reportFormatInputShape, reportPaginationInputShape, REPORT_EXPORT_FORMATS, REPORT_SORT_ORDERS, } from './shared.js';
|
|
16
|
+
/**
|
|
17
|
+
* Build a row's request: the context-scoped GET plus that group's query.
|
|
18
|
+
* `suffix` is a fixed literal owned by the table, never caller input.
|
|
19
|
+
*/
|
|
20
|
+
function reportRequest(suffix, buildQuery) {
|
|
21
|
+
return (args) => {
|
|
22
|
+
const input = args;
|
|
23
|
+
return {
|
|
24
|
+
method: 'GET',
|
|
25
|
+
path: contextReportPath(input.contextId, suffix),
|
|
26
|
+
...withQuery(buildQuery(input)),
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The thirteen curated report reads. Every description string is the
|
|
32
|
+
* hand-tuned LLM guidance a client sees verbatim; the published-surface golden
|
|
33
|
+
* is what proves an edit here did not drop a character.
|
|
34
|
+
*/
|
|
35
|
+
const REPORT_TOOLS = [
|
|
36
|
+
{
|
|
37
|
+
name: 'report_matched',
|
|
38
|
+
description: 'List matched transactions for a context within a date window ' +
|
|
39
|
+
'(cursor-paginated). Pass contextId (UUID path param — not a tenant ' +
|
|
40
|
+
'field), and optionally date_from/date_to (YYYY-MM-DD, window ≤ 90 ' +
|
|
41
|
+
'days; if omitted, defaults to the last ~30 days and SILENTLY EXCLUDES ' +
|
|
42
|
+
'older matches — pass an explicit range for a full picture), source_id, ' +
|
|
43
|
+
'limit (1–200), sort_order (asc|desc), and/or cursor. The response ' +
|
|
44
|
+
'carries { items, pagination: { next, prev } } — paginate by re-calling ' +
|
|
45
|
+
'with cursor set to the returned pagination.next (empty when exhausted). ' +
|
|
46
|
+
'No tenant field is accepted.',
|
|
47
|
+
inputShape: {
|
|
48
|
+
contextId: contextIdField('The reconciliation context id (UUID) whose matched transactions to ' +
|
|
49
|
+
'report. Routing path param, not a tenant field.'),
|
|
50
|
+
...reportFilterInputShape,
|
|
51
|
+
...reportPaginationInputShape,
|
|
52
|
+
},
|
|
53
|
+
request: reportRequest('matched', buildReportPaginatedQuery),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'report_unmatched',
|
|
57
|
+
description: 'List unmatched transactions for a context within a date window ' +
|
|
58
|
+
'(cursor-paginated). Pass contextId (UUID path param — not a tenant ' +
|
|
59
|
+
'field), and optionally date_from/date_to (YYYY-MM-DD, window ≤ 90 ' +
|
|
60
|
+
'days; if omitted, defaults to the last ~30 days and SILENTLY EXCLUDES ' +
|
|
61
|
+
'older unmatched items — pass an explicit range for a full picture), ' +
|
|
62
|
+
'source_id, limit (1–200), sort_order (asc|desc), and/or cursor. The ' +
|
|
63
|
+
'response carries { items, pagination: { next, prev } } — paginate by ' +
|
|
64
|
+
're-calling with cursor set to the returned pagination.next (empty when ' +
|
|
65
|
+
'exhausted). No tenant field is accepted.',
|
|
66
|
+
inputShape: {
|
|
67
|
+
contextId: contextIdField('The reconciliation context id (UUID) whose unmatched transactions to ' +
|
|
68
|
+
'report. Routing path param, not a tenant field.'),
|
|
69
|
+
...reportFilterInputShape,
|
|
70
|
+
...reportPaginationInputShape,
|
|
71
|
+
},
|
|
72
|
+
request: reportRequest('unmatched', buildReportPaginatedQuery),
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'report_variance',
|
|
76
|
+
description: 'List variance report rows for a context within a date window ' +
|
|
77
|
+
'(cursor-paginated). Pass contextId (UUID path param — not a tenant ' +
|
|
78
|
+
'field), and optionally date_from/date_to (YYYY-MM-DD, window ≤ 90 ' +
|
|
79
|
+
'days; if omitted, defaults to the last ~30 days and SILENTLY EXCLUDES ' +
|
|
80
|
+
'older rows — pass an explicit range for a full picture), source_id, ' +
|
|
81
|
+
'limit (1–200), sort_order (asc|desc), and/or cursor. The response ' +
|
|
82
|
+
'carries { items, pagination: { next, prev } } — paginate by re-calling ' +
|
|
83
|
+
'with cursor set to the returned pagination.next (empty when exhausted). ' +
|
|
84
|
+
'No tenant field is accepted.',
|
|
85
|
+
inputShape: {
|
|
86
|
+
contextId: contextIdField('The reconciliation context id (UUID) whose variance rows to report. ' +
|
|
87
|
+
'Routing path param, not a tenant field.'),
|
|
88
|
+
...reportFilterInputShape,
|
|
89
|
+
...reportPaginationInputShape,
|
|
90
|
+
},
|
|
91
|
+
request: reportRequest('variance', buildReportPaginatedQuery),
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'report_summary',
|
|
95
|
+
description: 'Get aggregated reconciliation summary statistics for a context within ' +
|
|
96
|
+
'a date window. Pass contextId (UUID path param — not a tenant field), ' +
|
|
97
|
+
'and optionally date_from/date_to (YYYY-MM-DD, window ≤ 90 days; if ' +
|
|
98
|
+
'omitted, defaults to the last ~30 days and SILENTLY EXCLUDES older ' +
|
|
99
|
+
'data — pass an explicit range for a full picture) and source_id. ' +
|
|
100
|
+
'Returns the summary totals, or a structured RFC 9457 error. No tenant ' +
|
|
101
|
+
'field is accepted.',
|
|
102
|
+
inputShape: {
|
|
103
|
+
contextId: contextIdField('The reconciliation context id (UUID) to summarize. Routing path param, ' +
|
|
104
|
+
'not a tenant field.'),
|
|
105
|
+
...reportFilterInputShape,
|
|
106
|
+
},
|
|
107
|
+
request: reportRequest('summary', buildReportFilterQuery),
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'report_count_exceptions',
|
|
111
|
+
description: 'Count exceptions for a context within a date window — use it to decide ' +
|
|
112
|
+
'between a sync download (<1000 rows) and an async export. The date ' +
|
|
113
|
+
"filter applies to each exception's created_at. Pass contextId (UUID " +
|
|
114
|
+
'path param — not a tenant field), and optionally date_from/date_to ' +
|
|
115
|
+
'(YYYY-MM-DD, window ≤ 90 days; if omitted, defaults to the last ~30 ' +
|
|
116
|
+
'days and SILENTLY EXCLUDES older exceptions — pass an explicit range ' +
|
|
117
|
+
'for a full picture) and source_id. No tenant field is accepted.',
|
|
118
|
+
inputShape: {
|
|
119
|
+
contextId: contextIdField('The reconciliation context id (UUID) whose exceptions to count. Routing ' +
|
|
120
|
+
'path param, not a tenant field.'),
|
|
121
|
+
...reportFilterInputShape,
|
|
122
|
+
},
|
|
123
|
+
request: reportRequest('exceptions/count', buildReportFilterQuery),
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
// The spec path is `matches/count` (plural), NOT `matched/count` — the
|
|
127
|
+
// one genuine asymmetry in this family. Carried from count-matched.ts.
|
|
128
|
+
name: 'report_count_matched',
|
|
129
|
+
description: 'Count matched records for a context within a date window — use it to ' +
|
|
130
|
+
'decide between a sync download (<1000 rows) and an async export. The ' +
|
|
131
|
+
'date filter applies to the transaction date. Pass contextId (UUID path ' +
|
|
132
|
+
'param — not a tenant field), and optionally date_from/date_to ' +
|
|
133
|
+
'(YYYY-MM-DD, window ≤ 90 days; if omitted, defaults to the last ~30 ' +
|
|
134
|
+
'days and SILENTLY EXCLUDES older matches — pass an explicit range for ' +
|
|
135
|
+
'a full picture) and source_id. No tenant field is accepted.',
|
|
136
|
+
inputShape: {
|
|
137
|
+
contextId: contextIdField('The reconciliation context id (UUID) whose matched records to count. ' +
|
|
138
|
+
'Routing path param, not a tenant field.'),
|
|
139
|
+
...reportFilterInputShape,
|
|
140
|
+
},
|
|
141
|
+
request: reportRequest('matches/count', buildReportFilterQuery),
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'report_count_unmatched',
|
|
145
|
+
description: 'Count unmatched records for a context within a date window — use it to ' +
|
|
146
|
+
'decide between a sync download (<1000 rows) and an async export. The ' +
|
|
147
|
+
'date filter applies to the transaction date. Pass contextId (UUID path ' +
|
|
148
|
+
'param — not a tenant field), and optionally date_from/date_to ' +
|
|
149
|
+
'(YYYY-MM-DD, window ≤ 90 days; if omitted, defaults to the last ~30 ' +
|
|
150
|
+
'days and SILENTLY EXCLUDES older unmatched records — pass an explicit ' +
|
|
151
|
+
'range for a full picture) and source_id. No tenant field is accepted.',
|
|
152
|
+
inputShape: {
|
|
153
|
+
contextId: contextIdField('The reconciliation context id (UUID) whose unmatched records to count. ' +
|
|
154
|
+
'Routing path param, not a tenant field.'),
|
|
155
|
+
...reportFilterInputShape,
|
|
156
|
+
},
|
|
157
|
+
request: reportRequest('unmatched/count', buildReportFilterQuery),
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: 'report_count_transactions',
|
|
161
|
+
description: 'Count all transactions for a context within a date window — use it to ' +
|
|
162
|
+
'decide between a sync download (<1000 rows) and an async export. The ' +
|
|
163
|
+
'date filter applies to the transaction date. Pass contextId (UUID path ' +
|
|
164
|
+
'param — not a tenant field), and optionally date_from/date_to ' +
|
|
165
|
+
'(YYYY-MM-DD, window ≤ 90 days; if omitted, defaults to the last ~30 ' +
|
|
166
|
+
'days and SILENTLY EXCLUDES older transactions — pass an explicit range ' +
|
|
167
|
+
'for a full picture) and source_id. No tenant field is accepted.',
|
|
168
|
+
inputShape: {
|
|
169
|
+
contextId: contextIdField('The reconciliation context id (UUID) whose transactions to count. ' +
|
|
170
|
+
'Routing path param, not a tenant field.'),
|
|
171
|
+
...reportFilterInputShape,
|
|
172
|
+
},
|
|
173
|
+
request: reportRequest('transactions/count', buildReportFilterQuery),
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'report_export_exceptions',
|
|
177
|
+
description: 'Export the exceptions report for a context within a date window as a ' +
|
|
178
|
+
'CSV or PDF file. Pass contextId (UUID path param — not a tenant field), ' +
|
|
179
|
+
'and optionally date_from/date_to (YYYY-MM-DD, window ≤ 90 days; if ' +
|
|
180
|
+
'omitted, defaults to the last ~30 days and SILENTLY EXCLUDES older ' +
|
|
181
|
+
'exceptions — pass an explicit range for a full picture), source_id, ' +
|
|
182
|
+
'and format (csv|pdf, default csv). The result is a base64-encoded ' +
|
|
183
|
+
'string — decode it to recover the file bytes. No tenant field is ' +
|
|
184
|
+
'accepted.',
|
|
185
|
+
inputShape: {
|
|
186
|
+
contextId: contextIdField('The reconciliation context id (UUID) whose exceptions to export. ' +
|
|
187
|
+
'Routing path param, not a tenant field.'),
|
|
188
|
+
...reportFilterInputShape,
|
|
189
|
+
...reportFormatInputShape,
|
|
190
|
+
},
|
|
191
|
+
request: reportRequest('exceptions/export', buildReportExportQuery),
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'report_export_matched',
|
|
195
|
+
description: 'Export the matched-transactions report for a context within a date ' +
|
|
196
|
+
'window as a CSV or PDF file. Pass contextId (UUID path param — not a ' +
|
|
197
|
+
'tenant field), and optionally date_from/date_to (YYYY-MM-DD, window ≤ ' +
|
|
198
|
+
'90 days; if omitted, defaults to the last ~30 days and SILENTLY ' +
|
|
199
|
+
'EXCLUDES older matches — pass an explicit range for a full picture), ' +
|
|
200
|
+
'source_id, and format (csv|pdf, default csv). The result is a ' +
|
|
201
|
+
'base64-encoded string — decode it to recover the file bytes. No tenant ' +
|
|
202
|
+
'field is accepted.',
|
|
203
|
+
inputShape: {
|
|
204
|
+
contextId: contextIdField('The reconciliation context id (UUID) whose matched transactions to ' +
|
|
205
|
+
'export. Routing path param, not a tenant field.'),
|
|
206
|
+
...reportFilterInputShape,
|
|
207
|
+
...reportFormatInputShape,
|
|
208
|
+
},
|
|
209
|
+
request: reportRequest('matched/export', buildReportExportQuery),
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: 'report_export_summary',
|
|
213
|
+
description: 'Export the reconciliation summary report for a context within a date ' +
|
|
214
|
+
'window as a CSV or PDF file. Pass contextId (UUID path param — not a ' +
|
|
215
|
+
'tenant field), and optionally date_from/date_to (YYYY-MM-DD, window ≤ ' +
|
|
216
|
+
'90 days; if omitted, defaults to the last ~30 days and SILENTLY ' +
|
|
217
|
+
'EXCLUDES older data — pass an explicit range for a full picture), ' +
|
|
218
|
+
'source_id, and format (csv|pdf, default csv). The result is a ' +
|
|
219
|
+
'base64-encoded string — decode it to recover the file bytes. No tenant ' +
|
|
220
|
+
'field is accepted.',
|
|
221
|
+
inputShape: {
|
|
222
|
+
contextId: contextIdField('The reconciliation context id (UUID) to export the summary for. Routing ' +
|
|
223
|
+
'path param, not a tenant field.'),
|
|
224
|
+
...reportFilterInputShape,
|
|
225
|
+
...reportFormatInputShape,
|
|
226
|
+
},
|
|
227
|
+
request: reportRequest('summary/export', buildReportExportQuery),
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: 'report_export_unmatched',
|
|
231
|
+
description: 'Export the unmatched-transactions report for a context within a date ' +
|
|
232
|
+
'window as a CSV or PDF file. Pass contextId (UUID path param — not a ' +
|
|
233
|
+
'tenant field), and optionally date_from/date_to (YYYY-MM-DD, window ≤ ' +
|
|
234
|
+
'90 days; if omitted, defaults to the last ~30 days and SILENTLY ' +
|
|
235
|
+
'EXCLUDES older unmatched items — pass an explicit range for a full ' +
|
|
236
|
+
'picture), source_id, and format (csv|pdf, default csv). The result is ' +
|
|
237
|
+
'a base64-encoded string — decode it to recover the file bytes. No ' +
|
|
238
|
+
'tenant field is accepted.',
|
|
239
|
+
inputShape: {
|
|
240
|
+
contextId: contextIdField('The reconciliation context id (UUID) whose unmatched transactions to ' +
|
|
241
|
+
'export. Routing path param, not a tenant field.'),
|
|
242
|
+
...reportFilterInputShape,
|
|
243
|
+
...reportFormatInputShape,
|
|
244
|
+
},
|
|
245
|
+
request: reportRequest('unmatched/export', buildReportExportQuery),
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: 'report_export_variance',
|
|
249
|
+
description: 'Export the variance analysis report for a context within a date ' +
|
|
250
|
+
'window as a CSV or PDF file. Pass contextId (UUID path param — not a ' +
|
|
251
|
+
'tenant field), and optionally date_from/date_to (YYYY-MM-DD, window ≤ ' +
|
|
252
|
+
'90 days; if omitted, defaults to the last ~30 days and SILENTLY ' +
|
|
253
|
+
'EXCLUDES older rows — pass an explicit range for a full picture), ' +
|
|
254
|
+
'source_id, and format (csv|pdf, default csv). The result is a ' +
|
|
255
|
+
'base64-encoded string — decode it to recover the file bytes. No tenant ' +
|
|
256
|
+
'field is accepted.',
|
|
257
|
+
inputShape: {
|
|
258
|
+
contextId: contextIdField('The reconciliation context id (UUID) whose variance rows to export. ' +
|
|
259
|
+
'Routing path param, not a tenant field.'),
|
|
260
|
+
...reportFilterInputShape,
|
|
261
|
+
...reportFormatInputShape,
|
|
262
|
+
},
|
|
263
|
+
request: reportRequest('variance/export', buildReportExportQuery),
|
|
264
|
+
},
|
|
265
|
+
];
|
|
24
266
|
/** Register all thirteen curated report tools on the given server. */
|
|
25
267
|
export function registerReportTools(server) {
|
|
26
|
-
|
|
27
|
-
registerReportUnmatchedTool(server);
|
|
28
|
-
registerReportVarianceTool(server);
|
|
29
|
-
registerReportSummaryTool(server);
|
|
30
|
-
registerReportCountExceptionsTool(server);
|
|
31
|
-
registerReportCountMatchedTool(server);
|
|
32
|
-
registerReportCountUnmatchedTool(server);
|
|
33
|
-
registerReportCountTransactionsTool(server);
|
|
34
|
-
registerReportExportExceptionsTool(server);
|
|
35
|
-
registerReportExportMatchedTool(server);
|
|
36
|
-
registerReportExportSummaryTool(server);
|
|
37
|
-
registerReportExportUnmatchedTool(server);
|
|
38
|
-
registerReportExportVarianceTool(server);
|
|
268
|
+
registerCuratedTools(server, REPORT_TOOLS);
|
|
39
269
|
}
|
|
40
270
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/report/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,iFAAiF;AACjF,+EAA+E;AAC/E
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/report/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,iFAAiF;AACjF,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,4EAA4E;AAC5E,iFAAiF;AACjF,8EAA8E;AAC9E,0EAA0E;AAC1E,0EAA0E;AAC1E,kBAAkB;AAKlB,OAAO,EACL,oBAAoB,EACpB,SAAS,GAEV,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAA;AAkBpB;;;GAGG;AACH,SAAS,aAAa,CACpB,MAAc,EACd,UAAyD;IAEzD,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,KAAK,GAAG,IAAkB,CAAA;QAChC,OAAO;YACL,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC;YAChD,GAAG,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;SAChC,CAAA;IACH,CAAC,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,YAAY,GAA2B;IAC3C;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,+DAA+D;YAC/D,qEAAqE;YACrE,oEAAoE;YACpE,wEAAwE;YACxE,yEAAyE;YACzE,oEAAoE;YACpE,yEAAyE;YACzE,0EAA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QAC7B,UAAU,EAAE;YACV,SAAS,EAAE,cAAc,CACvB,uEAAuE;gBACrE,iDAAiD,CACpD;YACD,GAAG,sBAAsB;YACzB,GAAG,sBAAsB;SAC1B;QACD,OAAO,EAAE,aAAa,CAAC,kBAAkB,EAAE,sBAAsB,CAAC;KACnE;IACD;QACE,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACT,kEAAkE;YAClE,uEAAuE;YACvE,wEAAwE;YACxE,kEAAkE;YAClE,oEAAoE;YACpE,gEAAgE;YAChE,yEAAyE;YACzE,oBAAoB;QACtB,UAAU,EAAE;YACV,SAAS,EAAE,cAAc,CACvB,sEAAsE;gBACpE,yCAAyC,CAC5C;YACD,GAAG,sBAAsB;YACzB,GAAG,sBAAsB;SAC1B;QACD,OAAO,EAAE,aAAa,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;KAClE;CACF,CAAA;AAED,sEAAsE;AACtE,MAAM,UAAU,mBAAmB,CAAC,MAAiB;IACnD,oBAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;AAC5C,CAAC"}
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
// - the five exports: the common date filter plus a csv|pdf format, returning
|
|
12
12
|
// a base64 STRING the caller must decode.
|
|
13
13
|
//
|
|
14
|
-
// This module factors the path builder, the
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
14
|
+
// This module factors the path builder, the contextId field builder and the
|
|
15
|
+
// three reusable query builders exactly once so each of the thirteen tools is
|
|
16
|
+
// one table row in index.ts (just "name the suffix + pick the query builder").
|
|
17
|
+
// The relay itself lives in shared-dispatch.ts, reached through the shared
|
|
18
|
+
// registration loop and shared with the source / fee-schedule / match-rule
|
|
19
|
+
// verticals, so curated and generic surfaces map matcher errors through the
|
|
20
|
+
// same path (toToolError).
|
|
19
21
|
//
|
|
20
22
|
// Security: the bearer token is never read here directly — requireMatcherClient
|
|
21
23
|
// owns the request-scoped relay and fails closed when no usable credential was
|
|
@@ -32,9 +34,7 @@
|
|
|
32
34
|
// number as the whole reconciliation result.
|
|
33
35
|
import { z } from 'zod';
|
|
34
36
|
import { pageLimit, reportDateFrom, reportDateTo } from '../input-fields.js';
|
|
35
|
-
import { requireMatcherClient, UnauthenticatedError, } from '../../auth/request-token.js';
|
|
36
37
|
import { pickQuery } from '../request-fields.js';
|
|
37
|
-
import { isMatcherApiError, toToolError } from '../tool-error.js';
|
|
38
38
|
/** Sort-order enum shared by the paginated report ops (created_at asc|desc). */
|
|
39
39
|
export const REPORT_SORT_ORDERS = ['asc', 'desc'];
|
|
40
40
|
/** Export-format enum shared by the five export ops (csv|pdf). */
|
|
@@ -49,6 +49,14 @@ export const REPORT_EXPORT_FORMATS = ['csv', 'pdf'];
|
|
|
49
49
|
export function contextReportPath(contextId, suffix) {
|
|
50
50
|
return `/v1/reports/contexts/${encodeURIComponent(contextId)}/${suffix}`;
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Build a row's `contextId` path field. Every report op declares the same
|
|
54
|
+
* validation and differs only in the sentence naming what it reports on, so the
|
|
55
|
+
* description is supplied verbatim per row and nothing else is repeated.
|
|
56
|
+
*/
|
|
57
|
+
export function contextIdField(description) {
|
|
58
|
+
return z.string().min(1).describe(description);
|
|
59
|
+
}
|
|
52
60
|
/**
|
|
53
61
|
* The common date-window + source filter every report op accepts. Factored as a
|
|
54
62
|
* raw-shape fragment so each op's inputSchema spreads it in and stays focused on
|
|
@@ -104,40 +112,4 @@ export function buildReportPaginatedQuery(args) {
|
|
|
104
112
|
export function buildReportExportQuery(args) {
|
|
105
113
|
return pickQuery(args, [...REPORT_FILTER_KEYS, 'format']);
|
|
106
114
|
}
|
|
107
|
-
/**
|
|
108
|
-
* Run one assembled request through the relay: fail-closed auth, dispatch, and
|
|
109
|
-
* RFC 9457 → tool-error mapping — identical to the generic invoke's dispatch so
|
|
110
|
-
* both surfaces produce the same structured error shape.
|
|
111
|
-
*
|
|
112
|
-
* `clientFor` is injectable for tests; production callers pass nothing and get
|
|
113
|
-
* the request-scoped, fail-closed `requireMatcherClient`.
|
|
114
|
-
*/
|
|
115
|
-
export async function dispatchReport(request, extra, clientFor = requireMatcherClient) {
|
|
116
|
-
let client;
|
|
117
|
-
try {
|
|
118
|
-
// Fail-closed on a missing / empty / non-Bearer credential.
|
|
119
|
-
client = clientFor(extra);
|
|
120
|
-
}
|
|
121
|
-
catch (err) {
|
|
122
|
-
if (err instanceof UnauthenticatedError) {
|
|
123
|
-
return { isError: true, content: [{ type: 'text', text: err.message }] };
|
|
124
|
-
}
|
|
125
|
-
throw err;
|
|
126
|
-
}
|
|
127
|
-
try {
|
|
128
|
-
const result = await client.request(request);
|
|
129
|
-
// Success → matcher's JSON returned as-is. Exports return a base64 STRING
|
|
130
|
-
// here verbatim (the caller decodes it); a 204/empty body → null.
|
|
131
|
-
return { content: [{ type: 'text', text: JSON.stringify(result ?? null) }] };
|
|
132
|
-
}
|
|
133
|
-
catch (err) {
|
|
134
|
-
// RFC 9457 problem → the SHARED structured tool error (status/title/detail/
|
|
135
|
-
// code preserved). A non-matcher error is a bug, not a matcher failure, and
|
|
136
|
-
// is re-thrown rather than masqueraded as one.
|
|
137
|
-
if (isMatcherApiError(err)) {
|
|
138
|
-
return toToolError(err);
|
|
139
|
-
}
|
|
140
|
-
throw err;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
115
|
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/tools/report/shared.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,8EAA8E;AAC9E,iFAAiF;AACjF,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAChF,iFAAiF;AACjF,gBAAgB;AAChB,4EAA4E;AAC5E,gFAAgF;AAChF,8CAA8C;AAC9C,EAAE;AACF
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/t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relayed bearer token.
|
|
13
13
|
import { z } from 'zod';
|
|
14
14
|
import { bodyWithout } from '../request-fields.js';
|
|
15
|
-
import {
|
|
15
|
+
import { dispatchToolRequest } from '../shared-dispatch.js';
|
|
16
|
+
import { contextSourcesPath } from './shared.js';
|
|
16
17
|
/** Origin of the source data (LEDGER ledger / BANK feed / GATEWAY / CUSTOM / FETCHER pull). */
|
|
17
18
|
export const SOURCE_TYPES = [
|
|
18
19
|
'LEDGER',
|
|
@@ -215,7 +216,7 @@ export function registerSourceCreateTool(server) {
|
|
|
215
216
|
'that contextId and perform the action it names, repeating until ready.',
|
|
216
217
|
inputSchema: createSourceInputShape,
|
|
217
218
|
}, async (args, extra) => {
|
|
218
|
-
return
|
|
219
|
+
return dispatchToolRequest({
|
|
219
220
|
method: 'POST',
|
|
220
221
|
path: contextSourcesPath(args.contextId),
|
|
221
222
|
body: buildCreateBody(args),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/tools/source/create.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,iFAAiF;AACjF,6EAA6E;AAC7E,gFAAgF;AAChF,mBAAmB;AACnB,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;AAE5E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAElD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/tools/source/create.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,iFAAiF;AACjF,6EAA6E;AAC7E,gFAAgF;AAChF,mBAAmB;AACnB,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;AAE5E,OAAO,EAAE,CAAC,EAAE,MAAM,KAA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C;IACH,MAAM,EAAE,kBAAkB;SACvB,QAAQ,EAAE;SACV,QAAQ,CACP,0EAA0E;QACxE,4EAA4E;QAC5E,wEAAwE;QACxE,uEAAuE;QACvE,sCAAsC,CACzC;CACJ,CAAA;AAOD;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAuB;IAEvB,OAAO,WAAW,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;AACzC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,WAAW,EACT,oEAAoE;YACpE,4DAA4D;YAC5D,kEAAkE;YAClE,wEAAwE;YACxE,kDAAkD;YAClD,yEAAyE;YACzE,sEAAsE;YACtE,yEAAyE;YACzE,wEAAwE;QAC1E,WAAW,EAAE,sBAAsB;KACpC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,mBAAmB,CACxB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC;YACxC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC;SAC5B,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -5,23 +5,111 @@
|
|
|
5
5
|
// explicit that archiving reserves the source name until restore, a trap the
|
|
6
6
|
// generic invoke surface left implicit.) Sources are fully context-nested on
|
|
7
7
|
// every op (single-resource ops keep contextId, unlike fee-rules). Each tool
|
|
8
|
-
// shares the fail-closed relay (shared.ts) and the RFC 9457 →
|
|
9
|
-
// (toToolError) with the generic surface, so curated and
|
|
10
|
-
// errors identically. No tool carries a tenant field;
|
|
11
|
-
// path param matcher validates against the relayed
|
|
12
|
-
|
|
8
|
+
// shares the fail-closed relay (shared-dispatch.ts) and the RFC 9457 →
|
|
9
|
+
// tool-error mapping (toToolError) with the generic surface, so curated and
|
|
10
|
+
// generic map matcher errors identically. No tool carries a tenant field;
|
|
11
|
+
// contextId is a routing path param matcher validates against the relayed
|
|
12
|
+
// token's tenant.
|
|
13
|
+
//
|
|
14
|
+
// The three id-only tools (get, archive, restore) differ only in their name,
|
|
15
|
+
// their method, their path suffix and their description, so they are declared
|
|
16
|
+
// as three rows and registered by the one shared loop; create, list and update
|
|
17
|
+
// carry request bodies or query builders and stay as files.
|
|
18
|
+
import { z } from 'zod';
|
|
19
|
+
import { registerCuratedTools } from '../curated-tool.js';
|
|
20
|
+
import { contextRoutingId } from '../input-fields.js';
|
|
13
21
|
import { registerSourceCreateTool } from './create.js';
|
|
14
|
-
import { registerSourceGetTool } from './get.js';
|
|
15
22
|
import { registerSourceListTool } from './list.js';
|
|
16
|
-
import {
|
|
23
|
+
import { contextSourcePath } from './shared.js';
|
|
17
24
|
import { registerSourceUpdateTool } from './update.js';
|
|
25
|
+
/**
|
|
26
|
+
* The source registration list, IN PUBLISHED ORDER: thin tools inline as data
|
|
27
|
+
* rows, the tools that still need their own file by their register function.
|
|
28
|
+
* This list is the order `tools/list` returns, so moving an entry moves what a
|
|
29
|
+
* client renders and what an agent prompt built from it reads first.
|
|
30
|
+
*
|
|
31
|
+
* Every description string is the hand-tuned LLM guidance a client sees
|
|
32
|
+
* verbatim; the published-surface golden is what proves an edit here dropped no
|
|
33
|
+
* character and moved no tool.
|
|
34
|
+
*
|
|
35
|
+
* `source_get`'s text is where an operator reads the duplicate-key
|
|
36
|
+
* declaration back.
|
|
37
|
+
*/
|
|
38
|
+
const SOURCE_TOOLS = [
|
|
39
|
+
registerSourceCreateTool,
|
|
40
|
+
registerSourceListTool,
|
|
41
|
+
{
|
|
42
|
+
name: 'source_get',
|
|
43
|
+
description: 'Fetch a single reconciliation source by id (UUID) within a context. ' +
|
|
44
|
+
'Provide both contextId and sourceId (path params; contextId is not a ' +
|
|
45
|
+
"tenant field). The source must belong to your token's tenant. Returns " +
|
|
46
|
+
'the source, or a structured RFC 9457 error (e.g. 404 if it does not ' +
|
|
47
|
+
'exist or is not yours). In the returned config, duplicate_key is the ' +
|
|
48
|
+
'ordered list of mapped fields that make two rows the same row — absent ' +
|
|
49
|
+
'means rows are deduplicated on external_id alone — and ' +
|
|
50
|
+
'duplicate_key_changed_at is the server-set RFC 3339 moment ' +
|
|
51
|
+
'duplicate-key detection last changed meaning on this source: either ' +
|
|
52
|
+
'that list changing, or the field map remapping the column a declared ' +
|
|
53
|
+
'field reads. Rows imported before it keep the key they were ' +
|
|
54
|
+
'deduplicated under, so a duplicate straddling that moment is not ' +
|
|
55
|
+
'detected. duplicate_policy is what happens to a repeat: ' +
|
|
56
|
+
'FLAG_AS_EXCEPTION (the default), KEEP_FIRST or REJECT.',
|
|
57
|
+
inputShape: {
|
|
58
|
+
contextId: contextRoutingId,
|
|
59
|
+
sourceId: z
|
|
60
|
+
.string()
|
|
61
|
+
.min(1)
|
|
62
|
+
.describe('The reconciliation source id (UUID) to fetch.'),
|
|
63
|
+
},
|
|
64
|
+
request: (args) => ({
|
|
65
|
+
method: 'GET',
|
|
66
|
+
path: contextSourcePath(String(args.contextId), String(args.sourceId)),
|
|
67
|
+
}),
|
|
68
|
+
},
|
|
69
|
+
registerSourceUpdateTool,
|
|
70
|
+
{
|
|
71
|
+
name: 'source_archive',
|
|
72
|
+
description: 'Archive (soft-delete) a reconciliation source by id (UUID) within a ' +
|
|
73
|
+
"context. Archiving never erases the source's imported transactions " +
|
|
74
|
+
'or field map — the source is simply excluded from listings, readiness ' +
|
|
75
|
+
'counts, clone reads, and the matching working set. The archived name ' +
|
|
76
|
+
'stays reserved until you restore it, so you cannot create a new source ' +
|
|
77
|
+
'reusing that name in the context. Provide contextId and sourceId (path ' +
|
|
78
|
+
'params; contextId is not a tenant field). Returns no content (204), or ' +
|
|
79
|
+
'a structured RFC 9457 error.',
|
|
80
|
+
inputShape: {
|
|
81
|
+
contextId: contextRoutingId,
|
|
82
|
+
sourceId: z
|
|
83
|
+
.string()
|
|
84
|
+
.min(1)
|
|
85
|
+
.describe('The reconciliation source id (UUID) to archive.'),
|
|
86
|
+
},
|
|
87
|
+
request: (args) => ({
|
|
88
|
+
method: 'POST',
|
|
89
|
+
path: `${contextSourcePath(String(args.contextId), String(args.sourceId))}/archive`,
|
|
90
|
+
}),
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'source_restore',
|
|
94
|
+
description: 'Restore an archived reconciliation source by id (UUID) back into the ' +
|
|
95
|
+
'live working set, so it counts toward readiness and feeds matching ' +
|
|
96
|
+
'again. Provide contextId and sourceId (path params; contextId is not a ' +
|
|
97
|
+
'tenant field). Returns no content (204), or a structured RFC 9457 error.',
|
|
98
|
+
inputShape: {
|
|
99
|
+
contextId: contextRoutingId,
|
|
100
|
+
sourceId: z
|
|
101
|
+
.string()
|
|
102
|
+
.min(1)
|
|
103
|
+
.describe('The archived reconciliation source id (UUID) to restore.'),
|
|
104
|
+
},
|
|
105
|
+
request: (args) => ({
|
|
106
|
+
method: 'POST',
|
|
107
|
+
path: `${contextSourcePath(String(args.contextId), String(args.sourceId))}/restore`,
|
|
108
|
+
}),
|
|
109
|
+
},
|
|
110
|
+
];
|
|
18
111
|
/** Register all curated source tools on the given server. */
|
|
19
112
|
export function registerSourceTools(server) {
|
|
20
|
-
|
|
21
|
-
registerSourceListTool(server);
|
|
22
|
-
registerSourceGetTool(server);
|
|
23
|
-
registerSourceUpdateTool(server);
|
|
24
|
-
registerSourceArchiveTool(server);
|
|
25
|
-
registerSourceRestoreTool(server);
|
|
113
|
+
registerCuratedTools(server, SOURCE_TOOLS);
|
|
26
114
|
}
|
|
27
115
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/source/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,gFAAgF;AAChF,gFAAgF;AAChF,iFAAiF;AACjF,6EAA6E;AAC7E,6EAA6E;AAC7E,6EAA6E;AAC7E,
|
|
1
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,CAAC,MAAiB;IACnD,oBAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;AAC5C,CAAC"}
|
|
@@ -11,7 +11,8 @@ import { nextCursor, pageLimit } from '../input-fields.js';
|
|
|
11
11
|
import { queryHandler } from '../query-handler.js';
|
|
12
12
|
import { pickQuery } from '../request-fields.js';
|
|
13
13
|
import { SOURCE_TYPES } from './create.js';
|
|
14
|
-
import {
|
|
14
|
+
import { dispatchToolRequest } from '../shared-dispatch.js';
|
|
15
|
+
import { contextSourcesPath } from './shared.js';
|
|
15
16
|
/** Zod raw shape for `source_list` input — contextId path + type filter + pagination. */
|
|
16
17
|
export const listSourcesInputShape = {
|
|
17
18
|
contextId: z
|
|
@@ -43,6 +44,6 @@ export function registerSourceListTool(server) {
|
|
|
43
44
|
'The response carries { items, nextCursor } — paginate by re-calling ' +
|
|
44
45
|
'with the returned nextCursor. No tenant field is accepted.',
|
|
45
46
|
inputSchema: listSourcesInputShape,
|
|
46
|
-
}, queryHandler(buildListQuery, (args) => contextSourcesPath(args.contextId),
|
|
47
|
+
}, queryHandler(buildListQuery, (args) => contextSourcesPath(args.contextId), dispatchToolRequest));
|
|
47
48
|
}
|
|
48
49
|
//# sourceMappingURL=list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/tools/source/list.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,6EAA6E;AAC7E,wEAAwE;AACxE,+EAA+E;AAC/E,iDAAiD;AAEjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,a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