promptvet-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 +278 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +273 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/layers/heuristics/actionVerbs.d.ts +4 -0
- package/dist/layers/heuristics/actionVerbs.d.ts.map +1 -0
- package/dist/layers/heuristics/actionVerbs.js +9 -0
- package/dist/layers/heuristics/actionVerbs.js.map +1 -0
- package/dist/layers/heuristics/browserApiRisk.d.ts +2 -0
- package/dist/layers/heuristics/browserApiRisk.d.ts.map +1 -0
- package/dist/layers/heuristics/browserApiRisk.js +18 -0
- package/dist/layers/heuristics/browserApiRisk.js.map +1 -0
- package/dist/layers/heuristics/frustrationSignal.d.ts +2 -0
- package/dist/layers/heuristics/frustrationSignal.d.ts.map +1 -0
- package/dist/layers/heuristics/frustrationSignal.js +26 -0
- package/dist/layers/heuristics/frustrationSignal.js.map +1 -0
- package/dist/layers/heuristics/geoFlakeRisk.d.ts +2 -0
- package/dist/layers/heuristics/geoFlakeRisk.d.ts.map +1 -0
- package/dist/layers/heuristics/geoFlakeRisk.js +14 -0
- package/dist/layers/heuristics/geoFlakeRisk.js.map +1 -0
- package/dist/layers/heuristics/missingFramework.d.ts +2 -0
- package/dist/layers/heuristics/missingFramework.d.ts.map +1 -0
- package/dist/layers/heuristics/missingFramework.js +16 -0
- package/dist/layers/heuristics/missingFramework.js.map +1 -0
- package/dist/layers/heuristics/missingMockStrategy.d.ts +2 -0
- package/dist/layers/heuristics/missingMockStrategy.d.ts.map +1 -0
- package/dist/layers/heuristics/missingMockStrategy.js +17 -0
- package/dist/layers/heuristics/missingMockStrategy.js.map +1 -0
- package/dist/layers/heuristics/missingOutputFormat.d.ts +2 -0
- package/dist/layers/heuristics/missingOutputFormat.d.ts.map +1 -0
- package/dist/layers/heuristics/missingOutputFormat.js +31 -0
- package/dist/layers/heuristics/missingOutputFormat.js.map +1 -0
- package/dist/layers/heuristics/missingScope.d.ts +2 -0
- package/dist/layers/heuristics/missingScope.d.ts.map +1 -0
- package/dist/layers/heuristics/missingScope.js +11 -0
- package/dist/layers/heuristics/missingScope.js.map +1 -0
- package/dist/layers/heuristics/noActionableIntent.d.ts +2 -0
- package/dist/layers/heuristics/noActionableIntent.d.ts.map +1 -0
- package/dist/layers/heuristics/noActionableIntent.js +14 -0
- package/dist/layers/heuristics/noActionableIntent.js.map +1 -0
- package/dist/layers/linguistic/bloatDetector.d.ts +2 -0
- package/dist/layers/linguistic/bloatDetector.d.ts.map +1 -0
- package/dist/layers/linguistic/bloatDetector.js +91 -0
- package/dist/layers/linguistic/bloatDetector.js.map +1 -0
- package/dist/layers/linguistic/chainedIntent.d.ts +3 -0
- package/dist/layers/linguistic/chainedIntent.d.ts.map +1 -0
- package/dist/layers/linguistic/chainedIntent.js +26 -0
- package/dist/layers/linguistic/chainedIntent.js.map +1 -0
- package/dist/layers/linguistic/hedgeDetector.d.ts +2 -0
- package/dist/layers/linguistic/hedgeDetector.d.ts.map +1 -0
- package/dist/layers/linguistic/hedgeDetector.js +12 -0
- package/dist/layers/linguistic/hedgeDetector.js.map +1 -0
- package/dist/layers/linguistic/negationDensity.d.ts +2 -0
- package/dist/layers/linguistic/negationDensity.d.ts.map +1 -0
- package/dist/layers/linguistic/negationDensity.js +8 -0
- package/dist/layers/linguistic/negationDensity.js.map +1 -0
- package/dist/layers/linguistic/passiveVoice.d.ts +2 -0
- package/dist/layers/linguistic/passiveVoice.d.ts.map +1 -0
- package/dist/layers/linguistic/passiveVoice.js +8 -0
- package/dist/layers/linguistic/passiveVoice.js.map +1 -0
- package/dist/layers/linguistic/pronounAmbiguity.d.ts +2 -0
- package/dist/layers/linguistic/pronounAmbiguity.d.ts.map +1 -0
- package/dist/layers/linguistic/pronounAmbiguity.js +25 -0
- package/dist/layers/linguistic/pronounAmbiguity.js.map +1 -0
- package/dist/layers/linguistic/tokenCount.d.ts +2 -0
- package/dist/layers/linguistic/tokenCount.d.ts.map +1 -0
- package/dist/layers/linguistic/tokenCount.js +6 -0
- package/dist/layers/linguistic/tokenCount.js.map +1 -0
- package/dist/layers/semantic/classifier.d.ts +7 -0
- package/dist/layers/semantic/classifier.d.ts.map +1 -0
- package/dist/layers/semantic/classifier.js +40 -0
- package/dist/layers/semantic/classifier.js.map +1 -0
- package/dist/layers/syscan/auditor.d.ts +12 -0
- package/dist/layers/syscan/auditor.d.ts.map +1 -0
- package/dist/layers/syscan/auditor.js +108 -0
- package/dist/layers/syscan/auditor.js.map +1 -0
- package/dist/layers/syscan/qePersona.d.ts +2 -0
- package/dist/layers/syscan/qePersona.d.ts.map +1 -0
- package/dist/layers/syscan/qePersona.js +45 -0
- package/dist/layers/syscan/qePersona.js.map +1 -0
- package/dist/scorer/fixSuggestions.d.ts +2 -0
- package/dist/scorer/fixSuggestions.d.ts.map +1 -0
- package/dist/scorer/fixSuggestions.js +18 -0
- package/dist/scorer/fixSuggestions.js.map +1 -0
- package/dist/scorer/scorer.d.ts +23 -0
- package/dist/scorer/scorer.d.ts.map +1 -0
- package/dist/scorer/scorer.js +122 -0
- package/dist/scorer/scorer.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frustrationSignal.js","sourceRoot":"","sources":["../../../src/layers/heuristics/frustrationSignal.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAa;IAC1B,WAAW;IACX,WAAW;IACX,WAAW;IACX,UAAU;IACV,UAAU;CACX,CAAC;AAEF,MAAM,mBAAmB,GAAa;IACpC,qBAAqB;IACrB,YAAY;IACZ,gBAAgB;IAChB,qBAAqB;IACrB,yBAAyB;IACzB,wBAAwB;IACxB,qBAAqB;IACrB,iBAAiB;IACjB,sBAAsB;IACtB,eAAe;IACf,oBAAoB;IACpB,wBAAwB;CACzB,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,OAAO,CACL,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,mBAAmB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAClD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geoFlakeRisk.d.ts","sourceRoot":"","sources":["../../../src/layers/heuristics/geoFlakeRisk.ts"],"names":[],"mappings":"AAQA,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAKpD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const GEO_KEYWORDS = [
|
|
2
|
+
'geolocation', 'gps', 'location', 'coordinates',
|
|
3
|
+
'latitude', 'longitude', 'getcurrentposition',
|
|
4
|
+
'watchposition', 'geofence', 'geofencing',
|
|
5
|
+
'geocoding', 'navigator.geolocation', 'current position',
|
|
6
|
+
];
|
|
7
|
+
const UNIT_TEST_PATTERN = /\bunit\s+tests?\b/i;
|
|
8
|
+
export function geoFlakeRisk(prompt) {
|
|
9
|
+
const lower = prompt.toLowerCase();
|
|
10
|
+
const hasGeoKeyword = GEO_KEYWORDS.some((kw) => lower.includes(kw));
|
|
11
|
+
const hasUnitTest = UNIT_TEST_PATTERN.test(prompt);
|
|
12
|
+
return hasGeoKeyword && hasUnitTest;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=geoFlakeRisk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geoFlakeRisk.js","sourceRoot":"","sources":["../../../src/layers/heuristics/geoFlakeRisk.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG;IACnB,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa;IAC/C,UAAU,EAAE,WAAW,EAAE,oBAAoB;IAC7C,eAAe,EAAE,UAAU,EAAE,YAAY;IACzC,WAAW,EAAE,uBAAuB,EAAE,kBAAkB;CACzD,CAAC;AACF,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAE/C,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACnC,MAAM,aAAa,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,OAAO,aAAa,IAAI,WAAW,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missingFramework.d.ts","sourceRoot":"","sources":["../../../src/layers/heuristics/missingFramework.ts"],"names":[],"mappings":"AAQA,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAMxD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const TEST_REQUEST_PATTERN = /\bwrite\b(?:\s+\w+){0,3}\s+(tests?|test\s+cases?|specs?)\b|\bwrite\s+unittest\s+cases?\b/i;
|
|
2
|
+
const FRAMEWORKS = [
|
|
3
|
+
'vitest', 'jest', 'mocha', 'jasmine', 'cypress', 'playwright', 'qunit', 'ava', 'tape',
|
|
4
|
+
'pytest', 'unittest', 'junit', 'rspec', 'phpunit', 'nunit', 'xunit',
|
|
5
|
+
];
|
|
6
|
+
export function missingFramework(prompt) {
|
|
7
|
+
if (!prompt)
|
|
8
|
+
return false;
|
|
9
|
+
if (!TEST_REQUEST_PATTERN.test(prompt))
|
|
10
|
+
return false;
|
|
11
|
+
const lower = prompt.toLowerCase();
|
|
12
|
+
if (lower.includes('go test'))
|
|
13
|
+
return false;
|
|
14
|
+
return !FRAMEWORKS.some(fw => lower.includes(fw));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=missingFramework.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missingFramework.js","sourceRoot":"","sources":["../../../src/layers/heuristics/missingFramework.ts"],"names":[],"mappings":"AAAA,MAAM,oBAAoB,GACxB,2FAA2F,CAAC;AAE9F,MAAM,UAAU,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM;IACrF,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO;CACpE,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC1B,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IACrD,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACnC,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missingMockStrategy.d.ts","sourceRoot":"","sources":["../../../src/layers/heuristics/missingMockStrategy.ts"],"names":[],"mappings":"AAUA,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAQ3D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const EXTERNAL_DEPENDENCY_KEYWORDS = [
|
|
2
|
+
'api', 'database', 'fetch', 'network',
|
|
3
|
+
'axios', 'superagent', 'got', 'ky', 'request',
|
|
4
|
+
'prisma', 'mongoose', 'sequelize', 'knex', 'typeorm',
|
|
5
|
+
'pg', 'mysql', 'redis', 'supabase', 'firebase',
|
|
6
|
+
'http', 'xhr', 'websocket',
|
|
7
|
+
];
|
|
8
|
+
const UNIT_TEST_KEYWORDS = ['unit test', 'unit tests', 'write test', 'add test'];
|
|
9
|
+
const MOCK_KEYWORDS = ['mock', 'stub', 'spy', 'fake', 'nock', 'msw', 'sinon'];
|
|
10
|
+
export function missingMockStrategy(prompt) {
|
|
11
|
+
const lower = prompt.toLowerCase();
|
|
12
|
+
const hasExternalDependency = EXTERNAL_DEPENDENCY_KEYWORDS.some(k => lower.includes(k));
|
|
13
|
+
const hasUnitTest = UNIT_TEST_KEYWORDS.some(k => lower.includes(k));
|
|
14
|
+
const hasMockStrategy = MOCK_KEYWORDS.some(k => lower.includes(k));
|
|
15
|
+
return hasExternalDependency && hasUnitTest && !hasMockStrategy;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=missingMockStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missingMockStrategy.js","sourceRoot":"","sources":["../../../src/layers/heuristics/missingMockStrategy.ts"],"names":[],"mappings":"AAAA,MAAM,4BAA4B,GAAG;IACnC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS;IACrC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS;IAC7C,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS;IACpD,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU;IAC9C,MAAM,EAAE,KAAK,EAAE,WAAW;CAC3B,CAAA;AACD,MAAM,kBAAkB,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,CAAC,CAAA;AAChF,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AAE7E,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAA;IAElC,MAAM,qBAAqB,GAAG,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IACvF,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IACnE,MAAM,eAAe,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IAElE,OAAO,qBAAqB,IAAI,WAAW,IAAI,CAAC,eAAe,CAAA;AACjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missingOutputFormat.d.ts","sourceRoot":"","sources":["../../../src/layers/heuristics/missingOutputFormat.ts"],"names":[],"mappings":"AAiBA,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAiB3D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { GENERATION_VERBS, FIX_VERBS } from './actionVerbs.js';
|
|
2
|
+
const FORMAT_KEYWORDS = [
|
|
3
|
+
'json', 'markdown', 'yaml', 'xml', 'csv', 'html',
|
|
4
|
+
'bullet', 'bulleted', 'numbered list', 'table',
|
|
5
|
+
'paragraph', 'prose', 'plaintext', 'plain text',
|
|
6
|
+
'outline', 'array', 'inline comments',
|
|
7
|
+
];
|
|
8
|
+
const CODE_NOUNS = [
|
|
9
|
+
'test', 'function', 'component', 'class', 'hook',
|
|
10
|
+
'module', 'file', 'script',
|
|
11
|
+
];
|
|
12
|
+
// Matches "this <noun>" or "the <noun>" — code noun used as subject, not as intended output
|
|
13
|
+
const CODE_NOUN_AS_SUBJECT = new RegExp(`\\b(?:this|the)\\s+(?:${CODE_NOUNS.join('|')})`);
|
|
14
|
+
export function missingOutputFormat(prompt) {
|
|
15
|
+
if (prompt.trim() === '')
|
|
16
|
+
return false;
|
|
17
|
+
const lower = prompt.toLowerCase();
|
|
18
|
+
const isFixRequest = FIX_VERBS.some(v => lower.includes(v));
|
|
19
|
+
if (isFixRequest)
|
|
20
|
+
return false;
|
|
21
|
+
const isGenerationRequest = GENERATION_VERBS.some(v => lower.includes(v));
|
|
22
|
+
if (!isGenerationRequest)
|
|
23
|
+
return false;
|
|
24
|
+
const hasCodeNoun = CODE_NOUNS.some(n => lower.includes(n));
|
|
25
|
+
const isCodeGeneration = hasCodeNoun && !CODE_NOUN_AS_SUBJECT.test(lower);
|
|
26
|
+
if (isCodeGeneration)
|
|
27
|
+
return false;
|
|
28
|
+
const hasFormatSpecified = FORMAT_KEYWORDS.some(f => lower.includes(f));
|
|
29
|
+
return !hasFormatSpecified;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=missingOutputFormat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missingOutputFormat.js","sourceRoot":"","sources":["../../../src/layers/heuristics/missingOutputFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE9D,MAAM,eAAe,GAAG;IACtB,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM;IAChD,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO;IAC9C,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY;IAC/C,SAAS,EAAE,OAAO,EAAE,iBAAiB;CACtC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,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":"AAOA,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAGpD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const VAGUE_PATTERNS = [
|
|
2
|
+
/\b(my|this)\s+(app|feature|project|code|service|component|module|function|codebase|stub)\b/i,
|
|
3
|
+
/\bthe\s+codebase\b/i,
|
|
4
|
+
];
|
|
5
|
+
const FILE_EXTENSION_PATTERN = /\.\b(ts|tsx|js|jsx|py|rb|java|go|php|cs|cpp|rs|swift)\b/i;
|
|
6
|
+
export function missingScope(prompt) {
|
|
7
|
+
if (FILE_EXTENSION_PATTERN.test(prompt))
|
|
8
|
+
return false;
|
|
9
|
+
return VAGUE_PATTERNS.some((pattern) => pattern.test(prompt));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=missingScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missingScope.js","sourceRoot":"","sources":["../../../src/layers/heuristics/missingScope.ts"],"names":[],"mappings":"AAAA,MAAM,cAAc,GAAG;IACrB,6FAA6F;IAC7F,qBAAqB;CACtB,CAAC;AAEF,MAAM,sBAAsB,GAAG,0DAA0D,CAAC;AAE1F,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,IAAI,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IACtD,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noActionableIntent.d.ts","sourceRoot":"","sources":["../../../src/layers/heuristics/noActionableIntent.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAK1D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ACTION_VERBS } from './actionVerbs.js';
|
|
2
|
+
const BEHAVIOR_SIGNALS = [
|
|
3
|
+
'does not', "doesn't", 'fails to', 'resets to',
|
|
4
|
+
'still shows', 'continues to', 'but then', 'however',
|
|
5
|
+
];
|
|
6
|
+
export function noActionableIntent(prompt) {
|
|
7
|
+
if (prompt.trim() === '')
|
|
8
|
+
return false;
|
|
9
|
+
const lower = prompt.toLowerCase();
|
|
10
|
+
if (BEHAVIOR_SIGNALS.some((s) => lower.includes(s)))
|
|
11
|
+
return false;
|
|
12
|
+
return !ACTION_VERBS.some((v) => lower.includes(v));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=noActionableIntent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noActionableIntent.js","sourceRoot":"","sources":["../../../src/layers/heuristics/noActionableIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,MAAM,gBAAgB,GAAG;IACvB,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW;IAC9C,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS;CACrD,CAAA;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,KAAK,CAAA;IACtC,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAA;IAClC,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAA;IACjE,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;AACrD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bloatDetector.d.ts","sourceRoot":"","sources":["../../../src/layers/linguistic/bloatDetector.ts"],"names":[],"mappings":"AAuFA,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAgBrD"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { tokenCount } from './tokenCount.js';
|
|
2
|
+
const FILLER_PHRASES = [
|
|
3
|
+
// role-setting bloat
|
|
4
|
+
'you are a helpful assistant',
|
|
5
|
+
'you are an expert',
|
|
6
|
+
'you are a professional',
|
|
7
|
+
'act as a',
|
|
8
|
+
'pretend you are',
|
|
9
|
+
// unnecessary context-setters
|
|
10
|
+
'as you know',
|
|
11
|
+
'as previously mentioned',
|
|
12
|
+
'as i said before',
|
|
13
|
+
'as noted above',
|
|
14
|
+
'needless to say',
|
|
15
|
+
'it goes without saying',
|
|
16
|
+
// hedged requests
|
|
17
|
+
'i want you to',
|
|
18
|
+
'i would like you to',
|
|
19
|
+
'i need you to',
|
|
20
|
+
'could you please',
|
|
21
|
+
'can you please',
|
|
22
|
+
'i was hoping you could',
|
|
23
|
+
'i was wondering if you could',
|
|
24
|
+
// filler qualifiers
|
|
25
|
+
'basically',
|
|
26
|
+
'essentially',
|
|
27
|
+
'in order to',
|
|
28
|
+
'for the purpose of',
|
|
29
|
+
'with the goal of',
|
|
30
|
+
// instruction bloat
|
|
31
|
+
'please make sure that',
|
|
32
|
+
'please ensure that',
|
|
33
|
+
'make sure to',
|
|
34
|
+
'ensure that you',
|
|
35
|
+
'be sure to',
|
|
36
|
+
'do not forget to',
|
|
37
|
+
// meta-commentary
|
|
38
|
+
'without further ado',
|
|
39
|
+
'to be honest',
|
|
40
|
+
'at the end of the day',
|
|
41
|
+
];
|
|
42
|
+
const INSTRUCTION_VERBS = [
|
|
43
|
+
'write', 'create', 'generate', 'build', 'make', 'list', 'explain', 'describe',
|
|
44
|
+
'give', 'show', 'provide', 'tell', 'implement', 'add', 'design', 'develop',
|
|
45
|
+
'draft', 'suggest', 'recommend', 'analyze', 'review', 'fix', 'debug',
|
|
46
|
+
'refactor', 'test', 'summarize', 'convert', 'translate', 'format',
|
|
47
|
+
'calculate', 'check', 'verify', 'identify', 'find', 'output', 'return',
|
|
48
|
+
'mock', 'cover', 'assert', 'validate',
|
|
49
|
+
];
|
|
50
|
+
const FILLER_DENSITY_THRESHOLD = 2;
|
|
51
|
+
const PREAMBLE_TOKEN_THRESHOLD = 60;
|
|
52
|
+
const PREAMBLE_RATIO_THRESHOLD = 0.5;
|
|
53
|
+
function hasInstructionRepetition(lower) {
|
|
54
|
+
const sentences = lower.split(/[.!?]+/).map((s) => s.trim()).filter(Boolean);
|
|
55
|
+
const instructionSentences = sentences.filter((s) => INSTRUCTION_VERBS.some((verb) => s.startsWith(verb)));
|
|
56
|
+
// same imperative verb opening more than once signals repetition
|
|
57
|
+
const verbsUsed = instructionSentences.map((s) => s.split(' ')[0]);
|
|
58
|
+
const uniqueVerbs = new Set(verbsUsed);
|
|
59
|
+
return verbsUsed.length > uniqueVerbs.size;
|
|
60
|
+
}
|
|
61
|
+
function hasUnnecessaryPreamble(prompt, tokens) {
|
|
62
|
+
if (tokens < PREAMBLE_TOKEN_THRESHOLD)
|
|
63
|
+
return false;
|
|
64
|
+
const lower = prompt.toLowerCase();
|
|
65
|
+
// find position of first imperative instruction verb
|
|
66
|
+
const firstVerbIndex = Math.min(...INSTRUCTION_VERBS.map((v) => {
|
|
67
|
+
const idx = lower.indexOf(v);
|
|
68
|
+
return idx === -1 ? Infinity : idx;
|
|
69
|
+
}));
|
|
70
|
+
if (firstVerbIndex === Infinity)
|
|
71
|
+
return false;
|
|
72
|
+
// flag if the instruction verb appears only in the latter half of a long prompt
|
|
73
|
+
return firstVerbIndex / prompt.length > PREAMBLE_RATIO_THRESHOLD;
|
|
74
|
+
}
|
|
75
|
+
export function bloatDetector(prompt) {
|
|
76
|
+
if (!prompt.trim())
|
|
77
|
+
return false;
|
|
78
|
+
const lower = prompt.toLowerCase();
|
|
79
|
+
const tokens = tokenCount(prompt);
|
|
80
|
+
if (tokens === 0)
|
|
81
|
+
return false;
|
|
82
|
+
const fillerCount = FILLER_PHRASES.filter((phrase) => lower.includes(phrase)).length;
|
|
83
|
+
if (fillerCount >= FILLER_DENSITY_THRESHOLD)
|
|
84
|
+
return true;
|
|
85
|
+
if (hasInstructionRepetition(lower))
|
|
86
|
+
return true;
|
|
87
|
+
if (hasUnnecessaryPreamble(prompt, tokens))
|
|
88
|
+
return true;
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=bloatDetector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bloatDetector.js","sourceRoot":"","sources":["../../../src/layers/linguistic/bloatDetector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,cAAc,GAAG;IACrB,qBAAqB;IACrB,6BAA6B;IAC7B,mBAAmB;IACnB,wBAAwB;IACxB,UAAU;IACV,iBAAiB;IAEjB,8BAA8B;IAC9B,aAAa;IACb,yBAAyB;IACzB,kBAAkB;IAClB,gBAAgB;IAChB,iBAAiB;IACjB,wBAAwB;IAExB,kBAAkB;IAClB,eAAe;IACf,qBAAqB;IACrB,eAAe;IACf,kBAAkB;IAClB,gBAAgB;IAChB,wBAAwB;IACxB,8BAA8B;IAE9B,oBAAoB;IACpB,WAAW;IACX,aAAa;IACb,aAAa;IACb,oBAAoB;IACpB,kBAAkB;IAElB,oBAAoB;IACpB,uBAAuB;IACvB,oBAAoB;IACpB,cAAc;IACd,iBAAiB;IACjB,YAAY;IACZ,kBAAkB;IAElB,kBAAkB;IAClB,qBAAqB;IACrB,cAAc;IACd,uBAAuB;CACxB,CAAC;AAEF,MAAM,iBAAiB,GAAG;IACxB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU;IAC7E,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EA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ts","sourceRoot":"","sources":["../../../src/layers/linguistic/chainedIntent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgB3D,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAa5D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const CONNECTORS = [
|
|
2
|
+
'and also',
|
|
3
|
+
'as well as',
|
|
4
|
+
'in addition to',
|
|
5
|
+
'but also',
|
|
6
|
+
'furthermore',
|
|
7
|
+
'additionally',
|
|
8
|
+
'on top of that',
|
|
9
|
+
'moreover',
|
|
10
|
+
'while also',
|
|
11
|
+
'along with',
|
|
12
|
+
'and then',
|
|
13
|
+
];
|
|
14
|
+
export function chainedIntent(prompt) {
|
|
15
|
+
const lower = prompt.toLowerCase();
|
|
16
|
+
const found = new Set();
|
|
17
|
+
for (const connector of CONNECTORS) {
|
|
18
|
+
const pattern = new RegExp(`(?<![a-z])${connector.replace(/\s+/g, '\\s+')}(?![a-z])`, 'i');
|
|
19
|
+
if (pattern.test(lower)) {
|
|
20
|
+
found.add(connector);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const matches = Array.from(found);
|
|
24
|
+
return { flagged: matches.length > 0, matches };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=chainedIntent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chainedIntent.js","sourceRoot":"","sources":["../../../src/layers/linguistic/chainedIntent.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAG;IACjB,UAAU;IACV,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,UAAU;IACV,YAAY;IACZ,YAAY;IACZ,UAAU;CACX,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAEhC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,aAAa,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAC3F,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hedgeDetector.d.ts","sourceRoot":"","sources":["../../../src/layers/linguistic/hedgeDetector.ts"],"names":[],"mappings":"AAMA,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIrD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const HEDGE_WORDS = [
|
|
2
|
+
'maybe', 'perhaps', 'kind of', 'sort of', 'somehow',
|
|
3
|
+
'probably', 'possibly', 'somewhat', 'arguably', 'supposedly',
|
|
4
|
+
'i think', 'i guess', 'it seems',
|
|
5
|
+
];
|
|
6
|
+
export function hedgeDetector(prompt) {
|
|
7
|
+
if (prompt.trim() === '')
|
|
8
|
+
return false;
|
|
9
|
+
const lower = prompt.toLowerCase();
|
|
10
|
+
return HEDGE_WORDS.some((word) => lower.includes(word));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=hedgeDetector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hedgeDetector.js","sourceRoot":"","sources":["../../../src/layers/linguistic/hedgeDetector.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACnD,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY;IAC5D,SAAS,EAAE,SAAS,EAAE,UAAU;CACjC,CAAA;AAED,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,KAAK,CAAA;IACtC,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAA;IAClC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;AACzD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negationDensity.d.ts","sourceRoot":"","sources":["../../../src/layers/linguistic/negationDensity.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIvD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const NEGATION = /\b(don't|do not|never|no|not|cannot|can't|won't|shouldn't|wouldn't|isn't|aren't|avoid|without|refrain from)\b/gi;
|
|
2
|
+
export function negationDensity(prompt) {
|
|
3
|
+
if (prompt.trim() === '')
|
|
4
|
+
return false;
|
|
5
|
+
const matches = prompt.match(NEGATION);
|
|
6
|
+
return matches !== null && matches.length >= 2;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=negationDensity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negationDensity.js","sourceRoot":"","sources":["../../../src/layers/linguistic/negationDensity.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,iHAAiH,CAAA;AAElI,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,KAAK,CAAA;IACtC,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IACtC,OAAO,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,CAAA;AAChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passiveVoice.d.ts","sourceRoot":"","sources":["../../../src/layers/linguistic/passiveVoice.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAGpD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const IRREGULARS = 'written|broken|built|done|made|sent|given|taken|known|seen|found|said|told|kept|held';
|
|
2
|
+
const BE_FORMS = new RegExp(`\\b(is|are|was|were|be|been|being|am)\\s+(\\w+ly\\s+)?(\\w+(ed|en)|${IRREGULARS})\\b`, 'i');
|
|
3
|
+
export function passiveVoice(prompt) {
|
|
4
|
+
if (prompt.trim() === '')
|
|
5
|
+
return false;
|
|
6
|
+
return BE_FORMS.test(prompt);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=passiveVoice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passiveVoice.js","sourceRoot":"","sources":["../../../src/layers/linguistic/passiveVoice.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,sFAAsF,CAAA;AACzG,MAAM,QAAQ,GAAG,IAAI,MAAM,CACzB,sEAAsE,UAAU,MAAM,EACtF,GAAG,CACJ,CAAA;AAED,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,KAAK,CAAA;IACtC,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pronounAmbiguity.d.ts","sourceRoot":"","sources":["../../../src/layers/linguistic/pronounAmbiguity.ts"],"names":[],"mappings":"AAMA,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAmBxD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const PRONOUN = /\b(it|this|that|they)\b/i;
|
|
2
|
+
const NOUN_LIKE = /\bthe\s+\w+/i;
|
|
3
|
+
// KNOWN LIMITATION: this is a best-effort heuristic,
|
|
4
|
+
// not true antecedent resolution. Cross-sentence
|
|
5
|
+
// reference tracking is deferred to the semantic/ layer.
|
|
6
|
+
export function pronounAmbiguity(prompt) {
|
|
7
|
+
if (prompt.trim() === '')
|
|
8
|
+
return false;
|
|
9
|
+
const sentences = prompt.split(/[.!?]+/).map(s => s.trim()).filter(Boolean);
|
|
10
|
+
for (let i = 0; i < sentences.length; i++) {
|
|
11
|
+
const sentence = sentences[i];
|
|
12
|
+
if (sentence === undefined)
|
|
13
|
+
continue;
|
|
14
|
+
const match = PRONOUN.exec(sentence);
|
|
15
|
+
if (!match)
|
|
16
|
+
continue;
|
|
17
|
+
const priorContext = sentences.slice(0, i).join(' ');
|
|
18
|
+
const beforePronoun = sentence.slice(0, match.index);
|
|
19
|
+
const hasAntecedent = NOUN_LIKE.test(beforePronoun) || NOUN_LIKE.test(priorContext);
|
|
20
|
+
if (!hasAntecedent)
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=pronounAmbiguity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pronounAmbiguity.js","sourceRoot":"","sources":["../../../src/layers/linguistic/pronounAmbiguity.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,0BAA0B,CAAA;AAC1C,MAAM,SAAS,GAAG,cAAc,CAAA;AAEhC,qDAAqD;AACrD,iDAAiD;AACjD,yDAAyD;AACzD,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,KAAK,CAAA;IAEtC,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAE3E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;QAC7B,IAAI,QAAQ,KAAK,SAAS;YAAE,SAAQ;QACpC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACpC,IAAI,CAAC,KAAK;YAAE,SAAQ;QAEpB,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACpD,MAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;QAEpD,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QACnF,IAAI,CAAC,aAAa;YAAE,OAAO,IAAI,CAAA;IACjC,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenCount.d.ts","sourceRoot":"","sources":["../../../src/layers/linguistic/tokenCount.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAGjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenCount.js","sourceRoot":"","sources":["../../../src/layers/linguistic/tokenCount.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,CAAC,CAAA;IAClC,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAA;AAC1C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ClassifyResult {
|
|
2
|
+
isMeaningful: boolean;
|
|
3
|
+
confidence: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function disposeClassifier(): Promise<void>;
|
|
6
|
+
export declare function classifyIntent(prompt: string): Promise<ClassifyResult>;
|
|
7
|
+
//# sourceMappingURL=classifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classifier.d.ts","sourceRoot":"","sources":["../../../src/layers/semantic/classifier.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAqBD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQvD;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAgB5E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Labels tuned to require named context (file, component, behavior, error).
|
|
2
|
+
// Generic verbs with broad objects ("fix all things") should score below threshold.
|
|
3
|
+
const LABELS = [
|
|
4
|
+
'a precise software engineering task, bug description, or code change request that names a specific file, component, function, behavior, or error',
|
|
5
|
+
'vague or generic text that lacks a specific subject, named component, or identifiable context',
|
|
6
|
+
];
|
|
7
|
+
// Typed as unknown — @huggingface/transformers pipeline types don't expose a clean
|
|
8
|
+
// public callable interface; we access the result shape directly at call time.
|
|
9
|
+
let cachedPipeline = null;
|
|
10
|
+
async function getPipeline() {
|
|
11
|
+
if (!cachedPipeline) {
|
|
12
|
+
const { pipeline } = await import('@huggingface/transformers');
|
|
13
|
+
cachedPipeline = await pipeline('zero-shot-classification', 'Xenova/nli-deberta-v3-xsmall');
|
|
14
|
+
}
|
|
15
|
+
return cachedPipeline;
|
|
16
|
+
}
|
|
17
|
+
export async function disposeClassifier() {
|
|
18
|
+
if (cachedPipeline !== null) {
|
|
19
|
+
const p = cachedPipeline;
|
|
20
|
+
if (typeof p.dispose === 'function') {
|
|
21
|
+
await p.dispose();
|
|
22
|
+
}
|
|
23
|
+
cachedPipeline = null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export async function classifyIntent(prompt) {
|
|
27
|
+
if (!prompt || !prompt.trim()) {
|
|
28
|
+
return { isMeaningful: false, confidence: 0 };
|
|
29
|
+
}
|
|
30
|
+
const classifier = await getPipeline();
|
|
31
|
+
const result = await classifier(prompt, [...LABELS]);
|
|
32
|
+
// scores are sorted descending — index 0 is the winning label
|
|
33
|
+
const winningLabel = result.labels[0];
|
|
34
|
+
const winningScore = result.scores[0] ?? 0;
|
|
35
|
+
return {
|
|
36
|
+
isMeaningful: winningLabel === LABELS[0],
|
|
37
|
+
confidence: winningScore,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=classifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classifier.js","sourceRoot":"","sources":["../../../src/layers/semantic/classifier.ts"],"names":[],"mappings":"AAKA,4EAA4E;AAC5E,oFAAoF;AACpF,MAAM,MAAM,GAAG;IACb,kJAAkJ;IAClJ,+FAA+F;CACvF,CAAC;AAEX,mFAAmF;AACnF,+EAA+E;AAC/E,IAAI,cAAc,GAAY,IAAI,CAAC;AAEnC,KAAK,UAAU,WAAW;IACxB,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;QAC/D,cAAc,GAAG,MAAM,QAAQ,CAAC,0BAA0B,EAAE,8BAA8B,CAAC,CAAC;IAC9F,CAAC;IACD,OAAO,cAAsG,CAAC;AAChH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;QAC5B,MAAM,CAAC,GAAG,cAAmD,CAAA;QAC7D,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;YACpC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;QACnB,CAAC;QACD,cAAc,GAAG,IAAI,CAAA;IACvB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAc;IACjD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QAC9B,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;IAChD,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,WAAW,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAErD,8DAA8D;IAC9D,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAE3C,OAAO;QACL,YAAY,EAAE,YAAY,KAAK,MAAM,CAAC,CAAC,CAAC;QACxC,UAAU,EAAE,YAAY;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const DEFAULT_MODEL = "hf:ggml-org/SmolLM3-3B-GGUF:Q4_K_M";
|
|
2
|
+
interface Gap {
|
|
3
|
+
summary: string;
|
|
4
|
+
detail: string;
|
|
5
|
+
}
|
|
6
|
+
interface AuditResult {
|
|
7
|
+
gaps: Gap[];
|
|
8
|
+
raw: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function auditSystemPrompt(prompt: string, modelUri?: string): Promise<AuditResult>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=auditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auditor.d.ts","sourceRoot":"","sources":["../../../src/layers/syscan/auditor.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,uCAAuC,CAAC;AAElE,UAAU,GAAG;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAqFD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAAsB,GAC/B,OAAO,CAAC,WAAW,CAAC,CAsCtB"}
|