@vorionsys/atsf-core 0.1.0 → 0.2.1

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 (215) hide show
  1. package/README.md +12 -12
  2. package/dist/api/server.d.ts.map +1 -1
  3. package/dist/api/server.js +463 -35
  4. package/dist/api/server.js.map +1 -1
  5. package/dist/arbitration/index.d.ts.map +1 -1
  6. package/dist/arbitration/index.js +8 -6
  7. package/dist/arbitration/index.js.map +1 -1
  8. package/dist/audit/key-manager.d.ts +118 -0
  9. package/dist/audit/key-manager.d.ts.map +1 -0
  10. package/dist/audit/key-manager.js +565 -0
  11. package/dist/audit/key-manager.js.map +1 -0
  12. package/dist/basis/evaluator.d.ts +31 -0
  13. package/dist/basis/evaluator.d.ts.map +1 -1
  14. package/dist/basis/evaluator.js +205 -10
  15. package/dist/basis/evaluator.js.map +1 -1
  16. package/dist/basis/parser.d.ts +210 -210
  17. package/dist/basis/parser.js.map +1 -1
  18. package/dist/carbon-aware/carbon-metrics.d.ts +151 -0
  19. package/dist/carbon-aware/carbon-metrics.d.ts.map +1 -0
  20. package/dist/carbon-aware/carbon-metrics.js +370 -0
  21. package/dist/carbon-aware/carbon-metrics.js.map +1 -0
  22. package/dist/carbon-aware/carbon-router.d.ts +101 -0
  23. package/dist/carbon-aware/carbon-router.d.ts.map +1 -0
  24. package/dist/carbon-aware/carbon-router.js +400 -0
  25. package/dist/carbon-aware/carbon-router.js.map +1 -0
  26. package/dist/chain/index.d.ts +147 -0
  27. package/dist/chain/index.d.ts.map +1 -0
  28. package/dist/chain/index.js +219 -0
  29. package/dist/chain/index.js.map +1 -0
  30. package/dist/cognigate/index.d.ts +33 -4
  31. package/dist/cognigate/index.d.ts.map +1 -1
  32. package/dist/cognigate/index.js +199 -24
  33. package/dist/cognigate/index.js.map +1 -1
  34. package/dist/common/adapters.d.ts +172 -0
  35. package/dist/common/adapters.d.ts.map +1 -0
  36. package/dist/common/adapters.js +329 -0
  37. package/dist/common/adapters.js.map +1 -0
  38. package/dist/common/config.d.ts +168 -163
  39. package/dist/common/config.d.ts.map +1 -1
  40. package/dist/common/config.js +2 -0
  41. package/dist/common/config.js.map +1 -1
  42. package/dist/common/index.d.ts +1 -0
  43. package/dist/common/index.d.ts.map +1 -1
  44. package/dist/common/index.js +1 -0
  45. package/dist/common/index.js.map +1 -1
  46. package/dist/common/types.d.ts +67 -16
  47. package/dist/common/types.d.ts.map +1 -1
  48. package/dist/common/types.js +4 -0
  49. package/dist/common/types.js.map +1 -1
  50. package/dist/enforce/index.d.ts +226 -16
  51. package/dist/enforce/index.d.ts.map +1 -1
  52. package/dist/enforce/index.js +196 -49
  53. package/dist/enforce/index.js.map +1 -1
  54. package/dist/governance/fluid-workflow.d.ts +217 -0
  55. package/dist/governance/fluid-workflow.d.ts.map +1 -0
  56. package/dist/governance/fluid-workflow.js +491 -0
  57. package/dist/governance/fluid-workflow.js.map +1 -0
  58. package/dist/governance/index.d.ts +1 -0
  59. package/dist/governance/index.d.ts.map +1 -1
  60. package/dist/governance/index.js +1 -0
  61. package/dist/governance/index.js.map +1 -1
  62. package/dist/index.d.ts +9 -3
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +14 -3
  65. package/dist/index.js.map +1 -1
  66. package/dist/intent/index.d.ts +127 -10
  67. package/dist/intent/index.d.ts.map +1 -1
  68. package/dist/intent/index.js +121 -16
  69. package/dist/intent/index.js.map +1 -1
  70. package/dist/langchain/executor.d.ts +19 -5
  71. package/dist/langchain/executor.d.ts.map +1 -1
  72. package/dist/langchain/executor.js +287 -36
  73. package/dist/langchain/executor.js.map +1 -1
  74. package/dist/langchain/index.d.ts +2 -1
  75. package/dist/langchain/index.d.ts.map +1 -1
  76. package/dist/langchain/index.js +3 -1
  77. package/dist/langchain/index.js.map +1 -1
  78. package/dist/langchain/tools.d.ts.map +1 -1
  79. package/dist/langchain/tools.js +2 -1
  80. package/dist/langchain/tools.js.map +1 -1
  81. package/dist/langchain/types.d.ts +41 -0
  82. package/dist/langchain/types.d.ts.map +1 -1
  83. package/dist/layers/index.d.ts +1 -1
  84. package/dist/layers/index.d.ts.map +1 -1
  85. package/dist/persistence/file.d.ts +35 -3
  86. package/dist/persistence/file.d.ts.map +1 -1
  87. package/dist/persistence/file.js +138 -11
  88. package/dist/persistence/file.js.map +1 -1
  89. package/dist/persistence/index.d.ts +11 -1
  90. package/dist/persistence/index.d.ts.map +1 -1
  91. package/dist/persistence/index.js +25 -1
  92. package/dist/persistence/index.js.map +1 -1
  93. package/dist/persistence/sqlite.d.ts +135 -0
  94. package/dist/persistence/sqlite.d.ts.map +1 -0
  95. package/dist/persistence/sqlite.js +372 -0
  96. package/dist/persistence/sqlite.js.map +1 -0
  97. package/dist/persistence/supabase.d.ts +93 -0
  98. package/dist/persistence/supabase.d.ts.map +1 -0
  99. package/dist/persistence/supabase.js +219 -0
  100. package/dist/persistence/supabase.js.map +1 -0
  101. package/dist/persistence/types.d.ts +5 -1
  102. package/dist/persistence/types.d.ts.map +1 -1
  103. package/dist/phase6/ceiling.d.ts +177 -0
  104. package/dist/phase6/ceiling.d.ts.map +1 -0
  105. package/dist/phase6/ceiling.js +463 -0
  106. package/dist/phase6/ceiling.js.map +1 -0
  107. package/dist/phase6/context.d.ts +207 -0
  108. package/dist/phase6/context.d.ts.map +1 -0
  109. package/dist/phase6/context.js +603 -0
  110. package/dist/phase6/context.js.map +1 -0
  111. package/dist/phase6/index.d.ts +79 -0
  112. package/dist/phase6/index.d.ts.map +1 -0
  113. package/dist/phase6/index.js +152 -0
  114. package/dist/phase6/index.js.map +1 -0
  115. package/dist/phase6/presets.d.ts +148 -0
  116. package/dist/phase6/presets.d.ts.map +1 -0
  117. package/dist/phase6/presets.js +467 -0
  118. package/dist/phase6/presets.js.map +1 -0
  119. package/dist/phase6/provenance.d.ts +148 -0
  120. package/dist/phase6/provenance.d.ts.map +1 -0
  121. package/dist/phase6/provenance.js +545 -0
  122. package/dist/phase6/provenance.js.map +1 -0
  123. package/dist/phase6/role-gates/index.d.ts +7 -0
  124. package/dist/phase6/role-gates/index.d.ts.map +1 -0
  125. package/dist/phase6/role-gates/index.js +7 -0
  126. package/dist/phase6/role-gates/index.js.map +1 -0
  127. package/dist/phase6/role-gates/kernel.d.ts +84 -0
  128. package/dist/phase6/role-gates/kernel.d.ts.map +1 -0
  129. package/dist/phase6/role-gates/kernel.js +258 -0
  130. package/dist/phase6/role-gates/kernel.js.map +1 -0
  131. package/dist/phase6/role-gates/policy.d.ts +110 -0
  132. package/dist/phase6/role-gates/policy.d.ts.map +1 -0
  133. package/dist/phase6/role-gates/policy.js +157 -0
  134. package/dist/phase6/role-gates/policy.js.map +1 -0
  135. package/dist/phase6/role-gates.d.ts +164 -0
  136. package/dist/phase6/role-gates.d.ts.map +1 -0
  137. package/dist/phase6/role-gates.js +536 -0
  138. package/dist/phase6/role-gates.js.map +1 -0
  139. package/dist/phase6/types.d.ts +1827 -0
  140. package/dist/phase6/types.d.ts.map +1 -0
  141. package/dist/phase6/types.js +450 -0
  142. package/dist/phase6/types.js.map +1 -0
  143. package/dist/phase6/weight-presets/canonical.d.ts +93 -0
  144. package/dist/phase6/weight-presets/canonical.d.ts.map +1 -0
  145. package/dist/phase6/weight-presets/canonical.js +122 -0
  146. package/dist/phase6/weight-presets/canonical.js.map +1 -0
  147. package/dist/phase6/weight-presets/deltas.d.ts +144 -0
  148. package/dist/phase6/weight-presets/deltas.d.ts.map +1 -0
  149. package/dist/phase6/weight-presets/deltas.js +184 -0
  150. package/dist/phase6/weight-presets/deltas.js.map +1 -0
  151. package/dist/phase6/weight-presets/index.d.ts +8 -0
  152. package/dist/phase6/weight-presets/index.d.ts.map +1 -0
  153. package/dist/phase6/weight-presets/index.js +8 -0
  154. package/dist/phase6/weight-presets/index.js.map +1 -0
  155. package/dist/phase6/weight-presets/merger.d.ts +79 -0
  156. package/dist/phase6/weight-presets/merger.d.ts.map +1 -0
  157. package/dist/phase6/weight-presets/merger.js +161 -0
  158. package/dist/phase6/weight-presets/merger.js.map +1 -0
  159. package/dist/proof/index.d.ts +50 -1
  160. package/dist/proof/index.d.ts.map +1 -1
  161. package/dist/proof/index.js +122 -3
  162. package/dist/proof/index.js.map +1 -1
  163. package/dist/proof/merkle.d.ts +195 -0
  164. package/dist/proof/merkle.d.ts.map +1 -0
  165. package/dist/proof/merkle.js +412 -0
  166. package/dist/proof/merkle.js.map +1 -0
  167. package/dist/proof/zk-proofs.d.ts +218 -0
  168. package/dist/proof/zk-proofs.d.ts.map +1 -0
  169. package/dist/proof/zk-proofs.js +531 -0
  170. package/dist/proof/zk-proofs.js.map +1 -0
  171. package/dist/trust-engine/ceiling-enforcement/audit.d.ts +98 -0
  172. package/dist/trust-engine/ceiling-enforcement/audit.d.ts.map +1 -0
  173. package/dist/trust-engine/ceiling-enforcement/audit.js +160 -0
  174. package/dist/trust-engine/ceiling-enforcement/audit.js.map +1 -0
  175. package/dist/trust-engine/ceiling-enforcement/index.d.ts +6 -0
  176. package/dist/trust-engine/ceiling-enforcement/index.d.ts.map +1 -0
  177. package/dist/trust-engine/ceiling-enforcement/index.js +6 -0
  178. package/dist/trust-engine/ceiling-enforcement/index.js.map +1 -0
  179. package/dist/trust-engine/ceiling-enforcement/kernel.d.ts +112 -0
  180. package/dist/trust-engine/ceiling-enforcement/kernel.d.ts.map +1 -0
  181. package/dist/trust-engine/ceiling-enforcement/kernel.js +158 -0
  182. package/dist/trust-engine/ceiling-enforcement/kernel.js.map +1 -0
  183. package/dist/trust-engine/context-policy/enforcement.d.ts +62 -0
  184. package/dist/trust-engine/context-policy/enforcement.d.ts.map +1 -0
  185. package/dist/trust-engine/context-policy/enforcement.js +104 -0
  186. package/dist/trust-engine/context-policy/enforcement.js.map +1 -0
  187. package/dist/trust-engine/context-policy/factory.d.ts +75 -0
  188. package/dist/trust-engine/context-policy/factory.d.ts.map +1 -0
  189. package/dist/trust-engine/context-policy/factory.js +130 -0
  190. package/dist/trust-engine/context-policy/factory.js.map +1 -0
  191. package/dist/trust-engine/context-policy/index.d.ts +6 -0
  192. package/dist/trust-engine/context-policy/index.d.ts.map +1 -0
  193. package/dist/trust-engine/context-policy/index.js +6 -0
  194. package/dist/trust-engine/context-policy/index.js.map +1 -0
  195. package/dist/trust-engine/creation-modifiers/index.d.ts +5 -0
  196. package/dist/trust-engine/creation-modifiers/index.d.ts.map +1 -0
  197. package/dist/trust-engine/creation-modifiers/index.js +5 -0
  198. package/dist/trust-engine/creation-modifiers/index.js.map +1 -0
  199. package/dist/trust-engine/creation-modifiers/types.d.ts +112 -0
  200. package/dist/trust-engine/creation-modifiers/types.d.ts.map +1 -0
  201. package/dist/trust-engine/creation-modifiers/types.js +166 -0
  202. package/dist/trust-engine/creation-modifiers/types.js.map +1 -0
  203. package/dist/trust-engine/decay-profiles.d.ts +159 -0
  204. package/dist/trust-engine/decay-profiles.d.ts.map +1 -0
  205. package/dist/trust-engine/decay-profiles.js +210 -0
  206. package/dist/trust-engine/decay-profiles.js.map +1 -0
  207. package/dist/trust-engine/index.d.ts +144 -5
  208. package/dist/trust-engine/index.d.ts.map +1 -1
  209. package/dist/trust-engine/index.js +320 -15
  210. package/dist/trust-engine/index.js.map +1 -1
  211. package/dist/trust-engine/phase6-types.d.ts +123 -0
  212. package/dist/trust-engine/phase6-types.d.ts.map +1 -0
  213. package/dist/trust-engine/phase6-types.js +88 -0
  214. package/dist/trust-engine/phase6-types.js.map +1 -0
  215. package/package.json +26 -10
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Context-Aware Trust Decay Profiles
3
+ *
4
+ * Implements half-life based exponential decay with:
5
+ * - Environment-aware profiles (volatile, standard, stable)
6
+ * - Failure acceleration multipliers
7
+ * - Entity-specific profile overrides
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ /**
12
+ * Profile type names
13
+ */
14
+ export type EnvironmentProfileType = 'volatile' | 'standard' | 'stable';
15
+ /**
16
+ * Environment profile configuration
17
+ *
18
+ * Defines decay characteristics for different operational contexts.
19
+ */
20
+ export interface EnvironmentProfile {
21
+ /** Profile type identifier */
22
+ type: EnvironmentProfileType;
23
+ /** Base half-life in days (time for score to decay to 50%) */
24
+ baseHalfLifeDays: number;
25
+ /** Multiplier applied per failure (exponential: multiplier^failureCount) */
26
+ failureMultiplier: number;
27
+ }
28
+ /**
29
+ * Detailed result from decay calculation
30
+ */
31
+ export interface DecayCalculationResult {
32
+ /** Final decayed score */
33
+ decayedScore: number;
34
+ /** Base decay factor before failure acceleration (0-1) */
35
+ baseDecayFactor: number;
36
+ /** Effective decay factor after failure acceleration */
37
+ effectiveDecayFactor: number;
38
+ /** Failure acceleration divisor (failureMultiplier^failureCount) */
39
+ failureAcceleration: number;
40
+ /** Name of profile used for calculation */
41
+ profileUsed: EnvironmentProfileType;
42
+ }
43
+ /**
44
+ * Configuration for decay profile resolution
45
+ */
46
+ export interface DecayConfig {
47
+ /** Enable automatic classification based on activity rate */
48
+ autoClassification: boolean;
49
+ /** Manual profile overrides by entity ID */
50
+ overrideByAgentId: Map<string, EnvironmentProfile>;
51
+ }
52
+ /**
53
+ * Options for creating a DecayConfig
54
+ */
55
+ export interface DecayConfigOptions {
56
+ autoClassification?: boolean;
57
+ overrideByAgentId?: Map<string, EnvironmentProfile>;
58
+ }
59
+ /**
60
+ * Default decay profiles for different environment types
61
+ *
62
+ * - **Volatile**: High-frequency trading, real-time systems
63
+ * - 30-day half-life (fast decay for frequently-used agents)
64
+ * - 4x failure multiplier (harsh penalties for failures)
65
+ *
66
+ * - **Standard**: General-purpose agents, typical workloads
67
+ * - 182-day half-life (~6 months)
68
+ * - 3x failure multiplier (moderate penalties)
69
+ *
70
+ * - **Stable**: Audit systems, compliance agents, infrequent operations
71
+ * - 365-day half-life (slow decay for long-running agents)
72
+ * - 2x failure multiplier (lenient penalties)
73
+ */
74
+ export declare const DEFAULT_DECAY_PROFILES: {
75
+ readonly profiles: {
76
+ readonly volatile: {
77
+ readonly type: "volatile";
78
+ readonly baseHalfLifeDays: 30;
79
+ readonly failureMultiplier: 4;
80
+ };
81
+ readonly standard: {
82
+ readonly type: "standard";
83
+ readonly baseHalfLifeDays: 182;
84
+ readonly failureMultiplier: 3;
85
+ };
86
+ readonly stable: {
87
+ readonly type: "stable";
88
+ readonly baseHalfLifeDays: 365;
89
+ readonly failureMultiplier: 2;
90
+ };
91
+ };
92
+ };
93
+ /**
94
+ * Calculate context-aware trust decay
95
+ *
96
+ * Uses exponential decay formula with half-life:
97
+ * `score * (0.5 ^ (days / halfLife)) / (failureMultiplier ^ failureCount)`
98
+ *
99
+ * @param initialScore - Starting trust score (0-1000)
100
+ * @param daysSinceLastAction - Days since last trust-relevant action
101
+ * @param profile - Environment profile to use for decay calculation
102
+ * @param failureCount - Number of recent failures (0 for no failures)
103
+ * @returns Decayed trust score, floored at 0
104
+ */
105
+ export declare function calculateContextAwareDecay(initialScore: number, daysSinceLastAction: number, profile: EnvironmentProfile, failureCount: number): number;
106
+ /**
107
+ * Calculate context-aware decay with detailed breakdown
108
+ *
109
+ * Returns full calculation details for debugging, logging, and analysis.
110
+ *
111
+ * @param initialScore - Starting trust score (0-1000)
112
+ * @param daysSinceLastAction - Days since last trust-relevant action
113
+ * @param profile - Environment profile to use
114
+ * @param failureCount - Number of recent failures
115
+ * @returns Detailed calculation result
116
+ */
117
+ export declare function calculateContextAwareDecayWithDetails(initialScore: number, daysSinceLastAction: number, profile: EnvironmentProfile, failureCount: number): DecayCalculationResult;
118
+ /**
119
+ * Calculate days until score decays to target value
120
+ *
121
+ * Inverse of the decay formula to predict when a threshold will be reached.
122
+ *
123
+ * @param currentScore - Current trust score
124
+ * @param targetScore - Target score to calculate time for
125
+ * @param profile - Environment profile
126
+ * @param failureCount - Number of recent failures
127
+ * @returns Days until target is reached, or Infinity if unreachable
128
+ */
129
+ export declare function calculateDaysUntilDecay(currentScore: number, targetScore: number, profile: EnvironmentProfile, failureCount: number): number;
130
+ /**
131
+ * Classify environment profile based on activity rate
132
+ *
133
+ * Automatically determines the appropriate decay profile based on
134
+ * how frequently an agent performs trust-relevant actions.
135
+ *
136
+ * @param actionsPerDay - Average number of actions per day
137
+ * @returns Appropriate environment profile
138
+ */
139
+ export declare function classifyEnvironmentProfile(actionsPerDay: number): EnvironmentProfile;
140
+ /**
141
+ * Get the appropriate profile for a specific entity
142
+ *
143
+ * Checks for manual overrides first, then falls back to
144
+ * auto-classification or default profile.
145
+ *
146
+ * @param entityId - Entity identifier
147
+ * @param actionsPerDay - Activity rate for auto-classification
148
+ * @param config - Decay configuration with overrides
149
+ * @returns Environment profile for the entity
150
+ */
151
+ export declare function getProfileForEntity(entityId: string, actionsPerDay: number, config: DecayConfig): EnvironmentProfile;
152
+ /**
153
+ * Create a decay configuration with defaults
154
+ *
155
+ * @param options - Configuration options
156
+ * @returns Complete decay configuration
157
+ */
158
+ export declare function createDecayConfig(options?: DecayConfigOptions): DecayConfig;
159
+ //# sourceMappingURL=decay-profiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decay-profiles.d.ts","sourceRoot":"","sources":["../../src/trust-engine/decay-profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;AAExE;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,IAAI,EAAE,sBAAsB,CAAC;IAE7B,8DAA8D;IAC9D,gBAAgB,EAAE,MAAM,CAAC;IAEzB,4EAA4E;IAC5E,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,0BAA0B;IAC1B,YAAY,EAAE,MAAM,CAAC;IAErB,0DAA0D;IAC1D,eAAe,EAAE,MAAM,CAAC;IAExB,wDAAwD;IACxD,oBAAoB,EAAE,MAAM,CAAC;IAE7B,oEAAoE;IACpE,mBAAmB,EAAE,MAAM,CAAC;IAE5B,2CAA2C;IAC3C,WAAW,EAAE,sBAAsB,CAAC;CACr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-0,0 +1,210 @@
1
+ /**
2
+ * Context-Aware Trust Decay Profiles
3
+ *
4
+ * Implements half-life based exponential decay with:
5
+ * - Environment-aware profiles (volatile, standard, stable)
6
+ * - Failure acceleration multipliers
7
+ * - Entity-specific profile overrides
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ // ============================================================================
12
+ // Default Profiles
13
+ // ============================================================================
14
+ /**
15
+ * Default decay profiles for different environment types
16
+ *
17
+ * - **Volatile**: High-frequency trading, real-time systems
18
+ * - 30-day half-life (fast decay for frequently-used agents)
19
+ * - 4x failure multiplier (harsh penalties for failures)
20
+ *
21
+ * - **Standard**: General-purpose agents, typical workloads
22
+ * - 182-day half-life (~6 months)
23
+ * - 3x failure multiplier (moderate penalties)
24
+ *
25
+ * - **Stable**: Audit systems, compliance agents, infrequent operations
26
+ * - 365-day half-life (slow decay for long-running agents)
27
+ * - 2x failure multiplier (lenient penalties)
28
+ */
29
+ export const DEFAULT_DECAY_PROFILES = {
30
+ profiles: {
31
+ volatile: {
32
+ type: 'volatile',
33
+ baseHalfLifeDays: 30,
34
+ failureMultiplier: 4.0,
35
+ },
36
+ standard: {
37
+ type: 'standard',
38
+ baseHalfLifeDays: 182,
39
+ failureMultiplier: 3.0,
40
+ },
41
+ stable: {
42
+ type: 'stable',
43
+ baseHalfLifeDays: 365,
44
+ failureMultiplier: 2.0,
45
+ },
46
+ },
47
+ };
48
+ // ============================================================================
49
+ // Core Decay Functions
50
+ // ============================================================================
51
+ /**
52
+ * Calculate context-aware trust decay
53
+ *
54
+ * Uses exponential decay formula with half-life:
55
+ * `score * (0.5 ^ (days / halfLife)) / (failureMultiplier ^ failureCount)`
56
+ *
57
+ * @param initialScore - Starting trust score (0-1000)
58
+ * @param daysSinceLastAction - Days since last trust-relevant action
59
+ * @param profile - Environment profile to use for decay calculation
60
+ * @param failureCount - Number of recent failures (0 for no failures)
61
+ * @returns Decayed trust score, floored at 0
62
+ */
63
+ export function calculateContextAwareDecay(initialScore, daysSinceLastAction, profile, failureCount) {
64
+ // Calculate base decay factor using half-life formula
65
+ // At half-life days, this equals 0.5 (50% remaining)
66
+ const baseDecayFactor = Math.pow(0.5, daysSinceLastAction / profile.baseHalfLifeDays);
67
+ // Calculate failure acceleration (exponential penalty)
68
+ // Treat negative failure counts as 0
69
+ const effectiveFailures = Math.max(0, failureCount);
70
+ const failureAcceleration = Math.pow(profile.failureMultiplier, effectiveFailures);
71
+ // Apply decay: score * baseFactor / failureAcceleration
72
+ const decayedScore = (initialScore * baseDecayFactor) / failureAcceleration;
73
+ // Floor at 0
74
+ return Math.max(0, decayedScore);
75
+ }
76
+ /**
77
+ * Calculate context-aware decay with detailed breakdown
78
+ *
79
+ * Returns full calculation details for debugging, logging, and analysis.
80
+ *
81
+ * @param initialScore - Starting trust score (0-1000)
82
+ * @param daysSinceLastAction - Days since last trust-relevant action
83
+ * @param profile - Environment profile to use
84
+ * @param failureCount - Number of recent failures
85
+ * @returns Detailed calculation result
86
+ */
87
+ export function calculateContextAwareDecayWithDetails(initialScore, daysSinceLastAction, profile, failureCount) {
88
+ // Calculate base decay factor
89
+ const baseDecayFactor = Math.pow(0.5, daysSinceLastAction / profile.baseHalfLifeDays);
90
+ // Calculate failure acceleration
91
+ const effectiveFailures = Math.max(0, failureCount);
92
+ const failureAcceleration = Math.pow(profile.failureMultiplier, effectiveFailures);
93
+ // Calculate effective decay factor (after failure penalty)
94
+ const effectiveDecayFactor = baseDecayFactor / failureAcceleration;
95
+ // Calculate final score
96
+ const decayedScore = Math.max(0, initialScore * effectiveDecayFactor);
97
+ return {
98
+ decayedScore,
99
+ baseDecayFactor,
100
+ effectiveDecayFactor,
101
+ failureAcceleration,
102
+ profileUsed: profile.type,
103
+ };
104
+ }
105
+ /**
106
+ * Calculate days until score decays to target value
107
+ *
108
+ * Inverse of the decay formula to predict when a threshold will be reached.
109
+ *
110
+ * @param currentScore - Current trust score
111
+ * @param targetScore - Target score to calculate time for
112
+ * @param profile - Environment profile
113
+ * @param failureCount - Number of recent failures
114
+ * @returns Days until target is reached, or Infinity if unreachable
115
+ */
116
+ export function calculateDaysUntilDecay(currentScore, targetScore, profile, failureCount) {
117
+ // If already at or below target, return Infinity (already there)
118
+ if (currentScore <= targetScore) {
119
+ return Infinity;
120
+ }
121
+ // If target is zero or negative, return Infinity (asymptotic)
122
+ if (targetScore <= 0) {
123
+ return Infinity;
124
+ }
125
+ // Calculate failure acceleration
126
+ const effectiveFailures = Math.max(0, failureCount);
127
+ const failureAcceleration = Math.pow(profile.failureMultiplier, effectiveFailures);
128
+ // Adjust current score for failure acceleration
129
+ const effectiveCurrentScore = currentScore / failureAcceleration;
130
+ // If effective current is already at or below target, return 0
131
+ if (effectiveCurrentScore <= targetScore) {
132
+ return 0;
133
+ }
134
+ // Solve for days: target = current * (0.5 ^ (days / halfLife))
135
+ // target / current = 0.5 ^ (days / halfLife)
136
+ // log(target / current) = (days / halfLife) * log(0.5)
137
+ // days = halfLife * log(target / current) / log(0.5)
138
+ const ratio = targetScore / effectiveCurrentScore;
139
+ const days = profile.baseHalfLifeDays * Math.log(ratio) / Math.log(0.5);
140
+ return Math.max(0, days);
141
+ }
142
+ // ============================================================================
143
+ // Profile Classification
144
+ // ============================================================================
145
+ /**
146
+ * Activity rate thresholds for profile classification
147
+ */
148
+ const ACTIVITY_THRESHOLDS = {
149
+ volatile: 100, // >= 100 actions/day = volatile
150
+ standard: 10, // >= 10 actions/day = standard
151
+ // < 10 actions/day = stable
152
+ };
153
+ /**
154
+ * Classify environment profile based on activity rate
155
+ *
156
+ * Automatically determines the appropriate decay profile based on
157
+ * how frequently an agent performs trust-relevant actions.
158
+ *
159
+ * @param actionsPerDay - Average number of actions per day
160
+ * @returns Appropriate environment profile
161
+ */
162
+ export function classifyEnvironmentProfile(actionsPerDay) {
163
+ if (actionsPerDay >= ACTIVITY_THRESHOLDS.volatile) {
164
+ return DEFAULT_DECAY_PROFILES.profiles.volatile;
165
+ }
166
+ if (actionsPerDay >= ACTIVITY_THRESHOLDS.standard) {
167
+ return DEFAULT_DECAY_PROFILES.profiles.standard;
168
+ }
169
+ return DEFAULT_DECAY_PROFILES.profiles.stable;
170
+ }
171
+ /**
172
+ * Get the appropriate profile for a specific entity
173
+ *
174
+ * Checks for manual overrides first, then falls back to
175
+ * auto-classification or default profile.
176
+ *
177
+ * @param entityId - Entity identifier
178
+ * @param actionsPerDay - Activity rate for auto-classification
179
+ * @param config - Decay configuration with overrides
180
+ * @returns Environment profile for the entity
181
+ */
182
+ export function getProfileForEntity(entityId, actionsPerDay, config) {
183
+ // Check for manual override first
184
+ const override = config.overrideByAgentId.get(entityId);
185
+ if (override) {
186
+ return override;
187
+ }
188
+ // Use auto-classification if enabled
189
+ if (config.autoClassification) {
190
+ return classifyEnvironmentProfile(actionsPerDay);
191
+ }
192
+ // Default to standard profile
193
+ return DEFAULT_DECAY_PROFILES.profiles.standard;
194
+ }
195
+ // ============================================================================
196
+ // Configuration Factory
197
+ // ============================================================================
198
+ /**
199
+ * Create a decay configuration with defaults
200
+ *
201
+ * @param options - Configuration options
202
+ * @returns Complete decay configuration
203
+ */
204
+ export function createDecayConfig(options = {}) {
205
+ return {
206
+ autoClassification: options.autoClassification ?? true,
207
+ overrideByAgentId: options.overrideByAgentId ?? new Map(),
208
+ };
209
+ }
210
+ //# sourceMappingURL=decay-profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decay-profiles.js","sourceRoot":"","sources":["../../src/trust-engine/decay-profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAkEH,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,QAAQ,EAAE;QACR,QAAQ,EAAE;YACR,IAAI,EAAE,UAAmB;YACzB,gBAAgB,EAAE,EAAE;YACpB,iBAAiB,EAAE,GAAG;SACvB;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,UAAmB;YACzB,gBAAgB,EAAE,G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IAAI;QACtD,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,IAAI,IAAI,GAAG,EAAE;KAC1D,CAAC;AACJ,CAAC"}
@@ -10,14 +10,14 @@ import { EventEmitter } from 'events';
10
10
  import type { TrustScore, TrustLevel, TrustSignal, TrustComponents, ID } from '../common/types.js';
