Skip to content

Commit cfb2dd7

Browse files
Branimir RakicBranimir Rakic
authored andcommitted
Public beta launch
0 parents  commit cfb2dd7

File tree

302 files changed

+65699
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+65699
-0
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": true,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.github/workflows/pr.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: PR Validation
2+
3+
concurrency:
4+
group: pr-validation-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
branches:
10+
- "**" # Run on push to any branch
11+
pull_request:
12+
branches:
13+
- "**" # Run on PR to any branch
14+
schedule:
15+
- cron: "0 0 * * 3" # Wednesdays at midnight check all node js versions
16+
17+
workflow_dispatch:
18+
19+
jobs:
20+
validate:
21+
name: Check Code Quality on Node.js ${{ matrix.node-version }}
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 45
24+
env:
25+
TURBO_TELEMETRY_DISABLED: 1
26+
27+
strategy:
28+
matrix:
29+
# The fromJSON() function converts the JSON string into an actual array
30+
node-version: ${{ fromJSON((github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch') && '[22]' || '[22, 24]') }}
31+
fail-fast: false
32+
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v4
36+
37+
- name: Setup Node.js ${{ matrix.node-version }}
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: ${{ matrix.node-version }}
41+
cache: "npm"
42+
cache-dependency-path: "package-lock.json"
43+
44+
- name: Install dependencies
45+
run: npm install
46+
47+
- name: Create environment files for tests
48+
run: |
49+
# Create main .env file for agent (mainnet by default)
50+
# Use absolute path for DATABASE_URL to work from any directory
51+
# IMPORTANT: No quotes around DATABASE_URL path!
52+
cat > apps/agent/.env << EOF
53+
PORT=9200
54+
EXPO_PUBLIC_MCP_URL=http://localhost:9200
55+
EXPO_PUBLIC_APP_URL=http://localhost:9200
56+
DATABASE_URL=${GITHUB_WORKSPACE}/apps/agent/test.db
57+
OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
58+
DKG_PUBLISH_WALLET=${{ secrets.DKG_Node_Private_key }}
59+
DKG_BLOCKCHAIN=otp:2043
60+
DKG_OTNODE_URL=https://positron.origin-trail.network
61+
EOF
62+
63+
# Create root .env file for turbo dev (when running from root directory)
64+
# This is needed because turbo dev runs from root and dotenv looks for .env in cwd
65+
cat > .env << EOF
66+
PORT=9200
67+
EXPO_PUBLIC_MCP_URL=http://localhost:9200
68+
EXPO_PUBLIC_APP_URL=http://localhost:9200
69+
DATABASE_URL=${GITHUB_WORKSPACE}/apps/agent/test.db
70+
OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
71+
DKG_PUBLISH_WALLET=${{ secrets.DKG_Node_Private_key }}
72+
DKG_BLOCKCHAIN=otp:2043
73+
DKG_OTNODE_URL=https://positron.origin-trail.network
74+
EOF
75+
76+
# Create development override file
77+
cat > apps/agent/.env.development.local << 'EOF'
78+
# These values will override the .env file during the development
79+
EXPO_PUBLIC_APP_URL=http://localhost:8081
80+
EOF
81+
82+
# Create testnet environment file
83+
mkdir -p apps/agent/tests
84+
cat > apps/agent/tests/.env.testing.testnet.local << EOF
85+
PORT=9200
86+
EXPO_PUBLIC_MCP_URL=http://localhost:9200
87+
EXPO_PUBLIC_APP_URL=http://localhost:9200
88+
DATABASE_URL=${GITHUB_WORKSPACE}/apps/agent/test.db
89+
OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
90+
DKG_PUBLISH_WALLET=${{ secrets.DKG_Node_Private_key }}
91+
DKG_BLOCKCHAIN=otp:20430
92+
DKG_OTNODE_URL=https://v6-pegasus-node-02.origin-trail.network
93+
EOF
94+
95+
# Create mainnet environment file
96+
cat > apps/agent/tests/.env.testing.mainnet.local << EOF
97+
PORT=9200
98+
EXPO_PUBLIC_MCP_URL=http://localhost:9200
99+
EXPO_PUBLIC_APP_URL=http://localhost:9200
100+
DATABASE_URL=${GITHUB_WORKSPACE}/apps/agent/test.db
101+
OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
102+
DKG_PUBLISH_WALLET=${{ secrets.DKG_Node_Private_key }}
103+
DKG_BLOCKCHAIN=otp:2043
104+
DKG_OTNODE_URL=https://positron.origin-trail.network
105+
EOF
106+
107+
echo "Environment files created successfully!"
108+
109+
- name: Install Playwright browsers
110+
run: npx playwright install --with-deps chromium
111+
112+
- name: Check code quality
113+
run: npm run check || echo "⚠️ Code quality checks completed with warnings (non-blocking)"
114+
115+
- name: Build packages and apps
116+
run: npm run build
117+
118+
- name: Create admin user for tests
119+
run: |
120+
cd apps/agent
121+
rm -f test.db test.db-* *.db-journal
122+
# Create admin user: email password scope firstName lastName
123+
npm run script:createUser [email protected] admin123 mcp,llm,blob,scope123 Admin User
124+
125+
- name: Run tests from all packages
126+
run: npm run test
127+
env:
128+
CI: true
129+
130+
- name: Upload test videos and screenshots
131+
if: failure()
132+
uses: actions/upload-artifact@v4
133+
with:
134+
name: test-artifacts-node-${{ matrix.node-version }}
135+
path: |
136+
apps/agent/test-results/
137+
apps/agent/playwright-report/
138+
retention-days: 7
139+
if-no-files-found: warn
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Validate Plugin Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- "**" # Run on push to any branch
7+
paths:
8+
- "packages/plugin-*/**"
9+
pull_request:
10+
paths:
11+
- "packages/plugin-*/**"
12+
13+
jobs:
14+
validate-plugin-tests:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: "22"
25+
cache: "npm"
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Build packages (required for tests)
31+
run: |
32+
echo "Building packages before running tests..."
33+
npm run build
34+
35+
- name: Check Plugin Tests
36+
run: |
37+
echo "Validating plugin tests..."
38+
echo "Required: Core Functionality + Error Handling test categories"
39+
echo "Note: Plugin Configuration tests are validated automatically by test execution"
40+
41+
# Find all plugin directories at the top level only
42+
plugins=$(find packages -maxdepth 1 -name "plugin-*" -type d)
43+
44+
if [ -z "$plugins" ]; then
45+
echo "No plugins found, nothing to check"
46+
exit 0
47+
fi
48+
49+
failed=false
50+
51+
for plugin in $plugins; do
52+
name=$(basename "$plugin")
53+
echo ""
54+
echo "Checking $name..."
55+
56+
cd "$plugin"
57+
58+
# Run the tests (with 60 second timeout)
59+
echo "Running tests..."
60+
test_output=$(timeout 60s npm test 2>&1 || echo "TESTS_FAILED")
61+
if [[ "$test_output" != *"TESTS_FAILED"* ]]; then
62+
echo "✅ All tests passed (including Plugin Configuration)"
63+
else
64+
echo "❌ Tests failed or took too long"
65+
66+
# Check for common failure reasons
67+
if [[ "$test_output" == *"TODO: Replace placeholder"* ]]; then
68+
echo " → Reason: Placeholder tests detected (need customization)"
69+
elif [[ "$test_output" == *"timeout"* ]]; then
70+
echo " → Reason: Tests took longer than 60 seconds"
71+
elif [[ "$test_output" == *"npm ERR!"* ]]; then
72+
echo " → Reason: npm/dependency error"
73+
else
74+
echo " → Reason: Unknown test failure"
75+
fi
76+
77+
failed=true
78+
fi
79+
80+
# Check for the 2 required test categories
81+
test_file=$(find tests -name "*.spec.ts" | head -1)
82+
if [ -f "$test_file" ]; then
83+
echo "Checking required test categories..."
84+
85+
# 1. Core Functionality tests (required)
86+
if grep -E "(Core Functionality|Tool Registration|Tool Functionality|API Endpoint|Login Endpoint|OpenAPI Endpoint|Resource Handler|Registration|Functionality)" "$test_file" > /dev/null; then
87+
echo "✅ Core Functionality tests found"
88+
else
89+
echo "❌ Missing Core Functionality tests (required category 1/2)"
90+
failed=true
91+
fi
92+
93+
# 2. Error Handling tests (required)
94+
if grep -E "(Error Handling|Error Cases|Invalid Parameters|Validation Errors|Exception Handling)" "$test_file" > /dev/null; then
95+
echo "✅ Error Handling tests found"
96+
else
97+
echo "❌ Missing Error Handling tests (required category 2/2)"
98+
failed=true
99+
fi
100+
else
101+
echo "❌ No test files found"
102+
failed=true
103+
fi
104+
105+
cd - > /dev/null
106+
done
107+
108+
echo ""
109+
echo "=== VALIDATION SUMMARY ==="
110+
if [ "$failed" = true ]; then
111+
echo "❌ Plugin validation failed!"
112+
echo ""
113+
114+
# Check what types of failures occurred and provide specific guidance
115+
if echo "$test_output" | grep -q "TODO: Replace placeholder"; then
116+
echo "ISSUE: Placeholder tests found"
117+
echo " You need to replace the auto-generated placeholder tests with real ones."
118+
echo " Look for 'TODO: Replace placeholder test' messages in your test files."
119+
echo ""
120+
echo "SOLUTION:"
121+
echo " 1. Open your tests/[plugin-name].spec.ts file"
122+
echo " 2. Replace placeholder tests in 'Core Functionality' section"
123+
echo " 3. Replace placeholder tests in 'Error Handling' section"
124+
echo " 4. See packages/plugin-example/tests/ for examples"
125+
echo ""
126+
fi
127+
echo ""
128+
echo "Read packages/PLUGIN_TESTING_GUIDE.md for detailed instructions"
129+
exit 1
130+
else
131+
echo "✅All plugins passed validation!"
132+
echo "✅ Core Functionality tests found"
133+
echo "✅ Error Handling tests found"
134+
echo "✅ All tests passing"
135+
fi

.gitignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# Dependencies
4+
node_modules
5+
.pnp
6+
.pnp.js
7+
8+
# Local env files
9+
.env
10+
.env.local
11+
.env.development.local
12+
.env.test.local
13+
.env.production.local
14+
15+
# Testing
16+
coverage
17+
18+
# Turbo
19+
.turbo
20+
21+
# Vercel
22+
.vercel
23+
24+
# Build Outputs
25+
.next/
26+
out/
27+
build
28+
dist
29+
30+
31+
# Debug
32+
npm-debug.log*
33+
yarn-debug.log*
34+
yarn-error.log*
35+
36+
# Misc
37+
.DS_Store
38+
*.pem
39+
playwright-report
40+
mochawesome-report
41+
DKG_Node_UI_Tests
42+
DKG_Node_UI_Tests.xml
43+
test-results
44+
ot-node
45+
dkg-engine
46+
47+
# RAGAS Reports
48+
apps/agent/tests/ragas/reports/
49+
tests/ragas/reports/

.npmrc

Whitespace-only changes.

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v22.6.0

0 commit comments

Comments
 (0)