@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.
Files changed (45) hide show
  1. package/README.md +209 -138
  2. package/dist/index.d.ts +7 -3
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +7 -3
  5. package/dist/index.js.map +1 -1
  6. package/package.json +1 -2
  7. package/src/cpe/envelope.ts +0 -115
  8. package/src/cpe/exceptions/EnvelopeError.ts +0 -11
  9. package/src/cpe/exceptions/index.ts +0 -6
  10. package/src/cpe/index.ts +0 -44
  11. package/src/cpe/types.ts +0 -68
  12. package/src/cpe/utils.ts +0 -65
  13. package/src/cpe/value-objects/Metadata.ts +0 -78
  14. package/src/cpe/value-objects/Nonce.ts +0 -57
  15. package/src/cpe/value-objects/Signature.ts +0 -83
  16. package/src/cpe/value-objects/index.ts +0 -10
  17. package/src/csl/classify.ts +0 -77
  18. package/src/csl/exceptions/ClassificationError.ts +0 -16
  19. package/src/csl/exceptions/SegmentationError.ts +0 -19
  20. package/src/csl/exceptions/index.ts +0 -3
  21. package/src/csl/index.ts +0 -55
  22. package/src/csl/lineage.ts +0 -40
  23. package/src/csl/segment.ts +0 -100
  24. package/src/csl/types.ts +0 -113
  25. package/src/csl/utils.ts +0 -30
  26. package/src/csl/value-objects/ContentHash.ts +0 -48
  27. package/src/csl/value-objects/LineageEntry.ts +0 -33
  28. package/src/csl/value-objects/Origin-map.ts +0 -51
  29. package/src/csl/value-objects/Origin.ts +0 -52
  30. package/src/csl/value-objects/TrustLevel.ts +0 -33
  31. package/src/csl/value-objects/index.ts +0 -14
  32. package/src/index.ts +0 -94
  33. package/src/isl/exceptions/SanitizationError.ts +0 -14
  34. package/src/isl/exceptions/index.ts +0 -2
  35. package/src/isl/index.ts +0 -53
  36. package/src/isl/sanitize.ts +0 -93
  37. package/src/isl/types.ts +0 -87
  38. package/src/isl/value-objects/AnomalyScore.ts +0 -40
  39. package/src/isl/value-objects/Pattern.ts +0 -158
  40. package/src/isl/value-objects/PiDetection.ts +0 -92
  41. package/src/isl/value-objects/PiDetectionResult.ts +0 -129
  42. package/src/isl/value-objects/PolicyRule.ts +0 -117
  43. package/src/isl/value-objects/index.ts +0 -41
  44. package/src/shared/index.ts +0 -18
  45. package/src/shared/lineage.ts +0 -53
