@kmlckj/licos-ai-cli 0.0.31 → 0.0.34

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.
Files changed (37) hide show
  1. package/lib/__templates__/agent/README.md +58 -5
  2. package/lib/__templates__/agent/pyproject.toml +1 -1
  3. package/lib/__templates__/agent/requirements.txt +1 -1
  4. package/lib/__templates__/expo/.licosproj/scripts/prod_build.sh +39 -0
  5. package/lib/__templates__/expo/pnpm-lock.yaml +5 -5
  6. package/lib/__templates__/expo/server/package.json +1 -1
  7. package/lib/__templates__/expo/server/src/index.ts +12 -0
  8. package/lib/__templates__/native-static/.licos +2 -2
  9. package/lib/__templates__/nextjs/next.config.ts +10 -0
  10. package/lib/__templates__/nextjs/package.json +1 -1
  11. package/lib/__templates__/nextjs/pnpm-lock.yaml +5 -5
  12. package/lib/__templates__/nuxt-vue/nuxt.config.ts +32 -22
  13. package/lib/__templates__/nuxt-vue/package.json +21 -15
  14. package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +456 -465
  15. package/lib/__templates__/nuxt-vue/scripts/build.sh +10 -0
  16. package/lib/__templates__/nuxt-vue/scripts/start.sh +10 -0
  17. package/lib/__templates__/taro/.licosproj/scripts/deploy_run.sh +1 -1
  18. package/lib/__templates__/taro/AGENTS.md +7 -0
  19. package/lib/__templates__/taro/README.md +4 -3
  20. package/lib/__templates__/taro/config/index.ts +1 -1
  21. package/lib/__templates__/taro/eslint.config.mjs +1 -1
  22. package/lib/__templates__/taro/package.json +2 -1
  23. package/lib/__templates__/taro/pnpm-lock.yaml +47 -1983
  24. package/lib/__templates__/taro/server/package.json +4 -13
  25. package/lib/__templates__/taro/server/src/main.ts +17 -0
  26. package/lib/__templates__/taro/src/presets/env.ts +1 -1
  27. package/lib/__templates__/taro/types/global.d.ts +1 -2
  28. package/lib/__templates__/vite/package.json +1 -1
  29. package/lib/__templates__/vite/pnpm-lock.yaml +5 -5
  30. package/lib/__templates__/vite/scripts/build.sh +1 -0
  31. package/lib/__templates__/vite/server/vite.ts +5 -2
  32. package/lib/__templates__/vite/vite.config.ts +7 -0
  33. package/lib/__templates__/workflow/README.md +11 -1
  34. package/lib/__templates__/workflow/pyproject.toml +1 -1
  35. package/lib/__templates__/workflow/requirements.txt +1 -1
  36. package/lib/cli.js +20 -1
  37. package/package.json +1 -1
@@ -31,14 +31,67 @@ bash scripts/http_run.sh -p <%= port %>
31
31
  - `GET /health`
32
32
  - `POST /run`
33
33
  - `POST /stream_run`
34
- - `POST /cancel/{run_id}`
35
- - `POST /node_run/{node_id}`
36
- - `GET /graph_parameter`
37
34
  - `GET /agent/config`
38
- - `GET /agent/canvas`
39
- - `POST /agent/canvas`
40
35
  - `POST /v1/chat/completions`
41
36
 
37
+ `POST /run` 的 Body 是智能体状态输入,常用:
38
+
39
+ ```json
40
+ {
41
+ "input": "请分析这个需求"
42
+ }
43
+ ```
44
+
45
+ 也可以传 OpenAI-style `messages`:
46
+
47
+ ```json
48
+ {
49
+ "messages": [
50
+ {
51
+ "role": "user",
52
+ "content": "请分析这个需求"
53
+ }
54
+ ]
55
+ }
56
+ ```
57
+
58
+ Body 可以同时带 `attachments`、`files`、`references` 等业务字段;运行时会作为图状态传入,具体解释由智能体项目代码决定。
59
+
60
+ `POST /stream_run` 支持 `input` / `messages`,也兼容平台 `content.query.prompt` 包装;文本和附件会归一成智能体图输入,`references` 等业务字段会保留并传给智能体图。`content.query.prompt` 内的 `upload_file` 会从已上传文件 URL 下载到项目附件目录,默认是 `/workspace/projects/assets`,并写入 `attachments` 和 `files`。
61
+
62
+ ```json
63
+ {
64
+ "content": {
65
+ "query": {
66
+ "prompt": [
67
+ {
68
+ "type": "text",
69
+ "content": {
70
+ "text": "请结合附件分析需求"
71
+ }
72
+ },
73
+ {
74
+ "type": "upload_file",
75
+ "content": {
76
+ "upload_file": {
77
+ "file_name": "spec.md",
78
+ "url": "https://files.example.com/spec.md?sign=xxx",
79
+ "mime_type": "text/markdown"
80
+ }
81
+ }
82
+ }
83
+ ]
84
+ }
85
+ },
86
+ "references": [
87
+ {
88
+ "type": "file",
89
+ "path": "docs/spec.md"
90
+ }
91
+ ]
92
+ }
93
+ ```
94
+
42
95
  ## 智能体配置
