@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.
Files changed (118) hide show
  1. package/CHANGELOG.md +175 -1
  2. package/README.md +751 -22
  3. package/dist/AAL/index.d.ts +28 -0
  4. package/dist/AAL/index.d.ts.map +1 -0
  5. package/dist/AAL/index.js +28 -0
  6. package/dist/AAL/index.js.map +1 -0
  7. package/dist/AAL/lineage/buildAALLineage.d.ts +22 -0
  8. package/dist/AAL/lineage/buildAALLineage.d.ts.map +1 -0
  9. package/dist/AAL/lineage/buildAALLineage.js +26 -0
  10. package/dist/AAL/lineage/buildAALLineage.js.map +1 -0
  11. package/dist/AAL/lineage/index.d.ts +5 -0
  12. package/dist/AAL/lineage/index.d.ts.map +1 -0
  13. package/dist/AAL/lineage/index.js +5 -0
  14. package/dist/AAL/lineage/index.js.map +1 -0
  15. package/dist/AAL/process/buildDecisionReason.d.ts +36 -0
  16. package/dist/AAL/process/buildDecisionReason.d.ts.map +1 -0
  17. package/dist/AAL/process/buildDecisionReason.js +48 -0
  18. package/dist/AAL/process/buildDecisionReason.js.map +1 -0
  19. package/dist/AAL/process/buildRemovalPlan.d.ts +32 -0
  20. package/dist/AAL/process/buildRemovalPlan.d.ts.map +1 -0
  21. package/dist/AAL/process/buildRemovalPlan.js +50 -0
  22. package/dist/AAL/process/buildRemovalPlan.js.map +1 -0
  23. package/dist/AAL/process/index.d.ts +9 -0
  24. package/dist/AAL/process/index.d.ts.map +1 -0
  25. package/dist/AAL/process/index.js +7 -0
  26. package/dist/AAL/process/index.js.map +1 -0
  27. package/dist/AAL/process/resolveAgentAction.d.ts +31 -0
  28. package/dist/AAL/process/resolveAgentAction.d.ts.map +1 -0
  29. package/dist/AAL/process/resolveAgentAction.js +43 -0
  30. package/dist/AAL/process/resolveAgentAction.js.map +1 -0
  31. package/dist/AAL/types.d.ts +104 -0
  32. package/dist/AAL/types.d.ts.map +1 -0
  33. package/dist/AAL/types.js +2 -0
  34. package/dist/AAL/types.js.map +1 -0
  35. package/dist/{isl → AAL}/value-objects/AnomalyScore.d.ts +2 -1
  36. package/dist/AAL/value-objects/AnomalyScore.d.ts.map +1 -0
  37. package/dist/{isl → AAL}/value-objects/AnomalyScore.js.map +1 -1
  38. package/dist/{isl → AAL}/value-objects/PolicyRule.d.ts.map +1 -1
  39. package/dist/{isl → AAL}/value-objects/PolicyRule.js.map +1 -1
  40. package/dist/AAL/value-objects/index.d.ts +5 -0
  41. package/dist/AAL/value-objects/index.d.ts.map +1 -0
  42. package/dist/AAL/value-objects/index.js +3 -0
  43. package/dist/AAL/value-objects/index.js.map +1 -0
  44. package/dist/csl/classify.d.ts +2 -2
  45. package/dist/csl/classify.js +5 -5
  46. package/dist/csl/classify.js.map +1 -1
  47. package/dist/csl/value-objects/Origin-map.js +5 -5
  48. package/dist/csl/value-objects/Origin-map.js.map +1 -1
  49. package/dist/index.d.ts +10 -6
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +8 -5
  52. package/dist/index.js.map +1 -1
  53. package/dist/isl/index.d.ts +15 -6
  54. package/dist/isl/index.d.ts.map +1 -1
  55. package/dist/isl/index.js +15 -5
  56. package/dist/isl/index.js.map +1 -1
  57. package/dist/isl/lineage/buildISLLineage.d.ts +22 -0
  58. package/dist/isl/lineage/buildISLLineage.d.ts.map +1 -0
  59. package/dist/isl/lineage/buildISLLineage.js +26 -0
  60. package/dist/isl/lineage/buildISLLineage.js.map +1 -0
  61. package/dist/isl/lineage/index.d.ts +5 -0
  62. package/dist/isl/lineage/index.d.ts.map +1 -0
  63. package/dist/isl/lineage/index.js +5 -0
  64. package/dist/isl/lineage/index.js.map +1 -0
  65. package/dist/isl/process/buildISLResult.d.ts +24 -0
  66. package/dist/isl/process/buildISLResult.d.ts.map +1 -0
  67. package/dist/isl/process/buildISLResult.js +38 -0
  68. package/dist/isl/process/buildISLResult.js.map +1 -0
  69. package/dist/isl/process/emitSignal.d.ts +23 -0
  70. package/dist/isl/process/emitSignal.d.ts.map +1 -0
  71. package/dist/isl/process/emitSignal.js +39 -0
  72. package/dist/isl/process/emitSignal.js.map +1 -0
  73. package/dist/isl/process/index.d.ts +6 -0
  74. package/dist/isl/process/index.d.ts.map +1 -0
  75. package/dist/isl/process/index.js +6 -0
  76. package/dist/isl/process/index.js.map +1 -0
  77. package/dist/isl/sanitize.d.ts +5 -5
  78. package/dist/isl/sanitize.d.ts.map +1 -1
  79. package/dist/isl/sanitize.js +24 -38
  80. package/dist/isl/sanitize.js.map +1 -1
  81. package/dist/isl/signals.d.ts +98 -0
  82. package/dist/isl/signals.d.ts.map +1 -0
  83. package/dist/isl/signals.js +92 -0
  84. package/dist/isl/signals.js.map +1 -0
  85. package/dist/isl/types.d.ts +4 -48
  86. package/dist/isl/types.d.ts.map +1 -1
  87. package/dist/isl/types.js +1 -1
  88. package/dist/isl/value-objects/PiDetection.d.ts +2 -1
  89. package/dist/isl/value-objects/PiDetection.d.ts.map +1 -1
  90. package/dist/isl/value-objects/PiDetectionResult.d.ts +2 -3
  91. package/dist/isl/value-objects/PiDetectionResult.d.ts.map +1 -1
  92. package/dist/isl/value-objects/PiDetectionResult.js +1 -27
  93. package/dist/isl/value-objects/PiDetectionResult.js.map +1 -1
  94. package/dist/isl/value-objects/RiskScore.d.ts +70 -0
  95. package/dist/isl/value-objects/RiskScore.d.ts.map +1 -0
  96. package/dist/isl/value-objects/RiskScore.js +85 -0
  97. package/dist/isl/value-objects/RiskScore.js.map +1 -0
  98. package/dist/isl/value-objects/index.d.ts +2 -2
  99. package/dist/isl/value-objects/index.d.ts.map +1 -1
  100. package/dist/isl/value-objects/index.js +1 -3
  101. package/dist/isl/value-objects/index.js.map +1 -1
  102. package/dist/shared/audit.d.ts +150 -0
  103. package/dist/shared/audit.d.ts.map +1 -0
  104. package/dist/shared/audit.js +173 -0
  105. package/dist/shared/audit.js.map +1 -0
  106. package/dist/shared/index.d.ts +5 -3
  107. package/dist/shared/index.d.ts.map +1 -1
  108. package/dist/shared/index.js +5 -6
  109. package/dist/shared/index.js.map +1 -1
  110. package/dist/shared/types.d.ts +36 -0
  111. package/dist/shared/types.d.ts.map +1 -0
  112. package/dist/shared/types.js +2 -0
  113. package/dist/shared/types.js.map +1 -0
  114. package/package.json +7 -2
  115. package/dist/isl/value-objects/AnomalyScore.d.ts.map +0 -1
  116. /package/dist/{isl → AAL}/value-objects/AnomalyScore.js +0 -0
  117. /package/dist/{isl → AAL}/value-objects/PolicyRule.d.ts +0 -0
  118. /package/dist/{isl → AAL}/value-objects/PolicyRule.js +0 -0
