@vorionsys/contracts 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/README.md +3 -3
- package/dist/aci/index.d.ts +1 -1
- package/dist/aci/index.js +1 -1
- package/dist/canonical/agent.d.ts +14 -14
- package/dist/canonical/governance.d.ts +8 -8
- package/dist/canonical/intent.d.ts +18 -18
- package/dist/canonical/middleware.d.ts +4 -4
- package/dist/canonical/trust-signal.d.ts +48 -45
- package/dist/canonical/trust-signal.d.ts.map +1 -1
- package/dist/canonical/trust-signal.js +7 -2
- package/dist/canonical/trust-signal.js.map +1 -1
- package/dist/canonical/validation.d.ts +11 -26
- package/dist/canonical/validation.d.ts.map +1 -1
- package/dist/canonical/validation.js +30 -101
- package/dist/canonical/validation.js.map +1 -1
- package/dist/car/attestation.d.ts +30 -30
- package/dist/car/attestation.d.ts.map +1 -1
- package/dist/car/attestation.js +3 -1
- package/dist/car/attestation.js.map +1 -1
- package/dist/car/car-string.d.ts +41 -41
- package/dist/car/car-string.d.ts.map +1 -1
- package/dist/car/car-string.js +36 -36
- package/dist/car/car-string.js.map +1 -1
- package/dist/car/domains.d.ts +34 -18
- package/dist/car/domains.d.ts.map +1 -1
- package/dist/car/domains.js +53 -15
- package/dist/car/domains.js.map +1 -1
- package/dist/car/effective-permission.d.ts +59 -11
- package/dist/car/effective-permission.d.ts.map +1 -1
- package/dist/car/effective-permission.js +30 -2
- package/dist/car/effective-permission.js.map +1 -1
- package/dist/car/identity.d.ts +298 -79
- package/dist/car/identity.d.ts.map +1 -1
- package/dist/car/identity.js +112 -10
- package/dist/car/identity.js.map +1 -1
- package/dist/car/index.d.ts +3 -3
- package/dist/car/index.d.ts.map +1 -1
- package/dist/car/index.js +15 -7
- package/dist/car/index.js.map +1 -1
- package/dist/car/jwt-claims.d.ts +179 -179
- package/dist/car/jwt-claims.d.ts.map +1 -1
- package/dist/car/jwt-claims.js +39 -46
- package/dist/car/jwt-claims.js.map +1 -1
- package/dist/car/levels.d.ts +2 -2
- package/dist/car/mapping.d.ts +36 -36
- package/dist/car/mapping.d.ts.map +1 -1
- package/dist/car/mapping.js +107 -43
- package/dist/car/mapping.js.map +1 -1
- package/dist/car/skills.d.ts +4 -4
- package/dist/car/tiers.d.ts +7 -7
- package/dist/car/tiers.js +4 -4
- package/dist/car/tiers.js.map +1 -1
- package/dist/common/primitives.d.ts +2 -2
- package/dist/db/agents.d.ts +4 -4
- package/dist/db/agents.js +4 -4
- package/dist/db/agents.js.map +1 -1
- package/dist/v2/enums.d.ts +5 -0
- package/dist/v2/enums.d.ts.map +1 -1
- package/dist/v2/enums.js +5 -0
- package/dist/v2/enums.js.map +1 -1
- package/dist/v2/evidence.d.ts +20 -20
- package/dist/v2/pre-action-gate.js +5 -5
- package/dist/v2/pre-action-gate.js.map +1 -1
- package/dist/v2/retention.d.ts +14 -14
- package/dist/v2/trust-delta.d.ts +6 -6
- package/dist/v2/trust-delta.d.ts.map +1 -1
- package/dist/v2/trust-profile.d.ts +116 -54
- package/dist/v2/trust-profile.d.ts.map +1 -1
- package/dist/v2/trust-profile.js +22 -17
- package/dist/v2/trust-profile.js.map +1 -1
- package/dist/validators/decision.d.ts +6 -6
- package/dist/validators/intent.d.ts +8 -8
- package/dist/validators/proof-event.d.ts +54 -54
- package/dist/validators/trust-profile.d.ts +76 -244
- package/dist/validators/trust-profile.d.ts.map +1 -1
- package/dist/validators/trust-profile.js +21 -35
- package/dist/validators/trust-profile.js.map +1 -1
- package/package.json +4 -3
|
@@ -3,41 +3,29 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ObservationTier, TrustBand } from './enums.js';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Graduated circuit breaker state for the trust dynamics engine.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
*
|
|
13
|
-
* Note: The 0-1000 scale provides higher precision for trust calculations
|
|
14
|
-
* and aligns with API response formats.
|
|
8
|
+
* - 'normal' : standard operation
|
|
9
|
+
* - 'degraded' : soft CB — score entered the warning zone; gains blocked,
|
|
10
|
+
* losses still apply; auto-resets after tier-appropriate timeout
|
|
11
|
+
* - 'tripped' : hard CB — all updates blocked; tier-dependent auto-reset
|
|
12
|
+
* (T0-T2 auto-reset, T3+ require admin)
|
|
15
13
|
*/
|
|
16
|
-
export
|
|
17
|
-
/** Capability Trust - Does the agent have the skills? (0-1000) */
|
|
18
|
-
CT: number;
|
|
19
|
-
/** Behavioral Trust - Has the agent acted reliably? (0-1000) */
|
|
20
|
-
BT: number;
|
|
21
|
-
/** Governance Trust - Is the agent properly governed? (0-1000) */
|
|
22
|
-
GT: number;
|
|
23
|
-
/** Contextual Trust - Is this the right context for the agent? (0-1000) */
|
|
24
|
-
XT: number;
|
|
25
|
-
/** Assurance Confidence - How confident are we in our assessment? (0-1000) */
|
|
26
|
-
AC: number;
|
|
27
|
-
}
|
|
14
|
+
export type CircuitBreakerState = 'normal' | 'degraded' | 'tripped';
|
|
28
15
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
16
|
+
* Trust factor scores for an agent
|
|
17
|
+
*
|
|
18
|
+
* Each factor is scored 0.0-1.0 where:
|
|
19
|
+
* - 0.0: No evidence / unproven
|
|
20
|
+
* - 0.5: Baseline / meets minimum
|
|
21
|
+
* - 1.0: Maximum trust / proven excellence
|
|
22
|
+
*
|
|
23
|
+
* The 16 core factors are defined in @vorionsys/basis.
|
|
24
|
+
* Factor codes: CT-COMP, CT-REL, CT-OBS, CT-TRANS, CT-ACCT, CT-SAFE,
|
|
25
|
+
* CT-SEC, CT-PRIV, CT-ID, OP-HUMAN, OP-ALIGN, OP-CONTEXT,
|
|
26
|
+
* OP-STEW, SF-HUM, SF-ADAPT, SF-LEARN
|
|
31
27
|
*/
|
|
32
|
-
export
|
|
33
|
-
CT: number;
|
|
34
|
-
BT: number;
|
|
35
|
-
GT: number;
|
|
36
|
-
XT: number;
|
|
37
|
-
AC: number;
|
|
38
|
-
}
|
|
39
|
-
/** Default trust dimension weights */
|
|
40
|
-
export declare const DEFAULT_TRUST_WEIGHTS: TrustWeights;
|
|
28
|
+
export type TrustFactorScores = Record<string, number>;
|
|
41
29
|
/**
|
|
42
30
|
* Evidence type classification for weighted trust calculations
|
|
43
31
|
*
|
|
@@ -51,6 +39,11 @@ export type EvidenceType = 'automated' | 'hitl_approval' | 'hitl_rejection' | 'e
|
|
|
51
39
|
*
|
|
52
40
|
* These multipliers solve the 1000-event cold-start problem by giving
|
|
53
41
|
* HITL approvals significantly more weight than automated observations.
|
|
42
|
+
*
|
|
43
|
+
* IMPORTANT: Multipliers > 1.0 are only applied to POSITIVE evidence.
|
|
44
|
+
* Negative evidence is never amplified by these multipliers — the tier-scaled
|
|
45
|
+
* penalty formula (7-10x) is the sole mechanism for negative amplification.
|
|
46
|
+
* hitl_rejection is listed as 1.0 to make this explicit.
|
|
54
47
|
*/
|
|
55
48
|
export declare const EVIDENCE_TYPE_MULTIPLIERS: Record<EvidenceType, number>;
|
|
56
49
|
/**
|
|
@@ -59,8 +52,8 @@ export declare const EVIDENCE_TYPE_MULTIPLIERS: Record<EvidenceType, number>;
|
|
|
59
52
|
export interface TrustEvidence {
|
|
60
53
|
/** Unique identifier for this evidence */
|
|
61
54
|
evidenceId: string;
|
|
62
|
-
/** Which
|
|
63
|
-
|
|
55
|
+
/** Which trust factor this evidence affects (e.g. 'CT-COMP', 'OP-ALIGN') */
|
|
56
|
+
factorCode: string;
|
|
64
57
|
/** Score impact (-1000 to +1000) on the 0-1000 scale */
|
|
65
58
|
impact: number;
|
|
66
59
|
/** Human-readable source of evidence */
|
|
@@ -85,11 +78,9 @@ export interface TrustProfile {
|
|
|
85
78
|
profileId: string;
|
|
86
79
|
/** Agent this profile belongs to */
|
|
87
80
|
agentId: string;
|
|
88
|
-
/** Individual
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
weights: TrustWeights;
|
|
92
|
-
/** Raw composite score (weighted sum of dimensions, 0-1000) */
|
|
81
|
+
/** Individual factor scores (each 0.0-1.0) */
|
|
82
|
+
factorScores: TrustFactorScores;
|
|
83
|
+
/** Composite trust score (weighted sum, 0-1000) */
|
|
93
84
|
compositeScore: number;
|
|
94
85
|
/** Observation tier determines trust ceiling */
|
|
95
86
|
observationTier: ObservationTier;
|
|
@@ -126,7 +117,6 @@ export interface TrustCalculationRequest {
|
|
|
126
117
|
agentId: string;
|
|
127
118
|
observationTier: ObservationTier;
|
|
128
119
|
evidence: TrustEvidence[];
|
|
129
|
-
weights?: Partial<TrustWeights>;
|
|
130
120
|
}
|
|
131
121
|
/**
|
|
132
122
|
* Configuration for trust band thresholds (T0-T7)
|
|
@@ -189,7 +179,12 @@ export interface BandingConfig {
|
|
|
189
179
|
thresholds: BandThresholds;
|
|
190
180
|
/** Points buffer to prevent oscillation */
|
|
191
181
|
hysteresis: number;
|
|
192
|
-
/**
|
|
182
|
+
/**
|
|
183
|
+
* Daily decay rate for stale evidence freshness weighting (0.0 to 1.0).
|
|
184
|
+
* Reduces the influence of older evidence in banding calculations.
|
|
185
|
+
* NOTE: This is NOT inactivity decay. For inactivity decay, see
|
|
186
|
+
* DECAY_MILESTONES (stepped milestones: 7/14/28/42/56/84/112/140/182 days).
|
|
187
|
+
*/
|
|
193
188
|
decayRate: number;
|
|
194
189
|
/** Minimum days at current band before promotion */
|
|
195
190
|
promotionDelay: number;
|
|
@@ -216,7 +211,12 @@ export declare enum RiskProfile {
|
|
|
216
211
|
export declare const RISK_PROFILE_WINDOWS: Record<RiskProfile, number>;
|
|
217
212
|
/**
|
|
218
213
|
* Configuration for asymmetric trust dynamics
|
|
219
|
-
* Per ATSF v2.0: "Trust is hard to gain, easy to lose" (
|
|
214
|
+
* Per ATSF v2.0: "Trust is hard to gain, easy to lose" (7-10x ratio, tier-scaled)
|
|
215
|
+
*
|
|
216
|
+
* Failure penalty scales linearly from penaltyRatioMin at T0 (Sandbox) to
|
|
217
|
+
* penaltyRatioMax at T7 (Autonomous). This allows early-stage agents room to
|
|
218
|
+
* grow while applying strict accountability at higher tiers. A single penalty
|
|
219
|
+
* mechanism is used — stacking separate penalties is prohibited (double jeopardy).
|
|
220
220
|
*/
|
|
221
221
|
export interface TrustDynamicsConfig {
|
|
222
222
|
/**
|
|
@@ -226,11 +226,17 @@ export interface TrustDynamicsConfig {
|
|
|
226
226
|
*/
|
|
227
227
|
gainRate: number;
|
|
228
228
|
/**
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
* Default:
|
|
229
|
+
* Minimum failure penalty ratio, applied at T0 (Sandbox)
|
|
230
|
+
* Effective loss rate = gainRate * penaltyRatioMin
|
|
231
|
+
* Default: 7 (7x gainRate — lenient for new/recovering agents)
|
|
232
232
|
*/
|
|
233
|
-
|
|
233
|
+
penaltyRatioMin: number;
|
|
234
|
+
/**
|
|
235
|
+
* Maximum failure penalty ratio, applied at T7 (Autonomous)
|
|
236
|
+
* Effective loss rate = gainRate * penaltyRatioMax
|
|
237
|
+
* Default: 10 (10x gainRate — strict for highest-trust agents)
|
|
238
|
+
*/
|
|
239
|
+
penaltyRatioMax: number;
|
|
234
240
|
/**
|
|
235
241
|
* Cooldown period in hours after any trust drop
|
|
236
242
|
* During cooldown, trust cannot increase
|
|
@@ -248,17 +254,53 @@ export interface TrustDynamicsConfig {
|
|
|
248
254
|
* Default: 24 hours
|
|
249
255
|
*/
|
|
250
256
|
oscillationWindowHours: number;
|
|
251
|
-
/**
|
|
252
|
-
* Penalty multiplier for outcome reversals
|
|
253
|
-
* When provisional success becomes final failure
|
|
254
|
-
* Default: 2.0 (2x normal failure penalty)
|
|
255
|
-
*/
|
|
256
|
-
reversalPenaltyMultiplier: number;
|
|
257
257
|
/**
|
|
258
258
|
* Minimum trust score threshold for circuit breaker trigger
|
|
259
259
|
* Default: 100 (trust < 100 on 0-1000 scale triggers circuit breaker)
|
|
260
260
|
*/
|
|
261
261
|
circuitBreakerThreshold: number;
|
|
262
|
+
/**
|
|
263
|
+
* Number of failures with the same methodology key within the window
|
|
264
|
+
* required to trip the circuit breaker.
|
|
265
|
+
* Default: 3
|
|
266
|
+
*/
|
|
267
|
+
methodologyFailureThreshold: number;
|
|
268
|
+
/**
|
|
269
|
+
* Rolling time window in hours for methodology failure detection.
|
|
270
|
+
* Default: 72 hours (3 days)
|
|
271
|
+
*/
|
|
272
|
+
methodologyWindowHours: number;
|
|
273
|
+
/**
|
|
274
|
+
* Total failures across ALL methodology keys within the rolling window
|
|
275
|
+
* that trigger a circuit breaker trip, regardless of per-key counts.
|
|
276
|
+
* Closes the "methodology rotation" attack where an agent uses unique
|
|
277
|
+
* keys to stay below the per-key threshold.
|
|
278
|
+
* Default: 6 (2x methodologyFailureThreshold)
|
|
279
|
+
*/
|
|
280
|
+
crossMethodologyFailureThreshold: number;
|
|
281
|
+
/**
|
|
282
|
+
* Score threshold (0-1000) for entering degraded mode (soft circuit breaker).
|
|
283
|
+
* When a LOSS drives the score below this value (but above circuitBreakerThreshold),
|
|
284
|
+
* the engine enters 'degraded' state: gains are blocked, losses still apply.
|
|
285
|
+
* Degraded auto-resets after cbDegradedAutoResetMinutes[tier].
|
|
286
|
+
* Default: 200 (T0/T1 boundary — warning zone)
|
|
287
|
+
*/
|
|
288
|
+
degradedThreshold: number;
|
|
289
|
+
/**
|
|
290
|
+
* Minutes until automatic recovery from 'degraded' mode, indexed by tier (T0=index 0..T7=index 7).
|
|
291
|
+
* After this timeout the engine resets to 'normal' without admin action.
|
|
292
|
+
* Lower tiers recover faster (sandbox agents get short timeouts).
|
|
293
|
+
* Default: [5, 15, 30, 120, 240, 720, 1440, 2880] (T0: 5min → T7: 2 days)
|
|
294
|
+
*/
|
|
295
|
+
cbDegradedAutoResetMinutes: readonly number[];
|
|
296
|
+
/**
|
|
297
|
+
* Minutes until automatic recovery from 'tripped' state, indexed by tier.
|
|
298
|
+
* null = no auto-reset at that tier; admin override required.
|
|
299
|
+
* T0-T2: auto-reset allowed; T3+: admin required.
|
|
300
|
+
* Default: [15, 60, 120, null, null, null, null, null]
|
|
301
|
+
* (T0: 15min, T1: 1hr, T2: 2hr; T3-T7: admin only)
|
|
302
|
+
*/
|
|
303
|
+
cbTrippedAutoResetMinutes: readonly (number | null)[];
|
|
262
304
|
}
|
|
263
305
|
/** Default trust dynamics configuration per ATSF v2.0 */
|
|
264
306
|
export declare const DEFAULT_TRUST_DYNAMICS: TrustDynamicsConfig;
|
|
@@ -300,12 +342,32 @@ export interface TrustDynamicsState {
|
|
|
300
342
|
directionChanges: DirectionChange[];
|
|
301
343
|
/** Last trust update direction */
|
|
302
344
|
lastDirection: 'gain' | 'loss' | 'none';
|
|
303
|
-
/**
|
|
345
|
+
/**
|
|
346
|
+
* Graduated circuit breaker state.
|
|
347
|
+
* 'normal' → 'degraded' (score warning zone) → 'tripped' (hard lock)
|
|
348
|
+
* See CircuitBreakerState for full semantics.
|
|
349
|
+
*/
|
|
350
|
+
circuitBreakerState: CircuitBreakerState;
|
|
351
|
+
/**
|
|
352
|
+
* Whether circuit breaker is fully tripped (hard CB).
|
|
353
|
+
* Derived from circuitBreakerState === 'tripped'.
|
|
354
|
+
* Kept for backwards compatibility.
|
|
355
|
+
*/
|
|
304
356
|
circuitBreakerTripped: boolean;
|
|
305
|
-
/** Reason for circuit breaker
|
|
357
|
+
/** Reason for the current circuit breaker event (degraded or tripped) */
|
|
306
358
|
circuitBreakerReason?: string;
|
|
307
|
-
/** When circuit breaker was
|
|
359
|
+
/** When the current circuit breaker event was triggered */
|
|
308
360
|
circuitBreakerTrippedAt?: Date;
|
|
361
|
+
/**
|
|
362
|
+
* Agent tier at the time the circuit breaker event was triggered.
|
|
363
|
+
* Used to select the correct per-tier auto-reset timeout.
|
|
364
|
+
*/
|
|
365
|
+
tierAtCbEvent?: number;
|
|
366
|
+
/**
|
|
367
|
+
* Recent failure timestamps keyed by methodology key.
|
|
368
|
+
* Used to detect repeated failures with the same approach.
|
|
369
|
+
*/
|
|
370
|
+
methodologyFailures: Record<string, Date[]>;
|
|
309
371
|
}
|
|
310
372
|
/**
|
|
311
373
|
* Provisional outcome for temporal tracking
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trust-profile.d.ts","sourceRoot":"","sources":["../../src/v2/trust-profile.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE7D
|
|
1
|
+
{"version":3,"file":"trust-profile.d.ts","sourceRoot":"","sources":["../../src/v2/trust-profile.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE7D;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAEpE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,OAAO,GACP,cAAc,GACd,aAAa,CAAC;AAElB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAQlE,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,WAAW,EAAE,IAAI,CAAC;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB;;;OAGG;IACH,YAAY,CAAC,EAA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-3,29 +3,26 @@
|
|
|
3
3
|
* Trust Profile types - represents an agent's current trust state
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DEFAULT_TRUST_DYNAMICS = exports.RISK_PROFILE_WINDOWS = exports.RiskProfile = exports.DEFAULT_BANDING_CONFIG = exports.DEFAULT_BAND_THRESHOLDS = exports.EVIDENCE_TYPE_MULTIPLIERS =
|
|
7
|
-
/** Default trust dimension weights */
|
|
8
|
-
exports.DEFAULT_TRUST_WEIGHTS = {
|
|
9
|
-
CT: 0.25,
|
|
10
|
-
BT: 0.25,
|
|
11
|
-
GT: 0.20,
|
|
12
|
-
XT: 0.15,
|
|
13
|
-
AC: 0.15,
|
|
14
|
-
};
|
|
6
|
+
exports.DEFAULT_TRUST_DYNAMICS = exports.RISK_PROFILE_WINDOWS = exports.RiskProfile = exports.DEFAULT_BANDING_CONFIG = exports.DEFAULT_BAND_THRESHOLDS = exports.EVIDENCE_TYPE_MULTIPLIERS = void 0;
|
|
15
7
|
/**
|
|
16
8
|
* Default evidence type multipliers
|
|
17
9
|
*
|
|
18
10
|
* These multipliers solve the 1000-event cold-start problem by giving
|
|
19
11
|
* HITL approvals significantly more weight than automated observations.
|
|
12
|
+
*
|
|
13
|
+
* IMPORTANT: Multipliers > 1.0 are only applied to POSITIVE evidence.
|
|
14
|
+
* Negative evidence is never amplified by these multipliers — the tier-scaled
|
|
15
|
+
* penalty formula (7-10x) is the sole mechanism for negative amplification.
|
|
16
|
+
* hitl_rejection is listed as 1.0 to make this explicit.
|
|
20
17
|
*/
|
|
21
18
|
exports.EVIDENCE_TYPE_MULTIPLIERS = {
|
|
22
19
|
automated: 1.0,
|
|
23
|
-
hitl_approval: 5.0, // HITL approval = 5 automated observations
|
|
24
|
-
hitl_rejection:
|
|
25
|
-
examination: 3.0, // Formal exams count more
|
|
26
|
-
audit: 3.0, // Audits are authoritative
|
|
20
|
+
hitl_approval: 5.0, // HITL approval = 5 automated observations (positive only)
|
|
21
|
+
hitl_rejection: 1.0, // No extra amplification — tier penalty formula handles negatives
|
|
22
|
+
examination: 3.0, // Formal exams count more (positive findings only)
|
|
23
|
+
audit: 3.0, // Audits are authoritative (positive findings only)
|
|
27
24
|
sandbox_test: 0.5, // Sandbox/testnet observations count less (unverified)
|
|
28
|
-
peer_review: 2.0, // Cross-agent reviews have moderate weight
|
|
25
|
+
peer_review: 2.0, // Cross-agent reviews have moderate weight (positive only)
|
|
29
26
|
};
|
|
30
27
|
/**
|
|
31
28
|
* Default band thresholds on 0-1000 scale
|
|
@@ -89,11 +86,19 @@ exports.RISK_PROFILE_WINDOWS = {
|
|
|
89
86
|
/** Default trust dynamics configuration per ATSF v2.0 */
|
|
90
87
|
exports.DEFAULT_TRUST_DYNAMICS = {
|
|
91
88
|
gainRate: 0.01, // Logarithmic gain (slow)
|
|
92
|
-
|
|
89
|
+
penaltyRatioMin: 7, // T0 loss = 7x gainRate (early-stage leniency)
|
|
90
|
+
penaltyRatioMax: 10, // T7 loss = 10x gainRate (strict at full autonomy)
|
|
93
91
|
cooldownHours: 168, // 7 days after any drop
|
|
94
92
|
oscillationThreshold: 3, // 3 direction changes triggers alert
|
|
95
93
|
oscillationWindowHours: 24, // Within 24 hours
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
circuitBreakerThreshold: 100, // Trust < 100 (on 0-1000 scale) → hard CB trip
|
|
95
|
+
methodologyFailureThreshold: 3, // 3 same-methodology failures → circuit breaker
|
|
96
|
+
methodologyWindowHours: 72, // Within 72 hours (3 days)
|
|
97
|
+
crossMethodologyFailureThreshold: 6, // 6 total failures across ANY keys → circuit breaker
|
|
98
|
+
degradedThreshold: 200, // Trust < 200 on a LOSS → degraded mode (warning zone)
|
|
99
|
+
// Per-tier degraded auto-reset (minutes): T0=5min → T7=2 days
|
|
100
|
+
cbDegradedAutoResetMinutes: [5, 15, 30, 120, 240, 720, 1440, 2880],
|
|
101
|
+
// Per-tier tripped auto-reset (minutes): null = admin required; T0=15min, T1=1hr, T2=2hr, T3+=admin
|
|
102
|
+
cbTrippedAutoResetMinutes: [15, 60, 120, null, null, null, null, null],
|
|
98
103
|
};
|
|
99
104
|
//# sourceMappingURL=trust-profile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trust-profile.js","sourceRoot":"","sources":["../../src/v2/trust-profile.ts"],"names":[],"mappings":";AAAA;;GAEG;;;
|
|
1
|
+
{"version":3,"file":"trust-profile.js","sourceRoot":"","sources":["../../src/v2/trust-profile.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA8CH;;;;;;;;;;GAUG;AACU,QAAA,yBAAyB,GAAiC;IACrE,SAAS,EAAE,GAAG;IACd,aAAa,EAAE,GAAG,EAAK,2DAA2D;IAClF,cAAc,EAAE,GAAG,EAAI,kEAAkE;IACzF,WAAW,EAAE,GAAG,EAAO,mDAAmD;IAC1E,KAAK,EAAE,GAAG,EAAa,oDAAoD;IAC3E,YAAY,EAAE,GAAG,EAAM,uDAAuD;IAC9E,WAAW,EAAE,GAAG,EAAO,2DAA2D;CACnF,CAAC;AAqGF;;;;;;;;;;;;;;;GAeG;AACU,QAAA,uBAAuB,GAAmB;IACrD,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE;IACxB,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;IAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;IAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;IAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;IAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;IAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,E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A+C;IAClF,eAAe,EAAE,EAAE,EAAgB,mDAAmD;IACtF,aAAa,EAAE,GAAG,EAAiB,wBAAwB;IAC3D,oBAAoB,EAAE,CAAC,EAAY,qCAAqC;IACxE,sBAAsB,EAAE,EAAE,EAAS,kBAAkB;IACrD,uBAAuB,EAAE,GAAG,EAAO,+CAA+C;IAClF,2BAA2B,EAAE,CAAC,EAAK,gDAAgD;IACnF,sBAAsB,EAAE,EAAE,EAAS,2BAA2B;IAC9D,gCAAgC,EAAE,CAAC,EAAE,qDAAqD;IAC1F,iBAAiB,EAAE,GAAG,EAAa,uDAAuD;IAC1F,8DAA8D;IAC9D,0BAA0B,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAsB;IACvF,oGAAoG;IACpG,yBAAyB,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAA+B;CACrG,CAAC"}
|
|
@@ -196,12 +196,12 @@ export declare const decisionSchema: z.ZodObject<{
|
|
|
196
196
|
latencyMs: z.ZodNumber;
|
|
197
197
|
version: z.ZodNumber;
|
|
198
198
|
}, "strip", z.ZodTypeAny, {
|
|
199
|
-
|
|
199
|
+
agentId: string;
|
|
200
200
|
intentId: string;
|
|
201
|
-
|
|
201
|
+
correlationId: string;
|
|
202
202
|
expiresAt: Date;
|
|
203
|
+
decisionId: string;
|
|
203
204
|
version: number;
|
|
204
|
-
agentId: string;
|
|
205
205
|
trustScore: number;
|
|
206
206
|
trustBand: import("../index.js").TrustBand;
|
|
207
207
|
decidedAt: Date;
|
|
@@ -229,12 +229,12 @@ export declare const decisionSchema: z.ZodObject<{
|
|
|
229
229
|
} | undefined;
|
|
230
230
|
policySetId?: string | undefined;
|
|
231
231
|
}, {
|
|
232
|
-
|
|
232
|
+
agentId: string;
|
|
233
233
|
intentId: string;
|
|
234
|
-
|
|
234
|
+
correlationId: string;
|
|
235
235
|
expiresAt: Date;
|
|
236
|
+
decisionId: string;
|
|
236
237
|
version: number;
|
|
237
|
-
agentId: string;
|
|
238
238
|
trustScore: number;
|
|
239
239
|
trustBand: import("../index.js").TrustBand;
|
|
240
240
|
decidedAt: Date;
|
|
@@ -85,10 +85,10 @@ export declare const intentSchema: z.ZodObject<{
|
|
|
85
85
|
expiresAt: z.ZodOptional<z.ZodDate>;
|
|
86
86
|
source: z.ZodOptional<z.ZodString>;
|
|
87
87
|
}, "strip", z.ZodTypeAny, {
|
|
88
|
-
|
|
88
|
+
agentId: string;
|
|
89
89
|
intentId: string;
|
|
90
|
+
correlationId: string;
|
|
90
91
|
createdAt: Date;
|
|
91
|
-
agentId: string;
|
|
92
92
|
context: {
|
|
93
93
|
metadata?: Record<string, unknown> | undefined;
|
|
94
94
|
domain?: string | undefined;
|
|
@@ -106,13 +106,13 @@ export declare const intentSchema: z.ZodObject<{
|
|
|
106
106
|
resourceScope: string[];
|
|
107
107
|
dataSensitivity: import("../index.js").DataSensitivity;
|
|
108
108
|
reversibility: import("../index.js").Reversibility;
|
|
109
|
-
expiresAt?: Date | undefined;
|
|
110
109
|
source?: string | undefined;
|
|
110
|
+
expiresAt?: Date | undefined;
|
|
111
111
|
}, {
|
|
112
|
-
|
|
112
|
+
agentId: string;
|
|
113
113
|
intentId: string;
|
|
114
|
+
correlationId: string;
|
|
114
115
|
createdAt: Date;
|
|
115
|
-
agentId: string;
|
|
116
116
|
context: {
|
|
117
117
|
metadata?: Record<string, unknown> | undefined;
|
|
118
118
|
domain?: string | undefined;
|
|
@@ -130,8 +130,8 @@ export declare const intentSchema: z.ZodObject<{
|
|
|
130
130
|
resourceScope: string[];
|
|
131
131
|
dataSensitivity: import("../index.js").DataSensitivity;
|
|
132
132
|
reversibility: import("../index.js").Reversibility;
|
|
133
|
-
expiresAt?: Date | undefined;
|
|
134
133
|
source?: string | undefined;
|
|
134
|
+
expiresAt?: Date | undefined;
|
|
135
135
|
}>;
|
|
136
136
|
/** Create intent request validator */
|
|
137
137
|
export declare const createIntentRequestSchema: z.ZodObject<{
|
|
@@ -185,6 +185,7 @@ export declare const createIntentRequestSchema: z.ZodObject<{
|
|
|
185
185
|
resourceScope: string[];
|
|
186
186
|
dataSensitivity: import("../index.js").DataSensitivity;
|
|
187
187
|
reversibility: import("../index.js").Reversibility;
|
|
188
|
+
source?: string | undefined;
|
|
188
189
|
correlationId?: string | undefined;
|
|
189
190
|
context?: {
|
|
190
191
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -198,7 +199,6 @@ export declare const createIntentRequestSchema: z.ZodObject<{
|
|
|
198
199
|
handlesPhi?: boolean | undefined;
|
|
199
200
|
jurisdictions?: string[] | undefined;
|
|
200
201
|
} | undefined;
|
|
201
|
-
source?: string | undefined;
|
|
202
202
|
expiresIn?: number | undefined;
|
|
203
203
|
}, {
|
|
204
204
|
agentId: string;
|
|
@@ -207,6 +207,7 @@ export declare const createIntentRequestSchema: z.ZodObject<{
|
|
|
207
207
|
resourceScope: string[];
|
|
208
208
|
dataSensitivity: import("../index.js").DataSensitivity;
|
|
209
209
|
reversibility: import("../index.js").Reversibility;
|
|
210
|
+
source?: string | undefined;
|
|
210
211
|
correlationId?: string | undefined;
|
|
211
212
|
context?: {
|
|
212
213
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -220,7 +221,6 @@ export declare const createIntentRequestSchema: z.ZodObject<{
|
|
|
220
221
|
handlesPhi?: boolean | undefined;
|
|
221
222
|
jurisdictions?: string[] | undefined;
|
|
222
223
|
} | undefined;
|
|
223
|
-
source?: string | undefined;
|
|
224
224
|
expiresIn?: number | undefined;
|
|
225
225
|
}>;
|
|
226
226
|
export type ValidatedIntent = z.infer<typeof intentSchema>;
|