@jupiterone/jupiterone-mcp 2.6.2 → 2.8.0

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 (125) hide show
  1. package/README.md +124 -72
  2. package/dist/client/graphql/mutations.d.ts +17 -0
  3. package/dist/client/graphql/mutations.d.ts.map +1 -1
  4. package/dist/client/graphql/mutations.js +143 -1
  5. package/dist/client/graphql/mutations.js.map +1 -1
  6. package/dist/client/graphql/queries.d.ts +28 -3
  7. package/dist/client/graphql/queries.d.ts.map +1 -1
  8. package/dist/client/graphql/queries.js +104 -4
  9. package/dist/client/graphql/queries.js.map +1 -1
  10. package/dist/client/jupiterone-client.d.ts +31 -0
  11. package/dist/client/jupiterone-client.d.ts.map +1 -1
  12. package/dist/client/jupiterone-client.js +63 -0
  13. package/dist/client/jupiterone-client.js.map +1 -1
  14. package/dist/client/services/compliance-service.d.ts +48 -1
  15. package/dist/client/services/compliance-service.d.ts.map +1 -1
  16. package/dist/client/services/compliance-service.js +292 -0
  17. package/dist/client/services/compliance-service.js.map +1 -1
  18. package/dist/client/services/j1ql-service.d.ts +10 -2
  19. package/dist/client/services/j1ql-service.d.ts.map +1 -1
  20. package/dist/client/services/j1ql-service.js +11 -3
  21. package/dist/client/services/j1ql-service.js.map +1 -1
  22. package/dist/client/services/rule-service.d.ts +14 -2
  23. package/dist/client/services/rule-service.d.ts.map +1 -1
  24. package/dist/client/services/rule-service.js +24 -5
  25. package/dist/client/services/rule-service.js.map +1 -1
  26. package/dist/generated/description-map.d.ts.map +1 -1
  27. package/dist/generated/description-map.js +843 -49
  28. package/dist/generated/description-map.js.map +1 -1
  29. package/dist/server/mcp-server.d.ts.map +1 -1
  30. package/dist/server/mcp-server.js +39 -2
  31. package/dist/server/mcp-server.js.map +1 -1
  32. package/dist/server/skills.d.ts +25 -0
  33. package/dist/server/skills.d.ts.map +1 -0
  34. package/dist/server/skills.js +115 -0
  35. package/dist/server/skills.js.map +1 -0
  36. package/dist/server/tools/compliance/attestations.d.ts.map +1 -1
  37. package/dist/server/tools/compliance/attestations.js +20 -37
  38. package/dist/server/tools/compliance/attestations.js.map +1 -1
  39. package/dist/server/tools/compliance/authoring.d.ts +3 -0
  40. package/dist/server/tools/compliance/authoring.d.ts.map +1 -0
  41. package/dist/server/tools/compliance/authoring.js +773 -0
  42. package/dist/server/tools/compliance/authoring.js.map +1 -0
  43. package/dist/server/tools/compliance/controls.d.ts.map +1 -1
  44. package/dist/server/tools/compliance/controls.js +193 -19
  45. package/dist/server/tools/compliance/controls.js.map +1 -1
  46. package/dist/server/tools/compliance/exemptions.d.ts +3 -0
  47. package/dist/server/tools/compliance/exemptions.d.ts.map +1 -0
  48. package/dist/server/tools/compliance/exemptions.js +287 -0
  49. package/dist/server/tools/compliance/exemptions.js.map +1 -0
  50. package/dist/server/tools/compliance/framework.d.ts +3 -0
  51. package/dist/server/tools/compliance/framework.d.ts.map +1 -0
  52. package/dist/server/tools/compliance/framework.js +445 -0
  53. package/dist/server/tools/compliance/framework.js.map +1 -0
  54. package/dist/server/tools/compliance/graph.d.ts +56 -0
  55. package/dist/server/tools/compliance/graph.d.ts.map +1 -0
  56. package/dist/server/tools/compliance/graph.js +115 -0
  57. package/dist/server/tools/compliance/graph.js.map +1 -0
  58. package/dist/server/tools/compliance/index.d.ts +2 -16
  59. package/dist/server/tools/compliance/index.d.ts.map +1 -1
  60. package/dist/server/tools/compliance/index.js +45 -15
  61. package/dist/server/tools/compliance/index.js.map +1 -1
  62. package/dist/server/tools/compliance/requirements.d.ts +3 -0
  63. package/dist/server/tools/compliance/requirements.d.ts.map +1 -0
  64. package/dist/server/tools/compliance/requirements.js +243 -0
  65. package/dist/server/tools/compliance/requirements.js.map +1 -0
  66. package/dist/server/tools/compliance/schemas.d.ts +409 -8
  67. package/dist/server/tools/compliance/schemas.d.ts.map +1 -1
  68. package/dist/server/tools/compliance/schemas.js +337 -7
  69. package/dist/server/tools/compliance/schemas.js.map +1 -1
  70. package/dist/server/tools/compliance/shared.d.ts +103 -1
  71. package/dist/server/tools/compliance/shared.d.ts.map +1 -1
  72. package/dist/server/tools/compliance/shared.js +235 -1
  73. package/dist/server/tools/compliance/shared.js.map +1 -1
  74. package/dist/server/tools/compliance/summary.d.ts +2 -8
  75. package/dist/server/tools/compliance/summary.d.ts.map +1 -1
  76. package/dist/server/tools/compliance/summary.js +149 -87
  77. package/dist/server/tools/compliance/summary.js.map +1 -1
  78. package/dist/server/tools/compliance/tests.d.ts +3 -0
  79. package/dist/server/tools/compliance/tests.d.ts.map +1 -0
  80. package/dist/server/tools/compliance/tests.js +463 -0
  81. package/dist/server/tools/compliance/tests.js.map +1 -0
  82. package/dist/server/tools/compliance/transitions.d.ts +6 -0
  83. package/dist/server/tools/compliance/transitions.d.ts.map +1 -0
  84. package/dist/server/tools/compliance/transitions.js +659 -0
  85. package/dist/server/tools/compliance/transitions.js.map +1 -0
  86. package/dist/server/tools/integrations.d.ts.map +1 -1
  87. package/dist/server/tools/integrations.js +43 -49
  88. package/dist/server/tools/integrations.js.map +1 -1
  89. package/dist/server/tools/reference.d.ts +1 -1
  90. package/dist/server/tools/reference.d.ts.map +1 -1
  91. package/dist/server/tools/reference.js +2 -0
  92. package/dist/server/tools/reference.js.map +1 -1
  93. package/dist/server/tools/result.d.ts +3 -2
  94. package/dist/server/tools/result.d.ts.map +1 -1
  95. package/dist/server/tools/result.js +3 -2
  96. package/dist/server/tools/result.js.map +1 -1
  97. package/dist/server/tools/rule-preview-checks.d.ts +95 -0
  98. package/dist/server/tools/rule-preview-checks.d.ts.map +1 -0
  99. package/dist/server/tools/rule-preview-checks.js +380 -0
  100. package/dist/server/tools/rule-preview-checks.js.map +1 -0
  101. package/dist/server/tools/rule-preview.d.ts +105 -0
  102. package/dist/server/tools/rule-preview.d.ts.map +1 -0
  103. package/dist/server/tools/rule-preview.js +507 -0
  104. package/dist/server/tools/rule-preview.js.map +1 -0
  105. package/dist/server/tools/rules.d.ts +1 -1
  106. package/dist/server/tools/rules.d.ts.map +1 -1
  107. package/dist/server/tools/rules.js +264 -51
  108. package/dist/server/tools/rules.js.map +1 -1
  109. package/dist/server/tools/types.d.ts +2 -0
  110. package/dist/server/tools/types.d.ts.map +1 -1
  111. package/dist/server/tools/types.js.map +1 -1
  112. package/dist/server/tools/usage.d.ts +7 -8
  113. package/dist/server/tools/usage.d.ts.map +1 -1
  114. package/dist/server/tools/usage.js +239 -5
  115. package/dist/server/tools/usage.js.map +1 -1
  116. package/dist/server/tools/value-probe.d.ts.map +1 -1
  117. package/dist/server/tools/value-probe.js +33 -9
  118. package/dist/server/tools/value-probe.js.map +1 -1
  119. package/dist/types/jupiterone.d.ts +213 -5
  120. package/dist/types/jupiterone.d.ts.map +1 -1
  121. package/dist/utils/j1ql-validator.d.ts.map +1 -1
  122. package/dist/utils/j1ql-validator.js +129 -1
  123. package/dist/utils/j1ql-validator.js.map +1 -1
  124. package/node_modules/dtrace-provider/build/Makefile +1 -1
  125. package/package.json +3 -3
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GRAPH_REQUIREMENT_ID = exports.GRAPH_FRAMEWORK_ID = exports.GRAPH_MAX_PAGES = exports.GRAPH_PAGE_SIZE = void 0;
4
+ exports.runGraphQuery = runGraphQuery;
5
+ exports.frameworkRequirementsQuery = frameworkRequirementsQuery;
6
+ exports.rowText = rowText;
7
+ exports.rowIds = rowIds;
8
+ const j1ql_service_js_1 = require("../../../client/services/j1ql-service.js");
9
+ const shared_js_1 = require("./shared.js");
10
+ /**
11
+ * Graph reads the compliance tools share: the summary's drill, and the authoring tools' lookups,
12
+ * dedup reads and selections. On j1dev the graph answers in tens of milliseconds where the
13
+ * apps-api `controls` query takes 13-54 s (2026-10-15, 2026-10-28), so every read that selects
14
+ * or dedups comes from here and the API is called only to write.
15
+ */
16
+ /**
17
+ * Rows per page of a graph query. The query service refuses a larger LIMIT: on ECS 186 both drill
18
+ * queries at LIMIT 1000 failed with `"limit" must be a value between 1 and 250`, and every drill
19
+ * fell back to the API (2026-10-15).
20
+ */
21
+ exports.GRAPH_PAGE_SIZE = 250;
22
+ /** Pages a drill query follows its cursor through: up to 1,000 rows. Past it, it is cut short. */
23
+ exports.GRAPH_MAX_PAGES = 4;
24
+ /**
25
+ * One page, raced against `deadlineAt` and polling no longer than the time left. A poll budget
26
+ * that runs out is a timeout, like the race; anything else, a malformed answer included, is a
27
+ * failure.
28
+ */
29
+ async function readGraphPage(client, query, cursor, deadlineAt, fresh) {
30
+ if (Date.now() >= deadlineAt)
31
+ return { kind: 'timeout' };
32
+ try {
33
+ const result = await (0, shared_js_1.withDeadline)(client.executeJ1qlQuery({
34
+ query,
35
+ ...(cursor === undefined ? {} : { cursor }),
36
+ ...(fresh ? { ignoreCachedResult: true } : {}),
37
+ maxPollAttempts: Math.max(1, Math.ceil((deadlineAt - Date.now()) / 1000)),
38
+ }), deadlineAt);
39
+ if (result === shared_js_1.DEADLINE_PASSED)
40
+ return { kind: 'timeout' };
41
+ const { data, cursor: next } = (result ?? {});
42
+ if (!Array.isArray(data)) {
43
+ throw new Error('Invalid response structure from JupiterOne API: a graph query returned no data');
44
+ }
45
+ // A row that is not an object fails the read: dropped, `[null]` read as a complete empty page,
46
+ // and a duplicate check would have found nothing and let the create through (PR #59 review).
47
+ if (!data.every((row) => typeof row === 'object' && row !== null && !Array.isArray(row))) {
48
+ throw new Error('Invalid response structure from JupiterOne API: a graph query returned a row that is ' +
49
+ 'not an object');
50
+ }
51
+ return {
52
+ kind: 'page',
53
+ rows: data,
54
+ cursor: typeof next === 'string' && next.length > 0 ? next : null,
55
+ };
56
+ }
57
+ catch (error) {
58
+ return error instanceof j1ql_service_js_1.J1qlQueryTimeoutError ? { kind: 'timeout' } : { kind: 'failed', error };
59
+ }
60
+ }
61
+ /**
62
+ * A graph query's rows over up to `maxPages` pages of its cursor, every page inside `deadlineAt`.
63
+ * `more` says the rows may be cut short: a cursor left after the last page, or a later page that
64
+ * ran out of time. The cursor is the only "more" signal: a live probe showed a full 250-row page
65
+ * under `LIMIT 250` carries a cursor when more remain, and a page can come back short while more
66
+ * do. A first page that runs out of time is a timeout, and a failed page fails the read.
67
+ *
68
+ * `fresh` bypasses query-service's 5-minute result cache, which otherwise answers an identical
69
+ * query with what it read the first time. Every read a write is decided on sets it: a dedup, a
70
+ * link check or a selection that read its answer from before its own writes made duplicates
71
+ * (j1dev, 2026-10-30: an identical create-controls batch 5 s later created a second control).
72
+ * Display reads keep the cache; each fresh read is one more query-service execution.
73
+ */
74
+ async function runGraphQuery(client, query, deadlineAt, maxPages = 1, { fresh = false } = {}) {
75
+ const rows = [];
76
+ let cursor;
77
+ for (let page = 0; page < maxPages; page++) {
78
+ const read = await readGraphPage(client, query, cursor, deadlineAt, fresh);
79
+ if (read.kind === 'failed')
80
+ return read;
81
+ if (read.kind === 'timeout')
82
+ return page === 0 ? read : { kind: 'rows', rows, more: true };
83
+ rows.push(...read.rows);
84
+ if (read.cursor === null)
85
+ return { kind: 'rows', rows, more: false };
86
+ cursor = read.cursor;
87
+ }
88
+ return { kind: 'rows', rows, more: true };
89
+ }
90
+ /** A framework id the graph queries may interpolate: a UUID, or `ccm_f_` and a slug. */
91
+ exports.GRAPH_FRAMEWORK_ID = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|ccm_f_[A-Za-z0-9_-]+)$/i;
92
+ /** A requirement id the graph queries may interpolate: a UUID, or `ccm_r_` and a slug. */
93
+ exports.GRAPH_REQUIREMENT_ID = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|ccm_r_[A-Za-z0-9_-]+)$/i;
94
+ /**
95
+ * A framework's requirements with the keys a listing shows and a batch dedups on. One read serves
96
+ * create-requirements' dedup and the summary's `includeRequirements`.
97
+ */
98
+ function frameworkRequirementsQuery(frameworkId) {
99
+ return (`FIND ccm_framework WITH id = '${frameworkId}' THAT HAS ccm_requirement AS r ` +
100
+ 'RETURN r.id AS id, r.identifier AS identifier, r.title AS title, r.section AS section, ' +
101
+ `r.priority AS priority LIMIT ${exports.GRAPH_PAGE_SIZE}`);
102
+ }
103
+ /** A row column as text, or null when it is not a non-empty string. */
104
+ function rowText(value) {
105
+ return typeof value === 'string' && value.length > 0 ? value : null;
106
+ }
107
+ /** A row column that the graph stores as a string or a list of strings, as a list. */
108
+ function rowIds(value) {
109
+ if (typeof value === 'string')
110
+ return value ? [value] : [];
111
+ return Array.isArray(value)
112
+ ? value.filter((entry) => typeof entry === 'string')
113
+ : [];
114
+ }
115
+ //# sourceMappingURL=graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.js","sourceRoot":"","sources":["../../../../src/server/tools/compliance/graph.ts"],"names":[],"mappings":";;;AA6FA,sCAkBC;AAaD,gEAMC;AAGD,0BAEC;AAGD,wBAKC;AA9ID,8EAAiF;AACjF,2CAA4D;AAE5D;;;;;GAKG;AAEH;;;;GAIG;AACU,QAAA,eAAe,GAAG,GAAG,CAAC;AACnC,kGAAkG;AACrF,QAAA,eAAe,GAAG,CAAC,CAAC;AAcjC;;;;GAIG;AACH,KAAK,UAAU,aAAa,CAC1B,MAAwB,EACxB,KAAa,EACb,MAA0B,EAC1B,UAAkB,EAClB,KAAc;IAEd,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,UAAU;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IACzD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAY,EAC/B,MAAM,CAAC,gBAAgB,CAAC;YACtB,KAAK;YACL,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;YAC3C,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,C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E,CAClD,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,SAAgB,OAAO,CAAC,KAAc;IACpC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACtE,CAAC;AAED,sFAAsF;AACtF,SAAgB,MAAM,CAAC,KAAc;IACnC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACzB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;QACrE,CAAC,CAAC,EAAE,CAAC;AACT,CAAC"}
@@ -1,21 +1,7 @@
1
1
  import type { ToolDefinition } from '../types.js';