11
11
  import type { PersistenceProvider } from '../persistence/types.js';
12
12
  /**
13
- * Trust level thresholds (6 tiers) - per BASIS specification
13
+ * Trust level thresholds (8 tiers T0-T7) - per BASIS specification
14
14
  */
15
15
  export declare const TRUST_THRESHOLDS: Record<TrustLevel, {
16
16
  min: number;
17
17
  max: number;
18
18
  }>;
19
19
  /**
20
- * Trust level names (6 tiers) - per BASIS specification
20
+ * Trust level names (8 tiers T0-T7) - per BASIS specification
21
21
  */
22
22
  export declare const TRUST_LEVEL_NAMES: Record<TrustLevel, string>;
23
23
  /**
@@ -27,7 +27,7 @@ export declare const SIGNAL_WEIGHTS: Record<keyof TrustComponents, number>;
27
27
  /**
28
28
  * Trust event types
29
29
  */
30
- export type TrustEventType = 'trust:initialized' | 'trust:signal_recorded' | 'trust:score_changed' | 'trust:tier_changed' | 'trust:decay_applied' | 'trust:failure_detected';
30
+ export type TrustEventType = 'trust:initialized' | 'trust:signal_recorded' | 'trust:score_changed' | 'trust:tier_changed' | 'trust:decay_applied' | 'trust:failure_detected' | 'trust:recovery_applied' | 'trust:recovery_milestone';
31
31
  /**
32
32
  * Base trust event
33
33
  */