43
96
 
44
97
  `config/agent_llm_config.json` 是平台预览读取智能体配置和工具列表的来源:
@@ -4,7 +4,7 @@ version = "0.1.0"
4
4
  description = "LICOS LangGraph agent project"
5
5
  requires-python = ">=3.12"
6
6
  dependencies = [
7
- "licos-agent-runtime>=0.2.9",
7
+ "licos-agent-runtime>=0.2.10",
8
8
  ]
9
9
 
10
10
  [tool.uv]
@@ -1 +1 @@
1
- licos-agent-runtime>=0.2.9
1
+ licos-agent-runtime>=0.2.10
@@ -40,6 +40,45 @@ fi
40
40
  info "==================== 依赖安装完成!====================\n"
41
41
 
42
42
  info "==================== dist打包 ===================="
43
+ info "开始执行:expo export --platform web (client)"
44
+ rm -rf "$ROOT_DIR/server/public"
45
+ (pushd "$ROOT_DIR/client" > /dev/null && pnpm expo export --platform web --output-dir ../server/public; popd > /dev/null) || error "client web 打包失败"
46
+
47
+ BASE_URL="${BASE_PATH:-/}"
48
+ if [ "${BASE_URL}" != "/" ]; then
49
+ BASE_URL="/$(printf '%s' "${BASE_URL}" | sed 's#^/*##; s#/*$##')/"
50
+ fi
51
+ if [ "${BASE_URL}" != "/" ]; then
52
+ info "重写 Expo Web 静态资源前缀:${BASE_URL}"
53
+ BASE_URL="${BASE_URL}" python3 - <<'PY'
54
+ import os
55
+ from pathlib import Path
56
+
57
+ base = os.environ["BASE_URL"]
58
+ public_dir = Path("server/public")
59
+ replacements = [
60
+ ('"/_expo/', f'"{base}_expo/'),
61
+ ("'/_expo/", f"'{base}_expo/"),
62
+ ('"/assets/', f'"{base}assets/'),
63
+ ("'/assets/", f"'{base}assets/"),
64
+ ('"/favicon.ico"', f'"{base}favicon.ico"'),
65
+ ("'/favicon.ico'", f"'{base}favicon.ico'"),
66
+ ("url(/assets/", f"url({base}assets/"),
67
+ ('url("/assets/', f'url("{base}assets/'),
68
+ ("url('/assets/", f"url('{base}assets/"),
69
+ ]
70
+ for path in public_dir.rglob("*"):
71
+ if path.suffix not in {".html", ".js", ".css"}:
72
+ continue
73
+ text = path.read_text(encoding="utf-8")
74
+ updated = text
75
+ for old, new in replacements:
76
+ updated = updated.replace(old, new)
77
+ if updated != text:
78
+ path.write_text(updated, encoding="utf-8")
79
+ PY
80
+ fi
81
+
43
82
  info "开始执行:pnpm run build (server)"
44
83
  (pushd "$ROOT_DIR/server" > /dev/null && pnpm run build; popd > /dev/null) || error "dist打包失败"
45
84
  info "==================== dist打包完成!====================\n"
@@ -263,8 +263,8 @@ importers:
263
263
  server:
264
264
  dependencies:
265
265
  '@kmlckj/licos-platform-sdk':
266
- specifier: 0.6.2
267
- version: 0.6.2
266
+ specifier: 0.6.3
267
+ version: 0.6.3
268
268
  cors:
