Skip to content

Commit

Permalink
[JS] chore: dependencies cleanup: typescript, teamsfx, and browserify (
Browse files Browse the repository at this point in the history
…#2014)

## Linked issues

closes: #1947
closes #1371

#### TLDR: Node 20 is now supported!!! If you're eager for this, you
shouldn't need to wait for a release, as the affected packages were our
samples.

## Details

- Modified package configuration for `typescript` to only allow patch
updates. See Change details below for more information. This is
(ideally) temporary.
- Remove `@microsoft/teamsfx` as a dependency - it turns out this
dependency is entirely unused, but due to sub-dependencies was
preventing us from being able to support Node >=18. Because of this and
`botbuilder-js@4.23.x` now supporting node 20, teams-ai js package now
also runs with node 20 too!
- Removed `browserify` - unused dependency
- Updated Powered by AI docs to slightly clarify how AI module may use a
`planner`.

#### Change details

[TS made an
update](https://devblogs.microsoft.com/typescript/announcing-typescript-5-6)
that in 5.6 reveals previously 'hidden' TS errors.
`gpt-tokenizer` and `botbuilder` have TS errors that 5.6 catches. I
filed bugs for both packages:
 
[[Bug] Cannot upgrade to TS 5.6x due to build errors · Issue #49 ·
niieani/gpt-tokenizer
(github.com)](niieani/gpt-tokenizer#49)
[Cannot bump typescript to 5.6 due to botbuilder `INodeBuffer` error ·
Issue #4746 · microsoft/botbuilder-js
(github.com)](microsoft/botbuilder-js#4746)

## Attestation Checklist

- [x] My code follows the style guidelines of this project

- I have checked for/fixed spelling, linting, and other errors
- I have commented my code for clarity
- I have made corresponding changes to the documentation (updating the
doc strings in the code is sufficient)
- My changes generate no new warnings
- I have added tests that validates my changes, and provides sufficient
test coverage. I have tested with:
  - Local testing
  - E2E testing in Teams
- New and existing unit tests pass locally with my changes

### Additional information

> Feel free to add other relevant information below

---------

Co-authored-by: Corina Gum <>
  • Loading branch information
corinagum committed Sep 13, 2024
1 parent 923a490 commit c933428
Show file tree
Hide file tree
Showing 26 changed files with 1,102 additions and 2,328 deletions.
10 changes: 9 additions & 1 deletion getting-started/CONCEPTS/POWERED-BY-AI.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Feedback loop, when enabled, will add thumbs up and thumbs down buttons to the b
To enable this feature, set the `enable_feedback_loop` property to `true` in the `AIOptions` object when creating the `AI` object.

### JS

```typescript
export const app = new Application<ApplicationTurnState>({
ai: {
Expand All @@ -83,6 +84,7 @@ export const app = new Application<ApplicationTurnState>({
```
### C#
```csharp
AIOptions<TurnState> options = new(planner);
options.EnableFeedbackLoop = true; // setting `EnableFeedbackLoop`
Expand All @@ -93,10 +95,11 @@ Application<TurnState> app = new ApplicationBuilder<TurnState>()
```
### Python
```python
app = Application[AppTurnState](
ApplicationOptions(
...,
# ...other options e.g. planner
ai=AIOptions(
enable_feedback_loop=True
),
Expand All @@ -122,13 +125,15 @@ If the user presses either of the feedback buttons, they will be prompted to pro
Use the `app.feedbackLoop` method to register a feedback loop handler. This method will be called when the user provides feedback on the AI system's response. It is up to the developer to store and process the feedback.
### JS
```typescript
app.feedbackLoop(async (context, state, feedbackLoopData) => {
// custom logic here...
});
```
### C#
```csharp
app.OnFeedbackLoop(async (turnContext, turnState, feedbackLoopData, cancellationToken) =>
{
Expand All @@ -137,6 +142,7 @@ app.OnFeedbackLoop(async (turnContext, turnState, feedbackLoopData, cancellation
```
### Python
```python
@app.feedback_loop
async def feedback_loop(
Expand Down Expand Up @@ -191,6 +197,7 @@ app.ai.action<PredictedSayCommand>(AI.SayCommandActionName, async (context, stat
```
### C#
```csharp
// AIActions.cs
public class AIActions
Expand All @@ -208,6 +215,7 @@ app.AI.ImportActions(new AIActions());
```
### Python
```python
@app.ai.action(ActionTypes.SAY_COMMAND)
async def on_say(
Expand Down
3 changes: 1 addition & 2 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"applicationinsights": "^2.9.6",
"browserify": "^17.0.0",
"chai": "^4.5.0",
"depcheck": "^1.4.7",
"eslint": "^8.57.0",
Expand Down Expand Up @@ -64,7 +63,7 @@
"sponge": "^0.1.0",
"tinyify": "^4.0.0",
"ts-node": "^10.9.2",
"typescript": "^5.5.4",
"typescript": "5.5.4",
"wsrun": "^5.2.4"
}
}
2 changes: 1 addition & 1 deletion js/packages/teams-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"rimraf": "5.0.10",
"shx": "^0.3.4",
"ts-mocha": "10.0.0",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
},
"scripts": {
"build": "tsc -b",
Expand Down
2 changes: 1 addition & 1 deletion js/samples/01.getting-started/a.echoBot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
"prettier": "^3.3.3",
"rimraf": "^5.0.10",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"nodemon": "~3.0.1",
"prettier": "^3.3.3",
"rimraf": "^5.0.10",
"typescript": "^5.5.4",
"typescript": "~5.5.4",
"ts-node": "^10.9.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@
"prettier": "^3.3.3",
"rimraf": "^5.0.10",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
2 changes: 1 addition & 1 deletion js/samples/03.ai-concepts/a.twentyQuestions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
"rimraf": "^5.0.10",
"shx": "^0.3.4",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"nodemon": "~3.0.1",
"prettier": "^3.3.3",
"rimraf": "^5.0.10",
"typescript": "^5.5.4",
"typescript": "~5.5.4",
"shx": "^0.3.4",
"ts-node": "^10.9.2"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
"rimraf": "^5.0.10",
"shx": "^0.3.4",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@
"rimraf": "^5.0.10",
"shx": "^0.3.4",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
2 changes: 1 addition & 1 deletion js/samples/03.ai-concepts/e.customModel-LLAMA/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"nodemon": "~1.19.4",
"prettier": "^3.3.3",
"rimraf": "^5.0.10",
"typescript": "^5.5.4",
"typescript": "~5.5.4",
"shx": "^0.3.4",
"ts-node": "^10.9.2"
}
Expand Down
2 changes: 1 addition & 1 deletion js/samples/03.ai-concepts/f.chatModeration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
"prettier": "^3.3.3",
"shx": "^0.3.4",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
3 changes: 1 addition & 2 deletions js/samples/04.ai-apps/a.teamsChefBot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"dependencies": {
"@microsoft/teams-ai": "~1.4.0",
"@microsoft/teams-js": "^2.28.0",
"@microsoft/teamsfx": "^2.3.2",
"botbuilder": "^4.23.0",
"dotenv": "^16.4.5",
"openai": "4.41.1",
Expand All @@ -44,6 +43,6 @@
"prettier": "^3.3.3",
"rimraf": "^5.0.10",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
2 changes: 1 addition & 1 deletion js/samples/04.ai-apps/b.devOpsBot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
"rimraf": "^5.0.10",
"shx": "^0.3.4",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
3 changes: 1 addition & 2 deletions js/samples/04.ai-apps/c.vision-cardGazer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
},
"dependencies": {
"@microsoft/teams-ai": "~1.4.0",
"@microsoft/teamsfx": "^2.3.2",
"botbuilder": "^4.23.0",
"dotenv": "^16.4.5",
"openai": "4.41.1",
Expand All @@ -39,6 +38,6 @@
"rimraf": "^5.0.10",
"nodemon": "~3.0.1",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
2 changes: 1 addition & 1 deletion js/samples/04.ai-apps/d.assistants-mathBot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
"prettier": "^3.3.3",
"rimraf": "^5.0.10",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
2 changes: 1 addition & 1 deletion js/samples/04.ai-apps/e.assistants-orderBot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
"prettier": "^3.3.3",
"rimraf": "^5.0.10",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
2 changes: 1 addition & 1 deletion js/samples/04.ai-apps/f.whoBot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
"rimraf": "^5.0.10",
"ts-node": "^10.9.2",
"tsc-watch": "^6.2.0",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"dependencies": {
"@azure/search-documents": "12.1.0",
"@microsoft/teams-ai": "~1.4.0",
"@microsoft/teamsfx": "^2.3.2",
"botbuilder": "^4.23.0",
"debug": "^4.3.7",
"dotenv": "^16.4.1",
Expand All @@ -51,6 +50,6 @@
"prettier": "^3.3.3",
"rimraf": "^5.0.10",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
3 changes: 1 addition & 2 deletions js/samples/04.ai-apps/h.datasource-azureOpenAI/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"@azure/identity": "^4.4.1",
"@azure/search-documents": "12.1.0",
"@microsoft/teams-ai": "~1.4.0",
"@microsoft/teamsfx": "^2.3.2",
"botbuilder": "^4.23.0",
"dotenv": "^16.4.1",
"openai": "4.41.1",
Expand All @@ -51,6 +50,6 @@
"prettier": "^3.3.3",
"rimraf": "^5.0.10",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
"rimraf": "^5.0.10",
"ts-node": "^10.9.2",
"tsc-watch": "^6.2.0",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
2 changes: 1 addition & 1 deletion js/samples/05.authentication/b.oauth-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
"rimraf": "^5.0.10",
"ts-node": "^10.9.2",
"tsc-watch": "^6.2.0",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@
"rimraf": "^5.0.10",
"ts-node": "^10.9.2",
"tsc-watch": "^6.2.0",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
2 changes: 1 addition & 1 deletion js/samples/05.authentication/d.teamsSSO-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
"rimraf": "^5.0.10",
"ts-node": "^10.9.2",
"tsc-watch": "^6.2.0",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
"rimraf": "^5.0.10",
"ts-node": "^10.9.2",
"tsc-watch": "^6.2.0",
"typescript": "^5.5.4"
"typescript": "~5.5.4"
}
}
Loading

0 comments on commit c933428

Please sign in to comment.