@@ -94,10 +94,32 @@ export interface TrustFailureDetectedEvent extends TrustEvent {
94
94
  failureCount: number;
95
95
  acceleratedDecayActive: boolean;
96
96
  }
97
+ /**
98
+ * Recovery applied event
99
+ */
100
+ export interface TrustRecoveryAppliedEvent extends TrustEvent {
101
+ type: 'trust:recovery_applied';
102
+ signal: TrustSignal;
103
+ previousScore: TrustScore;
104
+ newScore: TrustScore;
105
+ recoveryAmount: number;
106
+ consecutiveSuccesses: number;
107
+ acceleratedRecoveryActive: boolean;
108
+ }
109
+ /**
110
+ * Recovery milestone event (e.g., restored to previous tier)
111
+ */
112
+ export interface TrustRecoveryMilestoneEvent extends TrustEvent {
113
+ type: 'trust:recovery_milestone';
114
+ milestone: 'tier_restored' | 'full_recovery' | 'accelerated_recovery_earned';
115
+ previousScore: TrustScore;
116
+ newScore: TrustScore;
117
+ details: string;
118
+ }
97
119
  /**
98
120
  * Union of all trust events
99
121
  */
100
- export type AnyTrustEvent = TrustInitializedEvent | TrustSignalRecordedEvent | TrustScoreChangedEvent | TrustTierChangedEvent | TrustDecayAppliedEvent | TrustFailureDetectedEvent;
122
+ export type AnyTrustEvent = TrustInitializedEvent | TrustSignalRecordedEvent | TrustScoreChangedEvent | TrustTierChangedEvent | TrustDecayAppliedEvent | TrustFailureDetectedEvent | TrustRecoveryAppliedEvent | TrustRecoveryMilestoneEvent;
101
123
  /**
102
124
  * Entity trust record
103
125
  */
