@ai-pip/core 0.1.8 → 0.3.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 (145) hide show
  1. package/CHANGELOG.md +157 -2
  2. package/README.md +351 -11
  3. package/dist/AAL/constants.d.ts +15 -0
  4. package/dist/AAL/constants.d.ts.map +1 -0
  5. package/dist/AAL/constants.js +20 -0
  6. package/dist/AAL/constants.js.map +1 -0
  7. package/dist/AAL/index.d.ts +29 -0
  8. package/dist/AAL/index.d.ts.map +1 -0
  9. package/dist/AAL/index.js +30 -0
  10. package/dist/AAL/index.js.map +1 -0
  11. package/dist/AAL/lineage/buildAALLineage.d.ts +22 -0
  12. package/dist/AAL/lineage/buildAALLineage.d.ts.map +1 -0
  13. package/dist/AAL/lineage/buildAALLineage.js +26 -0
  14. package/dist/AAL/lineage/buildAALLineage.js.map +1 -0
  15. package/dist/AAL/lineage/index.d.ts +5 -0
  16. package/dist/AAL/lineage/index.d.ts.map +1 -0
  17. package/dist/AAL/lineage/index.js +5 -0
  18. package/dist/AAL/lineage/index.js.map +1 -0
  19. package/dist/AAL/process/applyRemovalPlan.d.ts +21 -0
  20. package/dist/AAL/process/applyRemovalPlan.d.ts.map +1 -0
  21. package/dist/AAL/process/applyRemovalPlan.js +150 -0
  22. package/dist/AAL/process/applyRemovalPlan.js.map +1 -0
  23. package/dist/AAL/process/buildDecisionReason.d.ts +36 -0
  24. package/dist/AAL/process/buildDecisionReason.d.ts.map +1 -0
  25. package/dist/AAL/process/buildDecisionReason.js +70 -0
  26. package/dist/AAL/process/buildDecisionReason.js.map +1 -0
  27. package/dist/AAL/process/buildRemovalPlan.d.ts +39 -0
  28. package/dist/AAL/process/buildRemovalPlan.d.ts.map +1 -0
  29. package/dist/AAL/process/buildRemovalPlan.js +104 -0
  30. package/dist/AAL/process/buildRemovalPlan.js.map +1 -0
  31. package/dist/AAL/process/index.d.ts +10 -0
  32. package/dist/AAL/process/index.d.ts.map +1 -0
  33. package/dist/AAL/process/index.js +8 -0
  34. package/dist/AAL/process/index.js.map +1 -0
  35. package/dist/AAL/process/resolveAgentAction.d.ts +31 -0
  36. package/dist/AAL/process/resolveAgentAction.d.ts.map +1 -0
  37. package/dist/AAL/process/resolveAgentAction.js +67 -0
  38. package/dist/AAL/process/resolveAgentAction.js.map +1 -0
  39. package/dist/AAL/types.d.ts +108 -0
  40. package/dist/AAL/types.d.ts.map +1 -0
  41. package/dist/AAL/types.js +2 -0
  42. package/dist/AAL/types.js.map +1 -0
  43. package/dist/{isl → AAL}/value-objects/AnomalyScore.d.ts +2 -1
  44. package/dist/AAL/value-objects/AnomalyScore.d.ts.map +1 -0
  45. package/dist/{isl → AAL}/value-objects/AnomalyScore.js.map +1 -1
  46. package/dist/{isl → AAL}/value-objects/PolicyRule.d.ts.map +1 -1
  47. package/dist/{isl → AAL}/value-objects/PolicyRule.js.map +1 -1
  48. package/dist/AAL/value-objects/index.d.ts +5 -0
  49. package/dist/AAL/value-objects/index.d.ts.map +1 -0
  50. package/dist/AAL/value-objects/index.js +3 -0
  51. package/dist/AAL/value-objects/index.js.map +1 -0
  52. package/dist/index.d.ts +10 -6
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +8 -5
  55. package/dist/index.js.map +1 -1
  56. package/dist/isl/detect/detect.d.ts +39 -0
  57. package/dist/isl/detect/detect.d.ts.map +1 -0
  58. package/dist/isl/detect/detect.js +369 -0
  59. package/dist/isl/detect/detect.js.map +1 -0
  60. package/dist/isl/detect/index.d.ts +6 -0
  61. package/dist/isl/detect/index.d.ts.map +1 -0
  62. package/dist/isl/detect/index.js +5 -0
  63. package/dist/isl/detect/index.js.map +1 -0
  64. package/dist/isl/index.d.ts +22 -6
  65. package/dist/isl/index.d.ts.map +1 -1
  66. package/dist/isl/index.js +20 -5
  67. package/dist/isl/index.js.map +1 -1
  68. package/dist/isl/lineage/buildISLLineage.d.ts +22 -0
  69. package/dist/isl/lineage/buildISLLineage.d.ts.map +1 -0
  70. package/dist/isl/lineage/buildISLLineage.js +26 -0
  71. package/dist/isl/lineage/buildISLLineage.js.map +1 -0
  72. package/dist/isl/lineage/index.d.ts +5 -0
  73. package/dist/isl/lineage/index.d.ts.map +1 -0
  74. package/dist/isl/lineage/index.js +5 -0
  75. package/dist/isl/lineage/index.js.map +1 -0
  76. package/dist/isl/process/buildISLResult.d.ts +24 -0
  77. package/dist/isl/process/buildISLResult.d.ts.map +1 -0
  78. package/dist/isl/process/buildISLResult.js +38 -0
  79. package/dist/isl/process/buildISLResult.js.map +1 -0
  80. package/dist/isl/process/emitSignal.d.ts +32 -0
  81. package/dist/isl/process/emitSignal.d.ts.map +1 -0
  82. package/dist/isl/process/emitSignal.js +41 -0
  83. package/dist/isl/process/emitSignal.js.map +1 -0
  84. package/dist/isl/process/index.d.ts +7 -0
  85. package/dist/isl/process/index.d.ts.map +1 -0
  86. package/dist/isl/process/index.js +6 -0
  87. package/dist/isl/process/index.js.map +1 -0
  88. package/dist/isl/riskScore/calculators.d.ts +19 -0
  89. package/dist/isl/riskScore/calculators.d.ts.map +1 -0
  90. package/dist/isl/riskScore/calculators.js +50 -0
  91. package/dist/isl/riskScore/calculators.js.map +1 -0
  92. package/dist/isl/riskScore/index.d.ts +14 -0
  93. package/dist/isl/riskScore/index.d.ts.map +1 -0
  94. package/dist/isl/riskScore/index.js +26 -0
  95. package/dist/isl/riskScore/index.js.map +1 -0
  96. package/dist/isl/riskScore/types.d.ts +20 -0
  97. package/dist/isl/riskScore/types.d.ts.map +1 -0
  98. package/dist/isl/riskScore/types.js +12 -0
  99. package/dist/isl/riskScore/types.js.map +1 -0
  100. package/dist/isl/sanitize.d.ts +13 -6
  101. package/dist/isl/sanitize.d.ts.map +1 -1
  102. package/dist/isl/sanitize.js +34 -40
  103. package/dist/isl/sanitize.js.map +1 -1
  104. package/dist/isl/signals.d.ts +113 -0
  105. package/dist/isl/signals.d.ts.map +1 -0
  106. package/dist/isl/signals.js +94 -0
  107. package/dist/isl/signals.js.map +1 -0
  108. package/dist/isl/types.d.ts +4 -48
  109. package/dist/isl/types.d.ts.map +1 -1
  110. package/dist/isl/types.js +1 -1
  111. package/dist/isl/value-objects/Pattern.d.ts +21 -0
  112. package/dist/isl/value-objects/Pattern.d.ts.map +1 -1
  113. package/dist/isl/value-objects/Pattern.js +36 -0
  114. package/dist/isl/value-objects/Pattern.js.map +1 -1
  115. package/dist/isl/value-objects/PiDetection.d.ts +2 -1
  116. package/dist/isl/value-objects/PiDetection.d.ts.map +1 -1
  117. package/dist/isl/value-objects/PiDetectionResult.d.ts +2 -3
  118. package/dist/isl/value-objects/PiDetectionResult.d.ts.map +1 -1
  119. package/dist/isl/value-objects/PiDetectionResult.js +1 -27
  120. package/dist/isl/value-objects/PiDetectionResult.js.map +1 -1
  121. package/dist/isl/value-objects/RiskScore.d.ts +70 -0
  122. package/dist/isl/value-objects/RiskScore.d.ts.map +1 -0
  123. package/dist/isl/value-objects/RiskScore.js +85 -0
  124. package/dist/isl/value-objects/RiskScore.js.map +1 -0
  125. package/dist/isl/value-objects/index.d.ts +4 -4
  126. package/dist/isl/value-objects/index.d.ts.map +1 -1
  127. package/dist/isl/value-objects/index.js +2 -4
  128. package/dist/isl/value-objects/index.js.map +1 -1
  129. package/dist/shared/audit.d.ts +250 -0
  130. package/dist/shared/audit.d.ts.map +1 -0
  131. package/dist/shared/audit.js +455 -0
  132. package/dist/shared/audit.js.map +1 -0
  133. package/dist/shared/index.d.ts +5 -3
  134. package/dist/shared/index.d.ts.map +1 -1
  135. package/dist/shared/index.js +5 -6
  136. package/dist/shared/index.js.map +1 -1
  137. package/dist/shared/types.d.ts +36 -0
  138. package/dist/shared/types.d.ts.map +1 -0
  139. package/dist/shared/types.js +2 -0
  140. package/dist/shared/types.js.map +1 -0
  141. package/package.json +12 -3
  142. package/dist/isl/value-objects/AnomalyScore.d.ts.map +0 -1
  143. /package/dist/{isl → AAL}/value-objects/AnomalyScore.js +0 -0
  144. /package/dist/{isl → AAL}/value-objects/PolicyRule.d.ts +0 -0
  145. /package/dist/{isl → AAL}/value-objects/PolicyRule.js +0 -0
