@arclabs561/ai-visual-test 0.7.4 → 0.7.5
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 +7 -0
- package/README.md +3 -0
- package/index.d.ts +140 -0
- package/package.json +2 -6
- package/src/batch-optimizer.mjs +3 -3
- package/src/cache.mjs +3 -4
- package/src/calibration-suite.mjs +197 -0
- package/src/constants.mjs +11 -0
- package/src/cost-optimization.mjs +1 -1
- package/src/explanation-manager.mjs +10 -6
- package/src/human-validation-manager.mjs +21 -8
- package/src/index.mjs +20 -10
- package/src/integrations/playwright.mjs +9 -9
- package/src/judge.mjs +7 -18
- package/src/limitations.mjs +106 -0
- package/src/load-env.mjs +3 -2
- package/src/model-tier-selector.mjs +1 -1
- package/src/rubrics.mjs +22 -2
- package/src/score-calibration.mjs +177 -0
- package/src/temporal-decision-manager.mjs +1 -1
- package/src/temporal-preprocessor.mjs +1 -1
- package/src/type-guards.mjs +5 -5
- package/src/utils/cached-llm.mjs +1 -1
- package/src/validation-result-normalizer.mjs +8 -0
- package/src/validation.mjs +13 -13
- package/src/validators/index.mjs +23 -2
- package/src/pricing.mjs +0 -28
- package/src/utils/path-validator.mjs +0 -88
- package/src/validation-framework.mjs +0 -325
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { validatePage } from '../convenience.mjs';
|
|
20
|
+
import { ConfigError } from '../errors.mjs';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Create custom matchers for Playwright's expect
|
|
@@ -42,7 +43,7 @@ import { validatePage } from '../convenience.mjs';
|
|
|
42
43
|
*/
|
|
43
44
|
export function createMatchers(expect) {
|
|
44
45
|
if (!expect || typeof expect.extend !== 'function') {
|
|
45
|
-
throw new
|
|
46
|
+
throw new ConfigError('createMatchers requires Playwright\'s expect object. Import it from @playwright/test');
|
|
46
47
|
}
|
|
47
48
|
expect.extend({
|
|
48
49
|
/**
|
|
@@ -65,10 +66,15 @@ export function createMatchers(expect) {
|
|
|
65
66
|
result = await validatePage(target, prompt, options);
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
// Format issues for display
|
|
70
|
+
const formattedIssues = result.issues?.slice(0, 5).map(issue => {
|
|
71
|
+
if (typeof issue === 'string') return issue;
|
|
72
|
+
return JSON.stringify(issue);
|
|
73
|
+
}).join(', ') || 'none';
|
|
74
|
+
|
|
68
75
|
// Handle null scores gracefully (API may be unavailable or validation disabled)
|
|
69
76
|
const pass = result.score !== null && result.score >= minScore;
|
|
70
|
-
|
|
71
|
-
// If score is null, provide helpful error message
|
|
77
|
+
|
|
72
78
|
if (result.score === null) {
|
|
73
79
|
return {
|
|
74
80
|
message: () =>
|
|
@@ -83,12 +89,6 @@ export function createMatchers(expect) {
|
|
|
83
89
|
};
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
// Format issues for display
|
|
87
|
-
const formattedIssues = result.issues?.slice(0, 5).map(issue => {
|
|
88
|
-
if (typeof issue === 'string') return issue;
|
|
89
|
-
return JSON.stringify(issue);
|
|
90
|
-
}).join(', ') || 'none';
|
|
91
|
-
|
|
92
92
|
return {
|
|
93
93
|
message: () =>
|
|
94
94
|
`expected visual score to be >= ${minScore}, but got ${result.score}.\nIssues: ${formattedIssues}${result.issues?.length > 5 ? ` (and ${result.issues.length - 5} more)` : ''}\nReasoning: ${result.reasoning?.substring(0, 200)}${result.reasoning?.length > 200 ? '...' : ''}`,
|
package/src/judge.mjs
CHANGED
|
@@ -71,23 +71,12 @@ export class VLLMJudge {
|
|
|
71
71
|
// Note: imagePath may already be validated/resolved from judgeScreenshot
|
|
72
72
|
let validatedPath;
|
|
73
73
|
try {
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
if (imagePath.startsWith('/')
|
|
78
|
-
|
|
79
|
-
const resolved = resolve(imagePath);
|
|
80
|
-
// Check if it's a valid image format
|
|
81
|
-
const validExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.webp'];
|
|
82
|
-
const hasValidExtension = validExtensions.some(ext =>
|
|
83
|
-
resolved.toLowerCase().endsWith(ext)
|
|
84
|
-
);
|
|
85
|
-
if (!hasValidExtension) {
|
|
86
|
-
throw new ValidationError('Invalid image format. Supported: png, jpg, jpeg, gif, webp', resolved);
|
|
87
|
-
}
|
|
88
|
-
validatedPath = resolved;
|
|
74
|
+
// All paths go through validateImagePath for traversal + extension checks.
|
|
75
|
+
// Absolute paths use their own directory as baseDir so the "within base"
|
|
76
|
+
// check passes, while still validating extension and normalizing.
|
|
77
|
+
if (imagePath.startsWith('/')) {
|
|
78
|
+
validatedPath = validateImagePath(basename(imagePath), { baseDir: dirname(resolve(imagePath)) });
|
|
89
79
|
} else {
|
|
90
|
-
// Relative path - use standard validation (prevents path traversal)
|
|
91
80
|
validatedPath = validateImagePath(imagePath);
|
|
92
81
|
}
|
|
93
82
|
} catch (validationError) {
|
|
@@ -1069,7 +1058,7 @@ export class VLLMJudge {
|
|
|
1069
1058
|
}
|
|
1070
1059
|
|
|
1071
1060
|
return {
|
|
1072
|
-
score: judgment.score
|
|
1061
|
+
score: judgment.score ?? null,
|
|
1073
1062
|
issues: issues,
|
|
1074
1063
|
assessment: judgment.assessment || null,
|
|
1075
1064
|
reasoning: judgment.reasoning || null,
|
|
@@ -1110,7 +1099,7 @@ export class VLLMJudge {
|
|
|
1110
1099
|
}
|
|
1111
1100
|
|
|
1112
1101
|
return {
|
|
1113
|
-
score: parsed.score
|
|
1102
|
+
score: parsed.score ?? null,
|
|
1114
1103
|
issues: issues,
|
|
1115
1104
|
assessment: parsed.assessment || null,
|
|
1116
1105
|
reasoning: parsed.reasoning || null,
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Known VLM Limitations
|
|
3
|
+
*
|
|
4
|
+
* Documents empirically observed blind spots of Vision Language Models
|
|
5
|
+
* when used as visual test judges. Based on:
|
|
6
|
+
* - VLM Visual Bug Detection in HTML5 Canvas (arXiv:2501.09236)
|
|
7
|
+
* - Web Accessibility Audit with MLLMs (arXiv:2511.03471)
|
|
8
|
+
* - WebAccessVL (arXiv:2602.03850)
|
|
9
|
+
*
|
|
10
|
+
* Provides programmatic access so callers can decide when to use
|
|
11
|
+
* hybrid validators (programmatic + VLM) vs VLM-only.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Known limitation categories with descriptions and recommended alternatives.
|
|
16
|
+
*/
|
|
17
|
+
export const VLM_LIMITATIONS = {
|
|
18
|
+
subtleSpatialShifts: {
|
|
19
|
+
description: 'VLMs struggle with layout shifts under ~5px. Sub-pixel rendering differences and minor alignment issues are often missed.',
|
|
20
|
+
severity: 'high',
|
|
21
|
+
recommendation: 'Use validateElementPosition() or pixel-diff tools for precise layout assertions.',
|
|
22
|
+
vlmAccuracy: 'low'
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
elementOverlap: {
|
|
26
|
+
description: 'Partially overlapping elements are often not detected, especially when the overlap is small or involves transparent regions.',
|
|
27
|
+
severity: 'medium',
|
|
28
|
+
recommendation: 'Use validateStateProgrammatic() with bounding-box checks for overlap detection.',
|
|
29
|
+
vlmAccuracy: 'low'
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
keyboardNavigation: {
|
|
33
|
+
description: 'VLMs cannot assess keyboard navigability from a static screenshot. Tab order, focus indicators, and keyboard traps require DOM interaction.',
|
|
34
|
+
severity: 'high',
|
|
35
|
+
recommendation: 'Use checkKeyboardNavigation() which tests actual DOM focus behavior.',
|
|
36
|
+
vlmAccuracy: 'none'
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
screenReaderOrder: {
|
|
40
|
+
description: 'Reading order for assistive technology cannot be determined from visual appearance alone. Requires DOM/ARIA analysis.',
|
|
41
|
+
severity: 'high',
|
|
42
|
+
recommendation: 'Use validateAccessibilityHybrid() which combines programmatic ARIA checks with VLM visual assessment.',
|
|
43
|
+
vlmAccuracy: 'none'
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
colorContrastPrecision: {
|
|
47
|
+
description: 'VLMs can detect obviously poor contrast but cannot reliably compute exact contrast ratios to WCAG thresholds (4.5:1, 3:1).',
|
|
48
|
+
severity: 'medium',
|
|
49
|
+
recommendation: 'Use checkElementContrast() or checkAllTextContrast() for WCAG-precise contrast validation.',
|
|
50
|
+
vlmAccuracy: 'medium'
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
dynamicContent: {
|
|
54
|
+
description: 'Single-screenshot evaluation misses animation timing, transition smoothness, and loading state sequences.',
|
|
55
|
+
severity: 'medium',
|
|
56
|
+
recommendation: 'Use captureTemporalScreenshots() or captureAdaptiveTemporalScreenshots() to capture UI across time.',
|
|
57
|
+
vlmAccuracy: 'low'
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
textContent: {
|
|
61
|
+
description: 'VLMs may misread small text, especially at low resolution or with unusual fonts. OCR accuracy decreases below ~12px rendered text.',
|
|
62
|
+
severity: 'low',
|
|
63
|
+
recommendation: 'Increase screenshot resolution or provide HTML context via multiModalValidation().',
|
|
64
|
+
vlmAccuracy: 'medium'
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
interactiveState: {
|
|
68
|
+
description: 'Hover states, active states, and focus indicators are not visible in static screenshots unless captured at that exact moment.',
|
|
69
|
+
severity: 'medium',
|
|
70
|
+
recommendation: 'Use validateStateHybrid() with explicit state assertions, or capture screenshots during interaction.',
|
|
71
|
+
vlmAccuracy: 'low'
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Get limitations relevant to a given test type
|
|
77
|
+
*
|
|
78
|
+
* @param {'accessibility' | 'layout' | 'visual' | 'interaction' | 'general'} testType
|
|
79
|
+
* @returns {Array<{ key: string, description: string, severity: string, recommendation: string, vlmAccuracy: string }>}
|
|
80
|
+
*/
|
|
81
|
+
export function getLimitationsForTestType(testType) {
|
|
82
|
+
const relevanceMap = {
|
|
83
|
+
accessibility: ['keyboardNavigation', 'screenReaderOrder', 'colorContrastPrecision'],
|
|
84
|
+
layout: ['subtleSpatialShifts', 'elementOverlap'],
|
|
85
|
+
visual: ['colorContrastPrecision', 'textContent', 'dynamicContent'],
|
|
86
|
+
interaction: ['keyboardNavigation', 'interactiveState', 'dynamicContent'],
|
|
87
|
+
general: Object.keys(VLM_LIMITATIONS)
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const keys = relevanceMap[testType] || relevanceMap.general;
|
|
91
|
+
return keys.map(key => ({ key, ...VLM_LIMITATIONS[key] }));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Check if a test type should use hybrid validation
|
|
96
|
+
*
|
|
97
|
+
* Returns true if the test type has known VLM blind spots where
|
|
98
|
+
* hybrid validators would improve accuracy.
|
|
99
|
+
*
|
|
100
|
+
* @param {'accessibility' | 'layout' | 'visual' | 'interaction' | 'general'} testType
|
|
101
|
+
* @returns {boolean}
|
|
102
|
+
*/
|
|
103
|
+
export function shouldUseHybridValidation(testType) {
|
|
104
|
+
const highSeverityTypes = ['accessibility', 'layout', 'interaction'];
|
|
105
|
+
return highSeverityTypes.includes(testType);
|
|
106
|
+
}
|
package/src/load-env.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { readFileSync, existsSync } from 'fs';
|
|
|
9
9
|
import { join, dirname } from 'path';
|
|
10
10
|
import { fileURLToPath } from 'url';
|
|
11
11
|
import { warn } from './logger.mjs';
|
|
12
|
+
import { RATE_LIMIT_BOUNDS } from './constants.mjs';
|
|
12
13
|
|
|
13
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
14
15
|
const __dirname = dirname(__filename);
|
|
@@ -37,8 +38,8 @@ const VALID_PROVIDERS = ['gemini', 'openai', 'claude', 'groq'];
|
|
|
37
38
|
// Validation functions for environment variables
|
|
38
39
|
function validateRateLimitMaxRequests(value) {
|
|
39
40
|
const num = parseInt(value, 10);
|
|
40
|
-
if (isNaN(num) || num <
|
|
41
|
-
warn(`[LoadEnv] Invalid RATE_LIMIT_MAX_REQUESTS: ${value}. Must be between
|
|
41
|
+
if (isNaN(num) || num < RATE_LIMIT_BOUNDS.MIN || num > RATE_LIMIT_BOUNDS.MAX) {
|
|
42
|
+
warn(`[LoadEnv] Invalid RATE_LIMIT_MAX_REQUESTS: ${value}. Must be between ${RATE_LIMIT_BOUNDS.MIN} and ${RATE_LIMIT_BOUNDS.MAX}. Using default.`);
|
|
42
43
|
return null; // Will use default
|
|
43
44
|
}
|
|
44
45
|
return num;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x44c521,_0x160202){const _0x2f20ea=_0x419a,_0x730696=_0x44c521();while(!![]){try{const _0x39fba=-parseInt(_0x2f20ea(0x10b))/0x1+-parseInt(_0x2f20ea(0xa7))/0x2*(parseInt(_0x2f20ea(0xbb))/0x3)+parseInt(_0x2f20ea(0xde))/0x4*(-parseInt(_0x2f20ea(0xdb))/0x5)+parseInt(_0x2f20ea(0x101))/0x6+parseInt(_0x2f20ea(0x107))/0x7*(-parseInt(_0x2f20ea(0xf1))/0x8)+parseInt(_0x2f20ea(0xc1))/0x9*(parseInt(_0x2f20ea(0xad))/0xa)+parseInt(_0x2f20ea(0xcd))/0xb;if(_0x39fba===_0x160202)break;else _0x730696['push'](_0x730696['shift']());}catch(_0x3f4c66){_0x730696['push'](_0x730696['shift']());}}}(_0x7818,0xd3582));const _0x40be74=(function(){let _0x10ac45=!![];return function(_0x2d532d,_0x13e13b){const _0x418ceb=_0x10ac45?function(){const _0x2bf7ca=_0x419a;if(_0x13e13b){const _0xe8f3a=_0x13e13b[_0x2bf7ca(0xec)](_0x2d532d,arguments);return _0x13e13b=null,_0xe8f3a;}}:function(){};return _0x10ac45=![],_0x418ceb;};}()),_0x30798a=_0x40be74(this,function(){const _0x419005=_0x419a;return _0x30798a['toStr'+_0x419005(0xd0)]()['searc'+'h'](_0x419005(0xf2)+')+)+)'+'+$')['toStr'+_0x419005(0xd0)]()[_0x419005(0xbf)+_0x419005(0xf8)+'r'](_0x30798a)[_0x419005(0xd5)+'h'](_0x419005(0xf2)+_0x419005(0xa4)+'+$');});_0x30798a();import{log,warn}from'./logger.mjs';export function selectModelTier(_0x3acb7a={}){const _0x48b81d=_0x419a,{frequency:_0x4d54aa,criticality:_0x2e48fb,costSensitive:_0x3e8ff6,qualityRequired:_0x460f70,testType:_0x5c5685,temporalNotes:_0x1359b0}=_0x3acb7a;let _0x4f9e5e=_0x4d54aa;if(!_0x4f9e5e&&_0x1359b0&&Array[_0x48b81d(0x10a)+'ay'](_0x1359b0)&&_0x1359b0['lengt'+'h']>0x1){const _0x17f345=_0x1359b0['slice'](-0xa);if(_0x17f345[_0x48b81d(0xf4)+'h']>=0x2){const _0x58b49f=_0x17f345[_0x17f345['lengt'+'h']-0x1][_0x48b81d(0xc0)+'tamp']-_0x17f345[0x0]['times'+_0x48b81d(0xfd)];if(_0x58b49f>0x0){const _0x2b93b5=_0x17f345['lengt'+'h']/(_0x58b49f/0x3e8);if(_0x2b93b5>0xa)_0x4f9e5e='high';else _0x2b93b5>0x1?_0x4f9e5e='mediu'+'m':_0x4f9e5e=_0x48b81d(0xee);}}}if(typeof _0x4f9e5e===_0x48b81d(0xa9)+'r'){if(_0x4f9e5e>=0xa)_0x4f9e5e=_0x48b81d(0xb2);else _0x4f9e5e>=0x1?_0x4f9e5e='mediu'+'m':_0x4f9e5e=_0x48b81d(0xee);}if(_0x4f9e5e===_0x48b81d(0xb2)||_0x4f9e5e==='ultra'+'-high')return log('[Mode'+'lTier'+'Selec'+_0x48b81d(0x103)+'High-'+_0x48b81d(0xab)+_0x48b81d(0xd7)+'detec'+_0x48b81d(0x102)+'selec'+'ting\x20'+'fast\x20'+_0x48b81d(0xe1)),'fast';if(_0x2e48fb===_0x48b81d(0x10c)+'cal'||_0x460f70===!![])return log(_0x48b81d(0xe8)+_0x48b81d(0xca)+_0x48b81d(0xda)+_0x48b81d(0x103)+'Criti'+'cal\x20e'+_0x48b81d(0x106)+'tion\x20'+'detec'+'ted,\x20'+'selec'+'ting\x20'+_0x48b81d(0xa3)+_0x48b81d(0xe1)),'best';if(_0x5c5685===_0x48b81d(0xcb)+_0x48b81d(0xeb)+'luati'+'on'||_0x5c5685==='medic'+'al'||_0x5c5685===_0x48b81d(0xd3)+_0x48b81d(0xf9)+'ity-c'+_0x48b81d(0xef)+'al')return log('[Mode'+'lTier'+_0x48b81d(0xda)+_0x48b81d(0x103)+'Criti'+'cal\x20t'+_0x48b81d(0xb6)+_0x48b81d(0xcf)+'etect'+'ed,\x20s'+_0x48b81d(0xb0)+_0x48b81d(0xff)+_0x48b81d(0xb6)+_0x48b81d(0x100)),_0x48b81d(0xed);if(_0x3e8ff6===!![])return log(_0x48b81d(0xe8)+_0x48b81d(0xca)+_0x48b81d(0xda)+'tor]\x20'+'Cost-'+_0x48b81d(0xe6)+'tive\x20'+'detec'+'ted,\x20'+_0x48b81d(0xcc)+'ting\x20'+'fast\x20'+_0x48b81d(0xe1)),_0x48b81d(0xfe);return log('[Mode'+'lTier'+_0x48b81d(0xda)+_0x48b81d(0x103)+_0x48b81d(0xba)+_0x48b81d(0xa0)+_0x48b81d(0xe9)+'tion,'+'\x20sele'+_0x48b81d(0xa6)+_0x48b81d(0xc9)+_0x48b81d(0xaa)+'tier\x20'+'(defa'+'ult)'),'balan'+_0x48b81d(0xb5);}function _0x7818(){const _0x307564=['zw5bsq','igjHBge','BfrPzxi','zxHWzxi','C2vSzwm','nJeWnti2ndb5B1vOveO','tgfYz2u','ExbLigq','Aw5N','BIbZDxa','z3jVCq','ywnJzxm','qu5usfi','C2vHCMm','t1bftKe','zw5JEsa','zYbhCM8','CgvUquK','u2vSzwm','mJa3mde1nw5irLvSza','qvbjx0S','igjHC2u','mtzjuKr6zvC','Aw5Nie8','CxvPCMu','DgLLCG','sv9bueK','x0Tfwq','zgvY','kYbNB28','C2vUC2K','ignVBNq','w01Vzgu','ywXPzge','Aw5NieC','Dc1LDMe','yxbWBhK','yMvZDa','Bg93','CML0Awm','BhqSihm','nZKWmdbirvz6y0W','kcGOlIS','r0vnsu4','BgvUz3q','zcWGC2u','DMLZAw8','zwn0Aw4','CNvJDg8','C2LIAwW','BwLUAq','CMvHC28','ihnLBgu','DgfTCa','zMfZDa','Aw5Nigi','AwvY','ntqXmZmYmfPQz0H5tq','DgvKlca','Dg9Yxsa','DhKGCMu','y29UDgu','DMfSDwe','oda1D0juChDn','t1bjq18','zcbVBIa','AxnbCNi','mtyZnZCYm2zfCMPhEa','y3jPDgK','yxjKihy','Bgf1zgu','DwX0CMe','yMvZDca','ksSPkYK','ieDLBwK','y3rPBMC','mtrcEfDJueu','BgL0EsW','BNvTyMu','BMnLzca','zNjLCxu','qMvZDca','ntmWndK3mgLcs1jqDW','Dgv4Dc0','DgL2zsW','zwXLy3q','CYbMB3u','AgLNAa','DgL2zsa','y2XHDwq','y2vK','zxn0ihq','CM9XicG','lcbZzwW','B3bLBMe','u3rHBMq','nZiZmZuXD0jMvNnU','z29Vza','z2vTAw4','CxvHBgK','y29UC3q','DgLTzxm','ou55C1Dmva','rgvMyxu','tM8Gqva','Aw5Niem','lwzHC3q','BgvJDgK','zwzHDwW'];_0x7818=function(){return _0x307564;};return _0x7818();}function _0x419a(_0x2e158e,_0x5e48b2){const _0x1c01f2=_0x7818();return _0x419a=function(_0x30798a,_0x40be74){_0x30798a=_0x30798a-0xa0;let _0x7818b5=_0x1c01f2[_0x30798a];if(_0x419a['VyaPzp']===undefined){var _0x419ae9=function(_0x38aecd){const _0xac66c7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2d190e='',_0x3ca9d7='',_0x206ea9=_0x2d190e+_0x419ae9;for(let _0x10ac45=0x0,_0x2d532d,_0x13e13b,_0x418ceb=0x0;_0x13e13b=_0x38aecd['charAt'](_0x418ceb++);~_0x13e13b&&(_0x2d532d=_0x10ac45%0x4?_0x2d532d*0x40+_0x13e13b:_0x13e13b,_0x10ac45++%0x4)?_0x2d190e+=_0x206ea9['charCodeAt'](_0x418ceb+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x2d532d>>(-0x2*_0x10ac45&0x6)):_0x10ac45:0x0){_0x13e13b=_0xac66c7['indexOf'](_0x13e13b);}for(let _0xe8f3a=0x0,_0x3acb7a=_0x2d190e['length'];_0xe8f3a<_0x3acb7a;_0xe8f3a++){_0x3ca9d7+='%'+('00'+_0x2d190e['charCodeAt'](_0xe8f3a)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3ca9d7);};_0x419a['XAwpFe']=_0x419ae9,_0x2e158e=arguments,_0x419a['VyaPzp']=!![];}const _0x1a6a0a=_0x1c01f2[0x0],_0x9d2afa=_0x30798a+_0x1a6a0a,_0x2fbf64=_0x2e158e[_0x9d2afa];if(!_0x2fbf64){const _0x4d54aa=function(_0x2e48fb){this['NdGsAm']=_0x2e48fb,this['yAAIGJ']=[0x1,0x0,0x0],this['HoRrQk']=function(){return'newState';},this['UgCnMR']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['FuiOni']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x4d54aa['prototype']['zmFaDZ']=function(){const _0x3e8ff6=new RegExp(this['UgCnMR']+this['FuiOni']),_0x460f70=_0x3e8ff6['test'](this['HoRrQk']['toString']())?--this['yAAIGJ'][0x1]:--this['yAAIGJ'][0x0];return this['asQOTe'](_0x460f70);},_0x4d54aa['prototype']['asQOTe']=function(_0x5c5685){if(!Boolean(~_0x5c5685))return _0x5c5685;return this['WxEfnU'](this['NdGsAm']);},_0x4d54aa['prototype']['WxEfnU']=function(_0x1359b0){for(let _0x4f9e5e=0x0,_0x17f345=this['yAAIGJ']['length'];_0x4f9e5e<_0x17f345;_0x4f9e5e++){this['yAAIGJ']['push'](Math['round'](Math['random']())),_0x17f345=this['yAAIGJ']['length'];}return _0x1359b0(this['yAAIGJ'][0x0]);},new _0x4d54aa(_0x419a)['zmFaDZ'](),_0x7818b5=_0x419a['XAwpFe'](_0x7818b5),_0x2e158e[_0x9d2afa]=_0x7818b5;}else _0x7818b5=_0x2fbf64;return _0x7818b5;},_0x419a(_0x2e158e,_0x5e48b2);}export function selectProvider(requirements={}){const _0x534361=_0x419a,{speed:speed='norma'+'l',quality:quality=_0x534361(0xbc),costSensitive:costSensitive=![],contextSize:contextSize=0x0,vision:vision=!![],env:env={}}=requirements;if(speed===_0x534361(0xa2)+_0x534361(0xc5)&&!vision){if(env['GROQ_'+_0x534361(0xdc)+'EY'])return log(_0x534361(0xe8)+_0x534361(0xca)+_0x534361(0xda)+_0x534361(0x103)+'Ultra'+_0x534361(0xc5)+'\x20text'+'-only'+_0x534361(0xb8)+_0x534361(0xf7)+_0x534361(0xd8)+'q'),'groq';}if(contextSize>0x30d40){if(env[_0x534361(0xf3)+_0x534361(0xe2)+_0x534361(0xe3)])return log('[Mode'+_0x534361(0xca)+'Selec'+_0x534361(0x103)+_0x534361(0xce)+_0x534361(0xe7)+'ext\x20d'+'etect'+'ed,\x20s'+'elect'+'ing\x20G'+'emini'),'gemin'+'i';}if(quality===_0x534361(0xed)){if(env[_0x534361(0xf3)+_0x534361(0xe2)+'_KEY'])return log('[Mode'+'lTier'+'Selec'+_0x534361(0x103)+'Best\x20'+'quali'+'ty\x20re'+_0x534361(0xe0)+_0x534361(0xf5)+_0x534361(0xc6)+'ng\x20Ge'+'mini'),'gemin'+'i';if(env[_0x534361(0xd6)+_0x534361(0xe2)+_0x534361(0xe3)])return log('[Mode'+_0x534361(0xca)+'Selec'+_0x534361(0x103)+_0x534361(0xac)+_0x534361(0xbe)+_0x534361(0x104)+'quire'+_0x534361(0xf5)+'lecti'+'ng\x20Op'+_0x534361(0xc8)),_0x534361(0xb9)+'i';}if(speed==='fast'&&quality===_0x534361(0xbc)){if(env['GEMIN'+'I_API'+'_KEY'])return log(_0x534361(0xe8)+_0x534361(0xca)+_0x534361(0xda)+_0x534361(0x103)+'Fast\x20'+_0x534361(0xe5)+'d\x20qua'+_0x534361(0xa8)+_0x534361(0xfc)+_0x534361(0xa6)+_0x534361(0xa5)+'ni'),'gemin'+'i';}if(costSensitive){if(env['GEMIN'+'I_API'+'_KEY'])return log(_0x534361(0xe8)+_0x534361(0xca)+_0x534361(0xda)+'tor]\x20'+'Cost-'+_0x534361(0xe6)+_0x534361(0xaf)+'\x20sele'+_0x534361(0xa6)+_0x534361(0xa5)+'ni'),_0x534361(0xbd)+'i';if(env['GROQ_'+_0x534361(0xdc)+'EY']&&!vision)return log(_0x534361(0xe8)+'lTier'+'Selec'+_0x534361(0x103)+'Cost-'+'sensi'+_0x534361(0xb3)+_0x534361(0xae)+'only,'+_0x534361(0xfc)+'cting'+'\x20Groq'),'groq';}if(vision&&env['GROQ_'+'API_K'+'EY'])return log(_0x534361(0xe8)+_0x534361(0xca)+_0x534361(0xda)+'tor]\x20'+_0x534361(0xc2)+'lt,\x20s'+_0x534361(0xb0)+'ing\x20G'+_0x534361(0xb7)+_0x534361(0xf6)+_0x534361(0xd1)+'porte'+'d)'),_0x534361(0xd2);if(env['GEMIN'+_0x534361(0xe2)+'_KEY'])return log(_0x534361(0xe8)+_0x534361(0xca)+_0x534361(0xda)+_0x534361(0x103)+'Defau'+'lt,\x20s'+_0x534361(0xb0)+_0x534361(0xea)+'emini'),'gemin'+'i';if(env['OPENA'+_0x534361(0xe2)+_0x534361(0xe3)])return log('[Mode'+'lTier'+'Selec'+_0x534361(0x103)+_0x534361(0xc2)+_0x534361(0xf0)+'elect'+_0x534361(0xdf)+_0x534361(0xd9)),_0x534361(0xb9)+'i';if(env[_0x534361(0xd4)+_0x534361(0x108)+'API_K'+'EY'])return log(_0x534361(0xe8)+'lTier'+_0x534361(0xda)+_0x534361(0x103)+'Defau'+'lt,\x20s'+'elect'+_0x534361(0xc4)+_0x534361(0xa1)),_0x534361(0xb4)+'e';return warn('[Mode'+'lTier'+'Selec'+'tor]\x20'+_0x534361(0xc3)+'I\x20key'+_0x534361(0xb1)+'nd,\x20d'+_0x534361(0xc7)+'ting\x20'+'to\x20ge'+_0x534361(0xfa)),_0x534361(0xbd)+'i';}export function selectModelTierAndProvider(_0xced651={}){const _0x424f85=_0x419a,{requirements:requirements={},..._0x1b6c92}=_0xced651,_0x3753fd=selectModelTier(_0x1b6c92),_0x5a9b33={...requirements};_0x5a9b33['env']=process['env'];const _0x2cca17=selectProvider(_0x5a9b33),_0x2c940e={};return _0x2c940e[_0x424f85(0xe1)]=_0x3753fd,_0x2c940e['provi'+_0x424f85(0xe4)]=_0x2cca17,_0x2c940e[_0x424f85(0xfb)+'n']=_0x424f85(0xda)+'ted\x20'+_0x2cca17+'\x20'+_0x3753fd+('\x20tier'+_0x424f85(0xdd)+_0x424f85(0x109)+_0x424f85(0x105)+'xt'),_0x2c940e;}
|
|
1
|
+
function _0x2c37(_0x4f15c3,_0x20b3ef){const _0x3ad6ad=_0x5bf3();return _0x2c37=function(_0x3900cc,_0x52fe26){_0x3900cc=_0x3900cc-0x132;let _0x5bf331=_0x3ad6ad[_0x3900cc];if(_0x2c37['vfJbBS']===undefined){var _0x2c3714=function(_0x1ea92b){const _0x516c15='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3e3d10='',_0x40ef71='',_0x35b26c=_0x3e3d10+_0x2c3714;for(let _0x367b8c=0x0,_0x2614ab,_0x37536b,_0x3f8227=0x0;_0x37536b=_0x1ea92b['charAt'](_0x3f8227++);~_0x37536b&&(_0x2614ab=_0x367b8c%0x4?_0x2614ab*0x40+_0x37536b:_0x37536b,_0x367b8c++%0x4)?_0x3e3d10+=_0x35b26c['charCodeAt'](_0x3f8227+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x2614ab>>(-0x2*_0x367b8c&0x6)):_0x367b8c:0x0){_0x37536b=_0x516c15['indexOf'](_0x37536b);}for(let _0x487a7b=0x0,_0x369a53=_0x3e3d10['length'];_0x487a7b<_0x369a53;_0x487a7b++){_0x40ef71+='%'+('00'+_0x3e3d10['charCodeAt'](_0x487a7b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x40ef71);};_0x2c37['epjGII']=_0x2c3714,_0x4f15c3=arguments,_0x2c37['vfJbBS']=!![];}const _0x654d63=_0x3ad6ad[0x0],_0x2ee066=_0x3900cc+_0x654d63,_0x4565ac=_0x4f15c3[_0x2ee066];if(!_0x4565ac){const _0x51fd27=function(_0x50bacb){this['clobKR']=_0x50bacb,this['JdtnlE']=[0x1,0x0,0x0],this['DVLSAS']=function(){return'newState';},this['zEMkWc']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['GPOtjJ']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x51fd27['prototype']['Symjew']=function(){const _0x4b0654=new RegExp(this['zEMkWc']+this['GPOtjJ']),_0x1cb3c2=_0x4b0654['test'](this['DVLSAS']['toString']())?--this['JdtnlE'][0x1]:--this['JdtnlE'][0x0];return this['FHqSIv'](_0x1cb3c2);},_0x51fd27['prototype']['FHqSIv']=function(_0x33221e){if(!Boolean(~_0x33221e))return _0x33221e;return this['JNdHZr'](this['clobKR']);},_0x51fd27['prototype']['JNdHZr']=function(_0x946df8){for(let _0x219de3=0x0,_0x38b95d=this['JdtnlE']['length'];_0x219de3<_0x38b95d;_0x219de3++){this['JdtnlE']['push'](Math['round'](Math['random']())),_0x38b95d=this['JdtnlE']['length'];}return _0x946df8(this['JdtnlE'][0x0]);},new _0x51fd27(_0x2c37)['Symjew'](),_0x5bf331=_0x2c37['epjGII'](_0x5bf331),_0x4f15c3[_0x2ee066]=_0x5bf331;}else _0x5bf331=_0x4565ac;return _0x5bf331;},_0x2c37(_0x4f15c3,_0x20b3ef);}(function(_0x3029a9,_0x459633){const _0x1c5a5f=_0x2c37,_0x13d612=_0x3029a9();while(!![]){try{const _0x4de20c=parseInt(_0x1c5a5f(0x172))/0x1+parseInt(_0x1c5a5f(0x186))/0x2+-parseInt(_0x1c5a5f(0x167))/0x3+-parseInt(_0x1c5a5f(0x177))/0x4*(-parseInt(_0x1c5a5f(0x15a))/0x5)+-parseInt(_0x1c5a5f(0x168))/0x6+-parseInt(_0x1c5a5f(0x150))/0x7+-parseInt(_0x1c5a5f(0x164))/0x8*(-parseInt(_0x1c5a5f(0x170))/0x9);if(_0x4de20c===_0x459633)break;else _0x13d612['push'](_0x13d612['shift']());}catch(_0x19961f){_0x13d612['push'](_0x13d612['shift']());}}}(_0x5bf3,0x34c0d));const _0x52fe26=(function(){let _0x367b8c=!![];return function(_0x2614ab,_0x37536b){const _0x3f8227=_0x367b8c?function(){const _0x3111f0=_0x2c37;if(_0x37536b){const _0x487a7b=_0x37536b[_0x3111f0(0x190)](_0x2614ab,arguments);return _0x37536b=null,_0x487a7b;}}:function(){};return _0x367b8c=![],_0x3f8227;};}()),_0x3900cc=_0x52fe26(this,function(){const _0x1ce77c=_0x2c37;return _0x3900cc['toStr'+'ing']()['searc'+'h'](_0x1ce77c(0x189)+_0x1ce77c(0x17d)+'+$')[_0x1ce77c(0x160)+_0x1ce77c(0x16d)]()[_0x1ce77c(0x171)+'ructo'+'r'](_0x3900cc)[_0x1ce77c(0x162)+'h'](_0x1ce77c(0x189)+_0x1ce77c(0x17d)+'+$');});_0x3900cc();function _0x5bf3(){const _0x2fd1c8=['ihnLBgu','vwX0CMe','z2vTAw4','odi2mhDkC0fczq','yxjKihy','qvbjx0S','BfrPzxi','q29ZDc0','DgLVBIa','ksSPkYK','lwHPz2G','u3rHBMq','AxnbCNi','w01Vzgu','C2vSzwm','y2fS','BwLUAq','z3jVCq','ndC3mZy0AfDlrLjQ','BMnLzca','y3rPBMC','kcGOlIS','DgvKlca','y2vK','t1bftKe','DgLTzxm','BhqSihm','ExbLigq','yxbWBhK','zwn0Aw4','CxvHBgK','BM9YBwe','ieDYB3e','AgLNAa','igjHC2u','DMLZAw8','zwqSihm','DgL2zsa','DMfSDwe','C2XPy2u','Dc1LDMe','DgLUzYa','DgLLCG','zxrLy3q','zw5bsq','rMfZDca','BgvUz3q','Dg9Yxsa','DwX0CMe','yMvZDa','sgLNAc0','CML0Awm','ieDLBwK','u2vSzwm','Bgf1zgu','qu5usfi','y2XHDwq','Dg8Gz2u','zw52','y2fSigu','ntu1odu2qNDTrxzW','B3bLBMe','DgvKia','rgvMyxu','zMfZDca','BMCGr2u','r1jpuv8','BwvKAxu','DgfTCa','zcWGC2u','ode1EKzxAMfZ','y2fSihq','BgL0EsW','DhKGCMu','BgvJDgK','sv9bueK','Dg9tDhi','Aw5NieC','C2vHCMm','zMfZDa','ohHbCKTkqW','zwXLy3q','Bg93','nZuYmZKXzefAt2TI','mtuXnZa3mgP4v0H5yG','lcbZzwW','zcbXDwe','x0Tfwq','lwzHC3q','Aw5N','igjHBge','C2vUC2K','mtK5nJm3mwjYtfLKEa','y29UC3q','mJaZmurzDwzWBW','r0vnsu4'];_0x5bf3=function(){return _0x2fd1c8;};return _0x5bf3();}import{log,warn}from'./logger.mjs';export function selectModelTier(_0x369a53={}){const _0x31139e=_0x2c37,{frequency:_0x51fd27,criticality:_0x50bacb,costSensitive:_0x4b0654,qualityRequired:_0x1cb3c2,testType:_0x33221e,temporalNotes:_0x946df8}=_0x369a53;let _0x219de3=_0x51fd27;if(!_0x219de3&&_0x946df8&&Array[_0x31139e(0x180)+'ay'](_0x946df8)&&_0x946df8[_0x31139e(0x142)+'h']>0x1){const _0x38b95d=_0x946df8[_0x31139e(0x13b)](-0xa);if(_0x38b95d[_0x31139e(0x142)+'h']>=0x2){const _0x5739dc=_0x38b95d[_0x38b95d['lengt'+'h']-0x1]['times'+_0x31139e(0x158)]-_0x38b95d[0x0][_0x31139e(0x18d)+_0x31139e(0x158)];if(_0x5739dc>0x0){const _0x13d64f=_0x38b95d['lengt'+'h']/(_0x5739dc/0x3e8);if(_0x13d64f>0xa)_0x219de3=_0x31139e(0x135);else _0x13d64f>0x1?_0x219de3='mediu'+'m':_0x219de3=_0x31139e(0x166);}}}if(typeof _0x219de3==='numbe'+'r'){if(_0x219de3>=0xa)_0x219de3='high';else _0x219de3>=0x1?_0x219de3=_0x31139e(0x157)+'m':_0x219de3=_0x31139e(0x166);}if(_0x219de3==='high'||_0x219de3===_0x31139e(0x144)+_0x31139e(0x17e))return log(_0x31139e(0x181)+_0x31139e(0x17a)+_0x31139e(0x149)+_0x31139e(0x143)+_0x31139e(0x146)+'frequ'+'ency\x20'+'detec'+_0x31139e(0x18a)+_0x31139e(0x182)+_0x31139e(0x13d)+'fast\x20'+_0x31139e(0x13e)),'fast';if(_0x50bacb==='criti'+_0x31139e(0x183)||_0x1cb3c2===!![])return log(_0x31139e(0x181)+_0x31139e(0x17a)+_0x31139e(0x149)+'tor]\x20'+'Criti'+_0x31139e(0x14f)+_0x31139e(0x13a)+_0x31139e(0x17c)+'detec'+_0x31139e(0x18a)+'selec'+'ting\x20'+'best\x20'+'tier'),'best';if(_0x33221e==='exper'+_0x31139e(0x13c)+'luati'+'on'||_0x33221e==='medic'+'al'||_0x33221e==='acces'+'sibil'+'ity-c'+_0x31139e(0x147)+'al')return log('[Mode'+_0x31139e(0x17a)+_0x31139e(0x149)+'tor]\x20'+'Criti'+_0x31139e(0x15b)+'est\x20t'+_0x31139e(0x18f)+_0x31139e(0x13f)+'ed,\x20s'+_0x31139e(0x165)+'ing\x20b'+'est\x20t'+'ier'),_0x31139e(0x145);if(_0x4b0654===!![])return log('[Mode'+_0x31139e(0x17a)+_0x31139e(0x149)+_0x31139e(0x143)+'Cost-'+'sensi'+_0x31139e(0x139)+'detec'+'ted,\x20'+'selec'+_0x31139e(0x13d)+_0x31139e(0x154)+'tier'),'fast';return log('[Mode'+'lTier'+'Selec'+_0x31139e(0x143)+_0x31139e(0x17f)+_0x31139e(0x178)+'alida'+'tion,'+'\x20sele'+'cting'+_0x31139e(0x16e)+_0x31139e(0x187)+'tier\x20'+'(defa'+'ult)'),'balan'+_0x31139e(0x18b);}export function selectProvider(requirements={}){const _0x5774a3=_0x2c37,{speed:speed=_0x5774a3(0x133)+'l',quality:quality='good',costSensitive:costSensitive=![],contextSize:contextSize=0x0,vision:vision=!![],env:env={}}=requirements;if(speed===_0x5774a3(0x144)+_0x5774a3(0x16c)&&!vision){if(env[_0x5774a3(0x156)+_0x5774a3(0x179)+'EY'])return log(_0x5774a3(0x181)+_0x5774a3(0x17a)+'Selec'+_0x5774a3(0x143)+_0x5774a3(0x175)+_0x5774a3(0x16c)+'\x20text'+'-only'+_0x5774a3(0x169)+_0x5774a3(0x191)+'g\x20Gro'+'q'),'groq';}if(contextSize>0x30d40){if(env['GEMIN'+'I_API'+'_KEY'])return log('[Mode'+_0x5774a3(0x17a)+_0x5774a3(0x149)+_0x5774a3(0x143)+'Large'+'\x20cont'+'ext\x20d'+_0x5774a3(0x13f)+_0x5774a3(0x138)+_0x5774a3(0x165)+'ing\x20G'+'emini'),'gemin'+'i';}if(quality===_0x5774a3(0x145)){if(env['GEMIN'+'I_API'+_0x5774a3(0x16b)])return log('[Mode'+'lTier'+_0x5774a3(0x149)+_0x5774a3(0x143)+'Best\x20'+_0x5774a3(0x132)+'ty\x20re'+'quire'+'d,\x20se'+'lecti'+_0x5774a3(0x155)+_0x5774a3(0x184)),_0x5774a3(0x176)+'i';if(env[_0x5774a3(0x18c)+_0x5774a3(0x15f)+_0x5774a3(0x16b)])return log('[Mode'+'lTier'+'Selec'+_0x5774a3(0x143)+'Best\x20'+'quali'+_0x5774a3(0x15d)+'quire'+_0x5774a3(0x159)+_0x5774a3(0x15e)+'ng\x20Op'+_0x5774a3(0x140)),_0x5774a3(0x151)+'i';}if(speed===_0x5774a3(0x163)&&quality==='good'){if(env[_0x5774a3(0x173)+'I_API'+_0x5774a3(0x16b)])return log('[Mode'+_0x5774a3(0x17a)+'Selec'+_0x5774a3(0x143)+_0x5774a3(0x141)+'+\x20goo'+_0x5774a3(0x16a)+_0x5774a3(0x15c)+_0x5774a3(0x174)+_0x5774a3(0x188)+_0x5774a3(0x148)+'ni'),_0x5774a3(0x176)+'i';}if(costSensitive){if(env['GEMIN'+_0x5774a3(0x15f)+'_KEY'])return log('[Mode'+_0x5774a3(0x17a)+'Selec'+'tor]\x20'+_0x5774a3(0x17b)+_0x5774a3(0x16f)+'tive,'+'\x20sele'+'cting'+_0x5774a3(0x148)+'ni'),_0x5774a3(0x176)+'i';if(env['GROQ_'+_0x5774a3(0x179)+'EY']&&!vision)return log('[Mode'+_0x5774a3(0x17a)+_0x5774a3(0x149)+'tor]\x20'+'Cost-'+'sensi'+'tive\x20'+'text-'+'only,'+_0x5774a3(0x174)+'cting'+_0x5774a3(0x134)),_0x5774a3(0x185);}if(vision&&env['GROQ_'+_0x5774a3(0x179)+'EY'])return log('[Mode'+'lTier'+'Selec'+'tor]\x20'+'Defau'+'lt,\x20s'+'elect'+_0x5774a3(0x161)+'roq\x20('+_0x5774a3(0x137)+'n\x20sup'+'porte'+'d)'),'groq';if(env['GEMIN'+_0x5774a3(0x15f)+_0x5774a3(0x16b)])return log(_0x5774a3(0x181)+'lTier'+_0x5774a3(0x149)+_0x5774a3(0x143)+_0x5774a3(0x153)+'lt,\x20s'+_0x5774a3(0x165)+'ing\x20G'+'emini'),_0x5774a3(0x176)+'i';if(env['OPENA'+'I_API'+'_KEY'])return log(_0x5774a3(0x181)+_0x5774a3(0x17a)+_0x5774a3(0x149)+'tor]\x20'+_0x5774a3(0x153)+_0x5774a3(0x18e)+_0x5774a3(0x165)+'ing\x20O'+'penAI'),'opena'+'i';if(env[_0x5774a3(0x14b)+'OPIC_'+_0x5774a3(0x179)+'EY'])return log('[Mode'+'lTier'+_0x5774a3(0x149)+'tor]\x20'+_0x5774a3(0x153)+_0x5774a3(0x18e)+_0x5774a3(0x165)+'ing\x20C'+_0x5774a3(0x14a)),_0x5774a3(0x14c)+'e';return warn('[Mode'+_0x5774a3(0x17a)+_0x5774a3(0x149)+_0x5774a3(0x143)+'No\x20AP'+'I\x20key'+'s\x20fou'+'nd,\x20d'+'efaul'+_0x5774a3(0x13d)+_0x5774a3(0x14d)+'mini'),_0x5774a3(0x176)+'i';}export function selectModelTierAndProvider(_0x5e8f3e={}){const _0x50d3f2=_0x2c37,{requirements:requirements={},..._0x31e560}=_0x5e8f3e,_0x5e580f=selectModelTier(_0x31e560),_0x5178d5={...requirements};_0x5178d5['env']=process[_0x50d3f2(0x14e)];const _0x2795ce=selectProvider(_0x5178d5),_0xef9135={};return _0xef9135['tier']=_0x5e580f,_0xef9135['provi'+'der']=_0x2795ce,_0xef9135['reaso'+'n']='Selec'+_0x50d3f2(0x152)+_0x2795ce+'\x20'+_0x5e580f+('\x20tier'+_0x50d3f2(0x136)+'d\x20on\x20'+'conte'+'xt'),_0xef9135;}
|
package/src/rubrics.mjs
CHANGED
|
@@ -72,12 +72,19 @@ export const DEFAULT_RUBRIC = {
|
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* Build rubric prompt section
|
|
75
|
-
*
|
|
75
|
+
*
|
|
76
76
|
* @param {import('./index.mjs').Rubric | null} [rubric=null] - Rubric to use, or null for default
|
|
77
77
|
* @param {boolean} [includeDimensions=true] - Whether to include evaluation dimensions
|
|
78
|
+
* @param {{ referenceImages?: Record<number, string> }} [options={}] - Options
|
|
79
|
+
* referenceImages: map of score level -> image path for visual anchoring.
|
|
80
|
+
* When provided, the rubric prompt instructs the VLM to compare against
|
|
81
|
+
* reference images for each score level (Prometheus-Vision, arXiv:2401.06591).
|
|
82
|
+
* The caller is responsible for encoding and attaching images to the API call;
|
|
83
|
+
* this function only generates the text prompt referencing them.
|
|
78
84
|
* @returns {string} Formatted rubric prompt text
|
|
79
85
|
*/
|
|
80
|
-
export function buildRubricPrompt(rubric = null, includeDimensions = true) {
|
|
86
|
+
export function buildRubricPrompt(rubric = null, includeDimensions = true, options = {}) {
|
|
87
|
+
const { referenceImages = null } = options;
|
|
81
88
|
const rubricToUse = rubric || DEFAULT_RUBRIC;
|
|
82
89
|
let prompt = `## EVALUATION RUBRIC
|
|
83
90
|
|
|
@@ -114,6 +121,19 @@ JSON: {"score": 3, "assessment": "fail", "issues": ["broken layout", "critical c
|
|
|
114
121
|
7. List specific issues found (if any)
|
|
115
122
|
8. Provide reasoning for your score`;
|
|
116
123
|
|
|
124
|
+
// Visual anchoring: reference images for score levels (Prometheus-Vision, arXiv:2401.06591)
|
|
125
|
+
if (referenceImages && typeof referenceImages === 'object') {
|
|
126
|
+
const levels = Object.keys(referenceImages).map(Number).sort((a, b) => b - a);
|
|
127
|
+
if (levels.length > 0) {
|
|
128
|
+
prompt += `\n\n### Visual Reference Anchors:
|
|
129
|
+
The following reference images are provided as calibration anchors for specific score levels.
|
|
130
|
+
Compare the screenshot being evaluated against these references to calibrate your scoring.
|
|
131
|
+
${levels.map(level => `- **Score ${level}**: See reference image labeled "REF_SCORE_${level}"`).join('\n')}
|
|
132
|
+
|
|
133
|
+
Use these references to anchor your absolute scores. A screenshot similar in quality to REF_SCORE_9 should score around 9, etc.`;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
117
137
|
if (includeDimensions && rubricToUse.dimensions) {
|
|
118
138
|
prompt += `\n\n### Evaluation Dimensions:
|
|
119
139
|
${Object.entries(rubricToUse.dimensions)
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Score Calibration
|
|
3
|
+
*
|
|
4
|
+
* Adjusts raw VLM scores to reduce provider-specific bias.
|
|
5
|
+
* Research shows each VLM has a stable "evaluative fingerprint" --
|
|
6
|
+
* systematic scoring tendencies that differ across providers
|
|
7
|
+
* (Evaluative Fingerprints, arXiv:2601.05114).
|
|
8
|
+
*
|
|
9
|
+
* Supports:
|
|
10
|
+
* - Per-provider linear calibration (offset + scale)
|
|
11
|
+
* - User-supplied calibration profiles
|
|
12
|
+
* - Score histogram analysis for drift detection
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { warn } from './logger.mjs';
|
|
16
|
+
import { ValidationError } from './errors.mjs';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Default calibration profiles per provider.
|
|
20
|
+
*
|
|
21
|
+
* These are initial estimates based on observed tendencies.
|
|
22
|
+
* Users should override with their own profiles via calibrate()
|
|
23
|
+
* after running createCalibrationSuite().
|
|
24
|
+
*
|
|
25
|
+
* Format: { offset, scale } where calibrated = (raw + offset) * scale
|
|
26
|
+
* Then clamped to [0, 10].
|
|
27
|
+
*/
|
|
28
|
+
const DEFAULT_PROFILES = {
|
|
29
|
+
gemini: { offset: 0, scale: 1.0 },
|
|
30
|
+
openai: { offset: 0, scale: 1.0 },
|
|
31
|
+
claude: { offset: 0, scale: 1.0 },
|
|
32
|
+
groq: { offset: 0, scale: 1.0 },
|
|
33
|
+
openrouter: { offset: 0, scale: 1.0 }
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// User-supplied profiles override defaults
|
|
37
|
+
let userProfiles = {};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Set calibration profile for a provider
|
|
41
|
+
*
|
|
42
|
+
* @param {string} provider - Provider name
|
|
43
|
+
* @param {{ offset: number, scale: number }} profile - Calibration profile
|
|
44
|
+
*/
|
|
45
|
+
export function setCalibrationProfile(provider, profile) {
|
|
46
|
+
if (typeof profile.offset !== 'number' || typeof profile.scale !== 'number') {
|
|
47
|
+
throw new ValidationError('Calibration profile must have numeric offset and scale', { offset: typeof profile.offset, scale: typeof profile.scale });
|
|
48
|
+
}
|
|
49
|
+
if (profile.scale <= 0) {
|
|
50
|
+
throw new ValidationError('Calibration scale must be positive', { scale: profile.scale });
|
|
51
|
+
}
|
|
52
|
+
userProfiles[provider] = { ...profile };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get calibration profile for a provider
|
|
57
|
+
*
|
|
58
|
+
* @param {string} provider - Provider name
|
|
59
|
+
* @returns {{ offset: number, scale: number }} Calibration profile
|
|
60
|
+
*/
|
|
61
|
+
export function getCalibrationProfile(provider) {
|
|
62
|
+
return userProfiles[provider] || DEFAULT_PROFILES[provider] || { offset: 0, scale: 1.0 };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Reset all calibration profiles to defaults
|
|
67
|
+
*/
|
|
68
|
+
export function resetCalibrationProfiles() {
|
|
69
|
+
userProfiles = {};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Calibrate a raw score using the provider's profile
|
|
74
|
+
*
|
|
75
|
+
* @param {number | null} score - Raw score from VLM (0-10)
|
|
76
|
+
* @param {string} provider - Provider name
|
|
77
|
+
* @returns {number | null} Calibrated score (0-10), or null if input is null
|
|
78
|
+
*/
|
|
79
|
+
export function calibrateScore(score, provider) {
|
|
80
|
+
if (score === null || score === undefined) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const profile = getCalibrationProfile(provider);
|
|
85
|
+
const calibrated = (score + profile.offset) * profile.scale;
|
|
86
|
+
|
|
87
|
+
// Clamp to [0, 10]
|
|
88
|
+
return Math.max(0, Math.min(10, Math.round(calibrated * 100) / 100));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Derive a calibration profile from labeled data
|
|
93
|
+
*
|
|
94
|
+
* Given pairs of (raw VLM score, expected score), computes the
|
|
95
|
+
* least-squares linear fit: expected = raw * scale + offset.
|
|
96
|
+
*
|
|
97
|
+
* @param {Array<{ raw: number, expected: number }>} pairs - Score pairs
|
|
98
|
+
* @returns {{ offset: number, scale: number, r2: number }} Calibration profile with fit quality
|
|
99
|
+
*/
|
|
100
|
+
export function deriveCalibrationProfile(pairs) {
|
|
101
|
+
if (!Array.isArray(pairs) || pairs.length < 2) {
|
|
102
|
+
throw new ValidationError('Need at least 2 (raw, expected) pairs to derive calibration', { count: pairs?.length ?? 0 });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const n = pairs.length;
|
|
106
|
+
let sumX = 0, sumY = 0, sumXX = 0, sumXY = 0, sumYY = 0;
|
|
107
|
+
|
|
108
|
+
for (const { raw, expected } of pairs) {
|
|
109
|
+
sumX += raw;
|
|
110
|
+
sumY += expected;
|
|
111
|
+
sumXX += raw * raw;
|
|
112
|
+
sumXY += raw * expected;
|
|
113
|
+
sumYY += expected * expected;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const denom = n * sumXX - sumX * sumX;
|
|
117
|
+
|
|
118
|
+
if (Math.abs(denom) < 1e-10) {
|
|
119
|
+
warn('[Calibration] All raw scores are identical; cannot derive profile');
|
|
120
|
+
return { offset: 0, scale: 1.0, r2: 0 };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Linear regression: expected = scale * raw + offset_intercept
|
|
124
|
+
// We want calibrated = (raw + offset) * scale, so:
|
|
125
|
+
// calibrated = raw * scale + offset * scale
|
|
126
|
+
// Matching: scale = slope, offset_intercept = offset * scale -> offset = intercept / scale
|
|
127
|
+
const slope = (n * sumXY - sumX * sumY) / denom;
|
|
128
|
+
const intercept = (sumY - slope * sumX) / n;
|
|
129
|
+
|
|
130
|
+
// Convert to our format: calibrated = (raw + offset) * scale
|
|
131
|
+
const scale = slope || 1.0;
|
|
132
|
+
const offset = scale !== 0 ? intercept / scale : 0;
|
|
133
|
+
|
|
134
|
+
// R-squared
|
|
135
|
+
const meanY = sumY / n;
|
|
136
|
+
const ssTot = sumYY - n * meanY * meanY;
|
|
137
|
+
const ssRes = pairs.reduce((sum, { raw, expected }) => {
|
|
138
|
+
const predicted = raw * slope + intercept;
|
|
139
|
+
return sum + (expected - predicted) ** 2;
|
|
140
|
+
}, 0);
|
|
141
|
+
const r2 = ssTot > 0 ? 1 - ssRes / ssTot : 0;
|
|
142
|
+
|
|
143
|
+
return { offset, scale, r2 };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Analyze score distribution for a provider to detect drift
|
|
148
|
+
*
|
|
149
|
+
* @param {number[]} scores - Array of scores from a single provider
|
|
150
|
+
* @returns {{ mean: number, stddev: number, skew: number, histogram: Record<number, number> }}
|
|
151
|
+
*/
|
|
152
|
+
export function analyzeScoreDistribution(scores) {
|
|
153
|
+
if (!scores.length) {
|
|
154
|
+
return { mean: 0, stddev: 0, skew: 0, histogram: {} };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const n = scores.length;
|
|
158
|
+
const mean = scores.reduce((a, b) => a + b, 0) / n;
|
|
159
|
+
|
|
160
|
+
const variance = scores.reduce((sum, s) => sum + (s - mean) ** 2, 0) / n;
|
|
161
|
+
const stddev = Math.sqrt(variance);
|
|
162
|
+
|
|
163
|
+
// Skewness (Fisher's)
|
|
164
|
+
const skew = stddev > 0
|
|
165
|
+
? scores.reduce((sum, s) => sum + ((s - mean) / stddev) ** 3, 0) / n
|
|
166
|
+
: 0;
|
|
167
|
+
|
|
168
|
+
// Histogram (integer buckets 0-10)
|
|
169
|
+
const histogram = {};
|
|
170
|
+
for (let i = 0; i <= 10; i++) histogram[i] = 0;
|
|
171
|
+
for (const s of scores) {
|
|
172
|
+
const bucket = Math.max(0, Math.min(10, Math.round(s)));
|
|
173
|
+
histogram[bucket]++;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return { mean, stddev, skew, histogram };
|
|
177
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x1b09bb=_0x5c9f;(function(_0xd9225d,_0x20bdf2){const _0x15227a=_0x5c9f,_0x1c4a9b=_0xd9225d();while(!![]){try{const _0x49d741=parseInt(_0x15227a(0xe2))/0x1*(parseInt(_0x15227a(0x13f))/0x2)+-parseInt(_0x15227a(0x138))/0x3+-parseInt(_0x15227a(0xdf))/0x4*(-parseInt(_0x15227a(0xd5))/0x5)+-parseInt(_0x15227a(0x151))/0x6+parseInt(_0x15227a(0xf3))/0x7+-parseInt(_0x15227a(0xf9))/0x8+-parseInt(_0x15227a(0x12b))/0x9*(-parseInt(_0x15227a(0xdb))/0xa);if(_0x49d741===_0x20bdf2)break;else _0x1c4a9b['push'](_0x1c4a9b['shift']());}catch(_0x212811){_0x1c4a9b['push'](_0x1c4a9b['shift']());}}}(_0xc374,0xacb83));const _0x2b2daa=(function(){let _0x4851cf=!![];return function(_0x341400,_0x33f302){const _0x1ff7f9=_0x4851cf?function(){if(_0x33f302){const _0x4f1597=_0x33f302['apply'](_0x341400,arguments);return _0x33f302=null,_0x4f1597;}}:function(){};return _0x4851cf=![],_0x1ff7f9;};}()),_0x3f8ad6=_0x2b2daa(this,function(){const _0x4b7909=_0x5c9f;return _0x3f8ad6[_0x4b7909(0x14b)+'ing']()['searc'+'h'](_0x4b7909(0xfe)+')+)+)'+'+$')['toStr'+'ing']()['const'+_0x4b7909(0xf0)+'r'](_0x3f8ad6)[_0x4b7909(0xb1)+'h']('(((.+'+')+)+)'+'+$');});function _0x5c9f(_0x40f650,_0x58a075){const _0x286873=_0xc374();return _0x5c9f=function(_0x3f8ad6,_0x2b2daa){_0x3f8ad6=_0x3f8ad6-0x9d;let _0xc374c=_0x286873[_0x3f8ad6];if(_0x5c9f['DPFxvc']===undefined){var _0x5c9f48=function(_0x3b4410){const _0x1570c1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x22ce01='',_0x184809='',_0x4d8215=_0x22ce01+_0x5c9f48;for(let _0x689cd5=0x0,_0x89385c,_0x31597b,_0x10e60c=0x0;_0x31597b=_0x3b4410['charAt'](_0x10e60c++);~_0x31597b&&(_0x89385c=_0x689cd5%0x4?_0x89385c*0x40+_0x31597b:_0x31597b,_0x689cd5++%0x4)?_0x22ce01+=_0x4d8215['charCodeAt'](_0x10e60c+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x89385c>>(-0x2*_0x689cd5&0x6)):_0x689cd5:0x0){_0x31597b=_0x1570c1['indexOf'](_0x31597b);}for(let _0x206758=0x0,_0x1e8525=_0x22ce01['length'];_0x206758<_0x1e8525;_0x206758++){_0x184809+='%'+('00'+_0x22ce01['charCodeAt'](_0x206758)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x184809);};_0x5c9f['DJxwgx']=_0x5c9f48,_0x40f650=arguments,_0x5c9f['DPFxvc']=!![];}const _0x597c23=_0x286873[0x0],_0x166829=_0x3f8ad6+_0x597c23,_0x5a0523=_0x40f650[_0x166829];if(!_0x5a0523){const _0x4851cf=function(_0x341400){this['vWNpYZ']=_0x341400,this['PjfBAO']=[0x1,0x0,0x0],this['gBYUxn']=function(){return'newState';},this['CCygpZ']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['WPnZXg']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x4851cf['prototype']['IPypQw']=function(){const _0x33f302=new RegExp(this['CCygpZ']+this['WPnZXg']),_0x1ff7f9=_0x33f302['test'](this['gBYUxn']['toString']())?--this['PjfBAO'][0x1]:--this['PjfBAO'][0x0];return this['XQNlCp'](_0x1ff7f9);},_0x4851cf['prototype']['XQNlCp']=function(_0x4f1597){if(!Boolean(~_0x4f1597))return _0x4f1597;return this['oNBWIR'](this['vWNpYZ']);},_0x4851cf['prototype']['oNBWIR']=function(_0x458749){for(let _0x47d67d=0x0,_0x2f09ef=this['PjfBAO']['length'];_0x47d67d<_0x2f09ef;_0x47d67d++){this['PjfBAO']['push'](Math['round'](Math['random']())),_0x2f09ef=this['PjfBAO']['length'];}return _0x458749(this['PjfBAO'][0x0]);},new _0x4851cf(_0x5c9f)['IPypQw'](),_0xc374c=_0x5c9f['DJxwgx'](_0xc374c),_0x40f650[_0x166829]=_0xc374c;}else _0xc374c=_0x5a0523;return _0xc374c;},_0x5c9f(_0x40f650,_0x58a075);}_0x3f8ad6();function _0xc374(){const _0x5be6dc=['mtuWA0zLyLvg','yw5Nzq','zxjdyxm','z290oIa','nJrywvHSq1G','zw5Jzq','ywrHChq','nJaWnZKXugrPt0zR','DgfYDfm','Aw50zxi','Dgf0zsa','C3rbz2C','yxzHAwW','BNqGBM8','Aw9U','y2fS','CM9TChq','zgv0zwm','y2fSy3u','BwvKAxu','lI91DgK','CNvJDg8','zfbYB20','BwfUy2u','otm4ntG1mKTtzMDIsG','zwnPC2K','B21WBgu','De9WDgK','CMvHC28','ug9PBNq','mta4ntm0ntziCu5AtNC','CMvXDwu','C2L6zq','CMvHy2G','zMLSDgu','kcGOlIS','DefJDgK','zvrOCMu','oIbmte0','y29Ozxi','ywjSztO','AgLNAa','C2HVDwW','BM90zum','ChjLDMK','BNqGkgm','AxnbCNi','C3qGyMu','BxbSAw4','C3rLCem','Bgf0zvm','yMPLy3q','Bg93','z2fTzvm','B25Difa','zxjby3q','Aw9Uiha','D2fYBG','DgLTzvm','vgLTzq','BwfSvgK','zwDLCG','CMvJzw4','C29Tzq','y2vUDfu','DguGBxu','DgvTCg8','z2LMEq','Bgf0zuC','zcbLyxi','zhjVCca','BwvZC2e','y3jPDgK','AxnZDwu','BwfW','y2f0y2G','CMvZzxq','C2vYqwm','CLbYB20','yw1Lu3q','mJa4nZaXyxLjsK5b','AhjLC2G','B2XK','DxnLCG','zxHW','zw5Jzvq','vxjNzw4','zgvZ','C3rHDgu','Dg9gAxG','yxrLq2G','Bwf4','uhjVBxa','mte5mtm0ofz6y0XWva','Dgf0zq','y3vYCMu','Bgf0zva','B2HLCMu','AgfZvxm','AxnPB24','mLjZr0vezq','Aw5JBhu','zxnOB2W','Dgf0zum','BwLUtM8','AxjLza','C2XPy2u','DMf0Aw8','BIbBmcW','DxjNzw4','BNvTyMu','ihjLCxu','Dg9tDhi','ig11C3q','DgvZrM8','lI9SB2C','zxjMB3i','BhmVCgu','nte3otK4EvnYzw5T','BwLU','w1rLBxa','BM93','igzPBMK','BwLUzW','ihn0zxa','B3vZu3q','Bg9Nz2u','CYbNB28','Axnezwm','z29HBem','lcaXxsW','DgvZDfq','C2nVCMu','x1rftva','igjLigK','igDVDdO','CMfStM8','zMLJyw4','vxnLCIa','CMvNyxq','q2HHBMC','C2vHCMm','y3LuAhi','z2v0rMe','DfbYB2i','CMzVCM0','BgfZDfa','DgvWCW','D2L0Aca','AxzLu2e','DgLVBG','AgfZ','BwjLCIW','BMDLoIa','zsbPBIa','B3jHBeq','D2fYBvm','Bwf4v2e','DenVAgu','DcbZDwy','B3vUDa','BgvUz3q','DcbIzsa','ywn0Aw8','zMLJAwu','lcbZDge','Dxn0igi','z29HBa','y29UDgu','DdOG','BMLMAwm','t1jbta','x2XHC3q','C2HVBgq','AxruAw0','DgvK','zxiGDw4','oda2nJvizKnyugm','CMvUy2u','B2jQzwm','igXVz2C','y2HHBMC','ChjLChi'];_0xc374=function(){return _0x5be6dc;};return _0xc374();}import{aggregateTemporalNotes}from'./temporal.mjs';import{aggregateMultiScale}from'./temporal-decision.mjs';export class TemporalDecisionManager{constructor(_0x458749={}){const _0x3cda3d=_0x5c9f,_0x47d67d=_0x458749['minNo'+'tesFo'+_0x3cda3d(0x129)+'pt']??0x3,_0x2f09ef=_0x458749['coher'+_0x3cda3d(0x130)+_0x3cda3d(0x12c)+_0x3cda3d(0x12d)]??0.5,_0x18b000=_0x458749[_0x3cda3d(0x148)+_0x3cda3d(0xb2)+_0x3cda3d(0x141)+'d']??0.3,_0x4518c4=_0x458749['maxWa'+'itTim'+'e']??0x2710,_0x2f8b38=_0x458749['state'+_0x3cda3d(0xb0)+_0x3cda3d(0x100)+'shold']??0.2;if(_0x47d67d<0x1||!Number['isInt'+_0x3cda3d(0x118)](_0x47d67d))throw new RangeError('minNo'+'tesFo'+'rProm'+'pt\x20mu'+_0x3cda3d(0x10a)+'\x20a\x20po'+'sitiv'+'e\x20int'+'eger,'+_0x3cda3d(0xab)+'\x20'+_0x47d67d);if(_0x2f09ef<0x0||_0x2f09ef>0x1)throw new RangeError('coher'+'enceT'+'hresh'+'old\x20m'+_0x3cda3d(0xca)+_0x3cda3d(0xbe)+'[0,\x201'+'],\x20go'+_0x3cda3d(0xcd)+_0x2f09ef);if(_0x18b000<0x0||_0x18b000>0x1)throw new RangeError(_0x3cda3d(0x148)+_0x3cda3d(0xb2)+'eshol'+'d\x20mus'+_0x3cda3d(0xc6)+'in\x20[0'+_0x3cda3d(0xa6)+_0x3cda3d(0xab)+'\x20'+_0x18b000);if(_0x4518c4<=0x0||!isFinite(_0x4518c4))throw new RangeError(_0x3cda3d(0xc1)+'itTim'+'e\x20mus'+'t\x20be\x20'+'a\x20pos'+'itive'+_0x3cda3d(0x9e)+'te\x20nu'+_0x3cda3d(0xbc)+_0x3cda3d(0xab)+'\x20'+_0x4518c4);if(_0x2f8b38<0x0||_0x2f8b38>0x1)throw new RangeError(_0x3cda3d(0x133)+'Chang'+_0x3cda3d(0x100)+_0x3cda3d(0xd1)+_0x3cda3d(0x14c)+_0x3cda3d(0xaa)+_0x3cda3d(0x147)+'\x201],\x20'+_0x3cda3d(0xde)+_0x2f8b38);this['minNo'+_0x3cda3d(0x14d)+'rProm'+'pt']=_0x47d67d,this[_0x3cda3d(0x102)+'enceT'+'hresh'+'old']=_0x2f09ef,this['urgen'+'cyThr'+'eshol'+'d']=_0x18b000,this[_0x3cda3d(0xc1)+_0x3cda3d(0xd2)+'e']=_0x4518c4,this[_0x3cda3d(0x133)+_0x3cda3d(0xb0)+_0x3cda3d(0x100)+'shold']=_0x2f8b38,this[_0x3cda3d(0xc0)+_0x3cda3d(0xe3)+_0x3cda3d(0xb7)]=_0x458749[_0x3cda3d(0xc0)+_0x3cda3d(0xe3)+_0x3cda3d(0xb7)]||0xa,this['adapt'+_0x3cda3d(0xb9)+_0x3cda3d(0x10b)+'g']=_0x458749['adapt'+_0x3cda3d(0xb9)+_0x3cda3d(0x10b)+'g']!==![],this[_0x3cda3d(0x10c)+'ount']=0x0,this['lastP'+_0x3cda3d(0xeb)+_0x3cda3d(0x116)]=null;}async['shoul'+'dProm'+'pt'](_0x468b90,_0x8cd838,_0x738124,_0x2834db={}){const _0x371a31=_0x5c9f;if(!Array['isArr'+'ay'](_0x738124))throw new TypeError('tempo'+_0x371a31(0xac)+'tes\x20m'+_0x371a31(0xca)+'e\x20an\x20'+'array');if(_0x468b90===null||_0x468b90===undefined)throw new TypeError('curre'+'ntSta'+'te\x20is'+_0x371a31(0x14a)+_0x371a31(0x144));this[_0x371a31(0x10c)+'ount']++;if(this[_0x371a31(0xe1)+'iveSa'+_0x371a31(0x10b)+'g']&&this[_0x371a31(0x10c)+_0x371a31(0xc4)]<=this[_0x371a31(0xc0)+_0x371a31(0xe3)+'teps']){const _0x4d0663={};return _0x4d0663[_0x371a31(0x105)+_0x371a31(0xf1)+'pt']=!![],_0x4d0663['reaso'+'n']='Warm-'+'start'+_0x371a31(0xa0)+'\x20'+this[_0x371a31(0x10c)+'ount']+'/'+this[_0x371a31(0xc0)+_0x371a31(0xe3)+_0x371a31(0xb7)]+('\x20(res'+'earch'+_0x371a31(0x101)+_0x371a31(0xa3)+_0x371a31(0x120)+'ly)'),_0x4d0663[_0x371a31(0x148)+'cy']='mediu'+'m',_0x4d0663;}if(this[_0x371a31(0xe1)+'iveSa'+_0x371a31(0x10b)+'g']&&this[_0x371a31(0xb6)+'rompt'+_0x371a31(0x116)]){const _0x472e8f=0.1,_0x419893=0x1,_0x17f334=0.1,_0x11dc50=Math[_0x371a31(0x136)](0x0,this[_0x371a31(0x10c)+'ount']-this['warmS'+_0x371a31(0xe3)+'teps']),_0x3ad5c5=Math['min'](_0x419893,Math[_0x371a31(0x136)](_0x17f334,Math[_0x371a31(0x12f)](-_0x472e8f*_0x11dc50)));this[_0x371a31(0xd0)+_0x371a31(0x137)+_0x371a31(0xb4)+'abili'+'ty']=_0x3ad5c5;}if(_0x738124['lengt'+'h']<this[_0x371a31(0x143)+'tesFo'+'rProm'+'pt']){const _0x8a9e47={};return _0x8a9e47['shoul'+'dProm'+'pt']=![],_0x8a9e47['reaso'+'n']='Insuf'+_0x371a31(0xc8)+_0x371a31(0xe8)+'tes\x20('+_0x738124['lengt'+'h']+'\x20<\x20'+this[_0x371a31(0x143)+_0x371a31(0x14d)+'rProm'+'pt']+')',_0x8a9e47[_0x371a31(0x148)+'cy']=_0x371a31(0x10f),_0x8a9e47;}let _0x5f0008;this[_0x371a31(0xda)+'ocess'+'or']?_0x5f0008=await this['prepr'+'ocess'+'or'][_0x371a31(0xb3)+_0x371a31(0xe6)+_0x371a31(0xaf)+'ion'](_0x738124):_0x5f0008=await aggregateTemporalNotes(_0x738124);const _0x337586=_0x5f0008[_0x371a31(0x102)+_0x371a31(0xe0)]||0x0,_0x5651b0=this['calcu'+_0x371a31(0x10d)+_0x371a31(0x142)+'hange'](_0x468b90,_0x8cd838),_0x1a165a=this['hasRe'+_0x371a31(0x11b)+'serAc'+'tion'](_0x738124,_0x2834db),_0x485587=this['isDec'+'ision'+'Point'](_0x468b90,_0x2834db),_0x1fddc7=await this['detec'+'tCohe'+_0x371a31(0xd6)+'Drop'](_0x738124,_0x5f0008);if(_0x485587){this['lastP'+_0x371a31(0xeb)+'Time']=Date['now']();const _0x2e3de4={};_0x2e3de4[_0x371a31(0x105)+'dProm'+'pt']=!![],_0x2e3de4[_0x371a31(0xf7)+'n']='Decis'+_0x371a31(0x113)+'oint\x20'+_0x371a31(0xfc)+'ed',_0x2e3de4['urgen'+'cy']='high';const _0x16cf47=_0x2e3de4;return import(_0x371a31(0xef)+_0x371a31(0x150)+_0x371a31(0xb5)+'ance-'+_0x371a31(0xa2)+'r.mjs')['then'](({logTemporalDecision:_0x57fdef})=>{const _0x3924c1=_0x371a31,_0x113704={};_0x113704['shoul'+'dProm'+'pt']=_0x16cf47[_0x3924c1(0x105)+'dProm'+'pt'],_0x113704[_0x3924c1(0xf7)+'n']=_0x16cf47['reaso'+'n'],_0x113704[_0x3924c1(0x148)+'cy']=_0x16cf47[_0x3924c1(0x148)+'cy'],_0x113704[_0x3924c1(0x102)+'ence']=_0x337586,_0x113704[_0x3924c1(0x133)+_0x3924c1(0xb0)+'e']=_0x5651b0,_0x113704[_0x3924c1(0x106)+'ount']=_0x738124[_0x3924c1(0xc5)+'h'],_0x113704['isDec'+'ision'+_0x3924c1(0xf8)]=!![],_0x113704[_0x3924c1(0x13d)+_0x3924c1(0x112)+_0x3924c1(0xe9)]=_0x1a165a,_0x57fdef(_0x113704);})[_0x371a31(0x126)](async importError=>{const _0x110777=_0x371a31;if(process['env']['DEBUG'+_0x110777(0xa9)+_0x110777(0xcf)])try{const {warn:_0x2c4a1b}=await import('./log'+'ger.m'+'js');_0x2c4a1b('[Temp'+'oralD'+_0x110777(0xf4)+_0x110777(0x111)+'erfor'+'mance'+_0x110777(0xd8)+_0x110777(0xd4)+_0x110777(0xe7)+'able:'+'\x20'+importError['messa'+'ge']);}catch{console['warn']('[Temp'+'oralD'+_0x110777(0xf4)+'on]\x20P'+_0x110777(0x14f)+_0x110777(0xf2)+'\x20logg'+_0x110777(0xd4)+'avail'+'able:'+'\x20'+importError['messa'+'ge']);}}),_0x16cf47;}if(_0x1fddc7){this[_0x371a31(0xb6)+'rompt'+'Time']=Date[_0x371a31(0x9d)]();const _0x10602d={};_0x10602d[_0x371a31(0x105)+'dProm'+'pt']=!![],_0x10602d['reaso'+'n']='Coher'+'ence\x20'+_0x371a31(0x121)+_0x371a31(0xec)+'ted\x20('+'quali'+'ty\x20is'+'sue)',_0x10602d[_0x371a31(0x148)+'cy']=_0x371a31(0x104);const _0x1b8f8c=_0x10602d;return import('./uti'+_0x371a31(0x150)+_0x371a31(0xb5)+'ance-'+'logge'+'r.mjs')['then'](({logTemporalDecision:_0x2e2cce})=>{const _0x1c94d0=_0x371a31,_0x5f08da={};_0x5f08da['shoul'+_0x1c94d0(0xf1)+'pt']=_0x1b8f8c['shoul'+_0x1c94d0(0xf1)+'pt'],_0x5f08da[_0x1c94d0(0xf7)+'n']=_0x1b8f8c['reaso'+'n'],_0x5f08da['urgen'+'cy']=_0x1b8f8c['urgen'+'cy'],_0x5f08da[_0x1c94d0(0x102)+_0x1c94d0(0xe0)]=_0x337586,_0x5f08da[_0x1c94d0(0x133)+_0x1c94d0(0xb0)+'e']=_0x5651b0,_0x5f08da[_0x1c94d0(0x106)+_0x1c94d0(0xc4)]=_0x738124[_0x1c94d0(0xc5)+'h'],_0x5f08da[_0x1c94d0(0xa4)+'ision'+'Point']=![],_0x5f08da['hasUs'+'erAct'+_0x1c94d0(0xe9)]=_0x1a165a,_0x2e2cce(_0x5f08da);})['catch'](async importError=>{const _0x149e40=_0x371a31;if(process['env']['DEBUG'+'_TEMP'+_0x149e40(0xcf)])try{const {warn:_0x292db7}=await import(_0x149e40(0x14e)+'ger.m'+'js');_0x292db7('[Temp'+_0x149e40(0xbf)+'ecisi'+_0x149e40(0x111)+'erfor'+_0x149e40(0xf2)+'\x20logg'+'er\x20un'+_0x149e40(0xe7)+_0x149e40(0x103)+'\x20'+importError['messa'+'ge']);}catch{console[_0x149e40(0x114)](_0x149e40(0x153)+_0x149e40(0xbf)+_0x149e40(0xf4)+'on]\x20P'+'erfor'+_0x149e40(0xf2)+_0x149e40(0xd8)+_0x149e40(0xd4)+'avail'+'able:'+'\x20'+importError[_0x149e40(0x122)+'ge']);}}),_0x1b8f8c;}if(_0x1a165a&&_0x5651b0>this[_0x371a31(0x133)+_0x371a31(0xb0)+'eThre'+_0x371a31(0xd1)]){this[_0x371a31(0xb6)+_0x371a31(0xeb)+'Time']=Date['now']();const _0x2e61cb={};return _0x2e61cb[_0x371a31(0x105)+_0x371a31(0xf1)+'pt']=!![],_0x2e61cb['reaso'+'n']=_0x371a31(0xae)+'actio'+'n\x20wit'+'h\x20sig'+_0x371a31(0xce)+'ant\x20s'+_0x371a31(0xe5)+_0x371a31(0xd9)+'e',_0x2e61cb[_0x371a31(0x148)+'cy']='mediu'+'m',_0x2e61cb;}if(_0x337586>=this[_0x371a31(0x102)+_0x371a31(0x130)+_0x371a31(0x12c)+'old']&&_0x5651b0>this[_0x371a31(0x133)+_0x371a31(0xb0)+_0x371a31(0x100)+_0x371a31(0xd1)]){this[_0x371a31(0xb6)+_0x371a31(0xeb)+'Time']=Date[_0x371a31(0x9d)]();const _0x1da2c0={};return _0x1da2c0['shoul'+'dProm'+'pt']=!![],_0x1da2c0[_0x371a31(0xf7)+'n']='Stabl'+'e\x20con'+'text\x20'+_0x371a31(0xb8)+'signi'+_0x371a31(0xad)+'t\x20sta'+'te\x20ch'+'ange',_0x1da2c0[_0x371a31(0x148)+'cy']=_0x371a31(0xee)+'m',_0x1da2c0;}return{'shouldPrompt':![],'reason':'Conte'+'xt\x20no'+_0x371a31(0xc3)+'ficie'+_0x371a31(0x108)+_0x371a31(0x13c)+'nce:\x20'+_0x337586['toFix'+'ed'](0x2)+(_0x371a31(0xc9)+'teCha'+_0x371a31(0xbd))+_0x5651b0[_0x371a31(0x134)+'ed'](0x2)+')','urgency':_0x371a31(0x10f)};}[_0x1b09bb(0x127)](){const _0x1eba46=_0x1b09bb;this[_0x1eba46(0x10c)+_0x1eba46(0xc4)]=0x0,this[_0x1eba46(0xb6)+'rompt'+_0x1eba46(0x116)]=null;}[_0x1b09bb(0xed)+'lateS'+'tateC'+'hange'](_0x351bcf,_0x3fcaa9){const _0x517e8b=_0x1b09bb;if(!_0x351bcf||typeof _0x351bcf!==_0x517e8b(0xd7)+'t')throw new TypeError(_0x517e8b(0x13a)+'ntSta'+_0x517e8b(0x11c)+'st\x20be'+'\x20an\x20o'+_0x517e8b(0x10e));if(!_0x3fcaa9)return 0x1;let _0x493f0e=0x0,_0x2ebb8a=0x0;if(_0x351bcf[_0x517e8b(0xa8)]!==undefined&&_0x3fcaa9[_0x517e8b(0xa8)]!==undefined){const _0x531787=typeof _0x351bcf[_0x517e8b(0xa8)]===_0x517e8b(0x149)+'r'?_0x351bcf['score']:0x0,_0x220e1b=typeof _0x3fcaa9['score']===_0x517e8b(0x149)+'r'?_0x3fcaa9['score']:0x0,_0x323d20=Math['abs'](_0x531787-_0x220e1b)/0xa;isFinite(_0x323d20)&&(_0x493f0e+=_0x323d20,_0x2ebb8a++);}if(_0x351bcf['issue'+'s']&&_0x3fcaa9['issue'+'s']){if(Array[_0x517e8b(0x109)+'ay'](_0x351bcf[_0x517e8b(0x124)+'s'])&&Array['isArr'+'ay'](_0x3fcaa9['issue'+'s'])){const _0x4d1305=new Set(_0x351bcf['issue'+'s']['map'](_0x3559de=>String(_0x3559de)['toLow'+_0x517e8b(0xdd)+'e']()['trim']())),_0x40dbd0=new Set(_0x3fcaa9['issue'+'s'][_0x517e8b(0x125)](_0x59d7c5=>String(_0x59d7c5)['toLow'+_0x517e8b(0xdd)+'e']()['trim']())),_0x271025=[..._0x4d1305]['filte'+'r'](_0xa13fb0=>!_0x40dbd0[_0x517e8b(0xbb)](_0xa13fb0))[_0x517e8b(0xc5)+'h'],_0x53b11b=[..._0x40dbd0]['filte'+'r'](_0x1eb053=>!_0x4d1305[_0x517e8b(0xbb)](_0x1eb053))['lengt'+'h'],_0x3891cc=_0x4d1305['size']+_0x40dbd0[_0x517e8b(0xfb)],_0x1b2d98=_0x3891cc>0x0?(_0x271025+_0x53b11b)/_0x3891cc:0x0;isFinite(_0x1b2d98)&&(_0x493f0e+=_0x1b2d98,_0x2ebb8a++);}}if(_0x351bcf[_0x517e8b(0x110)+'tate']&&_0x3fcaa9[_0x517e8b(0x110)+'tate']){const _0x2929c6=this['calcu'+_0x517e8b(0x11f)+_0x517e8b(0x12a)+_0x517e8b(0x135)+_0x517e8b(0xdc)](_0x351bcf['gameS'+_0x517e8b(0x139)],_0x3fcaa9[_0x517e8b(0x110)+_0x517e8b(0x139)]);isFinite(_0x2929c6)&&(_0x493f0e+=_0x2929c6,_0x2ebb8a++);}const _0x303932=_0x2ebb8a>0x0?_0x493f0e/_0x2ebb8a:0x0;return Math[_0x517e8b(0x136)](0x0,Math[_0x517e8b(0x152)](0x1,_0x303932));}[_0x1b09bb(0xed)+_0x1b09bb(0x11f)+_0x1b09bb(0x12a)+_0x1b09bb(0x135)+_0x1b09bb(0xdc)](_0x24901a,_0x1b665a){const _0x1ebb79=_0x1b09bb,_0x41de4d=Object['keys'](_0x24901a||{}),_0x66e316=Object['keys'](_0x1b665a||{}),_0x225d99=_0x41de4d['filte'+'r'](_0x24ba5c=>!_0x66e316['inclu'+_0x1ebb79(0x132)](_0x24ba5c))['lengt'+'h'],_0x1cf14c=_0x66e316[_0x1ebb79(0xfd)+'r'](_0x5de59c=>!_0x41de4d['inclu'+_0x1ebb79(0x132)](_0x5de59c))['lengt'+'h'],_0x1879c3=_0x41de4d['filte'+'r'](_0x5e375f=>_0x66e316[_0x1ebb79(0x140)+_0x1ebb79(0x132)](_0x5e375f)&&JSON['strin'+'gify'](_0x24901a[_0x5e375f])!==JSON['strin'+_0x1ebb79(0x11e)](_0x1b665a[_0x5e375f]))[_0x1ebb79(0xc5)+'h'],_0x448a8f=new Set([..._0x41de4d,..._0x66e316])[_0x1ebb79(0xfb)];return _0x448a8f>0x0?(_0x225d99+_0x1cf14c+_0x1879c3)/_0x448a8f:0x0;}['hasRe'+_0x1b09bb(0x11b)+_0x1b09bb(0x128)+_0x1b09bb(0xba)](_0x4997f3,_0x57c92a){const _0x5b2129=_0x1b09bb;if(_0x57c92a[_0x5b2129(0x119)+_0x5b2129(0xff)+'on'])return!![];const _0x4e0cad=_0x4997f3['slice'](-0x3);return _0x4e0cad[_0x5b2129(0x11a)](_0xff9917=>{const _0x5a6417=_0x5b2129,_0x4752b8=String(_0xff9917['step']||''),_0x3de44c=String(_0xff9917['obser'+_0x5a6417(0x146)+'n']||'');return _0x4752b8[_0x5a6417(0x140)+'des'](_0x5a6417(0xe4)+_0x5a6417(0xc7)+'n')||_0x4752b8[_0x5a6417(0x140)+_0x5a6417(0x132)]('click')||_0x4752b8[_0x5a6417(0x140)+_0x5a6417(0x132)]('actio'+'n')||_0x3de44c['inclu'+_0x5a6417(0x132)](_0x5a6417(0x12e))||_0x3de44c['inclu'+_0x5a6417(0x132)]('click'+'ed');});}[_0x1b09bb(0xa4)+_0x1b09bb(0x13e)+'Point'](_0x5ae162,_0x1e3f8d){const _0x5ae20e=_0x1b09bb;if(_0x1e3f8d['stage']==='decis'+'ion'||_0x1e3f8d['stage']==='evalu'+'ation')return!![];if(_0x1e3f8d[_0x5ae20e(0xa7)+'ype']===_0x5ae20e(0x123)+_0x5ae20e(0xea)||_0x1e3f8d[_0x5ae20e(0x123)+_0x5ae20e(0xea)])return!![];if(_0x1e3f8d[_0x5ae20e(0xcb)]&&_0x1e3f8d[_0x5ae20e(0xa5)+_0x5ae20e(0xf5)+_0x5ae20e(0xd3)])return!![];return![];}async['detec'+_0x1b09bb(0xc2)+'rence'+'Drop'](_0x2fc498,_0x118fa5){const _0x518f5e=_0x1b09bb;if(_0x2fc498['lengt'+'h']<0x4)return![];const _0x1c6d8f=_0x2fc498[_0x518f5e(0x145)](0x0,-0x1),_0x187b9c=await aggregateTemporalNotes(_0x1c6d8f),_0x2c80b7=_0x187b9c['coher'+'ence']||0x1,_0x511128=_0x118fa5[_0x518f5e(0x102)+'ence']||0x1,_0x31007d=_0x2c80b7-_0x511128;return _0x31007d>this[_0x518f5e(0x148)+_0x518f5e(0xb2)+_0x518f5e(0x141)+'d'];}['calcu'+_0x1b09bb(0x13b)+'rompt'+_0x1b09bb(0x131)+'cy'](_0x3d9aba,_0x6c48a6){const _0x3b2ff1=_0x1b09bb;if(_0x6c48a6[_0x3b2ff1(0x148)+'cy']===_0x3b2ff1(0x104))return 0x1;if(_0x6c48a6[_0x3b2ff1(0x148)+'cy']===_0x3b2ff1(0xee)+'m')return 0.6;const _0x515916=_0x3d9aba[_0x3b2ff1(0x102)+_0x3b2ff1(0xe0)]||0x0,_0x391985=_0x3d9aba[_0x3b2ff1(0x115)+'inceL'+'astPr'+'ompt']||0x0;if(_0x515916>0.7&&_0x391985>0x1388)return 0.4;return 0.2;}async['selec'+_0x1b09bb(0xf6)+_0x1b09bb(0x117)+_0x1b09bb(0x9f)](_0xf57d24,_0x5a7581){const _0x31c06e=_0x1b09bb,_0x9fa99=await Promise['all'](_0xf57d24[_0x31c06e(0x125)](async _0x49cacc=>({'request':_0x49cacc,'decision':await this[_0x31c06e(0x105)+'dProm'+'pt'](_0x49cacc[_0x31c06e(0x13a)+'ntSta'+'te'],_0x49cacc[_0x31c06e(0x107)+_0x31c06e(0xa1)+'ate'],_0x49cacc[_0x31c06e(0x11d)+'ralNo'+'tes']||[],_0x49cacc[_0x31c06e(0xcc)+'xt']||{})}))),_0x5a4bf0=_0x9fa99[_0x31c06e(0xfd)+'r'](_0x3f0e2b=>_0x3f0e2b['decis'+'ion'][_0x31c06e(0x148)+'cy']===_0x31c06e(0x104)),_0xd465b6=_0x9fa99[_0x31c06e(0xfd)+'r'](_0x46a515=>_0x46a515['decis'+_0x31c06e(0xe9)][_0x31c06e(0x148)+'cy']==='mediu'+'m'),_0x11acf7=_0x9fa99[_0x31c06e(0xfd)+'r'](_0x1c6bfe=>_0x1c6bfe['decis'+'ion']['urgen'+'cy']==='low'),_0x5a765c=_0x5a7581[_0x31c06e(0x102)+'ence']>0.7,_0x3ebd9e=_0x5a765c&&_0xd465b6[_0x31c06e(0xc5)+'h']+_0x11acf7[_0x31c06e(0xc5)+'h']>0x1;return{'promptNow':_0x5a4bf0['map'](_0xbf4e8e=>_0xbf4e8e['reque'+'st']),'batch':_0x3ebd9e?[..._0xd465b6,..._0x11acf7]['map'](_0x3bb839=>_0x3bb839[_0x31c06e(0xfa)+'st']):_0xd465b6[_0x31c06e(0x125)](_0x3079a4=>_0x3079a4['reque'+'st']),'wait':_0x3ebd9e?[]:_0x11acf7['map'](_0xde7db1=>_0xde7db1[_0x31c06e(0xfa)+'st']),'decisions':_0x9fa99};}}export function createTemporalDecisionManager(_0xeb1097={}){return new TemporalDecisionManager(_0xeb1097);}
|
|
1
|
+
const _0x55f708=_0xb470;(function(_0x57e6b4,_0xe12072){const _0xc7c12e=_0xb470,_0x1e1432=_0x57e6b4();while(!![]){try{const _0x1d86f0=-parseInt(_0xc7c12e(0x1c3))/0x1*(-parseInt(_0xc7c12e(0x210))/0x2)+parseInt(_0xc7c12e(0x1e7))/0x3*(parseInt(_0xc7c12e(0x198))/0x4)+-parseInt(_0xc7c12e(0x21a))/0x5*(-parseInt(_0xc7c12e(0x1aa))/0x6)+-parseInt(_0xc7c12e(0x1d1))/0x7*(parseInt(_0xc7c12e(0x208))/0x8)+-parseInt(_0xc7c12e(0x234))/0x9*(parseInt(_0xc7c12e(0x1c8))/0xa)+parseInt(_0xc7c12e(0x19f))/0xb*(-parseInt(_0xc7c12e(0x224))/0xc)+parseInt(_0xc7c12e(0x1dd))/0xd*(parseInt(_0xc7c12e(0x1d3))/0xe);if(_0x1d86f0===_0xe12072)break;else _0x1e1432['push'](_0x1e1432['shift']());}catch(_0x47dec3){_0x1e1432['push'](_0x1e1432['shift']());}}}(_0x2612,0xa856a));function _0x2612(){const _0x4aca18=['y2fSy3u','C3vLkq','DxjNzw4','zcbTDxm','BwLUtM8','BwvKAxu','y29UC3q','C3rHDgu','CM9TChq','Aw5JBhu','DcbZDge','zxiGDw4','D2fYBvm','BwjLCIW','B2HLCMu','v2fYBs0','BwvZC2e','B2nLC3m','CMvHC28','Dgf0zsa','BNvTyMu','BwfUy2u','zw5Jzq','DfbYB2i','CMvHy2G','EhqGBM8','DguGy2G','y2XPy2S','zMLJAwu','BM93','xsWGz28','zgv0zwm','BM90zum','B2LUDca','mtqYmJG0AKXHr25j','DgvTCg8','y29Ozxi','BwLU','z2fTzvm','Bg93','zfbYB20','mtiXntGZAKPgwNDh','y3vYCMu','BwfW','zw52','DMf0Aw8','BgvUz3q','zsbPBNq','Aw9Uiha','D2L0Aca','q29UDgu','y29UDgu','mJaWnhnSEfffyq','ywn0Aw8','oIbmte0','DgvZrM8','BIbBmcW','CMvXDwu','BNqGBM8','yxrPB24','ywjPBgK','DgvZicG','rgvJAxm','B25Difa','C2XPy2u','zgvZ','y2fS','AhjLC2G','zxjby3q','Dgf0zum','DgvZDfq','DgfYDfm','idWG','ywXS','Dg9gAxG','zsbTDxm','CxvHBgK','mtv2t3f2qwy','C2LNBMK','revcvuC','igDVDdO','C3rLCem','mZa3meXPteLXvG','C2HVBgq','ChqGBxu','C3rYAw4','zwnPC2K','CLbYB20','B2jQzwm','yw5Nzq','BNrtDge','ntC4mMvssKTeAa','Axnezwm','mte3nLPMEKz2EG','zwDLCG','CMvNyxq','DhjPBq','lI9SB2C','C2HVDwW','Aw50zxi','AxnbCNi','C3rHCNq','x2XHC3q','nZiZntHuD1fwtxK','ChjLChi','yxrLq2G','Bwf4','AgfUz2u','B3vUDa','DgvZig0','Bg9Nz2u','AxnZDwu','BMLMAwm','mtvNy3zgvgS','y2f0y2G','y2vUDfu','z290oIa','igjLigK','CYbNB28','B2jZzxi','Dgv4Dca','x1rftva','AgfZuMu','C3qGyMu','AxzLu2e','Dgf0zq','yxzHAwW','AxnjBNq','vxnLCIa','Bwf4v2e','ywjSztO','BgfZDfa','z2LMEq','ksSPkYK','C2L6zq','zMLJyw4','DxnLCG','AxrPDMu','BxbSAw4','zxjdyxm','B2XK','CMzVCM0','C2vYqwm','DgvKicG','DgLVBG','C3rbz2C','mJu5mKjTqMjNzW','zMLSDgu','zvrOCMu','B3jHBeq','yw5Jzs0','yxbWBhK','igXVz2C','ysbWB3m','mtm1mtqWEMnjqxzo','AxnPB24','CI5TANm','z29HBem','y3LuAhi','BwfSvgK','zw5Jzvq','BhKP','CMvZzxq','Aw5N','ndu1EhHdt3rd','z29HBa','CMfStM8','A2v5CW','Aw9U','zcbLyxi','DhKGAxm','zxjMB3i','w1rLBxa','Bgf0zva','mtiWBenZBfr2','z2v0rMe','zgvJAxm','lI91DgK','zxnOB2W','AgLNAa','q2HHBMC','lcaXxsW','AgfZvxm','DgvWCW','rhjVCa','DgvZ','ug9PBNq','CMvJzw4','C2nVCMu','ywrHChq','mtGYmJv1C1Doz1q','z2vYlM0','vgLTzq','AxruAw0','zsbPBIa','Dg9mB3C','BhmVCgu'];_0x2612=function(){return _0x4aca18;};return _0x2612();}function _0xb470(_0x427df8,_0x308251){const _0xe258d=_0x2612();return _0xb470=function(_0x37d37c,_0x324166){_0x37d37c=_0x37d37c-0x188;let _0x261217=_0xe258d[_0x37d37c];if(_0xb470['brBgzx']===undefined){var _0xb47034=function(_0x39d087){const _0xf9af6c='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x29049d='',_0x48f7b6='',_0xbb3dcc=_0x29049d+_0xb47034;for(let _0x127d41=0x0,_0x5a8d7b,_0x550abe,_0x1af9fc=0x0;_0x550abe=_0x39d087['charAt'](_0x1af9fc++);~_0x550abe&&(_0x5a8d7b=_0x127d41%0x4?_0x5a8d7b*0x40+_0x550abe:_0x550abe,_0x127d41++%0x4)?_0x29049d+=_0xbb3dcc['charCodeAt'](_0x1af9fc+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x5a8d7b>>(-0x2*_0x127d41&0x6)):_0x127d41:0x0){_0x550abe=_0xf9af6c['indexOf'](_0x550abe);}for(let _0x4d3455=0x0,_0xb9315e=_0x29049d['length'];_0x4d3455<_0xb9315e;_0x4d3455++){_0x48f7b6+='%'+('00'+_0x29049d['charCodeAt'](_0x4d3455)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x48f7b6);};_0xb470['NGiBkl']=_0xb47034,_0x427df8=arguments,_0xb470['brBgzx']=!![];}const _0xd4887a=_0xe258d[0x0],_0x28ba7c=_0x37d37c+_0xd4887a,_0x4b0b42=_0x427df8[_0x28ba7c];if(!_0x4b0b42){const _0x150e1c=function(_0x370deb){this['ZQTleU']=_0x370deb,this['LCNZrc']=[0x1,0x0,0x0],this['nBeCkc']=function(){return'newState';},this['MEtLlt']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['pJZqxm']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x150e1c['prototype']['nVXhua']=function(){const _0x563a7d=new RegExp(this['MEtLlt']+this['pJZqxm']),_0x7b8cd9=_0x563a7d['test'](this['nBeCkc']['toString']())?--this['LCNZrc'][0x1]:--this['LCNZrc'][0x0];return this['VTtMsi'](_0x7b8cd9);},_0x150e1c['prototype']['VTtMsi']=function(_0x15e31d){if(!Boolean(~_0x15e31d))return _0x15e31d;return this['eWnqAG'](this['ZQTleU']);},_0x150e1c['prototype']['eWnqAG']=function(_0x472293){for(let _0x4f37c5=0x0,_0x161a97=this['LCNZrc']['length'];_0x4f37c5<_0x161a97;_0x4f37c5++){this['LCNZrc']['push'](Math['round'](Math['random']())),_0x161a97=this['LCNZrc']['length'];}return _0x472293(this['LCNZrc'][0x0]);},new _0x150e1c(_0xb470)['nVXhua'](),_0x261217=_0xb470['NGiBkl'](_0x261217),_0x427df8[_0x28ba7c]=_0x261217;}else _0x261217=_0x4b0b42;return _0x261217;},_0xb470(_0x427df8,_0x308251);}const _0x324166=(function(){let _0x150e1c=!![];return function(_0x370deb,_0x563a7d){const _0x7b8cd9=_0x150e1c?function(){const _0x5e76f4=_0xb470;if(_0x563a7d){const _0x15e31d=_0x563a7d[_0x5e76f4(0x20d)](_0x370deb,arguments);return _0x563a7d=null,_0x15e31d;}}:function(){};return _0x150e1c=![],_0x7b8cd9;};}()),_0x37d37c=_0x324166(this,function(){const _0x5c5915=_0xb470;return _0x37d37c['toStr'+_0x5c5915(0x219)]()['searc'+'h']('(((.+'+_0x5c5915(0x1fb)+'+$')['toStr'+_0x5c5915(0x219)]()[_0x5c5915(0x241)+'ructo'+'r'](_0x37d37c)['searc'+'h']('(((.+'+')+)+)'+'+$');});_0x37d37c();import{aggregateTemporalNotes}from'./temporal.mjs';import{aggregateMultiScale}from'./temporal-decision.mjs';export class TemporalDecisionManager{constructor(_0x472293={}){const _0x4c4a44=_0xb470,_0x4f37c5=_0x472293['minNo'+_0x4c4a44(0x1ad)+'rProm'+'pt']??0x3,_0x161a97=_0x472293['coher'+_0x4c4a44(0x216)+_0x4c4a44(0x1b9)+_0x4c4a44(0x202)]??0.5,_0x553236=_0x472293['urgen'+_0x4c4a44(0x214)+'eshol'+'d']??0.3,_0x4ff0cc=_0x472293[_0x4c4a44(0x1f7)+_0x4c4a44(0x237)+'e']??0x2710,_0x2b79ce=_0x472293['state'+'Chang'+'eThre'+'shold']??0.2;if(_0x4f37c5<0x1||!Number[_0x4c4a44(0x1f5)+_0x4c4a44(0x1d4)](_0x4f37c5))throw new RangeError(_0x4c4a44(0x23f)+_0x4c4a44(0x1ad)+'rProm'+_0x4c4a44(0x1ca)+_0x4c4a44(0x1f1)+'\x20a\x20po'+'sitiv'+_0x4c4a44(0x1a5)+'eger,'+_0x4c4a44(0x1c6)+'\x20'+_0x4f37c5);if(_0x161a97<0x0||_0x161a97>0x1)throw new RangeError(_0x4c4a44(0x19a)+_0x4c4a44(0x216)+_0x4c4a44(0x1b9)+'old\x20m'+'ust\x20b'+_0x4c4a44(0x238)+'[0,\x201'+_0x4c4a44(0x194)+'t:\x20'+_0x161a97);if(_0x553236<0x0||_0x553236>0x1)throw new RangeError(_0x4c4a44(0x23d)+'cyThr'+_0x4c4a44(0x228)+_0x4c4a44(0x23e)+'t\x20be\x20'+'in\x20[0'+_0x4c4a44(0x22b)+_0x4c4a44(0x1c6)+'\x20'+_0x553236);if(_0x4ff0cc<=0x0||!isFinite(_0x4ff0cc))throw new RangeError(_0x4c4a44(0x1f7)+'itTim'+_0x4c4a44(0x1c1)+'t\x20be\x20'+_0x4c4a44(0x20f)+_0x4c4a44(0x1ff)+'\x20fini'+'te\x20nu'+_0x4c4a44(0x248)+'\x20got:'+'\x20'+_0x4ff0cc);if(_0x2b79ce<0x0||_0x2b79ce>0x1)throw new RangeError('state'+'Chang'+_0x4c4a44(0x20a)+_0x4c4a44(0x1c9)+'\x20must'+_0x4c4a44(0x1eb)+_0x4c4a44(0x1ae)+'\x201],\x20'+_0x4c4a44(0x1ea)+_0x2b79ce);this[_0x4c4a44(0x23f)+_0x4c4a44(0x1ad)+_0x4c4a44(0x1cd)+'pt']=_0x4f37c5,this['coher'+_0x4c4a44(0x216)+'hresh'+_0x4c4a44(0x202)]=_0x161a97,this[_0x4c4a44(0x23d)+'cyThr'+'eshol'+'d']=_0x553236,this[_0x4c4a44(0x1f7)+_0x4c4a44(0x237)+'e']=_0x4ff0cc,this[_0x4c4a44(0x242)+_0x4c4a44(0x22a)+_0x4c4a44(0x20a)+'shold']=_0x2b79ce,this['warmS'+'tartS'+_0x4c4a44(0x22d)]=_0x472293[_0x4c4a44(0x247)+_0x4c4a44(0x1bd)+'teps']||0xa,this['adapt'+_0x4c4a44(0x1f2)+'mplin'+'g']=_0x472293[_0x4c4a44(0x233)+'iveSa'+'mplin'+'g']!==![],this[_0x4c4a44(0x1c7)+'ount']=0x0,this['lastP'+_0x4c4a44(0x243)+'Time']=null;}async[_0x55f708(0x1d8)+_0x55f708(0x19e)+'pt'](_0x193396,_0x2b2c94,_0x589faa,_0xc93fdf={}){const _0x139672=_0x55f708;if(!Array['isArr'+'ay'](_0x589faa))throw new TypeError(_0x139672(0x199)+'ralNo'+_0x139672(0x1e3)+'ust\x20b'+'e\x20an\x20'+'array');if(_0x193396===null||_0x193396===undefined)throw new TypeError(_0x139672(0x1a0)+'ntSta'+'te\x20is'+'\x20requ'+'ired');this['stepC'+_0x139672(0x1e2)]++;if(this['adapt'+_0x139672(0x1f2)+_0x139672(0x200)+'g']&&this['stepC'+_0x139672(0x1e2)]<=this[_0x139672(0x247)+'tartS'+'teps']){const _0x3d5c3a={};return _0x3d5c3a['shoul'+_0x139672(0x19e)+'pt']=!![],_0x3d5c3a[_0x139672(0x188)+'n']=_0x139672(0x24a)+_0x139672(0x1db)+'\x20step'+'\x20'+this[_0x139672(0x1c7)+'ount']+'/'+this['warmS'+_0x139672(0x1bd)+_0x139672(0x22d)]+('\x20(res'+'earch'+_0x139672(0x1ac)+_0x139672(0x1ec)+_0x139672(0x21f)+_0x139672(0x217)),_0x3d5c3a['urgen'+'cy']=_0x139672(0x240)+'m',_0x3d5c3a;}if(this[_0x139672(0x233)+'iveSa'+_0x139672(0x200)+'g']&&this['lastP'+'rompt'+'Time']){const _0xe06346=0.1,_0x10d6a2=0x1,_0xe5676b=0.1,_0x7aea3a=Math['max'](0x0,this['stepC'+_0x139672(0x1e2)]-this['warmS'+'tartS'+_0x139672(0x22d)]),_0x290548=Math[_0x139672(0x19b)](_0x10d6a2,Math['max'](_0xe5676b,Math['exp'](-_0xe06346*_0x7aea3a)));this[_0x139672(0x1dc)+'Promp'+_0x139672(0x18d)+_0x139672(0x1b2)+'ty']=_0x290548;}if(_0x589faa['lengt'+'h']<this['minNo'+'tesFo'+'rProm'+'pt']){const _0x40bbab={};return _0x40bbab['shoul'+'dProm'+'pt']=![],_0x40bbab[_0x139672(0x188)+'n']='Insuf'+'ficie'+_0x139672(0x1b0)+_0x139672(0x1b3)+_0x589faa[_0x139672(0x1a4)+'h']+_0x139672(0x1be)+this[_0x139672(0x23f)+_0x139672(0x1ad)+_0x139672(0x1cd)+'pt']+')',_0x40bbab[_0x139672(0x23d)+'cy']=_0x139672(0x19d),_0x40bbab;}let _0x5d5d57;this[_0x139672(0x1de)+'ocess'+'or']?_0x5d5d57=await this['prepr'+_0x139672(0x24c)+'or'][_0x139672(0x225)+_0x139672(0x207)+_0x139672(0x1d5)+_0x139672(0x21e)](_0x589faa):_0x5d5d57=await aggregateTemporalNotes(_0x589faa);const _0x14e4de=_0x5d5d57['coher'+_0x139672(0x18c)]||0x0,_0x3f3d8e=this['calcu'+'lateS'+_0x139672(0x1bb)+'hange'](_0x193396,_0x2b2c94),_0x4d33a0=this['hasRe'+_0x139672(0x1e9)+_0x139672(0x204)+'tion'](_0x589faa,_0xc93fdf),_0x240936=this['isDec'+_0x139672(0x211)+'Point'](_0x193396,_0xc93fdf),_0x4be758=await this['detec'+'tCohe'+'rence'+_0x139672(0x22e)](_0x589faa,_0x5d5d57);if(_0x240936){this['lastP'+'rompt'+'Time']=Date[_0x139672(0x193)]();const _0x2c8070={};_0x2c8070['shoul'+_0x139672(0x19e)+'pt']=!![],_0x2c8070[_0x139672(0x188)+'n']=_0x139672(0x1b4)+_0x139672(0x1a6)+_0x139672(0x197)+_0x139672(0x18e)+'ed',_0x2c8070['urgen'+'cy']=_0x139672(0x229);const _0x4b0688=_0x2c8070;return import('./uti'+'ls/pe'+_0x139672(0x203)+_0x139672(0x20c)+'logge'+'r.mjs')['then'](({logTemporalDecision:_0x2ebe4e})=>{const _0x3c648e=_0x139672,_0xac872f={};_0xac872f['shoul'+_0x3c648e(0x19e)+'pt']=_0x4b0688[_0x3c648e(0x1d8)+_0x3c648e(0x19e)+'pt'],_0xac872f[_0x3c648e(0x188)+'n']=_0x4b0688[_0x3c648e(0x188)+'n'],_0xac872f[_0x3c648e(0x23d)+'cy']=_0x4b0688[_0x3c648e(0x23d)+'cy'],_0xac872f['coher'+_0x3c648e(0x18c)]=_0x14e4de,_0xac872f[_0x3c648e(0x242)+_0x3c648e(0x22a)+'e']=_0x3f3d8e,_0xac872f[_0x3c648e(0x196)+_0x3c648e(0x1e2)]=_0x589faa['lengt'+'h'],_0xac872f[_0x3c648e(0x1d2)+'ision'+_0x3c648e(0x230)]=!![],_0xac872f['hasUs'+_0x3c648e(0x1ba)+'ion']=_0x4d33a0,_0x2ebe4e(_0xac872f);})[_0x139672(0x1e8)](async importError=>{const _0x3691a5=_0x139672;if(process[_0x3691a5(0x1a2)][_0x3691a5(0x1c5)+_0x3691a5(0x1ef)+'ORAL'])try{const {warn:_0x204e9f}=await import(_0x3691a5(0x1d7)+_0x3691a5(0x235)+'js');_0x204e9f(_0x3691a5(0x222)+'oralD'+_0x3691a5(0x1cc)+_0x3691a5(0x1b5)+_0x3691a5(0x221)+_0x3691a5(0x18b)+_0x3691a5(0x20e)+_0x3691a5(0x246)+_0x3691a5(0x1f4)+_0x3691a5(0x1f8)+'\x20'+importError[_0x3691a5(0x24b)+'ge']);}catch{console['warn'](_0x3691a5(0x222)+'oralD'+'ecisi'+_0x3691a5(0x1b5)+_0x3691a5(0x221)+_0x3691a5(0x18b)+_0x3691a5(0x20e)+_0x3691a5(0x246)+'avail'+'able:'+'\x20'+importError['messa'+'ge']);}}),_0x4b0688;}if(_0x4be758){this[_0x139672(0x1f9)+'rompt'+_0x139672(0x236)]=Date[_0x139672(0x193)]();const _0x1ee8b6={};_0x1ee8b6['shoul'+'dProm'+'pt']=!![],_0x1ee8b6['reaso'+'n']='Coher'+'ence\x20'+'drop\x20'+_0x139672(0x195)+_0x139672(0x205)+_0x139672(0x1c2)+_0x139672(0x220)+_0x139672(0x23c),_0x1ee8b6['urgen'+'cy']=_0x139672(0x229);const _0x2b3c70=_0x1ee8b6;return import(_0x139672(0x227)+_0x139672(0x23a)+_0x139672(0x203)+_0x139672(0x20c)+_0x139672(0x1e4)+_0x139672(0x212))['then'](({logTemporalDecision:_0x6adeb2})=>{const _0x2aa9cb=_0x139672,_0x418c8c={};_0x418c8c['shoul'+_0x2aa9cb(0x19e)+'pt']=_0x2b3c70[_0x2aa9cb(0x1d8)+_0x2aa9cb(0x19e)+'pt'],_0x418c8c['reaso'+'n']=_0x2b3c70[_0x2aa9cb(0x188)+'n'],_0x418c8c['urgen'+'cy']=_0x2b3c70[_0x2aa9cb(0x23d)+'cy'],_0x418c8c[_0x2aa9cb(0x19a)+_0x2aa9cb(0x18c)]=_0x14e4de,_0x418c8c[_0x2aa9cb(0x242)+_0x2aa9cb(0x22a)+'e']=_0x3f3d8e,_0x418c8c[_0x2aa9cb(0x196)+'ount']=_0x589faa['lengt'+'h'],_0x418c8c[_0x2aa9cb(0x1d2)+'ision'+_0x2aa9cb(0x230)]=![],_0x418c8c[_0x2aa9cb(0x22c)+'erAct'+_0x2aa9cb(0x21e)]=_0x4d33a0,_0x6adeb2(_0x418c8c);})[_0x139672(0x1e8)](async importError=>{const _0x59ff94=_0x139672;if(process['env']['DEBUG'+'_TEMP'+'ORAL'])try{const {warn:_0x3201b0}=await import(_0x59ff94(0x1d7)+'ger.m'+'js');_0x3201b0(_0x59ff94(0x222)+'oralD'+_0x59ff94(0x1cc)+'on]\x20P'+_0x59ff94(0x221)+_0x59ff94(0x18b)+'\x20logg'+'er\x20un'+_0x59ff94(0x1f4)+'able:'+'\x20'+importError[_0x59ff94(0x24b)+'ge']);}catch{console['warn']('[Temp'+_0x59ff94(0x20b)+_0x59ff94(0x1cc)+'on]\x20P'+_0x59ff94(0x221)+'mance'+_0x59ff94(0x20e)+'er\x20un'+_0x59ff94(0x1f4)+'able:'+'\x20'+importError['messa'+'ge']);}}),_0x2b3c70;}if(_0x4d33a0&&_0x3f3d8e>this['state'+_0x139672(0x22a)+'eThre'+'shold']){this['lastP'+'rompt'+'Time']=Date['now']();const _0x395af7={};return _0x395af7[_0x139672(0x1d8)+'dProm'+'pt']=!![],_0x395af7['reaso'+'n']=_0x139672(0x1f6)+_0x139672(0x1ab)+'n\x20wit'+'h\x20sig'+_0x139672(0x1e6)+'ant\x20s'+_0x139672(0x189)+'chang'+'e',_0x395af7['urgen'+'cy']=_0x139672(0x240)+'m',_0x395af7;}if(_0x14e4de>=this[_0x139672(0x19a)+'enceT'+'hresh'+_0x139672(0x202)]&&_0x3f3d8e>this['state'+'Chang'+'eThre'+_0x139672(0x1c9)]){this[_0x139672(0x1f9)+_0x139672(0x243)+_0x139672(0x236)]=Date['now']();const _0x4ea970={};return _0x4ea970['shoul'+_0x139672(0x19e)+'pt']=!![],_0x4ea970[_0x139672(0x188)+'n']='Stabl'+'e\x20con'+_0x139672(0x1ee)+_0x139672(0x1a7)+_0x139672(0x1c4)+_0x139672(0x1fd)+_0x139672(0x245)+_0x139672(0x190)+_0x139672(0x1cf),_0x4ea970[_0x139672(0x23d)+'cy']='mediu'+'m',_0x4ea970;}return{'shouldPrompt':![],'reason':_0x139672(0x1a8)+_0x139672(0x18f)+'t\x20suf'+_0x139672(0x192)+'nt\x20(c'+_0x139672(0x249)+'nce:\x20'+_0x14e4de[_0x139672(0x1c0)+'ed'](0x2)+(',\x20sta'+'teCha'+'nge:\x20')+_0x3f3d8e['toFix'+'ed'](0x2)+')','urgency':_0x139672(0x19d)};}[_0x55f708(0x218)](){const _0x5cdb9a=_0x55f708;this['stepC'+'ount']=0x0,this['lastP'+_0x5cdb9a(0x243)+'Time']=null;}[_0x55f708(0x23b)+'lateS'+_0x55f708(0x1bb)+_0x55f708(0x1e1)](_0x3320bf,_0x1f560d){const _0x16d9e6=_0x55f708;if(!_0x3320bf||typeof _0x3320bf!==_0x16d9e6(0x1ce)+'t')throw new TypeError(_0x16d9e6(0x1a0)+'ntSta'+'te\x20mu'+'st\x20be'+'\x20an\x20o'+'bject');if(!_0x1f560d)return 0x1;let _0x2e5145=0x0,_0x1b0657=0x0;if(_0x3320bf[_0x16d9e6(0x232)]!==undefined&&_0x1f560d['score']!==undefined){const _0x10a6c4=typeof _0x3320bf[_0x16d9e6(0x232)]===_0x16d9e6(0x18a)+'r'?_0x3320bf['score']:0x0,_0x17731b=typeof _0x1f560d['score']===_0x16d9e6(0x18a)+'r'?_0x1f560d['score']:0x0,_0x533f44=Math['abs'](_0x10a6c4-_0x17731b)/0xa;isFinite(_0x533f44)&&(_0x2e5145+=_0x533f44,_0x1b0657++);}if(_0x3320bf['issue'+'s']&&_0x1f560d['issue'+'s']){if(Array['isArr'+'ay'](_0x3320bf[_0x16d9e6(0x1e5)+'s'])&&Array[_0x16d9e6(0x1da)+'ay'](_0x1f560d[_0x16d9e6(0x1e5)+'s'])){const _0x34d627=new Set(_0x3320bf[_0x16d9e6(0x1e5)+'s'][_0x16d9e6(0x1a1)](_0x7bffbf=>String(_0x7bffbf)[_0x16d9e6(0x239)+_0x16d9e6(0x201)+'e']()[_0x16d9e6(0x1d6)]())),_0x5538d6=new Set(_0x1f560d[_0x16d9e6(0x1e5)+'s'][_0x16d9e6(0x1a1)](_0x5a8b15=>String(_0x5a8b15)[_0x16d9e6(0x239)+'erCas'+'e']()[_0x16d9e6(0x1d6)]())),_0x4c4f80=[..._0x34d627][_0x16d9e6(0x209)+'r'](_0x3486cc=>!_0x5538d6['has'](_0x3486cc))[_0x16d9e6(0x1a4)+'h'],_0x3a4d15=[..._0x5538d6]['filte'+'r'](_0xef5a03=>!_0x34d627['has'](_0xef5a03))['lengt'+'h'],_0x572281=_0x34d627['size']+_0x5538d6[_0x16d9e6(0x1fc)],_0x4579d4=_0x572281>0x0?(_0x4c4f80+_0x3a4d15)/_0x572281:0x0;isFinite(_0x4579d4)&&(_0x2e5145+=_0x4579d4,_0x1b0657++);}}if(_0x3320bf['gameS'+'tate']&&_0x1f560d[_0x16d9e6(0x19c)+'tate']){const _0x362709=this[_0x16d9e6(0x23b)+'lateG'+'ameSt'+'ateCh'+_0x16d9e6(0x1cf)](_0x3320bf[_0x16d9e6(0x19c)+'tate'],_0x1f560d['gameS'+_0x16d9e6(0x1f3)]);isFinite(_0x362709)&&(_0x2e5145+=_0x362709,_0x1b0657++);}const _0x4d47a3=_0x1b0657>0x0?_0x2e5145/_0x1b0657:0x0;return Math[_0x16d9e6(0x1e0)](0x0,Math[_0x16d9e6(0x19b)](0x1,_0x4d47a3));}['calcu'+'lateG'+'ameSt'+_0x55f708(0x1df)+'ange'](_0x469cc2,_0x36b1f4){const _0x56a93d=_0x55f708,_0xbe7a43=Object['keys'](_0x469cc2||{}),_0x23139b=Object[_0x56a93d(0x21d)](_0x36b1f4||{}),_0x285d60=_0xbe7a43['filte'+'r'](_0x1f0982=>!_0x23139b['inclu'+_0x56a93d(0x1b7)](_0x1f0982))[_0x56a93d(0x1a4)+'h'],_0x7b0d0b=_0x23139b['filte'+'r'](_0x39a2b0=>!_0xbe7a43['inclu'+_0x56a93d(0x1b7)](_0x39a2b0))[_0x56a93d(0x1a4)+'h'],_0x5abaac=_0xbe7a43['filte'+'r'](_0xf01122=>_0x23139b[_0x56a93d(0x244)+_0x56a93d(0x1b7)](_0xf01122)&&JSON[_0x56a93d(0x1cb)+_0x56a93d(0x1fa)](_0x469cc2[_0xf01122])!==JSON['strin'+_0x56a93d(0x1fa)](_0x36b1f4[_0xf01122]))[_0x56a93d(0x1a4)+'h'],_0x1517d4=new Set([..._0xbe7a43,..._0x23139b])['size'];return _0x1517d4>0x0?(_0x285d60+_0x7b0d0b+_0x5abaac)/_0x1517d4:0x0;}[_0x55f708(0x1f0)+_0x55f708(0x1e9)+_0x55f708(0x204)+_0x55f708(0x206)](_0x1992db,_0x5514c0){const _0xf1a1a8=_0x55f708;if(_0x5514c0[_0xf1a1a8(0x231)+'tActi'+'on'])return!![];const _0x4eeca6=_0x1992db['slice'](-0x3);return _0x4eeca6['some'](_0x1beb90=>{const _0x12985e=_0xf1a1a8,_0x2ab5f9=String(_0x1beb90['step']||''),_0x47d370=String(_0x1beb90[_0x12985e(0x1ed)+_0x12985e(0x1a3)+'n']||'');return _0x2ab5f9['inclu'+_0x12985e(0x1b7)](_0x12985e(0x1d9)+'actio'+'n')||_0x2ab5f9[_0x12985e(0x244)+_0x12985e(0x1b7)](_0x12985e(0x191))||_0x2ab5f9[_0x12985e(0x244)+_0x12985e(0x1b7)](_0x12985e(0x1ab)+'n')||_0x47d370['inclu'+'des'](_0x12985e(0x1fe))||_0x47d370['inclu'+_0x12985e(0x1b7)](_0x12985e(0x191)+'ed');});}[_0x55f708(0x1d2)+_0x55f708(0x211)+_0x55f708(0x230)](_0x5ebcbc,_0x32b696){const _0x39f4eb=_0x55f708;if(_0x32b696['stage']===_0x39f4eb(0x226)+'ion'||_0x32b696['stage']==='evalu'+_0x39f4eb(0x1b1))return!![];if(_0x32b696[_0x39f4eb(0x1bc)+'ype']==='criti'+_0x39f4eb(0x1b8)||_0x32b696['criti'+_0x39f4eb(0x1b8)])return!![];if(_0x32b696[_0x39f4eb(0x21b)]&&_0x32b696[_0x39f4eb(0x213)+'omple'+'ted'])return!![];return![];}async['detec'+'tCohe'+'rence'+_0x55f708(0x22e)](_0x7cbfda,_0x28ee61){const _0xaa3d23=_0x55f708;if(_0x7cbfda[_0xaa3d23(0x1a4)+'h']<0x4)return![];const _0x43e6e1=_0x7cbfda[_0xaa3d23(0x1b6)](0x0,-0x1),_0x102f4a=await aggregateTemporalNotes(_0x43e6e1),_0x3f7a80=_0x102f4a[_0xaa3d23(0x19a)+'ence']||0x1,_0x17d66e=_0x28ee61['coher'+'ence']||0x1,_0x1c2746=_0x3f7a80-_0x17d66e;return _0x1c2746>this['urgen'+'cyThr'+_0xaa3d23(0x228)+'d'];}['calcu'+_0x55f708(0x223)+'rompt'+'Urgen'+'cy'](_0x3c6340,_0x2a7feb){const _0x15ef03=_0x55f708;if(_0x2a7feb[_0x15ef03(0x23d)+'cy']===_0x15ef03(0x229))return 0x1;if(_0x2a7feb[_0x15ef03(0x23d)+'cy']==='mediu'+'m')return 0.6;const _0x320c1a=_0x3c6340['coher'+'ence']||0x0,_0xa7d58d=_0x3c6340['timeS'+'inceL'+'astPr'+'ompt']||0x0;if(_0x320c1a>0.7&&_0xa7d58d>0x1388)return 0.4;return 0.2;}async['selec'+'tOpti'+_0x55f708(0x215)+'ming'](_0x313043,_0x34629f){const _0x1468a6=_0x55f708,_0xbce23d=await Promise[_0x1468a6(0x1bf)](_0x313043['map'](async _0x47f26f=>({'request':_0x47f26f,'decision':await this[_0x1468a6(0x1d8)+_0x1468a6(0x19e)+'pt'](_0x47f26f[_0x1468a6(0x1a0)+_0x1468a6(0x1d0)+'te'],_0x47f26f['previ'+'ousSt'+'ate'],_0x47f26f['tempo'+_0x1468a6(0x21c)+_0x1468a6(0x22f)]||[],_0x47f26f[_0x1468a6(0x1a9)+'xt']||{})}))),_0x21dc73=_0xbce23d['filte'+'r'](_0xbd83d1=>_0xbd83d1[_0x1468a6(0x226)+_0x1468a6(0x21e)]['urgen'+'cy']===_0x1468a6(0x229)),_0x48ccb4=_0xbce23d[_0x1468a6(0x209)+'r'](_0x269a0e=>_0x269a0e[_0x1468a6(0x226)+'ion']['urgen'+'cy']==='mediu'+'m'),_0x22922e=_0xbce23d[_0x1468a6(0x209)+'r'](_0x535a24=>_0x535a24['decis'+_0x1468a6(0x21e)][_0x1468a6(0x23d)+'cy']===_0x1468a6(0x19d)),_0x3c86be=_0x34629f['coher'+_0x1468a6(0x18c)]>0.7,_0x5ef18a=_0x3c86be&&_0x48ccb4[_0x1468a6(0x1a4)+'h']+_0x22922e[_0x1468a6(0x1a4)+'h']>0x1;return{'promptNow':_0x21dc73[_0x1468a6(0x1a1)](_0x46e253=>_0x46e253['reque'+'st']),'batch':_0x5ef18a?[..._0x48ccb4,..._0x22922e][_0x1468a6(0x1a1)](_0x4bb995=>_0x4bb995[_0x1468a6(0x1af)+'st']):_0x48ccb4['map'](_0x45ef98=>_0x45ef98[_0x1468a6(0x1af)+'st']),'wait':_0x5ef18a?[]:_0x22922e['map'](_0x46ffb9=>_0x46ffb9[_0x1468a6(0x1af)+'st']),'decisions':_0xbce23d};}}export function createTemporalDecisionManager(_0x4c9e5b={}){return new TemporalDecisionManager(_0x4c9e5b);}
|