diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..e19db719 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +__pycache__ +venv +env +.github +docs +scripts +tests \ No newline at end of file diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..62359462 --- /dev/null +++ b/.env.example @@ -0,0 +1,5 @@ +OPENAI_API_KEY='' +GEMINI_API_KEY='' +ANTHROPIC_API_KEY='' +GROQ_API_KEY='' +HF_AUTH_TOKENS='' \ No newline at end of file diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 00000000..67fba720 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,59 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: AIOS application + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Git Clone Action + # You may pin to the exact commit or the version. + # uses: sudosubin/git-clone-action@8a93ce24d47782e30077508cccacf8a05a891bae + uses: sudosubin/git-clone-action@v1.0.1 + with: + # Repository owner and name. Ex: sudosubin/git-clone-action + repository: agiresearch/Cerebrum # optional, default is ${{ github.repository }} + path: Cerebrum + - name: Install cerebrum special edition + run: | + python -m pip install -e Cerebrum/ + - name: Run AIOS kernel in background + run: | + bash runtime/launch_kernel.sh &>logs & + + - name: run the run-agent code + run: | + curl localhost:8000 + export GEMINI_API_KEY=AIzaSyDKcFCc0UjbS_bliq78luOwcSGYJedlNK8 + run-agent --llm_name gemini-1.5-flash --llm_backend google --agent_name_or_path demo_author/demo_agent --task "Tell me what is core idea of AIOS" --aios_kernel_url http://localhost:8000 + # >>logs 2>&1 + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4.4.3 + with: + # Artifact name + name: logs + # A file, directory or wildcard pattern that describes what to upload + path: logs + + diff --git a/.github/workflows/test_ollama.yml b/.github/workflows/test_ollama.yml new file mode 100644 index 00000000..45f68add --- /dev/null +++ b/.github/workflows/test_ollama.yml @@ -0,0 +1,135 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: AIOS Application + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + ref: main # Specify main branch + + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - name: Git Clone Action + # You may pin to the exact commit or the version. + # uses: sudosubin/git-clone-action@8a93ce24d47782e30077508cccacf8a05a891bae + uses: sudosubin/git-clone-action@v1.0.1 + with: + # Repository owner and name. Ex: sudosubin/git-clone-action + repository: agiresearch/Cerebrum + path: Cerebrum + + - name: Install cerebrum special edition + run: | + python -m pip install -e Cerebrum/ + + - name: Download and install Ollama + run: | + curl -fsSL https://ollama.com/install.sh | sh + + - name: Pull Ollama models + run: | + ollama pull llama3:8b + + - name: Run Ollama serve + run: | + ollama serve 2>&1 | tee ollama-llm.log + + - name: Run AIOS kernel in background + run: | + bash runtime/launch_kernel.sh &>logs & + KERNEL_PID=$! + + # Set maximum wait time (20 seconds) + max_wait=20 + start_time=$SECONDS + + # Dynamically check if the process is running until it succeeds or times out + while true; do + if ! ps -p $KERNEL_PID > /dev/null; then + echo "Kernel process died. Checking logs:" + cat logs + exit 1 + fi + + if nc -z localhost 8000; then + if curl -s http://localhost:8000/health > /dev/null; then + echo "Kernel successfully started and healthy" + break + fi + fi + + # Check if timed out + elapsed=$((SECONDS - start_time)) + if [ $elapsed -ge $max_wait ]; then + echo "Timeout after ${max_wait} seconds. Kernel failed to start properly." + cat logs + exit 1 + fi + + echo "Waiting for kernel to start... (${elapsed}s elapsed)" + sleep 1 + done + + - name: Run the run-agent code + run: | + # Run agent and capture exit code + run-agent \ + --llm_name llama3:8b \ + --llm_backend ollama \ + --agent_name_or_path demo_author/demo_agent \ + --task "Tell me what is core idea of AIOS" \ + --aios_kernel_url http://localhost:8000 \ + 2>&1 | tee agent.log + + # Check for specific error patterns in the log + if grep -q "Failed to initialize client: 500 Server Error" agent.log; then + echo "Error: LLM initialization failed. Please check your API key configuration." + exit 1 + fi + + # Check if the agent actually completed successfully + if ! grep -q "Final Result:" agent.log; then + echo "Error: Agent did not complete successfully" + exit 1 + fi + + - name: Upload a Build Artifact + if: always() # Upload logs even if job fails + uses: actions/upload-artifact@v4.4.3 + with: + name: logs + path: | + logs + agent.log + + - name: Collect debug information + if: failure() + run: | + echo "=== Kernel Logs ===" + cat logs + echo "=== Environment Variables ===" + env | grep -i api_key || true + echo "=== Process Status ===" + ps aux | grep kernel diff --git a/.gitignore b/.gitignore index a641d4e2..9e1fd112 100644 --- a/.gitignore +++ b/.gitignore @@ -203,4 +203,7 @@ next-env.d.ts metagpt workspace -cache \ No newline at end of file +cache + +# Ignore configuration files +aios/config/config.yaml \ No newline at end of file diff --git a/Cerebrum b/Cerebrum new file mode 160000 index 00000000..86bd6fa1 --- /dev/null +++ b/Cerebrum @@ -0,0 +1 @@ +Subproject commit 86bd6fa1cc4a85b767ea0e9d7396b955f20fbd47 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..c7161568 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.11.8-slim-bullseye + +ENV PYTHONUNBUFFERED True + +ENV APP_HOME /app +WORKDIR $APP_HOME +COPY . ./ + +ENV PORT 8000 + +RUN pip install --no-cache-dir -r requirements.txt + +# As an example here we're running the web service with one worker on uvicorn. +CMD exec uvicorn server:app --host 0.0.0.0 --port ${PORT} --workers 1 \ No newline at end of file diff --git a/README.md b/README.md index 5436734d..86fe570c 100644 --- a/README.md +++ b/README.md @@ -17,13 +17,13 @@ AIOS is the AI Agent Operating System, which embeds large language model (LLM) i

