@clawos-dev/clawd 0.2.619 → 0.2.620
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/dist/app-builder-plugin/mcp-server.cjs +6 -15
- package/dist/cli.cjs +150 -699
- package/dist/dispatch/mcp-server.cjs +6 -28
- package/dist/persona-defaults/persona-app-builder/.claude/skills/app-builder-projects/scripts/collect-files.mjs +6 -15
- package/dist/persona-defaults/persona-app-builder/.claude/skills/app-builder-projects/scripts/list-projects.mjs +1 -2
- package/dist/persona-defaults/persona-app-builder/.claude/skills/app-builder-projects/scripts/record-push.mjs +3 -5
- package/dist/persona-defaults/persona-app-builder/.claude/skills/app-builder-projects/scripts/render-sql.mjs +4 -6
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/src/app.module.ts +1 -7
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/src/main.ts +3 -9
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/src/polyfill.ts +3 -9
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/server/src/table-name.ts +2 -5
- package/dist/persona-defaults/persona-app-builder/extension-kit/examples/nestjs-react/web/src/App.jsx +1 -8
- package/dist/persona-defaults/persona-app-builder/mcp/clawd-app-builder/mcp-server.cjs +6 -15
- package/dist/persona-defaults/persona-clawd-butler/.claude/skills/clawd-session-import/scripts/link-sessions.mjs +7 -23
- package/dist/persona-defaults/persona-clawd-butler/.claude/skills/scan-sessions-suggest-personas/scripts/extract-signals.mjs +6 -14
- package/dist/persona-defaults/persona-dataclaw-builder/.claude/skills/app-builder-projects/scripts/collect-files.mjs +6 -15
- package/dist/persona-defaults/persona-dataclaw-builder/.claude/skills/app-builder-projects/scripts/list-projects.mjs +1 -2
- package/dist/persona-defaults/persona-dataclaw-builder/.claude/skills/app-builder-projects/scripts/record-push.mjs +3 -5
- package/dist/persona-defaults/persona-dataclaw-builder/.claude/skills/app-builder-projects/scripts/render-sql.mjs +4 -6
- package/dist/persona-defaults/persona-dataclaw-builder/extension-kit/examples/nestjs-react/server/src/app.module.ts +2 -6
- package/dist/persona-defaults/persona-dataclaw-builder/extension-kit/examples/nestjs-react/server/src/dataclaw/dataclaw.client.ts +2 -4
- package/dist/persona-defaults/persona-dataclaw-builder/extension-kit/examples/nestjs-react/server/src/dataclaw/dataclaw.controller.ts +1 -2
- package/dist/persona-defaults/persona-dataclaw-builder/extension-kit/examples/nestjs-react/server/src/main.ts +4 -11
- package/dist/persona-defaults/persona-dataclaw-builder/extension-kit/examples/nestjs-react/server/src/polyfill.ts +1 -5
- package/dist/persona-defaults/persona-dataclaw-builder/extension-kit/examples/nestjs-react/web/src/api.js +1 -4
- package/dist/persona-defaults/persona-dataclaw-builder/extension-kit/examples/nestjs-react/web/src/components/BarChart.jsx +0 -1
- package/dist/persona-defaults/persona-dataclaw-builder/extension-kit/examples/nestjs-react/web/src/components/ResultCards.jsx +0 -1
- package/dist/persona-defaults/persona-dataclaw-builder/extension-kit/examples/nestjs-react/web/src/components/ResultTable.jsx +0 -1
- package/dist/persona-defaults/persona-dataclaw-builder/extension-kit/examples/nestjs-react/web/src/enums.js +2 -3
- package/dist/persona-defaults/persona-dataclaw-builder/mcp/clawd-app-builder/mcp-server.cjs +6 -15
- package/package.json +1 -1
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// integration → <APP_NAME>_<SLUG>_int_ prod → <APP_NAME>_<SLUG>_
|
|
6
|
-
// ext.conf 没 SLUG 的老项目退成 <APP_NAME>_int_ / <APP_NAME>_。
|
|
2
|
+
// 渲 server/db/schema.sql 的 __TABLE_PREFIX__ 到 stdout,共用一份 DDL。
|
|
3
|
+
// 前缀与 publish/remove 一致:integration 为 <APP_NAME>_<SLUG>_int_,prod 为 <APP_NAME>_<SLUG>_。
|
|
4
|
+
// legacy 无 SLUG 时分别退为 <APP_NAME>_int_ / <APP_NAME>_。
|
|
7
5
|
import { readFile } from 'node:fs/promises'
|
|
8
6
|
import { join } from 'node:path'
|
|
9
7
|
|
|
@@ -27,7 +25,7 @@ function fail(msg) {
|
|
|
27
25
|
process.exit(1)
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
/**
|
|
28
|
+
/** 只解析单行 KEY=value 及单/双引号,不执行 ext.conf 的 shell 内容。 */
|
|
31
29
|
function readConf(text) {
|
|
32
30
|
const out = {}
|
|
33
31
|
for (const line of text.split('\n')) {
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { Module } from '@nestjs/common';
|
|
2
2
|
import { DataclawModule } from './dataclaw/dataclaw.module';
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// 业务逻辑由 assistant 按用户需求从零加(添 controller/module 进 imports 即可)。
|
|
7
|
-
//
|
|
8
|
-
// vite middleware / 静态资源 serve 路径仍由 main.ts 处理(dev mount vite,prod express.static),
|
|
9
|
-
// 不需要 ServeStaticModule。
|
|
4
|
+
// 起手注册 DataclawModule 的五个只读端点;apikey 只由后端以 Bearer 发往 dataclaw。
|
|
5
|
+
// 静态资源由 main.ts 托管,无需 ServeStaticModule。
|
|
10
6
|
@Module({
|
|
11
7
|
imports: [DataclawModule],
|
|
12
8
|
})
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Injectable, HttpException, OnModuleInit } from '@nestjs/common'
|
|
2
2
|
import { DataclawConfig, loadDataclawConfig } from './dataclaw.config'
|
|
3
3
|
|
|
4
|
-
// dataclaw
|
|
5
|
-
// 本 app 唯一出站目标就是 dataclaw 这一个自签 https,进程级放开 TLS 校验即可(最小改动、零依赖)。
|
|
4
|
+
// dataclaw 服务使用自签证书;这里关闭整个进程的 TLS 证书验证,会影响所有出站 HTTPS。
|
|
6
5
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
|
|
7
6
|
|
|
8
7
|
// 端点超时:schema / 固定查询走默认;intent-execute 可能跑 LLM 编排,给 90s。
|
|
@@ -50,8 +49,7 @@ export class DataclawClient implements OnModuleInit {
|
|
|
50
49
|
throw new HttpException({ ok: false, error: `dataclaw 非 JSON 响应: ${text.slice(0, 200)}` }, 502)
|
|
51
50
|
}
|
|
52
51
|
if (!res.ok || json?.ok === false) {
|
|
53
|
-
//
|
|
54
|
-
// (别把 200 当错误码抛——对前端是"成功码带错误体"的矛盾态)。
|
|
52
|
+
// 2xx 的应用层 ok:false 及上游 5xx 统一映射为 502,避免以成功状态返回错误体。
|
|
55
53
|
const status = res.ok ? 502 : res.status >= 500 ? 502 : res.status || 400
|
|
56
54
|
throw new HttpException(
|
|
57
55
|
{ ok: false, error: json?.error || `dataclaw ${res.status}`, upstreamStatus: res.status },
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Body, Controller, Get, Post, Query } from '@nestjs/common'
|
|
2
2
|
import { DataclawClient } from './dataclaw.client'
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
// 故这里的路径不带 /api。前端只调本 app 的 /api/*,apikey 由后端注入,绝不下发浏览器。
|
|
4
|
+
// main.ts 统一添加 /api 前缀;路由不重复写它。apikey 只在后端,不下发浏览器。
|
|
6
5
|
@Controller()
|
|
7
6
|
export class DataclawController {
|
|
8
7
|
constructor(private readonly dc: DataclawClient) {}
|
|
@@ -5,11 +5,8 @@ import { NestExpressApplication } from '@nestjs/platform-express';
|
|
|
5
5
|
import { AppModule } from './app.module';
|
|
6
6
|
import * as path from 'node:path';
|
|
7
7
|
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// /api 走 web/vite.config.js 的 proxy 转到本进程)
|
|
11
|
-
// - prod / FC:nest 直接 serve web 的打包产物(publish.sh 的 BUILD_CMD 把 web/dist 拷进 dist/public)
|
|
12
|
-
// FC_SERVER_PORT 是 FC 运行时注入的端口;PORT 给本地调试。
|
|
8
|
+
// dev 由 Vite 独跑并代理 /api;FC 托管拷入 dist/public 的 web 产物。
|
|
9
|
+
// 端口优先 FC_SERVER_PORT,其次本地 PORT。
|
|
13
10
|
async function bootstrap() {
|
|
14
11
|
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
|
15
12
|
|
|
@@ -18,13 +15,9 @@ async function bootstrap() {
|
|
|
18
15
|
|
|
19
16
|
app.setGlobalPrefix('api', { exclude: ['/'] });
|
|
20
17
|
|
|
21
|
-
//
|
|
22
|
-
// 见 dataclaw.client —— key 绝不下发浏览器。
|
|
18
|
+
// 页面无登录门禁,apikey 仅由后端使用。
|
|
23
19
|
|
|
24
|
-
//
|
|
25
|
-
// 1. FC(CODE_DIR=./server 只上传 server/,运行时 __dirname=dist/):publish.sh BUILD_CMD 末尾
|
|
26
|
-
// 把 ../web/dist 拷进 dist/public,跟着 server 一起上传,所以优先用 __dirname/public
|
|
27
|
-
// 2. 本地 `node dist/main.js`:__dirname/public 不存在时 fallback 到 ../../web/dist
|
|
20
|
+
// FC 仅上传 server/,优先托管 dist/public;本地构建可回落到 web/dist。
|
|
28
21
|
const fs = await import('node:fs');
|
|
29
22
|
const fcStaticDir = path.resolve(__dirname, 'public');
|
|
30
23
|
const monorepoStaticDir = path.resolve(__dirname, '..', '..', 'web', 'dist');
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
//
|
|
2
|
-
// server 拿不到 DATACLAW_* env → loadDataclawConfig 会 fail-loud。
|
|
3
|
-
// 这里在 nest bootstrap 之前显式 require dotenv 把 .env 填进 process.env。
|
|
4
|
-
// prod 路径(node --env-file=.env dist/main.js)Node 自带 loader 已经填了,dotenv 看到
|
|
5
|
-
// 已存在的 env 不会覆盖(默认行为),行为对齐。
|
|
1
|
+
// nest watch 不经过 Node --env-file;bootstrap 前加载 .env,dotenv 不覆盖已注入的 env。
|
|
6
2
|
require('dotenv/config');
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// dev 隧道模式下页面挂在子路径 /preview/<port>/ 下(见 vite.config.js base),
|
|
4
|
-
// 所以 API_BASE 要拼上 import.meta.env.BASE_URL,否则 fetch 会打到错误的绝对路径。
|
|
1
|
+
// 只调本 app 的 BFF,apikey 留在后端;API 路径相对 Vite BASE_URL(默认 /)。
|
|
5
2
|
const API_BASE = (import.meta.env.BASE_URL || '/').replace(/\/+$/, '') + '/api';
|
|
6
3
|
|
|
7
4
|
async function req(path, opts = {}) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { INTERNAL_FIELDS } from '../enums';
|
|
2
2
|
|
|
3
|
-
// 结果表格。列取 rows[0] 的 key(过滤 _provenance 等内部字段),数字按 zh-CN 千分位展示,空数组显示「无数据」。
|
|
4
3
|
export default function ResultTable({ rows }) {
|
|
5
4
|
if (!rows || rows.length === 0) return <div className="empty">无数据</div>;
|
|
6
5
|
const cols = Object.keys(rows[0]).filter((c) => !INTERNAL_FIELDS.has(c));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
//
|
|
2
|
-
// ResultTable 渲染时按此 Set 过滤掉对应列。
|
|
1
|
+
// 渲染结果时隐藏内部编号、ID 及溯源元数据。
|
|
3
2
|
export const INTERNAL_FIELDS = new Set([
|
|
4
3
|
'ID', 'unique_id', '链接', 'SourceID', '发票ID', '客户ID', '职位ID',
|
|
5
4
|
'业绩所属一级团队编号', '业绩所属二级团队编号', '业绩所属三级团队编号', '所属OP名称', '候选人ID',
|
|
6
|
-
'_provenance',
|
|
5
|
+
'_provenance',
|
|
7
6
|
]);
|
|
@@ -21229,17 +21229,12 @@ var ProjectStore = class {
|
|
|
21229
21229
|
await this.write(validated.data);
|
|
21230
21230
|
return validated.data;
|
|
21231
21231
|
}
|
|
21232
|
-
/**
|
|
21233
|
-
* 同步内联 scaffold:spawn `new-extension.sh <name> <模板源> <项目目录>` 等 exit。
|
|
21234
|
-
* 必须在 `create()` 之后调(脚本要求目标目录已存在且只含 .clawd-project.json)。
|
|
21235
|
-
* 失败抛错;上层(core.createProject)catch 后回滚。
|
|
21236
|
-
*/
|
|
21232
|
+
/** create 后才 scaffold;目标仅含元数据,失败抛给 core 尝试回滚。 */
|
|
21237
21233
|
async scaffold(name, templateSrcDir, scaffoldScriptPath, extraEnv) {
|
|
21238
21234
|
const destDir = this.projectDir(name);
|
|
21239
21235
|
return await new Promise((resolve, reject) => {
|
|
21240
21236
|
const child = (0, import_node_child_process.spawn)("bash", [scaffoldScriptPath, name, templateSrcDir, destDir], {
|
|
21241
|
-
//
|
|
21242
|
-
// 脚本以「命令找不到」的形态崩在离现场很远的地方。
|
|
21237
|
+
// 恢复宿主 PATH,避免 extraEnv 的同名值破坏脚本命令查找。
|
|
21243
21238
|
env: { ...process.env, ...extraEnv ?? {}, PATH: process.env.PATH ?? "" },
|
|
21244
21239
|
stdio: ["ignore", "pipe", "pipe"]
|
|
21245
21240
|
});
|
|
@@ -25065,13 +25060,11 @@ var L = [
|
|
|
25065
25060
|
"",
|
|
25066
25061
|
"jobs:",
|
|
25067
25062
|
" build:",
|
|
25068
|
-
//
|
|
25069
|
-
// 中文说明归 clawd 的上云页面,这里保持机器好认。
|
|
25063
|
+
// jobs API 只返 name 不返 key,故 name 必须用段 key。
|
|
25070
25064
|
" name: build",
|
|
25071
25065
|
" runs-on: ubuntu-latest",
|
|
25072
|
-
// ACR
|
|
25066
|
+
// ACR 账号内串行构建,需给其他镜像排队留时间。
|
|
25073
25067
|
" timeout-minutes: 40",
|
|
25074
|
-
// 没有 outputs:——smoke / deploy 段自己读契约、自己解析 digest(文件头)。
|
|
25075
25068
|
" steps:",
|
|
25076
25069
|
...CONTRACT_STEPS,
|
|
25077
25070
|
" - name: \u51ED\u636E\u9F50\u4E0D\u9F50\uFF08\u7F3A\u54EA\u51E0\u4E2A\u540D\u5B57\u4E00\u6B21\u5217\u5168\uFF09",
|
|
@@ -25108,7 +25101,7 @@ var L = [
|
|
|
25108
25101
|
" ALIBABA_CLOUD_ACCESS_KEY_ID: ${{ secrets.ALI_ACS_ACCESS_KEY_ID }}",
|
|
25109
25102
|
" ALIBABA_CLOUD_ACCESS_KEY_SECRET: ${{ secrets.ALI_ACS_ACCESS_KEY_SECRET }}",
|
|
25110
25103
|
" run: |",
|
|
25111
|
-
// pipefail
|
|
25104
|
+
// pipefail 让 ls-remote 失败正确传播,避免被 cut 的成功状态掩盖。
|
|
25112
25105
|
" set -eo pipefail",
|
|
25113
25106
|
' REPO="$ACR_NAMESPACE/${{ steps.plan.outputs.persona_id }}"',
|
|
25114
25107
|
' node clawos/cloud-host/pipeline/acr.mjs ensure-repo --repo "$REPO" \\',
|
|
@@ -25135,9 +25128,7 @@ var L = [
|
|
|
25135
25128
|
" - name: \u4E34\u65F6\u767B\u8BB0 \u2192 \u8D77\u4E00\u6B21 Pod \u2192 \u64A4\u9500",
|
|
25136
25129
|
" # \u767B\u8BB0\u6B63\u5F0F\u53EA\u662F\u5F80 gateway \u5199\u4E00\u884C\uFF0Cgateway \u4E0D\u78B0\u955C\u50CF\uFF1B\u96C6\u7FA4\u62C9\u955C\u50CF\u53D1\u751F\u5728\u7B2C\u4E00\u4E2A\u4EFB\u52A1\u5230\u6765\u65F6\u3002",
|
|
25137
25130
|
" # \u6CA1\u6709\u8FD9\u4E00\u6B65\uFF0C\u6D41\u6C34\u7EBF\u7EFF\u4E86\u53EA\u4EE3\u8868\u300C\u767B\u8BB0\u4E86\u300D\u3002\u955C\u50CF\u7528 digest\uFF08\u96C6\u7FA4 Job \u662F IfNotPresent\uFF0C\u79FB\u52A8 tag \u4F1A\u4E00\u76F4\u8DD1\u65E7\u7684\uFF09\u3002",
|
|
25138
|
-
//
|
|
25139
|
-
// 名字形状 deploy-file.mjs 已卡死(persona_id [a-z0-9-]、model / effort [A-Za-z0-9._/-](`/` 是 pi 的 provider/id,不是元字符)、size 四档枚举、task_concurrency 正整数、connectors 无单引号
|
|
25140
|
-
// 无换行),所以单引号包住直接拼进命令行是安全的。
|
|
25131
|
+
// smoke 与正式发布用同份模型/档位/连接器;deploy-file.mjs 拒绝单引号/换行等危险值,方可单引号拼参。
|
|
25141
25132
|
" env:",
|
|
25142
25133
|
" CLAWD_GATEWAY_URL: ${{ vars.CLAWD_GATEWAY_URL }}",
|
|
25143
25134
|
" CLAWD_GATEWAY_ADMIN_KEY: ${{ secrets.CLAWD_GATEWAY_ADMIN_KEY }}",
|