@@ -16,10 +16,10 @@ import type { Source } from './types.js';
16
16
  * @example
17
17
  * ```typescript
18
18
  * const trust = classifySource('UI')
19
- * // Returns: { value: 'TC' }
19
+ * // Returns: { value: 'STC' }
20
20
  *
21
21
  * const trust2 = classifySource('DOM')
22
- * // Returns: { value: 'STC' }
22
+ * // Returns: { value: 'UC' }
23
23
  * ```
24
24
  */
25
25
  export declare function classifySource(source: Source): import("./value-objects/TrustLevel.js").TrustLevel;
@@ -18,19 +18,19 @@ import { OriginType } from './types.js';
18
18
  * @example
19
19
  * ```typescript
20
20
  * const trust = classifySource('UI')
21
- * // Returns: { value: 'TC' }
21
+ * // Returns: { value: 'STC' }
22
22
  *
23
23
  * const trust2 = classifySource('DOM')
24
- * // Returns: { value: 'STC' }
24
+ * // Returns: { value: 'UC' }
25
25
  * ```
26
26
  */
27
27
  export function classifySource(source) {
28
28
  // Mapeo simple: Source → OriginType → TrustLevel
29
29
  const sourceToOriginType = {
30
- 'UI': OriginType.SYSTEM_GENERATED, // UI directa → TC
31
30
  'SYSTEM': OriginType.SYSTEM_GENERATED, // System → TC
32
- 'DOM': OriginType.DOM_VISIBLE, // DOM → STC
33
- 'API': OriginType.NETWORK_FETCHED // API → UC
31
+ 'UI': OriginType.DOM_VISIBLE, // UI → STC
32
+ 'API': OriginType.DOM_ATTRIBUTE, // API → STC
33
+ 'DOM': OriginType.DOM_HIDDEN // DOM/WEB/SCRAPED → UC
34
34
  };
35
35
  const originType = sourceToOriginType[source];
36
36
  if (!originType) {
@@ -1 +1 @@
1
- {"version":3,"file":"classify.js","sourceRoot":"","sources":["../../src/csl/classify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAGvC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,iDAAiD;IACjD,MAAM,kBAAkB,GAA+B;QACrD,IAAI,EAAE,UAAU,CAAC,gBAAgB,EAAO,kBAAkB;QAC1D,QAAQ,EAAE,UAAU,CAAC,gBAAgB,EAAI,cAAc;QACvD,KAAK,EAAE,UAAU,CAAC,WAAW,EAAY,YAAY;QACrD,KAAK,EAAE,UAAU,CAAC,eAAe,CAAQ,WAAW;KACrD,CAAA;IAED,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAE7C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,mBAAmB,CAAC,WAAW,MAAM,wBAAwB,CAAC,CAAA;IAC1E,CAAC;IAED,MAAM,cAAc,GAAG,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IAEhD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,mBAAmB,CAC3B,gBAAgB,UAAU,gCAAgC;YAC1D,qEAAqE,CACtE,CAAA;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC,cAAc,CAAC,CAAA;AACzC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,MAAM,cAAc,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAA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ACzC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,MAAM,cAAc,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAEjD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,mBAAmB,CAC3B,gBAAgB,MAAM,CAAC,IAAI,gCAAgC;YAC3D,qEAAqE,CACtE,CAAA;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC,cAAc,CAAC,CAAA;AACzC,CAAC"}
@@ -14,15 +14,15 @@ import { OriginType, TrustLevelType } from '../types.js';
14
14
  export const originMap = new Map([
15
15
  // User origins - always untrusted (security by default)
16
16
  [OriginType.USER, TrustLevelType.UC],
17
- // DOM origins - trust based on visibility
18
- [OriginType.DOM_VISIBLE, TrustLevelType.STC],
19
- [OriginType.DOM_HIDDEN, TrustLevelType.UC],
20
- [OriginType.DOM_ATTRIBUTE, TrustLevelType.STC],
17
+ // DOM origins - trust based on visibility and source
18
+ [OriginType.DOM_VISIBLE, TrustLevelType.STC], // Used for UI source
19
+ [OriginType.DOM_HIDDEN, TrustLevelType.UC], // Used for DOM/WEB/SCRAPED source
20
+ [OriginType.DOM_ATTRIBUTE, TrustLevelType.STC], // Used for API source
21
21
  // External origins - always untrusted
22
22
  [OriginType.SCRIPT_INJECTED, TrustLevelType.UC],
23
23
  [OriginType.NETWORK_FETCHED, TrustLevelType.UC],
24
24
  // System origins - trusted (system controls)
25
- [OriginType.SYSTEM_GENERATED, TrustLevelType.TC],
25
+ [OriginType.SYSTEM_GENERATED, TrustLevelType.TC], // Used for SYSTEM source
26
26
  // Unknown - untrusted by default (fail-secure)
27
27
  [OriginType.UNKNOWN, TrustLevelType.UC],
28
28
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"Origin-map.js","sourceRoot":"","sources":["../../../src/csl/value-objects/Origin-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EA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ocol
3
3
  *
4
4
  * @remarks
5
- * Main entry point that re-exports all layers (CSL, ISL, CPE, Shared)
5
+ * Main entry point that re-exports all layers (CSL, ISL, CPE, AAL ,Shared)
6
6
  *
7
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
10
  * - import { envelope } from '@ai-pip/core/cpe'
11
+ * - import { createAnomalyScore } from '@ai-pip/core/AAL'
11
12
  *
12
13
  * Or import everything from the main entry point:
13
- * - import { addLineageEntry, segment, sanitize, envelope } from '@ai-pip/core'
14
+ * - import { addLineageEntry, segment, sanitize, envelope, createAnomalyScore } from '@ai-pip/core'
14
15
  *
15
16
  * Note: Shared functions are only available from the main entry point, not as a subpath.
16
17
  */
17
18
  export { segment, classifySource, classifyOrigin, initLineage, createLineageEntry, generateId, splitByContextRules, OriginType, TrustLevelType, ClassificationError, SegmentationError } from './csl/index.js';
18
19
  export type { HashAlgorithm, Source, CSLInput, CSLSegment, CSLResult, TrustLevel, Origin, LineageEntry, ContentHash } from './csl/index.js';
19
- export { sanitize } from './isl/index.js';
20
- export type { RiskScore, AnomalyAction, Position, BlockedIntent, SensitiveScope, ProtectedRole, ImmutableInstruction, RemovedInstruction, ISLSegment, ISLResult, PiDetection, PiDetectionResult, AnomalyScore, Pattern } from './isl/index.js';
21
- export { createPiDetection, getDetectionLength, isHighConfidence, isMediumConfidence, isLowConfidence, createPiDetectionResult, hasDetections, getDetectionCount, getDetectionsByType, getHighestConfidenceDetection, createAnomalyScore, isHighRisk, isWarnRisk, isLowRisk, createPattern, matchesPattern, findMatch, MAX_CONTENT_LENGTH, MAX_PATTERN_LENGTH, MAX_MATCHES, SanitizationError } from './isl/index.js';
22
- export { addLineageEntry, addLineageEntries, filterLineageByStep, getLastLineageEntry } from './shared/index.js';
20
+ export { sanitize, emitSignal, createISLSignal, isHighRiskSignal, isMediumRiskSignal, isLowRiskSignal } from './isl/index.js';
21
+ export type { RiskScore, ISLSegment, ISLResult, ISLSignal, PiDetection, PiDetectionResult, Pattern } from './isl/index.js';
22
+ export { createPiDetection, getDetectionLength, isHighConfidence, isMediumConfidence, isLowConfidence, createPiDetectionResult, hasDetections, getDetectionCount, getDetectionsByType, getHighestConfidenceDetection, createPattern, matchesPattern, findMatch, MAX_CONTENT_LENGTH, MAX_PATTERN_LENGTH, MAX_MATCHES, createRiskScore, normalizeRiskScore, isHighRiskScore, isMediumRiskScore, isLowRiskScore, MIN_RISK_SCORE, MAX_RISK_SCORE, SanitizationError } from './isl/index.js';
23
+ export { addLineageEntry, addLineageEntries, filterLineageByStep, getLastLineageEntry, formatLineageForAudit, formatCSLForAudit, formatISLForAudit, formatISLSignalForAudit, formatAALForAudit, formatCPEForAudit, formatPipelineAudit } from './shared/index.js';
24
+ export type { LineageEntryLike, CSLResultLike, ISLResultLike, ISLSignalLike, DecisionReasonLike, RemovalPlanLike, CPEResultLike } from './shared/index.js';
23
25
  export { envelope, createNonce, isValidNonce, equalsNonce, createMetadata, isValidMetadata, CURRENT_PROTOCOL_VERSION, createSignature, EnvelopeError } from './cpe/index.js';
24
26
  export type { Nonce, SignatureVO, ProtocolVersion, Timestamp, NonceValue, SignatureAlgorithm, Signature, CPEMetadata, CPEEvelope, CPEResult } from './cpe/index.js';
27
+ export { createAnomalyScore, isHighRisk, isLowRisk, isWarnRisk, isRoleProtected, isContextLeakPreventionEnabled, isInstructionImmutable, isIntentBlocked, isScopeSensitive, resolveAgentAction, resolveAgentActionWithScore, buildDecisionReason, buildRemovalPlan, buildAALLineage } from './AAL/index.js';
28
+ export type { AnomalyAction, AnomalyScore, RemovedInstruction, BlockedIntent, SensitiveScope, ProtectedRole, ImmutableInstruction, AgentPolicy, DecisionReason, RemovalPlan } from './AAL/index.js';
25
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA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,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;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,gBAAgB,CAAA;AACvB,YAAY,EACV,aAAa,EACb,MAAM,EACN,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,EACV,MAAM,EACN,YAAY,EACZ,WAAW,EACZ,MAAM,gBAAgB,CAAA;AAGvB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAC7H,YAAY,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,OAAO,EACR,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,6BAA6B,EAC7B,aAAa,EACb,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,EAClB,MAAM,gBAAgB,CAAA;AAGvB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,aAAa,EACd,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,wBAAwB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC5K,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAInK,OAAO,EACH,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,8BAA8B,EAC9B,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EAClB,MAAM,gBAAgB,CAAA;AAGvB,YAAY,EACR,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,WAAW,EACd,MAAM,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -2,25 +2,28 @@
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, CPE, Shared)
5
+ * Main entry point that re-exports all layers (CSL, ISL, CPE, AAL ,Shared)
6
6
  *
7
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
10
  * - import { envelope } from '@ai-pip/core/cpe'
11
+ * - import { createAnomalyScore } from '@ai-pip/core/AAL'
11
12
  *
12
13
  * Or import everything from the main entry point:
13
- * - import { addLineageEntry, segment, sanitize, envelope } from '@ai-pip/core'
14
+ * - import { addLineageEntry, segment, sanitize, envelope, createAnomalyScore } from '@ai-pip/core'
14
15
  *
15
16
  * Note: Shared functions are only available from the main entry point, not as a subpath.
16
17
  */
17
18
  // Re-export CSL
18
19
  export { segment, classifySource, classifyOrigin, initLineage, createLineageEntry, generateId, splitByContextRules, OriginType, TrustLevelType, ClassificationError, SegmentationError } from './csl/index.js';
19
20
  // Re-export ISL
20
- export { sanitize } from './isl/index.js';
21
- export { createPiDetection, getDetectionLength, isHighConfidence, isMediumConfidence, isLowConfidence, createPiDetectionResult, hasDetections, getDetectionCount, getDetectionsByType, getHighestConfidenceDetection, createAnomalyScore, isHighRisk, isWarnRisk, isLowRisk, createPattern, matchesPattern, findMatch, MAX_CONTENT_LENGTH, MAX_PATTERN_LENGTH, MAX_MATCHES, SanitizationError } from './isl/index.js';
21
+ export { sanitize, emitSignal, createISLSignal, isHighRiskSignal, isMediumRiskSignal, isLowRiskSignal } from './isl/index.js';
22
+ export { createPiDetection, getDetectionLength, isHighConfidence, isMediumConfidence, isLowConfidence, createPiDetectionResult, hasDetections, getDetectionCount, getDetectionsByType, getHighestConfidenceDetection, createPattern, matchesPattern, findMatch, MAX_CONTENT_LENGTH, MAX_PATTERN_LENGTH, MAX_MATCHES, createRiskScore, normalizeRiskScore, isHighRiskScore, isMediumRiskScore, isLowRiskScore, MIN_RISK_SCORE, MAX_RISK_SCORE, SanitizationError } from './isl/index.js';
22
23
  // Re-export Shared
23
- export { addLineageEntry, addLineageEntries, filterLineageByStep, getLastLineageEntry } from './shared/index.js';
24
+ export { addLineageEntry, addLineageEntries, filterLineageByStep, getLastLineageEntry, formatLineageForAudit, formatCSLForAudit, formatISLForAudit, formatISLSignalForAudit, formatAALForAudit, formatCPEForAudit, formatPipelineAudit } from './shared/index.js';
24
25
  // Re-export CPE
25
26
  export { envelope, createNonce, isValidNonce, equalsNonce, createMetadata, isValidMetadata, CURRENT_PROTOCOL_VERSION, createSignature, EnvelopeError } from './cpe/index.js';
27
+ // Re-export AAL
28
+ export { createAnomalyScore, isHighRisk, isLowRisk, isWarnRisk, isRoleProtected, isContextLeakPreventionEnabled, isInstructionImmutable, isIntentBlocked, isScopeSensitive, resolveAgentAction, resolveAgentActionWithScore, buildDecisionReason, buildRemovalPlan, buildAALLineage } from './AAL/index.js';
26
29
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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,gBAAgB,CAAA;AAavB,gBAAgB;AAChB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAiBzC,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,gBAAgB,CAAA;AAEvB,mBAAmB;AACnB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,mBAAmB,CAAA;AAE1B,gBAAgB;AAChB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,wBAAwB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts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AAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EAClB,MAAM,gBAAgB,CAAA"}
@@ -1,13 +1,22 @@
1
1
  /**
2
- * ISL (Instruction Sanitization Layer) - Core Semántico
2
+ * ISL (Instruction Sanitization Layer) - Semantic Core
3
3
  *
4
4
  * @remarks
5
- * ISL sanitiza instrucciones maliciosas recibidas de CSL,
6
- * aplicando diferentes niveles de sanitización según el nivel de confianza.
5
+ * ISL sanitizes malicious instructions received from CSL,
6
+ * applying different sanitization levels according to trust level.
7
+ *
8
+ * **Architecture:**
9
+ * - ISL processes content and emits signals (ISLSignal) for other layers
10
+ * - ISLResult is internal, ISLSignal is the external semantic contract
11
+ * - A layer should never consume the internal "result" of another layer
7
12
  */
8
13
  export { sanitize } from './sanitize.js';
9
- export type { PiDetection, PiDetectionResult, AnomalyScore, Pattern } from './value-objects/index.js';
10
- export { createPiDetection, getDetectionLength, isHighConfidence, isMediumConfidence, isLowConfidence, createPiDetectionResult, hasDetections, getDetectionCount, getDetectionsByType, getHighestConfidenceDetection, createAnomalyScore, isHighRisk, isWarnRisk, isLowRisk, createPattern, matchesPattern, findMatch, MAX_CONTENT_LENGTH, MAX_PATTERN_LENGTH, MAX_MATCHES } from './value-objects/index.js';
14
+ export { buildISLResult, emitSignal } from './process/index.js';
15
+ export { buildISLLineage } from './lineage/index.js';
16
+ export type { ISLSignal } from './signals.js';
17
+ export { createISLSignal, isHighRiskSignal, isMediumRiskSignal, isLowRiskSignal } from './signals.js';
18
+ export type { PiDetection, PiDetectionResult, Pattern, RiskScore } from './value-objects/index.js';
19
+ export { createPiDetection, getDetectionLength, isHighConfidence, isMediumConfidence, isLowConfidence, createPiDetectionResult, hasDetections, getDetectionCount, getDetectionsByType, getHighestConfidenceDetection, createPattern, matchesPattern, findMatch, MAX_CONTENT_LENGTH, MAX_PATTERN_LENGTH, MAX_MATCHES, createRiskScore, normalizeRiskScore, isHighRiskScore, isMediumRiskScore, isLowRiskScore, MIN_RISK_SCORE, MAX_RISK_SCORE } from './value-objects/index.js';
11
20
  export { SanitizationError } from './exceptions/SanitizationError.js';
12
- export type { RiskScore, AnomalyAction, Position, BlockedIntent, SensitiveScope, ProtectedRole, ImmutableInstruction, RemovedInstruction, ISLSegment, ISLResult } from './types.js';
21
+ export type { RiskScore as RiskScoreType, ISLSegment, ISLResult } from './types.js';
13
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/isl/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AACrG,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,EACZ,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAGrE,YAAY,EACV,SAAS,EACT,aAAa,EACb,QAAQ,EACR,aAAa,EACb,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACV,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/isl/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAG/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,cAAc,CAAA;AAGrB,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAClG,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,6BAA6B,EAC7B,aAAa,EACb,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACf,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAGrE,YAAY,EACV,SAAS,IAAI,aAAa,EAC1B,UAAU,EACV,SAAS,EACV,MAAM,YAAY,CAAA"}
package/dist/isl/index.js CHANGED
@@ -1,13 +1,23 @@
1
1
  /**
2
- * ISL (Instruction Sanitization Layer) - Core Semántico
2
+ * ISL (Instruction Sanitization Layer) - Semantic Core
3
3
  *
4
4
  * @remarks
5
- * ISL sanitiza instrucciones maliciosas recibidas de CSL,
6
- * aplicando diferentes niveles de sanitización según el nivel de confianza.
5
+ * ISL sanitizes malicious instructions received from CSL,
6
+ * applying different sanitization levels according to trust level.
7
+ *
8
+ * **Architecture:**
9
+ * - ISL processes content and emits signals (ISLSignal) for other layers
10
+ * - ISLResult is internal, ISLSignal is the external semantic contract
11
+ * - A layer should never consume the internal "result" of another layer
7
12
  */
8
- // Funciones puras principales
13
+ // Main pure functions
9
14
  export { sanitize } from './sanitize.js';
10
- export { createPiDetection, getDetectionLength, isHighConfidence, isMediumConfidence, isLowConfidence, createPiDetectionResult, hasDetections, getDetectionCount, getDetectionsByType, getHighestConfidenceDetection, createAnomalyScore, isHighRisk, isWarnRisk, isLowRisk, createPattern, matchesPattern, findMatch, MAX_CONTENT_LENGTH, MAX_PATTERN_LENGTH, MAX_MATCHES } from './value-objects/index.js';
15
+ // Process functions
16
+ export { buildISLResult, emitSignal } from './process/index.js';
17
+ // Lineage functions
18
+ export { buildISLLineage } from './lineage/index.js';
19
+ export { createISLSignal, isHighRiskSignal, isMediumRiskSignal, isLowRiskSignal } from './signals.js';
20
+ export { createPiDetection, getDetectionLength, isHighConfidence, isMediumConfidence, isLowConfidence, createPiDetectionResult, hasDetections, getDetectionCount, getDetectionsByType, getHighestConfidenceDetection, createPattern, matchesPattern, findMatch, MAX_CONTENT_LENGTH, MAX_PATTERN_LENGTH, MAX_MATCHES, createRiskScore, normalizeRiskScore, isHighRiskScore, isMediumRiskScore, isLowRiskScore, MIN_RISK_SCORE, MAX_RISK_SCORE } from './value-objects/index.js';
11
21
  // Exceptions
12
22
  export { SanitizationError } from './exceptions/SanitizationError.js';
13
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/isl/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8BAA8B;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAIxC,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,EACZ,MAAM,0BAA0B,CAAA;AAEjC,aAAa;AACb,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/isl/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,sBAAsB;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,oBAAoB;AACpB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/D,oBAAoB;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAIpD,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,cAAc,CAAA;AAIrB,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,6BAA6B,EAC7B,aAAa,EACb,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACf,MAAM,0BAA0B,CAAA;AAEjC,aAAa;AACb,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * buildISLLineage - Builds ISL lineage
3
+ *
4
+ * @remarks
5
+ * This function builds and updates the ISL-specific lineage,
6
+ * adding processing entries for auditing and traceability.
7
+ *
8
+ * **Responsibility:**
9
+ * - Build ISL lineage
10
+ * - Add processing entries
11
+ * - Preserve lineage from previous layers
12
+ */
13
+ import type { LineageEntry } from '../../csl/value-objects/index.js';
14
+ /**
15
+ * Builds ISL lineage by adding a processing entry
16
+ *
17
+ * @param previousLineage - Lineage from previous layers
18
+ * @param timestamp - Processing timestamp (default: Date.now())
19
+ * @returns Updated lineage with ISL entry
20
+ */
21
+ export declare function buildISLLineage(previousLineage: readonly LineageEntry[], timestamp?: number): readonly LineageEntry[];
22
+ //# sourceMappingURL=buildISLLineage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildISLLineage.d.ts","sourceRoot":"","sources":["../../../src/isl/lineage/buildISLLineage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAIpE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,eAAe,EAAE,SAAS,YAAY,EAAE,EACxC,SAAS,GAAE,MAAmB,GAC7B,SAAS,YAAY,EAAE,CAGzB"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * buildISLLineage - Builds ISL lineage
3
+ *
4
+ * @remarks
5
+ * This function builds and updates the ISL-specific lineage,
6
+ * adding processing entries for auditing and traceability.
7
+ *
8
+ * **Responsibility:**
9
+ * - Build ISL lineage
10
+ * - Add processing entries
11
+ * - Preserve lineage from previous layers
12
+ */
13
+ import { createLineageEntry } from '../../csl/value-objects/index.js';
14
+ import { addLineageEntry } from '../../shared/lineage.js';
15
+ /**
16
+ * Builds ISL lineage by adding a processing entry
17
+ *
18
+ * @param previousLineage - Lineage from previous layers
19
+ * @param timestamp - Processing timestamp (default: Date.now())
20
+ * @returns Updated lineage with ISL entry
21
+ */
22
+ export function buildISLLineage(previousLineage, timestamp = Date.now()) {
23
+ const islEntry = createLineageEntry('ISL', timestamp);
24
+ return addLineageEntry(previousLineage, islEntry);
25
+ }
26
+ //# sourceMappingURL=buildISLLineage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildISLLineage.js","sourceRoot":"","sources":["../../../src/isl/lineage/buildISLLineage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,eAAwC,EACxC,YAAoB,IAAI,CAAC,GAAG,EAAE;IAE9B,MAAM,QAAQ,GAAG,kBAAkB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IACrD,OAAO,eAAe,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAA;AACnD,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * ISL Lineage - Lineage construction for ISL
3
+ */
4
+ export { buildISLLineage } from './buildISLLineage.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/isl/lineage/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * ISL Lineage - Lineage construction for ISL
3
+ */
4
+ export { buildISLLineage } from './buildISLLineage.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/isl/lineage/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * buildISLResult - Builds the internal ISL result
3
+ *
4
+ * @remarks
5
+ * This function builds the internal ISLResult that contains
6
+ * all ISL processing information.
7
+ *
8
+ * **Responsibility:**
9
+ * - Build ISLResult from processed segments
10
+ * - Add processing metadata
11
+ * - Preserve complete lineage
12
+ */
13
+ import type { ISLResult, ISLSegment } from '../types.js';
14
+ import type { LineageEntry } from '../../csl/value-objects/index.js';
15
+ /**
16
+ * Builds an ISLResult from processed segments
17
+ *
18
+ * @param segments - Segments sanitized by ISL
19
+ * @param lineage - Complete processing lineage
20
+ * @param processingTimeMs - Processing time in milliseconds (optional)
21
+ * @returns ISLResult with all processing information
22
+ */
23
+ export declare function buildISLResult(segments: readonly ISLSegment[], lineage: readonly LineageEntry[], processingTimeMs?: number): ISLResult;
24
+ //# sourceMappingURL=buildISLResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildISLResult.d.ts","sourceRoot":"","sources":["../../../src/isl/process/buildISLResult.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAEpE;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,SAAS,UAAU,EAAE,EAC/B,OAAO,EAAE,SAAS,YAAY,EAAE,EAChC,gBAAgB,CAAC,EAAE,MAAM,GACxB,SAAS,CAiBX"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * buildISLResult - Builds the internal ISL result
3
+ *
4
+ * @remarks
5
+ * This function builds the internal ISLResult that contains
6
+ * all ISL processing information.
7
+ *
8
+ * **Responsibility:**
9
+ * - Build ISLResult from processed segments
10
+ * - Add processing metadata
11
+ * - Preserve complete lineage
12
+ */
13
+ /**
14
+ * Builds an ISLResult from processed segments
15
+ *
16
+ * @param segments - Segments sanitized by ISL
17
+ * @param lineage - Complete processing lineage
18
+ * @param processingTimeMs - Processing time in milliseconds (optional)
19
+ * @returns ISLResult with all processing information
20
+ */
21
+ export function buildISLResult(segments, lineage, processingTimeMs) {
22
+ const metadata = processingTimeMs === undefined
23
+ ? {
24
+ totalSegments: segments.length,
25
+ sanitizedSegments: segments.length
26
+ }
27
+ : {
28
+ totalSegments: segments.length,
29
+ sanitizedSegments: segments.length,
30
+ processingTimeMs
31
+ };
32
+ return {
33
+ segments: Object.freeze(segments),
34
+ lineage: Object.freeze(lineage),
35
+ metadata: Object.freeze(metadata)
36
+ };
37
+ }
38
+ //# sourceMappingURL=buildISLResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildISLResult.js","sourceRoot":"","sources":["../../../src/isl/process/buildISLResult.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,QAA+B,EAC/B,OAAgC,EAChC,gBAAyB;IAEzB,MAAM,QAAQ,GAAG,gBAAgB,KAAK,SAAS;QAC7C,CAAC,CAAC;YACE,aAAa,EAAE,QAAQ,CAAC,MAAM;YAC9B,iBAAiB,EAAE,QAAQ,CAAC,MAAM;SACnC;QACH,CAAC,CAAC;YACE,aAAa,EAAE,QAAQ,CAAC,MAAM;YAC9B,iBAAiB,EAAE,QAAQ,CAAC,MAAM;YAClC,gBAAgB;SACjB,CAAA;IAEL,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;QACjC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QAC/B,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;KAClC,CAAA;AACH,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * emitSignal - Emits an ISLSignal from an internal ISLResult
3
+ *
4
+ * @remarks
5
+ * This function converts the internal ISL result (ISLResult)
6
+ * into a semantic signal (ISLSignal) that can be consumed by other layers.
7
+ *
8
+ * **Responsibility:**
9
+ * - Extract essential semantic information from internal result
10
+ * - Create signal without exposing ISL internals
11
+ * - Add risk score and detections
12
+ */
13
+ import type { ISLResult } from '../types.js';
14
+ import type { ISLSignal } from '../signals.js';
15
+ /**
16
+ * Emits an ISLSignal from an internal ISLResult
17
+ *
18
+ * @param islResult - Internal ISL result
19
+ * @param timestamp - Signal timestamp (default: Date.now())
20
+ * @returns ISLSignal - Semantic signal for external consumption
21
+ */
22
+ export declare function emitSignal(islResult: ISLResult, timestamp?: number): ISLSignal;
23
+ //# sourceMappingURL=emitSignal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitSignal.d.ts","sourceRoot":"","sources":["../../../src/isl/process/emitSignal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAK9C;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,SAAS,EACpB,SAAS,GAAE,MAAmB,GAC7B,SAAS,CAkBX"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * emitSignal - Emits an ISLSignal from an internal ISLResult
3
+ *
4
+ * @remarks
5
+ * This function converts the internal ISL result (ISLResult)
6
+ * into a semantic signal (ISLSignal) that can be consumed by other layers.
7
+ *
8
+ * **Responsibility:**
9
+ * - Extract essential semantic information from internal result
10
+ * - Create signal without exposing ISL internals
11
+ * - Add risk score and detections
12
+ */
13
+ import { createISLSignal } from '../signals.js';
14
+ import { createPiDetectionResult } from '../value-objects/PiDetectionResult.js';
15
+ import { MIN_RISK_SCORE, createRiskScore } from '../value-objects/RiskScore.js';
16
+ /**
17
+ * Emits an ISLSignal from an internal ISLResult
18
+ *
19
+ * @param islResult - Internal ISL result
20
+ * @param timestamp - Signal timestamp (default: Date.now())
21
+ * @returns ISLSignal - Semantic signal for external consumption
22
+ */
23
+ export function emitSignal(islResult, timestamp = Date.now()) {
24
+ // Aggregate all detections from all segments
25
+ const allDetections = islResult.segments
26
+ .filter(segment => segment.piDetection)
27
+ .flatMap(segment => segment.piDetection?.detections ?? []);
28
+ // Create aggregated detection result
29
+ const piDetection = createPiDetectionResult(allDetections);
30
+ // Calculate aggregated risk score
31
+ // If there are detections, use the detection result score
32
+ // If no detections, use minimum score
33
+ const riskScore = piDetection.detected
34
+ ? createRiskScore(piDetection.score)
35
+ : MIN_RISK_SCORE;
36
+ // Create and return signal
37
+ return createISLSignal(riskScore, piDetection, timestamp);
38
+ }
39
+ //# sourceMappingURL=emitSignal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitSignal.js","sourceRoot":"","sources":["../../../src/isl/process/emitSignal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/E;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,SAAoB,EACpB,YAAoB,IAAI,CAAC,GAAG,EAAE;IAE9B,6CAA6C;IAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ;SACrC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC;SACtC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,IAAI,EAAE,CAAC,CAAA;IAE5D,qCAAqC;IACrC,MAAM,WAAW,GAAG,uBAAuB,CAAC,aAAa,CAAC,CAAA;IAE1D,kCAAkC;IAClC,0DAA0D;IAC1D,sCAAsC;IACtC,MAAM,SAAS,GAAG,WAAW,CAAC,QAAQ;QACpC,CAAC,CAAC,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC;QACpC,CAAC,CAAC,cAAc,CAAA;IAElB,2BAA2B;IAC3B,OAAO,eAAe,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,CAAC,CAAA;AAC3D,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * ISL Process - ISL processing functions
3
+ */
4
+ export { buildISLResult } from './buildISLResult.js';
5
+ export { emitSignal } from './emitSignal.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/isl/process/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * ISL Process - ISL processing functions
3
+ */
4
+ export { buildISLResult } from './buildISLResult.js';
5
+ export { emitSignal } from './emitSignal.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/isl/process/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA"}
@@ -1,13 +1,13 @@
1
1
  import type { CSLResult } from '../csl/types.js';
2
2
  import type { ISLResult } from './types.js';
3
3
  /**
4
- * Sanitiza contenido según nivel de confianza - función pura
4
+ * Sanitizes content according to trust level - pure function
5
5
  *
6
6
  * @remarks
7
- * ISL aplica sanitización diferenciada según el trust level:
8
- * - TC: Sanitización mínima
9
- * - STC: Sanitización moderada
10
- * - UC: Sanitización agresiva
7
+ * ISL applies differentiated sanitization according to trust level:
8
+ * - TC: Minimal sanitization
9
+ * - STC: Moderate sanitization
10
+ * - UC: Aggressive sanitization
11
11
  */
12
12
  export declare function sanitize(cslResult: CSLResult): ISLResult;
13
13
  //# sourceMappingURL=sanitize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/isl/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAkC,MAAM,YAAY,CAAA;AAM3E;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAmDxD"}
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/isl/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGhD,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,YAAY,CAAA;AAIvD;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAqCxD"}