@didit-protocol/mcp-server 3.0.3 → 5.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +582 -178
  3. package/dist/audit-log.d.ts +22 -0
  4. package/dist/audit-log.d.ts.map +1 -0
  5. package/dist/audit-log.js +77 -0
  6. package/dist/audit-log.js.map +1 -0
  7. package/dist/auth/introspection-verifier.d.ts +16 -0
  8. package/dist/auth/introspection-verifier.d.ts.map +1 -0
  9. package/dist/auth/introspection-verifier.js +77 -0
  10. package/dist/auth/introspection-verifier.js.map +1 -0
  11. package/dist/auth/verifier.d.ts +19 -0
  12. package/dist/auth/verifier.d.ts.map +1 -0
  13. package/dist/auth/verifier.js +88 -0
  14. package/dist/auth/verifier.js.map +1 -0
  15. package/dist/blank-args.d.ts +10 -0
  16. package/dist/blank-args.d.ts.map +1 -0
  17. package/dist/blank-args.js +34 -0
  18. package/dist/blank-args.js.map +1 -0
  19. package/dist/chatgpt-app.d.ts +44 -0
  20. package/dist/chatgpt-app.d.ts.map +1 -0
  21. package/dist/chatgpt-app.js +52 -0
  22. package/dist/chatgpt-app.js.map +1 -0
  23. package/dist/config.d.ts +115 -2
  24. package/dist/config.d.ts.map +1 -1
  25. package/dist/config.js +251 -15
  26. package/dist/config.js.map +1 -1
  27. package/dist/dates.d.ts +2 -0
  28. package/dist/dates.d.ts.map +1 -0
  29. package/dist/dates.js +23 -0
  30. package/dist/dates.js.map +1 -0
  31. package/dist/feature-config-schema.d.ts +66 -0
  32. package/dist/feature-config-schema.d.ts.map +1 -0
  33. package/dist/feature-config-schema.js +192 -0
  34. package/dist/feature-config-schema.js.map +1 -0
  35. package/dist/http.d.ts +4 -0
  36. package/dist/http.d.ts.map +1 -0
  37. package/dist/http.js +230 -0
  38. package/dist/http.js.map +1 -0
  39. package/dist/index.d.ts +20 -1
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +2986 -440
  42. package/dist/index.js.map +1 -1
  43. package/dist/internal-tools.d.ts +17 -0
  44. package/dist/internal-tools.d.ts.map +1 -0
  45. package/dist/internal-tools.js +26 -0
  46. package/dist/internal-tools.js.map +1 -0
  47. package/dist/mcp-modern.d.ts +36 -0
  48. package/dist/mcp-modern.d.ts.map +1 -0
  49. package/dist/mcp-modern.js +152 -0
  50. package/dist/mcp-modern.js.map +1 -0
  51. package/dist/orgapp.d.ts +34 -0
  52. package/dist/orgapp.d.ts.map +1 -0
  53. package/dist/orgapp.js +93 -0
  54. package/dist/orgapp.js.map +1 -0
  55. package/dist/permissions.d.ts +24 -0
  56. package/dist/permissions.d.ts.map +1 -0
  57. package/dist/permissions.js +210 -0
  58. package/dist/permissions.js.map +1 -0
  59. package/dist/privileged-tools.d.ts +14 -0
  60. package/dist/privileged-tools.d.ts.map +1 -0
  61. package/dist/privileged-tools.js +21 -0
  62. package/dist/privileged-tools.js.map +1 -0
  63. package/dist/schema/feature-config-schema.json +4446 -0
  64. package/dist/security.d.ts +168 -0
  65. package/dist/security.d.ts.map +1 -0
  66. package/dist/security.js +858 -0
  67. package/dist/security.js.map +1 -0
  68. package/dist/session-pdf-download.d.ts +8 -0
  69. package/dist/session-pdf-download.d.ts.map +1 -0
  70. package/dist/session-pdf-download.js +91 -0
  71. package/dist/session-pdf-download.js.map +1 -0
  72. package/dist/tools/analytics.d.ts +13 -0
  73. package/dist/tools/analytics.d.ts.map +1 -0
  74. package/dist/tools/analytics.js +171 -0
  75. package/dist/tools/analytics.js.map +1 -0
  76. package/dist/tools/auth.d.ts +11 -2
  77. package/dist/tools/auth.d.ts.map +1 -1
  78. package/dist/tools/auth.js +93 -19
  79. package/dist/tools/auth.js.map +1 -1
  80. package/dist/tools/billing.d.ts +2 -2
  81. package/dist/tools/billing.d.ts.map +1 -1
  82. package/dist/tools/billing.js +38 -12
  83. package/dist/tools/billing.js.map +1 -1
  84. package/dist/tools/blocklist.d.ts +2 -1
  85. package/dist/tools/blocklist.d.ts.map +1 -1
  86. package/dist/tools/blocklist.js +10 -19
  87. package/dist/tools/blocklist.js.map +1 -1
  88. package/dist/tools/businesses.d.ts +7 -0
  89. package/dist/tools/businesses.d.ts.map +1 -0
  90. package/dist/tools/businesses.js +57 -0
  91. package/dist/tools/businesses.js.map +1 -0
  92. package/dist/tools/cases.d.ts +6 -0
  93. package/dist/tools/cases.d.ts.map +1 -0
  94. package/dist/tools/cases.js +63 -0
  95. package/dist/tools/cases.js.map +1 -0
  96. package/dist/tools/compliance.d.ts +8 -0
  97. package/dist/tools/compliance.d.ts.map +1 -0
  98. package/dist/tools/compliance.js +95 -0
  99. package/dist/tools/compliance.js.map +1 -0
  100. package/dist/tools/context.d.ts +2 -0
  101. package/dist/tools/context.d.ts.map +1 -0
  102. package/dist/tools/context.js +37 -0
  103. package/dist/tools/context.js.map +1 -0
  104. package/dist/tools/customization.d.ts +18 -0
  105. package/dist/tools/customization.d.ts.map +1 -0
  106. package/dist/tools/customization.js +35 -0
  107. package/dist/tools/customization.js.map +1 -0
  108. package/dist/tools/feature-config.d.ts +53 -0
  109. package/dist/tools/feature-config.d.ts.map +1 -0
  110. package/dist/tools/feature-config.js +432 -0
  111. package/dist/tools/feature-config.js.map +1 -0
  112. package/dist/tools/lists.d.ts +3 -0
  113. package/dist/tools/lists.d.ts.map +1 -1
  114. package/dist/tools/lists.js +29 -26
  115. package/dist/tools/lists.js.map +1 -1
  116. package/dist/tools/members.d.ts +7 -0
  117. package/dist/tools/members.d.ts.map +1 -0
  118. package/dist/tools/members.js +60 -0
  119. package/dist/tools/members.js.map +1 -0
  120. package/dist/tools/observability.d.ts +4 -0
  121. package/dist/tools/observability.d.ts.map +1 -0
  122. package/dist/tools/observability.js +17 -0
  123. package/dist/tools/observability.js.map +1 -0
  124. package/dist/tools/questionnaires.d.ts +61 -3
  125. package/dist/tools/questionnaires.d.ts.map +1 -1
  126. package/dist/tools/questionnaires.js +128 -24
  127. package/dist/tools/questionnaires.js.map +1 -1
  128. package/dist/tools/reports.d.ts +5 -0
  129. package/dist/tools/reports.d.ts.map +1 -0
  130. package/dist/tools/reports.js +89 -0
  131. package/dist/tools/reports.js.map +1 -0
  132. package/dist/tools/search.d.ts +30 -0
  133. package/dist/tools/search.d.ts.map +1 -0
  134. package/dist/tools/search.js +317 -0
  135. package/dist/tools/search.js.map +1 -0
  136. package/dist/tools/session-explain-levers.d.ts +17 -0
  137. package/dist/tools/session-explain-levers.d.ts.map +1 -0
  138. package/dist/tools/session-explain-levers.js +139 -0
  139. package/dist/tools/session-explain-levers.js.map +1 -0
  140. package/dist/tools/session-explain.d.ts +3 -0
  141. package/dist/tools/session-explain.d.ts.map +1 -0
  142. package/dist/tools/session-explain.js +180 -0
  143. package/dist/tools/session-explain.js.map +1 -0
  144. package/dist/tools/sessions.d.ts +16 -3
  145. package/dist/tools/sessions.d.ts.map +1 -1
  146. package/dist/tools/sessions.js +150 -64
  147. package/dist/tools/sessions.js.map +1 -1
  148. package/dist/tools/settings.d.ts +15 -1
  149. package/dist/tools/settings.d.ts.map +1 -1
  150. package/dist/tools/settings.js +141 -22
  151. package/dist/tools/settings.js.map +1 -1
  152. package/dist/tools/standalone.d.ts +9 -6
  153. package/dist/tools/standalone.d.ts.map +1 -1
  154. package/dist/tools/standalone.js +47 -102
  155. package/dist/tools/standalone.js.map +1 -1
  156. package/dist/tools/transactions.d.ts +14 -0
  157. package/dist/tools/transactions.d.ts.map +1 -0
  158. package/dist/tools/transactions.js +93 -0
  159. package/dist/tools/transactions.js.map +1 -0
  160. package/dist/tools/users.d.ts +3 -1
  161. package/dist/tools/users.d.ts.map +1 -1
  162. package/dist/tools/users.js +35 -22
  163. package/dist/tools/users.js.map +1 -1
  164. package/dist/tools/webhooks.d.ts +6 -0
  165. package/dist/tools/webhooks.d.ts.map +1 -0
  166. package/dist/tools/webhooks.js +41 -0
  167. package/dist/tools/webhooks.js.map +1 -0
  168. package/dist/tools/workflow-graph.d.ts +65 -0
  169. package/dist/tools/workflow-graph.d.ts.map +1 -0
  170. package/dist/tools/workflow-graph.js +686 -0
  171. package/dist/tools/workflow-graph.js.map +1 -0
  172. package/package.json +23 -6
