switchboard-router 0.9.3 → 0.9.6

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.
Files changed (136) hide show
  1. package/app/.next/static/chunks/{1321-6bd6f91d24e9863e.js → 1321-d31d839184ff87c5.js} +1 -1
  2. package/app/.next/static/chunks/app/(dashboard)/dashboard/agent-library/page-40f3ca16440f8e17.js +1 -0
  3. package/app/{.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-b1e9603ce7be0155.js → .next/static/chunks/app/(dashboard)/dashboard/skills/page-645e7c5ec034fe8c.js} +1 -1
  4. package/app/.next/static/css/196a6347b9104610.css +1 -0
  5. package/app/.next-cli-build/BUILD_ID +1 -1
  6. package/app/.next-cli-build/app-path-routes-manifest.json +12 -12
  7. package/app/.next-cli-build/build-manifest.json +2 -2
  8. package/app/.next-cli-build/prerender-manifest.json +3 -3
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page_client-reference-manifest.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page_client-reference-manifest.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  37. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  39. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  40. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  41. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  42. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  43. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  44. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  45. package/app/.next-cli-build/server/app/_not-found.rsc +4 -4
  46. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
  47. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
  48. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  49. package/app/.next-cli-build/server/app/api/agent-library/catalog/route.js +1 -1
  50. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js +2 -2
  51. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
  52. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  53. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
  54. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  55. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
  56. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
  57. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +2 -2
  58. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +1 -1
  59. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  60. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js +2 -2
  61. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js +2 -2
  62. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
  63. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +1 -1
  64. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  65. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  66. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  67. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +1 -1
  68. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
  69. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  70. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  71. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  72. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  73. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  74. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  75. package/app/.next-cli-build/server/app/callback.html +1 -1
  76. package/app/.next-cli-build/server/app/callback.rsc +4 -4
  77. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
  78. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  79. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +4 -4
  80. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  81. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  82. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  83. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  84. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  85. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +4 -4
  86. package/app/.next-cli-build/server/app/index.html +1 -1
  87. package/app/.next-cli-build/server/app/index.rsc +4 -4
  88. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +4 -4
  89. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
  90. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  91. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  92. package/app/.next-cli-build/server/app/landing.html +1 -1
  93. package/app/.next-cli-build/server/app/landing.rsc +4 -4
  94. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
  95. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  96. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +4 -4
  97. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  98. package/app/.next-cli-build/server/app/login.html +1 -1
  99. package/app/.next-cli-build/server/app/login.rsc +4 -4
  100. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
  101. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  102. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  103. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  104. package/app/.next-cli-build/server/app-paths-manifest.json +12 -12
  105. package/app/.next-cli-build/server/chunks/1350.js +1 -1
  106. package/app/.next-cli-build/server/chunks/194.js +1 -1
  107. package/app/.next-cli-build/server/chunks/369.js +2 -2
  108. package/app/.next-cli-build/server/chunks/5920.js +2 -2
  109. package/app/.next-cli-build/server/chunks/6985.js +1 -1
  110. package/app/.next-cli-build/server/chunks/7454.js +1 -1
  111. package/app/.next-cli-build/server/chunks/869.js +1 -1
  112. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  113. package/app/.next-cli-build/server/pages/404.html +1 -1
  114. package/app/.next-cli-build/server/pages/500.html +1 -1
  115. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  116. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  117. package/app/.next-cli-build/static/chunks/{1321-6bd6f91d24e9863e.js → 1321-d31d839184ff87c5.js} +1 -1
  118. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/agent-library/page-40f3ca16440f8e17.js +1 -0
  119. package/app/{.next/static/chunks/app/(dashboard)/dashboard/skills/page-b1e9603ce7be0155.js → .next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-645e7c5ec034fe8c.js} +1 -1
  120. package/app/.next-cli-build/static/css/196a6347b9104610.css +1 -0
  121. package/app/open-sse/identity/tls/bin/darwin/arm64/switchboard-claude-tls +0 -0
  122. package/app/open-sse/identity/tls/bin/darwin/x64/switchboard-claude-tls +0 -0
  123. package/app/open-sse/identity/tls/bin/linux/arm64/switchboard-claude-tls +0 -0
  124. package/app/open-sse/identity/tls/bin/linux/x64/switchboard-claude-tls +0 -0
  125. package/app/open-sse/identity/tls/bin/win32/arm64/switchboard-claude-tls.exe +0 -0
  126. package/app/open-sse/identity/tls/bin/win32/x64/switchboard-claude-tls.exe +0 -0
  127. package/app/package.json +1 -1
  128. package/package.json +1 -1
  129. package/app/.next/static/chunks/app/(dashboard)/dashboard/agent-library/page-cf3bc192f7a27304.js +0 -1
  130. package/app/.next/static/css/c5928b380ef8a163.css +0 -1
  131. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/agent-library/page-cf3bc192f7a27304.js +0 -1
  132. package/app/.next-cli-build/static/css/c5928b380ef8a163.css +0 -1
  133. /package/app/.next/static/{kGdbG3TEpkBeoqsRS2Mre → Dj3B1SY51GKVJr4nnDlac}/_buildManifest.js +0 -0
  134. /package/app/.next/static/{kGdbG3TEpkBeoqsRS2Mre → Dj3B1SY51GKVJr4nnDlac}/_ssgManifest.js +0 -0
  135. /package/app/.next-cli-build/static/{kGdbG3TEpkBeoqsRS2Mre → Dj3B1SY51GKVJr4nnDlac}/_buildManifest.js +0 -0
  136. /package/app/.next-cli-build/static/{kGdbG3TEpkBeoqsRS2Mre → Dj3B1SY51GKVJr4nnDlac}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (()=>{var a={};a.id=6897,a.ids=[6897],a.modules={3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10335:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>x,handler:()=>z,routeModule:()=>y});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,32059))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,30508))),o=(0,d.p)(()=>Promise.resolve().then(c.bind(c,57097))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),q=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),r=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),s=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),t=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),u=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),v={children:["",{children:["(dashboard)",{children:["dashboard",{children:["agent-library",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,90657))),"/home/runner/work/switchboard-router/switchboard-router/src/app/(dashboard)/dashboard/agent-library/page.js"]}]},{"global-error":[u,"next/dist/client/components/builtin/global-error.js"]},[]]},{"global-error":[t,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"/home/runner/work/switchboard-router/switchboard-router/src/app/(dashboard)/layout.js"],error:[o,"/home/runner/work/switchboard-router/switchboard-router/src/app/(dashboard)/error.js"],"global-error":[p,"next/dist/client/components/builtin/global-error.js"],"not-found":[q,"next/dist/client/components/builtin/not-found.js"],forbidden:[r,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[s,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]},{layout:[i,"/home/runner/work/switchboard-router/switchboard-router/src/app/layout.js"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]}.children,w=(0,e.H)({tree:v,page:"/(dashboard)/dashboard/agent-library/page",pathname:"/dashboard/agent-library",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),x=w.__next_app__,y=w.routeModule,z=w.handler},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33614:(a,b,c)=>{Promise.resolve().then(c.bind(c,58675))},33873:a=>{"use strict";a.exports=require("path")},38522:a=>{"use strict";a.exports=require("node:zlib")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},46293:a=>{"use strict";a.exports=require("sql.js")},50412:(a,b,c)=>{"use strict";c.d(b,{x0:()=>x.default,Ex:()=>j.default,$n:()=>d.default,nh:()=>C.default,Zp:()=>g.default,Qv:()=>i.CardSkeleton,CK:()=>o.default,uo:()=>h.ConfirmModal,G9:()=>t.default,wI:()=>w.default,vj:()=>v.default,vE:()=>u.default,pd:()=>e.default,Mh:()=>s.default,uR:()=>n.default,Nf:()=>p.default,aF:()=>h.default,rq:()=>m.default,gw:()=>y.default,LF:()=>l.default,Wx:()=>B.default,gM:()=>r.default,Iz:()=>z.default,l6:()=>f.default,lM:()=>k.default,m_:()=>A.default,jK:()=>q.default});var d=c(99070),e=c(83552),f=c(4770),g=c(17660),h=c(95145),i=c(74812);c(25919);var j=c(75171),k=c(95514);c(53845),c(19308),c(42196),c(32456),c(48781);var l=c(79346),m=c(83352),n=c(39645),o=c(62727),p=c(20084),q=c(87226);c(267),c(3236),c(11229);var r=c(91809);c(4481);var s=c(5291);c(56110);var t=c(51109),u=c(79488),v=c(43182),w=c(51585),x=c(67738),y=c(50585),z=c(91099),A=c(32971),B=c(11633),C=c(38930);c(5993),c(53838)},55511:a=>{"use strict";a.exports=require("crypto")},58675:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>h});var d=c(48249),e=c(67484),f=c(50412),g=c(78097);function h(){let[a,b]=(0,e.useState)(null),[c,h]=(0,e.useState)(!0),[j,k]=(0,e.useState)(""),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(null),[p,q]=(0,e.useState)(null),[r,s]=(0,e.useState)("overview"),[t,u]=(0,e.useState)({id:"",name:"",transport:"stdio",command:"npx",args:"-y @modelcontextprotocol/server-filesystem .",url:"",notes:""}),[v,w]=(0,e.useState)([]),[x,y]=(0,e.useState)(""),[z,A]=(0,e.useState)(""),[B,C]=(0,e.useState)(""),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(""),[H,I]=(0,e.useState)(""),[J,K]=(0,e.useState)({}),[L,M]=(0,e.useState)(null),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)(""),R=(0,e.useCallback)(async()=>{h(!0);try{let a=await fetch("/api/agent-library",{cache:"no-store"}),c=await a.json();if(!a.ok)throw Error(c.error||"Load failed");b(c)}catch(a){m({type:"error",text:a.message})}finally{h(!1)}},[]),S=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/agent-library/updates",{cache:"no-store"}),b=await a.json();if(!a.ok)return;let c={};for(let a of b.results||[])c[a.id]=a;K(c)}catch{}},[]),T=a?.settings||{},U=a?.agents||{};async function V(a){k("settings"),m(null);try{let b=await fetch("/api/agent-library",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();if(!b.ok)throw Error(c.error||"Save failed");m({type:"success",text:"Settings saved"}),await R()}catch(a){m({type:"error",text:a.message})}finally{k("")}}async function W(a){k(a),m(null),q(null);try{let b=await fetch("/api/agent-library/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a,confirm:"clean"===a||void 0})}),c=await b.json();if(!b.ok)throw Error(c.error||c.message||"Sync failed");q(c),m({type:c.conflictCount?"warn":"success",text:"dry-run"===a?`Dry-run: ${c.summary?.skillsSynced??0} skill ops, ${c.summary?.mcpOk??0} MCP ok, ${c.conflictCount||0} conflicts`:"clean"===a?"Removed Switchboard-managed projections only":`Applied: ${c.summary?.skillsSynced??0} skills synced, ${c.conflictCount||0} conflicts protected`}),await R()}catch(a){m({type:"error",text:a.message})}finally{k("")}}async function X(){k("doctor");try{let a=await fetch("/api/agent-library/doctor",{cache:"no-store"}),b=await a.json();if(!a.ok)throw Error(b.error||"Doctor failed");o(b),m({type:b.ok?"success":"warn",text:b.ok?"Doctor: no blocking errors":`Doctor: ${b.issues?.filter(a=>"error"===a.severity).length||0} errors`})}catch(a){m({type:"error",text:a.message})}finally{k("")}}async function Y(a){a?.preventDefault?.(),k("mcp");try{let a=t.args?t.args.split(/\s+/).filter(Boolean):[],b=await fetch("/api/agent-library/mcp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t.id,name:t.name||t.id,transport:t.transport,command:"stdio"===t.transport?t.command:void 0,args:"stdio"===t.transport?a:void 0,url:"stdio"!==t.transport?t.url:void 0,notes:t.notes})}),c=await b.json();if(!b.ok)throw Error(c.error||"MCP save failed");c.warnings?.length?m({type:"warn",text:c.warnings.join(" \xb7 ")}):m({type:"success",text:`MCP ${c.server?.id} saved (Apply to project)`}),u({id:"",name:"",transport:"stdio",command:"npx",args:"",url:"",notes:""}),await R()}catch(a){m({type:"error",text:a.message})}finally{k("")}}async function Z(a){if(await (0,g.l)({message:`Remove MCP ${a} from library? (targets updated on next Apply)`,confirmText:"Continue"})){k("mcp-del");try{let b=await fetch(`/api/agent-library/mcp?id=${encodeURIComponent(a)}`,{method:"DELETE"}),c=await b.json();if(!b.ok)throw Error(c.error);m({type:"success",text:"MCP removed from library"}),await R()}catch(a){m({type:"error",text:a.message})}finally{k("")}}}async function $(a){if(await (0,g.l)({message:`Remove skill ${a} from library?`,confirmText:"Continue"})){k("skill-del");try{let b=await fetch(`/api/agent-library/skills?id=${encodeURIComponent(a)}`,{method:"DELETE"}),c=await b.json();if(!b.ok)throw Error(c.error);m({type:"success",text:"Skill removed from library"}),await R(),await S()}catch(a){m({type:"error",text:a.message})}finally{k("")}}}async function _(){k("skill-add");try{let a=await fetch("/api/agent-library/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:F,markdown:H,source:"manual"})}),b=await a.json();if(!a.ok)throw Error(b.error);m({type:"success",text:`Skill ${b.id} installed in library`}),G(""),I(""),await R()}catch(a){m({type:"error",text:a.message})}finally{k("")}}async function aa(a){k("upd-preview"),O(!1);try{let b=await fetch("/api/agent-library/updates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview",skillId:a})}),c=await b.json();if(!b.ok||!c.ok)throw Error(c.message||c.error||"Preview failed");M({id:a,markdown:c.markdown,contentHash:c.contentHash})}catch(a){m({type:"error",text:a.message})}finally{k("")}}async function ab(){if(L){k("upd-apply");try{let a=await fetch("/api/agent-library/updates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update",skillId:L.id,confirmed:N,expectedHash:L.contentHash})}),b=await a.json();if(!a.ok||!b.ok)throw Error(b.message||b.error||"Update failed");m({type:"success",text:b.warning||`Updated ${b.id}`}),M(null),O(!1),await R(),await S()}catch(a){m({type:"error",text:a.message})}finally{k("")}}}async function ac(a){k("preview");try{let b=await fetch("/api/agent-library/catalog",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview",url:a})}),c=await b.json();if(!b.ok||!c.ok)throw Error(c.error||"Preview failed");C(c.preview||""),m({type:"success",text:`Preview loaded (${c.bytes} bytes)`})}catch(a){m({type:"error",text:a.message})}finally{k("")}}async function ad(){k("catalog");try{let a=await fetch("/api/agent-library/catalog",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"install",skillId:z,url:x,confirmed:D})}),b=await a.json();if(!a.ok)throw Error(b.message||b.error||"Install failed");m({type:"success",text:b.warning||`Installed ${b.id}`}),E(!1),await R(),await S()}catch(a){m({type:"error",text:a.message})}finally{k("")}}async function ae(){k("export");try{let a=await fetch("/api/agent-library/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({destPath:P||void 0})}),b=await a.json();if(!a.ok)throw Error(b.message||b.error||"Export failed");m({type:"success",text:`Exported AgentSync layout to ${b.path}`})}catch(a){m({type:"error",text:a.message})}finally{k("")}}return(0,d.jsxs)("div",{className:"max-w-5xl mx-auto space-y-5 pb-12",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Agent library"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted leading-relaxed max-w-2xl",children:["One Switchboard-owned library of ",(0,d.jsx)("strong",{className:"text-text-main",children:"skills"})," and"," ",(0,d.jsx)("strong",{className:"text-text-main",children:"MCP servers"}),", projected into Claude Code, Codex, OpenCode, Gemini CLI, and Cursor. Managed entries use the"," ",(0,d.jsx)("code",{className:"text-[11px] font-mono",children:"sb-"})," namespace so we never overwrite your existing skills or MCP keys."]})]}),l&&(0,d.jsx)("div",{className:`text-xs px-3 py-2 rounded-lg border ${"success"===l.type?"bg-green-500/10 border-green-500/30 text-green-600 dark:text-green-400":"warn"===l.type?"bg-amber-500/10 border-amber-500/30 text-amber-700 dark:text-amber-400":"bg-red-500/10 border-red-500/30 text-red-500"}`,children:l.text}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)("label",{className:"flex items-center gap-2 text-sm text-text-main cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",className:"accent-[var(--color-primary)]","aria-label":"Sync enabled",checked:!1!==T.enabled,disabled:!!j,onChange:a=>V({enabled:a.target.checked})}),"Sync enabled"]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",disabled:!!j||!1===T.enabled,loading:"dry-run"===j,onClick:()=>W("dry-run"),children:"Dry-run"}),(0,d.jsx)(f.$n,{size:"sm",disabled:!!j||!1===T.enabled,loading:"apply"===j,onClick:()=>W("apply"),children:"Apply sync"}),(0,d.jsx)(f.$n,{size:"sm",variant:"outline",disabled:!!j,loading:"doctor"===j,onClick:X,children:"Doctor"})]})]}),(0,d.jsxs)("p",{className:"text-[11px] text-text-subtle mt-2 font-mono break-all",children:["Library: ",a?.libraryRoot||"…",T.linkMode?` \xb7 mode=${T.linkMode}`:"",T.scope?` \xb7 scope=${T.scope}`:""]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1 border-b border-border pb-0",children:[{id:"overview",label:"Overview"},{id:"skills",label:"Skills"},{id:"mcp",label:"MCP"},{id:"catalog",label:"Catalog"},{id:"advanced",label:"Advanced"}].map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>s(a.id),className:`px-3 py-2 text-xs font-medium rounded-t-md transition-colors ${r===a.id?"bg-surface border border-border border-b-surface text-primary -mb-px":"text-text-muted hover:text-text-main"}`,children:a.label},a.id))}),c&&(0,d.jsxs)("p",{className:"text-sm text-text-muted flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),"Loading…"]}),!c&&"overview"===r&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"How it works"}),(0,d.jsxs)("ol",{className:"text-xs text-text-muted space-y-1.5 list-decimal pl-4 leading-relaxed",children:[(0,d.jsxs)("li",{children:["Skills and MCP servers live only in Switchboard's library (",(0,d.jsx)("code",{className:"font-mono",children:"~/.switchboard/agent-library"}),")."]}),(0,d.jsxs)("li",{children:[(0,d.jsx)("strong",{className:"text-text-main",children:"Apply sync"})," projects them into each enabled agent under namespaced paths/keys (",(0,d.jsx)("code",{className:"font-mono",children:"sb-*"}),")."]}),(0,d.jsxs)("li",{children:["If a path already exists and is ",(0,d.jsx)("em",{children:"not"})," marked managed, we"," ",(0,d.jsx)("strong",{className:"text-text-main",children:"skip"})," it (never overwrite)."]}),(0,d.jsx)("li",{children:"Turn individual agents or skills/MCP off with the toggles below."})]})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-3",children:"Targets"}),(0,d.jsx)("div",{className:"space-y-2",children:Object.values(U).map(a=>{let b=T.targets?.[a.id]||{skills:!0,mcp:!0};return(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 py-2 border-b border-border-subtle last:border-0",children:[(0,d.jsx)("span",{className:"text-sm text-text-main",children:a.label}),(0,d.jsxs)("div",{className:"flex gap-4 text-xs text-text-muted",children:[(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox","aria-label":`${a.label} skills projection`,checked:!1!==b.skills,disabled:!a.supportsSkills||!!j,onChange:c=>V({targets:{...T.targets,[a.id]:{...b,skills:c.target.checked}}})}),"Skills"]}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox","aria-label":`${a.label} MCP projection`,checked:!1!==b.mcp,disabled:!a.supportsMcp||!!j,onChange:c=>V({targets:{...T.targets,[a.id]:{...b,mcp:c.target.checked}}})}),"MCP"]})]})]},a.id)})})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-3",children:"Safety & link mode"}),(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 text-xs",children:[(0,d.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Link mode"}),(0,d.jsxs)("select",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-text-main",value:T.linkMode||"copy",disabled:!!j,onChange:a=>V({linkMode:a.target.value}),children:[(0,d.jsx)("option",{value:"copy",children:"Copy (safe default on Windows)"}),(0,d.jsx)("option",{value:"symlink",children:"Symlink (instant updates; may need privileges on Windows)"})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Scope"}),(0,d.jsxs)("select",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-text-main",value:T.scope||"global",disabled:!!j,onChange:a=>V({scope:a.target.value,projectPath:"project"===a.target.value?T.projectPath||"":null}),children:[(0,d.jsx)("option",{value:"global",children:"Global (user home agents)"}),(0,d.jsx)("option",{value:"project",children:"Project (paths under project folder)"})]})]}),"project"===T.scope&&(0,d.jsxs)("label",{className:"flex flex-col gap-1 sm:col-span-2",children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Project path (absolute)"}),(0,d.jsx)("input",{className:"bg-surface border border-border rounded-md px-2 py-1.5 font-mono text-text-main",value:T.projectPath||"",placeholder:"/Users/you/my-app",disabled:!!j,onChange:a=>V({projectPath:a.target.value})})]}),(0,d.jsxs)("label",{className:"flex items-start gap-2 sm:col-span-2 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",className:"mt-0.5","aria-label":"Never overwrite user-owned files",checked:!1!==T.neverOverwriteUser,disabled:!!j,onChange:async a=>{a.target.checked?V({neverOverwriteUser:!0}):await (0,g.l)({message:"Allow overwriting paths that are NOT Switchboard-managed? This can replace your personal skills/MCP. Continue?",confirmText:"Continue"})&&V({neverOverwriteUser:!1,confirmAllowOverwrite:!0})}}),(0,d.jsxs)("span",{className:"text-text-muted leading-relaxed",children:[(0,d.jsx)("strong",{className:"text-text-main",children:"Never overwrite user-owned files"})," ","(recommended). Only touch ",(0,d.jsx)("code",{className:"font-mono",children:"sb-*"})," managed entries."]})]}),(0,d.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox","aria-label":"Auto-include Switchboard product skills",checked:!1!==T.includeProductSkills,disabled:!!j,onChange:a=>V({includeProductSkills:a.target.checked})}),(0,d.jsx)("span",{className:"text-text-muted",children:"Auto-include Switchboard product skills (entry + chat)"})]})]})]}),(0,d.jsxs)("div",{className:"grid sm:grid-cols-3 gap-3",children:[(0,d.jsx)(i,{label:"Skills in library",value:String(a?.skills?.length??0)}),(0,d.jsx)(i,{label:"MCP servers",value:String(a?.mcpServers?.length??0)}),(0,d.jsx)(i,{label:"Last sync",value:a?.state?.lastSync?.at?new Date(a.state.lastSync.at).toLocaleString():"—"})]}),p&&(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Last sync detail"}),(0,d.jsx)("pre",{className:"text-[11px] font-mono text-text-muted overflow-x-auto max-h-48 bg-surface-2 p-2 rounded",children:JSON.stringify(p.summary||p,null,2)}),p.skills?.filter(a=>"conflict"===a.action).length>0&&(0,d.jsxs)("div",{className:"mt-2 text-xs text-amber-600 dark:text-amber-400",children:["Conflicts (protected):",(0,d.jsx)("ul",{className:"list-disc pl-4 mt-1",children:p.skills.filter(a=>"conflict"===a.action).map((a,b)=>(0,d.jsxs)("li",{children:[a.agent,"/",a.skillId,": ",a.message||a.reason]},b))})]})]}),n&&(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Doctor"}),n.issues?.length===0?(0,d.jsx)("p",{className:"text-xs text-green-600",children:"No issues"}):(0,d.jsx)("ul",{className:"text-xs space-y-1",children:n.issues?.map((a,b)=>(0,d.jsxs)("li",{className:"error"===a.severity?"text-red-500":"text-amber-600 dark:text-amber-400",children:["[",a.severity,"] ",a.message]},b))})]})]}),!c&&"skills"===r&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main",children:"Library skills"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(f.$n,{size:"sm",variant:"ghost",disabled:!!j,onClick:async()=>{k("upd-check");try{await S(),m({type:"success",text:"Update check complete"})}finally{k("")}},children:"Check updates"}),(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",disabled:!!j,onClick:async()=>{k("ensure");try{await fetch("/api/agent-library/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"ensure_product"})}),await R(),m({type:"success",text:"Product skills ensured"})}finally{k("")}},children:"Refresh product skills"})]})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(a?.skills||[]).map(a=>(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2 p-3 rounded-lg border border-border-subtle bg-surface-2/50",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:a.title||a.id}),(0,d.jsx)(f.Ex,{size:"sm",variant:"default",children:(0,d.jsxs)("code",{className:"text-[10px]",children:["sb-",a.id]})}),J[a.id]?.status==="update"&&(0,d.jsx)(f.Ex,{size:"sm",variant:"warning",children:"update available"}),J[a.id]?.status==="error"&&(0,d.jsx)("span",{className:"text-[10px] text-text-subtle",title:J[a.id]?.message||"check failed",children:"check failed"})]}),(0,d.jsx)("p",{className:"text-[11px] text-text-muted mt-0.5 line-clamp-2",children:a.description||"—"})]}),(0,d.jsxs)("div",{className:"flex gap-1 shrink-0",children:[J[a.id]?.status==="update"&&(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",disabled:!!j,loading:"upd-preview"===j&&L?.id!==a.id,onClick:()=>aa(a.id),children:"Update"}),(0,d.jsx)(f.$n,{size:"sm",variant:"ghost",disabled:!!j,onClick:()=>$(a.id),children:"Remove"})]})]},a.id)),!a?.skills?.length&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"No skills yet. Enable product skills or add manually."})]})]}),L&&(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsxs)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:["Update preview — ",(0,d.jsx)("code",{className:"text-[12px]",children:L.id})]}),(0,d.jsx)("p",{className:"text-[11px] text-text-subtle mb-2",children:"Full incoming SKILL.md shown below. Exactly these bytes are installed on confirm — if upstream changes in between, the update is refused and you preview again."}),(0,d.jsx)("pre",{className:"text-[10px] font-mono max-h-64 overflow-auto bg-surface-2 p-2 rounded border border-border-subtle whitespace-pre-wrap",children:L.markdown}),(0,d.jsxs)("label",{className:"flex items-start gap-2 text-xs text-text-muted cursor-pointer mt-2",children:[(0,d.jsx)("input",{type:"checkbox","aria-label":"I reviewed this skill update and understand it may instruct agents to run tools or shell commands",checked:N,onChange:a=>O(a.target.checked)}),"I reviewed this skill and understand it may instruct agents to run tools/shell commands."]}),(0,d.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,d.jsx)(f.$n,{size:"sm",disabled:!N||!!j,loading:"upd-apply"===j,onClick:ab,children:"Apply update"}),(0,d.jsx)(f.$n,{size:"sm",variant:"ghost",disabled:!!j,onClick:()=>{M(null),O(!1)},children:"Cancel"})]})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Add skill (paste SKILL.md)"}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"skill-id (e.g. my-review)",value:F,onChange:a=>G(a.target.value)}),(0,d.jsx)("textarea",{className:"w-full h-40 bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"---\nname: my-skill\ndescription: ...\n---\n\n# ...",value:H,onChange:a=>I(a.target.value)}),(0,d.jsx)(f.$n,{size:"sm",disabled:!F||!H||!!j,loading:"skill-add"===j,onClick:_,children:"Add to library"})]})]})]}),!c&&"mcp"===r&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-1",children:"MCP servers in library"}),(0,d.jsxs)("p",{className:"text-[11px] text-text-subtle mb-3",children:["Prefer ",(0,d.jsxs)("code",{className:"font-mono",children:["$","{GITHUB_TOKEN}"]})," style env values — do not paste raw API keys if you can avoid it. Keys are projected as"," ",(0,d.jsx)("code",{className:"font-mono",children:"sb-*"})," only."]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(a?.mcpServers||[]).map(a=>(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2 p-3 rounded-lg border border-border-subtle",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-sm text-text-main font-medium",children:a.name}),(0,d.jsx)("code",{className:"text-[10px] text-text-subtle",children:a.id}),(0,d.jsxs)("div",{className:"text-[11px] text-text-muted mt-1",children:[a.transport||"stdio"," \xb7"," ",a.command?`${a.command} ${(a.args||[]).join(" ")}`:a.url]})]}),(0,d.jsx)(f.$n,{size:"sm",variant:"ghost",onClick:()=>Z(a.id),children:"Remove"})]},a.id)),!a?.mcpServers?.length&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"No MCP servers in library yet."})]})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-3",children:"Add MCP server"}),(0,d.jsxs)("form",{className:"grid gap-2 sm:grid-cols-2",onSubmit:Y,children:[(0,d.jsx)("input",{required:!0,className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"id (e.g. filesystem)",value:t.id,onChange:a=>u({...t,id:a.target.value})}),(0,d.jsx)("input",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs",placeholder:"Display name",value:t.name,onChange:a=>u({...t,name:a.target.value})}),(0,d.jsxs)("select",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs",value:t.transport,onChange:a=>u({...t,transport:a.target.value}),children:[(0,d.jsx)("option",{value:"stdio",children:"stdio (command)"}),(0,d.jsx)("option",{value:"http",children:"http (url)"}),(0,d.jsx)("option",{value:"sse",children:"sse (url)"})]}),"stdio"===t.transport?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"command",value:t.command,onChange:a=>u({...t,command:a.target.value})}),(0,d.jsx)("input",{className:"sm:col-span-2 bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"args (space-separated)",value:t.args,onChange:a=>u({...t,args:a.target.value})})]}):(0,d.jsx)("input",{className:"sm:col-span-1 bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"https://...",value:t.url,onChange:a=>u({...t,url:a.target.value})}),(0,d.jsx)("div",{className:"sm:col-span-2",children:(0,d.jsx)(f.$n,{size:"sm",type:"submit",loading:"mcp"===j,disabled:!!j,children:"Save to library"})})]})]})]}),!c&&"catalog"===r&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-1",children:"Trusted presets"}),(0,d.jsx)("p",{className:"text-[11px] text-text-subtle mb-3",children:"Fetches SKILL.md only — never runs install scripts. You must confirm and then Apply sync."}),(0,d.jsx)("div",{className:"space-y-2",children:v.map(a=>(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 p-2 rounded border border-border-subtle",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-sm text-text-main",children:a.name}),(0,d.jsx)("div",{className:"text-[11px] text-text-muted",children:a.description})]}),(0,d.jsxs)("div",{className:"flex gap-1",children:[(0,d.jsx)(f.$n,{size:"sm",variant:"ghost",onClick:()=>{y(a.rawUrl),A(a.skillId),ac(a.rawUrl)},children:"Preview"}),(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",onClick:()=>{y(a.rawUrl),A(a.skillId),E(!1)},children:"Select"})]})]},a.id))})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Install from URL"}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"skill-id",value:z,onChange:a=>A(a.target.value)}),(0,d.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"https://.../SKILL.md",value:x,onChange:a=>y(a.target.value)}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",disabled:!x||!!j,onClick:()=>ac(x),children:"Preview"})}),B&&(0,d.jsx)("pre",{className:"text-[10px] font-mono max-h-48 overflow-auto bg-surface-2 p-2 rounded border border-border-subtle whitespace-pre-wrap",children:B}),(0,d.jsxs)("label",{className:"flex items-start gap-2 text-xs text-text-muted cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox","aria-label":"I reviewed this catalog skill and understand it may instruct agents to run tools or shell commands",checked:D,onChange:a=>E(a.target.checked)}),"I reviewed this skill and understand it may instruct agents to run tools/shell commands."]}),(0,d.jsx)(f.$n,{size:"sm",disabled:!x||!z||!D||!!j,loading:"catalog"===j,onClick:ad,children:"Install into library"})]})]})]}),!c&&"advanced"===r&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Clean managed projections"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mb-3",children:["Removes only ",(0,d.jsx)("code",{className:"font-mono",children:"sb-*"})," skills and MCP keys written by Switchboard. Your other skills/MCP stay untouched."]}),(0,d.jsx)(f.$n,{size:"sm",variant:"outline",disabled:!!j,loading:"clean"===j,onClick:async()=>{await (0,g.l)({message:"Remove all Switchboard-managed skill/MCP projections from targets?",confirmText:"Continue"})&&W("clean")},children:"Clean managed only"})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Export AgentSync layout"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Writes a coexistence-friendly ",(0,d.jsx)("code",{className:"font-mono",children:".agents/"})," tree (skills + agentsync.toml). Does not run agentsync. Paths must be under your home or project directory."]}),(0,d.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono mb-2",placeholder:"Optional dest (default ~/switchboard-agents-export/.agents)",value:P,onChange:a=>Q(a.target.value)}),(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",disabled:!!j,loading:"export"===j,onClick:ae,children:"Export"})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Coexistence"}),(0,d.jsxs)("ul",{className:"text-xs text-text-muted space-y-1 list-disc pl-4",children:[(0,d.jsxs)("li",{children:["Switchboard only owns ",(0,d.jsx)("code",{className:"font-mono",children:"sb-*"})," skill directories and MCP keys."]}),(0,d.jsx)("li",{children:"AgentSync / skillbook may manage other paths — avoid pointing both at the same un-namespaced skill."}),(0,d.jsx)("li",{children:"Product skills for HTTP agents remain under Dashboard → Skills (separate)."})]})]})]})]})}function i({label:a,value:b}){return(0,d.jsxs)(f.Zp,{padding:"sm",children:[(0,d.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-text-subtle font-semibold",children:a}),(0,d.jsx)("div",{className:"text-sm text-text-main mt-1 font-medium truncate",title:b,children:b})]})}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63878:(a,b,c)=>{Promise.resolve().then(c.bind(c,90657))},73024:a=>{"use strict";a.exports=require("node:fs")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},79646:a=>{"use strict";a.exports=require("child_process")},79868:a=>{"use strict";a.exports=require("node:sqlite")},81787:a=>{"use strict";a.exports=require("bun:sqlite")},87550:a=>{"use strict";a.exports=require("better-sqlite3")},90657:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/switchboard-router/switchboard-router/src/app/(dashboard)/dashboard/agent-library/page.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/switchboard-router/switchboard-router/src/app/(dashboard)/dashboard/agent-library/page.js","default")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,2430,9995,2712,3787,8976,5350,869,3986,5781,5717,194,7757,8834],()=>b(b.s=10335));module.exports=c})();
1
+ (()=>{var a={};a.id=6897,a.ids=[6897],a.modules={3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10335:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>x,handler:()=>z,routeModule:()=>y});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,32059))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,30508))),o=(0,d.p)(()=>Promise.resolve().then(c.bind(c,57097))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),q=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),r=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),s=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),t=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),u=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),v={children:["",{children:["(dashboard)",{children:["dashboard",{children:["agent-library",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,90657))),"/home/runner/work/switchboard-router/switchboard-router/src/app/(dashboard)/dashboard/agent-library/page.js"]}]},{"global-error":[u,"next/dist/client/components/builtin/global-error.js"]},[]]},{"global-error":[t,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"/home/runner/work/switchboard-router/switchboard-router/src/app/(dashboard)/layout.js"],error:[o,"/home/runner/work/switchboard-router/switchboard-router/src/app/(dashboard)/error.js"],"global-error":[p,"next/dist/client/components/builtin/global-error.js"],"not-found":[q,"next/dist/client/components/builtin/not-found.js"],forbidden:[r,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[s,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]},{layout:[i,"/home/runner/work/switchboard-router/switchboard-router/src/app/layout.js"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]}.children,w=(0,e.H)({tree:v,page:"/(dashboard)/dashboard/agent-library/page",pathname:"/dashboard/agent-library",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),x=w.__next_app__,y=w.routeModule,z=w.handler},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33614:(a,b,c)=>{Promise.resolve().then(c.bind(c,58675))},33873:a=>{"use strict";a.exports=require("path")},38522:a=>{"use strict";a.exports=require("node:zlib")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},46293:a=>{"use strict";a.exports=require("sql.js")},50412:(a,b,c)=>{"use strict";c.d(b,{x0:()=>x.default,Ex:()=>j.default,$n:()=>d.default,nh:()=>C.default,Zp:()=>g.default,Qv:()=>i.CardSkeleton,CK:()=>o.default,uo:()=>h.ConfirmModal,G9:()=>t.default,wI:()=>w.default,vj:()=>v.default,vE:()=>u.default,pd:()=>e.default,Mh:()=>s.default,uR:()=>n.default,Nf:()=>p.default,aF:()=>h.default,rq:()=>m.default,gw:()=>y.default,LF:()=>l.default,Wx:()=>B.default,gM:()=>r.default,Iz:()=>z.default,l6:()=>f.default,lM:()=>k.default,m_:()=>A.default,jK:()=>q.default});var d=c(99070),e=c(83552),f=c(4770),g=c(17660),h=c(95145),i=c(74812);c(25919);var j=c(75171),k=c(95514);c(53845),c(19308),c(42196),c(32456),c(48781);var l=c(79346),m=c(83352),n=c(39645),o=c(62727),p=c(20084),q=c(87226);c(267),c(3236),c(11229);var r=c(91809);c(4481);var s=c(5291);c(56110);var t=c(51109),u=c(79488),v=c(43182),w=c(51585),x=c(67738),y=c(50585),z=c(91099),A=c(32971),B=c(11633),C=c(38930);c(5993),c(53838)},55511:a=>{"use strict";a.exports=require("crypto")},58675:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>h});var d=c(48249),e=c(67484),f=c(50412),g=c(78097);function h(){let a,b,[c,h]=(0,e.useState)(null),[j,k]=(0,e.useState)(!0),[l,m]=(0,e.useState)(""),[n,o]=(0,e.useState)(null),[p,q]=(0,e.useState)(null),[r,s]=(0,e.useState)(null),[t,u]=(0,e.useState)("overview"),[v,w]=(0,e.useState)({id:"",name:"",transport:"stdio",command:"npx",args:"-y @modelcontextprotocol/server-filesystem .",url:"",notes:""}),[x,y]=(0,e.useState)([]),[z,A]=(0,e.useState)([]),[B,C]=(0,e.useState)(""),[D,E]=(0,e.useState)([]),[F,G]=(0,e.useState)(""),[H,I]=(0,e.useState)(""),[J,K]=(0,e.useState)(""),[L,M]=(0,e.useState)(""),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)(""),[R,S]=(0,e.useState)(""),[T,U]=(0,e.useState)({}),[V,W]=(0,e.useState)(null),[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)(""),_=(0,e.useCallback)(async()=>{k(!0);try{let a=await fetch("/api/agent-library",{cache:"no-store"}),b=await a.json();if(!a.ok)throw Error(b.error||"Load failed");h(b)}catch(a){o({type:"error",text:a.message})}finally{k(!1)}},[]),aa=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/agent-library/updates",{cache:"no-store"}),b=await a.json();if(!a.ok)return;let c={};for(let a of b.results||[])c[a.id]=a;U(c)}catch{}},[]),ab=c?.settings||{},ac=c?.agents||{};async function ad(a){m("settings"),o(null);try{let b=await fetch("/api/agent-library",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();if(!b.ok)throw Error(c.error||"Save failed");o({type:"success",text:"Settings saved"}),await _()}catch(a){o({type:"error",text:a.message})}finally{m("")}}async function ae(a){m(a),o(null),s(null);try{let b=await fetch("/api/agent-library/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a,confirm:"clean"===a||void 0})}),c=await b.json();if(!b.ok)throw Error(c.error||c.message||"Sync failed");s(c),o({type:c.conflictCount?"warn":"success",text:"dry-run"===a?`Dry-run: ${c.summary?.skillsSynced??0} skill ops, ${c.summary?.mcpOk??0} MCP ok, ${c.conflictCount||0} conflicts`:"clean"===a?"Removed Switchboard-managed projections only":`Applied: ${c.summary?.skillsSynced??0} skills synced, ${c.conflictCount||0} conflicts protected`}),await _()}catch(a){o({type:"error",text:a.message})}finally{m("")}}async function af(){m("doctor");try{let a=await fetch("/api/agent-library/doctor",{cache:"no-store"}),b=await a.json();if(!a.ok)throw Error(b.error||"Doctor failed");q(b),o({type:b.ok?"success":"warn",text:b.ok?"Doctor: no blocking errors":`Doctor: ${b.issues?.filter(a=>"error"===a.severity).length||0} errors`})}catch(a){o({type:"error",text:a.message})}finally{m("")}}async function ag(a){a?.preventDefault?.(),m("mcp");try{let a=v.args?v.args.split(/\s+/).filter(Boolean):[],b=await fetch("/api/agent-library/mcp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:v.id,name:v.name||v.id,transport:v.transport,command:"stdio"===v.transport?v.command:void 0,args:"stdio"===v.transport?a:void 0,url:"stdio"!==v.transport?v.url:void 0,notes:v.notes})}),c=await b.json();if(!b.ok)throw Error(c.error||"MCP save failed");c.warnings?.length?o({type:"warn",text:c.warnings.join(" \xb7 ")}):o({type:"success",text:`MCP ${c.server?.id} saved (Apply to project)`}),w({id:"",name:"",transport:"stdio",command:"npx",args:"",url:"",notes:""}),await _()}catch(a){o({type:"error",text:a.message})}finally{m("")}}async function ah(a){m(`mcp-preset-${a.id}`),o(null);try{let b=await fetch("/api/agent-library/mcp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a.id,name:a.name||a.id,transport:a.transport||"stdio",command:a.command,args:a.args,url:a.url,env:a.env,notes:a.notes})}),c=await b.json();if(!b.ok)throw Error(c.error||"MCP preset save failed");o({type:"success",text:`MCP ${c.server?.id||a.id} saved to library. Click Apply sync to project to agents.`}),await _()}catch(a){o({type:"error",text:a.message})}finally{m("")}}function ai(a){w({id:a.id,name:a.name||a.id,transport:a.transport||"stdio",command:a.command||"npx",args:(a.args||[]).join(" "),url:a.url||"",notes:a.notes||""}),o({type:"success",text:`Loaded ${a.name} into form below. Edit parameters as needed and click Save.`})}async function aj(a){if(await (0,g.l)({message:`Remove MCP ${a} from library? (targets updated on next Apply)`,confirmText:"Continue"})){m("mcp-del");try{let b=await fetch(`/api/agent-library/mcp?id=${encodeURIComponent(a)}`,{method:"DELETE"}),c=await b.json();if(!b.ok)throw Error(c.error);o({type:"success",text:"MCP removed from library"}),await _()}catch(a){o({type:"error",text:a.message})}finally{m("")}}}async function ak(a){if(await (0,g.l)({message:`Remove skill ${a} from library?`,confirmText:"Continue"})){m("skill-del");try{let b=await fetch(`/api/agent-library/skills?id=${encodeURIComponent(a)}`,{method:"DELETE"}),c=await b.json();if(!b.ok)throw Error(c.error);o({type:"success",text:"Skill removed from library"}),await _(),await aa()}catch(a){o({type:"error",text:a.message})}finally{m("")}}}async function al(){m("skill-add");try{let a=await fetch("/api/agent-library/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:P,markdown:R,source:"manual"})}),b=await a.json();if(!a.ok)throw Error(b.error);o({type:"success",text:`Skill ${b.id} installed in library`}),Q(""),S(""),await _()}catch(a){o({type:"error",text:a.message})}finally{m("")}}async function am(a){m("upd-preview"),Y(!1);try{let b=await fetch("/api/agent-library/updates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview",skillId:a})}),c=await b.json();if(!b.ok||!c.ok)throw Error(c.message||c.error||"Preview failed");W({id:a,markdown:c.markdown,contentHash:c.contentHash})}catch(a){o({type:"error",text:a.message})}finally{m("")}}async function an(){if(V){m("upd-apply");try{let a=await fetch("/api/agent-library/updates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update",skillId:V.id,confirmed:X,expectedHash:V.contentHash})}),b=await a.json();if(!a.ok||!b.ok)throw Error(b.message||b.error||"Update failed");o({type:"success",text:b.warning||`Updated ${b.id}`}),W(null),Y(!1),await _(),await aa()}catch(a){o({type:"error",text:a.message})}finally{m("")}}}async function ao(a){if(a?.preventDefault?.(),B.trim()){m("resolve"),o(null),G("");try{let a=await fetch("/api/agent-library/catalog",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"resolve",input:B.trim()})}),b=await a.json();if(!a.ok||!b.ok)throw Error(b.message||b.error||"Resolution failed");let c=b.skills||[];E(c),1===c.length?(K(c[0].skillId),I(c[0].rawUrl),M(c[0].preview||""),O(!1),o({type:"success",text:`Resolved skill: ${c[0].skillId}`})):c.length>1&&(K(""),I(""),M(""),O(!1),o({type:"success",text:`Found ${c.length} skills in ${b.repo||"repository"}. Select one below.`}))}catch(a){o({type:"error",text:a.message})}finally{m("")}}}async function ap(a){m("preview");try{let b=await fetch("/api/agent-library/catalog",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview",url:a})}),c=await b.json();if(!b.ok||!c.ok)throw Error(c.error||"Preview failed");M(c.preview||""),o({type:"success",text:`Preview loaded (${c.bytes} bytes)`})}catch(a){o({type:"error",text:a.message})}finally{m("")}}async function aq(){m("catalog");try{let a=await fetch("/api/agent-library/catalog",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"install",skillId:J,url:H,confirmed:N})}),b=await a.json();if(!a.ok)throw Error(b.message||b.error||"Install failed");G(b.id||J),o({type:"success",text:b.warning||`Installed ${b.id}`}),O(!1),await _(),await aa()}catch(a){o({type:"error",text:a.message})}finally{m("")}}async function ar(){m("export");try{let a=await fetch("/api/agent-library/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({destPath:Z||void 0})}),b=await a.json();if(!a.ok)throw Error(b.message||b.error||"Export failed");o({type:"success",text:`Exported AgentSync layout to ${b.path}`})}catch(a){o({type:"error",text:a.message})}finally{m("")}}return(0,d.jsxs)("div",{className:"max-w-5xl mx-auto space-y-5 pb-12",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Agent library"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted leading-relaxed max-w-2xl",children:["One Switchboard-owned library of ",(0,d.jsx)("strong",{className:"text-text-main",children:"skills"})," and"," ",(0,d.jsx)("strong",{className:"text-text-main",children:"MCP servers"}),", projected into Claude Code, Codex, OpenCode, Gemini CLI, and Cursor. Managed entries use the"," ",(0,d.jsx)("code",{className:"text-[11px] font-mono",children:"sb-"})," namespace so we never overwrite your existing skills or MCP keys."]})]}),n&&(0,d.jsx)("div",{className:`text-xs px-3 py-2 rounded-lg border ${"success"===n.type?"bg-green-500/10 border-green-500/30 text-green-600 dark:text-green-400":"warn"===n.type?"bg-amber-500/10 border-amber-500/30 text-amber-700 dark:text-amber-400":"bg-red-500/10 border-red-500/30 text-red-500"}`,children:n.text}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)("label",{className:"flex items-center gap-2 text-sm text-text-main cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",className:"accent-[var(--color-primary)]","aria-label":"Sync enabled",checked:!1!==ab.enabled,disabled:!!l,onChange:a=>ad({enabled:a.target.checked})}),"Sync enabled"]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",disabled:!!l||!1===ab.enabled,loading:"dry-run"===l,onClick:()=>ae("dry-run"),children:"Dry-run"}),(0,d.jsx)(f.$n,{size:"sm",disabled:!!l||!1===ab.enabled,loading:"apply"===l,onClick:()=>ae("apply"),children:"Apply sync"}),(0,d.jsx)(f.$n,{size:"sm",variant:"outline",disabled:!!l,loading:"doctor"===l,onClick:af,children:"Doctor"})]})]}),(0,d.jsxs)("p",{className:"text-[11px] text-text-subtle mt-2 font-mono break-all",children:["Library: ",c?.libraryRoot||"…",ab.linkMode?` \xb7 mode=${ab.linkMode}`:"",ab.scope?` \xb7 scope=${ab.scope}`:""]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1 border-b border-border pb-0",children:[{id:"overview",label:"Overview"},{id:"skills",label:"Skills"},{id:"mcp",label:"MCP"},{id:"catalog",label:"Catalog"},{id:"advanced",label:"Advanced"}].map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>u(a.id),className:`px-3 py-2 text-xs font-medium rounded-t-md transition-colors ${t===a.id?"bg-surface border border-border border-b-surface text-primary -mb-px":"text-text-muted hover:text-text-main"}`,children:a.label},a.id))}),j&&(0,d.jsxs)("p",{className:"text-sm text-text-muted flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),"Loading…"]}),!j&&"overview"===t&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"How it works"}),(0,d.jsxs)("ol",{className:"text-xs text-text-muted space-y-1.5 list-decimal pl-4 leading-relaxed",children:[(0,d.jsxs)("li",{children:["Skills and MCP servers live only in Switchboard's library (",(0,d.jsx)("code",{className:"font-mono",children:"~/.switchboard/agent-library"}),")."]}),(0,d.jsxs)("li",{children:[(0,d.jsx)("strong",{className:"text-text-main",children:"Apply sync"})," projects them into each enabled agent under namespaced paths/keys (",(0,d.jsx)("code",{className:"font-mono",children:"sb-*"}),")."]}),(0,d.jsxs)("li",{children:["If a path already exists and is ",(0,d.jsx)("em",{children:"not"})," marked managed, we"," ",(0,d.jsx)("strong",{className:"text-text-main",children:"skip"})," it (never overwrite)."]}),(0,d.jsx)("li",{children:"Turn individual agents or skills/MCP off with the toggles below."})]})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-3",children:"Targets"}),(0,d.jsx)("div",{className:"space-y-2",children:Object.values(ac).map(a=>{let b=ab.targets?.[a.id]||{skills:!0,mcp:!0};return(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 py-2 border-b border-border-subtle last:border-0",children:[(0,d.jsx)("span",{className:"text-sm text-text-main",children:a.label}),(0,d.jsxs)("div",{className:"flex gap-4 text-xs text-text-muted",children:[(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox","aria-label":`${a.label} skills projection`,checked:!1!==b.skills,disabled:!a.supportsSkills||!!l,onChange:c=>ad({targets:{...ab.targets,[a.id]:{...b,skills:c.target.checked}}})}),"Skills"]}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox","aria-label":`${a.label} MCP projection`,checked:!1!==b.mcp,disabled:!a.supportsMcp||!!l,onChange:c=>ad({targets:{...ab.targets,[a.id]:{...b,mcp:c.target.checked}}})}),"MCP"]})]})]},a.id)})})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-3",children:"Safety & link mode"}),(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 text-xs",children:[(0,d.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Link mode"}),(0,d.jsxs)("select",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-text-main",value:ab.linkMode||"copy",disabled:!!l,onChange:a=>ad({linkMode:a.target.value}),children:[(0,d.jsx)("option",{value:"copy",children:"Copy (safe default on Windows)"}),(0,d.jsx)("option",{value:"symlink",children:"Symlink (instant updates; may need privileges on Windows)"})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Scope"}),(0,d.jsxs)("select",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-text-main",value:ab.scope||"global",disabled:!!l,onChange:a=>ad({scope:a.target.value,projectPath:"project"===a.target.value?ab.projectPath||"":null}),children:[(0,d.jsx)("option",{value:"global",children:"Global (user home agents)"}),(0,d.jsx)("option",{value:"project",children:"Project (paths under project folder)"})]})]}),"project"===ab.scope&&(0,d.jsxs)("label",{className:"flex flex-col gap-1 sm:col-span-2",children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Project path (absolute)"}),(0,d.jsx)("input",{className:"bg-surface border border-border rounded-md px-2 py-1.5 font-mono text-text-main",value:ab.projectPath||"",placeholder:"/Users/you/my-app",disabled:!!l,onChange:a=>ad({projectPath:a.target.value})})]}),(0,d.jsxs)("label",{className:"flex items-start gap-2 sm:col-span-2 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",className:"mt-0.5","aria-label":"Never overwrite user-owned files",checked:!1!==ab.neverOverwriteUser,disabled:!!l,onChange:async a=>{a.target.checked?ad({neverOverwriteUser:!0}):await (0,g.l)({message:"Allow overwriting paths that are NOT Switchboard-managed? This can replace your personal skills/MCP. Continue?",confirmText:"Continue"})&&ad({neverOverwriteUser:!1,confirmAllowOverwrite:!0})}}),(0,d.jsxs)("span",{className:"text-text-muted leading-relaxed",children:[(0,d.jsx)("strong",{className:"text-text-main",children:"Never overwrite user-owned files"})," ","(recommended). Only touch ",(0,d.jsx)("code",{className:"font-mono",children:"sb-*"})," managed entries."]})]}),(0,d.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox","aria-label":"Auto-include Switchboard product skills",checked:!1!==ab.includeProductSkills,disabled:!!l,onChange:a=>ad({includeProductSkills:a.target.checked})}),(0,d.jsx)("span",{className:"text-text-muted",children:"Auto-include Switchboard product skills (entry + chat)"})]})]})]}),(0,d.jsx)(f.Zp,{padding:"md",className:"border-primary/20 bg-primary/5",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"space-y-1 max-w-xl",children:[(0,d.jsxs)("div",{className:"text-xs font-semibold text-text-main flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"hub"}),"Featured: Executor.sh Tool Gateway & MCP Presets"]}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:["Connect your AI agents to OpenAPI, GraphQL, MCP servers, and custom JavaScript functions via ",(0,d.jsx)("strong",{children:"Executor.sh"})," (",(0,d.jsx)("code",{className:"font-mono text-primary",children:"npx -y executor mcp"}),")."]})]}),(0,d.jsx)(f.$n,{size:"sm",variant:"primary",onClick:()=>u("mcp"),children:"Manage MCP Gateways"})]})}),(0,d.jsxs)("div",{className:"grid sm:grid-cols-3 gap-3",children:[(0,d.jsx)(i,{label:"Skills in library",value:String(c?.skills?.length??0)}),(0,d.jsx)(i,{label:"MCP servers",value:String(c?.mcpServers?.length??0)}),(0,d.jsx)(i,{label:"Last sync",value:c?.state?.lastSync?.at?new Date(c.state.lastSync.at).toLocaleString():"—"})]}),r&&(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Last sync detail"}),(0,d.jsx)("pre",{className:"text-[11px] font-mono text-text-muted overflow-x-auto max-h-48 bg-surface-2 p-2 rounded",children:JSON.stringify(r.summary||r,null,2)}),r.skills?.filter(a=>"conflict"===a.action).length>0&&(0,d.jsxs)("div",{className:"mt-2 text-xs text-amber-600 dark:text-amber-400",children:["Conflicts (protected):",(0,d.jsx)("ul",{className:"list-disc pl-4 mt-1",children:r.skills.filter(a=>"conflict"===a.action).map((a,b)=>(0,d.jsxs)("li",{children:[a.agent,"/",a.skillId,": ",a.message||a.reason]},b))})]})]}),p&&(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Doctor"}),p.issues?.length===0?(0,d.jsx)("p",{className:"text-xs text-green-600",children:"No issues"}):(0,d.jsx)("ul",{className:"text-xs space-y-1",children:p.issues?.map((a,b)=>(0,d.jsxs)("li",{className:"error"===a.severity?"text-red-500":"text-amber-600 dark:text-amber-400",children:["[",a.severity,"] ",a.message]},b))})]})]}),!j&&"skills"===t&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main",children:"Library skills"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(f.$n,{size:"sm",variant:"ghost",disabled:!!l,onClick:async()=>{m("upd-check");try{await aa(),o({type:"success",text:"Update check complete"})}finally{m("")}},children:"Check updates"}),(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",disabled:!!l,onClick:async()=>{m("ensure");try{await fetch("/api/agent-library/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"ensure_product"})}),await _(),o({type:"success",text:"Product skills ensured"})}finally{m("")}},children:"Refresh product skills"})]})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(c?.skills||[]).map(a=>(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2 p-3 rounded-lg border border-border-subtle bg-surface-2/50",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:a.title||a.id}),(0,d.jsx)(f.Ex,{size:"sm",variant:"default",children:(0,d.jsxs)("code",{className:"text-[10px]",children:["sb-",a.id]})}),T[a.id]?.status==="update"&&(0,d.jsx)(f.Ex,{size:"sm",variant:"warning",children:"update available"}),T[a.id]?.status==="error"&&(0,d.jsx)("span",{className:"text-[10px] text-text-subtle",title:T[a.id]?.message||"check failed",children:"check failed"})]}),(0,d.jsx)("p",{className:"text-[11px] text-text-muted mt-0.5 line-clamp-2",children:a.description||"—"})]}),(0,d.jsxs)("div",{className:"flex gap-1 shrink-0",children:[T[a.id]?.status==="update"&&(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",disabled:!!l,loading:"upd-preview"===l&&V?.id!==a.id,onClick:()=>am(a.id),children:"Update"}),(0,d.jsx)(f.$n,{size:"sm",variant:"ghost",disabled:!!l,onClick:()=>ak(a.id),children:"Remove"})]})]},a.id)),!c?.skills?.length&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"No skills yet. Enable product skills or add manually."})]})]}),V&&(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsxs)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:["Update preview — ",(0,d.jsx)("code",{className:"text-[12px]",children:V.id})]}),(0,d.jsx)("p",{className:"text-[11px] text-text-subtle mb-2",children:"Full incoming SKILL.md shown below. Exactly these bytes are installed on confirm — if upstream changes in between, the update is refused and you preview again."}),(0,d.jsx)("pre",{className:"text-[10px] font-mono max-h-64 overflow-auto bg-surface-2 p-2 rounded border border-border-subtle whitespace-pre-wrap",children:V.markdown}),(0,d.jsxs)("label",{className:"flex items-start gap-2 text-xs text-text-muted cursor-pointer mt-2",children:[(0,d.jsx)("input",{type:"checkbox","aria-label":"I reviewed this skill update and understand it may instruct agents to run tools or shell commands",checked:X,onChange:a=>Y(a.target.checked)}),"I reviewed this skill and understand it may instruct agents to run tools/shell commands."]}),(0,d.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,d.jsx)(f.$n,{size:"sm",disabled:!X||!!l,loading:"upd-apply"===l,onClick:an,children:"Apply update"}),(0,d.jsx)(f.$n,{size:"sm",variant:"ghost",disabled:!!l,onClick:()=>{W(null),Y(!1)},children:"Cancel"})]})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Add skill (paste SKILL.md)"}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"skill-id (e.g. my-review)",value:P,onChange:a=>Q(a.target.value)}),(0,d.jsx)("textarea",{className:"w-full h-40 bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"---\nname: my-skill\ndescription: ...\n---\n\n# ...",value:R,onChange:a=>S(a.target.value)}),(0,d.jsx)(f.$n,{size:"sm",disabled:!P||!R||!!l,loading:"skill-add"===l,onClick:al,children:"Add to library"})]})]})]}),!j&&"mcp"===t&&(0,d.jsxs)("div",{className:"space-y-4",children:[(a=z.find(a=>"executor"===a.id)||{id:"executor",name:"Executor.sh (Tool Gateway)",description:"Unified MCP tool gateway for OpenAPI, GraphQL, MCP servers & sandboxed JavaScript functions (executor.sh)",transport:"stdio",command:"npx",args:["-y","executor","mcp"],notes:"Executor.sh tool execution gateway (https://executor.sh)",docsUrl:"https://executor.sh"},b=(c?.mcpServers||[]).some(a=>"executor"===a.id||"sb-executor"===a.id),(0,d.jsx)(f.Zp,{padding:"md",className:"border-primary/30 bg-primary/5",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"space-y-1 max-w-xl",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"hub"}),(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main",children:"Executor.sh Tool Gateway"}),(0,d.jsx)(f.Ex,{variant:"primary",size:"sm",children:"FEATURED GATEWAY"}),b&&(0,d.jsx)(f.Ex,{variant:"default",size:"sm",children:"Installed in Library"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted leading-relaxed",children:"Connect your AI agents to OpenAPI, GraphQL, MCP servers, and custom JavaScript functions through a single managed endpoint with local-first credential management."}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-3 pt-1 text-[11px] font-mono text-text-subtle",children:[(0,d.jsxs)("span",{children:["Command: ",(0,d.jsx)("code",{className:"text-text-main",children:"npx -y executor mcp"})]}),(0,d.jsx)("span",{children:"\xb7"}),(0,d.jsxs)("a",{href:"https://executor.sh",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline inline-flex items-center gap-0.5",children:["executor.sh docs",(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"open_in_new"})]})]})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2 shrink-0",children:[(0,d.jsx)(f.$n,{size:"sm",variant:b?"outline":"primary",disabled:b||!!l,loading:"mcp-preset-executor"===l,onClick:()=>ah(a),children:b?"Installed":"Add Executor Gateway"}),(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",disabled:!!l,onClick:()=>ai(a),children:"Customize"})]})]})})),z.filter(a=>"executor"!==a.id).length>0&&(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-1",children:"Popular MCP Server Presets"}),(0,d.jsx)("p",{className:"text-[11px] text-text-subtle mb-3",children:"1-click presets for common Model Context Protocol servers."}),(0,d.jsx)("div",{className:"grid gap-2 sm:grid-cols-3",children:z.filter(a=>"executor"!==a.id).map(a=>{let b=(c?.mcpServers||[]).some(b=>b.id===a.id||b.id===`sb-${a.id}`);return(0,d.jsxs)("div",{className:"p-3 rounded-lg border border-border-subtle bg-surface-2/40 hover:bg-surface-2/70 flex flex-col justify-between gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main",children:a.name}),b&&(0,d.jsx)(f.Ex,{size:"sm",variant:"default",children:"Installed"})]}),(0,d.jsx)("p",{className:"text-[11px] text-text-muted mt-1 line-clamp-2",children:a.description})]}),(0,d.jsxs)("div",{className:"flex gap-1.5 pt-1",children:[(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",disabled:b||!!l,loading:l===`mcp-preset-${a.id}`,onClick:()=>ah(a),children:b?"Installed":"Add"}),(0,d.jsx)(f.$n,{size:"sm",variant:"ghost",disabled:!!l,onClick:()=>ai(a),children:"Customize"})]})]},a.id)})})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-1",children:"MCP servers in library"}),(0,d.jsxs)("p",{className:"text-[11px] text-text-subtle mb-3",children:["Prefer ",(0,d.jsxs)("code",{className:"font-mono",children:["$","{GITHUB_TOKEN}"]})," style env values — do not paste raw API keys if you can avoid it. Keys are projected as"," ",(0,d.jsx)("code",{className:"font-mono",children:"sb-*"})," only."]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(c?.mcpServers||[]).map(a=>(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2 p-3 rounded-lg border border-border-subtle",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-sm text-text-main font-medium",children:a.name}),(0,d.jsx)("code",{className:"text-[10px] text-text-subtle",children:a.id}),(0,d.jsxs)("div",{className:"text-[11px] text-text-muted mt-1",children:[a.transport||"stdio"," \xb7"," ",a.command?`${a.command} ${(a.args||[]).join(" ")}`:a.url]})]}),(0,d.jsx)(f.$n,{size:"sm",variant:"ghost",onClick:()=>aj(a.id),children:"Remove"})]},a.id)),!c?.mcpServers?.length&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"No MCP servers in library yet. Add Executor.sh or another preset above."})]})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-3",children:"Add Custom MCP server"}),(0,d.jsxs)("form",{className:"grid gap-2 sm:grid-cols-2",onSubmit:ag,children:[(0,d.jsx)("input",{required:!0,className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"id (e.g. filesystem)",value:v.id,onChange:a=>w({...v,id:a.target.value})}),(0,d.jsx)("input",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs",placeholder:"Display name",value:v.name,onChange:a=>w({...v,name:a.target.value})}),(0,d.jsxs)("select",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs",value:v.transport,onChange:a=>w({...v,transport:a.target.value}),children:[(0,d.jsx)("option",{value:"stdio",children:"stdio (command)"}),(0,d.jsx)("option",{value:"http",children:"http (url)"}),(0,d.jsx)("option",{value:"sse",children:"sse (url)"})]}),"stdio"===v.transport?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"command",value:v.command,onChange:a=>w({...v,command:a.target.value})}),(0,d.jsx)("input",{className:"sm:col-span-2 bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"args (space-separated)",value:v.args,onChange:a=>w({...v,args:a.target.value})})]}):(0,d.jsx)("input",{className:"sm:col-span-1 bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"https://...",value:v.url,onChange:a=>w({...v,url:a.target.value})}),(0,d.jsx)("div",{className:"sm:col-span-2",children:(0,d.jsx)(f.$n,{size:"sm",type:"submit",loading:"mcp"===l,disabled:!!l,children:"Save to library"})})]})]})]}),!j&&"catalog"===t&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-1",children:"Smart Import (Command, Repo, or URL)"}),(0,d.jsxs)("p",{className:"text-[11px] text-text-subtle mb-3",children:["Paste CLI commands like ",(0,d.jsx)("code",{className:"font-mono text-primary",children:"npx skills add citrolabs/ego-lite"}),", GitHub repositories like ",(0,d.jsx)("code",{className:"font-mono text-primary",children:"citrolabs/ego-lite"}),", or direct ",(0,d.jsx)("code",{className:"font-mono text-primary",children:"SKILL.md"})," URLs."]}),(0,d.jsxs)("form",{onSubmit:ao,className:"space-y-2.5",children:[(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("input",{className:"flex-1 bg-surface border border-border rounded-md px-2.5 py-1.5 text-xs font-mono text-text-main placeholder:text-text-subtle",placeholder:"e.g. npx skills add citrolabs/ego-lite, anthropics/skills, or https://github.com/...",value:B,disabled:!!l,onChange:a=>{C(a.target.value),G("")}}),(0,d.jsx)(f.$n,{size:"sm",type:"submit",disabled:!B.trim()||!!l,loading:"resolve"===l,children:"Resolve & Preview"}),B&&(0,d.jsx)(f.$n,{size:"sm",variant:"ghost",disabled:!!l,onClick:()=>{C(""),E([]),K(""),I(""),M(""),O(!1),G("")},children:"Clear"})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px] text-text-subtle pt-1",children:[(0,d.jsx)("span",{className:"font-medium text-text-muted",children:"Quick try:"}),["npx skills add citrolabs/ego-lite","anthropics/skills","citrolabs/ego-lite"].map(a=>(0,d.jsx)("button",{type:"button",className:"px-2 py-0.5 rounded border border-border-subtle bg-surface-2 hover:bg-surface text-text-main hover:border-primary font-mono text-[10px] transition-colors cursor-pointer",disabled:!!l,onClick:()=>{C(a),G(""),m("resolve"),o(null),fetch("/api/agent-library/catalog",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"resolve",input:a})}).then(a=>a.json()).then(a=>{if(!a.ok)throw Error(a.message||a.error||"Resolution failed");let b=a.skills||[];E(b),1===b.length?(K(b[0].skillId),I(b[0].rawUrl),M(b[0].preview||""),O(!1),o({type:"success",text:`Resolved skill: ${b[0].skillId}`})):b.length>1&&(K(""),I(""),M(""),O(!1),o({type:"success",text:`Found ${b.length} skills in ${a.repo||"repository"}. Select one below.`}))}).catch(a=>o({type:"error",text:a.message})).finally(()=>m(""))},children:a},a))]})]}),D.length>1&&(0,d.jsxs)("div",{className:"mt-4 pt-3 border-t border-border-subtle space-y-2",children:[(0,d.jsxs)("div",{className:"text-xs font-medium text-text-main flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"folder_open"}),"Found ",D.length," skills in repository:"]}),(0,d.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:D.map(a=>(0,d.jsxs)("div",{className:`p-2.5 rounded-lg border transition-all text-xs cursor-pointer ${H===a.rawUrl?"border-primary bg-primary/5 shadow-sm":"border-border-subtle hover:border-border bg-surface-2/40"}`,onClick:()=>{K(a.skillId),I(a.rawUrl),O(!1),a.preview?M(a.preview):ap(a.rawUrl)},children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1",children:[(0,d.jsx)("span",{className:"font-semibold text-text-main",children:a.title||a.skillId}),(0,d.jsx)(f.Ex,{size:"sm",variant:H===a.rawUrl?"primary":"default",children:(0,d.jsxs)("code",{className:"text-[10px]",children:["sb-",a.skillId]})})]}),(0,d.jsx)("div",{className:"text-[11px] font-mono text-text-subtle mt-1 truncate",children:a.path}),a.description&&(0,d.jsx)("p",{className:"text-[11px] text-text-muted mt-1 line-clamp-2",children:a.description})]},a.path||a.skillId))})]}),H&&(0,d.jsxs)("div",{className:"mt-4 pt-3 border-t border-border-subtle space-y-3",children:[(0,d.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[(0,d.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,d.jsxs)("span",{className:"text-[11px] text-text-muted",children:["Skill ID (installed as sb-",J||"...",")"]}),(0,d.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono text-text-main",placeholder:"skill-id",value:J,disabled:!!l,onChange:a=>K(a.target.value)})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,d.jsx)("span",{className:"text-[11px] text-text-muted",children:"Resolved Raw Source URL"}),(0,d.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono text-text-main",placeholder:"https://.../SKILL.md",value:H,disabled:!!l,onChange:a=>I(a.target.value)})]})]}),L?(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("span",{className:"text-[11px] text-text-muted",children:"SKILL.md preview:"}),(0,d.jsx)("pre",{className:"text-[10px] font-mono max-h-56 overflow-auto bg-surface-2 p-2.5 rounded-lg border border-border-subtle whitespace-pre-wrap",children:L})]}):(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",disabled:!H||!!l,loading:"preview"===l,onClick:()=>ap(H),children:"Load Preview"}),(0,d.jsxs)("label",{className:"flex items-start gap-2 text-xs text-text-muted cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox","aria-label":"I reviewed this catalog skill and understand it may instruct agents to run tools or shell commands",checked:N,disabled:!!l,onChange:a=>O(a.target.checked)}),(0,d.jsx)("span",{children:"I reviewed this skill and understand it may instruct agents to run tools or shell commands."})]}),(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsx)(f.$n,{size:"sm",disabled:!H||!J||!N||!!l,loading:"catalog"===l,onClick:aq,children:"Install into library"})})]}),F&&(0,d.jsxs)("div",{className:"mt-4 p-3 rounded-lg bg-green-500/10 border border-green-500/30 flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"text-xs text-green-700 dark:text-green-300",children:[(0,d.jsx)("strong",{children:F})," is installed in your Switchboard library. Apply sync to project it into Claude, Codex, Gemini, OpenCode, and Cursor."]}),(0,d.jsx)(f.$n,{size:"sm",variant:"primary",loading:"apply"===l,disabled:!!l,onClick:()=>ae("apply"),children:"Apply sync to all agents now"})]})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-1",children:"Trusted presets"}),(0,d.jsx)("p",{className:"text-[11px] text-text-subtle mb-3",children:"One-click standard skills from official sources."}),(0,d.jsx)("div",{className:"space-y-2",children:x.map(a=>(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 p-2.5 rounded-lg border border-border-subtle bg-surface-2/40 hover:bg-surface-2/70 transition-colors",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-xs font-semibold text-text-main",children:a.name}),(0,d.jsx)("div",{className:"text-[11px] text-text-muted",children:a.description})]}),(0,d.jsxs)("div",{className:"flex gap-1.5",children:[(0,d.jsx)(f.$n,{size:"sm",variant:"ghost",onClick:()=>{C(a.rawUrl),I(a.rawUrl),K(a.skillId),E([]),G(""),ap(a.rawUrl)},children:"Preview"}),(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",onClick:()=>{C(a.rawUrl),I(a.rawUrl),K(a.skillId),E([]),O(!1),G(""),ap(a.rawUrl)},children:"Select"})]})]},a.id))})]})]}),!j&&"advanced"===t&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Clean managed projections"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mb-3",children:["Removes only ",(0,d.jsx)("code",{className:"font-mono",children:"sb-*"})," skills and MCP keys written by Switchboard. Your other skills/MCP stay untouched."]}),(0,d.jsx)(f.$n,{size:"sm",variant:"outline",disabled:!!l,loading:"clean"===l,onClick:async()=>{await (0,g.l)({message:"Remove all Switchboard-managed skill/MCP projections from targets?",confirmText:"Continue"})&&ae("clean")},children:"Clean managed only"})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Export AgentSync layout"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Writes a coexistence-friendly ",(0,d.jsx)("code",{className:"font-mono",children:".agents/"})," tree (skills + agentsync.toml). Does not run agentsync. Paths must be under your home or project directory."]}),(0,d.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono mb-2",placeholder:"Optional dest (default ~/switchboard-agents-export/.agents)",value:Z,onChange:a=>$(a.target.value)}),(0,d.jsx)(f.$n,{size:"sm",variant:"secondary",disabled:!!l,loading:"export"===l,onClick:ar,children:"Export"})]}),(0,d.jsxs)(f.Zp,{padding:"md",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Coexistence"}),(0,d.jsxs)("ul",{className:"text-xs text-text-muted space-y-1 list-disc pl-4",children:[(0,d.jsxs)("li",{children:["Switchboard only owns ",(0,d.jsx)("code",{className:"font-mono",children:"sb-*"})," skill directories and MCP keys."]}),(0,d.jsx)("li",{children:"AgentSync / skillbook may manage other paths — avoid pointing both at the same un-namespaced skill."}),(0,d.jsx)("li",{children:"Product skills for HTTP agents remain under Dashboard → Skills (separate)."})]})]})]})]})}function i({label:a,value:b}){return(0,d.jsxs)(f.Zp,{padding:"sm",children:[(0,d.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-text-subtle font-semibold",children:a}),(0,d.jsx)("div",{className:"text-sm text-text-main mt-1 font-medium truncate",title:b,children:b})]})}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63878:(a,b,c)=>{Promise.resolve().then(c.bind(c,90657))},73024:a=>{"use strict";a.exports=require("node:fs")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},79646:a=>{"use strict";a.exports=require("child_process")},79868:a=>{"use strict";a.exports=require("node:sqlite")},81787:a=>{"use strict";a.exports=require("bun:sqlite")},87550:a=>{"use strict";a.exports=require("better-sqlite3")},90657:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/switchboard-router/switchboard-router/src/app/(dashboard)/dashboard/agent-library/page.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/switchboard-router/switchboard-router/src/app/(dashboard)/dashboard/agent-library/page.js","default")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,2430,9995,2712,3787,8976,5350,869,3986,5781,5717,194,7757,8834],()=>b(b.s=10335));module.exports=c})();