-The AIOS system is comprised of two key components: the AIOS kernel and the AIOS-Agent SDK. +The AIOS system is comprised of two key components: the AIOS kernel and the AIOS SDK. The AIOS kernel acts as an abstraction layer over the operating system kernel, managing various resources that agents require, such as LLM, memory, storage and tool. -The AIOS-Agent SDK is designed for agent users and developers, enabling them to build and run agent applications by interacting with the AIOS kernel. -AIOS kernel is the current repository and AIOS-Agent SDK can be found at [here](htgithub.com/agiresearch/Cerebrum) +The AIOS SDK is designed for agent users and developers, enabling them to build and run agent applications by interacting with the AIOS kernel. +AIOS kernel is the current repository and AIOS SDK can be found at [here](https://github.com/agiresearch/Cerebrum) ### Modules and Connections -Below shows how agents utilize AIOS-Agent SDK to interact with AIOS kernel and how AIOS kernel receives agent queries and leverage the chain of syscalls that are scheduled and dispatched to run in different modules. +Below shows how agents utilize AIOS SDK to interact with AIOS kernel and how AIOS kernel receives agent queries and leverage the chain of syscalls that are scheduled and dispatched to run in different modules.

@@ -41,6 +41,74 @@ Below shows how agents utilize AIOS-Agent SDK to interact with AIOS kernel and h - **[2024-03-25]** ✈️ Our paper [AIOS: LLM Agent Operating System](https://arxiv.org/abs/2403.16971) is released! - **[2023-12-06]** 📋 After several months of working, our perspective paper [LLM as OS, Agents as Apps: Envisioning AIOS, Agents and the AIOS-Agent Ecosystem](https://arxiv.org/abs/2312.03815) is officially released. +## Different deployment modes of AIOS +Here are some key notations that are required to know before introducing the different modes of AIOS. +- **AHM (Agent Hub Machine)**: Central server that hosts the agent marketplace/repository where users can publish, download, and share agents. Acts as the distribution center for all agent-related resources. +- **AUM (Agent UI Machine)**: Client machine that provides user interface for interacting with agents. Can be any device from mobile phones to desktops that supports agent visualization and control. +- **ADM (Agent Development Machine)**: Development environment where agent developers write, debug and test their agents. Requires proper development tools and libraries. +- **ARM (Agent Running Machine)**: Execution environment where agents actually run and perform tasks. Needs adequate computational resources for agent operations. + +The following parts introduce different modes of deploying AIOS. **Currently, AIOS already supports Mode 1 and Mode 2, other modes with new features are still ongoing.** + +### Mode 1 (Local Kernel Mode) + +

+ +

+ +- Features: + - For agent users: They can download agents from agent hub from Machine B and run agents on Machine A. + - For agent developers: They can develop and test agents in Machine A and can upload agents to agent hub on Machine B. + +### Mode 2 (Remote Kernel Mode) + +

+ +

+ +- Features: + - Remote use of agents: Agent users / developers can use agents on Machine B, which is different from the development and running machine (Machine A). + - Benefit users who would like to use agents on resource-restricted machine (e.g., mobile device or edge device) + +### Mode 2.5 (Remote Kernel Dev Mode) + +

+ +

+ +- Features: + - Remote development of agents: Agent developers can develop their agents on Machine B while running and testing their agents in Machine A. Benefit developers who would like to develop agents on resource-restricted machine (e.g., mobile device or edge device) +- Critical technique: + - Packaging and agent transmission on different machines for distributed agent development and testing + +### Mode 3 (Personal Remote Kernel Mode) + +

+ +

+ +- Ongoing Features: + - Each user/developer can have their personal AIOS with long-term persistent data as long as they have registered account in the AIOS ecosystem + - Their personal data can be synced to different machines with the same account + +- Critical techniques: + - User account registration and verification mechanism + - Persistent personal data storage for each user's AIOS + - Synchronization for different AIOS instances on different devices within the same account + - Data privacy mechanism + +### Mode 4 (Personal Remote Virtual Kernel Mode) + +

+ +

+ +- Ongoing Features: + - Different user/developer’s personal AIOS kernels can co-exist in the same physical machine through virtualization +- Critical techniques: + - Virtualization of different AIOS kernel instances in the same machine + - Scheduling and resource allocation mechanism for different virtual machines located in the same machine + ## ✈️ Getting Started Please see our ongoing [documentation](https://docs.aios.foundation/) for more information. @@ -76,11 +144,13 @@ To obtain these API keys: Git clone AIOS kernel ```bash git clone https://github.com/agiresearch/AIOS.git -cd AIOS && git checkout v0.2.0.beta +cd AIOS +git checkout v.20 # don't do this unless you're testing ``` Create venv environment (recommended) ```bash -python3.x -m venv venv # Only support for Python 3.10 and 3.11 +python3.x --version # Check if it is 3.10 or 3.11 +python3.x -m venv venv source venv/bin/activate ``` or create conda environment @@ -109,15 +179,23 @@ pip install -r requirements.txt #### Configurations ##### Use with OpenAI API -You need to get your OpenAI API key from https://platform.openai.com/api-keys. +You need to get your OpenAI API key from https://platform.openai.com/api-keys. Note that API keys **cost money**. Then set up your OpenAI API key as an environment variable ```bash export OPENAI_API_KEY= ``` +##### Use with Anthropic API +You need to get your Anthropic API key from https://console.anthropic.com/settings/keys. +Then set up your Anthropic API key as an environment variable + +```bash +export ANTHROPIC_API_KEY= +``` + ##### Use with Gemini API -You need to get your Gemini API key from https://ai.google.dev/gemini-api +You need to get your Gemini API key from https://ai.google.dev/gemini-api. Gemini is a free cloud LLM provider. ```bash export GEMINI_API_KEY= @@ -178,13 +256,18 @@ or you can pass the `CUDA_VISIBLE_DEVICES` as the prefix #### Launch AIOS After you setup your keys or environment parameters, then you can follow the instructions below to start. -First, you need to start the AIOS kernel by running the following commands - -``` +Start AIOS by running: +```bash bash runtime/launch_kernel.sh ``` -Then you can start the client provided by the AIOS-Agent SDK either in the terminal or in the WebUI. The instructions can be found at [here](https://github.com/agiresearch/Cerebrum) +**Note:** If you need to specify `python3.10`, `python3.11`, `python3`, etc. then run the command in the script manually: + +```bash +python3.x -m uvicorn runtime.kernel:app --host 0.0.0.0 +``` + +Then you can start the client provided by the AIOS SDK either in the terminal or in the WebUI. The instructions can be found at [here](https://github.com/agiresearch/Cerebrum) ### Supported Agent Frameworks diff --git a/agenthub/.eslintrc.json b/agenthub/.eslintrc.json deleted file mode 100644 index a91bc255..00000000 --- a/agenthub/.eslintrc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": ["next/core-web-vitals", "next/typescript"], - "rules": { - "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/no-explicit-any": "off" - } -} diff --git a/agenthub/.gitignore b/agenthub/.gitignore deleted file mode 100644 index fd3dbb57..00000000 --- a/agenthub/.gitignore +++ /dev/null @@ -1,36 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js -.yarn/install-state.gz - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# local env files -.env*.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts diff --git a/agenthub/README.md b/agenthub/README.md deleted file mode 100644 index 0ad73330..00000000 --- a/agenthub/README.md +++ /dev/null @@ -1,36 +0,0 @@ -This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). - -## Getting Started - -First, run the development server: - -```bash -npm run dev -# or -yarn dev -# or -pnpm dev -# or -bun dev -``` - -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. - -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. - -This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. - -## Learn More - -To learn more about Next.js, take a look at the following resources: - -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. - -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! - -## Deploy on Vercel - -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. diff --git a/agenthub/app/LandingPageFooter.tsx b/agenthub/app/LandingPageFooter.tsx deleted file mode 100644 index bbb9a3bb..00000000 --- a/agenthub/app/LandingPageFooter.tsx +++ /dev/null @@ -1,155 +0,0 @@ -export default function LandingPageFooter() { - return ( - - ) - } \ No newline at end of file diff --git a/agenthub/app/LandingPageMain.tsx b/agenthub/app/LandingPageMain.tsx deleted file mode 100644 index 826636c2..00000000 --- a/agenthub/app/LandingPageMain.tsx +++ /dev/null @@ -1,1324 +0,0 @@ -export default function LandingPageMain() { - return ( -
-
-
-
-
-
- NEW -
-

- Deploy - - LLama 2 - - ( - - Chat 7B - - and - - 13B - - ) in a few clicks on - - - - - - Inference Endpoints - -

-
-
- -

- The AI community building the future. -

-

- Build, train and deploy state of the art models powered by the reference open source in machine learning. -

- -
- -
-
-
-
-
-
-
- -
-

Hub

-

Home of Machine Learning

-
-
-
-

- Create, discover and collaborate on ML better. -
- Join the community to start your ML journey. -

-
- - Sign Up - -
-
-
- Hugging Face Hub dashboard - Hugging Face Hub dashboard -
-
-
-
- -
-
-
-
-
- -
-
-
-

Open Source

-

Transformers

-
-
-
-

- Transformers is our natural language processing library and our hub is now open to all ML models, with - support from libraries like - - Flair - - , - - Asteroid - - , - - ESPnet - - , - - Pyannote - - , and more to come. -

-
- - Read documentation - -
-
-
-
-
-
-
-
-
-
-
- huggingface@transformers:~ -
-
-
-                      
-                        {/*  */}
-                        from
-                        transformers
-                        import
-                        AutoTokenizer,
-                        AutoModelForMaskedLM
-                        tokenizer= AutoTokenizer.
-                        from_pretrained(
-                        {`"bert-base-uncased"`})
-                        model=AutoModelForMaskedLM.
-                        from_pretrained(
-                        {`"bert-base-uncased"`}){/*  */}
-                      
-                    
-
-
-
-
-
-
-
-
-
-
- -
-
-
-

On demand

-

Inference API

-
-
-
-

- Serve your models directly from Hugging Face infrastructure and run large scale NLP models in - milliseconds with just a few lines of code. -

-
- - Learn more - -
-
-
- -
-
-
-
-
- -
- - Fill-Mask -
-
-
-
-
-
Examples
- -
-
-
-
-
-
- Mask token: [MASK] -
- - -
-
-
- Computation time on Intel Xeon 3rd Gen Scalable cpu: cached -
-
-
-
-
-
- happiness -
- 0.036 -
-
-
-
- survival -
- 0.031 -
-
-
-
- salvation -
- 0.017 -
-
-
-
- freedom -
- 0.017 -
-
-
-
- unity -
- 0.015 -
-
-
- - -
-
-
-
-
-
- -
-
-
-
-
- -
- - Token Classification -
-
-
-
-
-
Examples
- -
-
-
-
-
- - -
-
-
- Computation time on Intel Xeon 3rd Gen Scalable cpu: cached -
-
-
- My name is - - Clara - - PER - - - and I live in - - Berkeley - - LOC - - - , - - California - - LOC - - - . I work at this cool company called - - Hugging Face - - ORG - - - . -
-
- - -
-
-
-
-
-
-
-
-
-
- -
Science
-

Our Research contributions

-

- We’re on a journey to advance and democratize NLP for everyone. Along the way, we contribute to the - development of technology for the better. -

-
-
-
-

🌸

-
-
-
-
-

T0

-

- Multitask Prompted Training Enables Zero-Shot Task Generalization -

-
-
-
-

- Open source state-of-the-art zero-shot language model out of - - BigScience - - . -

-
- - Read more - -
-
-
-
-

🐎

-
-
-
-
-

DistilBERT

-

- DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter -

-
-
-
-

- A smaller, faster, lighter, cheaper version of BERT obtained via model distillation. -

-
- - Read more - -
-
-
-
-

📚

-
-
-
-
-

HMTL

-

Hierarchical Multi-Task Learning

-
-
-
-

- Learning embeddings from semantic tasks for multi-task learning. We have open-sourced code and a demo. -

-
- - Read more - -
-
-
-
-

🐸

-
-
-
-
-

Dynamical Language Models

-

- Meta-learning for language modeling -

-
-
-
-

- A meta learner is trained via gradient descent to continuously and dynamically update language model - weights. -

-
- - Read more - -
-
-
-
-

🤖

-
-
-
-
-

State of the art

-

Neuralcoref

-
-
-
-

- Our open source coreference resolution library for coreference. You can train it on your own dataset and - language. -

-
- - Read more - -
-
-
-
-

🦄

-
-
-
-
-

Auto-complete your thoughts

-

Write with Transformers

-
-
-
-

- This web app is the official demo of the Transformers repository 's text generation capabilities. -

-
- - Start writing - -
-
-
-
-
- ) - } \ No newline at end of file diff --git a/agenthub/app/_page.tsx b/agenthub/app/_page.tsx deleted file mode 100644 index c96253d2..00000000 --- a/agenthub/app/_page.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import LandingPageFooter from './LandingPageFooter' -import LandingPageMain from './LandingPageMain' - -export default function Page() { - return ( -
- - -
- ) -} \ No newline at end of file diff --git a/agenthub/app/api/download/route.ts b/agenthub/app/api/download/route.ts deleted file mode 100644 index d998a925..00000000 --- a/agenthub/app/api/download/route.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { NextResponse } from 'next/server'; -import prisma from '../../../lib/prisma' - -export async function GET(request: Request): Promise { - const { searchParams } = new URL(request.url); - const name = searchParams.get('name'); - const version = searchParams.get('version'); - const author = searchParams.get('author'); - - if (name && version && author) { - const result = await prisma.agent.findFirst({ - where: { - name, - version, - author - }, - include: { - files: true - } - }); - - if (result != null) { - return NextResponse.json({ ...result }); - } - } else if (name && author) { - const result = await prisma.agent.findFirst({ - where: { - name, - author - }, - orderBy: { - version: 'desc' - }, - include: { - files: true - } - }); - - if (result != null) { - return NextResponse.json({ ...result }); - } - - } - - - - - - return NextResponse.json({ status: 'fail' }); -} \ No newline at end of file diff --git a/agenthub/app/api/get_agent_by_name/route.ts b/agenthub/app/api/get_agent_by_name/route.ts deleted file mode 100644 index 943a1248..00000000 --- a/agenthub/app/api/get_agent_by_name/route.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { NextResponse } from 'next/server'; -import prisma from '../../../lib/prisma' - -export async function GET(request: Request): Promise { - const { searchParams } = new URL(request.url); - const name = searchParams.get('name'); - - if (name) { - const result = await prisma.agent.findFirst({ - where: { - name, - }, - include: { - files: true - } - }); - - if (result != null) { - return NextResponse.json({ ...result }); - } - } - - - return NextResponse.json({ status: 'fail' }); -} \ No newline at end of file diff --git a/agenthub/app/api/get_agent_by_name_and_version/route.ts b/agenthub/app/api/get_agent_by_name_and_version/route.ts deleted file mode 100644 index 0a25a9e5..00000000 --- a/agenthub/app/api/get_agent_by_name_and_version/route.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { NextResponse } from 'next/server'; -import prisma from '../../../lib/prisma' - -export async function GET(request: Request): Promise { - const { searchParams } = new URL(request.url); - const name = searchParams.get('name'); - const version = searchParams.get('version'); - - console.log(name, version) - - if (name && version) { - const result = await prisma.agent.findFirst({ - where: { - name, - version - }, - include: { - files: true - } - }); - - if (result != null) { - return NextResponse.json({ ...result }); - } - } - - - return NextResponse.json({ status: 'fail' }); -} \ No newline at end of file diff --git a/agenthub/app/api/get_all_agents/light/route.ts b/agenthub/app/api/get_all_agents/light/route.ts deleted file mode 100644 index 5fe7085e..00000000 --- a/agenthub/app/api/get_all_agents/light/route.ts +++ /dev/null @@ -1,22 +0,0 @@ -export const dynamic = 'force-dynamic' - -import { NextResponse } from 'next/server'; -import prisma from '../../../../lib/prisma' - -export async function GET(request: Request): Promise { - //linter - // console.log(request) - - const result = await prisma.agent.findMany({ - select: { - id: true, - author: true, - name: true, - version: true, - description: true, - createdAt: true - } - }); - - return NextResponse.json({...result}); - } \ No newline at end of file diff --git a/agenthub/app/api/get_all_agents/route.ts b/agenthub/app/api/get_all_agents/route.ts deleted file mode 100644 index 0e68729d..00000000 --- a/agenthub/app/api/get_all_agents/route.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const dynamic = 'force-dynamic' - -import { NextResponse } from 'next/server'; -import prisma from '../../../lib/prisma' - -export async function GET(request: Request): Promise { - //linter - // console.log(request) - const result = await prisma.agent.findMany(); - - return NextResponse.json({...result}); - } \ No newline at end of file diff --git a/agenthub/app/api/proxy/route.ts b/agenthub/app/api/proxy/route.ts deleted file mode 100644 index c18f1a84..00000000 --- a/agenthub/app/api/proxy/route.ts +++ /dev/null @@ -1,76 +0,0 @@ -// app/api/proxy/route.ts - -import { NextRequest, NextResponse } from 'next/server' -import axios from 'axios' -import { retryOperation } from '@/lib/utils/retry' - -export async function POST(request: Request): Promise { - try { - const { type, payload, url } = await request.json() - - if (!type || !url) { - return NextResponse.json({ message: 'Missing required parameters' }, { status: 400 }) - } - - let response - - switch (type.toUpperCase()) { - case 'GET': - response = await retryOperation(async () => { - return await axios.get(url); - }); - break - case 'POST': - response = await retryOperation(async () => { - return await axios.post(url, payload); - }); - break - case 'PUT': - response = await axios.put(url, payload) - break - case 'DELETE': - response = await axios.delete(url) - break - default: - return NextResponse.json({ message: 'Unsupported request type' }, { status: 400 }) - } - - // Return the proxied response as-is - return new NextResponse(JSON.stringify(response.data), { - status: response.status, - headers: { - 'Content-Type': 'application/json', - }, - }) - } catch (error) { - if (axios.isAxiosError(error)) { - // Forward the error response if it's an Axios error - if (error.response) { - return new NextResponse(JSON.stringify(error.response.data), { - status: error.response.status, - headers: { - 'Content-Type': 'application/json', - }, - }) - } else { - return NextResponse.json({ message: error.message }, { status: 500 }) - } - } else { - // For other types of errors - return NextResponse.json({ message: 'An unexpected error occurred' }, { status: 500 }) - } - } -} - -// Optionally, you can add this to disallow other HTTP methods -export async function GET() { - return NextResponse.json({ message: 'Method Not Allowed' }, { status: 405 }) -} - -export async function PUT() { - return NextResponse.json({ message: 'Method Not Allowed' }, { status: 405 }) -} - -export async function DELETE() { - return NextResponse.json({ message: 'Method Not Allowed' }, { status: 405 }) -} \ No newline at end of file diff --git a/agenthub/app/api/upload/route.ts b/agenthub/app/api/upload/route.ts deleted file mode 100644 index bc20ed41..00000000 --- a/agenthub/app/api/upload/route.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { NextResponse } from 'next/server'; -import prisma from '../../../lib/prisma' - -export async function POST(request: Request): Promise { - if (request.body) { - const body = await request.json(); - - // Destructure the body to separate agent data from files - const { author, name, version, license, files, ...otherData } = body; - - try { - const result = await prisma.agent.create({ - data: { - author, - name, - version, - license, - ...otherData, - files: { - //@ts-ignore - create: files.map((file: any) => ({ - path: file.path, - content: file.content - })) - } - }, - include: { - files: true - } - }); - - return NextResponse.json(result); - } catch (error) { - console.error('Error creating agent:', error); - return NextResponse.json({ status: 'error', message: 'Failed to create agent' }, { status: 500 }); - } - } else { - return NextResponse.json({ status: 'fail', message: 'No body provided' }, { status: 400 }); - } -} \ No newline at end of file diff --git a/agenthub/app/cerebrum/download/route.ts b/agenthub/app/cerebrum/download/route.ts deleted file mode 100644 index c2bc7294..00000000 --- a/agenthub/app/cerebrum/download/route.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { NextResponse } from 'next/server'; -import prisma from '../../../lib/prisma' - -export async function GET(request: Request): Promise { - const { searchParams } = new URL(request.url); - const name = searchParams.get('name'); - const version = searchParams.get('version'); - const author = searchParams.get('author'); - - if (name && version && author) { - const result = await prisma.cerebrumAgent.findFirst({ - where: { - name, - version, - author - }, - include: { - files: true - } - }); - - if (result != null) { - return NextResponse.json({ ...result }); - } - } else if (name && author) { - const result = await prisma.cerebrumAgent.findFirst({ - where: { - name, - author - }, - orderBy: { - version: 'desc' - }, - include: { - files: true - } - }); - - if (result != null) { - return NextResponse.json({ ...result }); - } - - } - - return NextResponse.json({ status: 'fail' }); -} \ No newline at end of file diff --git a/agenthub/app/cerebrum/get_all_agents/light/route.ts b/agenthub/app/cerebrum/get_all_agents/light/route.ts deleted file mode 100644 index 644fc94d..00000000 --- a/agenthub/app/cerebrum/get_all_agents/light/route.ts +++ /dev/null @@ -1,19 +0,0 @@ -export const dynamic = 'force-dynamic' - -import { NextResponse } from 'next/server'; -import prisma from '../../../../lib/prisma' - -export async function GET(request: Request): Promise { - const result = await prisma.cerebrumAgent.findMany({ - select: { - id: true, - author: true, - name: true, - version: true, - description: true, - createdAt: true - } - }); - - return NextResponse.json({...result}); - } \ No newline at end of file diff --git a/agenthub/app/cerebrum/get_all_agents/route.ts b/agenthub/app/cerebrum/get_all_agents/route.ts deleted file mode 100644 index c978b543..00000000 --- a/agenthub/app/cerebrum/get_all_agents/route.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const dynamic = 'force-dynamic' - -import { NextResponse } from 'next/server'; -import prisma from '../../../lib/prisma' - -export async function GET(request: Request): Promise { - const result = await prisma.cerebrumAgent.findMany(); - - return NextResponse.json({...result}); - } \ No newline at end of file diff --git a/agenthub/app/cerebrum/tools/download/route.ts b/agenthub/app/cerebrum/tools/download/route.ts deleted file mode 100644 index f07a9b25..00000000 --- a/agenthub/app/cerebrum/tools/download/route.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { NextResponse } from 'next/server'; -import prisma from '../../../../lib/prisma' - -export async function GET(request: Request): Promise { - const { searchParams } = new URL(request.url); - const name = searchParams.get('name'); - const version = searchParams.get('version'); - const author = searchParams.get('author'); - - if (name && version && author) { - const result = await prisma.cerebrumTool.findFirst({ - where: { - name, - version, - author - }, - include: { - files: true - } - }); - - if (result != null) { - return NextResponse.json({ ...result }); - } - } else if (name && author) { - const result = await prisma.cerebrumTool.findFirst({ - where: { - name, - author - }, - orderBy: { - version: 'desc' - }, - include: { - files: true - } - }); - - if (result != null) { - return NextResponse.json({ ...result }); - } - - } - - return NextResponse.json({ status: 'fail' }); -} \ No newline at end of file diff --git a/agenthub/app/cerebrum/tools/list/route.ts b/agenthub/app/cerebrum/tools/list/route.ts deleted file mode 100644 index 2c52e261..00000000 --- a/agenthub/app/cerebrum/tools/list/route.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const dynamic = 'force-dynamic' - -import { NextResponse } from 'next/server'; -import prisma from '../../../../lib/prisma' - -export async function GET(request: Request): Promise { - const result = await prisma.cerebrumTool.findMany(); - - return NextResponse.json({...result}); - } \ No newline at end of file diff --git a/agenthub/app/cerebrum/tools/upload/route.ts b/agenthub/app/cerebrum/tools/upload/route.ts deleted file mode 100644 index 09536208..00000000 --- a/agenthub/app/cerebrum/tools/upload/route.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { NextResponse } from 'next/server'; -import prisma from '../../../../lib/prisma' - -export async function POST(request: Request): Promise { - if (request.body) { - const body = await request.json(); - - // Destructure the body to separate agent data from files - const { author, name, version, license, files, ...otherData } = body; - console.log(body) - - try { - const result = await prisma.cerebrumTool.create({ - data: { - author, - name, - version, - license, - ...otherData, - files: { - //@ts-ignore - create: files.map((file: any) => ({ - path: file.path, - content: file.content - })) - } - }, - include: { - files: true - } - }); - - return NextResponse.json(result); - } catch (error) { - console.error('Error creating agent:', error); - return NextResponse.json({ status: 'error', message: 'Failed to create tool' }, { status: 500 }); - } - } else { - return NextResponse.json({ status: 'fail', message: 'No body provided' }, { status: 400 }); - } -} \ No newline at end of file diff --git a/agenthub/app/cerebrum/upload/route.ts b/agenthub/app/cerebrum/upload/route.ts deleted file mode 100644 index 5f56c63f..00000000 --- a/agenthub/app/cerebrum/upload/route.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { NextResponse } from 'next/server'; -import prisma from '../../../lib/prisma' - -export async function POST(request: Request): Promise { - if (request.body) { - const body = await request.json(); - - // Destructure the body to separate agent data from files - const { author, name, version, license, files, ...otherData } = body; - console.log(body) - - try { - const result = await prisma.cerebrumAgent.create({ - data: { - author, - name, - version, - license, - ...otherData, - files: { - //@ts-ignore - create: files.map((file: any) => ({ - path: file.path, - content: file.content - })) - } - }, - include: { - files: true - } - }); - - return NextResponse.json(result); - } catch (error) { - console.error('Error creating agent:', error); - return NextResponse.json({ status: 'error', message: 'Failed to create agent' }, { status: 500 }); - } - } else { - return NextResponse.json({ status: 'fail', message: 'No body provided' }, { status: 400 }); - } -} \ No newline at end of file diff --git a/agenthub/app/fonts/GeistMonoVF.woff b/agenthub/app/fonts/GeistMonoVF.woff deleted file mode 100644 index f2ae185c..00000000 Binary files a/agenthub/app/fonts/GeistMonoVF.woff and /dev/null differ diff --git a/agenthub/app/fonts/GeistVF.woff b/agenthub/app/fonts/GeistVF.woff deleted file mode 100644 index 1b62daac..00000000 Binary files a/agenthub/app/fonts/GeistVF.woff and /dev/null differ diff --git a/agenthub/app/globals.css b/agenthub/app/globals.css deleted file mode 100644 index 0659979f..00000000 --- a/agenthub/app/globals.css +++ /dev/null @@ -1,178 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -@layer base { - /* Headings */ - .message-box h1 { - @apply !text-4xl !font-bold mb-4; - } - .message-box h2 { - @apply !text-3xl !font-bold mb-3; - } - .message-box h3 { - @apply !text-2xl !font-bold mb-2; - } - .message-box h4 { - @apply !text-xl !font-bold mb-2; - } - - /* Lists */ - .message-box ul, .message-box ol { - @apply !mb-4 !pl-8; - } - .message-box ul { - @apply !list-disc; - } - .message-box ol { - @apply !list-decimal; - } - .message-box li { - @apply !mb-1; - } - - /* Strong tag */ - .message-box strong { - @apply !font-bold; - } -} - -:root { - --background: #ffffff; - --foreground: #171717; -} - -@media (prefers-color-scheme: dark) { - :root { - --background: #0a0a0a; - --foreground: #ededed; - } -} - -body { - color: var(--foreground); - background: var(--background); - font-family: Arial, Helvetica, sans-serif; - background-color:rgb(18,18,18); -} - -/* body{--tw-bg-opacity:1;); */ - -@layer utilities { - .text-balance { - text-wrap: balance; - } -} - -.editor { - border: 1px solid #737373; /* border-[1px] and border-neutral-500 */ - border-radius: 0.75rem; /* rounded-xl */ - background-color: inherit; /* bg-inherit */ - color: #e5e5e5; /* text-neutral-200 */ - min-height: 3rem; /* h-12 (assuming 1rem = 16px) */ - max-height: 7rem; - overflow-y: auto; - padding: 12px; - outline: none; - display: flex; - max-width: 100%; -} - -/* .editor[placeholder]:empty:before { - content: attr(placeholder); - color: #a3a3a3; - cursor: text; -} */ - - -.paragraph { - width: 100%; - height: 100%; -} - -p.is-editor-empty:first-child::before { - color: rgba(197, 173, 173, 0.524); - content: attr(data-placeholder); - float: left; - height: 0; - pointer-events: none; -} - -.mentionNode { - background-color: rgba(88, 101, 242, 0.3); /* Discord blue with opacity */ - color: #dee0fc; /* Light blue-ish color for text */ - border-radius: 16px; - padding: 4px 8px; - font-weight: 500; - cursor: pointer; - transition: background-color 0.1s ease, color 0.1s ease; -} - -.mentionsContainer { - background-color: #2f3136; - border-radius: 16px; - box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2); - max-height: 60vh; - overflow-y: auto; - width: 40vh; - padding: 1rem; -} - -.mentionsItem { - padding: 8px 12px; - color: white; - font-size: 14px; - display: flex; - align-items: center; - cursor: pointer; - border-radius: 12px; -} - -.mentionsItem:hover { - background-color: #393c43; -} - -@keyframes marquee { - 0% { - transform: translateX(0); - } - to { - transform: translateX(-100%); - } -} - -.text-foreground { - /* font-size: 72px; */ - color: white; -} - -.text-brand { - /* font-size: 72px; */ - color: rgb(30, 145, 221); -} - -.bg-muted { - background-color: rgb(36,36,36); -} - -.bg-getstarted { - background-color: rgb(64, 150, 219); -} - -.border-strong { - border-color: rgb(54,54,54); -} - -.border-stronger { - border-color: rgb(69, 69, 69); -} - -.border-strong:hover { - border-color: rgb(69, 69, 69); -} - -.from-border { - border-color: rgb(46, 46, 46); - border-width: 1px; -} - diff --git a/agenthub/app/icon.svg b/agenthub/app/icon.svg deleted file mode 100644 index 7e9f6f13..00000000 --- a/agenthub/app/icon.svg +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - diff --git a/agenthub/app/layout.tsx b/agenthub/app/layout.tsx deleted file mode 100644 index 7e8aa792..00000000 --- a/agenthub/app/layout.tsx +++ /dev/null @@ -1,98 +0,0 @@ -// import type { Metadata } from "next"; -// import localFont from "next/font/local"; -// import "./globals.css"; - -// const geistSans = localFont({ -// src: "./fonts/GeistVF.woff", -// variable: "--font-geist-sans", -// weight: "100 900", -// }); -// const geistMono = localFont({ -// src: "./fonts/GeistMonoVF.woff", -// variable: "--font-geist-mono", -// weight: "100 900", -// }); - -// export const metadata: Metadata = { -// title: "Create Next App", -// description: "Generated by create next app", -// }; - -// export default function RootLayout({ -// children, -// }: Readonly<{ -// children: React.ReactNode; -// }>) { -// return ( -// -// -// {children} -// -// -// ); -// } - - -import { Metadata } from 'next' -import { Providers } from './providers' - - -import '@/styles/global-stylesheet.css' -import '@/styles/google-font-Source-Sans-Pro.css' -import '@/styles/google-font-IBM-Plex-Mono.css' -import "./globals.css"; -import "./ts.css" -import '@mantine/core/styles.css'; - -import { ColorSchemeScript, MantineProvider } from '@mantine/core'; - -export const metadata: Metadata = { - title: 'AIOS – The future of AI Agents', - openGraph: { - title: 'AIOS – The future of AI Agents', - type: 'website', - url: 'aiosfoundation', - images: 'https://my.aios.foundation/Agent.png', - }, - description: - 'We’re on a journey to advance and democratize artificial intelligence through open source and open science.', - twitter: { - card: 'summary_large_image', - site: '@aiosfoundation', - }, - appLinks: {}, - // fb: { app_id: '1321688464574422', }, -} - -export default function RootLayout({ children }: { children: React.ReactNode }) { - return ( - - {/* - - - - */} - - - - - - -
-
- {/* */} - {/*
*/} - {children} -
-
-
-
- - - ) -} \ No newline at end of file diff --git a/agenthub/app/page.tsx b/agenthub/app/page.tsx deleted file mode 100644 index 31a4fd31..00000000 --- a/agenthub/app/page.tsx +++ /dev/null @@ -1,32 +0,0 @@ -'use client' - -import dynamic from 'next/dynamic' -// import content from '~/data/home/content' -import Layout from '@/components/homepage/DefaultLayout' -import Hero from '@/components/homepage/Hero' -import Logos from '@/components/homepage/logos' - -const Products = dynamic(() => import('@/components/homepage/Products')) -// const HeroFrameworks = dynamic(() => import('~/components/Hero/HeroFrameworks')) -// const CustomerStories = dynamic(() => import('components/CustomerStories')) -// const BuiltWithSupabase = dynamic(() => import('components/BuiltWithSupabase')) -// const DashboardFeatures = dynamic(() => import('~/components/DashboardFeatures')) -const TwitterSocialSection = dynamic(() => import('@/components/homepage/TwitterSocialSection')) -// const CTABanner = dynamic(() => import('components/CTABanner/index')) -// const ReactTooltip = dynamic(() => import('react-tooltip'), { ssr: false }) - -const Index = () => { - return ( -
- - {/* */} - - - {/* */} -
- - - ) -} - -export default Index \ No newline at end of file diff --git a/agenthub/app/providers.tsx b/agenthub/app/providers.tsx deleted file mode 100644 index 1d937bb4..00000000 --- a/agenthub/app/providers.tsx +++ /dev/null @@ -1,11 +0,0 @@ -// app/providers.tsx - -import {NextUIProvider} from '@nextui-org/react' - -export function Providers({children}: { children: React.ReactNode }) { - return ( - - {children} - - ) -} \ No newline at end of file diff --git a/agenthub/app/utils/index.ts b/agenthub/app/utils/index.ts deleted file mode 100644 index ba5dab96..00000000 --- a/agenthub/app/utils/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -export function formatDate(dateString: string) { - const date = new Date(dateString); - - const months = [ - 'January', 'February', 'March', 'April', 'May', 'June', - 'July', 'August', 'September', 'October', 'November', 'December' - ]; - - const month = months[date.getUTCMonth()]; - const day = date.getUTCDate(); - const year = date.getUTCFullYear(); - - // Function to add ordinal suffix to day - function getOrdinalSuffix(day: number) { - if (day > 3 && day < 21) return 'th'; - switch (day % 10) { - case 1: return "st"; - case 2: return "nd"; - case 3: return "rd"; - default: return "th"; - } - } - - return `${month} ${day}${getOrdinalSuffix(day)}, ${year}`; -} \ No newline at end of file diff --git a/agenthub/components/homepage/DefaultLayout.tsx b/agenthub/components/homepage/DefaultLayout.tsx deleted file mode 100644 index 8be4ac9d..00000000 --- a/agenthub/components/homepage/DefaultLayout.tsx +++ /dev/null @@ -1,34 +0,0 @@ -// import Nav from 'components/Nav/index' -// import Footer from 'components/Footer/index' -import { cn } from '@/lib/utils' -// import { useForceDeepDark } from '~/lib/theme.utils' - -type Props = { - hideHeader?: boolean - hideFooter?: boolean - className?: string - footerClassName?: string - children: React.ReactNode -} - -const DefaultLayout = (props: Props) => { - const { - hideHeader = false, - hideFooter = false, - className = '', - footerClassName = '', - children, - } = props - -// useForceDeepDark() - - return ( - <> - {/*