@agentix-e/nl2spel 1.2.0 → 1.2.2

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.
Files changed (75) hide show
  1. package/dist/index.cjs +3040 -0
  2. package/dist/index.d.cts +908 -0
  3. package/dist/index.d.ts +908 -28
  4. package/dist/index.js +2999 -24
  5. package/package.json +16 -5
  6. package/dist/context/context-extractor.d.ts +0 -82
  7. package/dist/context/context-extractor.d.ts.map +0 -1
  8. package/dist/context/context-extractor.js +0 -176
  9. package/dist/context/context-extractor.js.map +0 -1
  10. package/dist/context/schema-formatter.d.ts +0 -20
  11. package/dist/context/schema-formatter.d.ts.map +0 -1
  12. package/dist/context/schema-formatter.js +0 -104
  13. package/dist/context/schema-formatter.js.map +0 -1
  14. package/dist/engine/nl2spel-engine.d.ts +0 -145
  15. package/dist/engine/nl2spel-engine.d.ts.map +0 -1
  16. package/dist/engine/nl2spel-engine.js +0 -130
  17. package/dist/engine/nl2spel-engine.js.map +0 -1
  18. package/dist/index.d.ts.map +0 -1
  19. package/dist/index.js.map +0 -1
  20. package/dist/pattern/builtin-patterns.d.ts +0 -12
  21. package/dist/pattern/builtin-patterns.d.ts.map +0 -1
  22. package/dist/pattern/builtin-patterns.js +0 -812
  23. package/dist/pattern/builtin-patterns.js.map +0 -1
  24. package/dist/pattern/pattern-definition.d.ts +0 -49
  25. package/dist/pattern/pattern-definition.d.ts.map +0 -1
  26. package/dist/pattern/pattern-definition.js +0 -2
  27. package/dist/pattern/pattern-definition.js.map +0 -1
  28. package/dist/pattern/pattern-matcher.d.ts +0 -55
  29. package/dist/pattern/pattern-matcher.d.ts.map +0 -1
  30. package/dist/pattern/pattern-matcher.js +0 -216
  31. package/dist/pattern/pattern-matcher.js.map +0 -1
  32. package/dist/provider/llm-provider.d.ts +0 -146
  33. package/dist/provider/llm-provider.d.ts.map +0 -1
  34. package/dist/provider/llm-provider.js +0 -2
  35. package/dist/provider/llm-provider.js.map +0 -1
  36. package/dist/provider/provider-registry.d.ts +0 -28
  37. package/dist/provider/provider-registry.d.ts.map +0 -1
  38. package/dist/provider/provider-registry.js +0 -65
  39. package/dist/provider/provider-registry.js.map +0 -1
  40. package/dist/strategy/strategy-router.d.ts +0 -79
  41. package/dist/strategy/strategy-router.d.ts.map +0 -1
  42. package/dist/strategy/strategy-router.js +0 -182
  43. package/dist/strategy/strategy-router.js.map +0 -1
  44. package/dist/template/intent-classifier.d.ts +0 -56
  45. package/dist/template/intent-classifier.d.ts.map +0 -1
  46. package/dist/template/intent-classifier.js +0 -251
  47. package/dist/template/intent-classifier.js.map +0 -1
  48. package/dist/template/nl-intent.d.ts +0 -38
  49. package/dist/template/nl-intent.d.ts.map +0 -1
  50. package/dist/template/nl-intent.js +0 -39
  51. package/dist/template/nl-intent.js.map +0 -1
  52. package/dist/template/prompts/prompt-builder.d.ts +0 -20
  53. package/dist/template/prompts/prompt-builder.d.ts.map +0 -1
  54. package/dist/template/prompts/prompt-builder.js +0 -243
  55. package/dist/template/prompts/prompt-builder.js.map +0 -1
  56. package/dist/template/template-engine.d.ts +0 -27
  57. package/dist/template/template-engine.d.ts.map +0 -1
  58. package/dist/template/template-engine.js +0 -378
  59. package/dist/template/template-engine.js.map +0 -1
  60. package/dist/utils/chinese-number-parser.d.ts +0 -30
  61. package/dist/utils/chinese-number-parser.d.ts.map +0 -1
  62. package/dist/utils/chinese-number-parser.js +0 -92
  63. package/dist/utils/chinese-number-parser.js.map +0 -1
  64. package/dist/validation/auto-fixer.d.ts +0 -13
  65. package/dist/validation/auto-fixer.d.ts.map +0 -1
  66. package/dist/validation/auto-fixer.js +0 -110
  67. package/dist/validation/auto-fixer.js.map +0 -1
  68. package/dist/validation/self-correction-loop.d.ts +0 -46
  69. package/dist/validation/self-correction-loop.d.ts.map +0 -1
  70. package/dist/validation/self-correction-loop.js +0 -132
  71. package/dist/validation/self-correction-loop.js.map +0 -1
  72. package/dist/validation/validation-pipeline.d.ts +0 -81
  73. package/dist/validation/validation-pipeline.d.ts.map +0 -1
  74. package/dist/validation/validation-pipeline.js +0 -306
  75. package/dist/validation/validation-pipeline.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"provider-registry.js","sourceRoot":"","sources":["../../src/provider/provider-registry.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;IACnB,UAAU,GAAkB,EAAE,CAAC;IAEvC,0BAA0B;IACnB,QAAQ,CAAC,QAAqB;QACnC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1D,MAAM,IAAI,KAAK,CAAC,aAAa,QAAQ,CAAC,IAAI,sBAAsB,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IAED,4BAA4B;IACrB,UAAU,CAAC,IAAY;QAC5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACnE,CAAC;IAED,6BAA6B;IACtB,GAAG,CAAC,IAAY;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACtD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,cAAc;QACzB,MAAM,SAAS,GAAkB,EAAE,CAAC;QACpC,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAChC,IAAI,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;gBAC1B,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YAC7B,mBAAmB;YACnB,MAAM,QAAQ,GAAG,CAAC,CAAC,YAAY,CAAC,gBAAgB,CAAC;YACjD,MAAM,QAAQ,GAAG,CAAC,CAAC,YAAY,CAAC,gBAAgB,CAAC;YACjD,IAAI,QAAQ,IAAI,CAAC,QAAQ;gBAAE,OAAO,CAAC,CAAC,CAAC;YACrC,IAAI,CAAC,QAAQ,IAAI,QAAQ;gBAAE,OAAO,CAAC,CAAC;YACpC,mBAAmB;YACnB,MAAM,KAAK,GAAG,CAAC,CAAC,YAAY,CAAC,uBAAuB,IAAI,QAAQ,CAAC;YACjE,MAAM,KAAK,GAAG,CAAC,CAAC,YAAY,CAAC,uBAAuB,IAAI,QAAQ,CAAC;YACjE,IAAI,KAAK,GAAG,KAAK;gBAAE,OAAO,CAAC,CAAC,CAAC;YAC7B,IAAI,KAAK,GAAG,KAAK;gBAAE,OAAO,CAAC,CAAC;YAC5B,yBAAyB;YACzB,OAAO,CAAC,CAAC,YAAY,CAAC,kBAAkB,GAAG,CAAC,CAAC,YAAY,CAAC,kBAAkB,CAAC;QAC/E,CAAC,CAAC,CAAC;IACL,CAAC;IAED,oCAAoC;IAC7B,IAAI;QACT,OAAO,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9B,CAAC;IAED,qCAAqC;IACrC,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;IAChC,CAAC;CACF"}
