@bryan-thompson/inspector-assessment-client 1.25.4 → 1.25.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/dist/assets/{OAuthCallback-DE62cdTZ.js → OAuthCallback-Dl4GYls3.js} +1 -1
  2. package/dist/assets/{OAuthDebugCallback-CWjFdCIE.js → OAuthDebugCallback-BdJ38Z-r.js} +1 -1
  3. package/dist/assets/{index-Df9Sx1jt.css → index-cHhcEXbr.css} +4 -0
  4. package/dist/assets/{index-PCQVSwHa.js → index-pfUiTdQb.js} +4 -4
  5. package/dist/index.html +2 -2
  6. package/lib/lib/assessment/coreTypes.d.ts +65 -0
  7. package/lib/lib/assessment/coreTypes.d.ts.map +1 -1
  8. package/lib/lib/assessment/extendedTypes.d.ts +127 -0
  9. package/lib/lib/assessment/extendedTypes.d.ts.map +1 -1
  10. package/lib/lib/assessment/resultTypes.d.ts +45 -0
  11. package/lib/lib/assessment/resultTypes.d.ts.map +1 -1
  12. package/lib/services/assessment/AssessmentOrchestrator.d.ts +3 -7
  13. package/lib/services/assessment/AssessmentOrchestrator.d.ts.map +1 -1
  14. package/lib/services/assessment/AssessmentOrchestrator.js +13 -2
  15. package/lib/services/assessment/TestDataGenerator.d.ts +9 -1
  16. package/lib/services/assessment/TestDataGenerator.d.ts.map +1 -1
  17. package/lib/services/assessment/TestDataGenerator.js +32 -6
  18. package/lib/services/assessment/TestScenarioEngine.d.ts +9 -1
  19. package/lib/services/assessment/TestScenarioEngine.d.ts.map +1 -1
  20. package/lib/services/assessment/TestScenarioEngine.js +17 -14
  21. package/lib/services/assessment/config/annotationPatterns.d.ts +3 -1
  22. package/lib/services/assessment/config/annotationPatterns.d.ts.map +1 -1
  23. package/lib/services/assessment/config/annotationPatterns.js +5 -2
  24. package/lib/services/assessment/config/architecturePatterns.d.ts +101 -0
  25. package/lib/services/assessment/config/architecturePatterns.d.ts.map +1 -0
  26. package/lib/services/assessment/config/architecturePatterns.js +248 -0
  27. package/lib/services/assessment/config/performanceConfig.d.ts +122 -0
  28. package/lib/services/assessment/config/performanceConfig.d.ts.map +1 -0
  29. package/lib/services/assessment/config/performanceConfig.js +154 -0
  30. package/lib/services/assessment/config/sanitizationPatterns.d.ts +63 -0
  31. package/lib/services/assessment/config/sanitizationPatterns.d.ts.map +1 -0
  32. package/lib/services/assessment/config/sanitizationPatterns.js +223 -0
  33. package/lib/services/assessment/lib/claudeCodeBridge.d.ts +3 -1
  34. package/lib/services/assessment/lib/claudeCodeBridge.d.ts.map +1 -1
  35. package/lib/services/assessment/lib/claudeCodeBridge.js +5 -3
  36. package/lib/services/assessment/lib/concurrencyLimit.d.ts +6 -2
  37. package/lib/services/assessment/lib/concurrencyLimit.d.ts.map +1 -1
  38. package/lib/services/assessment/lib/concurrencyLimit.js +13 -6
  39. package/lib/services/assessment/lib/errors.d.ts +90 -0
  40. package/lib/services/assessment/lib/errors.d.ts.map +1 -0
  41. package/lib/services/assessment/lib/errors.js +136 -0
  42. package/lib/services/assessment/lib/timeoutUtils.d.ts +69 -0
  43. package/lib/services/assessment/lib/timeoutUtils.d.ts.map +1 -0
  44. package/lib/services/assessment/lib/timeoutUtils.js +103 -0
  45. package/lib/services/assessment/modules/BaseAssessor.d.ts +43 -8
  46. package/lib/services/assessment/modules/BaseAssessor.d.ts.map +1 -1
  47. package/lib/services/assessment/modules/BaseAssessor.js +103 -34
  48. package/lib/services/assessment/modules/DeveloperExperienceAssessor.d.ts +38 -1
  49. package/lib/services/assessment/modules/DeveloperExperienceAssessor.d.ts.map +1 -1
  50. package/lib/services/assessment/modules/DeveloperExperienceAssessor.js +185 -19
  51. package/lib/services/assessment/modules/DocumentationAssessor.d.ts +5 -0
  52. package/lib/services/assessment/modules/DocumentationAssessor.d.ts.map +1 -1
  53. package/lib/services/assessment/modules/DocumentationAssessor.js +11 -0
  54. package/lib/services/assessment/modules/ErrorHandlingAssessor.js +1 -1
  55. package/lib/services/assessment/modules/FunctionalityAssessor.d.ts.map +1 -1
  56. package/lib/services/assessment/modules/FunctionalityAssessor.js +6 -3
  57. package/lib/services/assessment/modules/MCPSpecComplianceAssessor.d.ts +3 -0
  58. package/lib/services/assessment/modules/MCPSpecComplianceAssessor.d.ts.map +1 -1
  59. package/lib/services/assessment/modules/MCPSpecComplianceAssessor.js +14 -2
  60. package/lib/services/assessment/modules/ManifestValidationAssessor.d.ts.map +1 -1
  61. package/lib/services/assessment/modules/ManifestValidationAssessor.js +7 -2
  62. package/lib/services/assessment/modules/PromptAssessor.d.ts +1 -0
  63. package/lib/services/assessment/modules/PromptAssessor.d.ts.map +1 -1
  64. package/lib/services/assessment/modules/PromptAssessor.js +26 -16
  65. package/lib/services/assessment/modules/ProtocolComplianceAssessor.d.ts.map +1 -1
  66. package/lib/services/assessment/modules/ProtocolComplianceAssessor.js +6 -2
  67. package/lib/services/assessment/modules/ProtocolConformanceAssessor.d.ts +5 -0
  68. package/lib/services/assessment/modules/ProtocolConformanceAssessor.d.ts.map +1 -1
  69. package/lib/services/assessment/modules/ProtocolConformanceAssessor.js +15 -0
  70. package/lib/services/assessment/modules/ResourceAssessor.d.ts.map +1 -1
  71. package/lib/services/assessment/modules/ResourceAssessor.js +8 -2
  72. package/lib/services/assessment/modules/SecurityAssessor.d.ts +3 -171
  73. package/lib/services/assessment/modules/SecurityAssessor.d.ts.map +1 -1
  74. package/lib/services/assessment/modules/SecurityAssessor.js +25 -1480
  75. package/lib/services/assessment/modules/ToolAnnotationAssessor.d.ts +27 -28
  76. package/lib/services/assessment/modules/ToolAnnotationAssessor.d.ts.map +1 -1
  77. package/lib/services/assessment/modules/ToolAnnotationAssessor.js +340 -863
  78. package/lib/services/assessment/modules/UsabilityAssessor.d.ts +5 -0
  79. package/lib/services/assessment/modules/UsabilityAssessor.d.ts.map +1 -1
  80. package/lib/services/assessment/modules/UsabilityAssessor.js +11 -0
  81. package/lib/services/assessment/modules/annotations/AnnotationDeceptionDetector.d.ts +57 -0
  82. package/lib/services/assessment/modules/annotations/AnnotationDeceptionDetector.d.ts.map +1 -0
  83. package/lib/services/assessment/modules/annotations/AnnotationDeceptionDetector.js +176 -0
  84. package/lib/services/assessment/modules/annotations/ArchitectureDetector.d.ts +67 -0
  85. package/lib/services/assessment/modules/annotations/ArchitectureDetector.d.ts.map +1 -0
  86. package/lib/services/assessment/modules/annotations/ArchitectureDetector.js +239 -0
  87. package/lib/services/assessment/modules/annotations/BehaviorInference.d.ts +46 -0
  88. package/lib/services/assessment/modules/annotations/BehaviorInference.d.ts.map +1 -0
  89. package/lib/services/assessment/modules/annotations/BehaviorInference.js +394 -0
  90. package/lib/services/assessment/modules/annotations/DescriptionAnalyzer.d.ts +64 -0
  91. package/lib/services/assessment/modules/annotations/DescriptionAnalyzer.d.ts.map +1 -0
  92. package/lib/services/assessment/modules/annotations/DescriptionAnalyzer.js +304 -0
  93. package/lib/services/assessment/modules/annotations/DescriptionPoisoningDetector.d.ts +43 -0
  94. package/lib/services/assessment/modules/annotations/DescriptionPoisoningDetector.d.ts.map +1 -0
  95. package/lib/services/assessment/modules/annotations/DescriptionPoisoningDetector.js +276 -0
  96. package/lib/services/assessment/modules/annotations/SchemaAnalyzer.d.ts +122 -0
  97. package/lib/services/assessment/modules/annotations/SchemaAnalyzer.d.ts.map +1 -0
  98. package/lib/services/assessment/modules/annotations/SchemaAnalyzer.js +388 -0
  99. package/lib/services/assessment/modules/annotations/index.d.ts +13 -0
  100. package/lib/services/assessment/modules/annotations/index.d.ts.map +1 -0
  101. package/lib/services/assessment/modules/annotations/index.js +15 -0
  102. package/lib/services/assessment/modules/index.d.ts +10 -0
  103. package/lib/services/assessment/modules/index.d.ts.map +1 -1
  104. package/lib/services/assessment/modules/index.js +13 -0
  105. package/lib/services/assessment/modules/securityTests/SanitizationDetector.d.ts +125 -0
  106. package/lib/services/assessment/modules/securityTests/SanitizationDetector.d.ts.map +1 -0
  107. package/lib/services/assessment/modules/securityTests/SanitizationDetector.js +345 -0
  108. package/lib/services/assessment/modules/securityTests/SecurityPayloadGenerator.d.ts +33 -0
  109. package/lib/services/assessment/modules/securityTests/SecurityPayloadGenerator.d.ts.map +1 -0
  110. package/lib/services/assessment/modules/securityTests/SecurityPayloadGenerator.js +128 -0
  111. package/lib/services/assessment/modules/securityTests/SecurityPayloadTester.d.ts +67 -0
  112. package/lib/services/assessment/modules/securityTests/SecurityPayloadTester.d.ts.map +1 -0
  113. package/lib/services/assessment/modules/securityTests/SecurityPayloadTester.js +372 -0
  114. package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts +178 -0
  115. package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts.map +1 -0
  116. package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.js +1207 -0
  117. package/lib/services/assessment/modules/securityTests/index.d.ts +8 -0
  118. package/lib/services/assessment/modules/securityTests/index.d.ts.map +1 -0
  119. package/lib/services/assessment/modules/securityTests/index.js +7 -0
  120. package/lib/services/assessment/tool-classifier-patterns.d.ts +1 -0
  121. package/lib/services/assessment/tool-classifier-patterns.d.ts.map +1 -1
  122. package/lib/services/assessment/tool-classifier-patterns.js +17 -0
  123. package/package.json +1 -1
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Schema Analyzer
3
+ *
4
+ * Analyzes input and output schemas for behavioral hints.
5
+ * Provides inference signals based on parameter patterns and return types.
6
+ *
7
+ * Part of Issue #57: Architecture detection and behavior inference modules
8
+ */
9
+ import type { InferenceSignal } from "../../../../lib/assessment/extendedTypes.js";
10
+ /**
11
+ * JSON Schema type definition for tool parameters.
12
+ * Simplified version for analysis purposes.
13
+ */
14
+ export interface JSONSchema {
15
+ type?: string | string[];
16
+ properties?: Record<string, JSONSchema>;
17
+ items?: JSONSchema;
18
+ required?: string[];
19
+ description?: string;
20
+ enum?: unknown[];
21
+ additionalProperties?: boolean | JSONSchema;
22
+ format?: string;
23
+ pattern?: string;
24
+ minimum?: number;
25
+ maximum?: number;
26
+ default?: unknown;
27
+ }
28
+ /**
29
+ * Input schema patterns indicating read-only operations.
30
+ */
31
+ export declare const INPUT_READONLY_PATTERNS: {
32
+ /** ID-only parameters suggest retrieval (e.g., { id: string }) */
33
+ idOnlyParams: RegExp;
34
+ /** Query/filter parameters suggest search */
35
+ queryParams: RegExp;
36
+ /** Pagination parameters suggest list retrieval */
37
+ paginationParams: RegExp;
38
+ /** Sort/order parameters suggest list retrieval */
39
+ sortParams: RegExp;
40
+ /** Field selection suggests retrieval */
41
+ fieldSelectionParams: RegExp;
42
+ };
43
+ /**
44
+ * Input schema patterns indicating destructive operations.
45
+ */
46
+ export declare const INPUT_DESTRUCTIVE_PATTERNS: {
47
+ /** Force/confirm flags suggest potentially dangerous operations */
48
+ forceFlags: RegExp;
49
+ /** Hard delete indicators */
50
+ hardDeleteParams: RegExp;
51
+ };
52
+ /**
53
+ * Input schema patterns indicating write operations.
54
+ */
55
+ export declare const INPUT_WRITE_PATTERNS: {
56
+ /** Data payload suggests creation/update */
57
+ dataPayloads: RegExp;
58
+ /** Specific update parameters */
59
+ updateParams: RegExp;
60
+ /** Creation parameters */
61
+ createParams: RegExp;
62
+ };
63
+ export declare const OUTPUT_READONLY_PATTERNS: {
64
+ /** Array return type suggests list/search operation (checks nested schemas) */
65
+ returnsArray: (schema: JSONSchema) => boolean;
66
+ /** Object with common read-only fields */
67
+ hasReadOnlyFields: (schema: JSONSchema) => boolean;
68
+ };
69
+ /**
70
+ * Output schema patterns indicating destructive operations.
71
+ */
72
+ export declare const OUTPUT_DESTRUCTIVE_PATTERNS: {
73
+ /** Returns deleted flag/count */
74
+ returnsDeletedFlag: (schema: JSONSchema) => boolean;
75
+ /** Returns void/empty suggests side-effect only */
76
+ returnsVoid: (schema: JSONSchema) => boolean;
77
+ };
78
+ /**
79
+ * Output schema patterns indicating write operations.
80
+ */
81
+ export declare const OUTPUT_WRITE_PATTERNS: {
82
+ /** Returns created object with id and timestamp */
83
+ returnsCreatedObject: (schema: JSONSchema) => boolean;
84
+ /** Returns single object with ID */
85
+ returnsSingleWithId: (schema: JSONSchema) => boolean;
86
+ };
87
+ /**
88
+ * Analyze input schema for behavioral signals.
89
+ *
90
+ * @param schema - JSON Schema of tool input parameters
91
+ * @returns InferenceSignal with read-only/destructive expectations
92
+ */
93
+ export declare function analyzeInputSchema(schema: JSONSchema): InferenceSignal;
94
+ /**
95
+ * Analyze output schema for behavioral signals.
96
+ *
97
+ * @param schema - JSON Schema of tool output
98
+ * @returns InferenceSignal with read-only/destructive expectations
99
+ */
100
+ export declare function analyzeOutputSchema(schema: JSONSchema): InferenceSignal;
101
+ /**
102
+ * Check if schema has bulk operation indicators.
103
+ *
104
+ * @param schema - Input schema to check
105
+ * @returns True if schema suggests bulk operation support
106
+ */
107
+ export declare function hasBulkOperationIndicators(schema: JSONSchema): boolean;
108
+ /**
109
+ * Check if schema has pagination parameters.
110
+ *
111
+ * @param schema - Input schema to check
112
+ * @returns True if schema has pagination parameters
113
+ */
114
+ export declare function hasPaginationParameters(schema: JSONSchema): boolean;
115
+ /**
116
+ * Check if schema has force/confirm flags.
117
+ *
118
+ * @param schema - Input schema to check
119
+ * @returns True if schema has force/confirm flags
120
+ */
121
+ export declare function hasForceFlags(schema: JSONSchema): boolean;
122
+ //# sourceMappingURL=SchemaAnalyzer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaAnalyzer.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/annotations/SchemaAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;I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M,EAAE,UAAU,GAAG,OAAO,CAmBtE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAWnE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAWzD"}
@@ -0,0 +1,388 @@
1
+ /**
2
+ * Schema Analyzer
3
+ *
4
+ * Analyzes input and output schemas for behavioral hints.
5
+ * Provides inference signals based on parameter patterns and return types.
6
+ *
7
+ * Part of Issue #57: Architecture detection and behavior inference modules
8
+ */
9
+ /**
10
+ * Input schema patterns indicating read-only operations.
11
+ */
12
+ export const INPUT_READONLY_PATTERNS = {
13
+ /** ID-only parameters suggest retrieval (e.g., { id: string }) */
14
+ idOnlyParams: /^(id|uuid|key|identifier|resource_id|item_id)$/i,
15
+ /** Query/filter parameters suggest search */
16
+ queryParams: /^(query|q|filter|search|where|criteria|condition)$/i,
17
+ /** Pagination parameters suggest list retrieval */
18
+ paginationParams: /^(limit|offset|page|page_size|pageSize|cursor|skip|take)$/i,
19
+ /** Sort/order parameters suggest list retrieval */
20
+ sortParams: /^(sort|order|orderBy|order_by|sortBy|sort_by|direction)$/i,
21
+ /** Field selection suggests retrieval */
22
+ fieldSelectionParams: /^(fields|select|include|exclude|projection)$/i,
23
+ };
24
+ /**
25
+ * Input schema patterns indicating destructive operations.
26
+ */
27
+ export const INPUT_DESTRUCTIVE_PATTERNS = {
28
+ /** Force/confirm flags suggest potentially dangerous operations */
29
+ forceFlags: /^(force|confirm|hard|permanent|cascade|recursive|skip_confirmation)$/i,
30
+ /** Hard delete indicators */
31
+ hardDeleteParams: /^(hard_delete|permanent_delete|force_delete|purge)$/i,
32
+ };
33
+ /**
34
+ * Input schema patterns indicating write operations.
35
+ */
36
+ export const INPUT_WRITE_PATTERNS = {
37
+ /** Data payload suggests creation/update */
38
+ dataPayloads: /^(data|payload|body|content|item|record|document|entity|object)$/i,
39
+ /** Specific update parameters */
40
+ updateParams: /^(update|changes|modifications|patch|diff)$/i,
41
+ /** Creation parameters */
42
+ createParams: /^(create|new|add|insert|name|title|description)$/i,
43
+ };
44
+ /**
45
+ * Output schema patterns indicating read-only operations.
46
+ */
47
+ /**
48
+ * Recursively check if schema contains array type at any level.
49
+ * Used to detect list/collection return patterns.
50
+ */
51
+ function hasArrayTypeRecursive(schema, maxDepth = 3) {
52
+ if (maxDepth <= 0)
53
+ return false;
54
+ // Direct array type
55
+ if (schema.type === "array" ||
56
+ (Array.isArray(schema.type) && schema.type.includes("array"))) {
57
+ return true;
58
+ }
59
+ // Check nested properties
60
+ if (schema.properties) {
61
+ for (const prop of Object.values(schema.properties)) {
62
+ if (hasArrayTypeRecursive(prop, maxDepth - 1)) {
63
+ return true;
64
+ }
65
+ }
66
+ }
67
+ // Check array items
68
+ if (schema.items) {
69
+ if (hasArrayTypeRecursive(schema.items, maxDepth - 1)) {
70
+ return true;
71
+ }
72
+ }
73
+ return false;
74
+ }
75
+ export const OUTPUT_READONLY_PATTERNS = {
76
+ /** Array return type suggests list/search operation (checks nested schemas) */
77
+ returnsArray: (schema) => {
78
+ return hasArrayTypeRecursive(schema);
79
+ },
80
+ /** Object with common read-only fields */
81
+ hasReadOnlyFields: (schema) => {
82
+ if (schema.type !== "object" || !schema.properties)
83
+ return false;
84
+ const props = Object.keys(schema.properties);
85
+ const readOnlyIndicators = [
86
+ "items",
87
+ "results",
88
+ "data",
89
+ "records",
90
+ "total",
91
+ "count",
92
+ "page",
93
+ ];
94
+ return props.some((p) => readOnlyIndicators.includes(p.toLowerCase()));
95
+ },
96
+ };
97
+ /**
98
+ * Output schema patterns indicating destructive operations.
99
+ */
100
+ export const OUTPUT_DESTRUCTIVE_PATTERNS = {
101
+ /** Returns deleted flag/count */
102
+ returnsDeletedFlag: (schema) => {
103
+ if (schema.type !== "object" || !schema.properties)
104
+ return false;
105
+ const props = Object.keys(schema.properties).map((p) => p.toLowerCase());
106
+ return (props.includes("deleted") ||
107
+ props.includes("deletedcount") ||
108
+ props.includes("deleted_count") ||
109
+ props.includes("removed") ||
110
+ props.includes("removedcount") ||
111
+ props.includes("removed_count"));
112
+ },
113
+ /** Returns void/empty suggests side-effect only */
114
+ returnsVoid: (schema) => {
115
+ return (schema.type === "null" ||
116
+ schema.type === "void" ||
117
+ (schema.type === "object" &&
118
+ (!schema.properties || Object.keys(schema.properties).length === 0)));
119
+ },
120
+ };
121
+ /**
122
+ * Output schema patterns indicating write operations.
123
+ */
124
+ export const OUTPUT_WRITE_PATTERNS = {
125
+ /** Returns created object with id and timestamp */
126
+ returnsCreatedObject: (schema) => {
127
+ if (schema.type !== "object" || !schema.properties)
128
+ return false;
129
+ const props = Object.keys(schema.properties).map((p) => p.toLowerCase());
130
+ const hasId = props.includes("id") || props.includes("_id");
131
+ const hasTimestamp = props.includes("createdat") ||
132
+ props.includes("created_at") ||
133
+ props.includes("timestamp");
134
+ return hasId && hasTimestamp;
135
+ },
136
+ /** Returns single object with ID */
137
+ returnsSingleWithId: (schema) => {
138
+ if (schema.type !== "object" || !schema.properties)
139
+ return false;
140
+ const props = Object.keys(schema.properties).map((p) => p.toLowerCase());
141
+ return props.includes("id") || props.includes("_id");
142
+ },
143
+ };
144
+ /**
145
+ * Analyze input schema for behavioral signals.
146
+ *
147
+ * @param schema - JSON Schema of tool input parameters
148
+ * @returns InferenceSignal with read-only/destructive expectations
149
+ */
150
+ export function analyzeInputSchema(schema) {
151
+ if (!schema || !schema.properties) {
152
+ return {
153
+ expectedReadOnly: false,
154
+ expectedDestructive: false,
155
+ confidence: 0,
156
+ evidence: ["No input schema or properties provided"],
157
+ };
158
+ }
159
+ const paramNames = Object.keys(schema.properties);
160
+ const evidence = [];
161
+ let readOnlyScore = 0;
162
+ let destructiveScore = 0;
163
+ let writeScore = 0;
164
+ for (const paramName of paramNames) {
165
+ const lowerName = paramName.toLowerCase();
166
+ const paramSchema = schema.properties[paramName];
167
+ // Check for read-only patterns
168
+ if (INPUT_READONLY_PATTERNS.idOnlyParams.test(paramName)) {
169
+ // ID-only params are read-only only if few other params
170
+ if (paramNames.length <= 2) {
171
+ readOnlyScore += 70;
172
+ evidence.push(`ID-only param pattern: ${paramName}`);
173
+ }
174
+ }
175
+ if (INPUT_READONLY_PATTERNS.queryParams.test(paramName)) {
176
+ readOnlyScore += 80;
177
+ evidence.push(`Query param pattern: ${paramName}`);
178
+ }
179
+ if (INPUT_READONLY_PATTERNS.paginationParams.test(paramName)) {
180
+ readOnlyScore += 90;
181
+ evidence.push(`Pagination param pattern: ${paramName}`);
182
+ }
183
+ if (INPUT_READONLY_PATTERNS.sortParams.test(paramName)) {
184
+ readOnlyScore += 70;
185
+ evidence.push(`Sort param pattern: ${paramName}`);
186
+ }
187
+ if (INPUT_READONLY_PATTERNS.fieldSelectionParams.test(paramName)) {
188
+ readOnlyScore += 70;
189
+ evidence.push(`Field selection param pattern: ${paramName}`);
190
+ }
191
+ // Check for destructive patterns
192
+ if (INPUT_DESTRUCTIVE_PATTERNS.forceFlags.test(paramName)) {
193
+ destructiveScore += 90;
194
+ evidence.push(`Force flag pattern: ${paramName}`);
195
+ }
196
+ if (INPUT_DESTRUCTIVE_PATTERNS.hardDeleteParams.test(paramName)) {
197
+ destructiveScore += 95;
198
+ evidence.push(`Hard delete param pattern: ${paramName}`);
199
+ }
200
+ // Check for write patterns
201
+ if (INPUT_WRITE_PATTERNS.dataPayloads.test(paramName)) {
202
+ writeScore += 80;
203
+ evidence.push(`Data payload param pattern: ${paramName}`);
204
+ }
205
+ if (INPUT_WRITE_PATTERNS.updateParams.test(paramName)) {
206
+ writeScore += 85;
207
+ evidence.push(`Update param pattern: ${paramName}`);
208
+ }
209
+ // Check for array inputs indicating bulk operations
210
+ if (paramSchema &&
211
+ paramSchema.type === "array" &&
212
+ paramSchema.items?.type === "string") {
213
+ // Bulk ID array for deletion
214
+ if (lowerName.includes("id") ||
215
+ paramSchema.items.description?.toLowerCase().includes("id")) {
216
+ writeScore += 60;
217
+ evidence.push(`Bulk ID array param: ${paramName}`);
218
+ }
219
+ }
220
+ // Object payload suggests write operation
221
+ if (paramSchema &&
222
+ paramSchema.type === "object" &&
223
+ paramSchema.properties) {
224
+ writeScore += 70;
225
+ evidence.push(`Object payload param: ${paramName}`);
226
+ }
227
+ }
228
+ // Determine dominant behavior
229
+ let expectedReadOnly = false;
230
+ let expectedDestructive = false;
231
+ let confidence = 0;
232
+ // Destructive takes priority
233
+ if (destructiveScore > 0 && destructiveScore >= readOnlyScore) {
234
+ expectedDestructive = true;
235
+ confidence = Math.min(100, destructiveScore);
236
+ }
237
+ else if (readOnlyScore > writeScore && readOnlyScore > 0) {
238
+ expectedReadOnly = true;
239
+ confidence = Math.min(100, readOnlyScore);
240
+ }
241
+ else if (writeScore > 0) {
242
+ confidence = Math.min(100, writeScore);
243
+ }
244
+ if (evidence.length === 0) {
245
+ evidence.push("No recognizable schema patterns");
246
+ confidence = 0;
247
+ }
248
+ return {
249
+ expectedReadOnly,
250
+ expectedDestructive,
251
+ confidence,
252
+ evidence,
253
+ };
254
+ }
255
+ /**
256
+ * Analyze output schema for behavioral signals.
257
+ *
258
+ * @param schema - JSON Schema of tool output
259
+ * @returns InferenceSignal with read-only/destructive expectations
260
+ */
261
+ export function analyzeOutputSchema(schema) {
262
+ if (!schema) {
263
+ return {
264
+ expectedReadOnly: false,
265
+ expectedDestructive: false,
266
+ confidence: 0,
267
+ evidence: ["No output schema provided"],
268
+ };
269
+ }
270
+ const evidence = [];
271
+ let readOnlyScore = 0;
272
+ let destructiveScore = 0;
273
+ let writeScore = 0;
274
+ // Check read-only output patterns
275
+ if (OUTPUT_READONLY_PATTERNS.returnsArray(schema)) {
276
+ readOnlyScore += 85;
277
+ evidence.push("Returns array - suggests list/search operation");
278
+ }
279
+ if (OUTPUT_READONLY_PATTERNS.hasReadOnlyFields(schema)) {
280
+ readOnlyScore += 75;
281
+ evidence.push("Has read-only field patterns (items, results, data)");
282
+ }
283
+ // Check destructive output patterns
284
+ if (OUTPUT_DESTRUCTIVE_PATTERNS.returnsDeletedFlag(schema)) {
285
+ destructiveScore += 90;
286
+ evidence.push("Returns deleted flag/count - suggests deletion");
287
+ }
288
+ if (OUTPUT_DESTRUCTIVE_PATTERNS.returnsVoid(schema)) {
289
+ // Void return could be read-only (status check) or destructive
290
+ // Only slight indicator without other context
291
+ destructiveScore += 30;
292
+ evidence.push("Returns void/empty - possible side-effect operation");
293
+ }
294
+ // Check write output patterns
295
+ if (OUTPUT_WRITE_PATTERNS.returnsCreatedObject(schema)) {
296
+ writeScore += 90;
297
+ evidence.push("Returns object with id and created timestamp - suggests creation");
298
+ }
299
+ else if (OUTPUT_WRITE_PATTERNS.returnsSingleWithId(schema)) {
300
+ // Single object with ID could be read (get by id) or write (create/update)
301
+ // Weak signal without other context
302
+ writeScore += 40;
303
+ evidence.push("Returns single object with id");
304
+ }
305
+ // Determine dominant behavior
306
+ let expectedReadOnly = false;
307
+ let expectedDestructive = false;
308
+ let confidence = 0;
309
+ // Destructive takes priority if strong signal
310
+ if (destructiveScore >= 80) {
311
+ expectedDestructive = true;
312
+ confidence = Math.min(100, destructiveScore);
313
+ }
314
+ else if (readOnlyScore > writeScore && readOnlyScore > destructiveScore) {
315
+ expectedReadOnly = true;
316
+ confidence = Math.min(100, readOnlyScore);
317
+ }
318
+ else if (writeScore >= destructiveScore) {
319
+ confidence = Math.min(100, writeScore);
320
+ }
321
+ if (evidence.length === 0) {
322
+ evidence.push("No recognizable output schema patterns");
323
+ confidence = 0;
324
+ }
325
+ return {
326
+ expectedReadOnly,
327
+ expectedDestructive,
328
+ confidence,
329
+ evidence,
330
+ };
331
+ }
332
+ /**
333
+ * Check if schema has bulk operation indicators.
334
+ *
335
+ * @param schema - Input schema to check
336
+ * @returns True if schema suggests bulk operation support
337
+ */
338
+ export function hasBulkOperationIndicators(schema) {
339
+ if (!schema?.properties)
340
+ return false;
341
+ const paramNames = Object.keys(schema.properties);
342
+ for (const paramName of paramNames) {
343
+ const paramSchema = schema.properties[paramName];
344
+ // Array parameters often indicate bulk operations
345
+ if (paramSchema?.type === "array") {
346
+ return true;
347
+ }
348
+ // Common bulk operation parameter names
349
+ if (/^(ids|items|records|batch|bulk|list)$/i.test(paramName)) {
350
+ return true;
351
+ }
352
+ }
353
+ return false;
354
+ }
355
+ /**
356
+ * Check if schema has pagination parameters.
357
+ *
358
+ * @param schema - Input schema to check
359
+ * @returns True if schema has pagination parameters
360
+ */
361
+ export function hasPaginationParameters(schema) {
362
+ if (!schema?.properties)
363
+ return false;
364
+ const paramNames = Object.keys(schema.properties);
365
+ for (const paramName of paramNames) {
366
+ if (INPUT_READONLY_PATTERNS.paginationParams.test(paramName)) {
367
+ return true;
368
+ }
369
+ }
370
+ return false;
371
+ }
372
+ /**
373
+ * Check if schema has force/confirm flags.
374
+ *
375
+ * @param schema - Input schema to check
376
+ * @returns True if schema has force/confirm flags
377
+ */
378
+ export function hasForceFlags(schema) {
379
+ if (!schema?.properties)
380
+ return false;
381
+ const paramNames = Object.keys(schema.properties);
382
+ for (const paramName of paramNames) {
383
+ if (INPUT_DESTRUCTIVE_PATTERNS.forceFlags.test(paramName)) {
384
+ return true;
385
+ }
386
+ }
387
+ return false;
388
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Annotations Assessment Module
3
+ * Exports all annotation-related components
4
+ *
5
+ * Enhanced in Issue #57 with architecture detection and multi-signal behavior inference.
6
+ */
7
+ export { DESCRIPTION_POISONING_PATTERNS, scanDescriptionForPoisoning, type PoisoningPattern, type PoisoningScanResult, } from "./DescriptionPoisoningDetector.js";
8
+ export { READONLY_CONTRADICTION_KEYWORDS, RUN_READONLY_EXEMPT_SUFFIXES, DESTRUCTIVE_CONTRADICTION_KEYWORDS, containsKeyword, isRunKeywordExempt, isActionableConfidence, detectAnnotationDeception, type DeceptionResult, } from "./AnnotationDeceptionDetector.js";
9
+ export { inferBehavior, inferBehaviorEnhanced, type BehaviorInferenceResult, } from "./BehaviorInference.js";
10
+ export { analyzeDescription, hasReadOnlyIndicators, hasDestructiveIndicators, hasWriteIndicators, DESCRIPTION_BEHAVIOR_KEYWORDS, } from "./DescriptionAnalyzer.js";
11
+ export { analyzeInputSchema, analyzeOutputSchema, hasBulkOperationIndicators, hasPaginationParameters, hasForceFlags, INPUT_READONLY_PATTERNS, INPUT_DESTRUCTIVE_PATTERNS, INPUT_WRITE_PATTERNS, OUTPUT_READONLY_PATTERNS, OUTPUT_DESTRUCTIVE_PATTERNS, OUTPUT_WRITE_PATTERNS, type JSONSchema, } from "./SchemaAnalyzer.js";
12
+ export { detectArchitecture, hasDatabaseToolPatterns, extractDatabasesFromDependencies, type Tool as ArchitectureTool, type ArchitectureContext, } from "./ArchitectureDetector.js";
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/annotations/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,EAC5B,kCAAkC,EAClC,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,EACzB,KAAK,eAAe,GACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,aAAa,EACb,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,gCAAgC,EAChC,KAAK,IAAI,IAAI,gBAAgB,EAC7B,KAAK,mBAAmB,GACzB,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Annotations Assessment Module
3
+ * Exports all annotation-related components
4
+ *
5
+ * Enhanced in Issue #57 with architecture detection and multi-signal behavior inference.
6
+ */
7
+ export { DESCRIPTION_POISONING_PATTERNS, scanDescriptionForPoisoning, } from "./DescriptionPoisoningDetector.js";
8
+ export { READONLY_CONTRADICTION_KEYWORDS, RUN_READONLY_EXEMPT_SUFFIXES, DESTRUCTIVE_CONTRADICTION_KEYWORDS, containsKeyword, isRunKeywordExempt, isActionableConfidence, detectAnnotationDeception, } from "./AnnotationDeceptionDetector.js";
9
+ export { inferBehavior, inferBehaviorEnhanced, } from "./BehaviorInference.js";
10
+ // Issue #57: Description Analyzer
11
+ export { analyzeDescription, hasReadOnlyIndicators, hasDestructiveIndicators, hasWriteIndicators, DESCRIPTION_BEHAVIOR_KEYWORDS, } from "./DescriptionAnalyzer.js";
12
+ // Issue #57: Schema Analyzer
13
+ export { analyzeInputSchema, analyzeOutputSchema, hasBulkOperationIndicators, hasPaginationParameters, hasForceFlags, INPUT_READONLY_PATTERNS, INPUT_DESTRUCTIVE_PATTERNS, INPUT_WRITE_PATTERNS, OUTPUT_READONLY_PATTERNS, OUTPUT_DESTRUCTIVE_PATTERNS, OUTPUT_WRITE_PATTERNS, } from "./SchemaAnalyzer.js";
14
+ // Issue #57: Architecture Detector
15
+ export { detectArchitecture, hasDatabaseToolPatterns, extractDatabasesFromDependencies, } from "./ArchitectureDetector.js";
@@ -56,6 +56,16 @@ export { CrossCapabilitySecurityAssessor } from "./CrossCapabilitySecurityAssess
56
56
  export { DeveloperExperienceAssessor } from "./DeveloperExperienceAssessor.js";
57
57
  export { PortabilityAssessor } from "./PortabilityAssessor.js";
58
58
  export { ExternalAPIScannerAssessor } from "./ExternalAPIScannerAssessor.js";
59
+ /**
60
+ * Security testing helper modules - extracted from SecurityAssessor
61
+ * These are composition helpers, not standalone assessors
62
+ */
63
+ export * from "./securityTests/index.js";
64
+ /**
65
+ * Annotation helper modules - extracted from ToolAnnotationAssessor
66
+ * These are composition helpers, not standalone assessors
67
+ */
68
+ export * from "./annotations/index.js";
59
69
  /**
60
70
  * @deprecated Use DeveloperExperienceAssessor instead.
61
71
  * DocumentationAssessor has been merged into DeveloperExperienceAssessor.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/assessment/modules/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAM9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAMhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAMlE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAMpF,OAAO,EAAE,2B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BAAkB,CAAC;AAClD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAMpF,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAM1E;;;GAGG;AACH,cAAc,iBAAiB,CAAC;AAEhC;;;GAGG;AACH,cAAc,eAAe,CAAC;AAM9B;;;;GAIG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;GAIG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;GAIG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE;;;;GAIG;AACH,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC"}
@@ -70,6 +70,19 @@ export { DeveloperExperienceAssessor } from "./DeveloperExperienceAssessor.js";
70
70
  export { PortabilityAssessor } from "./PortabilityAssessor.js";
71
71
  export { ExternalAPIScannerAssessor } from "./ExternalAPIScannerAssessor.js";
72
72
  // ============================================================================
73
+ // Helper Modules (Extracted for maintainability)
74
+ // ============================================================================
75
+ /**
76
+ * Security testing helper modules - extracted from SecurityAssessor
77
+ * These are composition helpers, not standalone assessors
78
+ */
79
+ export * from "./securityTests/index.js";
80
+ /**
81
+ * Annotation helper modules - extracted from ToolAnnotationAssessor
82
+ * These are composition helpers, not standalone assessors
83
+ */
84
+ export * from "./annotations/index.js";
85
+ // ============================================================================
73
86
  // Deprecated Exports (backward compatibility - will be removed in v2.0.0)
74
87
  // ============================================================================
75
88
  /**