bailinghub 0.10.0 → 0.11.1
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/CONTRIBUTING.md +20 -0
- package/README.en.md +6 -6
- package/README.md +6 -6
- package/SECURITY.md +20 -0
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/docker-compose.images.yml +2 -2
- package/docs/AGENT_CONVERSATION_AUDIT.en.md +8 -2
- package/docs/AGENT_CONVERSATION_AUDIT.md +8 -1
- package/docs/CHANGELOG.en.md +29 -1
- package/docs/CHANGELOG.md +29 -1
- package/docs/IMPLEMENTATION_STATUS.en.md +12 -3
- package/docs/IMPLEMENTATION_STATUS.md +12 -3
- package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
- package/docs/INDEPENDENT_VALIDATION.md +4 -4
- package/docs/MODEL_CONTINUATION.en.md +8 -0
- package/docs/MODEL_CONTINUATION.md +8 -0
- package/docs/MODEL_OUTPUT_BUDGET.en.md +1 -0
- package/docs/MODEL_OUTPUT_BUDGET.md +1 -0
- package/docs/README.en.md +6 -0
- package/docs/README.md +6 -0
- package/docs/RELEASE_NOTES_v0.10.1.en.md +41 -0
- package/docs/RELEASE_NOTES_v0.10.1.md +41 -0
- package/docs/RELEASE_NOTES_v0.11.0.en.md +19 -0
- package/docs/RELEASE_NOTES_v0.11.0.md +19 -0
- package/docs/RELEASE_NOTES_v0.11.1.en.md +25 -0
- package/docs/RELEASE_NOTES_v0.11.1.md +25 -0
- package/docs/UPGRADE_v0.10.1.en.md +66 -0
- package/docs/UPGRADE_v0.10.1.md +66 -0
- package/docs/UPGRADE_v0.11.0.en.md +24 -0
- package/docs/UPGRADE_v0.11.0.md +24 -0
- package/docs/UPGRADE_v0.11.1.en.md +28 -0
- package/docs/UPGRADE_v0.11.1.md +28 -0
- package/docs/security/GRC_EVIDENCE.md +54 -0
- package/docs/user-guide/console-map.md +2 -2
- package/package.json +5 -3
- package/scripts/check-doc-links.mjs +6 -0
- package/scripts/check-image-tags.sh +1 -1
- package/scripts/check-php-sdk-artifacts.mjs +152 -0
- package/scripts/check-php-sdk-artifacts.test.mjs +99 -0
- package/scripts/check-release-consistency.test.mjs +2 -2
- package/scripts/copy-acr-platform-image.sh +42 -0
- package/scripts/e2e-console-runtime-audit.mjs +7 -0
- package/scripts/e2e-console-troubleshooting-extra.mjs +4 -4
- package/scripts/e2e-console.mjs +90 -23
- package/scripts/install.sh +1 -1
- package/scripts/notification-console-test.mjs +2 -1
- package/scripts/publish-images.sh +1 -1
- package/scripts/release-audit.mjs +13 -1
- package/scripts/restore-ghcr-version.sh +48 -0
- package/scripts/sdk-declaration-contract-test.ts +34 -0
- package/scripts/sdk-p1-check.mjs +62 -26
- package/scripts/test-acr-platform-copy.sh +152 -0
- package/scripts/verify-github-repo.mjs +12 -0
- package/sdk/dotnet/Bailing.Connect/BailingConnect.cs +4 -4
- package/sdk/dotnet/README.md +8 -0
- package/sdk/dotnet/tests/Declaration/Declaration.csproj +11 -0
- package/sdk/dotnet/tests/Declaration/Program.cs +74 -0
- package/sdk/go/README.md +8 -0
- package/sdk/go/bailingconnect/connect.go +5 -5
- package/sdk/go/bailingconnect/declaration_test.go +107 -0
- package/sdk/java/README.md +13 -0
- package/sdk/java/src/main/java/com/bailing/connect/BailingConnect.java +4 -4
- package/sdk/java/tests/DeclarationTest.java +70 -0
- package/sdk/node/README.md +8 -0
- package/sdk/node/src/index.mjs +4 -4
- package/sdk/node/tests/declaration.test.mjs +41 -0
- package/sdk/php/README.md +16 -0
- package/sdk/php/src/Attributes/AiTool.php +4 -4
- package/sdk/php/src/SpecBuilder.php +8 -8
- package/sdk/php/tests/declaration-serialization.php +103 -0
- package/sdk/php7/README.md +14 -0
- package/sdk/php7/src/ToolDef.php +3 -3
- package/sdk/php7/src/ToolSpec.php +8 -13
- package/sdk/php7/tests/declaration-serialization.php +103 -0
- package/sdk/python/README.md +8 -0
- package/sdk/python/bailing_connect/__init__.py +6 -6
- package/sdk/python/tests/test_declaration.py +61 -0
- package/src/core/config/console-task-location.test.ts +12 -24
- package/src/core/contracts/explicit-capability-values.test.ts +62 -0
- package/src/core/contracts/openapi-tools.ts +2 -2
- package/src/core/contracts/tool-annotations.ts +4 -4
- package/src/core/runtime/credential-resolver.ts +3 -3
- package/src/infrastructure/config/config-agent-conversation-audit-repository.test.ts +29 -0
- package/src/infrastructure/config/config-agent-conversation-audit-repository.ts +142 -9
- package/src/infrastructure/config/config-conversation-feed.integration.test.ts +134 -0
- package/src/infrastructure/config/config-conversation-ledger.test.ts +47 -1
- package/src/infrastructure/config/config-conversation-ledger.ts +24 -8
- package/src/infrastructure/config/config-observability-ledger.ts +32 -4
- package/src/infrastructure/config/config-recent-jobs.integration.test.ts +45 -0
- package/src/infrastructure/config/configstore.ts +4 -4
- package/src/infrastructure/config/conversation-delivery-message.ts +12 -0
- package/src/modules/usage/contracts.ts +1 -0
- package/src/modules/usage/model-context.test.ts +106 -0
- package/src/modules/usage/model-context.ts +54 -0
- package/src/modules/usage/model-continuation.test.ts +27 -0
- package/src/modules/usage/provider.test.ts +40 -0
- package/src/modules/usage/provider.ts +21 -3
- package/src/modules/usage/repository.ts +2 -1
- package/src/routes/admin-conversation-audit.ts +20 -3
- package/src/routes/admin-history-cursor.ts +12 -0
- package/src/routes/admin-runtime.test.ts +47 -0
- package/src/routes/admin-runtime.ts +32 -3
- package/src/routes/admin-usage.ts +12 -1
- package/src/routes/admin.ts +6 -1
- package/src/routes/agent-conversation-audit.test.ts +47 -3
- package/src/test-support/agent-conversation-audit-fixture.ts +9 -1
- package/web/connect/bailing-connect-php.tgz +0 -0
- package/web/connect/bailing-connect-php7.tgz +0 -0
- package/web/console/assets/{Accounts-Dhyw-7wF.js → Accounts-B1Ne8Xx2.js} +1 -1
- package/web/console/assets/AgentClients-CiGQ-n2i.js +1 -0
- package/web/console/assets/AgentClients-xEIfsj7w.css +1 -0
- package/web/console/assets/AgentTasks-CaCeYv60.css +1 -0
- package/web/console/assets/AgentTasks-CylHZHHq.js +2 -0
- package/web/console/assets/{Approvals-CQx1YWxW.js → Approvals-wD4Iv80G.js} +1 -1
- package/web/console/assets/{Audit--QcdVlMh.js → Audit-BStlxkPw.js} +1 -1
- package/web/console/assets/{BrandLockup-DQcaW4Nt.js → BrandLockup-BAhrPnhy.js} +1 -1
- package/web/console/assets/Channels-DAlIgNxo.js +105 -0
- package/web/console/assets/Channels-WwRHFKJn.css +1 -0
- package/web/console/assets/ChatEntries-CPx-E9aJ.js +7 -0
- package/web/console/assets/ChatEntries-DALYfRDP.css +1 -0
- package/web/console/assets/Clients-gqNFusNW.css +1 -0
- package/web/console/assets/Clients-w97QPpFD.js +3 -0
- package/web/console/assets/Cost-CNDZaif-.css +1 -0
- package/web/console/assets/Cost-CxtN0mca.js +1 -0
- package/web/console/assets/Credentials-6c6aktzZ.css +1 -0
- package/web/console/assets/Credentials-BhpoH-hR.js +1 -0
- package/web/console/assets/{Diagnostics-CyoM1XrZ.js → Diagnostics-DnC-ODuy.js} +1 -1
- package/web/console/assets/Executors-CCTYuZf4.js +1 -0
- package/web/console/assets/Executors-CQ8iw3kK.css +1 -0
- package/web/console/assets/{HelpTip-DLlhaGQp.js → HelpTip-piedkqU-.js} +1 -1
- package/web/console/assets/Kb-CFCa-7LY.css +1 -0
- package/web/console/assets/Kb-DKp3mwWB.js +2 -0
- package/web/console/assets/Login-g_aZWHQd.js +1 -0
- package/web/console/assets/Login-krXZsvoF.css +1 -0
- package/web/console/assets/Projects-BexeaCxT.css +1 -0
- package/web/console/assets/Projects-DurExYV9.js +1 -0
- package/web/console/assets/Routes-CKoIjkCM.css +1 -0
- package/web/console/assets/Routes-CX7Q7bkz.js +138 -0
- package/web/console/assets/Runs-C48kdEwk.css +1 -0
- package/web/console/assets/Runs-CQKEDsrH.js +3 -0
- package/web/console/assets/Setup-CtWCXXpj.css +1 -0
- package/web/console/assets/Setup-DzI8rEAc.js +1 -0
- package/web/console/assets/Shell-BQ-g_O7K.js +1 -0
- package/web/console/assets/Shell-Y2fZK5LV.css +1 -0
- package/web/console/assets/StorageBuckets-CWxzIh0x.css +1 -0
- package/web/console/assets/StorageBuckets-DoZIzA7B.js +1 -0
- package/web/console/assets/SystemSettings-C3pFFzAQ.js +1 -0
- package/web/console/assets/SystemSettings-C5nv0K2a.css +1 -0
- package/web/console/assets/SystemStatus-Bbxu2dp4.css +1 -0
- package/web/console/assets/SystemStatus-BgekIK52.js +1 -0
- package/web/console/assets/Targets-CbLq7rgm.css +1 -0
- package/web/console/assets/Targets-DH1ZcK0J.js +1 -0
- package/web/console/assets/Tools-CMS1wVOm.js +5 -0
- package/web/console/assets/Tools-Qk1c5Rp8.css +1 -0
- package/web/console/assets/Usage-C0OkK7Jg.js +1 -0
- package/web/console/assets/Usage-Cue7CYnT.css +1 -0
- package/web/console/assets/UsageAccess-CHdWXvE8.js +1 -0
- package/web/console/assets/UsageAccess-nOa03hGb.css +1 -0
- package/web/console/assets/{UsageHelp-BmuiE1Ew.js → UsageHelp-BkIsuFUj.js} +1 -1
- package/web/console/assets/{console-location-Csv-xsnl.js → console-location-C_az_xHo.js} +1 -1
- package/web/console/assets/index-CbI5fbiD.js +2 -0
- package/web/console/assets/{index-B_5UfiTw.js → index-DwlsLKwM.js} +1 -1
- package/web/console/assets/request-WgSVj8ie.js +1 -0
- package/web/console/assets/{schema-o3mK4mid.js → schema-rb4T_2cj.js} +1 -1
- package/web/console/assets/task-page-location-BGxGar7H.js +1 -0
- package/web/console/assets/{use-list-location-cIPy2cKM.js → use-list-location-DeVfTTII.js} +1 -1
- package/web/console/assets/{use-unsaved-form-DScKD0h9.js → use-unsaved-form-B10XHC-n.js} +1 -1
- package/web/console/assets/{util-B40VqOwl.js → util-C0YJ70YU.js} +1 -1
- package/web/console/assets/{vendor-element-BT8tHCFk.js → vendor-element-BCC2kYn_.js} +7 -7
- package/web/console/assets/{vendor-mammoth-CVIXVxTN.js → vendor-mammoth-C7l0Q30g.js} +1 -1
- package/web/console/index.html +2 -2
- package/web-admin/package-lock.json +4 -4
- package/web-admin/package.json +1 -1
- package/web-admin/scripts/agent-task-control-smoke.mjs +26 -3
- package/web-admin/src/components/AgentSetupPanel.vue +19 -15
- package/web-admin/src/components/ChannelThread.vue +441 -0
- package/web-admin/src/components/ClientConversations.vue +397 -134
- package/web-admin/src/components/ConversationSourceTag.vue +24 -0
- package/web-admin/src/components/JobStatusTag.vue +18 -0
- package/web-admin/src/components/NotificationOutboxPanel.vue +5 -2
- package/web-admin/src/components/UsageServiceReferences.vue +6 -24
- package/web-admin/src/components/conversation-audit.ts +67 -2
- package/web-admin/src/components/conversation-reading-position.ts +27 -0
- package/web-admin/src/layout/Shell.vue +15 -17
- package/web-admin/src/onboarding-state.ts +5 -5
- package/web-admin/src/pages/AgentClients.vue +33 -27
- package/web-admin/src/pages/AgentTasks.vue +88 -43
- package/web-admin/src/pages/Channels.vue +15 -41
- package/web-admin/src/pages/ChatEntries.vue +13 -51
- package/web-admin/src/pages/Clients.vue +2 -2
- package/web-admin/src/pages/Cost.vue +10 -51
- package/web-admin/src/pages/Credentials.vue +1 -1
- package/web-admin/src/pages/Executors.vue +4 -3
- package/web-admin/src/pages/Kb.vue +4 -4
- package/web-admin/src/pages/Login.vue +7 -8
- package/web-admin/src/pages/Projects.vue +1 -1
- package/web-admin/src/pages/Routes.vue +46 -83
- package/web-admin/src/pages/Runs.vue +239 -567
- package/web-admin/src/pages/Setup.vue +20 -20
- package/web-admin/src/pages/StorageBuckets.vue +1 -1
- package/web-admin/src/pages/SystemSettings.vue +1 -2
- package/web-admin/src/pages/SystemStatus.vue +4 -6
- package/web-admin/src/pages/Targets.vue +0 -2
- package/web-admin/src/pages/Tools.vue +31 -22
- package/web-admin/src/pages/Usage.vue +110 -60
- package/web-admin/src/pages/UsageAccess.vue +2 -5
- package/web-admin/src/request.ts +5 -1
- package/web-admin/src/task-page-location.ts +6 -12
- package/web-admin/src/task-trace-presentation.ts +143 -0
- package/web-admin/tests/conversation-audit.test.mjs +23 -1
- package/web-admin/tests/model-context.browser.mjs +238 -0
- package/web-admin/tests/model-output-budget.browser.mjs +1 -0
- package/web/console/assets/AgentClients-BA0M26-I.css +0 -1
- package/web/console/assets/AgentClients-DWxb8-ko.js +0 -1
- package/web/console/assets/AgentTasks-DOyxANnx.css +0 -1
- package/web/console/assets/AgentTasks-DUHD4dzr.js +0 -2
- package/web/console/assets/Channels-DJJU3ksE.css +0 -1
- package/web/console/assets/Channels-cGS5WfQ-.js +0 -105
- package/web/console/assets/ChatEntries-BYpji27B.css +0 -1
- package/web/console/assets/ChatEntries-nh23Iz5O.js +0 -7
- package/web/console/assets/Clients-CX5EeYio.js +0 -3
- package/web/console/assets/Clients-CbZAou8E.css +0 -1
- package/web/console/assets/Cost-C6oQvz9P.css +0 -1
- package/web/console/assets/Cost-DOZfdNS9.js +0 -1
- package/web/console/assets/Credentials--aHs57yV.css +0 -1
- package/web/console/assets/Credentials-sy6W9Sac.js +0 -1
- package/web/console/assets/Executors-2Upi6bOS.css +0 -1
- package/web/console/assets/Executors-BQqqiFwt.js +0 -1
- package/web/console/assets/Kb-5R3ce4UU.js +0 -5
- package/web/console/assets/Kb-BM_PYi11.css +0 -1
- package/web/console/assets/Login-YKeUwdgo.js +0 -1
- package/web/console/assets/Login-xtPwDB5_.css +0 -1
- package/web/console/assets/Projects-DHwHrPT9.css +0 -1
- package/web/console/assets/Projects-Grgb6fOv.js +0 -1
- package/web/console/assets/Routes-DR_Yf02e.css +0 -1
- package/web/console/assets/Routes-DYgrXlRJ.js +0 -138
- package/web/console/assets/Runs-CwTddJJj.js +0 -3
- package/web/console/assets/Runs-D4FOvNfu.css +0 -1
- package/web/console/assets/Setup-Ca0b1d1-.css +0 -1
- package/web/console/assets/Setup-D_xUPNDq.js +0 -1
- package/web/console/assets/Shell-BTg8Vw_L.css +0 -1
- package/web/console/assets/Shell-Dfam2Uoj.js +0 -1
- package/web/console/assets/StorageBuckets-7QLBpV4a.css +0 -1
- package/web/console/assets/StorageBuckets-CP6e50wI.js +0 -1
- package/web/console/assets/SystemSettings-BRYKyJNa.js +0 -1
- package/web/console/assets/SystemSettings-HsXGx0aH.css +0 -1
- package/web/console/assets/SystemStatus-B-VfRsQd.css +0 -1
- package/web/console/assets/SystemStatus-CbPsDsGt.js +0 -1
- package/web/console/assets/Targets-1j4-g6rC.css +0 -1
- package/web/console/assets/Targets-C2LkR2AF.js +0 -1
- package/web/console/assets/Tools-C9HPJqJb.css +0 -1
- package/web/console/assets/Tools-C9JNJUS0.js +0 -2
- package/web/console/assets/Usage-D1Mv6vGY.js +0 -1
- package/web/console/assets/Usage-DMOzUsqh.css +0 -1
- package/web/console/assets/UsageAccess-77LmGCm6.js +0 -1
- package/web/console/assets/UsageAccess-C6ZGxEgJ.css +0 -1
- package/web/console/assets/index-MjZJEFIN.js +0 -2
- package/web/console/assets/request-rqm6MT0s.js +0 -1
- package/web/console/assets/task-page-location-DWiGtAln.js +0 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { lstatSync, mkdtempSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { dirname, join, posix, resolve } from 'node:path';
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
7
|
+
|
|
8
|
+
const defaultRoot = fileURLToPath(new URL('../', import.meta.url));
|
|
9
|
+
const supportedSdks = ['php', 'php7'];
|
|
10
|
+
const sha256 = (value) => createHash('sha256').update(value).digest('hex');
|
|
11
|
+
|
|
12
|
+
function run(command, args) {
|
|
13
|
+
const result = spawnSync(command, args, { maxBuffer: 32 * 1024 * 1024 });
|
|
14
|
+
if (result.error) throw result.error;
|
|
15
|
+
if (result.status !== 0) {
|
|
16
|
+
throw new Error(`${command} exited ${result.status}: ${String(result.stderr || result.stdout).slice(0, 8000)}`);
|
|
17
|
+
}
|
|
18
|
+
return result.stdout;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function sourceFiles(root, relative = '') {
|
|
22
|
+
const files = [];
|
|
23
|
+
for (const name of readdirSync(join(root, relative)).sort()) {
|
|
24
|
+
if (/[\r\n\\]/.test(name)) throw new Error(`Unsupported SDK filename: ${JSON.stringify(name)}`);
|
|
25
|
+
const path = relative ? `${relative}/${name}` : name;
|
|
26
|
+
const stat = lstatSync(join(root, path));
|
|
27
|
+
if (stat.isSymbolicLink()) throw new Error(`SDK source symlinks are not allowed: ${path}`);
|
|
28
|
+
if (stat.isDirectory()) files.push(...sourceFiles(root, path));
|
|
29
|
+
else if (stat.isFile()) files.push(path);
|
|
30
|
+
else throw new Error(`SDK source contains a non-regular file: ${path}`);
|
|
31
|
+
}
|
|
32
|
+
return files.sort();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function lines(output) {
|
|
36
|
+
const result = String(output).split('\n');
|
|
37
|
+
if (result.at(-1) === '') result.pop();
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function archiveFiles(archive, prefix) {
|
|
42
|
+
const names = lines(run('tar', ['-tzf', archive]));
|
|
43
|
+
const details = lines(run('tar', ['-tvzf', archive]));
|
|
44
|
+
if (names.length !== details.length) throw new Error('Archive listing and file types do not agree');
|
|
45
|
+
const seen = new Set();
|
|
46
|
+
const files = [];
|
|
47
|
+
for (let index = 0; index < names.length; index++) {
|
|
48
|
+
const name = names[index];
|
|
49
|
+
const normalized = name.endsWith('/') ? name.slice(0, -1) : name;
|
|
50
|
+
if (!normalized || /[\r\n\\]/.test(normalized)
|
|
51
|
+
|| posix.normalize(normalized) !== normalized
|
|
52
|
+
|| (normalized !== prefix && !normalized.startsWith(`${prefix}/`))) {
|
|
53
|
+
throw new Error(`Unsafe archive path: ${JSON.stringify(name)}`);
|
|
54
|
+
}
|
|
55
|
+
if (seen.has(normalized)) throw new Error(`Duplicate archive path: ${name}`);
|
|
56
|
+
seen.add(normalized);
|
|
57
|
+
const type = details[index]?.[0];
|
|
58
|
+
if (type !== '-' && type !== 'd') throw new Error(`Archive links or special files are not allowed: ${name}`);
|
|
59
|
+
if (type === '-') {
|
|
60
|
+
if (normalized === prefix) throw new Error('Archive root must be a directory');
|
|
61
|
+
files.push(normalized.slice(prefix.length + 1));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return files.sort();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function regression(driver, sdkRoot, phpCommand, sdk) {
|
|
68
|
+
const output = run(phpCommand, [driver, sdkRoot]);
|
|
69
|
+
let result;
|
|
70
|
+
try { result = JSON.parse(String(output)); }
|
|
71
|
+
catch { throw new Error(`${sdk}: generator regression did not return JSON`); }
|
|
72
|
+
if (result.sdk !== sdk || result.passed !== true || result.matrixCases !== 24
|
|
73
|
+
|| result.idempotenceCases !== 6 || !Array.isArray(result.errors) || result.errors.length !== 0
|
|
74
|
+
|| !Array.isArray(result.matrix) || result.matrix.length !== 24
|
|
75
|
+
|| !Array.isArray(result.idempotence) || result.idempotence.length !== 6
|
|
76
|
+
|| !Number.isInteger(result.checks) || result.checks < 100) {
|
|
77
|
+
throw new Error(`${sdk}: generator regression is failed or incomplete`);
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function verifyPhpSdkArtifact({ root = defaultRoot, sdk, phpCommand = 'php' }) {
|
|
83
|
+
if (!supportedSdks.includes(sdk)) throw new Error(`Unsupported PHP SDK: ${sdk}`);
|
|
84
|
+
const source = join(root, 'sdk', sdk);
|
|
85
|
+
const archiveRelative = `web/connect/bailing-connect-${sdk}.tgz`;
|
|
86
|
+
const archive = join(root, archiveRelative);
|
|
87
|
+
const prefix = `bailing-connect-${sdk}`;
|
|
88
|
+
const expected = sourceFiles(source);
|
|
89
|
+
const actual = archiveFiles(archive, prefix);
|
|
90
|
+
const missing = expected.filter((file) => !actual.includes(file));
|
|
91
|
+
const unexpected = actual.filter((file) => !expected.includes(file));
|
|
92
|
+
if (missing.length || unexpected.length) {
|
|
93
|
+
throw new Error(`${sdk}: archive file set differs from source; missing=${JSON.stringify(missing)}, unexpected=${JSON.stringify(unexpected)}`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const temp = mkdtempSync(join(tmpdir(), 'bailinghub-php-artifact-'));
|
|
97
|
+
const extracted = join(temp, prefix);
|
|
98
|
+
const files = [];
|
|
99
|
+
try {
|
|
100
|
+
for (const file of expected) {
|
|
101
|
+
// Read each validated regular member to stdout, then write only our own
|
|
102
|
+
// source-derived paths. Never let tar create paths, links, or devices.
|
|
103
|
+
const bytes = run('tar', ['-xOzf', archive, '--', `${prefix}/${file}`]);
|
|
104
|
+
const sourceBytes = readFileSync(join(source, file));
|
|
105
|
+
if (!sourceBytes.equals(bytes)) throw new Error(`${sdk}: archive bytes differ from source: ${file}`);
|
|
106
|
+
files.push({ path: file, bytes: bytes.length, sha256: sha256(bytes) });
|
|
107
|
+
const destination = join(extracted, file);
|
|
108
|
+
mkdirSync(dirname(destination), { recursive: true });
|
|
109
|
+
writeFileSync(destination, bytes, { mode: 0o600 });
|
|
110
|
+
}
|
|
111
|
+
const sourceDriver = join(source, 'tests', 'declaration-serialization.php');
|
|
112
|
+
const artifactDriver = join(extracted, 'tests', 'declaration-serialization.php');
|
|
113
|
+
const sourceRegression = regression(sourceDriver, source, phpCommand, sdk);
|
|
114
|
+
const artifactRegression = regression(artifactDriver, extracted, phpCommand, sdk);
|
|
115
|
+
return {
|
|
116
|
+
sdk,
|
|
117
|
+
archive: archiveRelative,
|
|
118
|
+
archiveSha256: sha256(readFileSync(archive)),
|
|
119
|
+
fileCount: files.length,
|
|
120
|
+
files,
|
|
121
|
+
sourceRegression,
|
|
122
|
+
artifactRegression,
|
|
123
|
+
};
|
|
124
|
+
} finally {
|
|
125
|
+
rmSync(temp, { recursive: true, force: true });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function options(argv) {
|
|
130
|
+
const result = { root: defaultRoot, sdks: supportedSdks, phpCommand: 'php' };
|
|
131
|
+
for (let index = 0; index < argv.length; index++) {
|
|
132
|
+
const arg = argv[index];
|
|
133
|
+
const value = argv[++index];
|
|
134
|
+
if (!value) throw new Error(`Missing value for ${arg}`);
|
|
135
|
+
if (arg === '--root') result.root = resolve(value);
|
|
136
|
+
else if (arg === '--sdk' && supportedSdks.includes(value)) result.sdks = [value];
|
|
137
|
+
else if (arg === '--php') result.phpCommand = value;
|
|
138
|
+
else throw new Error(`Unsupported argument: ${arg} ${value}`);
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (process.argv[1] && pathToFileURL(resolve(process.argv[1])).href === import.meta.url) {
|
|
144
|
+
try {
|
|
145
|
+
const { root, sdks, phpCommand } = options(process.argv.slice(2));
|
|
146
|
+
const artifacts = sdks.map((sdk) => verifyPhpSdkArtifact({ root, sdk, phpCommand }));
|
|
147
|
+
process.stdout.write(`${JSON.stringify({ passed: true, artifacts }, null, 2)}\n`);
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.error(`PHP SDK artifact check failed: ${error.message}`);
|
|
150
|
+
process.exitCode = 1;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { cpSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import test from 'node:test';
|
|
7
|
+
import { verifyPhpSdkArtifact } from './check-php-sdk-artifacts.mjs';
|
|
8
|
+
|
|
9
|
+
function fixture(t, driver) {
|
|
10
|
+
const root = mkdtempSync(join(tmpdir(), 'php-artifact-check-test-'));
|
|
11
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
12
|
+
const source = join(root, 'sdk', 'php7');
|
|
13
|
+
const stage = join(root, 'stage');
|
|
14
|
+
const prefix = 'bailing-connect-php7';
|
|
15
|
+
const staged = join(stage, prefix);
|
|
16
|
+
mkdirSync(join(source, 'src'), { recursive: true });
|
|
17
|
+
mkdirSync(join(source, 'tests'), { recursive: true });
|
|
18
|
+
mkdirSync(join(root, 'web', 'connect'), { recursive: true });
|
|
19
|
+
writeFileSync(join(source, 'src', 'Tool.php'), '<?php return "fixture";\n');
|
|
20
|
+
// These tests exercise archive enforcement. The real SDK matrix drivers are
|
|
21
|
+
// executed separately by the artifact command against the actual packages.
|
|
22
|
+
const report = {
|
|
23
|
+
sdk: 'php7', passed: true, matrixCases: 24, idempotenceCases: 6,
|
|
24
|
+
checks: 171, errors: [], matrix: Array(24).fill({}), idempotence: Array(6).fill({}),
|
|
25
|
+
};
|
|
26
|
+
writeFileSync(join(source, 'tests', 'declaration-serialization.php'), driver ?? `<?php echo '${JSON.stringify(report)}';`);
|
|
27
|
+
cpSync(source, staged, { recursive: true });
|
|
28
|
+
const archive = join(root, 'web', 'connect', `${prefix}.tgz`);
|
|
29
|
+
const pack = (members = [prefix]) => {
|
|
30
|
+
const packed = spawnSync('tar', ['-czf', archive, '-C', stage, ...members], { encoding: 'utf8' });
|
|
31
|
+
assert.equal(packed.status, 0, packed.stderr);
|
|
32
|
+
};
|
|
33
|
+
pack();
|
|
34
|
+
return { root, source, staged, prefix, pack };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
test('valid archive verifies complete file identity and both regression executions', (t) => {
|
|
38
|
+
const { root } = fixture(t);
|
|
39
|
+
const result = verifyPhpSdkArtifact({ root, sdk: 'php7' });
|
|
40
|
+
assert.equal(result.fileCount, 2);
|
|
41
|
+
assert.match(result.archiveSha256, /^[0-9a-f]{64}$/);
|
|
42
|
+
assert.deepEqual(result.files.map((file) => file.path), ['src/Tool.php', 'tests/declaration-serialization.php']);
|
|
43
|
+
assert.equal(result.sourceRegression.passed, true);
|
|
44
|
+
assert.equal(result.artifactRegression.passed, true);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('stale archive bytes fail before any generator is run', (t) => {
|
|
48
|
+
const { root, source } = fixture(t);
|
|
49
|
+
writeFileSync(join(source, 'src', 'Tool.php'), '<?php return "updated";\n');
|
|
50
|
+
assert.throws(() => verifyPhpSdkArtifact({ root, sdk: 'php7' }), /archive bytes differ from source: src\/Tool.php/);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('archive missing a source file is rejected', (t) => {
|
|
54
|
+
const { root, staged, pack } = fixture(t);
|
|
55
|
+
rmSync(join(staged, 'src', 'Tool.php'));
|
|
56
|
+
pack();
|
|
57
|
+
assert.throws(() => verifyPhpSdkArtifact({ root, sdk: 'php7' }), /archive file set differs.*missing=\["src\/Tool.php"\]/);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('archive with an extra file is rejected', (t) => {
|
|
61
|
+
const { root, staged, pack } = fixture(t);
|
|
62
|
+
writeFileSync(join(staged, 'extra.php'), '<?php echo "unexpected";');
|
|
63
|
+
pack();
|
|
64
|
+
assert.throws(() => verifyPhpSdkArtifact({ root, sdk: 'php7' }), /unexpected=\["extra.php"\]/);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('archive links are rejected without extracting them', (t) => {
|
|
68
|
+
const { root, staged, pack } = fixture(t);
|
|
69
|
+
symlinkSync('/outside/sdk', join(staged, 'link'));
|
|
70
|
+
pack();
|
|
71
|
+
assert.throws(() => verifyPhpSdkArtifact({ root, sdk: 'php7' }), /Archive links or special files are not allowed/);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('duplicate archive members are rejected', (t) => {
|
|
75
|
+
const { root, prefix, pack } = fixture(t);
|
|
76
|
+
pack([prefix, `${prefix}/src/Tool.php`]);
|
|
77
|
+
assert.throws(() => verifyPhpSdkArtifact({ root, sdk: 'php7' }), /Duplicate archive path/);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('source symlinks are rejected', (t) => {
|
|
81
|
+
const { root, source } = fixture(t);
|
|
82
|
+
symlinkSync('/outside/sdk', join(source, 'link'));
|
|
83
|
+
assert.throws(() => verifyPhpSdkArtifact({ root, sdk: 'php7' }), /SDK source symlinks are not allowed/);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('regression failure cannot be reported as a valid artifact', (t) => {
|
|
87
|
+
const { root } = fixture(t, '<?php fwrite(STDERR, "regression failed"); exit(1);');
|
|
88
|
+
assert.throws(() => verifyPhpSdkArtifact({ root, sdk: 'php7' }), /php exited 1: regression failed/);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('an incomplete successful regression report is rejected', (t) => {
|
|
92
|
+
const { root } = fixture(t, '<?php echo \'{"sdk":"php7","passed":true,"matrixCases":1}\';');
|
|
93
|
+
assert.throws(() => verifyPhpSdkArtifact({ root, sdk: 'php7' }), /generator regression is failed or incomplete/);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('missing PHP runtime fails instead of silently skipping', (t) => {
|
|
97
|
+
const { root } = fixture(t);
|
|
98
|
+
assert.throws(() => verifyPhpSdkArtifact({ root, sdk: 'php7', phpCommand: join(root, 'missing-php') }), /ENOENT/);
|
|
99
|
+
});
|
|
@@ -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.11.1');
|
|
42
|
+
assert.equal(result.stableVersion, '0.11.1');
|
|
43
43
|
assert.equal(result.publishTag, 'latest');
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Copy the runnable manifest while keeping the build attestations in the source registry.
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
if [[ $# != 6 ]]; then
|
|
6
|
+
echo "usage: $0 SOURCE_REPO SOURCE_DIGEST TARGET_REPO TARGET_TAG EXPECTED_REVISION EXPECTED_VERSION" >&2
|
|
7
|
+
exit 2
|
|
8
|
+
fi
|
|
9
|
+
source_repo=$1
|
|
10
|
+
build_digest=$2
|
|
11
|
+
target="docker://$3:$4"
|
|
12
|
+
revision=$5
|
|
13
|
+
version=$6
|
|
14
|
+
digest_pattern='^sha256:[0-9a-f]{64}$'
|
|
15
|
+
[[ $build_digest =~ $digest_pattern ]] || { echo 'Expected a build digest' >&2; exit 1; }
|
|
16
|
+
|
|
17
|
+
platform_digest=$(
|
|
18
|
+
skopeo inspect --retry-times 3 --raw "docker://$source_repo@$build_digest" |
|
|
19
|
+
jq -er --arg build "$build_digest" '
|
|
20
|
+
if (.manifests | type) == "array" then
|
|
21
|
+
[.manifests[] | select(.platform.os == "linux" and .platform.architecture == "amd64")] |
|
|
22
|
+
if length == 1 then .[0].digest else error("expected exactly one linux/amd64 image") end
|
|
23
|
+
elif .config.digest and (.layers | type) == "array" then $build
|
|
24
|
+
else error("expected an image manifest or index") end'
|
|
25
|
+
)
|
|
26
|
+
[[ $platform_digest =~ $digest_pattern ]] || { echo 'Invalid platform manifest digest' >&2; exit 1; }
|
|
27
|
+
source_image="docker://$source_repo@$platform_digest"
|
|
28
|
+
|
|
29
|
+
skopeo inspect --retry-times 3 --config "$source_image" |
|
|
30
|
+
jq -e --arg revision "$revision" --arg version "$version" '
|
|
31
|
+
.os == "linux" and .architecture == "amd64" and
|
|
32
|
+
.config.Labels["org.opencontainers.image.revision"] == $revision and
|
|
33
|
+
.config.Labels["org.opencontainers.image.version"] == $version' >/dev/null
|
|
34
|
+
|
|
35
|
+
skopeo copy --retry-times 3 --preserve-digests "$source_image" "$target"
|
|
36
|
+
# The manifest digest also binds the config and every ordered layer digest.
|
|
37
|
+
actual=$(skopeo inspect --retry-times 3 --raw "$target" | sha256sum | cut -d ' ' -f 1)
|
|
38
|
+
if [[ sha256:$actual != "$platform_digest" ]]; then
|
|
39
|
+
echo "Published manifest at $target does not match $platform_digest" >&2
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
printf '%s -> %s (%s)\n' "$source_image" "$target" "$revision"
|
|
@@ -78,6 +78,13 @@ async function scenario(readonly = false) {
|
|
|
78
78
|
await page.getByRole('button', { name: '调用代码', exact: true }).click();
|
|
79
79
|
await page.getByText('当前账号不能读取接入方目录;代码保留 token 占位,请由管理员核对推送授权。', { exact: true }).waitFor();
|
|
80
80
|
assert.equal(await page.getByText('还没有接入方被授权推送', { exact: false }).count(), 0, 'missing directory permission is not no authorization');
|
|
81
|
+
const help = page.getByRole('button', { name: '点击查看:渠道推送与接入授权', exact: true });
|
|
82
|
+
const instructions = page.getByText('将本渠道加入接入方的可推渠道白名单', { exact: false });
|
|
83
|
+
await instructions.waitFor({ state: 'hidden' });
|
|
84
|
+
await help.click();
|
|
85
|
+
await instructions.waitFor({ state: 'visible' });
|
|
86
|
+
await help.press('Escape');
|
|
87
|
+
await instructions.waitFor({ state: 'hidden' });
|
|
81
88
|
assert.equal(revealReads, 0);
|
|
82
89
|
releaseFirstToken(); await context.close(); return;
|
|
83
90
|
}
|
|
@@ -153,7 +153,7 @@ export async function verifyTroubleshootingExtra(browser, base, mockApi, fixture
|
|
|
153
153
|
await page.locator('.task-control-page .el-table').getByRole('button', { name: `${taskA.slice(0, 8)}…${taskA.slice(-4)}`, exact: true }).click();
|
|
154
154
|
await waitFor(() => Boolean(taskReadGate === undefined), '任务详情读取未开始');
|
|
155
155
|
await closeTask();
|
|
156
|
-
const refresh = page.locator('.task-
|
|
156
|
+
const refresh = page.locator('.task-control-page .el-card__header').getByRole('button', { name: '刷新', exact: true });
|
|
157
157
|
await waitFor(() => refresh.isEnabled(), '关闭加载中的详情后刷新仍被 loading 禁用');
|
|
158
158
|
detail.released.resolve();
|
|
159
159
|
await detail.finished.promise;
|
|
@@ -212,7 +212,7 @@ export async function verifyTroubleshootingExtra(browser, base, mockApi, fixture
|
|
|
212
212
|
await visible(page, '孤立告警规则 17');
|
|
213
213
|
assert.equal(await rulePanel.locator('.el-table__row').count(), 1, '告警规则精确定位不得包含 117');
|
|
214
214
|
assert.equal(await page.getByText('近似告警规则 117', { exact: true }).count(), 0);
|
|
215
|
-
assert.equal(await rulePanel.getByText('
|
|
215
|
+
assert.equal(await rulePanel.getByText('暂无告警规则', { exact: true }).count(), 0);
|
|
216
216
|
await page.reload();
|
|
217
217
|
await visible(page, '孤立告警规则 17');
|
|
218
218
|
|
|
@@ -220,7 +220,7 @@ export async function verifyTroubleshootingExtra(browser, base, mockApi, fixture
|
|
|
220
220
|
ruleReadFails = true;
|
|
221
221
|
await page.reload();
|
|
222
222
|
await rulePanel.locator('.el-alert--error').waitFor();
|
|
223
|
-
assert.equal(await rulePanel.getByText('
|
|
223
|
+
assert.equal(await rulePanel.getByText('暂无告警规则', { exact: true }).count(), 0);
|
|
224
224
|
ruleReadFails = false;
|
|
225
225
|
await rulePanel.getByRole('button', { name: '重试读取告警规则', exact: true }).click();
|
|
226
226
|
await visible(page, '孤立告警规则 17');
|
|
@@ -231,7 +231,7 @@ export async function verifyTroubleshootingExtra(browser, base, mockApi, fixture
|
|
|
231
231
|
await page.reload();
|
|
232
232
|
await visible(page, '孤立告警规则 17');
|
|
233
233
|
await page.locator('.el-card').filter({ has: page.getByText('入站渠道', { exact: true }) }).first().locator('.el-alert--error').waitFor();
|
|
234
|
-
assert.equal(await page.getByText('
|
|
234
|
+
assert.equal(await page.getByText('暂无入站渠道', { exact: true }).count(), 0);
|
|
235
235
|
channelReadFails = false;
|
|
236
236
|
|
|
237
237
|
// Known online workers filtered to offline are "no matches", never "no workers online".
|
package/scripts/e2e-console.mjs
CHANGED
|
@@ -126,6 +126,7 @@ const conversation = {
|
|
|
126
126
|
conversation_id: conversationId,
|
|
127
127
|
client_archive_id: '723e4567-e89b-42d3-a456-426614174000',
|
|
128
128
|
client_conversation_id: 'demo-client-conversation',
|
|
129
|
+
first_user_preview: conversationUser,
|
|
129
130
|
client_app_id: 'demo-app',
|
|
130
131
|
route_key: 'demo_support',
|
|
131
132
|
state: 'ready',
|
|
@@ -308,6 +309,11 @@ async function mockApi(context) {
|
|
|
308
309
|
if (url.pathname === '/admin/api/clients') return route.fulfill({ json: fixtures.clients });
|
|
309
310
|
if (url.pathname === '/admin/api/routes') return route.fulfill({ json: fixtures.routes });
|
|
310
311
|
if (url.pathname === '/admin/api/runs') return route.fulfill({ json: fixtures.runs });
|
|
312
|
+
if (url.pathname === '/admin/api/conversation-audits/feed') {
|
|
313
|
+
const item = { ...conversation, kind: 'audit', source: 'client', title: conversationUser, source_label: 'Demo 客户端', thread_id: null };
|
|
314
|
+
const source = url.searchParams.get('source') || 'all';
|
|
315
|
+
return route.fulfill({ json: { items: source === 'all' || source === 'client' ? [item] : [], has_more: false, next_offset: null } });
|
|
316
|
+
}
|
|
311
317
|
if (url.pathname === '/admin/api/conversation-audits') return route.fulfill({ json: {
|
|
312
318
|
schema: 'bailing.agent-conversation-audit-list.v1', items: [conversation], has_more: false, next_offset: null,
|
|
313
319
|
} });
|
|
@@ -362,7 +368,11 @@ async function verifyCallSnippets(page, base) {
|
|
|
362
368
|
await page.goto(`${base}/console/routes`);
|
|
363
369
|
await page.getByRole('button', { name: '调用代码', exact: true }).first().click();
|
|
364
370
|
const dialog = page.getByRole('dialog', { name: /调用代码/ });
|
|
365
|
-
await
|
|
371
|
+
await dialog.getByRole('button', { name: '前往接入方' }).waitFor();
|
|
372
|
+
const tokenHelp = dialog.getByRole('button', { name: '点击查看:调用凭证' });
|
|
373
|
+
await tokenHelp.click();
|
|
374
|
+
await expectVisible(page, '从「接入方」复制该接入方的完整 Token');
|
|
375
|
+
await tokenHelp.press('Escape');
|
|
366
376
|
await expectVisible(page, '1 个接入方可调用');
|
|
367
377
|
for (const language of ['HTTP / cURL', 'Node.js', 'Python', 'PHP', 'Agent 触发']) {
|
|
368
378
|
await dialog.getByRole('tab', { name: language, exact: true }).click();
|
|
@@ -373,9 +383,9 @@ async function verifyCallSnippets(page, base) {
|
|
|
373
383
|
await page.keyboard.press('Escape');
|
|
374
384
|
await page.getByRole('button', { name: '编辑', exact: true }).first().click();
|
|
375
385
|
await expectVisible(page, '执行行为提示');
|
|
376
|
-
await expectVisible(page, '仅提示词约束;工具授权与审批');
|
|
377
386
|
await page.getByRole('button', { name: '点击查看:执行行为提示', exact: true }).click();
|
|
378
387
|
await expectVisible(page, '此项是提示词约束,不是强制授权或沙箱');
|
|
388
|
+
await page.getByRole('button', { name: '点击查看:执行行为提示', exact: true }).press('Escape');
|
|
379
389
|
await page.getByRole('button', { name: '取消', exact: true }).click();
|
|
380
390
|
console.log('✓ snippets: environment token, enabled clients and visible permission boundary passed');
|
|
381
391
|
} finally { fixtures.clients.pop(); }
|
|
@@ -612,8 +622,11 @@ async function verifyOnboardingAndForms(browser, base) {
|
|
|
612
622
|
await p.waitForURL('**/setup?flow=agent');
|
|
613
623
|
assert.deepEqual(await p.locator('.stepTop > b').allTextContents(), ['登记业务工具源', '准备工作空间(业务路由)', '创建接入方并关联路由', '配置业务授权与工具范围', '在本地客户端登录并验证']);
|
|
614
624
|
assert.equal(await p.locator('.modelNote').count(), 0);
|
|
625
|
+
const workspaceHelp = p.getByRole('button', { name: '点击查看:准备工作空间(业务路由)' });
|
|
626
|
+
await workspaceHelp.click();
|
|
615
627
|
await expectVisible(p, '新建时仍需绑定真实调度目标');
|
|
616
628
|
await expectVisible(p, '中枢模型目标(llm)需要模型凭证');
|
|
629
|
+
await workspaceHelp.press('Escape');
|
|
617
630
|
routeReadFails = true;
|
|
618
631
|
await p.getByRole('button', { name: '刷新', exact: true }).click();
|
|
619
632
|
await expectVisible(p, '读取失败');
|
|
@@ -746,7 +759,26 @@ async function verifyTroubleshooting(browser, base) {
|
|
|
746
759
|
];
|
|
747
760
|
await context.route('**/admin/api/config-diagnostics', r => r.fulfill({ json: { ok: false, errors: 1, warnings: 3, diagnostics: ds } }));
|
|
748
761
|
await context.route('**/admin/api/clients', r => r.fulfill({ json: [...fixtures.clients, { ...fixtures.clients[0], app_id: 'demo-app-extra', name: 'Similar client' }] }));
|
|
749
|
-
|
|
762
|
+
const dispatchReads = [];
|
|
763
|
+
const missingJob = '00000000-0000-4000-8000-000000000099';
|
|
764
|
+
await context.route('**/admin/api/runs/trace?**', r => {
|
|
765
|
+
const q = new URL(r.request().url()).searchParams;
|
|
766
|
+
if (q.get('job_id') === missingJob) return r.fulfill({ status: 404, json: { error: 'job 不存在' } });
|
|
767
|
+
if (q.has('job_id')) return r.fulfill({ json: tracePayload() });
|
|
768
|
+
if (q.get('client_id') === 'demo') return r.fulfill({ json: { matches: [fixtures.runs[0], { ...fixtures.runs[0], job_id: missingJob, request_id: 'previous-task' }] } });
|
|
769
|
+
return r.fulfill({ json: { matches: [] } });
|
|
770
|
+
});
|
|
771
|
+
await context.route('**/admin/api/runs?*', r => {
|
|
772
|
+
const q = new URL(r.request().url()).searchParams;
|
|
773
|
+
dispatchReads.push(Object.fromEntries(q));
|
|
774
|
+
const jobs = [
|
|
775
|
+
...Array.from({length:50}, (_, i) => ({ ...fixtures.runs[0], job_id: 'newer-' + i, route_key: 'other_route' })),
|
|
776
|
+
{ ...fixtures.runs[0], route_key: 'demo_support', status: 'error', input_preview: '较早的失败任务', error_preview: '上游请求失败' },
|
|
777
|
+
];
|
|
778
|
+
const offset = Number(q.get('offset') || 0);
|
|
779
|
+
const rows = jobs.filter(j => (!q.get('status') || j.status === q.get('status')) && (!q.get('route_key') || j.route_key === q.get('route_key')));
|
|
780
|
+
return r.fulfill({ json: rows.slice(offset, offset + Number(q.get('limit') || 50)) });
|
|
781
|
+
});
|
|
750
782
|
await context.route('**/admin/api/notification-outbox?*', r => r.fulfill({ json: { items: [{ event_id: 'delivery-unknown', kind: 'delivery-dlq', status: 'uncertain', job_id: fixtures.runs[0].job_id, attempts: 1, updated_at: new Date().toISOString() }], total: 1, snapshot: { counts: { pending: 0, processing: 0, failed: 0, uncertain: 1 } } } }));
|
|
751
783
|
try {
|
|
752
784
|
await p.goto(`${base}/console/diagnostics?severity=error&q=demo`);
|
|
@@ -788,19 +820,49 @@ async function verifyTroubleshooting(browser, base) {
|
|
|
788
820
|
await p.locator('.notification-panel .el-table__expand-icon').first().click();
|
|
789
821
|
await p.getByRole('button', { name: '查看原任务', exact: true }).click();
|
|
790
822
|
await p.waitForURL(u => !!u.searchParams.get('detail'));
|
|
791
|
-
|
|
823
|
+
const detailStatus = p.locator('.runDetailDrawer:visible .jobStatusTag');
|
|
824
|
+
await detailStatus.hover();
|
|
825
|
+
assert.equal(await detailStatus.innerText(), '已完成');
|
|
826
|
+
await p.getByRole('tooltip').filter({ hasText: '原始状态:done' }).waitFor();
|
|
827
|
+
await p.locator('.runDetailDrawer:visible .el-drawer__close-btn').click();
|
|
792
828
|
await p.waitForURL(u => !u.searchParams.has('detail') && u.searchParams.get('outbox_status') === 'uncertain');
|
|
793
829
|
await p.getByRole('button', { name: '返回来源页面', exact: true }).click();
|
|
794
830
|
await p.waitForURL(u => u.pathname.endsWith('/diagnostics') && u.searchParams.get('q') === 'delivery_dlq');
|
|
795
831
|
await p.goto(`${base}/console/diagnostics?q=error_burst`);
|
|
796
832
|
await p.locator('.groups .el-table__row').first().getByRole('button', { name: '打开', exact: true }).click();
|
|
797
833
|
await p.waitForURL(u => u.pathname.endsWith('/runs') && u.searchParams.get('tab') === 'jobs');
|
|
798
|
-
await expectVisible(p, '
|
|
834
|
+
await expectVisible(p, '共 1 条任务');
|
|
799
835
|
await p.locator('.run-filters .el-select__wrapper').nth(2).click();
|
|
800
836
|
await p.getByRole('option', { name: '最近 24 小时', exact: true }).click();
|
|
801
837
|
await p.waitForURL(u => u.searchParams.get('run_period') === '24h' && u.searchParams.get('run_status') === 'error');
|
|
802
838
|
await p.reload();
|
|
803
|
-
await expectVisible(p, '
|
|
839
|
+
await expectVisible(p, '共 1 条任务');
|
|
840
|
+
const failedTask = p.getByRole('button', { name: '较早的失败任务', exact: true });
|
|
841
|
+
await failedTask.press('Tab');
|
|
842
|
+
const focusedStatus = p.locator('.runsTable .jobStatusTag:focus-visible');
|
|
843
|
+
assert.equal(await focusedStatus.innerText(), '执行错误');
|
|
844
|
+
await p.waitForFunction(() => getComputedStyle(document.activeElement).outlineWidth === '2px');
|
|
845
|
+
await p.getByRole('tooltip').filter({ hasText: '原始状态:error' }).waitFor();
|
|
846
|
+
assert.ok(dispatchReads.some(q => q.period === '24h' && q.status === 'error' && q.offset === '0'));
|
|
847
|
+
await p.goto(`${base}/console/runs?tab=trace&trace_q=client%3Ademo`);
|
|
848
|
+
const match = p.locator('.traceMatches').getByRole('button', { name: fixtures.runs[0].request_id, exact: true });
|
|
849
|
+
await p.locator('.traceMatches .jobStatusTag').getByText('已完成', { exact: true }).first().waitFor();
|
|
850
|
+
await match.click();
|
|
851
|
+
await p.locator('.traceHeadTags .jobStatusTag').getByText('已完成', { exact: true }).waitFor();
|
|
852
|
+
await p.reload();
|
|
853
|
+
await p.getByRole('button', { name: '返回匹配任务' }).click();
|
|
854
|
+
await match.waitFor();
|
|
855
|
+
assert.equal(new URL(p.url()).searchParams.get('trace_q'), 'client:demo');
|
|
856
|
+
await match.click();
|
|
857
|
+
await p.locator('.tracePanel').waitFor();
|
|
858
|
+
await p.goBack();
|
|
859
|
+
await match.waitFor();
|
|
860
|
+
for (const raw of ['missing-request', missingJob]) {
|
|
861
|
+
await p.goto(`${base}/console/runs?tab=trace&trace_q=${raw}`);
|
|
862
|
+
await expectVisible(p, `没有与「${raw}」匹配的任务`);
|
|
863
|
+
assert.equal(await p.locator('.tracePanel:visible').count(), 0);
|
|
864
|
+
}
|
|
865
|
+
|
|
804
866
|
assert.deepEqual(errors, []);
|
|
805
867
|
console.log('✓ troubleshooting: exact diagnostic focus, missing objects, filters, tabs, reload and return context passed');
|
|
806
868
|
} finally { await context.close(); }
|
|
@@ -837,8 +899,11 @@ try {
|
|
|
837
899
|
await expectVisible(page, '通过 3');
|
|
838
900
|
|
|
839
901
|
await page.getByRole('menuitem', { name: '聊天入口' }).click();
|
|
902
|
+
const chatHelp = page.getByRole('button', { name: '点击查看:聊天入口是什么' });
|
|
903
|
+
await chatHelp.click();
|
|
840
904
|
await expectVisible(page, '“匿名预览”不会继承中枢后台登录状态');
|
|
841
905
|
await expectVisible(page, '包括只读查询和写操作');
|
|
906
|
+
await chatHelp.press('Escape');
|
|
842
907
|
await expectVisible(page, '支持业务身份票据:demo-app');
|
|
843
908
|
await expectVisible(page, '匿名预览');
|
|
844
909
|
|
|
@@ -891,10 +956,8 @@ try {
|
|
|
891
956
|
await page.getByRole('button', { name: '取消', exact: true }).click();
|
|
892
957
|
|
|
893
958
|
await page.getByRole('menuitem', { name: '任务', exact: true }).click();
|
|
894
|
-
const
|
|
895
|
-
|
|
896
|
-
const auditList = page.locator('aside[aria-label="客户端对话列表"]');
|
|
897
|
-
await auditList.getByRole('button', { name: /demo-client-conversation/ }).click();
|
|
959
|
+
const auditList = page.locator('aside[aria-label="会话列表"]');
|
|
960
|
+
await auditList.getByRole('button', { name: new RegExp(conversationUser) }).click();
|
|
898
961
|
const auditTurn = page.locator(`section[data-turn-id="${conversationTurnId}"]`);
|
|
899
962
|
await expectVisible(page, conversationReply);
|
|
900
963
|
if (await auditTurn.locator('.userMessage .messageText').innerText() !== conversationUser ||
|
|
@@ -904,31 +967,28 @@ try {
|
|
|
904
967
|
await expectVisible(page, '已接收 1 轮 / 2 条消息');
|
|
905
968
|
await expectVisible(page, '旧历史或未同步内容可能缺失');
|
|
906
969
|
if (await auditTurn.locator('.authorizationRun').count() !== 2) throw new Error('本轮应保留两项独立授权执行');
|
|
907
|
-
const accountA = auditTurn.locator(
|
|
908
|
-
const accountB = auditTurn.locator(
|
|
970
|
+
const accountA = auditTurn.locator(`[data-run-id="${agentRunId}"]`);
|
|
971
|
+
const accountB = auditTurn.locator(`[data-run-id="${incompleteAgentRunId}"]`);
|
|
909
972
|
await accountA.getByText('演示账户 A', { exact: true }).waitFor();
|
|
910
973
|
await accountB.getByText('演示账户 B', { exact: true }).waitFor();
|
|
911
|
-
await accountA.getByRole('button', { name:
|
|
974
|
+
await accountA.getByRole('button', { name: /授权执行.*演示账户 A/ }).click();
|
|
912
975
|
await accountA.locator('.invocation').getByText('staff_edit', { exact: true }).waitFor();
|
|
913
976
|
await accountA.getByRole('button', { name: '原授权记录', exact: true }).click();
|
|
914
977
|
await expectVisible(page, '把员工资料改成新的姓名');
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
}
|
|
978
|
+
const rawPanel = page.locator('.rawRecordDrawer');
|
|
979
|
+
await rawPanel.waitFor({ state: 'visible' });
|
|
918
980
|
await page.locator('.tracetoggle').filter({ hasText: '执行轨迹' }).first().click();
|
|
919
981
|
await page.getByRole('button', { name: '查看客户端完整对话', exact: true }).click();
|
|
920
982
|
await page.waitForURL((url) => url.searchParams.get('conversation') === conversationId &&
|
|
921
983
|
url.searchParams.get('turn') === conversationTurnId);
|
|
922
984
|
await auditTurn.locator('.assistantMessage .messageText').waitFor({ state: 'visible' });
|
|
923
|
-
if (
|
|
985
|
+
if (await auditTurn.locator('.assistantMessage .messageText').innerText() !== conversationReply) {
|
|
924
986
|
throw new Error('原执行轨迹必须返回同一客户端对话与原始答复');
|
|
925
987
|
}
|
|
926
988
|
|
|
927
989
|
// Keep the existing business-entry and authorization-scoped trace checks.
|
|
928
|
-
await
|
|
929
|
-
|
|
930
|
-
throw new Error('切换后应展示原授权记录');
|
|
931
|
-
}
|
|
990
|
+
await auditList.getByRole('button', { name: '授权与接入记录' }).click();
|
|
991
|
+
await rawPanel.waitFor({ state: 'visible' });
|
|
932
992
|
await expectVisible(page, '查询订单 SO-1001');
|
|
933
993
|
await page.getByText('查询订单 SO-1001').first().click();
|
|
934
994
|
await expectVisible(page, '订单 SO-1001 已查询完成');
|
|
@@ -936,11 +996,15 @@ try {
|
|
|
936
996
|
await expectVisible(page, '工具返回');
|
|
937
997
|
await expectVisible(page, '任务完成');
|
|
938
998
|
|
|
939
|
-
await
|
|
999
|
+
await rawPanel.getByRole('button', { name: '返回记录列表' }).click();
|
|
1000
|
+
await rawPanel.getByText('员工资料已修改').first().click();
|
|
940
1001
|
await expectVisible(page, '把员工资料改成新的姓名');
|
|
941
1002
|
await page.locator('.tracetoggle').filter({ hasText: '执行轨迹' }).first().click();
|
|
942
1003
|
await expectVisible(page, '本地智能体编排');
|
|
1004
|
+
const agentTraceHelp = rawPanel.getByRole('button', { name: '点击查看:本地智能体执行轨迹' }).first();
|
|
1005
|
+
await agentTraceHelp.click();
|
|
943
1006
|
await expectVisible(page, '隐藏推理不会上传');
|
|
1007
|
+
await agentTraceHelp.press('Escape');
|
|
944
1008
|
await expectVisible(page, '中枢治理');
|
|
945
1009
|
await expectVisible(page, 'staff_edit');
|
|
946
1010
|
if (await page.getByText('未挂工具', { exact: true }).count()) {
|
|
@@ -950,12 +1014,15 @@ try {
|
|
|
950
1014
|
throw new Error('Agent Client 会话轨迹不得展示隐藏推理');
|
|
951
1015
|
}
|
|
952
1016
|
|
|
953
|
-
await
|
|
1017
|
+
await rawPanel.getByRole('button', { name: '返回记录列表' }).click();
|
|
1018
|
+
await rawPanel.getByText('等待本地智能体继续处理').first().click();
|
|
954
1019
|
await page.locator('.tracetoggle').filter({ hasText: '执行轨迹' }).first().click();
|
|
955
1020
|
await expectVisible(page, '上下文已就绪');
|
|
956
1021
|
await expectVisible(page, '已批准,等待本地智能体续执行');
|
|
957
1022
|
await expectVisible(page, '不代表全量');
|
|
958
1023
|
|
|
1024
|
+
await page.keyboard.press('Escape');
|
|
1025
|
+
await rawPanel.waitFor({ state: 'hidden' });
|
|
959
1026
|
await verifyCallSnippets(page, `http://127.0.0.1:${port}`);
|
|
960
1027
|
await verifyStatusFeedback(page, context, `http://127.0.0.1:${port}`);
|
|
961
1028
|
|
package/scripts/install.sh
CHANGED
|
@@ -279,7 +279,7 @@ write_env() {
|
|
|
279
279
|
TOOL_SECRET="${DEMO_TOOL_SECRET:-$(secret)}"
|
|
280
280
|
CLIENT_TOKEN="${DEMO_CLIENT_TOKEN:-$(secret)}"
|
|
281
281
|
IMAGE_TAG="${BAILING_IMAGE_TAG:-$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$APP_DIR/package.json" | head -1)}"
|
|
282
|
-
[ -n "$IMAGE_TAG" ] || IMAGE_TAG="0.
|
|
282
|
+
[ -n "$IMAGE_TAG" ] || IMAGE_TAG="0.11.1"
|
|
283
283
|
IMAGE_REGISTRY="${BAILING_IMAGE_REGISTRY:-$DEFAULT_IMAGE_REGISTRY}"
|
|
284
284
|
IMAGE_NAMESPACE="${BAILING_IMAGE_NAMESPACE:-$DEFAULT_IMAGE_NAMESPACE}"
|
|
285
285
|
cat > "$ENV_FILE" <<EOF
|
|
@@ -50,7 +50,8 @@ async function open(role) {
|
|
|
50
50
|
perms: role === 'writer' ? ['runs:read', 'runs:write'] : ['runs:read'], capabilities: { modules: ['runs'] } } });
|
|
51
51
|
if (url.pathname === '/admin/api/status') return route.fulfill({ json: { executors: [] } });
|
|
52
52
|
if (url.pathname === '/admin/api/runs' || url.pathname === '/admin/api/threads') return route.fulfill({ json: [] });
|
|
53
|
-
if (
|
|
53
|
+
if (request.method() === 'GET' && ['/admin/api/conversation-audits', '/admin/api/conversation-audits/feed'].includes(url.pathname))
|
|
54
|
+
return route.fulfill({ json: { items: [], has_more: false, next_offset: null } });
|
|
54
55
|
if (url.pathname.startsWith('/admin/api/notification-outbox')) {
|
|
55
56
|
const record = { role, method: request.method(), path: url.pathname, query: Object.fromEntries(url.searchParams) };
|
|
56
57
|
requests.push(record);
|
|
@@ -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.11.1"
|
|
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}"
|