@@ -1,79 +0,0 @@
1
- import { PatternMatcher } from '../pattern/pattern-matcher.js';
2
- import { TemplateEngine } from '../template/template-engine.js';
3
- import { PromptBuilder } from '../template/prompts/prompt-builder.js';
4
- import { ProviderRegistry } from '../provider/provider-registry.js';
5
- import type { ContextSchema, SpelEvaluator } from '@agentix-e/spel-ts';
6
- export type StrategyType = 'pattern' | 'template' | 'llm-api' | 'llm-fallback' | 'none';
7
- export interface StrategyResult {
8
- /** Generated SpEL expression */
9
- expression: string;
10
- /** Strategy used */
11
- strategy: StrategyType;
12
- /** Confidence (0-1) */
13
- confidence: number;
14
- /** Strategy-related metadata */
15
- metadata: StrategyMetadata;
16
- /** Generation latency (ms) */
17
- latencyMs: number;
18
- }
19
- export interface StrategyMetadata {
20
- /** Matched pattern ID (pattern strategy only) */
21
- patternId?: string;
22
- /** Intent type (template strategy only) */
23
- intent?: string;
24
- /** Template name (template strategy only) */
25
- templateName?: string;
26
- /** LLM Provider name (llm strategy only) */
27
- providerName?: string;
28
- /** LLM model (llm strategy only) */
29
- model?: string;
30
- /** Correction count (llm strategy + self-correction only) */
31
- corrections?: number;
32
- /** Raw LLM output (llm strategy only) */
33
- rawOutput?: string;
34
- }
35
- export interface StrategyRouterConfig {
36
- /** Pattern confidence threshold (default 0.7) */
37
- patternMinConfidence?: number;
38
- /** Template confidence threshold (default 0.6) */
39
- templateMinConfidence?: number;
40
- /** LLM confidence threshold (default 0.5) */
41
- llmMinConfidence?: number;
42
- /** Whether Self-Correction is enabled (default true) */
43
- enableSelfCorrection?: boolean;
44
- /** Maximum Self-Correction attempts (default 3) */
45
- maxCorrectionAttempts?: number;
46
- }
47
- export declare class StrategyRouter {
48
- private readonly patternMatcher;
49
- private readonly intentClassifier;
50
- private readonly templateEngine;
51
- private readonly promptBuilder;
52
- private readonly validationPipeline;
53
- private readonly autoFixer;
54
- private readonly providerRegistry;
55
- private readonly config;
56
- constructor(providerRegistry: ProviderRegistry, config?: StrategyRouterConfig);
57
- /**
58
- * Execute the full generation strategy routing
59
- */
60
- generate(nl: string, contextSchema?: ContextSchema, forceLLMProvider?: string): Promise<StrategyResult>;
61
- /**
62
- * Get PatternMatcher (for external testing/debugging)
63
- */
64
- getPatternMatcher(): PatternMatcher;
65
- /**
66
- * Get TemplateEngine
67
- */
68
- getTemplateEngine(): TemplateEngine;
69
- /**
70
- * Get PromptBuilder
71
- */
72
- getPromptBuilder(): PromptBuilder;
73
- /**
74
- * Set SpelEvaluator for validation pipeline.
75
- * Must be called before generate() if parse-level validation is needed.
76
- */
77
- setEvaluator(evaluator: SpelEvaluator): void;
78
- }
79
- //# sourceMappingURL=strategy-router.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strategy-router.d.ts","sourceRoot":"","sources":["../../src/strategy/strategy-router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG/D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKvE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,cAAc,GAAG,MAAM,CAAC;AAExF,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IAEnB,oBAAoB;IACpB,QAAQ,EAAE,YAAY,CAAC;IAEvB,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IAEnB,gCAAgC;IAChC,QAAQ,EAAE,gBAAgB,CAAC;IAE3B,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,4CAA4C;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,iDAAiD;IACjD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kDAAkD;IAClD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6CAA6C;IAC7C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mDAAmD;IACnD,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IACpD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAqB;IACxD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IACpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;gBAElC,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,GAAE,oBAAyB;IAiBjF;;OAEG;IACU,QAAQ,CACnB,EAAE,EAAE,MAAM,EACV,aAAa,CAAC,EAAE,aAAa,EAC7B,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,cAAc,CAAC;IAsJ1B;;OAEG;IACI,iBAAiB,IAAI,cAAc;IAI1C;;OAEG;IACI,iBAAiB,IAAI,cAAc;IAI1C;;OAEG;IACI,gBAAgB,IAAI,aAAa;IAIxC;;;OAGG;IACI,YAAY,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI;CAGpD"}
@@ -1,182 +0,0 @@
1
- import { PatternMatcher } from '../pattern/pattern-matcher.js';
2
- import { BUILTIN_PATTERNS } from '../pattern/builtin-patterns.js';
3
- import { IntentClassifier } from '../template/intent-classifier.js';
4
- import { TemplateEngine } from '../template/template-engine.js';
5
- import { PromptBuilder } from '../template/prompts/prompt-builder.js';
6
- import { ProviderRegistry } from '../provider/provider-registry.js';
7
- import { ValidationPipeline } from '../validation/validation-pipeline.js';
8
- import { AutoFixer } from '../validation/auto-fixer.js';
9
- import { SelfCorrectionLoop } from '../validation/self-correction-loop.js';
10
- export class StrategyRouter {
11
- patternMatcher;
12
- intentClassifier;
13
- templateEngine;
14
- promptBuilder;
15
- validationPipeline;
16
- autoFixer;
17
- providerRegistry;
18
- config;
19
- constructor(providerRegistry, config = {}) {
20
- this.patternMatcher = new PatternMatcher(BUILTIN_PATTERNS);
21
- this.intentClassifier = new IntentClassifier();
22
- this.templateEngine = new TemplateEngine();
23
- this.promptBuilder = new PromptBuilder();
24
- this.validationPipeline = new ValidationPipeline();
25
- this.autoFixer = new AutoFixer();
26
- this.providerRegistry = providerRegistry;
27
- this.config = {
28
- patternMinConfidence: config.patternMinConfidence ?? 0.7,
29
- templateMinConfidence: config.templateMinConfidence ?? 0.6,
30
- llmMinConfidence: config.llmMinConfidence ?? 0.5,
31
- enableSelfCorrection: config.enableSelfCorrection ?? true,
32
- maxCorrectionAttempts: config.maxCorrectionAttempts ?? 3,
33
- };
34
- }
35
- /**
36
- * Execute the full generation strategy routing
37
- */
38
- async generate(nl, contextSchema, forceLLMProvider) {
39
- const startTime = Date.now();
40
- if (contextSchema) {
41
- this.templateEngine.setContext(contextSchema);
42
- }
43
- // ---------- Layer 0: Pattern Matching ----------
44
- const patternResult = this.patternMatcher.match(nl);
45
- if (patternResult.matched && patternResult.confidence >= this.config.patternMinConfidence) {
46
- // Validate pattern result
47
- const validation = await this.validationPipeline.validate(patternResult.spel, contextSchema);
48
- if (validation.valid) {
49
- return {
50
- expression: patternResult.spel,
51
- strategy: 'pattern',
52
- confidence: patternResult.confidence,
53
- metadata: { patternId: patternResult.pattern?.id },
54
- latencyMs: Date.now() - startTime,
55
- };
56
- }
57
- // Pattern result validation failed, try AutoFix
58
- try {
59
- const afResult = this.autoFixer.fix(patternResult.spel);
60
- if (afResult.wasFixed) {
61
- const afValidation = await this.validationPipeline.validate(afResult.expression, contextSchema);
62
- if (afValidation.valid) {
63
- return {
64
- expression: afResult.expression,
65
- strategy: 'pattern',
66
- confidence: patternResult.confidence * 0.95,
67
- metadata: { patternId: patternResult.pattern?.id },
68
- latencyMs: Date.now() - startTime,
69
- };
70
- }
71
- }
72
- }
73
- catch {
74
- // AutoFix failed, fall through to template/LLM layers
75
- }
76
- }
77
- // ---------- Layer 1: Template ----------
78
- const intentResult = this.intentClassifier.classify(nl);
79
- let templateResult = null;
80
- try {
81
- templateResult = this.templateEngine.generate(nl, intentResult);
82
- }
83
- catch {
84
- // Template generation failed, fall through to LLM fallback
85
- }
86
- if (templateResult &&
87
- templateResult.confidence >= this.config.templateMinConfidence &&
88
- templateResult.unfilledSlots.length === 0) {
89
- // Validate template result
90
- const validation = await this.validationPipeline.validate(templateResult.expression, contextSchema);
91
- if (validation.valid) {
92
- return {
93
- expression: templateResult.expression,
94
- strategy: 'template',
95
- confidence: templateResult.confidence,
96
- metadata: {
97
- intent: templateResult.intent,
98
- templateName: templateResult.templateName,
99
- },
100
- latencyMs: Date.now() - startTime,
101
- };
102
- }
103
- }
104
- // ---------- Layer 2: LLM ----------
105
- // Build prompt
106
- const prompt = this.promptBuilder.build(nl, contextSchema);
107
- // Get available providers
108
- let providers = await this.providerRegistry.getPrioritized();
109
- // If a specific provider is forced, use it first
110
- if (forceLLMProvider) {
111
- const forced = providers.find((p) => p.name === forceLLMProvider);
112
- if (forced) {
113
- providers = [forced, ...providers.filter((p) => p !== forced)];
114
- }
115
- }
116
- if (providers.length === 0) {
117
- throw new Error('No LLM providers available');
118
- }
119
- let lastError = null;
120
- for (const provider of providers) {
121
- try {
122
- const response = await provider.generate(prompt, { timeout: 30000 });
123
- let expression = response.text.trim();
124
- let corrections = 0;
125
- // Self-Correction loop
126
- if (this.config.enableSelfCorrection && contextSchema) {
127
- const correctionLoop = new SelfCorrectionLoop({
128
- maxAttempts: this.config.maxCorrectionAttempts,
129
- }, this.validationPipeline);
130
- const correctionResult = await correctionLoop.correct(expression, contextSchema, (prompt) => provider.generate(prompt), prompt);
131
- expression = correctionResult.expression;
132
- corrections = correctionResult.correctionAttempts;
133
- }
134
- return {
135
- expression,
136
- strategy: 'llm-api',
137
- confidence: 0.8,
138
- metadata: {
139
- providerName: provider.name,
140
- model: response.model,
141
- corrections,
142
- rawOutput: response.text,
143
- },
144
- latencyMs: Date.now() - startTime,
145
- };
146
- }
147
- catch (err) {
148
- lastError = err;
149
- // Try next provider
150
- continue;
151
- }
152
- }
153
- // All providers failed
154
- throw new Error(`All LLM providers failed. Last error: ${lastError?.message ?? 'Unknown'}`);
155
- }
156
- /**
157
- * Get PatternMatcher (for external testing/debugging)
158
- */
159
- getPatternMatcher() {
160
- return this.patternMatcher;
161
- }
162
- /**
163
- * Get TemplateEngine
164
- */
165
- getTemplateEngine() {
166
- return this.templateEngine;
167
- }
168
- /**
169
- * Get PromptBuilder
170
- */
171
- getPromptBuilder() {
172
- return this.promptBuilder;
173
- }
174
- /**
175
- * Set SpelEvaluator for validation pipeline.
176
- * Must be called before generate() if parse-level validation is needed.
177
- */
178
- setEvaluator(evaluator) {
179
- this.validationPipeline.setEvaluator(evaluator);
180
- }
181
- }
182
- //# sourceMappingURL=strategy-router.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strategy-router.js","sourceRoot":"","sources":["../../src/strategy/strategy-router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,k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AAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EACrC,MAAM,CACP,CAAC;oBACF,UAAU,GAAG,gBAAgB,CAAC,UAAU,CAAC;oBACzC,WAAW,GAAG,gBAAgB,CAAC,kBAAkB,CAAC;gBACpD,CAAC;gBAED,OAAO;oBACL,UAAU;oBACV,QAAQ,EAAE,SAAS;oBACnB,UAAU,EAAE,GAAG;oBACf,QAAQ,EAAE;wBACR,YAAY,EAAE,QAAQ,CAAC,IAAI;wBAC3B,KAAK,EAAE,QAAQ,CAAC,KAAK;wBACrB,WAAW;wBACX,SAAS,EAAE,QAAQ,CAAC,IAAI;qBACzB;oBACD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;iBAClC,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,SAAS,GAAG,GAAY,CAAC;gBACzB,oBAAoB;gBACpB,SAAS;YACX,CAAC;QACH,CAAC;QAED,uBAAuB;QACvB,MAAM,IAAI,KAAK,CAAC,yCAAyC,SAAS,EAAE,OAAO,IAAI,SAAS,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED;;OAEG;IACI,iBAAiB;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED;;OAEG;IACI,iBAAiB;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACI,YAAY,CAAC,SAAwB;QAC1C,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAClD,CAAC;CACF"}
@@ -1,56 +0,0 @@
1
- import { NLIntent } from './nl-intent.js';
2
- /**
3
- * Intent classification result
4
- */
5
- export interface IntentResult {
6
- /** Primary intent (highest confidence) */
7
- primaryIntent: NLIntent;
8
- /** All possible intents with confidence scores */
9
- intents: Array<{
10
- intent: NLIntent;
11
- confidence: number;
12
- }>;
13
- /** Extracted entities */
14
- entities: IntentEntity[];
15
- /** Recognized operators */
16
- operators: string[];
17
- /** Recognized logical connectors */
18
- logicalConnectors: string[];
19
- /** Complexity score (0-100) */
20
- complexity: number;
21
- }
22
- export interface IntentEntity {
23
- text: string;
24
- type: 'field' | 'value' | 'operator' | 'logic' | 'quantifier';
25
- position: {
26
- start: number;
27
- end: number;
28
- };
29
- }
30
- export declare class IntentClassifier {
31
- /**
32
- * Main method for classifying natural language input
33
- */
34
- classify(input: string): IntentResult;
35
- /**
36
- * Entity extraction
37
- */
38
- private extractEntities;
39
- /**
40
- * Operator recognition
41
- */
42
- private extractOperators;
43
- /**
44
- * Logical connector recognition
45
- */
46
- private extractLogicalConnectors;
47
- /**
48
- * Complexity calculation
49
- */
50
- private calculateComplexity;
51
- /**
52
- * Input normalization
53
- */
54
- private normalize;
55
- }
56
- //# sourceMappingURL=intent-classifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"intent-classifier.d.ts","sourceRoot":"","sources":["../../src/template/intent-classifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,aAAa,EAAE,QAAQ,CAAC;IAExB,kDAAkD;IAClD,OAAO,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,QAAQ,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEzD,yBAAyB;IACzB,QAAQ,EAAE,YAAY,EAAE,CAAC;IAEzB,2BAA2B;IAC3B,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB,oCAAoC;IACpC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAE5B,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,CAAC;IAC9D,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1C;AA+ED,qBAAa,gBAAgB;IAC3B;;OAEG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IA8E5C;;OAEG;IACH,OAAO,CAAC,eAAe;IAuCvB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAwBxB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAahC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA2B3B;;OAEG;IACH,OAAO,CAAC,SAAS;CAUlB"}
@@ -1,251 +0,0 @@
1
- import { NLIntent } from './nl-intent.js';
2
- /**
3
- * Intent keyword mapping table
4
- */
5
- const INTENT_KEYWORDS = {
6
- [NLIntent.COMPARISON]: {
7
- zh: [
8
- '大于',
9
- '小于',
10
- '等于',
11
- '超过',
12
- '低于',
13
- '不小于',
14
- '不大于',
15
- '大于等于',
16
- '小于等于',
17
- '不等于',
18
- ],
19
- en: ['greater', 'less', 'equal', 'above', 'below', 'exceed', '>', '<', '==', '!=', '>=', '<='],
20
- },
21
- [NLIntent.NULL_CHECK]: {
22
- zh: ['为空', '不为空', '是空', '存在', '不存在', 'null', '没有值'],
23
- en: ['null', 'empty', 'is null', 'is not null', 'is empty', 'is not empty'],
24
- },
25
- [NLIntent.PERMISSION_CHECK]: {
26
- zh: ['角色', '权限', '管理员', '可以', '允许', '禁止', '拒绝'],
27
- en: ['role', 'permission', 'can', 'allow', 'deny', 'has role', 'has permission'],
28
- },
29
- [NLIntent.LOGICAL]: {
30
- zh: ['且', '并且', '同时', '或', '或者', '非', '不是', '也不'],
31
- en: ['and', 'or', 'not', '&&', '||', '!'],
32
- },
33
- [NLIntent.STRING_MATCH]: {
34
- zh: ['包含', '含有', '包括', '以...开头', '以...结尾', '匹配', '符合', '正则', '开头', '结尾'],
35
- en: ['contains', 'includes', 'starts with', 'ends with', 'matches', 'regex'],
36
- },
37
- [NLIntent.COLLECTION]: {
38
- zh: ['列表', '数组', '集合', '大小', '长度', 'isEmpty', '为空', '不为空', '项', 'items'],
39
- en: ['list', 'array', 'collection', 'size', 'length', 'count', 'isempty', 'empty', 'items'],
40
- },
41
- [NLIntent.RANGE]: {
42
- zh: ['之间', '范围', '介于', 'between'],
43
- en: ['between', 'range', 'from...to'],
44
- },
45
- [NLIntent.SELECTION]: {
46
- zh: ['筛选', '选择', '所有满足', '第一个满足', '符合条件的'],
47
- en: ['select', 'filter', 'first', 'matching'],
48
- },
49
- [NLIntent.PROJECTION]: {
50
- zh: ['每个', '所有', '全部', '投影'],
51
- en: ['each', 'every', 'project'],
52
- },
53
- [NLIntent.TYPE_CHECK]: {
54
- zh: ['是否是', '类型', 'instanceof'],
55
- en: ['instanceof', 'type of', 'is a'],
56
- },
57
- [NLIntent.BOOLEAN]: {
58
- zh: ['是否', '真假', 'true', 'false', '是', '否'],
59
- en: ['true', 'false', 'yes', 'no', 'is', 'is not'],
60
- },
61
- [NLIntent.DATE]: {
62
- zh: ['日期', '时间', '之后', '之前', '早于', '晚于'],
63
- en: ['date', 'time', 'after', 'before', 'earlier', 'later'],
64
- },
65
- [NLIntent.ELVIS]: {
66
- zh: ['或者', '默认值', '兜底', '默认', '否则'],
67
- en: ['default', 'fallback', 'or', 'otherwise'],
68
- },
69
- [NLIntent.ASSIGNMENT]: {
70
- zh: ['设置', '赋值', '赋予', '设定'],
71
- en: ['set', 'assign', 'put'],
72
- },
73
- [NLIntent.ARITHMETIC]: {
74
- zh: ['加', '减', '乘', '除', '取模', '求和', '平均值', '总和'],
75
- en: ['plus', 'minus', 'multiply', 'divide', 'mod', 'sum', 'average'],
76
- },
77
- };
78
- export class IntentClassifier {
79
- /**
80
- * Main method for classifying natural language input
81
- */
82
- classify(input) {
83
- const normalized = this.normalize(input);
84
- // Step 1: Keyword matching → intent scoring
85
- const intentScores = new Map();
86
- for (const intent of Object.keys(INTENT_KEYWORDS)) {
87
- const keywords = INTENT_KEYWORDS[intent];
88
- let score = 0;
89
- for (const kw of keywords.zh) {
90
- if (normalized.includes(kw))
91
- score += 3;
92
- }
93
- for (const kw of keywords.en) {
94
- if (normalized.toLowerCase().includes(kw.toLowerCase()))
95
- score += 2;
96
- }
97
- if (score > 0)
98
- intentScores.set(intent, score);
99
- }
100
- // Pattern-based boosting
101
- // If both LOGICAL and COMPARISON detected, LOGICAL gets bonus (combination intent)
102
- if (intentScores.has(NLIntent.LOGICAL) && intentScores.has(NLIntent.COMPARISON)) {
103
- intentScores.set(NLIntent.LOGICAL, (intentScores.get(NLIntent.LOGICAL) ?? 0) + 2);
104
- }
105
- // Boost RANGE if "between X and Y" pattern found
106
- if (/between\s+\S+\s+(and|,)\s+\S+/i.test(normalized)) {
107
- intentScores.set(NLIntent.RANGE, (intentScores.get(NLIntent.RANGE) ?? 0) + 3);
108
- }
109
- // Boost TYPE_CHECK if "instanceof" or type keywords present
110
- if (/instanceof/i.test(normalized) || (/是否是/.test(normalized) && /类型/.test(normalized))) {
111
- intentScores.set(NLIntent.TYPE_CHECK, (intentScores.get(NLIntent.TYPE_CHECK) ?? 0) + 3);
112
- }
113
- // Boost PROJECTION if explicit projection keywords
114
- if (/每个/.test(normalized) || /each/.test(normalized)) {
115
- intentScores.set(NLIntent.PROJECTION, (intentScores.get(NLIntent.PROJECTION) ?? 0) + 2);
116
- }
117
- // COLLECTION boost if collection-specific keywords present
118
- if (/isempty|\.isEmpty|列表|数组|集合/.test(normalized)) {
119
- intentScores.set(NLIntent.COLLECTION, (intentScores.get(NLIntent.COLLECTION) ?? 0) + 1);
120
- }
121
- // Step 2: Entity extraction
122
- const entities = this.extractEntities(normalized);
123
- // Step 3: Operator recognition
124
- const operators = this.extractOperators(normalized);
125
- // Step 4: Logical connector recognition
126
- const logicalConnectors = this.extractLogicalConnectors(normalized);
127
- // Step 5: Complexity scoring
128
- const complexity = this.calculateComplexity(normalized, intentScores, entities, operators, logicalConnectors);
129
- // Step 6: Sort intents
130
- const sortedIntents = Array.from(intentScores.entries())
131
- .sort((a, b) => b[1] - a[1])
132
- .map(([intent, score]) => ({
133
- intent,
134
- confidence: Math.min(score / 15, 1.0),
135
- }));
136
- return {
137
- primaryIntent: sortedIntents[0]?.intent ?? NLIntent.COMPARISON,
138
- intents: sortedIntents.length > 0
139
- ? sortedIntents
140
- : [{ intent: NLIntent.COMPARISON, confidence: 0.3 }],
141
- entities,
142
- operators,
143
- logicalConnectors,
144
- complexity,
145
- };
146
- }
147
- /**
148
- * Entity extraction
149
- */
150
- extractEntities(normalized) {
151
- const entities = [];
152
- // Numeric value extraction
153
- const numRegex = /\b(\d+(?:\.\d+)?)\b/g;
154
- let match;
155
- while ((match = numRegex.exec(normalized)) !== null) {
156
- entities.push({
157
- text: match[1],
158
- type: 'value',
159
- position: { start: match.index, end: match.index + match[1].length },
160
- });
161
- }
162
- // Quoted string extraction
163
- const strRegex = /['""]([^'""]*)['""]/g;
164
- while ((match = strRegex.exec(normalized)) !== null) {
165
- entities.push({
166
- text: match[1],
167
- type: 'value',
168
- position: { start: match.index, end: match.index + match[0].length },
169
- });
170
- }
171
- // Operator position extraction
172
- for (const op of ['>=', '<=', '!=', '==', '>', '<', '=']) {
173
- let idx = normalized.indexOf(op);
174
- if (idx >= 0) {
175
- entities.push({
176
- text: op,
177
- type: 'operator',
178
- position: { start: idx, end: idx + op.length },
179
- });
180
- }
181
- }
182
- return entities;
183
- }
184
- /**
185
- * Operator recognition
186
- */
187
- extractOperators(normalized) {
188
- const operators = [];
189
- const OP_MAP = [
190
- { pattern: /大于等于|>=|≥/, op: '>=' },
191
- { pattern: /小于等于|<=|≤/, op: '<=' },
192
- { pattern: /不等于|!=|≠/, op: '!=' },
193
- { pattern: /等于|==/, op: '==' },
194
- { pattern: /大于|>/, op: '>' },
195
- { pattern: /小于|</, op: '<' },
196
- { pattern: /匹配|match/, op: 'matches' },
197
- { pattern: /之间|between/, op: 'between' },
198
- { pattern: /包含|contains/, op: 'contains' },
199
- ];
200
- for (const { pattern, op } of OP_MAP) {
201
- if (pattern.test(normalized)) {
202
- operators.push(op);
203
- }
204
- }
205
- return operators;
206
- }
207
- /**
208
- * Logical connector recognition
209
- */
210
- extractLogicalConnectors(normalized) {
211
- const connectors = [];
212
- // Skip "and" detection when it's part of "between X and Y"
213
- const isBetween = /between\s+\d+(\s*,\s*|\s+and\s+)\d+/i.test(normalized);
214
- if (/且|并且|and|&&/i.test(normalized) && !isBetween)
215
- connectors.push('and');
216
- if (/或|或者|or|\|\|/i.test(normalized))
217
- connectors.push('or');
218
- if (/非|不是|不|not|!/i.test(normalized))
219
- connectors.push('not');
220
- return connectors;
221
- }
222
- /**
223
- * Complexity calculation
224
- */
225
- calculateComplexity(input, intentScores, entities, operators, logicalConnectors) {
226
- let complexity = 0;
227
- // Base: input length
228
- complexity += Math.min(input.length / 5, 15);
229
- // Multiple intents hit → higher complexity
230
- complexity += (intentScores.size - 1) * 10;
231
- // Logical connectors
232
- complexity += logicalConnectors.length * 15;
233
- // Entity count
234
- complexity += entities.length * 5;
235
- // Operator count
236
- complexity += operators.length * 8;
237
- return Math.max(0, Math.min(complexity, 100));
238
- }
239
- /**
240
- * Input normalization
241
- */
242
- normalize(input) {
243
- return (input
244
- .trim()
245
- .toLowerCase()
246
- // Full-width to half-width
247
- .replace(/[\uFF01-\uFF5E]/g, (ch) => String.fromCharCode(ch.charCodeAt(0) - 0xfee0))
248
- .replace(/\s+/g, ' '));
249
- }
250
- }
251
- //# sourceMappingURL=intent-classifier.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"intent-classifier.js","sourceRoot":"","sources":["../../src/template/intent-classifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA+B1C;;GAEG;AACH,MAAM,eAAe,GAAqD;IACxE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;QACrB,EAAE,EAAE;YACF,IAAI;Y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Aa,EACb,YAAmC,EACnC,QAAwB,EACxB,SAAmB,EACnB,iBAA2B;QAE3B,IAAI,UAAU,GAAG,CAAC,CAAC;QAEnB,qBAAqB;QACrB,UAAU,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;QAE7C,2CAA2C;QAC3C,UAAU,IAAI,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAE3C,qBAAqB;QACrB,UAAU,IAAI,iBAAiB,CAAC,MAAM,GAAG,EAAE,CAAC;QAE5C,eAAe;QACf,UAAU,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QAElC,iBAAiB;QACjB,UAAU,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;QAEnC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACK,SAAS,CAAC,KAAa;QAC7B,OAAO,CACL,KAAK;aACF,IAAI,EAAE;aACN,WAAW,EAAE;YACd,2BAA2B;aAC1B,OAAO,CAAC,kBAAkB,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;aACnF,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CACxB,CAAC;IACJ,CAAC;CACF"}
@@ -1,38 +0,0 @@
1
- /**
2
- * NLIntent — Natural language intent classification system.
3
- *
4
- * 15 intent types covering all common SpEL usage scenarios.
5
- */
6
- export declare enum NLIntent {
7
- /** Numeric comparison: "amount > 100", "年龄大于18" */
8
- COMPARISON = "COMPARISON",
9
- /** Permission check: "hasRole('admin')", "用户是VIP" */
10
- PERMISSION_CHECK = "PERMISSION_CHECK",
11
- /** Null check: "== null", "!= null", "不为空" */
12
- NULL_CHECK = "NULL_CHECK",
13
- /** Logical combination: "a and b", "金额大于100且已确认" */
14
- LOGICAL = "LOGICAL",
15
- /** String matching: "contains('keyword')", "以ORD开头" */
16
- STRING_MATCH = "STRING_MATCH",
17
- /** Collection operations: "list.contains('x')", "items.isEmpty()" */
18
- COLLECTION = "COLLECTION",
19
- /** Range check: "between {1, 10}", "年龄在18到60之间" */
20
- RANGE = "RANGE",
21
- /** Selection (filter): ".?[condition]", "all matching conditions" */
22
- SELECTION = "SELECTION",
23
- /** Projection: ".![field]", "each item's name" */
24
- PROJECTION = "PROJECTION",
25
- /** Type check: "instanceof", "是否是Admin类型" */
26
- TYPE_CHECK = "TYPE_CHECK",
27
- /** Boolean property: "isVIP", "是否已支付" */
28
- BOOLEAN = "BOOLEAN",
29
- /** Date comparison: "after/before", "after a certain date" */
30
- DATE = "DATE",
31
- /** Elvis default: "a ?: default", "or default value" */
32
- ELVIS = "ELVIS",
33
- /** Assignment: "a = value", "set field to" */
34
- ASSIGNMENT = "ASSIGNMENT",
35
- /** Arithmetic: "amount * price", "total = unit price × quantity" */
36
- ARITHMETIC = "ARITHMETIC"
37
- }
38
- //# sourceMappingURL=nl-intent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nl-intent.d.ts","sourceRoot":"","sources":["../../src/template/nl-intent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,QAAQ;IAClB,mDAAmD;IACnD,UAAU,eAAe;IAEzB,qDAAqD;IACrD,gBAAgB,qBAAqB;IAErC,8CAA8C;IAC9C,UAAU,eAAe;IAEzB,oDAAoD;IACpD,OAAO,YAAY;IAEnB,uDAAuD;IACvD,YAAY,iBAAiB;IAE7B,qEAAqE;IACrE,UAAU,eAAe;IAEzB,mDAAmD;IACnD,KAAK,UAAU;IAEf,qEAAqE;IACrE,SAAS,cAAc;IAEvB,kDAAkD;IAClD,UAAU,eAAe;IAEzB,6CAA6C;IAC7C,UAAU,eAAe;IAEzB,yCAAyC;IACzC,OAAO,YAAY;IAEnB,8DAA8D;IAC9D,IAAI,SAAS;IAEb,wDAAwD;IACxD,KAAK,UAAU;IAEf,8CAA8C;IAC9C,UAAU,eAAe;IAEzB,oEAAoE;IACpE,UAAU,eAAe;CAC1B"}