@ai-pip/core 0.1.4 → 0.1.6
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 +209 -138
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
- package/src/cpe/envelope.ts +0 -115
- package/src/cpe/exceptions/EnvelopeError.ts +0 -11
- package/src/cpe/exceptions/index.ts +0 -6
- package/src/cpe/index.ts +0 -44
- package/src/cpe/types.ts +0 -68
- package/src/cpe/utils.ts +0 -65
- package/src/cpe/value-objects/Metadata.ts +0 -78
- package/src/cpe/value-objects/Nonce.ts +0 -57
- package/src/cpe/value-objects/Signature.ts +0 -83
- package/src/cpe/value-objects/index.ts +0 -10
- package/src/csl/classify.ts +0 -77
- package/src/csl/exceptions/ClassificationError.ts +0 -16
- package/src/csl/exceptions/SegmentationError.ts +0 -19
- package/src/csl/exceptions/index.ts +0 -3
- package/src/csl/index.ts +0 -55
- package/src/csl/lineage.ts +0 -40
- package/src/csl/segment.ts +0 -100
- package/src/csl/types.ts +0 -113
- package/src/csl/utils.ts +0 -30
- package/src/csl/value-objects/ContentHash.ts +0 -48
- package/src/csl/value-objects/LineageEntry.ts +0 -33
- package/src/csl/value-objects/Origin-map.ts +0 -51
- package/src/csl/value-objects/Origin.ts +0 -52
- package/src/csl/value-objects/TrustLevel.ts +0 -33
- package/src/csl/value-objects/index.ts +0 -14
- package/src/index.ts +0 -94
- package/src/isl/exceptions/SanitizationError.ts +0 -14
- package/src/isl/exceptions/index.ts +0 -2
- package/src/isl/index.ts +0 -53
- package/src/isl/sanitize.ts +0 -93
- package/src/isl/types.ts +0 -87
- package/src/isl/value-objects/AnomalyScore.ts +0 -40
- package/src/isl/value-objects/Pattern.ts +0 -158
- package/src/isl/value-objects/PiDetection.ts +0 -92
- package/src/isl/value-objects/PiDetectionResult.ts +0 -129
- package/src/isl/value-objects/PolicyRule.ts +0 -117
- package/src/isl/value-objects/index.ts +0 -41
- package/src/shared/index.ts +0 -18
- package/src/shared/lineage.ts +0 -53
package/README.md
CHANGED
|
@@ -5,122 +5,155 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/@ai-pip/core)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
|
|
8
|
-
## 📋
|
|
8
|
+
## 📋 Description
|
|
9
9
|
|
|
10
|
-
**AI-PIP (AI Prompt Integrity Protocol)**
|
|
10
|
+
**AI-PIP (AI Prompt Integrity Protocol)** is a multi-layer security protocol designed to protect AI systems against prompt injection and malicious context manipulation.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
This package contains the **core** implementation of the protocol, which includes pure functions, immutable value objects, and semantic contracts between layers.
|
|
13
13
|
|
|
14
|
-
## 🏗️
|
|
14
|
+
## 🏗️ Architecture
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
The AI-PIP protocol is composed of the following layers:
|
|
17
17
|
|
|
18
|
-
### ✅
|
|
18
|
+
### ✅ Implemented Layers
|
|
19
19
|
|
|
20
|
-
- **CSL (Context Segmentation Layer)**:
|
|
21
|
-
- **ISL (Instruction Sanitization Layer)**:
|
|
22
|
-
- **CPE (Cryptographic Prompt Envelope)**:
|
|
20
|
+
- **CSL (Context Segmentation Layer)**: Segments and classifies content according to its origin
|
|
21
|
+
- **ISL (Instruction Sanitization Layer)**: Sanitizes instructions according to trust level
|
|
22
|
+
- **CPE (Cryptographic Prompt Envelope)**: Generates cryptographic envelope with HMAC-SHA256 signature
|
|
23
23
|
|
|
24
|
-
###
|
|
24
|
+
### 🔧 Shared Features
|
|
25
25
|
|
|
26
|
-
- **
|
|
27
|
-
- **Model Gateway**: Interfaz con modelos de IA
|
|
26
|
+
- **Shared**: Shared functions and global incremental lineage (not a layer, but features shared between layers)
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
### 📝 Note on AAL and Model Gateway
|
|
29
|
+
|
|
30
|
+
**AAL (Agent Action Lock)** and **Model Gateway** are SDK components, not part of the semantic core. The semantic core focuses on pure functions and signals, while these layers require operational decisions and side effects that belong to the implementation (SDK).
|
|
31
|
+
|
|
32
|
+
## 📦 Installation
|
|
30
33
|
|
|
31
34
|
```bash
|
|
32
35
|
pnpm add @ai-pip/core
|
|
33
|
-
#
|
|
36
|
+
# or
|
|
34
37
|
npm install @ai-pip/core
|
|
35
|
-
#
|
|
38
|
+
# or
|
|
36
39
|
yarn add @ai-pip/core
|
|
37
40
|
```
|
|
38
41
|
|
|
39
|
-
## 🚀
|
|
42
|
+
## 🚀 Basic Usage
|
|
40
43
|
|
|
41
|
-
###
|
|
44
|
+
### Import from main package
|
|
42
45
|
|
|
43
46
|
```typescript
|
|
44
47
|
import { segment, sanitize, envelope } from '@ai-pip/core'
|
|
48
|
+
import type { CSLResult, ISLResult, CPEResult } from '@ai-pip/core'
|
|
45
49
|
```
|
|
46
50
|
|
|
47
|
-
###
|
|
51
|
+
### Complete Example
|
|
48
52
|
|
|
49
53
|
```typescript
|
|
50
|
-
|
|
51
|
-
import {
|
|
54
|
+
import { segment, sanitize, envelope } from '@ai-pip/core'
|
|
55
|
+
import type { CSLResult, ISLResult, CPEResult } from '@ai-pip/core'
|
|
56
|
+
|
|
57
|
+
// 1. Segment content (CSL)
|
|
58
|
+
const cslResult: CSLResult = segment({
|
|
59
|
+
content: 'User input here',
|
|
60
|
+
source: 'UI',
|
|
61
|
+
metadata: {}
|
|
62
|
+
})
|
|
52
63
|
|
|
53
|
-
//
|
|
54
|
-
|
|
64
|
+
// 2. Sanitize content (ISL)
|
|
65
|
+
const islResult: ISLResult = sanitize(cslResult)
|
|
55
66
|
|
|
56
|
-
//
|
|
57
|
-
|
|
67
|
+
// 3. Generate cryptographic envelope (CPE)
|
|
68
|
+
const secretKey = 'your-secret-key'
|
|
69
|
+
const cpeResult: CPEResult = envelope(islResult, secretKey)
|
|
58
70
|
|
|
59
|
-
//
|
|
60
|
-
|
|
71
|
+
// cpeResult.envelope contains the protected prompt
|
|
72
|
+
console.log(JSON.stringify(cpeResult, null, 2))
|
|
61
73
|
```
|
|
62
74
|
|
|
63
|
-
###
|
|
75
|
+
### Example with additional functions
|
|
64
76
|
|
|
65
77
|
```typescript
|
|
66
|
-
import {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
import {
|
|
79
|
+
segment,
|
|
80
|
+
sanitize,
|
|
81
|
+
envelope,
|
|
82
|
+
classifySource,
|
|
83
|
+
addLineageEntry,
|
|
84
|
+
createNonce
|
|
85
|
+
} from '@ai-pip/core'
|
|
86
|
+
import type {
|
|
87
|
+
CSLResult,
|
|
88
|
+
ISLResult,
|
|
89
|
+
CPEResult,
|
|
90
|
+
Source,
|
|
91
|
+
TrustLevel
|
|
92
|
+
} from '@ai-pip/core'
|
|
93
|
+
|
|
94
|
+
// Classify a source
|
|
95
|
+
const trust = classifySource('UI' as Source)
|
|
96
|
+
|
|
97
|
+
// Add lineage entry
|
|
98
|
+
const updatedLineage = addLineageEntry(cslResult.lineage, {
|
|
99
|
+
step: 'CUSTOM',
|
|
100
|
+
timestamp: Date.now()
|
|
75
101
|
})
|
|
76
102
|
|
|
77
|
-
//
|
|
78
|
-
const
|
|
103
|
+
// Generate nonce
|
|
104
|
+
const nonce = createNonce()
|
|
105
|
+
```
|
|
79
106
|
|
|
80
|
-
|
|
81
|
-
const secretKey = 'your-secret-key'
|
|
82
|
-
const cpeResult = envelope(islResult, secretKey)
|
|
107
|
+
## 📚 Documentation
|
|
83
108
|
|
|
84
|
-
|
|
85
|
-
|
|
109
|
+
All AI-PIP protocol documentation is centralized in the [documentation repository](https://github.com/AI-PIP/ai-pip-docs):
|
|
110
|
+
|
|
111
|
+
### Protocol Documentation
|
|
86
112
|
|
|
87
|
-
|
|
113
|
+
- **[Whitepaper](https://github.com/AI-PIP/ai-pip-docs/blob/main/docs/whitepaper.md)** - Complete technical specification
|
|
114
|
+
- **[Architecture](https://github.com/AI-PIP/ai-pip-docs/blob/main/docs/architecture.md)** - Semantic architecture
|
|
115
|
+
- **[Roadmap](https://github.com/AI-PIP/ai-pip-docs/blob/main/docs/roadmap.md)** - Development plan
|
|
88
116
|
|
|
89
|
-
###
|
|
117
|
+
### Core Documentation
|
|
90
118
|
|
|
91
|
-
- **[
|
|
92
|
-
- **[
|
|
93
|
-
- **[
|
|
119
|
+
- **[Core Overview](https://github.com/AI-PIP/ai-pip-docs/blob/main/docs/core/CORE.md)** - Semantic core description
|
|
120
|
+
- **[CSL (Context Segmentation Layer)](https://github.com/AI-PIP/ai-pip-docs/blob/main/docs/core/layers/CSL.md)** - Context segmentation layer
|
|
121
|
+
- **[ISL (Instruction Sanitization Layer)](https://github.com/AI-PIP/ai-pip-docs/blob/main/docs/core/layers/ISL.md)** - Instruction sanitization layer
|
|
122
|
+
- **[CPE (Cryptographic Prompt Envelope)](https://github.com/AI-PIP/ai-pip-docs/blob/main/docs/core/layers/CPE.md)** - Cryptographic prompt envelope
|
|
123
|
+
- **[Shared](https://github.com/AI-PIP/ai-pip-docs/blob/main/docs/core/layers/shared.md)** - Shared features and lineage
|
|
94
124
|
|
|
95
|
-
###
|
|
125
|
+
### SDK Documentation
|
|
96
126
|
|
|
97
|
-
- **[
|
|
98
|
-
- **[
|
|
99
|
-
|
|
100
|
-
-
|
|
127
|
+
- **[SDK](https://github.com/AI-PIP/ai-pip-docs/blob/main/docs/sdk/sdk.md)** - SDK implementation guide
|
|
128
|
+
- **[SDK Reference](https://github.com/AI-PIP/ai-pip-docs/blob/main/docs/sdk/sdk-reference.md)** - Complete SDK reference guide
|
|
129
|
+
|
|
130
|
+
### Code-Specific Documentation
|
|
131
|
+
|
|
132
|
+
- **[CHANGELOG](./CHANGELOG.md)** - Package version history
|
|
133
|
+
- **[API Reference](#-basic-usage)** - Usage examples in this README
|
|
101
134
|
|
|
102
135
|
## 🧪 Testing
|
|
103
136
|
|
|
104
137
|
```bash
|
|
105
|
-
#
|
|
138
|
+
# Run tests
|
|
106
139
|
pnpm test
|
|
107
140
|
|
|
108
|
-
# Tests
|
|
141
|
+
# Tests in watch mode
|
|
109
142
|
pnpm test:watch
|
|
110
143
|
|
|
111
|
-
# Tests
|
|
144
|
+
# Tests with coverage
|
|
112
145
|
pnpm test:coverage
|
|
113
146
|
|
|
114
|
-
# UI
|
|
147
|
+
# Test UI
|
|
115
148
|
pnpm test:ui
|
|
116
149
|
```
|
|
117
150
|
|
|
118
|
-
**
|
|
151
|
+
**Current coverage**: 87%
|
|
119
152
|
|
|
120
|
-
## 🔧
|
|
153
|
+
## 🔧 Development
|
|
121
154
|
|
|
122
155
|
```bash
|
|
123
|
-
#
|
|
156
|
+
# Install dependencies
|
|
124
157
|
pnpm install
|
|
125
158
|
|
|
126
159
|
# Type checking
|
|
@@ -129,21 +162,21 @@ pnpm type-check
|
|
|
129
162
|
# Linting
|
|
130
163
|
pnpm lint
|
|
131
164
|
|
|
132
|
-
#
|
|
165
|
+
# Development
|
|
133
166
|
pnpm dev
|
|
134
167
|
```
|
|
135
168
|
|
|
136
|
-
## 📋
|
|
169
|
+
## 📋 Requirements
|
|
137
170
|
|
|
138
171
|
### Runtime
|
|
139
172
|
- **Node.js**: >= 18.0.0
|
|
140
|
-
- **pnpm**: >= 8.0.0 (
|
|
173
|
+
- **pnpm**: >= 8.0.0 (recommended) or npm/yarn
|
|
141
174
|
|
|
142
|
-
### TypeScript ⚠️ **
|
|
175
|
+
### TypeScript ⚠️ **REQUIRED**
|
|
143
176
|
|
|
144
|
-
|
|
177
|
+
This package uses ESM (`"type": "module"`) and exports with subpaths. For TypeScript to correctly resolve imports and types, your project **MUST** have the following configuration in `tsconfig.json`:
|
|
145
178
|
|
|
146
|
-
**
|
|
179
|
+
**Minimum required configuration:**
|
|
147
180
|
|
|
148
181
|
```json
|
|
149
182
|
{
|
|
@@ -155,12 +188,12 @@ Este paquete utiliza ESM (`"type": "module"`) y exports con subpaths. Para que T
|
|
|
155
188
|
}
|
|
156
189
|
```
|
|
157
190
|
|
|
158
|
-
**⚠️
|
|
191
|
+
**⚠️ CRITICAL**: Without this configuration, you will get errors like:
|
|
159
192
|
- `Module '"@ai-pip/core/csl"' has no exported member 'CSLResult'`
|
|
160
193
|
- `ERR_PACKAGE_PATH_NOT_EXPORTED`
|
|
161
|
-
-
|
|
194
|
+
- Types will not resolve correctly
|
|
162
195
|
|
|
163
|
-
####
|
|
196
|
+
#### Recommended complete `tsconfig.json` example
|
|
164
197
|
|
|
165
198
|
```json
|
|
166
199
|
{
|
|
@@ -177,121 +210,159 @@ Este paquete utiliza ESM (`"type": "module"`) y exports con subpaths. Para que T
|
|
|
177
210
|
}
|
|
178
211
|
```
|
|
179
212
|
|
|
180
|
-
####
|
|
213
|
+
#### Important notes
|
|
181
214
|
|
|
182
|
-
- **
|
|
183
|
-
- **
|
|
184
|
-
- **JavaScript
|
|
215
|
+
- **From version 0.1.2+**: This configuration is mandatory. Previous versions (0.1.0, 0.1.1) are deprecated.
|
|
216
|
+
- **If you use `tsx` or `ts-node`**: Even if you run TypeScript directly, you **still need** this configuration in `tsconfig.json` for TypeScript to resolve types correctly.
|
|
217
|
+
- **Pure JavaScript**: If you use JavaScript without TypeScript, you don't need this configuration, but you will lose type support.
|
|
185
218
|
|
|
186
|
-
## 📄
|
|
219
|
+
## 📄 License
|
|
187
220
|
|
|
188
|
-
Apache-2.0 -
|
|
221
|
+
Apache-2.0 - See [LICENSE](LICENSE) for more details.
|
|
189
222
|
|
|
190
|
-
## 🤝
|
|
223
|
+
## 🤝 Contributing
|
|
191
224
|
|
|
192
|
-
|
|
225
|
+
Contributions are welcome. Please:
|
|
193
226
|
|
|
194
|
-
1.
|
|
195
|
-
2.
|
|
196
|
-
3.
|
|
227
|
+
1. Review the [Roadmap](https://github.com/AI-PIP/ai-pip-docs/blob/main/roadmap.md) to see what's pending
|
|
228
|
+
2. Open an issue to discuss major changes
|
|
229
|
+
3. Submit a pull request with your improvements
|
|
197
230
|
|
|
198
|
-
**
|
|
231
|
+
**Repository**: https://github.com/AI-PIP/ai-pip-core
|
|
199
232
|
**Issues**: https://github.com/AI-PIP/ai-pip-core/issues
|
|
200
233
|
|
|
201
|
-
## 🔗
|
|
234
|
+
## 🔗 Links
|
|
202
235
|
|
|
203
|
-
- **
|
|
236
|
+
- **Documentation**: [ai-pip-docs](https://github.com/AI-PIP/ai-pip-docs)
|
|
204
237
|
- **NPM Package**: https://www.npmjs.com/package/@ai-pip/core
|
|
205
238
|
- **GitHub**: https://github.com/AI-PIP/ai-pip-core
|
|
206
239
|
|
|
240
|
+
## 🔮 Future Improvements
|
|
241
|
+
|
|
242
|
+
### Imports by Specific Layer
|
|
243
|
+
|
|
244
|
+
Currently, it's recommended to import from the main package (`@ai-pip/core`) to avoid confusion with similar names between layers. In future versions, support for direct imports from specific layers will be improved:
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
// Future (in development)
|
|
248
|
+
import { segment } from '@ai-pip/core/csl'
|
|
249
|
+
import { sanitize } from '@ai-pip/core/isl'
|
|
250
|
+
import { envelope } from '@ai-pip/core/cpe'
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
This will enable:
|
|
254
|
+
- **Better organization**: Import only what's needed from each layer
|
|
255
|
+
- **Avoid conflicts**: Prevent confusion with similarly named functions
|
|
256
|
+
- **Improved tree-shaking**: Bundlers will be able to eliminate unused code more efficiently
|
|
257
|
+
|
|
258
|
+
**Note**: Exports by layer are technically available, but it's recommended to use the main package until module resolution optimization is complete.
|
|
259
|
+
|
|
207
260
|
---
|
|
208
261
|
|
|
209
262
|
## 📝 CHANGELOG
|
|
210
263
|
|
|
264
|
+
### [0.1.5] - 2025-12-28
|
|
265
|
+
|
|
266
|
+
#### 📚 Documentation Improvements
|
|
267
|
+
- **Updated README**: Added links to whitepaper, roadmap, and complete layer documentation
|
|
268
|
+
- **Updated Roadmap**: Added SDK-browser in Phase 4, updated Phase 1 status to 100% completed
|
|
269
|
+
- **Architecture clarification**: Corrected documentation about Shared (not a layer, but shared features)
|
|
270
|
+
- **SDK note**: Updated explanation about AAL and Model Gateway (they are SDK components, not core)
|
|
271
|
+
|
|
272
|
+
#### 🔧 Optimizations
|
|
273
|
+
- **Package size reduction**: Removed `src/` from `files` field in `package.json` to make the package lighter
|
|
274
|
+
- **Optimized package**: Only necessary files are included (`dist/`, `tsconfig.json`, `README.md`, `LICENSE`)
|
|
275
|
+
|
|
276
|
+
#### ✨ Improvements
|
|
277
|
+
- **Layer documentation**: Added link to Shared documentation (shared features)
|
|
278
|
+
- **Documentation organization**: Reorganized documentation section with priority on whitepaper and roadmap
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
211
282
|
### [0.1.3] - 2025-12-28
|
|
212
283
|
|
|
213
|
-
#### ✨
|
|
214
|
-
- **
|
|
215
|
-
- **
|
|
216
|
-
- **Source maps**:
|
|
217
|
-
|
|
218
|
-
#### 🔧
|
|
219
|
-
- **
|
|
220
|
-
- **
|
|
221
|
-
- **
|
|
222
|
-
- **
|
|
223
|
-
- **ESLint**:
|
|
224
|
-
|
|
225
|
-
#### 🐛
|
|
226
|
-
- **
|
|
227
|
-
- **Imports
|
|
228
|
-
- **
|
|
229
|
-
- **
|
|
230
|
-
|
|
231
|
-
#### 📚
|
|
232
|
-
- **
|
|
233
|
-
- **
|
|
234
|
-
- **CHANGELOG
|
|
235
|
-
|
|
236
|
-
#### 🛠️
|
|
237
|
-
- **
|
|
238
|
-
- **
|
|
284
|
+
#### ✨ New Features
|
|
285
|
+
- **JavaScript compilation**: The package now compiles to JavaScript (`dist/`) for better compatibility
|
|
286
|
+
- **Type declaration files**: `.d.ts` files are generated for full TypeScript support
|
|
287
|
+
- **Source maps**: Included for better debugging
|
|
288
|
+
|
|
289
|
+
#### 🔧 Technical Changes
|
|
290
|
+
- **Publication structure**: Changed from publishing `.ts` files directly to compiling to `dist/`
|
|
291
|
+
- **Improved exports**: Exports now point to compiled files (`.js` and `.d.ts`)
|
|
292
|
+
- **Relative paths**: Replaced path aliases (`@/`) with relative paths for compatibility
|
|
293
|
+
- **Build configuration**: Fixed generation of `.d.ts` files in `dist/` instead of `src/`
|
|
294
|
+
- **ESLint**: Configured to ignore generated `.d.ts` files
|
|
295
|
+
|
|
296
|
+
#### 🐛 Fixes
|
|
297
|
+
- **Type resolution**: TypeScript types now resolve correctly from `node_modules`
|
|
298
|
+
- **Imports from subpaths**: Fixed imports from `@ai-pip/core/csl`, `@ai-pip/core/isl`, etc.
|
|
299
|
+
- **Complete exports**: Added `default` field to all exports for Node.js ESM
|
|
300
|
+
- **File generation**: `.d.ts` files now generate correctly in `dist/`
|
|
301
|
+
|
|
302
|
+
#### 📚 Documentation
|
|
303
|
+
- **TypeScript requirements**: Improved documentation about required configuration
|
|
304
|
+
- **Updated examples**: Usage examples updated for new structure
|
|
305
|
+
- **Complete CHANGELOG**: Documentation of all versions and deprecations
|
|
306
|
+
|
|
307
|
+
#### 🛠️ Development Improvements
|
|
308
|
+
- **test:install script**: Script to verify installation before publishing
|
|
309
|
+
- **prepublishOnly script**: Automatically runs build, lint, tests, and test:install before publishing
|
|
239
310
|
|
|
240
311
|
#### ⚠️ Breaking Changes
|
|
241
|
-
- **
|
|
312
|
+
- **TypeScript configuration required**: It's now **mandatory** to use `module: "NodeNext"` and `moduleResolution: "nodenext"` in `tsconfig.json`
|
|
242
313
|
|
|
243
314
|
---
|
|
244
315
|
|
|
245
316
|
### [0.1.2] - 2025-12-28
|
|
246
317
|
|
|
247
|
-
#### ⚠️
|
|
318
|
+
#### ⚠️ DEPRECATED
|
|
248
319
|
|
|
249
|
-
**
|
|
320
|
+
**Deprecation reason**: This version had issues with compilation and `.d.ts` file generation. Files were generated in incorrect locations (`src/` instead of `dist/`), causing linting errors and type resolution problems.
|
|
250
321
|
|
|
251
|
-
**
|
|
252
|
-
-
|
|
253
|
-
- ESLint
|
|
254
|
-
-
|
|
255
|
-
-
|
|
322
|
+
**Known issues**:
|
|
323
|
+
- `.d.ts` files were generated in `src/` instead of `dist/`
|
|
324
|
+
- ESLint tried to lint generated `.d.ts` files, causing errors
|
|
325
|
+
- Incomplete build configuration (`declarationDir` misconfigured)
|
|
326
|
+
- Types did not resolve correctly in some cases
|
|
256
327
|
|
|
257
|
-
**
|
|
328
|
+
**Recommendation**: Update to `0.1.3` or higher.
|
|
258
329
|
|
|
259
330
|
---
|
|
260
331
|
|
|
261
332
|
### [0.1.1] - 2025-12-28
|
|
262
333
|
|
|
263
|
-
#### ⚠️
|
|
334
|
+
#### ⚠️ DEPRECATED
|
|
264
335
|
|
|
265
|
-
**
|
|
336
|
+
**Deprecation reason**: This version had issues with path alias resolution (`@/`) that caused errors when importing from other projects. Types did not resolve correctly when the package was installed from npm.
|
|
266
337
|
|
|
267
|
-
**
|
|
268
|
-
-
|
|
269
|
-
- Path aliases
|
|
270
|
-
-
|
|
338
|
+
**Known issues**:
|
|
339
|
+
- Errors: `Module '"@ai-pip/core/csl"' has no exported member 'CSLResult'`
|
|
340
|
+
- Path aliases did not work in consumer projects
|
|
341
|
+
- Types did not resolve correctly from `node_modules`
|
|
271
342
|
|
|
272
|
-
**
|
|
343
|
+
**Recommendation**: Update to `0.1.3` or higher.
|
|
273
344
|
|
|
274
345
|
---
|
|
275
346
|
|
|
276
347
|
### [0.1.0] - 2025-12-28
|
|
277
348
|
|
|
278
|
-
#### ⚠️
|
|
349
|
+
#### ⚠️ DEPRECATED
|
|
279
350
|
|
|
280
|
-
**
|
|
351
|
+
**Deprecation reason**: Initial version with fundamental compatibility issues. Exports did not include the `default` field required by Node.js ESM, causing `ERR_PACKAGE_PATH_NOT_EXPORTED` errors.
|
|
281
352
|
|
|
282
|
-
**
|
|
283
|
-
-
|
|
284
|
-
-
|
|
285
|
-
- Path aliases
|
|
353
|
+
**Known issues**:
|
|
354
|
+
- Errors: `ERR_PACKAGE_PATH_NOT_EXPORTED` when importing subpaths
|
|
355
|
+
- Incomplete exports: Missing `default` field in exports
|
|
356
|
+
- Path aliases did not work correctly
|
|
286
357
|
|
|
287
|
-
**
|
|
358
|
+
**Recommendation**: Update to `0.1.3` or higher.
|
|
288
359
|
|
|
289
|
-
#### 📦
|
|
290
|
-
- **CSL (Context Segmentation Layer)**:
|
|
291
|
-
- **ISL (Instruction Sanitization Layer)**:
|
|
292
|
-
- **CPE (Cryptographic Prompt Envelope)**:
|
|
360
|
+
#### 📦 Initial Content
|
|
361
|
+
- **CSL (Context Segmentation Layer)**: Content segmentation and classification
|
|
362
|
+
- **ISL (Instruction Sanitization Layer)**: Instruction sanitization
|
|
363
|
+
- **CPE (Cryptographic Prompt Envelope)**: Cryptographic envelope with HMAC-SHA256
|
|
293
364
|
|
|
294
365
|
---
|
|
295
366
|
|
|
296
|
-
**
|
|
297
|
-
**
|
|
367
|
+
**Current Version**: 0.1.5
|
|
368
|
+
**Status**: Phase 1 - Core Layers (100% completed)
|
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
* @ai-pip/core - Core implementation of the AI-PIP protocol
|
|
3
3
|
*
|
|
4
4
|
* @remarks
|
|
5
|
-
* Main entry point that re-exports all layers (CSL, ISL, Shared)
|
|
5
|
+
* Main entry point that re-exports all layers (CSL, ISL, CPE, Shared)
|
|
6
6
|
*
|
|
7
|
-
* You can
|
|
7
|
+
* You can import from specific layers:
|
|
8
8
|
* - import { segment } from '@ai-pip/core/csl'
|
|
9
9
|
* - import { sanitize } from '@ai-pip/core/isl'
|
|
10
|
-
* - import { addLineageEntry } from '@ai-pip/core/shared'
|
|
11
10
|
* - import { envelope } from '@ai-pip/core/cpe'
|
|
11
|
+
*
|
|
12
|
+
* Or import everything from the main entry point:
|
|
13
|
+
* - import { addLineageEntry, segment, sanitize, envelope } from '@ai-pip/core'
|
|
14
|
+
*
|
|
15
|
+
* Note: Shared functions are only available from the main entry point, not as a subpath.
|
|
12
16
|
*/
|
|
13
17
|
export { segment, classifySource, classifyOrigin, initLineage, createLineageEntry, generateId, splitByContextRules, OriginType, TrustLevelType, ClassificationError, SegmentationError } from './csl';
|
|
14
18
|
export type { HashAlgorithm, Source, CSLInput, CSLSegment, CSLResult, TrustLevel, Origin, LineageEntry, ContentHash } from './csl';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,OAAO,CAAA;AACd,YAAY,EACV,aAAa,EACb,MAAM,EACN,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,EACV,MAAM,EACN,YAAY,EACZ,WAAW,EACZ,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,YAAY,EACV,SAAS,EACT,aAAa,EACb,QAAQ,EACR,aAAa,EACb,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACR,MAAM,OAAO,CAAA;AACd,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,6BAA6B,EAC7B,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EAClB,MAAM,OAAO,CAAA;AAGd,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,UAAU,CAAA;AAGjB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,wBAAwB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACnK,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
* @ai-pip/core - Core implementation of the AI-PIP protocol
|
|
3
3
|
*
|
|
4
4
|
* @remarks
|
|
5
|
-
* Main entry point that re-exports all layers (CSL, ISL, Shared)
|
|
5
|
+
* Main entry point that re-exports all layers (CSL, ISL, CPE, Shared)
|
|
6
6
|
*
|
|
7
|
-
* You can
|
|
7
|
+
* You can import from specific layers:
|
|
8
8
|
* - import { segment } from '@ai-pip/core/csl'
|
|
9
9
|
* - import { sanitize } from '@ai-pip/core/isl'
|
|
10
|
-
* - import { addLineageEntry } from '@ai-pip/core/shared'
|
|
11
10
|
* - import { envelope } from '@ai-pip/core/cpe'
|
|
11
|
+
*
|
|
12
|
+
* Or import everything from the main entry point:
|
|
13
|
+
* - import { addLineageEntry, segment, sanitize, envelope } from '@ai-pip/core'
|
|
14
|
+
*
|
|
15
|
+
* Note: Shared functions are only available from the main entry point, not as a subpath.
|
|
12
16
|
*/
|
|
13
17
|
// Re-export CSL
|
|
14
18
|
export { segment, classifySource, classifyOrigin, initLineage, createLineageEntry, generateId, splitByContextRules, OriginType, TrustLevelType, ClassificationError, SegmentationError } from './csl';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,gBAAgB;AAChB,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,OAAO,CAAA;AAad,gBAAgB;AAChB,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAiBhC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,6BAA6B,EAC7B,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EAClB,MAAM,OAAO,CAAA;AAEd,mBAAmB;AACnB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,UAAU,CAAA;AAEjB,gBAAgB;AAChB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,wBAAwB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-pip/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Core implementation of the AI-PIP protocol. Provides layered, zero-trust context processing (CSL, ISL, CPE, ALL, ModelGateway)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"dist",
|
|
37
|
-
"src",
|
|
38
37
|
"tsconfig.json",
|
|
39
38
|
"README.md",
|
|
40
39
|
"LICENSE"
|