@ai-pip/core 0.1.7 → 0.2.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.
- package/CHANGELOG.md +175 -1
- package/README.md +751 -22
- package/dist/AAL/index.d.ts +28 -0
- package/dist/AAL/index.d.ts.map +1 -0
- package/dist/AAL/index.js +28 -0
- package/dist/AAL/index.js.map +1 -0
- package/dist/AAL/lineage/buildAALLineage.d.ts +22 -0
- package/dist/AAL/lineage/buildAALLineage.d.ts.map +1 -0
- package/dist/AAL/lineage/buildAALLineage.js +26 -0
- package/dist/AAL/lineage/buildAALLineage.js.map +1 -0
- package/dist/AAL/lineage/index.d.ts +5 -0
- package/dist/AAL/lineage/index.d.ts.map +1 -0
- package/dist/AAL/lineage/index.js +5 -0
- package/dist/AAL/lineage/index.js.map +1 -0
- package/dist/AAL/process/buildDecisionReason.d.ts +36 -0
- package/dist/AAL/process/buildDecisionReason.d.ts.map +1 -0
- package/dist/AAL/process/buildDecisionReason.js +48 -0
- package/dist/AAL/process/buildDecisionReason.js.map +1 -0
- package/dist/AAL/process/buildRemovalPlan.d.ts +32 -0
- package/dist/AAL/process/buildRemovalPlan.d.ts.map +1 -0
- package/dist/AAL/process/buildRemovalPlan.js +50 -0
- package/dist/AAL/process/buildRemovalPlan.js.map +1 -0
- package/dist/AAL/process/index.d.ts +9 -0
- package/dist/AAL/process/index.d.ts.map +1 -0
- package/dist/AAL/process/index.js +7 -0
- package/dist/AAL/process/index.js.map +1 -0
- package/dist/AAL/process/resolveAgentAction.d.ts +31 -0
- package/dist/AAL/process/resolveAgentAction.d.ts.map +1 -0
- package/dist/AAL/process/resolveAgentAction.js +43 -0
- package/dist/AAL/process/resolveAgentAction.js.map +1 -0
- package/dist/AAL/types.d.ts +104 -0
- package/dist/AAL/types.d.ts.map +1 -0
- package/dist/AAL/types.js +2 -0
- package/dist/AAL/types.js.map +1 -0
- package/dist/{isl → AAL}/value-objects/AnomalyScore.d.ts +2 -1
- package/dist/AAL/value-objects/AnomalyScore.d.ts.map +1 -0
- package/dist/{isl → AAL}/value-objects/AnomalyScore.js.map +1 -1
- package/dist/{isl → AAL}/value-objects/PolicyRule.d.ts.map +1 -1
- package/dist/{isl → AAL}/value-objects/PolicyRule.js.map +1 -1
- package/dist/AAL/value-objects/index.d.ts +5 -0
- package/dist/AAL/value-objects/index.d.ts.map +1 -0
- package/dist/AAL/value-objects/index.js +3 -0
- package/dist/AAL/value-objects/index.js.map +1 -0
- package/dist/csl/classify.d.ts +2 -2
- package/dist/csl/classify.js +5 -5
- package/dist/csl/classify.js.map +1 -1
- package/dist/csl/value-objects/Origin-map.js +5 -5
- package/dist/csl/value-objects/Origin-map.js.map +1 -1
- package/dist/index.d.ts +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/isl/index.d.ts +15 -6
- package/dist/isl/index.d.ts.map +1 -1
- package/dist/isl/index.js +15 -5
- package/dist/isl/index.js.map +1 -1
- package/dist/isl/lineage/buildISLLineage.d.ts +22 -0
- package/dist/isl/lineage/buildISLLineage.d.ts.map +1 -0
- package/dist/isl/lineage/buildISLLineage.js +26 -0
- package/dist/isl/lineage/buildISLLineage.js.map +1 -0
- package/dist/isl/lineage/index.d.ts +5 -0
- package/dist/isl/lineage/index.d.ts.map +1 -0
- package/dist/isl/lineage/index.js +5 -0
- package/dist/isl/lineage/index.js.map +1 -0
- package/dist/isl/process/buildISLResult.d.ts +24 -0
- package/dist/isl/process/buildISLResult.d.ts.map +1 -0
- package/dist/isl/process/buildISLResult.js +38 -0
- package/dist/isl/process/buildISLResult.js.map +1 -0
- package/dist/isl/process/emitSignal.d.ts +23 -0
- package/dist/isl/process/emitSignal.d.ts.map +1 -0
- package/dist/isl/process/emitSignal.js +39 -0
- package/dist/isl/process/emitSignal.js.map +1 -0
- package/dist/isl/process/index.d.ts +6 -0
- package/dist/isl/process/index.d.ts.map +1 -0
- package/dist/isl/process/index.js +6 -0
- package/dist/isl/process/index.js.map +1 -0
- package/dist/isl/sanitize.d.ts +5 -5
- package/dist/isl/sanitize.d.ts.map +1 -1
- package/dist/isl/sanitize.js +24 -38
- package/dist/isl/sanitize.js.map +1 -1
- package/dist/isl/signals.d.ts +98 -0
- package/dist/isl/signals.d.ts.map +1 -0
- package/dist/isl/signals.js +92 -0
- package/dist/isl/signals.js.map +1 -0
- package/dist/isl/types.d.ts +4 -48
- package/dist/isl/types.d.ts.map +1 -1
- package/dist/isl/types.js +1 -1
- package/dist/isl/value-objects/PiDetection.d.ts +2 -1
- package/dist/isl/value-objects/PiDetection.d.ts.map +1 -1
- package/dist/isl/value-objects/PiDetectionResult.d.ts +2 -3
- package/dist/isl/value-objects/PiDetectionResult.d.ts.map +1 -1
- package/dist/isl/value-objects/PiDetectionResult.js +1 -27
- package/dist/isl/value-objects/PiDetectionResult.js.map +1 -1
- package/dist/isl/value-objects/RiskScore.d.ts +70 -0
- package/dist/isl/value-objects/RiskScore.d.ts.map +1 -0
- package/dist/isl/value-objects/RiskScore.js +85 -0
- package/dist/isl/value-objects/RiskScore.js.map +1 -0
- package/dist/isl/value-objects/index.d.ts +2 -2
- package/dist/isl/value-objects/index.d.ts.map +1 -1
- package/dist/isl/value-objects/index.js +1 -3
- package/dist/isl/value-objects/index.js.map +1 -1
- package/dist/shared/audit.d.ts +150 -0
- package/dist/shared/audit.d.ts.map +1 -0
- package/dist/shared/audit.js +173 -0
- package/dist/shared/audit.js.map +1 -0
- package/dist/shared/index.d.ts +5 -3
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +5 -6
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/types.d.ts +36 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +2 -0
- package/dist/shared/types.js.map +1 -0
- package/package.json +7 -2
- package/dist/isl/value-objects/AnomalyScore.d.ts.map +0 -1
- /package/dist/{isl → AAL}/value-objects/AnomalyScore.js +0 -0
- /package/dist/{isl → AAL}/value-objects/PolicyRule.d.ts +0 -0
- /package/dist/{isl → AAL}/value-objects/PolicyRule.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,8 +7,149 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [0.2.0] - 2026-01-26
|
|
11
|
+
|
|
12
|
+
### ♻️ Architectural Refactor - ISL / AAL Separation
|
|
13
|
+
|
|
14
|
+
- Refactored ISL (Instruction Sanitization Layer) to be strictly pure and semantic
|
|
15
|
+
- Removed all decision-making logic from ISL:
|
|
16
|
+
- No Blocking
|
|
17
|
+
- No allowing
|
|
18
|
+
- No warnings
|
|
19
|
+
- No instruction removal
|
|
20
|
+
- ISL is now responsible for:
|
|
21
|
+
- Malicious pattern detection (prompt injection, jailbreak, role hijacking, ...)
|
|
22
|
+
- Risk scoring (RiskScore)
|
|
23
|
+
- Content sanitization
|
|
24
|
+
- Signal emission and lineage preservation
|
|
25
|
+
|
|
26
|
+
- Introduced AAL (Agent Action Lock) as a distinct hybrid layer:
|
|
27
|
+
- Consume ISL signal (RiskScore, detection)
|
|
28
|
+
- Applies configurable policies (ALLOW / WARN / BLOCK)
|
|
29
|
+
- Decides whether to remove malicious instructions
|
|
30
|
+
- Ensures only sanitized content reaches the LLM
|
|
31
|
+
- Designed as a core-defined contract, implemented at the SDK level
|
|
32
|
+
|
|
33
|
+
- **Shared audit utilities**: Pure functions for ordered, human-readable audit output (`formatCSLForAudit`, `formatISLForAudit`, `formatISLSignalForAudit`, `formatAALForAudit`, `formatCPEForAudit`, `formatPipelineAudit`) for compliance and debugging
|
|
34
|
+
|
|
35
|
+
- **Package**: Version set to 0.2.0; AAL export path corrected (`./aal` → `./dist/AAL/`)
|
|
36
|
+
|
|
37
|
+
### 📚 Documentation
|
|
38
|
+
|
|
39
|
+
- README.md updated to clarify the new ISL / AAL responsibility split; architecture and layer sections in English
|
|
40
|
+
- **Use cases** section added with scenarios (secure chat, policy moderation, audit, DOM/API/SYSTEM sources, lineage)
|
|
41
|
+
- Examples for policy-based moderation (ISL + AAL) and audit report using shared formatters
|
|
42
|
+
- Audit and pretty-print utilities documented (formatCSLForAudit, formatISLForAudit, formatISLSignalForAudit, formatAALForAudit, formatCPEForAudit, formatPipelineAudit)
|
|
43
|
+
|
|
44
|
+
### 🧪 Testing
|
|
45
|
+
|
|
46
|
+
- Added unit tests for CSL (segment, classify), ISL (signals, emitSignal, buildISLResult, RiskScore), AAL (resolveAgentAction, buildDecisionReason, buildRemovalPlan, buildAALLineage, AnomalyScore, PolicyRule), CPE (envelope), and shared (audit formatters)
|
|
47
|
+
- Integration tests updated for ISL Signal → AAL flow; all test messages in English
|
|
48
|
+
- Coverage target met: **92%+** statements for CSL, ISL, AAL, CPE, and shared layers
|
|
49
|
+
|
|
50
|
+
### ⚠️ Breaking Semantic Change
|
|
51
|
+
|
|
52
|
+
- Although public APIs remain mostly stable, ISL behavior has changed semantically
|
|
53
|
+
- Consumers must no longer expect ISL to perform actions or remove instructions
|
|
54
|
+
- Decision logic must be handled by AAL or the SDK
|
|
55
|
+
|
|
56
|
+
## [0.1.8] - 2026-01-04
|
|
57
|
+
|
|
58
|
+
### 🐛 Critical Fixes - Origin Classification
|
|
59
|
+
|
|
60
|
+
- **Fixed source classification mapping**: Corrected the deterministic trust level classification for all content sources to align with AI-PIP protocol specification
|
|
61
|
+
- **Updated trust level assignments**:
|
|
62
|
+
- `SYSTEM` → `TC` (Trusted Content) - System-generated content, fully trusted
|
|
63
|
+
- `UI` → `STC` (Semi-Trusted Content) - User interface content, moderate trust
|
|
64
|
+
- `API` → `STC` (Semi-Trusted Content) - External API content, moderate trust
|
|
65
|
+
- `DOM` → `UC` (Untrusted Content) - DOM/WEB/SCRAPED content, untrusted by default
|
|
66
|
+
- **Corrected sanitization levels**: Updated sanitization logic to match the corrected trust levels (TC → minimal, STC → moderate, UC → aggressive)
|
|
67
|
+
- **Fixed test suite**: Updated all tests to reflect the correct classification, ensuring consistency across the codebase
|
|
68
|
+
|
|
69
|
+
#### What This Fixes
|
|
70
|
+
|
|
71
|
+
**Problem**: During documentation review, inconsistencies were discovered between:
|
|
72
|
+
- The actual source classification implementation
|
|
73
|
+
- The AI-PIP protocol specification
|
|
74
|
+
- Test expectations and assertions
|
|
75
|
+
- Documentation examples
|
|
76
|
+
|
|
77
|
+
**Solution**:
|
|
78
|
+
- Aligned source-to-trust-level mapping with AI-PIP protocol specification
|
|
79
|
+
- Updated `classifySource()` function to use correct deterministic mappings
|
|
80
|
+
- Corrected all test cases to match the proper classification
|
|
81
|
+
- Updated documentation examples to reflect accurate trust levels
|
|
82
|
+
|
|
83
|
+
**Impact**:
|
|
84
|
+
- ✅ Deterministic trust level classification now matches AI-PIP specification
|
|
85
|
+
- ✅ Consistent behavior across all layers (CSL, ISL, CPE)
|
|
86
|
+
- ✅ All tests pass with correct expectations
|
|
87
|
+
- ✅ Documentation accurately reflects actual behavior
|
|
88
|
+
- ✅ Proper sanitization levels applied based on correct trust classification
|
|
89
|
+
|
|
90
|
+
### 📚 Documentation Improvements
|
|
91
|
+
|
|
92
|
+
- **Enhanced usage examples**: Added detailed explanations below each code example describing what each script does and how it works in real-world scenarios
|
|
93
|
+
- **Layer-specific imports documentation**: Updated examples to show practical usage of layer-specific imports with step-by-step explanations
|
|
94
|
+
- **Official SDK announcement**: Added section explaining that `@ai-pip/core` will be used as the foundation for the official AI-PIP SDK
|
|
95
|
+
- **Improved example clarity**: Each example now includes context about when and why to use specific functions, making it easier for users to understand the complete processing pipeline
|
|
96
|
+
- **Updated source classification examples**: All examples now correctly show the trust levels and sanitization levels for each source type
|
|
97
|
+
|
|
98
|
+
#### What This Improves
|
|
99
|
+
|
|
100
|
+
**Problem**: Users visiting the package on npmjs could see code examples but lacked context about:
|
|
101
|
+
- What each example actually does in practice
|
|
102
|
+
- How the processing pipeline works end-to-end
|
|
103
|
+
- When to use specific functions or import strategies
|
|
104
|
+
- The relationship between the core package and the official SDK
|
|
105
|
+
- Correct trust level classification for different sources
|
|
106
|
+
|
|
107
|
+
**Solution**:
|
|
108
|
+
- Added detailed explanations below each code example
|
|
109
|
+
- Explained the purpose and workflow of each processing step
|
|
110
|
+
- Documented the relationship between core and SDK
|
|
111
|
+
- Added professional context about real-world usage
|
|
112
|
+
- Corrected all source classification examples
|
|
113
|
+
|
|
114
|
+
**Impact**:
|
|
115
|
+
- ✅ Users can now understand examples without prior knowledge
|
|
116
|
+
- ✅ Better onboarding experience for new users
|
|
117
|
+
- ✅ Clearer documentation for npmjs visitors
|
|
118
|
+
- ✅ Professional presentation of the package capabilities
|
|
119
|
+
- ✅ Accurate trust level information in all examples
|
|
120
|
+
|
|
121
|
+
### 📦 Package Changes
|
|
122
|
+
|
|
123
|
+
- **Source classification fixes**: Updated `src/csl/classify.ts` with correct source-to-trust-level mappings
|
|
124
|
+
- **Test suite updates**: Fixed all test files to match correct classification:
|
|
125
|
+
- `test/core/csl/classify.test.ts`
|
|
126
|
+
- `test/core/csl/segment.test.ts`
|
|
127
|
+
- `test/core/isl/sanitize.test.ts`
|
|
128
|
+
- `test/core/cpe/envelope.test.ts`
|
|
129
|
+
- `test/core/integration.test.ts`
|
|
130
|
+
- **README.md updated**: Enhanced with practical examples, explanations, and correct source classification
|
|
131
|
+
- **Professional presentation**: Improved clarity and context for all usage examples
|
|
132
|
+
|
|
133
|
+
### ⚠️ Breaking Changes
|
|
134
|
+
|
|
135
|
+
**None** - This is a patch version that fixes classification inconsistencies and improves documentation. The API remains unchanged, but the trust level classification behavior is now correct and consistent with the AI-PIP protocol specification.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
10
139
|
## [0.1.7] - 2026-01-04
|
|
11
140
|
|
|
141
|
+
### ⚠️ DEPRECATED
|
|
142
|
+
|
|
143
|
+
**Deprecation reason**: This version has incorrect source classification that doesn't match the AI-PIP protocol specification. The trust level assignments for sources (UI, DOM, API, SYSTEM) are incorrect, which can lead to improper sanitization levels and security vulnerabilities.
|
|
144
|
+
|
|
145
|
+
**Known issues**:
|
|
146
|
+
- Incorrect source-to-trust-level mapping (UI classified as TC instead of STC, DOM as STC instead of UC, API as UC instead of STC)
|
|
147
|
+
- Inconsistent behavior with AI-PIP protocol specification
|
|
148
|
+
- Tests and documentation don't match actual implementation
|
|
149
|
+
- Potential security risks due to incorrect sanitization levels
|
|
150
|
+
|
|
151
|
+
**Recommendation**: Update to `0.1.8` or higher, which fixes all classification issues and aligns with the AI-PIP protocol specification.
|
|
152
|
+
|
|
12
153
|
### 🐛 Critical Fixes
|
|
13
154
|
|
|
14
155
|
#### Type Resolution Fix
|
|
@@ -62,6 +203,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
62
203
|
|
|
63
204
|
## [0.1.6] - 2025-12-28
|
|
64
205
|
|
|
206
|
+
### ⚠️ DEPRECATED
|
|
207
|
+
|
|
208
|
+
**Deprecation reason**: This version has incorrect source classification that doesn't match the AI-PIP protocol specification. The trust level assignments for sources are incorrect, which can lead to improper sanitization levels and security vulnerabilities.
|
|
209
|
+
|
|
210
|
+
**Known issues**:
|
|
211
|
+
- Incorrect source-to-trust-level mapping
|
|
212
|
+
- Inconsistent behavior with AI-PIP protocol specification
|
|
213
|
+
- Potential security risks due to incorrect sanitization levels
|
|
214
|
+
|
|
215
|
+
**Recommendation**: Update to `0.1.8` or higher, which fixes all classification issues and aligns with the AI-PIP protocol specification.
|
|
216
|
+
|
|
65
217
|
### 📚 Documentation Improvements
|
|
66
218
|
- **Centralized documentation**: Moved all protocol documentation to `ai-pip-docs` repository
|
|
67
219
|
- **Updated README**: Added comprehensive links to centralized documentation
|
|
@@ -75,6 +227,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
75
227
|
|
|
76
228
|
## [0.1.5] - 2025-12-28
|
|
77
229
|
|
|
230
|
+
### ⚠️ DEPRECATED
|
|
231
|
+
|
|
232
|
+
**Deprecation reason**: This version has incorrect source classification that doesn't match the AI-PIP protocol specification. The trust level assignments for sources are incorrect, which can lead to improper sanitization levels and security vulnerabilities.
|
|
233
|
+
|
|
234
|
+
**Known issues**:
|
|
235
|
+
- Incorrect source-to-trust-level mapping
|
|
236
|
+
- Inconsistent behavior with AI-PIP protocol specification
|
|
237
|
+
- Potential security risks due to incorrect sanitization levels
|
|
238
|
+
|
|
239
|
+
**Recommendation**: Update to `0.1.8` or higher, which fixes all classification issues and aligns with the AI-PIP protocol specification.
|
|
240
|
+
|
|
78
241
|
### 📚 Documentation Improvements
|
|
79
242
|
- **Updated README**: Added links to whitepaper, roadmap, and complete layer documentation
|
|
80
243
|
- **Updated Roadmap**: Added SDK-browser in Phase 4, updated Phase 1 status to 100% completed
|
|
@@ -93,6 +256,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
93
256
|
|
|
94
257
|
## [0.1.3] - 2025-12-28
|
|
95
258
|
|
|
259
|
+
### ⚠️ DEPRECATED
|
|
260
|
+
|
|
261
|
+
**Deprecation reason**: This version has incorrect source classification that doesn't match the AI-PIP protocol specification. The trust level assignments for sources are incorrect, which can lead to improper sanitization levels and security vulnerabilities.
|
|
262
|
+
|
|
263
|
+
**Known issues**:
|
|
264
|
+
- Incorrect source-to-trust-level mapping
|
|
265
|
+
- Inconsistent behavior with AI-PIP protocol specification
|
|
266
|
+
- Potential security risks due to incorrect sanitization levels
|
|
267
|
+
|
|
268
|
+
**Recommendation**: Update to `0.1.8` or higher, which fixes all classification issues and aligns with the AI-PIP protocol specification.
|
|
269
|
+
|
|
96
270
|
### ✨ New Features
|
|
97
271
|
- **JavaScript compilation**: The package now compiles to JavaScript (`dist/`) for better compatibility
|
|
98
272
|
- **Type declaration files**: `.d.ts` files are generated for full TypeScript support
|
|
@@ -176,6 +350,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
176
350
|
|
|
177
351
|
---
|
|
178
352
|
|
|
179
|
-
**Current Version**: 0.1.
|
|
353
|
+
**Current Version**: 0.1.8
|
|
180
354
|
**Status**: Phase 1 - Core Layers (100% completed)
|
|
181
355
|
|