@ik-firewall/core 1.0.0
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/README.md +152 -0
- package/dist/index.cjs +2425 -0
- package/dist/index.d.cts +683 -0
- package/dist/index.d.ts +683 -0
- package/dist/index.js +2393 -0
- package/package.json +44 -0
- package/scripts/download-bin.js +56 -0
- package/scripts/download-model.js +51 -0
- package/scripts/master-setup.js +102 -0
- package/scripts/robust-download.js +67 -0
- package/scripts/runtime-emulator.js +104 -0
- package/scripts/setup-runtime.js +44 -0
- package/scripts/start-ai.js +38 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,683 @@
|
|
|
1
|
+
type ModelRole = 'high_performance' | 'cost_optimized' | 'audit_layer';
|
|
2
|
+
type ProviderMode = 'openai' | 'anthropic' | 'deepseek' | 'gemini' | 'local' | 'hybrid';
|
|
3
|
+
type RuntimeStrategy = 'internal' | 'sidecar' | 'wasm';
|
|
4
|
+
type ContextMode = 'FIRST_MESSAGE' | 'EVERY_MESSAGE' | 'SYSTEM_ONLY';
|
|
5
|
+
type PromptLength = 'SHORT' | 'MEDIUM' | 'LONG';
|
|
6
|
+
type PromptType = 'TECHNICAL_ANALYSIS' | 'REASONING' | 'EXPLANATION' | 'SUMMARIZATION' | 'CODING' | 'DEBUGGING' | 'DECISION_MAKING' | 'CREATIVITY' | 'PHILOSOPHY' | 'ADVERSARIAL' | 'FUZZY_PROBLEM' | 'LEARNING_ADVICE' | 'POETRY' | 'STORY' | 'ANALYTICAL_PHILOSOPHY' | 'DEV_PROBLEM' | 'CRITICAL_THINKING' | 'HYBRID_DOMAIN' | 'INSTRUCTION_FOLLOWING' | 'REAL_WORLD_BUSINESS';
|
|
7
|
+
interface TestPrompt {
|
|
8
|
+
id: string;
|
|
9
|
+
type: PromptType;
|
|
10
|
+
length?: PromptLength;
|
|
11
|
+
title: string;
|
|
12
|
+
content: string;
|
|
13
|
+
}
|
|
14
|
+
interface IKConfig {
|
|
15
|
+
aggressiveness: number;
|
|
16
|
+
forcedEfficiency?: boolean;
|
|
17
|
+
precisionBias: number;
|
|
18
|
+
balance: number;
|
|
19
|
+
gatekeeperEnabled: boolean;
|
|
20
|
+
locale?: string;
|
|
21
|
+
providerMode: ProviderMode;
|
|
22
|
+
runtimeStrategy: RuntimeStrategy;
|
|
23
|
+
localAuditEndpoint?: string;
|
|
24
|
+
centralReportEndpoint?: string;
|
|
25
|
+
fallbackToCloudAudit?: boolean;
|
|
26
|
+
modelConfig?: {
|
|
27
|
+
modelType: '1b' | '0.5b' | 'custom';
|
|
28
|
+
modelPath?: string;
|
|
29
|
+
};
|
|
30
|
+
cqThresholds?: {
|
|
31
|
+
low: number;
|
|
32
|
+
high: number;
|
|
33
|
+
};
|
|
34
|
+
safeMode?: boolean;
|
|
35
|
+
allowedScopes?: string[];
|
|
36
|
+
customBoundaryKeywords?: string[];
|
|
37
|
+
plugins?: {
|
|
38
|
+
id: string;
|
|
39
|
+
enabled: boolean;
|
|
40
|
+
config?: any;
|
|
41
|
+
}[];
|
|
42
|
+
customContext?: string;
|
|
43
|
+
contextMode?: ContextMode;
|
|
44
|
+
instanceConfigs?: Record<string, Partial<IKConfig>>;
|
|
45
|
+
isEnabled?: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface IKPluginInfo {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
version: string;
|
|
52
|
+
author: string;
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
type: 'methodology' | 'safety' | 'utility';
|
|
55
|
+
}
|
|
56
|
+
interface IKMetrics {
|
|
57
|
+
dm: number;
|
|
58
|
+
ei: number;
|
|
59
|
+
inputLength: number;
|
|
60
|
+
precisionBoost: boolean;
|
|
61
|
+
kft: number;
|
|
62
|
+
opt: number;
|
|
63
|
+
agentDirective?: string;
|
|
64
|
+
handoff_logic?: {
|
|
65
|
+
model: string;
|
|
66
|
+
reason: string;
|
|
67
|
+
mustEscalate: boolean;
|
|
68
|
+
};
|
|
69
|
+
approach?: {
|
|
70
|
+
category: string;
|
|
71
|
+
subtype: string;
|
|
72
|
+
};
|
|
73
|
+
semanticInsights?: {
|
|
74
|
+
metaphoricalScale: number;
|
|
75
|
+
conceptualUnits: number;
|
|
76
|
+
conceptualUnitsCount: number;
|
|
77
|
+
redundancyRatio: number;
|
|
78
|
+
conceptualBlueprint: string;
|
|
79
|
+
noiseClusters?: string[];
|
|
80
|
+
toneVector?: {
|
|
81
|
+
abstraction: number;
|
|
82
|
+
directness: number;
|
|
83
|
+
density: number;
|
|
84
|
+
};
|
|
85
|
+
immutableEntities?: string[];
|
|
86
|
+
intentMode?: 'ENGINEERING' | 'CONCEPTUAL' | 'SPECIALIZED';
|
|
87
|
+
cognitiveDepth?: 'L1-DIRECT' | 'L2-ANALYTICAL' | 'L3-CONCEPTUAL' | 'HYBRID-MULTI-LAYER';
|
|
88
|
+
activeLayers?: ('L1' | 'L2' | 'L3')[];
|
|
89
|
+
precisionRequired?: boolean;
|
|
90
|
+
semanticProof?: number;
|
|
91
|
+
cognitiveKinetic?: number;
|
|
92
|
+
engine_tuning_recommendation?: string;
|
|
93
|
+
detectedDomain?: string;
|
|
94
|
+
illocutionaryPoint?: 'ASSERTIVE' | 'DIRECTIVE' | 'COMMISSIVE' | 'EXPRESSIVE' | 'DECLARATIVE';
|
|
95
|
+
rhetoricalRatio?: {
|
|
96
|
+
ethos: number;
|
|
97
|
+
pathos: number;
|
|
98
|
+
logos: number;
|
|
99
|
+
};
|
|
100
|
+
expectancyViolation?: {
|
|
101
|
+
detected: boolean;
|
|
102
|
+
reason: string;
|
|
103
|
+
shiftSeverity: number;
|
|
104
|
+
};
|
|
105
|
+
approach?: {
|
|
106
|
+
category: string;
|
|
107
|
+
subtype: string;
|
|
108
|
+
};
|
|
109
|
+
gatekeeperFlag?: string;
|
|
110
|
+
kognitiveTrace: string[];
|
|
111
|
+
kft?: number;
|
|
112
|
+
opt?: number;
|
|
113
|
+
usageMetadata?: {
|
|
114
|
+
prompt_tokens: number;
|
|
115
|
+
completion_tokens: number;
|
|
116
|
+
total_tokens: number;
|
|
117
|
+
};
|
|
118
|
+
rawAuditResponse?: string;
|
|
119
|
+
finalCrystallizedPrompt?: string;
|
|
120
|
+
requiredIQTier?: 'TIER_1' | 'TIER_2' | 'TIER_3';
|
|
121
|
+
routingReason?: string;
|
|
122
|
+
routingPath?: string;
|
|
123
|
+
cqScore?: number;
|
|
124
|
+
archetype?: 'CRYSTAL' | 'FLUID' | 'NEURAL' | 'DYNAMIC';
|
|
125
|
+
ambiguityTolerance?: number;
|
|
126
|
+
logicalFocus?: string;
|
|
127
|
+
detectedLanguage?: string;
|
|
128
|
+
boundaryScore?: number;
|
|
129
|
+
requiresHumanIntervention?: boolean;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
interface AIResponse {
|
|
133
|
+
content: string;
|
|
134
|
+
usage?: {
|
|
135
|
+
prompt_tokens: number;
|
|
136
|
+
completion_tokens: number;
|
|
137
|
+
total_tokens: number;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
type AIProvider = (prompt: string, role: ModelRole) => Promise<AIResponse>;
|
|
141
|
+
interface UsageData {
|
|
142
|
+
instanceId: string;
|
|
143
|
+
model_used: string;
|
|
144
|
+
routingPath: string;
|
|
145
|
+
input_tokens: number;
|
|
146
|
+
output_tokens: number;
|
|
147
|
+
optimized_tokens?: number;
|
|
148
|
+
tokens_saved: number;
|
|
149
|
+
cost_saved: number;
|
|
150
|
+
timestamp: string;
|
|
151
|
+
is_local: boolean;
|
|
152
|
+
cq_score: number;
|
|
153
|
+
clientOrigin?: string;
|
|
154
|
+
trace?: any;
|
|
155
|
+
}
|
|
156
|
+
interface IKHooks {
|
|
157
|
+
onDNAChange?: (dna: number) => void;
|
|
158
|
+
onAuditComplete?: (metrics: IKMetrics) => void;
|
|
159
|
+
onStatus?: (message: string) => void;
|
|
160
|
+
onUsageReported?: (usage: UsageData) => void;
|
|
161
|
+
onAuthorityExceeded?: (metrics: IKMetrics, prompt: string) => void | Promise<void>;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
declare abstract class BaseProvider {
|
|
165
|
+
/**
|
|
166
|
+
* Primary method to send a prompt to the AI model.
|
|
167
|
+
* @param prompt The constructed prompt to send.
|
|
168
|
+
* @param role The role of the model (audit_layer, cost_optimized, etc.)
|
|
169
|
+
*/
|
|
170
|
+
abstract call(prompt: string, role: ModelRole): Promise<AIResponse>;
|
|
171
|
+
/**
|
|
172
|
+
* Optional method to check if the provider is healthy.
|
|
173
|
+
*/
|
|
174
|
+
healthCheck(): Promise<boolean>;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* OpenAIProvider wraps a functional AIProvider into the BaseProvider class.
|
|
179
|
+
* This ensures backward compatibility while allowing for the new abstraction layer.
|
|
180
|
+
*/
|
|
181
|
+
declare class OpenAIProvider extends BaseProvider {
|
|
182
|
+
private functionalProvider;
|
|
183
|
+
constructor(provider: AIProvider);
|
|
184
|
+
call(prompt: string, role: ModelRole): Promise<AIResponse>;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
declare class LocalProvider extends BaseProvider {
|
|
188
|
+
private endpoint;
|
|
189
|
+
constructor(endpoint?: string);
|
|
190
|
+
call(prompt: string, role: ModelRole): Promise<AIResponse>;
|
|
191
|
+
healthCheck(): Promise<boolean>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* AnthropicProvider wraps a functional AIProvider into the BaseProvider class.
|
|
196
|
+
* This ensures the core logic can seamlessly route to Anthropic models (Claude)
|
|
197
|
+
* using the same unified abstraction layer.
|
|
198
|
+
*/
|
|
199
|
+
declare class AnthropicProvider extends BaseProvider {
|
|
200
|
+
private functionalProvider;
|
|
201
|
+
constructor(provider: AIProvider);
|
|
202
|
+
call(prompt: string, role: ModelRole): Promise<AIResponse>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* DeepSeekProvider wraps a functional AIProvider into the BaseProvider class.
|
|
207
|
+
* This ensures the core logic can seamlessly route to DeepSeek models
|
|
208
|
+
* using the same unified abstraction layer.
|
|
209
|
+
*/
|
|
210
|
+
declare class DeepSeekProvider extends BaseProvider {
|
|
211
|
+
private functionalProvider;
|
|
212
|
+
constructor(provider: AIProvider);
|
|
213
|
+
call(prompt: string, role: ModelRole): Promise<AIResponse>;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* GeminiProvider wraps a functional AIProvider into the BaseProvider class.
|
|
218
|
+
* This ensures the core logic can seamlessly route to Google Gemini models
|
|
219
|
+
* using the same unified abstraction layer.
|
|
220
|
+
*/
|
|
221
|
+
declare class GeminiProvider extends BaseProvider {
|
|
222
|
+
private functionalProvider;
|
|
223
|
+
constructor(provider: AIProvider);
|
|
224
|
+
call(prompt: string, role: ModelRole): Promise<AIResponse>;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* IK FIREWALL: THE CORE ALGORITHM (STANDALONE VERSION)
|
|
229
|
+
* Version: 2.1.0 (Modular & Provider-Agnostic)
|
|
230
|
+
*/
|
|
231
|
+
declare class IKFirewallCore {
|
|
232
|
+
private static instance;
|
|
233
|
+
static readonly CONSTANTS: {
|
|
234
|
+
DNA: {
|
|
235
|
+
MIN: number;
|
|
236
|
+
MAX: number;
|
|
237
|
+
HARDENING_SYSTEM: number;
|
|
238
|
+
HARDENING_MODERATE: number;
|
|
239
|
+
HARDENING_DOMAIN: number;
|
|
240
|
+
SOFTENING_STEP: number;
|
|
241
|
+
STRICT_THRESHOLD: number;
|
|
242
|
+
FLUID_THRESHOLD: number;
|
|
243
|
+
RANK_MIN: number;
|
|
244
|
+
RANK_MAX: number;
|
|
245
|
+
};
|
|
246
|
+
PRECISION: {
|
|
247
|
+
BIAS_DEFAULT: number;
|
|
248
|
+
METAPHOR_THRESHOLD: number;
|
|
249
|
+
REDUNDANCY_BOOST_LIMIT: number;
|
|
250
|
+
BALANCE_BOOST_THRESHOLD: number;
|
|
251
|
+
BOOST_EI_THRESHOLD: number;
|
|
252
|
+
};
|
|
253
|
+
HEURISTICS: {
|
|
254
|
+
UNIK_LENGTH_DIVISOR: number;
|
|
255
|
+
COMPLEXITY_SKIP_THRESHOLD: number;
|
|
256
|
+
INPUT_SUBSTRING_LIMIT: number;
|
|
257
|
+
};
|
|
258
|
+
AI: {
|
|
259
|
+
TEMPERATURE: number;
|
|
260
|
+
DM_LENGTH_DIVISOR: number;
|
|
261
|
+
CRYSTALLIZATION_LENGTH_RATIO: number;
|
|
262
|
+
CRYSTALLIZATION_SP_THRESHOLD: number;
|
|
263
|
+
BLUEPRINT_DENSITY_WARNING: number;
|
|
264
|
+
THRESHOLD_MIN: number;
|
|
265
|
+
THRESHOLD_MAX: number;
|
|
266
|
+
DM_THRESHOLD_DIVISOR: number;
|
|
267
|
+
AGGRESSIVENESS_WEIGHT: number;
|
|
268
|
+
};
|
|
269
|
+
TONE: {
|
|
270
|
+
CONVERSATIONAL_DIRECTNESS: number;
|
|
271
|
+
SLANG_DIRECTNESS: number;
|
|
272
|
+
ABSTRACTION_THRESHOLD: number;
|
|
273
|
+
DIRECTNESS_THRESHOLD: number;
|
|
274
|
+
STABLE_VAL: number;
|
|
275
|
+
KFT_DEFAULT: number;
|
|
276
|
+
OPT_DEFAULT: number;
|
|
277
|
+
};
|
|
278
|
+
AESTHETICS: {
|
|
279
|
+
CRYSTAL_THRESHOLD: number;
|
|
280
|
+
BRIDGE_THRESHOLD: number;
|
|
281
|
+
FLUID_THRESHOLD: number;
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
private gatekeeper;
|
|
285
|
+
private configManager;
|
|
286
|
+
private sessionDNA;
|
|
287
|
+
hooks?: IKHooks;
|
|
288
|
+
private cloudProvider?;
|
|
289
|
+
private localProvider;
|
|
290
|
+
private orchestrator;
|
|
291
|
+
private usageTracker;
|
|
292
|
+
constructor(config?: Partial<IKConfig>, hooks?: IKHooks, cloudProvider?: AIProvider | BaseProvider);
|
|
293
|
+
static getInstance(config?: Partial<IKConfig>, hooks?: IKHooks): IKFirewallCore;
|
|
294
|
+
setConfig(newConfig: Partial<IKConfig>): void;
|
|
295
|
+
getConfig(): IKConfig;
|
|
296
|
+
getPlugins(): IKPluginInfo[];
|
|
297
|
+
getSessionDNA(): number;
|
|
298
|
+
getInstanceConfigs(): Record<string, Partial<IKConfig>>;
|
|
299
|
+
setInstanceConfig(instanceId: string, config: Partial<IKConfig>): void;
|
|
300
|
+
/**
|
|
301
|
+
* Discovers available providers by checking environment variables and local health.
|
|
302
|
+
*/
|
|
303
|
+
getAvailableProviders(): Promise<{
|
|
304
|
+
[provider: string]: {
|
|
305
|
+
available: boolean;
|
|
306
|
+
reason?: string;
|
|
307
|
+
};
|
|
308
|
+
}>;
|
|
309
|
+
/**
|
|
310
|
+
* Returns the model name based on its role and current configuration.
|
|
311
|
+
*/
|
|
312
|
+
getModel(role: ModelRole): string;
|
|
313
|
+
/**
|
|
314
|
+
* Returns aggregated cognitive analytics (Stub for Phase 7).
|
|
315
|
+
*/
|
|
316
|
+
getAnalytics(): {
|
|
317
|
+
totalSavings: number;
|
|
318
|
+
tokensSaved: number;
|
|
319
|
+
roi: number;
|
|
320
|
+
sessionCount: number;
|
|
321
|
+
};
|
|
322
|
+
setSessionDNA(dna: number): void;
|
|
323
|
+
logConsumption(params: {
|
|
324
|
+
instanceId: string;
|
|
325
|
+
model: string;
|
|
326
|
+
inputTokens: number;
|
|
327
|
+
outputTokens: number;
|
|
328
|
+
optimizedTokens?: number;
|
|
329
|
+
cqScore: number;
|
|
330
|
+
routingPath: string;
|
|
331
|
+
clientOrigin?: string;
|
|
332
|
+
trace?: any;
|
|
333
|
+
}): Promise<void>;
|
|
334
|
+
/**
|
|
335
|
+
* Primary Analysis Entry Point
|
|
336
|
+
*/
|
|
337
|
+
analyze(input: string, provider?: AIProvider | BaseProvider, personaName?: string, locale?: string, instanceId?: string): Promise<IKMetrics>;
|
|
338
|
+
private getEmptyMetrics;
|
|
339
|
+
private createHeuristicMetrics;
|
|
340
|
+
private sniffDNA;
|
|
341
|
+
analyzeAIAssisted(input: string, provider?: AIProvider | BaseProvider, personaName?: string, instanceId?: string, configOverride?: Partial<IKConfig>): Promise<IKMetrics>;
|
|
342
|
+
private calculateDNARank;
|
|
343
|
+
private constructAuditPrompt;
|
|
344
|
+
private getFallbackMetrics;
|
|
345
|
+
crystallize(input: string, metrics?: IKMetrics, locale?: string): string;
|
|
346
|
+
private miniCrystallize;
|
|
347
|
+
getAgentDirective(personaName: string, userInsights?: IKMetrics['semanticInsights'], locale?: string): string;
|
|
348
|
+
private getApproachGuidance;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* HeuristicGatekeeper: Implementation of local, non-API cognitive checks.
|
|
353
|
+
* Optimized for sub-millisecond execution.
|
|
354
|
+
* Now uses Multilingual Heuristic Dictionaries (MHD).
|
|
355
|
+
*/
|
|
356
|
+
declare class HeuristicGatekeeper {
|
|
357
|
+
private static readonly CONSTANTS;
|
|
358
|
+
analyze(input: string): {
|
|
359
|
+
complexityScore: number;
|
|
360
|
+
intentMode: 'ENGINEERING' | 'CONCEPTUAL' | 'SPECIALIZED';
|
|
361
|
+
};
|
|
362
|
+
/**
|
|
363
|
+
* Fast heuristic check for boundary communication (Safe Mode / Audit Ai)
|
|
364
|
+
* High score means AI/User might be breaking authorization rules.
|
|
365
|
+
*/
|
|
366
|
+
evaluateBoundaryCommunication(input: string, customKeywords?: string[]): {
|
|
367
|
+
boundaryScore: number;
|
|
368
|
+
requiresHumanIntervention: boolean;
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* IK Multilingual Heuristic Dictionary (MHD)
|
|
374
|
+
* Compiled domain-specific keyword lists.
|
|
375
|
+
*/
|
|
376
|
+
declare const Dictionaries: {
|
|
377
|
+
engineering: string[];
|
|
378
|
+
conceptual: string[];
|
|
379
|
+
construction: string[];
|
|
380
|
+
medical: string[];
|
|
381
|
+
legal: string[];
|
|
382
|
+
finance: string[];
|
|
383
|
+
structural: string[];
|
|
384
|
+
relational: string[];
|
|
385
|
+
meta: {
|
|
386
|
+
en: {
|
|
387
|
+
immutable_desc: string;
|
|
388
|
+
blueprint_desc: string;
|
|
389
|
+
noise_desc: string;
|
|
390
|
+
audit_title: string;
|
|
391
|
+
audit_intro: string;
|
|
392
|
+
lang_rule: string;
|
|
393
|
+
schema_intro: string;
|
|
394
|
+
guide_title: string;
|
|
395
|
+
role_eng: string;
|
|
396
|
+
role_conceptual: string;
|
|
397
|
+
mode_l1: string;
|
|
398
|
+
mode_l2: string;
|
|
399
|
+
mode_l3: string;
|
|
400
|
+
mode_hybrid: string;
|
|
401
|
+
audit_rules_title: string;
|
|
402
|
+
audit_rule_1: string;
|
|
403
|
+
audit_rule_2: string;
|
|
404
|
+
audit_rule_3: string;
|
|
405
|
+
audit_rule_4: string;
|
|
406
|
+
audit_rule_5: string;
|
|
407
|
+
audit_rule_6: string;
|
|
408
|
+
eng_guide: string;
|
|
409
|
+
conceptual_guide: string;
|
|
410
|
+
steering_title: string;
|
|
411
|
+
priority_desc: string;
|
|
412
|
+
precision_gate: string;
|
|
413
|
+
params_title: string;
|
|
414
|
+
abstraction_title: string;
|
|
415
|
+
directness_title: string;
|
|
416
|
+
density_title: string;
|
|
417
|
+
adaptation_title: string;
|
|
418
|
+
adapt_rule_1: string;
|
|
419
|
+
adapt_rule_2: string;
|
|
420
|
+
adapt_rule_3: string;
|
|
421
|
+
tuning_desc: string;
|
|
422
|
+
medical_guardrail: string;
|
|
423
|
+
legal_precision: string;
|
|
424
|
+
finance_risk: string;
|
|
425
|
+
philo_protection: string;
|
|
426
|
+
slang_examples: string;
|
|
427
|
+
system_prompt_patterns: string;
|
|
428
|
+
structural_noise: string;
|
|
429
|
+
meta_audit_meta_role: string;
|
|
430
|
+
meta_audit_objectivity: string;
|
|
431
|
+
meta_audit_blueprint_density: string;
|
|
432
|
+
meta_audit_schema_logic: string;
|
|
433
|
+
meta_audit_transform_rule: string;
|
|
434
|
+
logic_anchor_title: string;
|
|
435
|
+
logic_anchor_rule: string;
|
|
436
|
+
anti_eloquence_rule: string;
|
|
437
|
+
meta_audit_narrative_protection: string;
|
|
438
|
+
kft_opt_rule: string;
|
|
439
|
+
meta_audit_meta_pragmatic_stance: string;
|
|
440
|
+
guidance_REFLECTIVE: string;
|
|
441
|
+
guidance_NARRATIVE: string;
|
|
442
|
+
guidance_PROBLEM_ORIENTED: string;
|
|
443
|
+
guidance_REFLECTIVE_NARRATIVE: string;
|
|
444
|
+
guidance_DIRECTIVE: string;
|
|
445
|
+
guidance_ARGUMENTATIVE: string;
|
|
446
|
+
guidance_DIALOGICAL: string;
|
|
447
|
+
interface_distinction_rule: string;
|
|
448
|
+
persona_narrator: string;
|
|
449
|
+
suppress_listing: string;
|
|
450
|
+
persona_professional: string;
|
|
451
|
+
persona_sharp: string;
|
|
452
|
+
persona_empathetic: string;
|
|
453
|
+
persona_provocative: string;
|
|
454
|
+
persona_lock: string;
|
|
455
|
+
persona_lock_fluid: string;
|
|
456
|
+
tone_high_stakes: string;
|
|
457
|
+
tone_engineering: string;
|
|
458
|
+
tone_fluid: string;
|
|
459
|
+
tone_warm: string;
|
|
460
|
+
tone_rapport: string;
|
|
461
|
+
tone_objective: string;
|
|
462
|
+
label_cognitive_resonance: string;
|
|
463
|
+
label_authoritative_blueprint: string;
|
|
464
|
+
label_authoritative_blueprint_desc: string;
|
|
465
|
+
label_performative_intent: string;
|
|
466
|
+
label_rhetorical_balance: string;
|
|
467
|
+
guidance_commissive: string;
|
|
468
|
+
guidance_directive: string;
|
|
469
|
+
aesthetic_logic_crystal: string;
|
|
470
|
+
aesthetic_strategic_bridge: string;
|
|
471
|
+
aesthetic_natural_flow: string;
|
|
472
|
+
aesthetic_neutral: string;
|
|
473
|
+
execution_mode_creative: string;
|
|
474
|
+
construction_precision: string;
|
|
475
|
+
tone_engineering_rapport: string;
|
|
476
|
+
iq_classification_title: string;
|
|
477
|
+
iq_tier_1_desc: string;
|
|
478
|
+
iq_tier_2_desc: string;
|
|
479
|
+
iq_tier_3_desc: string;
|
|
480
|
+
iq_routing_rule: string;
|
|
481
|
+
archetype_title: string;
|
|
482
|
+
archetype_crystal: string;
|
|
483
|
+
archetype_fluid: string;
|
|
484
|
+
archetype_neural: string;
|
|
485
|
+
archetype_dynamic: string;
|
|
486
|
+
essence_indexing_rule: string;
|
|
487
|
+
logical_focus_desc: string;
|
|
488
|
+
};
|
|
489
|
+
sr: {
|
|
490
|
+
immutable_desc: string;
|
|
491
|
+
blueprint_desc: string;
|
|
492
|
+
noise_desc: string;
|
|
493
|
+
audit_title: string;
|
|
494
|
+
audit_intro: string;
|
|
495
|
+
lang_rule: string;
|
|
496
|
+
schema_intro: string;
|
|
497
|
+
guide_title: string;
|
|
498
|
+
role_eng: string;
|
|
499
|
+
role_conceptual: string;
|
|
500
|
+
mode_l1: string;
|
|
501
|
+
mode_l2: string;
|
|
502
|
+
mode_l3: string;
|
|
503
|
+
mode_hybrid: string;
|
|
504
|
+
audit_rules_title: string;
|
|
505
|
+
audit_rule_1: string;
|
|
506
|
+
audit_rule_2: string;
|
|
507
|
+
audit_rule_3: string;
|
|
508
|
+
audit_rule_4: string;
|
|
509
|
+
audit_rule_5: string;
|
|
510
|
+
audit_rule_6: string;
|
|
511
|
+
eng_guide: string;
|
|
512
|
+
conceptual_guide: string;
|
|
513
|
+
steering_title: string;
|
|
514
|
+
priority_desc: string;
|
|
515
|
+
precision_gate: string;
|
|
516
|
+
params_title: string;
|
|
517
|
+
abstraction_title: string;
|
|
518
|
+
directness_title: string;
|
|
519
|
+
density_title: string;
|
|
520
|
+
adaptation_title: string;
|
|
521
|
+
adapt_rule_1: string;
|
|
522
|
+
adapt_rule_2: string;
|
|
523
|
+
adapt_rule_3: string;
|
|
524
|
+
tuning_desc: string;
|
|
525
|
+
medical_guardrail: string;
|
|
526
|
+
legal_precision: string;
|
|
527
|
+
finance_risk: string;
|
|
528
|
+
philo_protection: string;
|
|
529
|
+
slang_examples: string;
|
|
530
|
+
system_prompt_patterns: string;
|
|
531
|
+
structural_noise: string;
|
|
532
|
+
meta_audit_meta_role: string;
|
|
533
|
+
meta_audit_objectivity: string;
|
|
534
|
+
meta_audit_blueprint_density: string;
|
|
535
|
+
meta_audit_schema_logic: string;
|
|
536
|
+
meta_audit_transform_rule: string;
|
|
537
|
+
logic_anchor_title: string;
|
|
538
|
+
logic_anchor_rule: string;
|
|
539
|
+
anti_eloquence_rule: string;
|
|
540
|
+
meta_audit_narrative_protection: string;
|
|
541
|
+
kft_opt_rule: string;
|
|
542
|
+
meta_audit_meta_pragmatic_stance: string;
|
|
543
|
+
guidance_REFLECTIVE: string;
|
|
544
|
+
guidance_NARRATIVE: string;
|
|
545
|
+
guidance_PROBLEM_ORIENTED: string;
|
|
546
|
+
guidance_REFLECTIVE_NARRATIVE: string;
|
|
547
|
+
guidance_DIRECTIVE: string;
|
|
548
|
+
guidance_ARGUMENTATIVE: string;
|
|
549
|
+
guidance_DIALOGICAL: string;
|
|
550
|
+
interface_distinction_rule: string;
|
|
551
|
+
persona_professional: string;
|
|
552
|
+
persona_sharp: string;
|
|
553
|
+
persona_empathetic: string;
|
|
554
|
+
persona_provocative: string;
|
|
555
|
+
persona_narrator: string;
|
|
556
|
+
suppress_listing: string;
|
|
557
|
+
persona_lock: string;
|
|
558
|
+
persona_lock_fluid: string;
|
|
559
|
+
tone_high_stakes: string;
|
|
560
|
+
tone_engineering: string;
|
|
561
|
+
tone_fluid: string;
|
|
562
|
+
tone_warm: string;
|
|
563
|
+
tone_rapport: string;
|
|
564
|
+
tone_objective: string;
|
|
565
|
+
label_cognitive_resonance: string;
|
|
566
|
+
label_authoritative_blueprint: string;
|
|
567
|
+
label_authoritative_blueprint_desc: string;
|
|
568
|
+
label_performative_intent: string;
|
|
569
|
+
label_rhetorical_balance: string;
|
|
570
|
+
guidance_commissive: string;
|
|
571
|
+
guidance_directive: string;
|
|
572
|
+
guidance_DIDACTIC: string;
|
|
573
|
+
guidance_STRATEGIC: string;
|
|
574
|
+
guidance_CLINICAL: string;
|
|
575
|
+
guidance_PERSUASIVE: string;
|
|
576
|
+
aesthetic_logic_crystal: string;
|
|
577
|
+
aesthetic_strategic_bridge: string;
|
|
578
|
+
aesthetic_natural_flow: string;
|
|
579
|
+
aesthetic_neutral: string;
|
|
580
|
+
execution_mode_creative: string;
|
|
581
|
+
construction_precision: string;
|
|
582
|
+
tone_engineering_rapport: string;
|
|
583
|
+
iq_classification_title: string;
|
|
584
|
+
iq_tier_1_desc: string;
|
|
585
|
+
iq_tier_2_desc: string;
|
|
586
|
+
iq_tier_3_desc: string;
|
|
587
|
+
iq_routing_rule: string;
|
|
588
|
+
archetype_title: string;
|
|
589
|
+
archetype_crystal: string;
|
|
590
|
+
archetype_fluid: string;
|
|
591
|
+
archetype_neural: string;
|
|
592
|
+
archetype_dynamic: string;
|
|
593
|
+
essence_indexing_rule: string;
|
|
594
|
+
logical_focus_desc: string;
|
|
595
|
+
};
|
|
596
|
+
stances: {
|
|
597
|
+
categories: {
|
|
598
|
+
id: string;
|
|
599
|
+
subtypes: string[];
|
|
600
|
+
primaryIllocution: string;
|
|
601
|
+
}[];
|
|
602
|
+
illocutionaryPoints: {
|
|
603
|
+
ASSERTIVE: string;
|
|
604
|
+
DIRECTIVE: string;
|
|
605
|
+
COMMISSIVE: string;
|
|
606
|
+
EXPRESSIVE: string;
|
|
607
|
+
DECLARATIVE: string;
|
|
608
|
+
};
|
|
609
|
+
};
|
|
610
|
+
};
|
|
611
|
+
boundary: string[];
|
|
612
|
+
};
|
|
613
|
+
declare const DictionaryRegex: {
|
|
614
|
+
engineering: RegExp;
|
|
615
|
+
conceptual: RegExp;
|
|
616
|
+
construction: RegExp;
|
|
617
|
+
medical: RegExp;
|
|
618
|
+
legal: RegExp;
|
|
619
|
+
finance: RegExp;
|
|
620
|
+
structural: RegExp;
|
|
621
|
+
relational: RegExp;
|
|
622
|
+
boundary: RegExp;
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
interface TestCase {
|
|
626
|
+
category: string;
|
|
627
|
+
type: 'RAZVODNJENA' | 'ZBIJENA' | 'NORMAL';
|
|
628
|
+
length: 'KRACI' | 'DUZI';
|
|
629
|
+
text: string;
|
|
630
|
+
}
|
|
631
|
+
interface TestResult {
|
|
632
|
+
sp: number;
|
|
633
|
+
ck: number;
|
|
634
|
+
dm: number;
|
|
635
|
+
rec: string;
|
|
636
|
+
duration: number;
|
|
637
|
+
}
|
|
638
|
+
declare class SurgicalTester {
|
|
639
|
+
private static instance;
|
|
640
|
+
private core;
|
|
641
|
+
private constructor();
|
|
642
|
+
static getInstance(): SurgicalTester;
|
|
643
|
+
runTest(text: string): Promise<TestResult[]>;
|
|
644
|
+
calculateAverages(results: TestResult[]): {
|
|
645
|
+
avgSp: number;
|
|
646
|
+
avgCk: number;
|
|
647
|
+
avgDm: number;
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
interface StressTestCase {
|
|
652
|
+
category: string;
|
|
653
|
+
type: 'RAZVODNJENA' | 'ZBIJENA' | 'NORMAL';
|
|
654
|
+
length: 'KRACI' | 'DUZI';
|
|
655
|
+
text: string;
|
|
656
|
+
}
|
|
657
|
+
interface StressReport {
|
|
658
|
+
category: string;
|
|
659
|
+
type: string;
|
|
660
|
+
length: string;
|
|
661
|
+
averages: {
|
|
662
|
+
dm: string;
|
|
663
|
+
sp: string;
|
|
664
|
+
ck: string;
|
|
665
|
+
units: number;
|
|
666
|
+
};
|
|
667
|
+
recommendation: string;
|
|
668
|
+
status: string;
|
|
669
|
+
}
|
|
670
|
+
declare class StressTester {
|
|
671
|
+
private static instance;
|
|
672
|
+
private core;
|
|
673
|
+
private constructor();
|
|
674
|
+
static getInstance(): StressTester;
|
|
675
|
+
runSuite(testCases: StressTestCase[]): Promise<StressReport[]>;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
declare const IKBenchmarks: {
|
|
679
|
+
SHORT_TEST: TestPrompt[];
|
|
680
|
+
BIG_TEST: TestPrompt[];
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
export { type AIProvider, type AIResponse, AnthropicProvider, BaseProvider, type ContextMode, DeepSeekProvider, Dictionaries, DictionaryRegex, GeminiProvider, HeuristicGatekeeper, IKBenchmarks, type IKConfig, IKFirewallCore, type IKHooks, type IKMetrics, type IKPluginInfo, LocalProvider, type ModelRole, OpenAIProvider, type PromptLength, type PromptType, type ProviderMode, type RuntimeStrategy, type StressReport, type StressTestCase, StressTester, SurgicalTester, type TestCase, type TestPrompt, type TestResult, type UsageData };
|