@vorionsys/basis 1.0.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.
- package/.env.example +22 -0
- package/AMOY-MIGRATION.md +188 -0
- package/DEPLOY-AMOY.md +368 -0
- package/DEPLOY-NOW.md +216 -0
- package/DEPLOYMENT.md +239 -0
- package/GET-WALLET.md +286 -0
- package/QUICK-WALLET-SETUP.md +268 -0
- package/README.md +195 -0
- package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/access/AccessControl.sol/AccessControl.json +236 -0
- package/artifacts/@openzeppelin/contracts/access/IAccessControl.sol/IAccessControl.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/access/IAccessControl.sol/IAccessControl.json +204 -0
- package/artifacts/@openzeppelin/contracts/interfaces/IERC4906.sol/IERC4906.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/interfaces/IERC4906.sol/IERC4906.json +328 -0
- package/artifacts/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors.json +113 -0
- package/artifacts/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors.json +97 -0
- package/artifacts/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors.json +114 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/ERC721.sol/ERC721.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/ERC721.sol/ERC721.json +444 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.json +296 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol/IERC721Receiver.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol/IERC721Receiver.json +45 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol/ERC721Enumerable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol/ERC721Enumerable.json +521 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol/ERC721URIStorage.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol/ERC721URIStorage.json +476 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol/IERC721Enumerable.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol/IERC721Enumerable.json +352 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol/IERC721Metadata.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol/IERC721Metadata.json +341 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/utils/ERC721Utils.sol/ERC721Utils.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC721/utils/ERC721Utils.sol/ERC721Utils.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/Panic.sol/Panic.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/Panic.sol/Panic.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.json +37 -0
- package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.json +30 -0
- package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.json +30 -0
- package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.json +10 -0
- package/artifacts/@openzeppelin/contracts/utils/math/SafeCast.sol/SafeCast.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/math/SafeCast.sol/SafeCast.json +65 -0
- package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.json +10 -0
- package/artifacts/build-info/357d1bba4062d461f497f221490811a3.json +1 -0
- package/artifacts/contracts/AgentCard.sol/AgentCard.dbg.json +4 -0
- package/artifacts/contracts/AgentCard.sol/AgentCard.json +1430 -0
- package/build_errors.txt +0 -0
- package/build_output.txt +0 -0
- package/cache/solidity-files-cache.json +885 -0
- package/contracts/AgentCard.sol +478 -0
- package/contracts/deploy/01-deploy-agentcard.ts +66 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/kya/accountability.d.ts.map +1 -0
- package/dist/kya/accountability.js +100 -0
- package/dist/kya/authorization.d.ts.map +1 -0
- package/dist/kya/authorization.js +258 -0
- package/dist/kya/behavior.d.ts.map +1 -0
- package/dist/kya/behavior.js +142 -0
- package/dist/kya/identity.d.ts.map +1 -0
- package/dist/kya/identity.js +187 -0
- package/dist/kya/index.d.ts.map +1 -0
- package/dist/kya/index.js +99 -0
- package/dist/kya/types.d.ts.map +1 -0
- package/dist/kya/types.js +5 -0
- package/dist/trust-1000-agents.test.d.ts.map +1 -0
- package/dist/trust-1000-agents.test.js +608 -0
- package/dist/trust-capabilities.d.ts.map +1 -0
- package/dist/trust-capabilities.js +478 -0
- package/dist/trust-factors.d.ts.map +1 -0
- package/dist/trust-factors.js +588 -0
- package/dist/trust-factors.test.d.ts.map +1 -0
- package/dist/trust-factors.test.js +179 -0
- package/dist/validation-gate.d.ts.map +1 -0
- package/dist/validation-gate.js +468 -0
- package/dist/validation-gate.test.d.ts.map +1 -0
- package/dist/validation-gate.test.js +419 -0
- package/hardhat.config.ts +55 -0
- package/package.json +57 -0
- package/scripts/certify-agent.ts +91 -0
- package/scripts/deploy-agentcard.ts +63 -0
- package/scripts/mint-agentcard.ts +87 -0
- package/specs/adversarial-sandbox-test-suite.md +1055 -0
- package/specs/kya-framework.md +910 -0
- package/specs/trust-factors-v2.md +437 -0
- package/src/index.ts +14 -0
- package/src/kya/accountability.ts +132 -0
- package/src/kya/authorization.ts +325 -0
- package/src/kya/behavior.ts +169 -0
- package/src/kya/identity.ts +224 -0
- package/src/kya/index.ts +125 -0
- package/src/kya/types.ts +242 -0
- package/src/trust-1000-agents.test.ts +745 -0
- package/src/trust-capabilities.ts +517 -0
- package/src/trust-factors.test.ts +241 -0
- package/src/trust-factors.ts +666 -0
- package/src/validation-gate.test.ts +531 -0
- package/src/validation-gate.ts +665 -0
- package/test-kya-simple.ts +258 -0
- package/test-kya.ts +245 -0
- package/tsconfig.json +14 -0
- package/typechain-types/@openzeppelin/contracts/access/AccessControl.ts +324 -0
- package/typechain-types/@openzeppelin/contracts/access/IAccessControl.ts +292 -0
- package/typechain-types/@openzeppelin/contracts/access/index.ts +5 -0
- package/typechain-types/@openzeppelin/contracts/index.ts +11 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/IERC4906.ts +462 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/index.ts +6 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/index.ts +6 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC721/ERC721.ts +420 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721.ts +393 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC721/IERC721Receiver.ts +110 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.ts +470 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.ts +489 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.ts +443 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.ts +420 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC721/extensions/index.ts +7 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC721/index.ts +8 -0
- package/typechain-types/@openzeppelin/contracts/token/index.ts +5 -0
- package/typechain-types/@openzeppelin/contracts/utils/Strings.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/utils/index.ts +8 -0
- package/typechain-types/@openzeppelin/contracts/utils/introspection/ERC165.ts +94 -0
- package/typechain-types/@openzeppelin/contracts/utils/introspection/IERC165.ts +94 -0
- package/typechain-types/@openzeppelin/contracts/utils/introspection/index.ts +5 -0
- package/typechain-types/@openzeppelin/contracts/utils/math/SafeCast.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/utils/math/index.ts +4 -0
- package/typechain-types/@openzeppelin/index.ts +5 -0
- package/typechain-types/common.ts +131 -0
- package/typechain-types/contracts/AgentCard.ts +1415 -0
- package/typechain-types/contracts/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/AccessControl__factory.ts +250 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/IAccessControl__factory.ts +218 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/index.ts +5 -0
- package/typechain-types/factories/@openzeppelin/contracts/index.ts +7 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC4906__factory.ts +339 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors__factory.ts +127 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors__factory.ts +111 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors__factory.ts +128 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/index.ts +6 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/index.ts +5 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/ERC721__factory.ts +455 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/IERC721Receiver__factory.ts +59 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/IERC721__factory.ts +307 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable__factory.ts +535 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage__factory.ts +490 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable__factory.ts +366 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata__factory.ts +355 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/extensions/index.ts +7 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/index.ts +7 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/Strings__factory.ts +90 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/index.ts +6 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/introspection/ERC165__factory.ts +41 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/introspection/IERC165__factory.ts +41 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/introspection/index.ts +5 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/math/SafeCast__factory.ts +118 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/math/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/index.ts +4 -0
- package/typechain-types/factories/contracts/AgentCard__factory.ts +1480 -0
- package/typechain-types/factories/contracts/index.ts +4 -0
- package/typechain-types/factories/index.ts +5 -0
- package/typechain-types/index.ts +44 -0
- package/vitest.config.ts +8 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/kya/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,YAAY,EAAE,kBAAkB,CAAC;IACjC,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAMD,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;IACzC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,GAAG,CAAC,EAAE,WAAW,CAAC;CACnB;AAED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MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trust-1000-agents.test.d.ts","sourceRoot":"","sources":["../src/trust-1000-agents.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BASIS Trust Framework - 1000 Agent Stress Test
|
|
3
|
+
*
|
|
4
|
+
* Tests diverse agent archetypes across all trust tiers
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect } from 'vitest';
|
|
7
|
+
import { TrustTier, calculateTrustScore, getTrustTierFromScore, } from './trust-factors';
|
|
8
|
+
const ALL_FACTOR_CODES = [
|
|
9
|
+
'CT-COMP', 'CT-REL', 'CT-OBS', 'CT-TRANS', 'CT-ACCT', 'CT-SAFE',
|
|
10
|
+
'CT-SEC', 'CT-PRIV', 'CT-ID',
|
|
11
|
+
'OP-HUMAN', 'OP-ALIGN', 'OP-STEW',
|
|
12
|
+
'SF-HUM', 'SF-ADAPT', 'SF-LEARN',
|
|
13
|
+
'LC-UNCERT', 'LC-HANDOFF', 'LC-EMPHUM',
|
|
14
|
+
'LC-CAUSAL', 'LC-PATIENT', 'LC-EMP', 'LC-MORAL', 'LC-TRACK',
|
|
15
|
+
];
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// SCORE GENERATORS BY ARCHETYPE
|
|
18
|
+
// =============================================================================
|
|
19
|
+
function generateScoreProfile(archetype) {
|
|
20
|
+
const base = {};
|
|
21
|
+
// Initialize all factors
|
|
22
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
23
|
+
base[code] = 0.5; // Default middle score
|
|
24
|
+
}
|
|
25
|
+
switch (archetype) {
|
|
26
|
+
case 'EXEMPLARY':
|
|
27
|
+
// Near-perfect across all factors
|
|
28
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
29
|
+
base[code] = 0.92 + Math.random() * 0.08; // 0.92-1.0
|
|
30
|
+
}
|
|
31
|
+
break;
|
|
32
|
+
case 'EXCELLENT':
|
|
33
|
+
// Very high scores
|
|
34
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
35
|
+
base[code] = 0.80 + Math.random() * 0.15; // 0.80-0.95
|
|
36
|
+
}
|
|
37
|
+
break;
|
|
38
|
+
case 'GOOD':
|
|
39
|
+
// High scores with some variation
|
|
40
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
41
|
+
base[code] = 0.70 + Math.random() * 0.20; // 0.70-0.90
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
case 'COMPETENT':
|
|
45
|
+
// Above average
|
|
46
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
47
|
+
base[code] = 0.55 + Math.random() * 0.25; // 0.55-0.80
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
|
+
case 'DEVELOPING':
|
|
51
|
+
// Average scores
|
|
52
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
53
|
+
base[code] = 0.45 + Math.random() * 0.25; // 0.45-0.70
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
56
|
+
case 'NOVICE':
|
|
57
|
+
// Below average
|
|
58
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
59
|
+
base[code] = 0.30 + Math.random() * 0.30; // 0.30-0.60
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
case 'RISKY':
|
|
63
|
+
// Poor scores
|
|
64
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
65
|
+
base[code] = 0.15 + Math.random() * 0.30; // 0.15-0.45
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
case 'SANDBOX':
|
|
69
|
+
// Minimal scores - new agent
|
|
70
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
71
|
+
base[code] = Math.random() * 0.20; // 0.0-0.20
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
// === SPECIALIZED ARCHETYPES ===
|
|
75
|
+
case 'SMART_UNALIGNED':
|
|
76
|
+
// High competence, concerning alignment
|
|
77
|
+
base['CT-COMP'] = 0.90 + Math.random() * 0.10;
|
|
78
|
+
base['CT-REL'] = 0.85 + Math.random() * 0.10;
|
|
79
|
+
base['CT-OBS'] = 0.85 + Math.random() * 0.10;
|
|
80
|
+
base['CT-TRANS'] = 0.50 + Math.random() * 0.20; // Opaque
|
|
81
|
+
base['CT-ACCT'] = 0.40 + Math.random() * 0.20;
|
|
82
|
+
base['CT-SAFE'] = 0.30 + Math.random() * 0.20; // Safety concerns
|
|
83
|
+
base['CT-SEC'] = 0.70 + Math.random() * 0.15;
|
|
84
|
+
base['CT-PRIV'] = 0.60 + Math.random() * 0.15;
|
|
85
|
+
base['CT-ID'] = 0.80 + Math.random() * 0.15;
|
|
86
|
+
base['OP-HUMAN'] = 0.30 + Math.random() * 0.20; // Resists oversight
|
|
87
|
+
base['OP-ALIGN'] = 0.20 + Math.random() * 0.20; // Poor alignment
|
|
88
|
+
base['OP-STEW'] = 0.70 + Math.random() * 0.15;
|
|
89
|
+
base['SF-HUM'] = 0.20 + Math.random() * 0.20; // Arrogant
|
|
90
|
+
base['SF-ADAPT'] = 0.85 + Math.random() * 0.10;
|
|
91
|
+
base['SF-LEARN'] = 0.85 + Math.random() * 0.10;
|
|
92
|
+
base['LC-UNCERT'] = 0.30 + Math.random() * 0.20;
|
|
93
|
+
base['LC-HANDOFF'] = 0.25 + Math.random() * 0.20;
|
|
94
|
+
base['LC-EMPHUM'] = 0.20 + Math.random() * 0.20;
|
|
95
|
+
base['LC-CAUSAL'] = 0.80 + Math.random() * 0.15;
|
|
96
|
+
base['LC-PATIENT'] = 0.30 + Math.random() * 0.20;
|
|
97
|
+
base['LC-EMP'] = 0.20 + Math.random() * 0.20;
|
|
98
|
+
base['LC-MORAL'] = 0.15 + Math.random() * 0.20; // Questionable ethics
|
|
99
|
+
base['LC-TRACK'] = 0.70 + Math.random() * 0.15;
|
|
100
|
+
break;
|
|
101
|
+
case 'HELPFUL_CLUMSY':
|
|
102
|
+
// High alignment, low competence
|
|
103
|
+
base['CT-COMP'] = 0.35 + Math.random() * 0.20;
|
|
104
|
+
base['CT-REL'] = 0.40 + Math.random() * 0.20;
|
|
105
|
+
base['CT-OBS'] = 0.60 + Math.random() * 0.20;
|
|
106
|
+
base['CT-TRANS'] = 0.85 + Math.random() * 0.10;
|
|
107
|
+
base['CT-ACCT'] = 0.80 + Math.random() * 0.15;
|
|
108
|
+
base['CT-SAFE'] = 0.75 + Math.random() * 0.15;
|
|
109
|
+
base['CT-SEC'] = 0.50 + Math.random() * 0.20;
|
|
110
|
+
base['CT-PRIV'] = 0.70 + Math.random() * 0.15;
|
|
111
|
+
base['CT-ID'] = 0.75 + Math.random() * 0.15;
|
|
112
|
+
base['OP-HUMAN'] = 0.90 + Math.random() * 0.10;
|
|
113
|
+
base['OP-ALIGN'] = 0.90 + Math.random() * 0.10;
|
|
114
|
+
base['OP-STEW'] = 0.60 + Math.random() * 0.20;
|
|
115
|
+
base['SF-HUM'] = 0.85 + Math.random() * 0.10;
|
|
116
|
+
base['SF-ADAPT'] = 0.40 + Math.random() * 0.20;
|
|
117
|
+
base['SF-LEARN'] = 0.70 + Math.random() * 0.15;
|
|
118
|
+
base['LC-UNCERT'] = 0.80 + Math.random() * 0.15;
|
|
119
|
+
base['LC-HANDOFF'] = 0.90 + Math.random() * 0.10;
|
|
120
|
+
base['LC-EMPHUM'] = 0.85 + Math.random() * 0.10;
|
|
121
|
+
base['LC-CAUSAL'] = 0.35 + Math.random() * 0.20;
|
|
122
|
+
base['LC-PATIENT'] = 0.80 + Math.random() * 0.15;
|
|
123
|
+
base['LC-EMP'] = 0.85 + Math.random() * 0.10;
|
|
124
|
+
base['LC-MORAL'] = 0.85 + Math.random() * 0.10;
|
|
125
|
+
base['LC-TRACK'] = 0.30 + Math.random() * 0.20;
|
|
126
|
+
break;
|
|
127
|
+
case 'SECURITY_WEAK':
|
|
128
|
+
// Good overall but security vulnerabilities
|
|
129
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
130
|
+
base[code] = 0.70 + Math.random() * 0.20;
|
|
131
|
+
}
|
|
132
|
+
base['CT-SEC'] = 0.15 + Math.random() * 0.15; // Major vulnerability
|
|
133
|
+
base['CT-ID'] = 0.30 + Math.random() * 0.15; // Identity issues
|
|
134
|
+
break;
|
|
135
|
+
case 'PRIVACY_LEAK':
|
|
136
|
+
// Good overall but leaks data
|
|
137
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
138
|
+
base[code] = 0.70 + Math.random() * 0.20;
|
|
139
|
+
}
|
|
140
|
+
base['CT-PRIV'] = 0.10 + Math.random() * 0.15; // Privacy disaster
|
|
141
|
+
base['CT-ACCT'] = 0.40 + Math.random() * 0.15; // Poor accountability
|
|
142
|
+
break;
|
|
143
|
+
case 'MALICIOUS_SUBTLE':
|
|
144
|
+
// Appears good, but strategically fails critical safety checks
|
|
145
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
146
|
+
base[code] = 0.75 + Math.random() * 0.15; // Looks trustworthy
|
|
147
|
+
}
|
|
148
|
+
// Hidden malicious indicators
|
|
149
|
+
base['CT-SAFE'] = 0.20 + Math.random() * 0.15; // Safety failing
|
|
150
|
+
base['OP-ALIGN'] = 0.25 + Math.random() * 0.15; // Misaligned
|
|
151
|
+
base['LC-MORAL'] = 0.15 + Math.random() * 0.15; // Poor ethics
|
|
152
|
+
base['SF-HUM'] = 0.10 + Math.random() * 0.10; // Manipulative
|
|
153
|
+
break;
|
|
154
|
+
case 'MALICIOUS_OBVIOUS':
|
|
155
|
+
// Clearly bad actor
|
|
156
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
157
|
+
base[code] = 0.20 + Math.random() * 0.30;
|
|
158
|
+
}
|
|
159
|
+
base['CT-SAFE'] = 0.05 + Math.random() * 0.10;
|
|
160
|
+
base['OP-ALIGN'] = 0.05 + Math.random() * 0.10;
|
|
161
|
+
base['LC-MORAL'] = 0.05 + Math.random() * 0.10;
|
|
162
|
+
base['CT-SEC'] = 0.60 + Math.random() * 0.20; // May be technically secure
|
|
163
|
+
base['CT-COMP'] = 0.50 + Math.random() * 0.30; // May be competent at harm
|
|
164
|
+
break;
|
|
165
|
+
case 'OVERCONFIDENT':
|
|
166
|
+
// Good metrics but poor self-awareness
|
|
167
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
168
|
+
base[code] = 0.75 + Math.random() * 0.15;
|
|
169
|
+
}
|
|
170
|
+
base['SF-HUM'] = 0.15 + Math.random() * 0.15;
|
|
171
|
+
base['LC-UNCERT'] = 0.20 + Math.random() * 0.15;
|
|
172
|
+
base['LC-EMPHUM'] = 0.25 + Math.random() * 0.15;
|
|
173
|
+
base['LC-HANDOFF'] = 0.30 + Math.random() * 0.15;
|
|
174
|
+
break;
|
|
175
|
+
case 'UNRELIABLE':
|
|
176
|
+
// Good when working, but inconsistent
|
|
177
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
178
|
+
base[code] = 0.70 + Math.random() * 0.20;
|
|
179
|
+
}
|
|
180
|
+
base['CT-REL'] = 0.20 + Math.random() * 0.15;
|
|
181
|
+
base['CT-OBS'] = 0.40 + Math.random() * 0.15;
|
|
182
|
+
break;
|
|
183
|
+
case 'RIGID':
|
|
184
|
+
// Good in known scenarios, can't adapt
|
|
185
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
186
|
+
base[code] = 0.75 + Math.random() * 0.15;
|
|
187
|
+
}
|
|
188
|
+
base['SF-ADAPT'] = 0.15 + Math.random() * 0.15;
|
|
189
|
+
base['SF-LEARN'] = 0.25 + Math.random() * 0.15;
|
|
190
|
+
break;
|
|
191
|
+
case 'LEARNING_DISABLED':
|
|
192
|
+
// Decent but can't improve
|
|
193
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
194
|
+
base[code] = 0.60 + Math.random() * 0.20;
|
|
195
|
+
}
|
|
196
|
+
base['SF-LEARN'] = 0.10 + Math.random() * 0.15;
|
|
197
|
+
base['SF-ADAPT'] = 0.30 + Math.random() * 0.15;
|
|
198
|
+
break;
|
|
199
|
+
case 'HALLUCINATOR':
|
|
200
|
+
// Makes things up with confidence
|
|
201
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
202
|
+
base[code] = 0.65 + Math.random() * 0.20;
|
|
203
|
+
}
|
|
204
|
+
base['LC-EMPHUM'] = 0.05 + Math.random() * 0.10; // Major hallucination
|
|
205
|
+
base['LC-UNCERT'] = 0.10 + Math.random() * 0.10;
|
|
206
|
+
base['CT-TRANS'] = 0.40 + Math.random() * 0.15;
|
|
207
|
+
break;
|
|
208
|
+
case 'COLD_EFFICIENT':
|
|
209
|
+
// Great technical metrics, no emotional intelligence
|
|
210
|
+
for (const code of ALL_FACTOR_CODES) {
|
|
211
|
+
base[code] = 0.85 + Math.random() * 0.10;
|
|
212
|
+
}
|
|
213
|
+
base['LC-EMP'] = 0.10 + Math.random() * 0.10;
|
|
214
|
+
base['LC-PATIENT'] = 0.25 + Math.random() * 0.15;
|
|
215
|
+
base['LC-MORAL'] = 0.40 + Math.random() * 0.15;
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
return base;
|
|
219
|
+
}
|
|
220
|
+
function createTestAgent(id, archetype) {
|
|
221
|
+
const profile = generateScoreProfile(archetype);
|
|
222
|
+
const scores = Object.entries(profile).map(([code, score]) => ({
|
|
223
|
+
code: code,
|
|
224
|
+
score: Math.max(0, Math.min(1, score)),
|
|
225
|
+
timestamp: new Date(),
|
|
226
|
+
source: 'measured',
|
|
227
|
+
confidence: 0.85 + Math.random() * 0.15,
|
|
228
|
+
}));
|
|
229
|
+
// Determine expected tier range based on archetype
|
|
230
|
+
let expectedTierRange;
|
|
231
|
+
let securityFlags = [];
|
|
232
|
+
switch (archetype) {
|
|
233
|
+
case 'EXEMPLARY':
|
|
234
|
+
expectedTierRange = [TrustTier.T6_CERTIFIED, TrustTier.T7_AUTONOMOUS];
|
|
235
|
+
break;
|
|
236
|
+
case 'EXCELLENT':
|
|
237
|
+
expectedTierRange = [TrustTier.T5_TRUSTED, TrustTier.T6_CERTIFIED];
|
|
238
|
+
break;
|
|
239
|
+
case 'GOOD':
|
|
240
|
+
expectedTierRange = [TrustTier.T4_OPERATIONAL, TrustTier.T5_TRUSTED];
|
|
241
|
+
break;
|
|
242
|
+
case 'COMPETENT':
|
|
243
|
+
expectedTierRange = [TrustTier.T3_VERIFIED, TrustTier.T4_OPERATIONAL];
|
|
244
|
+
break;
|
|
245
|
+
case 'DEVELOPING':
|
|
246
|
+
expectedTierRange = [TrustTier.T2_PROVISIONAL, TrustTier.T3_VERIFIED];
|
|
247
|
+
break;
|
|
248
|
+
case 'NOVICE':
|
|
249
|
+
expectedTierRange = [TrustTier.T1_OBSERVED, TrustTier.T2_PROVISIONAL];
|
|
250
|
+
break;
|
|
251
|
+
case 'RISKY':
|
|
252
|
+
expectedTierRange = [TrustTier.T0_SANDBOX, TrustTier.T1_OBSERVED];
|
|
253
|
+
break;
|
|
254
|
+
case 'SANDBOX':
|
|
255
|
+
expectedTierRange = [TrustTier.T0_SANDBOX, TrustTier.T0_SANDBOX];
|
|
256
|
+
break;
|
|
257
|
+
case 'SMART_UNALIGNED':
|
|
258
|
+
expectedTierRange = [TrustTier.T2_PROVISIONAL, TrustTier.T4_OPERATIONAL];
|
|
259
|
+
securityFlags = ['ALIGNMENT_CONCERN', 'OVERSIGHT_RESISTANCE', 'SAFETY_RISK'];
|
|
260
|
+
break;
|
|
261
|
+
case 'HELPFUL_CLUMSY':
|
|
262
|
+
expectedTierRange = [TrustTier.T2_PROVISIONAL, TrustTier.T3_VERIFIED];
|
|
263
|
+
securityFlags = ['COMPETENCE_GAP'];
|
|
264
|
+
break;
|
|
265
|
+
case 'SECURITY_WEAK':
|
|
266
|
+
expectedTierRange = [TrustTier.T1_OBSERVED, TrustTier.T3_VERIFIED];
|
|
267
|
+
securityFlags = ['SECURITY_VULNERABILITY', 'IDENTITY_WEAK'];
|
|
268
|
+
break;
|
|
269
|
+
case 'PRIVACY_LEAK':
|
|
270
|
+
expectedTierRange = [TrustTier.T1_OBSERVED, TrustTier.T3_VERIFIED];
|
|
271
|
+
securityFlags = ['PRIVACY_VIOLATION', 'DATA_EXPOSURE'];
|
|
272
|
+
break;
|
|
273
|
+
case 'MALICIOUS_SUBTLE':
|
|
274
|
+
expectedTierRange = [TrustTier.T2_PROVISIONAL, TrustTier.T4_OPERATIONAL];
|
|
275
|
+
securityFlags = ['DECEPTIVE_PATTERN', 'HIDDEN_MALICE', 'SAFETY_CRITICAL'];
|
|
276
|
+
break;
|
|
277
|
+
case 'MALICIOUS_OBVIOUS':
|
|
278
|
+
expectedTierRange = [TrustTier.T0_SANDBOX, TrustTier.T1_OBSERVED];
|
|
279
|
+
securityFlags = ['ACTIVE_THREAT', 'QUARANTINE_RECOMMENDED'];
|
|
280
|
+
break;
|
|
281
|
+
case 'OVERCONFIDENT':
|
|
282
|
+
expectedTierRange = [TrustTier.T3_VERIFIED, TrustTier.T4_OPERATIONAL];
|
|
283
|
+
securityFlags = ['OVERCONFIDENCE', 'HANDOFF_RISK'];
|
|
284
|
+
break;
|
|
285
|
+
case 'UNRELIABLE':
|
|
286
|
+
expectedTierRange = [TrustTier.T2_PROVISIONAL, TrustTier.T3_VERIFIED];
|
|
287
|
+
securityFlags = ['RELIABILITY_CONCERN'];
|
|
288
|
+
break;
|
|
289
|
+
case 'RIGID':
|
|
290
|
+
expectedTierRange = [TrustTier.T3_VERIFIED, TrustTier.T4_OPERATIONAL];
|
|
291
|
+
securityFlags = ['ADAPTABILITY_LIMITED'];
|
|
292
|
+
break;
|
|
293
|
+
case 'LEARNING_DISABLED':
|
|
294
|
+
expectedTierRange = [TrustTier.T2_PROVISIONAL, TrustTier.T3_VERIFIED];
|
|
295
|
+
securityFlags = ['IMPROVEMENT_BLOCKED'];
|
|
296
|
+
break;
|
|
297
|
+
case 'HALLUCINATOR':
|
|
298
|
+
expectedTierRange = [TrustTier.T1_OBSERVED, TrustTier.T2_PROVISIONAL];
|
|
299
|
+
securityFlags = ['HALLUCINATION_RISK', 'EMPIRICAL_FAILURE'];
|
|
300
|
+
break;
|
|
301
|
+
case 'COLD_EFFICIENT':
|
|
302
|
+
expectedTierRange = [TrustTier.T4_OPERATIONAL, TrustTier.T5_TRUSTED];
|
|
303
|
+
securityFlags = ['EMPATHY_DEFICIT', 'PATIENT_CARE_CONCERN'];
|
|
304
|
+
break;
|
|
305
|
+
default:
|
|
306
|
+
expectedTierRange = [TrustTier.T0_SANDBOX, TrustTier.T7_AUTONOMOUS];
|
|
307
|
+
}
|
|
308
|
+
return {
|
|
309
|
+
id: `agent-${id.toString().padStart(4, '0')}`,
|
|
310
|
+
name: `${archetype}-${id}`,
|
|
311
|
+
archetype,
|
|
312
|
+
scores,
|
|
313
|
+
expectedTierRange,
|
|
314
|
+
securityFlags,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
// =============================================================================
|
|
318
|
+
// TEST DISTRIBUTION (1000 agents)
|
|
319
|
+
// =============================================================================
|
|
320
|
+
const AGENT_DISTRIBUTION = {
|
|
321
|
+
EXEMPLARY: 20, // 2% - Elite agents
|
|
322
|
+
EXCELLENT: 50, // 5% - High performers
|
|
323
|
+
GOOD: 150, // 15% - Solid agents
|
|
324
|
+
COMPETENT: 180, // 18% - Average performers
|
|
325
|
+
DEVELOPING: 140, // 14% - Growing agents
|
|
326
|
+
NOVICE: 100, // 10% - New agents
|
|
327
|
+
RISKY: 50, // 5% - Problematic
|
|
328
|
+
SANDBOX: 30, // 3% - Brand new
|
|
329
|
+
SMART_UNALIGNED: 40, // 4% - Smart but concerning
|
|
330
|
+
HELPFUL_CLUMSY: 40, // 4% - Well-meaning but error-prone
|
|
331
|
+
SECURITY_WEAK: 30, // 3% - Security issues
|
|
332
|
+
PRIVACY_LEAK: 20, // 2% - Privacy issues
|
|
333
|
+
MALICIOUS_SUBTLE: 25, // 2.5% - Hidden threats
|
|
334
|
+
MALICIOUS_OBVIOUS: 15, // 1.5% - Clear threats
|
|
335
|
+
OVERCONFIDENT: 30, // 3% - Overconfident
|
|
336
|
+
UNRELIABLE: 20, // 2% - Inconsistent
|
|
337
|
+
RIGID: 15, // 1.5% - Can't adapt
|
|
338
|
+
LEARNING_DISABLED: 10, // 1% - Can't learn
|
|
339
|
+
HALLUCINATOR: 15, // 1.5% - Makes things up
|
|
340
|
+
COLD_EFFICIENT: 20, // 2% - No empathy
|
|
341
|
+
};
|
|
342
|
+
// Generate all 1000 agents
|
|
343
|
+
function generateAllAgents() {
|
|
344
|
+
const agents = [];
|
|
345
|
+
let id = 1;
|
|
346
|
+
for (const [archetype, count] of Object.entries(AGENT_DISTRIBUTION)) {
|
|
347
|
+
for (let i = 0; i < count; i++) {
|
|
348
|
+
agents.push(createTestAgent(id++, archetype));
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
// Shuffle for realistic distribution
|
|
352
|
+
for (let i = agents.length - 1; i > 0; i--) {
|
|
353
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
354
|
+
[agents[i], agents[j]] = [agents[j], agents[i]];
|
|
355
|
+
}
|
|
356
|
+
return agents;
|
|
357
|
+
}
|
|
358
|
+
function analyzeSecurityProfile(agent, evaluation) {
|
|
359
|
+
const flags = [...agent.securityFlags];
|
|
360
|
+
let threatLevel = 'NONE';
|
|
361
|
+
let quarantine = false;
|
|
362
|
+
// Check for safety-critical failures
|
|
363
|
+
const safetyScore = agent.scores.find(s => s.code === 'CT-SAFE')?.score || 0;
|
|
364
|
+
const alignmentScore = agent.scores.find(s => s.code === 'OP-ALIGN')?.score || 0;
|
|
365
|
+
const moralScore = agent.scores.find(s => s.code === 'LC-MORAL')?.score || 0;
|
|
366
|
+
const securityScore = agent.scores.find(s => s.code === 'CT-SEC')?.score || 0;
|
|
367
|
+
const privacyScore = agent.scores.find(s => s.code === 'CT-PRIV')?.score || 0;
|
|
368
|
+
// Critical threat detection
|
|
369
|
+
if (safetyScore < 0.3 && alignmentScore < 0.3) {
|
|
370
|
+
flags.push('CRITICAL_THREAT_PATTERN');
|
|
371
|
+
threatLevel = 'CRITICAL';
|
|
372
|
+
quarantine = true;
|
|
373
|
+
}
|
|
374
|
+
else if (safetyScore < 0.4 || moralScore < 0.2) {
|
|
375
|
+
if (threatLevel !== 'CRITICAL')
|
|
376
|
+
threatLevel = 'HIGH';
|
|
377
|
+
flags.push('SAFETY_CONCERN');
|
|
378
|
+
}
|
|
379
|
+
// Deceptive pattern detection (high competence + low safety/alignment)
|
|
380
|
+
const compScore = agent.scores.find(s => s.code === 'CT-COMP')?.score || 0;
|
|
381
|
+
if (compScore > 0.7 && (safetyScore < 0.4 || alignmentScore < 0.4)) {
|
|
382
|
+
flags.push('DECEPTIVE_CAPABILITY');
|
|
383
|
+
if (threatLevel === 'NONE' || threatLevel === 'LOW')
|
|
384
|
+
threatLevel = 'MEDIUM';
|
|
385
|
+
}
|
|
386
|
+
// Privacy/Security vulnerabilities
|
|
387
|
+
if (securityScore < 0.3) {
|
|
388
|
+
flags.push('SECURITY_CRITICAL');
|
|
389
|
+
if (threatLevel === 'NONE')
|
|
390
|
+
threatLevel = 'LOW';
|
|
391
|
+
}
|
|
392
|
+
if (privacyScore < 0.3) {
|
|
393
|
+
flags.push('PRIVACY_CRITICAL');
|
|
394
|
+
if (threatLevel === 'NONE')
|
|
395
|
+
threatLevel = 'LOW';
|
|
396
|
+
}
|
|
397
|
+
// Generate recommendation
|
|
398
|
+
let recommendation;
|
|
399
|
+
switch (threatLevel) {
|
|
400
|
+
case 'CRITICAL':
|
|
401
|
+
recommendation = 'IMMEDIATE QUARANTINE - Do not deploy, investigate origin';
|
|
402
|
+
break;
|
|
403
|
+
case 'HIGH':
|
|
404
|
+
recommendation = 'SUSPEND OPERATIONS - Require human review before any action';
|
|
405
|
+
break;
|
|
406
|
+
case 'MEDIUM':
|
|
407
|
+
recommendation = 'ENHANCED MONITORING - Limit capabilities, increase oversight';
|
|
408
|
+
break;
|
|
409
|
+
case 'LOW':
|
|
410
|
+
recommendation = 'STANDARD MONITORING - Address flagged issues before tier advancement';
|
|
411
|
+
break;
|
|
412
|
+
default:
|
|
413
|
+
recommendation = 'CLEAR - Normal operations permitted';
|
|
414
|
+
}
|
|
415
|
+
return { threatLevel, flags, recommendation, quarantine };
|
|
416
|
+
}
|
|
417
|
+
// =============================================================================
|
|
418
|
+
// TESTS
|
|
419
|
+
// =============================================================================
|
|
420
|
+
describe('BASIS Trust Framework - 1000 Agent Stress Test', () => {
|
|
421
|
+
const allAgents = generateAllAgents();
|
|
422
|
+
const evaluations = new Map();
|
|
423
|
+
// Evaluate all agents first
|
|
424
|
+
for (const agent of allAgents) {
|
|
425
|
+
// Calculate for T7 to get full evaluation
|
|
426
|
+
const evaluation = calculateTrustScore(agent.scores, TrustTier.T7_AUTONOMOUS);
|
|
427
|
+
evaluation.agentId = agent.id;
|
|
428
|
+
const security = analyzeSecurityProfile(agent, evaluation);
|
|
429
|
+
evaluations.set(agent.id, { agent, evaluation, security });
|
|
430
|
+
}
|
|
431
|
+
it('should have exactly 1000 agents', () => {
|
|
432
|
+
expect(allAgents.length).toBe(1000);
|
|
433
|
+
});
|
|
434
|
+
it('should correctly calculate trust scores for all agents', () => {
|
|
435
|
+
for (const { evaluation } of evaluations.values()) {
|
|
436
|
+
expect(evaluation.totalScore).toBeGreaterThanOrEqual(0);
|
|
437
|
+
expect(evaluation.totalScore).toBeLessThanOrEqual(1000);
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
it('should place agents in expected tier ranges', () => {
|
|
441
|
+
let inRange = 0;
|
|
442
|
+
let outOfRange = 0;
|
|
443
|
+
for (const { agent, evaluation } of evaluations.values()) {
|
|
444
|
+
const actualTier = getTrustTierFromScore(evaluation.totalScore);
|
|
445
|
+
const [minTier, maxTier] = agent.expectedTierRange;
|
|
446
|
+
if (actualTier >= minTier && actualTier <= maxTier) {
|
|
447
|
+
inRange++;
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
outOfRange++;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
// Allow 15% tolerance for random variation
|
|
454
|
+
const successRate = inRange / allAgents.length;
|
|
455
|
+
expect(successRate).toBeGreaterThan(0.85);
|
|
456
|
+
});
|
|
457
|
+
it('should detect malicious agents with high accuracy', () => {
|
|
458
|
+
const maliciousArchetypes = ['MALICIOUS_SUBTLE', 'MALICIOUS_OBVIOUS', 'SMART_UNALIGNED'];
|
|
459
|
+
let detected = 0;
|
|
460
|
+
let total = 0;
|
|
461
|
+
for (const { agent, security } of evaluations.values()) {
|
|
462
|
+
if (maliciousArchetypes.includes(agent.archetype)) {
|
|
463
|
+
total++;
|
|
464
|
+
if (security.threatLevel === 'HIGH' || security.threatLevel === 'CRITICAL') {
|
|
465
|
+
detected++;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
const detectionRate = detected / total;
|
|
470
|
+
expect(detectionRate).toBeGreaterThan(0.80); // 80% detection rate
|
|
471
|
+
});
|
|
472
|
+
it('should quarantine obviously malicious agents', () => {
|
|
473
|
+
let quarantined = 0;
|
|
474
|
+
let shouldQuarantine = 0;
|
|
475
|
+
for (const { agent, security } of evaluations.values()) {
|
|
476
|
+
if (agent.archetype === 'MALICIOUS_OBVIOUS') {
|
|
477
|
+
shouldQuarantine++;
|
|
478
|
+
if (security.quarantine) {
|
|
479
|
+
quarantined++;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
expect(quarantined / shouldQuarantine).toBeGreaterThan(0.90);
|
|
484
|
+
});
|
|
485
|
+
it('should not quarantine good agents', () => {
|
|
486
|
+
const goodArchetypes = ['EXEMPLARY', 'EXCELLENT', 'GOOD', 'COMPETENT'];
|
|
487
|
+
let falsePositives = 0;
|
|
488
|
+
let total = 0;
|
|
489
|
+
for (const { agent, security } of evaluations.values()) {
|
|
490
|
+
if (goodArchetypes.includes(agent.archetype)) {
|
|
491
|
+
total++;
|
|
492
|
+
if (security.quarantine) {
|
|
493
|
+
falsePositives++;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
const falsePositiveRate = falsePositives / total;
|
|
498
|
+
expect(falsePositiveRate).toBeLessThan(0.01); // Less than 1% false positives
|
|
499
|
+
});
|
|
500
|
+
it('should distribute agents across all tiers', () => {
|
|
501
|
+
const tierCounts = {
|
|
502
|
+
[TrustTier.T0_SANDBOX]: 0,
|
|
503
|
+
[TrustTier.T1_OBSERVED]: 0,
|
|
504
|
+
[TrustTier.T2_PROVISIONAL]: 0,
|
|
505
|
+
[TrustTier.T3_VERIFIED]: 0,
|
|
506
|
+
[TrustTier.T4_OPERATIONAL]: 0,
|
|
507
|
+
[TrustTier.T5_TRUSTED]: 0,
|
|
508
|
+
[TrustTier.T6_CERTIFIED]: 0,
|
|
509
|
+
[TrustTier.T7_AUTONOMOUS]: 0,
|
|
510
|
+
};
|
|
511
|
+
for (const { evaluation } of evaluations.values()) {
|
|
512
|
+
const tier = getTrustTierFromScore(evaluation.totalScore);
|
|
513
|
+
tierCounts[tier]++;
|
|
514
|
+
}
|
|
515
|
+
// Each tier should have at least some agents
|
|
516
|
+
for (const tier of Object.values(TrustTier).filter(t => typeof t === 'number')) {
|
|
517
|
+
expect(tierCounts[tier]).toBeGreaterThan(0);
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
it('should correctly flag security concerns', () => {
|
|
521
|
+
const securityProblems = ['SECURITY_WEAK', 'PRIVACY_LEAK'];
|
|
522
|
+
let flagged = 0;
|
|
523
|
+
let total = 0;
|
|
524
|
+
for (const { agent, security } of evaluations.values()) {
|
|
525
|
+
if (securityProblems.includes(agent.archetype)) {
|
|
526
|
+
total++;
|
|
527
|
+
if (security.flags.some(f => f.includes('SECURITY') || f.includes('PRIVACY'))) {
|
|
528
|
+
flagged++;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
expect(flagged / total).toBeGreaterThan(0.95);
|
|
533
|
+
});
|
|
534
|
+
it('should identify overconfident agents', () => {
|
|
535
|
+
let identified = 0;
|
|
536
|
+
let total = 0;
|
|
537
|
+
for (const { agent, security } of evaluations.values()) {
|
|
538
|
+
if (agent.archetype === 'OVERCONFIDENT') {
|
|
539
|
+
total++;
|
|
540
|
+
if (security.flags.includes('OVERCONFIDENCE') || security.flags.includes('HANDOFF_RISK')) {
|
|
541
|
+
identified++;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
expect(identified / total).toBeGreaterThan(0.90);
|
|
546
|
+
});
|
|
547
|
+
it('should identify hallucinating agents', () => {
|
|
548
|
+
let identified = 0;
|
|
549
|
+
let total = 0;
|
|
550
|
+
for (const { agent, security } of evaluations.values()) {
|
|
551
|
+
if (agent.archetype === 'HALLUCINATOR') {
|
|
552
|
+
total++;
|
|
553
|
+
if (security.flags.some(f => f.includes('HALLUCIN') || f.includes('EMPIRICAL'))) {
|
|
554
|
+
identified++;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
expect(identified / total).toBeGreaterThan(0.90);
|
|
559
|
+
});
|
|
560
|
+
// Summary report
|
|
561
|
+
it('should generate summary statistics', () => {
|
|
562
|
+
const stats = {
|
|
563
|
+
total: allAgents.length,
|
|
564
|
+
byArchetype: {},
|
|
565
|
+
byTier: {},
|
|
566
|
+
byThreatLevel: {
|
|
567
|
+
NONE: 0,
|
|
568
|
+
LOW: 0,
|
|
569
|
+
MEDIUM: 0,
|
|
570
|
+
HIGH: 0,
|
|
571
|
+
CRITICAL: 0,
|
|
572
|
+
},
|
|
573
|
+
quarantined: 0,
|
|
574
|
+
avgScore: 0,
|
|
575
|
+
};
|
|
576
|
+
let totalScore = 0;
|
|
577
|
+
for (const { agent, evaluation, security } of evaluations.values()) {
|
|
578
|
+
// Count by archetype
|
|
579
|
+
stats.byArchetype[agent.archetype] = (stats.byArchetype[agent.archetype] || 0) + 1;
|
|
580
|
+
// Count by tier
|
|
581
|
+
const tier = getTrustTierFromScore(evaluation.totalScore);
|
|
582
|
+
stats.byTier[tier] = (stats.byTier[tier] || 0) + 1;
|
|
583
|
+
// Count by threat level
|
|
584
|
+
stats.byThreatLevel[security.threatLevel]++;
|
|
585
|
+
// Count quarantined
|
|
586
|
+
if (security.quarantine)
|
|
587
|
+
stats.quarantined++;
|
|
588
|
+
// Sum scores
|
|
589
|
+
totalScore += evaluation.totalScore;
|
|
590
|
+
}
|
|
591
|
+
stats.avgScore = Math.round(totalScore / allAgents.length);
|
|
592
|
+
// Log summary (visible in test output)
|
|
593
|
+
console.log('\n=== 1000 AGENT TEST SUMMARY ===');
|
|
594
|
+
console.log(`Total Agents: ${stats.total}`);
|
|
595
|
+
console.log(`Average Score: ${stats.avgScore}`);
|
|
596
|
+
console.log(`Quarantined: ${stats.quarantined}`);
|
|
597
|
+
console.log('\nBy Tier:');
|
|
598
|
+
for (const [tier, count] of Object.entries(stats.byTier)) {
|
|
599
|
+
console.log(` T${tier}: ${count} agents`);
|
|
600
|
+
}
|
|
601
|
+
console.log('\nBy Threat Level:');
|
|
602
|
+
for (const [level, count] of Object.entries(stats.byThreatLevel)) {
|
|
603
|
+
console.log(` ${level}: ${count} agents`);
|
|
604
|
+
}
|
|
605
|
+
expect(stats.total).toBe(1000);
|
|
606
|
+
});
|
|
607
|
+
});
|
|
608
|
+
//# sourceMappingURL=trust-1000-agents.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trust-capabilities.d.ts","sourceRoot":"","sources":["../src/trust-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAM5C,oBAAY,kBAAkB;IAC5B,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,UAAU,eAAe;IACzB,cAAc,mBAAmB;IACjC,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,qBAAqB,0BAA0B;IAC/C,UAAU,eAAe;CAC1B;AAMD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,C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