diff --git a/docs/changelog.md b/docs/changelog.md index a788f983..9be128b5 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,6 @@ ## Unreleased +- Added `SEMA4AI_FILE_MANAGEMENT_URL` environment variable when running actions to `file:///devdata/chat-files`. - Updated Action Server to `2.9.0` - Updated Agent CLI to `v1.0.5` - Updated RCC to `v19.0.2` diff --git a/sema4ai/vscode-client/src/activities.ts b/sema4ai/vscode-client/src/activities.ts index 84bd969f..daa094ea 100644 --- a/sema4ai/vscode-client/src/activities.ts +++ b/sema4ai/vscode-client/src/activities.ts @@ -52,6 +52,8 @@ import { import { createActionPackage } from "./robo/actionPackage"; import { createAgentPackage } from "./robo/agentPackage"; import { langServer } from "./extension"; +import * as path from "path"; +import * as fs from "fs"; export interface ListRobotSelectionOpts { showTaskPackages: boolean; @@ -494,7 +496,7 @@ export async function uploadRobot(robot?: LocalPackageMetadataInfo) { let refresh = false; SELECT_OR_REFRESH: do { let workspaceSelection = await selectWorkspace( - "Please select a Workspace to upload ‘" + robot.name + "’ to.", + "Please select a Workspace to upload '" + robot.name + "' to.", refresh ); if (workspaceSelection === undefined) { @@ -605,7 +607,7 @@ export async function uploadRobot(robot?: LocalPackageMetadataInfo) { let selectedItem: QuickPickItemWithAction = await showSelectOneQuickPick( updateExistingCaptions, - "This will overwrite the robot ‘" + robotInfo.name + "’ on Control Room. Are you sure? " + "This will overwrite the robot '" + robotInfo.name + "' on Control Room. Are you sure? " ); // robot.language-server.python @@ -892,7 +894,8 @@ export async function createPackage() { * tasks will use `updateLaunchEnvironment`). */ export async function updateLaunchEnvironmentCommonTasksAndActions( - environment: Record + environment: Record, + targetYaml?: string ): Promise> { const newEnv = applyOutViewIntegrationEnvVars(environment); @@ -901,6 +904,20 @@ export async function updateLaunchEnvironmentCommonTasksAndActions( newEnv["SEMA4AI_CREDENTIAL_API"] = externalApiUrl; } + if (targetYaml) { + const packageDir = path.dirname(targetYaml); + const devdataPath = path.join(packageDir, "devdata", "chat-files"); + + try { + if (!fs.existsSync(devdataPath)) { + fs.mkdirSync(devdataPath, { recursive: true }); + } + newEnv["SEMA4AI_FILE_MANAGEMENT_URL"] = `file://${devdataPath}`; + } catch (error) { + logError("Error creating devdata/chat-files directory", error, "ERR_CREATE_DEVDATA_DIR"); + } + } + return newEnv; } diff --git a/sema4ai/vscode-client/src/debugger.ts b/sema4ai/vscode-client/src/debugger.ts index 70af5e4c..acf7e850 100644 --- a/sema4ai/vscode-client/src/debugger.ts +++ b/sema4ai/vscode-client/src/debugger.ts @@ -135,7 +135,7 @@ export class RobocorpCodeDebugConfigurationProvider implements DebugConfiguratio } if (isActionPackageLaunch) { - env = await updateLaunchEnvironmentCommonTasksAndActions(env); + env = await updateLaunchEnvironmentCommonTasksAndActions(env, debugConfiguration.package); // Vault/work-items features not available in action server at this point. } else { // Resolve environment (updates the environment to add vault