269
269
  specifier: ^2.8.5
270
270
  version: 2.8.6
@@ -1321,8 +1321,8 @@ packages:
1321
1321
  '@jridgewell/trace-mapping@0.3.31':
1322
1322
  resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
1323
1323
 
1324
- '@kmlckj/licos-platform-sdk@0.6.2':
1325
- resolution: {integrity: sha512-hnHnSjVpih6Z1DL2kGumql0WV7JClmwX9GulqTxfuNX42JHFbvzTq4xHUXtb37bFtFFMWWHzG7ascQFWrheb4w==}
1324
+ '@kmlckj/licos-platform-sdk@0.6.3':
1325
+ resolution: {integrity: sha512-BzgGAa+ppt2e/LP6053GHpLVXrigyeAV0ZPt73Q6inaJay6tvEMxhSvQitg5wJ8V4uXCAYVCK4gFrGqTAoYODA==}
1326
1326
 
1327
1327
  '@langchain/core@1.1.17':
1328
1328
  resolution: {integrity: sha512-g7/kcKbKEwNZSyyT7aT0utxn7wTOtKErqz0cL6VjrV4v/aOb9g+dKcfj17YkSm42YQmJp/rB2IXGc17vQPEBqA==}
@@ -7562,7 +7562,7 @@ snapshots:
7562
7562
  '@jridgewell/resolve-uri': 3.1.2
7563
7563
  '@jridgewell/sourcemap-codec': 1.5.5
7564
7564
 
7565
- '@kmlckj/licos-platform-sdk@0.6.2': {}
7565
+ '@kmlckj/licos-platform-sdk@0.6.3': {}
7566
7566
 
7567
7567
  '@langchain/core@1.1.17(openai@6.16.0(ws@8.19.0)(zod@4.3.6))':
7568
7568
  dependencies:
@@ -10,7 +10,7 @@
10
10
  "lint": "tsc --noEmit"
11
11
  },
