bailinghub 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -0
- package/docker-compose.images.yml +2 -2
- package/docs/AGENT_AUTH_API.en.md +25 -9
- package/docs/AGENT_AUTH_API.md +17 -5
- package/docs/AGENT_CLIENT_QUICKSTART.en.md +65 -14
- package/docs/AGENT_CLIENT_QUICKSTART.md +51 -12
- package/docs/CHANGELOG.en.md +12 -0
- package/docs/CHANGELOG.md +12 -0
- package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
- package/docs/INDEPENDENT_VALIDATION.md +4 -4
- package/docs/README.en.md +2 -0
- package/docs/README.md +2 -0
- package/docs/RELEASE_NOTES_v0.5.1.en.md +45 -0
- package/docs/RELEASE_NOTES_v0.5.1.md +45 -0
- package/package.json +1 -1
- package/scripts/check-doc-links.mjs +1 -0
- package/scripts/check-image-tags.sh +1 -1
- package/scripts/check-release-consistency.test.mjs +5 -5
- package/scripts/install.sh +1 -1
- package/scripts/publish-images.sh +1 -1
- package/scripts/release-audit.mjs +1 -0
- package/scripts/verify-github-repo.mjs +1 -0
- package/src/app/oss-edition.ts +1 -0
- package/src/core/config/agent-direct-console-selection.test.ts +22 -0
- package/src/infrastructure/config/config-agent-auth-repository.test.ts +36 -0
- package/src/infrastructure/config/config-agent-auth-repository.ts +97 -0
- package/src/infrastructure/config/config-agent-client-runtime-repository.test.ts +38 -0
- package/src/infrastructure/config/config-agent-client-runtime-repository.ts +54 -0
- package/src/routes/admin-agent-clients.test.ts +120 -0
- package/src/routes/admin-agent-clients.ts +161 -0
- package/src/routes/admin.ts +3 -0
- package/web/console/assets/{Accounts-D4RRm5D1.js → Accounts-r10QUjLQ.js} +1 -1
- package/web/console/assets/AgentClients-DsWADpzr.css +1 -0
- package/web/console/assets/AgentClients-UTTqbkjy.js +1 -0
- package/web/console/assets/{Approvals-CsTTKb8o.js → Approvals-BGKkYIya.js} +1 -1
- package/web/console/assets/{Audit-BzvZ7JZw.js → Audit-CQmjOAoO.js} +1 -1
- package/web/console/assets/{BrandLockup-CYcA93wh.js → BrandLockup-BF_0pCa3.js} +1 -1
- package/web/console/assets/{Channels-DRQZggqM.js → Channels-C4yZE67F.js} +1 -1
- package/web/console/assets/{ChatEntries-BUB7BWKU.js → ChatEntries-OqsqLjU6.js} +1 -1
- package/web/console/assets/Clients-CNIVs7Qn.css +1 -0
- package/web/console/assets/Clients-Dv3sv51C.js +3 -0
- package/web/console/assets/{Cost-BZgFf1yM.js → Cost-C_-kiH59.js} +1 -1
- package/web/console/assets/{Credentials-BTe2Q07j.js → Credentials-CPTEAiV6.js} +1 -1
- package/web/console/assets/{Diagnostics-WL-buYli.js → Diagnostics-O-NKFOeI.js} +1 -1
- package/web/console/assets/{Executors-CGZ-7Xmp.js → Executors-GVIAiNgv.js} +1 -1
- package/web/console/assets/{HelpTip-CT07o3kB.js → HelpTip-i-KJhf5s.js} +1 -1
- package/web/console/assets/{Kb-VVw8oGsT.js → Kb-BsCWkJI1.js} +2 -2
- package/web/console/assets/{Login-rwvmBBPl.js → Login-VFjkHNMr.js} +1 -1
- package/web/console/assets/{Projects-CexaCEY1.js → Projects-Ds-sJwfy.js} +1 -1
- package/web/console/assets/Routes-CXGl9SMM.css +1 -0
- package/web/console/assets/Routes-Wwurw2UU.js +124 -0
- package/web/console/assets/{Runs-BzFNPTwD.js → Runs-DLPzXmSy.js} +1 -1
- package/web/console/assets/{Setup-Djh5yadQ.js → Setup-BLelw0_V.js} +1 -1
- package/web/console/assets/Shell-CvaeK4j_.js +1 -0
- package/web/console/assets/Shell-D9Uw-fsa.css +1 -0
- package/web/console/assets/{StorageBuckets-CQBR41W1.js → StorageBuckets-Dv6u47yO.js} +1 -1
- package/web/console/assets/{SystemSettings-DgnopekD.js → SystemSettings-B9K7zaDU.js} +1 -1
- package/web/console/assets/{SystemStatus-Bj8-kPt2.js → SystemStatus-H-oKDo-y.js} +1 -1
- package/web/console/assets/{Targets-BAfCt_nH.js → Targets-CCFhjPKf.js} +1 -1
- package/web/console/assets/{Tools-xjd0NZdE.js → Tools-D0H9xpFH.js} +1 -1
- package/web/console/assets/index-CuoTgf6q.js +2 -0
- package/web/console/assets/{index-DZEQL_yy.js → index-DyX9Bz3V.js} +1 -1
- package/web/console/assets/{request-DkNPOweH.js → request-F5lXa7Ro.js} +1 -1
- package/web/console/assets/{schema-CgPWAu1_.js → schema-DUWaWqPn.js} +1 -1
- package/web/console/assets/{util-SiQC2MJh.js → util-4bN2dv7B.js} +1 -1
- package/web/console/assets/{vendor-element-D7WRzHhy.js → vendor-element-CZoEjZr8.js} +1 -1
- package/web/console/assets/{vendor-mammoth-DvgsHdlx.js → vendor-mammoth-nXG51Cg7.js} +1 -1
- package/web/console/index.html +2 -2
- package/web-admin/src/agent-direct-selection.ts +21 -0
- package/web-admin/src/layout/Shell.vue +1 -1
- package/web-admin/src/pages/AgentClients.vue +254 -0
- package/web-admin/src/pages/Clients.vue +4 -2
- package/web-admin/src/pages/Routes.vue +54 -5
- package/web-admin/src/router.ts +2 -0
- package/web/console/assets/Clients-CQ_MonGL.css +0 -1
- package/web/console/assets/Clients-HhCyrxfz.js +0 -3
- package/web/console/assets/Routes-B9ZHbQAp.js +0 -124
- package/web/console/assets/Routes-BbkFpi6Y.css +0 -1
- package/web/console/assets/Shell-BVIjmoY8.css +0 -1
- package/web/console/assets/Shell-kn763smL.js +0 -1
- package/web/console/assets/index-DfJA7iJS.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Rs,c as pn}from"./vendor-element-
|
|
1
|
+
import{g as Rs,c as pn}from"./vendor-element-CZoEjZr8.js";var Ze={},Ii="1.13.8",Fa=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||Function("return this")()||{},nr=Array.prototype,Ni=Object.prototype,Ca=typeof Symbol<"u"?Symbol.prototype:null,Os=nr.push,dt=nr.slice,it=Ni.toString,Is=Ni.hasOwnProperty,$c=typeof ArrayBuffer<"u",Ns=typeof DataView<"u",Ls=Array.isArray,Sa=Object.keys,Ba=Object.create,ka=$c&&ArrayBuffer.isView,Ms=isNaN,qs=isFinite,Yc=!{toString:null}.propertyIsEnumerable("toString"),Wa=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Ps=Math.pow(2,53)-1;function ze(e,n){return n=n==null?e.length-1:+n,function(){for(var t=Math.max(arguments.length-n,0),i=Array(t),c=0;c<t;c++)i[c]=arguments[c+n];switch(n){case 0:return e.call(this,i);case 1:return e.call(this,arguments[0],i);case 2:return e.call(this,arguments[0],arguments[1],i)}var r=Array(n+1);for(c=0;c<n;c++)r[c]=arguments[c];return r[n]=i,e.apply(this,r)}}function bn(e){var n=typeof e;return n==="function"||n==="object"&&!!e}function Kc(e){return e===null}function Li(e){return e===void 0}function Mi(e){return e===!0||e===!1||it.call(e)==="[object Boolean]"}function Qc(e){return!!(e&&e.nodeType===1)}function Pe(e){var n="[object "+e+"]";return function(t){return it.call(t)===n}}const tr=Pe("String"),qi=Pe("Number"),Jc=Pe("Date"),eu=Pe("RegExp"),nu=Pe("Error"),Pi=Pe("Symbol"),zi=Pe("ArrayBuffer");var tu=Pe("Function"),zs=Fa.document&&Fa.document.childNodes;typeof/./!="function"&&typeof Int8Array!="object"&&typeof zs!="function"&&(tu=function(e){return typeof e=="function"||!1});const qe=tu,ru=Pe("Object");var iu=Ns&&(!/\[native code\]/.test(String(DataView))||ru(new DataView(new ArrayBuffer(8)))),ji=typeof Map<"u"&&ru(new Map),js=Pe("DataView");function Xs(e){return e!=null&&qe(e.getInt8)&&zi(e.buffer)}const at=iu?Xs:js,yn=Ls||Pe("Array");function Dn(e,n){return e!=null&&Is.call(e,n)}var Ri=Pe("Arguments");(function(){Ri(arguments)||(Ri=function(e){return Dn(e,"callee")})})();const rr=Ri;function au(e){return!Pi(e)&&qs(e)&&!isNaN(parseFloat(e))}function Xi(e){return qi(e)&&Ms(e)}function Vi(e){return function(){return e}}function ou(e){return function(n){var t=e(n);return typeof t=="number"&&t>=0&&t<=Ps}}function cu(e){return function(n){return n==null?void 0:n[e]}}const Yt=cu("byteLength"),Vs=ou(Yt);var Hs=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;function Gs(e){return ka?ka(e)&&!at(e):Vs(e)&&Hs.test(it.call(e))}const Hi=$c?Gs:Vi(!1),Me=cu("length");function Zs(e){for(var n={},t=e.length,i=0;i<t;++i)n[e[i]]=!0;return{contains:function(c){return n[c]===!0},push:function(c){return n[c]=!0,e.push(c)}}}function uu(e,n){n=Zs(n);var t=Wa.length,i=e.constructor,c=qe(i)&&i.prototype||Ni,r="constructor";for(Dn(e,r)&&!n.contains(r)&&n.push(r);t--;)r=Wa[t],r in e&&e[r]!==c[r]&&!n.contains(r)&&n.push(r)}function Oe(e){if(!bn(e))return[];if(Sa)return Sa(e);var n=[];for(var t in e)Dn(e,t)&&n.push(t);return Yc&&uu(e,n),n}function su(e){if(e==null)return!0;var n=Me(e);return typeof n=="number"&&(yn(e)||tr(e)||rr(e))?n===0:Me(Oe(e))===0}function Gi(e,n){var t=Oe(n),i=t.length;if(e==null)return!i;for(var c=Object(e),r=0;r<i;r++){var a=t[r];if(n[a]!==c[a]||!(a in c))return!1}return!0}function Ae(e){if(e instanceof Ae)return e;if(!(this instanceof Ae))return new Ae(e);this._wrapped=e}Ae.VERSION=Ii;Ae.prototype.value=function(){return this._wrapped};Ae.prototype.valueOf=Ae.prototype.toJSON=Ae.prototype.value;Ae.prototype.toString=function(){return String(this._wrapped)};function Ra(e){return new Uint8Array(e.buffer||e,e.byteOffset||0,Yt(e))}var Oa="[object DataView]";function du(e,n){for(var t=[{a:e,b:n}],i=[],c=[];t.length;){var r=t.pop();if(r===!0){i.pop(),c.pop();continue}if(e=r.a,n=r.b,e===n){if(e!==0||1/e===1/n)continue;return!1}if(e==null||n==null)return!1;if(e!==e){if(n!==n)continue;return!1}var a=typeof e;if(a!=="function"&&a!=="object"&&typeof n!="object")return!1;e instanceof Ae&&(e=e._wrapped),n instanceof Ae&&(n=n._wrapped);var o=it.call(e);if(o!==it.call(n))return!1;if(iu&&o=="[object Object]"&&at(e)){if(!at(n))return!1;o=Oa}switch(o){case"[object RegExp]":case"[object String]":if(""+e==""+n)continue;return!1;case"[object Number]":t.push({a:+e,b:+n});continue;case"[object Date]":case"[object Boolean]":if(+e==+n)continue;return!1;case"[object Symbol]":if(Ca.valueOf.call(e)===Ca.valueOf.call(n))continue;return!1;case"[object ArrayBuffer]":case Oa:t.push({a:Ra(e),b:Ra(n)});continue}var u=o==="[object Array]";if(!u&&Hi(e)){var h=Yt(e);if(h!==Yt(n))return!1;if(e.buffer===n.buffer&&e.byteOffset===n.byteOffset)continue;u=!0}if(!u){if(typeof e!="object"||typeof n!="object")return!1;var b=e.constructor,m=n.constructor;if(b!==m&&!(qe(b)&&b instanceof b&&qe(m)&&m instanceof m)&&"constructor"in e&&"constructor"in n)return!1}for(var g=i.length;g--;)if(i[g]===e){if(c[g]===n)break;return!1}if(!(g>=0))if(i.push(e),c.push(n),t.push(!0),u){if(g=e.length,g!==n.length)return!1;for(;g--;)t.push({a:e[g],b:n[g]})}else{var f=Oe(e),y;if(g=f.length,Oe(n).length!==g)return!1;for(;g--;){if(y=f[g],!Dn(n,y))return!1;t.push({a:e[y],b:n[y]})}}}return!0}function jn(e){if(!bn(e))return[];var n=[];for(var t in e)n.push(t);return Yc&&uu(e,n),n}function Zi(e){var n=Me(e);return function(t){if(t==null)return!1;var i=jn(t);if(Me(i))return!1;for(var c=0;c<n;c++)if(!qe(t[e[c]]))return!1;return e!==hu||!qe(t[$i])}}var $i="forEach",lu="has",Yi=["clear","delete"],fu=["get",lu,"set"],$s=Yi.concat($i,fu),hu=Yi.concat(fu),Ys=["add"].concat(Yi,$i,lu);const pu=ji?Zi($s):Pe("Map"),gu=ji?Zi(hu):Pe("WeakMap"),mu=ji?Zi(Ys):Pe("Set"),bu=Pe("WeakSet");function kn(e){for(var n=Oe(e),t=n.length,i=Array(t),c=0;c<t;c++)i[c]=e[n[c]];return i}function yu(e){for(var n=Oe(e),t=n.length,i=Array(t),c=0;c<t;c++)i[c]=[n[c],e[n[c]]];return i}function Ki(e){for(var n={},t=Oe(e),i=0,c=t.length;i<c;i++)n[e[t[i]]]=t[i];return n}function ot(e){var n=[];for(var t in e)qe(e[t])&&n.push(t);return n.sort()}function Qi(e,n){return function(t){var i=arguments.length;if(n&&(t=Object(t)),i<2||t==null)return t;for(var c=1;c<i;c++)for(var r=arguments[c],a=e(r),o=a.length,u=0;u<o;u++){var h=a[u];(!n||t[h]===void 0)&&(t[h]=r[h])}return t}}const Ji=Qi(jn),Pn=Qi(Oe),ea=Qi(jn,!0);function Ks(){return function(){}}function Du(e){if(!bn(e))return{};if(Ba)return Ba(e);var n=Ks();n.prototype=e;var t=new n;return n.prototype=null,t}function vu(e,n){var t=Du(e);return n&&Pn(t,n),t}function xu(e){return bn(e)?yn(e)?e.slice():Ji({},e):e}function _u(e,n){return n(e),e}function na(e){return yn(e)?e:[e]}Ae.toPath=na;function lt(e){return Ae.toPath(e)}function ta(e,n){for(var t=n.length,i=0;i<t;i++){if(e==null)return;e=e[n[i]]}return t?e:void 0}function ra(e,n,t){var i=ta(e,lt(n));return Li(i)?t:i}function Uu(e,n){n=lt(n);for(var t=n.length,i=0;i<t;i++){var c=n[i];if(!Dn(e,c))return!1;e=e[c]}return!!t}function ir(e){return e}function Bn(e){return e=Pn({},e),function(n){return Gi(n,e)}}function ar(e){return e=lt(e),function(n){return ta(n,e)}}function ft(e,n,t){if(n===void 0)return e;switch(t??3){case 1:return function(i){return e.call(n,i)};case 3:return function(i,c,r){return e.call(n,i,c,r)};case 4:return function(i,c,r,a){return e.call(n,i,c,r,a)}}return function(){return e.apply(n,arguments)}}function Tu(e,n,t){return e==null?ir:qe(e)?ft(e,n,t):bn(e)&&!yn(e)?Bn(e):ar(e)}function or(e,n){return Tu(e,n,1/0)}Ae.iteratee=or;function je(e,n,t){return Ae.iteratee!==or?Ae.iteratee(e,n):Tu(e,n,t)}function wu(e,n,t){n=je(n,t);for(var i=Oe(e),c=i.length,r={},a=0;a<c;a++){var o=i[a];r[o]=n(e[o],o,e)}return r}function ia(){}function Eu(e){return e==null?ia:function(n){return ra(e,n)}}function Au(e,n,t){var i=Array(Math.max(0,e));n=ft(n,t,1);for(var c=0;c<e;c++)i[c]=n(c);return i}function Kt(e,n){return n==null&&(n=e,e=0),e+Math.floor(Math.random()*(n-e+1))}const zn=Date.now||function(){return new Date().getTime()};function Fu(e){var n=function(r){return e[r]},t="(?:"+Oe(e).join("|")+")",i=RegExp(t),c=RegExp(t,"g");return function(r){return r=r==null?"":""+r,i.test(r)?r.replace(c,n):r}}const Cu={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Su=Fu(Cu),Qs=Ki(Cu),Bu=Fu(Qs),ku=Ae.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var Fr=/(.)^/,Js={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},ed=/\\|'|\r|\n|\u2028|\u2029/g;function nd(e){return"\\"+Js[e]}var td=/^\s*(\w|\$)+\s*$/;function Wu(e,n,t){!n&&t&&(n=t),n=ea({},n,Ae.templateSettings);var i=RegExp([(n.escape||Fr).source,(n.interpolate||Fr).source,(n.evaluate||Fr).source].join("|")+"|$","g"),c=0,r="__p+='";e.replace(i,function(h,b,m,g,f){return r+=e.slice(c,f).replace(ed,nd),c=f+h.length,b?r+=`'+
|
|
2
2
|
((__t=(`+b+`))==null?'':_.escape(__t))+
|
|
3
3
|
'`:m?r+=`'+
|
|
4
4
|
((__t=(`+m+`))==null?'':__t)+
|
package/web/console/index.html
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>百灵中枢 · 控制台</title>
|
|
7
7
|
<style>html,body{background:#0a0b0d;color-scheme:dark}</style>
|
|
8
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-CuoTgf6q.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="./assets/vendor-vue-B2uhHUfE.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="./assets/vendor-element-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="./assets/vendor-element-CZoEjZr8.js">
|
|
11
11
|
<link rel="stylesheet" crossorigin href="./assets/index-Fi9gkGxV.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const EXACT_OPERATION_ID_RE = /^[A-Za-z_][A-Za-z0-9_]{0,63}$/;
|
|
2
|
+
|
|
3
|
+
export function mergeExactOperationIds(...groups: ReadonlyArray<ReadonlyArray<string>>): string[] {
|
|
4
|
+
const merged: string[] = [];
|
|
5
|
+
const seen = new Set<string>();
|
|
6
|
+
for (const group of groups) {
|
|
7
|
+
for (const raw of group) {
|
|
8
|
+
const operationId = String(raw).trim();
|
|
9
|
+
if (!EXACT_OPERATION_ID_RE.test(operationId) || seen.has(operationId)) continue;
|
|
10
|
+
seen.add(operationId);
|
|
11
|
+
merged.push(operationId);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return merged;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function includesAllCurrentOperationIds(selected: ReadonlyArray<string>, current: ReadonlyArray<string>): boolean {
|
|
18
|
+
if (!current.length) return false;
|
|
19
|
+
const selectedSet = new Set(selected);
|
|
20
|
+
return current.every((operationId) => selectedSet.has(operationId));
|
|
21
|
+
}
|
|
@@ -102,7 +102,7 @@ const menuRef = ref<{ open: (index: string) => void } | null>(null);
|
|
|
102
102
|
const ICONS: Record<string, unknown> = {
|
|
103
103
|
kb: markRaw(Collection), runs: markRaw(Tickets), executors: markRaw(Monitor), cost: markRaw(Coin), routes: markRaw(Connection), targets: markRaw(Cpu),
|
|
104
104
|
tools: markRaw(SetUp), approvals: markRaw(Stamp), chat: markRaw(ChatDotRound), channels: markRaw(Promotion), projects: markRaw(Folder),
|
|
105
|
-
clients: markRaw(Key), credentials: markRaw(Lock), storage: markRaw(Box), settings: markRaw(Brush), system: markRaw(InfoFilled), diagnostics: markRaw(Warning), accounts: markRaw(User), audit: markRaw(Document),
|
|
105
|
+
clients: markRaw(Key), 'agent-clients': markRaw(Connection), credentials: markRaw(Lock), storage: markRaw(Box), settings: markRaw(Brush), system: markRaw(InfoFilled), diagnostics: markRaw(Warning), accounts: markRaw(User), audit: markRaw(Document),
|
|
106
106
|
};
|
|
107
107
|
const GROUP_ORDER = ['场景配置', '接入入口', '能力装配', '运行', '基础资源', '系统管理'] as const;
|
|
108
108
|
const DEFAULT_OPEN_GROUPS = new Set<string>(['场景配置', '接入入口', '能力装配', '运行']);
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="agent-clients-page">
|
|
3
|
+
<el-card shadow="never">
|
|
4
|
+
<template #header>
|
|
5
|
+
<div class="head">
|
|
6
|
+
<div>
|
|
7
|
+
<b>智能体客户端</b>
|
|
8
|
+
<HelpTip title="和执行器有什么区别">
|
|
9
|
+
<p><b>智能体客户端</b>在本地理解用户意图、选择能力并完成多步编排;中枢继续负责业务身份、授权、审批、执行与审计。</p>
|
|
10
|
+
<p><b>执行器</b>是中枢下发 Job、由本地运行时执行本地任务后回报结果。两者是独立概念。</p>
|
|
11
|
+
<p>本页聚合现有接入方、Agent Session 和 Agent Run,不创建第二套接入方配置。</p>
|
|
12
|
+
<p>每个接入方只配置一个不绑定账号、租户或门店的业务授权入口;账号切换与租户选择由业务授权页完成。</p>
|
|
13
|
+
</HelpTip>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="actions">
|
|
16
|
+
<el-select v-model="days" size="small" style="width: 108px" @change="loadOverview">
|
|
17
|
+
<el-option :value="7" label="近 7 天" />
|
|
18
|
+
<el-option :value="30" label="近 30 天" />
|
|
19
|
+
<el-option :value="90" label="近 90 天" />
|
|
20
|
+
</el-select>
|
|
21
|
+
<el-button size="small" :loading="loading" @click="refreshAll">刷新</el-button>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<div v-loading="loading" class="overview">
|
|
27
|
+
<div class="metric primary"><span>客户端应用</span><b>{{ int(summary.agent_auth_enabled) }}</b><em>共 {{ int(summary.applications) }} 个接入方</em></div>
|
|
28
|
+
<div class="metric"><span>有效授权设备</span><b>{{ int(summary.sessions?.active) }}</b><em>总会话 {{ int(summary.sessions?.total) }}</em></div>
|
|
29
|
+
<div class="metric"><span>Agent Run</span><b>{{ int(summary.runs) }}</b><em>{{ int(summary.conversations) }} 个本地会话</em></div>
|
|
30
|
+
<div class="metric"><span>工具调用</span><b>{{ int(summary.tool_calls) }}</b><em>审批 {{ int(approvalTotal) }} 次</em></div>
|
|
31
|
+
<div class="metric"><span>累计 Token</span><b>{{ int(summary.total_tokens) }}</b><em>由客户端公开 usage 汇总</em></div>
|
|
32
|
+
<div class="metric" :class="{ danger: Number(summary.failure_rate || 0) > 0.1 }"><span>失败率</span><b>{{ percent(summary.failure_rate) }}</b><em>{{ int(summary.failed) }} 个失败或取消</em></div>
|
|
33
|
+
</div>
|
|
34
|
+
</el-card>
|
|
35
|
+
|
|
36
|
+
<el-card shadow="never">
|
|
37
|
+
<template #header>
|
|
38
|
+
<div class="section-head">
|
|
39
|
+
<div><b>客户端应用</b><span>复用“接入方”配置;只有设置 Agent 授权页后才能发起浏览器登录。</span></div>
|
|
40
|
+
<el-button size="small" @click="router.push('/clients')">管理接入方</el-button>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
<el-empty v-if="!applications.length" description="还没有接入方" />
|
|
44
|
+
<el-table v-else :data="applications" size="small">
|
|
45
|
+
<el-table-column label="应用" :width="180">
|
|
46
|
+
<template #default="{ row }"><div class="stack"><b>{{ row.name || row.app_id }}</b><code>{{ row.app_id }}</code></div></template>
|
|
47
|
+
</el-table-column>
|
|
48
|
+
<el-table-column label="Agent 登录" :min-width="240" show-overflow-tooltip>
|
|
49
|
+
<template #default="{ row }">
|
|
50
|
+
<div class="stack">
|
|
51
|
+
<div><el-tag size="small" effect="plain" :type="row.enabled && row.agent_auth_enabled ? 'success' : 'info'">{{ row.enabled && row.agent_auth_enabled ? '可授权' : '未开放' }}</el-tag></div>
|
|
52
|
+
<span class="muted mono">{{ row.agent_authorize_url || '未配置授权页' }}</span>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
</el-table-column>
|
|
56
|
+
<el-table-column label="允许 Workspace" :width="180">
|
|
57
|
+
<template #default="{ row }"><div class="tags"><el-tag v-for="route in previewRoutes(row.allowed_routes)" :key="route" size="small" effect="plain" type="info">{{ route }}</el-tag></div></template>
|
|
58
|
+
</el-table-column>
|
|
59
|
+
<el-table-column label="近期开销" :width="150" align="right">
|
|
60
|
+
<template #default="{ row }"><div class="stack right"><span>{{ int(row.stats.runs) }} Run / {{ int(row.stats.tool_calls) }} 调用</span><span class="muted">{{ int(row.stats.total_tokens) }} Token</span></div></template>
|
|
61
|
+
</el-table-column>
|
|
62
|
+
<el-table-column :width="160" align="right">
|
|
63
|
+
<template #default="{ row }">
|
|
64
|
+
<el-button link type="primary" :disabled="!row.agent_auth_enabled || !eligibleWorkspaces(row).length" @click="openConnection(row)">生成连接配置</el-button>
|
|
65
|
+
<el-button link @click="router.push('/clients')">编辑</el-button>
|
|
66
|
+
</template>
|
|
67
|
+
</el-table-column>
|
|
68
|
+
</el-table>
|
|
69
|
+
</el-card>
|
|
70
|
+
|
|
71
|
+
<el-card shadow="never">
|
|
72
|
+
<template #header>
|
|
73
|
+
<div class="section-head">
|
|
74
|
+
<div><b>授权设备与 Agent Session</b><span>远程撤销后,后续 access/refresh token 都会失效;本地客户端需要重新登录。</span></div>
|
|
75
|
+
<div class="actions">
|
|
76
|
+
<el-select v-model="sessionFilter.client_app_id" clearable filterable size="small" placeholder="全部应用" style="width: 190px" @change="resetSessions">
|
|
77
|
+
<el-option v-for="app in applications" :key="app.app_id" :label="app.name || app.app_id" :value="app.app_id" />
|
|
78
|
+
</el-select>
|
|
79
|
+
<el-select v-model="sessionFilter.state" size="small" style="width: 112px" @change="resetSessions">
|
|
80
|
+
<el-option value="all" label="全部状态" />
|
|
81
|
+
<el-option value="active" label="有效" />
|
|
82
|
+
<el-option value="expired" label="已过期" />
|
|
83
|
+
<el-option value="revoked" label="已撤销" />
|
|
84
|
+
</el-select>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</template>
|
|
88
|
+
<el-empty v-if="!sessions.length" description="当前筛选下没有 Agent Session" />
|
|
89
|
+
<el-table v-else v-loading="sessionsLoading" :data="sessions" size="small">
|
|
90
|
+
<el-table-column label="设备" :width="170">
|
|
91
|
+
<template #default="{ row }"><div class="stack"><b>{{ row.device_label || '未命名设备' }}</b><code>{{ shortId(row.session_id) }}</code></div></template>
|
|
92
|
+
</el-table-column>
|
|
93
|
+
<el-table-column label="业务主体" :width="150">
|
|
94
|
+
<template #default="{ row }"><div class="stack"><span>{{ row.principal?.id || row.on_behalf_of }}</span><span class="muted">{{ row.principal?.tenant || '未声明租户' }}</span></div></template>
|
|
95
|
+
</el-table-column>
|
|
96
|
+
<el-table-column label="应用 / Workspace" :min-width="190">
|
|
97
|
+
<template #default="{ row }"><div class="stack"><code>{{ row.client_app_id }}</code><span class="muted">{{ (row.allowed_routes || []).join('、') || '无可用路由' }}</span></div></template>
|
|
98
|
+
</el-table-column>
|
|
99
|
+
<el-table-column label="活跃与有效期" :width="185">
|
|
100
|
+
<template #default="{ row }"><div class="stack"><span>活跃 {{ fmtTime(row.last_seen_at) }}</span><span class="muted">到期 {{ fmtTime(row.refresh_expires_at) }}</span></div></template>
|
|
101
|
+
</el-table-column>
|
|
102
|
+
<el-table-column label="状态" :width="80"><template #default="{ row }"><el-tag size="small" effect="plain" :type="stateType(row.state)">{{ stateText(row.state) }}</el-tag></template></el-table-column>
|
|
103
|
+
<el-table-column :width="90" align="right">
|
|
104
|
+
<template #default="{ row }"><el-button v-if="row.state !== 'revoked'" link type="danger" :loading="revoking === row.session_id" @click="revoke(row)">远程撤销</el-button><span v-else class="muted">已处理</span></template>
|
|
105
|
+
</el-table-column>
|
|
106
|
+
</el-table>
|
|
107
|
+
<div v-if="sessionTotal > sessionPageSize" class="pagination">
|
|
108
|
+
<el-pagination v-model:current-page="sessionPage" :page-size="sessionPageSize" :total="sessionTotal" layout="prev, pager, next, total" @current-change="loadSessions" />
|
|
109
|
+
</div>
|
|
110
|
+
</el-card>
|
|
111
|
+
|
|
112
|
+
<el-dialog v-model="connection.open" title="生成智能体客户端连接配置" width="620px">
|
|
113
|
+
<el-alert type="info" :closable="false" show-icon title="这里只生成公开连接元数据,不包含业务 URL、业务身份、Client Token、Agent Token 或模型密钥。" />
|
|
114
|
+
<p class="connection-note"><code>connectionName</code> 只是本机连接选择器。登录时会统一打开接入方配置的业务授权页,由该页面确认当前账号与租户。</p>
|
|
115
|
+
<el-form label-position="top" class="connection-form">
|
|
116
|
+
<el-form-item label="Hub 地址"><el-input :model-value="hubUrl" readonly class="mono" /></el-form-item>
|
|
117
|
+
<div class="form-grid">
|
|
118
|
+
<el-form-item label="Client App ID"><el-input :model-value="connection.app_id" readonly class="mono" /></el-form-item>
|
|
119
|
+
<el-form-item label="Connection Name"><el-input v-model="connection.name" maxlength="128" class="mono" /></el-form-item>
|
|
120
|
+
</div>
|
|
121
|
+
<el-form-item label="Workspace">
|
|
122
|
+
<el-select v-model="connection.workspace" style="width: 100%"><el-option v-for="workspace in connection.workspaces" :key="workspace.route" :label="workspace.name + '(' + workspace.route + ')'" :value="workspace.route" /></el-select>
|
|
123
|
+
</el-form-item>
|
|
124
|
+
</el-form>
|
|
125
|
+
<div class="code-block"><pre>{{ connectionJson }}</pre></div>
|
|
126
|
+
<div class="code-block"><pre>{{ connectionCommand }}</pre></div>
|
|
127
|
+
<template #footer><el-button @click="connection.open = false">关闭</el-button><el-button @click="copy(connectionJson)">复制 JSON</el-button><el-button type="primary" @click="copy(connectionCommand)">复制 DSH 命令</el-button></template>
|
|
128
|
+
</el-dialog>
|
|
129
|
+
</div>
|
|
130
|
+
</template>
|
|
131
|
+
|
|
132
|
+
<script setup lang="ts">
|
|
133
|
+
import { computed, onMounted, reactive, ref } from 'vue';
|
|
134
|
+
import { useRouter } from 'vue-router';
|
|
135
|
+
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
136
|
+
import HelpTip from '../components/HelpTip.vue';
|
|
137
|
+
import { kernelFetch, kernelOrigin } from '../runtime-path';
|
|
138
|
+
|
|
139
|
+
interface Workspace { route: string; name: string; description?: string }
|
|
140
|
+
interface Stats { runs: number; conversations: number; completed: number; failed: number; tool_calls: number; total_tokens: number; approvals: Record<string, number> }
|
|
141
|
+
interface Application { app_id: string; name: string; enabled: boolean; agent_auth_enabled: boolean; agent_authorize_url?: string | null; allowed_routes: string[]; last_used_at?: string | null; stats: Stats }
|
|
142
|
+
interface SessionRow { session_id: string; client_app_id: string; device_label: string; principal?: { id?: string; tenant?: string; roles?: string[] }; on_behalf_of: string; allowed_routes: string[]; last_seen_at?: string; refresh_expires_at: string; state: 'active' | 'expired' | 'revoked' }
|
|
143
|
+
|
|
144
|
+
const router = useRouter();
|
|
145
|
+
const days = ref(30);
|
|
146
|
+
const loading = ref(false);
|
|
147
|
+
const sessionsLoading = ref(false);
|
|
148
|
+
const revoking = ref('');
|
|
149
|
+
const applications = ref<Application[]>([]);
|
|
150
|
+
const workspaces = ref<Workspace[]>([]);
|
|
151
|
+
const sessions = ref<SessionRow[]>([]);
|
|
152
|
+
const sessionTotal = ref(0);
|
|
153
|
+
const sessionPage = ref(1);
|
|
154
|
+
const sessionPageSize = 50;
|
|
155
|
+
const summary = reactive<any>({ applications: 0, agent_auth_enabled: 0, sessions: {}, runs: 0, conversations: 0, failed: 0, tool_calls: 0, total_tokens: 0, failure_rate: 0, approvals: {} });
|
|
156
|
+
const sessionFilter = reactive({ client_app_id: '', state: 'all' });
|
|
157
|
+
const connection = reactive<{ open: boolean; app_id: string; name: string; workspace: string; workspaces: Workspace[] }>({ open: false, app_id: '', name: '', workspace: '', workspaces: [] });
|
|
158
|
+
const hubUrl = computed(() => kernelOrigin());
|
|
159
|
+
const approvalTotal = computed(() => Object.values(summary.approvals || {}).reduce((sum: number, value) => sum + Number(value || 0), 0));
|
|
160
|
+
const connectionJson = computed(() => JSON.stringify({ hubUrl: hubUrl.value, clientAppId: connection.app_id, workspace: connection.workspace, connectionName: connection.name.trim() || 'default' }, null, 2));
|
|
161
|
+
const connectionCommand = computed(() => `/bailinghub connections add ${quote(connection.name.trim() || 'default')} ${quote(hubUrl.value)} ${quote(connection.app_id)} ${quote(connection.workspace)}`);
|
|
162
|
+
|
|
163
|
+
function quote(value: string): string { return JSON.stringify(value); }
|
|
164
|
+
function int(value: unknown): string { return new Intl.NumberFormat('zh-CN').format(Number(value || 0)); }
|
|
165
|
+
function percent(value: unknown): string { return `${(Number(value || 0) * 100).toFixed(1)}%`; }
|
|
166
|
+
function shortId(value: string): string { return value ? `${value.slice(0, 8)}…${value.slice(-4)}` : '—'; }
|
|
167
|
+
function fmtTime(value?: string | null): string { return value ? new Date(value).toLocaleString('zh-CN', { hour12: false }) : '从未'; }
|
|
168
|
+
function stateText(value: SessionRow['state']): string { return value === 'active' ? '有效' : value === 'expired' ? '已过期' : '已撤销'; }
|
|
169
|
+
function stateType(value: SessionRow['state']): 'success' | 'warning' | 'info' { return value === 'active' ? 'success' : value === 'expired' ? 'warning' : 'info'; }
|
|
170
|
+
function previewRoutes(routes: string[]): string[] { return routes.includes('*') ? ['全部 Workspace'] : routes.slice(0, 4); }
|
|
171
|
+
function eligibleWorkspaces(app: Application): Workspace[] { return workspaces.value.filter((workspace) => app.allowed_routes.includes('*') || app.allowed_routes.includes(workspace.route)); }
|
|
172
|
+
|
|
173
|
+
async function loadOverview(): Promise<void> {
|
|
174
|
+
loading.value = true;
|
|
175
|
+
try {
|
|
176
|
+
const response = await kernelFetch(`/admin/api/agent-clients/overview?days=${days.value}`);
|
|
177
|
+
if (!response.ok) throw new Error((await response.json().catch(() => ({}))).error || '加载失败');
|
|
178
|
+
const data = await response.json();
|
|
179
|
+
applications.value = data.applications || [];
|
|
180
|
+
workspaces.value = data.workspaces || [];
|
|
181
|
+
Object.assign(summary, data.summary || {});
|
|
182
|
+
} catch (error) { ElMessage.error(error instanceof Error ? error.message : '加载智能体客户端失败'); }
|
|
183
|
+
finally { loading.value = false; }
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async function loadSessions(): Promise<void> {
|
|
187
|
+
sessionsLoading.value = true;
|
|
188
|
+
try {
|
|
189
|
+
const params = new URLSearchParams({
|
|
190
|
+
state: sessionFilter.state,
|
|
191
|
+
limit: String(sessionPageSize),
|
|
192
|
+
offset: String((sessionPage.value - 1) * sessionPageSize),
|
|
193
|
+
});
|
|
194
|
+
if (sessionFilter.client_app_id) params.set('client_app_id', sessionFilter.client_app_id);
|
|
195
|
+
const response = await kernelFetch(`/admin/api/agent-clients/sessions?${params}`);
|
|
196
|
+
if (!response.ok) throw new Error((await response.json().catch(() => ({}))).error || '加载失败');
|
|
197
|
+
const data = await response.json();
|
|
198
|
+
sessions.value = data.list || [];
|
|
199
|
+
sessionTotal.value = Number(data.total || 0);
|
|
200
|
+
} catch (error) { ElMessage.error(error instanceof Error ? error.message : '加载授权设备失败'); }
|
|
201
|
+
finally { sessionsLoading.value = false; }
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async function refreshAll(): Promise<void> { await Promise.all([loadOverview(), loadSessions()]); }
|
|
205
|
+
async function resetSessions(): Promise<void> { sessionPage.value = 1; await loadSessions(); }
|
|
206
|
+
function openConnection(app: Application): void {
|
|
207
|
+
const options = eligibleWorkspaces(app);
|
|
208
|
+
connection.app_id = app.app_id;
|
|
209
|
+
connection.name = app.app_id.replace(/[^a-zA-Z0-9._-]+/g, '-').replace(/^-+|-+$/g, '') || 'default';
|
|
210
|
+
connection.workspaces = options;
|
|
211
|
+
connection.workspace = options[0]?.route || '';
|
|
212
|
+
connection.open = true;
|
|
213
|
+
}
|
|
214
|
+
async function copy(value: string): Promise<void> { await navigator.clipboard.writeText(value); ElMessage.success('已复制'); }
|
|
215
|
+
async function revoke(row: SessionRow): Promise<void> {
|
|
216
|
+
await ElMessageBox.confirm(`撤销设备“${row.device_label || shortId(row.session_id)}”的 Agent Session?撤销后需要重新登录授权。`, '远程撤销', { type: 'warning', confirmButtonText: '确认撤销' });
|
|
217
|
+
revoking.value = row.session_id;
|
|
218
|
+
try {
|
|
219
|
+
const response = await kernelFetch(`/admin/api/agent-clients/sessions/${row.session_id}/revoke`, { method: 'POST' });
|
|
220
|
+
if (!response.ok) throw new Error((await response.json().catch(() => ({}))).error || '撤销失败');
|
|
221
|
+
ElMessage.success('Agent Session 已撤销');
|
|
222
|
+
await refreshAll();
|
|
223
|
+
} catch (error) { ElMessage.error(error instanceof Error ? error.message : '撤销失败'); }
|
|
224
|
+
finally { revoking.value = ''; }
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
onMounted(refreshAll);
|
|
228
|
+
</script>
|
|
229
|
+
|
|
230
|
+
<style scoped>
|
|
231
|
+
.agent-clients-page { display: grid; gap: 16px; }
|
|
232
|
+
.head, .section-head, .actions { display: flex; align-items: center; gap: 10px; }
|
|
233
|
+
.head, .section-head { justify-content: space-between; }
|
|
234
|
+
.section-head > div:first-child { display: flex; align-items: baseline; gap: 10px; }
|
|
235
|
+
.section-head span, .muted { color: var(--el-text-color-secondary); font-size: 12px; }
|
|
236
|
+
.overview { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
|
|
237
|
+
.metric { min-width: 0; padding: 16px; border: 1px solid var(--el-border-color-lighter); border-radius: 10px; background: var(--el-fill-color-blank); }
|
|
238
|
+
.metric span, .metric em { display: block; color: var(--el-text-color-secondary); font-style: normal; font-size: 12px; }
|
|
239
|
+
.metric b { display: block; margin: 8px 0 5px; font-size: 24px; line-height: 1; }
|
|
240
|
+
.metric.primary { border-color: color-mix(in srgb, var(--el-color-primary) 34%, transparent); background: color-mix(in srgb, var(--el-color-primary) 7%, transparent); }
|
|
241
|
+
.metric.danger b { color: var(--el-color-danger); }
|
|
242
|
+
.stack { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
|
|
243
|
+
.stack.right { align-items: flex-end; }
|
|
244
|
+
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
|
|
245
|
+
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
246
|
+
.connection-form { margin-top: 18px; }
|
|
247
|
+
.connection-note { margin: 12px 0 0; color: var(--el-text-color-secondary); font-size: 12px; line-height: 1.6; }
|
|
248
|
+
.pagination { display: flex; justify-content: flex-end; padding-top: 14px; }
|
|
249
|
+
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
|
|
250
|
+
.code-block { margin-top: 10px; padding: 12px; overflow: auto; border-radius: 8px; background: #111827; color: #e5e7eb; }
|
|
251
|
+
.code-block pre { margin: 0; white-space: pre-wrap; word-break: break-all; font-size: 12px; }
|
|
252
|
+
@media (max-width: 1280px) { .overview { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
|
|
253
|
+
@media (max-width: 760px) { .overview, .form-grid { grid-template-columns: 1fr; } .head, .section-head { align-items: flex-start; flex-direction: column; } }
|
|
254
|
+
</style>
|
|
@@ -99,11 +99,13 @@
|
|
|
99
99
|
<el-input v-model="form.name" placeholder="如 业务系统" />
|
|
100
100
|
</el-form-item>
|
|
101
101
|
<el-form-item>
|
|
102
|
-
<template #label>{{ fieldTitle('agent_authorize_url', 'Agent
|
|
102
|
+
<template #label>{{ fieldTitle('agent_authorize_url', 'Agent 授权入口') }} <HelpTip :title="fieldTitle('agent_authorize_url', 'Agent 授权入口')">
|
|
103
103
|
<p>{{ fieldDesc('agent_authorize_url', '本地 Agent 发起登录时打开的业务系统网页。') }}</p>
|
|
104
|
+
<p>同一接入方只配置一个<b>稳定、统一的业务授权入口</b>,不要绑定具体账号、租户或门店。该页面负责业务登录、切换账号和选择租户;业务后端再从当前服务端登录态派生可信 <code>principal</code> / <code>on_behalf_of</code>。</p>
|
|
105
|
+
<p>本地插件不会填写或选择业务 URL,也不能用 <code>connectionName</code> 指定业务身份。</p>
|
|
104
106
|
<p>留空表示不开放 Agent 登录。生产必须使用 HTTPS;本机联调可使用带端口的 <code>127.0.0.1</code> / <code>::1</code> HTTP URL。</p>
|
|
105
107
|
</HelpTip></template>
|
|
106
|
-
<el-input v-model="form.agent_authorize_url" placeholder="https://business.example.com/agent
|
|
108
|
+
<el-input v-model="form.agent_authorize_url" placeholder="https://business.example.com/agent/authorize" class="mono" />
|
|
107
109
|
</el-form-item>
|
|
108
110
|
<el-form-item>
|
|
109
111
|
<template #label>{{ fieldTitle('allowed_routes', '可调路由') }} <span v-if="fieldRequired('allowed_routes')" class="field-required">*</span> <HelpTip :title="fieldTitle('allowed_routes', '可调路由')">
|
|
@@ -620,6 +620,12 @@
|
|
|
620
620
|
<p>只有精确列入的写工具才会暴露给本地 Agent。候选项来自已选工具源的 <code>/tools</code> 编译结果,并且必须已被上方 scope 放行。</p>
|
|
621
621
|
<p>可手动填写尚未拉取到的 operationId,但不允许 <code>*</code> 或其他通配符。</p>
|
|
622
622
|
</HelpTip></template>
|
|
623
|
+
<div class="agent-direct-write-actions">
|
|
624
|
+
<span>当前目录已选 {{ agentDirectSelectedCatalogWriteCount }} / {{ agentDirectWriteOptions.length }}</span>
|
|
625
|
+
<el-button size="small" type="primary" plain :disabled="!agentDirectWriteOptions.length || agentDirectAllCurrentWritesSelected"
|
|
626
|
+
@click="selectAllCurrentAgentDirectWrites">全选当前写操作({{ agentDirectWriteOptions.length }})</el-button>
|
|
627
|
+
<el-button size="small" :disabled="!agentDirect.write_tools.length" @click="clearAgentDirectWrites">清空</el-button>
|
|
628
|
+
</div>
|
|
623
629
|
<el-select v-model="agentDirect.write_tools" multiple filterable allow-create default-first-option
|
|
624
630
|
style="width: 100%" placeholder="选择写操作,或手填精确 operationId" @change="onAgentDirectNamesChange('write_tools')">
|
|
625
631
|
<el-option v-for="tool in agentDirectWriteOptions" :key="tool.name" :value="tool.name" :label="tool.name">
|
|
@@ -632,7 +638,7 @@
|
|
|
632
638
|
</div>
|
|
633
639
|
</el-option>
|
|
634
640
|
</el-select>
|
|
635
|
-
<div class="field-hint"
|
|
641
|
+
<div class="field-hint">“全选当前”保存的是此刻工具目录的精确 operationId 快照,不会自动授权未来新增写操作;只读工具仍按工具源 scope 与业务主体权限自动暴露。</div>
|
|
636
642
|
</el-form-item>
|
|
637
643
|
<el-form-item>
|
|
638
644
|
<template #label>额外强制审批 <HelpTip title="额外强制审批">
|
|
@@ -853,6 +859,7 @@
|
|
|
853
859
|
<script setup lang="ts">
|
|
854
860
|
import { computed, onMounted, reactive, ref } from 'vue';
|
|
855
861
|
import { ElMessage } from 'element-plus/es/components/message/index';
|
|
862
|
+
import { ElMessageBox } from 'element-plus/es/components/message-box/index';
|
|
856
863
|
import { WarningFilled } from '@element-plus/icons-vue';
|
|
857
864
|
import { api } from '../request';
|
|
858
865
|
import { openDoc } from '../docs';
|
|
@@ -862,6 +869,7 @@ import { useMe } from '../store';
|
|
|
862
869
|
import { LLM_PROVIDERS, detectProvider } from '../llm-catalog';
|
|
863
870
|
import { schemaDescription, schemaRequired, schemaTitle, useConfigSchema } from '../schema';
|
|
864
871
|
import { kernelOrigin } from '../runtime-path';
|
|
872
|
+
import { EXACT_OPERATION_ID_RE, includesAllCurrentOperationIds, mergeExactOperationIds } from '../agent-direct-selection';
|
|
865
873
|
|
|
866
874
|
const s = useMe();
|
|
867
875
|
const routeSchema = useConfigSchema('route');
|
|
@@ -1102,6 +1110,14 @@ const agentDirectToolOptions = computed<AgentDirectToolOption[]>(() => {
|
|
|
1102
1110
|
});
|
|
1103
1111
|
const agentDirectWriteOptions = computed(() => agentDirectToolOptions.value.filter((tool) => !tool.readonly && tool.allowed));
|
|
1104
1112
|
const agentDirectReadonlyCount = computed(() => agentDirectToolOptions.value.filter((tool) => tool.readonly && tool.allowed).length);
|
|
1113
|
+
const agentDirectCurrentWriteNames = computed(() => agentDirectWriteOptions.value.map((tool) => tool.name));
|
|
1114
|
+
const agentDirectSelectedCatalogWriteCount = computed(() => {
|
|
1115
|
+
const selected = new Set(agentDirect.write_tools);
|
|
1116
|
+
return agentDirectCurrentWriteNames.value.filter((name) => selected.has(name)).length;
|
|
1117
|
+
});
|
|
1118
|
+
const agentDirectAllCurrentWritesSelected = computed(() => (
|
|
1119
|
+
includesAllCurrentOperationIds(agentDirect.write_tools, agentDirectCurrentWriteNames.value)
|
|
1120
|
+
));
|
|
1105
1121
|
const agentDirectApprovalOptions = computed<AgentDirectToolOption[]>(() => {
|
|
1106
1122
|
const catalog = new Map(agentDirectToolOptions.value.map((tool) => [tool.name, tool]));
|
|
1107
1123
|
return agentDirect.write_tools.map((name) => catalog.get(name) ?? {
|
|
@@ -1115,14 +1131,13 @@ const agentDirectApprovalOptions = computed<AgentDirectToolOption[]>(() => {
|
|
|
1115
1131
|
});
|
|
1116
1132
|
});
|
|
1117
1133
|
|
|
1118
|
-
const OPERATION_ID_RE = /^[A-Za-z_][A-Za-z0-9_]{0,63}$/;
|
|
1119
1134
|
type AgentDirectListField = 'write_tools' | 'force_approval_tools';
|
|
1120
1135
|
function onAgentDirectNamesChange(field: AgentDirectListField): void {
|
|
1121
1136
|
agentDirect.configured = true;
|
|
1122
1137
|
const values = agentDirect[field].map((value) => String(value).trim()).filter(Boolean);
|
|
1123
|
-
const invalid = values.filter((value) => !
|
|
1138
|
+
const invalid = values.filter((value) => !EXACT_OPERATION_ID_RE.test(value));
|
|
1124
1139
|
if (invalid.length) {
|
|
1125
|
-
agentDirect[field] = [...new Set(values.filter((value) =>
|
|
1140
|
+
agentDirect[field] = [...new Set(values.filter((value) => EXACT_OPERATION_ID_RE.test(value)))];
|
|
1126
1141
|
ElMessage.warning(invalid.includes('*') ? '本地 Agent 工具不允许 *,请选择或填写精确 operationId' : 'operationId 只允许字母、数字和下划线,且以字母或下划线开头');
|
|
1127
1142
|
} else {
|
|
1128
1143
|
agentDirect[field] = [...new Set(values)];
|
|
@@ -1143,6 +1158,29 @@ function onAgentDirectNamesChange(field: AgentDirectListField): void {
|
|
|
1143
1158
|
}
|
|
1144
1159
|
}
|
|
1145
1160
|
}
|
|
1161
|
+
async function selectAllCurrentAgentDirectWrites(): Promise<void> {
|
|
1162
|
+
const current = agentDirectCurrentWriteNames.value;
|
|
1163
|
+
if (!current.length || agentDirectAllCurrentWritesSelected.value) return;
|
|
1164
|
+
try {
|
|
1165
|
+
await ElMessageBox.confirm(
|
|
1166
|
+
`将把当前工具目录中的 ${current.length} 个写 operationId 精确加入本地 Agent 白名单。未来新增写操作不会自动获得授权,ACC 风险、主体与审批治理仍然生效。`,
|
|
1167
|
+
'全选当前写操作',
|
|
1168
|
+
{ type: 'warning', confirmButtonText: '确认全选', cancelButtonText: '取消' },
|
|
1169
|
+
);
|
|
1170
|
+
} catch {
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
agentDirect.configured = true;
|
|
1174
|
+
agentDirect.write_tools = mergeExactOperationIds(agentDirect.write_tools, current);
|
|
1175
|
+
ElMessage.success(`已选择当前 ${current.length} 个写操作,保存路由后生效`);
|
|
1176
|
+
}
|
|
1177
|
+
function clearAgentDirectWrites(): void {
|
|
1178
|
+
if (!agentDirect.write_tools.length) return;
|
|
1179
|
+
agentDirect.configured = true;
|
|
1180
|
+
agentDirect.write_tools = [];
|
|
1181
|
+
agentDirect.force_approval_tools = [];
|
|
1182
|
+
ElMessage.info('已清空写操作授权及其额外强制审批项,保存路由后生效');
|
|
1183
|
+
}
|
|
1146
1184
|
function agentToolRiskType(risk: string): 'success' | 'warning' | 'danger' | 'info' {
|
|
1147
1185
|
if (risk === 'high') return 'danger';
|
|
1148
1186
|
if (risk === 'medium') return 'warning';
|
|
@@ -1151,7 +1189,7 @@ function agentToolRiskType(risk: string): 'success' | 'warning' | 'danger' | 'in
|
|
|
1151
1189
|
}
|
|
1152
1190
|
function validateAgentDirectNames(field: AgentDirectListField, label: string): string[] {
|
|
1153
1191
|
const names = agentDirect[field].map((value) => String(value).trim()).filter(Boolean);
|
|
1154
|
-
if (names.some((name) => !
|
|
1192
|
+
if (names.some((name) => !EXACT_OPERATION_ID_RE.test(name))) throw new Error(`${label}只允许精确 operationId,不允许 * 或其他通配符`);
|
|
1155
1193
|
return [...new Set(names)];
|
|
1156
1194
|
}
|
|
1157
1195
|
|
|
@@ -1894,6 +1932,17 @@ onMounted(async () => {
|
|
|
1894
1932
|
font-size: 12px;
|
|
1895
1933
|
line-height: 1.6;
|
|
1896
1934
|
}
|
|
1935
|
+
.agent-direct-write-actions {
|
|
1936
|
+
display: flex;
|
|
1937
|
+
align-items: center;
|
|
1938
|
+
justify-content: flex-end;
|
|
1939
|
+
gap: 8px;
|
|
1940
|
+
width: 100%;
|
|
1941
|
+
margin-bottom: 8px;
|
|
1942
|
+
color: var(--el-text-color-secondary);
|
|
1943
|
+
font-size: 12px;
|
|
1944
|
+
}
|
|
1945
|
+
.agent-direct-write-actions span { margin-right: auto; }
|
|
1897
1946
|
.agent-tool-option {
|
|
1898
1947
|
display: flex;
|
|
1899
1948
|
align-items: center;
|
package/web-admin/src/router.ts
CHANGED
|
@@ -16,6 +16,7 @@ export const PAGES = [
|
|
|
16
16
|
{ path: 'routes', perm: 'routes:read', title: '触发路由', group: '场景配置' },
|
|
17
17
|
// ③ 接入入口 —— 场景怎么被触发(谁/从哪触发)
|
|
18
18
|
{ path: 'clients', perm: 'clients:read', title: '接入方', group: '接入入口' },
|
|
19
|
+
{ path: 'agent-clients', perm: 'clients:read', title: '智能体客户端', group: '接入入口' },
|
|
19
20
|
{ path: 'chat', perm: 'routes:read', title: '聊天入口', group: '接入入口' },
|
|
20
21
|
{ path: 'channels', perm: 'channels:read', title: '入站渠道', group: '接入入口' },
|
|
21
22
|
// ④ 能力 —— 场景可引用的积木
|
|
@@ -59,6 +60,7 @@ export const router = createRouter({
|
|
|
59
60
|
{ path: 'channels', component: () => import('./pages/Channels.vue'), meta: { perm: 'channels:read', title: '入站渠道' } },
|
|
60
61
|
{ path: 'projects', component: () => import('./pages/Projects.vue'), meta: { perm: 'projects:read', title: '项目目录' } },
|
|
61
62
|
{ path: 'clients', component: () => import('./pages/Clients.vue'), meta: { perm: 'clients:read', title: '接入方' } },
|
|
63
|
+
{ path: 'agent-clients', component: () => import('./pages/AgentClients.vue'), meta: { perm: 'clients:read', title: '智能体客户端' } },
|
|
62
64
|
{ path: 'credentials', component: () => import('./pages/Credentials.vue'), meta: { perm: 'credentials:read', title: '模型凭证' } },
|
|
63
65
|
{ path: 'storage', component: () => import('./pages/StorageBuckets.vue'), meta: { perm: 'storage:read', title: '媒体存储' } },
|
|
64
66
|
{ path: 'settings', component: () => import('./pages/SystemSettings.vue'), meta: { perm: 'admins:manage', title: '实例外观' } },
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.head[data-v-4d900ece]{display:flex;align-items:center;gap:10px}.muted[data-v-4d900ece]{color:var(--el-text-color-secondary);font-size:12px}.mono[data-v-4d900ece]{font-family:var(--bz-mono);font-size:12px}.client-main[data-v-4d900ece],.client-stack[data-v-4d900ece],.protection-stack[data-v-4d900ece]{display:grid;gap:4px;min-width:0}.client-main b[data-v-4d900ece]{min-width:0;overflow:hidden;color:var(--el-text-color-primary);font-size:13px;font-weight:650;text-overflow:ellipsis;white-space:nowrap}.client-main code[data-v-4d900ece]{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.client-token[data-v-4d900ece],.tagline[data-v-4d900ece],.protection-stack>div[data-v-4d900ece]{display:flex;align-items:center;flex-wrap:wrap;gap:5px;min-width:0}.inline-row[data-v-4d900ece]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.hint[data-v-4d900ece]{margin-top:4px;width:100%}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{E as O,aj as fe}from"./vendor-element-D7WRzHhy.js";import{a as V}from"./request-DkNPOweH.js";import{f as ce,c as J}from"./util-SiQC2MJh.js";import{u as be}from"./index-DfJA7iJS.js";import{H as g}from"./HelpTip-CT07o3kB.js";import{u as ke,s as ye,a as ge,b as ve}from"./schema-CgPWAu1_.js";import{d as we,z as he,c as k,S as a,J as l,R as C,r as z,ai as m,o as u,I as v,P as o,e as n,Q as s,u as X,O as T,a3 as N,q as Y}from"./vendor-vue-B2uhHUfE.js";import{_ as Ve}from"./_plugin-vue_export-helper-DlAUqK2U.js";const Te={class:"head"},Ce={class:"client-main"},ze={class:"client-token"},Se={class:"mono muted"},Ue={class:"client-stack"},Oe={class:"tagline"},Ne={class:"tagline"},Pe={key:1,class:"muted"},Ae={class:"tagline"},xe={key:1,class:"muted"},Be={class:"protection-stack"},Ee={class:"muted"},je={class:"muted"},De={key:0,class:"field-required"},$e={key:0,class:"field-required"},qe={key:0,class:"field-required"},He={class:"inline-row"},Ie=we({__name:"Clients",setup(Re){const j=be(),P=ke("client"),D=z([]),K=z([]),L=z([]),$=z({}),S=z(!1),U=z(!1),q=z(!1),r=Y({app_id:"",name:"",agent_authorize_url:"",allowed_routes:[],allowed_channels:[],rate_limit_per_min:60,description:"",enabled:!0}),_=Y({enabled:!1,window:"day",hard_cost_usd:void 0,hard_tokens:void 0});let A={};function p(i,e){return ye(P.schema.value,i,e)}function w(i,e=""){return ge(P.schema.value,i,e)}function H(i){return ve(P.required.value,i)}function Z(i){var e,d,f;return((e=i.budget)==null?void 0:e.enabled)!==!1&&(((d=i.budget)==null?void 0:d.hard_cost_usd)||((f=i.budget)==null?void 0:f.hard_tokens))}function I(i,e){const d=Array.isArray(i)?i.map(f=>String(f)).filter(Boolean):[];return d.length?d.includes("*")?[e]:d.length<=3?d:[...d.slice(0,3),`+${d.length-3}`]:[]}async function x(){D.value=await V("/admin/api/clients")}function ee(i,e){const d={},f={};if(!i||typeof i!="object"||Array.isArray(i))return[d,f];for(const[c,h]of Object.entries(i))e.includes(c)?d[c]=h:f[c]=h;return[d,f]}function le(){Object.assign(_,{enabled:!1,window:"day",hard_cost_usd:void 0,hard_tokens:void 0}),A={}}function te(i){const[e,d]=ee(i,["enabled","window","window_hours","hard_cost_usd","hard_tokens","soft_cost_usd","soft_tokens"]),f=Number(e.window_hours)===1?"hour":Number(e.window_hours)===720?"month":"day",c=["hour","day","month"].includes(String(e.window))?String(e.window):f;Object.assign(_,{enabled:!!i&&e.enabled!==!1,window:c,hard_cost_usd:e.hard_cost_usd==null?void 0:Number(e.hard_cost_usd),hard_tokens:e.hard_tokens==null?void 0:Number(e.hard_tokens)}),A=d}function ne(){if(!_.enabled)return;const i=Number(_.hard_cost_usd),e=Number(_.hard_tokens);if(!(!(i>0)&&!(e>0)&&!Object.keys(A).length))return{enabled:!0,window:_.window,...i>0?{hard_cost_usd:i}:{},...e>0?{hard_tokens:Math.round(e)}:{},...A}}function F(){U.value=!1,Object.assign(r,{app_id:"",name:"",agent_authorize_url:"",allowed_routes:[],allowed_channels:[],rate_limit_per_min:60,description:"",enabled:!0}),le(),S.value=!0}function ae(i){U.value=!0,Object.assign(r,{app_id:i.app_id,name:i.name,agent_authorize_url:i.agent_authorize_url||"",allowed_routes:[...i.allowed_routes||[]],allowed_channels:[...i.allowed_channels||[]],rate_limit_per_min:i.rate_limit_per_min??60,description:i.description||"",enabled:!!i.enabled}),te(i.budget),S.value=!0}async function oe(){if(!r.allowed_routes.length){O.error("至少选一个路由(或 *)");return}q.value=!0;try{const i=await V("/admin/api/clients",{method:"POST",body:JSON.stringify({...r,budget:ne()})});S.value=!1,await x(),U.value?O.success("已保存"):(await fe.alert(`接入方 ${i.app_id} 的 token(业务侧 Authorization 用):
|
|
2
|
-
|
|
3
|
-
${i.token}`,"接入方已创建",{confirmButtonText:"复制 token"}).catch(()=>{}),await J(i.token,"token 已复制"))}catch(i){O.error(i.message)}finally{q.value=!1}}async function ie(i){try{const e=await V("/admin/api/clients",{method:"POST",body:JSON.stringify({...i,rotate_token:!0})});await x(),await J(e.token,"新 token 已复制,请同步给业务侧")}catch(e){O.error(e.message)}}async function de(i){try{await V("/admin/api/clients/"+encodeURIComponent(i),{method:"DELETE"}),await x()}catch(e){O.error(e.message)}}async function se(i){try{const e=await V("/admin/api/clients/"+encodeURIComponent(i)+"/token");await J(e.token,"完整 token 已复制")}catch(e){O.error(e.message)}}return he(async()=>{var i;if(await Promise.all([P.load().catch(()=>{}),x()]),j.can("channels:read"))try{L.value=(await V("/admin/api/channels")).map(e=>e.name)}catch{}if(j.can("routes:read")){try{K.value=(await V("/admin/api/routes")).map(e=>e.route_key)}catch{}try{const e={};for(const d of await V("/admin/api/chat-entries"))d.ticket_client&&(e[i=d.ticket_client]||(e[i]=[])).push(d.entry_key);$.value=e}catch{}}}),(i,e)=>{const d=m("el-button"),f=m("el-empty"),c=m("el-table-column"),h=m("el-tag"),G=m("el-popconfirm"),ue=m("el-table"),re=m("el-card"),B=m("el-input"),y=m("el-form-item"),E=m("el-option"),Q=m("el-select"),R=m("el-input-number"),W=m("el-switch"),M=m("el-radio-button"),pe=m("el-radio-group"),me=m("el-form"),_e=m("el-drawer");return u(),k(C,null,[a(re,{shadow:"never"},{header:l(()=>[n("div",Te,[e[16]||(e[16]=n("b",null,"接入方",-1)),e[17]||(e[17]=o()),a(g,{title:"接入方是干什么的"},{default:l(()=>[...e[14]||(e[14]=[n("p",null,[o("业务系统「"),n("b",null,"带 token 主动调中枢 API"),o("」的一把可吊销钥匙,管三条主动调用链路:① "),n("code",null,"POST /run"),o(" 发任务;② "),n("code",null,"GET /jobs/:id"),o(" 查结果;③ "),n("code",null,"POST /send"),o(" 经渠道主动推消息给某用户(会作为「回复方」记进该用户在该渠道的会话历史,用户追问时大脑读得到)。控制:能不能调(token)、能调哪些路由(可调路由白名单)、能往哪些渠道推(可推渠道白名单)、调多频(限速)。")],-1),n("p",null,[n("b",null,"聊天入口(网页/小程序组件)不走接入方"),o("——那是公开面(Origin 白名单 + 限速),不带 token。接入方在聊天里只有一个间接角色:「票据签发方」,业务后端用它的 token 给登录用户签身份票据(见右侧「聊天入口票据」列)。")],-1),n("p",null,[n("b",null,"开始对接:"),o("可直接到「触发路由」页点该路由的「调用代码」按钮,生成可粘贴的 HTTP / Node.js / Python / PHP 高频示例;Java、Go、.NET 与任意语言接入见官网 SDK 文档。")],-1)])]),_:1}),a(d,{type:"primary",style:{"margin-left":"auto"},onClick:F},{default:l(()=>[...e[15]||(e[15]=[o("新建接入方",-1)])]),_:1})])]),default:l(()=>[D.value.length?(u(),v(ue,{key:1,data:D.value},{default:l(()=>[a(c,{label:"接入方","min-width":"250","show-overflow-tooltip":""},{default:l(({row:t})=>[n("div",Ce,[n("b",null,s(t.name||t.app_id),1),n("code",null,s(t.app_id),1),n("div",ze,[n("span",Se,s(t.token),1),X(j).can("clients:write")?(u(),v(d,{key:0,link:"",type:"primary",onClick:b=>se(t.app_id)},{default:l(()=>[...e[19]||(e[19]=[o("复制完整",-1)])]),_:1},8,["onClick"])):T("",!0)])])]),_:1}),a(c,{label:"授权边界","min-width":"280"},{default:l(({row:t})=>[n("div",Ue,[n("div",Oe,[e[20]||(e[20]=n("span",{class:"muted"},"可调",-1)),(u(!0),k(C,null,N(I(t.allowed_routes,"全部路由"),b=>(u(),v(h,{key:b,size:"small",effect:"plain",type:"info"},{default:l(()=>[o(s(b),1)]),_:2},1024))),128))]),n("div",Ne,[e[21]||(e[21]=n("span",{class:"muted"},"可推",-1)),(t.allowed_channels||[]).length?(u(!0),k(C,{key:0},N(I(t.allowed_channels,"全部渠道"),b=>(u(),v(h,{key:b,size:"small",effect:"plain",type:"warning"},{default:l(()=>[o(s(b),1)]),_:2},1024))),128)):(u(),k("span",Pe,"不允许主动推送"))])])]),_:1}),a(c,{label:"聊天票据","min-width":"190"},{default:l(({row:t})=>[n("div",Ae,[($.value[t.app_id]||[]).length?(u(!0),k(C,{key:0},N(I($.value[t.app_id],"全部入口"),b=>(u(),v(h,{key:b,size:"small",effect:"plain",type:"success"},{default:l(()=>[o(s(b),1)]),_:2},1024))),128)):(u(),k("span",xe,"未作为票据签发方"))])]),_:1}),a(c,{label:"保护",width:"180"},{default:l(({row:t})=>[n("div",Be,[n("div",null,[a(h,{size:"small",effect:"plain",type:t.enabled?"success":"info"},{default:l(()=>[o(s(t.enabled?"已启用":"已停用"),1)]),_:2},1032,["type"]),t.agent_authorize_url?(u(),v(h,{key:0,size:"small",effect:"plain",type:"primary"},{default:l(()=>[...e[22]||(e[22]=[o("Agent 登录",-1)])]),_:1})):T("",!0),Z(t)?(u(),v(h,{key:1,size:"small",effect:"plain",type:"danger"},{default:l(()=>[...e[23]||(e[23]=[o("预算闸",-1)])]),_:1})):T("",!0)]),n("span",Ee,"限速 "+s(t.rate_limit_per_min?t.rate_limit_per_min+"/分":"不限"),1)])]),_:1}),a(c,{width:"136"},{header:l(()=>[e[25]||(e[25]=o("最近调用 ",-1)),a(g,{title:"最近调用怎么算"},{default:l(()=>[...e[24]||(e[24]=[n("p",null,[o("最近一次该接入方"),n("b",null,"凭证被实际使用"),o(":① 业务后端带 token 调 "),n("code",null,"/run"),o(" / "),n("code",null,"/jobs/:id"),o(";② 它作为聊天入口票据签发方,由已登录业务用户携带后端签发的身份票据来验签。")],-1),n("p",null,[n("b",null,"聊天入口的匿名流量不算"),o("(公开面、不带 token)——所以小程序匿名聊天再多这里也不动,属正常;真正验过业务身份票据后才会显示活跃。")],-1)])]),_:1})]),default:l(({row:t})=>[n("span",je,s(X(ce)(t.last_used_at)),1)]),_:1}),a(c,{width:"146",align:"right"},{default:l(({row:t})=>[a(d,{link:"",type:"primary",onClick:b=>ae(t)},{default:l(()=>[...e[26]||(e[26]=[o("编辑",-1)])]),_:1},8,["onClick"]),a(G,{title:"换钥?旧 token 立即作废,业务侧需同步更新。",width:"240",onConfirm:b=>ie(t)},{reference:l(()=>[a(d,{link:"",type:"warning"},{default:l(()=>[...e[27]||(e[27]=[o("换钥",-1)])]),_:1})]),_:1},8,["onConfirm"]),a(G,{title:"删除该接入方?其 token 立即失效。",width:"220",onConfirm:b=>de(t.app_id)},{reference:l(()=>[a(d,{link:"",type:"danger"},{default:l(()=>[...e[28]||(e[28]=[o("删",-1)])]),_:1})]),_:1},8,["onConfirm"])]),_:1})]),_:1},8,["data"])):(u(),v(f,{key:0,description:"还没有接入方:业务系统接入前先在这里发一把钥匙"},{default:l(()=>[a(d,{type:"primary",onClick:F},{default:l(()=>[...e[18]||(e[18]=[o("发第一把",-1)])]),_:1})]),_:1}))]),_:1}),a(_e,{modelValue:S.value,"onUpdate:modelValue":e[13]||(e[13]=t=>S.value=t),title:U.value?"编辑接入方":"新建接入方",size:"440px"},{footer:l(()=>[a(d,{onClick:e[12]||(e[12]=t=>S.value=!1)},{default:l(()=>[...e[44]||(e[44]=[o("取消",-1)])]),_:1}),a(d,{type:"primary",loading:q.value,onClick:oe},{default:l(()=>[...e[45]||(e[45]=[o("保存",-1)])]),_:1},8,["loading"])]),default:l(()=>[a(me,{"label-position":"top"},{default:l(()=>[a(y,null,{label:l(()=>[o(s(p("app_id","AppID"))+" ",1),H("app_id")?(u(),k("span",De,"*")):T("",!0),e[29]||(e[29]=o()),a(g,{title:p("app_id","AppID")},{default:l(()=>[n("p",null,s(w("app_id","接入方的稳定标识。")),1)]),_:1},8,["title"])]),default:l(()=>[a(B,{modelValue:r.app_id,"onUpdate:modelValue":e[0]||(e[0]=t=>r.app_id=t),disabled:U.value,placeholder:"留空自动生成,如 business-api",class:"mono"},null,8,["modelValue","disabled"])]),_:1}),a(y,null,{label:l(()=>[o(s(p("name","名称"))+" ",1),H("name")?(u(),k("span",$e,"*")):T("",!0),e[30]||(e[30]=o()),a(g,{title:p("name","名称")},{default:l(()=>[n("p",null,s(w("name","后台展示的人类可读名称。")),1)]),_:1},8,["title"])]),default:l(()=>[a(B,{modelValue:r.name,"onUpdate:modelValue":e[1]||(e[1]=t=>r.name=t),placeholder:"如 业务系统"},null,8,["modelValue"])]),_:1}),a(y,null,{label:l(()=>[o(s(p("agent_authorize_url","Agent 授权页"))+" ",1),a(g,{title:p("agent_authorize_url","Agent 授权页")},{default:l(()=>[n("p",null,s(w("agent_authorize_url","本地 Agent 发起登录时打开的业务系统网页。")),1),e[31]||(e[31]=n("p",null,[o("留空表示不开放 Agent 登录。生产必须使用 HTTPS;本机联调可使用带端口的 "),n("code",null,"127.0.0.1"),o(" / "),n("code",null,"::1"),o(" HTTP URL。")],-1))]),_:1},8,["title"])]),default:l(()=>[a(B,{modelValue:r.agent_authorize_url,"onUpdate:modelValue":e[2]||(e[2]=t=>r.agent_authorize_url=t),placeholder:"https://business.example.com/agent-authorize",class:"mono"},null,8,["modelValue"])]),_:1}),a(y,null,{label:l(()=>[o(s(p("allowed_routes","可调路由"))+" ",1),H("allowed_routes")?(u(),k("span",qe,"*")):T("",!0),e[33]||(e[33]=o()),a(g,{title:p("allowed_routes","可调路由")},{default:l(()=>[n("p",null,s(w("allowed_routes","该接入方可触发哪些 route。")),1),e[32]||(e[32]=n("p",null,[n("code",null,"*"),o(" 表示全部路由,适合本地开发或完全受信的内部系统,生产环境慎用。")],-1))]),_:1},8,["title"])]),default:l(()=>[a(Q,{modelValue:r.allowed_routes,"onUpdate:modelValue":e[3]||(e[3]=t=>r.allowed_routes=t),multiple:"",filterable:"","allow-create":"","default-first-option":"",style:{width:"100%"},placeholder:"选择或输入场景标识"},{default:l(()=>[a(E,{value:"*",label:"*(全部路由)"}),(u(!0),k(C,null,N(K.value,t=>(u(),v(E,{key:t,value:t,label:t},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(y,null,{label:l(()=>[o(s(p("allowed_channels","可推渠道白名单"))+" ",1),a(g,{title:p("allowed_channels","可推渠道白名单")},{default:l(()=>[n("p",null,s(w("allowed_channels","该接入方调 POST /send 主动推消息时,只能推这里授权的渠道。")),1),e[34]||(e[34]=n("p",null,"推送会作为「回复方」消息记进收件人在该渠道的会话历史,所以用户后续在该渠道追问时,大脑接得上上下文。",-1))]),_:1},8,["title"])]),default:l(()=>[a(Q,{modelValue:r.allowed_channels,"onUpdate:modelValue":e[4]||(e[4]=t=>r.allowed_channels=t),multiple:"",filterable:"","default-first-option":"",style:{width:"100%"},placeholder:"留空=不允许主动推;或选渠道 / *"},{default:l(()=>[a(E,{value:"*",label:"*(全部渠道)"}),(u(!0),k(C,null,N(L.value,t=>(u(),v(E,{key:t,value:t,label:t},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(y,null,{label:l(()=>[o(s(p("rate_limit_per_min","限速"))+" ",1),a(g,{title:p("rate_limit_per_min","限速")},{default:l(()=>[n("p",null,s(w("rate_limit_per_min","该接入方每分钟最多调用多少次。0 表示不限。")),1),e[35]||(e[35]=n("p",null,[n("code",null,"/run"),o(" 和 "),n("code",null,"/send"),o(" 共用同一限速桶。")],-1))]),_:1},8,["title"])]),default:l(()=>[a(R,{modelValue:r.rate_limit_per_min,"onUpdate:modelValue":e[5]||(e[5]=t=>r.rate_limit_per_min=t),min:0,max:6e3},null,8,["modelValue"])]),_:1}),a(y,null,{label:l(()=>[o(s(p("budget","成本预算闸"))+" ",1),a(g,{title:p("budget","成本预算闸")},{default:l(()=>[n("p",null,s(w("budget","按接入方维度限制模型成本或 token 用量。")),1),e[36]||(e[36]=n("p",null,[o("按该接入方在指定窗口内的历史用量做入口硬限。达到成本或 token 上限后,该接入方的新 "),n("code",null,"/run"),o(" 任务会直接记为 "),n("code",null,"rejected"),o(",不会再进入模型、执行器或工具链路。")],-1)),e[37]||(e[37]=n("p",null,"这是调用方级预算;触发路由页还可以配置场景级预算。两边任一命中都会拒绝。",-1))]),_:1},8,["title"])]),default:l(()=>[a(W,{modelValue:_.enabled,"onUpdate:modelValue":e[6]||(e[6]=t=>_.enabled=t)},null,8,["modelValue"])]),_:1}),_.enabled?(u(),k(C,{key:0},[a(y,{label:"预算窗口"},{default:l(()=>[a(pe,{modelValue:_.window,"onUpdate:modelValue":e[7]||(e[7]=t=>_.window=t)},{default:l(()=>[a(M,{value:"hour"},{default:l(()=>[...e[38]||(e[38]=[o("每小时",-1)])]),_:1}),a(M,{value:"day"},{default:l(()=>[...e[39]||(e[39]=[o("每天",-1)])]),_:1}),a(M,{value:"month"},{default:l(()=>[...e[40]||(e[40]=[o("每月",-1)])]),_:1})]),_:1},8,["modelValue"])]),_:1}),a(y,{label:"硬限"},{default:l(()=>[n("div",He,[e[41]||(e[41]=n("span",{class:"muted"},"成本 USD",-1)),a(R,{modelValue:_.hard_cost_usd,"onUpdate:modelValue":e[8]||(e[8]=t=>_.hard_cost_usd=t),min:0,step:.1,precision:4},null,8,["modelValue"]),e[42]||(e[42]=n("span",{class:"muted"},"Token",-1)),a(R,{modelValue:_.hard_tokens,"onUpdate:modelValue":e[9]||(e[9]=t=>_.hard_tokens=t),min:0,step:1e3},null,8,["modelValue"])]),e[43]||(e[43]=n("div",{class:"muted hint"},"两个都为空等于不设硬限;任一达到上限即拒绝新任务。",-1))]),_:1})],64)):T("",!0),a(y,null,{label:l(()=>[o(s(p("description","说明"))+" ",1),a(g,{title:p("description","说明")},{default:l(()=>[n("p",null,s(w("description","给后台管理员看的补充备注。")),1)]),_:1},8,["title"])]),default:l(()=>[a(B,{modelValue:r.description,"onUpdate:modelValue":e[10]||(e[10]=t=>r.description=t)},null,8,["modelValue"])]),_:1}),U.value?(u(),v(y,{key:1},{label:l(()=>[o(s(p("enabled","启用"))+" ",1),a(g,{title:p("enabled","启用")},{default:l(()=>[n("p",null,s(w("enabled","关闭后该接入方 token 不再允许调用。")),1)]),_:1},8,["title"])]),default:l(()=>[a(W,{modelValue:r.enabled,"onUpdate:modelValue":e[11]||(e[11]=t=>r.enabled=t)},null,8,["modelValue"])]),_:1})):T("",!0)]),_:1})]),_:1},8,["modelValue","title"])],64)}}}),Xe=Ve(Ie,[["__scopeId","data-v-4d900ece"]]);export{Xe as default};
|