@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
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
// fee-rules' hybrid path, EVERY source op is fully context-nested: create/list
|
|
5
5
|
// hang off /v1/contexts/{contextId}/sources and get/update/delete off
|
|
6
6
|
// /v1/contexts/{contextId}/sources/{sourceId} — single-resource ops KEEP the
|
|
7
|
-
// contextId. This module
|
|
8
|
-
// exactly once so the
|
|
9
|
-
//
|
|
10
|
-
//
|
|
7
|
+
// contextId. This module holds the two path helpers and nothing else, factored
|
|
8
|
+
// exactly once so the three table rows in index.ts and the three tools that
|
|
9
|
+
// keep their own file address the same URLs. The relay itself lives in
|
|
10
|
+
// shared-dispatch.ts, so curated and generic surfaces map matcher errors
|
|
11
|
+
// through the identical path (toToolError).
|
|
11
12
|
//
|
|
12
13
|
// Security: the bearer token is never read here directly — requireMatcherClient
|
|
13
14
|
// owns the request-scoped relay and fails closed when no usable credential was
|
|
14
15
|
// provided. The contextId path param is a routing identifier (matcher validates
|
|
15
16
|
// the context belongs to the relayed token's tenant); no tenant identifier is
|
|
16
17
|
// ever read or injected, and no source tool input carries one.
|
|
17
|
-
import { dispatchToolRequest, } from '../shared-dispatch.js';
|
|
18
18
|
/** Build the context-scoped sources collection path (create/list). */
|
|
19
19
|
export function contextSourcesPath(contextId) {
|
|
20
20
|
return `/v1/contexts/${encodeURIComponent(contextId)}/sources`;
|
|
@@ -23,15 +23,4 @@ export function contextSourcesPath(contextId) {
|
|
|
23
23
|
export function contextSourcePath(contextId, sourceId) {
|
|
24
24
|
return `${contextSourcesPath(contextId)}/${encodeURIComponent(sourceId)}`;
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Run one assembled request through the relay: fail-closed auth, dispatch, and
|
|
28
|
-
* RFC 9457 → tool-error mapping — identical to the generic invoke's dispatch so
|
|
29
|
-
* both surfaces produce the same structured error shape.
|
|
30
|
-
*
|
|
31
|
-
* `clientFor` is injectable for tests; production callers pass nothing and get
|
|
32
|
-
* the request-scoped, fail-closed `requireMatcherClient`.
|
|
33
|
-
*/
|
|
34
|
-
export async function dispatchSource(request, extra, clientFor) {
|
|
35
|
-
return dispatchToolRequest(request, extra, clientFor);
|
|
36
|
-
}
|
|
37
26
|
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/tools/source/shared.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,uEAAuE;AACvE,+EAA+E;AAC/E,sEAAsE;AACtE,6EAA6E;AAC7E,
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/tools/source/shared.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,uEAAuE;AACvE,+EAA+E;AAC/E,sEAAsE;AACtE,6EAA6E;AAC7E,+EAA+E;AAC/E,4EAA4E;AAC5E,uEAAuE;AACvE,yEAAyE;AACzE,4CAA4C;AAC5C,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,gFAAgF;AAChF,8EAA8E;AAC9E,+DAA+D;AAE/D,sEAAsE;AACtE,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAClD,OAAO,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,UAAU,CAAA;AAChE,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,SAAiB,EAAE,QAAgB;IACnE,OAAO,GAAG,kBAAkB,CAAC,SAAS,CAAC,IAAI,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAA;AAC3E,CAAC"}
|
|
@@ -9,7 +9,8 @@ import { z } from 'zod';
|
|
|
9
9
|
import { contextRoutingId } from '../input-fields.js';
|
|
10
10
|
import { bodyWithout } from '../request-fields.js';
|
|
11
11
|
import { SOURCE_SIDES, SOURCE_TYPES, sourceConfigSchema } from './create.js';
|
|
12
|
-
import {
|
|
12
|
+
import { dispatchToolRequest } from '../shared-dispatch.js';
|
|
13
|
+
import { contextSourcePath } from './shared.js';
|
|
13
14
|
/** Zod raw shape for `source_update` input — path ids + optional body fields. */
|
|
14
15
|
export const updateSourceInputShape = {
|
|
15
16
|
contextId: contextRoutingId,
|
|
@@ -63,7 +64,7 @@ export function registerSourceUpdateTool(server) {
|
|
|
63
64
|
'RFC 9457 error.',
|
|
64
65
|
inputSchema: updateSourceInputShape,
|
|
65
66
|
}, async (args, extra) => {
|
|
66
|
-
return
|
|
67
|
+
return dispatchToolRequest({
|
|
67
68
|
method: 'PATCH',
|
|
68
69
|
path: contextSourcePath(args.contextId, args.sourceId),
|
|
69
70
|
body: buildUpdateBody(args),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/tools/source/update.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/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C;SAClB,QAAQ,EAAE;SACV,QAAQ,CACP,iEAAiE,CAClE;IACH,IAAI,EAAE,CAAC;SACJ,IAAI,CAAC,YAAY,CAAC;SAClB,QAAQ,EAAE;SACV,QAAQ,CAAC,+CAA+C,CAAC;IAC5D,MAAM,EAAE,kBAAkB;SACvB,QAAQ,EAAE;SACV,QAAQ,CACP,0EAA0E;QACxE,0EAA0E;QAC1E,4EAA4E;QAC5E,uEAAuE;QACvE,2EAA2E;QAC3E,2EAA2E;QAC3E,+DAA+D,CAClE;CACJ,CAAA;AAOD;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAuB;IAEvB,OAAO,WAAW,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAA;AACrD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,WAAW,EACT,0EAA0E;YAC1E,yEAAyE;YACzE,kEAAkE;YAClE,sEAAsE;YACtE,wEAAwE;YACxE,iBAAiB;QACnB,WAAW,EAAE,sBAAsB;KACpC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,mBAAmB,CACxB;YACE,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC;YACtD,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC;SAC5B,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
//
|
|
15
15
|
// There is no input at all: the tenant comes from the relayed token's claims, so
|
|
16
16
|
// there is nothing for a caller to pass — and nothing that could be spoofed.
|
|
17
|
-
import {
|
|
18
|
-
import { isMatcherApiError, toToolError } from '../tool-error.js';
|
|
17
|
+
import { dispatchToolRequest } from '../shared-dispatch.js';
|
|
19
18
|
/** The billing read path (tenant-scoped; tenant resolved from the token, not the path). */
|
|
20
19
|
const WORKSPACE_BILLING_PATH = '/v1/workspace/billing';
|
|
21
20
|
/**
|
|
@@ -51,7 +50,10 @@ export function usedPercent(body) {
|
|
|
51
50
|
}
|
|
52
51
|
/**
|
|
53
52
|
* Register `workspace_usage`. Reads the caller's own commercial state through the
|
|
54
|
-
* fail-closed relay
|
|
53
|
+
* SHARED fail-closed relay — the additive percent rides its success-body
|
|
54
|
+
* transform, so the credential refusal and the RFC 9457 mapping are the shared
|
|
55
|
+
* ones rather than a local copy (that copy was BUG-06) — and returns the body
|
|
56
|
+
* verbatim plus `usedPercent`. A matcher error
|
|
55
57
|
* (404 for a tenant with no self-serve workspace, 403 MTCH-0021 for a
|
|
56
58
|
* billing-suspended one) surfaces via the shared toToolError, so the model can
|
|
57
59
|
* branch on `status`/`code` exactly as it does on every other tool.
|
|
@@ -84,42 +86,12 @@ export function registerWorkspaceUsageTool(server) {
|
|
|
84
86
|
'The second is a receivable, not a negative balance: a new billing ' +
|
|
85
87
|
'period does not clear it, so never tell a customer a rollover settled ' +
|
|
86
88
|
'it, and never report it as a credit.',
|
|
87
|
-
}, async (extra) => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (err instanceof UnauthenticatedError) {
|
|
95
|
-
return { isError: true, content: [{ type: 'text', text: err.message }] };
|
|
96
|
-
}
|
|
97
|
-
throw err;
|
|
98
|
-
}
|
|
99
|
-
try {
|
|
100
|
-
const body = await client.request({
|
|
101
|
-
method: 'GET',
|
|
102
|
-
path: WORKSPACE_BILLING_PATH,
|
|
103
|
-
});
|
|
104
|
-
// Spread, don't rebuild: the backend's fields are relayed unchanged and
|
|
105
|
-
// the derived percent is purely additive.
|
|
106
|
-
return {
|
|
107
|
-
content: [
|
|
108
|
-
{
|
|
109
|
-
type: 'text',
|
|
110
|
-
text: JSON.stringify({ ...body, usedPercent: usedPercent(body) }),
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
catch (err) {
|
|
116
|
-
// RFC 9457 problem → the SHARED structured tool error. A non-matcher
|
|
117
|
-
// error is a bug, not a matcher failure, and is re-thrown.
|
|
118
|
-
if (isMatcherApiError(err)) {
|
|
119
|
-
return toToolError(err);
|
|
120
|
-
}
|
|
121
|
-
throw err;
|
|
122
|
-
}
|
|
123
|
-
});
|
|
89
|
+
}, async (extra) => dispatchToolRequest({ method: 'GET', path: WORKSPACE_BILLING_PATH }, extra, undefined,
|
|
90
|
+
// Spread, don't rebuild: the backend's fields are relayed unchanged and
|
|
91
|
+
// the derived percent is purely additive.
|
|
92
|
+
(billing) => ({
|
|
93
|
+
...billing,
|
|
94
|
+
usedPercent: usedPercent(billing),
|
|
95
|
+
})));
|
|
124
96
|
}
|
|
125
97
|
//# sourceMappingURL=usage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/tools/workspace/usage.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4DAA4D;AAC5D,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,8EAA8E;AAC9E,2EAA2E;AAC3E,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,iFAAiF;AACjF,6EAA6E;AAC7E,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,6EAA6E;AAI7E,OAAO,
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/tools/workspace/usage.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4DAA4D;AAC5D,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,8EAA8E;AAC9E,2EAA2E;AAC3E,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,iFAAiF;AACjF,6EAA6E;AAC7E,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,6EAA6E;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B,CACjB,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,sBAAsB,EAAE,EAC/C,KAAK,EACL,SAAS;IACT,wEAAwE;IACxE,0CAA0C;IAC1C,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACZ,GAAI,OAA4C;QAChD,WAAW,EAAE,WAAW,CAAC,OAA2C,CAAC;KACtE,CAAC,CACH,CACJ,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lerianstudio/matcher-mcp",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.69",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Model Context Protocol server for the Matcher reconciliation engine",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"vendor-spec": "node scripts/vendor-spec.mjs",
|
|
38
38
|
"predev": "node scripts/vendor-spec.mjs",
|
|
39
39
|
"dev": "node --watch --experimental-strip-types src/server.ts",
|
|
40
|
-
"prebuild": "node scripts/vendor-spec.mjs",
|
|
41
|
-
"build": "tsc",
|
|
40
|
+
"prebuild": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && node scripts/vendor-spec.mjs",
|
|
41
|
+
"build": "tsc -p tsconfig.build.json && node scripts/check-dist-clean.mjs",
|
|
42
42
|
"postbuild": "node scripts/vendor-spec.mjs",
|
|
43
43
|
"typecheck": "tsc --noEmit",
|
|
44
44
|
"pretest": "node scripts/vendor-spec.mjs",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'node:events';
|
|
2
|
-
/** Allow unrelated boundary tests to pass the tenant quota gate. */
|
|
3
|
-
export const allowAll = { check: () => ({ allowed: true, retryAfterSeconds: 0 }) };
|
|
4
|
-
/** Successful auth probe with no network or credential. */
|
|
5
|
-
export const okProbeClient = {
|
|
6
|
-
async request() {
|
|
7
|
-
return { items: [], hasMore: false };
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
export function mockRequest(body, headers) {
|
|
11
|
-
return {
|
|
12
|
-
headers,
|
|
13
|
-
async *[Symbol.asyncIterator]() {
|
|
14
|
-
if (body.length > 0)
|
|
15
|
-
yield typeof body === 'string' ? Buffer.from(body, 'utf8') : body;
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
/** Captures JSON and SSE responses; closing remains explicitly test-controlled. */
|
|
20
|
-
export class MockRes extends EventEmitter {
|
|
21
|
-
status = 0;
|
|
22
|
-
headers = {};
|
|
23
|
-
writes = [];
|
|
24
|
-
ended = false;
|
|
25
|
-
headersSent = false;
|
|
26
|
-
writeHead(status, headers) {
|
|
27
|
-
this.status = status;
|
|
28
|
-
if (headers !== undefined)
|
|
29
|
-
this.headers = headers;
|
|
30
|
-
this.headersSent = true;
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
write(chunk) {
|
|
34
|
-
this.writes.push(chunk);
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
end(chunk) {
|
|
38
|
-
if (chunk !== undefined)
|
|
39
|
-
this.writes.push(chunk);
|
|
40
|
-
this.ended = true;
|
|
41
|
-
return this;
|
|
42
|
-
}
|
|
43
|
-
get body() {
|
|
44
|
-
return this.writes.join('');
|
|
45
|
-
}
|
|
46
|
-
json() {
|
|
47
|
-
return JSON.parse(this.body);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=test_helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test_helpers.js","sourceRoot":"","sources":["../../src/copilot/test_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAK1C,oEAAoE;AACpE,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,I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AChD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC7B,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAA4B,CAAA;IACzD,CAAC;CACF"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// `context_archive` — curated POST /v1/contexts/{contextId}/archive.
|
|
2
|
-
//
|
|
3
|
-
// Soft-deletes a reconciliation context: it flips to ARCHIVED in place and its
|
|
4
|
-
// reconciled financial history is never erased. Archived contexts drop out of
|
|
5
|
-
// the default listing but the name stays reserved until restored (the F12 trap
|
|
6
|
-
// made explicit — you cannot create a new context reusing an archived name).
|
|
7
|
-
// contextId is the only input (a UUID path param); no tenant field is accepted
|
|
8
|
-
// (contextId is a routing param, not a tenant identifier).
|
|
9
|
-
import { z } from 'zod';
|
|
10
|
-
import { contextPath, dispatchContext } from './shared.js';
|
|
11
|
-
/** Zod raw shape for `context_archive` input — just the context id. */
|
|
12
|
-
export const archiveContextInputShape = {
|
|
13
|
-
contextId: z
|
|
14
|
-
.string()
|
|
15
|
-
.min(1)
|
|
16
|
-
.describe('The reconciliation context id (UUID) to archive.'),
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Register `context_archive`. Substitutes the id into the path and dispatches a
|
|
20
|
-
* POST through the shared fail-closed relay; a matcher error surfaces via the
|
|
21
|
-
* shared toToolError.
|
|
22
|
-
*/
|
|
23
|
-
export function registerContextArchiveTool(server) {
|
|
24
|
-
server.registerTool('context_archive', {
|
|
25
|
-
description: 'Archive (soft-delete) a reconciliation context by id (UUID). Archiving ' +
|
|
26
|
-
'flips the context to ARCHIVED in place — it never erases the reconciled ' +
|
|
27
|
-
'financial history (an archived context with children is valid) — and ' +
|
|
28
|
-
'excludes it from the default listing. The archived name stays reserved ' +
|
|
29
|
-
'until you restore it, so you cannot create a new context reusing that ' +
|
|
30
|
-
'name. Provide only contextId; no tenant field is accepted. Returns no ' +
|
|
31
|
-
'content (204), or a structured RFC 9457 error.',
|
|
32
|
-
inputSchema: archiveContextInputShape,
|
|
33
|
-
}, async (args, extra) => {
|
|
34
|
-
return dispatchContext({ method: 'POST', path: `${contextPath(args.contextId)}/archive` }, extra);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=archive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"archive.js","sourceRoot":"","sources":["../../../src/tools/context/archive.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAC/E,2DAA2D;AAE3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE1D,uEAAuE;AACvE,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,kDAAkD,CAAC;CAChE,CAAA;AAOD;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAiB;IAC1D,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,WAAW,EACT,yEAAyE;YACzE,0EAA0E;YAC1E,uEAAuE;YACvE,yEAAyE;YACzE,wEAAwE;YACxE,wEAAwE;YACxE,gDAAgD;QAClD,WAAW,EAAE,wBAAwB;KACtC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,eAAe,CACpB,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,EAClE,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// `context_get` — curated GET /v1/contexts/{contextId}.
|
|
2
|
-
//
|
|
3
|
-
// Reads one reconciliation context by id. contextId is the only input (a UUID
|
|
4
|
-
// path param). The context must belong to the relayed token's tenant — matcher
|
|
5
|
-
// enforces that; no tenant field is accepted (contextId is a routing param, not
|
|
6
|
-
// a tenant identifier).
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
import { contextPath, dispatchContext } from './shared.js';
|
|
9
|
-
/** Zod raw shape for `context_get` input — just the context id. */
|
|
10
|
-
export const getContextInputShape = {
|
|
11
|
-
contextId: z
|
|
12
|
-
.string()
|
|
13
|
-
.min(1)
|
|
14
|
-
.describe('The reconciliation context id (UUID) to fetch.'),
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Register `context_get`. Substitutes the id into the path and dispatches a GET
|
|
18
|
-
* through the shared fail-closed relay; a matcher error (e.g. 404) surfaces via
|
|
19
|
-
* the shared toToolError.
|
|
20
|
-
*/
|
|
21
|
-
export function registerContextGetTool(server) {
|
|
22
|
-
server.registerTool('context_get', {
|
|
23
|
-
description: 'Fetch a single reconciliation context by id (UUID). The context must ' +
|
|
24
|
-
"belong to your token's tenant. Returns the context, or a structured " +
|
|
25
|
-
'RFC 9457 error (e.g. 404 if it does not exist or is not yours).',
|
|
26
|
-
inputSchema: getContextInputShape,
|
|
27
|
-
}, async (args, extra) => {
|
|
28
|
-
return dispatchContext({ method: 'GET', path: contextPath(args.contextId) }, extra);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=get.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/tools/context/get.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,gFAAgF;AAChF,wBAAwB;AAExB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE1D,mEAAmE;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,gDAAgD,CAAC;CAC9D,CAAA;AAKD;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAiB;IACtD,MAAM,CAAC,YAAY,CACjB,aAAa,EACb;QACE,WAAW,EACT,uEAAuE;YACvE,sEAAsE;YACtE,iEAAiE;QACnE,WAAW,EAAE,oBAAoB;KAClC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,eAAe,CACpB,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EACpD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
// `next_step` — curated GET /v1/contexts/{contextId}/setup-progress projected
|
|
2
|
-
// to the ONE thing an operator-driving LLM needs to advance setup:
|
|
3
|
-
// `{ ready, next, thenCall }`.
|
|
4
|
-
//
|
|
5
|
-
// `context_setup_progress` already relays the FULL setup-progress blob (counts,
|
|
6
|
-
// last-run, readiness, next), so this tool's value is NOT "make `next` visible"
|
|
7
|
-
// — it is the focused shape plus the auto-conduction (`thenCall`) that tells the
|
|
8
|
-
// caller to loop. The auto-conduction is the only agent-specific knowledge here
|
|
9
|
-
// and it is STATIC (no per-context values are ever invented): the deterministic
|
|
10
|
-
// `next` action itself comes verbatim from the backend readiness gate (Phase 1).
|
|
11
|
-
//
|
|
12
|
-
// Because it projects, it does NOT use the shared dispatchContext stringify-
|
|
13
|
-
// everything path; it resolves the client the same fail-closed way
|
|
14
|
-
// (requireMatcherClient) and maps a matcher error through the SAME toToolError as
|
|
15
|
-
// its siblings. contextId is the only input (a UUID path param); no tenant field
|
|
16
|
-
// is accepted (matcher scopes to the relayed token's tenant).
|
|
17
|
-
import { z } from 'zod';
|
|
18
|
-
import { requireMatcherClient, UnauthenticatedError, } from '../../auth/request-token.js';
|
|
19
|
-
import { isMatcherApiError, toToolError } from '../tool-error.js';
|
|
20
|
-
import { contextSetupProgressPath } from './setup-progress.js';
|
|
21
|
-
/**
|
|
22
|
-
* Static auto-conduction string returned alongside a non-null `next`. It never
|
|
23
|
-
* carries per-context values — just the loop instruction. The concrete action to
|
|
24
|
-
* take is the backend `next`, not this string.
|
|
25
|
-
*/
|
|
26
|
-
export const NEXT_STEP_CONDUCTION = 'After applying this action, call next_step again with the same contextId to ' +
|
|
27
|
-
'get the following step. Repeat until ready is true.';
|
|
28
|
-
/** Zod raw shape for `next_step` input — just the context id. */
|
|
29
|
-
export const nextStepInputShape = {
|
|
30
|
-
contextId: z
|
|
31
|
-
.string()
|
|
32
|
-
.min(1)
|
|
33
|
-
.describe('The reconciliation context id (UUID) to get the next setup step for.'),
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Register `next_step`. Fetches setup-progress through the fail-closed relay and
|
|
37
|
-
* projects it to `{ ready, next, thenCall }`. A matcher error (e.g. 404) surfaces
|
|
38
|
-
* via the shared toToolError; a missing credential fails closed identically to
|
|
39
|
-
* the sibling context tools.
|
|
40
|
-
*/
|
|
41
|
-
export function registerContextNextStepTool(server) {
|
|
42
|
-
server.registerTool('next_step', {
|
|
43
|
-
description: 'Get the deterministic next setup action for a context, projected from ' +
|
|
44
|
-
'its readiness gate. Provide contextId (UUID path param, not a tenant ' +
|
|
45
|
-
'field). Returns { ready, next, thenCall }: ready is true only when the ' +
|
|
46
|
-
'context satisfies every activation requirement; next is the exact ' +
|
|
47
|
-
'action to take (requirementId — one of the FIVE public ' +
|
|
48
|
-
'context.activation.requirement.* identifiers: left-source, ' +
|
|
49
|
-
'right-source, source-mapping, match-rule, fee-rule; the sixth, ' +
|
|
50
|
-
'context.activation.requirement.unknown, never reaches next — the ' +
|
|
51
|
-
"backend returns a null next for an unmapped slug — it appears only in " +
|
|
52
|
-
'context_setup_progress readiness.missing[]; operationId, method, ' +
|
|
53
|
-
'path, requiredFields — field NAMES only, never values; you supply the ' +
|
|
54
|
-
'values), or null when ready; thenCall instructs you to apply next and ' +
|
|
55
|
-
'call next_step again with the same contextId, repeating until ready is ' +
|
|
56
|
-
'true (null when ready). Prefer this over context_setup_progress when ' +
|
|
57
|
-
'you just need the next action to advance setup. Returns a structured ' +
|
|
58
|
-
'RFC 9457 error on failure (e.g. 404 if the context does not exist or ' +
|
|
59
|
-
'is not yours).',
|
|
60
|
-
inputSchema: nextStepInputShape,
|
|
61
|
-
}, async (args, extra) => {
|
|
62
|
-
let client;
|
|
63
|
-
try {
|
|
64
|
-
// Fail-closed on a missing / empty / non-Bearer credential.
|
|
65
|
-
client = requireMatcherClient(extra);
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
if (err instanceof UnauthenticatedError) {
|
|
69
|
-
return { isError: true, content: [{ type: 'text', text: err.message }] };
|
|
70
|
-
}
|
|
71
|
-
throw err;
|
|
72
|
-
}
|
|
73
|
-
try {
|
|
74
|
-
const body = await client.request({
|
|
75
|
-
method: 'GET',
|
|
76
|
-
path: contextSetupProgressPath(args.contextId),
|
|
77
|
-
});
|
|
78
|
-
// Nil-safe projection: a malformed body (missing readiness) defaults to
|
|
79
|
-
// not-ready rather than throwing. `next` is relayed verbatim.
|
|
80
|
-
const ready = body?.readiness?.ready ?? false;
|
|
81
|
-
const next = body?.next ?? null;
|
|
82
|
-
const thenCall = next ? NEXT_STEP_CONDUCTION : null;
|
|
83
|
-
return {
|
|
84
|
-
content: [
|
|
85
|
-
{ type: 'text', text: JSON.stringify({ ready, next, thenCall }) },
|
|
86
|
-
],
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
catch (err) {
|
|
90
|
-
// RFC 9457 problem → the SHARED structured tool error. A non-matcher
|
|
91
|
-
// error is a bug, not a matcher failure, and is re-thrown.
|
|
92
|
-
if (isMatcherApiError(err)) {
|
|
93
|
-
return toToolError(err);
|
|
94
|
-
}
|
|
95
|
-
throw err;
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=next-step.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"next-step.js","sourceRoot":"","sources":["../../../src/tools/context/next-step.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,mEAAmE;AACnE,+BAA+B;AAC/B,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,iFAAiF;AACjF,gFAAgF;AAChF,gFAAgF;AAChF,iFAAiF;AACjF,EAAE;AACF,6EAA6E;AAC7E,mEAAmE;AACnE,kFAAkF;AAClF,iFAAiF;AACjF,8DAA8D;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAE9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAC/B,8EAA8E;IAC9E,qDAAqD,CAAA;AAEvD,iEAAiE;AACjE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,sEAAsE,CAAC;CACpF,CAAA;AAWD;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAAiB;IAC3D,MAAM,CAAC,YAAY,CACjB,WAAW,EACX;QACE,WAAW,EACT,wEAAwE;YACxE,uEAAuE;YACvE,yE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Q,EAAE,CAAC,EAAE;iBAClE;aACF,CAAA;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,qEAAqE;YACrE,2DAA2D;YAC3D,IAAI,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC3B,OAAO,WAAW,CAAC,GAAG,CAAC,CAAA;YACzB,CAAC;YACD,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// `context_restore` — curated POST /v1/contexts/{contextId}/restore.
|
|
2
|
-
//
|
|
3
|
-
// Reverses an archive: it returns the context to DRAFT so it can be re-validated
|
|
4
|
-
// and re-activated. Restoring never auto-resumes matching, and restoring a
|
|
5
|
-
// context that is not archived is rejected with a 409 invalid-state. contextId
|
|
6
|
-
// is the only input (a UUID path param); no tenant field is accepted (contextId
|
|
7
|
-
// is a routing param, not a tenant identifier).
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
import { contextPath, dispatchContext } from './shared.js';
|
|
10
|
-
/** Zod raw shape for `context_restore` input — just the context id. */
|
|
11
|
-
export const restoreContextInputShape = {
|
|
12
|
-
contextId: z
|
|
13
|
-
.string()
|
|
14
|
-
.min(1)
|
|
15
|
-
.describe('The archived reconciliation context id (UUID) to restore.'),
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Register `context_restore`. Substitutes the id into the path and dispatches a
|
|
19
|
-
* POST through the shared fail-closed relay; a matcher error surfaces via the
|
|
20
|
-
* shared toToolError.
|
|
21
|
-
*/
|
|
22
|
-
export function registerContextRestoreTool(server) {
|
|
23
|
-
server.registerTool('context_restore', {
|
|
24
|
-
description: 'Restore an archived reconciliation context by id (UUID) back to DRAFT ' +
|
|
25
|
-
'so it can be re-validated and re-activated. Restoring never auto-resumes ' +
|
|
26
|
-
'matching. Restoring a context that is not archived returns a 409 ' +
|
|
27
|
-
'invalid-state. Provide only contextId; no tenant field is accepted. ' +
|
|
28
|
-
'Returns no content (204), or a structured RFC 9457 error.',
|
|
29
|
-
inputSchema: restoreContextInputShape,
|
|
30
|
-
}, async (args, extra) => {
|
|
31
|
-
return dispatchContext({ method: 'POST', path: `${contextPath(args.contextId)}/restore` }, extra);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=restore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"restore.js","sourceRoot":"","sources":["../../../src/tools/context/restore.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,iFAAiF;AACjF,2EAA2E;AAC3E,+EAA+E;AAC/E,gFAAgF;AAChF,gDAAgD;AAEhD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE1D,uEAAuE;AACvE,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,2DAA2D,CAAC;CACzE,CAAA;AAOD;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAiB;IAC1D,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,WAAW,EACT,wEAAwE;YACxE,2EAA2E;YAC3E,mEAAmE;YACnE,sEAAsE;YACtE,2DAA2D;QAC7D,WAAW,EAAE,wBAAwB;KACtC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,eAAe,CACpB,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,EAClE,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// `dashboard_aggregates` — curated GET /v1/reports/contexts/{contextId}/dashboard.
|
|
2
|
-
//
|
|
3
|
-
// The combined dashboard read: volume, match-rate and SLA aggregates, plus the
|
|
4
|
-
// unreconciled exposure split per currency, in one payload (spec operationId
|
|
5
|
-
// getDashboardAggregates). Shares the family input
|
|
6
|
-
// shape (contextId path + optional date_from/date_to/source_id query) and the
|
|
7
|
-
// fail-closed relay. The report is implicitly tenant-scoped by the relayed
|
|
8
|
-
// token; contextId is a routing path param and source_id a data filter — neither
|
|
9
|
-
// is a tenant field, and no tenant field is accepted.
|
|
10
|
-
import { queryHandler } from '../query-handler.js';
|
|
11
|
-
import { buildDashboardQuery, contextDashboardPath, dashboardQueryInputShape, dispatchDashboard, } from './shared.js';
|
|
12
|
-
/** Zod raw shape for `dashboard_aggregates` input — the shared dashboard shape. */
|
|
13
|
-
export const dashboardAggregatesInputShape = dashboardQueryInputShape;
|
|
14
|
-
/**
|
|
15
|
-
* Register `dashboard_aggregates`. Dispatches a GET to the context's dashboard
|
|
16
|
-
* base path with the optional date/source query and returns matcher's combined
|
|
17
|
-
* aggregates verbatim; a matcher error surfaces via the shared toToolError.
|
|
18
|
-
*/
|
|
19
|
-
export function registerDashboardAggregatesTool(server) {
|
|
20
|
-
server.registerTool('dashboard_aggregates', {
|
|
21
|
-
description: 'Get the combined dashboard aggregates (volume, match rate, SLA, and ' +
|
|
22
|
-
'unmatchedByCurrency: the unreconciled exposure split into one entry per ' +
|
|
23
|
-
'currency, each with amount and transactionCount, whose amounts sum to ' +
|
|
24
|
-
'volume.unmatchedAmount and whose counts sum to volume.unmatchedCount; ' +
|
|
25
|
-
'empty when no transaction in the window is UNMATCHED or ' +
|
|
26
|
-
'PENDING_REVIEW, and the only place the payload ' +
|
|
27
|
-
'names a currency, since volume.unmatchedAmount carries none) ' +
|
|
28
|
-
'for a reconciliation context. Pass contextId (UUID path param — not a ' +
|
|
29
|
-
'tenant field), and optionally date_from/date_to (YYYY-MM-DD; matcher ' +
|
|
30
|
-
'defaults to the last ~30 days and SILENTLY EXCLUDES older data — for ' +
|
|
31
|
-
'a full picture pass an explicit date_from/date_to, max 90-day span) ' +
|
|
32
|
-
'and/or source_id (UUID data filter). The resolved window is echoed ' +
|
|
33
|
-
'back in volume.periodStart/volume.periodEnd — check those before ' +
|
|
34
|
-
'reporting a number as final. No tenant field is accepted.',
|
|
35
|
-
inputSchema: dashboardAggregatesInputShape,
|
|
36
|
-
}, queryHandler(buildDashboardQuery, (args) => contextDashboardPath(args.contextId), dispatchDashboard));
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=aggregates.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregates.js","sourceRoot":"","sources":["../../../src/tools/dashboard/aggregates.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,mDAAmD;AACnD,8EAA8E;AAC9E,2EAA2E;AAC3E,iFAAiF;AACjF,sDAAsD;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAEpB,mFAAmF;AACnF,MAAM,CAAC,MAAM,6BAA6B,GAAG,wBAAwB,CAAA;AAErE;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAAC,MAAiB;IAC/D,MAAM,CAAC,YAAY,CACjB,sBAAsB,EACtB;QACE,WAAW,EACT,sEAAsE;YACtE,0EAA0E;YAC1E,wEAAwE;YACxE,wEAAwE;YACxE,0DAA0D;YAC1D,iDAAiD;YACjD,+DAA+D;YAC/D,wEAAwE;YACxE,uEAAuE;YACvE,uEAAuE;YACvE,sEAAsE;YACtE,qEAAqE;YACrE,mEAAmE;YACnE,2DAA2D;QAC7D,WAAW,EAAE,6BAA6B;KAC3C,EACD,YAAY,CACV,mBAAmB,EACnB,CAAC,IAAI,EAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,EAC9C,iBAAiB,CAClB,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// `dashboard_cash_impact` — curated GET
|
|
2
|
-
// /v1/reports/contexts/{contextId}/dashboard/cash-impact.
|
|
3
|
-
//
|
|
4
|
-
// Unreconciled financial exposure with currency and age breakdowns (spec
|
|
5
|
-
// operationId getCashImpactSummary). Shares the family input shape (contextId
|
|
6
|
-
// path + optional date_from/date_to/source_id query) and the fail-closed relay.
|
|
7
|
-
// contextId is a routing path param and source_id a data filter — neither is a
|
|
8
|
-
// tenant field, and no tenant field is accepted.
|
|
9
|
-
import { queryHandler } from '../query-handler.js';
|
|
10
|
-
import { buildDashboardQuery, contextDashboardSlicePath, dashboardQueryInputShape, dispatchDashboard, } from './shared.js';
|
|
11
|
-
/** Zod raw shape for `dashboard_cash_impact` input — the shared dashboard shape. */
|
|
12
|
-
export const dashboardCashImpactInputShape = dashboardQueryInputShape;
|
|
13
|
-
/**
|
|
14
|
-
* Register `dashboard_cash_impact`. Dispatches a GET to the context's
|
|
15
|
-
* /dashboard/cash-impact slice with the optional date/source query and returns
|
|
16
|
-
* matcher's exposure summary verbatim; a matcher error surfaces via the shared
|
|
17
|
-
* toToolError.
|
|
18
|
-
*/
|
|
19
|
-
export function registerDashboardCashImpactTool(server) {
|
|
20
|
-
server.registerTool('dashboard_cash_impact', {
|
|
21
|
-
description: 'Get the cash-impact summary (unreconciled financial exposure, with ' +
|
|
22
|
-
'currency and age breakdowns) for a reconciliation context. Pass ' +
|
|
23
|
-
'contextId (UUID path param — not a tenant field), and optionally ' +
|
|
24
|
-
'date_from/date_to (YYYY-MM-DD; matcher defaults to the last ~30 days ' +
|
|
25
|
-
'and SILENTLY EXCLUDES older exposure — for a full picture pass an ' +
|
|
26
|
-
'explicit date_from/date_to, max 90-day span) and/or source_id (UUID ' +
|
|
27
|
-
'data filter). No tenant field is accepted.',
|
|
28
|
-
inputSchema: dashboardCashImpactInputShape,
|
|
29
|
-
}, queryHandler(buildDashboardQuery, (args) => contextDashboardSlicePath(args.contextId, 'cash-impact'), dispatchDashboard));
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=cash-impact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cash-impact.js","sourceRoot":"","sources":["../../../src/tools/dashboard/cash-impact.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,0DAA0D;AAC1D,EAAE;AACF,yEAAyE;AACzE,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,iDAAiD;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAEpB,oFAAoF;AACpF,MAAM,CAAC,MAAM,6BAA6B,GAAG,wBAAwB,CAAA;AAErE;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAAC,MAAiB;IAC/D,MAAM,CAAC,YAAY,CACjB,uBAAuB,EACvB;QACE,WAAW,EACT,qEAAqE;YACrE,kEAAkE;YAClE,mEAAmE;YACnE,uEAAuE;YACvE,oEAAoE;YACpE,sEAAsE;YACtE,4CAA4C;QAC9C,WAAW,EAAE,6BAA6B;KAC3C,EACD,YAAY,CACV,mBAAmB,EACnB,CAAC,IAAI,EAAE,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,EAClE,iBAAiB,CAClB,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// `dashboard_match_rate` — curated GET
|
|
2
|
-
// /v1/reports/contexts/{contextId}/dashboard/match-rate.
|
|
3
|
-
//
|
|
4
|
-
// Match-rate percentage and trend data over the window (spec operationId
|
|
5
|
-
// getMatchRateStats). Shares the family input shape (contextId path + optional
|
|
6
|
-
// date_from/date_to/source_id query) and the fail-closed relay. contextId is a
|
|
7
|
-
// routing path param and source_id a data filter — neither is a tenant field,
|
|
8
|
-
// and no tenant field is accepted.
|
|
9
|
-
import { queryHandler } from '../query-handler.js';
|
|
10
|
-
import { buildDashboardQuery, contextDashboardSlicePath, dashboardQueryInputShape, dispatchDashboard, } from './shared.js';
|
|
11
|
-
/** Zod raw shape for `dashboard_match_rate` input — the shared dashboard shape. */
|
|
12
|
-
export const dashboardMatchRateInputShape = dashboardQueryInputShape;
|
|
13
|
-
/**
|
|
14
|
-
* Register `dashboard_match_rate`. Dispatches a GET to the context's
|
|
15
|
-
* /dashboard/match-rate slice with the optional date/source query and returns
|
|
16
|
-
* matcher's match-rate stats verbatim; a matcher error surfaces via the shared
|
|
17
|
-
* toToolError.
|
|
18
|
-
*/
|
|
19
|
-
export function registerDashboardMatchRateTool(server) {
|
|
20
|
-
server.registerTool('dashboard_match_rate', {
|
|
21
|
-
description: 'Get the match-rate statistics (percentage plus trend) for a ' +
|
|
22
|
-
'reconciliation context. Pass contextId (UUID path param — not a tenant ' +
|
|
23
|
-
'field), and optionally date_from/date_to (YYYY-MM-DD; matcher defaults ' +
|
|
24
|
-
'to the last ~30 days and SILENTLY EXCLUDES older transactions — a ' +
|
|
25
|
-
'windowed match rate is NOT the overall result; for a full picture pass ' +
|
|
26
|
-
'an explicit date_from/date_to, max 90-day span) and/or source_id (UUID ' +
|
|
27
|
-
'data filter). No tenant field is accepted.',
|
|
28
|
-
inputSchema: dashboardMatchRateInputShape,
|
|
29
|
-
}, queryHandler(buildDashboardQuery, (args) => contextDashboardSlicePath(args.contextId, 'match-rate'), dispatchDashboard));
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=match-rate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"match-rate.js","sourceRoot":"","sources":["../../../src/tools/dashboard/match-rate.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,yDAAyD;AACzD,EAAE;AACF,yEAAyE;AACzE,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,mCAAmC;AAGnC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAEpB,mFAAmF;AACnF,MAAM,CAAC,MAAM,4BAA4B,GAAG,wBAAwB,CAAA;AAEpE;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAiB;IAC9D,MAAM,CAAC,YAAY,CACjB,sBAAsB,EACtB;QACE,WAAW,EACT,8DAA8D;YAC9D,yEAAyE;YACzE,yEAAyE;YACzE,oEAAoE;YACpE,yEAAyE;YACzE,yEAAyE;YACzE,4CAA4C;QAC9C,WAAW,EAAE,4BAA4B;KAC1C,EACD,YAAY,CACV,mBAAmB,EACnB,CAAC,IAAI,EAAE,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EACjE,iBAAiB,CAClB,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// `dashboard_metrics` — curated GET
|
|
2
|
-
// /v1/reports/contexts/{contextId}/dashboard/metrics.
|
|
3
|
-
//
|
|
4
|
-
// The complete Command Center metrics: summary, trends, and breakdowns in one
|
|
5
|
-
// payload (spec operationId getMatcherDashboardMetrics). Shares the family input
|
|
6
|
-
// shape (contextId path + optional date_from/date_to/source_id query) and the
|
|
7
|
-
// fail-closed relay. contextId is a routing path param and source_id a data
|
|
8
|
-
// filter — neither is a tenant field, and no tenant field is accepted.
|
|
9
|
-
import { queryHandler } from '../query-handler.js';
|
|
10
|
-
import { buildDashboardQuery, contextDashboardSlicePath, dashboardQueryInputShape, dispatchDashboard, } from './shared.js';
|
|
11
|
-
/** Zod raw shape for `dashboard_metrics` input — the shared dashboard shape. */
|
|
12
|
-
export const dashboardMetricsInputShape = dashboardQueryInputShape;
|
|
13
|
-
/**
|
|
14
|
-
* Register `dashboard_metrics`. Dispatches a GET to the context's
|
|
15
|
-
* /dashboard/metrics slice with the optional date/source query and returns
|
|
16
|
-
* matcher's comprehensive metrics verbatim; a matcher error surfaces via the
|
|
17
|
-
* shared toToolError.
|
|
18
|
-
*/
|
|
19
|
-
export function registerDashboardMetricsTool(server) {
|
|
20
|
-
server.registerTool('dashboard_metrics', {
|
|
21
|
-
description: 'Get the comprehensive Command Center dashboard metrics (summary, ' +
|
|
22
|
-
'trends, and breakdowns) for a reconciliation context. Pass contextId ' +
|
|
23
|
-
'(UUID path param — not a tenant field), and optionally date_from/' +
|
|
24
|
-
'date_to (YYYY-MM-DD; matcher defaults to the last ~30 days and ' +
|
|
25
|
-
'SILENTLY EXCLUDES older data — for a full picture pass an explicit ' +
|
|
26
|
-
'date_from/date_to, max 90-day span) and/or source_id (UUID data ' +
|
|
27
|
-
'filter). No tenant field is accepted.',
|
|
28
|
-
inputSchema: dashboardMetricsInputShape,
|
|
29
|
-
}, queryHandler(buildDashboardQuery, (args) => contextDashboardSlicePath(args.contextId, 'metrics'), dispatchDashboard));
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=metrics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/tools/dashboard/metrics.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sDAAsD;AACtD,EAAE;AACF,8EAA8E;AAC9E,iFAAiF;AACjF,8EAA8E;AAC9E,4EAA4E;AAC5E,uEAAuE;AAGvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAEpB,gFAAgF;AAChF,MAAM,CAAC,MAAM,0BAA0B,GAAG,wBAAwB,CAAA;AAElE;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAAC,MAAiB;IAC5D,MAAM,CAAC,YAAY,CACjB,mBAAmB,EACnB;QACE,WAAW,EACT,mEAAmE;YACnE,uEAAuE;YACvE,mEAAmE;YACnE,iEAAiE;YACjE,qEAAqE;YACrE,kEAAkE;YAClE,uCAAuC;QACzC,WAAW,EAAE,0BAA0B;KACxC,EACD,YAAY,CACV,mBAAmB,EACnB,CAAC,IAAI,EAAE,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,EAC9D,iBAAiB,CAClB,CACF,CAAA;AACH,CAAC"}
|