diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml index c9a8cc518f2..c1b0f4a5b8b 100644 --- a/.github/workflows/image.yaml +++ b/.github/workflows/image.yaml @@ -1,70 +1,96 @@ -# + name: Create and publish a Docker image -# Configures this workflow to run every time a change is pushed to the branch called `release`. on: - release: - types: [created] - workflow_dispatch: + workflow_dispatch: + #push: + #pull_request: -# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} -# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. jobs: - build-and-push-image: - runs-on: ubuntu-latest - # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. - permissions: - contents: read - packages: write - attestations: write - id-token: write - # - steps: - - name: Checkout repository - uses: actions/checkout@v4 - # Uses the `docker/login-action` action to log in to the Container registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. - - name: Log in to the Container registry - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. - # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. - # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. - - name: Build and push Docker image - id: push - uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + #- name: Configure AWS credentials + # uses: meta-introspector/configure-aws-credentials@v4 + # with: + # aws-region: ${{ secrets.AWS_REGION || 'us-east-2'}} + # role-session-name: github-actions-${{ env.APP_NAME || 'eliza'}} + # # FIXME hard coded + # role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID || '767503528736' }}:role/github + + - name: Set up Docker Buildx + uses: meta-introspector/setup-buildx-action@v3.8.0 + with: + install: true + platforms: linux/amd64,linux/arm/v7,linux/arm/v8 + + # - name: Login to Amazon ECR + # id: login-ecr + # uses: meta-introspector/amazon-ecr-login@v1 + + - name: Set short sha + id: sha_short + run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - name: Login to Docker Hub + uses: meta-introspector/login-action@v3 + with: + username: ${{ vars.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Checkout repository + uses: meta-introspector/checkout@v4 + + - name: Log in to the Container registry + uses: meta-introspector/login-action@v3.0.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: meta-introspector/metadata-action@v5.5.1 + with: + images: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + h4ckermike/elizaos-eliza +# ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY || 'agent/eliza'}} + + - name: Build and push Docker image + id: push + uses: meta-introspector/build-push-action@v6.10.0 + with: + platforms: linux/arm64,linux/arm64/v8 + context: . + push: true + tags: | + ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} - # This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)." - - name: Generate artifact attestation - uses: actions/attest-build-provenance@v1 - with: - subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} - subject-digest: ${{ steps.push.outputs.digest }} - push-to-registry: true + - name: Generate artifact attestation + uses: meta-introspector/attest-build-provenance@local + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true - # This step makes the Docker image public, so users can pull it without authentication. - - name: Make Docker image public - run: | - curl \ - -X PATCH \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/user/packages/container/${{ env.IMAGE_NAME }}/visibility \ - -d '{"visibility":"public"}' + - name: Make Docker image public + run: | + curl \ + -X PATCH \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/user/packages/container/${{ env.IMAGE_NAME }}/visibility \ + -d '{"visibility":"public"}' diff --git a/.github/workflows/integrationTests.yaml b/.github/workflows/integrationTests.yaml index b1981d06655..e12815e9e08 100644 --- a/.github/workflows/integrationTests.yaml +++ b/.github/workflows/integrationTests.yaml @@ -1,12 +1,7 @@ name: Integration Tests on: - push: - branches: - - "*" - pull_request_target: - branches: - - "*" + workflow_dispatch: env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} @@ -15,36 +10,36 @@ env: jobs: integration-tests: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Bun - uses: oven-sh/setup-bun@v2 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: "23" - - - name: Install required packages - run: | - sudo apt update - sudo apt -y install build-essential pkg-config libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev - - - name: Install dependencies - run: bun install - - - name: Build packages - run: bun run build - - - name: Check for API key - run: | - if [ -z "$OPENAI_API_KEY" ]; then - echo "Error: OPENAI_API_KEY is not set." - exit 1 - fi - - - name: Run integration tests - run: bun run test + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # - name: Install Bun + # uses: oven-sh/setup-bun@v2 + + # - name: Install Node.js + # uses: actions/setup-node@v4 + # with: + # node-version: "23" + + # - name: Install required packages + # run: | + # sudo apt update + # sudo apt -y install build-essential pkg-config libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev + + # - name: Install dependencies + # run: bun install + + # - name: Build packages + # run: bun run build + + # - name: Check for API key + # run: | + # if [ -z "$OPENAI_API_KEY" ]; then + # echo "Error: OPENAI_API_KEY is not set." + # exit 1 + # fi + + # - name: Run integration tests + # run: bun run test diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index ff90535fcc9..0796fe4b306 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -1,8 +1,8 @@ name: PR Title Check on: - pull_request: - types: [opened, edited, synchronize] + workflow_dispatch: + jobs: check-pr-title: diff --git a/.github/workflows/tauri-ci.yml b/.github/workflows/tauri-ci.yml index 841dc2ccea1..8dd73da8737 100644 --- a/.github/workflows/tauri-ci.yml +++ b/.github/workflows/tauri-ci.yml @@ -11,16 +11,8 @@ env: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 on: - push: - branches: [main, develop, v2-develop] - paths: - - 'packages/app/**' - - '.github/workflows/**' - pull_request: - branches: [v2-develop] - paths: - - 'packages/app/**' - - '.github/workflows/**' + workflow_dispatch: + jobs: test-build: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000000..00add8ef960 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,33 @@ +name: testdocker +on: + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + steps: + - name: Login to Docker Hub + uses: meta-introspector/login-action@v3 + with: + username: ${{ vars.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Build and push Docker image + id: push + uses: meta-introspector/build-push-action@v6.10.0 + with: + platforms: linux/arm64,linux/arm64/v8 + context: . + push: true + tags: | + ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + diff --git a/.gitignore b/.gitignore index e0237f28b6e..fa79c1a6794 100644 --- a/.gitignore +++ b/.gitignore @@ -65,4 +65,54 @@ lerna-debug.log tsdoc_cache/ tsdoc_comments/ -**/elizaDb/** \ No newline at end of file +**/elizaDb/**# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +# network security +/network-security.data + +packages/autodoc/text_objects/* +/env diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000000..1bc755f0da9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,21 @@ +[submodule "vendor/elizaos/plugin-twitter"] + path = vendor/elizaos/plugin-twitter + url = https://github.com/meta-introspector/plugin-twitter +[submodule "vendor/elizaos/agent-twitter-client"] + path = vendor/elizaos/agent-twitter-client + url = https://github.com/meta-introspector/agent-twitter-client.git +[submodule "vendor/elizaos/client-twitter"] + path = vendor/elizaos/client-twitter + url = https://github.com/meta-introspector/client-twitter-eliza-zos +[submodule "vendor/elizaos/client-discord-eliza"] + path = vendor/elizaos/client-discord-eliza + url = https://github.com/meta-introspector/client-discord-eliza-zos +[submodule "vendor/elizaos/plugin-speech-tts"] + path = vendor/elizaos/plugin-speech-tts + url = https://github.com/meta-introspector/plugin-speech-tts-eliza-zos +[submodule "vendor/elizaos/client-telegram"] + path = vendor/elizaos/client-telegram + url = https://github.com/meta-introspector/client-telegram-eliza-zos +[submodule "characters"] + path = characters + url = https://github.com/meta-introspector/characters-eliza-zos diff --git a/.nvmrc b/.nvmrc index fa12cf298e4..c6250905713 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v23.3.0 \ No newline at end of file +v23.9.0 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9eb72d5a863..431070d7a94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,7 +101,7 @@ - feat: add docs for story plugin [\#1672](https://github.com/elizaOS/eliza/pull/1672) ([chandiniv1](https://github.com/chandiniv1)) - fix: 1668 fix twitter image link [\#1671](https://github.com/elizaOS/eliza/pull/1671) ([nusk0](https://github.com/nusk0)) - fix: 1634 fix image description service [\#1667](https://github.com/elizaOS/eliza/pull/1667) ([nusk0](https://github.com/nusk0)) -- fix: Seperated imageModelProvider and imageVisionModelProvider for ImageDescriptioServices [\#1664](https://github.com/elizaOS/eliza/pull/1664) ([denizekiz](https://github.com/denizekiz)) +- fix: Separated imageModelProvider and imageVisionModelProvider for ImageDescriptionServices [\#1664](https://github.com/elizaOS/eliza/pull/1664) ([denizekiz](https://github.com/denizekiz)) - fix: Update Supabase schema.sql [\#1660](https://github.com/elizaOS/eliza/pull/1660) ([0xRider](https://github.com/0xRider)) - fix: Fix bug in plugin-bootstrap/src/evaluators/facts.ts [\#1648](https://github.com/elizaOS/eliza/pull/1648) ([metakai1](https://github.com/metakai1)) - Added Hungarian README [\#1645](https://github.com/elizaOS/eliza/pull/1645) ([mdominikd](https://github.com/mdominikd)) @@ -188,7 +188,7 @@ - bun install shows errors [\#1234](https://github.com/elizaOS/eliza/issues/1234) - Long tweets fail with error Tweet needs to be a bit shorter \(Code 186\) [\#1178](https://github.com/elizaOS/eliza/issues/1178) - Unable to Perform Transfer with plugin-evm Due to Parameter Parsing Error [\#964](https://github.com/elizaOS/eliza/issues/964) -- I have a twitter premium subscription and MAX\_TWEET\_LENGTH to 2500 but I can't to post a tweet with more than 280 characteres [\#883](https://github.com/elizaOS/eliza/issues/883) +- I have a twitter premium subscription and MAX\_TWEET\_LENGTH to 2500 but I can't to post a tweet with more than 280 characters [\#883](https://github.com/elizaOS/eliza/issues/883) - Twitter cookies do not match the docs [\#558](https://github.com/elizaOS/eliza/issues/558) **Closed issues:** diff --git a/Dockerfile b/Dockerfile index f8eb7c92722..3ab2fdeaaa1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,8 +27,6 @@ COPY scripts ./scripts # Copy source code COPY packages ./packages - - # Install dependencies RUN bun install RUN bun add better-sqlite3 @@ -36,36 +34,14 @@ RUN bun add better-sqlite3 # Build the project RUN bun run build -# Create a new stage for the final image -FROM node:23.3.0-slim - WORKDIR /app -# Install Node.js 23.3.0 and required dependencies -RUN apt-get update && \ - apt-get install -y curl git python3 make g++ unzip build-essential nodejs && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -# Install bun using npm -RUN npm install -g bun turbo@2.3.3 - -# Copy built artifacts and production dependencies from the builder stage -COPY --from=builder /app/package.json ./ -COPY --from=builder /app/tsconfig.json ./ -COPY --from=builder /app/turbo.json ./ -COPY --from=builder /app/lerna.json ./ -COPY --from=builder /app/renovate.json ./ -COPY --from=builder /app/biome.json ./ -COPY --from=builder /app/node_modules ./node_modules -COPY --from=builder /app/packages ./packages -COPY --from=builder /app/scripts ./scripts - # Set environment variables ENV NODE_ENV=production # Expose any necessary ports (if needed) EXPOSE 3000 5173 + # Start the application -CMD ["bun", "run", "start"] \ No newline at end of file +CMD ["bun", "start"] diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 00000000000..6fc6324575f --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,32 @@ +version: 0.2 + +env: + parameter-store: + DOCKER_USERNAME : "tine_agent_4_docker_username" + DOCKER_PASSWORD : "tine_agent_4_docker_password" + #DOCKER_IMAGE : "tine_agent_7_agent_image" + variables: + DOCKER_IMAGE : "h4ckermike/elizaos-eliza:v2" + + +phases: + pre_build: + commands: + - apt update + - apt-get install -y ec2-instance-connect git wget unzip systemd ca-certificates curl cloud-utils apt-transport-https ca-certificates software-properties-common + - curl -fsSL test.docker.com -o get-docker.sh && sh get-docker.sh + - echo $DOCKER_PASSWORD | md5sum + - echo $DOCKER_PASSWORD | wc + - echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin + - aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 767503528736.dkr.ecr.us-east-2.amazonaws.com + build: + commands: + - docker build -t agent/eliza:feb10 . + - docker tag agent/eliza:feb10 767503528736.dkr.ecr.us-east-2.amazonaws.com/agent/eliza:feb10 + post_build: + commands: + - docker push 767503528736.dkr.ecr.us-east-2.amazonaws.com/agent/eliza:feb10 + - docker tag 767503528736.dkr.ecr.us-east-2.amazonaws.com/agent/eliza:feb10 $DOCKER_IMAGE + - docker push $DOCKER_IMAGE + # h4ckermike/elizaos-eliza:feb10 + diff --git a/bun.lock b/bun.lock index 9a0e748213a..4c17947f1e4 100644 --- a/bun.lock +++ b/bun.lock @@ -5,7 +5,7 @@ "name": "eliza", "dependencies": { "@anthropic-ai/sdk": "^0.39.0", - "@babel/generator": "^7.26.9", + "@babel/generator": "^7.26.10", "vittest": "^1.0.2", "zod": "3.24.1", }, diff --git a/call_update.sh b/call_update.sh new file mode 100755 index 00000000000..5eaf492b8d7 --- /dev/null +++ b/call_update.sh @@ -0,0 +1,10 @@ +aws ssm send-command \ + --profile solfunmeme_dev \ + --region us-east-2 \ + --document-name "UpdateEliza" \ + --document-version "\$LATEST" \ + --targets '[{"Key":"InstanceIds","Values":["i-0b0e822632e0bef20"]}]' \ + --parameters '{"ImageParameterName":["tine_agent_4_agent_image"],"CharacterParameterName":["tine-agent-config-1"],"ContainerMemory":["1512"]}' \ + --timeout-seconds 600 \ + --max-concurrency "50" \ + --max-errors "0" diff --git a/codebuild.sh b/codebuild.sh new file mode 100755 index 00000000000..f3c682b405b --- /dev/null +++ b/codebuild.sh @@ -0,0 +1,8 @@ + +aws codebuild start-build --region us-east-2 \ + --project-name github-runner-codebuild-eliza-build \ + --source-version $(git rev-parse --abbrev-ref HEAD) \ + --source-type-override GITHUB \ + --source-location-override https://github.com/meta-introspector/cloud-deployment-eliza.git \ + --git-clone-depth 1 \ + --git-submodules-config fetchSubmodules=true diff --git a/docker-entrypoint-none.sh b/docker-entrypoint-none.sh new file mode 100755 index 00000000000..a50157180be --- /dev/null +++ b/docker-entrypoint-none.sh @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +# Run command with node if the first argument contains a "-" or is not a system command. The last +# part inside the "{}" is a workaround for the following bug in ash/dash: +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264 +set -x +#if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then +#apt update +#apt install -y strace + +#export COREPACK_ENABLE_DOWNLOAD_PROMPT=0 +#corepack enable && corepack install --global pnpm@9.8.0 + +#strace -f -o /opt/agent/strace.log -s99999 node CMD ["pnpm", "start", "--characters=characters/eliza.character.json"] +#pnpm start --characters=characters/tine-test.character.json +#pnpm start --characters=$(ls -1p characters/*.json | paste -sd,) +#fi +#exec "$@" +bun start # --characters=$(ls -1p characters/*.json | paste -sd,) diff --git a/docker-entrypoint-strace.sh b/docker-entrypoint-strace.sh new file mode 100755 index 00000000000..1c32ee7177a --- /dev/null +++ b/docker-entrypoint-strace.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Run command with node if the first argument contains a "-" or is not a system command. The last +# part inside the "{}" is a workaround for the following bug in ash/dash: +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264 +set -x +#if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then +strace -f -o /opt/agent/strace.log -s99999 node "$@" +#fi +#exec "$@" diff --git a/docker-entrypoint-strace2.sh b/docker-entrypoint-strace2.sh new file mode 100755 index 00000000000..c355cf0eaff --- /dev/null +++ b/docker-entrypoint-strace2.sh @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +# Run command with node if the first argument contains a "-" or is not a system command. The last +# part inside the "{}" is a workaround for the following bug in ash/dash: +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264 +set -x +#if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then +apt update +apt install -y strace + +#export COREPACK_ENABLE_DOWNLOAD_PROMPT=0 +#corepack enable && corepack install --global pnpm@9.8.0 + + +#strace -f -o /opt/agent/strace.log -s99999 node CMD ["pnpm", "start", "--characters=characters/eliza.character.json"] +strace -f -o /opt/agent/strace.log -s99999 bun start +#pnpm start:debug --characters=$(ls -1p characters/*.json | paste -sd,) +#fi +#exec "$@" diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 00000000000..1b3116e53ba --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Run command with node if the first argument contains a "-" or is not a system command. The last +# part inside the "{}" is a workaround for the following bug in ash/dash: +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264 +if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then + set -- node "$@" +fi + +exec "$@" diff --git a/doit.sh b/doit.sh new file mode 100644 index 00000000000..d2b204f6f47 --- /dev/null +++ b/doit.sh @@ -0,0 +1,21 @@ + +nvm use 23 +pnpm clean +pnpm install --no-frozen-lockfile +pnpm build + + +pushd packages/adapter-sqlite +pnpm rebuild +popd + + +pushd scripts/jsdoc-automation +pnpm install --no-frozen-lockfile +pnpm build + +pushd node_modules/.pnpm/better-sqlite3@11.8.1/node_modules/better-sqlite3/ +pnpm rebuild + +popd +popd diff --git a/get_secrets.sh b/get_secrets.sh new file mode 100755 index 00000000000..1e6ecaa5198 --- /dev/null +++ b/get_secrets.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# we are using parameters prefixed by ${AGENT_NAME}_, eg. "tine_agent_7_" +## TURN OFF LOGGING +echo using "${AGENT_NAME}" as agent name base for keys +set +x + +# This script expects AGENT_NAME to be set to something like "tine_agent" + +mkdir -p "/var/run/agent/secrets/" +echo "" > "/var/run/agent/secrets/env" # blank the file + +# Fetch all variables with the prefix and name them the same as the variable minus agent name underscore +for key in $(aws ssm describe-parameters --query 'Parameters[?starts_with(Name, `'"${AGENT_NAME}"'_`)].Name' --output text); do + value=$(aws ssm get-parameter --name "$key" | jq .Parameter.Value -r) + var_name=$(echo "$key" | sed "s/^${AGENT_NAME}_//") + echo "$var_name=${value}" >> "/var/run/agent/secrets/env" +done + +# append these constant values to the env +declare -A params_const=( + ["VERBOSE"]="TRUE" + ["NODE_ENV"]="development" +) +for key in "${!params_const[@]}"; do + value="${params_const[$key]}" + echo "$key=$value" >> "/var/run/agent/secrets/env" +done + +set -x +## TURN ON LOGGING diff --git a/package.json b/package.json index 826f8680934..abc2ffbdd77 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ }, "dependencies": { "@anthropic-ai/sdk": "^0.39.0", - "@babel/generator": "^7.26.9", + "@babel/generator": "^7.26.10", "vittest": "^1.0.2", "zod": "3.24.1" }, diff --git a/packages/registry b/packages/registry deleted file mode 160000 index 16bf207b402..00000000000 --- a/packages/registry +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 16bf207b4027c6547c3a6ba402e66d736b516c29 diff --git a/push_twitter.sh b/push_twitter.sh new file mode 100755 index 00000000000..b62e6d60df7 --- /dev/null +++ b/push_twitter.sh @@ -0,0 +1,6 @@ + +export TWITTER_EMAIL TWITTER_PASSWORD TWITTER_USER + +aws ssm put-parameter --name "tine_agent_twitter_password" --value "${TWITTER_PASSWORD}" --type String +aws ssm put-parameter --name "tine_agent_twitter_email" --value "${TWITTER_EMAIL}" --type String +aws ssm put-parameter --name "tine_agent_twitter_username" --value "${TWITTER_USERNAME}" --type String diff --git a/run_with_groq.sh b/run_with_groq.sh new file mode 100755 index 00000000000..ec20ab1f7a6 --- /dev/null +++ b/run_with_groq.sh @@ -0,0 +1,28 @@ + +# +bash ./get_secrets.sh + +docker kill agent-docker.service || echo skip +docker rm --force agent-docker.service || echo skip + +/usr/bin/bash -c 'docker login -u AWS -p $(aws ecr get-login-password --region us-east-2) 767503528736.dkr.ecr.us-east-2.amazonaws.com' + +/usr/bin/docker pull 767503528736.dkr.ecr.us-east-2.amazonaws.com/agent/eliza:feature-arm64_fastembed + +#/usr/bin/docker run -p 3000:3000 --mount type=bind,source=/opt/agent,target=/opt/agent --env-file /var/run/agent/secrets/env --rm --name "agent-docker.service" --entry-point docker-entrypoint-strace.sh 767503528736.dkr.ecr.us-east-2.amazonaws.com/agent/eliza:feature-arm64_fastembed pnpm start:debug --characters=characters/eliza.character.json + +#~/cloud-deployment-eliza/runlocaldocker-install-script.sh +# install strace (fixme : update docker) +#/usr/bin/docker run -p 3000:3000 --mount type=bind,source=/opt/agent,target=/opt/agent --env-file /var/run/agent/secrets/env --rm --name "agent-docker.service" --entrypoint /opt/agent/docker-entrypoint-none.sh 767503528736.dkr.ecr.us-east-2.amazonaws.com/agent/eliza:feature-arm64_fastembed /opt/agent/runlocaldocker-install-script.sh +#/usr/bin/docker commit "agent-docker.service" "agent-docker-strace" +# second step we debug with strace entrypoint +# first we create a volumee +#mount /node_modules/tokenizers/ from 767503528736.dkr.ecr.us-east-2.amazonaws.com/nodemodules/tokenizer:latest into +#"/app/node_modules/fastembed/node_modules/.pnpm/@anush008+tokenizers@https+++codeload.github.com+meta-introspector+arm64-tokenizers+tar.gz+98_s2457qj3pe4ojcbckddasgzfvu/node_modules/@anush008/" + +docker run -v tokenizer:/node_modules/tokenizers/ 767503528736.dkr.ecr.us-east-2.amazonaws.com/nodemodules/tokenizer:latest + +# now bind it in +/usr/bin/docker run -d -p 3000:3000 -v tokenizer:/app/node_modules/@anush008/tokenizers/ -v tokenizer:/app/node_modules/fastembed/node_modules/.pnpm/@anush008+tokenizers@https+++codeload.github.com+meta-introspector+arm64-tokenizers+tar.gz+98_s2457qj3pe4ojcbckddasgzfvu/node_modules/@anush008/ --mount type=bind,source=/opt/agent,target=/opt/agent --mount type=bind,source=/opt/agent/characters/,target=/app/characters/ --env-file /var/run/agent/secrets/env --rm --name "agent-docker.service" --entrypoint /opt/agent/docker-entrypoint-strace2.sh groq +#100755 > + diff --git a/run_with_groq_docker.sh b/run_with_groq_docker.sh new file mode 100755 index 00000000000..ee3145759e4 --- /dev/null +++ b/run_with_groq_docker.sh @@ -0,0 +1,30 @@ + +# +bash ./get_secrets.sh + +docker kill agent-docker.service || echo skip +docker rm --force agent-docker.service || echo skip + +export CORE_AGENT_IMAGE=h4ckermike/elizaos-eliza:feature-arm64_fastembed +export TOKENIZERS_IMAGE=h4ckermike/arm64-tokenizers:feature-arm64 +# AUDIO +# video +# more +/usr/bin/docker pull $TOKENIZERS_IMAGE +/usr/bin/docker pull $CORE_AGENT_IMAGE + +# intialize the volume as side effect +docker run -v tokenizer:/node_modules/tokenizers/ $TOKENIZERS_IMAGE +#docker cp characters/eliza.character.json agent-docker.service:/app/agent/characters/eliza.character.json +#docker commit agent-docker.service groq + +# now bind it in +/usr/bin/docker run -d -p 3000:3000 \ + -v tokenizer:/app/node_modules/@anush008/tokenizers/ -v tokenizer:/app/node_modules/fastembed/node_modules/.pnpm/@anush008+tokenizers@https+++codeload.github.com+meta-introspector+arm64-tokenizers+tar.gz+98_s2457qj3pe4ojcbckddasgzfvu/node_modules/@anush008/ \ + --mount type=bind,source=/opt/agent,target=/opt/agent \ + --mount type=bind,source=/opt/agent/characters/,target=/app/characters/ \ + --env-file /var/run/agent/secrets/env \ + --rm \ + --name "agent-docker.service" \ + --entrypoint /opt/agent/docker-entrypoint-strace2.sh $DOCKERIMAGE + diff --git a/rundocker.sh b/rundocker.sh new file mode 100755 index 00000000000..ce8dca3a07d --- /dev/null +++ b/rundocker.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# FIXME move this and related files into the user data via templates and compression +# this is the install script +# install_script = "/opt/agent/rundocker.sh" +# called on boot. +echo using "${AGENT_NAME}" as agent name base for keys +export AGENT_NAME +#pwd +#ls -latr +#. ./.env # for secrets +set -e # stop on any error +export WORKSOURCE="/opt/agent" + +echo for now install helper tools +snap install aws-cli --classic +apt install -y jq +apt install -y lsof strace nmap +#apt install -y emacs-nox + +if ! id -u agent > /dev/null 2>&1; then + adduser --disabled-password --gecos "" agent --home "/home/agent" || echo ignore +else + echo "User agent already exists, ignoring..." +fi + +git config --global --add safe.directory "/opt/agent" +cd "/opt/agent/" || exit 1 # "we need agent" +#git log -1 +mkdir -p "/home/agent" +mkdir -p "/var/agent/logs" +chown -R agent:agent "/var/agent/" "/home/agent" "/opt/agent" +mkdir -p "/var/run/agent/secrets/" + +bash ./get_secrets.sh + +if ! grep -q "^HOME" "/var/run/agent/secrets/env"; then + echo "HOME=/home/agent" >> "/var/run/agent/secrets/env" +fi +if ! grep -q "^HOME" "/var/run/agent/secrets/env"; then + echo "WORKSPACE_DIR=\${STATE_DIRECTORY}" >> "/var/run/agent/secrets/env" +fi +cp "${WORKSOURCE}/systemd/agent-docker.service" /etc/systemd/system/agent-docker.service +grep . -h -n /etc/systemd/system/agent-docker.service +chown -R agent:agent /var/run/agent/ +chown -R agent:agent /opt/agent/ +systemctl daemon-reload + +# now we can kill any existing +docker stop agent-docker.service || echo oops +docker kill agent-docker.service || echo oops +docker rm agent-docker.service || echo oops + + +systemctl start agent-docker || echo failed +systemctl enable agent-docker || echo failed +#systemctl status agent-docker || echo oops2 diff --git a/scripts/clean.sh b/scripts/clean.sh new file mode 100644 index 00000000000..9c687aa40cb --- /dev/null +++ b/scripts/clean.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Navigate to the script's directory +cd "$(dirname "$0")"/.. +echo "Cleanup started." +# Find and remove node_modules directories, dist directories. +find . -type d -name "node_modules" -print0 | xargs -0 rm -rf +find . -type d -name "dist" -exec rm -rf {} + +find . -type d -name ".turbo" -exec rm -rf {} + + +# Remove core cache +rm -rf ./packages/core/cache + +# Remove pnpm lockfile +rm -f ./pnpm-lock.yaml + +echo "Cleanup completed." +exit 0 diff --git a/set_secrets.sh b/set_secrets.sh new file mode 100755 index 00000000000..086a9791ddf --- /dev/null +++ b/set_secrets.sh @@ -0,0 +1,28 @@ +#set +x # turn off logging +export AGENT_IMAGE=h4ckermike/elizaos-eliza:feature-arm64_fastembed +export TOKENIZER_IMAGE=h4ckermike/arm64-tokenizers:feature-arm64 + +# sets the parameter +#aws ssm put-parameter --name "agent_openai_key" --value "${OPENAI_API_KEY}" --type String +aws ssm put-parameter --overwrite --name "tine_agent_twitter_password" --value "${TWITTER_PASSWORD}" --type String +aws ssm put-parameter --overwrite --name "tine_agent_twitter_email" --value "${TWITTER_EMAIL}" --type String +aws ssm put-parameter --overwrite --name "tine_agent_twitter_username" --value "${TWITTER_USERNAME}" --type String +#aws ssm put-parameter --name "tine_agent_openai_key" --value "${OPENAI_API_KEY}" --type String +#aws ssm put-parameter --name "tine_agent_openai_endpoint" --value "${OPENAI_API_BASE}" --type String +#aws ssm put-parameter --name "tine_agent_openai_model" --value "${LLMMODEL}" --type String +aws ssm put-parameter --name "tine_agent_groq_key" --value "${GROQ_API_KEY}" --type String + +aws ssm put-parameter --name "tine_agent_agent_image" --value "${AGENT_IMAGE}" --type String +# aws ssm put-parameter --name "tine_agent_agent_image" --value "${AGENT_IMAGE}" --type String --region us-east-1 --overwrite +aws ssm put-parameter --name "tine_agent_tokenizer_image" --value "${TOKENIZER_IMAGE}" --type String +#aws ssm put-parameter --name "tine_agent_tokenizer_image" --value "${TOKENIZER_IMAGE}" --type String --region us-east-1 --overwrite + + + + +aws ssm put-parameter --name "tine_agent_2_agent_image" --value "h4ckermike/elizaos-eliza:feb10" --type String +aws ssm put-parameter --name "tine_agent_2_docker_username" --value "${DOCKER_USERNAME}" --type String +aws ssm put-parameter --name "tine_agent_2_docker_password" --value "${DOCKER_PASSWORD}" --type String + + +# aws ssm put-parameter --name "tine_agent_2_docker_username" --value "${DOCKER_USERNAME}" --type String --profile solfunmeme_dev diff --git a/set_systemd.sh b/set_systemd.sh new file mode 100755 index 00000000000..e35953ad173 --- /dev/null +++ b/set_systemd.sh @@ -0,0 +1,2 @@ +#!/bin/bash +source /var/run/agent/secrets/env diff --git a/ssh-ssm.py b/ssh-ssm.py new file mode 100755 index 00000000000..94964c87a73 --- /dev/null +++ b/ssh-ssm.py @@ -0,0 +1,45 @@ +#!/usr/bin/python +import time +import json +import boto3 +#from dateutil import tz + + +def parse_command_id(send_command_output): + return send_command_output['Command']['CommandId'] + +def fwd(instance): + # https://aws.amazon.com/blogs/aws/new-port-forwarding-using-aws-system-manager-sessions-manager/ + #INSTANCE_ID=$(aws ec2 describe-instances --filter "Name=tag:Name,Values=CodeStack/NewsBlogInstance" --query "Reservations[].Instances[?State.Name == 'running'].InstanceId[]" --output text) +# create the port forwarding tunnel + prms = { + "portNumber":["22"], + "localPortNumber":["2222"] + } + prms_jsn = json.dumps(prms) + print(f"""aws ssm start-session --target {instance} --document-name AWS-StartPortForwardingSession --parameters '{prms_jsn}'""") + +def main(): + ec2_client = boto3.client('ec2') + ssm_client = boto3.client('ssm') + + # Get the list of instance IDs and their states + instances_response = ec2_client.describe_instances() + + instances = [ + (instance['InstanceId'], instance['State']['Name']) + for reservation in instances_response['Reservations'] + for instance in reservation['Instances'] + ] + for reservation in instances_response['Reservations']: + for instance in reservation['Instances']: + print(instance) + instance_id = instance['InstanceId'] + state = instance['State']['Name'] + if state == 'running': + #print(f"Starting command for instance: {instance_id}") + #print(f"aws ssm start-session --target {instance_id}") + fwd(instance_id) + +if __name__ == "__main__": + main() diff --git a/systemd/agent-docker-it.sh b/systemd/agent-docker-it.sh new file mode 100644 index 00000000000..831a77b0803 --- /dev/null +++ b/systemd/agent-docker-it.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +source /var/run/agent/secrets/env + +/usr/bin/docker run -p 3000:3000 \ + -v tokenizer:/app/node_modules/@anush008/tokenizers/ \ + -v tokenizer:/app/node_modules/fastembed/node_modules/.pnpm/@anush008+tokenizers@https+++codeload.github.com+meta-introspector+arm64-tokenizers+tar.gz+98_s2457qj3pe4ojcbckddasgzfvu/node_modules/@anush008/ \ + --mount type=bind,source=/opt/agent,target=/opt/agent \ + --env-file /var/run/agent/secrets/env \ + --name "agent-docker.service" --entrypoint "" -it ${AGENT_IMAGE} bash + + + diff --git a/systemd/agent-docker-local-it.sh b/systemd/agent-docker-local-it.sh new file mode 100644 index 00000000000..5dce24143f3 --- /dev/null +++ b/systemd/agent-docker-local-it.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +source ./env +/usr/bin/docker kill agent-docker.service || echo ok +/usr/bin/docker remove agent-docker.service || echo ok + +/usr/bin/docker run -p 3000:3000 \ + -v tokenizer:/app/node_modules/@anush008/tokenizers/ \ + -v tokenizer:/app/node_modules/fastembed/node_modules/.pnpm/@anush008+tokenizers@https+++codeload.github.com+meta-introspector+arm64-tokenizers+tar.gz+98_s2457qj3pe4ojcbckddasgzfvu/node_modules/@anush008/ \ + --mount type=bind,source=/opt/agent,target=/opt/agent \ + --env-file env \ + --name "agent-docker.service" --entrypoint "" -it ${AGENT_IMAGE} bash diff --git a/systemd/agent-docker-local.sh b/systemd/agent-docker-local.sh new file mode 100644 index 00000000000..97f1b380dfb --- /dev/null +++ b/systemd/agent-docker-local.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +source ./env +/usr/bin/docker remove agent-docker.service + +/usr/bin/docker run -p 3000:3000 \ + -v tokenizer:/app/node_modules/@anush008/tokenizers/ \ + -v tokenizer:/app/node_modules/fastembed/node_modules/.pnpm/@anush008+tokenizers@https+++codeload.github.com+meta-introspector+arm64-tokenizers+tar.gz+98_s2457qj3pe4ojcbckddasgzfvu/node_modules/@anush008/ \ + --mount type=bind,source=/opt/agent,target=/opt/agent \ + --env-file env \ + --name "agent-docker.service" \ + --entrypoint /opt/agent/docker-entrypoint-strace2.sh ${AGENT_IMAGE} + diff --git a/systemd/agent-docker.service b/systemd/agent-docker.service new file mode 100644 index 00000000000..cb04d270eb7 --- /dev/null +++ b/systemd/agent-docker.service @@ -0,0 +1,38 @@ +# derived from https://phil.lavin.me.uk/2021/12/running-docker-containers-from-aws-ecr-with-systemd/ +# derived from https://github.com/encode/uvicorn/issues/678 +# derived from https://blog.container-solutions.com/running-docker-containers-with-systemd + +[Unit] +Description=agent +After=docker.service +Requires=docker.service +StartLimitInterval=200 +StartLimitBurst=10 + +[Service] +EnvironmentFile=/var/run/agent/secrets/env +RestartSec=10 +TimeoutStartSec=0 +ExecStartPre=-/usr/bin/docker exec %n stop || echo cannot prestop +ExecStartPre=-/usr/bin/docker rm %n || echo cannot preremove +ExecStartPre=/usr/bin/docker pull ${AGENT_IMAGE} +ExecStartPre=/usr/bin/docker pull ${TOKENIZER_IMAGE} +ExecStartPre=-/usr/bin/docker run --name copytoken \ + -v tokenizer:/node_modules/tokenizers/ \ + ${TOKENIZER_IMAGE} +ExecStart=/usr/bin/docker run \ + -p 3000:3000 \ + -v tokenizer:/app/node_modules/@anush008/tokenizers/ \ + -v tokenizer:/app/node_modules/fastembed/node_modules/.pnpm/@anush008+tokenizers@https+++codeload.github.com+meta-introspector+arm64-tokenizers+tar.gz+98_s2457qj3pe4ojcbckddasgzfvu/node_modules/@anush008/ \ + --mount type=bind,source=/opt/agent,target=/opt/agent \ + --env-file /var/run/agent/secrets/env \ + --name "agent-docker.service" \ + --entrypoint /opt/agent/docker-entrypoint-none.sh \ + ${AGENT_IMAGE} +StandardOutput=file:/var/log/agent_systemd.log +StandardError=file:/var/log/agent_systemd.log +ExecReload=/bin/kill -HUP ${MAINPID} +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/systemd/agent-docker.sh b/systemd/agent-docker.sh new file mode 100644 index 00000000000..22f3b8b8031 --- /dev/null +++ b/systemd/agent-docker.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +source /var/run/agent/secrets/env + +/usr/bin/docker run -p 3000:3000 \ + -v tokenizer:/app/node_modules/@anush008/tokenizers/ \ + -v tokenizer:/app/node_modules/fastembed/node_modules/.pnpm/@anush008+tokenizers@https+++codeload.github.com+meta-introspector+arm64-tokenizers+tar.gz+98_s2457qj3pe4ojcbckddasgzfvu/node_modules/@anush008/ \ + --mount type=bind,source=/opt/agent,target=/opt/agent \ + --env-file /var/run/agent/secrets/env \ + --name "agent-docker.service" \ + --entrypoint /opt/agent/docker-entrypoint-strace2.sh ${AGENT_IMAGE} + diff --git a/update.sh b/update.sh new file mode 100755 index 00000000000..1b0d2e23768 --- /dev/null +++ b/update.sh @@ -0,0 +1,5 @@ +aws ssm update-document \ + + --name "UpdateEliza" \ + --content "file://UpdateEliza.yaml" \ + --document-version '$LATEST' diff --git a/vendor/elizaos/agent-twitter-client b/vendor/elizaos/agent-twitter-client new file mode 160000 index 00000000000..e4a4984c789 --- /dev/null +++ b/vendor/elizaos/agent-twitter-client @@ -0,0 +1 @@ +Subproject commit e4a4984c789db487916f3666f8bb9b316182d87d diff --git a/vendor/elizaos/client-telegram b/vendor/elizaos/client-telegram new file mode 160000 index 00000000000..443526dad82 --- /dev/null +++ b/vendor/elizaos/client-telegram @@ -0,0 +1 @@ +Subproject commit 443526dad82507ddebb1255014f57ada73a824b5 diff --git a/vendor/elizaos/client-twitter b/vendor/elizaos/client-twitter new file mode 160000 index 00000000000..fffa5389387 --- /dev/null +++ b/vendor/elizaos/client-twitter @@ -0,0 +1 @@ +Subproject commit fffa5389387834e8b340f37fc440b2275a07eabf diff --git a/vendor/elizaos/plugin-speech-tts b/vendor/elizaos/plugin-speech-tts new file mode 160000 index 00000000000..28fde3cf1d3 --- /dev/null +++ b/vendor/elizaos/plugin-speech-tts @@ -0,0 +1 @@ +Subproject commit 28fde3cf1d3331269751706b1e95af8e158d1390 diff --git a/vendor/elizaos/plugin-twitter b/vendor/elizaos/plugin-twitter new file mode 160000 index 00000000000..a92d94b46bc --- /dev/null +++ b/vendor/elizaos/plugin-twitter @@ -0,0 +1 @@ +Subproject commit a92d94b46bcf26a39620749d0bc67f192588b3c8