@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,445 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.frameworkTools = 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
+ /**
12
+ * check-compliance-coverage, import-framework and create-framework: whether a standard or a
13
+ * control topic is already in CCM, loading one of JupiterOne's prebuilt frameworks, and starting
14
+ * a customer's own.
15
+ */
16
+ /** Matched frameworks whose control counts a coverage check reads from the graph. */
17
+ const MAX_COVERAGE_FRAMEWORKS = 5;
18
+ const NEAREST_MAX = 10;
19
+ const LIBRARY_SOURCES = ['J1', 'UCF'];
20
+ /**
21
+ * Every control of a framework with its state, one row per test (a null `testId` for a control
22
+ * with none): the shape the summary's no-data read uses, 283 ms on j1dev's SOC 2 (2026-10-15).
23
+ */
24
+ function frameworkCountsQuery(frameworkId) {
25
+ return (`FIND ccm_control WITH frameworkId = '${frameworkId}' AS c ` +
26
+ '(THAT DEFINES ccm_control_test AS t)? ' +
27
+ `RETURN c.id AS controlId, c.state AS state, t.id AS testId LIMIT ${graph_js_1.GRAPH_PAGE_SIZE}`);
28
+ }
29
+ /**
30
+ * Controls whose name or identifier contains the topic, case-folded (`= /x/i`), one row per test.
31
+ * The topic is escaped as a regex body; the apps-api `controls({ searchText })` read it replaces
32
+ * took 13-54 s on dev (STATUS, 2026-10-15).
33
+ */
34
+ function topicQuery(topic) {
35
+ const pattern = (0, shared_js_1.j1qlRegex)(topic);
36
+ return (`FIND ccm_control WITH name = /${pattern}/i OR identifier = /${pattern}/i AS c ` +
37
+ '(THAT DEFINES ccm_control_test AS t)? ' +
38
+ 'RETURN c.id AS controlId, c.name AS name, c.identifier AS identifier, c.state AS state, ' +
39
+ `c.status AS status, c.frameworkId AS frameworkIds, t.id AS testId LIMIT ${graph_js_1.GRAPH_PAGE_SIZE}`);
40
+ }
41
+ function isDraftState(state) {
42
+ return state === 'DRAFT' || state === 'REVIEW';
43
+ }
44
+ function countsFromRows(rows) {
45
+ const controls = new Map();
46
+ for (const row of rows) {
47
+ const id = (0, graph_js_1.rowText)(row.controlId);
48
+ if (!id)
49
+ continue;
50
+ const control = controls.get(id) ?? { state: (0, graph_js_1.rowText)(row.state), tested: false };
51
+ if ((0, graph_js_1.rowText)(row.testId))
52
+ control.tested = true;
53
+ controls.set(id, control);
54
+ }
55
+ const counts = { total: 0, live: 0, draft: 0, liveWithTests: 0 };
56
+ for (const control of controls.values()) {
57
+ counts.total += 1;
58
+ if (control.state === 'LIVE') {
59
+ counts.live += 1;
60
+ if (control.tested)
61
+ counts.liveWithTests += 1;
62
+ }
63
+ else if (isDraftState(control.state)) {
64
+ counts.draft += 1;
65
+ }
66
+ }
67
+ return counts;
68
+ }
69
+ function topicControlsFromRows(rows) {
70
+ const controls = new Map();
71
+ for (const row of rows) {
72
+ const id = (0, graph_js_1.rowText)(row.controlId);
73
+ if (!id)
74
+ continue;
75
+ const control = controls.get(id) ?? {
76
+ id,
77
+ name: (0, graph_js_1.rowText)(row.name),
78
+ identifier: (0, graph_js_1.rowText)(row.identifier),
79
+ state: (0, graph_js_1.rowText)(row.state),
80
+ status: (0, graph_js_1.rowText)(row.status),
81
+ frameworkIds: (0, graph_js_1.rowIds)(row.frameworkIds),
82
+ testCount: 0,
83
+ };
84
+ if ((0, graph_js_1.rowText)(row.testId))
85
+ control.testCount += 1;
86
+ controls.set(id, control);
87
+ }
88
+ // LIVE controls with tests first: they are the reuse candidates that already count.
89
+ const rank = (control) => (control.state === 'LIVE' ? 0 : 2) + (control.testCount > 0 ? 0 : 1);
90
+ return [...controls.values()].sort((a, b) => rank(a) - rank(b));
91
+ }
92
+ function nextStepFor(verdict, draftCount, importable) {
93
+ switch (verdict) {
94
+ case 'covered':
95
+ return 'Answer from `list-controls` and `get-control`; nothing needs creating.';
96
+ case 'partial':
97
+ return (`${draftCount} matching control${draftCount === 1 ? ' is' : 's are'} DRAFT or REVIEW and ` +
98
+ 'count only once `transition-controls` promotes them; a control without tests needs ' +
99
+ '`create-control-test` or, once LIVE, `create-attestation`. Confirm with the user.');
100
+ case 'importable':
101
+ return ('Not loaded, but in the library: import with `import-framework` ' +
102
+ `{ "source": "${importable[0].source}", "sourceId": "${importable[0].sourceId}" }` +
103
+ ', after the user agrees.');
104
+ default:
105
+ return ('Nothing in CCM matches these words. Try other wording first; otherwise build it with ' +
106
+ '`create-framework`, `create-requirements`, `create-controls` and `create-control-test`.');
107
+ }
108
+ }
109
+ function libraryKey(source, sourceId) {
110
+ return `${source}:${sourceId}`;
111
+ }
112
+ /** Library entries whose name or id shares a word with the asked-for sourceId, for a refusal. */
113
+ function nearestLibrary(rows, sourceId) {
114
+ const tokens = (0, shared_js_1.foldName)(sourceId)
115
+ .split(/[^a-z0-9]+/)
116
+ .filter((token) => token.length > 2);
117
+ return rows
118
+ .filter((row) => tokens.some((token) => (0, shared_js_1.foldName)(row.sourceId).includes(token) || (0, shared_js_1.foldName)(row.name).includes(token)))
119
+ .slice(0, NEAREST_MAX)
120
+ .map((row) => ({ name: row.name, source: row.source, sourceId: row.sourceId }));
121
+ }
122
+ const NOTE_QUEUED = 'The backend runs the import as a job: the framework, its requirements, controls and tests ' +
123
+ 'appear once it completes, and the controls arrive DRAFT. A job that ends FAILED carries its ' +
124
+ 'reason in `importJobs[]` (the live-controls limit is checked by the job, not here).';
125
+ const NEXT_AFTER_IMPORT = 'Read `get-compliance-summary`: `importJobs[]` while it runs, then the framework and its ' +
126
+ '`importStatus`. Then `transition-controls` to promote the controls the user wants counted.';
127
+ const sourceInput = () => zod_1.z
128
+ .enum(LIBRARY_SOURCES)
129
+ .describe('The library the framework comes from: J1 (JupiterOne-authored) or UCF.');
130
+ exports.frameworkTools = [
131
+ (0, types_js_1.defineTool)({
132
+ name: 'check-compliance-coverage',
133
+ title: 'Check Compliance Coverage',
134
+ description: (0, load_description_js_1.loadDescription)('check-compliance-coverage.md'),
135
+ inputSchema: {
136
+ framework: zod_1.z
137
+ .string()
138
+ .trim()
139
+ .min(1)
140
+ .optional()
141
+ .describe('A standard\'s name or a fragment of it: "CIS AWS", "SOC 2", "PCI DSS 4".'),
142
+ topic: zod_1.z
143
+ .string()
144
+ .trim()
145
+ .min(1)
146
+ .optional()
147
+ .describe('A control subject: "MFA for console users", "S3 encryption", "CC6.1".'),
148
+ },
149
+ outputSchema: schemas_js_1.coverageOutput,
150
+ annotations: types_js_1.READ_ONLY,
151
+ accessDeniedHint: shared_js_1.ACCESS_DENIED_HINT,
152
+ errorContext: 'Error checking compliance coverage',
153
+ handler: async ({ framework, topic }, client, validator) => {
154
+ if (!framework && !topic) {
155
+ return (0, shared_js_1.validationError)("Pass at least one of `framework` (a standard's name) and `topic` (a control subject).");
156
+ }
157
+ const startedAt = Date.now();
158
+ const deadlineAt = startedAt + shared_js_1.AUTHORING_READ_DEADLINE_MS;
159
+ const timings = {};
160
+ const warnings = [];
161
+ const search = topic ? topicQuery(topic) : null;
162
+ if (search && !validator.validateQuery(search).isValid) {
163
+ return (0, shared_js_1.validationError)('`topic` holds characters the control search cannot match; use plain words.');
164
+ }
165
+ const subdomainRead = (0, shared_js_1.readSubdomain)(client, timings);
166
+ const frameworksRead = (0, shared_js_1.boundedRead)(timings, 'frameworks', () => client.listAllControlFrameworks(), deadlineAt);
167
+ const libraryRead = framework
168
+ ? (0, shared_js_1.timed)(timings, 'library', () => Promise.all(LIBRARY_SOURCES.map((source) => client.listImportableFrameworks(source, framework))).then((lists) => lists.flat()))
169
+ : Promise.resolve([]);
170
+ libraryRead.catch(() => undefined);
171
+ const topicRead = search
172
+ ? (0, shared_js_1.timed)(timings, 'topicSearch', () => (0, graph_js_1.runGraphQuery)(client, search, deadlineAt, 1))
173
+ : Promise.resolve({ kind: 'rows', rows: [], more: false });
174
+ const frameworkList = await frameworksRead;
175
+ // Every verdict depends on the loaded list: without it a loaded framework reads importable.
176
+ if (frameworkList === shared_js_1.DEADLINE_PASSED)
177
+ return (0, shared_js_1.readFailed)('The framework list', {});
178
+ const { frameworks, complete } = frameworkList;
179
+ const needle = (0, shared_js_1.foldName)(framework);
180
+ const matched = framework
181
+ ? frameworks.filter((entry) => !entry.deleted && (0, shared_js_1.foldName)(entry.name).includes(needle))
182
+ : [];
183
+ const countReads = matched
184
+ .slice(0, MAX_COVERAGE_FRAMEWORKS)
185
+ .map((entry) => graph_js_1.GRAPH_FRAMEWORK_ID.test(entry.id)
186
+ ? (0, graph_js_1.runGraphQuery)(client, frameworkCountsQuery(entry.id), deadlineAt, graph_js_1.GRAPH_MAX_PAGES)
187
+ : Promise.resolve({ kind: 'failed', error: new Error('uninterpolable id') }));
188
+ const [library, topicRows, counts, subdomain] = await Promise.all([
189
+ (0, shared_js_1.withDeadline)(libraryRead, deadlineAt).catch((error) => {
190
+ console.error('Error searching the framework library:', error);
191
+ return shared_js_1.DEADLINE_PASSED;
192
+ }),
193
+ topicRead,
194
+ Promise.all(countReads),
195
+ (0, shared_js_1.subdomainBy)(subdomainRead, deadlineAt),
196
+ ]);
197
+ if (library === shared_js_1.DEADLINE_PASSED) {
198
+ warnings.push('The framework library could not be searched; `importable` may be incomplete.');
199
+ }
200
+ if (topicRows.kind !== 'rows') {
201
+ if (topicRows.kind === 'failed')
202
+ console.error('Error searching controls:', topicRows.error);
203
+ warnings.push('The control search did not finish; `controls` may be incomplete.');
204
+ }
205
+ else if (topicRows.more) {
206
+ warnings.push('More controls match the topic than one page holds; narrow the words.');
207
+ }
208
+ if (!complete)
209
+ warnings.push('The framework list stopped at its page limit.');
210
+ const loaded = new Set(frameworks.map((entry) => libraryKey(entry.source, entry.sourceId)));
211
+ const importable = (library === shared_js_1.DEADLINE_PASSED ? [] : library)
212
+ .filter((row) => !loaded.has(libraryKey(row.source, row.sourceId)))
213
+ .map((row) => ({
214
+ name: row.name,
215
+ source: row.source,
216
+ sourceId: row.sourceId,
217
+ description: row.description,
218
+ }));
219
+ const names = new Map(frameworks.map((entry) => [entry.id, entry.name]));
220
+ const frameworkRows = matched.map((entry, index) => {
221
+ const read = counts[index];
222
+ if (read && read.kind !== 'rows') {
223
+ warnings.push(`The controls of "${entry.name}" could not be counted in time.`);
224
+ }
225
+ return {
226
+ id: entry.id,
227
+ name: entry.name,
228
+ source: entry.source,
229
+ sourceId: entry.sourceId,
230
+ url: (0, shared_js_1.frameworkUrl)(entry.id, subdomain),
231
+ controls: read && read.kind === 'rows' ? countsFromRows(read.rows) : null,
232
+ };
233
+ });
234
+ const topicControls = topicRows.kind === 'rows' ? topicControlsFromRows(topicRows.rows) : [];
235
+ const coveredByFramework = frameworkRows.some((row) => (row.controls?.liveWithTests ?? 0) > 0);
236
+ const coveredByTopic = topicControls.some((control) => control.state === 'LIVE' && control.testCount > 0);
237
+ const present = frameworkRows.length > 0 || topicControls.length > 0;
238
+ const verdict = coveredByFramework || coveredByTopic
239
+ ? 'covered'
240
+ : present
241
+ ? 'partial'
242
+ : importable.length > 0
243
+ ? 'importable'
244
+ : 'not_covered';
245
+ const draftCount = frameworkRows.reduce((sum, row) => sum + (row.controls?.draft ?? 0), 0) +
246
+ topicControls.filter((control) => isDraftState(control.state)).length;
247
+ return (0, result_js_1.structuredResult)({
248
+ outcome: 'ok',
249
+ verdict,
250
+ frameworks: frameworkRows,
251
+ controls: topicControls.slice(0, shared_js_1.MAX_CANDIDATES).map((control) => ({
252
+ ...control,
253
+ frameworkNames: control.frameworkIds.map((id) => names.get(id) ?? null),
254
+ url: (0, shared_js_1.controlUrl)(control.id, subdomain),
255
+ })),
256
+ importable,
257
+ draftCount,
258
+ frameworksComplete: complete,
259
+ nextStep: nextStepFor(verdict, draftCount, importable),
260
+ ...(warnings.length > 0 ? { warnings } : {}),
261
+ timingsMs: timings,
262
+ });
263
+ },
264
+ }),
265
+ (0, types_js_1.defineTool)({
266
+ name: 'import-framework',
267
+ title: 'Import Library Framework',
268
+ description: (0, load_description_js_1.loadDescription)('import-framework.md'),
269
+ inputSchema: {
270
+ source: sourceInput(),
271
+ sourceId: zod_1.z
272
+ .string()
273
+ .trim()
274
+ .min(1)
275
+ .describe('The library identifier, from `check-compliance-coverage` (`importable[].sourceId`).'),
276
+ resourceGroupId: zod_1.z
277
+ .string()
278
+ .trim()
279
+ .min(1)
280
+ .optional()
281
+ .describe('Optional resource group the framework is created in.'),
282
+ },
283
+ outputSchema: schemas_js_1.importFrameworkOutput,
284
+ annotations: types_js_1.CREATE,
285
+ accessDeniedHint: shared_js_1.ACCESS_DENIED_HINT,
286
+ errorContext: 'Error importing framework',
287
+ handler: async ({ source, sourceId, resourceGroupId }, client) => {
288
+ const startedAt = Date.now();
289
+ const readDeadline = startedAt + shared_js_1.AUTHORING_READ_DEADLINE_MS;
290
+ const timings = {};
291
+ const subdomainRead = (0, shared_js_1.readSubdomain)(client, timings);
292
+ const [frameworkList, library, jobs] = await Promise.all([
293
+ (0, shared_js_1.boundedRead)(timings, 'frameworks', () => client.listAllControlFrameworks(), readDeadline),
294
+ (0, shared_js_1.boundedRead)(timings, 'library', () => client.listImportableFrameworks(source), readDeadline),
295
+ (0, shared_js_1.boundedRead)(timings, 'jobs', () => client.listInProgressImportJobs(), readDeadline),
296
+ ]);
297
+ if (frameworkList === shared_js_1.DEADLINE_PASSED ||
298
+ library === shared_js_1.DEADLINE_PASSED ||
299
+ jobs === shared_js_1.DEADLINE_PASSED) {
300
+ return (0, shared_js_1.readFailed)('The framework list, library or import jobs', { source, sourceId });
301
+ }
302
+ const subdomain = await (0, shared_js_1.subdomainBy)(subdomainRead, readDeadline);
303
+ const loaded = frameworkList.frameworks.find((entry) => !entry.deleted && entry.source === source && entry.sourceId === sourceId);
304
+ // A list cut short cannot rule out a load of this framework, and queueing on it could
305
+ // import it twice (PR #59 review, 2026-10-30; create-framework refuses the same way).
306
+ if (!loaded && !frameworkList.complete) {
307
+ return (0, shared_js_1.refusal)('read_failed', 'The framework list was cut short, so a load of this framework cannot be ruled out; ' +
308
+ 'nothing was started. Call again.', { source, sourceId });
309
+ }
310
+ if (loaded) {
311
+ return (0, result_js_1.structuredResult)({
312
+ outcome: 'already_exists',
313
+ framework: {
314
+ id: loaded.id,
315
+ name: loaded.name,
316
+ source: loaded.source,
317
+ sourceId: loaded.sourceId,
318
+ url: (0, shared_js_1.frameworkUrl)(loaded.id, subdomain),
319
+ },
320
+ note: 'This framework is already loaded, so nothing was started; a repeat is harmless.',
321
+ nextStep: NEXT_AFTER_IMPORT,
322
+ timingsMs: timings,
323
+ });
324
+ }
325
+ // The job list holds deletes too; a delete in flight is not an import to wait for (PR #59
326
+ // review).
327
+ const running = jobs.find((job) => job.sourceId === sourceId && job.status === 'IN_PROGRESS' && job.type !== 'DELETE');
328
+ if (running) {
329
+ return (0, result_js_1.structuredResult)({
330
+ outcome: 'import_in_progress',
331
+ job: (0, shared_js_1.projectImportJob)(running),
332
+ note: 'An import of this framework is already running, so nothing was started.',
333
+ nextStep: NEXT_AFTER_IMPORT,
334
+ timingsMs: timings,
335
+ });
336
+ }
337
+ const row = library.find((entry) => entry.sourceId === sourceId);
338
+ if (!row) {
339
+ return (0, shared_js_1.refusal)('not_importable', 'Framework not imported — no library entry of this source has this sourceId. ' +
340
+ '`structuredContent.nearest` lists the closest library entries; ' +
341
+ '`check-compliance-coverage` finds them by name.', { source, sourceId, nearest: nearestLibrary(library, sourceId) });
342
+ }
343
+ try {
344
+ await (0, shared_js_1.timed)(timings, 'import', () => client.importFramework({ name: row.name, source, sourceId, resourceGroupId }));
345
+ }
346
+ catch (error) {
347
+ if ((0, shared_js_1.isAborted)(error)) {
348
+ return (0, shared_js_1.interruptedWrite)('the framework import was being queued', 'Read `importJobs[]` and the `frameworks` list on `get-compliance-summary` before ' +
349
+ 'importing again.');
350
+ }
351
+ throw error;
352
+ }
353
+ // The job list a few seconds after the queue, bounded so a slow read never turns a
354
+ // queued import into an error.
355
+ const after = await (0, shared_js_1.withDeadline)(client.listInProgressImportJobs().catch((error) => {
356
+ console.error('Error reading import jobs after queueing an import:', error);
357
+ return [];
358
+ }), Math.min(startedAt + 45_000, Date.now() + 5_000));
359
+ const job = after === shared_js_1.DEADLINE_PASSED
360
+ ? null
361
+ : (after.find((entry) => entry.sourceId === sourceId) ?? null);
362
+ return (0, result_js_1.structuredResult)({
363
+ outcome: 'queued',
364
+ framework: { name: row.name, source, sourceId },
365
+ job: job ? (0, shared_js_1.projectImportJob)(job) : null,
366
+ note: NOTE_QUEUED,
367
+ nextStep: NEXT_AFTER_IMPORT,
368
+ timingsMs: timings,
369
+ });
370
+ },
371
+ }),
372
+ (0, types_js_1.defineTool)({
373
+ name: 'create-framework',
374
+ title: 'Create Framework',
375
+ description: (0, load_description_js_1.loadDescription)('create-framework.md'),
376
+ inputSchema: {
377
+ title: zod_1.z.string().trim().min(1).describe("The program's name as the customer calls it."),
378
+ description: zod_1.z.string().trim().min(1).describe('What the program covers.'),
379
+ owner: (0, shared_js_1.ownerEmail)().optional().describe("Optional email address of the framework's owner."),
380
+ resourceGroupId: zod_1.z
381
+ .string()
382
+ .trim()
383
+ .min(1)
384
+ .optional()
385
+ .describe('Optional resource group the framework is created in.'),
386
+ },
387
+ outputSchema: schemas_js_1.createFrameworkOutput,
388
+ annotations: types_js_1.CREATE,
389
+ accessDeniedHint: shared_js_1.ACCESS_DENIED_HINT,
390
+ errorContext: 'Error creating framework',
391
+ handler: async ({ title: name, description, owner, resourceGroupId }, client) => {
392
+ const startedAt = Date.now();
393
+ const timings = {};
394
+ const subdomainRead = (0, shared_js_1.readSubdomain)(client, timings);
395
+ const readDeadline = startedAt + shared_js_1.AUTHORING_READ_DEADLINE_MS;
396
+ const frameworkList = await (0, shared_js_1.boundedRead)(timings, 'frameworks', () => client.listAllControlFrameworks(), readDeadline);
397
+ // Unbounded, this read spent the whole 55 s on dev before any create (2026-10-29).
398
+ if (frameworkList === shared_js_1.DEADLINE_PASSED)
399
+ return (0, shared_js_1.readFailed)('The framework list', {});
400
+ const { frameworks, complete } = frameworkList;
401
+ const subdomain = await (0, shared_js_1.subdomainBy)(subdomainRead, readDeadline);
402
+ const existing = frameworks.find((entry) => !entry.deleted && (0, shared_js_1.foldName)(entry.name) === (0, shared_js_1.foldName)(name));
403
+ // A list cut short cannot rule out a framework with this title, and creating on it could
404
+ // make a second one (PR #59 review).
405
+ if (!existing && !complete) {
406
+ return (0, shared_js_1.refusal)('read_failed', 'The framework list was cut short, so a framework with this title cannot be ruled ' +
407
+ 'out; nothing was created. Call again.', {});
408
+ }
409
+ if (existing) {
410
+ return (0, result_js_1.structuredResult)({
411
+ outcome: 'already_exists',
412
+ framework: {
413
+ id: existing.id,
414
+ name: existing.name,
415
+ url: (0, shared_js_1.frameworkUrl)(existing.id, subdomain),
416
+ },
417
+ note: 'A framework with this name exists, so nothing was created. Continue with its id, ' +
418
+ 'or choose another name if the user wants a second program.',
419
+ nextStep: `\`create-requirements\` with frameworkId ${existing.id}, one batch per section.`,
420
+ timingsMs: timings,
421
+ });
422
+ }
423
+ let created;
424
+ try {
425
+ created = await (0, shared_js_1.timed)(timings, 'create', () => client.createFramework({ title: name, description, owner, resourceGroupId }));
426
+ }
427
+ catch (error) {
428
+ if ((0, shared_js_1.isAborted)(error)) {
429
+ return (0, shared_js_1.interruptedWrite)('the framework was being created', 'The framework list lags a create by up to a minute, so wait a minute, then read the ' +
430
+ '`frameworks` list on `get-compliance-summary` before creating again; the same ' +
431
+ 'title then comes back `already_exists` if it landed.');
432
+ }
433
+ throw error;
434
+ }
435
+ return (0, result_js_1.structuredResult)({
436
+ outcome: 'created',
437
+ framework: { id: created.id, name: created.name, url: (0, shared_js_1.frameworkUrl)(created.id, subdomain) },
438
+ nextStep: 'Show the user the sections and requirements you propose, then `create-requirements` ' +
439
+ 'with this `frameworkId`, one batch per section.',
440
+ timingsMs: timings,
441
+ });
442
+ },
443
+ }),
444
+ ];
445
+ //# sourceMappingURL=framework.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework.js","sourceRoot":"","sources":["../../../../src/server/tools/compliance/framework.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAMxB,4EAAqE;AACrE,4CAAgD;AAChD,0CAAiF;AACjF,yCAQoB;AACpB,6CAA4F;AAC5F,2CAsBqB;AAErB;;;;GAIG;AAEH,qFAAqF;AACrF,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAClC,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,KAAK,CAAU,CAAC;AAE/C;;;GAGG;AACH,SAAS,oBAAoB,CAAC,WAAmB;IAC/C,OAAO,CACL,wCAAwC,WAAW,SAAS;QAC5D,wCAAwC;QACxC,oEAAoE,0BAAe,EAAE,CACtF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,KAAa;IAC/B,MAAM,OAAO,GAAG,IAAA,qBAAS,EAAC,KAAK,CAAC,CAAC;IACjC,OAAO,CACL,iCAAiC,OAAO,uBAAuB,O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1
+ import type { JupiterOneClient } from '../../../client/jupiterone-client.js';
2
+ /**
3
+ * Graph reads the compliance tools share: the summary's drill, and the authoring tools' lookups,
4
+ * dedup reads and selections. On j1dev the graph answers in tens of milliseconds where the
5
+ * apps-api `controls` query takes 13-54 s (2026-10-15, 2026-10-28), so every read that selects
6
+ * or dedups comes from here and the API is called only to write.
7
+ */
8
+ /**
9
+ * Rows per page of a graph query. The query service refuses a larger LIMIT: on ECS 186 both drill
10
+ * queries at LIMIT 1000 failed with `"limit" must be a value between 1 and 250`, and every drill
11
+ * fell back to the API (2026-10-15).
12
+ */
13
+ export declare const GRAPH_PAGE_SIZE = 250;
14
+ /** Pages a drill query follows its cursor through: up to 1,000 rows. Past it, it is cut short. */
15
+ export declare const GRAPH_MAX_PAGES = 4;
16
+ /** A graph query's rows, or why there are none: it ran out of time, or it failed. */
17
+ export type GraphRead = {
18
+ kind: 'rows';
19
+ rows: Array<Record<string, unknown>>;
20
+ more: boolean;
21
+ } | {
22
+ kind: 'timeout';
23
+ } | {
24
+ kind: 'failed';
25
+ error: unknown;
26
+ };
27
+ /**
28
+ * A graph query's rows over up to `maxPages` pages of its cursor, every page inside `deadlineAt`.
29
+ * `more` says the rows may be cut short: a cursor left after the last page, or a later page that
30
+ * ran out of time. The cursor is the only "more" signal: a live probe showed a full 250-row page
31
+ * under `LIMIT 250` carries a cursor when more remain, and a page can come back short while more
32
+ * do. A first page that runs out of time is a timeout, and a failed page fails the read.
33
+ *
34
+ * `fresh` bypasses query-service's 5-minute result cache, which otherwise answers an identical
35
+ * query with what it read the first time. Every read a write is decided on sets it: a dedup, a
36
+ * link check or a selection that read its answer from before its own writes made duplicates
37
+ * (j1dev, 2026-10-30: an identical create-controls batch 5 s later created a second control).
38
+ * Display reads keep the cache; each fresh read is one more query-service execution.
39
+ */
40
+ export declare function runGraphQuery(client: JupiterOneClient, query: string, deadlineAt: number, maxPages?: number, { fresh }?: {
41
+ fresh?: boolean;
42
+ }): Promise<GraphRead>;
43
+ /** A framework id the graph queries may interpolate: a UUID, or `ccm_f_` and a slug. */
44
+ export declare const GRAPH_FRAMEWORK_ID: RegExp;
45
+ /** A requirement id the graph queries may interpolate: a UUID, or `ccm_r_` and a slug. */
46
+ export declare const GRAPH_REQUIREMENT_ID: RegExp;
47
+ /**
48
+ * A framework's requirements with the keys a listing shows and a batch dedups on. One read serves
49
+ * create-requirements' dedup and the summary's `includeRequirements`.
50
+ */
51
+ export declare function frameworkRequirementsQuery(frameworkId: string): string;
52
+ /** A row column as text, or null when it is not a non-empty string. */
53
+ export declare function rowText(value: unknown): string | null;
54
+ /** A row column that the graph stores as a string or a list of strings, as a list. */
55
+ export declare function rowIds(value: unknown): string[];
56
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../../src/server/tools/compliance/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAI7E;;;;;GAKG;AAEH;;;;GAIG;AACH,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,kGAAkG;AAClG,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,qFAAqF;AACrF,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GACrE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAwDvC;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,QAAQ,SAAI,EACZ,EAAE,KAAa,EAAE,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAC1C,OAAO,CAAC,SAAS,CAAC,CAYpB;AAED,wFAAwF;AACxF,eAAO,MAAM,kBAAkB,QAC6D,CAAC;AAC7F,0FAA0F;AAC1F,eAAO,MAAM,oBAAoB,QAC2D,CAAC;AAE7F;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAMtE;AAED,uEAAuE;AACvE,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAErD;AAED,sFAAsF;AACtF,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAK/C"}