@kya-os/contracts 1.6.18 → 1.6.19

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.
@@ -0,0 +1,417 @@
1
+ "use strict";
2
+ /**
3
+ * Reputation API Schemas
4
+ *
5
+ * Request and response schemas for the Reputation Engine REST API.
6
+ * These schemas ensure type safety and runtime validation for all API endpoints.
7
+ *
8
+ * Endpoints covered:
9
+ * - POST /api/reputation/calculate - Calculate single agent reputation
10
+ * - POST /api/reputation/batch - Calculate reputation for multiple agents
11
+ * - POST /api/reputation/predict - Predict score changes
12
+ * - GET /api/reputation/:did - Get cached reputation score
13
+ *
14
+ * Related Spec: MCP-I §5.2 (Reputation API)
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.BUILT_IN_REPUTATION_API_KEY = exports.DEFAULT_REPUTATION_THRESHOLD = exports.REPUTATION_ENV_VARS = exports.REPUTATION_API_LIMITS = exports.REPUTATION_API_PATHS = exports.REGISTRY_URL = exports.ReputationUpdateRequestSchema = exports.ShadowRegisterResponseSchema = exports.ShadowRegisterRequestSchema = exports.ReputationErrorResponseSchema = exports.ReputationErrorCodeSchema = exports.GetReputationResponseSchema = exports.GetReputationRequestSchema = exports.PredictScoreChangeResponseSchema = exports.PredictScoreChangeRequestSchema = exports.BatchCalculateResponseSchema = exports.BatchResultItemSchema = exports.BatchCalculateRequestSchema = exports.CalculateReputationResponseSchema = exports.CalculateReputationRequestSchema = void 0;
18
+ exports.validateCalculateRequest = validateCalculateRequest;
19
+ exports.validateBatchCalculateRequest = validateBatchCalculateRequest;
20
+ exports.validatePredictRequest = validatePredictRequest;
21
+ exports.validateGetReputationRequest = validateGetReputationRequest;
22
+ exports.validateShadowRegisterRequest = validateShadowRegisterRequest;
23
+ exports.validateReputationUpdateRequest = validateReputationUpdateRequest;
24
+ const zod_1 = require("zod");
25
+ const schemas_js_1 = require("./schemas.js");
26
+ // ============================================================================
27
+ // SINGLE CALCULATION API
28
+ // ============================================================================
29
+ /**
30
+ * Calculate Reputation Request Schema
31
+ *
32
+ * Request body for POST /api/reputation/calculate
33
+ */
34
+ exports.CalculateReputationRequestSchema = zod_1.z.object({
35
+ /** Agent data for calculation */
36
+ agent: schemas_js_1.AgentDataSchema,
37
+ /** Optional calculator configuration */
38
+ config: schemas_js_1.CalculatorConfigSchema.optional(),
39
+ });
40
+ /**
41
+ * Calculate Reputation Response Schema
42
+ *
43
+ * Response body for POST /api/reputation/calculate
44
+ */
45
+ exports.CalculateReputationResponseSchema = zod_1.z.object({
46
+ /** Whether the request was successful */
47
+ success: zod_1.z.literal(true),
48
+ /** Calculated reputation score */
49
+ data: schemas_js_1.ReputationScoreSchema,
50
+ /** Optional metadata */
51
+ metadata: zod_1.z
52
+ .object({
53
+ /** Processing time in milliseconds */
54
+ processingTimeMs: zod_1.z.number().nonnegative().optional(),
55
+ /** Calculator preset used */
56
+ preset: schemas_js_1.CalculatorPresetSchema.optional(),
57
+ /** Cache status */
58
+ cached: zod_1.z.boolean().optional(),
59
+ })
60
+ .optional(),
61
+ });
62
+ // ============================================================================
63
+ // BATCH CALCULATION API
64
+ // ============================================================================
65
+ /**
66
+ * Batch Calculate Request Schema
67
+ *
68
+ * Request body for POST /api/reputation/batch
69
+ */
70
+ exports.BatchCalculateRequestSchema = zod_1.z.object({
71
+ /** Array of agents to calculate reputation for */
72
+ agents: zod_1.z.array(schemas_js_1.AgentDataSchema).min(1).max(1000), // Limit batch size
73
+ /** Shared calculator configuration for all agents */
74
+ config: schemas_js_1.CalculatorConfigSchema.optional(),
75
+ });
76
+ /**
77
+ * Batch Result Item Schema
78
+ *
79
+ * Individual result within a batch response.
80
+ */
81
+ exports.BatchResultItemSchema = zod_1.z.object({
82
+ /** Agent DID */
83
+ did: zod_1.z.string().min(1),
84
+ /** Calculated score (if successful) */
85
+ score: schemas_js_1.ReputationScoreSchema.optional(),
86
+ /** Error message (if failed) */
87
+ error: zod_1.z.string().optional(),
88
+ /** Whether calculation was successful */
89
+ success: zod_1.z.boolean(),
90
+ });
91
+ /**
92
+ * Batch Calculate Response Schema
93
+ *
94
+ * Response body for POST /api/reputation/batch
95
+ */
96
+ exports.BatchCalculateResponseSchema = zod_1.z.object({
97
+ /** Whether the batch request was successful */
98
+ success: zod_1.z.literal(true),
99
+ /** Array of results for each agent */
100
+ data: zod_1.z.object({
101
+ /** Results for each agent */
102
+ results: zod_1.z.array(exports.BatchResultItemSchema),
103
+ /** Summary statistics */
104
+ summary: zod_1.z.object({
105
+ /** Total agents processed */
106
+ total: zod_1.z.number().int().nonnegative(),
107
+ /** Number of successful calculations */
108
+ successful: zod_1.z.number().int().nonnegative(),
109
+ /** Number of failed calculations */
110
+ failed: zod_1.z.number().int().nonnegative(),
111
+ }),
112
+ }),
113
+ /** Metadata */
114
+ metadata: zod_1.z
115
+ .object({
116
+ /** Total processing time in milliseconds */
117
+ processingTimeMs: zod_1.z.number().nonnegative().optional(),
118
+ /** Average time per agent */
119
+ avgTimePerAgentMs: zod_1.z.number().nonnegative().optional(),
120
+ })
121
+ .optional(),
122
+ });
123
+ // ============================================================================
124
+ // PREDICTION API
125
+ // ============================================================================
126
+ /**
127
+ * Predict Score Change Request Schema
128
+ *
129
+ * Request body for POST /api/reputation/predict
130
+ */
131
+ exports.PredictScoreChangeRequestSchema = schemas_js_1.ScoreChangePredictionRequestSchema;
132
+ /**
133
+ * Predict Score Change Response Schema
134
+ *
135
+ * Response body for POST /api/reputation/predict
136
+ */
137
+ exports.PredictScoreChangeResponseSchema = zod_1.z.object({
138
+ /** Whether the request was successful */
139
+ success: zod_1.z.literal(true),
140
+ /** Prediction data */
141
+ data: schemas_js_1.ScoreChangePredictionResponseSchema,
142
+ /** Metadata */
143
+ metadata: zod_1.z
144
+ .object({
145
+ /** Processing time in milliseconds */
146
+ processingTimeMs: zod_1.z.number().nonnegative().optional(),
147
+ })
148
+ .optional(),
149
+ });
150
+ // ============================================================================
151
+ // LOOKUP API
152
+ // ============================================================================
153
+ /**
154
+ * Get Reputation Request Schema
155
+ *
156
+ * Query parameters for GET /api/reputation/:did
157
+ */
158
+ exports.GetReputationRequestSchema = zod_1.z.object({
159
+ /** Agent DID (from URL path) */
160
+ did: zod_1.z
161
+ .string()
162
+ .min(1)
163
+ .refine((val) => val.startsWith("did:"), {
164
+ message: 'DID must start with "did:"',
165
+ }),
166
+ /** Whether to force recalculation (bypass cache) */
167
+ refresh: zod_1.z.boolean().optional().default(false),
168
+ });
169
+ /**
170
+ * Get Reputation Response Schema
171
+ *
172
+ * Response body for GET /api/reputation/:did
173
+ */
174
+ exports.GetReputationResponseSchema = zod_1.z.object({
175
+ /** Whether the request was successful */
176
+ success: zod_1.z.literal(true),
177
+ /** Reputation score data */
178
+ data: schemas_js_1.ReputationScoreSchema,
179
+ /** Metadata */
180
+ metadata: zod_1.z
181
+ .object({
182
+ /** Whether result was served from cache */
183
+ cached: zod_1.z.boolean().optional(),
184
+ /** Cache age in seconds (if cached) */
185
+ cacheAgeSeconds: zod_1.z.number().nonnegative().optional(),
186
+ /** When the cache entry expires (ISO 8601) */
187
+ cacheExpiresAt: zod_1.z.string().datetime().optional(),
188
+ })
189
+ .optional(),
190
+ });
191
+ // ============================================================================
192
+ // ERROR RESPONSES
193
+ // ============================================================================
194
+ /**
195
+ * API Error Code Schema
196
+ *
197
+ * Standardized error codes for the Reputation API.
198
+ */
199
+ exports.ReputationErrorCodeSchema = zod_1.z.enum([
200
+ "validation_error", // Invalid input data
201
+ "agent_not_found", // Agent DID not found
202
+ "calculation_error", // Error during calculation
203
+ "rate_limit_exceeded", // Too many requests
204
+ "batch_too_large", // Batch size exceeds limit
205
+ "internal_error", // Internal server error
206
+ "unauthorized", // Missing or invalid auth
207
+ "insufficient_data", // Not enough data for calculation
208
+ ]);
209
+ /**
210
+ * API Error Response Schema
211
+ *
212
+ * Standard error response format for all Reputation API endpoints.
213
+ */
214
+ exports.ReputationErrorResponseSchema = zod_1.z.object({
215
+ /** Whether the request was successful (always false for errors) */
216
+ success: zod_1.z.literal(false),
217
+ /** Error details */
218
+ error: zod_1.z.object({
219
+ /** Error code */
220
+ code: exports.ReputationErrorCodeSchema,
221
+ /** Human-readable error message */
222
+ message: zod_1.z.string().min(1),
223
+ /** Additional error details */
224
+ details: zod_1.z.record(zod_1.z.unknown()).optional(),
225
+ /** Validation errors (for validation_error code) */
226
+ validationErrors: zod_1.z
227
+ .array(zod_1.z.object({
228
+ /** Field path */
229
+ path: zod_1.z.string(),
230
+ /** Error message */
231
+ message: zod_1.z.string(),
232
+ }))
233
+ .optional(),
234
+ }),
235
+ });
236
+ // ============================================================================
237
+ // VALIDATION HELPERS
238
+ // ============================================================================
239
+ /**
240
+ * Validate calculate reputation request
241
+ */
242
+ function validateCalculateRequest(data) {
243
+ return exports.CalculateReputationRequestSchema.safeParse(data);
244
+ }
245
+ /**
246
+ * Validate batch calculate request
247
+ */
248
+ function validateBatchCalculateRequest(data) {
249
+ return exports.BatchCalculateRequestSchema.safeParse(data);
250
+ }
251
+ /**
252
+ * Validate predict score change request
253
+ */
254
+ function validatePredictRequest(data) {
255
+ return exports.PredictScoreChangeRequestSchema.safeParse(data);
256
+ }
257
+ /**
258
+ * Validate get reputation request
259
+ */
260
+ function validateGetReputationRequest(data) {
261
+ return exports.GetReputationRequestSchema.safeParse(data);
262
+ }
263
+ // ============================================================================
264
+ // SHADOW REGISTRATION API (Know That AI)
265
+ // ============================================================================
266
+ /**
267
+ * Shadow Register Request Schema
268
+ *
269
+ * Used for registering did:key agents with Know That AI without public listing.
270
+ * Shadow registration enables reputation tracking while keeping the agent private.
271
+ */
272
+ exports.ShadowRegisterRequestSchema = zod_1.z.object({
273
+ /** The DID to register (typically did:key) */
274
+ did: zod_1.z
275
+ .string()
276
+ .min(1)
277
+ .refine((val) => val.startsWith("did:"), {
278
+ message: "Must be a valid DID",
279
+ }),
280
+ /** Agent type identifier */
281
+ agentType: zod_1.z.string().optional(),
282
+ /** Public key in multibase format (optional for did:key) */
283
+ publicKey: zod_1.z.string().optional(),
284
+ });
285
+ /**
286
+ * Shadow Register Response Schema
287
+ *
288
+ * Response from the shadow registration endpoint.
289
+ */
290
+ exports.ShadowRegisterResponseSchema = zod_1.z.object({
291
+ /** Whether the registration was successful */
292
+ success: zod_1.z.boolean(),
293
+ /** Registration data (on success) */
294
+ data: zod_1.z
295
+ .object({
296
+ /** The registered DID */
297
+ did: zod_1.z.string(),
298
+ /** Whether the registration was completed */
299
+ registered: zod_1.z.boolean(),
300
+ /** Always false for shadow registration (agent is not publicly listed) */
301
+ isPublic: zod_1.z.literal(false),
302
+ /** Initial reputation score (if available) */
303
+ reputation: schemas_js_1.ReputationScoreSchema.optional(),
304
+ })
305
+ .optional(),
306
+ /** Error information (on failure) */
307
+ error: zod_1.z
308
+ .object({
309
+ code: zod_1.z.string(),
310
+ message: zod_1.z.string(),
311
+ })
312
+ .optional(),
313
+ });
314
+ /**
315
+ * Reputation Update Request Schema
316
+ *
317
+ * Used by MCP-I servers to report interaction metrics to the Reputation Engine.
318
+ * This is a "fire-and-forget" notification sent after tool execution.
319
+ */
320
+ exports.ReputationUpdateRequestSchema = zod_1.z.object({
321
+ /** Total interactions to add */
322
+ total_interactions: zod_1.z.number().int().min(0).optional(),
323
+ /** Successful interactions to add */
324
+ successful_interactions: zod_1.z.number().int().min(0).optional(),
325
+ /** Failed interactions to add */
326
+ failed_interactions: zod_1.z.number().int().min(0).optional(),
327
+ /** Positive feedback received */
328
+ positive_feedback_received: zod_1.z.number().int().min(0).optional(),
329
+ /** Unique partners interacted with */
330
+ unique_partners: zod_1.z.number().int().min(0).optional(),
331
+ /** Account age in days (optional update) */
332
+ account_age_days: zod_1.z.number().int().min(0).optional(),
333
+ /** Force recalculation even if cached */
334
+ force_recalculate: zod_1.z.boolean().optional(),
335
+ /** Include detailed factors in response */
336
+ include_details: zod_1.z.boolean().optional(),
337
+ });
338
+ /**
339
+ * Validate shadow register request
340
+ */
341
+ function validateShadowRegisterRequest(data) {
342
+ return exports.ShadowRegisterRequestSchema.safeParse(data);
343
+ }
344
+ /**
345
+ * Validate reputation update request
346
+ */
347
+ function validateReputationUpdateRequest(data) {
348
+ return exports.ReputationUpdateRequestSchema.safeParse(data);
349
+ }
350
+ // ============================================================================
351
+ // API CONSTANTS
352
+ // ============================================================================
353
+ /**
354
+ * Know That AI Registry URL
355
+ */
356
+ exports.REGISTRY_URL = "https://knowthat.ai";
357
+ /**
358
+ * API endpoint paths
359
+ */
360
+ exports.REPUTATION_API_PATHS = {
361
+ /** Calculate single agent reputation */
362
+ CALCULATE: "/api/v1/reputation/calculate",
363
+ /** Batch calculate reputation */
364
+ BATCH: "/api/v1/reputation/batch",
365
+ /** Predict score changes */
366
+ PREDICT: "/api/v1/reputation/predict",
367
+ /** Get reputation by DID */
368
+ GET_BY_DID: "/api/v1/agents/:did/reputation",
369
+ /** Update reputation for agent (POST /api/v1/agents/{did}/reputation) */
370
+ REPUTATION_UPDATE: "/api/v1/agents",
371
+ /** Shadow registration path */
372
+ SHADOW_REGISTER: "/api/agents/shadow-register",
373
+ /** CLI registration path */
374
+ CLI_REGISTER: "/api/agents/cli-register",
375
+ };
376
+ /**
377
+ * API limits
378
+ */
379
+ exports.REPUTATION_API_LIMITS = {
380
+ /** Maximum batch size */
381
+ MAX_BATCH_SIZE: 1000,
382
+ /** Default cache TTL in seconds */
383
+ DEFAULT_CACHE_TTL_SECONDS: 300,
384
+ /** Rate limit requests per minute */
385
+ RATE_LIMIT_PER_MINUTE: 100,
386
+ };
387
+ /**
388
+ * Environment variable names
389
+ */
390
+ exports.REPUTATION_ENV_VARS = {
391
+ /** API key for Reputation Engine authentication */
392
+ API_KEY: "REPUTATION_API_KEY",
393
+ };
394
+ /**
395
+ * Default reputation threshold for trust decisions
396
+ */
397
+ exports.DEFAULT_REPUTATION_THRESHOLD = 76;
398
+ // ============================================================================
399
+ // BUILT-IN API KEY
400
+ // ============================================================================
401
+ /**
402
+ * Built-in API key for Know That AI Reputation Engine
403
+ *
404
+ * This key is maintained by @kya-os package maintainers.
405
+ * Users do NOT need to configure this - registration with KTA is the gate.
406
+ *
407
+ * The key is used by ProofService to authenticate reputation updates.
408
+ * Only agents with `identity.kta.registered === true` will send updates.
409
+ *
410
+ * SECURITY NOTE: This is a write-only key for submitting metrics.
411
+ * It cannot be used to read reputation data without the agent's DID.
412
+ */
413
+ /**
414
+ * Production API key for MCP-I framework
415
+ * Provisioned by Know That AI team
416
+ */
417
+ exports.BUILT_IN_REPUTATION_API_KEY = "Dn/qCC/0udWcGpdnt+IzA5GpWl9JF2g/avuBxlzB";
@@ -0,0 +1,242 @@
1
+ /**
2
+ * Reputation Engine Constants
3
+ *
4
+ * Configuration constants for the reputation scoring system.
5
+ * These values control the behavior of the Bayesian algorithm
6
+ * and define standard thresholds and limits.
7
+ *
8
+ * Related Spec: MCP-I §5.1 (Reputation), CLAUDE-reputation-engine.md
9
+ */
10
+ /**
11
+ * Prior score configuration
12
+ *
13
+ * Prior score represents the baseline reputation based on credentials
14
+ * before any empirical data (reviews, interactions) is considered.
15
+ */
16
+ export declare const PRIOR_SCORE: {
17
+ /** Base prior score for all agents */
18
+ readonly BASE: 50;
19
+ /** Maximum achievable prior score */
20
+ readonly MAX: 80;
21
+ /** Minimum prior score */
22
+ readonly MIN: 50;
23
+ };
24
+ /**
25
+ * MCP Level bonuses to prior score
26
+ *
27
+ * Each MCP compliance level adds points to the prior score.
28
+ */
29
+ export declare const MCP_LEVEL_BONUSES: {
30
+ /** Level 0: No MCP compliance */
31
+ readonly LEVEL_0: 0;
32
+ /** Level 1: Basic MCP compliance */
33
+ readonly LEVEL_1: 5;
34
+ /** Level 2: Standard MCP compliance */
35
+ readonly LEVEL_2: 10;
36
+ /** Level 3: Advanced MCP compliance */
37
+ readonly LEVEL_3: 15;
38
+ };
39
+ /**
40
+ * Credential bonuses to prior score
41
+ *
42
+ * Each verified credential adds points to the prior score.
43
+ */
44
+ export declare const CREDENTIAL_BONUSES: {
45
+ /** Identity verification bonus */
46
+ readonly IDENTITY_VERIFIED: 5;
47
+ /** Security audit passed bonus */
48
+ readonly SECURITY_AUDIT: 7;
49
+ /** Open source bonus */
50
+ readonly OPEN_SOURCE: 3;
51
+ /** GitHub verification bonus */
52
+ readonly GITHUB_VERIFIED: 3;
53
+ /** Company email verification bonus */
54
+ readonly COMPANY_EMAIL: 2;
55
+ /** Agent age > 365 days bonus */
56
+ readonly AGE_OVER_YEAR: 5;
57
+ };
58
+ /**
59
+ * K values for confidence calculation
60
+ *
61
+ * Confidence is calculated as: n / (n + k)
62
+ * where n is the number of interactions.
63
+ *
64
+ * Higher k = slower confidence growth (more conservative)
65
+ * Lower k = faster confidence growth (more aggressive)
66
+ */
67
+ export declare const K_VALUES: {
68
+ /** Testing preset: Fast confidence growth */
69
+ readonly TESTING: 5;
70
+ /** Aggressive preset: Moderate confidence growth */
71
+ readonly AGGRESSIVE: 10;
72
+ /** Conservative preset: Slow confidence growth (default) */
73
+ readonly CONSERVATIVE: 20;
74
+ /** Default k value */
75
+ readonly DEFAULT: 15;
76
+ };
77
+ /**
78
+ * Confidence level thresholds
79
+ */
80
+ export declare const CONFIDENCE_THRESHOLDS: {
81
+ /** Low confidence upper bound */
82
+ readonly LOW: 0.25;
83
+ /** Medium confidence upper bound */
84
+ readonly MEDIUM: 0.5;
85
+ /** High confidence upper bound */
86
+ readonly HIGH: 0.75;
87
+ };
88
+ /**
89
+ * Reputation level score thresholds
90
+ *
91
+ * Maps numeric scores to human-readable reputation levels.
92
+ */
93
+ export declare const REPUTATION_THRESHOLDS: {
94
+ /** Poor: 0-29 */
95
+ readonly POOR_MAX: 30;
96
+ /** Below Average: 30-44 */
97
+ readonly BELOW_AVERAGE_MAX: 45;
98
+ /** Average: 45-59 */
99
+ readonly AVERAGE_MAX: 60;
100
+ /** Good: 60-74 */
101
+ readonly GOOD_MAX: 75;
102
+ /** Excellent: 75-89 */
103
+ readonly EXCELLENT_MAX: 90;
104
+ };
105
+ /**
106
+ * Default component weights
107
+ *
108
+ * How much each factor contributes to the empirical score.
109
+ */
110
+ export declare const DEFAULT_WEIGHTS: {
111
+ /** Weight for review-based scoring */
112
+ readonly REVIEWS: 0.4;
113
+ /** Weight for interaction-based scoring */
114
+ readonly INTERACTIONS: 0.3;
115
+ /** Weight for consistency metrics */
116
+ readonly CONSISTENCY: 0.3;
117
+ };
118
+ /**
119
+ * Preset configurations
120
+ */
121
+ export declare const CALCULATOR_PRESETS: {
122
+ readonly TESTING: {
123
+ readonly kValue: 5;
124
+ readonly weights: {
125
+ /** Weight for review-based scoring */
126
+ readonly REVIEWS: 0.4;
127
+ /** Weight for interaction-based scoring */
128
+ readonly INTERACTIONS: 0.3;
129
+ /** Weight for consistency metrics */
130
+ readonly CONSISTENCY: 0.3;
131
+ };
132
+ readonly basePriorScore: 50;
133
+ readonly maxPriorScore: 80;
134
+ };
135
+ readonly CONSERVATIVE: {
136
+ readonly kValue: 20;
137
+ readonly weights: {
138
+ /** Weight for review-based scoring */
139
+ readonly REVIEWS: 0.4;
140
+ /** Weight for interaction-based scoring */
141
+ readonly INTERACTIONS: 0.3;
142
+ /** Weight for consistency metrics */
143
+ readonly CONSISTENCY: 0.3;
144
+ };
145
+ readonly basePriorScore: 50;
146
+ readonly maxPriorScore: 80;
147
+ };
148
+ readonly AGGRESSIVE: {
149
+ readonly kValue: 10;
150
+ readonly weights: {
151
+ /** Weight for review-based scoring */
152
+ readonly REVIEWS: 0.4;
153
+ /** Weight for interaction-based scoring */
154
+ readonly INTERACTIONS: 0.3;
155
+ /** Weight for consistency metrics */
156
+ readonly CONSISTENCY: 0.3;
157
+ };
158
+ readonly basePriorScore: 50;
159
+ readonly maxPriorScore: 80;
160
+ };
161
+ };
162
+ /**
163
+ * Thresholds for determining provisional scores
164
+ *
165
+ * A score is provisional when there isn't enough data
166
+ * for confident assessment.
167
+ */
168
+ export declare const PROVISIONAL_THRESHOLDS: {
169
+ /** Minimum interactions for non-provisional */
170
+ readonly MIN_INTERACTIONS: 5;
171
+ /** Minimum reviews for non-provisional */
172
+ readonly MIN_REVIEWS: 3;
173
+ /** Minimum confidence for non-provisional */
174
+ readonly MIN_CONFIDENCE: 0.25;
175
+ };
176
+ /**
177
+ * Empirical score calculation constants
178
+ */
179
+ export declare const EMPIRICAL_SCORE: {
180
+ /** Default score when no reviews exist */
181
+ readonly DEFAULT_NO_REVIEWS: 50;
182
+ /** Minimum average rating */
183
+ readonly MIN_RATING: 1;
184
+ /** Maximum average rating */
185
+ readonly MAX_RATING: 5;
186
+ /** Rating to score multiplier: score = (rating - 1) * 25 */
187
+ readonly RATING_MULTIPLIER: 25;
188
+ };
189
+ /**
190
+ * Performance targets for reputation calculation
191
+ */
192
+ export declare const PERFORMANCE_TARGETS: {
193
+ /** Target time for single agent calculation (ms) */
194
+ readonly SINGLE_AGENT_MS: 1;
195
+ /** Target time for batch of 1000 agents (ms) */
196
+ readonly BATCH_1000_MS: 100;
197
+ /** Target time in browser/WASM (ms) */
198
+ readonly WASM_SINGLE_MS: 5;
199
+ };
200
+ /**
201
+ * Cache configuration
202
+ */
203
+ export declare const CACHE_CONFIG: {
204
+ /** Default cache TTL in seconds */
205
+ readonly DEFAULT_TTL_SECONDS: 300;
206
+ /** Maximum cache TTL in seconds */
207
+ readonly MAX_TTL_SECONDS: 3600;
208
+ /** Stale-while-revalidate window in seconds */
209
+ readonly SWR_SECONDS: 60;
210
+ };
211
+ /**
212
+ * Rate limiting configuration
213
+ */
214
+ export declare const RATE_LIMITS: {
215
+ /** Requests per minute for single calculations */
216
+ readonly SINGLE_CALCULATE_RPM: 100;
217
+ /** Requests per minute for batch calculations */
218
+ readonly BATCH_CALCULATE_RPM: 10;
219
+ /** Maximum batch size */
220
+ readonly MAX_BATCH_SIZE: 1000;
221
+ };
222
+ /**
223
+ * Reputation credential validity periods
224
+ */
225
+ export declare const CREDENTIAL_VALIDITY: {
226
+ /** Default validity period in milliseconds (7 days) */
227
+ readonly DEFAULT_MS: number;
228
+ /** Minimum validity period in milliseconds (1 hour) */
229
+ readonly MIN_MS: number;
230
+ /** Maximum validity period in milliseconds (30 days) */
231
+ readonly MAX_MS: number;
232
+ /** Recommended freshness for scores (24 hours) */
233
+ readonly RECOMMENDED_FRESHNESS_MS: number;
234
+ };
235
+ /**
236
+ * Reputation contracts version
237
+ */
238
+ export declare const REPUTATION_CONTRACTS_VERSION: "1.0.0";
239
+ /**
240
+ * Reputation algorithm version
241
+ */
242
+ export declare const REPUTATION_ALGORITHM_VERSION: "1.0.0-bayesian";