Skip to content

feat: enable sandbox for teams agent template (ts & js) #14329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions templates/vsc/js/basic-custom-engine-agent/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"Provision (Sandbox)",
"Deploy (Sandbox)",
"Start application",
"Sideload App to channel"
],
"dependsOrder": "sequence"
},
Expand Down Expand Up @@ -299,6 +300,15 @@
"args": {
"url": "teams.microsoft.com/l/app/${{TEAMS_APP_ID}}?installAppPackage=true"
}
},
{
"label": "Sideload App to channel",
"type": "teamsfx",
"command": "install-app",
"args": {
"env": "sandbox",
"appPackagePath": "${workspaceFolder}/appPackage/build/appPackage.sandbox.zip"
}
}
]
}
11 changes: 11 additions & 0 deletions templates/vsc/js/basic-custom-engine-agent/env/.env.sandbox
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file includes environment variables that can be committed to git. It's gitignored by default because it represents your sandbox development environment.

# Built-in environment variables
TEAMSFX_ENV=sandbox
APP_NAME_SUFFIX=sandbox

# Generated during provision, you can also add your own variables.
BOT_ID=
TEAMS_APP_ID=
BOT_DOMAIN=
BOT_ENDPOINT=
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ provision:
appId: M365_APP_ID

deploy:
{{#SandBoxedTeam}}
# Sideload app in sandboxed team.
- uses: devChannel/installApp
with:
teamId: ${{TEAM_ID}}
channelId: ${{CHANNEL_ID}}
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip
{{/SandBoxedTeam}}

# Run npm command
- uses: cli/runNpmCommand
name: install dependencies
Expand All @@ -110,9 +101,8 @@ deploy:
with:
target: ./.localConfigs
envs:
BOT_ID: ${{BOT_ID}}
BOT_PASSWORD: ${{SECRET_BOT_PASSWORD}}
BOT_TYPE: 'MultiTenant'
clientId: ${{BOT_ID}}
clientSecret: ${{SECRET_BOT_PASSWORD}}
{{#useOpenAI}}
OPENAI_API_KEY: ${{SECRET_OPENAI_API_KEY}}
{{/useOpenAI}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@
{{/enableTestToolByDefault}}
"order": 6
},
"internalConsoleOptions": "neverOpen",
{{#CEAEnabled}}
},
{
"internalConsoleOptions": "neverOpen"
}
{{#CEAEnabled}}
,{
"name": "Launch Remote in Copilot (Edge)",
"type": "msedge",
"request": "launch",
Expand Down Expand Up @@ -157,8 +157,25 @@
"--remote-debugging-port=9223",
"--no-first-run"
]
{{/CEAEnabled}}
}
{{#SandBoxedTeam}}
,{
"name": "Launch Agent to channel (Edge)",
"type": "msedge",
"request": "launch",
"url": "${{sandbox:CHANNEL_WEB_URL}}&webjoin=true",
"cascadeTerminateToConfigurations": [
"Attach to Local Service"
],
"presentation": {
"group": "all",
"hidden": true
},
"internalConsoleOptions": "neverOpen",
"perScriptSourcemaps": "yes"
}
{{/SandBoxedTeam}}
{{/CEAEnabled}}
],
"compounds": [
{
Expand All @@ -179,6 +196,21 @@
},
"stopAll": true
},
{{#SandBoxedTeam}}
{
"name": "Debug in sandbox in Teams (Edge)",
"configurations": [
"Launch Agent to channel (Edge)",
"Attach to Local Service"
],
"preLaunchTask": "Start Agent (Sandbox)",
"presentation": {
"group": "1-local",
"order": 1
},
"stopAll": true
},
{{/SandBoxedTeam}}
{
"name": "Debug in Teams (Chrome)",
"configurations": [
Expand Down Expand Up @@ -230,9 +262,9 @@
"order": 1
},
"stopAll": true
{{#CEAEnabled}}
},
{
}
{{#CEAEnabled}}
,{
"name": "Debug in Copilot (Edge)",
"configurations": [
"Launch in Copilot (Edge)",
Expand All @@ -244,8 +276,8 @@
"order": 1
},
"stopAll": true
},
{
},
{
"name": "Debug in Copilot (Chrome)",
"configurations": [
"Launch in Copilot (Chrome)",
Expand All @@ -257,7 +289,7 @@
"order": 2
},
"stopAll": true
{{/CEAEnabled}}
}
{{/CEAEnabled}}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Agent (Sandbox)",
"dependsOn": [
"Validate prerequisites (Sandbox)",
"Start local tunnel (Sandbox)",
"Provision (Sandbox)",
"Deploy (Sandbox)",
"Start application",
"Sideload App to channel"
],
"dependsOrder": "sequence"
},
{
"label": "Start Agent in Microsoft 365 Agents Playground",
"dependsOn": [
Expand Down Expand Up @@ -103,6 +115,77 @@
"reveal": "silent"
}
},
{
// Check all required prerequisites.
// See https://aka.ms/teamsfx-tasks/check-prerequisites to know the details and how to customize the args.
"label": "Validate prerequisites (Sandbox)",
"type": "teamsfx",
"command": "debug-check-prerequisites",
"args": {
"prerequisites": [
"portOccupancy",
"sandbox",
"nodejs"
],
"portOccupancy": [
3978,
9239
]
}
},
{
// Start the local tunnel service to forward public URL to local port and inspect traffic.
// See https://aka.ms/teamsfx-tasks/local-tunnel for the detailed args definitions.
"label": "Start local tunnel (Sandbox)",
"type": "teamsfx",
"command": "debug-start-local-tunnel",
"args": {
"type": "dev-tunnel",
"ports": [
{
"portNumber": 3978,
"protocol": "http",
"access": "public",
"writeToEnvironmentFile": {
"endpoint": "BOT_ENDPOINT",
"domain": "BOT_DOMAIN"
}
}
],
"env": "sandbox"
},
"isBackground": true,
"problemMatcher": "$teamsfx-local-tunnel-watch"
},
{
// Create the debug resources.
// See https://aka.ms/teamsfx-tasks/provision to know the details and how to customize the args.
"label": "Provision (Sandbox)",
"type": "teamsfx",
"command": "provision",
"args": {
"env": "sandbox"
}
},
{
// Build the project.
// See https://aka.ms/teamsfx-tasks/deploy to know the details and how to customize the args.
"label": "Deploy (Sandbox)",
"type": "teamsfx",
"command": "deploy",
"args": {
"env": "sandbox"
}
},
{
"label": "Sideload App to channel",
"type": "teamsfx",
"command": "install-app",
"args": {
"env": "sandbox",
"appPackagePath": "${workspaceFolder}/appPackage/build/appPackage.sandbox.zip"
}
},
{
"label": "Start Agent Locally",
"dependsOn": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file includes environment variables that can be committed to git. It's gitignored by default because it represents your sandbox development environment.

# Built-in environment variables
TEAMSFX_ENV=sandbox
APP_NAME_SUFFIX=sandbox

# Generated during provision, you can also add your own variables.
BOT_ID=
TEAMS_APP_ID=
BOT_DOMAIN=
BOT_ENDPOINT=
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file includes environment variables that will not be committed to git by default. You can set these environment variables in your CI/CD system for your project.

# If you're adding a secret value, add SECRET_ prefix to the name so Microsoft 365 Agents Toolkit can handle them properly
# Secrets. Keys prefixed with `SECRET_` will be masked in Microsoft 365 Agents Toolkit logs.
SECRET_BOT_PASSWORD=
{{#useOpenAI}}
{{#openAIKey}}
SECRET_OPENAI_API_KEY={{{openAIKey}}}
{{/openAIKey}}
{{^openAIKey}}
SECRET_OPENAI_API_KEY=
{{/openAIKey}}
OPENAI_ASSISTANT_ID= # See README.md for how to fill in this value.
{{/useOpenAI}}
{{#useAzureOpenAI}}
{{#azureOpenAIKey}}
SECRET_AZURE_OPENAI_API_KEY={{{azureOpenAIKey}}}
{{/azureOpenAIKey}}
{{^azureOpenAIKey}}
SECRET_AZURE_OPENAI_API_KEY=
{{/azureOpenAIKey}}
{{#azureOpenAIEndpoint}}
AZURE_OPENAI_ENDPOINT='{{{azureOpenAIEndpoint}}}'
{{/azureOpenAIEndpoint}}
{{^azureOpenAIEndpoint}}
AZURE_OPENAI_ENDPOINT=
{{/azureOpenAIEndpoint}}
AZURE_OPENAI_ASSISTANT_ID= # See README.md for how to fill in this value.
{{/useAzureOpenAI}}
Loading