2
- /**
3
- * Compliance tools — the MCP surface over JupiterOne Continuous Control Monitoring (CCM).
4
- *
5
- * - get-compliance-summary the frameworks scorecard, optionally drilled into one framework
6
- * - list-controls the controls status view and its filters
7
- * - get-control one control with everything that explains its status
8
- * - create-attestation / update-attestation / revoke-attestation the attestation lifecycle
9
- *
10
- * Every resolver behind them is gated by the account's CCM entitlement and by CCM's own
11
- * per-resource-group permissions, so all six carry ACCESS_DENIED_HINT. Expected outcomes (not
12
- * found, ambiguous) are discriminated success envelopes. A write the server refuses is an
13
- * `isError` envelope that still carries its `outcome`, so refusals are countable without matching
14
- * text. No `isError` text carries customer text — the chokepoint copies its first 200 characters
15
- * into telemetry — so refusals name ids and enum values only.
16
- */
17
2
  export declare const complianceTools: ToolDefinition[];
18
3
  export { CONTROL_ID_FORBIDDEN, GET_CONTROL_DEADLINE_MS, MAX_EVALUATION_LOOKUPS, MAX_EXPIRED_ATTESTATIONS, MAX_NAMED_CONTROLS, MAX_REQUIREMENT_LOOKUPS, READ_FANOUT_DEADLINE_MS, STATS_CHUNK_SIZE, SUMMARY_READ_DEADLINE_MS, WRITE_READ_DEADLINE_MS, } from './shared.js';
