Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/build-image-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,42 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
sparse-checkout: |
/*
!modules/tool/packages

# Get changed packages and test build
- name: Get changed files in PR
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: modules/tool/packages/**

- name: Checkout changed packages
if: steps.changed-files.outputs.any_changed == 'true'
run: |
# Get list of changed packages
changed_packages=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | \
grep -oP 'modules/tool/packages/[^/]+' | \
sort -u)

# Checkout each changed package
for package in $changed_packages; do
echo "Checking out $package"
git sparse-checkout add "$package"
done

- name: Setup bun
if: steps.changed-files.outputs.any_changed == 'true'
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.23
- name: Install dependencies
if: steps.changed-files.outputs.any_changed == 'true'
run: bun install --frozen-lockfile && bun run install:plugins
- name: Build pkg
if: steps.changed-files.outputs.any_changed == 'true'
run: bun run build:pkg

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down
17 changes: 3 additions & 14 deletions .github/workflows/deploy-marketplace.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
name: Deploy to Marketplace

on:
push:
branches: [main]
workflow_dispatch:
inputs:
environment:
description: 'Deployment environment'
required: true
default: 'production'
type: choice
options:
- production
- staging
push:
# branches: [main]

jobs:
deploy:
Expand All @@ -31,7 +22,7 @@ jobs:
run: bun install --frozen-lockfile

- name: Install tool package dependencies
run: bun run ./scripts/install-all.ts
run: bun run install-all

- name: Build and deploy to marketplace
env:
Expand All @@ -45,13 +36,11 @@ jobs:
if: success()
run: |
echo "🚀 Marketplace deployment completed successfully!"
echo "Environment: ${{ github.event.inputs.environment || 'default' }}"
echo "Commit: ${{ github.sha }}"

- name: Notify deployment failure
if: failure()
run: |
echo "❌ Marketplace deployment failed!"
echo "Environment: ${{ github.event.inputs.environment || 'default' }}"
echo "Commit: ${{ github.sha }}"
exit 1
163 changes: 155 additions & 8 deletions bun.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dev_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,5 @@ modules/tool/type/tool.ts 下修改 `ToolTypeMap` 字段来增加类型枚举。

1. modules/model/provider 找到对应模型提供商配置文件
2. 按 ConfigModelItemSchema 数据类型填写配置即可


9 changes: 8 additions & 1 deletion lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@
"@opentelemetry/resources": "^2.0.1",
"@opentelemetry/sdk-logs": "^0.203.0",
"@opentelemetry/sdk-metrics": "^2.0.1",
"@scalar/express-api-reference": "^0.8.7",
"@ts-rest/core": "^3.52.1",
"@ts-rest/express": "^3.52.1",
"@ts-rest/open-api": "^3.52.1",
"@vercel/otel": "^1.9.2",
"fs-extra": "^11.3.2",
"jszip": "^3.10.1",
"mongoose": "^8.19.2",
"zod-openapi": "^5.4.3"
"zod-openapi": "^5.4.3",
"minio": "^8.0.6",
"undici": "^7.13.0",
"http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.6",
"ioredis": "^5.7.0"
},
"devDependencies": {
"@types/fs-extra": "^11.0.4",
Expand Down
11 changes: 0 additions & 11 deletions lib/worker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,6 @@ export async function dispatchWithNewWorker(data: {
worker.terminate();
});

console.log(
{
toolId,
inputs: workerData.inputs,
systemVar: workerData.systemVar,
filename: tool.toolFilename,
dev: devToolIds.has(toolId)
},
'==============-=-=-=-=-=-'
);

worker.postMessage({
type: 'runTool',
data: {
Expand Down
3 changes: 2 additions & 1 deletion modules/tool/build/build-json.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { basePath, UploadToolsS3Path } from '@tool/constants';
import { UploadToolsS3Path } from '@tool/constants';
import type { ToolSetType, ToolType } from '@tool/type';
import { ToolTagEnum } from '@tool/type/tags';
import { existsSync, writeFileSync } from 'fs';
Expand All @@ -10,6 +10,7 @@ const filterToolList = ['.DS_Store', '.git', '.github', 'node_modules', 'dist',

const S3BasePath = `${process.env.S3_ENDPOINT}/${process.env.S3_BUCKET}`;

const basePath = process.cwd();
const LoadToolsDev = async (filename: string): Promise<ToolType[]> => {
const tools: ToolType[] = [];

Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
"module": "index.ts",
"type": "module",
"scripts": {
"prepare": "husky install",
"new:tool": "bun ./scripts/newTool/index.ts",
"install:plugins": "bun ./scripts/install-all.ts",
"dev": "bun --cwd runtime dev",
"test": "vitest run",
"build:runtime": "bun --cwd runtime build",
"build:tools": "bun --cwd modules/tool build",
"build:marketplace": "bun run build:tools && bun --cwd runtime build:marketplace",
"start": "NODE_ENV=production node --env-file-if-exists=runtime/.env.local dist/index.js",
"build:pkg": "bun --cwd modules/tool build",
"build:sdk": "bun run --cwd sdk build",
"dev:runtime": "bun --cwd runtime dev",
"test": "vitest run",
"build:marketplace": "bun run build:pkg && bun ./modules/tool/build/build-json.ts",
"deploy:marketplace-data": "bun --env-file=.env.deploy ./scripts/deploy-marketplace.ts",
"prepare": "husky install",
"lint": "node_modules/.bin/eslint --fix",
"prettier": "prettier --write \"./**/*.{ts,js,json}\"",
"new:tool": "bun ./scripts/newTool/index.ts",
"start": "NODE_ENV=production node --env-file-if-exists=runtime/.env.local dist/index.js",
"deploy:marketplace-data": "bun --env-file=.env.deploy ./scripts/deploy-marketplace.ts"
"prettier": "prettier --write \"./**/*.{ts,js,json}\""
},
"devDependencies": {
"@inquirer/prompts": "^7.5.3",
Expand Down
5 changes: 2 additions & 3 deletions runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
"type": "module",
"scripts": {
"dev": "bun run dev/index.ts",
"build:worker": "bun build --env=disable --outfile=../dist/worker.js --target=node --minify ../lib/worker/worker.ts",
"build:main": "bun build --env=disable --outfile=../dist/index.js --target=node --minify index.ts",
"build": "bun run build/index.ts",
"build:marketplace": "bun run ../modules/tool/build/build-json.ts"
"build:worker": "bun build --env=disable --outfile=../dist/worker.js --target=node --minify ../lib/worker/worker.ts",
"build:main": "bun build --env=disable --outfile=../dist/index.js --target=node --minify index.ts"
},
"devDependencies": {
"@types/bun": "latest",
Expand Down