monora-ai 2.0.0 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +441 -150
- package/dist/aims_governance.d.ts +238 -0
- package/dist/aims_governance.d.ts.map +1 -0
- package/dist/aims_governance.js +922 -0
- package/dist/alerts.d.ts +16 -0
- package/dist/alerts.d.ts.map +1 -1
- package/dist/alerts.js +16 -0
- package/dist/api.d.ts +6 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +6 -0
- package/dist/assessment.d.ts +269 -0
- package/dist/assessment.d.ts.map +1 -0
- package/dist/assessment.js +1232 -0
- package/dist/attestation.js +23 -1
- package/dist/attribution.d.ts +349 -0
- package/dist/attribution.d.ts.map +1 -0
- package/dist/attribution.js +987 -0
- package/dist/autodetect.d.ts +69 -1
- package/dist/autodetect.d.ts.map +1 -1
- package/dist/autodetect.js +644 -1
- package/dist/bias.d.ts +130 -0
- package/dist/bias.d.ts.map +1 -0
- package/dist/bias.js +223 -0
- package/dist/circuit_breaker.js +3 -3
- package/dist/cli/diagnostics.d.ts +5 -1
- package/dist/cli/diagnostics.d.ts.map +1 -1
- package/dist/cli/diagnostics.js +31 -8
- package/dist/cli/doctor.d.ts +25 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +381 -0
- package/dist/cli/fix.d.ts +16 -0
- package/dist/cli/fix.d.ts.map +1 -0
- package/dist/cli/fix.js +284 -0
- package/dist/cli/init.d.ts +57 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +205 -0
- package/dist/cli.js +1611 -126
- package/dist/complianceTargets.d.ts +111 -0
- package/dist/complianceTargets.d.ts.map +1 -0
- package/dist/complianceTargets.js +521 -0
- package/dist/config.d.ts +301 -17
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +428 -36
- package/dist/config_migrations.d.ts +41 -0
- package/dist/config_migrations.d.ts.map +1 -1
- package/dist/config_migrations.js +205 -0
- package/dist/config_schema.d.ts +2900 -731
- package/dist/config_schema.d.ts.map +1 -1
- package/dist/config_schema.js +257 -55
- package/dist/context.d.ts +34 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +118 -7
- package/dist/control_backbone.d.ts +122 -0
- package/dist/control_backbone.d.ts.map +1 -0
- package/dist/control_backbone.js +698 -0
- package/dist/data-governance.d.ts +187 -0
- package/dist/data-governance.d.ts.map +1 -0
- package/dist/data-governance.js +424 -0
- package/dist/dataResidency.d.ts +44 -0
- package/dist/dataResidency.d.ts.map +1 -0
- package/dist/dataResidency.js +203 -0
- package/dist/dispatcher.d.ts +32 -0
- package/dist/dispatcher.d.ts.map +1 -1
- package/dist/dispatcher.js +91 -4
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +38 -0
- package/dist/evidence_store.d.ts +103 -0
- package/dist/evidence_store.d.ts.map +1 -0
- package/dist/evidence_store.js +459 -0
- package/dist/executiveSummary.d.ts +65 -8
- package/dist/executiveSummary.d.ts.map +1 -1
- package/dist/executiveSummary.js +289 -26
- package/dist/identity.d.ts +143 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +231 -0
- package/dist/impact-assessment.d.ts +350 -0
- package/dist/impact-assessment.d.ts.map +1 -0
- package/dist/impact-assessment.js +580 -0
- package/dist/index.d.ts +25 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +300 -4
- package/dist/instrumentation.d.ts +1 -1
- package/dist/instrumentation.d.ts.map +1 -1
- package/dist/instrumentation.js +243 -27
- package/dist/integrations/anthropic.d.ts +3 -0
- package/dist/integrations/anthropic.d.ts.map +1 -1
- package/dist/integrations/anthropic.js +284 -79
- package/dist/integrations/governance.d.ts +33 -0
- package/dist/integrations/governance.d.ts.map +1 -0
- package/dist/integrations/governance.js +208 -0
- package/dist/integrations/langchain.d.ts +7 -0
- package/dist/integrations/langchain.d.ts.map +1 -1
- package/dist/integrations/langchain.js +387 -143
- package/dist/integrations/openai.d.ts +9 -0
- package/dist/integrations/openai.d.ts.map +1 -1
- package/dist/integrations/openai.js +673 -73
- package/dist/iso42001_consolidation.d.ts +16 -0
- package/dist/iso42001_consolidation.d.ts.map +1 -0
- package/dist/iso42001_consolidation.js +413 -0
- package/dist/iso42001_workflows.d.ts +263 -0
- package/dist/iso42001_workflows.d.ts.map +1 -0
- package/dist/iso42001_workflows.js +781 -0
- package/dist/lifecycle.d.ts +299 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +624 -0
- package/dist/lineage.d.ts +2 -2
- package/dist/lineage.d.ts.map +1 -1
- package/dist/lineage.js +12 -17
- package/dist/middleware/express.d.ts.map +1 -1
- package/dist/middleware/express.js +33 -3
- package/dist/middleware/nextjs.d.ts.map +1 -1
- package/dist/middleware/nextjs.js +42 -68
- package/dist/model.d.ts +143 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +371 -0
- package/dist/onboarding.d.ts +42 -0
- package/dist/onboarding.d.ts.map +1 -0
- package/dist/onboarding.js +1022 -0
- package/dist/oversight.d.ts +264 -0
- package/dist/oversight.d.ts.map +1 -0
- package/dist/oversight.js +497 -0
- package/dist/pdf_report.d.ts.map +1 -1
- package/dist/pdf_report.js +42 -21
- package/dist/presets.d.ts +88 -0
- package/dist/presets.d.ts.map +1 -0
- package/dist/presets.js +520 -0
- package/dist/propagation.d.ts.map +1 -1
- package/dist/propagation.js +34 -2
- package/dist/quotas.d.ts +171 -0
- package/dist/quotas.d.ts.map +1 -0
- package/dist/quotas.js +259 -0
- package/dist/register.d.ts +13 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +99 -0
- package/dist/registry.d.ts +1 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +7 -0
- package/dist/registryData.json +43 -6
- package/dist/report.d.ts +2 -1
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +189 -2
- package/dist/reporting.d.ts +125 -0
- package/dist/reporting.d.ts.map +1 -1
- package/dist/reporting.js +196 -5
- package/dist/resources.d.ts +285 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +643 -0
- package/dist/risk.d.ts +120 -0
- package/dist/risk.d.ts.map +1 -0
- package/dist/risk.js +220 -0
- package/dist/runtime.d.ts +74 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +598 -22
- package/dist/schemaInference.d.ts +92 -0
- package/dist/schemaInference.d.ts.map +1 -0
- package/dist/schemaInference.js +466 -0
- package/dist/schema_validation.js +2 -2
- package/dist/schemas/config.schema.json +169 -6
- package/dist/schemas/event.schema.json +4 -0
- package/dist/security_report.js +4 -4
- package/dist/signing.d.ts +1 -1
- package/dist/signing.d.ts.map +1 -1
- package/dist/signing.js +4 -0
- package/dist/sinks/file.d.ts +19 -1
- package/dist/sinks/file.d.ts.map +1 -1
- package/dist/sinks/file.js +82 -13
- package/dist/sinks/https.d.ts +10 -0
- package/dist/sinks/https.d.ts.map +1 -1
- package/dist/sinks/https.js +76 -16
- package/dist/sinks/stdout.d.ts +1 -0
- package/dist/sinks/stdout.d.ts.map +1 -1
- package/dist/sinks/stdout.js +12 -1
- package/dist/spec.d.ts +159 -0
- package/dist/spec.d.ts.map +1 -0
- package/dist/spec.js +391 -0
- package/dist/stakeholders.d.ts +199 -0
- package/dist/stakeholders.d.ts.map +1 -0
- package/dist/stakeholders.js +398 -0
- package/dist/standards.d.ts.map +1 -1
- package/dist/standards.js +160 -2
- package/dist/standards_ingest.d.ts +2 -2
- package/dist/standards_ingest.d.ts.map +1 -1
- package/dist/standards_ingest.js +105 -23
- package/dist/streaming.d.ts.map +1 -1
- package/dist/streaming.js +7 -2
- package/dist/telemetry.d.ts +16 -2
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +79 -14
- package/dist/templates/controls/iso42001_control_catalog.json +1443 -0
- package/dist/traced_emitter.d.ts +3 -0
- package/dist/traced_emitter.d.ts.map +1 -1
- package/dist/traced_emitter.js +142 -25
- package/dist/trust_package.d.ts +21 -1
- package/dist/trust_package.d.ts.map +1 -1
- package/dist/trust_package.js +101 -4
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +9 -2
- package/dist/wal.d.ts.map +1 -1
- package/dist/wal.js +2 -1
- package/package.json +14 -1
- package/scripts/postinstall.js +119 -97
- package/templates/controls/iso42001_control_catalog.json +1443 -0
package/dist/alerts.d.ts
CHANGED
|
@@ -4,6 +4,22 @@
|
|
|
4
4
|
export declare class AlertError extends Error {
|
|
5
5
|
constructor(message: string);
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Build a standardized violation alert payload.
|
|
9
|
+
*
|
|
10
|
+
* @param event - The event object containing violation details.
|
|
11
|
+
* @returns Standardized payload object for webhook dispatch.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Cross-SDK Parity: Both Python and Node.js produce identical output payloads
|
|
15
|
+
* with fields: event_type, policy_event_type, model, tool_name, policy_name,
|
|
16
|
+
* message, timestamp, data_classification, rule_names, trace_id, span_id,
|
|
17
|
+
* parent_span_id, service_name, environment.
|
|
18
|
+
*
|
|
19
|
+
* Input signature differs by language idiom:
|
|
20
|
+
* - Node.js: `buildViolationPayload(event)` where event contains all fields
|
|
21
|
+
* - Python: `build_violation_payload(violation=v, trace_id=t, ...)` with explicit params
|
|
22
|
+
*/
|
|
7
23
|
export declare function buildViolationPayload(event: Record<string, any>): Record<string, any>;
|
|
8
24
|
export declare class ViolationWebhookDispatcher {
|
|
9
25
|
private endpoint;
|
package/dist/alerts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../src/alerts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,qBAAa,UAAW,SAAQ,KAAK;gBACvB,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,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18
18
|
}
|
|
19
19
|
exports.AlertError = AlertError;
|
|
20
|
+
/**
|
|
21
|
+
* Build a standardized violation alert payload.
|
|
22
|
+
*
|
|
23
|
+
* @param event - The event object containing violation details.
|
|
24
|
+
* @returns Standardized payload object for webhook dispatch.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* Cross-SDK Parity: Both Python and Node.js produce identical output payloads
|
|
28
|
+
* with fields: event_type, policy_event_type, model, tool_name, policy_name,
|
|
29
|
+
* message, timestamp, data_classification, rule_names, trace_id, span_id,
|
|
30
|
+
* parent_span_id, service_name, environment.
|
|
31
|
+
*
|
|
32
|
+
* Input signature differs by language idiom:
|
|
33
|
+
* - Node.js: `buildViolationPayload(event)` where event contains all fields
|
|
34
|
+
* - Python: `build_violation_payload(violation=v, trace_id=t, ...)` with explicit params
|
|
35
|
+
*/
|
|
20
36
|
function buildViolationPayload(event) {
|
|
21
37
|
const body = event.body || {};
|
|
22
38
|
return {
|
package/dist/api.d.ts
CHANGED
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
* }
|
|
33
33
|
* );
|
|
34
34
|
* ```
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* Cross-SDK Parity: Node.js uses separate objects for call arguments and governance
|
|
38
|
+
* options, while Python uses kwargs for both. This is an intentional language difference:
|
|
39
|
+
* - Node.js: `callLlm(fn, {model, messages}, {purpose})`
|
|
40
|
+
* - Python: `call_llm(fn, model="gpt-4", messages=[...], purpose="SUPPORT")`
|
|
35
41
|
*/
|
|
36
42
|
export declare function callLlm<T>(callFn: (...args: any[]) => T | Promise<T>, callArgs: Record<string, any> | any[] | undefined, options: {
|
|
37
43
|
model?: string;
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","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AC,CAAC,CAAC,EAC1C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,SAAS,EACjD,OAAO,EAAE;IACP,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB,GACA,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAShB"}
|
package/dist/api.js
CHANGED
|
@@ -38,6 +38,12 @@ const runtime_1 = require("./runtime");
|
|
|
38
38
|
* }
|
|
39
39
|
* );
|
|
40
40
|
* ```
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* Cross-SDK Parity: Node.js uses separate objects for call arguments and governance
|
|
44
|
+
* options, while Python uses kwargs for both. This is an intentional language difference:
|
|
45
|
+
* - Node.js: `callLlm(fn, {model, messages}, {purpose})`
|
|
46
|
+
* - Python: `call_llm(fn, model="gpt-4", messages=[...], purpose="SUPPORT")`
|
|
41
47
|
*/
|
|
42
48
|
function callLlm(callFn, callArgs, options) {
|
|
43
49
|
const args = normalizeArgs(callArgs);
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compliance assessment and certification support for Monora SDK.
|
|
3
|
+
*
|
|
4
|
+
* This module provides tools for running compliance checks and generating
|
|
5
|
+
* assessment reports for ISO 42001, SOC 2, GDPR, and other frameworks.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { runComplianceCheck, reportUsageProfile } from 'monora-ai';
|
|
10
|
+
*
|
|
11
|
+
* // Run compliance check before audit
|
|
12
|
+
* const result = await runComplianceCheck({
|
|
13
|
+
* eventsPath: './monora_events.jsonl',
|
|
14
|
+
* configPath: './monora.yml',
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // Report usage profile
|
|
18
|
+
* const profile = reportUsageProfile();
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
import { MonoraConfig } from './config';
|
|
22
|
+
/**
|
|
23
|
+
* Individual compliance check result.
|
|
24
|
+
*/
|
|
25
|
+
export interface ComplianceCheck {
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
passed: boolean;
|
|
29
|
+
category: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Result of a compliance check.
|
|
33
|
+
*/
|
|
34
|
+
export interface ComplianceCheckResult {
|
|
35
|
+
passed: boolean;
|
|
36
|
+
score: number;
|
|
37
|
+
grade: string;
|
|
38
|
+
scoreBreakdown?: ComplianceScoreBreakdown;
|
|
39
|
+
checks: ComplianceCheck[];
|
|
40
|
+
warnings: string[];
|
|
41
|
+
errors: string[];
|
|
42
|
+
recommendations: string[];
|
|
43
|
+
frameworksAssessed: string[];
|
|
44
|
+
assessedAt: string;
|
|
45
|
+
sdkVersion: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ComplianceScoreBreakdown {
|
|
48
|
+
method: 'weighted_categories';
|
|
49
|
+
frameworks: string[];
|
|
50
|
+
categoryWeights: Record<string, number>;
|
|
51
|
+
categoryTotals: Record<string, number>;
|
|
52
|
+
categoryPassed: Record<string, number>;
|
|
53
|
+
weightedPassed: number;
|
|
54
|
+
weightedTotal: number;
|
|
55
|
+
rawPassed: number;
|
|
56
|
+
rawTotal: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Usage profile for certification/assessment.
|
|
60
|
+
*/
|
|
61
|
+
export interface UsageProfile {
|
|
62
|
+
sdkVersion: string;
|
|
63
|
+
featuresEnabled: string[];
|
|
64
|
+
featuresUsed: string[];
|
|
65
|
+
configSummary: Record<string, any>;
|
|
66
|
+
auditMetadata?: Record<string, any>;
|
|
67
|
+
registration?: Record<string, any>;
|
|
68
|
+
environment: string;
|
|
69
|
+
generatedAt: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Compliance check options.
|
|
73
|
+
*/
|
|
74
|
+
export interface ComplianceCheckOptions {
|
|
75
|
+
/** Path to events JSONL file */
|
|
76
|
+
eventsPath?: string;
|
|
77
|
+
/** Path to configuration file */
|
|
78
|
+
configPath?: string;
|
|
79
|
+
/** Configuration object */
|
|
80
|
+
config?: Partial<MonoraConfig>;
|
|
81
|
+
/** Specific frameworks to check */
|
|
82
|
+
frameworks?: string[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Compliance check callback.
|
|
86
|
+
*/
|
|
87
|
+
export type ComplianceCheckCallback = (result: ComplianceCheckResult) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Run compliance checks for AI safety and governance.
|
|
90
|
+
*
|
|
91
|
+
* This function runs a series of checks to assess compliance with
|
|
92
|
+
* various frameworks like SOC 2, GDPR, ISO 27001, and ISO 42001.
|
|
93
|
+
*
|
|
94
|
+
* @param options - Check options.
|
|
95
|
+
* @returns ComplianceCheckResult with pass/fail status and details.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* const result = await runComplianceCheck({
|
|
100
|
+
* eventsPath: './monora_events.jsonl',
|
|
101
|
+
* configPath: './monora.yml',
|
|
102
|
+
* frameworks: ['SOC2', 'ISO42001'],
|
|
103
|
+
* });
|
|
104
|
+
*
|
|
105
|
+
* if (result.passed) {
|
|
106
|
+
* console.log(`Compliance score: ${result.score}`);
|
|
107
|
+
* }
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export declare function runComplianceCheck(options?: ComplianceCheckOptions): Promise<ComplianceCheckResult>;
|
|
111
|
+
/**
|
|
112
|
+
* Usage profile options.
|
|
113
|
+
*/
|
|
114
|
+
export interface UsageProfileOptions {
|
|
115
|
+
/** Current configuration */
|
|
116
|
+
config?: Partial<MonoraConfig>;
|
|
117
|
+
/** Deployment environment */
|
|
118
|
+
environment?: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Report current usage profile for certification/assessment.
|
|
122
|
+
*
|
|
123
|
+
* This generates a summary of SDK usage that can be used for
|
|
124
|
+
* certification processes like ISO 42001.
|
|
125
|
+
*
|
|
126
|
+
* @param options - Profile options.
|
|
127
|
+
* @returns UsageProfile object.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* const profile = reportUsageProfile();
|
|
132
|
+
* console.log(profile.featuresUsed);
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export declare function reportUsageProfile(options?: UsageProfileOptions): UsageProfile;
|
|
136
|
+
/**
|
|
137
|
+
* Register a callback for compliance check events.
|
|
138
|
+
*
|
|
139
|
+
* @param callback - Function called with check result.
|
|
140
|
+
* @returns Unsubscribe function.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* const unsubscribe = onComplianceCheck((result) => {
|
|
145
|
+
* if (!result.passed) {
|
|
146
|
+
* sendAlert('Compliance check failed!');
|
|
147
|
+
* }
|
|
148
|
+
* });
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export declare function onComplianceCheck(callback: ComplianceCheckCallback): () => void;
|
|
152
|
+
/**
|
|
153
|
+
* Assessment report options.
|
|
154
|
+
*/
|
|
155
|
+
export interface AssessmentReportOptions {
|
|
156
|
+
/** Path to events JSONL file */
|
|
157
|
+
eventsPath?: string;
|
|
158
|
+
/** Path to configuration file */
|
|
159
|
+
configPath?: string;
|
|
160
|
+
/** Optional path to write report */
|
|
161
|
+
outputPath?: string;
|
|
162
|
+
/** Specific frameworks to assess */
|
|
163
|
+
frameworks?: string[];
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Generate a comprehensive assessment report.
|
|
167
|
+
*
|
|
168
|
+
* This combines compliance checks, usage profile, and audit metadata
|
|
169
|
+
* into a single report suitable for certification processes.
|
|
170
|
+
*
|
|
171
|
+
* @param options - Report options.
|
|
172
|
+
* @returns Assessment report object.
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```typescript
|
|
176
|
+
* const report = await generateAssessmentReport({
|
|
177
|
+
* eventsPath: './monora_events.jsonl',
|
|
178
|
+
* configPath: './monora.yml',
|
|
179
|
+
* outputPath: './assessment_report.json',
|
|
180
|
+
* });
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
/**
|
|
184
|
+
* Priority level for remediation items.
|
|
185
|
+
*/
|
|
186
|
+
export type RemediationPriority = 'critical' | 'high' | 'medium' | 'low';
|
|
187
|
+
/**
|
|
188
|
+
* Effort estimate for remediation items.
|
|
189
|
+
*/
|
|
190
|
+
export type RemediationEffort = 'minimal' | 'low' | 'medium' | 'high';
|
|
191
|
+
/**
|
|
192
|
+
* Individual remediation item.
|
|
193
|
+
*/
|
|
194
|
+
export interface RemediationItem {
|
|
195
|
+
/** Unique identifier for the issue */
|
|
196
|
+
id: string;
|
|
197
|
+
/** Human-readable title */
|
|
198
|
+
title: string;
|
|
199
|
+
/** Detailed description of the issue */
|
|
200
|
+
description: string;
|
|
201
|
+
/** Category of the compliance check */
|
|
202
|
+
category: string;
|
|
203
|
+
/** Priority level for fixing */
|
|
204
|
+
priority: RemediationPriority;
|
|
205
|
+
/** Estimated effort to fix */
|
|
206
|
+
effort: RemediationEffort;
|
|
207
|
+
/** Specific fix instructions */
|
|
208
|
+
fix: string;
|
|
209
|
+
/** Compliance frameworks affected */
|
|
210
|
+
frameworks: string[];
|
|
211
|
+
/** Event IDs that provide evidence (if applicable) */
|
|
212
|
+
evidenceEventIds?: string[];
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Remediation plan result.
|
|
216
|
+
*/
|
|
217
|
+
export interface RemediationPlan {
|
|
218
|
+
/** Overall summary */
|
|
219
|
+
summary: {
|
|
220
|
+
totalIssues: number;
|
|
221
|
+
criticalCount: number;
|
|
222
|
+
highCount: number;
|
|
223
|
+
mediumCount: number;
|
|
224
|
+
lowCount: number;
|
|
225
|
+
estimatedEffort: string;
|
|
226
|
+
};
|
|
227
|
+
/** Grouped issues by priority */
|
|
228
|
+
issuesByPriority: {
|
|
229
|
+
critical: RemediationItem[];
|
|
230
|
+
high: RemediationItem[];
|
|
231
|
+
medium: RemediationItem[];
|
|
232
|
+
low: RemediationItem[];
|
|
233
|
+
};
|
|
234
|
+
/** Grouped issues by category */
|
|
235
|
+
issuesByCategory: Record<string, RemediationItem[]>;
|
|
236
|
+
/** Ordered list of fixes (recommended order) */
|
|
237
|
+
orderedFixes: RemediationItem[];
|
|
238
|
+
/** Generated timestamp */
|
|
239
|
+
generatedAt: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Generate a remediation plan from compliance check results.
|
|
243
|
+
*
|
|
244
|
+
* This function analyzes failed compliance checks and generates an
|
|
245
|
+
* actionable remediation plan with prioritized fixes.
|
|
246
|
+
*
|
|
247
|
+
* @param result - Compliance check result from runComplianceCheck().
|
|
248
|
+
* @returns RemediationPlan with prioritized fixes.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```typescript
|
|
252
|
+
* const checkResult = await runComplianceCheck({
|
|
253
|
+
* configPath: './monora.yml',
|
|
254
|
+
* frameworks: ['SOC2', 'GDPR'],
|
|
255
|
+
* });
|
|
256
|
+
*
|
|
257
|
+
* const plan = generateRemediationPlan(checkResult);
|
|
258
|
+
*
|
|
259
|
+
* console.log(`Total issues: ${plan.summary.totalIssues}`);
|
|
260
|
+
* console.log(`Critical: ${plan.summary.criticalCount}`);
|
|
261
|
+
*
|
|
262
|
+
* for (const issue of plan.orderedFixes) {
|
|
263
|
+
* console.log(`[${issue.priority}] ${issue.title}: ${issue.fix}`);
|
|
264
|
+
* }
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
export declare function generateRemediationPlan(result: ComplianceCheckResult): RemediationPlan;
|
|
268
|
+
export declare function generateAssessmentReport(options?: AssessmentReportOptions): Promise<Record<string, any>>;
|
|
269
|
+
//# sour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