bailinghub 0.3.4 → 0.5.0
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/.gitignore +5 -0
- package/README.en.md +6 -1
- package/README.md +6 -0
- package/SECURITY.md +11 -0
- package/docker-compose.images.yml +2 -2
- package/docs/AGENT_AUTH_API.en.md +175 -0
- package/docs/AGENT_AUTH_API.md +190 -0
- package/docs/AGENT_CLIENT_QUICKSTART.en.md +212 -0
- package/docs/AGENT_CLIENT_QUICKSTART.md +206 -0
- package/docs/AGENT_CLIENT_RUNTIME_API.en.md +157 -0
- package/docs/AGENT_CLIENT_RUNTIME_API.md +107 -0
- package/docs/CHANGELOG.en.md +59 -1
- package/docs/CHANGELOG.md +27 -1
- package/docs/COMPATIBILITY.en.md +25 -0
- package/docs/CONTRACT.en.md +79 -8
- package/docs/CONTRACT.md +36 -6
- package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
- package/docs/INDEPENDENT_VALIDATION.md +4 -4
- package/docs/QUICKSTART.en.md +6 -0
- package/docs/QUICKSTART.md +1 -1
- package/docs/README.en.md +8 -0
- package/docs/README.md +8 -0
- package/docs/RELEASE_NOTES_v0.4.0.en.md +39 -0
- package/docs/RELEASE_NOTES_v0.4.0.md +39 -0
- package/docs/RELEASE_NOTES_v0.5.0.en.md +41 -0
- package/docs/RELEASE_NOTES_v0.5.0.md +41 -0
- package/docs/STREAMING.en.md +32 -0
- package/docs/STREAMING.md +8 -2
- package/docs/WIDGET_RENDERERS.en.md +123 -6
- package/docs/WIDGET_RENDERERS.md +75 -6
- package/docs/user-guide/console-map.en.md +1 -2
- package/docs/user-guide/console-map.md +2 -2
- package/docs//345/205/274/345/256/271/346/200/247/344/270/216/345/215/207/347/272/247.md +9 -0
- package/package.json +3 -2
- package/schemas/config/chat-entry.schema.json +2 -1
- package/schemas/config/client.schema.json +7 -0
- package/schemas/config/common.schema.json +30 -0
- package/schemas/config/route.schema.json +11 -0
- package/scripts/check-doc-links.mjs +1 -0
- package/scripts/check-image-tags.sh +1 -1
- package/scripts/check-release-consistency.test.mjs +5 -5
- package/scripts/e2e-console.mjs +144 -0
- package/scripts/export-oss.mjs +5 -12
- package/scripts/install.sh +1 -1
- package/scripts/public-content-denylist.mjs +82 -0
- package/scripts/public-content-denylist.test.mjs +53 -0
- package/scripts/publish-images.sh +1 -1
- package/scripts/release-audit.mjs +8 -12
- package/scripts/sdk-runtime-test.mjs +171 -7
- package/scripts/security-scan.mjs +8 -5
- package/scripts/validate-examples.mjs +3 -1
- package/scripts/verify-github-repo.mjs +7 -11
- package/scripts/verify-oss-export.mjs +6 -12
- package/scripts/widget-renderer-test.mjs +244 -16
- package/sdk/php/README.md +27 -1
- package/sdk/php/src/AgentAuth.php +78 -0
- package/sdk/php/src/HubClient.php +3 -0
- package/sdk/php7/README.md +32 -2
- package/sdk/php7/src/AgentAuth.php +77 -0
- package/sdk/php7/src/HubClient.php +3 -0
- package/sql/055_agent_auth.sql +72 -0
- package/sql/056_agent_client_runtime.sql +60 -0
- package/src/adapters/channels/wecom-api.ts +1 -1
- package/src/app/agent-client-runtime.test.ts +221 -0
- package/src/app/agent-client-runtime.ts +408 -0
- package/src/app/agent-tool-invocations.test.ts +462 -0
- package/src/app/agent-tool-invocations.ts +795 -0
- package/src/app/agent-tool-job.test.ts +62 -0
- package/src/app/agent-tool-job.ts +41 -0
- package/src/app/auth.ts +2 -1
- package/src/app/kernel.ts +2 -0
- package/src/app/runtime-context.ts +8 -0
- package/src/app/tool-approvals.ts +5 -1
- package/src/app/tool-assembly.ts +19 -1
- package/src/app/tool-context.ts +2 -1
- package/src/core/config/config-codec.ts +2 -1
- package/src/core/config/config-models.test.ts +28 -1
- package/src/core/config/config-models.ts +46 -3
- package/src/core/config/config-schema.test.ts +8 -0
- package/src/core/config/route-config.test.ts +15 -0
- package/src/core/config/route-config.ts +36 -0
- package/src/core/config/tools-config.test.ts +58 -1
- package/src/core/config/tools-config.ts +84 -0
- package/src/core/contracts/tools.ts +162 -29
- package/src/core/contracts/types.ts +38 -1
- package/src/core/platform/chat-form.test.ts +147 -0
- package/src/core/platform/chat-form.ts +402 -0
- package/src/core/platform/version.ts +1 -1
- package/src/core/runtime/agent-client-trace.test.ts +154 -0
- package/src/core/runtime/agent-client-trace.ts +288 -0
- package/src/core/runtime/execution-runtime.test.ts +61 -0
- package/src/core/runtime/execution-runtime.ts +17 -0
- package/src/core/runtime/launch-runtime.ts +13 -0
- package/src/core/runtime/trace-runtime.test.ts +18 -1
- package/src/core/runtime/trace-runtime.ts +28 -3
- package/src/core/state/state-codec.ts +2 -0
- package/src/infrastructure/config/config-agent-auth-repository.test.ts +147 -0
- package/src/infrastructure/config/config-agent-auth-repository.ts +356 -0
- package/src/infrastructure/config/config-agent-client-runtime-repository.ts +253 -0
- package/src/infrastructure/config/config-approval-ledger.test.ts +32 -0
- package/src/infrastructure/config/config-approval-ledger.ts +16 -0
- package/src/infrastructure/config/config-client-repository.ts +3 -3
- package/src/infrastructure/config/config-conversation-ledger.test.ts +69 -0
- package/src/infrastructure/config/config-conversation-ledger.ts +8 -7
- package/src/infrastructure/config/config-observability-ledger.test.ts +50 -0
- package/src/infrastructure/config/config-observability-ledger.ts +65 -10
- package/src/infrastructure/config/config-route-repository.ts +4 -3
- package/src/infrastructure/config/configstore.ts +14 -3
- package/src/infrastructure/state/state-mysql.ts +2 -2
- package/src/kernel-api/v1/contracts.ts +8 -0
- package/src/routes/admin-runtime.test.ts +214 -0
- package/src/routes/admin-runtime.ts +82 -2
- package/src/routes/agent-api.test.ts +379 -0
- package/src/routes/agent-api.ts +251 -0
- package/src/routes/agent-auth.test.ts +276 -0
- package/src/routes/agent-auth.ts +395 -0
- package/src/routes/approvals.ts +4 -1
- package/src/routes/chat.test.ts +319 -7
- package/src/routes/chat.ts +166 -21
- package/src/routes/critical-routes.test.ts +235 -1
- package/src/routes/private-default.ts +2 -1
- package/src/routes/private.ts +16 -1
- package/src/routes/run.ts +79 -13
- package/web/connect/bailing-connect-php.tgz +0 -0
- package/web/connect/bailing-connect-php7.tgz +0 -0
- package/web/console/assets/{Accounts-CAwrtBiS.js → Accounts-D4RRm5D1.js} +1 -1
- package/web/console/assets/{Approvals-C2BZ86T3.js → Approvals-CsTTKb8o.js} +1 -1
- package/web/console/assets/{Audit-B-E4Y_Up.js → Audit-BzvZ7JZw.js} +1 -1
- package/web/console/assets/{BrandLockup-C18u8Lx5.js → BrandLockup-CYcA93wh.js} +1 -1
- package/web/console/assets/{Channels-DTy8ylH-.js → Channels-DRQZggqM.js} +1 -1
- package/web/console/assets/ChatEntries-BUB7BWKU.js +7 -0
- package/web/console/assets/ChatEntries-DsYtcXN6.css +1 -0
- package/web/console/assets/Clients-CQ_MonGL.css +1 -0
- package/web/console/assets/Clients-HhCyrxfz.js +3 -0
- package/web/console/assets/{Cost-2SSYs1AT.js → Cost-BZgFf1yM.js} +1 -1
- package/web/console/assets/{Credentials-B79LtxCE.js → Credentials-BTe2Q07j.js} +1 -1
- package/web/console/assets/{Diagnostics-BakcRYvb.js → Diagnostics-WL-buYli.js} +1 -1
- package/web/console/assets/{Executors-BXoyo28u.js → Executors-CGZ-7Xmp.js} +1 -1
- package/web/console/assets/{Kb-ISbzquab.js → Kb-VVw8oGsT.js} +1 -1
- package/web/console/assets/{Login-Dlu6Wgcf.js → Login-rwvmBBPl.js} +1 -1
- package/web/console/assets/{Projects-DFzmtnqg.js → Projects-CexaCEY1.js} +1 -1
- package/web/console/assets/Routes-B9ZHbQAp.js +124 -0
- package/web/console/assets/Routes-BbkFpi6Y.css +1 -0
- package/web/console/assets/Runs-4zDD9VOC.css +1 -0
- package/web/console/assets/Runs-BzFNPTwD.js +3 -0
- package/web/console/assets/{Setup-CrBAV-b9.js → Setup-Djh5yadQ.js} +1 -1
- package/web/console/assets/{Shell-B1a8DvXQ.js → Shell-kn763smL.js} +1 -1
- package/web/console/assets/{StorageBuckets-BRfL_eHb.js → StorageBuckets-CQBR41W1.js} +1 -1
- package/web/console/assets/{SystemSettings-CyirVLbq.js → SystemSettings-DgnopekD.js} +1 -1
- package/web/console/assets/{SystemStatus-DZ_OR7sk.js → SystemStatus-Bj8-kPt2.js} +1 -1
- package/web/console/assets/{Targets-CtIMa66c.js → Targets-BAfCt_nH.js} +1 -1
- package/web/console/assets/{Tools-BfDZHt01.js → Tools-xjd0NZdE.js} +1 -1
- package/web/console/assets/{index-DBiByFiO.js → index-DfJA7iJS.js} +2 -2
- package/web/console/assets/{request-DY2cxQqZ.js → request-DkNPOweH.js} +1 -1
- package/web/console/assets/{schema-6mCQ7rR5.js → schema-CgPWAu1_.js} +1 -1
- package/web/console/index.html +1 -1
- package/web/widget/widget.js +493 -14
- package/web-admin/src/pages/ChatEntries.vue +18 -6
- package/web-admin/src/pages/Clients.vue +11 -3
- package/web-admin/src/pages/Routes.vue +282 -16
- package/web-admin/src/pages/Runs.vue +159 -38
- package/web/console/assets/ChatEntries-9xbRiQov.css +0 -1
- package/web/console/assets/ChatEntries-DvD-4IeE.js +0 -7
- package/web/console/assets/Clients--D7NQJKk.css +0 -1
- package/web/console/assets/Clients-DWs9JFr0.js +0 -3
- package/web/console/assets/Routes-B-hm9HGY.js +0 -124
- package/web/console/assets/Routes-DWGQN5Pv.css +0 -1
- package/web/console/assets/Runs-CUtSsPW-.css +0 -1
- package/web/console/assets/Runs-hMRu1im3.js +0 -3
|
@@ -198,6 +198,36 @@
|
|
|
198
198
|
"url": { "type": "string" },
|
|
199
199
|
"to": { "type": "string" }
|
|
200
200
|
}
|
|
201
|
+
},
|
|
202
|
+
"agent_direct": {
|
|
203
|
+
"type": "object",
|
|
204
|
+
"additionalProperties": false,
|
|
205
|
+
"required": ["enabled"],
|
|
206
|
+
"not": { "required": ["force_approval_tools", "unattended_write_tools"] },
|
|
207
|
+
"properties": {
|
|
208
|
+
"enabled": { "type": "boolean" },
|
|
209
|
+
"write_tools": {
|
|
210
|
+
"type": "array",
|
|
211
|
+
"minItems": 1,
|
|
212
|
+
"uniqueItems": true,
|
|
213
|
+
"items": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$" }
|
|
214
|
+
},
|
|
215
|
+
"force_approval_tools": {
|
|
216
|
+
"description": "Route-level exact operationIds that require approval in addition to the ACC declaration. Omit to inherit ACC approval semantics.",
|
|
217
|
+
"type": "array",
|
|
218
|
+
"minItems": 1,
|
|
219
|
+
"uniqueItems": true,
|
|
220
|
+
"items": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$" }
|
|
221
|
+
},
|
|
222
|
+
"unattended_write_tools": {
|
|
223
|
+
"description": "Deprecated private-candidate compatibility field. When present, every write_tools entry not listed here is forced to approval. Remove it to inherit ACC, or migrate its complement within write_tools to force_approval_tools.",
|
|
224
|
+
"deprecated": true,
|
|
225
|
+
"type": "array",
|
|
226
|
+
"minItems": 1,
|
|
227
|
+
"uniqueItems": true,
|
|
228
|
+
"items": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$" }
|
|
229
|
+
}
|
|
230
|
+
}
|
|
201
231
|
}
|
|
202
232
|
},
|
|
203
233
|
"not": {
|
|
@@ -128,6 +128,17 @@
|
|
|
128
128
|
"title": "对话记忆",
|
|
129
129
|
"description": "路由会话历史装配、逐字窗口和滚动摘要配置。"
|
|
130
130
|
},
|
|
131
|
+
"agent_client": {
|
|
132
|
+
"type": "object",
|
|
133
|
+
"title": "本地 Agent Runtime",
|
|
134
|
+
"description": "本地 Agent 编排的显式开关、补充指令和每轮主动工具上限;缺省时兼容 tools.agent_direct.enabled。",
|
|
135
|
+
"additionalProperties": false,
|
|
136
|
+
"properties": {
|
|
137
|
+
"enabled": { "type": "boolean" },
|
|
138
|
+
"instructions": { "type": "string", "maxLength": 20000 },
|
|
139
|
+
"active_tool_limit": { "type": "integer", "minimum": 1, "maximum": 12 }
|
|
140
|
+
}
|
|
141
|
+
},
|
|
131
142
|
"budget": {
|
|
132
143
|
"$ref": "common.schema.json#/$defs/budgetPolicy",
|
|
133
144
|
"title": "成本预算闸",
|
|
@@ -101,6 +101,7 @@ const englishCompanions = {
|
|
|
101
101
|
'docs/RELEASE_NOTES_v0.3.2.md': 'docs/RELEASE_NOTES_v0.3.2.en.md',
|
|
102
102
|
'docs/RELEASE_NOTES_v0.3.3.md': 'docs/RELEASE_NOTES_v0.3.3.en.md',
|
|
103
103
|
'docs/RELEASE_NOTES_v0.3.4.md': 'docs/RELEASE_NOTES_v0.3.4.en.md',
|
|
104
|
+
'docs/RELEASE_NOTES_v0.5.0.md': 'docs/RELEASE_NOTES_v0.5.0.en.md',
|
|
104
105
|
'docs/TOOLS_DESIGN.md': 'docs/TOOLS_DESIGN.en.md',
|
|
105
106
|
'docs/TOOLS_MODEL.md': 'docs/TOOLS_MODEL.en.md',
|
|
106
107
|
'docs/AI友好工具设计指南.md': 'docs/AI_FRIENDLY_TOOLS.en.md',
|
|
@@ -9,7 +9,7 @@ REGISTRY="${BAILING_IMAGE_REGISTRY:-$DEFAULT_REGISTRY}"
|
|
|
9
9
|
NAMESPACE="${BAILING_IMAGE_NAMESPACE:-$DEFAULT_NAMESPACE}"
|
|
10
10
|
PACKAGE_VERSION="$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' package.json | head -1)"
|
|
11
11
|
TAG="${BAILING_IMAGE_TAG:-$PACKAGE_VERSION}"
|
|
12
|
-
[ -n "$TAG" ] || TAG="0.
|
|
12
|
+
[ -n "$TAG" ] || TAG="0.5.0"
|
|
13
13
|
MYSQL_TAG="${BAILING_MYSQL_IMAGE_TAG:-8.4}"
|
|
14
14
|
MYSQL_IMAGE="${BAILING_MYSQL_IMAGE:-$REGISTRY/$NAMESPACE/bailing-mysql:$MYSQL_TAG}"
|
|
15
15
|
PLATFORM="${BAILING_IMAGE_PLATFORM:-linux/amd64}"
|
|
@@ -38,8 +38,8 @@ function updateJson(root, relativePath, update) {
|
|
|
38
38
|
test('current release surface is internally consistent', () => {
|
|
39
39
|
const result = checkReleaseConsistency({ root: repoRoot });
|
|
40
40
|
assert.deepEqual(result.findings, []);
|
|
41
|
-
assert.equal(result.version, '0.
|
|
42
|
-
assert.equal(result.stableVersion, '0.
|
|
41
|
+
assert.equal(result.version, '0.5.0');
|
|
42
|
+
assert.equal(result.stableVersion, '0.5.0');
|
|
43
43
|
assert.equal(result.publishTag, 'latest');
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -51,13 +51,13 @@ for (const [label, tag] of [
|
|
|
51
51
|
const root = createFixture();
|
|
52
52
|
try {
|
|
53
53
|
updateJson(root, 'package.json', (pkg) => {
|
|
54
|
-
pkg.version = '0.
|
|
54
|
+
pkg.version = '0.5.0-rc.1';
|
|
55
55
|
if (tag === undefined) delete pkg.publishConfig;
|
|
56
56
|
else pkg.publishConfig = { tag };
|
|
57
57
|
});
|
|
58
58
|
updateJson(root, 'package-lock.json', (lock) => {
|
|
59
|
-
lock.version = '0.
|
|
60
|
-
lock.packages[''].version = '0.
|
|
59
|
+
lock.version = '0.5.0-rc.1';
|
|
60
|
+
lock.packages[''].version = '0.5.0-rc.1';
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
const result = checkReleaseConsistency({ root });
|
package/scripts/e2e-console.mjs
CHANGED
|
@@ -81,9 +81,34 @@ const fixtures = {
|
|
|
81
81
|
last_preview: '查询订单 SO-1001',
|
|
82
82
|
last_active_at: new Date().toISOString(),
|
|
83
83
|
message_count: 2,
|
|
84
|
+
}, {
|
|
85
|
+
thread_id: 2,
|
|
86
|
+
scope_key: 'agent:demo-app:employee-edit',
|
|
87
|
+
channel: 'agent:demo-app',
|
|
88
|
+
client_name: 'Demo 业务系统',
|
|
89
|
+
principal_id: 'uid:tenant-1:user-7',
|
|
90
|
+
route_name: 'Demo 售后助手',
|
|
91
|
+
last_preview: '员工资料已修改',
|
|
92
|
+
last_active_at: new Date().toISOString(),
|
|
93
|
+
message_count: 2,
|
|
94
|
+
}, {
|
|
95
|
+
thread_id: 3,
|
|
96
|
+
scope_key: 'agent:demo-app:incomplete-turn',
|
|
97
|
+
channel: 'agent:demo-app',
|
|
98
|
+
client_name: 'Demo 业务系统',
|
|
99
|
+
principal_id: 'uid:tenant-1:user-7',
|
|
100
|
+
route_name: 'Demo 售后助手',
|
|
101
|
+
last_preview: '等待本地智能体继续处理',
|
|
102
|
+
last_active_at: new Date().toISOString(),
|
|
103
|
+
message_count: 1,
|
|
84
104
|
}],
|
|
85
105
|
};
|
|
86
106
|
|
|
107
|
+
const agentRunId = '123e4567-e89b-42d3-a456-426614174000';
|
|
108
|
+
const agentToolJobId = '223e4567-e89b-42d3-a456-426614174000';
|
|
109
|
+
const incompleteAgentRunId = '323e4567-e89b-42d3-a456-426614174000';
|
|
110
|
+
const incompleteAgentToolJobId = '423e4567-e89b-42d3-a456-426614174000';
|
|
111
|
+
|
|
87
112
|
let smokeRequests = 0;
|
|
88
113
|
|
|
89
114
|
function tracePayload() {
|
|
@@ -101,6 +126,84 @@ function tracePayload() {
|
|
|
101
126
|
};
|
|
102
127
|
}
|
|
103
128
|
|
|
129
|
+
function agentRunTracePayload() {
|
|
130
|
+
return {
|
|
131
|
+
kind: 'agent_client_run',
|
|
132
|
+
run: {
|
|
133
|
+
run_id: agentRunId,
|
|
134
|
+
thread_id: 2,
|
|
135
|
+
client_app_id: 'demo-app',
|
|
136
|
+
route_key: 'demo_support',
|
|
137
|
+
status: 'completed',
|
|
138
|
+
model: 'deepseek-chat',
|
|
139
|
+
runtime: 'deepseek-harness',
|
|
140
|
+
usage: { total_tokens: 168 },
|
|
141
|
+
governance: { planner: 'local_agent', execution: 'bailinghub_governed', hidden_reasoning_sync: false },
|
|
142
|
+
},
|
|
143
|
+
trace: {
|
|
144
|
+
summary: { tool_invocations: 1, approvals: 0, warning_count: 0, error_count: 0, duration_ms: 1800 },
|
|
145
|
+
events: [
|
|
146
|
+
{ ts: new Date().toISOString(), event: 'agent_client_run_started', source: 'local_agent', stage: 'launch', severity: 'info', title: '本地智能体开始处理', summary: '本轮由本地智能体负责理解、规划和工具选择', detail: { hidden_reasoning_sync: false } },
|
|
147
|
+
{ ts: new Date().toISOString(), event: 'tool_call', source: 'hub_governance', tool_job_id: agentToolJobId, stage: 'tool', severity: 'info', title: '工具调用', summary: 'staff_edit', detail: { tool: 'staff_edit', argument_keys: ['id', 'name'] } },
|
|
148
|
+
{ ts: new Date().toISOString(), event: 'tool_result', source: 'hub_governance', tool_job_id: agentToolJobId, stage: 'tool', severity: 'info', title: '工具结果', summary: 'staff_edit · HTTP 200', detail: { tool: 'staff_edit', status: 200, ok: true } },
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
invocations: [{
|
|
152
|
+
job_id: agentToolJobId,
|
|
153
|
+
invocation_id: 'a'.repeat(64),
|
|
154
|
+
tool: 'staff_edit',
|
|
155
|
+
status: 'done',
|
|
156
|
+
state: 'executed',
|
|
157
|
+
ok: true,
|
|
158
|
+
business_status: 200,
|
|
159
|
+
approval_status: null,
|
|
160
|
+
approval_id: null,
|
|
161
|
+
event_count: 3,
|
|
162
|
+
duration_ms: 1200,
|
|
163
|
+
created_at: new Date().toISOString(),
|
|
164
|
+
updated_at: new Date().toISOString(),
|
|
165
|
+
}],
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function incompleteAgentRunTracePayload() {
|
|
170
|
+
return {
|
|
171
|
+
kind: 'agent_client_run',
|
|
172
|
+
run: {
|
|
173
|
+
run_id: incompleteAgentRunId,
|
|
174
|
+
thread_id: 3,
|
|
175
|
+
client_app_id: 'demo-app',
|
|
176
|
+
route_key: 'demo_support',
|
|
177
|
+
status: 'context_ready',
|
|
178
|
+
model: null,
|
|
179
|
+
runtime: 'deepseek-harness',
|
|
180
|
+
usage: null,
|
|
181
|
+
governance: { planner: 'local_agent', execution: 'bailinghub_governed', hidden_reasoning_sync: false },
|
|
182
|
+
},
|
|
183
|
+
trace: {
|
|
184
|
+
summary: { tool_invocations: 1, approvals: 1, warning_count: 1, error_count: 0, duration_ms: 3200, partial: true },
|
|
185
|
+
events: [
|
|
186
|
+
{ ts: new Date().toISOString(), event: 'agent_client_run_started', source: 'local_agent', stage: 'launch', severity: 'info', title: '本地智能体开始处理', summary: '本轮由本地智能体负责规划', detail: { hidden_reasoning_sync: false } },
|
|
187
|
+
{ ts: new Date().toISOString(), event: 'agent_tool_invocation_state', source: 'hub_governance', tool_job_id: incompleteAgentToolJobId, stage: 'tool', severity: 'warning', title: 'ACC 工具调用状态更新', summary: 'staff_edit · awaiting_approval', detail: { tool: 'staff_edit', state: 'awaiting_approval', ok: false } },
|
|
188
|
+
],
|
|
189
|
+
},
|
|
190
|
+
invocations: [{
|
|
191
|
+
job_id: incompleteAgentToolJobId,
|
|
192
|
+
invocation_id: 'b'.repeat(64),
|
|
193
|
+
tool: 'staff_edit',
|
|
194
|
+
status: 'done',
|
|
195
|
+
state: 'awaiting_approval',
|
|
196
|
+
ok: false,
|
|
197
|
+
business_status: null,
|
|
198
|
+
approval_status: 'approved',
|
|
199
|
+
approval_id: 9,
|
|
200
|
+
event_count: 2,
|
|
201
|
+
created_at: new Date().toISOString(),
|
|
202
|
+
updated_at: new Date().toISOString(),
|
|
203
|
+
}],
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
104
207
|
async function mockApi(context) {
|
|
105
208
|
await context.route('**/health', (route) => route.fulfill({ json: { status: 'ok', paused: false, queue: { running: 0, waiting: 0 }, backend: 'mysql', configBackend: true } }));
|
|
106
209
|
await context.route('**/admin/api/me', (route) => route.fulfill({ json: { username: 'admin', role: 'admin', perms: ['*'] } }));
|
|
@@ -123,6 +226,8 @@ async function mockApi(context) {
|
|
|
123
226
|
await context.route('**/admin/api/config-schemas/*', (route) => route.fulfill({ json: { required: [], properties: {} } }));
|
|
124
227
|
await context.route('**/admin/api/tool-providers/*/tools', (route) => route.fulfill({ json: { tools: [{ name: 'list_demo_orders', scope: 'demo.order.read' }] } }));
|
|
125
228
|
await context.route('**/admin/api/runs/*/trace', (route) => route.fulfill({ json: tracePayload() }));
|
|
229
|
+
await context.route(`**/admin/api/threads/2/agent-runs/${agentRunId}/trace`, (route) => route.fulfill({ json: agentRunTracePayload() }));
|
|
230
|
+
await context.route(`**/admin/api/threads/3/agent-runs/${incompleteAgentRunId}/trace`, (route) => route.fulfill({ json: incompleteAgentRunTracePayload() }));
|
|
126
231
|
await context.route('**/admin/api/**', (route) => {
|
|
127
232
|
const url = new URL(route.request().url());
|
|
128
233
|
if (url.pathname === '/admin/api/me') return route.fulfill({ json: { username: 'admin', role: 'admin', perms: ['*'] } });
|
|
@@ -148,6 +253,8 @@ async function mockApi(context) {
|
|
|
148
253
|
if (url.pathname === '/admin/api/routes') return route.fulfill({ json: fixtures.routes });
|
|
149
254
|
if (url.pathname === '/admin/api/runs') return route.fulfill({ json: fixtures.runs });
|
|
150
255
|
if (/^\/admin\/api\/runs\/[^/]+\/trace$/.test(url.pathname)) return route.fulfill({ json: tracePayload() });
|
|
256
|
+
if (url.pathname === `/admin/api/threads/2/agent-runs/${agentRunId}/trace`) return route.fulfill({ json: agentRunTracePayload() });
|
|
257
|
+
if (url.pathname === `/admin/api/threads/3/agent-runs/${incompleteAgentRunId}/trace`) return route.fulfill({ json: incompleteAgentRunTracePayload() });
|
|
151
258
|
if (url.pathname === '/admin/api/threads') return route.fulfill({ json: fixtures.threads });
|
|
152
259
|
if (url.pathname === '/admin/api/threads/1') return route.fulfill({
|
|
153
260
|
json: {
|
|
@@ -158,6 +265,23 @@ async function mockApi(context) {
|
|
|
158
265
|
],
|
|
159
266
|
},
|
|
160
267
|
});
|
|
268
|
+
if (url.pathname === '/admin/api/threads/2') return route.fulfill({
|
|
269
|
+
json: {
|
|
270
|
+
thread: fixtures.threads[1],
|
|
271
|
+
messages: [
|
|
272
|
+
{ id: 3, direction: 'in', content: '把员工资料改成新的姓名', agent_run_id: agentRunId, created_at: new Date().toISOString() },
|
|
273
|
+
{ id: 4, direction: 'out', content: '员工资料已修改', agent_run_id: agentRunId, created_at: new Date().toISOString() },
|
|
274
|
+
],
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
if (url.pathname === '/admin/api/threads/3') return route.fulfill({
|
|
278
|
+
json: {
|
|
279
|
+
thread: fixtures.threads[2],
|
|
280
|
+
messages: [
|
|
281
|
+
{ id: 5, direction: 'in', content: '等待本地智能体继续处理', agent_run_id: incompleteAgentRunId, created_at: new Date().toISOString() },
|
|
282
|
+
],
|
|
283
|
+
},
|
|
284
|
+
});
|
|
161
285
|
if (url.pathname === '/admin/api/executors') return route.fulfill({ json: [{ executor_id: 'demo-exec', online: true, targets: ['demo-agent'] }] });
|
|
162
286
|
if (url.pathname === '/admin/api/projects') return route.fulfill({ json: [] });
|
|
163
287
|
if (url.pathname === '/admin/api/demo-dataset/status') return route.fulfill({ json: fixtures.demoStatus });
|
|
@@ -234,6 +358,26 @@ try {
|
|
|
234
358
|
await expectVisible(page, '工具返回');
|
|
235
359
|
await expectVisible(page, '任务完成');
|
|
236
360
|
|
|
361
|
+
await page.getByText('员工资料已修改').first().click();
|
|
362
|
+
await expectVisible(page, '把员工资料改成新的姓名');
|
|
363
|
+
await page.locator('.tracetoggle').filter({ hasText: '执行轨迹' }).first().click();
|
|
364
|
+
await expectVisible(page, '本地智能体编排');
|
|
365
|
+
await expectVisible(page, '隐藏推理不会上传');
|
|
366
|
+
await expectVisible(page, '中枢治理');
|
|
367
|
+
await expectVisible(page, 'staff_edit');
|
|
368
|
+
if (await page.getByText('未挂工具', { exact: true }).count()) {
|
|
369
|
+
throw new Error('Agent Client 轨迹不应显示旧 Job 的「未挂工具」提示');
|
|
370
|
+
}
|
|
371
|
+
if (await page.getByText('PRIVATE_REASONING', { exact: false }).count()) {
|
|
372
|
+
throw new Error('Agent Client 会话轨迹不得展示隐藏推理');
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
await page.getByText('等待本地智能体继续处理').first().click();
|
|
376
|
+
await page.locator('.tracetoggle').filter({ hasText: '执行轨迹' }).first().click();
|
|
377
|
+
await expectVisible(page, '上下文已就绪');
|
|
378
|
+
await expectVisible(page, '已批准,等待本地智能体续执行');
|
|
379
|
+
await expectVisible(page, '不代表全量');
|
|
380
|
+
|
|
237
381
|
if (errors.length) throw new Error(`console errors:\n${errors.join('\n')}`);
|
|
238
382
|
console.log('✓ console e2e passed');
|
|
239
383
|
} finally {
|
package/scripts/export-oss.mjs
CHANGED
|
@@ -2,11 +2,14 @@ import { execFileSync, spawnSync } from 'node:child_process';
|
|
|
2
2
|
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync } from 'node:fs';
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
4
|
|
|
5
|
+
import { findPublicContentDenylistMatches, loadPrivateExactTextDenylist } from './public-content-denylist.mjs';
|
|
6
|
+
|
|
5
7
|
const root = process.cwd();
|
|
6
8
|
const outRoot = join(root, '.oss-dist');
|
|
7
9
|
const exportDir = join(outRoot, 'bailinghub');
|
|
8
10
|
const tarball = join(outRoot, 'bailinghub-oss-source.tgz');
|
|
9
11
|
const findings = [];
|
|
12
|
+
const privateExactTextDenylist = loadPrivateExactTextDenylist({ root });
|
|
10
13
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: '1' };
|
|
11
14
|
const tarNoMetadataArgs = ['--no-xattrs'];
|
|
12
15
|
|
|
@@ -52,16 +55,6 @@ const forbiddenFiles = new Set([
|
|
|
52
55
|
'config.json',
|
|
53
56
|
'.env',
|
|
54
57
|
]);
|
|
55
|
-
const rx = (parts, flags = '') => new RegExp(parts.join(''), flags);
|
|
56
|
-
|
|
57
|
-
const bannedText = [
|
|
58
|
-
{ name: 'local machine path', re: rx(['/Users/', 'macmini', '|', '项目', '\\/www']) },
|
|
59
|
-
{ name: 'known leaked password', re: rx(['Nie', '0712', '\\.\\.']) },
|
|
60
|
-
{ name: 'known managed MySQL host', re: rx(['sh-', 'cynosdb', 'mysql', '-[A-Za-z0-9.-]+', 'tencent', 'cdb\\.com']) },
|
|
61
|
-
{ name: 'known internal git token', re: rx(['pt', '-[A-Za-z0-9_-]{20,}']) },
|
|
62
|
-
{ name: 'GitHub PAT', re: rx(['github', '_pat', '_[A-Za-z0-9_]+']) },
|
|
63
|
-
{ name: 'old official domain', re: rx(['bailing\\.', 'bnopen', '\\.cn', '|', 'bnopen', '\\.cn']) },
|
|
64
|
-
];
|
|
65
58
|
const forbiddenPublicWording = new RegExp([
|
|
66
59
|
'商业' + '版',
|
|
67
60
|
'商业' + '扩展',
|
|
@@ -122,8 +115,8 @@ function scanExport() {
|
|
|
122
115
|
const textFiles = files.filter((file) => /\.(?:md|ts|tsx|js|mjs|json|sql|php|py|vue|html|css|sh|yml|yaml|txt|gitignore|npmignore|dockerignore)$/.test(file));
|
|
123
116
|
for (const file of textFiles) {
|
|
124
117
|
const text = readFileSync(join(exportDir, file), 'utf8');
|
|
125
|
-
for (const
|
|
126
|
-
|
|
118
|
+
for (const match of findPublicContentDenylistMatches(text, privateExactTextDenylist)) {
|
|
119
|
+
findings.push(`${file}: ${match}`);
|
|
127
120
|
}
|
|
128
121
|
if (file !== 'LICENSE' && forbiddenPublicWording.test(text)) {
|
|
129
122
|
findings.push(`${file}: use neutral public wording for private extension boundaries`);
|
package/scripts/install.sh
CHANGED
|
@@ -275,7 +275,7 @@ write_env() {
|
|
|
275
275
|
TOOL_SECRET="${DEMO_TOOL_SECRET:-$(secret)}"
|
|
276
276
|
CLIENT_TOKEN="${DEMO_CLIENT_TOKEN:-$(secret)}"
|
|
277
277
|
IMAGE_TAG="${BAILING_IMAGE_TAG:-$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$APP_DIR/package.json" | head -1)}"
|
|
278
|
-
[ -n "$IMAGE_TAG" ] || IMAGE_TAG="0.
|
|
278
|
+
[ -n "$IMAGE_TAG" ] || IMAGE_TAG="0.5.0"
|
|
279
279
|
IMAGE_REGISTRY="${BAILING_IMAGE_REGISTRY:-$DEFAULT_IMAGE_REGISTRY}"
|
|
280
280
|
IMAGE_NAMESPACE="${BAILING_IMAGE_NAMESPACE:-$DEFAULT_IMAGE_NAMESPACE}"
|
|
281
281
|
cat > "$ENV_FILE" <<EOF
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
2
|
+
import { isAbsolute, relative, sep } from 'node:path';
|
|
3
|
+
|
|
4
|
+
export const PUBLIC_DENYLIST_JSON_ENV = 'BAILING_PUBLIC_DENYLIST_JSON';
|
|
5
|
+
export const PUBLIC_DENYLIST_FILE_ENV = 'BAILING_PUBLIC_DENYLIST_FILE';
|
|
6
|
+
|
|
7
|
+
export const genericPublicContentRules = Object.freeze([
|
|
8
|
+
{
|
|
9
|
+
name: 'private key',
|
|
10
|
+
re: /-----BEGIN (?:RSA |DSA |EC |OPENSSH |)PRIVATE KEY-----/,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'GitHub personal access token',
|
|
14
|
+
re: /\b(?:github_pat_[A-Za-z0-9_]{20,}|gh[pousr]_[A-Za-z0-9_]{20,})\b/,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'local user absolute path',
|
|
18
|
+
re: /(?:^|[\s"'`=(])(?:\/Users\/[^/\s"'`]+\/|\/home\/[^/\s"'`]+\/|[A-Za-z]:\\Users\\[^\\\s"'`]+\\)/,
|
|
19
|
+
},
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
function parseExactValues(raw, sourceName) {
|
|
23
|
+
let parsed;
|
|
24
|
+
try {
|
|
25
|
+
parsed = JSON.parse(raw);
|
|
26
|
+
} catch {
|
|
27
|
+
throw new Error(`${sourceName} must contain a JSON array of exact text values`);
|
|
28
|
+
}
|
|
29
|
+
if (!Array.isArray(parsed)) {
|
|
30
|
+
throw new Error(`${sourceName} must contain a JSON array of exact text values`);
|
|
31
|
+
}
|
|
32
|
+
return parsed.map((value, index) => {
|
|
33
|
+
if (typeof value !== 'string' || value.trim().length < 4) {
|
|
34
|
+
throw new Error(`${sourceName} entry #${index + 1} must be a non-empty string of at least 4 characters`);
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function isInsideRoot(rootPath, candidatePath) {
|
|
41
|
+
const rel = relative(rootPath, candidatePath);
|
|
42
|
+
return rel === '' || (!rel.startsWith(`..${sep}`) && rel !== '..' && !isAbsolute(rel));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function loadPrivateExactTextDenylist({ root = process.cwd(), env = process.env } = {}) {
|
|
46
|
+
const values = [];
|
|
47
|
+
const inlineJson = env[PUBLIC_DENYLIST_JSON_ENV];
|
|
48
|
+
if (inlineJson) {
|
|
49
|
+
values.push(...parseExactValues(inlineJson, PUBLIC_DENYLIST_JSON_ENV));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const file = env[PUBLIC_DENYLIST_FILE_ENV];
|
|
53
|
+
if (file) {
|
|
54
|
+
if (!isAbsolute(file)) {
|
|
55
|
+
throw new Error(`${PUBLIC_DENYLIST_FILE_ENV} must point to an absolute path outside the repository`);
|
|
56
|
+
}
|
|
57
|
+
if (!existsSync(file)) {
|
|
58
|
+
throw new Error(`${PUBLIC_DENYLIST_FILE_ENV} does not exist`);
|
|
59
|
+
}
|
|
60
|
+
const rootPath = realpathSync(root);
|
|
61
|
+
const filePath = realpathSync(file);
|
|
62
|
+
if (isInsideRoot(rootPath, filePath)) {
|
|
63
|
+
throw new Error(`${PUBLIC_DENYLIST_FILE_ENV} must point outside the repository`);
|
|
64
|
+
}
|
|
65
|
+
values.push(...parseExactValues(readFileSync(filePath, 'utf8'), PUBLIC_DENYLIST_FILE_ENV));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return [...new Set(values)];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function findPublicContentDenylistMatches(text, exactValues = [], { generic = true } = {}) {
|
|
72
|
+
const matches = [];
|
|
73
|
+
if (generic) {
|
|
74
|
+
for (const rule of genericPublicContentRules) {
|
|
75
|
+
if (rule.re.test(text)) matches.push(rule.name);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exactValues.forEach((value, index) => {
|
|
79
|
+
if (text.includes(value)) matches.push(`private exact text #${index + 1}`);
|
|
80
|
+
});
|
|
81
|
+
return [...new Set(matches)];
|
|
82
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import test from 'node:test';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
PUBLIC_DENYLIST_FILE_ENV,
|
|
9
|
+
PUBLIC_DENYLIST_JSON_ENV,
|
|
10
|
+
findPublicContentDenylistMatches,
|
|
11
|
+
loadPrivateExactTextDenylist,
|
|
12
|
+
} from './public-content-denylist.mjs';
|
|
13
|
+
|
|
14
|
+
const PLACEHOLDER = 'DEPLOYMENT_ONLY_MARKER_ALPHA_42';
|
|
15
|
+
|
|
16
|
+
test('loads neutral exact text markers from CI JSON', () => {
|
|
17
|
+
const values = loadPrivateExactTextDenylist({
|
|
18
|
+
env: { [PUBLIC_DENYLIST_JSON_ENV]: JSON.stringify([PLACEHOLDER]) },
|
|
19
|
+
});
|
|
20
|
+
assert.deepEqual(values, [PLACEHOLDER]);
|
|
21
|
+
assert.deepEqual(findPublicContentDenylistMatches(`prefix ${PLACEHOLDER} suffix`, values), ['private exact text #1']);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('loads neutral exact text markers from a repository-external file', () => {
|
|
25
|
+
const externalRoot = mkdtempSync(join(tmpdir(), 'bailinghub-denylist-test-'));
|
|
26
|
+
const file = join(externalRoot, 'denylist.json');
|
|
27
|
+
writeFileSync(file, JSON.stringify([PLACEHOLDER]));
|
|
28
|
+
try {
|
|
29
|
+
assert.deepEqual(loadPrivateExactTextDenylist({
|
|
30
|
+
root: process.cwd(),
|
|
31
|
+
env: { [PUBLIC_DENYLIST_FILE_ENV]: file },
|
|
32
|
+
}), [PLACEHOLDER]);
|
|
33
|
+
} finally {
|
|
34
|
+
rmSync(externalRoot, { recursive: true, force: true });
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('rejects a denylist file stored inside the repository', () => {
|
|
39
|
+
assert.throws(
|
|
40
|
+
() => loadPrivateExactTextDenylist({
|
|
41
|
+
root: process.cwd(),
|
|
42
|
+
env: { [PUBLIC_DENYLIST_FILE_ENV]: join(process.cwd(), 'package.json') },
|
|
43
|
+
}),
|
|
44
|
+
/must point outside the repository/,
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('keeps generic rules independent of deployment values', () => {
|
|
49
|
+
const marker = `github_pat_${'A'.repeat(24)}`;
|
|
50
|
+
const neutralUserPath = ['/Users', 'example', 'project', 'file.txt'].join('/');
|
|
51
|
+
assert.deepEqual(findPublicContentDenylistMatches(marker), ['GitHub personal access token']);
|
|
52
|
+
assert.deepEqual(findPublicContentDenylistMatches(neutralUserPath), ['local user absolute path']);
|
|
53
|
+
});
|
|
@@ -9,7 +9,7 @@ REGISTRY="${BAILING_IMAGE_REGISTRY:-$DEFAULT_REGISTRY}"
|
|
|
9
9
|
NAMESPACE="${BAILING_IMAGE_NAMESPACE:-$DEFAULT_NAMESPACE}"
|
|
10
10
|
PACKAGE_VERSION="$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' package.json | head -1)"
|
|
11
11
|
TAG="${BAILING_IMAGE_TAG:-$PACKAGE_VERSION}"
|
|
12
|
-
[ -n "$TAG" ] || TAG="0.
|
|
12
|
+
[ -n "$TAG" ] || TAG="0.5.0"
|
|
13
13
|
NODE_IMAGE="${BAILING_NODE_IMAGE:-node:22-bookworm-slim}"
|
|
14
14
|
PLATFORM="${BAILING_IMAGE_PLATFORM:-linux/amd64}"
|
|
15
15
|
PUSH="${BAILING_PUSH_IMAGES:-0}"
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { execFileSync, spawnSync } from 'node:child_process';
|
|
2
2
|
import { existsSync, readFileSync } from 'node:fs';
|
|
3
3
|
|
|
4
|
+
import { findPublicContentDenylistMatches, loadPrivateExactTextDenylist } from './public-content-denylist.mjs';
|
|
5
|
+
|
|
4
6
|
const findings = [];
|
|
7
|
+
const privateExactTextDenylist = loadPrivateExactTextDenylist();
|
|
5
8
|
const requiredRepoFiles = [
|
|
6
9
|
'README.md',
|
|
7
10
|
'LICENSE',
|
|
@@ -32,6 +35,7 @@ const requiredRepoFiles = [
|
|
|
32
35
|
'docs/RELEASE_NOTES_v0.3.2.md',
|
|
33
36
|
'docs/RELEASE_NOTES_v0.3.3.md',
|
|
34
37
|
'docs/RELEASE_NOTES_v0.3.4.md',
|
|
38
|
+
'docs/RELEASE_NOTES_v0.5.0.md',
|
|
35
39
|
'docs/CHANGELOG.md',
|
|
36
40
|
'docs/CLIENT_API.md',
|
|
37
41
|
'config.example.json',
|
|
@@ -200,7 +204,9 @@ function assertSdkMetadata() {
|
|
|
200
204
|
'sdk/node/src/index.mjs',
|
|
201
205
|
'sdk/python/bailing_connect/__init__.py',
|
|
202
206
|
'sdk/php/src/HubClient.php',
|
|
207
|
+
'sdk/php/src/AgentAuth.php',
|
|
203
208
|
'sdk/php7/src/HubClient.php',
|
|
209
|
+
'sdk/php7/src/AgentAuth.php',
|
|
204
210
|
'sdk/java/src/main/java/com/bailing/connect/BailingConnect.java',
|
|
205
211
|
'sdk/go/bailingconnect/connect.go',
|
|
206
212
|
'sdk/dotnet/Bailing.Connect/BailingConnect.cs',
|
|
@@ -246,7 +252,6 @@ function packageFiles() {
|
|
|
246
252
|
return dryRunPackageManifest.files.map((file) => String(file.path ?? ''));
|
|
247
253
|
}
|
|
248
254
|
|
|
249
|
-
const rx = (parts, flags = '') => new RegExp(parts.join(''), flags);
|
|
250
255
|
|
|
251
256
|
assertPackageMetadata();
|
|
252
257
|
assertRepoEntrance();
|
|
@@ -293,15 +298,6 @@ try {
|
|
|
293
298
|
}
|
|
294
299
|
|
|
295
300
|
const textFiles = files.filter((file) => /\.(?:md|ts|tsx|js|mjs|json|sql|php|py|vue|html|css|sh|yml|yaml|txt)$/.test(file));
|
|
296
|
-
const banned = [
|
|
297
|
-
{ name: 'local machine path', re: rx(['/Users/', 'macmini', '|', '项目', '\\/www']) },
|
|
298
|
-
{ name: 'known leaked password', re: rx(['Nie', '0712', '\\.\\.']) },
|
|
299
|
-
{ name: 'known managed MySQL host', re: rx(['sh-', 'cynosdb', 'mysql', '-[A-Za-z0-9.-]+', 'tencent', 'cdb\\.com']) },
|
|
300
|
-
{ name: 'known internal git token', re: rx(['pt', '-[A-Za-z0-9_-]{20,}']) },
|
|
301
|
-
{ name: 'GitHub PAT', re: rx(['github', '_pat', '_[A-Za-z0-9_]+']) },
|
|
302
|
-
{ name: 'old official domain', re: rx(['bailing\\.', 'bnopen', '\\.cn', '|', 'bnopen', '\\.cn']) },
|
|
303
|
-
{ name: 'legacy internal bucket example', re: /bainiancloud-\d+/ },
|
|
304
|
-
];
|
|
305
301
|
const forbiddenPublicWording = new RegExp([
|
|
306
302
|
'商业' + '版',
|
|
307
303
|
'商业' + '扩展',
|
|
@@ -326,8 +322,8 @@ try {
|
|
|
326
322
|
} catch {
|
|
327
323
|
continue;
|
|
328
324
|
}
|
|
329
|
-
for (const
|
|
330
|
-
|
|
325
|
+
for (const match of findPublicContentDenylistMatches(text, privateExactTextDenylist)) {
|
|
326
|
+
findings.push(`${file}: ${match}`);
|
|
331
327
|
}
|
|
332
328
|
if (file !== 'LICENSE' && forbiddenPublicWording.test(text)) {
|
|
333
329
|
findings.push(`${file}: use neutral public wording for private extension boundaries`);
|