@@ -0,0 +1,455 @@
1
+ /**
2
+ * AI-PIP Audit utilities - Pure functions for ordered, human-readable audit output
3
+ *
4
+ * @remarks
5
+ * These functions format layer results and signals so that the **data** exposed
6
+ * is self-explanatory for an external auditor: each block includes a short
7
+ * explanation of what it represents, human-readable labels (e.g. TC/STC/UC,
8
+ * ALLOW/WARN/BLOCK), and origin/traceability. Visual styling is not part of core;
9
+ * scripts or SDK can consume this text for richer presentation.
10
+ *
11
+ * Supports:
12
+ * - Text report (formatPipelineAudit, formatPipelineAuditFull)
13
+ * - JSON report for logs/machine consumption (buildFullAuditPayload, formatPipelineAuditAsJson)
14
+ * - Run identifier (createAuditRunId) and generatedAt for correlation
15
+ * - Compact log entry (buildAuditLogEntry) for one-line logging
16
+ */
17
+ /** Trust level legend for audit output (human-readable) */
18
+ const TRUST_LEGEND = {
19
+ TC: 'Trusted Content',
20
+ STC: 'Semi-Trusted Content',
21
+ UC: 'Untrusted Content'
22
+ };
23
+ /** Action legend for audit output */
24
+ const ACTION_LEGEND = {
25
+ ALLOW: 'Allow (risk below warn threshold)',
26
+ WARN: 'Warn (risk above warn, below block)',
27
+ BLOCK: 'Block (risk above block threshold)'
28
+ };
29
+ const SEP = ' ';
30
+ const BORDER = '---';
31
+ /**
32
+ * Creates a unique run identifier for audit correlation (e.g. logs, multiple reports).
33
+ * Uses crypto.randomUUID() when available, otherwise a time-based id.
34
+ */
35
+ export function createAuditRunId() {
36
+ if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
37
+ return crypto.randomUUID();
38
+ }
39
+ return `audit-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
40
+ }
41
+ function ensureRunInfo(options) {
42
+ const generatedAt = options?.generatedAt ?? Date.now();
43
+ return {
44
+ runId: options?.runId ?? createAuditRunId(),
45
+ generatedAt,
46
+ generatedAtIso: new Date(generatedAt).toISOString()
47
+ };
48
+ }
49
+ /**
50
+ * Builds a compact audit entry for one-line logging (e.g. logger.info(JSON.stringify(entry))).
51
+ * Lineage is not included; use buildFullAuditPayload for full traceability.
52
+ */
53
+ export function buildAuditLogEntry(signal, reason, options) {
54
+ const run = ensureRunInfo(options);
55
+ return {
56
+ runId: run.runId,
57
+ generatedAt: run.generatedAt,
58
+ generatedAtIso: run.generatedAtIso,
59
+ action: reason.action,
60
+ riskScore: reason.riskScore,
61
+ hasThreats: reason.hasThreats,
62
+ detectionCount: reason.detectionCount
63
+ };
64
+ }
65
+ function lineageToJson(lineage) {
66
+ return lineage.map((e) => ({ step: e.step, timestamp: e.timestamp }));
67
+ }
68
+ function buildCslSection(result) {
69
+ return {
70
+ layer: 'CSL',
71
+ segmentCount: result.segments.length,
72
+ segments: result.segments.map((seg) => ({
73
+ id: seg.id,
74
+ trust: seg.trust.value,
75
+ contentLength: seg.content.length
76
+ })),
77
+ lineage: lineageToJson(result.lineage),
78
+ ...(typeof result.processingTimeMs === 'number' && { processingTimeMs: result.processingTimeMs })
79
+ };
80
+ }
81
+ function buildIslSection(result) {
82
+ const meta = result.metadata;
83
+ return {
84
+ layer: 'ISL',
85
+ totalSegments: meta.totalSegments,
86
+ sanitizedSegments: meta.sanitizedSegments,
87
+ segments: result.segments.map((seg) => {
88
+ const pi = seg.piDetection;
89
+ const detections = pi?.detections;
90
+ const detectionTypes = detections?.length ? summarizeDetectionTypes(detections) : 'none';
91
+ return {
92
+ id: seg.id,
93
+ trust: seg.trust.value,
94
+ sanitizationLevel: seg.sanitizationLevel,
95
+ originalLength: seg.originalContent.length,
96
+ sanitizedLength: seg.sanitizedContent.length,
97
+ detections: detections?.length ?? 0,
98
+ detectionTypes
99
+ };
100
+ }),
101
+ lineage: lineageToJson(result.lineage),
102
+ ...(typeof meta.processingTimeMs === 'number' && { processingTimeMs: meta.processingTimeMs })
103
+ };
104
+ }
105
+ function buildIslSignalSection(signal) {
106
+ const pd = signal.piDetection;
107
+ return {
108
+ layer: 'ISL_SIGNAL',
109
+ riskScore: signal.riskScore,
110
+ hasThreats: signal.hasThreats,
111
+ timestamp: signal.timestamp,
112
+ timestampIso: new Date(signal.timestamp).toISOString(),
113
+ piDetection: {
114
+ detected: pd.detected,
115
+ score: pd.score,
116
+ detectionCount: pd.detections.length,
117
+ detectionTypes: summarizeDetectionTypes(pd.detections),
118
+ ...(pd.patterns && pd.patterns.length > 0 && { patterns: [...pd.patterns] })
119
+ },
120
+ ...(signal.metadata?.strategy && { strategy: signal.metadata.strategy })
121
+ };
122
+ }
123
+ function buildAalSection(reason, removalPlan) {
124
+ const section = {
125
+ layer: 'AAL',
126
+ action: reason.action,
127
+ reason: reason.reason,
128
+ riskScore: reason.riskScore,
129
+ threshold: reason.threshold,
130
+ hasThreats: reason.hasThreats,
131
+ detectionCount: reason.detectionCount
132
+ };
133
+ if (removalPlan != null) {
134
+ section.removalEnabled = removalPlan.removalEnabled;
135
+ section.shouldRemove = removalPlan.shouldRemove;
136
+ section.instructionsToRemove = removalPlan.instructionsToRemove.map((inst) => ({
137
+ type: inst.type ?? 'unknown',
138
+ description: inst.description ?? inst.pattern ?? ''
139
+ }));
140
+ }
141
+ return section;
142
+ }
143
+ function buildCpeSection(result) {
144
+ const env = result.envelope;
145
+ return {
146
+ layer: 'CPE',
147
+ nonce: env.metadata.nonce,
148
+ timestamp: env.metadata.timestamp,
149
+ timestampIso: new Date(env.metadata.timestamp).toISOString(),
150
+ signatureAlgorithm: env.signature.algorithm,
151
+ lineage: lineageToJson(env.lineage),
152
+ ...(typeof env.metadata.protocolVersion === 'string' && { protocolVersion: env.metadata.protocolVersion }),
153
+ ...(typeof result.processingTimeMs === 'number' && { processingTimeMs: result.processingTimeMs })
154
+ };
155
+ }
156
+ /**
157
+ * Builds the full pipeline audit payload (JSON-serializable) with run id, timestamp, summary for logs, and section data.
158
+ * Preserves lineage in each section for traceability. Use formatPipelineAuditAsJson to get a JSON string.
159
+ */
160
+ export function buildFullAuditPayload(csl, isl, signal, reason, options) {
161
+ const run = ensureRunInfo(options);
162
+ const removalPlan = options?.removalPlan ?? undefined;
163
+ const cpe = options?.cpe;
164
+ const includeCpe = options?.includeCpe === true && cpe != null;
165
+ const payload = {
166
+ runId: run.runId,
167
+ generatedAt: run.generatedAt,
168
+ generatedAtIso: run.generatedAtIso,
169
+ summary: {
170
+ action: reason.action,
171
+ riskScore: reason.riskScore,
172
+ hasThreats: reason.hasThreats,
173
+ detectionCount: reason.detectionCount
174
+ },
175
+ sections: {
176
+ csl: buildCslSection(csl),
177
+ isl: buildIslSection(isl),
178
+ islSignal: buildIslSignalSection(signal),
179
+ aal: buildAalSection(reason, removalPlan),
180
+ ...(includeCpe && cpe && { cpe: buildCpeSection(cpe) })
181
+ }
182
+ };
183
+ return payload;
184
+ }
185
+ /** Summarizes detection types for audit (e.g. "prompt-injection (2), jailbreak (1)") */
186
+ function summarizeDetectionTypes(detections) {
187
+ if (detections.length === 0)
188
+ return 'none';
189
+ const counts = {};
190
+ for (const d of detections) {
191
+ const t = d.pattern_type ?? 'unknown';
192
+ counts[t] = (counts[t] ?? 0) + 1;
193
+ }
194
+ return Object.entries(counts)
195
+ .sort((a, b) => b[1] - a[1])
196
+ .map(([type, n]) => `${type} (${n})`)
197
+ .join(', ');
198
+ }
199
+ /**
200
+ * Formats lineage entries for audit - chronological traceability
201
+ *
202
+ * @param lineage - Array of lineage entries (any layer)
203
+ * @returns Formatted string with short legend and chronological steps
204
+ */
205
+ export function formatLineageForAudit(lineage) {
206
+ if (lineage.length === 0)
207
+ return 'Lineage: (none)\n Data: chronological list of processing steps (CSL, ISL, CPE, etc.) with timestamp.';
208
+ const legend = 'Chronological traceability: each entry is a processing step with timestamp.';
209
+ const lines = lineage.map((e, i) => `${SEP}${i + 1}. [${e.step}] ${new Date(e.timestamp).toISOString()}`);
210
+ return ['Lineage:', legend, BORDER, ...lines].join('\n');
211
+ }
212
+ /**
213
+ * Formats CSL result for audit - data self-explanatory for external auditor
214
+ *
215
+ * @param result - CSL result (or compatible shape)
216
+ * @returns Formatted string: what this block is, data origin, trust legend, per-segment data
217
+ */
218
+ export function formatCSLForAudit(result) {
219
+ const header = 'Content segmented and classified by trust. Trust levels: TC=Trusted Content, STC=Semi-Trusted Content, UC=Untrusted Content.';
220
+ const origin = 'Data from: CSL segmentation result (input split into segments with trust per segment).';
221
+ const processingTimeLine = typeof result.processingTimeMs === 'number'
222
+ ? [`Processing time: ${result.processingTimeMs}ms`]
223
+ : [];
224
+ const segmentLines = result.segments.map((seg, i) => {
225
+ const trustLabel = TRUST_LEGEND[seg.trust.value] ?? seg.trust.value;
226
+ return `${SEP}Segment ${i + 1}: id=${seg.id} trust=${seg.trust.value} (${trustLabel}) content_length=${seg.content.length}`;
227
+ });
228
+ const lines = [
229
+ '[CSL] Context Segmentation Layer',
230
+ header,
231
+ origin,
232
+ BORDER,
233
+ `Segments: ${result.segments.length}`,
234
+ ...processingTimeLine,
235
+ ...segmentLines,
236
+ '',
237
+ formatLineageForAudit(result.lineage)
238
+ ];
239
+ return lines.join('\n');
240
+ }
241
+ /**
242
+ * Formats ISL result for audit - data self-explanatory; per-segment detections when present
243
+ *
244
+ * @param result - ISL result (or compatible shape)
245
+ * @returns Formatted string: what this block is, data origin, per-segment trust/level/length/detections
246
+ */
247
+ export function formatISLForAudit(result) {
248
+ const header = 'Content sanitized by ISL; sanitization level per segment (minimal/moderate/aggressive). Per segment: trust, level, length before/after, detections (if any).';
249
+ const origin = 'Data from: ISL sanitization result (each segment may have piDetection with threat detections).';
250
+ const meta = result.metadata;
251
+ const processingTimeLine = typeof meta.processingTimeMs === 'number' ? [`Processing time: ${meta.processingTimeMs}ms`] : [];
252
+ const segmentLines = result.segments.flatMap((seg, i) => {
253
+ const trustLabel = TRUST_LEGEND[seg.trust.value] ?? seg.trust.value;
254
+ const base = [
255
+ `${SEP}Segment ${i + 1}: id=${seg.id} trust=${seg.trust.value} (${trustLabel}) level=${seg.sanitizationLevel}`,
256
+ `${SEP} original_length=${seg.originalContent.length} sanitized_length=${seg.sanitizedContent.length}`
257
+ ];
258
+ const pi = seg.piDetection;
259
+ const detections = pi?.detections;
260
+ if (detections?.length) {
261
+ const types = summarizeDetectionTypes(detections);
262
+ base.push(`${SEP} detections: ${detections.length} (types: ${types})`);
263
+ }
264
+ else if (pi?.detected) {
265
+ base.push(`${SEP} detections: yes (count/type not available)`);
266
+ }
267
+ else {
268
+ base.push(`${SEP} detections: none`);
269
+ }
270
+ return base;
271
+ });
272
+ const lines = [
273
+ '[ISL] Instruction Sanitization Layer',
274
+ header,
275
+ origin,
276
+ BORDER,
277
+ `Segments: ${meta.totalSegments} (sanitized: ${meta.sanitizedSegments})`,
278
+ ...processingTimeLine,
279
+ ...segmentLines,
280
+ '',
281
+ formatLineageForAudit(result.lineage)
282
+ ];
283
+ return lines.join('\n');
284
+ }
285
+ /**
286
+ * Formats ISL signal for audit - data self-explanatory; risk score and detection types
287
+ *
288
+ * @param signal - ISL signal (or compatible shape)
289
+ * @returns Formatted string: what this block is, data origin, risk score (0-1), hasThreats, detection types
290
+ */
291
+ export function formatISLSignalForAudit(signal) {
292
+ const header = 'Risk signal for AAL: summarizes threats and global risk. riskScore (0-1, higher = more risk), hasThreats (true if any detections), detections (count and types).';
293
+ const origin = 'Data from: signal emitted by ISL for AAL (external contract; AAL uses this to decide ALLOW/WARN/BLOCK).';
294
+ const pd = signal.piDetection;
295
+ const detectionTypes = summarizeDetectionTypes(pd.detections);
296
+ const strategyLine = signal.metadata?.strategy ? [`${SEP}Strategy: ${signal.metadata.strategy} (used to compute risk score)`] : [];
297
+ const patternLine = pd.patterns && pd.patterns.length > 0 ? [`${SEP}Patterns matched: ${pd.patterns.join(', ')}`] : [];
298
+ const lines = [
299
+ '[ISL Signal] External contract',
300
+ header,
301
+ origin,
302
+ BORDER,
303
+ `Risk score: ${signal.riskScore.toFixed(3)} (0-1, higher = more risk)`,
304
+ `Has threats: ${signal.hasThreats} (true if any detections present)`,
305
+ `Timestamp: ${new Date(signal.timestamp).toISOString()}`,
306
+ `Detections: ${pd.detections.length} (aggregated score: ${pd.score.toFixed(3)}, detected: ${pd.detected})`,
307
+ `Detection types: ${detectionTypes}`,
308
+ ...strategyLine,
309
+ ...patternLine
310
+ ];
311
+ return lines.join('\n');
312
+ }
313
+ /**
314
+ * Formats AAL decision reason and optional removal plan for audit
315
+ *
316
+ * @param reason - Decision reason (or compatible shape)
317
+ * @param removalPlan - Optional removal plan (or compatible shape)
318
+ * @returns Formatted string: what this block is, data origin, action (ALLOW/WARN/BLOCK), reason, thresholds, removal plan
319
+ */
320
+ export function formatAALForAudit(reason, removalPlan) {
321
+ const header = 'Agent Action Lock decision. Action (ALLOW/WARN/BLOCK), reason in plain language, thresholds used (warn/block), removal plan (if removal enabled and threats present).';
322
+ const origin = 'Data from: AAL decision (resolveAgentAction + buildDecisionReason + optional buildRemovalPlan/buildRemovalPlanFromResult).';
323
+ const actionLabel = ACTION_LEGEND[reason.action] ?? reason.action;
324
+ const plan = removalPlan ?? undefined;
325
+ const removalBlock = plan === undefined
326
+ ? []
327
+ : [
328
+ '',
329
+ `Removal enabled: ${plan.removalEnabled}`,
330
+ `Should remove: ${plan.shouldRemove} (if true, applyRemovalPlan can be used to get cleaned content)`,
331
+ ...(plan.instructionsToRemove.length > 0
332
+ ? [
333
+ `Instructions to remove: ${plan.instructionsToRemove.length}`,
334
+ ...plan.instructionsToRemove.map((inst, i) => `${SEP}${i + 1}. type=${inst.type ?? 'unknown'} - ${inst.description ?? inst.pattern ?? ''}`)
335
+ ]
336
+ : [])
337
+ ];
338
+ const lines = [
339
+ '[AAL] Agent Action Lock',
340
+ header,
341
+ origin,
342
+ BORDER,
343
+ `Action: ${reason.action} (${actionLabel})`,
344
+ `Risk score: ${reason.riskScore.toFixed(3)} (threshold: ${reason.threshold.toFixed(3)})`,
345
+ `Reason: ${reason.reason}`,
346
+ `Threats: ${reason.hasThreats} (detection count: ${reason.detectionCount})`,
347
+ ...removalBlock
348
+ ];
349
+ return lines.join('\n');
350
+ }
351
+ /**
352
+ * Formats CPE result for audit - data self-explanatory
353
+ *
354
+ * @param result - CPE result (or compatible shape)
355
+ * @returns Formatted string: what this block is, data origin, nonce, timestamp, signature
356
+ */
357
+ export function formatCPEForAudit(result) {
358
+ const header = 'Cryptographic envelope: nonce (unique per request), timestamp, signature (integrity).';
359
+ const origin = 'Data from: CPE envelope result (wraps sanitized content for integrity verification).';
360
+ const env = result.envelope;
361
+ const protocolVersionLine = typeof env.metadata.protocolVersion === 'string'
362
+ ? [`Protocol version: ${env.metadata.protocolVersion}`]
363
+ : [];
364
+ const processingTimeLine = typeof result.processingTimeMs === 'number'
365
+ ? [`Processing time: ${result.processingTimeMs}ms`]
366
+ : [];
367
+ const lines = [
368
+ '[CPE] Cryptographic Prompt Envelope',
369
+ header,
370
+ origin,
371
+ BORDER,
372
+ `Nonce: ${env.metadata.nonce}`,
373
+ `Timestamp: ${new Date(env.metadata.timestamp).toISOString()}`,
374
+ ...protocolVersionLine,
375
+ `Signature algorithm: ${env.signature.algorithm}`,
376
+ ...processingTimeLine,
377
+ '',
378
+ formatLineageForAudit(env.lineage)
379
+ ];
380
+ return lines.join('\n');
381
+ }
382
+ /**
383
+ * Builds a full pipeline audit report (CSL → ISL → CPE) from layer results.
384
+ * Accepts minimal shapes for flexibility.
385
+ * Use formatPipelineAuditFull when you need ISL Signal and AAL included.
386
+ *
387
+ * @param csl - CSL result (or compatible shape)
388
+ * @param isl - ISL result (or compatible shape)
389
+ * @param cpe - CPE result (or compatible shape)
390
+ * @param options - Optional title and separator; use includeSignalAndAAL to add Signal + AAL sections
391
+ * @returns Single formatted string for full audit
392
+ */
393
+ export function formatPipelineAudit(csl, isl, cpe, options) {
394
+ const sep = options?.sectionSeparator ?? '\n\n';
395
+ const title = options?.title ?? 'AI-PIP Pipeline Audit';
396
+ const parts = [title, BORDER, formatCSLForAudit(csl), sep, formatISLForAudit(isl)];
397
+ if (options?.includeSignalAndAAL && options.signal != null && options.aalReason != null) {
398
+ parts.push(sep, formatISLSignalForAudit(options.signal), sep, formatAALForAudit(options.aalReason, options.removalPlan ?? undefined));
399
+ }
400
+ parts.push(sep, formatCPEForAudit(cpe));
401
+ return parts.join('\n');
402
+ }
403
+ /**
404
+ * Full pipeline audit report (CSL → ISL → ISL Signal → AAL → optional CPE) with run id and timestamp.
405
+ * Unites all layers for a single audit view. Lineage is included in each section.
406
+ *
407
+ * @param csl - CSL result
408
+ * @param isl - ISL result
409
+ * @param signal - ISL signal (for AAL)
410
+ * @param aalReason - AAL decision reason
411
+ * @param removalPlan - Optional removal plan
412
+ * @param cpe - Optional CPE result (included when includeCpe is true)
413
+ * @param options - runId, generatedAt, includeCpe, title, sectionSeparator
414
+ * @returns Formatted string with header (runId, generatedAt) and all sections
415
+ */
416
+ export function formatPipelineAuditFull(csl, isl, signal, aalReason, removalPlan, cpe, options) {
417
+ const run = ensureRunInfo(options);
418
+ const sep = options?.sectionSeparator ?? '\n\n';
419
+ const title = options?.title ?? 'AI-PIP Pipeline Audit (full)';
420
+ const includeCpe = options?.includeCpe === true && cpe != null;
421
+ const header = [
422
+ title,
423
+ BORDER,
424
+ `Run ID: ${run.runId}`,
425
+ `Generated at: ${run.generatedAtIso}`,
426
+ BORDER
427
+ ].join('\n');
428
+ const parts = [
429
+ header,
430
+ sep,
431
+ formatCSLForAudit(csl),
432
+ sep,
433
+ formatISLForAudit(isl),
434
+ sep,
435
+ formatISLSignalForAudit(signal),
436
+ sep,
437
+ formatAALForAudit(aalReason, removalPlan ?? undefined)
438
+ ];
439
+ if (includeCpe && cpe) {
440
+ parts.push(sep, formatCPEForAudit(cpe));
441
+ }
442
+ return parts.join('\n');
443
+ }
444
+ /**
445
+ * Full pipeline audit as JSON string (for logs, SIEM, machine consumption).
446
+ * Preserves lineage in each section. Use buildFullAuditPayload for the raw object.
447
+ *
448
+ * @param options.compact - If true, single-line JSON; otherwise pretty-printed
449
+ * @returns JSON string of the full audit payload
450
+ */
451
+ export function formatPipelineAuditAsJson(csl, isl, signal, reason, options) {
452
+ const payload = buildFullAuditPayload(csl, isl, signal, reason, options);
453
+ return options?.compact === true ? JSON.stringify(payload) : JSON.stringify(payload, null, 2);
454
+ }
455
+ //# sourceMappingURL=audit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/shared/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,2DAA2D;AAC3D,MAAM,YAAY,GAA2B;IAC3C,EAAE,EAAE,iBAAiB;IACrB,GAAG,EAAE,sBAAsB;IAC3B,EAAE,EAAE,mBAAmB;CACxB,CAAA;AAED,qCAAqC;AACrC,MAAM,aAAa,GAA2B;IAC5C,KAAK,EAAE,mCAAmC;IAC1C,IAAI,EAAE,qCAAqC;IAC3C,KAAK,EAAE,oCAAoC;CAC5C,CAAA;AAqID,MAAM,GAAG,GAAG,IAAI,CAAA;AAChB,MAAM,MAAM,GAAG,KAAK,CAAA;AAEpB;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;QAC7E,OAAO,MAAM,CAAC,UAAU,EAAE,CAAA;IAC5B,CAAC;IACD,OAAO,SAAS,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAA;AACzE,CAAC;AAED,SAAS,aAAa,CAAC,OAAkD;IACvE,MAAM,WAAW,GAAG,OAAO,EAAE,WAAW,IAAI,IAAI,CAAC,GAAG,EAAE,CAAA;IACtD,OAAO;QACL,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,gBAAgB,EAAE;QAC3C,WAAW;QACX,cAAc,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE;KACpD,CAAA;AACH,CAAC;AAED;;;GAG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,MAA0B,EAC1B,OAAyG;IAEzG,MAAM,OAAO,GAAG,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;IACxE,OAAO,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAC/F,CAAC"}
@@ -1,9 +1,11 @@
1
1
  /**
2
- * Shared utilities for all layers - funciones puras compartidas
2
+ * Shared utilities for all layers - pure functions shared across the core
3
3
  *
4
4
  * @remarks
5
- * Solo funciones básicas de manejo de linaje.
6
- * Auditoría y análisis avanzado van al SDK.
5
+ * Lineage handling and AI-PIP audit formatting for clear, flexible auditing.
7
6
  */
8
7
  export { addLineageEntry, addLineageEntries, filterLineageByStep, getLastLineageEntry } from './lineage.js';
8
+ export { formatLineageForAudit, formatCSLForAudit, formatISLForAudit, formatISLSignalForAudit, formatAALForAudit, formatCPEForAudit, formatPipelineAudit, formatPipelineAuditFull, formatPipelineAuditAsJson, createAuditRunId, buildAuditLogEntry, buildFullAuditPayload } from './audit.js';
9
+ export type { LineageEntryLike, CSLResultLike, ISLResultLike, ISLSignalLike, DecisionReasonLike, RemovalPlanLike, CPEResultLike, AuditRunInfo, AuditLogSummary, FullPipelineAuditOptions, PipelineAuditJsonOptions } from './audit.js';
10
+ export type { Position, SegmentRef } from './types.js';
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,QAAQ,EACR,UAAU,EACX,MAAM,YAAY,CAAA"}
@@ -1,12 +1,11 @@
1
1
  /**
2
- * Shared utilities for all layers - funciones puras compartidas
2
+ * Shared utilities for all layers - pure functions shared across the core
3
3
  *
4
4
  * @remarks
5
- * Solo funciones básicas de manejo de linaje.
6
- * Auditoría y análisis avanzado van al SDK.
5
+ * Lineage handling and AI-PIP audit formatting for clear, flexible auditing.
7
6
  */
8
- // Lineage básico
7
+ // Lineage
9
8
  export { addLineageEntry, addLineageEntries, filterLineageByStep, getLastLineageEntry } from './lineage.js';
10
- // Funciones de auditoría NO son core - van al SDK/tooling
11
- // El core solo preserva linaje, no lo analiza
9
+ // Audit / pretty-print for AI-PIP layers (ordered, human-readable)
10
+ export { formatLineageForAudit, formatCSLForAudit, formatISLForAudit, formatISLSignalForAudit, formatAALForAudit, formatCPEForAudit, formatPipelineAudit, formatPipelineAuditFull, formatPipelineAuditAsJson, createAuditRunId, buildAuditLogEntry, buildFullAuditPayload } from './audit.js';
12
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iBAAiB;AACjB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAErB,0DAA0D;AAC1D,8CAA8C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,UAAU;AACV,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAErB,mEAAmE;AACnE,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,YAAY,CAAA"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Represents a zero-based position range within a string or segment.
3
+ *
4
+ * @remarks
5
+ * - `start` is inclusive
6
+ * - `end` is exclusive
7
+ * - Must satisfy: 0 <= start <= end
8
+ *
9
+ * This type is purely structural and shared across layers
10
+ * (CSL, ISL, AAL, reporters).
11
+ */
12
+ export type Position = {
13
+ /** Inclusive start index */
14
+ readonly start: number;
15
+ /** Exclusive end index */
16
+ readonly end: number;
17
+ };
18
+ /**
19
+ * References a specific segment and an optional position within it.
20
+ *
21
+ * @remarks
22
+ * Used to precisely point to a sub-range of a segment without
23
+ * mutating or interpreting its content.
24
+ *
25
+ * Common use cases:
26
+ * - ISL: attach threat signals to exact locations
27
+ * - AAL: target removals or locks precisely
28
+ * - Reporting: highlight affected content
29
+ */
30
+ export type SegmentRef = {
31
+ /** Unique identifier of the segment */
32
+ readonly segmentId: string;
33
+ /** Optional position within the segment */
34
+ readonly position?: Position;
35
+ };
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,GAAG;IACnB,4BAA4B;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IAEtB,0BAA0B;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,uCAAuC;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAE1B,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAC7B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ai-pip/core",
3
- "version": "0.1.8",
4
- "description": "Core implementation of the AI-PIP protocol. Provides layered, zero-trust context processing (CSL, ISL, CPE, ALL, ModelGateway)",
3
+ "version": "0.3.0",
4
+ "description": "Core implementation of the AI-PIP protocol. Provides layered, zero-trust context processing (CSL, ISL, AAL, CPE)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -21,6 +21,11 @@
21
21
  "import": "./dist/isl/index.js",
22
22
  "default": "./dist/isl/index.js"
23
23
  },
24
+ "./aal": {
25
+ "types": "./dist/AAL/index.d.ts",
26
+ "import": "./dist/AAL/index.js",
27
+ "default": "./dist/AAL/index.js"
28
+ },
24
29
  "./cpe": {
25
30
  "types": "./dist/cpe/index.d.ts",
26
31
  "import": "./dist/cpe/index.js",
@@ -81,6 +86,10 @@
81
86
  "test:watch": "vitest --watch",
82
87
  "test:ui": "vitest --ui",
83
88
  "test:coverage": "vitest --coverage",
84
- "test:install": "node test-package-install.js"
89
+ "test:install": "node test-package-install.js",
90
+ "verify-risk": "node scripts/verify-risk-score.mjs",
91
+ "demo-menu": "node scripts/interactive-risk-menu.mjs",
92
+ "demo-full": "node scripts/demo-full-flow.mjs",
93
+ "audit-report": "node scripts/audit-report.mjs"
85
94
  }
86
95
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnomalyScore.d.ts","sourceRoot":"","sources":["../../../src/isl/value-objects/AnomalyScore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE3D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;CAC/B,CAAA;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,YAAY,CAUxF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAEzD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAEzD;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAExD"}
File without changes
File without changes
File without changes