@@ -111,6 +133,12 @@ export interface TrustRecord {
111
133
  history: TrustHistoryEntry[];
112
134
  /** Recent failure timestamps for accelerated decay */
113
135
  recentFailures: string[];
136
+ /** Recent success timestamps for recovery */
137
+ recentSuccesses: string[];
138
+ /** Peak score achieved (for recovery milestone tracking) */
139
+ peakScore: TrustScore;
140
+ /** Consecutive successful signals count */
141
+ consecutiveSuccesses: number;
114
142
  }
115
143
  /**
116
144
  * Trust history entry
@@ -150,9 +178,27 @@ export interface TrustEngineConfig {
150
178
  persistence?: PersistenceProvider;
151
179
  /** Auto-persist changes (default: true when persistence is provided) */
152
180
  autoPersist?: boolean;
181
+ /** Signal value threshold above which a signal is considered a success (default: 0.7) */
182
+ successThreshold?: number;
183
+ /** Base recovery rate per successful signal (default: 0.02 = 2%) */
184
+ recoveryRate?: number;
185
+ /** Multiplier for recovery when entity has consecutive successes (default: 1.5) */
186
+ acceleratedRecoveryMultiplier?: number;
187
+ /** Minimum consecutive successes to trigger accelerated recovery (default: 3) */
188
+ minSuccessesForAcceleration?: number;
189
+ /** Time window in ms to consider successes as "recent" (default: 3600000 = 1 hour) */
190
+ successWindowMs?: number;
191
+ /** Maximum score boost per recovery signal (default: 50 points) */
192
+ maxRecoveryPerSignal?: number;
193
+ /** Maximum number of listeners per event type (default: 100) */
194
+ maxListenersPerEvent?: number;
195
+ /** Maximum total listeners across all events (default: 1000) */
196
+ maxTotalListeners?: number;
197
+ /** Warn when listener count exceeds this percentage of max (default: 0.8 = 80%) */
198
+ listenerWarningThreshold?: number;
153
199
  }
