-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rebase(main): Pulled in new API changes.
- Loading branch information
Showing
39 changed files
with
4,622 additions
and
6,195 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -263,4 +263,6 @@ cython_debug/ | |
.idea/ | ||
|
||
# Testing Suite HTML Reports | ||
report.html | ||
report.html | ||
|
||
**/.openapi-generator |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 @@ | ||
README.md |
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,23 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md |
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,56 @@ | ||
## agent-protocol-client@v1.0.0 | ||
|
||
This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: | ||
|
||
Environment | ||
|
||
- Node.js | ||
- Webpack | ||
- Browserify | ||
|
||
Language level | ||
|
||
- ES5 - you must have a Promises/A+ library installed | ||
- ES6 | ||
|
||
Module system | ||
|
||
- CommonJS | ||
- ES6 module system | ||
|
||
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) | ||
|
||
### Building | ||
|
||
To build and compile the typescript sources to javascript use: | ||
|
||
``` | ||
npm install | ||
npm run build | ||
``` | ||
|
||
### Testing with the Minimal Example | ||
|
||
- First set up the minimal example agent protocol server in the JS or Python SDK repositories. | ||
- After the minimal SDK example is running, run the minimal example locally by changing the import to `..` and running `npm run build` in the package root. | ||
- Run the minimal client example using `ts-node minimal.ts` once the package is built. | ||
|
||
### Publishing | ||
|
||
First build the package then run `npm publish` | ||
|
||
### Consuming | ||
|
||
navigate to the folder of your consuming project and run one of the following commands. | ||
|
||
_published:_ | ||
|
||
``` | ||
npm install agent-protocol-client@v1.0.0 --save | ||
``` | ||
|
||
_unPublished (not recommended):_ | ||
|
||
``` | ||
npm install PATH_TO_GENERATED_PACKAGE --save | ||
``` |
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,42 @@ | ||
import { Configuration, AgentApi, TaskRequestBody, StepRequestBody } from 'agent-protocol-client'; | ||
|
||
// Defining the host is optional and defaults to http://localhost | ||
// See configuration.ts for a list of all supported configuration parameters. | ||
const configuration = new Configuration({ basePath: "http://localhost:8000" }); | ||
|
||
async function main() { | ||
// Create an instance of the API client | ||
const apiInstance = new AgentApi(configuration); | ||
// Create an instance of the API class | ||
const taskRequestBody: TaskRequestBody = { | ||
input: "Write 'Hello world!' to hi.txt." | ||
}; | ||
|
||
const response = await apiInstance.createAgentTask({ taskRequestBody }); | ||
console.log("The response of AgentApi->createAgentTask:\n"); | ||
console.log(response); | ||
console.log("\n\n"); | ||
|
||
const taskId = response.taskId; | ||
let i = 1; | ||
|
||
while (true) { | ||
const stepRequestBody: StepRequestBody = { | ||
input: String(i) | ||
}; | ||
const step = await apiInstance.executeAgentTaskStep({ taskId, stepRequestBody }); | ||
|
||
if (!step || step.isLast) { | ||
break; | ||
} | ||
|
||
console.log("The response of AgentApi->executeAgentTaskStep:\n"); | ||
console.log(step); | ||
console.log("\n\n"); | ||
i += 1; | ||
} | ||
|
||
console.log("Agent finished its work!"); | ||
} | ||
|
||
main().catch(console.error); |
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,14 @@ | ||
{ | ||
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", | ||
"spaces": 2, | ||
"generator-cli": { | ||
"version": "7.2.0", | ||
"useDocker": true | ||
}, | ||
"projectName": "agent-protocol-client", | ||
"packageVersion": "1.0.0", | ||
"additionalProperties": { | ||
"npmName": "agent-protocol-client", | ||
"typescriptThreePlus": true | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,19 @@ | ||
{ | ||
"name": "agent-protocol-client", | ||
"version": "v1", | ||
"description": "OpenAPI client for agent-protocol-client", | ||
"author": "OpenAPI-Generator", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" | ||
}, | ||
"main": "./dist/index.js", | ||
"typings": "./dist/index.d.ts", | ||
"scripts": { | ||
"build": "tsc", | ||
"prepare": "npm run build" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^4.0" | ||
} | ||
} |
Oops, something went wrong.