package/README.md CHANGED
@@ -5,122 +5,155 @@
5
5
  [![npm version](https://img.shields.io/npm/v/@ai-pip/core)](https://www.npmjs.com/package/@ai-pip/core)
6
6
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
7
7
 
8
- ## 📋 Descripción
8
+ ## 📋 Description
9
9
 
10
- **AI-PIP (AI Prompt Integrity Protocol)** es un protocolo de seguridad de múltiples capas diseñado para proteger sistemas de IA contra prompt injection y manipulación maliciosa de contexto.
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
- Este paquete contiene la implementación **core** del protocolo, que incluye funciones puras, value objects inmutables y contratos semánticos entre capas.
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
- ## 🏗️ Arquitectura
14
+ ## 🏗️ Architecture
15
15
 
16
- El protocolo AI-PIP está compuesto por las siguientes capas:
16
+ The AI-PIP protocol is composed of the following layers:
17
17
 
18
- ### ✅ Capas Implementadas
18
+ ### ✅ Implemented Layers
19
19
 
20
- - **CSL (Context Segmentation Layer)**: Segmenta y clasifica contenido según su origen
21
- - **ISL (Instruction Sanitization Layer)**: Sanitiza instrucciones según nivel de confianza
22
- - **CPE (Cryptographic Prompt Envelope)**: Genera envoltorio criptográfico con firma HMAC-SHA256
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
- ### Capas Pendientes
24
+ ### 🔧 Shared Features
25
25
 
26
- - **AAL (Agent Action Lock)**: Bloqueo de acciones de agentes
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
- ## 📦 Instalación
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
- # o
36
+ # or
34
37
  npm install @ai-pip/core
35
- # o
38
+ # or
36
39
  yarn add @ai-pip/core
37
40
  ```
38
41
 
39
- ## 🚀 Uso Básico
42
+ ## 🚀 Basic Usage
40
43
 
41
- ### Importar capas completas
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
- ### Importar capas específicas
51
+ ### Complete Example
48
52
 
49
53
  ```typescript
50
- // CSL - Context Segmentation Layer
51
- import { segment, classifySource } from '@ai-pip/core/csl'
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
- // ISL - Instruction Sanitization Layer
54
- import { sanitize, createPolicyRule } from '@ai-pip/core/isl'
64
+ // 2. Sanitize content (ISL)
65
+ const islResult: ISLResult = sanitize(cslResult)
55
66
 
56
- // CPE - Cryptographic Prompt Envelope
57
- import { envelope, createNonce } from '@ai-pip/core/cpe'
67
+ // 3. Generate cryptographic envelope (CPE)
68
+ const secretKey = 'your-secret-key'
69
+ const cpeResult: CPEResult = envelope(islResult, secretKey)
58
70
 
59
- // Shared utilities
60
- import { addLineageEntry } from '@ai-pip/core/shared'
71
+ // cpeResult.envelope contains the protected prompt
72
+ console.log(JSON.stringify(cpeResult, null, 2))
61
73
  ```
62
74
 
63
- ### Ejemplo Completo
75
+ ### Example with additional functions
64
76
 
65
77
  ```typescript
66
- import { segment } from '@ai-pip/core/csl'
67
- import { sanitize } from '@ai-pip/core/isl'
68
- import { envelope } from '@ai-pip/core/cpe'
69
-
70
- // 1. Segmentar contenido (CSL)
71
- const cslResult = segment({
72
- content: 'User input here',
73
- source: 'UI',
74
- metadata: {}
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
- // 2. Sanitizar contenido (ISL)
78
- const islResult = sanitize(cslResult)
103
+ // Generate nonce
104
+ const nonce = createNonce()
105
+ ```
79
106
 
80
- // 3. Generar envelope criptográfico (CPE)
81
- const secretKey = 'your-secret-key'
82
- const cpeResult = envelope(islResult, secretKey)
107
+ ## 📚 Documentation
83
108
 
84
- // cpeResult.envelope contiene el prompt protegido
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
- ## 📚 Documentación
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
- ### Documentación de Capas
117
+ ### Core Documentation
90
118
 
91
- - **[CSL - Context Segmentation Layer](docs/layer/csl.md)**: Documentación completa de la capa de segmentación
92
- - **[ISL - Instruction Sanitization Layer](docs/layer/isl.md)**: Documentación completa de la capa de sanitización
93
- - **[CPE - Cryptographic Prompt Envelope](docs/layer/cpe.md)**: Documentación completa del envoltorio criptográfico
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
- ### Documentación General
125
+ ### SDK Documentation
96
126
 
97
- - **[Arquitectura](docs/architecture.md)**: Arquitectura semántica del protocolo
98
- - **[Roadmap](docs/roadmap.md)**: Plan de desarrollo y evolución
99
- - **[Whitepaper](docs/whitepaper.md)**: Especificación técnica completa
100
- - **[SDK Reference](docs/SDK.md)**: Referencia para desarrollo de SDKs
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
- # Ejecutar tests
138
+ # Run tests
106
139
  pnpm test
107
140
 
108
- # Tests en modo watch
141
+ # Tests in watch mode
109
142
  pnpm test:watch
110
143
 
111
- # Tests con cobertura
144
+ # Tests with coverage
112
145
  pnpm test:coverage
113
146
 
114
- # UI de tests
147
+ # Test UI
115
148
  pnpm test:ui
116
149
  ```
117
150
 
118
- **Cobertura actual**: 87%
151
+ **Current coverage**: 87%
119
152
 
120
- ## 🔧 Desarrollo
153
+ ## 🔧 Development
121
154
 
122
155
  ```bash
123
- # Instalar dependencias
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
- # Desarrollo
165
+ # Development
133
166
  pnpm dev
134
167
  ```
135
168
 
136
- ## 📋 Requisitos
169
+ ## 📋 Requirements
137
170
 
138
171
  ### Runtime
139
172
  - **Node.js**: >= 18.0.0
140
- - **pnpm**: >= 8.0.0 (recomendado) o npm/yarn
173
+ - **pnpm**: >= 8.0.0 (recommended) or npm/yarn
141
174
 
142
- ### TypeScript ⚠️ **REQUERIDO**
175
+ ### TypeScript ⚠️ **REQUIRED**
143
176
 
144
- Este paquete utiliza ESM (`"type": "module"`) y exports con subpaths. Para que TypeScript resuelva correctamente los imports y tipos, tu proyecto **DEBE** tener la siguiente configuración en `tsconfig.json`:
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
- **Configuración mínima requerida:**
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
- **⚠️ CRÍTICO**: Sin esta configuración, obtendrás errores como:
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
- - Los tipos no se resolverán correctamente
194
+ - Types will not resolve correctly
162
195
 
163
- #### Ejemplo de `tsconfig.json` completo recomendado
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
- #### Notas importantes
213
+ #### Important notes
181
214
 
182
- - **Desde la versión 0.1.2+**: Esta configuración es obligatoria. Las versiones anteriores (0.1.0, 0.1.1) están deprecadas.
183
- - **Si usas `tsx` o `ts-node`**: Aunque ejecutes TypeScript directamente, **aún necesitas** esta configuración en `tsconfig.json` para que TypeScript resuelva los tipos correctamente.
184
- - **JavaScript puro**: Si usas JavaScript sin TypeScript, no necesitas esta configuración, pero perderás el soporte de tipos.
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
- ## 📄 Licencia
219
+ ## 📄 License
187
220
 
188
- Apache-2.0 - Ver [LICENSE](LICENSE) para más detalles.
221
+ Apache-2.0 - See [LICENSE](LICENSE) for more details.
189
222
 
190
- ## 🤝 Contribuir
223
+ ## 🤝 Contributing
191
224
 
192
- Las contribuciones son bienvenidas. Por favor:
225
+ Contributions are welcome. Please:
193
226
 
194
- 1. Revisa el [Roadmap](docs/roadmap.md) para ver qué está pendiente
195
- 2. Abre un issue para discutir cambios mayores
196
- 3. Envía un pull request con tus mejoras
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
- **Repositorio**: https://github.com/AI-PIP/ai-pip-core
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
- ## 🔗 Enlaces
234
+ ## 🔗 Links
202
235
 
203
- - **Documentación**: [docs/](docs/)
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
- #### ✨ Nuevas características
214
- - **Compilación a JavaScript**: El paquete ahora se compila a JavaScript (`dist/`) para mayor compatibilidad
215
- - **Archivos de declaración de tipos**: Se generan archivos `.d.ts` para soporte completo de TypeScript
216
- - **Source maps**: Incluidos para mejor debugging
217
-
218
- #### 🔧 Cambios técnicos
219
- - **Estructura de publicación**: Cambio de publicar archivos `.ts` directamente a compilar a `dist/`
220
- - **Exports mejorados**: Los exports ahora apuntan a archivos compilados (`.js` y `.d.ts`)
221
- - **Rutas relativas**: Reemplazo de path aliases (`@/`) por rutas relativas para compatibilidad
222
- - **Configuración de build**: Corregida la generación de archivos `.d.ts` en `dist/` en lugar de `src/`
223
- - **ESLint**: Configurado para ignorar archivos `.d.ts` generados
224
-
225
- #### 🐛 Correcciones
226
- - **Resolución de tipos**: Los tipos TypeScript ahora se resuelven correctamente desde `node_modules`
227
- - **Imports desde subpaths**: Corregidos los imports desde `@ai-pip/core/csl`, `@ai-pip/core/isl`, etc.
228
- - **Exports completos**: Agregado campo `default` a todos los exports para Node.js ESM
229
- - **Generación de archivos**: Archivos `.d.ts` ahora se generan correctamente en `dist/`
230
-
231
- #### 📚 Documentación
232
- - **Requisitos de TypeScript**: Documentación mejorada sobre configuración requerida
233
- - **Ejemplos actualizados**: Ejemplos de uso actualizados para la nueva estructura
234
- - **CHANGELOG completo**: Documentación de todas las versiones y deprecaciones
235
-
236
- #### 🛠️ Mejoras de desarrollo
237
- - **Script test:install**: Script para verificar instalación antes de publicar
238
- - **Script prepublishOnly**: Ejecuta automáticamente build, lint, tests y test:install antes de publicar
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
- - **Configuración TypeScript requerida**: Ahora es **obligatorio** usar `module: "NodeNext"` y `moduleResolution: "nodenext"` en `tsconfig.json`
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
- #### ⚠️ DEPRECADA
318
+ #### ⚠️ DEPRECATED
248
319
 
249
- **Motivo de deprecación**: Esta versión tenía problemas con la compilación y generación de archivos `.d.ts`. Los archivos se generaban en ubicaciones incorrectas (`src/` en lugar de `dist/`), causando errores de linting y problemas de resolución de tipos.
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
- **Problemas conocidos**:
252
- - Archivos `.d.ts` se generaban en `src/` en lugar de `dist/`
253
- - ESLint intentaba lintear archivos `.d.ts` generados, causando errores
254
- - Configuración de build incompleta (`declarationDir` mal configurado)
255
- - Los tipos no se resolvían correctamente en algunos casos
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
- **Recomendación**: Actualizar a `0.1.3` o superior.
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
- #### ⚠️ DEPRECADA
334
+ #### ⚠️ DEPRECATED
264
335
 
265
- **Motivo de deprecación**: Esta versión tenía problemas con la resolución de path aliases (`@/`) que causaban errores al importar desde otros proyectos. Los tipos no se resolvían correctamente cuando el paquete se instalaba desde npm.
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
- **Problemas conocidos**:
268
- - Errores: `Module '"@ai-pip/core/csl"' has no exported member 'CSLResult'`
269
- - Path aliases no funcionaban en proyectos consumidores
270
- - Tipos no se resolvían correctamente desde `node_modules`
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
- **Recomendación**: Actualizar a `0.1.3` o superior.
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
- #### ⚠️ DEPRECADA
349
+ #### ⚠️ DEPRECATED
279
350
 
280
- **Motivo de deprecación**: Versión inicial con problemas fundamentales de compatibilidad. Los exports no incluían el campo `default` requerido por Node.js ESM, causando errores `ERR_PACKAGE_PATH_NOT_EXPORTED`.
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
- **Problemas conocidos**:
283
- - Errores: `ERR_PACKAGE_PATH_NOT_EXPORTED` al importar subpaths
284
- - Exports incompletos: Faltaba el campo `default` en los exports
285
- - Path aliases no funcionaban correctamente
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
- **Recomendación**: Actualizar a `0.1.3` o superior.
358
+ **Recommendation**: Update to `0.1.3` or higher.
288
359
 
289
- #### 📦 Contenido inicial
290
- - **CSL (Context Segmentation Layer)**: Segmentación y clasificación de contenido
291
- - **ISL (Instruction Sanitization Layer)**: Sanitización de instrucciones
292
- - **CPE (Cryptographic Prompt Envelope)**: Envoltorio criptográfico con HMAC-SHA256
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
- **Versión actual**: 0.1.3
297
- **Estado**: Fase 1 - Capas Core (60% completado)
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 also import specific layers:
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';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;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"}
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 also import specific layers:
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;;;;;;;;;;;GAWG;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"}
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.4",
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"