-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unified NPM AppAgent Provider (#454)
- Split inline agents (dispatcher/system) to be its own provider, so that eventually "builtin" agents can live in a separate package. - Unified built-in agents and external agent provider into npm agent provider, which only different in the "require" resolve path. - Add capability for npm agent provider to specify the path of the package in the config, instead of having it install/deploy to the user profile. - Add test agent that does simple addition and add test that inject the path of the agent using the npm agent provider.
- Loading branch information
Showing
34 changed files
with
602 additions
and
479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Microsoft Corporation. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# test | ||
|
||
Test dispatcher agent | ||
|
||
## Trademarks | ||
|
||
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft | ||
trademarks or logos is subject to and must follow | ||
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). | ||
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. | ||
Any use of third-party trademarks or logos are subject to those third-party's policies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "test-agent", | ||
"version": "0.0.1", | ||
"description": "Dispatch agent for testing", | ||
"homepage": "https://github.com/microsoft/TypeAgent#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/microsoft/TypeAgent.git", | ||
"directory": "ts/packages/agents/test" | ||
}, | ||
"license": "MIT", | ||
"author": "Microsoft", | ||
"type": "module", | ||
"exports": { | ||
"./agent/manifest": "./src/manifest.json", | ||
"./agent/handlers": "./dist/handler.js" | ||
}, | ||
"scripts": { | ||
"build": "npm run tsc", | ||
"clean": "rimraf --glob dist *.tsbuildinfo *.done.build.log", | ||
"prettier": "prettier --check . --ignore-path ../../../.prettierignore", | ||
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore", | ||
"tsc": "tsc -b" | ||
}, | ||
"dependencies": { | ||
"@typeagent/agent-sdk": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"prettier": "^3.2.5", | ||
"rimraf": "^5.0.5", | ||
"typescript": "^5.4.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { ActionContext, AppAgent } from "@typeagent/agent-sdk"; | ||
import { AddAction } from "./schema.js"; | ||
import { createActionResult } from "@typeagent/agent-sdk/helpers/action"; | ||
|
||
export function instantiate(): AppAgent { | ||
return { | ||
executeAction, | ||
}; | ||
} | ||
|
||
async function executeAction(action: AddAction, context: ActionContext<void>) { | ||
switch (action.actionName) { | ||
case "add": | ||
const { a, b } = action.parameters; | ||
return createActionResult(`The sum of ${a} and ${b} is ${a + b}`); | ||
default: | ||
throw new Error(`Unknown action: ${action.actionName}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"emojiChar": "➕", | ||
"description": "Agent to do addition", | ||
"schema": { | ||
"description": "Math agent with action to do addition", | ||
"schemaFile": "./schema.ts", | ||
"schemaType": "AddAction" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
export type AddAction = { | ||
actionName: "add"; | ||
parameters: { | ||
a: number; | ||
b: number; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "../../../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"composite": true, | ||
"rootDir": ".", | ||
"outDir": "../dist", | ||
}, | ||
"include": ["./**/*"], | ||
"ts-node": { | ||
"esm": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"composite": true, | ||
}, | ||
"include": [], | ||
"references": [ | ||
{ "path": "./src" } | ||
], | ||
"ts-node": { | ||
"esm": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.