19
- export { GRAPH_MAX_PAGES, GRAPH_PAGE_SIZE } from './summary.js';
4
+ export { GRAPH_MAX_PAGES, GRAPH_PAGE_SIZE } from './graph.js';
5
+ export { MAX_SUMMARY_FRAMEWORK_IDS } from './summary.js';
20
6
  export { type ControlStatusFacts, explainControlStatus, ORG_UNIT_SUGGESTIONS, STATUS_EXPLANATIONS, type StatusExplanation, } from './controls.js';
21
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/tools/compliance/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,eAAe,EAAE,cAAc,EAI3C,CAAC;AAEF,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACL,KAAK,kBAAkB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/tools/compliance/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA2ClD,eAAO,MAAM,eAAe,EAAE,cAAc,EAUtB,CAAC;AAEvB,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EACL,KAAK,kBAAkB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAC"}
@@ -1,9 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STATUS_EXPLANATIONS = exports.ORG_UNIT_SUGGESTIONS = exports.explainControlStatus = exports.GRAPH_PAGE_SIZE = exports.GRAPH_MAX_PAGES = exports.WRITE_READ_DEADLINE_MS = exports.SUMMARY_READ_DEADLINE_MS = exports.STATS_CHUNK_SIZE = exports.READ_FANOUT_DEADLINE_MS = exports.MAX_REQUIREMENT_LOOKUPS = exports.MAX_NAMED_CONTROLS = exports.MAX_EXPIRED_ATTESTATIONS = exports.MAX_EVALUATION_LOOKUPS = exports.GET_CONTROL_DEADLINE_MS = exports.CONTROL_ID_FORBIDDEN = exports.complianceTools = void 0;
3
+ exports.STATUS_EXPLANATIONS = exports.ORG_UNIT_SUGGESTIONS = exports.explainControlStatus = exports.MAX_SUMMARY_FRAMEWORK_IDS = exports.GRAPH_PAGE_SIZE = exports.GRAPH_MAX_PAGES = exports.WRITE_READ_DEADLINE_MS = exports.SUMMARY_READ_DEADLINE_MS = exports.STATS_CHUNK_SIZE = exports.READ_FANOUT_DEADLINE_MS = exports.MAX_REQUIREMENT_LOOKUPS = exports.MAX_NAMED_CONTROLS = exports.MAX_EXPIRED_ATTESTATIONS = exports.MAX_EVALUATION_LOOKUPS = exports.GET_CONTROL_DEADLINE_MS = exports.CONTROL_ID_FORBIDDEN = exports.complianceTools = void 0;
4
+ const shared_js_1 = require("./shared.js");
4
5
  const attestations_js_1 = require("./attestations.js");
