@kmlckj/licos-ai-cli 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__templates__/agent/README.md +1 -8
- package/lib/__templates__/agent/pyproject.toml +1 -1
- package/lib/__templates__/agent/requirements.txt +1 -1
- package/lib/__templates__/expo/.licos +4 -4
- package/lib/__templates__/expo/server/package.json +35 -35
- package/lib/__templates__/native-static/template.config.js +1 -1
- package/lib/__templates__/nextjs/package.json +93 -93
- package/lib/__templates__/nextjs/scripts/build.sh +2 -2
- package/lib/__templates__/nextjs/scripts/dev.sh +3 -3
- package/lib/__templates__/nextjs/scripts/prepare.sh +2 -2
- package/lib/__templates__/nextjs/scripts/start.sh +2 -2
- package/lib/__templates__/nextjs/template.config.js +1 -1
- package/lib/__templates__/nuxt-vue/package.json +35 -35
- package/lib/__templates__/nuxt-vue/scripts/build.sh +2 -2
- package/lib/__templates__/nuxt-vue/scripts/dev.sh +3 -3
- package/lib/__templates__/nuxt-vue/scripts/prepare.sh +2 -2
- package/lib/__templates__/nuxt-vue/scripts/start.sh +2 -2
- package/lib/__templates__/nuxt-vue/template.config.js +1 -1
- package/lib/__templates__/taro/.licos +5 -5
- package/lib/__templates__/taro/.licosproj/scripts/deploy_build.sh +3 -1
- package/lib/__templates__/taro/.licosproj/scripts/deploy_run.sh +3 -2
- package/lib/__templates__/taro/.licosproj/scripts/dev_run.sh +5 -2
- package/lib/__templates__/taro/.licosproj/scripts/init_env.sh +3 -1
- package/lib/__templates__/taro/server/package.json +40 -40
- package/lib/__templates__/taro/template.config.js +1 -1
- package/lib/__templates__/templates.json +30 -5
- package/lib/__templates__/vite/package.json +44 -44
- package/lib/__templates__/vite/scripts/build.sh +2 -2
- package/lib/__templates__/vite/scripts/dev.sh +3 -3
- package/lib/__templates__/vite/scripts/prepare.sh +2 -2
- package/lib/__templates__/vite/scripts/start.sh +2 -2
- package/lib/__templates__/vite/template.config.js +1 -1
- package/lib/__templates__/workflow/.licos +14 -0
- package/lib/__templates__/workflow/README.md +34 -0
- package/lib/__templates__/workflow/_gitignore +10 -0
- package/lib/__templates__/workflow/pyproject.toml +13 -0
- package/lib/__templates__/workflow/requirements.txt +1 -0
- package/lib/__templates__/workflow/scripts/http_run.sh +29 -0
- package/lib/__templates__/workflow/scripts/local_run.sh +12 -0
- package/lib/__templates__/workflow/scripts/pack.sh +23 -0
- package/lib/__templates__/workflow/scripts/setup.sh +44 -0
- package/lib/__templates__/workflow/src/graphs/__init__.py +1 -0
- package/lib/__templates__/workflow/src/graphs/graph.py +36 -0
- package/lib/__templates__/workflow/src/main.py +7 -0
- package/lib/__templates__/workflow/template.config.js +45 -0
- package/lib/cli.js +1 -1
- package/package.json +1 -1
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "server",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"description": "NestJS server application",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "nest build",
|
|
8
|
-
"dev": "nest start --watch",
|
|
9
|
-
"start": "nest start",
|
|
10
|
-
"start:debug": "nest start --debug --watch",
|
|
11
|
-
"start:prod": "node dist/main"
|
|
12
|
-
},
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"@kmlckj/licos-platform-sdk": "0.6.0",
|
|
15
|
-
"@aws-sdk/client-s3": "^3.958.0",
|
|
16
|
-
"@aws-sdk/lib-storage": "^3.958.0",
|
|
17
|
-
"@nestjs/common": "^10.4.15",
|
|
18
|
-
"@nestjs/core": "^10.4.15",
|
|
19
|
-
"@nestjs/platform-express": "^10.4.15",
|
|
20
|
-
"@supabase/supabase-js": "2.95.3",
|
|
21
|
-
"better-sqlite3": "^11.9.1",
|
|
22
|
-
"dotenv": "^17.2.3",
|
|
23
|
-
"drizzle-kit": "^0.31.8",
|
|
24
|
-
"drizzle-orm": "^0.45.1",
|
|
25
|
-
"drizzle-zod": "^0.8.3",
|
|
26
|
-
"express": "5.2.1",
|
|
27
|
-
"pg": "^8.16.3",
|
|
28
|
-
"rxjs": "^7.8.1",
|
|
29
|
-
"zod": "^4.3.5"
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@nestjs/cli": "^10.4.9",
|
|
33
|
-
"@nestjs/schematics": "^10.2.3",
|
|
34
|
-
"@types/better-sqlite3": "^7.6.13",
|
|
35
|
-
"@types/express": "5.0.6",
|
|
36
|
-
"@types/node": "^22.10.2",
|
|
37
|
-
"drizzle-kit": "^0.31.8",
|
|
38
|
-
"typescript": "^5.7.2"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "NestJS server application",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "nest build",
|
|
8
|
+
"dev": "nest start --watch",
|
|
9
|
+
"start": "nest start",
|
|
10
|
+
"start:debug": "nest start --debug --watch",
|
|
11
|
+
"start:prod": "node dist/main"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@kmlckj/licos-platform-sdk": "0.6.0",
|
|
15
|
+
"@aws-sdk/client-s3": "^3.958.0",
|
|
16
|
+
"@aws-sdk/lib-storage": "^3.958.0",
|
|
17
|
+
"@nestjs/common": "^10.4.15",
|
|
18
|
+
"@nestjs/core": "^10.4.15",
|
|
19
|
+
"@nestjs/platform-express": "^10.4.15",
|
|
20
|
+
"@supabase/supabase-js": "2.95.3",
|
|
21
|
+
"better-sqlite3": "^11.9.1",
|
|
22
|
+
"dotenv": "^17.2.3",
|
|
23
|
+
"drizzle-kit": "^0.31.8",
|
|
24
|
+
"drizzle-orm": "^0.45.1",
|
|
25
|
+
"drizzle-zod": "^0.8.3",
|
|
26
|
+
"express": "5.2.1",
|
|
27
|
+
"pg": "^8.16.3",
|
|
28
|
+
"rxjs": "^7.8.1",
|
|
29
|
+
"zod": "^4.3.5"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@nestjs/cli": "^10.4.9",
|
|
33
|
+
"@nestjs/schematics": "^10.2.3",
|
|
34
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
35
|
+
"@types/express": "5.0.6",
|
|
36
|
+
"@types/node": "^22.10.2",
|
|
37
|
+
"drizzle-kit": "^0.31.8",
|
|
38
|
+
"typescript": "^5.7.2"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
const description = `Taro(小程序 + H5):\`licos init \${
|
|
10
|
+
const description = `Taro(小程序 + H5):\`licos init \${LICOS_PROJECT_PATH} --template taro\`
|
|
11
11
|
- 适用:微信小程序、H5 跨端应用
|
|
12
12
|
- 前后端分离架构:Taro 4 + NestJS
|
|
13
13
|
- 支持微信小程序和 H5 双端构建
|
|
@@ -26,6 +26,31 @@
|
|
|
26
26
|
"additionalProperties": false
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
"name": "workflow",
|
|
31
|
+
"description": "Workflow(工作流项目):`licos init ${LICOS_PROJECT_PATH} --template workflow`\n- 适用:Python + LangGraph 工作流项目\n- 使用 licos-agent-runtime 提供 /run、/stream_run、/cancel、/node_run、/graph_parameter 接口\n- /stream_run 输出 workflow_start、node_start、node_end、workflow_end、error、ping 事件",
|
|
32
|
+
"location": "./workflow",
|
|
33
|
+
"paramsSchema": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"properties": {
|
|
36
|
+
"appName": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"minLength": 1,
|
|
39
|
+
"pattern": "^[a-z0-9-]+$",
|
|
40
|
+
"description": "Application name (lowercase, alphanumeric and hyphens only)"
|
|
41
|
+
},
|
|
42
|
+
"port": {
|
|
43
|
+
"type": "number",
|
|
44
|
+
"default": 5000,
|
|
45
|
+
"minimum": 1024,
|
|
46
|
+
"maximum": 65535,
|
|
47
|
+
"description": "Development server port"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"required": [],
|
|
51
|
+
"additionalProperties": false
|
|
52
|
+
}
|
|
53
|
+
},
|
|
29
54
|
{
|
|
30
55
|
"name": "expo",
|
|
31
56
|
"description": "Expo template for React Native applications",
|
|
@@ -53,7 +78,7 @@
|
|
|
53
78
|
},
|
|
54
79
|
{
|
|
55
80
|
"name": "native-static",
|
|
56
|
-
"description": "Native Static(纯静态):`licos init ${
|
|
81
|
+
"description": "Native Static(纯静态):`licos init ${LICOS_PROJECT_PATH} --template native-static`\n- 适用:纯静态 HTML/CSS/JS 项目、静态网站\n- 使用 Python http.server 作为开发服务器\n- 不需要 Node.js 环境,适合简单静态内容",
|
|
57
82
|
"location": "./native-static",
|
|
58
83
|
"paramsSchema": {
|
|
59
84
|
"type": "object",
|
|
@@ -64,7 +89,7 @@
|
|
|
64
89
|
},
|
|
65
90
|
{
|
|
66
91
|
"name": "nextjs",
|
|
67
|
-
"description": "Next.js(复杂项目):`licos init ${
|
|
92
|
+
"description": "Next.js(复杂项目):`licos init ${LICOS_PROJECT_PATH} --template nextjs`\n- 适用:全栈应用、复杂多页面等复杂项目\n- 使用默认nextjs项目规范\n - **目录规范**: 默认开启src目录(打开--src-dir选项):项目文件(如 app 目录、pages 目录、components 等)初始化到 src/ 目录下。\n - **项目理解加速**:初始可以依赖项目下 `package.json` 文件理解项目类型,如果没有或无法理解退化成阅读其他文件。\n - **UI设计与组件规范**:Next.js项目**必须默认**采用 shadcn/ui 风格和规范,`shadcn/ui`组件默认完整的预装在`src/components/ui/`目录下",
|
|
68
93
|
"location": "./nextjs",
|
|
69
94
|
"paramsSchema": {
|
|
70
95
|
"type": "object",
|
|
@@ -89,7 +114,7 @@
|
|
|
89
114
|
},
|
|
90
115
|
{
|
|
91
116
|
"name": "nuxt-vue",
|
|
92
|
-
"description": "Nuxt.js(服务端 + Vue):`licos init ${
|
|
117
|
+
"description": "Nuxt.js(服务端 + Vue):`licos init ${LICOS_PROJECT_PATH} --template nuxt-vue`\n- 适用:全栈应用、需要服务端接口能力的 Vue 项目\n- 特点:\n - **服务端能力**:内置服务端 API 路由,可直接创建后端接口\n - **Vue 3**:基于最新的 Vue 3 Composition API\n - **Vite**:使用 Vite 作为构建工具,开发体验极佳\n - **TypeScript**:完整的 TypeScript 支持\n - **文件路由**:基于文件系统的自动路由\n - **项目理解加速**:可依赖项目下 `package.json` 和 `nuxt.config.ts` 理解项目配置",
|
|
93
118
|
"location": "./nuxt-vue",
|
|
94
119
|
"paramsSchema": {
|
|
95
120
|
"type": "object",
|
|
@@ -121,7 +146,7 @@
|
|
|
121
146
|
},
|
|
122
147
|
{
|
|
123
148
|
"name": "taro",
|
|
124
|
-
"description": "Taro(小程序 + H5):`licos init ${
|
|
149
|
+
"description": "Taro(小程序 + H5):`licos init ${LICOS_PROJECT_PATH} --template taro`\n- 适用:微信小程序、H5 跨端应用\n- 前后端分离架构:Taro 4 + NestJS\n- 支持微信小程序和 H5 双端构建\n- 使用 TailwindCSS + weapp-tailwindcss 实现跨端样式",
|
|
125
150
|
"location": "./taro",
|
|
126
151
|
"paramsSchema": {
|
|
127
152
|
"type": "object",
|
|
@@ -153,7 +178,7 @@
|
|
|
153
178
|
},
|
|
154
179
|
{
|
|
155
180
|
"name": "vite",
|
|
156
|
-
"description": "Vite(简单项目):`licos init ${
|
|
181
|
+
"description": "Vite(简单项目):`licos init ${LICOS_PROJECT_PATH} --template vite`\n- 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。",
|
|
157
182
|
"location": "./vite",
|
|
158
183
|
"paramsSchema": {
|
|
159
184
|
"type": "object",
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "<%= appName %>",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "Vanilla TypeScript application with Express + Vite (HTML + CSS + TS + Node API)",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "bash ./scripts/build.sh",
|
|
7
|
-
"dev": "bash ./scripts/dev.sh",
|
|
8
|
-
"preinstall": "npx only-allow pnpm",
|
|
9
|
-
"lint": "eslint",
|
|
10
|
-
"start": "bash ./scripts/start.sh",
|
|
11
|
-
"ts-check": "tsc -p tsconfig.json"
|
|
12
|
-
},
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"@kmlckj/licos-platform-sdk": "0.6.0",
|
|
15
|
-
"@supabase/supabase-js": "2.95.3",
|
|
16
|
-
"dotenv": "^17.2.3",
|
|
17
|
-
"express": "^4.21.2"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@types/express": "^5.0.0",
|
|
21
|
-
"@types/node": "^22.10.5",
|
|
22
|
-
"autoprefixer": "^10.4.20",
|
|
23
|
-
"esbuild": "^0.24.2",
|
|
24
|
-
"eslint": "^9",
|
|
25
|
-
"only-allow": "^1.2.2",
|
|
26
|
-
"postcss": "^8.4.49",
|
|
27
|
-
"tailwindcss": "^3.4.17",
|
|
28
|
-
"tsup": "^8.3.5",
|
|
29
|
-
"tsx": "^4.19.2",
|
|
30
|
-
"typescript": "^5.6.0",
|
|
31
|
-
"typescript-eslint": "^8",
|
|
32
|
-
"vite": "^7.2.4"
|
|
33
|
-
},
|
|
34
|
-
"packageManager": "pnpm@9.0.0",
|
|
35
|
-
"engines": {
|
|
36
|
-
"pnpm": ">=9.0.0"
|
|
37
|
-
},
|
|
38
|
-
"pnpm": {
|
|
39
|
-
"overrides": {
|
|
40
|
-
"esbuild": "^0.27.2",
|
|
41
|
-
"is-generator-function": "1.0.10"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= appName %>",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Vanilla TypeScript application with Express + Vite (HTML + CSS + TS + Node API)",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "bash ./scripts/build.sh",
|
|
7
|
+
"dev": "bash ./scripts/dev.sh",
|
|
8
|
+
"preinstall": "npx only-allow pnpm",
|
|
9
|
+
"lint": "eslint",
|
|
10
|
+
"start": "bash ./scripts/start.sh",
|
|
11
|
+
"ts-check": "tsc -p tsconfig.json"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@kmlckj/licos-platform-sdk": "0.6.0",
|
|
15
|
+
"@supabase/supabase-js": "2.95.3",
|
|
16
|
+
"dotenv": "^17.2.3",
|
|
17
|
+
"express": "^4.21.2"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/express": "^5.0.0",
|
|
21
|
+
"@types/node": "^22.10.5",
|
|
22
|
+
"autoprefixer": "^10.4.20",
|
|
23
|
+
"esbuild": "^0.24.2",
|
|
24
|
+
"eslint": "^9",
|
|
25
|
+
"only-allow": "^1.2.2",
|
|
26
|
+
"postcss": "^8.4.49",
|
|
27
|
+
"tailwindcss": "^3.4.17",
|
|
28
|
+
"tsup": "^8.3.5",
|
|
29
|
+
"tsx": "^4.19.2",
|
|
30
|
+
"typescript": "^5.6.0",
|
|
31
|
+
"typescript-eslint": "^8",
|
|
32
|
+
"vite": "^7.2.4"
|
|
33
|
+
},
|
|
34
|
+
"packageManager": "pnpm@9.0.0",
|
|
35
|
+
"engines": {
|
|
36
|
+
"pnpm": ">=9.0.0"
|
|
37
|
+
},
|
|
38
|
+
"pnpm": {
|
|
39
|
+
"overrides": {
|
|
40
|
+
"esbuild": "^0.27.2",
|
|
41
|
+
"is-generator-function": "1.0.10"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
set -Eeuo pipefail
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
PROJECT_DIR="${LICOS_PROJECT_PATH:-${LICOS_WORKSPACE_PATH:-$(pwd)}}"
|
|
5
5
|
|
|
6
|
-
cd "${
|
|
6
|
+
cd "${PROJECT_DIR}"
|
|
7
7
|
|
|
8
8
|
echo "Installing dependencies..."
|
|
9
9
|
pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
@@ -4,15 +4,15 @@ set -Eeuo pipefail
|
|
|
4
4
|
<% if (process.env.NODE_ENV === 'test') { %>
|
|
5
5
|
# 测试环境:支持环境变量覆盖端口
|
|
6
6
|
PORT="${PORT:-<%= port %>}"
|
|
7
|
-
|
|
7
|
+
PROJECT_DIR="${LICOS_PROJECT_PATH:-${LICOS_WORKSPACE_PATH:-$(pwd)}}"
|
|
8
8
|
DEPLOY_RUN_PORT="${DEPLOY_RUN_PORT:-${PORT}}"
|
|
9
9
|
<% } else { %>
|
|
10
10
|
PORT=<%= port %>
|
|
11
|
-
|
|
11
|
+
PROJECT_DIR="${LICOS_PROJECT_PATH:-${LICOS_WORKSPACE_PATH:-$(pwd)}}"
|
|
12
12
|
DEPLOY_RUN_PORT=<%= port %>
|
|
13
13
|
<% } %>
|
|
14
14
|
|
|
15
|
-
cd "${
|
|
15
|
+
cd "${PROJECT_DIR}"
|
|
16
16
|
|
|
17
17
|
kill_port_if_listening() {
|
|
18
18
|
local pids
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
set -Eeuo pipefail
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
PROJECT_DIR="${LICOS_PROJECT_PATH:-${LICOS_WORKSPACE_PATH:-$(pwd)}}"
|
|
5
5
|
|
|
6
|
-
cd "${
|
|
6
|
+
cd "${PROJECT_DIR}"
|
|
7
7
|
|
|
8
8
|
echo "Installing dependencies..."
|
|
9
9
|
pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
set -Eeuo pipefail
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
PROJECT_DIR="${LICOS_PROJECT_PATH:-${LICOS_WORKSPACE_PATH:-$(pwd)}}"
|
|
5
5
|
<% if (process.env.NODE_ENV === 'test') { %>
|
|
6
6
|
# 测试环境:支持环境变量覆盖端口
|
|
7
7
|
PORT="${PORT:-<%= port %>}"
|
|
@@ -12,7 +12,7 @@ DEPLOY_RUN_PORT="${DEPLOY_RUN_PORT:-$PORT}"
|
|
|
12
12
|
<% } %>
|
|
13
13
|
|
|
14
14
|
start_service() {
|
|
15
|
-
cd "${
|
|
15
|
+
cd "${PROJECT_DIR}"
|
|
16
16
|
echo "Starting express production server on port ${DEPLOY_RUN_PORT}..."
|
|
17
17
|
PORT=$DEPLOY_RUN_PORT node dist-server/server.js
|
|
18
18
|
}
|
|
@@ -44,7 +44,7 @@ export const paramsSchema = {
|
|
|
44
44
|
additionalProperties: false,
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
const description = `Vite(简单项目):\`licos init \${
|
|
47
|
+
const description = `Vite(简单项目):\`licos init \${LICOS_PROJECT_PATH} --template vite\`
|
|
48
48
|
- 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。`;
|
|
49
49
|
|
|
50
50
|
const config = {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
entrypoint = "src/main.py"
|
|
3
|
+
requires = ["python-3.12"]
|
|
4
|
+
template = "workflow"
|
|
5
|
+
|
|
6
|
+
[dev]
|
|
7
|
+
build = ["bash", "scripts/setup.sh"]
|
|
8
|
+
run = ["bash", "scripts/http_run.sh", "-p", "<%= port %>"]
|
|
9
|
+
deps = ["git"]
|
|
10
|
+
|
|
11
|
+
[deploy]
|
|
12
|
+
build = ["bash", "scripts/setup.sh"]
|
|
13
|
+
run = ["bash", "scripts/http_run.sh", "-p", "<%= port %>"]
|
|
14
|
+
deps = ["git"]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# <%= appName %>
|
|
2
|
+
|
|
3
|
+
LICOS 工作流项目模板,基于 Python、LangGraph 和 `licos-agent-runtime`。
|
|
4
|
+
|
|
5
|
+
## 目录
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
.
|
|
9
|
+
├── .licos
|
|
10
|
+
├── pyproject.toml
|
|
11
|
+
├── scripts/
|
|
12
|
+
└── src/
|
|
13
|
+
├── main.py
|
|
14
|
+
└── graphs/
|
|
15
|
+
└── graph.py
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 本地运行
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
bash scripts/setup.sh
|
|
22
|
+
bash scripts/http_run.sh -p <%= port %>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## HTTP 接口
|
|
26
|
+
|
|
27
|
+
- `GET /health`
|
|
28
|
+
- `POST /run`
|
|
29
|
+
- `POST /stream_run`
|
|
30
|
+
- `POST /cancel/{run_id}`
|
|
31
|
+
- `POST /node_run/{node_id}`
|
|
32
|
+
- `GET /graph_parameter`
|
|
33
|
+
|
|
34
|
+
`POST /stream_run` 使用工作流流式协议,事件类型包括 `workflow_start`、`workflow_end`、`node_start`、`node_end`、`error`、`ping`。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "<%= appName %>"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "LICOS LangGraph workflow project"
|
|
5
|
+
requires-python = ">=3.12"
|
|
6
|
+
dependencies = [
|
|
7
|
+
"licos-agent-runtime>=0.2.1",
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
[tool.uv]
|
|
11
|
+
[[tool.uv.index]]
|
|
12
|
+
url = "https://mirrors.aliyun.com/pypi/simple/"
|
|
13
|
+
default = true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
licos-agent-runtime>=0.2.1
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -eo pipefail
|
|
3
|
+
|
|
4
|
+
PROJECT_DIR="${LICOS_PROJECT_PATH:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
|
|
5
|
+
PORT="${PORT:-<%= port %>}"
|
|
6
|
+
HOST="${HOST:-0.0.0.0}"
|
|
7
|
+
|
|
8
|
+
while [ "$#" -gt 0 ]; do
|
|
9
|
+
case "$1" in
|
|
10
|
+
-p|--port)
|
|
11
|
+
PORT="$2"
|
|
12
|
+
shift 2
|
|
13
|
+
;;
|
|
14
|
+
--host)
|
|
15
|
+
HOST="$2"
|
|
16
|
+
shift 2
|
|
17
|
+
;;
|
|
18
|
+
*)
|
|
19
|
+
shift
|
|
20
|
+
;;
|
|
21
|
+
esac
|
|
22
|
+
done
|
|
23
|
+
|
|
24
|
+
cd "$PROJECT_DIR"
|
|
25
|
+
|
|
26
|
+
export LICOS_PROJECT_PATH="$PROJECT_DIR"
|
|
27
|
+
export AGENT_PROJECT_TYPE="${AGENT_PROJECT_TYPE:-WORKFLOW}"
|
|
28
|
+
|
|
29
|
+
exec python -m licos_agent_runtime --mode http --host "$HOST" --port "$PORT"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -eo pipefail
|
|
3
|
+
|
|
4
|
+
PROJECT_DIR="${LICOS_PROJECT_PATH:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
|
|
5
|
+
INPUT="${1:-{\"topic\":\"LICOS 工作流\"}}"
|
|
6
|
+
|
|
7
|
+
cd "$PROJECT_DIR"
|
|
8
|
+
|
|
9
|
+
export LICOS_PROJECT_PATH="$PROJECT_DIR"
|
|
10
|
+
export AGENT_PROJECT_TYPE="${AGENT_PROJECT_TYPE:-WORKFLOW}"
|
|
11
|
+
|
|
12
|
+
python -m licos_agent_runtime --mode flow --input "$INPUT"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -eo pipefail
|
|
3
|
+
|
|
4
|
+
PROJECT_DIR="${LICOS_PROJECT_PATH:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
|
|
5
|
+
PACKAGE_NAME="${PACKAGE_NAME:-<%= appName %>.zip}"
|
|
6
|
+
|
|
7
|
+
cd "$PROJECT_DIR"
|
|
8
|
+
|
|
9
|
+
rm -f "$PACKAGE_NAME"
|
|
10
|
+
zip -r "$PACKAGE_NAME" . \
|
|
11
|
+
-x ".venv/*" \
|
|
12
|
+
-x "venv/*" \
|
|
13
|
+
-x "__pycache__/*" \
|
|
14
|
+
-x "*.pyc" \
|
|
15
|
+
-x ".git/*" \
|
|
16
|
+
-x ".pytest_cache/*" \
|
|
17
|
+
-x ".mypy_cache/*" \
|
|
18
|
+
-x ".ruff_cache/*" \
|
|
19
|
+
-x "dist/*" \
|
|
20
|
+
-x "build/*" \
|
|
21
|
+
-x "*.egg-info/*"
|
|
22
|
+
|
|
23
|
+
echo "$PROJECT_DIR/$PACKAGE_NAME"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -eo pipefail
|
|
3
|
+
|
|
4
|
+
PROJECT_DIR="${LICOS_PROJECT_PATH:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
|
|
5
|
+
cd "$PROJECT_DIR"
|
|
6
|
+
|
|
7
|
+
ensure_pip_config() {
|
|
8
|
+
mkdir -p "${HOME:-/root}/.pip"
|
|
9
|
+
cat > "${HOME:-/root}/.pip/pip.conf" <<'EOF'
|
|
10
|
+
[global]
|
|
11
|
+
index-url = https://mirrors.aliyun.com/pypi/simple/
|
|
12
|
+
extra-index-url = https://pypi.org/simple/
|
|
13
|
+
trusted-host = mirrors.aliyun.com
|
|
14
|
+
EOF
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ensure_pip_config
|
|
18
|
+
|
|
19
|
+
PIP_ARGS=(--no-cache-dir)
|
|
20
|
+
if python -m pip install --help 2>/dev/null | grep -q -- "--break-system-packages"; then
|
|
21
|
+
PIP_ARGS+=(--break-system-packages)
|
|
22
|
+
fi
|
|
23
|
+
if [ -n "${PIP_TARGET:-}" ]; then
|
|
24
|
+
PIP_ARGS+=(--target "$PIP_TARGET")
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
if command -v uv >/dev/null 2>&1 && [ -f "pyproject.toml" ]; then
|
|
28
|
+
if [ -n "${PIP_TARGET:-}" ]; then
|
|
29
|
+
echo "[setup] Deploy mode (uv): installing to PIP_TARGET=$PIP_TARGET"
|
|
30
|
+
uv export --frozen --no-hashes --no-dev | uv pip install --no-cache --target "$PIP_TARGET" -r -
|
|
31
|
+
else
|
|
32
|
+
echo "[setup] Dev mode (uv): syncing .venv"
|
|
33
|
+
if [ -f "uv.lock" ]; then
|
|
34
|
+
uv sync --frozen || uv sync
|
|
35
|
+
else
|
|
36
|
+
uv sync
|
|
37
|
+
fi
|
|
38
|
+
fi
|
|
39
|
+
elif [ -f "requirements.txt" ]; then
|
|
40
|
+
echo "[setup] Fallback mode (pip): installing from requirements.txt"
|
|
41
|
+
python -m pip install "${PIP_ARGS[@]}" -r requirements.txt
|
|
42
|
+
else
|
|
43
|
+
echo "[setup] no pyproject.toml or requirements.txt found, skipping install"
|
|
44
|
+
fi
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Workflow graph package."""
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, TypedDict
|
|
4
|
+
|
|
5
|
+
from langgraph.graph import END, START, StateGraph
|
|
6
|
+
from pydantic import BaseModel, Field
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class WorkflowInput(BaseModel):
|
|
10
|
+
topic: str = Field(default="", description="工作流输入主题")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class WorkflowOutput(BaseModel):
|
|
14
|
+
answer: str = Field(description="工作流输出结果")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class WorkflowState(TypedDict, total=False):
|
|
18
|
+
topic: str
|
|
19
|
+
answer: str
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def generate_answer(state: WorkflowState) -> WorkflowState:
|
|
23
|
+
topic = str(state.get("topic") or "").strip() or "LICOS 工作流"
|
|
24
|
+
return {"answer": f"已执行工作流,输入主题:{topic}"}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def create_graph(_ctx: Any = None) -> Any:
|
|
28
|
+
builder = StateGraph(
|
|
29
|
+
WorkflowState,
|
|
30
|
+
input_schema=WorkflowInput,
|
|
31
|
+
output_schema=WorkflowOutput,
|
|
32
|
+
)
|
|
33
|
+
builder.add_node("generate_answer", generate_answer, metadata={"title": "生成结果"})
|
|
34
|
+
builder.add_edge(START, "generate_answer")
|
|
35
|
+
builder.add_edge("generate_answer", END)
|
|
36
|
+
return builder.compile()
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const description = `Workflow(工作流项目):\`licos init \${LICOS_PROJECT_PATH} --template workflow\`
|
|
2
|
+
- 适用:Python + LangGraph 工作流项目
|
|
3
|
+
- 使用 licos-agent-runtime 提供 /run、/stream_run、/cancel、/node_run、/graph_parameter 接口
|
|
4
|
+
- /stream_run 输出 workflow_start、node_start、node_end、workflow_end、error、ping 事件`;
|
|
5
|
+
|
|
6
|
+
const config = {
|
|
7
|
+
description,
|
|
8
|
+
paramsSchema: {
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
appName: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
minLength: 1,
|
|
14
|
+
pattern: '^[a-z0-9-]+$',
|
|
15
|
+
description: 'Application name (lowercase, alphanumeric and hyphens only)',
|
|
16
|
+
},
|
|
17
|
+
port: {
|
|
18
|
+
type: 'number',
|
|
19
|
+
default: 5000,
|
|
20
|
+
minimum: 1024,
|
|
21
|
+
maximum: 65535,
|
|
22
|
+
description: 'Development server port',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: [],
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
},
|
|
28
|
+
defaultParams: {
|
|
29
|
+
appName: 'workflow-project',
|
|
30
|
+
port: 5000,
|
|
31
|
+
},
|
|
32
|
+
onBeforeRender: async context => {
|
|
33
|
+
console.log(`Creating LICOS Workflow project: ${context.appName}`);
|
|
34
|
+
return context;
|
|
35
|
+
},
|
|
36
|
+
onAfterRender: async (_context, outputPath) => {
|
|
37
|
+
console.log(`\nWorkflow project created at: ${outputPath}`);
|
|
38
|
+
console.log('\nConfiguration:');
|
|
39
|
+
console.log(' - Runtime: licos-agent-runtime');
|
|
40
|
+
console.log(' - Framework: LangGraph');
|
|
41
|
+
console.log(` - Port: ${_context.port}`);
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default config;
|
package/lib/cli.js
CHANGED
|
@@ -2107,7 +2107,7 @@ const EventBuilder = {
|
|
|
2107
2107
|
};
|
|
2108
2108
|
|
|
2109
2109
|
var name = "@kmlckj/licos-ai-cli";
|
|
2110
|
-
var version = "0.0.
|
|
2110
|
+
var version = "0.0.11";
|
|
2111
2111
|
var description = "LICOS AI coding workspace CLI - project template engine and dev tools";
|
|
2112
2112
|
var license = "MIT";
|
|
2113
2113
|
var author = "kmlckj";
|