@@ -3,20 +3,46 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getBalance = getBalance;
4
4
  exports.topUp = topUp;
5
5
  const config_1 = require("../config");
6
- async function getBalance() {
7
- const res = await fetch(`${config_1.DIDIT_API_BASE_URL}/billing/balance/`, { headers: (0, config_1.getHeaders)() });
8
- return res.json();
6
+ const security_1 = require("../security");
7
+ // Billing is ORG-level on the console (no flat /billing/balance/). The org top-up endpoint
8
+ // (GET) returns balance + auto-refill config; POST initiates a top-up checkout.
9
+ const TOP_UP_MINIMUM = 50;
10
+ const TOP_UP_MAXIMUM = 1000000;
11
+ async function getBalance(organizationId) {
12
+ return (0, config_1.apiRequest)((0, config_1.orgPath)("/top-up/", { organizationId }));
9
13
  }
10
- async function topUp(amountInDollars, successUrl, cancelUrl) {
11
- const res = await fetch(`${config_1.DIDIT_API_BASE_URL}/billing/top-up/`, {
14
+ async function topUp(amountInDollars, confirm, successUrl, cancelUrl) {
15
+ if (typeof amountInDollars !== "number" || !Number.isFinite(amountInDollars)) {
16
+ throw new security_1.DiditError({
17
+ code: "bad_request",
18
+ message: "amount must be a finite number (USD).",
19
+ field: "amount",
20
+ hint: "Pass a numeric dollar amount, e.g. amount:100.",
21
+ });
22
+ }
23
+ if (amountInDollars < TOP_UP_MINIMUM) {
24
+ throw new security_1.DiditError({ code: "unprocessable", message: `Minimum top-up is $${TOP_UP_MINIMUM}.`, field: "amount" });
25
+ }
26
+ if (amountInDollars > TOP_UP_MAXIMUM) {
27
+ throw new security_1.DiditError({
28
+ code: "unprocessable",
29
+ message: `Top-up amount exceeds the maximum of $${TOP_UP_MAXIMUM}.`,
30
+ field: "amount",
31
+ });
32
+ }
33
+ (0, security_1.assertBoolean)(confirm, "confirm");
34
+ if (confirm !== true) {
35
+ throw new security_1.DiditError({
36
+ code: "unsafe_operation",
37
+ message: `Top-up of $${amountInDollars} moves money and is not confirmed.`,
38
+ field: "confirm",
39
+ hint: "Re-call with confirm:true once a human has approved. This returns a checkout URL; it never auto-charges.",
40
+ });
41
+ }
42
+ const res = await (0, config_1.apiRequest)((0, config_1.orgPath)("/top-up/"), {
12
43
  method: "POST",
13
- headers: (0, config_1.getHeaders)(),
14
- body: JSON.stringify({
15
- amount_in_dollars: amountInDollars,
16
- success_url: successUrl,
17
- cancel_url: cancelUrl,
18
- }),
44
+ json: { amount_in_dollars: amountInDollars, success_url: successUrl, cancel_url: cancelUrl },
19
45
  });
20
- return res.json();
46
+ return { ...res, requires_human_approval: true };
21
47
  }
22
48
  //# sourceMappingURL=billing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/tools/billing.ts"],"names":[],"mappings":";;AAEA,gCAGC;AAED,sBAWC;AAlBD,sCAA2D;AAEpD,KAAK,UAAU,UAAU;IAC9B,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,2BAAkB,mBAAmB,EAAE,EAAE,OAAO,EAAE,IAAA,mBAAU,GAAE,EAAE,CAAC,CAAC;IAC7F,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC;AAEM,KAAK,UAAU,KAAK,CAAC,eAAuB,EAAE,UAAmB,EAAE,SAAkB;IAC1F,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,2BAAkB,kBAAkB,EAAE;QAC/D,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,IAAA,mBAAU,GAAE;QACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,iBAAiB,EAAE,eAAe;YAClC,WAAW,EAAE,UAAU;YACvB,UAAU,EAAE,SAAS;SACtB,CAAC;KACH,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC"}
1
+ {"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/tools/billing.ts"],"names":[],"mappings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AAK,EAAE,SAAS;YAChB,IAAI,EAAE,0GAA0G;SACjH,CAAC,CAAC;IACL,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,IAAA,mBAAU,EAAC,IAAA,gBAAO,EAAC,UAAU,CAAC,EAAE;QAChD,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,EAAE,iBAAiB,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE;KAC7F,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,GAAG,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC;AACnD,CAAC"}
@@ -1,4 +1,5 @@
1
- export declare function listBlocklist(params?: Record<string, string>): Promise<any>;
1
+ export declare function getBlocklist(params?: Record<string, any>): Promise<any>;
2
2
  export declare function addToBlocklist(data: Record<string, any>): Promise<any>;
3
3
  export declare function removeFromBlocklist(data: Record<string, any>): Promise<any>;
4
+ export declare function addToAllowlist(data: Record<string, any>): Promise<any>;
4
5
  //# sourceMappingURL=blocklist.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blocklist.d.ts","sourceRoot":"","sources":["../../src/tools/blocklist.ts"],"names":[],"mappings":"AAEA,wBAAsB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAKjF;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAO5E;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAOjF"}
1
+ {"version":3,"file":"blocklist.d.ts","sourceRoot":"","sources":["../../src/tools/blocklist.ts"],"names":[],"mappings":"AAIA,wBAAsB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAE7E;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAE5E;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAEjF;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAE5E"}
@@ -1,30 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listBlocklist = listBlocklist;
3
+ exports.getBlocklist = getBlocklist;
4
4
  exports.addToBlocklist = addToBlocklist;
5
5
  exports.removeFromBlocklist = removeFromBlocklist;
6
+ exports.addToAllowlist = addToAllowlist;
6
7
  const config_1 = require("../config");
7
- async function listBlocklist(params) {
8
- const url = new URL(`${config_1.DIDIT_API_BASE_URL}/blocklist/`);
9
- if (params)
10
- Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v));
11
- const res = await fetch(url.toString(), { headers: (0, config_1.getHeaders)() });
12
- return res.json();
8
+ // Blocklist / allowlist — org/app-scoped console resources.
9
+ async function getBlocklist(params) {
10
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/blocklist/"), { params });
13
11
  }
14
12
  async function addToBlocklist(data) {
15
- const res = await fetch(`${config_1.DIDIT_API_BASE_URL}/blocklist/add/`, {
16
- method: "POST",
17
- headers: (0, config_1.getHeaders)(),
18
- body: JSON.stringify(data),
19
- });
20
- return res.json();
13
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/blocklist/add/"), { method: "POST", json: data });
21
14
  }
22
15
  async function removeFromBlocklist(data) {
23
- const res = await fetch(`${config_1.DIDIT_API_BASE_URL}/blocklist/remove/`, {
24
- method: "POST",
25
- headers: (0, config_1.getHeaders)(),
26
- body: JSON.stringify(data),
27
- });
28
- return res.json();
16
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/blocklist/remove/"), { method: "POST", json: data });
17
+ }
18
+ async function addToAllowlist(data) {
19
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/allowlist/add/"), { method: "POST", json: data });
29
20
  }
30
21
  //# sourceMappingURL=blocklist.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"blocklist.js","sourceRoot":"","sources":["../../src/tools/blocklist.ts"],"names":[],"mappings":";;AAEA,sCAKC;AAED,wCAOC;AAED,kDAOC;AAzBD,sCAA2D;AAEpD,KAAK,UAAU,aAAa,CAAC,MAA+B;IACjE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,2BAAkB,aAAa,CAAC,CAAC;IACxD,IAAI,MAAM;QAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,IAAA,mBAAU,GAAE,EAAE,CAAC,CAAC;IACnE,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,IAAyB;IAC5D,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,2BAAkB,iBAAiB,EAAE;QAC9D,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,IAAA,mBAAU,GAAE;QACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC;AAEM,KAAK,UAAU,mBAAmB,CAAC,IAAyB;IACjE,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,2BAAkB,oBAAoB,EAAE;QACjE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,IAAA,mBAAU,GAAE;QACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC"}
1
+ {"version":3,"file":"blocklist.js","sourceRoot":"","sources":["../../src/tools/blocklist.ts"],"names":[],"mappings":";;AAIA,oCAEC;AAED,wCAEC;AAED,kDAEC;AAED,wCAEC;AAlBD,sCAAmD;AAEnD,4DAA4D;AAErD,KAAK,UAAU,YAAY,CAAC,MAA4B;IAC7D,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAC3D,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,IAAyB;IAC5D,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACnF,CAAC;AAEM,KAAK,UAAU,mBAAmB,CAAC,IAAyB;IACjE,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACtF,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,IAAyB;IAC5D,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACnF,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare function listBusinesses(params?: Record<string, string>): Promise<any>;
2
+ export declare function createBusiness(data: Record<string, any>): Promise<any>;
3
+ export declare function getBusiness(vendorData: string): Promise<any>;
4
+ export declare function updateBusiness(vendorData: string, data: Record<string, any>): Promise<any>;
5
+ export declare function updateBusinessStatus(vendorData: string, status: string): Promise<any>;
6
+ export declare function deleteBusinesses(vendorDataList?: string[], diditInternalIdList?: string[], deleteAll?: unknown, confirm?: unknown): Promise<any>;
7
+ //# sourceMappingURL=businesses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"businesses.d.ts","sourceRoot":"","sources":["../../src/tools/businesses.ts"],"names":[],"mappings":"AAQA,wBAAsB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAElF;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAE5E;AAED,wBAAsB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAElE;AAED,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAEhG;AAED,wBAAsB,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAK3F;AAED,wBAAsB,gBAAgB,CACpC,cAAc,CAAC,EAAE,MAAM,EAAE,EACzB,mBAAmB,CAAC,EAAE,MAAM,EAAE,EAC9B,SAAS,CAAC,EAAE,OAAO,EACnB,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,GAAG,CAAC,CAqBd"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listBusinesses = listBusinesses;
4
+ exports.createBusiness = createBusiness;
5
+ exports.getBusiness = getBusiness;
6
+ exports.updateBusiness = updateBusiness;
7
+ exports.updateBusinessStatus = updateBusinessStatus;
8
+ exports.deleteBusinesses = deleteBusinesses;
9
+ const config_1 = require("../config");
10
+ const security_1 = require("../security");
11
+ // Vendor businesses — the console resource is `vendor-businesses`, org/app-scoped (these are
12
+ // vendor business ENTITIES, not KYB sessions — KYB sessions are the separate `businesses`/
13
+ // `business-sessions` console resource). List/create/get(by vendor_data)/bulk-delete map
14
+ // cleanly; update by vendor_data is best-effort (console keys updates by internal id).
15
+ async function listBusinesses(params) {
16
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/vendor-businesses/"), { params });
17
+ }
18
+ async function createBusiness(data) {
19
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/vendor-businesses/"), { method: "POST", json: data });
20
+ }
21
+ async function getBusiness(vendorData) {
22
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/vendor-businesses/${encodeURIComponent(vendorData)}/`));
23
+ }
24
+ async function updateBusiness(vendorData, data) {
25
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/vendor-businesses/${encodeURIComponent(vendorData)}/update/`), { method: "PATCH", json: data });
26
+ }
27
+ async function updateBusinessStatus(vendorData, status) {
28
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/vendor-businesses/bulk-status/"), {
29
+ method: "POST",
30
+ json: { vendor_data_list: [vendorData], status },
31
+ });
32
+ }
33
+ async function deleteBusinesses(vendorDataList, diditInternalIdList, deleteAll, confirm) {
34
+ (0, security_1.assertBoolean)(deleteAll, "delete_all");
35
+ (0, security_1.assertBoolean)(confirm, "confirm");
36
+ const wildcard = deleteAll === true;
37
+ const ids = [...(vendorDataList || []), ...(diditInternalIdList || [])];
38
+ if (wildcard) {
39
+ if (confirm !== true)
40
+ throw new security_1.DiditError({ code: "unsafe_operation", message: "delete_all permanently removes EVERY vendor business.", field: "confirm", hint: "Re-call with confirm:true, or pass an explicit id list." });
41
+ }
42
+ else if (ids.length === 0) {
43
+ throw new security_1.DiditError({ code: "bad_request", message: "Provide a non-empty vendor_data_list or didit_internal_id_list, or set delete_all with confirm:true.", field: "vendor_data_list" });
44
+ }
45
+ else if (ids.length > security_1.MAX_BATCH_IDS) {
46
+ throw new security_1.DiditError({ code: "bad_request", message: `Too many ids (max ${security_1.MAX_BATCH_IDS}).`, field: "vendor_data_list" });
47
+ }
48
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/vendor-businesses/delete/"), {
49
+ method: "DELETE",
50
+ json: {
51
+ vendor_data_list: vendorDataList,
52
+ didit_internal_id_list: diditInternalIdList,
53
+ delete_all: wildcard,
54
+ },
55
+ });
56
+ }
57
+ //# sourceMappingURL=businesses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"businesses.js","sourceRoot":"","sources":["../../src/tools/businesses.ts"],"names":[],"mappings":";;AAQA,wCAEC;AAED,wCAEC;AAED,kCAEC;AAED,wCAEC;AAED,oDAKC;AAED,4CA0BC;AAzDD,sCAAmD;AACnD,0CAAuE;AAEvE,6FAA6F;AAC7F,2FAA2F;AAC3F,yFAAyF;AACzF,uFAAuF;AAEhF,KAAK,UAAU,cAAc,CAAC,MAA+B;IAClE,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,qBAAqB,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AACnE,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,IAAyB;IAC5D,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,qBAAqB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACvF,CAAC;AAEM,KAAK,UAAU,WAAW,CAAC,UAAkB;IAClD,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,sBAAsB,kBAAkB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AACzF,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,UAAkB,EAAE,IAAyB;IAChF,OAAO,IA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AM,GAAG,wBAAa,EAAE,CAAC;QACtC,MAAM,IAAI,qBAAU,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,qBAAqB,wBAAa,IAAI,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC5H,CAAC;IACD,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,4BAA4B,CAAC,EAAE;QAC1D,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE;YACJ,gBAAgB,EAAE,cAAc;YAChC,sBAAsB,EAAE,mBAAmB;YAC3C,UAAU,EAAE,QAAQ;SACrB;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare function listCases(params?: Record<string, any>): Promise<any>;
2
+ export declare function getCase(caseId: string): Promise<any>;
3
+ export declare function createCase(data: Record<string, any>): Promise<any>;
4
+ export declare function caseStatistics(params?: Record<string, any>): Promise<any>;
5
+ export declare function manageCase(caseId: string, action: string, data?: Record<string, any>, confirm?: unknown): Promise<any>;
6
+ //# sourceMappingURL=cases.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cases.d.ts","sourceRoot":"","sources":["../../src/tools/cases.ts"],"names":[],"mappings":"AASA,wBAAsB,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAE1E;AAED,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAE1D;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAExE;AAED,wBAAsB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAE/E;AAMD,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAC9B,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,GAAG,CAAC,CAiCd"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listCases = listCases;
4
+ exports.getCase = getCase;
5
+ exports.createCase = createCase;
6
+ exports.caseStatistics = caseStatistics;
7
+ exports.manageCase = manageCase;
8
+ const config_1 = require("../config");
9
+ const security_1 = require("../security");
10
+ // Case management — org/app-scoped console resource. Read/create are dedicated tools;
11
+ // the many per-case actions (assign/resolve/reopen/escalate/comment) fold into one
12
+ // action-dispatch tool to keep the surface small.
13
+ const cid = (id) => (0, security_1.pathSegment)(id, "case_id");
14
+ async function listCases(params) {
15
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/cases/"), { params });
16
+ }
17
+ async function getCase(caseId) {
18
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/cases/${cid(caseId)}/`));
19
+ }
20
+ async function createCase(data) {
21
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/cases/"), { method: "POST", json: data });
22
+ }
23
+ async function caseStatistics(params) {
24
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/cases/statistics/"), { params });
25
+ }
26
+ const KNOWN_CASE_ACTIONS = ["assign", "resolve", "reopen", "escalate", "comment", "update", "sar", "file_sar"];
27
+ const SAR_STATUS = "SAR_FILED";
28
+ // action ∈ assign | resolve | reopen | escalate | comment | update | sar
29
+ async function manageCase(caseId, action, data = {}, confirm) {
30
+ if (typeof action !== "string" || !KNOWN_CASE_ACTIONS.includes(action)) {
31
+ throw new security_1.DiditError({
32
+ code: "bad_request",
33
+ message: "Unknown case action.",
34
+ field: "action",
35
+ hint: `action must be one of: ${KNOWN_CASE_ACTIONS.join(", ")}.`,
36
+ allowed: KNOWN_CASE_ACTIONS,
37
+ });
38
+ }
39
+ // Filing a SAR is a high-impact regulatory action — gate the explicit action AND the
40
+ // status-smuggling path (resolving with status:SAR_FILED) behind confirm:true.
41
+ const callerStatus = typeof data.status === "string" ? data.status.trim().toUpperCase() : undefined;
42
+ const filesSar = action === "sar" || action === "file_sar" || callerStatus === SAR_STATUS;
43
+ if (filesSar && confirm !== true) {
44
+ throw new security_1.DiditError({
45
+ code: "unsafe_operation",
46
+ message: "Filing a SAR (Suspicious Activity Report) is a high-impact regulatory action.",
47
+ field: "confirm",
48
+ hint: "Re-call with confirm:true once a human has authorized filing — applies to action 'sar'/'file_sar' AND any resolve with status:'SAR_FILED'.",
49
+ });
50
+ }
51
+ if (action === "update") {
52
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/cases/${cid(caseId)}/`), { method: "PATCH", json: data });
53
+ }
54
+ if (action === "comment") {
55
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/cases/${cid(caseId)}/comments/`), { method: "POST", json: data });
56
+ }
57
+ if (action === "sar" || action === "file_sar") {
58
+ const { status: _s, ...rest } = data;
59
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/cases/${cid(caseId)}/resolve/`), { method: "POST", json: { ...rest, status: SAR_STATUS } });
60
+ }
61
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)(`/cases/${cid(caseId)}/${(0, security_1.pathSegment)(action, "action")}/`), { method: "POST", json: data });
62
+ }
63
+ //# sourceMappingURL=cases.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cases.js","sourceRoot":"","sources":["../../src/tools/cases.ts"],"names":[],"mappings":";;AASA,8BAEC;AAED,0BAEC;AAED,gCAEC;AAED,wCAEC;AAMD,gCAsCC;AAnED,sCAAmD;AACnD,0CAAsD;AAEtD,sFAAsF;AACtF,mFAAmF;AACnF,kDAAkD;AAElD,MAAM,GAAG,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAA,sBAAW,EAAC,EAAE,EAAE,SAAS,CAAC,CAAC;AAEhD,KA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AAI,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IAC7H,CAAC;IACD,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,UAAU,GAAG,CAAC,MAAM,CAAC,IAAI,IAAA,sBAAW,EAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3H,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare function withoutScope(data?: Record<string, any>): Record<string, any>;
2
+ /** Slim by default: the graph itself stays OUT of the model's context (the
3
+ * document catalog alone is ~100KB and stalled the flash arm into reasoning-only
4
+ * steps, 2026-09-02). The model gets a summary + the accepted spec and applies by
5
+ * reference — ui_workflow_apply_graph {spec} — while headless callers pass
6
+ * include_graph:true to receive the graph for didit_workflow_set_graph. */
7
+ export declare function buildWorkflow(data?: Record<string, any>): Promise<any>;
8
+ //# sourceMappingURL=compliance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compliance.d.ts","sourceRoot":"","sources":["../../src/tools/compliance.ts"],"names":[],"mappings":"AAUA,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAG5E;AA4DD;;;;2EAI2E;AAC3E,wBAAsB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAoB5E"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withoutScope = withoutScope;
4
+ exports.buildWorkflow = buildWorkflow;
5
+ const config_1 = require("../config");
6
+ const security_1 = require("../security");
7
+ // The build-workflow endpoint is an org/app-scoped console resource; org/app resolve from the
8
+ // tool args via the request context (see orgAppPath). The rest of the compliance tools
9
+ // (requirements, workflow-check, interview, profile, generate) are internal-only and live in a
10
+ // module the open-source sync omits.
11
+ // organization_id/application_id are routing args: the CallTool wrapper already resolved them
12
+ // into the request context (and thus the URL path), so keep them out of query params/bodies.
13
+ function withoutScope(data) {
14
+ const { organization_id, application_id, ...rest } = data ?? {};
15
+ return rest;
16
+ }
17
+ /**
18
+ * The spec vocabulary, mirroring service-didit-verification's
19
+ * `ComplianceBuildWorkflowSerializer` (compliance/serializers/compliance.py)
20
+ * and the tool schema in index.ts. Keep all three in sync.
21
+ */
22
+ const BUILD_SPEC_KEYS = ["branches", "countries", "document_rules", "features", "per_feature_config", "subject"];
23
+ /** The valid key a drifted one most likely meant, or "". A model does not invent
24
+ * names from nothing — it blends a real key with the naming convention of its
25
+ * neighbours, so the first underscore-token is the part it got right
26
+ * (`branch_rules` -> `branches`, `document_rules`' suffix landing on
27
+ * `branches`). Only when exactly ONE valid key matches, so the hint is never a
28
+ * coin flip. */
29
+ function nearestSpecKey(invented) {
30
+ const stem = invented.split("_")[0] ?? "";
31
+ if (stem.length < 4)
32
+ return "";
33
+ const matches = BUILD_SPEC_KEYS.filter((key) => key.startsWith(stem) || stem.startsWith(key));
34
+ return matches.length === 1 ? matches[0] : "";
35
+ }
36
+ /**
37
+ * Refuse a spec key the builder does not have, BEFORE the request.
38
+ *
39
+ * the console copilot sent `branch_rules` and the backend answered
40
+ * `Unknown key(s) branch_rules. Valid keys: ...` — correct, but a whole HTTP
41
+ * round trip after the mistake, and on the console's apply path the user
42
+ * watched their workflow fail to build. `additionalProperties: false` on the
43
+ * tool schema tells the model; this enforces it, because a declared schema is
44
+ * advice a client may or may not validate against.
45
+ */
46
+ function refuseUnknownSpecKeys(spec) {
47
+ const allowed = new Set(BUILD_SPEC_KEYS);
48
+ const unknown = Object.keys(spec).filter((key) => !allowed.has(key));
49
+ if (unknown.length === 0)
50
+ return;
51
+ const hints = unknown
52
+ .map((key) => {
53
+ const nearest = nearestSpecKey(key);
54
+ return nearest ? `${key} (the key is "${nearest}")` : key;
55
+ })
56
+ .join(", ");
57
+ // DiditError so the CallTool wrapper renders the structured shape the model
58
+ // already knows how to read (code / field / hint / allowed), rather than a
59
+ // bare message it has to parse out of prose.
60
+ throw new security_1.DiditError({
61
+ code: "bad_request",
62
+ message: `Unknown spec key(s) ${hints}.`,
63
+ field: unknown.join(", "),
64
+ allowed: [...BUILD_SPEC_KEYS],
65
+ hint: "Rewrite the spec with the allowed keys only and call didit_workflow_build_graph again - " +
66
+ "do not resend the same spec, and do not invent keys the builder does not have.",
67
+ });
68
+ }
69
+ /** Slim by default: the graph itself stays OUT of the model's context (the
70
+ * document catalog alone is ~100KB and stalled the flash arm into reasoning-only
71
+ * steps, 2026-09-02). The model gets a summary + the accepted spec and applies by
72
+ * reference — ui_workflow_apply_graph {spec} — while headless callers pass
73
+ * include_graph:true to receive the graph for didit_workflow_set_graph. */
74
+ async function buildWorkflow(data) {
75
+ const { include_graph, ...spec } = withoutScope(data) ?? {};
76
+ refuseUnknownSpecKeys(spec);
77
+ const built = await (0, config_1.apiRequest)((0, config_1.orgAppPath)("/compliance/build-workflow/"), { method: "POST", json: spec });
78
+ if (!built?.graph || include_graph)
79
+ return { ...built, spec };
80
+ const nodes = Object.values(built.graph.nodes ?? {});
81
+ const { graph: _graph, ...rest } = built;
82
+ return {
83
+ ...rest,
84
+ built: true,
85
+ spec,
86
+ graph_summary: {
87
+ node_count: nodes.length,
88
+ features: [...new Set(nodes.filter((node) => node.node_type === "feature").map((node) => node.feature))],
89
+ branches: nodes.filter((node) => node.node_type === "branch").length,
90
+ },
91
+ how_to_apply: "Editor open: call ui_workflow_apply_graph with {spec: <this exact spec>} — the console rebuilds " +
92
+ "and applies it byte-perfect. Headless: re-run with include_graph:true and didit_workflow_set_graph.",
93
+ };
94
+ }
95
+ //# sourceMappingURL=compliance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compliance.js","sourceRoot":"","sources":["../../src/tools/compliance.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EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACzC,OAAO;QACL,GAAG,IAAI;QACP,KAAK,EAAE,IAAI;QACX,IAAI;QACJ,aAAa,EAAE;YACb,UAAU,EAAE,KAAK,CAAC,MAAM;YACxB,QAAQ,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YACxG,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,MAAM;SACrE;QACD,YAAY,EACV,kGAAkG;YAClG,qGAAqG;KACxG,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function getContext(): Promise<any>;
2
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/tools/context.ts"],"names":[],"mappings":"AAKA,wBAAsB,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,CA6B/C"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getContext = getContext;
4
+ const orgapp_1 = require("../orgapp");
5
+ // One-shot discovery: every organization the caller can access with its applications
6
+ // nested, plus an unambiguous default org/app when there is only one. Replaces the
7
+ // didit_org_list + N×didit_org_list_applications round-trips with a single call.
8
+ async function getContext() {
9
+ const map = await (0, orgapp_1.getOrgAppMap)();
10
+ const organizations = map.map((o) => ({
11
+ organization_id: o.orgId,
12
+ organization_name: o.orgName,
13
+ applications: o.apps.map((a) => ({
14
+ application_id: a.appId,
15
+ application_name: a.appName,
16
+ // "live" | "sandbox". A name is not a mode: an application called
17
+ // "Acme (Sandbox)" can be live, and a live one bills every session it
18
+ // creates. Never infer this from application_name.
19
+ ...(a.mode ? { mode: a.mode } : {}),
20
+ })),
21
+ }));
22
+ const allApps = map.flatMap((o) => o.apps.map((a) => ({ orgId: o.orgId, appId: a.appId })));
23
+ // An org whose applications failed to list is UNKNOWN, not empty - it may hold a second
24
+ // application, so a lone visible app is not a default. The scope resolver applies the same
25
+ // rule, and the two must agree: a default advertised here that the resolver then refuses is
26
+ // exactly the "application_id is required" dead end this field exists to prevent.
27
+ const appsUnknown = map.some((o) => o.appsError);
28
+ return {
29
+ organizations,
30
+ organization_count: organizations.length,
31
+ application_count: allApps.length,
32
+ default_organization_id: organizations.length === 1 ? organizations[0].organization_id : undefined,
33
+ default_application_id: allApps.length === 1 && !appsUnknown ? allApps[0].appId : undefined,
34
+ hint: "Pass organization_id/application_id to target one scope, or omit them on *_search tools to aggregate across all apps. `mode` is the application's environment: a LIVE application bills every verification session created in it, a SANDBOX one mocks every provider and never bills. Read the field — never guess the environment from application_name.",
35
+ };
36
+ }
37
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/tools/context.ts"],"names":[],"mappings":";;AAKA,gCA6BC;AAlCD,sCAAyC;AAEzC,qFAAqF;AACrF,mFAAmF;AACnF,iFAAiF;AAC1E,KAAK,UAAU,UAAU;IAC9B,MAAM,GAAG,GAAG,MAAM,IAAA,qBAAY,GAAE,CAAC;IACjC,MAAM,aAAa,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACpC,eAAe,EAAE,CAAC,CAAC,KAAK;QACxB,iBAAiB,EAAE,CAAC,CAAC,OAAO;QAC5B,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC/B,cAAc,EAAE,CAAC,CAAC,KAAK;YACvB,gBAAgB,EAAE,CAAC,CAAC,OAAO;YAC3B,kEAAkE;YAClE,sEAAsE;YACtE,mDAAmD;YACnD,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpC,CAAC,CAAC;KACJ,CAAC,CAAC,CAAC;IACJ,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5F,wFAAwF;IACxF,2FAA2F;IAC3F,4FAA4F;IAC5F,kFAAkF;IAClF,MAAM,WAAW,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACjD,OAAO;QACL,aAAa;QACb,kBAAkB,EAAE,aAAa,CAAC,MAAM;QACxC,iBAAiB,EAAE,OAAO,CAAC,MAAM;QACjC,uBAAuB,EACrB,aAAa,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS;QAC3E,sBAAsB,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;QAC3F,IAAI,EAAE,2VAA2V;KAClW,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ export declare function getCustomization(): Promise<any>;
2
+ /**
3
+ * Update branding: logo images and/or the SMS sender name. Accepts the tool's *_path
4
+ * (local/stdio) or *_base64 (hosted) image inputs and maps them to the API's multipart field
5
+ * names. `sms_sender_name` is the app-level name every SMS verification code carries (free);
6
+ * an empty string clears it. Throws if nothing was supplied so the caller gets a clear local
7
+ * error instead of an empty PATCH.
8
+ */
9
+ export declare function updateCustomization(inputs: {
10
+ image_square_path?: string;
11
+ image_rectangular_path?: string;
12
+ image_favicon_path?: string;
13
+ image_square_base64?: string;
14
+ image_rectangular_base64?: string;
15
+ image_favicon_base64?: string;
16
+ sms_sender_name?: string | null;
17
+ }): Promise<any>;
18
+ //# sourceMappingURL=customization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customization.d.ts","sourceRoot":"","sources":["../../src/tools/customization.ts"],"names":[],"mappings":"AAIA,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,CAErD;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE;IAChD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC,GAAG,OAAO,CAAC,GAAG,CAAC,CAmBf"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCustomization = getCustomization;
4
+ exports.updateCustomization = updateCustomization;
5
+ const config_1 = require("../config");
6
+ // White-label branding — the console resource is `white-label-customization`, org/app-scoped.
7
+ async function getCustomization() {
8
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/white-label-customization/"));
9
+ }
10
+ /**
11
+ * Update branding: logo images and/or the SMS sender name. Accepts the tool's *_path
12
+ * (local/stdio) or *_base64 (hosted) image inputs and maps them to the API's multipart field
13
+ * names. `sms_sender_name` is the app-level name every SMS verification code carries (free);
14
+ * an empty string clears it. Throws if nothing was supplied so the caller gets a clear local
15
+ * error instead of an empty PATCH.
16
+ */
17
+ async function updateCustomization(inputs) {
18
+ const files = {
19
+ image_square: { path: inputs.image_square_path, base64: inputs.image_square_base64 },
20
+ image_rectangular: { path: inputs.image_rectangular_path, base64: inputs.image_rectangular_base64 },
21
+ image_favicon: { path: inputs.image_favicon_path, base64: inputs.image_favicon_base64 },
22
+ };
23
+ const hasImage = Object.values(files).some((f) => f.path || f.base64);
24
+ // null and "" both clear the name; the API treats a blank value as "no sender name".
25
+ const hasSenderName = inputs.sms_sender_name !== undefined;
26
+ if (!hasImage && !hasSenderName) {
27
+ throw new Error("updateCustomization requires at least one image (square, rectangular, or favicon) as *_path or *_base64, or sms_sender_name.");
28
+ }
29
+ const scalars = hasSenderName ? { sms_sender_name: inputs.sms_sender_name ?? "" } : {};
30
+ return (0, config_1.apiRequest)((0, config_1.orgAppPath)("/white-label-customization/"), {
31
+ method: "PATCH",
32
+ form: (0, config_1.buildFormData)(files, scalars),
33
+ });
34
+ }
35
+ //# sourceMappingURL=customization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customization.js","sourceRoot":"","sources":["../../src/tools/customization.ts"],"names":[],"mappings":";;AAIA,4CAEC;AASD,kDA2BC;AA1CD,sCAAkE;AAElE,8FAA8F;AAEvF,KAAK,UAAU,gBAAgB;IACpC,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,6BAA6B,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,mBAAmB,CAAC,MAQzC;IACC,MAAM,KAAK,GAAG;QACZ,YAAY,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,EAAE,MAAM,CAAC,mBAAmB,EAAE;QACpF,iBAAiB,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,sBAAsB,EAAE,MAAM,EAAE,MAAM,CAAC,wBAAwB,EAAE;QACnG,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,EAAE,MAAM,CAAC,oBAAoB,EAAE;KACxF,CAAC;IACF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;IACtE,qFAAqF;IACrF,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,KAAK,SAAS,CAAC;IAC3D,IAAI,CAAC,QAAQ,IAAI,CAAC,aAAa,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,8HAA8H,CAC/H,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,CAAC,eAAe,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACvF,OAAO,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,6BAA6B,CAAC,EAAE;QAC3D,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,IAAA,sBAAa,EAAC,KAAK,EAAE,OAAO,CAAC;KACpC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,53 @@
1
+ /** documents_allowed / poa_documents_allowed -> canonical `{ ISO3: { CODE: { enabled } } }`.
2
+ * A flat array or an "ALL" country fans the doc set out to every country (= "these docs,
3
+ * any country"); per-country maps are normalized in place. Returns the input untouched when it
4
+ * is already canonical or there is nothing to do. */
5
+ export declare function normalizeDocumentsAllowed(input: unknown): unknown;
6
+ /** poa_languages_allowed -> canonical `{ <lang>: 0|1 }`. Accepts a language array (all enabled)
7
+ * or a map with bool / number / string flags. */
8
+ export declare function normalizeLanguagesAllowed(input: unknown): unknown;
9
+ /** Normalize a single feature node's `config` IN PLACE (documents_allowed, poa_documents_allowed,
10
+ * poa_languages_allowed). Safe to call on any config object — keys that aren't present are skipped. */
11
+ export declare function normalizeFeatureConfig(config: unknown): void;
12
+ /** Walk every node of a graph and normalize its feature config in place. Returns the same graph. */
13
+ export declare function normalizeFeatureConfigs(graph: unknown): unknown;
14
+ export interface WorkflowFeatureInput {
15
+ feature?: string;
16
+ config?: Record<string, unknown>;
17
+ label?: string;
18
+ }
19
+ /** Build a linear workflow graph from an ordered feature list: each feature becomes a feature
20
+ * node wired to the next, terminating in an auto-decide status node. This is how the MCP creates
21
+ * a "simple" workflow — the console verification-settings endpoint ignores a `features` payload
22
+ * (it's a read-only computed property), so the only way to make the requested features actually
23
+ * run is to express them as a graph and save THAT. Configs are normalized by the caller.
24
+ * Throws if no usable feature is given (a featureless workflow is exactly the broken state we
25
+ * are preventing). */
26
+ export declare function buildLinearGraphFromFeatures(features: WorkflowFeatureInput[]): {
27
+ start_node: string;
28
+ nodes: Record<string, unknown>;
29
+ };
30
+ /** Fill in each branch rule's `node_id` (the feature node that produces the rule's field) in place.
31
+ * Runs for ANY node that owns branches (branch nodes, and feature/webhook nodes whose branches the
32
+ * runtime evaluates after they complete). Only feature nodes that actually run before the branch —
33
+ * the ones that reach it, plus the branch's own feature node when a feature node carries the
34
+ * branches — are eligible; a same-feature node on a downstream or alternate path is never picked.
35
+ * Leaves explicit `node_id`, `field@node_id` rules, else-branches, and non-feature fields
36
+ * (session/webhook/kyb/unknown) untouched. Returns the same graph. */
37
+ export declare function resolveBranchRuleNodeIds(graph: unknown): unknown;
38
+ /**
39
+ * The `workflow_type` a feature list declares: "kyb" when it runs a business-only feature,
40
+ * otherwise undefined (the backend's own KYC default). Sent on CREATE and nowhere else: the
41
+ * backend derives the type from the graph only when the graph arrives in the create payload and
42
+ * refuses to change it afterwards ("Workflow type cannot be changed once it has been set"), so a
43
+ * draft created empty and graphed by a later PUT stays untyped forever — and the console then
44
+ * validates a KYB canvas by KYC rules ("AML Screening requires ID Verification", prod thread
45
+ * 497172a8, 2026-09-11: 73 turns on a workflow the user could never publish).
46
+ */
47
+ export declare function workflowTypeForFeatures(features: unknown): "kyb" | undefined;
48
+ /** Throw a clear error if a graph mixes KYB (business) features with person/KYC-only features.
49
+ * Catches both directions — a KYB feature dropped into a KYC flow AND a KYC feature dropped into a
50
+ * KYB flow. Mirrors the backend rule so the agent gets immediate, actionable feedback instead of an
51
+ * opaque server rejection. A pure-KYC graph (no KYB feature) is never touched. */
52
+ export declare function assertKycKybSegregation(graph: unknown): void;
53
+ //# sourceMappingURL=feature-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-config.d.ts","sourceRoot":"","sources":["../../src/tools/feature-config.ts"],"names":[],"mappings":"AAkHA;;;sDAGsD;AACtD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAyBjE;AAED;kDACkD;AAClD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAmBjE;AAED;wGACwG;AACxG,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAM5D;AAED,oGAAoG;AACpG,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQ/D;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;uBAMuB;AACvB,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CA+BA;AA+ED;;;;;;uEAMuE;AACvE,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CA6ChE;AAiBD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAO5E;AAED;;;mFAGmF;AACnF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CA2B5D"}