coding-tool-x 3.9.0 → 3.9.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.md +2 -0
- package/dist/web/assets/AgentsDrawer-CobzHziM.css +1 -0
- package/dist/web/assets/AgentsDrawer-MeGfH4I0.js +1 -0
- package/dist/web/assets/{Analytics-BXRwqC-P.js → Analytics-DTIvvMXu.js} +1 -1
- package/dist/web/assets/{AssetPathField-B-LHvOxq.js → AssetPathField-jv-lopQ3.js} +1 -1
- package/dist/web/assets/{ChatHistoryDrawer-CoHlGAxb.js → ChatHistoryDrawer-T4OVnJzM.js} +1 -1
- package/dist/web/assets/{CollapseItem-kJkiHxFl.js → CollapseItem-P6BvSxEu.js} +1 -1
- package/dist/web/assets/{CommandsDrawer-DLQrikcw.js → CommandsDrawer-DtFJRtow.js} +1 -1
- package/dist/web/assets/{ConfigExportDrawer-BItwo0FQ.js → ConfigExportDrawer-Di7KXhVS.js} +1 -1
- package/dist/web/assets/{ConfigTemplates-R3YzzBT3.js → ConfigTemplates-VdKE5Kp0.js} +1 -1
- package/dist/web/assets/{ConfigTemplatesDrawer-C_nPKrhx.js → ConfigTemplatesDrawer-bQvPnUQ0.js} +1 -1
- package/dist/web/assets/{ConfigTemplatesPanel-BiwrNyYN.js → ConfigTemplatesPanel-ChdyQ3C6.js} +1 -1
- package/dist/web/assets/{FavoritesDrawer-BAJ-AOpN.js → FavoritesDrawer-A25XfI7C.js} +1 -1
- package/dist/web/assets/{GatewayConvertDrawer-Av3yzwhP.js → GatewayConvertDrawer-TSJPvY4f.js} +1 -1
- package/dist/web/assets/{Home-B01aL_SR.js → Home-CzB85lKE.js} +1 -1
- package/dist/web/assets/{MarkdownEditor-D75GGt5X.js → MarkdownEditor-BXwTqbMo.js} +1 -1
- package/dist/web/assets/{McpDrawer-xNzJtT4X.js → McpDrawer-DIaiFq4R.js} +1 -1
- package/dist/web/assets/{McpFormDrawer-B240mJ5y.js → McpFormDrawer-CQgTYAux.js} +1 -1
- package/dist/web/assets/{PluginManager-CgLjBdlr.js → PluginManager-BkGrr21J.js} +1 -1
- package/dist/web/assets/{PluginsDrawer-DvJdwMXx.js → PluginsDrawer-Bq1JkM5r.js} +1 -1
- package/dist/web/assets/{PluginsPanel-kX14E_DT.js → PluginsPanel-Clz1r67v.js} +1 -1
- package/dist/web/assets/{ProjectList-CRtc3Hhx.js → ProjectList-QIC7-9ic.js} +1 -1
- package/dist/web/assets/{PromptsDrawer-CvT9dA2N.js → PromptsDrawer-BLeUYZWW.js} +1 -1
- package/dist/web/assets/{RecentSessionsDrawer-DM1gf584.js → RecentSessionsDrawer-yOpScIwI.js} +1 -1
- package/dist/web/assets/{SessionCard-cZR2V4Br.js → SessionCard-DeKRHAzu.js} +1 -1
- package/dist/web/assets/{SessionList-D7-P4Zme.js → SessionList-B0fPT_VB.js} +1 -1
- package/dist/web/assets/{SettingsDrawer-gW8kh-S8.js → SettingsDrawer-DpZoDj3M.js} +1 -1
- package/dist/web/assets/{SkillManager-D0BlI7CG.js → SkillManager-BpPqV2o4.js} +1 -1
- package/dist/web/assets/{SkillsDrawer-BMB6uzqP.js → SkillsDrawer-BgMlJbgS.js} +1 -1
- package/dist/web/assets/{SkillsPanel-BzR828De.js → SkillsPanel-CK-pSSHU.js} +1 -1
- package/dist/web/assets/{Upload-3fNyOQrx.js → Upload-DtuQ7ady.js} +1 -1
- package/dist/web/assets/{WorkspaceDrawer-DvtBA58Q.js → WorkspaceDrawer-Bu5mOGsF.js} +1 -1
- package/dist/web/assets/{WorkspaceManager-BW5KtsHO.js → WorkspaceManager-D1mhnNV-.js} +1 -1
- package/dist/web/assets/{WorkspacePanel-BC_xpAEZ.js → WorkspacePanel-BIrkMC_5.js} +1 -1
- package/dist/web/assets/{index-Bn8BUnwP.css → index-B86H0_5y.css} +1 -1
- package/dist/web/assets/{index-BFqnddoI.js → index-Bw6YXbBA.js} +2 -2
- package/dist/web/assets/{useResponsiveDrawer-Ckgj760z.js → useResponsiveDrawer-C-UacYVP.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/src/platforms/agents-service.js +50 -12
- package/src/platforms/drivers/omp/channels-implementation.js +1 -1
- package/src/platforms/drivers/omp/gateway.js +1 -1
- package/src/platforms/drivers/omp/model-role-settings.js +235 -0
- package/src/platforms/manifests/omp.json +3 -3
- package/src/server/api/settings.js +27 -0
- package/src/server/services/model-definition-schema.js +2 -2
- package/dist/web/assets/AgentsDrawer-DooV5Qhx.js +0 -1
- package/dist/web/assets/AgentsDrawer-Pw2k-ZAa.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as e,I as t,It as n,Jt as r,N as o,Nt as i,Qt as a,Rt as s,Tt as l,Ut as d,Wt as c,Zt as u,gn as h,gt as m,hn as v,ht as b,jt as f,kt as p,qt as g,vn as w,w as y,y as z,yn as $,zt as x}from"./_plugin-vue_export-helper-BeLZJZij.js";import{A as S,F as k,G as C,H as E,M as B,N as F,Q as M,V as R,Z as H,b as O,dt as W,f as A,l as T,st as D,tt as N,z as P}from"./vue-vendor-BqZbbXHA.js";import{n as U,t as j}from"./use-lock-html-scroll-DXIqmUW4.js";import{W as L}from"./index-BFqnddoI.js";var I=S({name:"NDrawerContent",inheritAttrs:!1,props:{blockScroll:Boolean,show:{type:Boolean,default:void 0},displayDirective:{type:String,required:!0},placement:{type:String,required:!0},contentClass:String,contentStyle:[Object,String],nativeScrollbar:{type:Boolean,required:!0},scrollbarProps:Object,trapFocus:{type:Boolean,default:!0},autoFocus:{type:Boolean,default:!0},showMask:{type:[Boolean,String],required:!0},maxWidth:Number,maxHeight:Number,minWidth:Number,minHeight:Number,resizable:Boolean,onClickoutside:Function,onAfterLeave:Function,onAfterEnter:Function,onEsc:Function},setup(e){const n=D(!!e.show),o=D(null),i=F(r);let a=0,s="",l=null;const u=D(!1),h=D(!1),v=O(()=>"top"===e.placement||"bottom"===e.placement),{mergedClsPrefixRef:b,mergedRtlRef:f}=m(e),p=t("Drawer",f,b),w=S,{doUpdateHeight:y,doUpdateWidth:z}=i;function $(t){var n,r;if(h.value)if(v.value){let r=(null===(n=o.value)||void 0===n?void 0:n.offsetHeight)||0;const i=a-t.clientY;r+="bottom"===e.placement?i:-i,r=(t=>{const{maxHeight:n}=e;if(n&&t>n)return n;const{minHeight:r}=e;return r&&t<r?r:t})(r),y(r),a=t.clientY}else{let n=(null===(r=o.value)||void 0===r?void 0:r.offsetWidth)||0;const i=a-t.clientX;n+="right"===e.placement?i:-i,n=(t=>{const{maxWidth:n}=e;if(n&&t>n)return n;const{minWidth:r}=e;return r&&t<r?r:t})(n),z(n),a=t.clientX}}function S(){h.value&&(a=0,h.value=!1,document.body.style.cursor=s,document.body.removeEventListener("mousemove",$),document.body.removeEventListener("mouseup",S),document.body.removeEventListener("mouseleave",w))}M(()=>{e.show&&(n.value=!0)}),H(()=>e.show,e=>{e||S()}),P(()=>{S()});const k=O(()=>{const{show:t}=e,n=[[A,t]];return e.showMask||n.push([x,e.onClickoutside,void 0,{capture:!0}]),n});return j(O(()=>e.blockScroll&&n.value)),C(g,o),C(d,null),C(c,null),{bodyRef:o,rtlEnabled:p,mergedClsPrefix:i.mergedClsPrefixRef,isMounted:i.isMountedRef,mergedTheme:i.mergedThemeRef,displayed:n,transitionName:O(()=>({right:"slide-in-from-right-transition",left:"slide-in-from-left-transition",top:"slide-in-from-top-transition",bottom:"slide-in-from-bottom-transition"}[e.placement])),handleAfterLeave:function(){var t;n.value=!1,null===(t=e.onAfterLeave)||void 0===t||t.call(e)},bodyDirectives:k,handleMousedownResizeTrigger:e=>{h.value=!0,a=v.value?e.clientY:e.clientX,s=document.body.style.cursor,document.body.style.cursor=v.value?"ns-resize":"ew-resize",document.body.addEventListener("mousemove",$),document.body.addEventListener("mouseleave",w),document.body.addEventListener("mouseup",S)},handleMouseenterResizeTrigger:()=>{null!==l&&(window.clearTimeout(l),l=null),h.value?u.value=!0:l=window.setTimeout(()=>{u.value=!0},300)},handleMouseleaveResizeTrigger:()=>{null!==l&&(window.clearTimeout(l),l=null),u.value=!1},isDragging:h,isHoverOnResizeTrigger:u}},render(){const{$slots:e,mergedClsPrefix:t}=this;return"show"===this.displayDirective||this.displayed||this.show?N(B("div",{role:"none"},B(i,{disabled:!this.showMask||!this.trapFocus,active:this.show,autoFocus:this.autoFocus,onEsc:this.onEsc},{default:()=>B(T,{name:this.transitionName,appear:this.isMounted,onAfterEnter:this.onAfterEnter,onAfterLeave:this.handleAfterLeave},{default:()=>N(B("div",k(this.$attrs,{role:"dialog",ref:"bodyRef","aria-modal":"true",class:[`${t}-drawer`,this.rtlEnabled&&`${t}-drawer--rtl`,`${t}-drawer--${this.placement}-placement`,this.isDragging&&`${t}-drawer--unselectable`,this.nativeScrollbar&&`${t}-drawer--native-scrollbar`]}),[this.resizable?B("div",{class:[`${t}-drawer__resize-trigger`,(this.isDragging||this.isHoverOnResizeTrigger)&&`${t}-drawer__resize-trigger--hover`],onMouseenter:this.handleMouseenterResizeTrigger,onMouseleave:this.handleMouseleaveResizeTrigger,onMousedown:this.handleMousedownResizeTrigger}):null,this.nativeScrollbar?B("div",{class:[`${t}-drawer-content-wrapper`,this.contentClass],style:this.contentStyle,role:"none"},e):B(z,Object.assign({},this.scrollbarProps,{contentStyle:this.contentStyle,contentClass:[`${t}-drawer-content-wrapper`,this.contentClass],theme:this.mergedTheme.peers.Scrollbar,themeOverrides:this.mergedTheme.peerOverrides.Scrollbar}),e)]),this.bodyDirectives)})})),[[A,"if"===this.displayDirective||this.displayed||this.show]]):null}}),{cubicBezierEaseIn:X,cubicBezierEaseOut:Y}=e;var{cubicBezierEaseIn:_,cubicBezierEaseOut:q}=e;var{cubicBezierEaseIn:V,cubicBezierEaseOut:Q}=e;var{cubicBezierEaseIn:Z,cubicBezierEaseOut:G}=e;var J=v([h("drawer","\n word-break: break-word;\n line-height: var(--n-line-height);\n position: absolute;\n pointer-events: all;\n box-shadow: var(--n-box-shadow);\n transition:\n background-color .3s var(--n-bezier),\n color .3s var(--n-bezier);\n background-color: var(--n-color);\n color: var(--n-text-color);\n box-sizing: border-box;\n ",[function({duration:e="0.3s",leaveDuration:t="0.2s",name:n="slide-in-from-right"}={}){return[v(`&.${n}-transition-leave-active`,{transition:`transform ${t} ${V}`}),v(`&.${n}-transition-enter-active`,{transition:`transform ${e} ${Q}`}),v(`&.${n}-transition-enter-to`,{transform:"translateX(0)"}),v(`&.${n}-transition-enter-from`,{transform:"translateX(100%)"}),v(`&.${n}-transition-leave-from`,{transform:"translateX(0)"}),v(`&.${n}-transition-leave-to`,{transform:"translateX(100%)"})]}(),function({duration:e="0.3s",leaveDuration:t="0.2s",name:n="slide-in-from-left"}={}){return[v(`&.${n}-transition-leave-active`,{transition:`transform ${t} ${_}`}),v(`&.${n}-transition-enter-active`,{transition:`transform ${e} ${q}`}),v(`&.${n}-transition-enter-to`,{transform:"translateX(0)"}),v(`&.${n}-transition-enter-from`,{transform:"translateX(-100%)"}),v(`&.${n}-transition-leave-from`,{transform:"translateX(0)"}),v(`&.${n}-transition-leave-to`,{transform:"translateX(-100%)"})]}(),function({duration:e="0.3s",leaveDuration:t="0.2s",name:n="slide-in-from-top"}={}){return[v(`&.${n}-transition-leave-active`,{transition:`transform ${t} ${Z}`}),v(`&.${n}-transition-enter-active`,{transition:`transform ${e} ${G}`}),v(`&.${n}-transition-enter-to`,{transform:"translateY(0)"}),v(`&.${n}-transition-enter-from`,{transform:"translateY(-100%)"}),v(`&.${n}-transition-leave-from`,{transform:"translateY(0)"}),v(`&.${n}-transition-leave-to`,{transform:"translateY(-100%)"})]}(),function({duration:e="0.3s",leaveDuration:t="0.2s",name:n="slide-in-from-bottom"}={}){return[v(`&.${n}-transition-leave-active`,{transition:`transform ${t} ${X}`}),v(`&.${n}-transition-enter-active`,{transition:`transform ${e} ${Y}`}),v(`&.${n}-transition-enter-to`,{transform:"translateY(0)"}),v(`&.${n}-transition-enter-from`,{transform:"translateY(100%)"}),v(`&.${n}-transition-leave-from`,{transform:"translateY(0)"}),v(`&.${n}-transition-leave-to`,{transform:"translateY(100%)"})]}(),$("unselectable","\n user-select: none; \n -webkit-user-select: none;\n "),$("native-scrollbar",[h("drawer-content-wrapper","\n overflow: auto;\n height: 100%;\n ")]),w("resize-trigger","\n position: absolute;\n background-color: #0000;\n transition: background-color .3s var(--n-bezier);\n ",[$("hover","\n background-color: var(--n-resize-trigger-color-hover);\n ")]),h("drawer-content-wrapper","\n box-sizing: border-box;\n "),h("drawer-content","\n height: 100%;\n display: flex;\n flex-direction: column;\n ",[$("native-scrollbar",[h("drawer-body-content-wrapper","\n height: 100%;\n overflow: auto;\n ")]),h("drawer-body","\n flex: 1 0 0;\n overflow: hidden;\n "),h("drawer-body-content-wrapper","\n box-sizing: border-box;\n padding: var(--n-body-padding);\n "),h("drawer-header","\n font-weight: var(--n-title-font-weight);\n line-height: 1;\n font-size: var(--n-title-font-size);\n color: var(--n-title-text-color);\n padding: var(--n-header-padding);\n transition: border .3s var(--n-bezier);\n border-bottom: 1px solid var(--n-divider-color);\n border-bottom: var(--n-header-border-bottom);\n display: flex;\n justify-content: space-between;\n align-items: center;\n ",[w("main","\n flex: 1;\n "),w("close","\n margin-left: 6px;\n transition:\n background-color .3s var(--n-bezier),\n color .3s var(--n-bezier);\n ")]),h("drawer-footer","\n display: flex;\n justify-content: flex-end;\n border-top: var(--n-footer-border-top);\n transition: border .3s var(--n-bezier);\n padding: var(--n-footer-padding);\n ")]),$("right-placement","\n top: 0;\n bottom: 0;\n right: 0;\n border-top-left-radius: var(--n-border-radius);\n border-bottom-left-radius: var(--n-border-radius);\n ",[w("resize-trigger","\n width: 3px;\n height: 100%;\n top: 0;\n left: 0;\n transform: translateX(-1.5px);\n cursor: ew-resize;\n ")]),$("left-placement","\n top: 0;\n bottom: 0;\n left: 0;\n border-top-right-radius: var(--n-border-radius);\n border-bottom-right-radius: var(--n-border-radius);\n ",[w("resize-trigger","\n width: 3px;\n height: 100%;\n top: 0;\n right: 0;\n transform: translateX(1.5px);\n cursor: ew-resize;\n ")]),$("top-placement","\n top: 0;\n left: 0;\n right: 0;\n border-bottom-left-radius: var(--n-border-radius);\n border-bottom-right-radius: var(--n-border-radius);\n ",[w("resize-trigger","\n width: 100%;\n height: 3px;\n bottom: 0;\n left: 0;\n transform: translateY(1.5px);\n cursor: ns-resize;\n ")]),$("bottom-placement","\n left: 0;\n bottom: 0;\n right: 0;\n border-top-left-radius: var(--n-border-radius);\n border-top-right-radius: var(--n-border-radius);\n ",[w("resize-trigger","\n width: 100%;\n height: 3px;\n top: 0;\n left: 0;\n transform: translateY(-1.5px);\n cursor: ns-resize;\n ")])]),v("body",[v(">",[h("drawer-container","\n position: fixed;\n ")])]),h("drawer-container","\n position: relative;\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n pointer-events: none;\n ",[v("> *","\n pointer-events: all;\n ")]),h("drawer-mask","\n background-color: rgba(0, 0, 0, .3);\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n ",[$("invisible","\n background-color: rgba(0, 0, 0, 0)\n "),y({enterDuration:"0.2s",leaveDuration:"0.2s",enterCubicBezier:"var(--n-bezier-in)",leaveCubicBezier:"var(--n-bezier-out)"})])]),K=S({name:"Drawer",inheritAttrs:!1,props:Object.assign(Object.assign({},o.props),{show:Boolean,width:[Number,String],height:[Number,String],placement:{type:String,default:"right"},maskClosable:{type:Boolean,default:!0},showMask:{type:[Boolean,String],default:!0},to:[String,Object],displayDirective:{type:String,default:"if"},nativeScrollbar:{type:Boolean,default:!0},zIndex:Number,onMaskClick:Function,scrollbarProps:Object,contentClass:String,contentStyle:[Object,String],trapFocus:{type:Boolean,default:!0},onEsc:Function,autoFocus:{type:Boolean,default:!0},closeOnEsc:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!0},maxWidth:Number,maxHeight:Number,minWidth:Number,minHeight:Number,resizable:Boolean,defaultWidth:{type:[Number,String],default:251},defaultHeight:{type:[Number,String],default:251},onUpdateWidth:[Function,Array],onUpdateHeight:[Function,Array],"onUpdate:width":[Function,Array],"onUpdate:height":[Function,Array],"onUpdate:show":[Function,Array],onUpdateShow:[Function,Array],onAfterEnter:Function,onAfterLeave:Function,drawerStyle:[String,Object],drawerClass:String,target:null,onShow:Function,onHide:Function}),setup(e){const{mergedClsPrefixRef:t,namespaceRef:n,inlineThemeDisabled:i}=m(e),s=u(),d=o("Drawer","-drawer",J,L,e,t),c=D(e.defaultWidth),h=D(e.defaultHeight),v=a(W(e,"width"),c),g=a(W(e,"height"),h),w=O(()=>{const{placement:t}=e;return"top"===t||"bottom"===t?"":f(v.value)}),y=O(()=>{const{placement:t}=e;return"left"===t||"right"===t?"":f(g.value)}),z=O(()=>[{width:w.value,height:y.value},e.drawerStyle||""]);function $(t){const{onMaskClick:n,maskClosable:r}=e;r&&S(!1),n&&n(t)}const x=U();function S(t){const{onHide:n,onUpdateShow:r,"onUpdate:show":o}=e;r&&l(r,t),o&&l(o,t),n&&!t&&l(n,t)}C(r,{isMountedRef:s,mergedThemeRef:d,mergedClsPrefixRef:t,doUpdateShow:S,doUpdateHeight:t=>{const{onUpdateHeight:n,"onUpdate:width":r}=e;n&&l(n,t),r&&l(r,t),h.value=t},doUpdateWidth:t=>{const{onUpdateWidth:n,"onUpdate:width":r}=e;n&&l(n,t),r&&l(r,t),c.value=t}});const k=O(()=>{const{common:{cubicBezierEaseInOut:e,cubicBezierEaseIn:t,cubicBezierEaseOut:n},self:{color:r,textColor:o,boxShadow:i,lineHeight:a,headerPadding:s,footerPadding:l,borderRadius:c,bodyPadding:u,titleFontSize:h,titleTextColor:m,titleFontWeight:v,headerBorderBottom:b,footerBorderTop:f,closeIconColor:p,closeIconColorHover:g,closeIconColorPressed:w,closeColorHover:y,closeColorPressed:z,closeIconSize:$,closeSize:x,closeBorderRadius:S,resizableTriggerColorHover:k}}=d.value;return{"--n-line-height":a,"--n-color":r,"--n-border-radius":c,"--n-text-color":o,"--n-box-shadow":i,"--n-bezier":e,"--n-bezier-out":n,"--n-bezier-in":t,"--n-header-padding":s,"--n-body-padding":u,"--n-footer-padding":l,"--n-title-text-color":m,"--n-title-font-size":h,"--n-title-font-weight":v,"--n-header-border-bottom":b,"--n-footer-border-top":f,"--n-close-icon-color":p,"--n-close-icon-color-hover":g,"--n-close-icon-color-pressed":w,"--n-close-size":x,"--n-close-color-hover":y,"--n-close-color-pressed":z,"--n-close-icon-size":$,"--n-close-border-radius":S,"--n-resize-trigger-color-hover":k}}),E=i?b("drawer",void 0,k,e):void 0;return{mergedClsPrefix:t,namespace:n,mergedBodyStyle:z,handleOutsideClick:function(e){$(e)},handleMaskClick:$,handleEsc:function(t){var n;null===(n=e.onEsc)||void 0===n||n.call(e),e.show&&e.closeOnEsc&&p(t)&&(x.value||S(!1))},mergedTheme:d,cssVars:i?void 0:k,themeClass:null==E?void 0:E.themeClass,onRender:null==E?void 0:E.onRender,isMounted:s}},render(){const{mergedClsPrefix:e}=this;return B(n,{to:this.to,show:this.show},{default:()=>{var t;return null===(t=this.onRender)||void 0===t||t.call(this),N(B("div",{class:[`${e}-drawer-container`,this.namespace,this.themeClass],style:this.cssVars,role:"none"},this.showMask?B(T,{name:"fade-in-transition",appear:this.isMounted},{default:()=>this.show?B("div",{"aria-hidden":!0,class:[`${e}-drawer-mask`,"transparent"===this.showMask&&`${e}-drawer-mask--invisible`],onClick:this.handleMaskClick}):null}):null,B(I,Object.assign({},this.$attrs,{class:[this.drawerClass,this.$attrs.class],style:[this.mergedBodyStyle,this.$attrs.style],blockScroll:this.blockScroll,contentStyle:this.contentStyle,contentClass:this.contentClass,placement:this.placement,scrollbarProps:this.scrollbarProps,show:this.show,displayDirective:this.displayDirective,nativeScrollbar:this.nativeScrollbar,onAfterEnter:this.onAfterEnter,onAfterLeave:this.onAfterLeave,trapFocus:this.trapFocus,autoFocus:this.autoFocus,resizable:this.resizable,maxHeight:this.maxHeight,minHeight:this.minHeight,maxWidth:this.maxWidth,minWidth:this.minWidth,showMask:this.showMask,onEsc:this.handleEsc,onClickoutside:this.handleOutsideClick}),this.$slots)),[[s,{zIndex:this.zIndex,enabled:this.show}]])}})}});function ee(e=520,t=null){const n=D("undefined"!=typeof window?window.innerWidth:1200),r=()=>{n.value=window.innerWidth};R(()=>{window.addEventListener("resize",r)}),E(()=>{window.removeEventListener("resize",r)});const o=O(()=>n.value<640),i=O(()=>n.value>=640&&n.value<1024);return{drawerWidth:O(()=>{if(n.value<640)return"100%";if(n.value<768)return Math.min(.95*n.value,e);if(n.value<1024){const r=t||e;return Math.min(.85*n.value,r)}return e}),isMobile:o,isTablet:i,windowWidth:n}}export{K as n,ee as t};
|
|
1
|
+
import{F as e,I as t,It as n,Jt as r,N as o,Nt as i,Qt as a,Rt as s,Tt as l,Ut as d,Wt as c,Zt as u,gn as h,gt as m,hn as v,ht as b,jt as f,kt as p,qt as g,vn as w,w as y,y as z,yn as $,zt as x}from"./_plugin-vue_export-helper-BeLZJZij.js";import{A as S,F as k,G as C,H as E,M as B,N as F,Q as M,V as R,Z as H,b as O,dt as W,f as A,l as T,st as D,tt as N,z as P}from"./vue-vendor-BqZbbXHA.js";import{n as U,t as j}from"./use-lock-html-scroll-DXIqmUW4.js";import{W as L}from"./index-Bw6YXbBA.js";var I=S({name:"NDrawerContent",inheritAttrs:!1,props:{blockScroll:Boolean,show:{type:Boolean,default:void 0},displayDirective:{type:String,required:!0},placement:{type:String,required:!0},contentClass:String,contentStyle:[Object,String],nativeScrollbar:{type:Boolean,required:!0},scrollbarProps:Object,trapFocus:{type:Boolean,default:!0},autoFocus:{type:Boolean,default:!0},showMask:{type:[Boolean,String],required:!0},maxWidth:Number,maxHeight:Number,minWidth:Number,minHeight:Number,resizable:Boolean,onClickoutside:Function,onAfterLeave:Function,onAfterEnter:Function,onEsc:Function},setup(e){const n=D(!!e.show),o=D(null),i=F(r);let a=0,s="",l=null;const u=D(!1),h=D(!1),v=O(()=>"top"===e.placement||"bottom"===e.placement),{mergedClsPrefixRef:b,mergedRtlRef:f}=m(e),p=t("Drawer",f,b),w=S,{doUpdateHeight:y,doUpdateWidth:z}=i;function $(t){var n,r;if(h.value)if(v.value){let r=(null===(n=o.value)||void 0===n?void 0:n.offsetHeight)||0;const i=a-t.clientY;r+="bottom"===e.placement?i:-i,r=(t=>{const{maxHeight:n}=e;if(n&&t>n)return n;const{minHeight:r}=e;return r&&t<r?r:t})(r),y(r),a=t.clientY}else{let n=(null===(r=o.value)||void 0===r?void 0:r.offsetWidth)||0;const i=a-t.clientX;n+="right"===e.placement?i:-i,n=(t=>{const{maxWidth:n}=e;if(n&&t>n)return n;const{minWidth:r}=e;return r&&t<r?r:t})(n),z(n),a=t.clientX}}function S(){h.value&&(a=0,h.value=!1,document.body.style.cursor=s,document.body.removeEventListener("mousemove",$),document.body.removeEventListener("mouseup",S),document.body.removeEventListener("mouseleave",w))}M(()=>{e.show&&(n.value=!0)}),H(()=>e.show,e=>{e||S()}),P(()=>{S()});const k=O(()=>{const{show:t}=e,n=[[A,t]];return e.showMask||n.push([x,e.onClickoutside,void 0,{capture:!0}]),n});return j(O(()=>e.blockScroll&&n.value)),C(g,o),C(d,null),C(c,null),{bodyRef:o,rtlEnabled:p,mergedClsPrefix:i.mergedClsPrefixRef,isMounted:i.isMountedRef,mergedTheme:i.mergedThemeRef,displayed:n,transitionName:O(()=>({right:"slide-in-from-right-transition",left:"slide-in-from-left-transition",top:"slide-in-from-top-transition",bottom:"slide-in-from-bottom-transition"}[e.placement])),handleAfterLeave:function(){var t;n.value=!1,null===(t=e.onAfterLeave)||void 0===t||t.call(e)},bodyDirectives:k,handleMousedownResizeTrigger:e=>{h.value=!0,a=v.value?e.clientY:e.clientX,s=document.body.style.cursor,document.body.style.cursor=v.value?"ns-resize":"ew-resize",document.body.addEventListener("mousemove",$),document.body.addEventListener("mouseleave",w),document.body.addEventListener("mouseup",S)},handleMouseenterResizeTrigger:()=>{null!==l&&(window.clearTimeout(l),l=null),h.value?u.value=!0:l=window.setTimeout(()=>{u.value=!0},300)},handleMouseleaveResizeTrigger:()=>{null!==l&&(window.clearTimeout(l),l=null),u.value=!1},isDragging:h,isHoverOnResizeTrigger:u}},render(){const{$slots:e,mergedClsPrefix:t}=this;return"show"===this.displayDirective||this.displayed||this.show?N(B("div",{role:"none"},B(i,{disabled:!this.showMask||!this.trapFocus,active:this.show,autoFocus:this.autoFocus,onEsc:this.onEsc},{default:()=>B(T,{name:this.transitionName,appear:this.isMounted,onAfterEnter:this.onAfterEnter,onAfterLeave:this.handleAfterLeave},{default:()=>N(B("div",k(this.$attrs,{role:"dialog",ref:"bodyRef","aria-modal":"true",class:[`${t}-drawer`,this.rtlEnabled&&`${t}-drawer--rtl`,`${t}-drawer--${this.placement}-placement`,this.isDragging&&`${t}-drawer--unselectable`,this.nativeScrollbar&&`${t}-drawer--native-scrollbar`]}),[this.resizable?B("div",{class:[`${t}-drawer__resize-trigger`,(this.isDragging||this.isHoverOnResizeTrigger)&&`${t}-drawer__resize-trigger--hover`],onMouseenter:this.handleMouseenterResizeTrigger,onMouseleave:this.handleMouseleaveResizeTrigger,onMousedown:this.handleMousedownResizeTrigger}):null,this.nativeScrollbar?B("div",{class:[`${t}-drawer-content-wrapper`,this.contentClass],style:this.contentStyle,role:"none"},e):B(z,Object.assign({},this.scrollbarProps,{contentStyle:this.contentStyle,contentClass:[`${t}-drawer-content-wrapper`,this.contentClass],theme:this.mergedTheme.peers.Scrollbar,themeOverrides:this.mergedTheme.peerOverrides.Scrollbar}),e)]),this.bodyDirectives)})})),[[A,"if"===this.displayDirective||this.displayed||this.show]]):null}}),{cubicBezierEaseIn:X,cubicBezierEaseOut:Y}=e;var{cubicBezierEaseIn:_,cubicBezierEaseOut:q}=e;var{cubicBezierEaseIn:V,cubicBezierEaseOut:Q}=e;var{cubicBezierEaseIn:Z,cubicBezierEaseOut:G}=e;var J=v([h("drawer","\n word-break: break-word;\n line-height: var(--n-line-height);\n position: absolute;\n pointer-events: all;\n box-shadow: var(--n-box-shadow);\n transition:\n background-color .3s var(--n-bezier),\n color .3s var(--n-bezier);\n background-color: var(--n-color);\n color: var(--n-text-color);\n box-sizing: border-box;\n ",[function({duration:e="0.3s",leaveDuration:t="0.2s",name:n="slide-in-from-right"}={}){return[v(`&.${n}-transition-leave-active`,{transition:`transform ${t} ${V}`}),v(`&.${n}-transition-enter-active`,{transition:`transform ${e} ${Q}`}),v(`&.${n}-transition-enter-to`,{transform:"translateX(0)"}),v(`&.${n}-transition-enter-from`,{transform:"translateX(100%)"}),v(`&.${n}-transition-leave-from`,{transform:"translateX(0)"}),v(`&.${n}-transition-leave-to`,{transform:"translateX(100%)"})]}(),function({duration:e="0.3s",leaveDuration:t="0.2s",name:n="slide-in-from-left"}={}){return[v(`&.${n}-transition-leave-active`,{transition:`transform ${t} ${_}`}),v(`&.${n}-transition-enter-active`,{transition:`transform ${e} ${q}`}),v(`&.${n}-transition-enter-to`,{transform:"translateX(0)"}),v(`&.${n}-transition-enter-from`,{transform:"translateX(-100%)"}),v(`&.${n}-transition-leave-from`,{transform:"translateX(0)"}),v(`&.${n}-transition-leave-to`,{transform:"translateX(-100%)"})]}(),function({duration:e="0.3s",leaveDuration:t="0.2s",name:n="slide-in-from-top"}={}){return[v(`&.${n}-transition-leave-active`,{transition:`transform ${t} ${Z}`}),v(`&.${n}-transition-enter-active`,{transition:`transform ${e} ${G}`}),v(`&.${n}-transition-enter-to`,{transform:"translateY(0)"}),v(`&.${n}-transition-enter-from`,{transform:"translateY(-100%)"}),v(`&.${n}-transition-leave-from`,{transform:"translateY(0)"}),v(`&.${n}-transition-leave-to`,{transform:"translateY(-100%)"})]}(),function({duration:e="0.3s",leaveDuration:t="0.2s",name:n="slide-in-from-bottom"}={}){return[v(`&.${n}-transition-leave-active`,{transition:`transform ${t} ${X}`}),v(`&.${n}-transition-enter-active`,{transition:`transform ${e} ${Y}`}),v(`&.${n}-transition-enter-to`,{transform:"translateY(0)"}),v(`&.${n}-transition-enter-from`,{transform:"translateY(100%)"}),v(`&.${n}-transition-leave-from`,{transform:"translateY(0)"}),v(`&.${n}-transition-leave-to`,{transform:"translateY(100%)"})]}(),$("unselectable","\n user-select: none; \n -webkit-user-select: none;\n "),$("native-scrollbar",[h("drawer-content-wrapper","\n overflow: auto;\n height: 100%;\n ")]),w("resize-trigger","\n position: absolute;\n background-color: #0000;\n transition: background-color .3s var(--n-bezier);\n ",[$("hover","\n background-color: var(--n-resize-trigger-color-hover);\n ")]),h("drawer-content-wrapper","\n box-sizing: border-box;\n "),h("drawer-content","\n height: 100%;\n display: flex;\n flex-direction: column;\n ",[$("native-scrollbar",[h("drawer-body-content-wrapper","\n height: 100%;\n overflow: auto;\n ")]),h("drawer-body","\n flex: 1 0 0;\n overflow: hidden;\n "),h("drawer-body-content-wrapper","\n box-sizing: border-box;\n padding: var(--n-body-padding);\n "),h("drawer-header","\n font-weight: var(--n-title-font-weight);\n line-height: 1;\n font-size: var(--n-title-font-size);\n color: var(--n-title-text-color);\n padding: var(--n-header-padding);\n transition: border .3s var(--n-bezier);\n border-bottom: 1px solid var(--n-divider-color);\n border-bottom: var(--n-header-border-bottom);\n display: flex;\n justify-content: space-between;\n align-items: center;\n ",[w("main","\n flex: 1;\n "),w("close","\n margin-left: 6px;\n transition:\n background-color .3s var(--n-bezier),\n color .3s var(--n-bezier);\n ")]),h("drawer-footer","\n display: flex;\n justify-content: flex-end;\n border-top: var(--n-footer-border-top);\n transition: border .3s var(--n-bezier);\n padding: var(--n-footer-padding);\n ")]),$("right-placement","\n top: 0;\n bottom: 0;\n right: 0;\n border-top-left-radius: var(--n-border-radius);\n border-bottom-left-radius: var(--n-border-radius);\n ",[w("resize-trigger","\n width: 3px;\n height: 100%;\n top: 0;\n left: 0;\n transform: translateX(-1.5px);\n cursor: ew-resize;\n ")]),$("left-placement","\n top: 0;\n bottom: 0;\n left: 0;\n border-top-right-radius: var(--n-border-radius);\n border-bottom-right-radius: var(--n-border-radius);\n ",[w("resize-trigger","\n width: 3px;\n height: 100%;\n top: 0;\n right: 0;\n transform: translateX(1.5px);\n cursor: ew-resize;\n ")]),$("top-placement","\n top: 0;\n left: 0;\n right: 0;\n border-bottom-left-radius: var(--n-border-radius);\n border-bottom-right-radius: var(--n-border-radius);\n ",[w("resize-trigger","\n width: 100%;\n height: 3px;\n bottom: 0;\n left: 0;\n transform: translateY(1.5px);\n cursor: ns-resize;\n ")]),$("bottom-placement","\n left: 0;\n bottom: 0;\n right: 0;\n border-top-left-radius: var(--n-border-radius);\n border-top-right-radius: var(--n-border-radius);\n ",[w("resize-trigger","\n width: 100%;\n height: 3px;\n top: 0;\n left: 0;\n transform: translateY(-1.5px);\n cursor: ns-resize;\n ")])]),v("body",[v(">",[h("drawer-container","\n position: fixed;\n ")])]),h("drawer-container","\n position: relative;\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n pointer-events: none;\n ",[v("> *","\n pointer-events: all;\n ")]),h("drawer-mask","\n background-color: rgba(0, 0, 0, .3);\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n ",[$("invisible","\n background-color: rgba(0, 0, 0, 0)\n "),y({enterDuration:"0.2s",leaveDuration:"0.2s",enterCubicBezier:"var(--n-bezier-in)",leaveCubicBezier:"var(--n-bezier-out)"})])]),K=S({name:"Drawer",inheritAttrs:!1,props:Object.assign(Object.assign({},o.props),{show:Boolean,width:[Number,String],height:[Number,String],placement:{type:String,default:"right"},maskClosable:{type:Boolean,default:!0},showMask:{type:[Boolean,String],default:!0},to:[String,Object],displayDirective:{type:String,default:"if"},nativeScrollbar:{type:Boolean,default:!0},zIndex:Number,onMaskClick:Function,scrollbarProps:Object,contentClass:String,contentStyle:[Object,String],trapFocus:{type:Boolean,default:!0},onEsc:Function,autoFocus:{type:Boolean,default:!0},closeOnEsc:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!0},maxWidth:Number,maxHeight:Number,minWidth:Number,minHeight:Number,resizable:Boolean,defaultWidth:{type:[Number,String],default:251},defaultHeight:{type:[Number,String],default:251},onUpdateWidth:[Function,Array],onUpdateHeight:[Function,Array],"onUpdate:width":[Function,Array],"onUpdate:height":[Function,Array],"onUpdate:show":[Function,Array],onUpdateShow:[Function,Array],onAfterEnter:Function,onAfterLeave:Function,drawerStyle:[String,Object],drawerClass:String,target:null,onShow:Function,onHide:Function}),setup(e){const{mergedClsPrefixRef:t,namespaceRef:n,inlineThemeDisabled:i}=m(e),s=u(),d=o("Drawer","-drawer",J,L,e,t),c=D(e.defaultWidth),h=D(e.defaultHeight),v=a(W(e,"width"),c),g=a(W(e,"height"),h),w=O(()=>{const{placement:t}=e;return"top"===t||"bottom"===t?"":f(v.value)}),y=O(()=>{const{placement:t}=e;return"left"===t||"right"===t?"":f(g.value)}),z=O(()=>[{width:w.value,height:y.value},e.drawerStyle||""]);function $(t){const{onMaskClick:n,maskClosable:r}=e;r&&S(!1),n&&n(t)}const x=U();function S(t){const{onHide:n,onUpdateShow:r,"onUpdate:show":o}=e;r&&l(r,t),o&&l(o,t),n&&!t&&l(n,t)}C(r,{isMountedRef:s,mergedThemeRef:d,mergedClsPrefixRef:t,doUpdateShow:S,doUpdateHeight:t=>{const{onUpdateHeight:n,"onUpdate:width":r}=e;n&&l(n,t),r&&l(r,t),h.value=t},doUpdateWidth:t=>{const{onUpdateWidth:n,"onUpdate:width":r}=e;n&&l(n,t),r&&l(r,t),c.value=t}});const k=O(()=>{const{common:{cubicBezierEaseInOut:e,cubicBezierEaseIn:t,cubicBezierEaseOut:n},self:{color:r,textColor:o,boxShadow:i,lineHeight:a,headerPadding:s,footerPadding:l,borderRadius:c,bodyPadding:u,titleFontSize:h,titleTextColor:m,titleFontWeight:v,headerBorderBottom:b,footerBorderTop:f,closeIconColor:p,closeIconColorHover:g,closeIconColorPressed:w,closeColorHover:y,closeColorPressed:z,closeIconSize:$,closeSize:x,closeBorderRadius:S,resizableTriggerColorHover:k}}=d.value;return{"--n-line-height":a,"--n-color":r,"--n-border-radius":c,"--n-text-color":o,"--n-box-shadow":i,"--n-bezier":e,"--n-bezier-out":n,"--n-bezier-in":t,"--n-header-padding":s,"--n-body-padding":u,"--n-footer-padding":l,"--n-title-text-color":m,"--n-title-font-size":h,"--n-title-font-weight":v,"--n-header-border-bottom":b,"--n-footer-border-top":f,"--n-close-icon-color":p,"--n-close-icon-color-hover":g,"--n-close-icon-color-pressed":w,"--n-close-size":x,"--n-close-color-hover":y,"--n-close-color-pressed":z,"--n-close-icon-size":$,"--n-close-border-radius":S,"--n-resize-trigger-color-hover":k}}),E=i?b("drawer",void 0,k,e):void 0;return{mergedClsPrefix:t,namespace:n,mergedBodyStyle:z,handleOutsideClick:function(e){$(e)},handleMaskClick:$,handleEsc:function(t){var n;null===(n=e.onEsc)||void 0===n||n.call(e),e.show&&e.closeOnEsc&&p(t)&&(x.value||S(!1))},mergedTheme:d,cssVars:i?void 0:k,themeClass:null==E?void 0:E.themeClass,onRender:null==E?void 0:E.onRender,isMounted:s}},render(){const{mergedClsPrefix:e}=this;return B(n,{to:this.to,show:this.show},{default:()=>{var t;return null===(t=this.onRender)||void 0===t||t.call(this),N(B("div",{class:[`${e}-drawer-container`,this.namespace,this.themeClass],style:this.cssVars,role:"none"},this.showMask?B(T,{name:"fade-in-transition",appear:this.isMounted},{default:()=>this.show?B("div",{"aria-hidden":!0,class:[`${e}-drawer-mask`,"transparent"===this.showMask&&`${e}-drawer-mask--invisible`],onClick:this.handleMaskClick}):null}):null,B(I,Object.assign({},this.$attrs,{class:[this.drawerClass,this.$attrs.class],style:[this.mergedBodyStyle,this.$attrs.style],blockScroll:this.blockScroll,contentStyle:this.contentStyle,contentClass:this.contentClass,placement:this.placement,scrollbarProps:this.scrollbarProps,show:this.show,displayDirective:this.displayDirective,nativeScrollbar:this.nativeScrollbar,onAfterEnter:this.onAfterEnter,onAfterLeave:this.onAfterLeave,trapFocus:this.trapFocus,autoFocus:this.autoFocus,resizable:this.resizable,maxHeight:this.maxHeight,minHeight:this.minHeight,maxWidth:this.maxWidth,minWidth:this.minWidth,showMask:this.showMask,onEsc:this.handleEsc,onClickoutside:this.handleOutsideClick}),this.$slots)),[[s,{zIndex:this.zIndex,enabled:this.show}]])}})}});function ee(e=520,t=null){const n=D("undefined"!=typeof window?window.innerWidth:1200),r=()=>{n.value=window.innerWidth};R(()=>{window.addEventListener("resize",r)}),E(()=>{window.removeEventListener("resize",r)});const o=O(()=>n.value<640),i=O(()=>n.value>=640&&n.value<1024);return{drawerWidth:O(()=>{if(n.value<640)return"100%";if(n.value<768)return Math.min(.95*n.value,e);if(n.value<1024){const r=t||e;return Math.min(.85*n.value,r)}return e}),isMobile:o,isTablet:i,windowWidth:n}}export{K as n,ee as t};
|
package/dist/web/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" href="/favicon.ico">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<title>coding-tool-x · AI 编程工作台</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-Bw6YXbBA.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/vue-vendor-BqZbbXHA.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/_plugin-vue_export-helper-BeLZJZij.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/vendors-D0c_0KLP.js">
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/use-message-DBsCm7FJ.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/use-lock-html-scroll-DXIqmUW4.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/assets/light-C2X7hegj.js">
|
|
19
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
19
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B86H0_5y.css">
|
|
20
20
|
</head>
|
|
21
21
|
<body>
|
|
22
22
|
<div id="app"></div>
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agents 服务
|
|
3
3
|
*
|
|
4
|
-
* 管理 Claude/Codex/Gemini/OpenCode 自定义代理的 CRUD 操作
|
|
4
|
+
* 管理 Claude/Codex/Gemini/OpenCode/OMP 自定义代理的 CRUD 操作
|
|
5
5
|
* 支持从 GitHub 仓库扫描和安装代理
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const fs = require('fs');
|
|
9
9
|
const path = require('path');
|
|
10
10
|
const os = require('os');
|
|
11
|
+
const yaml = require('js-yaml');
|
|
11
12
|
const toml = require('toml');
|
|
12
13
|
const tomlStringify = require('@iarna/toml').stringify;
|
|
13
14
|
const { RepoScannerBase } = require('../server/services/repo-scanner-base');
|
|
@@ -22,7 +23,7 @@ const {
|
|
|
22
23
|
resolveInsideRoot
|
|
23
24
|
} = require('../shared/config-artifact-paths');
|
|
24
25
|
|
|
25
|
-
function readAgentMetadata(filePath) {
|
|
26
|
+
function readAgentMetadata(filePath, platform = '') {
|
|
26
27
|
const fd = fs.openSync(filePath, 'r');
|
|
27
28
|
const buffer = Buffer.alloc(8192);
|
|
28
29
|
const chunks = [];
|
|
@@ -36,7 +37,7 @@ function readAgentMetadata(filePath) {
|
|
|
36
37
|
let text = Buffer.concat(chunks).toString('utf8');
|
|
37
38
|
if (text.charCodeAt(0) === 0xFEFF) text = text.slice(1);
|
|
38
39
|
if (total === bytesRead && !/^\s*---\s*(?:\n|$)/.test(text)) return {};
|
|
39
|
-
if (/^\s*---\s*\n[\s\S]*?\n\s*---\s*(?:\n|$)/.test(text)) return parseFrontmatter(text).frontmatter;
|
|
40
|
+
if (/^\s*---\s*\n[\s\S]*?\n\s*---\s*(?:\n|$)/.test(text)) return parseFrontmatter(text, platform).frontmatter;
|
|
40
41
|
}
|
|
41
42
|
return {};
|
|
42
43
|
} finally {
|
|
@@ -87,6 +88,12 @@ const PLATFORM_CONFIG = {
|
|
|
87
88
|
projectAgentsDir: (projectPath) => path.join(projectPath, '.gemini', 'agents'),
|
|
88
89
|
repoType: 'gemini-agents',
|
|
89
90
|
capabilities: { projectScope: true, repoOperations: true }
|
|
91
|
+
},
|
|
92
|
+
omp: {
|
|
93
|
+
userAgentsDir: path.join(NATIVE_PATHS.omp.dir, 'agents'),
|
|
94
|
+
projectAgentsDir: (projectPath) => path.join(projectPath, '.omp', 'agents'),
|
|
95
|
+
repoType: 'agents',
|
|
96
|
+
capabilities: { projectScope: true, repoOperations: true }
|
|
90
97
|
}
|
|
91
98
|
};
|
|
92
99
|
|
|
@@ -350,7 +357,7 @@ function readCodexAgentConfigFile(configFilePath) {
|
|
|
350
357
|
/**
|
|
351
358
|
* 解析 YAML frontmatter
|
|
352
359
|
*/
|
|
353
|
-
function parseFrontmatter(content) {
|
|
360
|
+
function parseFrontmatter(content, platform = '') {
|
|
354
361
|
|
|
355
362
|
const result = {
|
|
356
363
|
frontmatter: {},
|
|
@@ -369,6 +376,18 @@ function parseFrontmatter(content) {
|
|
|
369
376
|
const frontmatterText = match[1];
|
|
370
377
|
result.body = match[2].trim();
|
|
371
378
|
|
|
379
|
+
if (platform === 'omp') {
|
|
380
|
+
try {
|
|
381
|
+
const parsed = yaml.load(frontmatterText);
|
|
382
|
+
if (isPlainObject(parsed)) {
|
|
383
|
+
result.frontmatter = parsed;
|
|
384
|
+
return result;
|
|
385
|
+
}
|
|
386
|
+
} catch {
|
|
387
|
+
// Fall back to the basic parser for OMP's supported shorthand values.
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
372
391
|
// 简单解析 YAML(支持基本字段)
|
|
373
392
|
const lines = frontmatterText.split('\n');
|
|
374
393
|
for (const line of lines) {
|
|
@@ -422,6 +441,19 @@ function readCodexTomlMetadata(filePath) {
|
|
|
422
441
|
function generateFrontmatter(data, platform = 'claude') {
|
|
423
442
|
const lines = ['---'];
|
|
424
443
|
|
|
444
|
+
if (platform === 'omp') {
|
|
445
|
+
const frontmatter = {};
|
|
446
|
+
if (data.name) frontmatter.name = data.name;
|
|
447
|
+
if (data.description) frontmatter.description = data.description;
|
|
448
|
+
if (data.tools) frontmatter.tools = data.tools;
|
|
449
|
+
if (data.model) frontmatter.model = data.model;
|
|
450
|
+
if (data.thinkingLevel) frontmatter['thinking-level'] = data.thinkingLevel;
|
|
451
|
+
if (data.spawns) frontmatter.spawns = data.spawns;
|
|
452
|
+
lines.push(yaml.dump(frontmatter, { lineWidth: 120, noRefs: true, sortKeys: false }).trimEnd());
|
|
453
|
+
lines.push('---');
|
|
454
|
+
return lines.join('\n');
|
|
455
|
+
}
|
|
456
|
+
|
|
425
457
|
// Claude 下写入 name,OpenCode 以文件名作为 agent id
|
|
426
458
|
if (platform !== 'opencode' && data.name) {
|
|
427
459
|
lines.push(`name: ${data.name}`);
|
|
@@ -481,8 +513,10 @@ function scanAgentsDir(dir, basePath, scope) {
|
|
|
481
513
|
path: relativePath,
|
|
482
514
|
fullPath,
|
|
483
515
|
description: frontmatter.description || '',
|
|
484
|
-
tools: frontmatter.tools || '',
|
|
485
|
-
model: frontmatter.model || '',
|
|
516
|
+
tools: Array.isArray(frontmatter.tools) ? frontmatter.tools.join(', ') : (frontmatter.tools || ''),
|
|
517
|
+
model: Array.isArray(frontmatter.model) ? frontmatter.model.join(', ') : (frontmatter.model || ''),
|
|
518
|
+
thinkingLevel: frontmatter.thinkingLevel || frontmatter['thinking-level'] || '',
|
|
519
|
+
spawns: Array.isArray(frontmatter.spawns) ? frontmatter.spawns.join(', ') : (frontmatter.spawns || ''),
|
|
486
520
|
permissionMode: frontmatter.permissionMode || '',
|
|
487
521
|
skills: frontmatter.skills || '',
|
|
488
522
|
systemPrompt: body,
|
|
@@ -687,14 +721,14 @@ class AgentsService {
|
|
|
687
721
|
this._localIndexes.set(key, new LocalResourceIndex({ key, roots: [root],
|
|
688
722
|
scanFile: (descriptor) => {
|
|
689
723
|
if (!descriptor.fullPath.endsWith('.md') || descriptor.relativePath.includes(path.sep)) return null;
|
|
690
|
-
const frontmatter = readAgentMetadata(descriptor.fullPath);
|
|
724
|
+
const frontmatter = readAgentMetadata(descriptor.fullPath, this.platform);
|
|
691
725
|
const fileName = path.basename(descriptor.relativePath, '.md');
|
|
692
|
-
return { name: frontmatter.name || fileName, fileName, scope, path: descriptor.relativePath, fullPath: descriptor.fullPath, description: frontmatter.description || '', tools: frontmatter.tools || '', model: frontmatter.model || '', permissionMode: frontmatter.permissionMode || '', skills: frontmatter.skills || '', updatedAt: descriptor.stat.mtime.getTime() };
|
|
726
|
+
return { name: frontmatter.name || fileName, fileName, scope, path: descriptor.relativePath, fullPath: descriptor.fullPath, description: frontmatter.description || '', tools: Array.isArray(frontmatter.tools) ? frontmatter.tools.join(', ') : (frontmatter.tools || ''), model: Array.isArray(frontmatter.model) ? frontmatter.model.join(', ') : (frontmatter.model || ''), thinkingLevel: frontmatter.thinkingLevel || frontmatter['thinking-level'] || '', spawns: Array.isArray(frontmatter.spawns) ? frontmatter.spawns.join(', ') : (frontmatter.spawns || ''), permissionMode: frontmatter.permissionMode || '', skills: frontmatter.skills || '', updatedAt: descriptor.stat.mtime.getTime() };
|
|
693
727
|
},
|
|
694
728
|
detailFile: (summary) => {
|
|
695
729
|
const content = fs.readFileSync(summary.fullPath, 'utf-8');
|
|
696
|
-
const { frontmatter, body } = parseFrontmatter(content);
|
|
697
|
-
return { systemPrompt: body, fullContent: content, updatedAt: fs.statSync(summary.fullPath).mtime.getTime(), name: frontmatter.name || summary.fileName, description: frontmatter.description || '', tools: frontmatter.tools || '', model: frontmatter.model || '', permissionMode: frontmatter.permissionMode || '', skills: frontmatter.skills || '' };
|
|
730
|
+
const { frontmatter, body } = parseFrontmatter(content, this.platform);
|
|
731
|
+
return { systemPrompt: body, fullContent: content, updatedAt: fs.statSync(summary.fullPath).mtime.getTime(), name: frontmatter.name || summary.fileName, description: frontmatter.description || '', tools: Array.isArray(frontmatter.tools) ? frontmatter.tools.join(', ') : (frontmatter.tools || ''), model: Array.isArray(frontmatter.model) ? frontmatter.model.join(', ') : (frontmatter.model || ''), thinkingLevel: frontmatter.thinkingLevel || frontmatter['thinking-level'] || '', spawns: Array.isArray(frontmatter.spawns) ? frontmatter.spawns.join(', ') : (frontmatter.spawns || ''), permissionMode: frontmatter.permissionMode || '', skills: frontmatter.skills || '' };
|
|
698
732
|
}
|
|
699
733
|
}));
|
|
700
734
|
}
|
|
@@ -807,7 +841,7 @@ class AgentsService {
|
|
|
807
841
|
/**
|
|
808
842
|
* 创建代理
|
|
809
843
|
*/
|
|
810
|
-
createAgent({ fileName, scope, projectPath, name, description, tools, model, permissionMode, skills, systemPrompt, configMode, configFile, configContent }) {
|
|
844
|
+
createAgent({ fileName, scope, projectPath, name, description, tools, model, thinkingLevel, spawns, permissionMode, skills, systemPrompt, configMode, configFile, configContent }) {
|
|
811
845
|
const safeFileName = assertSafeAgentFileName(fileName);
|
|
812
846
|
|
|
813
847
|
if (this.platform === 'codex') {
|
|
@@ -836,6 +870,8 @@ class AgentsService {
|
|
|
836
870
|
const frontmatterData = { name: (name || safeFileName), description };
|
|
837
871
|
if (tools) frontmatterData.tools = tools;
|
|
838
872
|
if (model) frontmatterData.model = model;
|
|
873
|
+
if (thinkingLevel) frontmatterData.thinkingLevel = thinkingLevel;
|
|
874
|
+
if (spawns) frontmatterData.spawns = spawns;
|
|
839
875
|
if (permissionMode) frontmatterData.permissionMode = permissionMode;
|
|
840
876
|
if (skills) frontmatterData.skills = skills;
|
|
841
877
|
|
|
@@ -848,7 +884,7 @@ class AgentsService {
|
|
|
848
884
|
/**
|
|
849
885
|
* 更新代理
|
|
850
886
|
*/
|
|
851
|
-
updateAgent({ fileName, scope, projectPath, name, description, tools, model, permissionMode, skills, systemPrompt, configMode, configFile, configContent }) {
|
|
887
|
+
updateAgent({ fileName, scope, projectPath, name, description, tools, model, thinkingLevel, spawns, permissionMode, skills, systemPrompt, configMode, configFile, configContent }) {
|
|
852
888
|
const safeFileName = assertSafeAgentFileName(fileName);
|
|
853
889
|
|
|
854
890
|
if (this.platform === 'codex') {
|
|
@@ -869,6 +905,8 @@ class AgentsService {
|
|
|
869
905
|
};
|
|
870
906
|
if (tools) frontmatterData.tools = tools;
|
|
871
907
|
if (model) frontmatterData.model = model;
|
|
908
|
+
if (thinkingLevel) frontmatterData.thinkingLevel = thinkingLevel;
|
|
909
|
+
if (spawns) frontmatterData.spawns = spawns;
|
|
872
910
|
if (permissionMode) frontmatterData.permissionMode = permissionMode;
|
|
873
911
|
if (skills) frontmatterData.skills = skills;
|
|
874
912
|
|
|
@@ -24,7 +24,7 @@ const {
|
|
|
24
24
|
upsertSyncedChannels
|
|
25
25
|
} = require('../../../server/services/channel-sync-utils');
|
|
26
26
|
|
|
27
|
-
const OMP_THINKING_SUFFIX_RE = /:(minimal|low|medium|high|xhigh|off)
|
|
27
|
+
const OMP_THINKING_SUFFIX_RE = /:(minimal|low|medium|high|xhigh|max|off)$/i;
|
|
28
28
|
|
|
29
29
|
let configuredState = {
|
|
30
30
|
channels: PATHS.channels?.omp,
|
|
@@ -157,7 +157,7 @@ function extractModelId(body, contentType = '') {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
function normalizeModelId(value) {
|
|
160
|
-
return String(value || '').trim().replace(/:(minimal|low|medium|high|xhigh|off)
|
|
160
|
+
return String(value || '').trim().replace(/:(minimal|low|medium|high|xhigh|max|off)$/i, '');
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
function channelSupportsModel(channel, modelId) {
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
getOmpPaths,
|
|
5
|
+
readOmpSettingsStrict,
|
|
6
|
+
readYamlFile,
|
|
7
|
+
writeOmpSettingsAtomic
|
|
8
|
+
} = require('./config');
|
|
9
|
+
const { getPlatformCatalog } = require('../../../server/services/platform-catalog');
|
|
10
|
+
|
|
11
|
+
const OMP_MODEL_ROLE_KEYS = Object.freeze([
|
|
12
|
+
'default',
|
|
13
|
+
'smol',
|
|
14
|
+
'slow',
|
|
15
|
+
'plan',
|
|
16
|
+
'commit',
|
|
17
|
+
'vision',
|
|
18
|
+
'designer',
|
|
19
|
+
'task',
|
|
20
|
+
'advisor',
|
|
21
|
+
'tiny'
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
const OMP_THINKING_LEVELS = new Set([
|
|
25
|
+
'minimal',
|
|
26
|
+
'low',
|
|
27
|
+
'medium',
|
|
28
|
+
'high',
|
|
29
|
+
'xhigh',
|
|
30
|
+
'max'
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
function isPlainObject(value) {
|
|
34
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function parseModelRoleSelector(value) {
|
|
38
|
+
const selector = typeof value === 'string' ? value.trim() : '';
|
|
39
|
+
const suffix = selector.match(/:(minimal|low|medium|high|xhigh|max)$/i);
|
|
40
|
+
if (!suffix) return { model: selector, thinkingLevel: '' };
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
model: selector.slice(0, -suffix[0].length),
|
|
44
|
+
thinkingLevel: suffix[1].toLowerCase()
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function normalizeProviderId(value = '') {
|
|
49
|
+
return String(value || '')
|
|
50
|
+
.trim()
|
|
51
|
+
.toLowerCase()
|
|
52
|
+
.replace(/[^a-z0-9_-]/g, '-')
|
|
53
|
+
.replace(/-+/g, '-')
|
|
54
|
+
.replace(/^-|-$/g, '')
|
|
55
|
+
|| 'coding-tool-x';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function readEnabledOmpChannels() {
|
|
59
|
+
const driver = getPlatformCatalog().driver('omp', 'channels');
|
|
60
|
+
const result = driver?.getEnabled?.();
|
|
61
|
+
if (!result || result.status !== 'ok') {
|
|
62
|
+
throw new Error(result?.error || 'Unable to read enabled OMP channels');
|
|
63
|
+
}
|
|
64
|
+
const channels = Array.isArray(result.data)
|
|
65
|
+
? result.data
|
|
66
|
+
: (Array.isArray(result.data?.channels) ? result.data.channels : []);
|
|
67
|
+
return channels.filter(channel => channel && channel.enabled !== false);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function modelIdFromConfig(value) {
|
|
71
|
+
const candidate = typeof value === 'string' ? value : (value?.id || value?.name || '');
|
|
72
|
+
return String(candidate || '').trim().replace(/:(minimal|low|medium|high|xhigh|max|off)$/i, '');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function uniqueModelIds(values = []) {
|
|
76
|
+
const seen = new Set();
|
|
77
|
+
const result = [];
|
|
78
|
+
for (const value of values) {
|
|
79
|
+
const modelId = modelIdFromConfig(value);
|
|
80
|
+
const key = modelId.toLowerCase();
|
|
81
|
+
if (!modelId || seen.has(key)) continue;
|
|
82
|
+
seen.add(key);
|
|
83
|
+
result.push(modelId);
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function getManagedProviderId(channel = {}) {
|
|
89
|
+
const rawId = channel.managedProviderId
|
|
90
|
+
|| channel.extra?.managedProviderId
|
|
91
|
+
|| channel.providerKey
|
|
92
|
+
|| channel.provider
|
|
93
|
+
|| channel.name
|
|
94
|
+
|| channel.id;
|
|
95
|
+
const normalizedId = normalizeProviderId(rawId);
|
|
96
|
+
return normalizedId.startsWith('ctx-') ? normalizedId : `ctx-${normalizedId}`;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function findConfiguredProviderId(providers, managedProviderId) {
|
|
100
|
+
const target = normalizeProviderId(managedProviderId);
|
|
101
|
+
return Object.keys(providers).find(providerId => normalizeProviderId(providerId) === target)
|
|
102
|
+
|| managedProviderId;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function collectNativeOAuthModelOptions(channel) {
|
|
106
|
+
const rawProviderId = String(channel.oauthProviderId || channel.authRef?.providerId || '').trim();
|
|
107
|
+
if (!rawProviderId) return [];
|
|
108
|
+
const providerId = normalizeProviderId(rawProviderId);
|
|
109
|
+
const allowedModels = Array.isArray(channel.allowedModels) ? channel.allowedModels : [];
|
|
110
|
+
const candidates = allowedModels.length > 0
|
|
111
|
+
? allowedModels
|
|
112
|
+
: [
|
|
113
|
+
...(Array.isArray(channel.models) ? channel.models : []),
|
|
114
|
+
channel.model
|
|
115
|
+
];
|
|
116
|
+
return uniqueModelIds(candidates).map(modelId => `${providerId}/${modelId}`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function collectManagedChannelModelOptions(channel, providers) {
|
|
120
|
+
const managedProviderId = getManagedProviderId(channel);
|
|
121
|
+
const configuredProviderId = findConfiguredProviderId(providers, managedProviderId);
|
|
122
|
+
const configuredModels = providers[configuredProviderId]?.models;
|
|
123
|
+
const channelModels = [
|
|
124
|
+
...(Array.isArray(channel.models) ? channel.models : []),
|
|
125
|
+
...(Array.isArray(channel.allowedModels) ? channel.allowedModels : []),
|
|
126
|
+
channel.model,
|
|
127
|
+
channel.speedTestModel,
|
|
128
|
+
...(Array.isArray(channel.modelBindings)
|
|
129
|
+
? channel.modelBindings.map(binding => binding?.modelId || binding?.id || binding)
|
|
130
|
+
: [])
|
|
131
|
+
];
|
|
132
|
+
const modelIds = uniqueModelIds(Array.isArray(configuredModels) && configuredModels.length > 0
|
|
133
|
+
? configuredModels
|
|
134
|
+
: channelModels);
|
|
135
|
+
return modelIds.map(modelId => `${configuredProviderId}/${modelId}`);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function collectModelOptions(modelsConfig = {}, channels = []) {
|
|
139
|
+
const options = new Set();
|
|
140
|
+
const providers = isPlainObject(modelsConfig.providers) ? modelsConfig.providers : {};
|
|
141
|
+
for (const channel of channels) {
|
|
142
|
+
const isNativeOAuth = channel.authMode === 'oauth' && !String(channel.baseUrl || '').trim();
|
|
143
|
+
const channelOptions = isNativeOAuth
|
|
144
|
+
? collectNativeOAuthModelOptions(channel)
|
|
145
|
+
: collectManagedChannelModelOptions(channel, providers);
|
|
146
|
+
channelOptions.forEach(option => options.add(option));
|
|
147
|
+
}
|
|
148
|
+
return [...options].sort((left, right) => left.localeCompare(right));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function readOmpModelRoleSettings() {
|
|
152
|
+
const settings = readOmpSettingsStrict();
|
|
153
|
+
const modelRoles = isPlainObject(settings.modelRoles) ? settings.modelRoles : {};
|
|
154
|
+
const roles = Object.fromEntries(OMP_MODEL_ROLE_KEYS.map((key) => [
|
|
155
|
+
key,
|
|
156
|
+
parseModelRoleSelector(modelRoles[key])
|
|
157
|
+
]));
|
|
158
|
+
const modelsConfig = readYamlFile(getOmpPaths().modelsYml, {});
|
|
159
|
+
const modelOptions = collectModelOptions(modelsConfig, readEnabledOmpChannels());
|
|
160
|
+
const optionSet = new Set(modelOptions);
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
roles,
|
|
164
|
+
modelOptions,
|
|
165
|
+
unavailableRoles: Object.fromEntries(Object.entries(roles)
|
|
166
|
+
.filter(([, role]) => role.model && !optionSet.has(role.model))
|
|
167
|
+
.map(([key]) => [key, true]))
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function updateOmpModelRoleSettings(input) {
|
|
172
|
+
if (!isPlainObject(input)) {
|
|
173
|
+
throw new Error('roles must be an object');
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const settings = readOmpSettingsStrict();
|
|
177
|
+
const modelRoles = isPlainObject(settings.modelRoles) ? { ...settings.modelRoles } : {};
|
|
178
|
+
const currentModelRoles = isPlainObject(settings.modelRoles) ? settings.modelRoles : {};
|
|
179
|
+
const modelOptions = new Set(collectModelOptions(
|
|
180
|
+
readYamlFile(getOmpPaths().modelsYml, {}),
|
|
181
|
+
readEnabledOmpChannels()
|
|
182
|
+
));
|
|
183
|
+
for (const [key, role] of Object.entries(input)) {
|
|
184
|
+
if (!OMP_MODEL_ROLE_KEYS.includes(key)) {
|
|
185
|
+
throw new Error(`roles.${key} is not a supported OMP model role`);
|
|
186
|
+
}
|
|
187
|
+
if (!isPlainObject(role) || typeof role.model !== 'string') {
|
|
188
|
+
throw new Error(`roles.${key}.model must be a string`);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const suppliedModel = role.model.trim();
|
|
192
|
+
if (suppliedModel.length > 500) {
|
|
193
|
+
throw new Error(`roles.${key}.model must be 500 characters or fewer`);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const suppliedThinkingLevel = role.thinkingLevel == null ? '' : role.thinkingLevel;
|
|
197
|
+
if (typeof suppliedThinkingLevel !== 'string'
|
|
198
|
+
|| (suppliedThinkingLevel && !OMP_THINKING_LEVELS.has(suppliedThinkingLevel))) {
|
|
199
|
+
throw new Error(`roles.${key}.thinkingLevel must be one of ${[...OMP_THINKING_LEVELS].join(', ')}`);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (!suppliedModel) {
|
|
203
|
+
delete modelRoles[key];
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const parsed = parseModelRoleSelector(suppliedModel);
|
|
208
|
+
if (!parsed.model) {
|
|
209
|
+
throw new Error(`roles.${key}.model must include a model selector`);
|
|
210
|
+
}
|
|
211
|
+
const thinkingLevel = suppliedThinkingLevel || parsed.thinkingLevel;
|
|
212
|
+
const nextSelector = thinkingLevel ? `${parsed.model}:${thinkingLevel}` : parsed.model;
|
|
213
|
+
const currentSelector = String(currentModelRoles[key] || '').trim();
|
|
214
|
+
if (!modelOptions.has(parsed.model) && nextSelector !== currentSelector) {
|
|
215
|
+
throw new Error(`roles.${key}.model must use a model from an enabled OMP channel`);
|
|
216
|
+
}
|
|
217
|
+
modelRoles[key] = nextSelector;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (Object.keys(modelRoles).length > 0) settings.modelRoles = modelRoles;
|
|
221
|
+
else delete settings.modelRoles;
|
|
222
|
+
|
|
223
|
+
writeOmpSettingsAtomic(settings);
|
|
224
|
+
return readOmpModelRoleSettings();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
module.exports = {
|
|
228
|
+
OMP_MODEL_ROLE_KEYS,
|
|
229
|
+
OMP_THINKING_LEVELS,
|
|
230
|
+
collectModelOptions,
|
|
231
|
+
readEnabledOmpChannels,
|
|
232
|
+
parseModelRoleSelector,
|
|
233
|
+
readOmpModelRoleSettings,
|
|
234
|
+
updateOmpModelRoleSettings
|
|
235
|
+
};
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"resourceTypes": {
|
|
46
46
|
"skills": true,
|
|
47
47
|
"commands": true,
|
|
48
|
-
"agents":
|
|
48
|
+
"agents": true,
|
|
49
49
|
"plugins": true
|
|
50
50
|
},
|
|
51
51
|
"agentCapabilities": {
|
|
52
|
-
"projectScope":
|
|
52
|
+
"projectScope": true,
|
|
53
53
|
"repoOperations": true
|
|
54
54
|
},
|
|
55
55
|
"skillActivation": {
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
]
|
|
74
74
|
},
|
|
75
75
|
"agents": {
|
|
76
|
-
"canonicalRoot":
|
|
76
|
+
"canonicalRoot": ".omp/agents"
|
|
77
77
|
},
|
|
78
78
|
"commands": {
|
|
79
79
|
"canonicalRoot": ".omp/commands",
|
|
@@ -9,6 +9,10 @@ const {
|
|
|
9
9
|
} = require('../../config/model-metadata');
|
|
10
10
|
const { getPlatformCatalog } = require('../services/platform-catalog');
|
|
11
11
|
const { loadConfig, saveConfig } = require('../../config/loader');
|
|
12
|
+
const {
|
|
13
|
+
readOmpModelRoleSettings,
|
|
14
|
+
updateOmpModelRoleSettings
|
|
15
|
+
} = require('../../platforms/drivers/omp/model-role-settings');
|
|
12
16
|
const {
|
|
13
17
|
MODEL_SCHEMA_VERSION,
|
|
14
18
|
getPublicModelFieldSchema,
|
|
@@ -269,4 +273,27 @@ function handleDeleteModelOverride(req, res) {
|
|
|
269
273
|
router.delete('/model-settings/:modelId', handleDeleteModelOverride);
|
|
270
274
|
router.delete('/model-metadata/:modelId', handleDeleteModelOverride);
|
|
271
275
|
|
|
276
|
+
router.get('/omp-model-roles', (req, res) => {
|
|
277
|
+
try {
|
|
278
|
+
res.json({ success: true, ...readOmpModelRoleSettings() });
|
|
279
|
+
} catch (error) {
|
|
280
|
+
console.error('Error getting OMP model roles:', error);
|
|
281
|
+
res.status(500).json({ error: error.message });
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
router.put('/omp-model-roles', (req, res) => {
|
|
286
|
+
try {
|
|
287
|
+
const { roles } = req.body || {};
|
|
288
|
+
if (!roles || typeof roles !== 'object' || Array.isArray(roles)) {
|
|
289
|
+
return res.status(400).json({ error: 'roles must be an object' });
|
|
290
|
+
}
|
|
291
|
+
res.json({ success: true, ...updateOmpModelRoleSettings(roles) });
|
|
292
|
+
} catch (error) {
|
|
293
|
+
console.error('Error saving OMP model roles:', error);
|
|
294
|
+
const isValidationError = /^roles(?:\.| must be)/.test(error.message);
|
|
295
|
+
res.status(isValidationError ? 400 : 500).json({ error: error.message });
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
272
299
|
module.exports = router;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const MODEL_SCHEMA_VERSION = 2;
|
|
4
4
|
const MODEL_METADATA_MODES = ['auto', 'hybrid', 'manual'];
|
|
5
5
|
const THINKING_EFFORT_LEVELS = ['minimal', 'low', 'medium', 'high', 'xhigh'];
|
|
6
|
-
const THINKING_SELECTOR_LEVELS = [...THINKING_EFFORT_LEVELS, 'off'];
|
|
6
|
+
const THINKING_SELECTOR_LEVELS = [...THINKING_EFFORT_LEVELS, 'max', 'off'];
|
|
7
7
|
const THINKING_MODES = [
|
|
8
8
|
'effort',
|
|
9
9
|
'budget',
|
|
@@ -173,7 +173,7 @@ function compactObject(value = {}) {
|
|
|
173
173
|
|
|
174
174
|
function splitModelSelector(value = '') {
|
|
175
175
|
const raw = String(value || '').trim();
|
|
176
|
-
const match = raw.match(/:(minimal|low|medium|high|xhigh|off)$/i);
|
|
176
|
+
const match = raw.match(/:(minimal|low|medium|high|xhigh|max|off)$/i);
|
|
177
177
|
if (!match) return { modelId: raw, thinkingLevel: null };
|
|
178
178
|
return {
|
|
179
179
|
modelId: raw.slice(0, -match[0].length),
|