@houtini/lm 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.
Files changed (260) hide show
  1. package/CHANGELOG.md +273 -0
  2. package/LICENSE +21 -0
  3. package/README.md +203 -0
  4. package/dist/cache/analysis-cache.d.ts +33 -0
  5. package/dist/cache/analysis-cache.d.ts.map +1 -0
  6. package/dist/cache/analysis-cache.js +56 -0
  7. package/dist/cache/analysis-cache.js.map +1 -0
  8. package/dist/cache/cache-manager.d.ts +29 -0
  9. package/dist/cache/cache-manager.d.ts.map +1 -0
  10. package/dist/cache/cache-manager.js +85 -0
  11. package/dist/cache/cache-manager.js.map +1 -0
  12. package/dist/cache/index.d.ts +16 -0
  13. package/dist/cache/index.d.ts.map +1 -0
  14. package/dist/cache/index.js +17 -0
  15. package/dist/cache/index.js.map +1 -0
  16. package/dist/cache/prompt-cache.d.ts +33 -0
  17. package/dist/cache/prompt-cache.d.ts.map +1 -0
  18. package/dist/cache/prompt-cache.js +61 -0
  19. package/dist/cache/prompt-cache.js.map +1 -0
  20. package/dist/config.d.ts +43 -0
  21. package/dist/config.d.ts.map +1 -0
  22. package/dist/config.js +70 -0
  23. package/dist/config.js.map +1 -0
  24. package/dist/core/ThreeStagePromptManager.d.ts +39 -0
  25. package/dist/core/ThreeStagePromptManager.d.ts.map +1 -0
  26. package/dist/core/ThreeStagePromptManager.js +176 -0
  27. package/dist/core/ThreeStagePromptManager.js.map +1 -0
  28. package/dist/index.d.ts +6 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +230 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/plugins/base-plugin.d.ts +47 -0
  33. package/dist/plugins/base-plugin.d.ts.map +1 -0
  34. package/dist/plugins/base-plugin.js +90 -0
  35. package/dist/plugins/base-plugin.js.map +1 -0
  36. package/dist/plugins/index.d.ts +58 -0
  37. package/dist/plugins/index.d.ts.map +1 -0
  38. package/dist/plugins/index.js +161 -0
  39. package/dist/plugins/index.js.map +1 -0
  40. package/dist/plugins/types.d.ts +5 -0
  41. package/dist/plugins/types.d.ts.map +1 -0
  42. package/dist/plugins/types.js +5 -0
  43. package/dist/plugins/types.js.map +1 -0
  44. package/dist/prompts/analyze/code-quality.d.ts +116 -0
  45. package/dist/prompts/analyze/code-quality.d.ts.map +1 -0
  46. package/dist/prompts/analyze/code-quality.js +433 -0
  47. package/dist/prompts/analyze/code-quality.js.map +1 -0
  48. package/dist/prompts/analyze/compare-integration.d.ts +130 -0
  49. package/dist/prompts/analyze/compare-integration.d.ts.map +1 -0
  50. package/dist/prompts/analyze/compare-integration.js +543 -0
  51. package/dist/prompts/analyze/compare-integration.js.map +1 -0
  52. package/dist/prompts/analyze/count-files.d.ts +109 -0
  53. package/dist/prompts/analyze/count-files.d.ts.map +1 -0
  54. package/dist/prompts/analyze/count-files.js +399 -0
  55. package/dist/prompts/analyze/count-files.js.map +1 -0
  56. package/dist/prompts/analyze/database-queries.d.ts +156 -0
  57. package/dist/prompts/analyze/database-queries.d.ts.map +1 -0
  58. package/dist/prompts/analyze/database-queries.js +759 -0
  59. package/dist/prompts/analyze/database-queries.js.map +1 -0
  60. package/dist/prompts/analyze/dependencies.d.ts +97 -0
  61. package/dist/prompts/analyze/dependencies.d.ts.map +1 -0
  62. package/dist/prompts/analyze/dependencies.js +333 -0
  63. package/dist/prompts/analyze/dependencies.js.map +1 -0
  64. package/dist/prompts/analyze/diff-signatures.d.ts +139 -0
  65. package/dist/prompts/analyze/diff-signatures.d.ts.map +1 -0
  66. package/dist/prompts/analyze/diff-signatures.js +702 -0
  67. package/dist/prompts/analyze/diff-signatures.js.map +1 -0
  68. package/dist/prompts/analyze/find-patterns.d.ts +128 -0
  69. package/dist/prompts/analyze/find-patterns.d.ts.map +1 -0
  70. package/dist/prompts/analyze/find-patterns.js +520 -0
  71. package/dist/prompts/analyze/find-patterns.js.map +1 -0
  72. package/dist/prompts/analyze/find-unused-css.d.ts +151 -0
  73. package/dist/prompts/analyze/find-unused-css.d.ts.map +1 -0
  74. package/dist/prompts/analyze/find-unused-css.js +754 -0
  75. package/dist/prompts/analyze/find-unused-css.js.map +1 -0
  76. package/dist/prompts/analyze/n8n-workflow.d.ts +137 -0
  77. package/dist/prompts/analyze/n8n-workflow.d.ts.map +1 -0
  78. package/dist/prompts/analyze/n8n-workflow.js +529 -0
  79. package/dist/prompts/analyze/n8n-workflow.js.map +1 -0
  80. package/dist/prompts/analyze/project-structure.d.ts +126 -0
  81. package/dist/prompts/analyze/project-structure.d.ts.map +1 -0
  82. package/dist/prompts/analyze/project-structure.js +569 -0
  83. package/dist/prompts/analyze/project-structure.js.map +1 -0
  84. package/dist/prompts/analyze/security-audit.d.ts +142 -0
  85. package/dist/prompts/analyze/security-audit.d.ts.map +1 -0
  86. package/dist/prompts/analyze/security-audit.js +637 -0
  87. package/dist/prompts/analyze/security-audit.js.map +1 -0
  88. package/dist/prompts/analyze/single-file.d.ts +162 -0
  89. package/dist/prompts/analyze/single-file.d.ts.map +1 -0
  90. package/dist/prompts/analyze/single-file.js +665 -0
  91. package/dist/prompts/analyze/single-file.js.map +1 -0
  92. package/dist/prompts/analyze/trace-execution.d.ts +126 -0
  93. package/dist/prompts/analyze/trace-execution.d.ts.map +1 -0
  94. package/dist/prompts/analyze/trace-execution.js +609 -0
  95. package/dist/prompts/analyze/trace-execution.js.map +1 -0
  96. package/dist/prompts/analyze/wordpress-plugin-audit.d.ts +116 -0
  97. package/dist/prompts/analyze/wordpress-plugin-audit.d.ts.map +1 -0
  98. package/dist/prompts/analyze/wordpress-plugin-audit.js +454 -0
  99. package/dist/prompts/analyze/wordpress-plugin-audit.js.map +1 -0
  100. package/dist/prompts/analyze/wordpress-security.d.ts +146 -0
  101. package/dist/prompts/analyze/wordpress-security.d.ts.map +1 -0
  102. package/dist/prompts/analyze/wordpress-security.js +698 -0
  103. package/dist/prompts/analyze/wordpress-security.js.map +1 -0
  104. package/dist/prompts/analyze/wordpress-theme-audit.d.ts +114 -0
  105. package/dist/prompts/analyze/wordpress-theme-audit.d.ts.map +1 -0
  106. package/dist/prompts/analyze/wordpress-theme-audit.js +538 -0
  107. package/dist/prompts/analyze/wordpress-theme-audit.js.map +1 -0
  108. package/dist/prompts/custom/custom-prompt.d.ts +135 -0
  109. package/dist/prompts/custom/custom-prompt.d.ts.map +1 -0
  110. package/dist/prompts/custom/custom-prompt.js +419 -0
  111. package/dist/prompts/custom/custom-prompt.js.map +1 -0
  112. package/dist/prompts/fun/arcade-game.d.ts +152 -0
  113. package/dist/prompts/fun/arcade-game.d.ts.map +1 -0
  114. package/dist/prompts/fun/arcade-game.js +653 -0
  115. package/dist/prompts/fun/arcade-game.js.map +1 -0
  116. package/dist/prompts/fun/create_text_adventure.d.ts +100 -0
  117. package/dist/prompts/fun/create_text_adventure.d.ts.map +1 -0
  118. package/dist/prompts/fun/create_text_adventure.js +397 -0
  119. package/dist/prompts/fun/create_text_adventure.js.map +1 -0
  120. package/dist/prompts/fun/css-art-generator.d.ts +168 -0
  121. package/dist/prompts/fun/css-art-generator.d.ts.map +1 -0
  122. package/dist/prompts/fun/css-art-generator.js +827 -0
  123. package/dist/prompts/fun/css-art-generator.js.map +1 -0
  124. package/dist/prompts/generate/project-documentation.d.ts +137 -0
  125. package/dist/prompts/generate/project-documentation.d.ts.map +1 -0
  126. package/dist/prompts/generate/project-documentation.js +666 -0
  127. package/dist/prompts/generate/project-documentation.js.map +1 -0
  128. package/dist/prompts/generate/refactoring.d.ts +164 -0
  129. package/dist/prompts/generate/refactoring.d.ts.map +1 -0
  130. package/dist/prompts/generate/refactoring.js +621 -0
  131. package/dist/prompts/generate/refactoring.js.map +1 -0
  132. package/dist/prompts/generate/responsive-component.d.ts +147 -0
  133. package/dist/prompts/generate/responsive-component.d.ts.map +1 -0
  134. package/dist/prompts/generate/responsive-component.js +955 -0
  135. package/dist/prompts/generate/responsive-component.js.map +1 -0
  136. package/dist/prompts/generate/typescript-conversion.d.ts +144 -0
  137. package/dist/prompts/generate/typescript-conversion.d.ts.map +1 -0
  138. package/dist/prompts/generate/typescript-conversion.js +527 -0
  139. package/dist/prompts/generate/typescript-conversion.js.map +1 -0
  140. package/dist/prompts/generate/unit-tests.d.ts +139 -0
  141. package/dist/prompts/generate/unit-tests.d.ts.map +1 -0
  142. package/dist/prompts/generate/unit-tests.js +578 -0
  143. package/dist/prompts/generate/unit-tests.js.map +1 -0
  144. package/dist/prompts/generate/wordpress-plugin.d.ts +179 -0
  145. package/dist/prompts/generate/wordpress-plugin.d.ts.map +1 -0
  146. package/dist/prompts/generate/wordpress-plugin.js +763 -0
  147. package/dist/prompts/generate/wordpress-plugin.js.map +1 -0
  148. package/dist/prompts/generate/wordpress-theme-from-static.d.ts +177 -0
  149. package/dist/prompts/generate/wordpress-theme-from-static.d.ts.map +1 -0
  150. package/dist/prompts/generate/wordpress-theme-from-static.js +695 -0
  151. package/dist/prompts/generate/wordpress-theme-from-static.js.map +1 -0
  152. package/dist/prompts/shared/cache-manager.d.ts +45 -0
  153. package/dist/prompts/shared/cache-manager.d.ts.map +1 -0
  154. package/dist/prompts/shared/cache-manager.js +129 -0
  155. package/dist/prompts/shared/cache-manager.js.map +1 -0
  156. package/dist/prompts/shared/helpers.d.ts +39 -0
  157. package/dist/prompts/shared/helpers.d.ts.map +1 -0
  158. package/dist/prompts/shared/helpers.js +151 -0
  159. package/dist/prompts/shared/helpers.js.map +1 -0
  160. package/dist/prompts/shared/templates.d.ts +35 -0
  161. package/dist/prompts/shared/templates.d.ts.map +1 -0
  162. package/dist/prompts/shared/templates.js +77 -0
  163. package/dist/prompts/shared/templates.js.map +1 -0
  164. package/dist/prompts/shared/types.d.ts +112 -0
  165. package/dist/prompts/shared/types.d.ts.map +1 -0
  166. package/dist/prompts/shared/types.js +5 -0
  167. package/dist/prompts/shared/types.js.map +1 -0
  168. package/dist/prompts/system/find-unused-files.d.ts +106 -0
  169. package/dist/prompts/system/find-unused-files.d.ts.map +1 -0
  170. package/dist/prompts/system/find-unused-files.js +353 -0
  171. package/dist/prompts/system/find-unused-files.js.map +1 -0
  172. package/dist/security/index.d.ts +39 -0
  173. package/dist/security/index.d.ts.map +1 -0
  174. package/dist/security/index.js +46 -0
  175. package/dist/security/index.js.map +1 -0
  176. package/dist/security/integration-helpers.d.ts +121 -0
  177. package/dist/security/integration-helpers.d.ts.map +1 -0
  178. package/dist/security/integration-helpers.js +190 -0
  179. package/dist/security/integration-helpers.js.map +1 -0
  180. package/dist/security/output-encoder.d.ts +94 -0
  181. package/dist/security/output-encoder.d.ts.map +1 -0
  182. package/dist/security/output-encoder.js +295 -0
  183. package/dist/security/output-encoder.js.map +1 -0
  184. package/dist/security/prompt-injection-guard.d.ts +59 -0
  185. package/dist/security/prompt-injection-guard.d.ts.map +1 -0
  186. package/dist/security/prompt-injection-guard.js +249 -0
  187. package/dist/security/prompt-injection-guard.js.map +1 -0
  188. package/dist/security/sanitisation.d.ts +67 -0
  189. package/dist/security/sanitisation.d.ts.map +1 -0
  190. package/dist/security/sanitisation.js +398 -0
  191. package/dist/security/sanitisation.js.map +1 -0
  192. package/dist/security/security-service.d.ts +103 -0
  193. package/dist/security/security-service.d.ts.map +1 -0
  194. package/dist/security/security-service.js +303 -0
  195. package/dist/security/security-service.js.map +1 -0
  196. package/dist/security-config.d.ts +45 -0
  197. package/dist/security-config.d.ts.map +1 -0
  198. package/dist/security-config.js +63 -0
  199. package/dist/security-config.js.map +1 -0
  200. package/dist/system/function-list.d.ts +61 -0
  201. package/dist/system/function-list.d.ts.map +1 -0
  202. package/dist/system/function-list.js +111 -0
  203. package/dist/system/function-list.js.map +1 -0
  204. package/dist/system/function-registry.d.ts +23 -0
  205. package/dist/system/function-registry.d.ts.map +1 -0
  206. package/dist/system/function-registry.js +136 -0
  207. package/dist/system/function-registry.js.map +1 -0
  208. package/dist/system/health-check.d.ts +33 -0
  209. package/dist/system/health-check.d.ts.map +1 -0
  210. package/dist/system/health-check.js +98 -0
  211. package/dist/system/health-check.js.map +1 -0
  212. package/dist/system/path-resolver.d.ts +55 -0
  213. package/dist/system/path-resolver.d.ts.map +1 -0
  214. package/dist/system/path-resolver.js +90 -0
  215. package/dist/system/path-resolver.js.map +1 -0
  216. package/dist/templates/plugin-template.d.ts +121 -0
  217. package/dist/templates/plugin-template.d.ts.map +1 -0
  218. package/dist/templates/plugin-template.js +450 -0
  219. package/dist/templates/plugin-template.js.map +1 -0
  220. package/dist/types/chunking-types.d.ts +88 -0
  221. package/dist/types/chunking-types.d.ts.map +1 -0
  222. package/dist/types/chunking-types.js +18 -0
  223. package/dist/types/chunking-types.js.map +1 -0
  224. package/dist/types/prompt-stages.d.ts +42 -0
  225. package/dist/types/prompt-stages.d.ts.map +1 -0
  226. package/dist/types/prompt-stages.js +6 -0
  227. package/dist/types/prompt-stages.js.map +1 -0
  228. package/dist/types.d.ts +46 -0
  229. package/dist/types.d.ts.map +1 -0
  230. package/dist/types.js +6 -0
  231. package/dist/types.js.map +1 -0
  232. package/dist/utils/css-parser.d.ts +26 -0
  233. package/dist/utils/css-parser.d.ts.map +1 -0
  234. package/dist/utils/css-parser.js +117 -0
  235. package/dist/utils/css-parser.js.map +1 -0
  236. package/dist/utils/path-resolver.d.ts +13 -0
  237. package/dist/utils/path-resolver.d.ts.map +1 -0
  238. package/dist/utils/path-resolver.js +78 -0
  239. package/dist/utils/path-resolver.js.map +1 -0
  240. package/dist/utils/plugin-utilities.d.ts +171 -0
  241. package/dist/utils/plugin-utilities.d.ts.map +1 -0
  242. package/dist/utils/plugin-utilities.js +221 -0
  243. package/dist/utils/plugin-utilities.js.map +1 -0
  244. package/dist/utils/streamHandler.d.ts +3 -0
  245. package/dist/utils/streamHandler.d.ts.map +1 -0
  246. package/dist/utils/streamHandler.js +137 -0
  247. package/dist/utils/streamHandler.js.map +1 -0
  248. package/dist/validation/output-validator.d.ts +136 -0
  249. package/dist/validation/output-validator.d.ts.map +1 -0
  250. package/dist/validation/output-validator.js +262 -0
  251. package/dist/validation/output-validator.js.map +1 -0
  252. package/dist/validation/response-factory.d.ts +44 -0
  253. package/dist/validation/response-factory.d.ts.map +1 -0
  254. package/dist/validation/response-factory.js +202 -0
  255. package/dist/validation/response-factory.js.map +1 -0
  256. package/dist/validation/schemas.d.ts +519 -0
  257. package/dist/validation/schemas.d.ts.map +1 -0
  258. package/dist/validation/schemas.js +6 -0
  259. package/dist/validation/schemas.js.map +1 -0
  260. package/package.json +72 -0
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Custom Prompt Executor - Modern v4.3 Universal Template
3
+ *
4
+ * Universal fallback function that allows Claude to communicate any task directly to local LLM
5
+ * Acts as the Swiss Army knife for tasks that don't match other specialized functions
6
+ *
7
+ * Created using the modern universal template architecture
8
+ */
9
+ import { BasePlugin } from '../../plugins/base-plugin.js';
10
+ import { IPromptPlugin } from '../shared/types.js';
11
+ import { PromptStages } from '../../types/prompt-stages.js';
12
+ export declare class CustomPromptExecutor extends BasePlugin implements IPromptPlugin {
13
+ name: string;
14
+ category: "custom";
15
+ description: string;
16
+ parameters: {
17
+ code: {
18
+ type: "string";
19
+ description: string;
20
+ required: boolean;
21
+ };
22
+ filePath: {
23
+ type: "string";
24
+ description: string;
25
+ required: boolean;
26
+ };
27
+ projectPath: {
28
+ type: "string";
29
+ description: string;
30
+ required: boolean;
31
+ };
32
+ files: {
33
+ type: "array";
34
+ description: string;
35
+ required: boolean;
36
+ items: {
37
+ type: "string";
38
+ };
39
+ };
40
+ maxDepth: {
41
+ type: "number";
42
+ description: string;
43
+ required: boolean;
44
+ default: number;
45
+ };
46
+ prompt: {
47
+ type: "string";
48
+ description: string;
49
+ required: boolean;
50
+ };
51
+ working_directory: {
52
+ type: "string";
53
+ description: string;
54
+ required: boolean;
55
+ };
56
+ context: {
57
+ type: "object";
58
+ description: string;
59
+ required: boolean;
60
+ properties: {
61
+ task_type: {
62
+ type: "string";
63
+ };
64
+ requirements: {
65
+ type: "array";
66
+ };
67
+ constraints: {
68
+ type: "array";
69
+ };
70
+ output_format: {
71
+ type: "string";
72
+ };
73
+ };
74
+ };
75
+ language: {
76
+ type: "string";
77
+ description: string;
78
+ required: boolean;
79
+ default: string;
80
+ };
81
+ analysisDepth: {
82
+ type: "string";
83
+ description: string;
84
+ enum: string[];
85
+ default: string;
86
+ required: boolean;
87
+ };
88
+ analysisType: {
89
+ type: "string";
90
+ description: string;
91
+ enum: string[];
92
+ default: string;
93
+ required: boolean;
94
+ };
95
+ };
96
+ private analysisCache;
97
+ private multiFileAnalysis;
98
+ constructor();
99
+ execute(params: any, llmClient: any): Promise<any>;
100
+ /**
101
+ * Auto-detect whether this is single-file or multi-file analysis
102
+ */
103
+ private detectAnalysisMode;
104
+ /**
105
+ * Validate parameters based on detected analysis mode
106
+ */
107
+ private validateParameters;
108
+ /**
109
+ * Execute single-file analysis
110
+ */
111
+ private executeSingleFileAnalysis;
112
+ /**
113
+ * Execute multi-file analysis
114
+ */
115
+ private executeMultiFileAnalysis;
116
+ /**
117
+ * Single-file prompt stages - optimized for universal custom tasks
118
+ */
119
+ private getSingleFilePromptStages;
120
+ /**
121
+ * Multi-file prompt stages - optimized for complex custom tasks across multiple files
122
+ */
123
+ private getMultiFilePromptStages;
124
+ /**
125
+ * Backwards compatibility method
126
+ */
127
+ getPromptStages(params: any): PromptStages;
128
+ private discoverRelevantFiles;
129
+ private performMultiFileAnalysis;
130
+ private analyzeIndividualFile;
131
+ private getFileExtensions;
132
+ private generateCacheKey;
133
+ }
134
+ export default CustomPromptExecutor;
135
+ //# sourceMappingURL=custom-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-prompt.d.ts","sourceRoot":"","sources":["../../../src/prompts/custom/custom-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAa5D,qBAAa,oBAAqB,SAAQ,UAAW,YAAW,aAAa;IAC3E,IAAI,SAAmB;IACvB,QAAQ,EAAG,QAAQ,CAAU;IAC7B,WAAW,SAAuS;IAGlT,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6ER;IAEF,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,iBAAiB,CAA2B;;IAO9C,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG;IAyBzC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA2B1B;;OAEG;YACW,yBAAyB;IAgEvC;;OAEG;YACW,wBAAwB;IA0CtC;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAsDjC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAkDhC;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,YAAY;YAW5B,qBAAqB;YASrB,wBAAwB;YA6CxB,qBAAqB;IAenC,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,gBAAgB;CAKzB;AAED,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,419 @@
1
+ /**
2
+ * Custom Prompt Executor - Modern v4.3 Universal Template
3
+ *
4
+ * Universal fallback function that allows Claude to communicate any task directly to local LLM
5
+ * Acts as the Swiss Army knife for tasks that don't match other specialized functions
6
+ *
7
+ * Created using the modern universal template architecture
8
+ */
9
+ import { BasePlugin } from '../../plugins/base-plugin.js';
10
+ import { ThreeStagePromptManager } from '../../core/ThreeStagePromptManager.js';
11
+ import { withSecurity } from '../../security/integration-helpers.js';
12
+ import { readFileContent } from '../shared/helpers.js';
13
+ import { ModelSetup, ResponseProcessor, ParameterValidator, ErrorHandler, MultiFileAnalysis, TokenCalculator } from '../../utils/plugin-utilities.js';
14
+ import { getAnalysisCache } from '../../cache/index.js';
15
+ export class CustomPromptExecutor extends BasePlugin {
16
+ constructor() {
17
+ super();
18
+ this.name = 'custom_prompt';
19
+ this.category = 'custom';
20
+ this.description = 'Universal fallback executor for any custom prompt with optional file context. Uses dynamic token allocation based on your loaded model - can handle everything from quick tasks to comprehensive multi-file analysis. The Swiss Army knife when no other specialized function matches your needs.';
21
+ // Universal parameter set - supports both single and multi-file scenarios
22
+ this.parameters = {
23
+ // Single-file parameters
24
+ code: {
25
+ type: 'string',
26
+ description: 'The code to analyze (for single-file analysis)',
27
+ required: false
28
+ },
29
+ filePath: {
30
+ type: 'string',
31
+ description: 'Path to single file to analyze',
32
+ required: false
33
+ },
34
+ // Multi-file parameters
35
+ projectPath: {
36
+ type: 'string',
37
+ description: 'Path to project root (for multi-file analysis)',
38
+ required: false
39
+ },
40
+ files: {
41
+ type: 'array',
42
+ description: 'Array of specific file paths to include as context',
43
+ required: false,
44
+ items: { type: 'string' }
45
+ },
46
+ maxDepth: {
47
+ type: 'number',
48
+ description: 'Maximum directory depth for multi-file discovery (1-5)',
49
+ required: false,
50
+ default: 3
51
+ },
52
+ // Custom prompt specific parameters
53
+ prompt: {
54
+ type: 'string',
55
+ description: 'The custom prompt/task to send to local LLM',
56
+ required: true
57
+ },
58
+ working_directory: {
59
+ type: 'string',
60
+ description: 'Working directory context (defaults to current working directory)',
61
+ required: false
62
+ },
63
+ context: {
64
+ type: 'object',
65
+ description: 'Optional structured context object for the task',
66
+ required: false,
67
+ properties: {
68
+ task_type: { type: 'string' },
69
+ requirements: { type: 'array' },
70
+ constraints: { type: 'array' },
71
+ output_format: { type: 'string' }
72
+ }
73
+ },
74
+ // Universal parameters
75
+ language: {
76
+ type: 'string',
77
+ description: 'Programming language (if applicable)',
78
+ required: false,
79
+ default: 'text'
80
+ },
81
+ analysisDepth: {
82
+ type: 'string',
83
+ description: 'Level of analysis detail',
84
+ enum: ['basic', 'detailed', 'comprehensive'],
85
+ default: 'detailed',
86
+ required: false
87
+ },
88
+ analysisType: {
89
+ type: 'string',
90
+ description: 'Type of analysis to perform',
91
+ enum: ['general', 'technical', 'creative', 'analytical'],
92
+ default: 'general',
93
+ required: false
94
+ }
95
+ };
96
+ this.analysisCache = getAnalysisCache();
97
+ this.multiFileAnalysis = new MultiFileAnalysis();
98
+ // Cache and analysis utilities are initialized above
99
+ }
100
+ async execute(params, llmClient) {
101
+ return await withSecurity(this, params, llmClient, async (secureParams) => {
102
+ try {
103
+ // 1. Auto-detect analysis mode based on parameters
104
+ const analysisMode = this.detectAnalysisMode(secureParams);
105
+ // 2. Validate parameters based on detected mode
106
+ this.validateParameters(secureParams, analysisMode);
107
+ // 3. Setup model
108
+ const { model, contextLength } = await ModelSetup.getReadyModel(llmClient);
109
+ // 4. Route to appropriate analysis method
110
+ if (analysisMode === 'single-file') {
111
+ return await this.executeSingleFileAnalysis(secureParams, model, contextLength);
112
+ }
113
+ else {
114
+ return await this.executeMultiFileAnalysis(secureParams, model, contextLength);
115
+ }
116
+ }
117
+ catch (error) {
118
+ return ErrorHandler.createExecutionError('custom_prompt', error);
119
+ }
120
+ });
121
+ }
122
+ /**
123
+ * Auto-detect whether this is single-file or multi-file analysis
124
+ */
125
+ detectAnalysisMode(params) {
126
+ // Multi-file indicators
127
+ if (params.projectPath || (params.files && params.files.length > 1)) {
128
+ return 'multi-file';
129
+ }
130
+ // Single-file indicators or no file context (just prompt)
131
+ if (params.code || params.filePath || (params.files && params.files.length === 1) || (!params.projectPath && !params.files)) {
132
+ return 'single-file';
133
+ }
134
+ // Default to single-file for simple prompts
135
+ return 'single-file';
136
+ }
137
+ /**
138
+ * Validate parameters based on detected analysis mode
139
+ */
140
+ validateParameters(params, mode) {
141
+ // Always require the prompt
142
+ if (!params.prompt || typeof params.prompt !== 'string') {
143
+ throw new Error('Prompt is required and must be a string');
144
+ }
145
+ if (mode === 'single-file') {
146
+ // Single-file mode can work with just a prompt, or with file context
147
+ if (params.filePath) {
148
+ ParameterValidator.validateCodeOrFile(params);
149
+ }
150
+ }
151
+ else {
152
+ // Multi-file mode requires either projectPath or files array
153
+ if (!params.projectPath && !params.files) {
154
+ throw new Error('Multi-file mode requires either projectPath or files array');
155
+ }
156
+ if (params.projectPath) {
157
+ ParameterValidator.validateProjectPath(params);
158
+ }
159
+ ParameterValidator.validateDepth(params);
160
+ }
161
+ // Universal validations
162
+ ParameterValidator.validateEnum(params, 'analysisType', ['general', 'technical', 'creative', 'analytical']);
163
+ ParameterValidator.validateEnum(params, 'analysisDepth', ['basic', 'detailed', 'comprehensive']);
164
+ }
165
+ /**
166
+ * Execute single-file analysis
167
+ */
168
+ async executeSingleFileAnalysis(params, model, contextLength) {
169
+ // Process single file input
170
+ let codeToAnalyze = params.code || '';
171
+ if (params.filePath) {
172
+ codeToAnalyze = await readFileContent(params.filePath);
173
+ }
174
+ else if (params.files && params.files.length === 1) {
175
+ codeToAnalyze = await readFileContent(params.files[0]);
176
+ }
177
+ // Generate prompt stages for single file
178
+ const promptStages = this.getSingleFilePromptStages({
179
+ ...params,
180
+ code: codeToAnalyze
181
+ });
182
+ // Execute with appropriate method
183
+ const promptManager = new ThreeStagePromptManager(contextLength);
184
+ const needsChunking = promptManager.needsChunking(promptStages);
185
+ if (needsChunking) {
186
+ const conversation = promptManager.createChunkedConversation(promptStages);
187
+ const messages = [
188
+ conversation.systemMessage,
189
+ ...conversation.dataMessages,
190
+ conversation.analysisMessage
191
+ ];
192
+ return await ResponseProcessor.executeChunked(messages, model, contextLength, 'custom_prompt', 'single');
193
+ }
194
+ else {
195
+ // Use proper dynamic token calculation for custom prompts
196
+ const maxTokens = TokenCalculator.calculateForDirect(promptStages, contextLength, {
197
+ minTokens: 2000, // Minimum for code generation
198
+ maxTokens: Math.floor(contextLength * 0.7), // Generous for custom tasks
199
+ bufferTokens: 1000 // Safety buffer
200
+ });
201
+ const fullPrompt = `${promptStages.systemAndContext}
202
+
203
+ ${promptStages.dataPayload}
204
+
205
+ ${promptStages.outputInstructions}`;
206
+ const response = await model.complete(fullPrompt, { maxTokens, temperature: 0.7 });
207
+ return {
208
+ success: true,
209
+ timestamp: new Date().toISOString(),
210
+ modelUsed: model.identifier || 'unknown',
211
+ executionTimeMs: 0,
212
+ data: response?.content || response?.text || response || 'No response content'
213
+ };
214
+ }
215
+ }
216
+ /**
217
+ * Execute multi-file analysis
218
+ */
219
+ async executeMultiFileAnalysis(params, model, contextLength) {
220
+ // Discover files
221
+ let filesToAnalyze = params.files ||
222
+ await this.discoverRelevantFiles(params.projectPath, params.maxDepth, params.analysisType);
223
+ // Perform multi-file analysis with caching
224
+ const analysisResult = await this.performMultiFileAnalysis(filesToAnalyze, params, model, contextLength);
225
+ // Generate prompt stages for multi-file
226
+ const promptStages = this.getMultiFilePromptStages({
227
+ ...params,
228
+ analysisResult,
229
+ fileCount: filesToAnalyze.length
230
+ });
231
+ // Always use chunking for multi-file
232
+ const promptManager = new ThreeStagePromptManager(contextLength);
233
+ const conversation = promptManager.createChunkedConversation(promptStages);
234
+ const messages = [
235
+ conversation.systemMessage,
236
+ ...conversation.dataMessages,
237
+ conversation.analysisMessage
238
+ ];
239
+ return await ResponseProcessor.executeChunked(messages, model, contextLength, 'custom_prompt', 'multifile');
240
+ }
241
+ /**
242
+ * Single-file prompt stages - optimized for universal custom tasks
243
+ */
244
+ getSingleFilePromptStages(params) {
245
+ const { prompt, code, language, analysisDepth, analysisType, context, working_directory } = params;
246
+ let systemAndContext = `You are an expert AI assistant specializing in ${analysisDepth} ${analysisType} tasks.
247
+
248
+ **Your Role**: Universal problem-solver and task executor with full access to dynamic token allocation
249
+ **Analysis Context**:
250
+ - Task Type: ${analysisType}
251
+ - Analysis Depth: ${analysisDepth}
252
+ - Language: ${language}
253
+ - Mode: Single File/Context Analysis
254
+ - Token Allocation: Dynamic (optimized for your current model's context window)
255
+
256
+ **Your Mission**: Execute the custom task with precision, creativity, and actionable results. You have access to the full context window of the loaded model, so don't hesitate to be comprehensive when the task requires it. You are the Swiss Army knife - adaptable, reliable, and comprehensive.`;
257
+ if (working_directory) {
258
+ systemAndContext += `\n- Working Directory: ${working_directory}`;
259
+ }
260
+ if (context) {
261
+ systemAndContext += `\n\n**Task Context**:`;
262
+ if (context.task_type)
263
+ systemAndContext += `\n- Task Type: ${context.task_type}`;
264
+ if (context.requirements)
265
+ systemAndContext += `\n- Requirements: ${Array.isArray(context.requirements) ? context.requirements.join(', ') : context.requirements}`;
266
+ if (context.constraints)
267
+ systemAndContext += `\n- Constraints: ${Array.isArray(context.constraints) ? context.constraints.join(', ') : context.constraints}`;
268
+ if (context.output_format)
269
+ systemAndContext += `\n- Output Format: ${context.output_format}`;
270
+ }
271
+ let dataPayload = '';
272
+ if (code && code.trim()) {
273
+ dataPayload = `**File Content for Analysis:**
274
+
275
+ \`\`\`${language}
276
+ ${code}
277
+ \`\`\``;
278
+ }
279
+ else {
280
+ dataPayload = `**Context**: Ready to execute custom task without specific file context.`;
281
+ }
282
+ const outputInstructions = `**CUSTOM TASK TO EXECUTE:**
283
+
284
+ ${prompt}
285
+
286
+ **Your Response Should:**
287
+ - Directly address the task requirements
288
+ - Be actionable and practical
289
+ - Match the requested output format (if specified)
290
+ - Demonstrate deep understanding and expertise
291
+ - Provide clear, implementable solutions
292
+
293
+ Execute this task with excellence and precision. You are Claude's trusted specialist for custom operations.`;
294
+ return { systemAndContext, dataPayload, outputInstructions };
295
+ }
296
+ /**
297
+ * Multi-file prompt stages - optimized for complex custom tasks across multiple files
298
+ */
299
+ getMultiFilePromptStages(params) {
300
+ const { prompt, analysisResult, analysisType, analysisDepth, fileCount, context, working_directory } = params;
301
+ let systemAndContext = `You are an expert multi-file AI analyst specializing in ${analysisDepth} ${analysisType} tasks.
302
+
303
+ **Your Role**: Advanced multi-file task executor and architectural consultant with full dynamic token access
304
+ **Analysis Context**:
305
+ - Task Type: ${analysisType}
306
+ - Analysis Depth: ${analysisDepth}
307
+ - Files Processed: ${fileCount}
308
+ - Mode: Multi-File Custom Analysis
309
+ - Token Allocation: Dynamic (full model context window available)
310
+
311
+ **Your Mission**: Execute complex custom tasks across multiple files with comprehensive understanding. You have access to the full context window, so provide detailed, thorough analysis when appropriate. You excel at seeing patterns, relationships, and providing strategic insights across entire codebases and project structures.`;
312
+ if (working_directory) {
313
+ systemAndContext += `\n- Working Directory: ${working_directory}`;
314
+ }
315
+ if (context) {
316
+ systemAndContext += `\n\n**Task Context**:`;
317
+ if (context.task_type)
318
+ systemAndContext += `\n- Task Type: ${context.task_type}`;
319
+ if (context.requirements)
320
+ systemAndContext += `\n- Requirements: ${Array.isArray(context.requirements) ? context.requirements.join(', ') : context.requirements}`;
321
+ if (context.constraints)
322
+ systemAndContext += `\n- Constraints: ${Array.isArray(context.constraints) ? context.constraints.join(', ') : context.constraints}`;
323
+ if (context.output_format)
324
+ systemAndContext += `\n- Output Format: ${context.output_format}`;
325
+ }
326
+ const dataPayload = `**Multi-File Analysis Results:**
327
+
328
+ ${JSON.stringify(analysisResult, null, 2)}
329
+
330
+ **Files Analyzed**: ${fileCount} files processed across the project structure.`;
331
+ const outputInstructions = `**CUSTOM MULTI-FILE TASK TO EXECUTE:**
332
+
333
+ ${prompt}
334
+
335
+ **Your Multi-File Response Should:**
336
+ - Synthesize insights across all ${fileCount} analyzed files
337
+ - Identify cross-file patterns, dependencies, and relationships
338
+ - Provide architectural and strategic recommendations
339
+ - Address the task with comprehensive project-wide understanding
340
+ - Deliver actionable results that consider the entire codebase context
341
+ - Match any specified output format requirements
342
+
343
+ Execute this complex multi-file task with expert-level analysis and strategic thinking. You are Claude's advanced specialist for comprehensive project-wide operations.`;
344
+ return { systemAndContext, dataPayload, outputInstructions };
345
+ }
346
+ /**
347
+ * Backwards compatibility method
348
+ */
349
+ getPromptStages(params) {
350
+ const mode = this.detectAnalysisMode(params);
351
+ if (mode === 'single-file') {
352
+ return this.getSingleFilePromptStages(params);
353
+ }
354
+ else {
355
+ return this.getMultiFilePromptStages(params);
356
+ }
357
+ }
358
+ // Multi-file helper methods
359
+ async discoverRelevantFiles(projectPath, maxDepth, analysisType) {
360
+ const extensions = this.getFileExtensions(analysisType);
361
+ return await this.multiFileAnalysis.discoverFiles(projectPath, extensions, maxDepth);
362
+ }
363
+ async performMultiFileAnalysis(files, params, model, contextLength) {
364
+ const cacheKey = this.analysisCache.generateKey('custom_prompt', params, files);
365
+ const cached = await this.analysisCache.get(cacheKey);
366
+ if (cached)
367
+ return cached;
368
+ const fileAnalysisResults = await this.multiFileAnalysis.analyzeBatch(files, (file) => this.analyzeIndividualFile(file, params, model), contextLength);
369
+ // Aggregate results into proper analysis result format
370
+ const aggregatedResult = {
371
+ summary: `Multi-file custom task analysis of ${files.length} files`,
372
+ findings: fileAnalysisResults,
373
+ data: {
374
+ fileCount: files.length,
375
+ totalSize: fileAnalysisResults.reduce((sum, result) => sum + (result.size || 0), 0),
376
+ customTaskContext: {
377
+ prompt: params.prompt,
378
+ analysisType: params.analysisType,
379
+ context: params.context
380
+ }
381
+ }
382
+ };
383
+ await this.analysisCache.cacheAnalysis(cacheKey, aggregatedResult, {
384
+ modelUsed: model.identifier || 'unknown',
385
+ executionTime: Date.now() - Date.now(), // TODO: Track actual execution time
386
+ timestamp: new Date().toISOString()
387
+ });
388
+ return aggregatedResult;
389
+ }
390
+ async analyzeIndividualFile(file, params, model) {
391
+ const content = await import('fs/promises').then(fs => fs.readFile(file, 'utf-8'));
392
+ return {
393
+ filePath: file,
394
+ size: content.length,
395
+ lines: content.split('\n').length,
396
+ extension: file.split('.').pop() || '',
397
+ customContext: {
398
+ taskType: params.analysisType,
399
+ prompt: params.prompt
400
+ }
401
+ };
402
+ }
403
+ getFileExtensions(analysisType) {
404
+ const extensionMap = {
405
+ 'general': ['.js', '.ts', '.jsx', '.tsx', '.php', '.py', '.java', '.md', '.txt', '.json', '.xml', '.css', '.html'],
406
+ 'technical': ['.js', '.ts', '.jsx', '.tsx', '.php', '.py', '.java', '.cs', '.cpp', '.h', '.go', '.rs', '.rb'],
407
+ 'creative': ['.md', '.txt', '.html', '.css', '.json', '.xml', '.yml', '.yaml'],
408
+ 'analytical': ['.js', '.ts', '.jsx', '.tsx', '.php', '.py', '.java', '.json', '.csv', '.sql', '.md']
409
+ };
410
+ return extensionMap[analysisType] || extensionMap.general;
411
+ }
412
+ generateCacheKey(files, params) {
413
+ const fileHash = files.join('|');
414
+ const paramHash = JSON.stringify(params);
415
+ return `${fileHash}_${paramHash}`.substring(0, 64);
416
+ }
417
+ }
418
+ export default CustomPromptExecutor;
419
+ //# sourceMappingURL=custom-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-prompt.js","sourceRoot":"","sources":["../../../src/prompts/custom/custom-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAwFlD;QACE,KAAK,EAAE,CAAC;QAxFV,SAAI,GAAG,eAAe,CAAC;QACvB,aAAQ,GAAG,QAAiB,CAAC;QAC7B,gBAAW,GAAG,mSAAmS,CAAC;QAElT,0EAA0E;QAC1E,eAAU,GAAG;YACX,yBAAyB;YACzB,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAiB;gBACvB,WAAW,EAAE,gDAAgD;gBAC7D,QAAQ,EAAE,KAAK;aAChB;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAiB;gBACvB,WAAW,EAAE,gCAAgC;gBAC7C,QAAQ,EAAE,KAAK;aAChB;YAED,0BAA0B;YAC1B,WAAW,EAAE;gBACX,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