12
12
  "dependencies": {
13
- "@kmlckj/licos-platform-sdk": "0.6.2",
13
+ "@kmlckj/licos-platform-sdk": "0.6.3",
14
14
  "cors": "^2.8.5",
15
15
  "dayjs": "^1.11.19",
16
16
  "dotenv": "^17.2.3",
@@ -1,5 +1,7 @@
1
1
  import express from "express";
2
2
  import cors from "cors";
3
+ import fs from "fs";
4
+ import path from "path";
3
5
 
4
6
  const app = express();
5
7
  const port = process.env.PORT || 5001;
@@ -14,6 +16,16 @@ app.get('/api/v1/health', (req, res) => {
14
16
  res.status(200).json({ status: 'ok' });
15
17
  });
16
18
 
19
+ const publicDir = path.resolve(process.cwd(), "public");
20
+ if (fs.existsSync(publicDir)) {
21
+ app.use(express.static(publicDir));
22
+ app.get("*", (req, res, next) => {
23
+ if (req.path.startsWith("/api/")) {
24
+ return next();
25
+ }
26
+ res.sendFile(path.join(publicDir, "index.html"));
27
+ });
28
+ }
17
29
 
18
30
  app.listen(port, () => {
19
31
  console.log(`Server listening at http://localhost:${port}/`);
@@ -3,9 +3,9 @@ entrypoint = "index.html"
3
3
  requires = ["python-3.12"]
4
4
 
5
5
  [dev]
6
- build = []
6
+ build = ["sh", "-lc", "true"]
7
7
  run = ["python", "-m", "http.server", "5000", "--bind", "0.0.0.0"]
8
8
 
9
9
  [deploy]
10
- build = []
10
+ build = ["sh", "-lc", "true"]
11
11
  run = ["python", "-m", "http.server", "5000", "--bind", "0.0.0.0"]
@@ -1,6 +1,16 @@
1
1
  import type { NextConfig } from 'next';
2
2
 
3
+ function normalizeBasePath(value?: string): string | undefined {
4
+ const trimmed = value?.trim();
5
+ if (!trimmed || trimmed === '/') return undefined;
6
+ return `/${trimmed.replace(/^\/+|\/+$/g, '')}`;
7
+ }
8
+
9
+ const basePath =
10
+ process.env.LICOS_PROJECT_ENV === 'PROD' ? normalizeBasePath(process.env.BASE_PATH) : undefined;
11
+
3
12
  const nextConfig: NextConfig = {
13
+ ...(basePath ? { basePath } : {}),
4
14
  // outputFileTracingRoot: path.resolve(__dirname, '../../'), // Uncomment and add 'import path from "path"' if needed
5
15
  /* config options here */
6
16
  allowedDevOrigins: ['*.dev.licos.local'],
@@ -14,7 +14,7 @@
14
14
  "ts-check": "tsc -p tsconfig.json"
15
15
  },
16
16
  "dependencies": {
17
- "@kmlckj/licos-platform-sdk": "0.6.2",
17
+ "@kmlckj/licos-platform-sdk": "0.6.3",
18
18
  "@aws-sdk/client-s3": "^3.958.0",
19
19
  "@aws-sdk/lib-storage": "^3.958.0",
20
20
  "@hookform/resolvers": "^5.2.2",
@@ -18,8 +18,8 @@ importers:
18
18
  specifier: ^5.2.2
19
19
  version: 5.2.2(react-hook-form@7.71.1(react@19.2.3))
20
20
  '@kmlckj/licos-platform-sdk':
21
- specifier: 0.6.2
22
- version: 0.6.2
21
+ specifier: 0.6.3
22
+ version: 0.6.3
23
23
  '@radix-ui/react-accordion':
24
24
  specifier: ^1.2.12
25
25
  version: 1.2.12(@types/react-dom@19.2.3(@types/react@19.2.10))(@types/react@19.2.10)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
@@ -1331,8 +1331,8 @@ packages:
1331
1331
  '@jridgewell/trace-mapping@0.3.31':
1332
1332
  resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
1333
1333
 
1334
- '@kmlckj/licos-platform-sdk@0.6.2':
1335
- resolution: {integrity: sha512-hnHnSjVpih6Z1DL2kGumql0WV7JClmwX9GulqTxfuNX42JHFbvzTq4xHUXtb37bFtFFMWWHzG7ascQFWrheb4w==}
1334
+ '@kmlckj/licos-platform-sdk@0.6.3':
1335
+ resolution: {integrity: sha512-BzgGAa+ppt2e/LP6053GHpLVXrigyeAV0ZPt73Q6inaJay6tvEMxhSvQitg5wJ8V4uXCAYVCK4gFrGqTAoYODA==}
1336
1336
 
1337
1337
  '@modelcontextprotocol/sdk@1.25.3':
1338
1338
  resolution: {integrity: sha512-vsAMBMERybvYgKbg/l4L1rhS7VXV1c0CtyJg72vwxONVX0l4ZfKVAnZEWTQixJGTzKnELjQ59e4NbdFDALRiAQ==}
@@ -7126,7 +7126,7 @@ snapshots:
7126
7126
  '@jridgewell/resolve-uri': 3.1.2
7127
7127
  '@jridgewell/sourcemap-codec': 1.5.5
7128
7128
 
7129
- '@kmlckj/licos-platform-sdk@0.6.2': {}
7129
+ '@kmlckj/licos-platform-sdk@0.6.3': {}
7130
7130
 
7131
7131
  '@modelcontextprotocol/sdk@1.25.3(@cfworker/json-schema@4.1.1)(hono@4.11.7)(zod@3.25.76)':
7132
7132
  dependencies:
@@ -5,6 +5,17 @@ import { dirname, resolve } from 'path';
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = dirname(__filename);
7
7
 
8
+ function normalizeBaseURL(value?: string): string {
9
+ const trimmed = value?.trim();
10
+ if (!trimmed || trimmed === '/') return '/';
11
+ return `/${trimmed.replace(/^\/+|\/+$/g, '')}/`;
12
+ }
13
+
14
+ const publicBaseURL =
15
+ process.env.LICOS_PROJECT_ENV === 'PROD'
16
+ ? normalizeBaseURL(process.env.NUXT_PUBLIC_BASE_URL || process.env.BASE_PATH)
17
+ : '/';
18
+
8
19
  export default defineNuxtConfig({
9
20
  compatibilityDate: '2025-07-15',
10
21
  // Disable devtools in CI/test environments (prevents hanging in headless mode)
@@ -15,6 +26,10 @@ export default defineNuxtConfig({
15
26
 
16
27
  // App head configuration
17
28
  app: {
29
+ // The cluster ingress rewrites /p/{projectId}/... to backend /...
30
+ // Keep Nuxt's server base at / and prefix only generated asset URLs.
31
+ baseURL: '/',
32
+ buildAssetsDir: publicBaseURL === '/' ? '/_nuxt/' : `${publicBaseURL}_nuxt/`,
18
33
  head: {
19
34
  title: '新应用 | LICOS AI',
20
35
  titleTemplate: '%s | LICOS AI',
@@ -55,15 +70,17 @@ export default defineNuxtConfig({
55
70
  },
56
71
 
57
72
  // Nuxt modules
58
- // Skip @nuxt/image in CI (requires sharp binaries not available in headless environments)
59
- modules:
60
- process.env.CI === 'true'
61
- ? ['@nuxtjs/tailwindcss']
62
- : ['@nuxt/image', '@nuxtjs/tailwindcss'],
73
+ modules: ['@nuxt/image', '@nuxtjs/tailwindcss'],
63
74
 
64
75
  // Global CSS
65
76
  css: [resolve(__dirname, 'assets/css/main.css')],
66
77
 
78
+ runtimeConfig: {
79
+ public: {
80
+ baseURL: publicBaseURL,
81
+ },
82
+ },
83
+
67
84
  // Development server configuration
68
85
  devServer: {
69
86
  port: parseInt(process.env.PORT || '<%= port %>', 10),
@@ -107,23 +124,16 @@ export default defineNuxtConfig({
107
124
  },
108
125
  },
109
126
 
110
- // Image optimization (similar to Next.js images config)
111
- // Using @nuxt/image module for image optimization
112
- // https://image.nuxt.com/
113
- // Skip image config in CI (when @nuxt/image module is disabled)
114
- ...(process.env.CI !== 'true' && {
115
- image: {
116
- domains: ['placeholder.local'],
117
- // Remote patterns configuration
118
- remotePatterns: [
119
- {
120
- protocol: 'https',
121
- hostname: 'placeholder.local',
122
- pathname: '/**',
123
- },
124
- ],
125
- },
126
- }),
127
+ image: {
128
+ domains: ['placeholder.local'],
129
+ remotePatterns: [
130
+ {
131
+ protocol: 'https',
132
+ hostname: 'placeholder.local',
133
+ pathname: '/**',
134
+ },
135
+ ],
136
+ },
127
137
 
128
138
  // Security headers (Content Security Policy)
129
139
  nitro: {
@@ -17,21 +17,27 @@
17
17
  "start": "bash ./scripts/start.sh"
18
18
  },
19
19
  "dependencies": {
20
- "@kmlckj/licos-platform-sdk": "0.6.2",
21
- "@nuxt/image": "^1.8.1",
22
- "nuxt": "^4.3.1",
23
- "tailwind-merge": "^2.6.0",
24
- "vue": "^3.5.30",
25
- "vue-router": "^4.6.4"
26
- },
27
- "devDependencies": {
28
- "@nuxtjs/tailwindcss": "^6.14.0",
29
- "@types/node": "^20",
30
- "autoprefixer": "^10.4.20",
31
- "postcss": "^8.4.49",
32
- "tailwindcss": "^3.4.17",
33
- "typescript": "^5"
34
- },
20
+ "@kmlckj/licos-platform-sdk": "0.6.3",
21
+ "@nuxt/image": "2.0.0",
22
+ "nuxt": "4.3.1",
23
+ "tailwind-merge": "2.6.0",
24
+ "vue": "3.5.30",
25
+ "vue-router": "4.6.4"
26
+ },
27
+ "devDependencies": {
28
+ "@nuxtjs/tailwindcss": "6.14.0",
29
+ "@types/node": "20.19.25",
30
+ "autoprefixer": "10.4.20",
31
+ "postcss": "8.4.49",
32
+ "tailwindcss": "3.4.17",
33
+ "typescript": "5.9.3"
34
+ },
35
+ "pnpm": {
36
+ "overrides": {
37
+ "ipx": "3.1.1",
38
+ "sharp": "0.34.5"
39
+ }
40
+ },
35
41
  "packageManager": "pnpm@9.0.0",
36
42
  "engines": {
37
43
  "pnpm": ">=9.0.0"