154
200
  /**
155
- * Trust Engine service with event emission
201
+ * Trust Engine service with event emission and subscription limits
156
202
  */
157
203
  export declare class TrustEngine extends EventEmitter {
158
204
  private records;
@@ -164,7 +210,60 @@ export declare class TrustEngine extends EventEmitter {
164
210
  private _minFailuresForAcceleration;
165
211
  private _persistence?;
166
212
  private _autoPersist;
213
+ private _successThreshold;
214
+ private _recoveryRate;
215
+ private _acceleratedRecoveryMultiplier;
216
+ private _minSuccessesForAcceleration;
217
+ private _successWindowMs;
218
+ private _maxRecoveryPerSignal;
219
+ private _maxListenersPerEvent;
220
+ private _maxTotalListeners;
221
+ private _listenerWarningThreshold;
222
+ private _listenerCounts;
223
+ private _totalListeners;
167
224
  constructor(config?: TrustEngineConfig);
225
+ /**
226
+ * Add event listener with subscription limits
227
+ * @throws Error if listener limits are exceeded
228
+ */
229
+ on(eventName: string | symbol, listener: (...args: unknown[]) => void): this;
230
+ /**
231
+ * Add one-time event listener with subscription limits
232
+ */
233
+ once(eventName: string | symbol, listener: (...args: unknown[]) => void): this;
234
+ /**
235
+ * Remove event listener
236
+ */
237
+ off(eventName: string | symbol, listener: (...args: unknown[]) => void): this;
238
+ /**
239
+ * Remove event listener (alias)
240
+ */
241
+ removeListener(eventName: string | symbol, listener: (...args: unknown[]) => void): this;
242
+ /**
243
+ * Remove all listeners for an event
244
+ */
245
+ removeAllListeners(eventName?: string | symbol): this;
246
+ /**
247
+ * Check if adding a listener would exceed limits
248
+ */
249
+ private checkListenerLimits;
250
+ /**
251
+ * Increment listener count for an event
252
+ */
253
+ private incrementListenerCount;
254
+ /**
255
+ * Decrement listener count for an event
256
+ */
257
+ private decrementListenerCount;
258
+ /**
259
+ * Get current listener statistics
260
+ */
261
+ getListenerStats(): {
262
+ totalListeners: number;
263
+ maxTotalListeners: number;
264
+ listenersByEvent: Record<string, number>;
265
+ maxListenersPerEvent: number;
266
+ };
168
267
  /**
169
268
  * Get the current decay rate
170
269
  */
@@ -185,6 +284,18 @@ export declare class TrustEngine extends EventEmitter {
185
284
  * Get the persistence provider
186
285
  */
187
286
  get persistence(): PersistenceProvider | undefined;
287
+ /**
288
+ * Get the success threshold
289
+ */
290
+ get successThreshold(): number;
291
+ /**
292
+ * Get the recovery rate
293
+ */
294
+ get recoveryRate(): number;
295
+ /**
296
+ * Get the accelerated recovery multiplier
297
+ */
298
+ get acceleratedRecoveryMultiplier(): number;
188
299
  /**
189
300
  * Load all records from persistence
190
301
  */
@@ -217,6 +328,22 @@ export declare class TrustEngine extends EventEmitter {
217
328
  * Clean up old failure timestamps outside the window
218
329
  */
219
330
  private cleanupFailures;
331
+ /**
332
+ * Clean up old success timestamps outside the window
333
+ */
334
+ private cleanupSuccesses;
335
+ /**
336
+ * Check if an entity has accelerated recovery active
337
+ */
338
+ private hasAcceleratedRecovery;
339
+ /**
340
+ * Calculate recovery amount for a success signal
341
+ */
342
+ private calculateRecoveryAmount;
343
+ /**
344
+ * Apply recovery to a trust record
345
+ */
346
+ private applyRecovery;
220
347
  /**
221
348
  * Get trust score for an entity (with automatic decay)
222
349
  */
@@ -261,10 +388,22 @@ export declare class TrustEngine extends EventEmitter {
261
388
  * Check if accelerated decay is currently active for an entity
262
389
  */
263
390
  isAcceleratedDecayActive(entityId: ID): boolean;
391
+ /**
392
+ * Check if accelerated recovery is currently active for an entity
393
+ */
394
+ isAcceleratedRecoveryActive(entityId: ID): boolean;
264
395
  /**
265
396
  * Get current failure count for an entity
266
397
  */
267
398
  getFailureCount(entityId: ID): number;
399
+ /**
400
+ * Get consecutive success count for an entity
401
+ */
402
+ getConsecutiveSuccessCount(entityId: ID): number;
403
+ /**
404
+ * Get peak score for an entity
405
+ */
406
+ getPeakScore(entityId: ID): TrustScore;
268
407
  }
269
408
  /**
270
409
  * Create a new Trust Engine instance
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/trust-engine/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,eAAe,EACf,EAAE,EACH,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAInE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,UAAU,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAO7E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAOxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,eAAe,EAAE,MAAM,CAKhE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,mBAAmB,GACnB,uBAAuB,GACvB,qBAAqB,GACrB,oBAAoB,GACpB,qBAAqB,GACrB,wBAAwB,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,EAAE,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,UAAU;IACvD,IAAI,EAAE,mBAAmB,CAAC;IAC1B,YAAY,EAAE,UAAU,CAAC;IACzB,YAAY,EAAE,UAAU,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,UAAU;IAC1D,IA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