6
+ const authoring_js_1 = require("./authoring.js");
7
+ const exemptions_js_1 = require("./exemptions.js");
5
8
  const controls_js_1 = require("./controls.js");
9
+ const framework_js_1 = require("./framework.js");
10
+ const requirements_js_1 = require("./requirements.js");
6
11
  const summary_js_1 = require("./summary.js");
12
+ const tests_js_1 = require("./tests.js");
13
+ const transitions_js_1 = require("./transitions.js");
7
14
  /**
8
15
  * Compliance tools — the MCP surface over JupiterOne Continuous Control Monitoring (CCM).
9
16
  *
@@ -19,25 +26,48 @@ const summary_js_1 = require("./summary.js");
19
26
  * text. No `isError` text carries customer text — the chokepoint copies its first 200 characters
20
27
  * into telemetry — so refusals name ids and enum values only.
21
28
  */
29
+ /**
30
+ * A thrown error names the phase it failed in and the phases finished so far: every compliance
31
+ * handler times its reads with `timed`, and an abort or an upstream failure otherwise said
32
+ * nothing about which read to narrow (2026-10-15). Access denials are framed by the chokepoint
33
+ * before this runs.
34
+ */
35
+ function withPhaseReport(tool) {
36
+ if (tool.formatError)
37
+ return tool;
38
+ const mode = tool.annotations.readOnlyHint ? 'read' : 'write';
39
+ return {
40
+ ...tool,
41
+ formatError: (error) => (0, shared_js_1.complianceErrorResponse)(error, tool.errorContext, mode),
42
+ };
43
+ }
22
44
  exports.complianceTools = [
23
45
  ...summary_js_1.summaryTools,
24
46
  ...controls_js_1.controlTools,
25
47
  ...attestations_js_1.attestationTools,
26
- ];
27
- var shared_js_1 = require("./shared.js");
28
- Object.defineProperty(exports, "CONTROL_ID_FORBIDDEN", { enumerable: true, get: function () { return shared_js_1.CONTROL_ID_FORBIDDEN; } });
29
- Object.defineProperty(exports, "GET_CONTROL_DEADLINE_MS", { enumerable: true, get: function () { return shared_js_1.GET_CONTROL_DEADLINE_MS; } });
30
- Object.defineProperty(exports, "MAX_EVALUATION_LOOKUPS", { enumerable: true, get: function () { return shared_js_1.MAX_EVALUATION_LOOKUPS; } });
31
- Object.defineProperty(exports, "MAX_EXPIRED_ATTESTATIONS", { enumerable: true, get: function () { return shared_js_1.MAX_EXPIRED_ATTESTATIONS; } });
32
- Object.defineProperty(exports, "MAX_NAMED_CONTROLS", { enumerable: true, get: function () { return shared_js_1.MAX_NAMED_CONTROLS; } });
33
- Object.defineProperty(exports, "MAX_REQUIREMENT_LOOKUPS", { enumerable: true, get: function () { return shared_js_1.MAX_REQUIREMENT_LOOKUPS; } });
34
- Object.defineProperty(exports, "READ_FANOUT_DEADLINE_MS", { enumerable: true, get: function () { return shared_js_1.READ_FANOUT_DEADLINE_MS; } });
35
- Object.defineProperty(exports, "STATS_CHUNK_SIZE", { enumerable: true, get: function () { return shared_js_1.STATS_CHUNK_SIZE; } });
36
- Object.defineProperty(exports, "SUMMARY_READ_DEADLINE_MS", { enumerable: true, get: function () { return shared_js_1.SUMMARY_READ_DEADLINE_MS; } });
37
- Object.defineProperty(exports, "WRITE_READ_DEADLINE_MS", { enumerable: true, get: function () { return shared_js_1.WRITE_READ_DEADLINE_MS; } });
48
+ ...framework_js_1.frameworkTools,
49
+ ...requirements_js_1.requirementTools,
50
+ ...authoring_js_1.controlAuthoringTools,
51
+ ...tests_js_1.controlTestTools,
52
+ ...transitions_js_1.transitionTools,
53
+ ...exemptions_js_1.exemptionTools,
54
+ ].map(withPhaseReport);
55
+ var shared_js_2 = require("./shared.js");
56
+ Object.defineProperty(exports, "CONTROL_ID_FORBIDDEN", { enumerable: true, get: function () { return shared_js_2.CONTROL_ID_FORBIDDEN; } });
57
+ Object.defineProperty(exports, "GET_CONTROL_DEADLINE_MS", { enumerable: true, get: function () { return shared_js_2.GET_CONTROL_DEADLINE_MS; } });
58
+ Object.defineProperty(exports, "MAX_EVALUATION_LOOKUPS", { enumerable: true, get: function () { return shared_js_2.MAX_EVALUATION_LOOKUPS; } });
59
+ Object.defineProperty(exports, "MAX_EXPIRED_ATTESTATIONS", { enumerable: true, get: function () { return shared_js_2.MAX_EXPIRED_ATTESTATIONS; } });
60
+ Object.defineProperty(exports, "MAX_NAMED_CONTROLS", { enumerable: true, get: function () { return shared_js_2.MAX_NAMED_CONTROLS; } });
61
+ Object.defineProperty(exports, "MAX_REQUIREMENT_LOOKUPS", { enumerable: true, get: function () { return shared_js_2.MAX_REQUIREMENT_LOOKUPS; } });
62
+ Object.defineProperty(exports, "READ_FANOUT_DEADLINE_MS", { enumerable: true, get: function () { return shared_js_2.READ_FANOUT_DEADLINE_MS; } });
63
+ Object.defineProperty(exports, "STATS_CHUNK_SIZE", { enumerable: true, get: function () { return shared_js_2.STATS_CHUNK_SIZE; } });
64
+ Object.defineProperty(exports, "SUMMARY_READ_DEADLINE_MS", { enumerable: true, get: function () { return shared_js_2.SUMMARY_READ_DEADLINE_MS; } });
65
+ Object.defineProperty(exports, "WRITE_READ_DEADLINE_MS", { enumerable: true, get: function () { return shared_js_2.WRITE_READ_DEADLINE_MS; } });
66
+ var graph_js_1 = require("./graph.js");
67
+ Object.defineProperty(exports, "GRAPH_MAX_PAGES", { enumerable: true, get: function () { return graph_js_1.GRAPH_MAX_PAGES; } });
68
+ Object.defineProperty(exports, "GRAPH_PAGE_SIZE", { enumerable: true, get: function () { return graph_js_1.GRAPH_PAGE_SIZE; } });
38
69
  var summary_js_2 = require("./summary.js");
