diff --git a/package.json b/package.json index d023a15a..1305cdcf 100644 --- a/package.json +++ b/package.json @@ -162,7 +162,7 @@ { "command": "vectorcastTestExplorer.removeTestsuite", "category": "VectorCAST Test Explorer", - "title": "Remove Environment from Testsuite" + "title": "Remove Environment from Testsuite" }, { "command": "vectorcastTestExplorer.newEnviroVCAST", @@ -487,8 +487,20 @@ "type": "string", "order": 7, "default": "openai", - "enum": ["openai", "azure_openai", "anthropic", "litellm"], - "enumDescriptions": ["OpenAI", "Azure OpenAI", "Anthropic", "LiteLLM"], + "enum": [ + "openai", + "azure_openai", + "anthropic", + "litellm", + "openai_at" + ], + "enumDescriptions": [ + "OpenAI", + "Azure OpenAI", + "Anthropic", + "LiteLLM", + "OpenAI (Access Token)" + ], "description": "Language model provider for automatic requirements and test generation using Reqs2X" }, "vectorcastTestExplorer.reqs2x.openai.apiKey": { @@ -593,6 +605,37 @@ "default": "", "description": "Environment variables to set when running LiteLLM, e.g., OPENAI_API_KEY=xxxx. Multiple variables can be separated by commas, e.g., OPENAI_API_KEY=xxxx,ANOTHER_ENV_VAR=yyyy. For a list of variables to set for a specific LiteLLM-compatible provider, see https://docs.litellm.ai/docs/providers." } + , + "vectorcastTestExplorer.reqs2x.openai_at.modelName": { + "type": "string", + "order": 25, + "default": "", + "description": "OpenAI AT model name" + }, + "vectorcastTestExplorer.reqs2x.openai_at.modelUrl": { + "type": "string", + "order": 26, + "default": "", + "description": "OpenAI AT model URL" + }, + "vectorcastTestExplorer.reqs2x.openai_at.authUrl": { + "type": "string", + "order": 27, + "default": "", + "description": "OpenAI AT authentication URL" + }, + "vectorcastTestExplorer.reqs2x.openai_at.appKey": { + "type": "string", + "order": 28, + "default": "", + "description": "OpenAI AT application key" + }, + "vectorcastTestExplorer.reqs2x.openai_at.appSecret": { + "type": "string", + "order": 29, + "default": "", + "description": "OpenAI AT application secret" + } } } ], @@ -936,173 +979,173 @@ "group": "vcast@3" } ], - "vectorcastTestExplorer.vcastsubmenu": [ - { - "command": "vectorcastTestExplorer.openProjectInVectorCAST", - "group": "vcast.project", - "when": "testId =~ /\\.vcm$/ || testId in vectorcastTestExplorer.globalProjectCompilers || testId in vectorcastTestExplorer.globalProjectTestsuites" - }, - { - "command": "vectorcastTestExplorer.addCompilerToProject", - "group": "vcast.project", - "when": "testId =~ /\\.vcm$/" - }, - { - "command": "vectorcastTestExplorer.addEnviroToProject", - "group": "vcast.project", - "when": "testId =~ /\\.vcm$/" - }, - { - "command": "vectorcastTestExplorer.newCompilerInProjectVCAST", - "group": "vcast.project", - "when": "testId =~ /\\.vcm$/" - }, - { - "command": "vectorcastTestExplorer.addTestsuiteToCompiler", - "group": "vcast.project", - "when": "testId in vectorcastTestExplorer.globalProjectCompilers" - }, - { - "command": "vectorcastTestExplorer.updateProjectEnvironment", - "group": "vcast.project", - "when": "(testId =~ /^vcast:.*$/ && (testId in vectorcastTestExplorer.vcastUnbuiltEnviroList || testId in vectorcastTestExplorer.vcastEnviroList) && vectorcastTestExplorer.globalProjectIsOpenedChecker) && !config.vectorcastTestExplorer.automaticallyUpdateManageProject" - }, - { - "command": "vectorcastTestExplorer.buildProjectEnviro", - "group": "vcast.build", - "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastUnbuiltEnviroList" - }, - { - "command": "vectorcastTestExplorer.getEnvFullReport", - "group": "vcast.build", - "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList" - }, - { - "command": "vectorcastTestExplorer.buildExecuteIncremental", - "group": "vcast.build", - "when": "vectorcastTestExplorer.globalProjectIsOpenedChecker && ( testId =~ /\\.vcm$/ || testId in vectorcastTestExplorer.globalProjectCompilers || testId in vectorcastTestExplorer.globalProjectTestsuites || (testId =~ /^vcast:.*$/ && ( testId in vectorcastTestExplorer.vcastEnviroList || testId in vectorcastTestExplorer.vcastUnbuiltEnviroList)))" - }, - { - "command": "vectorcastTestExplorer.rebuildEnviro", - "group": "vcast.build", - "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" - }, - { - "command": "vectorcastTestExplorer.cleanEnviro", - "group": "vcast.build", - "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && vectorcastTestExplorer.globalProjectIsOpenedChecker && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" - }, - { - "command": "vectorcastTestExplorer.openVCAST", - "group": "vcast.enviroManagement", - "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" - }, - { - "command": "vectorcastTestExplorer.deleteEnviro", - "group": "vcast.enviroManagement", - "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && !vectorcastTestExplorer.globalProjectIsOpenedChecker" - }, - { - "command": "vectorcastTestExplorer.deleteEnviroFromProject", - "group": "vcast.enviroManagement", - "when": "testId =~ /^vcast:.*$/ && (testId in vectorcastTestExplorer.vcastUnbuiltEnviroList || testId in vectorcastTestExplorer.vcastEnviroList) && vectorcastTestExplorer.globalProjectIsOpenedChecker" - }, - { - "command": "vectorcastTestExplorer.removeTestsuite", - "group": "vcast.enviroManagement", - "when": "testId =~ /^vcast:.*$/ && (testId in vectorcastTestExplorer.vcastUnbuiltEnviroList || testId in vectorcastTestExplorer.vcastEnviroList) && vectorcastTestExplorer.globalProjectIsOpenedChecker" - }, - { - "command": "vectorcastTestExplorer.editTestScript", - "group": "vcast.testScript", - "when": "testId =~ /^vcast:.*$/ && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" - }, - { - "command": "vectorcastTestExplorer.createTestScript", - "group": "vcast.testScript", - "when": "testId =~ /^vcast:.*$/ && testId not in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList && !(testId =~ /.*coded_tests_driver.*/ )" - }, - { - "command": "vectorcastTestExplorer.editCodedTest", - "group": "vcast.testScript", - "when": "testId =~ /^vcast:.*$/ && testId not in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList && testId =~ /.*coded_tests_driver.+/" - }, - { - "command": "vectorcastTestExplorer.addCodedTests", - "group": "vcast.testScript", - "when": "testId =~ /^vcast:.*$/ && testId =~ /.*coded_tests_driver$/ && testId not in vectorcastTestExplorer.vcastHasCodedTestsList" - }, - { - "command": "vectorcastTestExplorer.generateCodedTests", - "group": "vcast.testScript", - "when": "testId =~ /^vcast:.*$/ && testId =~ /.*coded_tests_driver$/ && testId not in vectorcastTestExplorer.vcastHasCodedTestsList" - }, - { - "command": "vectorcastTestExplorer.removeCodedTests", - "group": "vcast.testScript", - "when": "testId =~ /^vcast:.*$/ && testId =~ /.*coded_tests_driver$/ && testId in vectorcastTestExplorer.vcastHasCodedTestsList" - }, - { - "command": "vectorcastTestExplorer.insertBasisPathTests", - "group": "vcast.testGeneration", - "when": "testId =~ /^vcast:.*$/ && !(testId =~ /^.*<>.*$/) && !(testId =~ /^.*<>.*$/) && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" - }, - { - "command": "vectorcastTestExplorer.insertATGTests", - "group": "vcast.testGeneration", - "when": "testId =~ /^vcast:.*$/ && vectorcastTestExplorer.atgAvailable && !(testId =~ /^.*<>.*$/) && !(testId =~ /^.*<>.*$/) && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" - }, - { - "command": "vectorcastTestExplorer.deleteTest", - "group": "vcast.delete", - "when": "testId =~ /^vcast:.*$/ && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" - }, - { - "command": "vectorcastTestExplorer.deleteTestsuite", - "group": "vcast.delete", - "when": "testId in vectorcastTestExplorer.globalProjectTestsuites" - }, - { - "command": "vectorcastTestExplorer.deleteCompiler", - "group": "vcast.delete", - "when": "testId in vectorcastTestExplorer.globalProjectCompilers" - }, - { - "command": "vectorcastTestExplorer.importRequirementsFromGateway", - "group": "vcast@8", - "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && vectorcastTestExplorer.reqs2xFeatureEnabled && testId not in vectorcastTestExplorer.vcastRequirementsAvailable && vectorcastTestExplorer.generateRequirementsEnabled" - }, - { - "command": "vectorcastTestExplorer.generateRequirements", - "group": "vcast@8", - "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && vectorcastTestExplorer.reqs2xFeatureEnabled && testId not in vectorcastTestExplorer.vcastRequirementsAvailable && vectorcastTestExplorer.generateRequirementsEnabled" - }, - { - "command": "vectorcastTestExplorer.showRequirements", - "group": "vcast@9", - "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && vectorcastTestExplorer.reqs2xFeatureEnabled && testId in vectorcastTestExplorer.vcastRequirementsAvailable && vectorcastTestExplorer.generateRequirementsEnabled" - }, - { - "command": "vectorcastTestExplorer.generateTestsFromRequirements", - "group": "vcast@10", - "when": "testId =~ /^vcast:.*$/ && vectorcastTestExplorer.reqs2xFeatureEnabled" - }, - { - "command": "vectorcastTestExplorer.removeRequirements", - "group": "vcast@9", - "when": "testId =~ /^vcast:.*$/ && vectorcastTestExplorer.reqs2xFeatureEnabled && testId in vectorcastTestExplorer.vcastRequirementsAvailable && vectorcastTestExplorer.generateRequirementsEnabled" - }, - { - "command": "vectorcastTestExplorer.populateRequirementsGateway", - "group": "vcast@9", - "when": "testId =~ /^vcast:.*$/ && vectorcastTestExplorer.reqs2xFeatureEnabled && testId in vectorcastTestExplorer.vcastRequirementsAvailable && vectorcastTestExplorer.generateRequirementsEnabled" - }, - { - "command": "vectorcastTestExplorer.viewResults", - "group": "vcast.results", - "when": "testId =~ /^vcast:.*$/ && testId not in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" - } - ] + "vectorcastTestExplorer.vcastsubmenu": [ + { + "command": "vectorcastTestExplorer.openProjectInVectorCAST", + "group": "vcast.project", + "when": "testId =~ /\\.vcm$/ || testId in vectorcastTestExplorer.globalProjectCompilers || testId in vectorcastTestExplorer.globalProjectTestsuites" + }, + { + "command": "vectorcastTestExplorer.addCompilerToProject", + "group": "vcast.project", + "when": "testId =~ /\\.vcm$/" + }, + { + "command": "vectorcastTestExplorer.addEnviroToProject", + "group": "vcast.project", + "when": "testId =~ /\\.vcm$/" + }, + { + "command": "vectorcastTestExplorer.newCompilerInProjectVCAST", + "group": "vcast.project", + "when": "testId =~ /\\.vcm$/" + }, + { + "command": "vectorcastTestExplorer.addTestsuiteToCompiler", + "group": "vcast.project", + "when": "testId in vectorcastTestExplorer.globalProjectCompilers" + }, + { + "command": "vectorcastTestExplorer.updateProjectEnvironment", + "group": "vcast.project", + "when": "(testId =~ /^vcast:.*$/ && (testId in vectorcastTestExplorer.vcastUnbuiltEnviroList || testId in vectorcastTestExplorer.vcastEnviroList) && vectorcastTestExplorer.globalProjectIsOpenedChecker) && !config.vectorcastTestExplorer.automaticallyUpdateManageProject" + }, + { + "command": "vectorcastTestExplorer.buildProjectEnviro", + "group": "vcast.build", + "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastUnbuiltEnviroList" + }, + { + "command": "vectorcastTestExplorer.getEnvFullReport", + "group": "vcast.build", + "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList" + }, + { + "command": "vectorcastTestExplorer.buildExecuteIncremental", + "group": "vcast.build", + "when": "vectorcastTestExplorer.globalProjectIsOpenedChecker && ( testId =~ /\\.vcm$/ || testId in vectorcastTestExplorer.globalProjectCompilers || testId in vectorcastTestExplorer.globalProjectTestsuites || (testId =~ /^vcast:.*$/ && ( testId in vectorcastTestExplorer.vcastEnviroList || testId in vectorcastTestExplorer.vcastUnbuiltEnviroList)))" + }, + { + "command": "vectorcastTestExplorer.rebuildEnviro", + "group": "vcast.build", + "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" + }, + { + "command": "vectorcastTestExplorer.cleanEnviro", + "group": "vcast.build", + "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && vectorcastTestExplorer.globalProjectIsOpenedChecker && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" + }, + { + "command": "vectorcastTestExplorer.openVCAST", + "group": "vcast.enviroManagement", + "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" + }, + { + "command": "vectorcastTestExplorer.deleteEnviro", + "group": "vcast.enviroManagement", + "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && !vectorcastTestExplorer.globalProjectIsOpenedChecker" + }, + { + "command": "vectorcastTestExplorer.deleteEnviroFromProject", + "group": "vcast.enviroManagement", + "when": "testId =~ /^vcast:.*$/ && (testId in vectorcastTestExplorer.vcastUnbuiltEnviroList || testId in vectorcastTestExplorer.vcastEnviroList) && vectorcastTestExplorer.globalProjectIsOpenedChecker" + }, + { + "command": "vectorcastTestExplorer.removeTestsuite", + "group": "vcast.enviroManagement", + "when": "testId =~ /^vcast:.*$/ && (testId in vectorcastTestExplorer.vcastUnbuiltEnviroList || testId in vectorcastTestExplorer.vcastEnviroList) && vectorcastTestExplorer.globalProjectIsOpenedChecker" + }, + { + "command": "vectorcastTestExplorer.editTestScript", + "group": "vcast.testScript", + "when": "testId =~ /^vcast:.*$/ && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" + }, + { + "command": "vectorcastTestExplorer.createTestScript", + "group": "vcast.testScript", + "when": "testId =~ /^vcast:.*$/ && testId not in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList && !(testId =~ /.*coded_tests_driver.*/ )" + }, + { + "command": "vectorcastTestExplorer.editCodedTest", + "group": "vcast.testScript", + "when": "testId =~ /^vcast:.*$/ && testId not in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList && testId =~ /.*coded_tests_driver.+/" + }, + { + "command": "vectorcastTestExplorer.addCodedTests", + "group": "vcast.testScript", + "when": "testId =~ /^vcast:.*$/ && testId =~ /.*coded_tests_driver$/ && testId not in vectorcastTestExplorer.vcastHasCodedTestsList" + }, + { + "command": "vectorcastTestExplorer.generateCodedTests", + "group": "vcast.testScript", + "when": "testId =~ /^vcast:.*$/ && testId =~ /.*coded_tests_driver$/ && testId not in vectorcastTestExplorer.vcastHasCodedTestsList" + }, + { + "command": "vectorcastTestExplorer.removeCodedTests", + "group": "vcast.testScript", + "when": "testId =~ /^vcast:.*$/ && testId =~ /.*coded_tests_driver$/ && testId in vectorcastTestExplorer.vcastHasCodedTestsList" + }, + { + "command": "vectorcastTestExplorer.insertBasisPathTests", + "group": "vcast.testGeneration", + "when": "testId =~ /^vcast:.*$/ && !(testId =~ /^.*<>.*$/) && !(testId =~ /^.*<>.*$/) && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" + }, + { + "command": "vectorcastTestExplorer.insertATGTests", + "group": "vcast.testGeneration", + "when": "testId =~ /^vcast:.*$/ && vectorcastTestExplorer.atgAvailable && !(testId =~ /^.*<>.*$/) && !(testId =~ /^.*<>.*$/) && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" + }, + { + "command": "vectorcastTestExplorer.deleteTest", + "group": "vcast.delete", + "when": "testId =~ /^vcast:.*$/ && !(testId =~ /.*coded_tests_driver.*/) && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" + }, + { + "command": "vectorcastTestExplorer.deleteTestsuite", + "group": "vcast.delete", + "when": "testId in vectorcastTestExplorer.globalProjectTestsuites" + }, + { + "command": "vectorcastTestExplorer.deleteCompiler", + "group": "vcast.delete", + "when": "testId in vectorcastTestExplorer.globalProjectCompilers" + }, + { + "command": "vectorcastTestExplorer.importRequirementsFromGateway", + "group": "vcast@8", + "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && vectorcastTestExplorer.reqs2xFeatureEnabled && testId not in vectorcastTestExplorer.vcastRequirementsAvailable && vectorcastTestExplorer.generateRequirementsEnabled" + }, + { + "command": "vectorcastTestExplorer.generateRequirements", + "group": "vcast@8", + "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && vectorcastTestExplorer.reqs2xFeatureEnabled && testId not in vectorcastTestExplorer.vcastRequirementsAvailable && vectorcastTestExplorer.generateRequirementsEnabled" + }, + { + "command": "vectorcastTestExplorer.showRequirements", + "group": "vcast@9", + "when": "testId =~ /^vcast:.*$/ && testId in vectorcastTestExplorer.vcastEnviroList && vectorcastTestExplorer.reqs2xFeatureEnabled && testId in vectorcastTestExplorer.vcastRequirementsAvailable && vectorcastTestExplorer.generateRequirementsEnabled" + }, + { + "command": "vectorcastTestExplorer.generateTestsFromRequirements", + "group": "vcast@10", + "when": "testId =~ /^vcast:.*$/ && vectorcastTestExplorer.reqs2xFeatureEnabled" + }, + { + "command": "vectorcastTestExplorer.removeRequirements", + "group": "vcast@9", + "when": "testId =~ /^vcast:.*$/ && vectorcastTestExplorer.reqs2xFeatureEnabled && testId in vectorcastTestExplorer.vcastRequirementsAvailable && vectorcastTestExplorer.generateRequirementsEnabled" + }, + { + "command": "vectorcastTestExplorer.populateRequirementsGateway", + "group": "vcast@9", + "when": "testId =~ /^vcast:.*$/ && vectorcastTestExplorer.reqs2xFeatureEnabled && testId in vectorcastTestExplorer.vcastRequirementsAvailable && vectorcastTestExplorer.generateRequirementsEnabled" + }, + { + "command": "vectorcastTestExplorer.viewResults", + "group": "vcast.results", + "when": "testId =~ /^vcast:.*$/ && testId not in vectorcastTestExplorer.vcastEnviroList && testId not in vectorcastTestExplorer.vcastUnbuiltEnviroList" + } + ] }, "submenus": [ { @@ -1206,4 +1249,4 @@ "engines": { "vscode": "^1.79.0" } -} \ No newline at end of file +} diff --git a/python/vcastDataServer.py b/python/vcastDataServer.py index 21aaed54..ef887136 100644 --- a/python/vcastDataServer.py +++ b/python/vcastDataServer.py @@ -273,7 +273,10 @@ def main(): # start the server logFilePath = os.path.join(os.getcwd(), "vcastDataServer.log") - with open(logFilePath, "w", buffering=1) as pythonUtilities.logFileHandle: + # ensure the log file uses utf-8 so we can write any unicode chars + with open( + logFilePath, "w", buffering=1, encoding="utf-8", errors="replace" + ) as pythonUtilities.logFileHandle: # this will set the vcastDataServerTypes.PORT global findAvailablePort() app = init_application(logFilePath) diff --git a/src/extension.ts b/src/extension.ts index 4762892f..08570943 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -3338,6 +3338,33 @@ function gatherLLMProviderSettings(): LLMProviderSettingsResult { baseEnv[key.trim()] = value.trim(); } } + } else if (provider === "openai_at") { + // OpenAI Access Token based authentication (distinct from standard OpenAI apiKey usage) + need( + config.get("reqs2x.openai_at.modelName"), + "OpenAI AT Model Name", + "VCAST_REQS2X_OPENAI_AT_MODEL_NAME" + ); + need( + config.get("reqs2x.openai_at.modelUrl"), + "OpenAI AT Base URL", + "VCAST_REQS2X_OPENAI_AT_MODEL_URL" + ); + need( + config.get("reqs2x.openai_at.authUrl"), + "OpenAI AT Auth URL", + "VCAST_REQS2X_OPENAI_AT_AUTH_URL" + ); + need( + config.get("reqs2x.openai_at.appKey"), + "OpenAI AT App Key", + "VCAST_REQS2X_OPENAI_AT_APP_KEY" + ); + need( + config.get("reqs2x.openai_at.appSecret"), + "OpenAI AT App Secret", + "VCAST_REQS2X_OPENAI_AT_APP_SECRET" + ); } else { missing.push("Unsupported provider value"); }