@ai-dev-tools/csharp-copilot-core 0.0.19
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/ai-dev-tools-csharp-copilot-core-0.0.19.tgz +0 -0
- package/azure-pipelines.yml +52 -0
- package/out/analyze/cecil.d.ts +1 -0
- package/out/analyze/cecil.js +42 -0
- package/out/analyze/cecil.js.map +1 -0
- package/out/analyze/checkCodeSyntax.d.ts +7 -0
- package/out/analyze/checkCodeSyntax.js +67 -0
- package/out/analyze/checkCodeSyntax.js.map +1 -0
- package/out/analyze/generateCodeDependency.d.ts +6 -0
- package/out/analyze/generateCodeDependency.js +122 -0
- package/out/analyze/generateCodeDependency.js.map +1 -0
- package/out/analyze/installAnalyzerTool.d.ts +1 -0
- package/out/analyze/installAnalyzerTool.js +82 -0
- package/out/analyze/installAnalyzerTool.js.map +1 -0
- package/out/atmpCache/deps/EplantRequestCategoryCondition_Conditions_Eplant_Workflows_SharedSegmentsPlugins_SharedSegments_SharedSegments_CSServiceFundamental_code_D.deps +281 -0
- package/out/atmpCache/deps/IdentitySelectAnalyzer_ToListinatorAnalyzers_src_AIUnitTestExample_code_d.deps +1 -0
- package/out/atmpCache/deps/SqmidHelperTests_Utils_HttpRequestParser_Overview_Workflows_SharedSegmentsTests_SharedSegments_SharedSegments_CSServiceFundamental_code_D.deps +1 -0
- package/out/atmpCache/deps/SqmidHelper_Utils_HttpRequestParser_Overview_Workflows_SharedSegmentsPlugins_SharedSegments_SharedSegments_CSServiceFundamental_code_D.deps +1 -0
- package/out/atmpCache/deps/ToListCountAnalyzerTests_ToListinatorTests_test_AIUnitTestExample_code_d.deps +4037 -0
- package/out/atmpCache/deps/ToListCountAnalyzer_ToListinatorAnalyzers_src_AIUnitTestExample_code_d.deps +1 -0
- package/out/atmpCache/deps/ToListCountCodeFixProvider_ToListinatorCodeFixes_src_AIUnitTestExample_code_d.deps +1 -0
- package/out/atmpCache/deps/ToListForEachAnalyzer_ToListinatorAnalyzers_src_AIUnitTestExample_code_d.deps +1 -0
- package/out/atmpCache/dllref/ToListinatorTests_ToListinatorTests_test_AIUnitTestExample_code_d.dllref +202 -0
- package/out/batch/generateCodeTests.d.ts +6 -0
- package/out/batch/generateCodeTests.js +147 -0
- package/out/batch/generateCodeTests.js.map +1 -0
- package/out/batch/getFolderCodeFile.d.ts +1 -0
- package/out/batch/getFolderCodeFile.js +19 -0
- package/out/batch/getFolderCodeFile.js.map +1 -0
- package/out/batch/getProjectCodeFile.d.ts +4 -0
- package/out/batch/getProjectCodeFile.js +87 -0
- package/out/batch/getProjectCodeFile.js.map +1 -0
- package/out/batch/getSolutionCodeFile.d.ts +8 -0
- package/out/batch/getSolutionCodeFile.js +70 -0
- package/out/batch/getSolutionCodeFile.js.map +1 -0
- package/out/benchmark/formatToMarkdown.d.ts +2 -0
- package/out/benchmark/formatToMarkdown.js +101 -0
- package/out/benchmark/formatToMarkdown.js.map +1 -0
- package/out/benchmark/generateBenchmarkReport.d.ts +1 -0
- package/out/benchmark/generateBenchmarkReport.js +82 -0
- package/out/benchmark/generateBenchmarkReport.js.map +1 -0
- package/out/codeCoverage/codeCoverage.d.ts +6 -0
- package/out/codeCoverage/codeCoverage.js +35 -0
- package/out/codeCoverage/codeCoverage.js.map +1 -0
- package/out/codeCoverage/codeCoverageReport.d.ts +6 -0
- package/out/codeCoverage/codeCoverageReport.js +72 -0
- package/out/codeCoverage/codeCoverageReport.js.map +1 -0
- package/out/codeCoverage/extractCodeCoverageInfo.d.ts +2 -0
- package/out/codeCoverage/extractCodeCoverageInfo.js +80 -0
- package/out/codeCoverage/extractCodeCoverageInfo.js.map +1 -0
- package/out/codeCoverage/generateCodeCoverageReport.d.ts +1 -0
- package/out/codeCoverage/generateCodeCoverageReport.js +27 -0
- package/out/codeCoverage/generateCodeCoverageReport.js.map +1 -0
- package/out/codeCoverage/getCodeCoverageSetting.d.ts +1 -0
- package/out/codeCoverage/getCodeCoverageSetting.js +58 -0
- package/out/codeCoverage/getCodeCoverageSetting.js.map +1 -0
- package/out/codeCoverage/reportTool.d.ts +2 -0
- package/out/codeCoverage/reportTool.js +22 -0
- package/out/codeCoverage/reportTool.js.map +1 -0
- package/out/codeCoverage/simplifyCoverageXml.d.ts +2 -0
- package/out/codeCoverage/simplifyCoverageXml.js +116 -0
- package/out/codeCoverage/simplifyCoverageXml.js.map +1 -0
- package/out/codebk/250804prompt/buildAfGuidelines.liquid +15 -0
- package/out/codebk/250804prompt/general/generalBuildAutofixGuidelines.liquid +13 -0
- package/out/codebk/250804prompt/general/generalUtGuidelines.liquid +18 -0
- package/out/codebk/250804prompt/generateUtAutoFix.liquid +19 -0
- package/out/codebk/250804prompt/generateUtGuidelines.liquid +13 -0
- package/out/codebk/250804prompt/generateUtSystem.liquid +5 -0
- package/out/codebk/250804prompt/generateUtUserInput.liquid +27 -0
- package/out/codebk/250804prompt/testAfGuidelines.liquid +6 -0
- package/out/codebk/250804prompt/xap/xapBuildAutofixGuidelines.liquid +13 -0
- package/out/codebk/250804prompt/xap/xapCodeCodeDependency.liquid +0 -0
- package/out/codebk/250804prompt/xap/xapCodeSample.liquid +38 -0
- package/out/codebk/250804prompt/xap/xapUtGuideline-240804.liquid +36 -0
- package/out/codebk/250804prompt/xap/xapUtGuideline.liquid +36 -0
- package/out/codebk/childProcessManager.d.ts +1 -0
- package/out/codebk/childProcessManager.js +50 -0
- package/out/codebk/childProcessManager.js.map +1 -0
- package/out/codebk/msBuidSpawn.d.ts +1 -0
- package/out/codebk/msBuidSpawn.js +58 -0
- package/out/codebk/msBuidSpawn.js.map +1 -0
- package/out/codebk/msBuild.d.ts +1 -0
- package/out/codebk/msBuild.js +123 -0
- package/out/codebk/msBuild.js.map +1 -0
- package/out/codebk/old/generateXapTestAutoFix.liquid +12 -0
- package/out/codebk/old/generateXapTestGuidelines-fm.liquid +68 -0
- package/out/codebk/old/generateXapTestGuidelines.liquid +28 -0
- package/out/codebk/old/xapGuideline-fm.liquid +149 -0
- package/out/codebk/old/xapGuideline.liquid +37 -0
- package/out/codebk/oldExec/checkCodeSyntax.d.ts +1 -0
- package/out/codebk/oldExec/checkCodeSyntax.js +81 -0
- package/out/codebk/oldExec/checkCodeSyntax.js.map +1 -0
- package/out/codebk/oldExec/codeCoverage.d.ts +1 -0
- package/out/codebk/oldExec/codeCoverage.js +54 -0
- package/out/codebk/oldExec/codeCoverage.js.map +1 -0
- package/out/codebk/oldExec/codeCoverageReport.d.ts +1 -0
- package/out/codebk/oldExec/codeCoverageReport.js +64 -0
- package/out/codebk/oldExec/codeCoverageReport.js.map +1 -0
- package/out/codebk/oldExec/containsMethods.d.ts +1 -0
- package/out/codebk/oldExec/containsMethods.js +74 -0
- package/out/codebk/oldExec/containsMethods.js.map +1 -0
- package/out/codebk/oldExec/generateCodeDependency.d.ts +1 -0
- package/out/codebk/oldExec/generateCodeDependency.js +95 -0
- package/out/codebk/oldExec/generateCodeDependency.js.map +1 -0
- package/out/codebk/oldExec/msBuild.d.ts +1 -0
- package/out/codebk/oldExec/msBuild.js +53 -0
- package/out/codebk/oldExec/msBuild.js.map +1 -0
- package/out/codebk/oldExec/vsTest.d.ts +1 -0
- package/out/codebk/oldExec/vsTest.js +71 -0
- package/out/codebk/oldExec/vsTest.js.map +1 -0
- package/out/codebk/prompts/general/generalUnitTestGuidelines-20250702.liquid +56 -0
- package/out/codebk/prompts/generateXapTestGuidelines-20250704.liquid +21 -0
- package/out/codebk/prompts/generateXapTestGuidelines-o.liquid +29 -0
- package/out/codebk/prompts/xap/xapGuideline-o.liquid +45 -0
- package/out/codebk/testbuildkill.d.ts +1 -0
- package/out/codebk/testbuildkill.js +37 -0
- package/out/codebk/testbuildkill.js.map +1 -0
- package/out/command/index.d.ts +2 -0
- package/out/command/index.js +85 -0
- package/out/command/index.js.map +1 -0
- package/out/command/utGenWrapper.d.ts +3 -0
- package/out/command/utGenWrapper.js +40 -0
- package/out/command/utGenWrapper.js.map +1 -0
- package/out/exit/childProcessManager.d.ts +2 -0
- package/out/exit/childProcessManager.js +43 -0
- package/out/exit/childProcessManager.js.map +1 -0
- package/out/exit/setupProcessSignalHandler.d.ts +1 -0
- package/out/exit/setupProcessSignalHandler.js +18 -0
- package/out/exit/setupProcessSignalHandler.js.map +1 -0
- package/out/gen/autoFix.d.ts +4 -0
- package/out/gen/autoFix.js +125 -0
- package/out/gen/autoFix.js.map +1 -0
- package/out/gen/csharpUtGen.d.ts +2 -0
- package/out/gen/csharpUtGen.js +151 -0
- package/out/gen/csharpUtGen.js.map +1 -0
- package/out/gen/ensureValidLLMResponse.d.ts +1 -0
- package/out/gen/ensureValidLLMResponse.js +19 -0
- package/out/gen/ensureValidLLMResponse.js.map +1 -0
- package/out/gen/postGen/extractCodeFromResponse.d.ts +1 -0
- package/out/gen/postGen/extractCodeFromResponse.js +37 -0
- package/out/gen/postGen/extractCodeFromResponse.js.map +1 -0
- package/out/gen/postGen/postGenProcess.d.ts +1 -0
- package/out/gen/postGen/postGenProcess.js +36 -0
- package/out/gen/postGen/postGenProcess.js.map +1 -0
- package/out/gen/postGen/removeComments.d.ts +1 -0
- package/out/gen/postGen/removeComments.js +92 -0
- package/out/gen/postGen/removeComments.js.map +1 -0
- package/out/gen/postGen/removeSingleLines.d.ts +1 -0
- package/out/gen/postGen/removeSingleLines.js +28 -0
- package/out/gen/postGen/removeSingleLines.js.map +1 -0
- package/out/gen/postGen/repairRequiredNameSpaces.d.ts +1 -0
- package/out/gen/postGen/repairRequiredNameSpaces.js +116 -0
- package/out/gen/postGen/repairRequiredNameSpaces.js.map +1 -0
- package/out/gen/postGen/validateTestCode.d.ts +1 -0
- package/out/gen/postGen/validateTestCode.js +14 -0
- package/out/gen/postGen/validateTestCode.js.map +1 -0
- package/out/gen/preGen/excludeFileName.d.ts +1 -0
- package/out/gen/preGen/excludeFileName.js +49 -0
- package/out/gen/preGen/excludeFileName.js.map +1 -0
- package/out/gen/preGen/excludeSpecificTag.d.ts +1 -0
- package/out/gen/preGen/excludeSpecificTag.js +18 -0
- package/out/gen/preGen/excludeSpecificTag.js.map +1 -0
- package/out/gen/preGen/preGenProcess.d.ts +1 -0
- package/out/gen/preGen/preGenProcess.js +22 -0
- package/out/gen/preGen/preGenProcess.js.map +1 -0
- package/out/gen/preGen/validateCode.d.ts +3 -0
- package/out/gen/preGen/validateCode.js +62 -0
- package/out/gen/preGen/validateCode.js.map +1 -0
- package/out/index.d.ts +2 -0
- package/out/index.js +8 -0
- package/out/index.js.map +1 -0
- package/out/llm/model/Gpt4o.d.ts +1 -0
- package/out/llm/model/Gpt4o.js +91 -0
- package/out/llm/model/Gpt4o.js.map +1 -0
- package/out/llm/model/claude4.d.ts +1 -0
- package/out/llm/model/claude4.js +3 -0
- package/out/llm/model/claude4.js.map +1 -0
- package/out/llm/preparePrompt.d.ts +2 -0
- package/out/llm/preparePrompt.js +110 -0
- package/out/llm/preparePrompt.js.map +1 -0
- package/out/llm/prompt/buildAfGuidelines.liquid +15 -0
- package/out/llm/prompt/general/generalBuildAutofixGuidelines.liquid +13 -0
- package/out/llm/prompt/general/generalUtGuidelines.liquid +16 -0
- package/out/llm/prompt/generateUtAutoFix.liquid +19 -0
- package/out/llm/prompt/generateUtDependency.liquid +3 -0
- package/out/llm/prompt/generateUtGuidelines.liquid +29 -0
- package/out/llm/prompt/generateUtSystem.liquid +5 -0
- package/out/llm/prompt/generateUtTemplate.liquid +30 -0
- package/out/llm/prompt/generateUtUserInput.liquid +4 -0
- package/out/llm/prompt/testAfGuidelines.liquid +6 -0
- package/out/llm/prompt/userCustomPrompt.liquid +0 -0
- package/out/llm/prompt/xap/xapBuildAutofixGuidelines.liquid +13 -0
- package/out/llm/prompt/xap/xapCodeCodeDependency.liquid +0 -0
- package/out/llm/prompt/xap/xapCodeSample.liquid +38 -0
- package/out/llm/prompt/xap/xapUtGuideline-240804.liquid +36 -0
- package/out/llm/prompt/xap/xapUtGuideline.liquid +37 -0
- package/out/llm/sendRequestToLLM.d.ts +4 -0
- package/out/llm/sendRequestToLLM.js +12 -0
- package/out/llm/sendRequestToLLM.js.map +1 -0
- package/out/llm/sendRequestToSelfHostLLM.d.ts +4 -0
- package/out/llm/sendRequestToSelfHostLLM.js +41 -0
- package/out/llm/sendRequestToSelfHostLLM.js.map +1 -0
- package/out/metrics/appInsightTelemetry.d.ts +6 -0
- package/out/metrics/appInsightTelemetry.js +77 -0
- package/out/metrics/appInsightTelemetry.js.map +1 -0
- package/out/metrics/machineId.d.ts +11 -0
- package/out/metrics/machineId.js +85 -0
- package/out/metrics/machineId.js.map +1 -0
- package/out/setup/setup.d.ts +1 -0
- package/out/setup/setup.js +10 -0
- package/out/setup/setup.js.map +1 -0
- package/out/setup/setupConsole.d.ts +1 -0
- package/out/setup/setupConsole.js +23 -0
- package/out/setup/setupConsole.js.map +1 -0
- package/out/setup/setupLLMRequest.d.ts +2 -0
- package/out/setup/setupLLMRequest.js +10 -0
- package/out/setup/setupLLMRequest.js.map +1 -0
- package/out/tools/devenvcom.cmd +13 -0
- package/out/tools/devenvexe.cmd +13 -0
- package/out/tools/msbuildexe.cmd +13 -0
- package/out/tools/vstestexe.cmd +13 -0
- package/out/types/benchmark.d.ts +11 -0
- package/out/types/benchmark.js +3 -0
- package/out/types/benchmark.js.map +1 -0
- package/out/types/buildResult.d.ts +8 -0
- package/out/types/buildResult.js +3 -0
- package/out/types/buildResult.js.map +1 -0
- package/out/types/constants.d.ts +3 -0
- package/out/types/constants.js +7 -0
- package/out/types/constants.js.map +1 -0
- package/out/types/genResult.d.ts +10 -0
- package/out/types/genResult.js +3 -0
- package/out/types/genResult.js.map +1 -0
- package/out/types/testResult.d.ts +12 -0
- package/out/types/testResult.js +3 -0
- package/out/types/testResult.js.map +1 -0
- package/out/types/verifyResult.d.ts +8 -0
- package/out/types/verifyResult.js +3 -0
- package/out/types/verifyResult.js.map +1 -0
- package/out/utils/checkTestProject.d.ts +2 -0
- package/out/utils/checkTestProject.js +79 -0
- package/out/utils/checkTestProject.js.map +1 -0
- package/out/utils/checkXapCode.d.ts +2 -0
- package/out/utils/checkXapCode.js +59 -0
- package/out/utils/checkXapCode.js.map +1 -0
- package/out/utils/delay.d.ts +1 -0
- package/out/utils/delay.js +7 -0
- package/out/utils/delay.js.map +1 -0
- package/out/utils/detectTestFramework.d.ts +1 -0
- package/out/utils/detectTestFramework.js +32 -0
- package/out/utils/detectTestFramework.js.map +1 -0
- package/out/utils/fileUtils.d.ts +2 -0
- package/out/utils/fileUtils.js +42 -0
- package/out/utils/fileUtils.js.map +1 -0
- package/out/utils/generateCodeSha256.d.ts +1 -0
- package/out/utils/generateCodeSha256.js +46 -0
- package/out/utils/generateCodeSha256.js.map +1 -0
- package/out/utils/getCodeStructurePath.d.ts +5 -0
- package/out/utils/getCodeStructurePath.js +155 -0
- package/out/utils/getCodeStructurePath.js.map +1 -0
- package/out/utils/getOrCreateDir.d.ts +2 -0
- package/out/utils/getOrCreateDir.js +63 -0
- package/out/utils/getOrCreateDir.js.map +1 -0
- package/out/utils/getTestCodeInfo.d.ts +2 -0
- package/out/utils/getTestCodeInfo.js +121 -0
- package/out/utils/getTestCodeInfo.js.map +1 -0
- package/out/utils/getTestFile.d.ts +13 -0
- package/out/utils/getTestFile.js +295 -0
- package/out/utils/getTestFile.js.map +1 -0
- package/out/utils/parseBuildResult.d.ts +3 -0
- package/out/utils/parseBuildResult.js +44 -0
- package/out/utils/parseBuildResult.js.map +1 -0
- package/out/utils/parseSyntaxCheckResult.d.ts +2 -0
- package/out/utils/parseSyntaxCheckResult.js +38 -0
- package/out/utils/parseSyntaxCheckResult.js.map +1 -0
- package/out/utils/parseVstestResult.d.ts +3 -0
- package/out/utils/parseVstestResult.js +61 -0
- package/out/utils/parseVstestResult.js.map +1 -0
- package/out/utils/removeFailedTestMethods.d.ts +3 -0
- package/out/utils/removeFailedTestMethods.js +207 -0
- package/out/utils/removeFailedTestMethods.js.map +1 -0
- package/out/utils/runCommand.d.ts +1 -0
- package/out/utils/runCommand.js +14 -0
- package/out/utils/runCommand.js.map +1 -0
- package/out/utils/spawnExec.d.ts +1 -0
- package/out/utils/spawnExec.js +80 -0
- package/out/utils/spawnExec.js.map +1 -0
- package/out/utils/verifyBuildErrorCausedFile.d.ts +1 -0
- package/out/utils/verifyBuildErrorCausedFile.js +60 -0
- package/out/utils/verifyBuildErrorCausedFile.js.map +1 -0
- package/out/utils/verifyTestCode.d.ts +2 -0
- package/out/utils/verifyTestCode.js +25 -0
- package/out/utils/verifyTestCode.js.map +1 -0
- package/out/utils/writeGenCode.d.ts +1 -0
- package/out/utils/writeGenCode.js +50 -0
- package/out/utils/writeGenCode.js.map +1 -0
- package/out/vs/msBuild.d.ts +13 -0
- package/out/vs/msBuild.js +81 -0
- package/out/vs/msBuild.js.map +1 -0
- package/out/vs/vsTest.d.ts +15 -0
- package/out/vs/vsTest.js +107 -0
- package/out/vs/vsTest.js.map +1 -0
- package/out/vs/vsTools.d.ts +7 -0
- package/out/vs/vsTools.js +177 -0
- package/out/vs/vsTools.js.map +1 -0
- package/out/vsPlugin/getVsPluginVerifyResult.d.ts +2 -0
- package/out/vsPlugin/getVsPluginVerifyResult.js +41 -0
- package/out/vsPlugin/getVsPluginVerifyResult.js.map +1 -0
- package/out/vsPlugin/interactionConstants.d.ts +2 -0
- package/out/vsPlugin/interactionConstants.js +10 -0
- package/out/vsPlugin/interactionConstants.js.map +1 -0
- package/out/vsPlugin/sendStdToVsPlugin.d.ts +1 -0
- package/out/vsPlugin/sendStdToVsPlugin.js +12 -0
- package/out/vsPlugin/sendStdToVsPlugin.js.map +1 -0
- package/out/vsPlugin/stdListener.d.ts +3 -0
- package/out/vsPlugin/stdListener.js +57 -0
- package/out/vsPlugin/stdListener.js.map +1 -0
- package/package.json +33 -0
- package/tools/devenvcom.cmd +13 -0
- package/tools/devenvexe.cmd +13 -0
- package/tools/msbuildexe.cmd +13 -0
- package/tools/vstestexe.cmd +13 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
You are a highly skilled software engineer specializing in C# unit testing with extensive knowledge in test frameworks, test patterns, and best practices.
|
|
2
|
+
|
|
3
|
+
====
|
|
4
|
+
|
|
5
|
+
RULES
|
|
6
|
+
|
|
7
|
+
{% include 'general/generalUtGuidelines' %}
|
|
8
|
+
|
|
9
|
+
{% if isXapTest %}
|
|
10
|
+
{% include 'xap/xapUtGuideline' %}
|
|
11
|
+
{%- endif -%}
|
|
12
|
+
|
|
13
|
+
====
|
|
14
|
+
|
|
15
|
+
OBJECTIVE
|
|
16
|
+
|
|
17
|
+
You are tasked to write unit tests, breaking it down into clear steps and working through them methodically.
|
|
18
|
+
|
|
19
|
+
- Analyze the user's code and set clear, achievable goals to generate unit tests. Prioritize these goals in a logical order.
|
|
20
|
+
- Work through these goals sequentially, each goal should correspond to a distinct step in your problem-solving process.
|
|
21
|
+
|
|
22
|
+
====
|
|
23
|
+
|
|
24
|
+
USER'S CUSTOM INSTRUCTIONS
|
|
25
|
+
|
|
26
|
+
The following additional instructions are provided by the user, and should be followed to the best of your ability without interfering with the TOOL USE guidelines.
|
|
27
|
+
|
|
28
|
+
Language Preference:
|
|
29
|
+
You should always speak and think in the English language.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Keep your answers short and impersonal.
|
|
2
|
+
Use Markdown formatting in your answers.
|
|
3
|
+
Make sure to include the programming language name at the start of the Markdown code blocks.
|
|
4
|
+
Avoid wrapping the whole response in triple backticks.
|
|
5
|
+
You can only give one reply for each conversation turn.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
You are a highly skilled software engineer specializing in C# unit testing with extensive knowledge in test frameworks, test patterns, and best practices.
|
|
2
|
+
|
|
3
|
+
====
|
|
4
|
+
|
|
5
|
+
Rules
|
|
6
|
+
{% if isXapTest %}
|
|
7
|
+
The user provided source code is using XAP framework, which has specific rules for unit tests.
|
|
8
|
+
These rules are defined in the XAP UNIT TEST Guidelines. Please follow these rules strictly when generating unit tests. The rules in XAP UNIT TEST Guidelines should take precedence over the rules in GENERAL UNIT TEST Guidelines.
|
|
9
|
+
{% endif %}
|
|
10
|
+
{% include 'general/generalUtGuidelines' %}
|
|
11
|
+
{% if isXapTest %}
|
|
12
|
+
{% include 'xap/xapUtGuideline' %}
|
|
13
|
+
{% endif %}
|
|
14
|
+
====
|
|
15
|
+
|
|
16
|
+
OBJECTIVE
|
|
17
|
+
|
|
18
|
+
You are tasked to write unit tests, breaking it down into clear steps and working through them methodically.
|
|
19
|
+
|
|
20
|
+
- Analyze the user's code and set clear, achievable goals to generate unit tests. Prioritize these goals in a logical order.
|
|
21
|
+
- Work through these goals sequentially, each goal should correspond to a distinct step in your problem-solving process.
|
|
22
|
+
|
|
23
|
+
====
|
|
24
|
+
|
|
25
|
+
USER'S CUSTOM INSTRUCTIONS
|
|
26
|
+
|
|
27
|
+
The following additional instructions are provided by the user, and should be followed to the best of your ability without interfering with the and guidelines.
|
|
28
|
+
|
|
29
|
+
Language Preference:
|
|
30
|
+
You should always speak and think in the English language.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Build Failure Fix Guideline:
|
|
2
|
+
- Case1: The type or namespace name '{Class/Type}' does not exist in the namespace '{namespace}' (are you missing an assembly reference?)
|
|
3
|
+
Solution: Check the source code, code dependencies. Add the required `using` statements or assembly references.
|
|
4
|
+
- Case2: No overload for method 'Execute' takes {number} arguments
|
|
5
|
+
Solution: Refer to section [The method parameters of Execute in Xap instance are different from the source code.] Adjust the method parameters to match the correct overload as per the source code.
|
|
6
|
+
- Case3
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Build Failure Fix Guideline:
|
|
2
|
+
- Case 1: The type or namespace name '{Class/Type}' does not exist in the namespace '{namespace}' (are you missing an assembly reference?)
|
|
3
|
+
Solution: Check the source code, code dependencies. Add the required `using` statements or assembly references.
|
|
4
|
+
- Case 2: No overload for method 'Execute' takes {number} arguments
|
|
5
|
+
Solution: Refer to section [The method parameters of Execute in Xap instance are different from the source code.] of Xap Unit Test Guidelines, Adjust the method parameters to match the correct overload as per the source code.
|
|
6
|
+
- Case 3: Cannot create an instance of the abstract type or interface '{class / bondstucture}'
|
|
7
|
+
Solution: use ExecutionServices.CreateInstance<I{ClassName}>() to create Xap class instance or use ExecutionServices.CreateInstance<{StructName}>() to create Bond struct instance.
|
|
8
|
+
- Case 4: cannot convert from '{Class / Bond type}' to '{Class / Bond type}'
|
|
9
|
+
Solution: Do explicitly type convert.
|
|
10
|
+
- Case 5: [CS0037] Cannot convert null to '{Class / Bond type}' because it is a non-nullable value type
|
|
11
|
+
Solution: MUST assign non-null and valid value.
|
|
12
|
+
- Case 6: [CS0246] The type or namespace name '{class / interface}' could not be found (are you missing a using directive or an assembly reference?)
|
|
13
|
+
Solution: MUST import the **namespace** of {class / interface}
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
## Xap source code and test code examples
|
|
2
|
+
D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Plugins\Workflows\Eplant\HttpRequestParser\EplantHttpRequestParser.cs
|
|
3
|
+
Example #1 ()
|
|
4
|
+
```C#
|
|
5
|
+
public class SampleBuilder : IPlugin
|
|
6
|
+
{
|
|
7
|
+
public PluginResult Execute(
|
|
8
|
+
PluginServices pluginServices,
|
|
9
|
+
PluginOutput<EplantUserResp> eplantUserResp,
|
|
10
|
+
[ConfigFile("EplantConfig.ini")]
|
|
11
|
+
EplantConfig eplantConfig,
|
|
12
|
+
IEnumerable<ObjectStoreResponse_2<EplantUserKey, EMPTY, EMPTY, EplantUser>> osResponses = null,
|
|
13
|
+
EplantRequest req = null)
|
|
14
|
+
{
|
|
15
|
+
..... // omit detail implementation
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Test Code snippet:
|
|
21
|
+
```C#
|
|
22
|
+
[TestClass]
|
|
23
|
+
public class SampleBuilderTest
|
|
24
|
+
{
|
|
25
|
+
[TestMethod]
|
|
26
|
+
public void Execute_InvalidRequestOrIntent_Failure()
|
|
27
|
+
{
|
|
28
|
+
var builder = ExecutionServices.CreateInstance<ISampleBuilder>();
|
|
29
|
+
request.type = EplantReqType.Me;
|
|
30
|
+
IEnumerable<ObjectStoreResponse_2<EplantUserKey, EMPTY, EMPTY, EplantUser>> osResponses = null;
|
|
31
|
+
|
|
32
|
+
var result = builder.Execute(Task.FromResult(osResponses), Task.FromResult(request)).Result;
|
|
33
|
+
|
|
34
|
+
Assert.IsFalse(result.Success);
|
|
35
|
+
Assert.IsNull(builder.eplantUserResp.Result);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Xap Unit Test Guidelines (**ONLY apply when the source code is a Xap class. Ignore all these rules for non-Xap classes.**):
|
|
2
|
+
- Xap class is a class that inherits one of these interfaces: IPlugin, IConditionPlugin, Workflow, IExperiment, IPluginDataStore, IAsyncPlugin and implements an Execute() method.
|
|
3
|
+
- MUST use ExecutionServices.CreateInstance<I{ClassName}>() to create Xap class instance, where the interface name is the class name prefixed with "I".
|
|
4
|
+
Example: For Xap class SampleWorkflow, create instance MUST be like: **var sampleWorkflow = ExecutionServices.CreateInstance<ISampleWorkflow>();**
|
|
5
|
+
- The parameters of **Execute** method with types: **PluginServices**, **PluginOutput<T>**, or attributed with **[ConfigFile("{configFileName}")]** MUST be deleted when using Xap class instance to call the Execute method.
|
|
6
|
+
- Xap freamwork will take care these deleted parameters, NEVER try to mock or create these deleted types, it's invalid and forbidden.
|
|
7
|
+
- **MUST NOT** mock these deleted types' object, even if its methods or properties are used in the source code.
|
|
8
|
+
- For Remaining parameters,
|
|
9
|
+
- MUST pass in exact type as declared in source code.
|
|
10
|
+
- MUST keep original parameter order.
|
|
11
|
+
- MUST wrap each parameter with Task.FromResult(value).
|
|
12
|
+
Example:
|
|
13
|
+
The Execute method of Xap calss SampleWorkflow is: **PluginResult Execute(PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig, OsResponse osResp = null, EplantRequest req = null)**,
|
|
14
|
+
Base on above declared deleted types, **MUST delete** these three parameters: PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig,
|
|
15
|
+
call the Execute using Xap class instance MUST be like: **var pluginResult = sampleWorkflow.Execute(Task.FromResult(osResp), Task.FromResult(req)).Result;**
|
|
16
|
+
- The Execute method parameters with type PluginOutput<T> MUST be treated as method output, **T** is the type output value.
|
|
17
|
+
- MUST using the parameter name to access the output by the Xap instance
|
|
18
|
+
- MUST using **Result** property to access the output of type **T** in **PluginOutput<T>**.
|
|
19
|
+
- MUST assert PluginOutput<T> parameters' values if there's parameter with **PluginOutput<T>** type.
|
|
20
|
+
Example:
|
|
21
|
+
The Execute method of Xap calss SampleWorkflow is: **PluginResult Execute(PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig, OsResponse osResp = null, EplantRequest req = null)**,
|
|
22
|
+
Get the output value using Xap class instance MUST be like: **sampleWorkflow.resp**.
|
|
23
|
+
Assume there's one field named **Key** in **Resp** type, get **Key** MUST be like: **sampleWorkflow.pluginResp.Result.Key**.
|
|
24
|
+
Assert the PluginOutput<T> value in test code MUST be like: Assert.NotNull(sampleWorkflow.pluginResult.Result.Id); Assert.AreEqual(sampleWorkflow.pluginResult.Result.Id, "id");
|
|
25
|
+
- The Bond structures MUST be treated as regular C# class in test code:
|
|
26
|
+
- **MUST** import **Bond namespace** before using the Bond structure in test code
|
|
27
|
+
Example: The namespace in bond structure is like: **namespace SharedSegments.Weather.OneService**, to use this bond structure, **MUST** add: **using SharedSegments.Weather.OneService** in test code.
|
|
28
|
+
- MUST use ExecutionServices.CreateInstance<{StructName}>() to create Bond struct instances.
|
|
29
|
+
Example: For a Bond structure named **SampleBondStructure<T>**, create bond instance **MUST** be like: ** var subResponse = ExecutionServices.CreateInstance<SampleBondStructure<SampleObject>>();
|
|
30
|
+
- MUST not access the fields that are not defined in bond structure, it's invalid and forbidden.
|
|
31
|
+
- MUST treated the fields as **required** if they **are not** decorated with **optional** in bond structure
|
|
32
|
+
- **MUST** assign a valid, non-null value to **required field** that are **NOT decorated** with **optional** explicitly.
|
|
33
|
+
- MUST assign a valid value to the fields that are used in source code explicitly.
|
|
34
|
+
- MUST correctly handle the null checks for required fields in source code.
|
|
35
|
+
Example: the source code contains **if (sampleRequest?.Category == null)**, the **Category** is require field in sampleRequest bond structure and **MUST be non-null**, just test the case when sampleRequest is null.
|
|
36
|
+
- MUST use AsEnumerable() to convert IList to IEnumerable, e.g. IEnumerable osResponses = osResponseList.AsEnumerable()
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Xap Unit Test Guidelines
|
|
2
|
+
|
|
3
|
+
- Xap class is a class that inherits one of these interfaces: IPlugin, IConditionPlugin, Workflow, IExperiment, IPluginDataStore, IAsyncPlugin and implements an Execute() method.
|
|
4
|
+
- MUST use ExecutionServices.CreateInstance<I{ClassName}>() to create Xap class instance, where the interface name is the class name prefixed with "I".
|
|
5
|
+
Example: For Xap class SampleWorkflow, create instance MUST be like: **var sampleWorkflow = ExecutionServices.CreateInstance<ISampleWorkflow>();**
|
|
6
|
+
- The parameters of **Execute** method with types: **PluginServices**, **PluginOutput<T>**, or attributed with **[ConfigFile("{configFileName}")]** MUST be deleted when using Xap class instance to call the Execute method.
|
|
7
|
+
- Xap freamwork will take care these deleted parameters, NEVER try to mock or create these deleted types, it's invalid and forbidden.
|
|
8
|
+
- **MUST NOT** mock these deleted types' object, even if its methods or properties are used in the source code.
|
|
9
|
+
- For Remaining parameters,
|
|
10
|
+
- MUST pass in exact type as declared in source code.
|
|
11
|
+
- MUST keep original parameter order.
|
|
12
|
+
- MUST wrap each parameter with Task.FromResult(value).
|
|
13
|
+
Example:
|
|
14
|
+
The Execute method of Xap calss SampleWorkflow is: **PluginResult Execute(PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig, OsResponse osResp = null, EplantRequest req = null)**,
|
|
15
|
+
Base on above declared deleted types, **MUST delete** these three parameters: PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig,
|
|
16
|
+
call the Execute using Xap class instance MUST be like: **var pluginResult = sampleWorkflow.Execute(Task.FromResult(osResp), Task.FromResult(req)).Result;**
|
|
17
|
+
- The Execute method parameters with type PluginOutput<T> MUST be treated as method output, **T** is the type output value.
|
|
18
|
+
- MUST using the parameter name to access the output by the Xap instance
|
|
19
|
+
- MUST using **Result** property to access the output of type **T** in **PluginOutput<T>**.
|
|
20
|
+
- MUST assert PluginOutput<T> parameters' values if there's parameter with **PluginOutput<T>** type.
|
|
21
|
+
Example:
|
|
22
|
+
The Execute method of Xap calss SampleWorkflow is: **PluginResult Execute(PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig, OsResponse osResp = null, EplantRequest req = null)**,
|
|
23
|
+
Get the output value using Xap class instance MUST be like: **sampleWorkflow.resp**.
|
|
24
|
+
Assume there's one field named **Key** in **Resp** type, get **Key** MUST be like: **sampleWorkflow.pluginResp.Result.Key**.
|
|
25
|
+
Assert the PluginOutput<T> value in test code MUST be like: Assert.NotNull(sampleWorkflow.pluginResult.Result.Id); Assert.AreEqual(sampleWorkflow.pluginResult.Result.Id, "id");
|
|
26
|
+
- The Bond structures MUST be treated as regular C# class in test code:
|
|
27
|
+
- **MUST** import **Bond namespace** before using the Bond structure in test code
|
|
28
|
+
Example: The namespace in bond structure is like: **namespace SharedSegments.Weather.OneService**, to use this bond structure, **MUST** add: **using SharedSegments.Weather.OneService** in test code.
|
|
29
|
+
- MUST use ExecutionServices.CreateInstance<{StructName}>() to create Bond struct instances.
|
|
30
|
+
Example: For a Bond structure named **SampleBondStructure<T>**, create bond instance **MUST** be like: ** var subResponse = ExecutionServices.CreateInstance<SampleBondStructure<SampleObject>>();
|
|
31
|
+
- MUST not access the fields that are not defined in bond structure, it's invalid and forbidden.
|
|
32
|
+
- MUST treated the fields as **required** if they **are not** decorated with **optional** in bond structure
|
|
33
|
+
- **MUST** assign a valid, non-null value to **required field** that are **NOT decorated** with **optional** explicitly.
|
|
34
|
+
- MUST assign a valid value to the fields that are used in source code explicitly.
|
|
35
|
+
- MUST correctly handle the null checks for required fields in source code.
|
|
36
|
+
Example: the source code contains **if (sampleRequest?.Category == null)**, the **Category** is require field in sampleRequest bond structure and **MUST be non-null**, just test the case when sampleRequest is null.
|
|
37
|
+
- MUST use AsEnumerable() to convert IList to IEnumerable, e.g. IEnumerable osResponses = osResponseList.AsEnumerable()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendRequestToLLM = sendRequestToLLM;
|
|
4
|
+
const setupLLMRequest_1 = require("../setup/setupLLMRequest");
|
|
5
|
+
async function sendRequestToLLM(prompt, retryTimes = 3) {
|
|
6
|
+
const startTime = Date.now();
|
|
7
|
+
console.log(`Request to LLM...`);
|
|
8
|
+
const { success, content } = await (0, setupLLMRequest_1._sendRequestToLLM)(prompt);
|
|
9
|
+
console.log(`Retry max times, LLM response time: ${(Date.now() - startTime) / 1000} seconds`);
|
|
10
|
+
return { success, content };
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=sendRequestToLLM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendRequestToLLM.js","sourceRoot":"","sources":["../../src/llm/sendRequestToLLM.ts"],"names":[],"mappings":";;AAEA,4CAMC;AARD,8DAA6D;AAEtD,KAAK,UAAU,gBAAgB,CAAC,MAAa,EAAE,aAAqB,CAAC;IACxE,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,mCAAiB,EAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC;IAC9F,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import { _sendRequestToLLM } from \"../setup/setupLLMRequest\";\r\n\r\nexport async function sendRequestToLLM(prompt: any[], retryTimes: number = 3): Promise<{ success: boolean, content: string }> {\r\n const startTime = Date.now();\r\n console.log(`Request to LLM...`);\r\n const { success, content } = await _sendRequestToLLM(prompt);\r\n console.log(`Retry max times, LLM response time: ${(Date.now() - startTime) / 1000} seconds`);\r\n return { success, content };\r\n}"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendRequestToSelfHostLLM = sendRequestToSelfHostLLM;
|
|
4
|
+
const delay_1 = require("../utils/delay");
|
|
5
|
+
const Gpt4o_1 = require("./model/Gpt4o");
|
|
6
|
+
async function sendRequestToSelfHostLLM(prompt, retryTimes = 3) {
|
|
7
|
+
const startTime = Date.now();
|
|
8
|
+
console.log(`Request to LLM...`);
|
|
9
|
+
for (let i = 0; i < retryTimes; i++) {
|
|
10
|
+
try {
|
|
11
|
+
const resp = await (0, Gpt4o_1.getLLMResponse)(prompt);
|
|
12
|
+
// generate UT failed
|
|
13
|
+
if (!resp?.choices || resp.choices.length == 0 || !resp.choices[0]?.message?.content) {
|
|
14
|
+
const respStr = JSON.stringify(resp);
|
|
15
|
+
console.error("sendRequestToLLM Failed to generate XapUt code:", respStr);
|
|
16
|
+
if (respStr.includes("Rate limit is exceeded")) {
|
|
17
|
+
// wait for 30 seconds before retrying
|
|
18
|
+
await (0, delay_1.delay)(30000);
|
|
19
|
+
console.log(`delayed 30s`);
|
|
20
|
+
}
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
console.log(`LLM response time: ${(Date.now() - startTime) / 1000} seconds`);
|
|
24
|
+
return { success: true, content: resp.choices[0]?.message?.content };
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error("Error occurred while generating XapUt code:", error);
|
|
28
|
+
// if prompt size > 128KB, don't need to retry, just return back
|
|
29
|
+
if (error.code === "context_length_exceeded") {
|
|
30
|
+
console.error("Context length exceeded, please reduce the size of the prompt.");
|
|
31
|
+
return { success: false, content: "" };
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
console.log(`Retry max times, LLM response time: ${(Date.now() - startTime) / 1000} seconds`);
|
|
39
|
+
return { success: false, content: "" };
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=sendRequestToSelfHostLLM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendRequestToSelfHostLLM.js","sourceRoot":"","sources":["../../src/llm/sendRequestToSelfHostLLM.ts"],"names":[],"mappings":";;AAGA,4DAiCC;AApCD,0CAAuC;AACvC,yCAA+C;AAExC,KAAK,UAAU,wBAAwB,CAAC,MAAa,EAAE,aAAqB,CAAC;IAChF,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,IAAI,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,IAAA,sBAAc,EAAC,MAAM,CAAC,CAAC;YAC1C,qBAAqB;YACrB,IAAI,CAAC,IAAI,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;gBACnF,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBACrC,OAAO,CAAC,KAAK,CAAC,iDAAiD,EAAE,OAAO,CAAC,CAAC;gBAC1E,IAAI,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,CAAC;oBAC7C,sCAAsC;oBACtC,MAAM,IAAA,aAAK,EAAC,KAAK,CAAC,CAAC;oBACnB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;gBAC/B,CAAC;gBACD,SAAS;YACb,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC;YAC7E,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAC,CAAC;QACvE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,KAAK,CAAC,CAAC;YACpE,gEAAgE;YAChE,IAAI,KAAK,CAAC,IAAI,KAAK,yBAAyB,EAAE,CAAC;gBAC3C,OAAO,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAC;gBAChF,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAC,CAAC;YACzC,CAAC;iBAAM,CAAC;gBACJ,SAAS;YACb,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC;IAC9F,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAC,CAAC;AACzC,CAAC","sourcesContent":["import { delay } from \"../utils/delay\";\r\nimport { getLLMResponse } from \"./model/Gpt4o\";\r\n\r\nexport async function sendRequestToSelfHostLLM(prompt: any[], retryTimes: number = 3): Promise<{success: boolean, content: string}> {\r\n const startTime = Date.now();\r\n console.log(`Request to LLM...`);\r\n for (let i = 0; i < retryTimes; i++) {\r\n try {\r\n const resp = await getLLMResponse(prompt);\r\n // generate UT failed\r\n if (!resp?.choices || resp.choices.length == 0 || !resp.choices[0]?.message?.content) {\r\n const respStr = JSON.stringify(resp);\r\n console.error(\"sendRequestToLLM Failed to generate XapUt code:\", respStr);\r\n if (respStr.includes(\"Rate limit is exceeded\")) {\r\n // wait for 30 seconds before retrying\r\n await delay(30000);\r\n console.log(`delayed 30s`);\r\n }\r\n continue;\r\n }\r\n console.log(`LLM response time: ${(Date.now() - startTime) / 1000} seconds`);\r\n return {success: true, content: resp.choices[0]?.message?.content};\r\n } catch (error) {\r\n console.error(\"Error occurred while generating XapUt code:\", error);\r\n // if prompt size > 128KB, don't need to retry, just return back\r\n if (error.code === \"context_length_exceeded\") {\r\n console.error(\"Context length exceeded, please reduce the size of the prompt.\");\r\n return {success: false, content: \"\"};\r\n } else {\r\n continue;\r\n }\r\n }\r\n }\r\n\r\n console.log(`Retry max times, LLM response time: ${(Date.now() - startTime) / 1000} seconds`);\r\n return {success: false, content: \"\"};\r\n}"]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.sendTelemetryEvent = sendTelemetryEvent;
|
|
37
|
+
exports.sendUserUsageEvent = sendUserUsageEvent;
|
|
38
|
+
const appInsights = __importStar(require("applicationinsights"));
|
|
39
|
+
const constants_1 = require("../types/constants");
|
|
40
|
+
const machineId_1 = require("./machineId");
|
|
41
|
+
const os_1 = require("os");
|
|
42
|
+
const connectionString = "InstrumentationKey=c1a0c6a2-06a6-405f-9343-c8fbe29e0dc2;IngestionEndpoint=https://eastus2-3.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus2.livediagnostics.monitor.azure.com/;ApplicationId=e90435ce-8771-4069-bc94-77aaf8099529";
|
|
43
|
+
// init Application Insights
|
|
44
|
+
appInsights.setup(connectionString)
|
|
45
|
+
.setAutoCollectConsole(false)
|
|
46
|
+
.setAutoCollectDependencies(false)
|
|
47
|
+
.setAutoCollectExceptions(false)
|
|
48
|
+
.setAutoCollectPerformance(false)
|
|
49
|
+
.setAutoCollectRequests(false)
|
|
50
|
+
.setUseDiskRetryCaching(false)
|
|
51
|
+
.start();
|
|
52
|
+
let userId;
|
|
53
|
+
function initUser() {
|
|
54
|
+
if (userId) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
userId = (0, machineId_1.getMachineId)();
|
|
58
|
+
appInsights.defaultClient.context.tags[appInsights.defaultClient.context.keys.userId] = userId;
|
|
59
|
+
}
|
|
60
|
+
function sendTelemetryEvent(eventName, properties, measurements) {
|
|
61
|
+
initUser();
|
|
62
|
+
appInsights.defaultClient.trackEvent({
|
|
63
|
+
name: eventName,
|
|
64
|
+
properties,
|
|
65
|
+
measurements
|
|
66
|
+
});
|
|
67
|
+
appInsights.defaultClient.flush();
|
|
68
|
+
}
|
|
69
|
+
function sendUserUsageEvent(source = constants_1.CSHARPUTGEN, customUserName) {
|
|
70
|
+
const userName = customUserName || (0, os_1.userInfo)()?.username;
|
|
71
|
+
sendTelemetryEvent("userUsage", {
|
|
72
|
+
"user": userName,
|
|
73
|
+
source,
|
|
74
|
+
deviceId: (0, machineId_1.getMachineId)()
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=appInsightTelemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appInsightTelemetry.js","sourceRoot":"","sources":["../../src/metrics/appInsightTelemetry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,gDAQC;AAED,gDAOC;AA5CD,iEAAmD;AAEnD,kDAAiD;AACjD,2CAA2C;AAC3C,2BAA8B;AAE9B,MAAM,gBAAgB,GAAG,kPAAkP,CAAC;AAE5Q,4BAA4B;AAC5B,WAAW,CAAC,KAAK,CAAC,gBAAgB,CAAC;KAC9B,qBAAqB,CAAC,KAAK,CAAC;KAC5B,0BAA0B,CAAC,KAAK,CAAC;KACjC,wBAAwB,CAAC,KAAK,CAAC;KAC/B,yBAAyB,CAAC,KAAK,CAAC;KAChC,sBAAsB,CAAC,KAAK,CAAC;KAC7B,sBAAsB,CAAC,KAAK,CAAC;KAC7B,KAAK,EAAE,CAAC;AAEb,IAAI,MAAc,CAAC;AACnB,SAAS,QAAQ;IACb,IAAI,MAAM,EAAE,CAAC;QACT,OAAO;IACX,CAAC;IACD,MAAM,GAAG,IAAA,wBAAY,GAAE,CAAC;IACxB,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AACnG,CAAC;AAED,SAAgB,kBAAkB,CAAC,SAAiB,EAAE,UAAsC,EAAE,YAAwC;IAClI,QAAQ,EAAE,CAAC;IACX,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC;QACjC,IAAI,EAAE,SAAS;QACf,UAAU;QACV,YAAY;KACf,CAAC,CAAC;IACH,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;AACtC,CAAC;AAED,SAAgB,kBAAkB,CAAC,SAAiB,uBAAW,EAAE,cAAuB;IACpF,MAAM,QAAQ,GAAG,cAAc,IAAI,IAAA,aAAQ,GAAE,EAAE,QAAQ,CAAC;IACxD,kBAAkB,CAAC,WAAW,EAAE;QAC5B,MAAM,EAAE,QAAQ;QAChB,MAAM;QACN,QAAQ,EAAE,IAAA,wBAAY,GAAE;KAC3B,CAAC,CAAC;AACP,CAAC","sourcesContent":["import * as appInsights from \"applicationinsights\";\r\n\r\nimport { CSHARPUTGEN } from \"../types/constants\";\r\nimport { getMachineId } from \"./machineId\";\r\nimport { userInfo } from 'os';\r\n\r\nconst connectionString = \"InstrumentationKey=c1a0c6a2-06a6-405f-9343-c8fbe29e0dc2;IngestionEndpoint=https://eastus2-3.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus2.livediagnostics.monitor.azure.com/;ApplicationId=e90435ce-8771-4069-bc94-77aaf8099529\";\r\n\r\n// init Application Insights\r\nappInsights.setup(connectionString)\r\n .setAutoCollectConsole(false)\r\n .setAutoCollectDependencies(false)\r\n .setAutoCollectExceptions(false)\r\n .setAutoCollectPerformance(false)\r\n .setAutoCollectRequests(false)\r\n .setUseDiskRetryCaching(false)\r\n .start();\r\n\r\nlet userId: string;\r\nfunction initUser() {\r\n if (userId) {\r\n return;\r\n }\r\n userId = getMachineId();\r\n appInsights.defaultClient.context.tags[appInsights.defaultClient.context.keys.userId] = userId;\r\n}\r\n\r\nexport function sendTelemetryEvent(eventName: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) {\r\n initUser();\r\n appInsights.defaultClient.trackEvent({\r\n name: eventName,\r\n properties,\r\n measurements\r\n });\r\n appInsights.defaultClient.flush();\r\n}\r\n\r\nexport function sendUserUsageEvent(source: string = CSHARPUTGEN, customUserName?: string) {\r\n const userName = customUserName || userInfo()?.username;\r\n sendTelemetryEvent(\"userUsage\", {\r\n \"user\": userName,\r\n source,\r\n deviceId: getMachineId()\r\n });\r\n}"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function execAsync(command: string, params: string[], options?: {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
abortSignal?: AbortSignal;
|
|
4
|
+
}): Promise<{
|
|
5
|
+
error: Error | null;
|
|
6
|
+
stdout: string;
|
|
7
|
+
stderr: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function removeFile(filePath: string): void;
|
|
10
|
+
export declare function sleep(ms: number): Promise<unknown>;
|
|
11
|
+
export declare function getMachineId(): string;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.execAsync = execAsync;
|
|
7
|
+
exports.removeFile = removeFile;
|
|
8
|
+
exports.sleep = sleep;
|
|
9
|
+
exports.getMachineId = getMachineId;
|
|
10
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
11
|
+
const child_process_1 = require("child_process");
|
|
12
|
+
const fs_1 = __importDefault(require("fs"));
|
|
13
|
+
const os_1 = __importDefault(require("os"));
|
|
14
|
+
function execAsync(command, params, options) {
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
let execData = {
|
|
17
|
+
process: undefined,
|
|
18
|
+
};
|
|
19
|
+
const abortListener = () => {
|
|
20
|
+
if (execData.process) {
|
|
21
|
+
execData.process.kill();
|
|
22
|
+
execData.process = undefined;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
execData.process = (0, child_process_1.execFile)(command, params, {
|
|
26
|
+
shell: true,
|
|
27
|
+
...options
|
|
28
|
+
}, (error, stdout, stderr) => {
|
|
29
|
+
if (options?.abortSignal) {
|
|
30
|
+
options.abortSignal.removeEventListener('abort', abortListener);
|
|
31
|
+
}
|
|
32
|
+
resolve({
|
|
33
|
+
error,
|
|
34
|
+
stdout,
|
|
35
|
+
stderr
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
console.log(`PID: ${execData.process.pid}`);
|
|
39
|
+
if (options?.abortSignal) {
|
|
40
|
+
options.abortSignal.addEventListener('abort', abortListener);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function removeFile(filePath) {
|
|
45
|
+
try {
|
|
46
|
+
if (fs_1.default.existsSync(filePath)) {
|
|
47
|
+
fs_1.default.unlinkSync(filePath);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.log(`Remove file error: ${error}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function sleep(ms) {
|
|
55
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
56
|
+
}
|
|
57
|
+
function getMacAddress() {
|
|
58
|
+
const interfaces = os_1.default.networkInterfaces();
|
|
59
|
+
for (const name of Object.keys(interfaces)) {
|
|
60
|
+
for (const net of interfaces[name]) {
|
|
61
|
+
if (net.family === 'IPv4' &&
|
|
62
|
+
!net.internal &&
|
|
63
|
+
net.mac &&
|
|
64
|
+
net.mac !== '00:00:00:00:00:00') {
|
|
65
|
+
return net.mac;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return 'unknown';
|
|
70
|
+
}
|
|
71
|
+
let _cachedMachineId = null;
|
|
72
|
+
function getMachineId() {
|
|
73
|
+
if (_cachedMachineId) {
|
|
74
|
+
return _cachedMachineId;
|
|
75
|
+
}
|
|
76
|
+
const mac = getMacAddress();
|
|
77
|
+
const hostname = os_1.default.hostname();
|
|
78
|
+
const user = os_1.default.userInfo().username;
|
|
79
|
+
_cachedMachineId = crypto_1.default
|
|
80
|
+
.createHash('sha256')
|
|
81
|
+
.update(`${mac}-${hostname}-${user}`)
|
|
82
|
+
.digest('hex');
|
|
83
|
+
return _cachedMachineId;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=machineId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"machineId.js","sourceRoot":"","sources":["../../src/metrics/machineId.ts"],"names":[],"mappings":";;;;;AAKA,8BAsCC;AAED,gCAQC;AAED,sBAEC;AAsBD,oCAaC;AA5FD,oDAA4B;AAC5B,iDAAyC;AACzC,4CAAoB;AACpB,4CAAoB;AAEpB,SAAgB,SAAS,CAAC,OAAe,EAAE,MAAgB,EAAE,OAAqD;IAK9G,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3B,IAAI,QAAQ,GAAG;YACX,OAAO,EAAE,SAAS;SACrB,CAAC;QACF,MAAM,aAAa,GAAG,GAAG,EAAE;YACvB,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;gBACnB,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;gBACxB,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;YACjC,CAAC;QACL,CAAC,CAAC;QACF,QAAQ,CAAC,OAAO,GAAG,IAAA,wBAAQ,EACvB,OAAO,EACP,MAAM,EACN;YACI,KAAK,EAAE,IAAI;YACX,GAAG,OAAO;SACb,EACD,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACtB,IAAI,OAAO,EAAE,WAAW,EAAE,CAAC;gBACvB,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;YACpE,CAAC;YACD,OAAO,CAAC;gBACJ,KAAK;gBACL,MAAM;gBACN,MAAM;aACT,CAAC,CAAC;QACP,CAAC,CACJ,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,QAAQ,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC5C,IAAI,OAAO,EAAE,WAAW,EAAE,CAAC;YACvB,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QACjE,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAgB,UAAU,CAAC,QAAgB;IACvC,IAAI,CAAC;QACD,IAAI,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,sBAAsB,KAAK,EAAE,CAAC,CAAC;IAC/C,CAAC;AACL,CAAC;AAED,SAAgB,KAAK,CAAC,EAAU;IAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,aAAa;IAClB,MAAM,UAAU,GAAG,YAAE,CAAC,iBAAiB,EAAE,CAAC;IAE1C,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACzC,KAAK,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,IACI,GAAG,CAAC,MAAM,KAAK,MAAM;gBACrB,CAAC,GAAG,CAAC,QAAQ;gBACb,GAAG,CAAC,GAAG;gBACP,GAAG,CAAC,GAAG,KAAK,mBAAmB,EACjC,CAAC;gBACC,OAAO,GAAG,CAAC,GAAG,CAAC;YACnB,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,IAAI,gBAAgB,GAAkB,IAAI,CAAC;AAC3C,SAAgB,YAAY;IACxB,IAAI,gBAAgB,EAAE,CAAC;QACnB,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IACD,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAG,YAAE,CAAC,QAAQ,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,YAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;IAEpC,gBAAgB,GAAG,gBAAM;SACpB,UAAU,CAAC,QAAQ,CAAC;SACpB,MAAM,CAAC,GAAG,GAAG,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;SACpC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,gBAAgB,CAAC;AAC5B,CAAC","sourcesContent":["import crypto from 'crypto';\r\nimport { execFile } from 'child_process';\r\nimport fs from 'fs';\r\nimport os from 'os';\r\n\r\nexport function execAsync(command: string, params: string[], options?: { cwd?: string, abortSignal?: AbortSignal }): Promise<{\r\n error: Error | null;\r\n stdout: string;\r\n stderr: string;\r\n}> {\r\n return new Promise((resolve) => {\r\n let execData = {\r\n process: undefined,\r\n };\r\n const abortListener = () => {\r\n if (execData.process) {\r\n execData.process.kill();\r\n execData.process = undefined;\r\n }\r\n };\r\n execData.process = execFile(\r\n command,\r\n params,\r\n {\r\n shell: true,\r\n ...options\r\n },\r\n (error, stdout, stderr) => {\r\n if (options?.abortSignal) {\r\n options.abortSignal.removeEventListener('abort', abortListener);\r\n }\r\n resolve({\r\n error,\r\n stdout,\r\n stderr\r\n });\r\n }\r\n );\r\n console.log(`PID: ${execData.process.pid}`);\r\n if (options?.abortSignal) {\r\n options.abortSignal.addEventListener('abort', abortListener);\r\n }\r\n });\r\n}\r\n\r\nexport function removeFile(filePath: string) {\r\n try {\r\n if (fs.existsSync(filePath)) {\r\n fs.unlinkSync(filePath);\r\n }\r\n } catch (error) {\r\n console.log(`Remove file error: ${error}`);\r\n }\r\n}\r\n\r\nexport function sleep(ms: number) {\r\n return new Promise((resolve) => setTimeout(resolve, ms));\r\n}\r\n\r\nfunction getMacAddress() {\r\n const interfaces = os.networkInterfaces();\r\n\r\n for (const name of Object.keys(interfaces)) {\r\n for (const net of interfaces[name]) {\r\n if (\r\n net.family === 'IPv4' &&\r\n !net.internal &&\r\n net.mac &&\r\n net.mac !== '00:00:00:00:00:00'\r\n ) {\r\n return net.mac;\r\n }\r\n }\r\n }\r\n\r\n return 'unknown';\r\n}\r\n\r\nlet _cachedMachineId: string | null = null;\r\nexport function getMachineId() {\r\n if (_cachedMachineId) {\r\n return _cachedMachineId;\r\n }\r\n const mac = getMacAddress();\r\n const hostname = os.hostname();\r\n const user = os.userInfo().username;\r\n\r\n _cachedMachineId = crypto\r\n .createHash('sha256')\r\n .update(`${mac}-${hostname}-${user}`)\r\n .digest('hex');\r\n return _cachedMachineId;\r\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function setup(config: any): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setup = setup;
|
|
4
|
+
const setupConsole_1 = require("./setupConsole");
|
|
5
|
+
const setupLLMRequest_1 = require("./setupLLMRequest");
|
|
6
|
+
function setup(config) {
|
|
7
|
+
(0, setupLLMRequest_1.setupSendRequestToLLMFunc)(config.getLLMResponse);
|
|
8
|
+
config.getConsole && (0, setupConsole_1.setupConsole)(config.getConsole);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/setup/setup.ts"],"names":[],"mappings":";;AAGA,sBAGC;AAND,iDAA8C;AAC9C,uDAA8D;AAE9D,SAAgB,KAAK,CAAC,MAAM;IACxB,IAAA,2CAAyB,EAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IACjD,MAAM,CAAC,UAAU,IAAI,IAAA,2BAAY,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACzD,CAAC","sourcesContent":["import { setupConsole } from \"./setupConsole\";\r\nimport { setupSendRequestToLLMFunc } from \"./setupLLMRequest\";\r\n\r\nexport function setup(config) {\r\n setupSendRequestToLLMFunc(config.getLLMResponse);\r\n config.getConsole && setupConsole(config.getConsole);\r\n}\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function setupConsole(consoleLogger: any): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// keep original console functions
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.setupConsole = setupConsole;
|
|
5
|
+
function setupConsole(consoleLogger) {
|
|
6
|
+
if (!consoleLogger) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const originalConsole = global.console;
|
|
10
|
+
const customConsole = {
|
|
11
|
+
...originalConsole, // 保留其他方法,如 console.info/warn
|
|
12
|
+
log: (...args) => {
|
|
13
|
+
consoleLogger.log(...args);
|
|
14
|
+
originalConsole.log(...args);
|
|
15
|
+
},
|
|
16
|
+
error: (...args) => {
|
|
17
|
+
consoleLogger.error(...args);
|
|
18
|
+
originalConsole.error(...args);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
global.console = customConsole;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=setupConsole.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupConsole.js","sourceRoot":"","sources":["../../src/setup/setupConsole.ts"],"names":[],"mappings":";AACA,kCAAkC;;AAElC,oCAoBC;AApBD,SAAgB,YAAY,CAAC,aAAa;IACtC,IAAI,CAAC,aAAa,EAAE,CAAC;QACjB,OAAO;IACX,CAAC;IAED,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC;IAEvC,MAAM,aAAa,GAAY;QAC3B,GAAG,eAAe,EAAE,6BAA6B;QACjD,GAAG,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;YACpB,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;YAC3B,eAAe,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;QACjC,CAAC;QACD,KAAK,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;YACtB,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YAC7B,eAAe,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QACnC,CAAC;KACJ,CAAC;IAEF,MAAM,CAAC,OAAO,GAAG,aAAa,CAAC;AACnC,CAAC","sourcesContent":["\r\n// keep original console functions\r\n\r\nexport function setupConsole(consoleLogger) {\r\n if (!consoleLogger) {\r\n return;\r\n }\r\n\r\n const originalConsole = global.console;\r\n\r\n const customConsole: Console = {\r\n ...originalConsole, // 保留其他方法,如 console.info/warn\r\n log: (...args: any[]) => {\r\n consoleLogger.log(...args);\r\n originalConsole.log(...args);\r\n },\r\n error: (...args: any[]) => {\r\n consoleLogger.error(...args);\r\n originalConsole.error(...args);\r\n }\r\n };\r\n\r\n global.console = customConsole;\r\n}"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._sendRequestToLLM = void 0;
|
|
4
|
+
exports.setupSendRequestToLLMFunc = setupSendRequestToLLMFunc;
|
|
5
|
+
const sendRequestToSelfHostLLM_1 = require("../llm/sendRequestToSelfHostLLM");
|
|
6
|
+
exports._sendRequestToLLM = sendRequestToSelfHostLLM_1.sendRequestToSelfHostLLM;
|
|
7
|
+
function setupSendRequestToLLMFunc(sendRequestToLLMFunc) {
|
|
8
|
+
exports._sendRequestToLLM = sendRequestToLLMFunc;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=setupLLMRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupLLMRequest.js","sourceRoot":"","sources":["../../src/setup/setupLLMRequest.ts"],"names":[],"mappings":";;;AAGA,8DAEC;AALD,8EAA2E;AAEhE,QAAA,iBAAiB,GAAQ,mDAAwB,CAAC;AAC7D,SAAgB,yBAAyB,CAAC,oBAAyB;IAC/D,yBAAiB,GAAG,oBAAoB,CAAC;AAC7C,CAAC","sourcesContent":["import { sendRequestToSelfHostLLM } from \"../llm/sendRequestToSelfHostLLM\";\r\n\r\nexport let _sendRequestToLLM: any = sendRequestToSelfHostLLM;\r\nexport function setupSendRequestToLLMFunc(sendRequestToLLMFunc: any) {\r\n _sendRequestToLLM = sendRequestToLLMFunc;\r\n}\r\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@echo OFF
|
|
2
|
+
|
|
3
|
+
IF EXIST "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.com" (
|
|
4
|
+
SET DEVENVCOM="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.com"
|
|
5
|
+
) ELSE IF EXIST "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.com" (
|
|
6
|
+
SET DEVENVCOM="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.com"
|
|
7
|
+
) ELSE IF EXIST "C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.com" (
|
|
8
|
+
SET DEVENVCOM="C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.com"
|
|
9
|
+
) ELSE (
|
|
10
|
+
SET DEVENVCOM="devenv.com"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
%DEVENVCOM% %*
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@echo OFF
|
|
2
|
+
|
|
3
|
+
IF EXIST "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe" (
|
|
4
|
+
SET DEVENVEXE="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe"
|
|
5
|
+
) ELSE IF EXIST "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe" (
|
|
6
|
+
SET DEVENVEXE="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe"
|
|
7
|
+
) ELSE IF EXIST "C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe" (
|
|
8
|
+
SET DEVENVEXE="C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe"
|
|
9
|
+
) ELSE (
|
|
10
|
+
SET DEVENVEXE="devenv.exe"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
%DEVENVEXE% %*
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@echo OFF
|
|
2
|
+
|
|
3
|
+
IF EXIST "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\MSbuild.exe" (
|
|
4
|
+
SET MSBUILDEXE="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\MSbuild.exe"
|
|
5
|
+
) ELSE IF EXIST "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\MSbuild.exe" (
|
|
6
|
+
SET MSBUILDEXE="C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\MSbuild.exe"
|
|
7
|
+
) ELSE IF EXIST "C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\MSbuild.exe" (
|
|
8
|
+
SET MSBUILDEXE="C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\MSbuild.exe"
|
|
9
|
+
) ELSE (
|
|
10
|
+
SET MSBUILDEXE="msbuild.exe"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
%MSBUILDEXE% %*
|