39
- Object.defineProperty(exports, "GRAPH_MAX_PAGES", { enumerable: true, get: function () { return summary_js_2.GRAPH_MAX_PAGES; } });
40
- Object.defineProperty(exports, "GRAPH_PAGE_SIZE", { enumerable: true, get: function () { return summary_js_2.GRAPH_PAGE_SIZE; } });
70
+ Object.defineProperty(exports, "MAX_SUMMARY_FRAMEWORK_IDS", { enumerable: true, get: function () { return summary_js_2.MAX_SUMMARY_FRAMEWORK_IDS; } });
41
71
  var controls_js_2 = require("./controls.js");
42
72
  Object.defineProperty(exports, "explainControlStatus", { enumerable: true, get: function () { return controls_js_2.explainControlStatus; } });
43
73
  Object.defineProperty(exports, "ORG_UNIT_SUGGESTIONS", { enumerable: true, get: function () { return controls_js_2.ORG_UNIT_SUGGESTIONS; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/server/tools/compliance/index.ts"],"names":[],"mappings":";;;AACA,uDAAqD;AACrD,+CAA6C;AAC7C,6CAA4C;AAE5C;;;;;;;;;;;;;;GAcG;AAEU,QAAA,eAAe,GAAqB;IAC/C,GAAG,yBAAY;IACf,GAAG,0BAAY;IACf,GAAG,kCAAgB;CACpB,CAAC;AAEF,yCAWqB;AAVnB,iHAAA,oBAAoB,OAAA;AACpB,oHAAA,uBAAuB,OAAA;AACvB,mHAAA,sBAAsB,OAAA;AACtB,qHAAA,wBAAwB,OAAA;AACxB,+GAAA,kBAAkB,OAAA;AAClB,oHAAA,uBAAuB,OAAA;AACvB,oHAAA,uBAAuB,OAAA;AACvB,6GAAA,gBAAgB,OAAA;AAChB,qHAAA,wBAAwB,OAAA;AACxB,mHAAA,sBAAsB,OAAA;AAExB,2CAAgE;AAAvD,6GAAA,eAAe,OAAA;AAAE,6GAAA,eAAe,OAAA;AACzC,6CAMuB;AAJrB,mHAAA,oBAAoB,OAAA;AACpB,mHAAA,oBAAoB,OAAA;AACpB,kHAAA,mBAAmB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/server/tools/compliance/index.ts"],"names":[],"mappings":";;;AACA,2CAAsD;AACtD,uDAAqD;AACrD,iDAAuD;AACvD,mDAAiD;AACjD,+CAA6C;AAC7C,iDAAgD;AAChD,uDAAqD;AACrD,6CAA4C;AAC5C,yCAA8C;AAC9C,qDAAmD;AAEnD;;;;;;;;;;;;;;GAcG;AAEH;;;;;GAKG;AACH,SAAS,eAAe,CAAC,IAAoB;IAC3C,IAAI,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAClC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9D,OAAO;QACL,GAAG,IAAI;QACP,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,mCAAuB,EAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC;KAChF,CAAC;AACJ,CAAC;AAEY,QAAA,eAAe,GAAqB;IAC/C,GAAG,yBAAY;IACf,GAAG,0BAAY;IACf,GAAG,kCAAgB;IACnB,GAAG,6BAAc;IACjB,GAAG,kCAAgB;IACnB,GAAG,oCAAqB;IACxB,GAAG,2BAAgB;IACnB,GAAG,gCAAe;IAClB,GAAG,8BAAc;CAClB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAEvB,yCAWqB;AAVnB,iHAAA,oBAAoB,OAAA;AACpB,oHAAA,uBAAuB,OAAA;AACvB,mHAAA,sBAAsB,OAAA;AACtB,qHAAA,wBAAwB,OAAA;AACxB,+GAAA,kBAAkB,OAAA;AAClB,oHAAA,uBAAuB,OAAA;AACvB,oHAAA,uBAAuB,OAAA;AACvB,6GAAA,gBAAgB,OAAA;AAChB,qHAAA,wBAAwB,OAAA;AACxB,mHAAA,sBAAsB,OAAA;AAExB,uCAA8D;AAArD,2GAAA,eAAe,OAAA;AAAE,2GAAA,eAAe,OAAA;AACzC,2CAAyD;AAAhD,uHAAA,yBAAyB,OAAA;AAClC,6CAMuB;AAJrB,mHAAA,oBAAoB,OAAA;AACpB,mHAAA,oBAAoB,OAAA;AACpB,kHAAA,mBAAmB,OAAA"}
@@ -0,0 +1,3 @@
1
+ import { type ToolDefinition } from '../types.js';
2
+ export declare const requirementTools: ToolDefinition[];
3
+ //# sourceMappingURL=requirements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requirements.d.ts","sourceRoot":"","sources":["../../../../src/server/tools/compliance/requirements.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAgHtE,eAAO,MAAM,gBAAgB,EAAE,cAAc,EAiN5C,CAAC"}
@@ -0,0 +1,243 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requirementTools = void 0;
4
+ const zod_1 = require("zod");
5
+ const load_description_js_1 = require("../../../utils/load-description.js");
6
+ const result_js_1 = require("../result.js");
7
+ const types_js_1 = require("../types.js");
8
+ const graph_js_1 = require("./graph.js");
9
+ const schemas_js_1 = require("./schemas.js");
10
+ const shared_js_1 = require("./shared.js");
11
+ async function readExisting(client, frameworkId, deadlineAt) {
12
+ try {
13
+ const fresh = await (0, shared_js_1.withDeadline)(client.listFrameworkRequirements(frameworkId), deadlineAt);
14
+ if (fresh === shared_js_1.DEADLINE_PASSED)
15
+ return { kind: 'unread' };
16
+ if (fresh === null)
17
+ return { kind: 'unknown_framework' };
18
+ return { kind: 'rows', rows: fresh };
19
+ }
20
+ catch (error) {
21
+ if ((0, shared_js_1.isAborted)(error))
22
+ throw error;
23
+ return { kind: 'unread', error };
24
+ }
25
+ }
26
+ function existingMatch(item, byIdentifier, byTitle) {
27
+ return item.identifier
28
+ ? byIdentifier.get((0, shared_js_1.foldName)(item.identifier))
29
+ : byTitle.get((0, shared_js_1.foldName)(item.title));
30
+ }
31
+ function projectCreated(entry, item) {
32
+ return {
33
+ outcome: 'created',
34
+ id: entry.id,
35
+ title: entry.title ?? item.title,
36
+ identifier: entry.identifier ?? item.identifier ?? null,
37
+ section: entry.section ?? item.section ?? null,
38
+ };
39
+ }
40
+ const requirementInput = zod_1.z.object({
41
+ title: zod_1.z.string().trim().min(1).describe("The obligation in the standard's words."),
42
+ description: zod_1.z.string().trim().min(1).optional().describe('What the requirement asks for.'),
43
+ identifier: zod_1.z
44
+ .string()
45
+ .trim()
46
+ .min(1)
47
+ .optional()
48
+ .describe('The standard\'s own id, e.g. "CC6.1" or "A.9.1.1"; the dedup key when given.'),
49
+ section: zod_1.z.string().trim().min(1).optional().describe('The grouping shown in the app.'),
50
+ priority: zod_1.z.enum(['CRITICAL', 'HIGH', 'MEDIUM', 'LOW']).optional(),
51
+ });
52
+ exports.requirementTools = [
53
+ (0, types_js_1.defineTool)({
54
+ name: 'create-requirements',
55
+ title: 'Create Requirements',
56
+ description: (0, load_description_js_1.loadDescription)('create-requirements.md'),
57
+ inputSchema: {
58
+ frameworkId: zod_1.z
59
+ .string()
60
+ .trim()
61
+ .min(1)
62
+ .describe('The framework `id`, from `create-framework` or `get-compliance-summary`.'),
63
+ requirements: zod_1.z
64
+ .array(requirementInput)
65
+ .min(1)
66
+ .max(shared_js_1.MAX_REQUIREMENTS_PER_CALL)
67
+ .describe(`The requirements to add, 1 to ${shared_js_1.MAX_REQUIREMENTS_PER_CALL}; a section per call.`),
68
+ },
69
+ outputSchema: schemas_js_1.createRequirementsOutput,
70
+ annotations: types_js_1.CREATE,
71
+ accessDeniedHint: shared_js_1.ACCESS_DENIED_HINT,
72
+ errorContext: 'Error creating requirements',
73
+ handler: async ({ frameworkId, requirements }, client) => {
74
+ if (!graph_js_1.GRAPH_FRAMEWORK_ID.test(frameworkId)) {
75
+ return (0, shared_js_1.refusal)('framework_not_found', 'No framework has this id; take the `id` from `get-compliance-summary`.', {
76
+ frameworkId,
77
+ });
78
+ }
79
+ const startedAt = Date.now();
80
+ const readDeadline = startedAt + shared_js_1.AUTHORING_READ_DEADLINE_MS;
81
+ const writeDeadline = startedAt + shared_js_1.AUTHORING_DEADLINE_MS;
82
+ const timings = {};
83
+ const subdomainRead = (0, shared_js_1.readSubdomain)(client, timings);
84
+ // The framework list only names the framework in the response, so it waits no longer than the
85
+ // reads and a failure leaves the name null: an unbounded walk could push the creates past the
86
+ // write deadline after the authoritative read had answered (PR #59 review).
87
+ const [listedFrameworks, existingRead] = await Promise.all([
88
+ (0, shared_js_1.timed)(timings, 'frameworks', () => (0, shared_js_1.withDeadline)(client.listAllControlFrameworks(), readDeadline).catch((error) => {
89
+ if ((0, shared_js_1.isAborted)(error))
90
+ throw error;
91
+ console.error('Error listing frameworks to name the framework:', error);
92
+ return null;
93
+ })),
94
+ (0, shared_js_1.timed)(timings, 'requirements', () => readExisting(client, frameworkId, readDeadline)),
95
+ ]);
96
+ const frameworks = listedFrameworks && listedFrameworks !== shared_js_1.DEADLINE_PASSED ? listedFrameworks.frameworks : [];
97
+ // Only the API's by-id read says a framework is absent. The framework list lags a create by
98
+ // seconds (a framework created moments earlier was refused as not found, j1dev 2026-10-28),
99
+ // and a read that failed or timed out says nothing either way, so it answers `read_failed`
100
+ // rather than `framework_not_found` (PR #59 review).
101
+ if (existingRead.kind === 'unknown_framework') {
102
+ return (0, shared_js_1.refusal)('framework_not_found', 'No framework has this id; take the `id` from `create-framework` or ' +
103
+ '`get-compliance-summary`.', { frameworkId });
104
+ }
105
+ if (existingRead.kind !== 'rows') {
106
+ if (existingRead.error) {
107
+ console.error("Error reading a framework's requirements:", existingRead.error);
108
+ }
109
+ // Without the read a repeat would duplicate, which is the one thing a batch must never do.
110
+ return (0, shared_js_1.refusal)('read_failed', "The framework's existing requirements could not be read in time, so nothing was " +
111
+ 'created (a create without that read could duplicate). Call again.', { frameworkId });
112
+ }
113
+ const framework = frameworks.find((entry) => !entry.deleted && entry.id === frameworkId) ?? {
114
+ id: frameworkId,
115
+ name: null,
116
+ };
117
+ const byIdentifier = new Map();
118
+ const byTitle = new Map();
119
+ for (const row of existingRead.rows) {
120
+ const id = (0, graph_js_1.rowText)(row.id);
121
+ if (!id)
122
+ continue;
123
+ const entry = {
124
+ id,
125
+ identifier: (0, graph_js_1.rowText)(row.identifier),
126
+ title: (0, graph_js_1.rowText)(row.title),
127
+ section: (0, graph_js_1.rowText)(row.section),
128
+ };
129
+ if (entry.identifier)
130
+ byIdentifier.set((0, shared_js_1.foldName)(entry.identifier), entry);
131
+ if (entry.title)
132
+ byTitle.set((0, shared_js_1.foldName)(entry.title), entry);
133
+ }
134
+ const subdomain = await (0, shared_js_1.subdomainBy)(subdomainRead, readDeadline);
135
+ // Two items with the same key in one batch would both be created: with four in flight the
136
+ // second starts before the first's id is known. Only the first copy runs; the others follow
137
+ // it. Identifier and title keys live apart, since a title that reads like another item's
138
+ // identifier is a different obligation (PR #59 review); an item without an identifier
139
+ // follows an earlier item of the same title, as the title dedup reads it.
140
+ const slotByKey = new Map();
141
+ const unique = [];
142
+ const slotOf = [];
143
+ const followsFirst = new Set();
144
+ requirements.forEach((item, index) => {
145
+ const title = (0, shared_js_1.foldName)(item.title);
146
+ const titleKey = `title:${title}`;
147
+ const ownKey = item.identifier ? `id:${(0, shared_js_1.foldName)(item.identifier)}` : titleKey;
148
+ const first = slotByKey.get(ownKey);
149
+ if (first !== undefined) {
150
+ slotOf.push(first);
151
+ followsFirst.add(index);
152
+ return;
153
+ }
154
+ slotByKey.set(ownKey, unique.length);
155
+ // A later item may follow this one by title only if this one will carry that title: it
156
+ // creates it, or the requirement it matches has it. A match by identifier under another
157
+ // title left a title-only item reported already_exists with nothing created (PR #59
158
+ // review).
159
+ const match = existingMatch(item, byIdentifier, byTitle);
160
+ const carriesTitle = !match || (match.title !== null && (0, shared_js_1.foldName)(match.title) === title);
161
+ if (carriesTitle && !slotByKey.has(titleKey))
162
+ slotByKey.set(titleKey, unique.length);
163
+ slotOf.push(unique.length);
164
+ unique.push(item);
165
+ });
166
+ const uniqueSlots = await (0, shared_js_1.timed)(timings, 'create', () => (0, shared_js_1.runBatch)(unique, { deadlineAt: writeDeadline, concurrency: shared_js_1.BATCH_CONCURRENCY }, async (item) => {
167
+ const existing = existingMatch(item, byIdentifier, byTitle);
168
+ if (existing) {
169
+ return {
170
+ outcome: 'already_exists',
171
+ id: existing.id,
172
+ title: existing.title ?? item.title,
173
+ identifier: existing.identifier ?? item.identifier ?? null,
174
+ // What CCM holds; the requested section was not written (PR #59 review).
175
+ section: existing.section ?? null,
176
+ };
177
+ }
178
+ const input = {
179
+ title: item.title,
180
+ frameworkId,
181
+ description: item.description,
182
+ identifier: item.identifier,
183
+ section: item.section,
184
+ priority: item.priority,
185
+ };
186
+ try {
187
+ const created = await client.createRequirement(input);
188
+ // A later item with the same key in this batch is a duplicate of this one.
189
+ if (item.identifier)
190
+ byIdentifier.set((0, shared_js_1.foldName)(item.identifier), created);
191
+ byTitle.set((0, shared_js_1.foldName)(item.title), created);
192
+ return projectCreated(created, item);
193
+ }
194
+ catch (error) {
195
+ if ((0, shared_js_1.isAborted)(error))
196
+ throw error;
197
+ return {
198
+ outcome: 'refused',
199
+ title: item.title,
200
+ identifier: item.identifier ?? null,
201
+ reason: (0, shared_js_1.backendReason)(error),
202
+ };
203
+ }
204
+ }));
205
+ const outcomeOf = (slot, item) => slot.kind === 'done'
206
+ ? slot.value
207
+ : { outcome: slot.kind, title: item.title, identifier: item.identifier ?? null };
208
+ const items = requirements.map((item, index) => {
209
+ const leader = outcomeOf(uniqueSlots[slotOf[index]], item);
210
+ if (!followsFirst.has(index))
211
+ return leader;
212
+ // A copy of a saved item already exists, and reports what was saved rather than its own
213
+ // input; only an unsaved leader's copy keeps its own labels (PR #59 review).
214
+ return leader.outcome === 'created' || leader.outcome === 'already_exists'
215
+ ? { ...leader, outcome: 'already_exists' }
216
+ : { ...leader, title: item.title, identifier: item.identifier ?? null };
217
+ });
218
+ const count = (outcome) => items.filter((item) => item.outcome === outcome).length;
219
+ const remaining = count('not_attempted') + count('interrupted');
220
+ return (0, result_js_1.structuredResult)({
221
+ outcome: 'ok',
222
+ framework: {
223
+ id: framework.id,
224
+ name: framework.name,
225
+ url: (0, shared_js_1.frameworkUrl)(framework.id, subdomain),
226
+ },
227
+ items,
228
+ createdCount: count('created'),
229
+ existingCount: count('already_exists'),
230
+ refusedCount: count('refused'),
231
+ remaining,
232
+ nextStep: remaining > 0
233
+ ? `${remaining} requirement${remaining === 1 ? ' was' : 's were'} not reached in this ` +
234
+ "call's budget: call again with the same input; created ones come back " +
235
+ '`already_exists`.'
236
+ : 'Confirm the list with the user, then `create-controls` or `link-controls` per ' +
237
+ 'requirement.',
238
+ timingsMs: timings,
239
+ });
240
+ },
241
+ }),
242
+ ];
243
+ //# sourceMappingURL=requirements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requirements.js","sourceRoot":"","sources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