bailinghub 0.3.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/.dockerignore +42 -0
- package/.env.example +83 -0
- package/.gitignore +44 -0
- package/.npmignore +56 -0
- package/CODE_OF_CONDUCT.md +24 -0
- package/CONTRIBUTING.md +74 -0
- package/Dockerfile +16 -0
- package/LICENSE +176 -0
- package/LICENSING.md +9 -0
- package/NOTICE +23 -0
- package/README.en.md +264 -0
- package/README.md +279 -0
- package/SECURITY.md +30 -0
- package/THIRD_PARTY_NOTICES.md +254 -0
- package/VISION.md +41 -0
- package/assets/architecture-overview.en-dark.png +0 -0
- package/assets/architecture-overview.en-dark.svg +57 -0
- package/assets/architecture-overview.en.png +0 -0
- package/assets/architecture-overview.en.svg +57 -0
- package/assets/architecture-overview.zh-CN-dark.png +0 -0
- package/assets/architecture-overview.zh-CN-dark.svg +57 -0
- package/assets/architecture-overview.zh-CN.png +0 -0
- package/assets/architecture-overview.zh-CN.svg +57 -0
- package/assets/bailinghub-lockup-dark.png +0 -0
- package/assets/bailinghub-lockup-dark.svg +8 -0
- package/assets/bailinghub-lockup.png +0 -0
- package/assets/bailinghub-lockup.svg +8 -0
- package/brain/README.en.md +23 -0
- package/brain/README.md +45 -0
- package/brain/agents/code-review.md +41 -0
- package/brain/agents/triage.md +37 -0
- package/brain/profiles.json +114 -0
- package/brain/runbooks/ticket-triage.md +24 -0
- package/config.example.json +58 -0
- package/contracts/client-api/consumers.json +28 -0
- package/contracts/client-api/v1/error-response.schema.json +21 -0
- package/contracts/client-api/v1/health-response.schema.json +13 -0
- package/contracts/client-api/v1/job-response.schema.json +49 -0
- package/contracts/client-api/v1/manifest.json +63 -0
- package/contracts/client-api/v1/run-request.schema.json +42 -0
- package/contracts/client-api/v1/submit-response.schema.json +35 -0
- package/contracts/client-api/v1/vectors.json +153 -0
- package/demo/business/Dockerfile +8 -0
- package/demo/business/server.mjs +483 -0
- package/docker-compose.images.yml +67 -0
- package/docker-compose.yml +79 -0
- package/docs/AI_FRIENDLY_TOOLS.en.md +69 -0
- package/docs/AI/345/217/213/345/245/275/345/267/245/345/205/267/350/256/276/350/256/241/346/214/207/345/215/227.md +198 -0
- package/docs/ARCHITECTURE.en.md +81 -0
- package/docs/ARCHITECTURE.md +795 -0
- package/docs/CHANGELOG.en.md +275 -0
- package/docs/CHANGELOG.md +279 -0
- package/docs/CHANNELS.en.md +35 -0
- package/docs/CHANNELS.md +72 -0
- package/docs/CLIENT_API.md +89 -0
- package/docs/COMPATIBILITY.en.md +103 -0
- package/docs/CONTRACT.en.md +254 -0
- package/docs/CONTRACT.md +653 -0
- package/docs/DEMO.en.md +90 -0
- package/docs/DEMO.md +297 -0
- package/docs/ECOSYSTEM.en.md +39 -0
- package/docs/ECOSYSTEM.md +39 -0
- package/docs/INDEPENDENT_VALIDATION.en.md +184 -0
- package/docs/INDEPENDENT_VALIDATION.md +184 -0
- package/docs/INTEGRATION.en.md +120 -0
- package/docs/KERNEL_HOST_API.en.md +59 -0
- package/docs/KERNEL_HOST_API.md +59 -0
- package/docs/OPERATIONS.en.md +182 -0
- package/docs/OPERATIONS.md +231 -0
- package/docs/PIPELINE.en.md +74 -0
- package/docs/PIPELINE.md +67 -0
- package/docs/QUICKSTART.en.md +297 -0
- package/docs/QUICKSTART.md +152 -0
- package/docs/README.en.md +103 -0
- package/docs/README.md +119 -0
- package/docs/RELEASE_NOTES_v0.1.0.en.md +46 -0
- package/docs/RELEASE_NOTES_v0.1.0.md +66 -0
- package/docs/RELEASE_NOTES_v0.1.1.en.md +38 -0
- package/docs/RELEASE_NOTES_v0.1.1.md +38 -0
- package/docs/RELEASE_NOTES_v0.1.10.en.md +102 -0
- package/docs/RELEASE_NOTES_v0.1.10.md +102 -0
- package/docs/RELEASE_NOTES_v0.1.11.en.md +99 -0
- package/docs/RELEASE_NOTES_v0.1.11.md +99 -0
- package/docs/RELEASE_NOTES_v0.1.12.en.md +64 -0
- package/docs/RELEASE_NOTES_v0.1.12.md +64 -0
- package/docs/RELEASE_NOTES_v0.1.13.en.md +46 -0
- package/docs/RELEASE_NOTES_v0.1.13.md +46 -0
- package/docs/RELEASE_NOTES_v0.1.14.en.md +55 -0
- package/docs/RELEASE_NOTES_v0.1.14.md +55 -0
- package/docs/RELEASE_NOTES_v0.1.15.en.md +50 -0
- package/docs/RELEASE_NOTES_v0.1.15.md +50 -0
- package/docs/RELEASE_NOTES_v0.1.16.en.md +106 -0
- package/docs/RELEASE_NOTES_v0.1.16.md +105 -0
- package/docs/RELEASE_NOTES_v0.1.2.en.md +39 -0
- package/docs/RELEASE_NOTES_v0.1.2.md +39 -0
- package/docs/RELEASE_NOTES_v0.1.3.en.md +55 -0
- package/docs/RELEASE_NOTES_v0.1.3.md +55 -0
- package/docs/RELEASE_NOTES_v0.1.4.en.md +55 -0
- package/docs/RELEASE_NOTES_v0.1.4.md +55 -0
- package/docs/RELEASE_NOTES_v0.1.5.en.md +49 -0
- package/docs/RELEASE_NOTES_v0.1.5.md +49 -0
- package/docs/RELEASE_NOTES_v0.1.6.en.md +41 -0
- package/docs/RELEASE_NOTES_v0.1.6.md +41 -0
- package/docs/RELEASE_NOTES_v0.1.7.en.md +39 -0
- package/docs/RELEASE_NOTES_v0.1.7.md +39 -0
- package/docs/RELEASE_NOTES_v0.1.8.en.md +88 -0
- package/docs/RELEASE_NOTES_v0.1.8.md +88 -0
- package/docs/RELEASE_NOTES_v0.1.9.en.md +127 -0
- package/docs/RELEASE_NOTES_v0.1.9.md +127 -0
- package/docs/RELEASE_NOTES_v0.2.0.en.md +95 -0
- package/docs/RELEASE_NOTES_v0.2.0.md +96 -0
- package/docs/RELEASE_NOTES_v0.3.0.en.md +77 -0
- package/docs/RELEASE_NOTES_v0.3.0.md +77 -0
- package/docs/SDK.en.md +177 -0
- package/docs/STREAMING.en.md +78 -0
- package/docs/STREAMING.md +109 -0
- package/docs/TOOLS.en.md +205 -0
- package/docs/TOOLS_DESIGN.en.md +142 -0
- package/docs/TOOLS_DESIGN.md +466 -0
- package/docs/TOOLS_MODEL.en.md +56 -0
- package/docs/TOOLS_MODEL.md +903 -0
- package/docs/WIDGET_RENDERERS.en.md +133 -0
- package/docs/WIDGET_RENDERERS.md +139 -0
- package/docs/examples/bailing-tool-verify.mjs +94 -0
- package/docs/examples/bailing-tool-verify.php +154 -0
- package/docs/examples/bailing-tool-verify.py +107 -0
- package/docs/examples/custom-streaming-chat-client.mjs +108 -0
- package/docs/examples/widget-chart-renderer-adapter.mjs +44 -0
- package/docs/integrations/bailian/README.en.md +181 -0
- package/docs/integrations/bailian/README.md +165 -0
- package/docs/integrations/bailian/bailian-mcp-config.json +17 -0
- package/docs/integrations/bailian/verify_recipe.py +97 -0
- package/docs/integrations/deepseek/README.en.md +225 -0
- package/docs/integrations/deepseek/README.md +225 -0
- package/docs/integrations/deepseek/verify_e2e.py +131 -0
- package/docs/integrations/dify/README.en.md +131 -0
- package/docs/integrations/dify/README.md +131 -0
- package/docs/integrations/dify/bailinghub-control-plane.openapi.json +129 -0
- package/docs/integrations/dify/verify_contract.py +88 -0
- package/docs/integrations/dify/verify_e2e.py +117 -0
- package/docs/integrations/jeecgboot/README.en.md +193 -0
- package/docs/integrations/jeecgboot/README.md +161 -0
- package/docs/integrations/jeecgboot/adapter-contract.v1.json +94 -0
- package/docs/integrations/jeecgboot/jeecgboot-user-adapter.openapi.json +183 -0
- package/docs/integrations/jeecgboot/verify_recipe.mjs +97 -0
- package/docs/integrations/ruoyi-vue-pro/README.en.md +91 -0
- package/docs/integrations/ruoyi-vue-pro/README.md +155 -0
- package/docs/integrations/ruoyi-vue-pro/adapter-contract.v1.json +71 -0
- package/docs/integrations/ruoyi-vue-pro/ruoyi-vue-pro-trade-adapter.openapi.json +148 -0
- package/docs/integrations/ruoyi-vue-pro/verify_recipe.mjs +71 -0
- package/docs/user-guide/README.en.md +39 -0
- package/docs/user-guide/README.md +40 -0
- package/docs/user-guide/concepts.en.md +69 -0
- package/docs/user-guide/concepts.md +225 -0
- package/docs/user-guide/console-map.en.md +58 -0
- package/docs/user-guide/console-map.md +473 -0
- package/docs/user-guide/overview.en.md +61 -0
- package/docs/user-guide/overview.md +156 -0
- package/docs/user-guide/scenarios.en.md +70 -0
- package/docs/user-guide/scenarios.md +398 -0
- package/docs//345/205/274/345/256/271/346/200/247/344/270/216/345/215/207/347/272/247.md +134 -0
- package/docs//347/254/254/344/270/211/346/226/271/345/257/271/346/216/245/346/214/207/345/215/227.md +625 -0
- package/package.json +119 -0
- package/schemas/agent-capability-contract.schema.json +104 -0
- package/schemas/api/approval-decision.schema.json +28 -0
- package/schemas/api/approval-request.schema.json +31 -0
- package/schemas/api/delivery-callback.schema.json +28 -0
- package/schemas/api/job-response.schema.json +6 -0
- package/schemas/api/kb-doc-upsert.schema.json +21 -0
- package/schemas/api/run-request.schema.json +6 -0
- package/schemas/api/run-response.schema.json +6 -0
- package/schemas/api/tool-spec.schema.json +38 -0
- package/schemas/config/alert-rule.schema.json +22 -0
- package/schemas/config/channel.schema.json +91 -0
- package/schemas/config/chat-entry.schema.json +47 -0
- package/schemas/config/client.schema.json +56 -0
- package/schemas/config/common.schema.json +215 -0
- package/schemas/config/credential.schema.json +48 -0
- package/schemas/config/executor-token.schema.json +20 -0
- package/schemas/config/page-context.schema.json +21 -0
- package/schemas/config/route.schema.json +152 -0
- package/schemas/config/storage-bucket.schema.json +31 -0
- package/schemas/config/target.schema.json +17 -0
- package/schemas/config/tool-provider.schema.json +60 -0
- package/schemas/tool-definition.schema.json +188 -0
- package/scripts/check-client-api-ecosystem.mjs +69 -0
- package/scripts/check-doc-links.mjs +136 -0
- package/scripts/check-image-tags.sh +43 -0
- package/scripts/check-package-artifact.mjs +185 -0
- package/scripts/check-release-consistency.mjs +199 -0
- package/scripts/check-release-consistency.test.mjs +63 -0
- package/scripts/client-api-contract-test.ts +127 -0
- package/scripts/create-admin.ts +27 -0
- package/scripts/demo-e2e.ts +133 -0
- package/scripts/docker-entrypoint.sh +33 -0
- package/scripts/doctor.ts +107 -0
- package/scripts/e2e-console.mjs +214 -0
- package/scripts/export-oss.mjs +204 -0
- package/scripts/generate-readme-assets.mjs +181 -0
- package/scripts/generate-third-party-notices.mjs +93 -0
- package/scripts/image-release-policy.mjs +75 -0
- package/scripts/image-release-policy.test.mjs +58 -0
- package/scripts/init-db.ts +21 -0
- package/scripts/install.sh +461 -0
- package/scripts/oss-boundary-check.mjs +183 -0
- package/scripts/publish-images.sh +63 -0
- package/scripts/publish-mysql-image.sh +41 -0
- package/scripts/release-audit.mjs +348 -0
- package/scripts/sdk-contract-test.ts +62 -0
- package/scripts/sdk-p1-check.mjs +58 -0
- package/scripts/sdk-runtime-test.mjs +106 -0
- package/scripts/security-scan.mjs +110 -0
- package/scripts/seed-demo.ts +116 -0
- package/scripts/selftest.ts +226 -0
- package/scripts/smoke.ts +31 -0
- package/scripts/validate-examples.mjs +93 -0
- package/scripts/verify-bootstrap-admin-restart.ts +66 -0
- package/scripts/verify-github-repo.mjs +195 -0
- package/scripts/verify-oss-export.mjs +192 -0
- package/scripts/verify-routing.ts +29 -0
- package/scripts/widget-renderer-test.mjs +206 -0
- package/scripts/write-build-info.mjs +29 -0
- package/sdk/dotnet/Bailing.Connect/Bailing.Connect.csproj +12 -0
- package/sdk/dotnet/Bailing.Connect/BailingConnect.cs +260 -0
- package/sdk/dotnet/README.md +32 -0
- package/sdk/dotnet/examples/BuildSpec/BuildSpec.csproj +11 -0
- package/sdk/dotnet/examples/BuildSpec/Program.cs +36 -0
- package/sdk/go/README.md +33 -0
- package/sdk/go/bailingconnect/connect.go +367 -0
- package/sdk/go/examples/build-spec/main.go +39 -0
- package/sdk/go/go.mod +3 -0
- package/sdk/java/README.md +43 -0
- package/sdk/java/examples/BuildSpec.java +31 -0
- package/sdk/java/src/main/java/com/bailing/connect/BailingConnect.java +376 -0
- package/sdk/node/README.md +107 -0
- package/sdk/node/examples/build-spec.mjs +84 -0
- package/sdk/node/package.json +22 -0
- package/sdk/node/src/index.mjs +250 -0
- package/sdk/php/README.md +204 -0
- package/sdk/php/composer.json +18 -0
- package/sdk/php/examples/DemoStaffController.php +108 -0
- package/sdk/php/examples/build-spec.php +27 -0
- package/sdk/php/examples/thinkphp-integration.php +81 -0
- package/sdk/php/src/Attributes/AiParam.php +40 -0
- package/sdk/php/src/Attributes/AiTool.php +75 -0
- package/sdk/php/src/HubClient.php +122 -0
- package/sdk/php/src/SpecBuilder.php +328 -0
- package/sdk/php/src/SpecServer.php +209 -0
- package/sdk/php/src/Ticket.php +37 -0
- package/sdk/php/src/Verify.php +178 -0
- package/sdk/php7/README.md +191 -0
- package/sdk/php7/composer.json +18 -0
- package/sdk/php7/examples/build-spec.php +68 -0
- package/sdk/php7/examples/well-known.php +33 -0
- package/sdk/php7/src/HubClient.php +111 -0
- package/sdk/php7/src/SpecServer.php +203 -0
- package/sdk/php7/src/Ticket.php +33 -0
- package/sdk/php7/src/ToolDef.php +169 -0
- package/sdk/php7/src/ToolSpec.php +334 -0
- package/sdk/php7/src/Verify.php +165 -0
- package/sdk/python/README.md +107 -0
- package/sdk/python/bailing_connect/__init__.py +307 -0
- package/sdk/python/examples/build_spec.py +90 -0
- package/sdk/python/pyproject.toml +24 -0
- package/sql/001_init_state.sql +66 -0
- package/sql/002_routes.sql +44 -0
- package/sql/003_executor.sql +15 -0
- package/sql/004_clients.sql +22 -0
- package/sql/005_admins.sql +25 -0
- package/sql/006_ledger.sql +57 -0
- package/sql/007_delivery.sql +8 -0
- package/sql/008_kb.sql +66 -0
- package/sql/009_rbac.sql +5 -0
- package/sql/010_targets.sql +28 -0
- package/sql/011_observability.sql +11 -0
- package/sql/012_generic.sql +5 -0
- package/sql/013_tools.sql +24 -0
- package/sql/014_approvals.sql +27 -0
- package/sql/015_chat.sql +21 -0
- package/sql/016_chat_feedback.sql +19 -0
- package/sql/017_provider_autorefresh.sql +6 -0
- package/sql/018_kb_ingest.sql +11 -0
- package/sql/019_kb_datasources.sql +32 -0
- package/sql/022_storage_buckets.sql +25 -0
- package/sql/024_channels.sql +15 -0
- package/sql/025_chat_appearance.sql +7 -0
- package/sql/026_thread_memory.sql +10 -0
- package/sql/027_page_contexts.sql +23 -0
- package/sql/028_executor_capabilities.sql +4 -0
- package/sql/029_executor_tokens.sql +13 -0
- package/sql/030_route_permission.sql +5 -0
- package/sql/031_tool_embeddings.sql +20 -0
- package/sql/032_tool_provider_embed.sql +7 -0
- package/sql/033_alert_rules.sql +21 -0
- package/sql/034_client_allowed_channels.sql +6 -0
- package/sql/035_tool_idempotency.sql +15 -0
- package/sql/036_delivery_dlq.sql +15 -0
- package/sql/038_audit_trace_shape.sql +15 -0
- package/sql/039_runtime_locks.sql +9 -0
- package/sql/040_budget_policy.sql +3 -0
- package/sql/041_approval_intent.sql +14 -0
- package/sql/042_approval_decision_contract.sql +11 -0
- package/sql/043_rate_limits.sql +7 -0
- package/sql/044_job_run_after.sql +3 -0
- package/sql/045_job_claim_lease.sql +7 -0
- package/sql/046_tool_authz_probe.sql +5 -0
- package/sql/047_route_audience.sql +4 -0
- package/sql/048_llm_target.sql +17 -0
- package/sql/049_llm_input_shape.sql +11 -0
- package/sql/050_operational_metrics_indexes.sql +8 -0
- package/sql/051_instance_branding.sql +17 -0
- package/sql/052_tool_execution_journal.sql +19 -0
- package/sql/053_tool_spec_access_policy.sql +9 -0
- package/sql/README.en.md +41 -0
- package/sql/README.md +40 -0
- package/src/adapters/channels/wecom-api.test.ts +77 -0
- package/src/adapters/channels/wecom-api.ts +224 -0
- package/src/adapters/channels/wecom-crypto.test.ts +85 -0
- package/src/adapters/channels/wecom-crypto.ts +77 -0
- package/src/adapters/executors/claudecode.ts +39 -0
- package/src/adapters/executors/profiles.ts +86 -0
- package/src/adapters/executors/report.ts +35 -0
- package/src/adapters/executors/runner.ts +114 -0
- package/src/adapters/executors/wecomnotify.ts +63 -0
- package/src/adapters/llm/file.test.ts +81 -0
- package/src/adapters/llm/file.ts +250 -0
- package/src/adapters/llm/openai-chat-stream.test.ts +74 -0
- package/src/adapters/llm/openai-chat-stream.ts +154 -0
- package/src/adapters/llm/perception.ts +159 -0
- package/src/adapters/llm/speech.test.ts +75 -0
- package/src/adapters/llm/speech.ts +146 -0
- package/src/adapters/storage/object-storage.test.ts +38 -0
- package/src/adapters/storage/object-storage.ts +140 -0
- package/src/adapters/targets/demo-agent.ts +88 -0
- package/src/adapters/targets/llm.test.ts +733 -0
- package/src/adapters/targets/llm.ts +862 -0
- package/src/app/admin-bootstrap.test.ts +112 -0
- package/src/app/admin-bootstrap.ts +48 -0
- package/src/app/auth-default.ts +26 -0
- package/src/app/auth.test.ts +57 -0
- package/src/app/auth.ts +207 -0
- package/src/app/builtin-tools-default.ts +17 -0
- package/src/app/builtin-tools.test.ts +202 -0
- package/src/app/builtin-tools.ts +380 -0
- package/src/app/channels-default.ts +8 -0
- package/src/app/channels.ts +141 -0
- package/src/app/delivery-default.ts +14 -0
- package/src/app/delivery.test.ts +46 -0
- package/src/app/delivery.ts +215 -0
- package/src/app/engine-default.ts +54 -0
- package/src/app/engine.ts +427 -0
- package/src/app/http-mount.test.ts +27 -0
- package/src/app/http-server.test.ts +114 -0
- package/src/app/http-server.ts +127 -0
- package/src/app/http.test.ts +27 -0
- package/src/app/http.ts +118 -0
- package/src/app/kernel.test.ts +191 -0
- package/src/app/kernel.ts +544 -0
- package/src/app/monitor-default.ts +9 -0
- package/src/app/monitor.ts +46 -0
- package/src/app/operational-metrics.test.ts +73 -0
- package/src/app/operational-metrics.ts +124 -0
- package/src/app/oss-edition.test.ts +71 -0
- package/src/app/oss-edition.ts +108 -0
- package/src/app/outbound-default.ts +57 -0
- package/src/app/outbound.ts +133 -0
- package/src/app/readiness.test.ts +37 -0
- package/src/app/readiness.ts +39 -0
- package/src/app/runtime-composition.test.ts +51 -0
- package/src/app/runtime-composition.ts +73 -0
- package/src/app/runtime-context-default.ts +30 -0
- package/src/app/runtime-context.test.ts +60 -0
- package/src/app/runtime-context.ts +79 -0
- package/src/app/runtime-lifecycle-default.ts +48 -0
- package/src/app/runtime-lifecycle.test.ts +322 -0
- package/src/app/runtime-lifecycle.ts +440 -0
- package/src/app/runtime.ts +36 -0
- package/src/app/tool-approvals-default.ts +16 -0
- package/src/app/tool-approvals.ts +214 -0
- package/src/app/tool-assembly-default.ts +11 -0
- package/src/app/tool-assembly.test.ts +112 -0
- package/src/app/tool-assembly.ts +83 -0
- package/src/app/tool-context-default.ts +7 -0
- package/src/app/tool-context.test.ts +82 -0
- package/src/app/tool-context.ts +109 -0
- package/src/app/tool-debug.test.ts +111 -0
- package/src/app/tool-debug.ts +152 -0
- package/src/app/tool-proxy-default.ts +35 -0
- package/src/app/tool-proxy.ts +173 -0
- package/src/app/tool-specs-default.ts +33 -0
- package/src/app/tool-specs.test.ts +322 -0
- package/src/app/tool-specs.ts +555 -0
- package/src/app/tools-runtime-default.ts +14 -0
- package/src/app/tools-runtime.ts +23 -0
- package/src/architecture-boundary.test.ts +119 -0
- package/src/core/config/config-codec.test.ts +105 -0
- package/src/core/config/config-codec.ts +231 -0
- package/src/core/config/config-diagnostics.test.ts +285 -0
- package/src/core/config/config-diagnostics.ts +436 -0
- package/src/core/config/config-models.test.ts +584 -0
- package/src/core/config/config-models.ts +392 -0
- package/src/core/config/config-schema.test.ts +153 -0
- package/src/core/config/config.test.ts +314 -0
- package/src/core/config/config.ts +324 -0
- package/src/core/config/route-config.test.ts +232 -0
- package/src/core/config/route-config.ts +246 -0
- package/src/core/config/target-config.test.ts +139 -0
- package/src/core/config/target-config.ts +219 -0
- package/src/core/config/tools-config.test.ts +124 -0
- package/src/core/config/tools-config.ts +126 -0
- package/src/core/contracts/approval-decision.test.ts +67 -0
- package/src/core/contracts/approval-decision.ts +93 -0
- package/src/core/contracts/openapi-tools.ts +201 -0
- package/src/core/contracts/tool-annotations.ts +121 -0
- package/src/core/contracts/tool-definition.test.ts +147 -0
- package/src/core/contracts/tool-definition.ts +304 -0
- package/src/core/contracts/tools-idempotency.test.ts +435 -0
- package/src/core/contracts/tools.test.ts +487 -0
- package/src/core/contracts/tools.ts +831 -0
- package/src/core/contracts/types.ts +408 -0
- package/src/core/edition/capabilities.ts +6 -0
- package/src/core/edition/context.test.ts +20 -0
- package/src/core/edition/context.ts +78 -0
- package/src/core/edition/index.ts +4 -0
- package/src/core/edition/scope-resolver.ts +24 -0
- package/src/core/edition/store-factory.ts +6 -0
- package/src/core/observability/openmetrics.test.ts +57 -0
- package/src/core/observability/openmetrics.ts +103 -0
- package/src/core/platform/content.test.ts +46 -0
- package/src/core/platform/content.ts +90 -0
- package/src/core/platform/fence.test.ts +31 -0
- package/src/core/platform/fence.ts +11 -0
- package/src/core/platform/instance-branding.test.ts +65 -0
- package/src/core/platform/instance-branding.ts +202 -0
- package/src/core/platform/metrics-token.test.ts +31 -0
- package/src/core/platform/metrics-token.ts +42 -0
- package/src/core/platform/pagecontext.ts +0 -0
- package/src/core/platform/password.test.ts +13 -0
- package/src/core/platform/password.ts +38 -0
- package/src/core/platform/queue.test.ts +59 -0
- package/src/core/platform/queue.ts +75 -0
- package/src/core/platform/serial.test.ts +73 -0
- package/src/core/platform/serial.ts +64 -0
- package/src/core/platform/server-token.test.ts +46 -0
- package/src/core/platform/server-token.ts +60 -0
- package/src/core/platform/signing.test.ts +24 -0
- package/src/core/platform/signing.ts +22 -0
- package/src/core/platform/time.ts +73 -0
- package/src/core/platform/version.test.ts +19 -0
- package/src/core/platform/version.ts +90 -0
- package/src/core/runtime/budget-runtime.test.ts +93 -0
- package/src/core/runtime/budget-runtime.ts +110 -0
- package/src/core/runtime/context-runtime.test.ts +106 -0
- package/src/core/runtime/context-runtime.ts +95 -0
- package/src/core/runtime/credential-resolver.test.ts +129 -0
- package/src/core/runtime/credential-resolver.ts +93 -0
- package/src/core/runtime/credential-verify.test.ts +76 -0
- package/src/core/runtime/credential-verify.ts +161 -0
- package/src/core/runtime/debug-report.test.ts +20 -0
- package/src/core/runtime/debug-report.ts +100 -0
- package/src/core/runtime/execution-runtime.test.ts +350 -0
- package/src/core/runtime/execution-runtime.ts +197 -0
- package/src/core/runtime/finish-runtime.test.ts +168 -0
- package/src/core/runtime/finish-runtime.ts +83 -0
- package/src/core/runtime/identity-runtime.test.ts +38 -0
- package/src/core/runtime/identity-runtime.ts +104 -0
- package/src/core/runtime/inhub-runtime.test.ts +297 -0
- package/src/core/runtime/inhub-runtime.ts +198 -0
- package/src/core/runtime/job-stream.test.ts +55 -0
- package/src/core/runtime/job-stream.ts +187 -0
- package/src/core/runtime/knowledge-runtime.test.ts +120 -0
- package/src/core/runtime/knowledge-runtime.ts +98 -0
- package/src/core/runtime/launch-runtime.test.ts +187 -0
- package/src/core/runtime/launch-runtime.ts +182 -0
- package/src/core/runtime/memory-runtime.test.ts +85 -0
- package/src/core/runtime/memory-runtime.ts +32 -0
- package/src/core/runtime/memory.ts +141 -0
- package/src/core/runtime/redaction-runtime.test.ts +35 -0
- package/src/core/runtime/redaction-runtime.ts +60 -0
- package/src/core/runtime/routing-runtime.test.ts +89 -0
- package/src/core/runtime/routing-runtime.ts +146 -0
- package/src/core/runtime/smoke-runtime.test.ts +65 -0
- package/src/core/runtime/smoke-runtime.ts +237 -0
- package/src/core/runtime/summary-runtime.test.ts +234 -0
- package/src/core/runtime/summary-runtime.ts +153 -0
- package/src/core/runtime/trace-runtime.test.ts +234 -0
- package/src/core/runtime/trace-runtime.ts +330 -0
- package/src/core/state/audit-observability.test.ts +51 -0
- package/src/core/state/audit-observability.ts +74 -0
- package/src/core/state/state-codec.ts +44 -0
- package/src/core/state/state-contracts.ts +59 -0
- package/src/core/targets/adapter.ts +69 -0
- package/src/core/targets/registry.test.ts +65 -0
- package/src/core/targets/registry.ts +153 -0
- package/src/core/targets/resolve.ts +21 -0
- package/src/executor.ts +201 -0
- package/src/extension-api.test.ts +84 -0
- package/src/extension-api.ts +194 -0
- package/src/infrastructure/config/config-admin-repository.test.ts +193 -0
- package/src/infrastructure/config/config-admin-repository.ts +175 -0
- package/src/infrastructure/config/config-alert-rule-repository.ts +38 -0
- package/src/infrastructure/config/config-approval-ledger.ts +74 -0
- package/src/infrastructure/config/config-channel-repository.ts +31 -0
- package/src/infrastructure/config/config-chat-repository.ts +83 -0
- package/src/infrastructure/config/config-client-repository.ts +46 -0
- package/src/infrastructure/config/config-conversation-ledger.ts +222 -0
- package/src/infrastructure/config/config-credential-repository.test.ts +32 -0
- package/src/infrastructure/config/config-credential-repository.ts +47 -0
- package/src/infrastructure/config/config-delivery-dlq-ledger.ts +49 -0
- package/src/infrastructure/config/config-executor-ledger.ts +30 -0
- package/src/infrastructure/config/config-executor-token-repository.ts +44 -0
- package/src/infrastructure/config/config-instance-branding-repository.ts +75 -0
- package/src/infrastructure/config/config-knowledge-repository.ts +249 -0
- package/src/infrastructure/config/config-observability-ledger.ts +262 -0
- package/src/infrastructure/config/config-project-repository.ts +30 -0
- package/src/infrastructure/config/config-rate-limit-ledger.ts +56 -0
- package/src/infrastructure/config/config-route-repository.ts +41 -0
- package/src/infrastructure/config/config-storage-bucket-repository.ts +43 -0
- package/src/infrastructure/config/config-target-repository.ts +25 -0
- package/src/infrastructure/config/config-tool-call-ledger.ts +142 -0
- package/src/infrastructure/config/config-tool-embedding-repository.test.ts +124 -0
- package/src/infrastructure/config/config-tool-embedding-repository.ts +78 -0
- package/src/infrastructure/config/config-tool-provider-repository.test.ts +71 -0
- package/src/infrastructure/config/config-tool-provider-repository.ts +50 -0
- package/src/infrastructure/config/configstore.ts +130 -0
- package/src/infrastructure/config/local-instance-branding-provider.test.ts +94 -0
- package/src/infrastructure/config/local-instance-branding-provider.ts +79 -0
- package/src/infrastructure/mysql/pool-owner.test.ts +36 -0
- package/src/infrastructure/mysql/pool-owner.ts +56 -0
- package/src/infrastructure/schema/core-schema-migrator.test.ts +340 -0
- package/src/infrastructure/schema/core-schema-migrator.ts +461 -0
- package/src/infrastructure/schema/migration-files.test.ts +18 -0
- package/src/infrastructure/schema/migration-files.ts +27 -0
- package/src/infrastructure/schema/retired-migrations.ts +35 -0
- package/src/infrastructure/state/operational-metrics-storage.test.ts +107 -0
- package/src/infrastructure/state/state-jsonl.ts +268 -0
- package/src/infrastructure/state/state-mysql-update-plan.test.ts +54 -0
- package/src/infrastructure/state/state-mysql-update-plan.ts +63 -0
- package/src/infrastructure/state/state-mysql.ts +359 -0
- package/src/infrastructure/state/state.test.ts +319 -0
- package/src/infrastructure/state/state.ts +11 -0
- package/src/kernel-api/v1/artifact.test.ts +46 -0
- package/src/kernel-api/v1/artifact.ts +71 -0
- package/src/kernel-api/v1/contracts.ts +168 -0
- package/src/kernel-api/v1/execution-gate.test.ts +25 -0
- package/src/kernel-api/v1/execution-gate.ts +18 -0
- package/src/kernel-api/v1/index.ts +51 -0
- package/src/openclaw-stdio.test.ts +60 -0
- package/src/routes/admin-access-default.ts +20 -0
- package/src/routes/admin-access.ts +94 -0
- package/src/routes/admin-branding.test.ts +116 -0
- package/src/routes/admin-branding.ts +48 -0
- package/src/routes/admin-chat-default.ts +12 -0
- package/src/routes/admin-chat.ts +84 -0
- package/src/routes/admin-default.ts +35 -0
- package/src/routes/admin-dispatch-config-default.ts +13 -0
- package/src/routes/admin-dispatch-config.ts +121 -0
- package/src/routes/admin-format.ts +12 -0
- package/src/routes/admin-host.test.ts +56 -0
- package/src/routes/admin-infra-default.ts +12 -0
- package/src/routes/admin-infra.ts +142 -0
- package/src/routes/admin-kb-default.ts +13 -0
- package/src/routes/admin-kb.ts +160 -0
- package/src/routes/admin-runtime-default.ts +31 -0
- package/src/routes/admin-runtime.ts +444 -0
- package/src/routes/admin-tool-providers-default.ts +20 -0
- package/src/routes/admin-tool-providers.test.ts +114 -0
- package/src/routes/admin-tool-providers.ts +186 -0
- package/src/routes/admin.ts +246 -0
- package/src/routes/approvals-default.ts +32 -0
- package/src/routes/approvals.ts +120 -0
- package/src/routes/chat-default.ts +61 -0
- package/src/routes/chat-mount.test.ts +58 -0
- package/src/routes/chat.test.ts +222 -0
- package/src/routes/chat.ts +478 -0
- package/src/routes/critical-routes.test.ts +292 -0
- package/src/routes/executor-default.ts +45 -0
- package/src/routes/executor.ts +226 -0
- package/src/routes/kb-default.ts +23 -0
- package/src/routes/kb.ts +92 -0
- package/src/routes/private-default.ts +38 -0
- package/src/routes/private-host-auth.test.ts +84 -0
- package/src/routes/private.ts +210 -0
- package/src/routes/public-default.ts +46 -0
- package/src/routes/public.test.ts +504 -0
- package/src/routes/public.ts +313 -0
- package/src/routes/run-default.ts +25 -0
- package/src/routes/run.ts +188 -0
- package/src/routes/send-default.ts +24 -0
- package/src/routes/send.ts +143 -0
- package/src/routes/wecom-default.ts +27 -0
- package/src/routes/wecom.ts +307 -0
- package/src/server.ts +13 -0
- package/src/services/embedding.test.ts +185 -0
- package/src/services/embedding.ts +138 -0
- package/src/services/kb-repository.ts +79 -0
- package/src/services/kb.ts +328 -0
- package/src/services/kbsync.ts +166 -0
- package/src/services/tool-index-repository.ts +50 -0
- package/src/services/tools-index.test.ts +756 -0
- package/src/services/tools-index.ts +427 -0
- package/tsconfig.json +17 -0
- package/web/connect/bailing-connect-php.tgz +0 -0
- package/web/connect/bailing-connect-php7.tgz +0 -0
- package/web/connect/executor.mjs +152 -0
- package/web/connect/openclaw-stdio.mjs +145 -0
- package/web/connect/skills/connect-bailinghub-executor/SKILL.md +97 -0
- package/web/connect/skills/connect-bailinghub-executor/agents/openai.yaml +4 -0
- package/web/connect/skills/connect-bailinghub-executor/references/direct-protocol.md +99 -0
- package/web/connect/skills/connect-bailinghub-executor/references/openclaw.md +39 -0
- package/web/console/assets/Accounts-B4ePH5jp.css +1 -0
- package/web/console/assets/Accounts-Dwzm4D_V.js +3 -0
- package/web/console/assets/Approvals-BxhuI0ku.js +1 -0
- package/web/console/assets/Approvals-DlTSHl_7.css +1 -0
- package/web/console/assets/Audit-CSu6_3oD.css +1 -0
- package/web/console/assets/Audit-dFAbGynl.js +1 -0
- package/web/console/assets/BrandLockup-BtZyvkM5.js +1 -0
- package/web/console/assets/BrandLockup-DKYBYzKU.css +1 -0
- package/web/console/assets/Channels-CCn0L1jg.css +1 -0
- package/web/console/assets/Channels-Dqg4-_yr.js +105 -0
- package/web/console/assets/ChatEntries-BweMx_CU.css +1 -0
- package/web/console/assets/ChatEntries-CEGZ3NnJ.js +7 -0
- package/web/console/assets/Clients-C0QD1x7g.js +3 -0
- package/web/console/assets/Clients-DcTYN-Js.css +1 -0
- package/web/console/assets/Cost-BAJqLhpK.js +1 -0
- package/web/console/assets/Cost-CjT39DSZ.css +1 -0
- package/web/console/assets/Credentials-D_GDRgWi.js +1 -0
- package/web/console/assets/Credentials-ioLP0qYN.css +1 -0
- package/web/console/assets/Diagnostics-BWYnDxRj.js +1 -0
- package/web/console/assets/Diagnostics-Ya05PTDp.css +1 -0
- package/web/console/assets/Executors-CjhEM54c.css +1 -0
- package/web/console/assets/Executors-Cmryk4Vk.js +1 -0
- package/web/console/assets/HelpTip-CA6Bm7Nx.css +1 -0
- package/web/console/assets/HelpTip-CT07o3kB.js +1 -0
- package/web/console/assets/Kb-BSXQE0Fa.js +5 -0
- package/web/console/assets/Kb-CzIzd9xr.css +1 -0
- package/web/console/assets/Login-BnBPqC8Z.js +1 -0
- package/web/console/assets/Login-xtPwDB5_.css +1 -0
- package/web/console/assets/Projects-Bm8AjsNx.css +1 -0
- package/web/console/assets/Projects-CNHx4L_7.js +1 -0
- package/web/console/assets/Routes-DWGQN5Pv.css +1 -0
- package/web/console/assets/Routes-u5cEAEXQ.js +124 -0
- package/web/console/assets/Runs-BeFUR77_.js +3 -0
- package/web/console/assets/Runs-CUtSsPW-.css +1 -0
- package/web/console/assets/Setup-BjZfrmfN.js +1 -0
- package/web/console/assets/Setup-QjlHZKdB.css +1 -0
- package/web/console/assets/Shell-CbGNTN91.css +1 -0
- package/web/console/assets/Shell-EJuYf3OO.js +1 -0
- package/web/console/assets/StorageBuckets-DMXRJxUA.js +1 -0
- package/web/console/assets/StorageBuckets-GnXnVvF0.css +1 -0
- package/web/console/assets/SystemSettings-B72F-loY.js +1 -0
- package/web/console/assets/SystemSettings-BjiHyrXO.css +1 -0
- package/web/console/assets/SystemStatus-I11I67rw.css +1 -0
- package/web/console/assets/SystemStatus-hOj_TPYE.js +1 -0
- package/web/console/assets/Targets-DTb5tn6z.css +1 -0
- package/web/console/assets/Targets-UVVf7twC.js +1 -0
- package/web/console/assets/Tools-A20oaMaQ.css +1 -0
- package/web/console/assets/Tools-ihkr9R9x.js +2 -0
- package/web/console/assets/_plugin-vue_export-helper-DlAUqK2U.js +1 -0
- package/web/console/assets/docs-DPUOCa7R.js +1 -0
- package/web/console/assets/index-DZEQL_yy.js +1 -0
- package/web/console/assets/index-DxvruykG.js +2 -0
- package/web/console/assets/index-Fi9gkGxV.css +1 -0
- package/web/console/assets/llm-catalog-HwRIrS94.js +1 -0
- package/web/console/assets/request-BisL2T9B.js +1 -0
- package/web/console/assets/schema-CzpUpoLk.js +1 -0
- package/web/console/assets/util-SiQC2MJh.js +1 -0
- package/web/console/assets/vendor-element-D7WRzHhy.js +37 -0
- package/web/console/assets/vendor-mammoth-DvgsHdlx.js +231 -0
- package/web/console/assets/vendor-turndown-kLzRgxYD.js +61 -0
- package/web/console/assets/vendor-vue-B2uhHUfE.js +29 -0
- package/web/console/index.html +16 -0
- package/web/widget/widget.js +1490 -0
- package/web-admin/index.html +13 -0
- package/web-admin/package-lock.json +1854 -0
- package/web-admin/package.json +25 -0
- package/web-admin/src/App.vue +9 -0
- package/web-admin/src/branding.ts +90 -0
- package/web-admin/src/components/BrandLockup.vue +40 -0
- package/web-admin/src/components/HelpTip.vue +51 -0
- package/web-admin/src/components/RichText.vue +35 -0
- package/web-admin/src/docs.ts +16 -0
- package/web-admin/src/layout/Shell.vue +356 -0
- package/web-admin/src/llm-catalog.ts +129 -0
- package/web-admin/src/main.ts +116 -0
- package/web-admin/src/pages/Accounts.vue +162 -0
- package/web-admin/src/pages/Approvals.vue +179 -0
- package/web-admin/src/pages/Audit.vue +110 -0
- package/web-admin/src/pages/Channels.vue +738 -0
- package/web-admin/src/pages/ChatEntries.vue +778 -0
- package/web-admin/src/pages/Clients.vue +353 -0
- package/web-admin/src/pages/Cost.vue +314 -0
- package/web-admin/src/pages/Credentials.vue +418 -0
- package/web-admin/src/pages/Diagnostics.vue +440 -0
- package/web-admin/src/pages/Executors.vue +398 -0
- package/web-admin/src/pages/Kb.vue +698 -0
- package/web-admin/src/pages/Login.vue +314 -0
- package/web-admin/src/pages/Projects.vue +106 -0
- package/web-admin/src/pages/Routes.vue +1661 -0
- package/web-admin/src/pages/Runs.vue +1113 -0
- package/web-admin/src/pages/Setup.vue +354 -0
- package/web-admin/src/pages/StorageBuckets.vue +182 -0
- package/web-admin/src/pages/SystemSettings.vue +281 -0
- package/web-admin/src/pages/SystemStatus.vue +185 -0
- package/web-admin/src/pages/Targets.vue +193 -0
- package/web-admin/src/pages/Tools.vue +1051 -0
- package/web-admin/src/request.ts +18 -0
- package/web-admin/src/router.ts +142 -0
- package/web-admin/src/runtime-path.ts +27 -0
- package/web-admin/src/schema.ts +52 -0
- package/web-admin/src/store.ts +35 -0
- package/web-admin/src/styles/base.css +272 -0
- package/web-admin/src/table-widths.ts +603 -0
- package/web-admin/src/util.ts +16 -0
- package/web-admin/tsconfig.json +15 -0
- package/web-admin/vite.config.ts +35 -0
|
@@ -0,0 +1,1051 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-card shadow="never">
|
|
3
|
+
<template #header>
|
|
4
|
+
<div class="head"><b>工具源</b> <HelpTip title="工具源是什么">
|
|
5
|
+
<p>业务系统的 <b>Agent 可调接口清单</b>(OpenAPI + <code>x-agent-capability</code> 契约);注册后在「触发路由」挂 tools 白名单,即可让 Agent 查 / 办业务。</p>
|
|
6
|
+
</HelpTip>
|
|
7
|
+
<el-button style="margin-left: auto" @click="openDocs('tools')">开发文档</el-button>
|
|
8
|
+
<el-button type="primary" @click="openCreate">注册工具源</el-button></div>
|
|
9
|
+
</template>
|
|
10
|
+
<el-empty v-if="!list.length" description="还没有工具源:业务系统在自己的 OpenAPI 上声明 x-agent-capability 后,把 spec 注册进来">
|
|
11
|
+
<el-button @click="openDocs('tools')">查看开发文档</el-button>
|
|
12
|
+
<el-button type="primary" @click="openCreate">注册第一个</el-button>
|
|
13
|
+
</el-empty>
|
|
14
|
+
<el-table v-else :data="list">
|
|
15
|
+
<el-table-column label="工具源" min-width="270" show-overflow-tooltip>
|
|
16
|
+
<template #default="{ row }">
|
|
17
|
+
<div class="tool-main">
|
|
18
|
+
<b>{{ row.name }}</b>
|
|
19
|
+
<code>{{ row.base_url }}</code>
|
|
20
|
+
<span v-if="row.description" class="muted ellipsis">{{ row.description }}</span>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
</el-table-column>
|
|
24
|
+
<el-table-column label="接口清单" min-width="310">
|
|
25
|
+
<template #default="{ row }">
|
|
26
|
+
<div class="tool-stack">
|
|
27
|
+
<div class="tagline">
|
|
28
|
+
<el-tag size="small" effect="plain" :type="row.has_spec ? 'success' : 'danger'">{{ row.has_spec ? '已载入' : '未载入' }}</el-tag>
|
|
29
|
+
<el-tag size="small" effect="plain" type="info">{{ specSourceLabel(row) }}</el-tag>
|
|
30
|
+
<el-tag v-if="row.embed_credential" size="small" effect="plain" type="warning" :title="'工具检索已开启 · ' + (row.embed_model || '')">语义检索</el-tag>
|
|
31
|
+
</div>
|
|
32
|
+
<div v-if="row.spec_source === 'url'" class="tagline">
|
|
33
|
+
<el-tag size="small" effect="plain" :type="specAccessPolicyType(row.spec_access_policy)">{{ specAccessPolicyLabel(row.spec_access_policy) }}</el-tag>
|
|
34
|
+
<el-tag size="small" effect="plain" :type="specAccessProbeType(row)" :title="specAccessProbeTitle(row.spec_access_probe)">{{ specAccessProbeLabel(row.spec_access_probe) }}</el-tag>
|
|
35
|
+
</div>
|
|
36
|
+
<span v-if="row.spec_source === 'url'" class="muted">{{ specAccessProbeSummary(row.spec_access_probe) }}</span>
|
|
37
|
+
<span class="muted">{{ refreshPolicyLabel(row) }}</span>
|
|
38
|
+
<span class="muted">{{ specRefreshedLabel(row) }}</span>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
</el-table-column>
|
|
42
|
+
<el-table-column label="治理安全" min-width="260">
|
|
43
|
+
<template #default="{ row }">
|
|
44
|
+
<div class="tool-stack">
|
|
45
|
+
<div class="tagline">
|
|
46
|
+
<el-tag size="small" effect="plain" :type="authzProbeType(row.authz_probe)" :title="authzProbeTitle(row.authz_probe)">{{ authzProbeLabel(row.authz_probe) }}</el-tag>
|
|
47
|
+
<el-tag size="small" effect="plain" type="info">{{ auditLabel(row) }}</el-tag>
|
|
48
|
+
<el-tag size="small" effect="plain" type="info">{{ timeoutLabel(row.timeout_ms) }}</el-tag>
|
|
49
|
+
<el-tag size="small" effect="plain" type="info">{{ rateLimitLabel(row.rate_limit_per_min) }}</el-tag>
|
|
50
|
+
</div>
|
|
51
|
+
<div class="probe-line">
|
|
52
|
+
<span class="muted">{{ authzProbeSummary(row.authz_probe) }}</span>
|
|
53
|
+
<el-popover trigger="hover" placement="top" width="380">
|
|
54
|
+
<template #reference>
|
|
55
|
+
<el-button link size="small">详情</el-button>
|
|
56
|
+
</template>
|
|
57
|
+
<div class="probe-popover">
|
|
58
|
+
<div class="probe-title">{{ authzProbeTitle(row.authz_probe) }}</div>
|
|
59
|
+
<div class="probe-meta">
|
|
60
|
+
<span>模式:{{ authzProbeMode(row.authz_probe) }}</span>
|
|
61
|
+
<span v-if="row.authz_probe?.path">路径:<code>{{ row.authz_probe.path }}</code></span>
|
|
62
|
+
<span v-if="row.authz_probe?.tool">工具:<code>{{ row.authz_probe.tool }}</code></span>
|
|
63
|
+
<span v-if="row.authz_probe?.http">HTTP:{{ row.authz_probe.http }}</span>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="probe-advice-title">建议</div>
|
|
66
|
+
<ul class="probe-advice">
|
|
67
|
+
<li v-for="item in authzProbeAdvice(row.authz_probe)" :key="item">{{ item }}</li>
|
|
68
|
+
</ul>
|
|
69
|
+
</div>
|
|
70
|
+
</el-popover>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
74
|
+
</el-table-column>
|
|
75
|
+
<el-table-column label="密钥与状态" width="190">
|
|
76
|
+
<template #default="{ row }">
|
|
77
|
+
<div class="tool-stack">
|
|
78
|
+
<div class="secret-line">
|
|
79
|
+
<code>{{ row.secret }}</code>
|
|
80
|
+
<el-button v-if="s.can('tools:write')" link type="primary" @click="copySecret(row.name)">复制</el-button>
|
|
81
|
+
</div>
|
|
82
|
+
<el-tag size="small" effect="plain" :type="row.enabled ? 'success' : 'info'">{{ row.enabled ? '启用' : '停用' }}</el-tag>
|
|
83
|
+
</div>
|
|
84
|
+
</template>
|
|
85
|
+
</el-table-column>
|
|
86
|
+
<el-table-column width="320" align="right">
|
|
87
|
+
<template #default="{ row }">
|
|
88
|
+
<el-button link type="primary" @click="preview(row)">工具清单</el-button>
|
|
89
|
+
<el-button v-if="row.spec_source === 'url'" link type="primary" :loading="refreshing === row.name" @click="refresh(row.name)">刷新</el-button>
|
|
90
|
+
<el-button link type="primary" :loading="probing === row.name" @click="probeAuthz(row.name)">探针</el-button>
|
|
91
|
+
<el-button v-if="row.embed_credential" link type="primary" :loading="reindexing === row.name" @click="reindex(row.name)">重建索引</el-button>
|
|
92
|
+
<el-button link type="primary" @click="openEdit(row)">编辑</el-button>
|
|
93
|
+
<el-popconfirm title="删除该工具源?挂它的路由会降级为纯对话。" width="250" @confirm="del(row.name)">
|
|
94
|
+
<template #reference><el-button link type="danger">删</el-button></template>
|
|
95
|
+
</el-popconfirm>
|
|
96
|
+
</template>
|
|
97
|
+
</el-table-column>
|
|
98
|
+
</el-table>
|
|
99
|
+
</el-card>
|
|
100
|
+
|
|
101
|
+
<!-- 注册/编辑 -->
|
|
102
|
+
<el-drawer v-model="open" :title="editing ? '编辑工具源' : '注册工具源'" size="560px">
|
|
103
|
+
<el-form label-position="top">
|
|
104
|
+
<el-tabs v-model="toolFormTab" class="console-tabs">
|
|
105
|
+
<el-tab-pane label="基础" name="basic">
|
|
106
|
+
<el-form-item>
|
|
107
|
+
<template #label>{{ fieldTitle('name', '名称') }} <span v-if="fieldRequired('name')" class="field-required">*</span>
|
|
108
|
+
<HelpTip :title="fieldTitle('name', '名称')"><p>{{ fieldDesc('name') }}</p></HelpTip>
|
|
109
|
+
</template>
|
|
110
|
+
<el-input v-model="form.name" :disabled="editing" placeholder="如 demo-business / business-api" class="mono" />
|
|
111
|
+
</el-form-item>
|
|
112
|
+
<el-form-item>
|
|
113
|
+
<template #label>{{ fieldTitle('base_url', 'Base URL') }} <span v-if="fieldRequired('base_url')" class="field-required">*</span> <HelpTip :title="fieldTitle('base_url', 'Base URL')">
|
|
114
|
+
<p>{{ fieldDesc('base_url') }}</p>
|
|
115
|
+
<p>AI 调工具时,请求发到 <code>base_url + 接口 path</code>。</p>
|
|
116
|
+
<p><b>必须指向源站直连地址</b>——中枢"签所发即所发",URI 会被重写 / 重编码的 CDN 或网关后面验签必挂。</p>
|
|
117
|
+
</HelpTip></template>
|
|
118
|
+
<el-input v-model="form.base_url" placeholder="https://server.example.com" class="mono" />
|
|
119
|
+
</el-form-item>
|
|
120
|
+
<el-form-item>
|
|
121
|
+
<template #label>{{ fieldTitle('secret', '签名密钥') }} <span v-if="fieldRequired('secret')" class="field-required">*</span> <HelpTip :title="fieldTitle('secret', '签名密钥')">
|
|
122
|
+
<p>{{ fieldDesc('secret') }}</p>
|
|
123
|
+
<p>建议点「生成」用 32 位随机串。签名标签统一 <b>sha256=</b>(算法名,非版本号):构造把操作主体+任务也钉进 HMAC(spec 拉取无主体/任务即签空串,同一套构造)。<b>轮换:</b>改这里即时生效(无需重启),但业务侧 secret 要同步换成同值,否则验签失败;该 secret 在业务侧两处用(工具接口验签 + spec 托管)。</p>
|
|
124
|
+
<p>这是中枢与业务的<b>共享密钥</b>——业务侧验签要用同一串。建好后列表里只显示掩码,点该行「<b>复制</b>」按钮可随时取回完整值交给业务方(与模型凭证的 api_key 不同,那是中枢出站凭证、永不外泄)。</p>
|
|
125
|
+
<p>与接入方 token、中枢管理 token 完全解耦,可单独轮换;泄露只影响"伪装中枢调业务",不波及其他面。</p>
|
|
126
|
+
</HelpTip></template>
|
|
127
|
+
<el-input v-model="form.secret" type="password" show-password autocomplete="off" :placeholder="editing ? '留空 = 保留原密钥' : ''">
|
|
128
|
+
<template #append><el-button @click="genSecret">生成</el-button></template>
|
|
129
|
+
</el-input>
|
|
130
|
+
</el-form-item>
|
|
131
|
+
</el-tab-pane>
|
|
132
|
+
<el-tab-pane label="接口清单" name="spec">
|
|
133
|
+
<el-form-item>
|
|
134
|
+
<template #label>{{ fieldTitle('spec_source', '接口清单来源') }} <HelpTip :title="fieldTitle('spec_source', '接口清单来源')"><p>{{ fieldDesc('spec_source') }}</p></HelpTip></template>
|
|
135
|
+
<el-radio-group v-model="form.spec_source">
|
|
136
|
+
<el-radio value="inline">粘贴 openapi.json</el-radio>
|
|
137
|
+
<el-radio value="url">从 URL 拉取</el-radio>
|
|
138
|
+
</el-radio-group>
|
|
139
|
+
</el-form-item>
|
|
140
|
+
<el-form-item v-if="form.spec_source === 'url'">
|
|
141
|
+
<template #label>{{ fieldTitle('spec_url', '接口清单地址') }} <span class="field-required">*</span> <HelpTip :title="fieldTitle('spec_url', '接口清单地址')">
|
|
142
|
+
<p>{{ fieldDesc('spec_url') }}</p>
|
|
143
|
+
<p>推荐约定路径 <code>/.well-known/bailing/tools.json</code>,但<b>不强制</b>——宝塔等面板对点开头路径有特殊处理(详见官网开发文档),换任意路径(如 <code>/api/bailing/tools</code>)即可绕开。</p>
|
|
144
|
+
<p>建议 spec 根声明 <code>x-bailing-authz-probe</code>,并在业务系统单独挂一个授权探针端点;中枢刷新后会用不存在的主体验证业务侧是否 fail-closed。</p>
|
|
145
|
+
</HelpTip></template>
|
|
146
|
+
<el-input v-model="form.spec_url" placeholder="https://server.example.com/.well-known/bailing/tools.json" class="mono" />
|
|
147
|
+
</el-form-item>
|
|
148
|
+
<el-form-item v-if="form.spec_source === 'url'">
|
|
149
|
+
<template #label>接口清单访问策略 <HelpTip title="接口清单访问策略">
|
|
150
|
+
<p><b>签名保护(推荐)</b>:未签名或错误签名的请求必须被业务侧拒绝;中枢刷新时会用正确签名读取,再以未签名和错误签名请求确认它们均被拒绝。</p>
|
|
151
|
+
<p><b>允许公开</b>:中枢以未签名请求读取;任何能访问该 URL 的人都可以下载接口路径、参数、scope 与风险声明。只应在你明确接受公开时选择。</p>
|
|
152
|
+
<p>该策略只约束接口清单的读取方式;工具调用仍必须验签并按操作主体授权。</p>
|
|
153
|
+
</HelpTip></template>
|
|
154
|
+
<div class="spec-access-policy">
|
|
155
|
+
<el-radio-group v-model="form.spec_access_policy">
|
|
156
|
+
<el-radio value="signed_required">
|
|
157
|
+
签名保护(推荐)
|
|
158
|
+
<el-tag v-if="historicalProtectedEvidence" size="small" type="success" effect="plain">与当前实测一致</el-tag>
|
|
159
|
+
</el-radio>
|
|
160
|
+
<el-radio value="public_allowed">允许公开</el-radio>
|
|
161
|
+
</el-radio-group>
|
|
162
|
+
<el-alert
|
|
163
|
+
v-if="historicalAccessPending"
|
|
164
|
+
title="升级后待确认访问方式;当前运行不受影响"
|
|
165
|
+
:description="historicalAccessDescription"
|
|
166
|
+
type="warning"
|
|
167
|
+
:closable="false"
|
|
168
|
+
show-icon
|
|
169
|
+
/>
|
|
170
|
+
<el-button
|
|
171
|
+
v-if="historicalAccessPending && historicalProtectedEvidence"
|
|
172
|
+
type="primary"
|
|
173
|
+
plain
|
|
174
|
+
size="small"
|
|
175
|
+
@click="adoptProtectedSpecAccess"
|
|
176
|
+
>采用实测结果:签名保护</el-button>
|
|
177
|
+
<el-alert
|
|
178
|
+
v-if="form.spec_access_policy === 'public_allowed'"
|
|
179
|
+
title="公开的是能力清单,不是签名密钥;但接口路径、参数和风险声明会对 URL 访问者可见。保存时还会再次确认。"
|
|
180
|
+
type="warning"
|
|
181
|
+
:closable="false"
|
|
182
|
+
show-icon
|
|
183
|
+
/>
|
|
184
|
+
</div>
|
|
185
|
+
</el-form-item>
|
|
186
|
+
<el-form-item v-if="form.spec_source === 'url'">
|
|
187
|
+
<template #label>{{ fieldTitle('auto_refresh_min', '自动刷新') }}(分钟,0 = 关闭) <HelpTip :title="fieldTitle('auto_refresh_min', '自动刷新')">
|
|
188
|
+
<p>{{ fieldDesc('auto_refresh_min') }}</p>
|
|
189
|
+
<p>业务侧每次部署更新 spec 后,中枢按此间隔定时拉取,新标注的接口<b>无需任何人工操作</b>即成为 AI 工具。</p>
|
|
190
|
+
<p>自动生效不等于无人知晓:每次拉取与上次清单对账,工具<b>新增 / 移除 / scope 或风险级变化</b>都会记审计并告警管理员;拉取失败保留旧清单继续工作。</p>
|
|
191
|
+
</HelpTip></template>
|
|
192
|
+
<el-input-number v-model="form.auto_refresh_min" :min="0" :max="1440" :step="5" />
|
|
193
|
+
</el-form-item>
|
|
194
|
+
<el-form-item v-else>
|
|
195
|
+
<template #label>{{ fieldTitle('spec_json', 'OpenAPI 文档') }} <HelpTip :title="fieldTitle('spec_json', 'OpenAPI 文档')"><p>{{ editing ? fieldDesc('spec_json') : '含 x-agent-capability 契约的 OpenAPI 3.x JSON 或 YAML;保存后统一归一化。' }}</p></HelpTip></template>
|
|
196
|
+
<el-input v-model="form.spec_json" type="textarea" :rows="8" class="mono" placeholder="openapi: 3.0.0\npaths:\n /records/list:\n get:\n x-agent-capability:\n version: 1\n enabled: true\n scope: records.read" />
|
|
197
|
+
</el-form-item>
|
|
198
|
+
</el-tab-pane>
|
|
199
|
+
<el-tab-pane label="治理" name="governance">
|
|
200
|
+
<el-form-item>
|
|
201
|
+
<template #label>审计粒度 <HelpTip title="审计粒度">
|
|
202
|
+
<p>每次工具调用的参数记到什么程度:全量值(≤4KB 截断)便于排障对账;只记键名适合隐私敏感场景。</p>
|
|
203
|
+
<p>无论选哪种,业务侧标了 <code>sensitive</code> 的工具一律只记键名(接口注解优先级更高)。</p>
|
|
204
|
+
</HelpTip></template>
|
|
205
|
+
<el-radio-group v-model="form.log_payload">
|
|
206
|
+
<el-radio :value="true">记参数全量值(≤4KB 截断,默认)</el-radio>
|
|
207
|
+
<el-radio :value="false">只记键名(隐私敏感场景)</el-radio>
|
|
208
|
+
</el-radio-group>
|
|
209
|
+
</el-form-item>
|
|
210
|
+
<el-form-item>
|
|
211
|
+
<template #label>{{ fieldTitle('timeout_ms', '单次调用超时') }}(毫秒) <HelpTip :title="fieldTitle('timeout_ms', '单次调用超时')"><p>{{ fieldDesc('timeout_ms') }}</p></HelpTip></template>
|
|
212
|
+
<el-input-number v-model="form.timeout_ms" :min="1000" :max="60000" :step="1000" />
|
|
213
|
+
</el-form-item>
|
|
214
|
+
<el-form-item>
|
|
215
|
+
<template #label>{{ fieldTitle('rate_limit_per_min', '总闸限流') }}(次/分钟,0=不限) <HelpTip :title="fieldTitle('rate_limit_per_min', '总闸限流')"><p>{{ fieldDesc('rate_limit_per_min') }}</p></HelpTip></template>
|
|
216
|
+
<el-input-number v-model="form.rate_limit_per_min" :min="0" :max="6000" :step="10" />
|
|
217
|
+
</el-form-item>
|
|
218
|
+
</el-tab-pane>
|
|
219
|
+
<el-tab-pane label="工具检索" name="retrieval">
|
|
220
|
+
<el-form-item>
|
|
221
|
+
<template #label>向量模型凭证 <HelpTip title="工具检索:工具一多就别甩目录给模型">
|
|
222
|
+
<p>工具超过 12 个时,与其把整份目录甩给模型让它自己翻(命中率低、模型常常不去翻),不如由中枢按用户这句话<b>语义检索</b>出最相关的十来个工具,直接内联给模型用。</p>
|
|
223
|
+
<p>开启需要一把<b>向量化凭证</b>(在「模型凭证」里添加、用途含向量化)。<b>留空 = 不开检索</b>,使用「目录 + find_tools」渐进披露模式。</p>
|
|
224
|
+
<p>模型 / 维度与索引坐标系绑定,改了会整源重算(保存时自动重建)。建好后列表行有「重建索引」按钮可手动重建。</p>
|
|
225
|
+
</HelpTip></template>
|
|
226
|
+
<el-select v-model="form.embed_credential" clearable filterable placeholder="留空 = 不开工具检索" style="width: 100%" @change="onEmbedCred">
|
|
227
|
+
<el-option v-for="c in embCreds" :key="c.name" :value="c.name" :label="c.name + '(' + (c.default_model || '?') + ')'" />
|
|
228
|
+
</el-select>
|
|
229
|
+
<div v-if="!embCreds.length" class="muted hint">还没有可向量化的凭证——先去「模型凭证」加一把(用途含向量化)</div>
|
|
230
|
+
</el-form-item>
|
|
231
|
+
<el-form-item v-if="form.embed_credential" label="向量模型"><el-input v-model="form.embed_model" placeholder="如 text-embedding-v4" class="mono" /></el-form-item>
|
|
232
|
+
<el-form-item v-if="form.embed_credential" label="向量维度"><el-input-number v-model="form.embed_dim" :min="64" :max="4096" :step="256" /></el-form-item>
|
|
233
|
+
</el-tab-pane>
|
|
234
|
+
<el-tab-pane label="发布" name="publish">
|
|
235
|
+
<el-form-item label="说明(可选)"><el-input v-model="form.description" /></el-form-item>
|
|
236
|
+
<el-form-item v-if="editing" label="启用"><el-switch v-model="form.enabled" /></el-form-item>
|
|
237
|
+
</el-tab-pane>
|
|
238
|
+
</el-tabs>
|
|
239
|
+
</el-form>
|
|
240
|
+
<template #footer>
|
|
241
|
+
<el-button @click="open = false">取消</el-button>
|
|
242
|
+
<el-button type="primary" :loading="saving" @click="save">保存</el-button>
|
|
243
|
+
</template>
|
|
244
|
+
</el-drawer>
|
|
245
|
+
|
|
246
|
+
<!-- 工具清单预览 -->
|
|
247
|
+
<!-- 800 = 内表格最小宽 670 + 展开列 48 + 抽屉内边距 40 + 余量;改列宽时同步核算,别让抽屉底部出横向滚动 -->
|
|
248
|
+
<el-drawer v-model="previewOpen" :title="'工具清单 · ' + previewName" size="800px">
|
|
249
|
+
<el-alert v-if="previewNote" :title="previewNote" type="warning" :closable="false" style="margin-bottom: 12px" />
|
|
250
|
+
<template v-if="previewWarnings.length">
|
|
251
|
+
<div class="muted" style="margin: 0 0 6px">接入体检提醒:</div>
|
|
252
|
+
<div v-for="w in previewWarnings" :key="w.path + w.code + w.message" class="warning-row">
|
|
253
|
+
<code>{{ w.path }}</code><span>{{ w.message }}</span>
|
|
254
|
+
</div>
|
|
255
|
+
</template>
|
|
256
|
+
<template v-if="previewTools.length">
|
|
257
|
+
<!-- 搜索:文本筛选(即时、按名/路径/scope/描述)+ 语义召回预演(用向量检索预演"这句话会召回哪些工具、精度多高",调优工具措辞) -->
|
|
258
|
+
<div class="search-bar">
|
|
259
|
+
<el-input v-model="previewFilter" clearable size="small" placeholder="筛选:名称 / 路径 / scope / 描述(即时)" style="max-width: 300px" />
|
|
260
|
+
<template v-if="previewEmbed">
|
|
261
|
+
<el-input v-model="retrieveQ" clearable size="small" placeholder="语义召回预演:输入用户可能问的话" style="max-width: 320px" @keyup.enter="runRetrieveTest" />
|
|
262
|
+
<el-button type="primary" size="small" :loading="retrieving" @click="runRetrieveTest">召回预演</el-button>
|
|
263
|
+
</template>
|
|
264
|
+
<span v-else class="muted">(该工具源未开启检索,仅文本筛选可用)</span>
|
|
265
|
+
</div>
|
|
266
|
+
<div class="debug-call">
|
|
267
|
+
<div class="debug-head">
|
|
268
|
+
<b>调试调用</b>
|
|
269
|
+
<span class="muted">走中枢同款签名材料真实请求业务源站;高风险/审批工具默认只展示阻断原因,不直接执行。</span>
|
|
270
|
+
</div>
|
|
271
|
+
<el-row :gutter="8">
|
|
272
|
+
<el-col :span="8">
|
|
273
|
+
<el-select v-model="debugTool" filterable placeholder="选择工具" size="small" style="width: 100%">
|
|
274
|
+
<el-option v-for="t in previewTools" :key="t.name" :label="`${t.name} · ${t.method} ${t.path}`" :value="t.name" />
|
|
275
|
+
</el-select>
|
|
276
|
+
</el-col>
|
|
277
|
+
<el-col :span="8"><el-input v-model="debugSubject" size="small" placeholder="操作主体 on_behalf_of,如 demo-user-001" class="mono" /></el-col>
|
|
278
|
+
<el-col :span="8">
|
|
279
|
+
<el-select v-model="debugSampleId" clearable size="small" placeholder="最近样例" style="width: 100%" @change="applyDebugSampleById">
|
|
280
|
+
<el-option v-for="sample in debugSamples" :key="sample.id" :label="debugSampleLabel(sample)" :value="sample.id" />
|
|
281
|
+
</el-select>
|
|
282
|
+
</el-col>
|
|
283
|
+
</el-row>
|
|
284
|
+
<div class="debug-mode">
|
|
285
|
+
<el-radio-group v-model="debugMode" size="small">
|
|
286
|
+
<el-radio-button value="form">参数表单</el-radio-button>
|
|
287
|
+
<el-radio-button value="json">JSON</el-radio-button>
|
|
288
|
+
</el-radio-group>
|
|
289
|
+
<span v-if="selectedDebugTool" class="muted">
|
|
290
|
+
{{ selectedDebugTool.method }} {{ selectedDebugTool.path }} · <code>{{ selectedDebugTool.scope }}</code>
|
|
291
|
+
</span>
|
|
292
|
+
</div>
|
|
293
|
+
<div v-if="debugMode === 'form'" class="debug-param-grid">
|
|
294
|
+
<div v-if="!debugParamRows.length" class="muted debug-empty">该工具无入参,点击“实调验证”即可发起请求。</div>
|
|
295
|
+
<div v-for="p in debugParamRows" :key="p.name" class="debug-param">
|
|
296
|
+
<div class="debug-param-label">
|
|
297
|
+
<code>{{ p.name }}</code>
|
|
298
|
+
<el-tag size="small" effect="plain" type="info">{{ p.loc }}</el-tag>
|
|
299
|
+
<el-tag v-if="p.required" size="small" effect="plain" type="danger">必填</el-tag>
|
|
300
|
+
</div>
|
|
301
|
+
<el-select v-if="p.enum?.length" v-model="debugParamValues[p.name]" clearable filterable size="small" :placeholder="p.desc || p.type">
|
|
302
|
+
<el-option v-for="x in p.enum" :key="String(x)" :label="String(x)" :value="String(x)" />
|
|
303
|
+
</el-select>
|
|
304
|
+
<el-switch v-else-if="p.type === 'boolean'" v-model="debugParamValues[p.name]" active-value="true" inactive-value="false" />
|
|
305
|
+
<el-input-number v-else-if="p.type === 'number' || p.type === 'integer'" v-model="debugParamValues[p.name]" size="small" style="width: 100%" />
|
|
306
|
+
<el-input v-else-if="p.type === 'array' || p.type === 'object'" v-model="debugParamValues[p.name]" size="small" class="mono" :placeholder="p.type === 'array' ? '[...]' : '{...}'" />
|
|
307
|
+
<el-input v-else v-model="debugParamValues[p.name]" size="small" class="mono" :placeholder="p.desc || p.type" />
|
|
308
|
+
<div v-if="p.desc" class="muted debug-param-desc">{{ p.desc }}</div>
|
|
309
|
+
</div>
|
|
310
|
+
</div>
|
|
311
|
+
<el-input v-else v-model="debugArgs" type="textarea" :rows="4" class="mono debug-json" placeholder='{"id":1}' />
|
|
312
|
+
<div class="debug-actions">
|
|
313
|
+
<el-checkbox v-model="debugAllowRisky" size="small">允许实调高风险/审批工具</el-checkbox>
|
|
314
|
+
<el-button size="small" @click="syncDebugJsonFromForm">生成 JSON</el-button>
|
|
315
|
+
<el-button type="primary" size="small" :loading="debugLoading" @click="runDebugInvoke">实调验证</el-button>
|
|
316
|
+
</div>
|
|
317
|
+
<div v-if="debugResult" class="debug-result">
|
|
318
|
+
<div class="debug-status">
|
|
319
|
+
<el-tag size="small" effect="plain" :type="debugResult.blocked ? 'warning' : debugResult.ok ? 'success' : 'danger'">{{ debugResult.blocked ? '已阻断' : debugResult.ok ? '调用成功' : '调用失败' }}</el-tag>
|
|
320
|
+
<span v-if="debugResult.reason" class="muted">{{ debugResult.reason }}</span>
|
|
321
|
+
<span v-if="debugResult.response" class="muted">HTTP {{ debugResult.response.status }} · {{ debugResult.response.duration_ms }}ms</span>
|
|
322
|
+
</div>
|
|
323
|
+
<div v-if="debugDiagnosis" class="debug-diagnosis">{{ debugDiagnosis }}</div>
|
|
324
|
+
<div class="td-sec">签名字段</div>
|
|
325
|
+
<div class="signature-grid">
|
|
326
|
+
<div v-for="row in debugSignatureRows" :key="row.k"><span>{{ row.k }}</span><code>{{ row.v }}</code></div>
|
|
327
|
+
</div>
|
|
328
|
+
<div class="td-sec">请求摘要</div>
|
|
329
|
+
<pre class="block">{{ JSON.stringify(debugResult.request, null, 2) }}</pre>
|
|
330
|
+
<template v-if="debugResult.response">
|
|
331
|
+
<div class="td-sec">业务响应</div>
|
|
332
|
+
<pre class="block">{{ debugResult.response.text || '(空响应)' }}{{ debugResult.response.truncated ? '\n…[已截断]' : '' }}</pre>
|
|
333
|
+
</template>
|
|
334
|
+
</div>
|
|
335
|
+
</div>
|
|
336
|
+
<!-- 召回预演结果:绿=分数≥阈值会被内联给模型,灰=低于阈值仅 search_tools 可能补上 -->
|
|
337
|
+
<div v-if="retrieveHits.length" class="retrieve-result">
|
|
338
|
+
<div class="muted" style="margin-bottom: 6px">
|
|
339
|
+
针对「<b>{{ lastRetrieveQ }}</b>」的召回排序(<el-tag size="small" type="success" effect="plain">绿</el-tag> = 分数 ≥ 阈值 {{ retrieveMinScore }},会被内联给大脑;<el-tag size="small" type="info" effect="plain">灰</el-tag> = 低于阈值,仅模型主动 search_tools 时才可能补上)。
|
|
340
|
+
相关工具分数偏低 / 排得靠后 → 在它的 summary/描述里补上用户常说的词来调优。
|
|
341
|
+
</div>
|
|
342
|
+
<div class="rh-list">
|
|
343
|
+
<div v-for="h in retrieveHits" :key="h.name" class="rh-row" :class="{ below: h.score < retrieveMinScore }">
|
|
344
|
+
<el-tag size="small" effect="plain" :type="h.score >= retrieveMinScore ? 'success' : 'info'">{{ h.score.toFixed(3) }}</el-tag>
|
|
345
|
+
<code style="margin: 0 8px">{{ h.name }}</code><span class="muted">{{ h.scope }}</span>
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
349
|
+
<div class="muted" style="margin-bottom: 8px">共 {{ previewTools.length }} 个工具可被路由 allow 白名单引用(按 scope 匹配)<span v-if="previewFilter">,筛选出 <b>{{ filteredTools.length }}</b> 个</span>。<b>点行首箭头看完整详情</b>——业务侧注解派生出的全部内容(参数 schema / 治理参数 / 给 AI 的原文)都在这里核对,不用翻业务代码:</div>
|
|
350
|
+
<el-table :data="filteredTools" size="small" row-key="name">
|
|
351
|
+
<el-table-column type="expand">
|
|
352
|
+
<template #default="{ row }">
|
|
353
|
+
<div class="tool-detail">
|
|
354
|
+
<div class="td-sec">给 AI 的完整描述(summary + 何时用 + 返回 + 示例参数,AI 据此判断何时调用)</div>
|
|
355
|
+
<div class="td-text">{{ row.description }}</div>
|
|
356
|
+
<div class="td-sec">参数 schema(AI 按此传参;位置 = 中枢转发时放 query 还是 body)</div>
|
|
357
|
+
<el-table v-if="paramRows(row).length" :data="paramRows(row)" size="small">
|
|
358
|
+
<el-table-column label="参数" width="150"><template #default="{ row: p }"><code>{{ p.name }}</code></template></el-table-column>
|
|
359
|
+
<el-table-column label="位置" width="64" prop="loc" />
|
|
360
|
+
<el-table-column label="类型" width="90" prop="type" />
|
|
361
|
+
<el-table-column label="必填" width="56"><template #default="{ row: p }">{{ p.required ? '是' : '' }}</template></el-table-column>
|
|
362
|
+
<el-table-column label="说明" min-width="180"><template #default="{ row: p }">{{ p.desc || '—' }}</template></el-table-column>
|
|
363
|
+
</el-table>
|
|
364
|
+
<div v-else class="muted">无参数(GET 允许零参数;写接口无参数不会派生到这里)</div>
|
|
365
|
+
<div class="td-sec">治理参数</div>
|
|
366
|
+
<div class="td-text">
|
|
367
|
+
超时 {{ row.timeout_ms ? row.timeout_ms + ' ms(ACC execution.timeout_ms 覆盖)' : '跟随工具源全局' }}
|
|
368
|
+
· 单工具限速 {{ row.rate_limit_per_min ? row.rate_limit_per_min + ' 次/分' : '不限(用工具源全局限速)' }}
|
|
369
|
+
· {{ row.idempotent ? '幂等:失败可安全重试' : '非幂等:失败不自动重试' }}
|
|
370
|
+
· {{ row.readonly ? '只读' : '会改数据' }}
|
|
371
|
+
</div>
|
|
372
|
+
<template v-if="row.confirm_prompt">
|
|
373
|
+
<div class="td-sec">审批通知话术(ACC approval.prompt,{参数名} 由实参填充后发给审批人)</div>
|
|
374
|
+
<div class="td-text">{{ row.confirm_prompt }}</div>
|
|
375
|
+
</template>
|
|
376
|
+
<template v-if="row.confirm_when?.length">
|
|
377
|
+
<div class="td-sec">参数级确认规则(ACC approval.when,命中后本次调用进入审批)</div>
|
|
378
|
+
<pre class="block">{{ JSON.stringify(row.confirm_when, null, 2) }}</pre>
|
|
379
|
+
</template>
|
|
380
|
+
</div>
|
|
381
|
+
</template>
|
|
382
|
+
</el-table-column>
|
|
383
|
+
<el-table-column label="工具" min-width="170"><template #default="{ row }"><code>{{ row.name }}</code><div class="muted">{{ row.method }} {{ row.path }}</div></template></el-table-column>
|
|
384
|
+
<el-table-column label="权限范围" width="170"><template #default="{ row }"><code>{{ row.scope }}</code></template></el-table-column>
|
|
385
|
+
<el-table-column label="风险/标记" width="170">
|
|
386
|
+
<template #default="{ row }">
|
|
387
|
+
<el-tag size="small" effect="plain" :type="row.risk === 'high' ? 'danger' : row.risk === 'medium' ? 'warning' : 'success'">{{ row.risk }}</el-tag>
|
|
388
|
+
<el-tag v-if="row.confirm_required" size="small" type="danger" effect="plain" style="margin-left: 2px">需确认</el-tag>
|
|
389
|
+
<el-tag v-if="row.confirm_when?.length" size="small" type="danger" effect="plain" style="margin-left: 2px">条件确认</el-tag>
|
|
390
|
+
<el-tag v-if="row.requires_subject" size="small" type="warning" effect="plain" style="margin-left: 2px">需主体</el-tag>
|
|
391
|
+
<el-tag v-if="row.sensitive" size="small" type="info" effect="plain" style="margin-left: 2px">敏感</el-tag>
|
|
392
|
+
<el-tag v-if="row.readonly && row.method !== 'GET'" size="small" type="success" effect="plain" style="margin-left: 2px">只读</el-tag>
|
|
393
|
+
</template>
|
|
394
|
+
</el-table-column>
|
|
395
|
+
<el-table-column prop="description" label="说明" min-width="160" show-overflow-tooltip />
|
|
396
|
+
</el-table>
|
|
397
|
+
<div class="muted" style="margin-top: 8px">注:risk=high、「需确认」或命中「条件确认」的工具调用会先冻结为审批意图;业务侧或控制台兜底批准后,任务按原调用快照自动重跑执行。</div>
|
|
398
|
+
</template>
|
|
399
|
+
<template v-if="previewSkipped.length">
|
|
400
|
+
<div class="muted" style="margin: 14px 0 6px">以下接口被跳过(不会暴露给 AI):</div>
|
|
401
|
+
<div v-for="s in previewSkipped" :key="s.path" class="skipped mono">{{ s.path }} — {{ s.reason }}</div>
|
|
402
|
+
</template>
|
|
403
|
+
</el-drawer>
|
|
404
|
+
</template>
|
|
405
|
+
|
|
406
|
+
<script setup lang="ts">
|
|
407
|
+
import { computed, onMounted, reactive, ref, watch } from 'vue';
|
|
408
|
+
import { ElMessage } from 'element-plus/es/components/message/index';
|
|
409
|
+
import { ElMessageBox } from 'element-plus/es/components/message-box/index';
|
|
410
|
+
import { api } from '../request';
|
|
411
|
+
import { openDoc } from '../docs';
|
|
412
|
+
import { fmtTime } from '../util';
|
|
413
|
+
import { useMe } from '../store';
|
|
414
|
+
import HelpTip from '../components/HelpTip.vue';
|
|
415
|
+
import { schemaDescription, schemaRequired, schemaTitle, useConfigSchema } from '../schema';
|
|
416
|
+
|
|
417
|
+
const s = useMe();
|
|
418
|
+
const toolSchema = useConfigSchema('tool-provider');
|
|
419
|
+
const list = ref<any[]>([]);
|
|
420
|
+
const open = ref(false);
|
|
421
|
+
const editing = ref(false);
|
|
422
|
+
const saving = ref(false);
|
|
423
|
+
const toolFormTab = ref<'basic' | 'spec' | 'governance' | 'retrieval' | 'publish'>('basic');
|
|
424
|
+
const refreshing = ref('');
|
|
425
|
+
const reindexing = ref('');
|
|
426
|
+
const probing = ref('');
|
|
427
|
+
const embCreds = ref<any[]>([]); // 可做向量化的凭证(kind embedding/both),供工具检索选坐标系
|
|
428
|
+
type SpecAccessPolicy = 'signed_required' | 'public_allowed' | 'legacy_unverified';
|
|
429
|
+
type SpecAccessChoice = Exclude<SpecAccessPolicy, 'legacy_unverified'> | '';
|
|
430
|
+
type ToolProviderEditBaseline = {
|
|
431
|
+
spec_source: string;
|
|
432
|
+
spec_url: string;
|
|
433
|
+
spec_access_policy: SpecAccessPolicy;
|
|
434
|
+
spec_access_probe?: any;
|
|
435
|
+
auto_refresh_min: number;
|
|
436
|
+
enabled: boolean;
|
|
437
|
+
};
|
|
438
|
+
const form = reactive({ name: '', base_url: '', secret: '', spec_source: 'inline', spec_url: '', spec_json: '', spec_access_policy: 'signed_required' as SpecAccessChoice, log_payload: true, timeout_ms: 10000, rate_limit_per_min: 120, auto_refresh_min: 0, description: '', enabled: true, embed_credential: '', embed_model: '', embed_dim: 1024 });
|
|
439
|
+
const editBaseline = ref<ToolProviderEditBaseline | null>(null);
|
|
440
|
+
const historicalAccessPending = computed(() => editing.value
|
|
441
|
+
&& editBaseline.value?.spec_source === 'url'
|
|
442
|
+
&& editBaseline.value.spec_access_policy === 'legacy_unverified'
|
|
443
|
+
&& form.spec_source === 'url'
|
|
444
|
+
&& form.spec_access_policy === '');
|
|
445
|
+
const historicalProtectedEvidence = computed(() => editing.value
|
|
446
|
+
&& editBaseline.value?.spec_source === 'url'
|
|
447
|
+
&& editBaseline.value.spec_access_policy === 'legacy_unverified'
|
|
448
|
+
&& form.spec_source === 'url'
|
|
449
|
+
&& form.spec_url.trim() === editBaseline.value.spec_url.trim()
|
|
450
|
+
&& form.secret.trim() === ''
|
|
451
|
+
&& hasProtectedSpecAccessEvidence(editBaseline.value.spec_access_probe));
|
|
452
|
+
const historicalAccessDescription = computed(() => historicalProtectedEvidence.value
|
|
453
|
+
? `最近实测已保护:正签 ${editBaseline.value?.spec_access_probe?.signed_http} / 未签 ${editBaseline.value?.spec_access_probe?.unsigned_http} / 错签 ${editBaseline.value?.spec_access_probe?.invalid_http}。建议采用“签名保护”,仍需由管理员明确确认。`
|
|
454
|
+
: '这只是升级前配置缺少管理员意图,不代表清单已公开。当前继续按历史兼容方式运行;可先停用或维护说明、治理、检索等非清单字段。');
|
|
455
|
+
|
|
456
|
+
const previewOpen = ref(false);
|
|
457
|
+
const previewName = ref('');
|
|
458
|
+
const previewTools = ref<any[]>([]);
|
|
459
|
+
const previewSkipped = ref<any[]>([]);
|
|
460
|
+
const previewWarnings = ref<any[]>([]);
|
|
461
|
+
const previewNote = ref('');
|
|
462
|
+
const previewEmbed = ref(false); // 被预览的工具源是否开了检索(决定显不显示「召回预演」)
|
|
463
|
+
const previewFilter = ref(''); // 文本筛选词(即时过滤工具表)
|
|
464
|
+
const retrieveQ = ref(''); // 语义召回预演的输入
|
|
465
|
+
const lastRetrieveQ = ref(''); // 上次预演词(结果标题展示)
|
|
466
|
+
const retrieveHits = ref<Array<{ name: string; scope: string; score: number }>>([]);
|
|
467
|
+
const retrieveMinScore = ref(0.3); // 阈值参考线(后端返回的系统默认)
|
|
468
|
+
const retrieving = ref(false);
|
|
469
|
+
const debugTool = ref('');
|
|
470
|
+
const debugSubject = ref('');
|
|
471
|
+
const debugArgs = ref('{}');
|
|
472
|
+
const debugMode = ref<'form' | 'json'>('form');
|
|
473
|
+
const debugParamValues = reactive<Record<string, any>>({});
|
|
474
|
+
const debugSamples = ref<Array<{ id: string; at: string; subject: string; args: Record<string, unknown> }>>([]);
|
|
475
|
+
const debugSampleId = ref('');
|
|
476
|
+
const debugAllowRisky = ref(false);
|
|
477
|
+
const debugLoading = ref(false);
|
|
478
|
+
const debugResult = ref<any | null>(null);
|
|
479
|
+
|
|
480
|
+
function fieldTitle(field: string, fallback: string): string {
|
|
481
|
+
return schemaTitle(toolSchema.schema.value, field, fallback);
|
|
482
|
+
}
|
|
483
|
+
function fieldDesc(field: string, fallback = ''): string {
|
|
484
|
+
return schemaDescription(toolSchema.schema.value, field, fallback);
|
|
485
|
+
}
|
|
486
|
+
function fieldRequired(field: string): boolean {
|
|
487
|
+
return schemaRequired(toolSchema.required.value, field);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
function authzProbeLabel(p: any): string {
|
|
491
|
+
if (!p) return '未探测';
|
|
492
|
+
if (p.status === 'pass') return '已拒绝越权';
|
|
493
|
+
if (p.status === 'suspect') return '疑似未授权';
|
|
494
|
+
if (p.status === 'inconclusive') return '无法判定';
|
|
495
|
+
return '已跳过';
|
|
496
|
+
}
|
|
497
|
+
function authzProbeType(p: any): 'success' | 'danger' | 'warning' | 'info' {
|
|
498
|
+
if (!p) return 'info';
|
|
499
|
+
if (p.status === 'pass') return 'success';
|
|
500
|
+
if (p.status === 'suspect') return 'danger';
|
|
501
|
+
if (p.status === 'inconclusive') return 'warning';
|
|
502
|
+
return 'info';
|
|
503
|
+
}
|
|
504
|
+
function authzProbeTitle(p: any): string {
|
|
505
|
+
if (!p) return '尚未执行授权探针';
|
|
506
|
+
const parts = [authzProbeLabel(p)];
|
|
507
|
+
if (p.http) parts.push(`HTTP ${p.http}`);
|
|
508
|
+
if (p.tool) parts.push(`工具 ${p.tool}`);
|
|
509
|
+
if (p.reason) parts.push(p.reason);
|
|
510
|
+
return parts.join(' · ');
|
|
511
|
+
}
|
|
512
|
+
function authzProbeMode(p: any): string {
|
|
513
|
+
if (!p) return '尚未执行';
|
|
514
|
+
if (p.mode === 'dedicated') return '专用探针端点';
|
|
515
|
+
if (p.mode === 'fallback') return '回退到无参 GET 工具';
|
|
516
|
+
return p.mode || '未知';
|
|
517
|
+
}
|
|
518
|
+
function authzProbeAdvice(p: any): string[] {
|
|
519
|
+
if (!p) return [
|
|
520
|
+
'保存、刷新工具源或点击“探针”后会执行检测。',
|
|
521
|
+
'推荐在 spec 根声明 x-bailing-authz-probe,并挂独立探针端点。',
|
|
522
|
+
];
|
|
523
|
+
if (p.status === 'pass') return [
|
|
524
|
+
'当前探针结果符合预期:合成越权主体没有被放行。',
|
|
525
|
+
p.mode === 'dedicated' ? '保持探针端点走真实权限表,不要写死授权通过。' : '建议后续补专用探针端点,减少回退探测的误判和 skipped。',
|
|
526
|
+
];
|
|
527
|
+
if (p.status === 'suspect') return [
|
|
528
|
+
'这是高风险信号:业务侧可能只做了验签,没有按 X-Bailing-On-Behalf-Of 做授权。',
|
|
529
|
+
'检查工具接口或探针端点的 authorize 回调,禁止 return true 兜底。',
|
|
530
|
+
'让不存在的主体 __bailing_authz_probe__:nobody 返回 401/403 或 {"authorized":false}。',
|
|
531
|
+
];
|
|
532
|
+
if (p.status === 'inconclusive') return [
|
|
533
|
+
'中枢已发出探针,但响应不足以判断授权是否 fail-closed。',
|
|
534
|
+
'专用探针端点应返回 JSON:{"authorized":false} 或明确的 401/403。',
|
|
535
|
+
'检查 path、base_url、网关 rewrite 与签名验签是否使用原始 path/query。',
|
|
536
|
+
];
|
|
537
|
+
return [
|
|
538
|
+
'当前没有可安全探测的端点。',
|
|
539
|
+
'在 spec 根声明 x-bailing-authz-probe,例如 {"method":"POST","path":"/bailing/authz-probe"}。',
|
|
540
|
+
'业务端使用 PHP、Node、Python、Java、Go、.NET SDK 的 authz probe helper 接入,或按同一 HTTP 验签与授权返回契约实现。',
|
|
541
|
+
];
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
function specSourceLabel(row: any): string {
|
|
545
|
+
return row.spec_source === 'url' ? 'URL 托管' : '内联 JSON';
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function specAccessPolicyValue(value: unknown): SpecAccessPolicy {
|
|
549
|
+
if (value === 'signed_required' || value === 'public_allowed' || value === 'legacy_unverified') return value;
|
|
550
|
+
return 'legacy_unverified';
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function specAccessPolicyLabel(value: unknown): string {
|
|
554
|
+
const policy = specAccessPolicyValue(value);
|
|
555
|
+
if (policy === 'signed_required') return '期望:签名保护';
|
|
556
|
+
if (policy === 'public_allowed') return '期望:允许公开';
|
|
557
|
+
return '期望:待确认(历史配置)';
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function specAccessPolicyType(value: unknown): 'success' | 'danger' | 'warning' | 'info' {
|
|
561
|
+
const policy = specAccessPolicyValue(value);
|
|
562
|
+
if (policy === 'signed_required') return 'info';
|
|
563
|
+
if (policy === 'public_allowed') return 'warning';
|
|
564
|
+
return 'warning';
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function hasProtectedSpecAccessEvidence(probe: any): boolean {
|
|
568
|
+
const rejected = (status: unknown): boolean => {
|
|
569
|
+
const code = Number(status);
|
|
570
|
+
return code === 401 || code === 403 || code === 404;
|
|
571
|
+
};
|
|
572
|
+
return probe?.status === 'protected'
|
|
573
|
+
&& Number(probe.signed_http) >= 200
|
|
574
|
+
&& Number(probe.signed_http) < 300
|
|
575
|
+
&& rejected(probe.unsigned_http)
|
|
576
|
+
&& rejected(probe.invalid_http);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
function adoptProtectedSpecAccess(): void {
|
|
580
|
+
form.spec_access_policy = 'signed_required';
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
function specAccessProbeLabel(probe: any): string {
|
|
584
|
+
if (probe?.status === 'protected') return '实测:已保护';
|
|
585
|
+
if (probe?.status === 'public') return '实测:可公开读取';
|
|
586
|
+
if (probe?.status === 'inconclusive') return '实测:无法判定';
|
|
587
|
+
if (probe?.status === 'skipped') return '实测:兼容未验证';
|
|
588
|
+
return '实测:未执行';
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
function specAccessProbeType(row: any): 'success' | 'danger' | 'warning' | 'info' {
|
|
592
|
+
const status = row.spec_access_probe?.status;
|
|
593
|
+
const policy = specAccessPolicyValue(row.spec_access_policy);
|
|
594
|
+
if (status === 'protected') return policy === 'public_allowed' ? 'warning' : 'success';
|
|
595
|
+
if (status === 'public') return policy === 'signed_required' ? 'danger' : 'warning';
|
|
596
|
+
if (status === 'inconclusive') return 'warning';
|
|
597
|
+
return 'info';
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
function specAccessProbeTitle(probe: any): string {
|
|
601
|
+
const parts = [specAccessProbeLabel(probe)];
|
|
602
|
+
if (probe?.signed_http) parts.push(`签名 HTTP ${probe.signed_http}`);
|
|
603
|
+
if (probe?.unsigned_http) parts.push(`未签名 HTTP ${probe.unsigned_http}`);
|
|
604
|
+
if (probe?.invalid_http) parts.push(`错误签名 HTTP ${probe.invalid_http}`);
|
|
605
|
+
if (probe?.reason) parts.push(String(probe.reason));
|
|
606
|
+
return parts.join(' · ');
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function specAccessProbeSummary(probe: any): string {
|
|
610
|
+
if (!probe) return '尚未执行访问保护检测';
|
|
611
|
+
if (probe.status === 'skipped') {
|
|
612
|
+
const signed = probe.signed_http ? ` · 正签 ${probe.signed_http}` : '';
|
|
613
|
+
const at = probe.at ? ` · ${fmtTime(probe.at)}` : '';
|
|
614
|
+
return `兼容刷新未验证访问保护${signed}${at}`;
|
|
615
|
+
}
|
|
616
|
+
const codes = [
|
|
617
|
+
probe.signed_http ? `签名 ${probe.signed_http}` : '',
|
|
618
|
+
probe.unsigned_http ? `未签名 ${probe.unsigned_http}` : '',
|
|
619
|
+
probe.invalid_http ? `错误签名 ${probe.invalid_http}` : '',
|
|
620
|
+
].filter(Boolean).join(' / ');
|
|
621
|
+
const at = probe.at ? ` · ${fmtTime(probe.at)}` : '';
|
|
622
|
+
return `${codes || probe.reason || '已完成探测'}${at}`;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
function refreshPolicyLabel(row: any): string {
|
|
626
|
+
if (row.spec_source !== 'url') return '手动维护接口清单';
|
|
627
|
+
const min = Number(row.auto_refresh_min || 0);
|
|
628
|
+
return min > 0 ? `每 ${min} 分钟自动刷新` : '手动刷新';
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
function specRefreshedLabel(row: any): string {
|
|
632
|
+
return row.spec_refreshed_at ? `最近刷新 ${fmtTime(row.spec_refreshed_at)}` : '尚未刷新';
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
function auditLabel(row: any): string {
|
|
636
|
+
return row.log_payload ? '审计全量' : '只记键名';
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
function timeoutLabel(ms?: number): string {
|
|
640
|
+
return ms ? `超时 ${Math.round(ms / 1000)}s` : '默认超时';
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
function rateLimitLabel(n?: number): string {
|
|
644
|
+
return Number(n || 0) > 0 ? `${n}/min` : '不限流';
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
function authzProbeSummary(p: any): string {
|
|
648
|
+
if (!p) return '保存、刷新或点击探针后检测业务授权是否 fail-closed';
|
|
649
|
+
const at = p.at ? ` · ${fmtTime(p.at)}` : '';
|
|
650
|
+
return `${authzProbeMode(p)}${at}`;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
function openDocs(page: 'tools' | 'api' | 'approvals' = 'tools'): void {
|
|
654
|
+
const paths: Record<typeof page, string> = {
|
|
655
|
+
tools: '/docs/tools',
|
|
656
|
+
api: '/docs/api',
|
|
657
|
+
approvals: '/docs/approvals',
|
|
658
|
+
};
|
|
659
|
+
openDoc(paths[page]);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
// 文本筛选:按 名称/路径/scope/描述 子串匹配(不分大小写)
|
|
663
|
+
const filteredTools = computed(() => {
|
|
664
|
+
const q = previewFilter.value.trim().toLowerCase();
|
|
665
|
+
if (!q) return previewTools.value;
|
|
666
|
+
return previewTools.value.filter((t) => `${t.name} ${t.method} ${t.path} ${t.scope} ${t.description}`.toLowerCase().includes(q));
|
|
667
|
+
});
|
|
668
|
+
const selectedDebugTool = computed<any | null>(() => previewTools.value.find((t) => t.name === debugTool.value) || null);
|
|
669
|
+
const debugParamRows = computed(() => selectedDebugTool.value ? paramRows(selectedDebugTool.value) : []);
|
|
670
|
+
const debugSignatureRows = computed(() => {
|
|
671
|
+
const m = debugResult.value?.request?.signature_material;
|
|
672
|
+
if (!m) return [];
|
|
673
|
+
return [
|
|
674
|
+
{ k: 'timestamp', v: m.timestamp },
|
|
675
|
+
{ k: 'method', v: m.method },
|
|
676
|
+
{ k: 'path_with_query', v: m.path_with_query },
|
|
677
|
+
{ k: 'body_sha256', v: m.body_sha256 },
|
|
678
|
+
{ k: 'on_behalf_of', v: m.on_behalf_of || '空串' },
|
|
679
|
+
{ k: 'job_id', v: m.job_id || '空串' },
|
|
680
|
+
];
|
|
681
|
+
});
|
|
682
|
+
const debugDiagnosis = computed(() => {
|
|
683
|
+
const r = debugResult.value;
|
|
684
|
+
if (!r) return '';
|
|
685
|
+
if (r.blocked) return '调试台在发出 HTTP 前已阻断。本次不会触达业务系统。';
|
|
686
|
+
const s = Number(r.response?.status || 0);
|
|
687
|
+
if (!s) return '未收到 HTTP 状态。优先检查 Base URL、网络连通、DNS、TLS 证书和业务接口超时。';
|
|
688
|
+
if (s === 400 || s === 422) return '业务侧认为参数不合法。优先核对参数位置、必填字段、枚举值和 body JSON 结构。';
|
|
689
|
+
if (s === 401) return '业务侧认证失败。优先检查签名密钥、服务器时间、path/query 是否被网关重写,以及验签是否使用原始 URI。';
|
|
690
|
+
if (s === 403) return '业务侧授权拒绝。签名可能已通过,但 On-Behalf-Of 主体没有权限,这是正确的 fail-closed 方向。';
|
|
691
|
+
if (s === 404) return '业务侧未找到接口。优先检查 base_url 是否带了路径前缀、OpenAPI path 是否与实际路由一致。';
|
|
692
|
+
if (s >= 500) return '业务侧服务异常。中枢签名和转发已完成,继续看业务服务日志。';
|
|
693
|
+
return '';
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
// 语义召回预演:跑派发同款向量检索,返回工具+分数,让开发者看精度、调优工具措辞
|
|
697
|
+
async function runRetrieveTest(): Promise<void> {
|
|
698
|
+
const q = retrieveQ.value.trim();
|
|
699
|
+
if (!q) return;
|
|
700
|
+
retrieving.value = true;
|
|
701
|
+
try {
|
|
702
|
+
const r = await api<{ enabled: boolean; min_score_default: number; hits: Array<{ name: string; scope: string; score: number }> }>(
|
|
703
|
+
'/admin/api/tool-providers/' + encodeURIComponent(previewName.value) + '/retrieve-test', { method: 'POST', body: JSON.stringify({ query: q }) });
|
|
704
|
+
retrieveMinScore.value = r.min_score_default ?? 0.3;
|
|
705
|
+
retrieveHits.value = r.hits || [];
|
|
706
|
+
lastRetrieveQ.value = q;
|
|
707
|
+
if (!retrieveHits.value.length) ElMessage.info('没有召回(索引为空?先「重建索引」)');
|
|
708
|
+
} catch (e) { ElMessage.error((e as Error).message); }
|
|
709
|
+
finally { retrieving.value = false; }
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
async function runDebugInvoke(): Promise<void> {
|
|
713
|
+
if (!debugTool.value) { ElMessage.error('请选择工具'); return; }
|
|
714
|
+
let args: Record<string, unknown> = {};
|
|
715
|
+
try {
|
|
716
|
+
args = debugMode.value === 'form' ? buildDebugArgsFromForm() : parseDebugJson();
|
|
717
|
+
} catch (e) { ElMessage.error((e as Error).message); return; }
|
|
718
|
+
debugLoading.value = true;
|
|
719
|
+
try {
|
|
720
|
+
debugResult.value = await api('/admin/api/tool-providers/' + encodeURIComponent(previewName.value) + '/debug-invoke', {
|
|
721
|
+
method: 'POST',
|
|
722
|
+
body: JSON.stringify({
|
|
723
|
+
tool: debugTool.value,
|
|
724
|
+
args,
|
|
725
|
+
on_behalf_of: debugSubject.value.trim(),
|
|
726
|
+
allow_risky: debugAllowRisky.value,
|
|
727
|
+
}),
|
|
728
|
+
});
|
|
729
|
+
saveDebugSample(args);
|
|
730
|
+
if (debugResult.value.blocked) ElMessage.warning('调用已被调试台阻断');
|
|
731
|
+
else if (debugResult.value.ok) ElMessage.success('工具调用成功');
|
|
732
|
+
else ElMessage.warning('工具调用返回失败状态');
|
|
733
|
+
} catch (e) { ElMessage.error((e as Error).message); }
|
|
734
|
+
finally { debugLoading.value = false; }
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
function parseDebugJson(): Record<string, unknown> {
|
|
738
|
+
const raw = debugArgs.value.trim();
|
|
739
|
+
const args = raw ? JSON.parse(raw) : {};
|
|
740
|
+
if (!args || typeof args !== 'object' || Array.isArray(args)) throw new Error('参数必须是 JSON 对象');
|
|
741
|
+
return args as Record<string, unknown>;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
function buildDebugArgsFromForm(): Record<string, unknown> {
|
|
745
|
+
const out: Record<string, unknown> = {};
|
|
746
|
+
for (const p of debugParamRows.value) {
|
|
747
|
+
const raw = debugParamValues[p.name];
|
|
748
|
+
if (raw === undefined || raw === null || raw === '') continue;
|
|
749
|
+
if (p.type === 'integer') {
|
|
750
|
+
const n = Number(raw);
|
|
751
|
+
if (!Number.isInteger(n)) throw new Error(`${p.name} 必须是整数`);
|
|
752
|
+
out[p.name] = n;
|
|
753
|
+
} else if (p.type === 'number') {
|
|
754
|
+
const n = Number(raw);
|
|
755
|
+
if (!Number.isFinite(n)) throw new Error(`${p.name} 必须是数字`);
|
|
756
|
+
out[p.name] = n;
|
|
757
|
+
} else if (p.type === 'boolean') {
|
|
758
|
+
out[p.name] = raw === true || raw === 'true';
|
|
759
|
+
} else if (p.type === 'array' || p.type === 'object') {
|
|
760
|
+
try { out[p.name] = typeof raw === 'string' ? JSON.parse(raw) : raw; }
|
|
761
|
+
catch { throw new Error(`${p.name} 必须是合法 ${p.type === 'array' ? '数组' : '对象'} JSON`); }
|
|
762
|
+
} else {
|
|
763
|
+
out[p.name] = String(raw);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
debugArgs.value = JSON.stringify(out, null, 2);
|
|
767
|
+
return out;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
function syncDebugJsonFromForm(): void {
|
|
771
|
+
try {
|
|
772
|
+
const args = buildDebugArgsFromForm();
|
|
773
|
+
debugArgs.value = JSON.stringify(args, null, 2);
|
|
774
|
+
debugMode.value = 'json';
|
|
775
|
+
} catch (e) { ElMessage.error((e as Error).message); }
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
function debugStorageKey(): string {
|
|
779
|
+
return `bailing.tool-debug.${previewName.value}.${debugTool.value}`;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
function loadDebugSamples(): void {
|
|
783
|
+
debugSampleId.value = '';
|
|
784
|
+
try {
|
|
785
|
+
const raw = localStorage.getItem(debugStorageKey());
|
|
786
|
+
const arr = raw ? JSON.parse(raw) : [];
|
|
787
|
+
debugSamples.value = Array.isArray(arr) ? arr.slice(0, 5) : [];
|
|
788
|
+
} catch {
|
|
789
|
+
debugSamples.value = [];
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
function saveDebugSample(args: Record<string, unknown>): void {
|
|
794
|
+
const sample = { id: `${Date.now()}`, at: new Date().toISOString(), subject: debugSubject.value.trim(), args };
|
|
795
|
+
const same = (x: any) => x.subject === sample.subject && JSON.stringify(x.args) === JSON.stringify(args);
|
|
796
|
+
const next = [sample, ...debugSamples.value.filter((x) => !same(x))].slice(0, 5);
|
|
797
|
+
debugSamples.value = next;
|
|
798
|
+
localStorage.setItem(debugStorageKey(), JSON.stringify(next));
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
function applyDebugSampleById(id: string): void {
|
|
802
|
+
const sample = debugSamples.value.find((x) => x.id === id);
|
|
803
|
+
if (!sample) return;
|
|
804
|
+
debugSubject.value = sample.subject || '';
|
|
805
|
+
debugArgs.value = JSON.stringify(sample.args || {}, null, 2);
|
|
806
|
+
applyDebugArgsToForm(sample.args || {});
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
function applyDebugArgsToForm(args: Record<string, unknown>): void {
|
|
810
|
+
for (const k of Object.keys(debugParamValues)) delete debugParamValues[k];
|
|
811
|
+
for (const p of debugParamRows.value) {
|
|
812
|
+
const v = args[p.name];
|
|
813
|
+
if (v === undefined || v === null) debugParamValues[p.name] = '';
|
|
814
|
+
else if (typeof v === 'object') debugParamValues[p.name] = JSON.stringify(v);
|
|
815
|
+
else debugParamValues[p.name] = String(v);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
function resetDebugForTool(): void {
|
|
820
|
+
debugResult.value = null;
|
|
821
|
+
debugAllowRisky.value = false;
|
|
822
|
+
loadDebugSamples();
|
|
823
|
+
if (debugSamples.value[0]) {
|
|
824
|
+
debugSampleId.value = debugSamples.value[0].id;
|
|
825
|
+
applyDebugSampleById(debugSampleId.value);
|
|
826
|
+
} else {
|
|
827
|
+
debugArgs.value = '{}';
|
|
828
|
+
debugSubject.value = '';
|
|
829
|
+
applyDebugArgsToForm({});
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
function debugSampleLabel(sample: { at: string; subject: string; args: Record<string, unknown> }): string {
|
|
834
|
+
const keys = Object.keys(sample.args || {}).slice(0, 3).join(', ') || '无参数';
|
|
835
|
+
return `${sample.subject || '匿名'} · ${keys} · ${fmtTime(sample.at, true)}`;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
/** 展开行的参数表:从派生后的 JSON Schema + param_in 还原成人能核对的行 */
|
|
839
|
+
function paramRows(t: any): Array<{ name: string; loc: string; type: string; required: boolean; desc: string; enum?: unknown[] }> {
|
|
840
|
+
const props = (t.parameters?.properties ?? {}) as Record<string, any>;
|
|
841
|
+
const required = new Set<string>((t.parameters?.required ?? []) as string[]);
|
|
842
|
+
return Object.entries(props).map(([name, s]) => {
|
|
843
|
+
const bits: string[] = [];
|
|
844
|
+
if (s.description) bits.push(String(s.description));
|
|
845
|
+
if (Array.isArray(s.enum)) bits.push('枚举:' + s.enum.join(' / '));
|
|
846
|
+
if (s.default !== undefined) bits.push('默认:' + JSON.stringify(s.default));
|
|
847
|
+
if (s.format) bits.push('格式:' + s.format);
|
|
848
|
+
const type = String(s.type ?? 'string') + (s.type === 'array' && s.items?.type ? `<${s.items.type}>` : '');
|
|
849
|
+
return { name, loc: t.param_in?.[name] ?? 'query', type: String(s.type ?? 'string'), required: required.has(name), desc: bits.join(';'), enum: Array.isArray(s.enum) ? s.enum : undefined };
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// 取回完整签名密钥并复制(列表只给掩码;这把密钥要交给业务方验签,需随时可取)
|
|
854
|
+
async function copySecret(name: string): Promise<void> {
|
|
855
|
+
try {
|
|
856
|
+
const r = await api<{ secret: string }>(`/admin/api/tool-providers/${encodeURIComponent(name)}/secret`);
|
|
857
|
+
await navigator.clipboard.writeText(r.secret);
|
|
858
|
+
ElMessage.success('完整签名密钥已复制到剪贴板');
|
|
859
|
+
} catch (e) { ElMessage.error((e as Error).message || '取密钥失败'); }
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
async function load(): Promise<void> {
|
|
863
|
+
list.value = await api('/admin/api/tool-providers');
|
|
864
|
+
// 向量化凭证(工具检索选坐标系用);无权限/失败不阻塞页面
|
|
865
|
+
try { embCreds.value = (await api<any[]>('/admin/api/credentials')).filter((c) => c.kind === 'embedding' || c.kind === 'both'); } catch { /* 可选 */ }
|
|
866
|
+
}
|
|
867
|
+
async function reindex(name: string): Promise<void> {
|
|
868
|
+
reindexing.value = name;
|
|
869
|
+
try {
|
|
870
|
+
const r = await api<{ total: number; added: string[]; changed: string[]; removed: string[] }>('/admin/api/tool-providers/' + encodeURIComponent(name) + '/reindex', { method: 'POST' });
|
|
871
|
+
ElMessage.success(`索引已重建:共 ${r.total} 个工具(新增 ${r.added.length}、变更 ${r.changed.length}、移除 ${r.removed.length})`);
|
|
872
|
+
} catch (e) { ElMessage.error((e as Error).message); }
|
|
873
|
+
finally { reindexing.value = ''; }
|
|
874
|
+
}
|
|
875
|
+
async function probeAuthz(name: string): Promise<void> {
|
|
876
|
+
probing.value = name;
|
|
877
|
+
try {
|
|
878
|
+
const r = await api<{ authz_probe: any }>('/admin/api/tool-providers/' + encodeURIComponent(name) + '/authz-probe', { method: 'POST' });
|
|
879
|
+
if (authzProbeType(r.authz_probe) === 'danger') ElMessage.warning(`授权探针:${authzProbeLabel(r.authz_probe)}`);
|
|
880
|
+
else ElMessage.success(`授权探针:${authzProbeLabel(r.authz_probe)}`);
|
|
881
|
+
await load();
|
|
882
|
+
} catch (e) { ElMessage.error((e as Error).message); }
|
|
883
|
+
finally { probing.value = ''; }
|
|
884
|
+
}
|
|
885
|
+
function openCreate(): void {
|
|
886
|
+
editing.value = false;
|
|
887
|
+
editBaseline.value = null;
|
|
888
|
+
toolFormTab.value = 'basic';
|
|
889
|
+
Object.assign(form, { name: '', base_url: '', secret: '', spec_source: 'inline', spec_url: '', spec_json: '', spec_access_policy: 'signed_required', log_payload: true, timeout_ms: 10000, rate_limit_per_min: 120, auto_refresh_min: 0, description: '', enabled: true, embed_credential: '', embed_model: '', embed_dim: 1024 });
|
|
890
|
+
open.value = true;
|
|
891
|
+
}
|
|
892
|
+
function openEdit(row: any): void {
|
|
893
|
+
editing.value = true;
|
|
894
|
+
toolFormTab.value = 'basic';
|
|
895
|
+
const policy = specAccessPolicyValue(row.spec_access_policy);
|
|
896
|
+
editBaseline.value = {
|
|
897
|
+
spec_source: row.spec_source,
|
|
898
|
+
spec_url: row.spec_url || '',
|
|
899
|
+
spec_access_policy: policy,
|
|
900
|
+
spec_access_probe: row.spec_access_probe ? { ...row.spec_access_probe } : undefined,
|
|
901
|
+
auto_refresh_min: Number(row.auto_refresh_min ?? 0),
|
|
902
|
+
enabled: !!row.enabled,
|
|
903
|
+
};
|
|
904
|
+
const policyChoice: SpecAccessChoice = row.spec_source === 'url'
|
|
905
|
+
? policy === 'legacy_unverified' ? '' : policy
|
|
906
|
+
: 'signed_required';
|
|
907
|
+
Object.assign(form, { name: row.name, base_url: row.base_url, secret: '', spec_source: row.spec_source, spec_url: row.spec_url || '', spec_json: '', spec_access_policy: policyChoice, log_payload: !!row.log_payload, timeout_ms: row.timeout_ms, rate_limit_per_min: row.rate_limit_per_min, auto_refresh_min: row.auto_refresh_min ?? 0, description: row.description || '', enabled: !!row.enabled, embed_credential: row.embed_credential || '', embed_model: row.embed_model || '', embed_dim: row.embed_dim || 1024 });
|
|
908
|
+
open.value = true;
|
|
909
|
+
}
|
|
910
|
+
function onEmbedCred(): void {
|
|
911
|
+
// 选了向量凭证、模型还空 → 用该凭证的默认模型兜上(用户可改)
|
|
912
|
+
if (!form.embed_credential) return;
|
|
913
|
+
const c = embCreds.value.find((x) => x.name === form.embed_credential);
|
|
914
|
+
if (c && !form.embed_model) form.embed_model = c.default_model || '';
|
|
915
|
+
}
|
|
916
|
+
function genSecret(): void {
|
|
917
|
+
const a = new Uint8Array(16);
|
|
918
|
+
crypto.getRandomValues(a);
|
|
919
|
+
form.secret = Array.from(a, (b) => b.toString(16).padStart(2, '0')).join('');
|
|
920
|
+
}
|
|
921
|
+
function historicalAccessSensitiveChange(): boolean {
|
|
922
|
+
const baseline = editBaseline.value;
|
|
923
|
+
if (!historicalAccessPending.value || !baseline) return false;
|
|
924
|
+
return form.spec_url.trim() !== baseline.spec_url.trim()
|
|
925
|
+
|| form.secret.trim() !== ''
|
|
926
|
+
|| Number(form.auto_refresh_min) !== baseline.auto_refresh_min
|
|
927
|
+
|| (!baseline.enabled && form.enabled);
|
|
928
|
+
}
|
|
929
|
+
async function save(): Promise<void> {
|
|
930
|
+
if (historicalAccessSensitiveChange()) {
|
|
931
|
+
toolFormTab.value = 'spec';
|
|
932
|
+
ElMessage.warning('这项修改会改变接口清单拉取或重新启用历史工具源,请先确认签名保护或允许公开');
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
if (form.spec_source === 'url' && form.spec_access_policy === 'public_allowed') {
|
|
936
|
+
try {
|
|
937
|
+
const message = historicalProtectedEvidence.value
|
|
938
|
+
? '当前实测为正签可读、未签和错签均被拒绝。选择允许公开是在改变访问方式;需先让业务端允许匿名读取,否则刷新会失败。确认仍允许公开吗?'
|
|
939
|
+
: '任何能访问该 URL 的人都可以下载接口路径、参数、scope 与风险声明。工具调用仍需验签和授权。确认允许公开这份接口清单吗?';
|
|
940
|
+
await ElMessageBox.confirm(
|
|
941
|
+
message,
|
|
942
|
+
'确认公开接口清单',
|
|
943
|
+
{ confirmButtonText: '确认允许公开', cancelButtonText: '返回修改', type: 'warning' },
|
|
944
|
+
);
|
|
945
|
+
} catch {
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
saving.value = true;
|
|
950
|
+
try {
|
|
951
|
+
const payload: Record<string, unknown> = { ...form };
|
|
952
|
+
// 历史 URL 工具源未确认时省略该字段:后端会保留既有 sentinel,空串绝不代表允许公开。
|
|
953
|
+
if (form.spec_source === 'url' && form.spec_access_policy === '') delete payload.spec_access_policy;
|
|
954
|
+
await api('/admin/api/tool-providers', { method: 'POST', body: JSON.stringify(payload) });
|
|
955
|
+
ElMessage.success('已保存(密钥不再回显完整值)'); open.value = false; await load();
|
|
956
|
+
} catch (e) { ElMessage.error((e as Error).message); }
|
|
957
|
+
finally { saving.value = false; }
|
|
958
|
+
}
|
|
959
|
+
async function refresh(name: string): Promise<void> {
|
|
960
|
+
refreshing.value = name;
|
|
961
|
+
try {
|
|
962
|
+
const r = await api<{ tools: number }>('/admin/api/tool-providers/' + encodeURIComponent(name) + '/refresh', { method: 'POST' });
|
|
963
|
+
ElMessage.success(`已刷新,派生出 ${r.tools} 个工具`); await load();
|
|
964
|
+
} catch (e) { ElMessage.error((e as Error).message); }
|
|
965
|
+
finally { refreshing.value = ''; }
|
|
966
|
+
}
|
|
967
|
+
async function preview(row: any): Promise<void> {
|
|
968
|
+
previewName.value = row.name;
|
|
969
|
+
previewEmbed.value = !!row.embed_credential;
|
|
970
|
+
previewFilter.value = ''; retrieveQ.value = ''; lastRetrieveQ.value = ''; retrieveHits.value = [];
|
|
971
|
+
debugTool.value = ''; debugSubject.value = ''; debugArgs.value = '{}'; debugAllowRisky.value = false; debugResult.value = null; debugSamples.value = []; debugSampleId.value = '';
|
|
972
|
+
previewWarnings.value = []; previewSkipped.value = []; previewTools.value = [];
|
|
973
|
+
try {
|
|
974
|
+
const r = await api<any>('/admin/api/tool-providers/' + encodeURIComponent(row.name) + '/tools');
|
|
975
|
+
previewTools.value = r.tools || [];
|
|
976
|
+
previewSkipped.value = r.skipped || [];
|
|
977
|
+
previewWarnings.value = r.warnings || [];
|
|
978
|
+
previewNote.value = r.note || '';
|
|
979
|
+
previewOpen.value = true;
|
|
980
|
+
debugTool.value = previewTools.value[0]?.name || '';
|
|
981
|
+
resetDebugForTool();
|
|
982
|
+
} catch (e) { ElMessage.error((e as Error).message); }
|
|
983
|
+
}
|
|
984
|
+
async function del(name: string): Promise<void> {
|
|
985
|
+
try { await api('/admin/api/tool-providers/' + encodeURIComponent(name), { method: 'DELETE' }); await load(); }
|
|
986
|
+
catch (e) { ElMessage.error((e as Error).message); }
|
|
987
|
+
}
|
|
988
|
+
onMounted(async () => {
|
|
989
|
+
await Promise.all([toolSchema.load().catch(() => undefined), load()]);
|
|
990
|
+
});
|
|
991
|
+
watch(debugTool, () => resetDebugForTool());
|
|
992
|
+
</script>
|
|
993
|
+
|
|
994
|
+
<style scoped>
|
|
995
|
+
.head { display: flex; align-items: center; gap: 10px; }
|
|
996
|
+
.muted { color: var(--el-text-color-secondary); font-size: 12px; }
|
|
997
|
+
.mono { font-family: var(--bz-mono); font-size: 12px; }
|
|
998
|
+
.hint { margin-top: 4px; line-height: 1.5; }
|
|
999
|
+
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
|
|
1000
|
+
.tool-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; line-height: 1.35; }
|
|
1001
|
+
.tool-main b { font-size: 13px; color: var(--el-text-color-primary); }
|
|
1002
|
+
.tool-main code { font-family: var(--bz-mono); font-size: 12px; color: var(--el-text-color-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1003
|
+
.tool-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; line-height: 1.35; }
|
|
1004
|
+
.spec-access-policy { display: flex; flex-direction: column; gap: 10px; width: 100%; }
|
|
1005
|
+
.tagline { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
|
|
1006
|
+
.probe-line, .secret-line { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
|
|
1007
|
+
.probe-line .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1008
|
+
.secret-line code { font-family: var(--bz-mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; }
|
|
1009
|
+
.search-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
|
|
1010
|
+
.debug-call { border: 1px solid var(--el-border-color-lighter); border-radius: 0; padding: 10px 12px; margin-bottom: 12px; background: var(--el-fill-color-blank); }
|
|
1011
|
+
.debug-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
|
|
1012
|
+
.debug-mode { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
|
|
1013
|
+
.debug-param-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
|
|
1014
|
+
.debug-param { border: 1px solid var(--el-border-color-lighter); border-radius: 0; padding: 8px; min-width: 0; background: var(--el-fill-color-light); }
|
|
1015
|
+
.debug-param-label { display: flex; align-items: center; gap: 5px; margin-bottom: 6px; min-width: 0; }
|
|
1016
|
+
.debug-param-label code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1017
|
+
.debug-param-desc { margin-top: 4px; line-height: 1.45; }
|
|
1018
|
+
.debug-empty { grid-column: 1 / -1; padding: 8px 0; }
|
|
1019
|
+
.debug-json { margin-top: 8px; }
|
|
1020
|
+
.debug-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
|
|
1021
|
+
.debug-result { margin-top: 10px; }
|
|
1022
|
+
.debug-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
|
|
1023
|
+
.debug-diagnosis { border: 1px solid var(--el-color-warning-light-5); background: var(--el-color-warning-light-9); color: var(--el-color-warning-dark-2); border-radius: 0; padding: 8px 10px; font-size: 12px; line-height: 1.6; margin-bottom: 8px; }
|
|
1024
|
+
.signature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
|
|
1025
|
+
.signature-grid > div { border: 1px solid var(--el-border-color-lighter); border-radius: 0; padding: 6px 8px; min-width: 0; background: var(--el-fill-color-light); }
|
|
1026
|
+
.signature-grid span, .signature-grid code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1027
|
+
.signature-grid span { color: var(--el-text-color-secondary); font-size: 12px; margin-bottom: 2px; }
|
|
1028
|
+
.signature-grid code { font-family: var(--bz-mono); font-size: 12px; }
|
|
1029
|
+
.retrieve-result { background: var(--el-fill-color-light); border-radius: 0; padding: 10px 12px; margin-bottom: 12px; }
|
|
1030
|
+
.retrieve-result .rh-list { max-height: 280px; overflow: auto; }
|
|
1031
|
+
.retrieve-result .rh-row { display: flex; align-items: center; padding: 2px 0; line-height: 1.8; }
|
|
1032
|
+
.retrieve-result .rh-row.below { opacity: 0.6; }
|
|
1033
|
+
.skipped { padding: 4px 8px; border-radius: 0; background: var(--el-fill-color-light); margin-bottom: 4px; font-size: 12px; }
|
|
1034
|
+
.warning-row { display: flex; gap: 8px; align-items: flex-start; padding: 4px 8px; border-radius: 0; background: var(--el-color-warning-light-9); margin-bottom: 4px; font-size: 12px; }
|
|
1035
|
+
.warning-row code { flex: 0 0 auto; font-family: var(--bz-mono); color: var(--el-color-warning-dark-2); }.tool-detail { padding: 4px 12px 10px 48px; }
|
|
1036
|
+
.tool-detail .td-sec { font-weight: 600; font-size: 12px; margin: 10px 0 4px; color: var(--el-text-color-regular); }
|
|
1037
|
+
.tool-detail .td-text { font-size: 12px; line-height: 1.7; color: var(--el-text-color-primary); white-space: pre-wrap; word-break: break-word; }
|
|
1038
|
+
.probe-popover { font-size: 12px; line-height: 1.65; }
|
|
1039
|
+
.probe-title { font-weight: 600; margin-bottom: 6px; }
|
|
1040
|
+
.probe-meta { display: flex; flex-direction: column; gap: 2px; color: var(--el-text-color-secondary); margin-bottom: 8px; }
|
|
1041
|
+
.probe-meta code { font-family: var(--bz-mono); }
|
|
1042
|
+
.probe-advice-title { font-weight: 600; margin: 8px 0 4px; }
|
|
1043
|
+
.probe-advice { margin: 0; padding-left: 18px; }
|
|
1044
|
+
.probe-advice li { margin: 2px 0; }
|
|
1045
|
+
.block { font-family: var(--bz-mono); font-size: 12px; line-height: 1.6; background: var(--el-fill-color-light); padding: 10px 12px; border-radius: 0; overflow-x: auto; white-space: pre; margin: 0 0 6px; }
|
|
1046
|
+
.steps { margin: 0 0 10px; padding-left: 18px; }
|
|
1047
|
+
.steps li { line-height: 1.8; font-size: 13px; }
|
|
1048
|
+
@media (max-width: 760px) {
|
|
1049
|
+
.debug-param-grid, .signature-grid { grid-template-columns: 1fr; }
|
|
1050
|
+
}
|
|
1051
|
+
</style>
|