@bpinhosilva/agent-orchestrator 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/bug_report.md +25 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +18 -0
- package/.github/workflows/ci.yml +34 -0
- package/.github/workflows/gitleaks.yml +22 -0
- package/.github/workflows/release.yml +38 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +6 -0
- package/.prettierrc +4 -0
- package/.releaserc.json +31 -0
- package/CONTRIBUTING.md +64 -0
- package/LICENSE +21 -0
- package/README.md +75 -0
- package/TODO.md +14 -0
- package/commitlint.config.js +3 -0
- package/dist/agents/agents.controller.d.ts +8 -0
- package/dist/agents/agents.controller.js +39 -0
- package/dist/agents/agents.controller.js.map +1 -0
- package/dist/agents/agents.module.d.ts +2 -0
- package/dist/agents/agents.module.js +23 -0
- package/dist/agents/agents.module.js.map +1 -0
- package/dist/agents/agents.service.d.ts +10 -0
- package/dist/agents/agents.service.js +33 -0
- package/dist/agents/agents.service.js.map +1 -0
- package/dist/agents/dto/agent-request.dto.d.ts +3 -0
- package/dist/agents/dto/agent-request.dto.js +21 -0
- package/dist/agents/dto/agent-request.dto.js.map +1 -0
- package/dist/agents/implementations/gemini.agent.d.ts +8 -0
- package/dist/agents/implementations/gemini.agent.js +59 -0
- package/dist/agents/implementations/gemini.agent.js.map +1 -0
- package/dist/agents/interfaces/agent.interface.d.ts +8 -0
- package/dist/agents/interfaces/agent.interface.js +2 -0
- package/dist/agents/interfaces/agent.interface.js.map +1 -0
- package/dist/app.controller.d.ts +6 -0
- package/dist/app.controller.js +33 -0
- package/dist/app.controller.js.map +1 -0
- package/dist/app.module.d.ts +2 -0
- package/dist/app.module.js +31 -0
- package/dist/app.module.js.map +1 -0
- package/dist/app.service.d.ts +3 -0
- package/dist/app.service.js +19 -0
- package/dist/app.service.js.map +1 -0
- package/dist/cli.js +21 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +15 -0
- package/dist/main.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/docker-compose.yml +21 -0
- package/eslint.config.mjs +35 -0
- package/nest-cli.json +8 -0
- package/package.json +98 -0
- package/public/index.html +20 -0
- package/src/agents/agents.controller.spec.ts +46 -0
- package/src/agents/agents.controller.ts +17 -0
- package/src/agents/agents.module.ts +11 -0
- package/src/agents/agents.service.spec.ts +44 -0
- package/src/agents/agents.service.ts +23 -0
- package/src/agents/dto/agent-request.dto.ts +7 -0
- package/src/agents/implementations/gemini.agent.spec.ts +41 -0
- package/src/agents/implementations/gemini.agent.ts +50 -0
- package/src/agents/interfaces/agent.interface.ts +9 -0
- package/src/app.controller.spec.ts +22 -0
- package/src/app.controller.ts +12 -0
- package/src/app.module.ts +19 -0
- package/src/app.service.ts +8 -0
- package/src/cli.ts +23 -0
- package/src/main.ts +18 -0
- package/test/app.e2e-spec.ts +56 -0
- package/test/jest-e2e.json +9 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +25 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: 'fix: '
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior.
|
|
15
|
+
|
|
16
|
+
**Expected behavior**
|
|
17
|
+
A clear and concise description of what you expected to happen.
|
|
18
|
+
|
|
19
|
+
**Environment details:**
|
|
20
|
+
- OS: [e.g. Ubuntu 22.04]
|
|
21
|
+
- Node.js version: [e.g. 20.x]
|
|
22
|
+
- Package version: [e.g. 1.0.0]
|
|
23
|
+
|
|
24
|
+
**Additional context**
|
|
25
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: 'feat: '
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
<!-- Please include a concise summary of the changes and the related issue. -->
|
|
3
|
+
Resolves #
|
|
4
|
+
|
|
5
|
+
## Type of change
|
|
6
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
7
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
|
8
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
9
|
+
- [ ] Documentation update
|
|
10
|
+
|
|
11
|
+
## Checklist:
|
|
12
|
+
- [ ] My code follows the Conventional Commits specification.
|
|
13
|
+
- [ ] I have performed a self-review of my own code.
|
|
14
|
+
- [ ] I have commented my code, particularly in hard-to-understand areas.
|
|
15
|
+
- [ ] I have made corresponding changes to the documentation.
|
|
16
|
+
- [ ] My changes generate no new warnings.
|
|
17
|
+
- [ ] I have added tests that prove my fix is effective or that my feature works.
|
|
18
|
+
- [ ] New and existing tests pass locally with my changes.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "main" ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build-and-test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v5
|
|
14
|
+
|
|
15
|
+
- name: Use Node.js 24.x
|
|
16
|
+
uses: actions/setup-node@v5
|
|
17
|
+
with:
|
|
18
|
+
node-version: '24.x'
|
|
19
|
+
cache: 'npm'
|
|
20
|
+
|
|
21
|
+
- run: npm ci
|
|
22
|
+
|
|
23
|
+
- name: Run npm audit
|
|
24
|
+
run: npm audit --audit-level=high
|
|
25
|
+
|
|
26
|
+
- name: Run linter
|
|
27
|
+
run: npm run lint
|
|
28
|
+
|
|
29
|
+
- name: Run unit tests
|
|
30
|
+
run: npm test
|
|
31
|
+
|
|
32
|
+
# Optional: Generate a coverage report
|
|
33
|
+
- name: Run tests with coverage
|
|
34
|
+
run: npm run test:cov
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: gitleaks
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
scan:
|
|
13
|
+
name: gitleaks
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v5
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
- uses: gitleaks/gitleaks-action@v2
|
|
20
|
+
env:
|
|
21
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
22
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write # to be able to publish a GitHub release
|
|
10
|
+
issues: write # to be able to comment on released issues
|
|
11
|
+
pull-requests: write # to be able to comment on released pull requests
|
|
12
|
+
id-token: write # required for Trusted Publishing
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
release:
|
|
16
|
+
name: Release
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout
|
|
20
|
+
uses: actions/checkout@v5
|
|
21
|
+
with:
|
|
22
|
+
fetch-depth: 0
|
|
23
|
+
|
|
24
|
+
- name: Setup Node.js
|
|
25
|
+
uses: actions/setup-node@v5
|
|
26
|
+
with:
|
|
27
|
+
node-version: '24'
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: npm ci
|
|
31
|
+
|
|
32
|
+
- name: Run tests
|
|
33
|
+
run: npm test
|
|
34
|
+
|
|
35
|
+
- name: Semantic Release
|
|
36
|
+
env:
|
|
37
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
38
|
+
run: npx semantic-release
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx --no -- commitlint --edit "$1"
|
package/.prettierrc
ADDED
package/.releaserc.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"branches": [
|
|
3
|
+
"main",
|
|
4
|
+
{
|
|
5
|
+
"name": "alpha",
|
|
6
|
+
"prerelease": true
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"plugins": [
|
|
10
|
+
"@semantic-release/commit-analyzer",
|
|
11
|
+
"@semantic-release/release-notes-generator",
|
|
12
|
+
"@semantic-release/changelog",
|
|
13
|
+
[
|
|
14
|
+
"@semantic-release/npm",
|
|
15
|
+
{
|
|
16
|
+
"npmPublish": true
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"@semantic-release/github",
|
|
20
|
+
[
|
|
21
|
+
"@semantic-release/git",
|
|
22
|
+
{
|
|
23
|
+
"assets": [
|
|
24
|
+
"CHANGELOG.md",
|
|
25
|
+
"package.json"
|
|
26
|
+
],
|
|
27
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
]
|
|
31
|
+
}
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Contributing to Agent Orchestrator
|
|
2
|
+
|
|
3
|
+
First off, thank you for considering contributing to this project!
|
|
4
|
+
|
|
5
|
+
## 1. Local Development Setup
|
|
6
|
+
|
|
7
|
+
To get your environment set up:
|
|
8
|
+
|
|
9
|
+
1. **Clone the repository:**
|
|
10
|
+
```bash
|
|
11
|
+
git clone <your-fork-url>
|
|
12
|
+
cd agent-orchestrator
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. **Install dependencies:**
|
|
16
|
+
```bash
|
|
17
|
+
npm install
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
3. **Start the development server:**
|
|
21
|
+
```bash
|
|
22
|
+
npm run start:dev
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
4. **Run tests:**
|
|
26
|
+
```bash
|
|
27
|
+
npm test
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 2. Branching Strategy (GitHub Flow)
|
|
31
|
+
|
|
32
|
+
We use exactly **one** long-lived branch: `main`.
|
|
33
|
+
|
|
34
|
+
1. Always create a new branch from `main` for your work.
|
|
35
|
+
```bash
|
|
36
|
+
git checkout -b feature/your-feature-name
|
|
37
|
+
```
|
|
38
|
+
2. Commit your changes locally.
|
|
39
|
+
3. Push to your fork and submit a Pull Request against our `main` branch.
|
|
40
|
+
|
|
41
|
+
## 3. Commit Message Conventions (Conventional Commits)
|
|
42
|
+
|
|
43
|
+
We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). This project uses `husky` and `commitlint` to automatically enforce these rules when you commit.
|
|
44
|
+
|
|
45
|
+
Your commit messages MUST follow this format:
|
|
46
|
+
```
|
|
47
|
+
<type>(<optional scope>): <description>
|
|
48
|
+
|
|
49
|
+
[optional body]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
* **`feat:`** A new feature
|
|
53
|
+
* **`fix:`** A bug fix
|
|
54
|
+
* **`docs:`** Documentation only changes
|
|
55
|
+
* **`style:`** Changes that do not affect the meaning of the code (white-space, formatting, etc)
|
|
56
|
+
* **`refactor:`** A code change that neither fixes a bug nor adds a feature
|
|
57
|
+
* **`perf:`** A code change that improves performance
|
|
58
|
+
* **`test:`** Adding missing tests or correcting existing tests
|
|
59
|
+
* **`chore:`** Changes to the build process or auxiliary tools and libraries such as documentation generation
|
|
60
|
+
|
|
61
|
+
**Example:**
|
|
62
|
+
```
|
|
63
|
+
feat(gemini): add support for gemini-2.5-flash-lite
|
|
64
|
+
```
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bruno Sampaio Pinho da Silva
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Agent Orchestrator
|
|
2
|
+
|
|
3
|
+
[](https://github.com/bpinhosilva/agent-orchestrator/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/bpinhosilva/agent-orchestrator/actions/workflows/release.yml)
|
|
5
|
+
[](https://github.com/bpinhosilva/agent-orchestrator/actions/workflows/gitleaks.yml)
|
|
6
|
+
|
|
7
|
+
Agent Orchestrator is an open-source project designed to manage and orchestrate AI agents using both back-end services and front-end applications. It provides an automated agentic execution environment where you can create multiple agent profiles (e.g., Head Agent, Researcher, CMO) and delegate tasks to them through automated workflows.
|
|
8
|
+
|
|
9
|
+
## Features (In Progress & Planned)
|
|
10
|
+
- **Agent Delegation**: Delegate tasks to specialized AI agents.
|
|
11
|
+
- **Job Scheduler**: Create and schedule recurring agentic tasks.
|
|
12
|
+
- **Workflow Engine**: Drag-and-drop workflow builder supporting triggers, agent chaining, and outputs.
|
|
13
|
+
- **Agent Capabilities**: File reading/writing, web search, email capabilities, and image generation using NanoBanana.
|
|
14
|
+
- **TUI/CLI Tooling**: CLI executables to manage the installation and local agent configuration.
|
|
15
|
+
|
|
16
|
+
## Current Architecture
|
|
17
|
+
- **Backend Framework**: NestJS + TypeScript
|
|
18
|
+
- **Frontend SPA**: React (Currently served as a single placeholder HTML file by the backend for MVP)
|
|
19
|
+
- **Database**: PostgreSQL (via Docker Compose)
|
|
20
|
+
- **Testing**: Jest (TDD Approach with Unit & E2E)
|
|
21
|
+
- **Architecture**: 3-Tier (Controller, Service, DAL/Adapter Interfaces)
|
|
22
|
+
|
|
23
|
+
## Prerequisites
|
|
24
|
+
- [Node.js](https://nodejs.org/) (v18+)
|
|
25
|
+
- [Docker](https://www.docker.com/) and Docker Compose (Optional for local PostgreSQL deployment)
|
|
26
|
+
- A [Google Gemini API Key](https://aistudio.google.com/)
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
$ npm install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Running the app
|
|
35
|
+
|
|
36
|
+
Before running the application, ensure you have set the `GEMINI_API_KEY` in your environment variables, as the default agent is the `GeminiAgent`.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Start the PostgreSQL Database
|
|
40
|
+
$ docker compose up -d
|
|
41
|
+
|
|
42
|
+
# development
|
|
43
|
+
$ GEMINI_API_KEY="your-api-key" npm run start
|
|
44
|
+
|
|
45
|
+
# watch mode
|
|
46
|
+
$ GEMINI_API_KEY="your-api-key" npm run start:dev
|
|
47
|
+
|
|
48
|
+
# production mode
|
|
49
|
+
$ GEMINI_API_KEY="your-api-key" npm run start:prod
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Once running, you can access the frontend dashboard container URL at `http://localhost:3000`. The API endpoints are accessible via `http://localhost:3000/api/v1/`.
|
|
53
|
+
|
|
54
|
+
## Testing
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# unit tests
|
|
58
|
+
$ npm run test
|
|
59
|
+
|
|
60
|
+
# e2e tests
|
|
61
|
+
$ npm run test:e2e
|
|
62
|
+
|
|
63
|
+
# test coverage
|
|
64
|
+
$ npm run test:cov
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## API usage
|
|
68
|
+
|
|
69
|
+
**Endpoint**: `POST /api/v1/agents/process`
|
|
70
|
+
**Payload**:
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"input": "Write a short poem about automation."
|
|
74
|
+
}
|
|
75
|
+
```
|
package/TODO.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Agent Orchestrator TODO List
|
|
2
|
+
|
|
3
|
+
These are features and concepts to be discussed and implemented later:
|
|
4
|
+
|
|
5
|
+
- [ ] **Database Schema:** Model schema for agents, agent profiles (head, researcher, etc.), tasks, and workflows.
|
|
6
|
+
- [ ] **Authentication & Authorization:** Secure the API and frontend dashboard.
|
|
7
|
+
- [ ] **Executable Creation:** Implement ability to run project as an executable using `npx` or `pnpm`.
|
|
8
|
+
- [ ] **Release Management:** Set up semantic versioning (v0.x, v1.x) and branching strategies. (Standard today for OSS is GitHub Flow or Trunk-Based Development, rather than gitflow which is considered too heavy for most modern continuous delivery workflows).
|
|
9
|
+
- [ ] **CI/CD Pipelines:** GitHub Actions for automated unit testing (Jest), deployment, and PR validations.
|
|
10
|
+
- [ ] **Task & Job Execution:** Structure the database and execution flow for tasks assigned to agents.
|
|
11
|
+
- [ ] **Agent Workflow Engine:** Build a drag-and-drop workflow system with node triggers, inputs, and outputs.
|
|
12
|
+
- [ ] **Extended Capabilities:** Add "read file", "write file", "search web", "send e-mail", and image generation (NanoBanana).
|
|
13
|
+
- [ ] **Full Frontend Application:** Replace static placeholder with the React administrative dashboard.
|
|
14
|
+
- [ ] **Metrics:** Expose system metrics (e.g., Prometheus/Grafana) to monitor application health and performance.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AgentsService } from './agents.service';
|
|
2
|
+
import { AgentRequestDto } from './dto/agent-request.dto';
|
|
3
|
+
import { AgentResponse } from './interfaces/agent.interface';
|
|
4
|
+
export declare class AgentsController {
|
|
5
|
+
private readonly agentsService;
|
|
6
|
+
constructor(agentsService: AgentsService);
|
|
7
|
+
processText(requestDto: AgentRequestDto): Promise<AgentResponse>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AgentsController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const agents_service_1 = require("./agents.service");
|
|
18
|
+
const agent_request_dto_1 = require("./dto/agent-request.dto");
|
|
19
|
+
let AgentsController = class AgentsController {
|
|
20
|
+
constructor(agentsService) {
|
|
21
|
+
this.agentsService = agentsService;
|
|
22
|
+
}
|
|
23
|
+
async processText(requestDto) {
|
|
24
|
+
return this.agentsService.processRequest(requestDto);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.AgentsController = AgentsController;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, common_1.Post)('process'),
|
|
30
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
31
|
+
__param(0, (0, common_1.Body)()),
|
|
32
|
+
__metadata("design:type", Function),
|
|
33
|
+
__metadata("design:paramtypes", [agent_request_dto_1.AgentRequestDto]),
|
|
34
|
+
__metadata("design:returntype", Promise)
|
|
35
|
+
], AgentsController.prototype, "processText", null);
|
|
36
|
+
exports.AgentsController = AgentsController = __decorate([
|
|
37
|
+
(0, common_1.Controller)('agents'),
|
|
38
|
+
__metadata("design:paramtypes", [agents_service_1.AgentsService])
|
|
39
|
+
], AgentsController);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.controller.js","sourceRoot":"","sources":["../../src/agents/agents.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8E;AAC9E,qDAAiD;AACjD,+DAA0D;AAInD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IACE;IAA7B,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAIvD,AAAN,KAAK,CAAC,WAAW,CAAS,UAA2B;QACnD,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC;CACF,CAAA;AARY,4CAAgB;AAKrB;IAFL,IAAA,aAAI,EAAC,SAAS,CAAC;IACf,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACL,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAa,mCAAe;;mDAEpD;2BAPU,gBAAgB;IAD5B,IAAA,mBAAU,EAAC,QAAQ,CAAC;qCAEyB,8BAAa;GAD9C,gBAAgB,CAQ5B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AgentsModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const agents_controller_1 = require("./agents.controller");
|
|
12
|
+
const agents_service_1 = require("./agents.service");
|
|
13
|
+
const gemini_agent_1 = require("./implementations/gemini.agent");
|
|
14
|
+
let AgentsModule = class AgentsModule {
|
|
15
|
+
};
|
|
16
|
+
exports.AgentsModule = AgentsModule;
|
|
17
|
+
exports.AgentsModule = AgentsModule = __decorate([
|
|
18
|
+
(0, common_1.Module)({
|
|
19
|
+
controllers: [agents_controller_1.AgentsController],
|
|
20
|
+
providers: [agents_service_1.AgentsService, gemini_agent_1.GeminiAgent],
|
|
21
|
+
exports: [agents_service_1.AgentsService],
|
|
22
|
+
})
|
|
23
|
+
], AgentsModule);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.module.js","sourceRoot":"","sources":["../../src/agents/agents.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,2DAAuD;AACvD,qDAAiD;AACjD,iEAA6D;AAOtD,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,oCAAY;uBAAZ,YAAY;IALxB,IAAA,eAAM,EAAC;QACN,WAAW,EAAE,CAAC,oCAAgB,CAAC;QAC/B,SAAS,EAAE,CAAC,8BAAa,EAAE,0BAAW,CAAC;QACvC,OAAO,EAAE,CAAC,8BAAa,CAAC;KACzB,CAAC;GACW,YAAY,CAAG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GeminiAgent } from './implementations/gemini.agent';
|
|
2
|
+
import { AgentResponse } from './interfaces/agent.interface';
|
|
3
|
+
import { AgentRequestDto } from './dto/agent-request.dto';
|
|
4
|
+
export declare class AgentsService {
|
|
5
|
+
private readonly geminiAgent;
|
|
6
|
+
private readonly logger;
|
|
7
|
+
private defaultAgent;
|
|
8
|
+
constructor(geminiAgent: GeminiAgent);
|
|
9
|
+
processRequest(requestDto: AgentRequestDto): Promise<AgentResponse>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var AgentsService_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.AgentsService = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const gemini_agent_1 = require("./implementations/gemini.agent");
|
|
16
|
+
let AgentsService = AgentsService_1 = class AgentsService {
|
|
17
|
+
constructor(geminiAgent) {
|
|
18
|
+
this.geminiAgent = geminiAgent;
|
|
19
|
+
this.logger = new common_1.Logger(AgentsService_1.name);
|
|
20
|
+
this.defaultAgent = geminiAgent;
|
|
21
|
+
this.logger.log(`Initialized AgentsService with default agent: ${this.defaultAgent.getName()}`);
|
|
22
|
+
}
|
|
23
|
+
async processRequest(requestDto) {
|
|
24
|
+
this.logger.debug(`Processing input using default agent`);
|
|
25
|
+
// Eventually, logic to select agent based on user request/task could go here.
|
|
26
|
+
return this.defaultAgent.processText(requestDto.input);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.AgentsService = AgentsService;
|
|
30
|
+
exports.AgentsService = AgentsService = AgentsService_1 = __decorate([
|
|
31
|
+
(0, common_1.Injectable)(),
|
|
32
|
+
__metadata("design:paramtypes", [gemini_agent_1.GeminiAgent])
|
|
33
|
+
], AgentsService);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.service.js","sourceRoot":"","sources":["../../src/agents/agents.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,iEAA6D;AAKtD,IAAM,aAAa,qBAAnB,MAAM,aAAa;IAIK;IAHZ,MAAM,GAAG,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IACjD,YAAY,CAAQ;IAE5B,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;QACnD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,iDAAiD,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAClG,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,UAA2B;QAC9C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAE1D,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACzD,CAAC;CACF,CAAA;AAdY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAK+B,0BAAW;GAJ1C,aAAa,CAczB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AgentRequestDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class AgentRequestDto {
|
|
15
|
+
}
|
|
16
|
+
exports.AgentRequestDto = AgentRequestDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsString)(),
|
|
19
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], AgentRequestDto.prototype, "input", void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-request.dto.js","sourceRoot":"","sources":["../../../src/agents/dto/agent-request.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,eAAe;IAG1B,KAAK,CAAS;CACf;AAJD,0CAIC;AADC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;8CACC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var GeminiAgent_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GeminiAgent = void 0;
|
|
14
|
+
const generative_ai_1 = require("@google/generative-ai");
|
|
15
|
+
const common_1 = require("@nestjs/common");
|
|
16
|
+
let GeminiAgent = GeminiAgent_1 = class GeminiAgent {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.logger = new common_1.Logger(GeminiAgent_1.name);
|
|
19
|
+
const apiKey = process.env.GEMINI_API_KEY;
|
|
20
|
+
if (!apiKey) {
|
|
21
|
+
this.logger.error('GEMINI_API_KEY environment variable is not set');
|
|
22
|
+
throw new Error('GEMINI_API_KEY is required to initialize GeminiAgent');
|
|
23
|
+
}
|
|
24
|
+
this.genAI = new generative_ai_1.GoogleGenerativeAI(apiKey);
|
|
25
|
+
}
|
|
26
|
+
getName() {
|
|
27
|
+
return 'GeminiAgent';
|
|
28
|
+
}
|
|
29
|
+
async processText(input) {
|
|
30
|
+
this.logger.debug(`Processing input with GeminiAgent`);
|
|
31
|
+
try {
|
|
32
|
+
const model = this.genAI.getGenerativeModel({
|
|
33
|
+
model: 'gemini-2.5-flash-lite',
|
|
34
|
+
});
|
|
35
|
+
const result = await model.generateContent(input);
|
|
36
|
+
const output = result.response.text();
|
|
37
|
+
return {
|
|
38
|
+
content: output,
|
|
39
|
+
metadata: {
|
|
40
|
+
model: 'gemini-2.5-flash-lite',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (error instanceof Error) {
|
|
46
|
+
this.logger.error(`Error processing text: ${error.message}`, error.stack);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.logger.error(`Error processing text: ${String(error)}`);
|
|
50
|
+
}
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
exports.GeminiAgent = GeminiAgent;
|
|
56
|
+
exports.GeminiAgent = GeminiAgent = GeminiAgent_1 = __decorate([
|
|
57
|
+
(0, common_1.Injectable)(),
|
|
58
|
+
__metadata("design:paramtypes", [])
|
|
59
|
+
], GeminiAgent);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.agent.js","sourceRoot":"","sources":["../../../src/agents/implementations/gemini.agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yDAA2D;AAE3D,2CAAoD;AAG7C,IAAM,WAAW,mBAAjB,MAAM,WAAW;IACL,MAAM,GAAG,IAAI,eAAM,CAAC,aAAW,CAAC,IAAI,CAAC,CAAC;IAC/C,KAAK,CAAqB;IAElC;QACE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;QAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;YACpE,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,kCAAkB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO;QACL,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC;YAChF,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YAClD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YAEtC,OAAO;gBACL,OAAO,EAAE,MAAM;gBACf,QAAQ,EAAE;oBACR,KAAK,EAAE,uBAAuB;iBAC/B;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAC1E,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF,CAAA;AAnCY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;;GACA,WAAW,CAmCvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.interface.js","sourceRoot":"","sources":["../../../src/agents/interfaces/agent.interface.ts"],"names":[],"mappings":""}
|