@flexkit/studio 0.2.19 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chat-page-LAK4TFN4.js → chat-page-4G4XQ26P.js} +3 -3
- package/dist/{chat-page-LAK4TFN4.js.map → chat-page-4G4XQ26P.js.map} +1 -1
- package/dist/{chunk-4IEOAKKK.js → chunk-2P2QV3K6.js} +2 -2
- package/dist/{chunk-4IEOAKKK.js.map → chunk-2P2QV3K6.js.map} +1 -1
- package/dist/{chunk-OOYCTZ3C.js → chunk-445XKMAG.js} +3 -3
- package/dist/{chunk-OOYCTZ3C.js.map → chunk-445XKMAG.js.map} +1 -1
- package/dist/{chunk-H2RWSC56.js → chunk-B7QMGBK5.js} +3 -3
- package/dist/{chunk-H2RWSC56.js.map → chunk-B7QMGBK5.js.map} +1 -1
- package/dist/{chunk-ZKA2HKNI.js → chunk-BXN72PW2.js} +2 -2
- package/dist/{chunk-ZKA2HKNI.js.map → chunk-BXN72PW2.js.map} +1 -1
- package/dist/{chunk-HCJAM5LG.js → chunk-F2DT6NRK.js} +2 -2
- package/dist/{chunk-HCJAM5LG.js.map → chunk-F2DT6NRK.js.map} +1 -1
- package/dist/{chunk-DFLAX7EE.js → chunk-HLHLBMLJ.js} +2 -2
- package/dist/{chunk-DFLAX7EE.js.map → chunk-HLHLBMLJ.js.map} +1 -1
- package/dist/{chunk-V6RB45UU.js → chunk-JWBER5NX.js} +2 -2
- package/dist/{chunk-V6RB45UU.js.map → chunk-JWBER5NX.js.map} +1 -1
- package/dist/{chunk-VMWUMFUL.js → chunk-LK67JOQA.js} +3 -3
- package/dist/{chunk-VMWUMFUL.js.map → chunk-LK67JOQA.js.map} +1 -1
- package/dist/{chunk-6RRB47OZ.js → chunk-MKK65RQB.js} +3 -3
- package/dist/{chunk-6RRB47OZ.js.map → chunk-MKK65RQB.js.map} +1 -1
- package/dist/{chunk-XNHSHVG2.js → chunk-NYSQU73M.js} +3 -3
- package/dist/{chunk-XNHSHVG2.js.map → chunk-NYSQU73M.js.map} +1 -1
- package/dist/{chunk-QWQHXMXW.js → chunk-RY6PECIT.js} +2 -2
- package/dist/{chunk-QWQHXMXW.js.map → chunk-RY6PECIT.js.map} +1 -1
- package/dist/{entry-3JSFO4OU.js → entry-XVLXKEQV.js} +2 -2
- package/dist/{entry-3JSFO4OU.js.map → entry-XVLXKEQV.js.map} +1 -1
- package/dist/index.css +3 -0
- package/dist/index.js +2 -2
- package/dist/{list-SY3L2ACH.js → list-4OJMI4CB.js} +3 -3
- package/dist/{list-SY3L2ACH.js.map → list-4OJMI4CB.js.map} +1 -1
- package/dist/{list-Z2C74QDN.js → list-RABV2F3H.js} +2 -2
- package/dist/{list-Z2C74QDN.js.map → list-RABV2F3H.js.map} +1 -1
- package/dist/{pages-INCA54HE.js → pages-7LWBCW2X.js} +3 -3
- package/dist/{pages-INCA54HE.js.map → pages-7LWBCW2X.js.map} +1 -1
- package/dist/{plugin-pages-WO3MCJKC.js → plugin-pages-PQWTH7P5.js} +2 -2
- package/dist/{plugin-pages-WO3MCJKC.js.map → plugin-pages-PQWTH7P5.js.map} +1 -1
- package/dist/{record-links-CTB4SC4J.js → record-links-BFHPBOAL.js} +2 -2
- package/dist/{record-links-CTB4SC4J.js.map → record-links-BFHPBOAL.js.map} +1 -1
- package/dist/{root-XHXX3SZG.js → root-BS6QCYLO.js} +3 -3
- package/dist/{root-XHXX3SZG.js.map → root-BS6QCYLO.js.map} +1 -1
- package/dist/{root-6MSWGFZX.js → root-COI626G2.js} +2 -2
- package/dist/{root-6MSWGFZX.js.map → root-COI626G2.js.map} +1 -1
- package/dist/{root-DOOWSYWY.js → root-FTT4XDCE.js} +3 -3
- package/dist/{root-DOOWSYWY.js.map → root-FTT4XDCE.js.map} +1 -1
- package/dist/{root-OGX4DUTM.js → root-PDSTTPHO.js} +2 -2
- package/dist/{root-OGX4DUTM.js.map → root-PDSTTPHO.js.map} +1 -1
- package/dist/{root-JA2LFGNX.js → root-RXMRNU4M.js} +2 -2
- package/dist/{root-JA2LFGNX.js.map → root-RXMRNU4M.js.map} +1 -1
- package/dist/root-TZYOIXVG.js +2 -0
- package/dist/root-TZYOIXVG.js.map +1 -0
- package/dist/{search-Z4M4R4NJ.js → search-VPS2UHPQ.js} +2 -2
- package/dist/{search-Z4M4R4NJ.js.map → search-VPS2UHPQ.js.map} +1 -1
- package/dist/{skills-pages-TP2XQPCQ.js → skills-pages-G6JK7KKQ.js} +2 -2
- package/dist/{skills-pages-TP2XQPCQ.js.map → skills-pages-G6JK7KKQ.js.map} +1 -1
- package/dist/{source-5J56KIFA.js → source-MNHZQD4T.js} +2 -2
- package/dist/{source-5J56KIFA.js.map → source-MNHZQD4T.js.map} +1 -1
- package/package.json +3 -3
- package/dist/root-B4D3C37Q.js +0 -2
- package/dist/root-B4D3C37Q.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import'./index.css';import {g,d as d$1}from'./chunk-2HYQVMP3.js';import {b as b$1}from'./chunk-U45E5X3H.js';import {createContext,lazy,Suspense,useMemo,useContext}from'react';import {Navigate,useParams}from'react-router-dom';import {Bot,Layout,FileStack,BookOpenText,Waypoints,SquarePlay}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';import w,{mutate}from'swr';var d={name:"_asset",plural:"_assets",display:"originalFilename",menu:{hidden:true},attributes:[{name:"path",label:"Asset",scope:"global",options:{size:140},dataType:"string",inputType:"text",previewType:"assetPreviewField",defaultValue:""},{name:"originalFilename",label:"Filename",scope:"global",options:{size:320},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"size",label:"Size",scope:"global",options:{size:120},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"width",label:"Width",scope:"global",options:{size:90},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"height",label:"Height",scope:"global",options:{size:100},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"mimeType",label:"Mime Type",scope:"global",options:{size:160},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"lqip",label:"lqip",scope:"global",hidden:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"url",label:"URL",scope:"global",hidden:true,readOnly:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"tags",label:"Tags",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",previewType:"tags",options:{size:300},relationship:{mode:"multiple",field:"name",entity:"_tag"}}]};var f={name:"_tag",plural:"_tags",display:"name",menu:{hidden:true},attributes:[{name:"name",label:"Tag Name",scope:"global",options:{size:220},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"assets",label:"Assets",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",relationship:{mode:"multiple",field:"originalFilename",entity:"_asset"}}]};function x(){let{resolvedTheme:e}=b$1();return jsx("div",{className:"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background",children:jsxs("div",{className:"fk:flex fk:flex-col fk:items-center",children:[e==="dark"?jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"#020817"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"white"})]}):jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"white"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"#020817"})]}),jsx("div",{className:"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse",children:"Loading..."})]})})}var _=Navigate;function o(e){let t=lazy(e);return jsx(Suspense,{fallback:jsx(x,{}),children:jsx(t,{})})}var J=o(()=>import('./root-
|
|
2
|
-
export{x as a,d as b,f as c,Fe as d,Xe as e,qe as f};//# sourceMappingURL=chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import'./index.css';import {g,d as d$1}from'./chunk-2HYQVMP3.js';import {b as b$1}from'./chunk-U45E5X3H.js';import {createContext,lazy,Suspense,useMemo,useContext}from'react';import {Navigate,useParams}from'react-router-dom';import {Bot,Layout,FileStack,BookOpenText,Waypoints,SquarePlay}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';import w,{mutate}from'swr';var d={name:"_asset",plural:"_assets",display:"originalFilename",menu:{hidden:true},attributes:[{name:"path",label:"Asset",scope:"global",options:{size:140},dataType:"string",inputType:"text",previewType:"assetPreviewField",defaultValue:""},{name:"originalFilename",label:"Filename",scope:"global",options:{size:320},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"size",label:"Size",scope:"global",options:{size:120},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"width",label:"Width",scope:"global",options:{size:90},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"height",label:"Height",scope:"global",options:{size:100},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"mimeType",label:"Mime Type",scope:"global",options:{size:160},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"lqip",label:"lqip",scope:"global",hidden:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"url",label:"URL",scope:"global",hidden:true,readOnly:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"tags",label:"Tags",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",previewType:"tags",options:{size:300},relationship:{mode:"multiple",field:"name",entity:"_tag"}}]};var f={name:"_tag",plural:"_tags",display:"name",menu:{hidden:true},attributes:[{name:"name",label:"Tag Name",scope:"global",options:{size:220},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"assets",label:"Assets",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",relationship:{mode:"multiple",field:"originalFilename",entity:"_asset"}}]};function x(){let{resolvedTheme:e}=b$1();return jsx("div",{className:"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background",children:jsxs("div",{className:"fk:flex fk:flex-col fk:items-center",children:[e==="dark"?jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"#020817"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"white"})]}):jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"white"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"#020817"})]}),jsx("div",{className:"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse",children:"Loading..."})]})})}var _=Navigate;function o(e){let t=lazy(e);return jsx(Suspense,{fallback:jsx(x,{}),children:jsx(t,{})})}var J=o(()=>import('./root-RXMRNU4M.js').then(e=>({default:e.Root}))),X=o(()=>import('./list-RABV2F3H.js').then(e=>({default:e.List}))),q=o(()=>import('./edit-entity-PVT34FD7.js').then(e=>({default:e.EditEntity}))),K=o(()=>import('./root-FTT4XDCE.js').then(e=>({default:e.Root}))),G=o(()=>import('./root-COI626G2.js').then(e=>({default:e.Root}))),$=o(()=>import('./list-4OJMI4CB.js').then(e=>({default:e.List}))),Q=o(()=>import('./source-MNHZQD4T.js').then(e=>({default:e.Source}))),Y=o(()=>import('./root-TZYOIXVG.js').then(e=>({default:e.Root}))),ee=o(()=>import('./root-BS6QCYLO.js').then(e=>({default:e.Root}))),te=o(()=>import('./root-PDSTTPHO.js').then(e=>({default:e.Root}))),oe=o(()=>import('./plugin-pages-PQWTH7P5.js').then(e=>({default:e.PluginsPage}))),ne=o(()=>import('./plugin-pages-PQWTH7P5.js').then(e=>({default:e.InstalledPluginsPage}))),ae=o(()=>import('./plugin-pages-PQWTH7P5.js').then(e=>({default:e.PluginDetailPage}))),T=o(()=>import('./chat-page-4G4XQ26P.js').then(e=>({default:e.AgentChatPage}))),ie=o(()=>import('./pages-7LWBCW2X.js').then(e=>({default:e.AutomationsPage}))),re=o(()=>import('./pages-7LWBCW2X.js').then(e=>({default:e.RunHistoryPage}))),se=o(()=>import('./pages-7LWBCW2X.js').then(e=>({default:e.ApprovalsPage}))),pe=o(()=>import('./pages-7LWBCW2X.js').then(e=>({default:e.ActivityPage}))),ce=o(()=>import('./pages-7LWBCW2X.js').then(e=>({default:e.ActivityItemPage}))),le=o(()=>import('./pages-7LWBCW2X.js').then(e=>({default:e.CreateAutomationPage}))),me=o(()=>import('./pages-7LWBCW2X.js').then(e=>({default:e.AutomationDetailPage}))),ue=o(()=>import('./pages-7LWBCW2X.js').then(e=>({default:e.RunsPage}))),de=o(()=>import('./pages-7LWBCW2X.js').then(e=>({default:e.RunDetailPage}))),fe=o(()=>import('./skills-pages-G6JK7KKQ.js').then(e=>({default:e.SkillsPage}))),ge=o(()=>import('./skills-pages-G6JK7KKQ.js').then(e=>({default:e.CreateSkillPage}))),he=o(()=>import('./skills-pages-G6JK7KKQ.js').then(e=>({default:e.SkillDetailPage}))),l=[{name:"ai",icon:jsx(Bot,{strokeWidth:1.5}),title:"AI",component:te,routes:[{path:"plugins",component:oe},{path:"plugins/installed",component:ne},{path:"plugins/:pluginId",component:ae},{component:jsx(_,{replace:true,to:"agent"}),path:""},{component:T,path:"agent"},{component:T,path:"agent/chats/:chatId"},{component:ie,path:"automations"},{component:re,path:"runs"},{component:se,path:"approvals"},{component:pe,path:"activity"},{component:ce,path:"activity/:itemId"},{component:le,path:"automations/new"},{component:me,path:"automations/:automationId"},{component:ue,path:"automations/:automationId/runs"},{component:de,path:"automations/:automationId/runs/:runId"},{component:fe,path:"skills"},{component:ge,path:"skills/new"},{component:he,path:"skills/:skillId"}]},{name:"desk",icon:jsx(Layout,{strokeWidth:1.5}),title:"Desk",component:J,routes:[{path:"list/:entity",component:X,children:[{path:"edit/:id",component:q}]}]},{name:"asset-manager",icon:jsx(FileStack,{strokeWidth:1.5}),title:"Asset Manager",component:K,routes:[]},{name:"knowledge",icon:jsx(BookOpenText,{strokeWidth:1.5}),title:"Knowledge",component:G,routes:[{component:$,path:""},{component:Q,path:":sourceId"}]},{name:"graph",icon:jsx(Waypoints,{strokeWidth:1.5}),title:"Graph",component:Y,routes:[]},{name:"explorer",icon:jsx(SquarePlay,{strokeWidth:1.5}),title:"Explorer",component:ee,routes:[]}];async function C(e){try{let t=await fetch(d$1(e).schema,{credentials:"include",mode:"cors"});if(!t.ok){let a=t.statusText||`Request failed with status ${String(t.status)}`;try{let i=await t.json();a=i.error??i.message??a;}catch{}return {ok:!1,projectId:e,error:{status:t.status,message:a}}}let n=await t.json();return {ok:!0,project:{...n,projectId:n.projectId||e}}}catch(t){return {ok:false,projectId:e,error:{status:0,message:t instanceof Error?t.message:"Network error"}}}}function b(e,t){let n=[],a={};for(let i of e??[])i.ok?n.push(i.project):a[i.projectId]=i.error;return {projects:n,errors:a,isLoading:t}}function L(e,t){let n=t&&e.length>0?["project-schemas",t,...e]:null,{data:a,isLoading:i}=w(n,()=>Promise.all(e.map(p=>C(p))),{revalidateOnFocus:false,revalidateOnReconnect:false});return b(a,!!n&&(i||a===void 0))}function Pe(e,t){return b(e?[e]:void 0,t)}function A(e,t){let n=t&&e?["project-schema",t,e]:null,{data:a,isLoading:i}=w(n,()=>C(e??""),{revalidateOnFocus:false,revalidateOnReconnect:false});return Pe(a,!!n&&(i||a===void 0))}function Se(e,t){return Array.isArray(e)&&(e[0]==="project-schema"||e[0]==="project-schemas")&&e.slice(2).includes(t)}function Fe(e){return mutate(t=>Se(t,e))}var R=createContext({mode:"projects",apps:l,contributions:{apps:l},currentProjectId:void 0,currentProject:void 0,currentProjectSchema:[],projects:[],projectIds:[],projectSummaries:[],schemaErrors:{},isLoadingSchemas:false});function xe(e){return [...e.filter(n=>n.name!==d.name&&n.name!==f.name),d,f]}function Xe({projectIds:e,projectSummaries:t=[],mode:n="projects",userId:a,children:i}){let{projectId:p}=useParams(),[,I]=g(),h=I.user?.id??a,V=L(n==="projects"?e:[],h),O=A(n==="hosted"&&p&&e.includes(p)?p:void 0,h),{projects:y,errors:P,isLoading:S}=n==="hosted"?O:V,m=useMemo(()=>e.map(s=>y.find(u=>u.projectId===s)).filter(s=>s!==void 0).map(s=>({...s,schema:xe(s.schema)})),[y,e]),H=useMemo(()=>{let s=m.find(u=>u.projectId===p);return {mode:n,apps:l,contributions:{apps:l},currentProjectId:p,currentProject:s,currentProjectSchema:s?.schema??[],projects:m,projectIds:e,projectSummaries:t,schemaErrors:P,isLoadingSchemas:S}},[p,P,S,n,e,t,m]);return jsx(R.Provider,{value:H,children:i})}function qe(){return useContext(R)}
|
|
2
|
+
export{x as a,d as b,f as c,Fe as d,Xe as e,qe as f};//# sourceMappingURL=chunk-B7QMGBK5.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-B7QMGBK5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/entities/assets-schema.ts","../src/entities/tags-schema.ts","../src/ui/components/loading.tsx","../src/core/apps/built-in-apps.tsx","../src/core/config/use-project-schemas.ts","../src/core/config/config-context.tsx"],"names":["assetSchema","tagSchema","Loading","resolvedTheme","useTheme","jsx","jsxs","NavigateCompat","Navigate","lazyElement","loader","Component","lazy","Suspense","deskRoot","m","deskList","deskEditEntity","assetManagerRoot","knowledgeRoot","knowledgeList","knowledgeSource","graphRoot","explorerRoot","aiRoot","aiPluginsPage","aiInstalledPluginsPage","aiPluginDetailPage","aiAgentChatPage","aiAutomationsPage","aiRunHistoryPage","aiApprovalsPage","aiActivityPage","aiActivityItemPage","aiCreateAutomationPage","aiAutomationDetailPage","aiRunsPage","aiRunDetailPage","aiSkillsPage","aiCreateSkillPage","aiSkillDetailPage","builtInApps","BotIcon","LayoutIcon","FileStackIcon","BookOpenTextIcon","WaypointsIcon","SquarePlayIcon","fetchProjectSchema","projectId","response","apiPaths","message","body","project","error","toProjectSchemasState","outcomes","isLoading","projects","errors","outcome","useProjectSchemas","projectIds","userId","key","data","useSWR","toProjectSchemaState","useProjectSchema","isProjectSchemaKey","revalidateProjectSchema","mutate","ConfigContext","createContext","upsertReservedEntities","schema","entity","ConfigProvider","projectSummaries","mode","children","currentProjectId","useParams","auth","useAuth","schemaUserId","allSchemas","currentSchema","loadedProjects","useMemo","value","currentProject","useConfig","useContext"],"mappings":"uXAEO,IAAMA,CAAAA,CAAsB,CACjC,IAAA,CAAM,QAAA,CACN,OAAQ,SAAA,CACR,OAAA,CAAS,kBAAA,CACT,IAAA,CAAM,CACJ,MAAA,CAAQ,IACV,CAAA,CACA,UAAA,CAAY,CACV,CACE,IAAA,CAAM,OACN,KAAA,CAAO,OAAA,CACP,KAAA,CAAO,QAAA,CACP,OAAA,CAAS,CACP,KAAM,GACR,CAAA,CACA,SAAU,QAAA,CACV,SAAA,CAAW,OACX,WAAA,CAAa,mBAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,KAAM,kBAAA,CACN,KAAA,CAAO,WACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,QAAA,CACV,UAAW,MAAA,CACX,WAAA,CAAa,OACb,YAAA,CAAc,EAChB,EACA,CACE,IAAA,CAAM,MAAA,CACN,KAAA,CAAO,MAAA,CACP,KAAA,CAAO,SACP,OAAA,CAAS,CACP,KAAM,GACR,CAAA,CACA,SAAU,KAAA,CACV,SAAA,CAAW,MAAA,CACX,WAAA,CAAa,MAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,KAAM,OAAA,CACN,KAAA,CAAO,QACP,KAAA,CAAO,QAAA,CACP,OAAA,CAAS,CACP,IAAA,CAAM,EACR,EACA,QAAA,CAAU,KAAA,CACV,UAAW,MAAA,CACX,WAAA,CAAa,OACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,IAAA,CAAM,QAAA,CACN,MAAO,QAAA,CACP,KAAA,CAAO,SACP,OAAA,CAAS,CACP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js","sourcesContent":["import type { Entity } from '../core/types';\n\nexport const assetSchema: Entity = {\n name: '_asset',\n plural: '_assets',\n display: 'originalFilename',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'path',\n label: 'Asset',\n scope: 'global',\n options: {\n size: 140,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'assetPreviewField',\n defaultValue: '',\n },\n {\n name: 'originalFilename',\n label: 'Filename',\n scope: 'global',\n options: {\n size: 320,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'size',\n label: 'Size',\n scope: 'global',\n options: {\n size: 120,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'width',\n label: 'Width',\n scope: 'global',\n options: {\n size: 90,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'height',\n label: 'Height',\n scope: 'global',\n options: {\n size: 100,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'mimeType',\n label: 'Mime Type',\n scope: 'global',\n options: {\n size: 160,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'lqip',\n label: 'lqip',\n scope: 'global',\n hidden: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'url',\n label: 'URL',\n scope: 'global',\n hidden: true,\n readOnly: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'tags',\n label: 'Tags',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n previewType: 'tags',\n options: {\n size: 300,\n },\n relationship: {\n mode: 'multiple',\n field: 'name',\n entity: '_tag',\n },\n },\n ],\n};\n","import type { Entity } from '../core/types';\n\nexport const tagSchema: Entity = {\n name: '_tag',\n plural: '_tags',\n display: 'name',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'name',\n label: 'Tag Name',\n scope: 'global',\n options: {\n size: 220,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'assets',\n label: 'Assets',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n relationship: {\n mode: 'multiple',\n field: 'originalFilename',\n entity: '_asset',\n },\n },\n ],\n};\n","import type { JSX } from 'react';\nimport { useTheme } from '../theme-context';\n\nexport function Loading(): JSX.Element {\n const { resolvedTheme } = useTheme();\n\n return (\n <div className=\"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background\">\n <div className=\"fk:flex fk:flex-col fk:items-center\">\n {resolvedTheme === 'dark' ? (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"#020817\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"white\"\n />\n </svg>\n ) : (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"white\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"#020817\"\n />\n </svg>\n )}\n <div className=\"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse\">Loading...</div>\n </div>\n </div>\n );\n}\n","import { lazy, Suspense } from 'react';\nimport type { ComponentType, JSX } from 'react';\nimport {\n BookOpenText as BookOpenTextIcon,\n Bot as BotIcon,\n FileStack as FileStackIcon,\n Layout as LayoutIcon,\n SquarePlay as SquarePlayIcon,\n Waypoints as WaypointsIcon,\n} from 'lucide-react';\nimport { Navigate } from 'react-router-dom';\nimport { Loading } from '../../ui/components/loading';\nimport type { AppOptions } from '../config/types';\n\nconst NavigateCompat = Navigate as unknown as ComponentType<{\n replace?: boolean;\n to: string;\n}>;\n\n/**\n * Wraps a lazily imported component in Suspense so each built-in app (and each of its routes)\n * is only downloaded when it is first rendered.\n */\nfunction lazyElement(loader: () => Promise<{ default: ComponentType }>): JSX.Element {\n const Component = lazy(loader);\n\n return (\n <Suspense fallback={<Loading />}>\n <Component />\n </Suspense>\n );\n}\n\n// Desk\nconst deskRoot = lazyElement(() => import('../../apps/desk/root').then((m) => ({ default: m.Root })));\nconst deskList = lazyElement(() => import('../../apps/desk/list').then((m) => ({ default: m.List })));\nconst deskEditEntity = lazyElement(() =>\n import('../../apps/desk/edit-entity').then((m) => ({ default: m.EditEntity }))\n);\n\n// Asset Manager\nconst assetManagerRoot = lazyElement(() => import('../../apps/asset-manager/root').then((m) => ({ default: m.Root })));\n\n// Knowledge\nconst knowledgeRoot = lazyElement(() => import('../../apps/knowledge/root').then((m) => ({ default: m.Root })));\nconst knowledgeList = lazyElement(() => import('../../apps/knowledge/list').then((m) => ({ default: m.List })));\nconst knowledgeSource = lazyElement(() => import('../../apps/knowledge/source').then((m) => ({ default: m.Source })));\n\n// Graph\nconst graphRoot = lazyElement(() => import('../../apps/graph/root').then((m) => ({ default: m.Root })));\n\n// Explorer\nconst explorerRoot = lazyElement(() => import('../../apps/explorer/root').then((m) => ({ default: m.Root })));\n\n// AI\nconst aiRoot = lazyElement(() => import('../../apps/ai/root').then((m) => ({ default: m.Root })));\nconst aiPluginsPage = lazyElement(() => import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginsPage })));\nconst aiInstalledPluginsPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.InstalledPluginsPage }))\n);\nconst aiPluginDetailPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginDetailPage }))\n);\nconst aiAgentChatPage = lazyElement(() =>\n import('../../apps/ai/agent/chat-page').then((m) => ({ default: m.AgentChatPage }))\n);\nconst aiAutomationsPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationsPage }))\n);\nconst aiRunHistoryPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunHistoryPage })));\nconst aiApprovalsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ApprovalsPage })));\nconst aiActivityPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ActivityPage })));\nconst aiActivityItemPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.ActivityItemPage }))\n);\nconst aiCreateAutomationPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.CreateAutomationPage }))\n);\nconst aiAutomationDetailPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationDetailPage }))\n);\nconst aiRunsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunsPage })));\nconst aiRunDetailPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunDetailPage })));\nconst aiSkillsPage = lazyElement(() => import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillsPage })));\nconst aiCreateSkillPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.CreateSkillPage }))\n);\nconst aiSkillDetailPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillDetailPage }))\n);\n\nexport const builtInApps: AppOptions[] = [\n {\n name: 'ai',\n icon: <BotIcon strokeWidth={1.5} />,\n title: 'AI',\n component: aiRoot,\n routes: [\n { path: 'plugins', component: aiPluginsPage },\n { path: 'plugins/installed', component: aiInstalledPluginsPage },\n { path: 'plugins/:pluginId', component: aiPluginDetailPage },\n {\n component: <NavigateCompat replace to=\"agent\" />,\n path: '',\n },\n {\n component: aiAgentChatPage,\n path: 'agent',\n },\n {\n component: aiAgentChatPage,\n path: 'agent/chats/:chatId',\n },\n {\n component: aiAutomationsPage,\n path: 'automations',\n },\n {\n component: aiRunHistoryPage,\n path: 'runs',\n },\n {\n component: aiApprovalsPage,\n path: 'approvals',\n },\n {\n component: aiActivityPage,\n path: 'activity',\n },\n {\n component: aiActivityItemPage,\n path: 'activity/:itemId',\n },\n {\n component: aiCreateAutomationPage,\n path: 'automations/new',\n },\n {\n component: aiAutomationDetailPage,\n path: 'automations/:automationId',\n },\n {\n component: aiRunsPage,\n path: 'automations/:automationId/runs',\n },\n {\n component: aiRunDetailPage,\n path: 'automations/:automationId/runs/:runId',\n },\n {\n component: aiSkillsPage,\n path: 'skills',\n },\n {\n component: aiCreateSkillPage,\n path: 'skills/new',\n },\n {\n component: aiSkillDetailPage,\n path: 'skills/:skillId',\n },\n ],\n },\n {\n name: 'desk',\n icon: <LayoutIcon strokeWidth={1.5} />,\n title: 'Desk',\n component: deskRoot,\n routes: [\n {\n path: 'list/:entity',\n component: deskList,\n children: [\n {\n path: 'edit/:id',\n component: deskEditEntity, // Not used, left here as an example of how to nest routes in apps\n },\n ],\n },\n ],\n },\n {\n name: 'asset-manager',\n icon: <FileStackIcon strokeWidth={1.5} />,\n title: 'Asset Manager',\n component: assetManagerRoot,\n routes: [],\n },\n {\n name: 'knowledge',\n icon: <BookOpenTextIcon strokeWidth={1.5} />,\n title: 'Knowledge',\n component: knowledgeRoot,\n routes: [\n {\n component: knowledgeList,\n path: '',\n },\n {\n component: knowledgeSource,\n path: ':sourceId',\n },\n ],\n },\n {\n name: 'graph',\n icon: <WaypointsIcon strokeWidth={1.5} />,\n title: 'Graph',\n component: graphRoot,\n routes: [],\n },\n {\n name: 'explorer',\n icon: <SquarePlayIcon strokeWidth={1.5} />,\n title: 'Explorer',\n component: explorerRoot,\n routes: [],\n },\n];\n","'use client';\n\nimport useSWR, { mutate } from 'swr';\nimport { apiPaths } from '../api-paths';\nimport type { ProjectSchemaError, ProjectUiConfig } from './types';\n\nexport type ProjectSchemasState = {\n projects: ProjectUiConfig[];\n errors: { [projectId: string]: ProjectSchemaError };\n isLoading: boolean;\n};\n\ntype FetchOutcome = { ok: true; project: ProjectUiConfig } | { ok: false; projectId: string; error: ProjectSchemaError };\n\nasync function fetchProjectSchema(projectId: string): Promise<FetchOutcome> {\n try {\n const response = await fetch(apiPaths(projectId).schema, { credentials: 'include', mode: 'cors' });\n\n if (!response.ok) {\n let message = response.statusText || `Request failed with status ${String(response.status)}`;\n\n try {\n const body = (await response.json()) as { error?: string; message?: string };\n message = body.error ?? body.message ?? message;\n } catch {\n // keep the status text\n }\n\n return { ok: false, projectId, error: { status: response.status, message } };\n }\n\n const project = (await response.json()) as ProjectUiConfig;\n\n return { ok: true, project: { ...project, projectId: project.projectId || projectId } };\n } catch (error) {\n return {\n ok: false,\n projectId,\n error: { status: 0, message: error instanceof Error ? error.message : 'Network error' },\n };\n }\n}\n\nexport function toProjectSchemasState(outcomes: FetchOutcome[] | undefined, isLoading: boolean): ProjectSchemasState {\n const projects: ProjectUiConfig[] = [];\n const errors: { [projectId: string]: ProjectSchemaError } = {};\n\n for (const outcome of outcomes ?? []) {\n if (outcome.ok) {\n projects.push(outcome.project);\n } else {\n errors[outcome.projectId] = outcome.error;\n }\n }\n\n return { projects, errors, isLoading };\n}\n\n/**\n * Loads the deployed schema of every project the Studio can open. Fetching\n * starts once the user is known (the endpoint needs a session) and the result\n * is kept for the lifetime of the page: schemas only change on deploy.\n */\nexport function useProjectSchemas(projectIds: string[], userId: string | undefined): ProjectSchemasState {\n const key = userId && projectIds.length > 0 ? ['project-schemas', userId, ...projectIds] : null;\n const { data, isLoading } = useSWR(key, () => Promise.all(projectIds.map((projectId) => fetchProjectSchema(projectId))), {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n });\n\n return toProjectSchemasState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** State of a single project's schema, in the same shape as the multi-project hook. */\nexport function toProjectSchemaState(outcome: FetchOutcome | undefined, isLoading: boolean): ProjectSchemasState {\n return toProjectSchemasState(outcome ? [outcome] : undefined, isLoading);\n}\n\n/**\n * Hosted mode: loads only the project currently open. Each project has its own\n * SWR key, so switching back to a project reuses the schema already fetched.\n */\nexport function useProjectSchema(projectId: string | undefined, userId: string | undefined): ProjectSchemasState {\n const key = userId && projectId ? ['project-schema', userId, projectId] : null;\n const { data, isLoading } = useSWR(key, () => fetchProjectSchema(projectId ?? ''), {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n });\n\n return toProjectSchemaState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** True for the SWR keys that hold `projectId`'s schema (single- and multi-project hooks). */\nexport function isProjectSchemaKey(key: unknown, projectId: string): boolean {\n return (\n Array.isArray(key) &&\n (key[0] === 'project-schema' || key[0] === 'project-schemas') &&\n key.slice(2).includes(projectId)\n );\n}\n\n/** Refetches the deployed schema of `projectId`, e.g. after the agent deployed a schema change. */\nexport function revalidateProjectSchema(projectId: string): Promise<unknown> {\n return mutate((key) => isProjectSchemaKey(key, projectId));\n}\n","'use client';\n\nimport { createContext, useContext, useMemo } from 'react';\nimport type { JSX } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { useAuth } from '../../auth/auth-context';\nimport { assetSchema } from '../../entities/assets-schema';\nimport { tagSchema } from '../../entities/tags-schema';\nimport { builtInApps } from '../apps/built-in-apps';\nimport type { AppOptions, ProjectSchemaError, ProjectSummary, ProjectUiConfig, StudioMode } from './types';\nimport type { Entity } from '../types';\nimport { useProjectSchema, useProjectSchemas } from './use-project-schemas';\n\nexport interface ConfigContext {\n /** `projects` when the host passed `projectIds`, `hosted` when the Studio listed the user's projects itself. */\n mode: StudioMode;\n /** The Studio apps shown in the app bar, in order. */\n apps: AppOptions[];\n /** Kept for callers that read `contributions.apps`; same list as `apps`. */\n contributions: {\n apps: AppOptions[];\n };\n currentProjectId?: string;\n /** The project named by the `:projectId` route param, once its schema has loaded. */\n currentProject?: ProjectUiConfig;\n currentProjectSchema: Entity[];\n /** Projects whose schema loaded, in `projectIds` order. */\n projects: ProjectUiConfig[];\n /** Every project id the Studio can open, loaded or not. */\n projectIds: string[];\n /** Hosted mode: name, avatar, role and team of each project, known before any schema loads. */\n projectSummaries: ProjectSummary[];\n /** Per project id: why its schema could not be loaded. */\n schemaErrors: { [projectId: string]: ProjectSchemaError };\n isLoadingSchemas: boolean;\n}\n\nconst ConfigContext = createContext<ConfigContext>({\n mode: 'projects',\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId: undefined,\n currentProject: undefined,\n currentProjectSchema: [],\n projects: [],\n projectIds: [],\n projectSummaries: [],\n schemaErrors: {},\n isLoadingSchemas: false,\n});\n\n/** Appends the reserved asset and tag entities to a deployed schema. */\nexport function upsertReservedEntities(schema: Entity[]): Entity[] {\n const withoutReserved = schema.filter((entity) => entity.name !== assetSchema.name && entity.name !== tagSchema.name);\n\n return [...withoutReserved, assetSchema, tagSchema];\n}\n\nexport function ConfigProvider({\n projectIds,\n projectSummaries = [],\n mode = 'projects',\n userId,\n children,\n}: {\n projectIds: string[];\n projectSummaries?: ProjectSummary[];\n mode?: StudioMode;\n /** Hosted mode: the signed-in user's id, known before the per-project `/users/me` call. */\n userId?: string;\n children: React.ReactNode;\n}): JSX.Element {\n /**\n * Getting the projectId from the URL via react-router-dom's useParams hook triggers a rerender of this Context\n * every time the URL changes.\n */\n const { projectId: currentProjectId } = useParams<{ projectId: string }>();\n const [, auth] = useAuth();\n const schemaUserId = auth.user?.id ?? userId;\n // Project mode loads every project up front (short, host-defined list); hosted mode only the one open.\n const allSchemas = useProjectSchemas(mode === 'projects' ? projectIds : [], schemaUserId);\n const currentSchema = useProjectSchema(\n mode === 'hosted' && currentProjectId && projectIds.includes(currentProjectId) ? currentProjectId : undefined,\n schemaUserId\n );\n const { projects: loadedProjects, errors, isLoading } = mode === 'hosted' ? currentSchema : allSchemas;\n const projects = useMemo(\n () =>\n projectIds\n .map((projectId) => loadedProjects.find((project) => project.projectId === projectId))\n .filter((project): project is ProjectUiConfig => project !== undefined)\n .map((project) => ({ ...project, schema: upsertReservedEntities(project.schema) })),\n [loadedProjects, projectIds]\n );\n\n const value = useMemo<ConfigContext>(() => {\n const currentProject = projects.find((project) => project.projectId === currentProjectId);\n\n return {\n mode,\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId,\n currentProject,\n currentProjectSchema: currentProject?.schema ?? [],\n projects,\n projectIds,\n projectSummaries,\n schemaErrors: errors,\n isLoadingSchemas: isLoading,\n };\n }, [currentProjectId, errors, isLoading, mode, projectIds, projectSummaries, projects]);\n\n return <ConfigContext.Provider value={value}>{children}</ConfigContext.Provider>;\n}\n\nexport function useConfig(): ConfigContext {\n return useContext(ConfigContext);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/entities/assets-schema.ts","../src/entities/tags-schema.ts","../src/ui/components/loading.tsx","../src/core/apps/built-in-apps.tsx","../src/core/config/use-project-schemas.ts","../src/core/config/config-context.tsx"],"names":["assetSchema","tagSchema","Loading","resolvedTheme","useTheme","jsx","jsxs","NavigateCompat","Navigate","lazyElement","loader","Component","lazy","Suspense","deskRoot","m","deskList","deskEditEntity","assetManagerRoot","knowledgeRoot","knowledgeList","knowledgeSource","graphRoot","explorerRoot","aiRoot","aiPluginsPage","aiInstalledPluginsPage","aiPluginDetailPage","aiAgentChatPage","aiAutomationsPage","aiRunHistoryPage","aiApprovalsPage","aiActivityPage","aiActivityItemPage","aiCreateAutomationPage","aiAutomationDetailPage","aiRunsPage","aiRunDetailPage","aiSkillsPage","aiCreateSkillPage","aiSkillDetailPage","builtInApps","BotIcon","LayoutIcon","FileStackIcon","BookOpenTextIcon","WaypointsIcon","SquarePlayIcon","fetchProjectSchema","projectId","response","apiPaths","message","body","project","error","toProjectSchemasState","outcomes","isLoading","projects","errors","outcome","useProjectSchemas","projectIds","userId","key","data","useSWR","toProjectSchemaState","useProjectSchema","isProjectSchemaKey","revalidateProjectSchema","mutate","ConfigContext","createContext","upsertReservedEntities","schema","entity","ConfigProvider","projectSummaries","mode","children","currentProjectId","useParams","auth","useAuth","schemaUserId","allSchemas","currentSchema","loadedProjects","useMemo","value","currentProject","useConfig","useContext"],"mappings":"uXAEO,IAAMA,CAAAA,CAAsB,CACjC,IAAA,CAAM,QAAA,CACN,OAAQ,SAAA,CACR,OAAA,CAAS,kBAAA,CACT,IAAA,CAAM,CACJ,MAAA,CAAQ,IACV,CAAA,CACA,UAAA,CAAY,CACV,CACE,IAAA,CAAM,OACN,KAAA,CAAO,OAAA,CACP,KAAA,CAAO,QAAA,CACP,OAAA,CAAS,CACP,KAAM,GACR,CAAA,CACA,SAAU,QAAA,CACV,SAAA,CAAW,OACX,WAAA,CAAa,mBAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,KAAM,kBAAA,CACN,KAAA,CAAO,WACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,QAAA,CACV,UAAW,MAAA,CACX,WAAA,CAAa,OACb,Y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oBAAA,CAAsBA,CAAAA,EAAgB,MAAA,EAAU,EAAC,CACjD,QAAA,CAAAjC,EACA,UAAA,CAAAI,CAAAA,CACA,iBAAAgB,CAAAA,CACA,YAAA,CAAcnB,EACd,gBAAA,CAAkBF,CACpB,CACF,CAAA,CAAG,CAACwB,CAAAA,CAAkBtB,EAAQF,CAAAA,CAAWsB,CAAAA,CAAMjB,EAAYgB,CAAAA,CAAkBpB,CAAQ,CAAC,CAAA,CAEtF,OAAOtD,GAAAA,CAACoE,CAAAA,CAAc,QAAA,CAAd,CAAuB,MAAOkB,CAAAA,CAAQ,QAAA,CAAAV,CAAAA,CAAS,CACzD,CAEO,SAASY,IAA2B,CACzC,OAAOC,UAAAA,CAAWrB,CAAa,CACjC","file":"chunk-B7QMGBK5.js","sourcesContent":["import type { Entity } from '../core/types';\n\nexport const assetSchema: Entity = {\n name: '_asset',\n plural: '_assets',\n display: 'originalFilename',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'path',\n label: 'Asset',\n scope: 'global',\n options: {\n size: 140,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'assetPreviewField',\n defaultValue: '',\n },\n {\n name: 'originalFilename',\n label: 'Filename',\n scope: 'global',\n options: {\n size: 320,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'size',\n label: 'Size',\n scope: 'global',\n options: {\n size: 120,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'width',\n label: 'Width',\n scope: 'global',\n options: {\n size: 90,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'height',\n label: 'Height',\n scope: 'global',\n options: {\n size: 100,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'mimeType',\n label: 'Mime Type',\n scope: 'global',\n options: {\n size: 160,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'lqip',\n label: 'lqip',\n scope: 'global',\n hidden: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'url',\n label: 'URL',\n scope: 'global',\n hidden: true,\n readOnly: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'tags',\n label: 'Tags',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n previewType: 'tags',\n options: {\n size: 300,\n },\n relationship: {\n mode: 'multiple',\n field: 'name',\n entity: '_tag',\n },\n },\n ],\n};\n","import type { Entity } from '../core/types';\n\nexport const tagSchema: Entity = {\n name: '_tag',\n plural: '_tags',\n display: 'name',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'name',\n label: 'Tag Name',\n scope: 'global',\n options: {\n size: 220,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'assets',\n label: 'Assets',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n relationship: {\n mode: 'multiple',\n field: 'originalFilename',\n entity: '_asset',\n },\n },\n ],\n};\n","import type { JSX } from 'react';\nimport { useTheme } from '../theme-context';\n\nexport function Loading(): JSX.Element {\n const { resolvedTheme } = useTheme();\n\n return (\n <div className=\"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background\">\n <div className=\"fk:flex fk:flex-col fk:items-center\">\n {resolvedTheme === 'dark' ? (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"#020817\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"white\"\n />\n </svg>\n ) : (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"white\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"#020817\"\n />\n </svg>\n )}\n <div className=\"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse\">Loading...</div>\n </div>\n </div>\n );\n}\n","import { lazy, Suspense } from 'react';\nimport type { ComponentType, JSX } from 'react';\nimport {\n BookOpenText as BookOpenTextIcon,\n Bot as BotIcon,\n FileStack as FileStackIcon,\n Layout as LayoutIcon,\n SquarePlay as SquarePlayIcon,\n Waypoints as WaypointsIcon,\n} from 'lucide-react';\nimport { Navigate } from 'react-router-dom';\nimport { Loading } from '../../ui/components/loading';\nimport type { AppOptions } from '../config/types';\n\nconst NavigateCompat = Navigate as unknown as ComponentType<{\n replace?: boolean;\n to: string;\n}>;\n\n/**\n * Wraps a lazily imported component in Suspense so each built-in app (and each of its routes)\n * is only downloaded when it is first rendered.\n */\nfunction lazyElement(loader: () => Promise<{ default: ComponentType }>): JSX.Element {\n const Component = lazy(loader);\n\n return (\n <Suspense fallback={<Loading />}>\n <Component />\n </Suspense>\n );\n}\n\n// Desk\nconst deskRoot = lazyElement(() => import('../../apps/desk/root').then((m) => ({ default: m.Root })));\nconst deskList = lazyElement(() => import('../../apps/desk/list').then((m) => ({ default: m.List })));\nconst deskEditEntity = lazyElement(() =>\n import('../../apps/desk/edit-entity').then((m) => ({ default: m.EditEntity }))\n);\n\n// Asset Manager\nconst assetManagerRoot = lazyElement(() => import('../../apps/asset-manager/root').then((m) => ({ default: m.Root })));\n\n// Knowledge\nconst knowledgeRoot = lazyElement(() => import('../../apps/knowledge/root').then((m) => ({ default: m.Root })));\nconst knowledgeList = lazyElement(() => import('../../apps/knowledge/list').then((m) => ({ default: m.List })));\nconst knowledgeSource = lazyElement(() => import('../../apps/knowledge/source').then((m) => ({ default: m.Source })));\n\n// Graph\nconst graphRoot = lazyElement(() => import('../../apps/graph/root').then((m) => ({ default: m.Root })));\n\n// Explorer\nconst explorerRoot = lazyElement(() => import('../../apps/explorer/root').then((m) => ({ default: m.Root })));\n\n// AI\nconst aiRoot = lazyElement(() => import('../../apps/ai/root').then((m) => ({ default: m.Root })));\nconst aiPluginsPage = lazyElement(() => import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginsPage })));\nconst aiInstalledPluginsPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.InstalledPluginsPage }))\n);\nconst aiPluginDetailPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginDetailPage }))\n);\nconst aiAgentChatPage = lazyElement(() =>\n import('../../apps/ai/agent/chat-page').then((m) => ({ default: m.AgentChatPage }))\n);\nconst aiAutomationsPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationsPage }))\n);\nconst aiRunHistoryPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunHistoryPage })));\nconst aiApprovalsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ApprovalsPage })));\nconst aiActivityPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ActivityPage })));\nconst aiActivityItemPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.ActivityItemPage }))\n);\nconst aiCreateAutomationPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.CreateAutomationPage }))\n);\nconst aiAutomationDetailPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationDetailPage }))\n);\nconst aiRunsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunsPage })));\nconst aiRunDetailPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunDetailPage })));\nconst aiSkillsPage = lazyElement(() => import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillsPage })));\nconst aiCreateSkillPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.CreateSkillPage }))\n);\nconst aiSkillDetailPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillDetailPage }))\n);\n\nexport const builtInApps: AppOptions[] = [\n {\n name: 'ai',\n icon: <BotIcon strokeWidth={1.5} />,\n title: 'AI',\n component: aiRoot,\n routes: [\n { path: 'plugins', component: aiPluginsPage },\n { path: 'plugins/installed', component: aiInstalledPluginsPage },\n { path: 'plugins/:pluginId', component: aiPluginDetailPage },\n {\n component: <NavigateCompat replace to=\"agent\" />,\n path: '',\n },\n {\n component: aiAgentChatPage,\n path: 'agent',\n },\n {\n component: aiAgentChatPage,\n path: 'agent/chats/:chatId',\n },\n {\n component: aiAutomationsPage,\n path: 'automations',\n },\n {\n component: aiRunHistoryPage,\n path: 'runs',\n },\n {\n component: aiApprovalsPage,\n path: 'approvals',\n },\n {\n component: aiActivityPage,\n path: 'activity',\n },\n {\n component: aiActivityItemPage,\n path: 'activity/:itemId',\n },\n {\n component: aiCreateAutomationPage,\n path: 'automations/new',\n },\n {\n component: aiAutomationDetailPage,\n path: 'automations/:automationId',\n },\n {\n component: aiRunsPage,\n path: 'automations/:automationId/runs',\n },\n {\n component: aiRunDetailPage,\n path: 'automations/:automationId/runs/:runId',\n },\n {\n component: aiSkillsPage,\n path: 'skills',\n },\n {\n component: aiCreateSkillPage,\n path: 'skills/new',\n },\n {\n component: aiSkillDetailPage,\n path: 'skills/:skillId',\n },\n ],\n },\n {\n name: 'desk',\n icon: <LayoutIcon strokeWidth={1.5} />,\n title: 'Desk',\n component: deskRoot,\n routes: [\n {\n path: 'list/:entity',\n component: deskList,\n children: [\n {\n path: 'edit/:id',\n component: deskEditEntity, // Not used, left here as an example of how to nest routes in apps\n },\n ],\n },\n ],\n },\n {\n name: 'asset-manager',\n icon: <FileStackIcon strokeWidth={1.5} />,\n title: 'Asset Manager',\n component: assetManagerRoot,\n routes: [],\n },\n {\n name: 'knowledge',\n icon: <BookOpenTextIcon strokeWidth={1.5} />,\n title: 'Knowledge',\n component: knowledgeRoot,\n routes: [\n {\n component: knowledgeList,\n path: '',\n },\n {\n component: knowledgeSource,\n path: ':sourceId',\n },\n ],\n },\n {\n name: 'graph',\n icon: <WaypointsIcon strokeWidth={1.5} />,\n title: 'Graph',\n component: graphRoot,\n routes: [],\n },\n {\n name: 'explorer',\n icon: <SquarePlayIcon strokeWidth={1.5} />,\n title: 'Explorer',\n component: explorerRoot,\n routes: [],\n },\n];\n","'use client';\n\nimport useSWR, { mutate } from 'swr';\nimport { apiPaths } from '../api-paths';\nimport type { ProjectSchemaError, ProjectUiConfig } from './types';\n\nexport type ProjectSchemasState = {\n projects: ProjectUiConfig[];\n errors: { [projectId: string]: ProjectSchemaError };\n isLoading: boolean;\n};\n\ntype FetchOutcome = { ok: true; project: ProjectUiConfig } | { ok: false; projectId: string; error: ProjectSchemaError };\n\nasync function fetchProjectSchema(projectId: string): Promise<FetchOutcome> {\n try {\n const response = await fetch(apiPaths(projectId).schema, { credentials: 'include', mode: 'cors' });\n\n if (!response.ok) {\n let message = response.statusText || `Request failed with status ${String(response.status)}`;\n\n try {\n const body = (await response.json()) as { error?: string; message?: string };\n message = body.error ?? body.message ?? message;\n } catch {\n // keep the status text\n }\n\n return { ok: false, projectId, error: { status: response.status, message } };\n }\n\n const project = (await response.json()) as ProjectUiConfig;\n\n return { ok: true, project: { ...project, projectId: project.projectId || projectId } };\n } catch (error) {\n return {\n ok: false,\n projectId,\n error: { status: 0, message: error instanceof Error ? error.message : 'Network error' },\n };\n }\n}\n\nexport function toProjectSchemasState(outcomes: FetchOutcome[] | undefined, isLoading: boolean): ProjectSchemasState {\n const projects: ProjectUiConfig[] = [];\n const errors: { [projectId: string]: ProjectSchemaError } = {};\n\n for (const outcome of outcomes ?? []) {\n if (outcome.ok) {\n projects.push(outcome.project);\n } else {\n errors[outcome.projectId] = outcome.error;\n }\n }\n\n return { projects, errors, isLoading };\n}\n\n/**\n * Loads the deployed schema of every project the Studio can open. Fetching\n * starts once the user is known (the endpoint needs a session) and the result\n * is kept for the lifetime of the page: schemas only change on deploy.\n */\nexport function useProjectSchemas(projectIds: string[], userId: string | undefined): ProjectSchemasState {\n const key = userId && projectIds.length > 0 ? ['project-schemas', userId, ...projectIds] : null;\n const { data, isLoading } = useSWR(key, () => Promise.all(projectIds.map((projectId) => fetchProjectSchema(projectId))), {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n });\n\n return toProjectSchemasState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** State of a single project's schema, in the same shape as the multi-project hook. */\nexport function toProjectSchemaState(outcome: FetchOutcome | undefined, isLoading: boolean): ProjectSchemasState {\n return toProjectSchemasState(outcome ? [outcome] : undefined, isLoading);\n}\n\n/**\n * Hosted mode: loads only the project currently open. Each project has its own\n * SWR key, so switching back to a project reuses the schema already fetched.\n */\nexport function useProjectSchema(projectId: string | undefined, userId: string | undefined): ProjectSchemasState {\n const key = userId && projectId ? ['project-schema', userId, projectId] : null;\n const { data, isLoading } = useSWR(key, () => fetchProjectSchema(projectId ?? ''), {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n });\n\n return toProjectSchemaState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** True for the SWR keys that hold `projectId`'s schema (single- and multi-project hooks). */\nexport function isProjectSchemaKey(key: unknown, projectId: string): boolean {\n return (\n Array.isArray(key) &&\n (key[0] === 'project-schema' || key[0] === 'project-schemas') &&\n key.slice(2).includes(projectId)\n );\n}\n\n/** Refetches the deployed schema of `projectId`, e.g. after the agent deployed a schema change. */\nexport function revalidateProjectSchema(projectId: string): Promise<unknown> {\n return mutate((key) => isProjectSchemaKey(key, projectId));\n}\n","'use client';\n\nimport { createContext, useContext, useMemo } from 'react';\nimport type { JSX } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { useAuth } from '../../auth/auth-context';\nimport { assetSchema } from '../../entities/assets-schema';\nimport { tagSchema } from '../../entities/tags-schema';\nimport { builtInApps } from '../apps/built-in-apps';\nimport type { AppOptions, ProjectSchemaError, ProjectSummary, ProjectUiConfig, StudioMode } from './types';\nimport type { Entity } from '../types';\nimport { useProjectSchema, useProjectSchemas } from './use-project-schemas';\n\nexport interface ConfigContext {\n /** `projects` when the host passed `projectIds`, `hosted` when the Studio listed the user's projects itself. */\n mode: StudioMode;\n /** The Studio apps shown in the app bar, in order. */\n apps: AppOptions[];\n /** Kept for callers that read `contributions.apps`; same list as `apps`. */\n contributions: {\n apps: AppOptions[];\n };\n currentProjectId?: string;\n /** The project named by the `:projectId` route param, once its schema has loaded. */\n currentProject?: ProjectUiConfig;\n currentProjectSchema: Entity[];\n /** Projects whose schema loaded, in `projectIds` order. */\n projects: ProjectUiConfig[];\n /** Every project id the Studio can open, loaded or not. */\n projectIds: string[];\n /** Hosted mode: name, avatar, role and team of each project, known before any schema loads. */\n projectSummaries: ProjectSummary[];\n /** Per project id: why its schema could not be loaded. */\n schemaErrors: { [projectId: string]: ProjectSchemaError };\n isLoadingSchemas: boolean;\n}\n\nconst ConfigContext = createContext<ConfigContext>({\n mode: 'projects',\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId: undefined,\n currentProject: undefined,\n currentProjectSchema: [],\n projects: [],\n projectIds: [],\n projectSummaries: [],\n schemaErrors: {},\n isLoadingSchemas: false,\n});\n\n/** Appends the reserved asset and tag entities to a deployed schema. */\nexport function upsertReservedEntities(schema: Entity[]): Entity[] {\n const withoutReserved = schema.filter((entity) => entity.name !== assetSchema.name && entity.name !== tagSchema.name);\n\n return [...withoutReserved, assetSchema, tagSchema];\n}\n\nexport function ConfigProvider({\n projectIds,\n projectSummaries = [],\n mode = 'projects',\n userId,\n children,\n}: {\n projectIds: string[];\n projectSummaries?: ProjectSummary[];\n mode?: StudioMode;\n /** Hosted mode: the signed-in user's id, known before the per-project `/users/me` call. */\n userId?: string;\n children: React.ReactNode;\n}): JSX.Element {\n /**\n * Getting the projectId from the URL via react-router-dom's useParams hook triggers a rerender of this Context\n * every time the URL changes.\n */\n const { projectId: currentProjectId } = useParams<{ projectId: string }>();\n const [, auth] = useAuth();\n const schemaUserId = auth.user?.id ?? userId;\n // Project mode loads every project up front (short, host-defined list); hosted mode only the one open.\n const allSchemas = useProjectSchemas(mode === 'projects' ? projectIds : [], schemaUserId);\n const currentSchema = useProjectSchema(\n mode === 'hosted' && currentProjectId && projectIds.includes(currentProjectId) ? currentProjectId : undefined,\n schemaUserId\n );\n const { projects: loadedProjects, errors, isLoading } = mode === 'hosted' ? currentSchema : allSchemas;\n const projects = useMemo(\n () =>\n projectIds\n .map((projectId) => loadedProjects.find((project) => project.projectId === projectId))\n .filter((project): project is ProjectUiConfig => project !== undefined)\n .map((project) => ({ ...project, schema: upsertReservedEntities(project.schema) })),\n [loadedProjects, projectIds]\n );\n\n const value = useMemo<ConfigContext>(() => {\n const currentProject = projects.find((project) => project.projectId === currentProjectId);\n\n return {\n mode,\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId,\n currentProject,\n currentProjectSchema: currentProject?.schema ?? [],\n projects,\n projectIds,\n projectSummaries,\n schemaErrors: errors,\n isLoadingSchemas: isLoading,\n };\n }, [currentProjectId, errors, isLoading, mode, projectIds, projectSummaries, projects]);\n\n return <ConfigContext.Provider value={value}>{children}</ConfigContext.Provider>;\n}\n\nexport function useConfig(): ConfigContext {\n return useContext(ConfigContext);\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./index.css';import {e,c,b,a,g,h as h$1,m as m$1,k as k$1,n}from'./chunk-4IEOAKKK.js';import {m as m$2,w as w$1}from'./chunk-OOYCTZ3C.js';import {b as b$3}from'./chunk-ZZRA4567.js';import {c as c$3}from'./chunk-BMO7JFAX.js';import {c as c$4}from'./chunk-XMOSCJOI.js';import {u,t,v,r as r$1,w,l as l$1,j,p as p$2,s,q as q$2}from'./chunk-A7XHA2P6.js';import {a as a$2}from'./chunk-ERDARDGB.js';import {f}from'./chunk-H2RWSC56.js';import {na,p,q,r,t as t$2,u as u$1,v as v$1,qa,s as s$1}from'./chunk-DGIY4SKN.js';import {t as t$1}from'./chunk-SZEGGBOC.js';import {b as b$2,c as c$1,h,i,k,l,m,o,p as p$1,q as q$1,r as r$2,t as t$3}from'./chunk-32ZU4MLE.js';import {a as a$1,b as b$4,c as c$2,e as e$1}from'./chunk-USNXQOMJ.js';import {b as b$1}from'./chunk-6NRQMG26.js';import {useState,useMemo,useDeferredValue}from'react';import {BookOpenTextIcon,PaperclipIcon,ChevronRightIcon,LayersIcon,XIcon,PlusIcon,Unlink2Icon,LoaderCircle,SearchIcon}from'lucide-react';import {Link}from'react-router-dom';import H from'swr';import Qe from'swr/infinite';import {jsxs,Fragment,jsx}from'react/jsx-runtime';var Be=50;function fe({disabled:n,label:l,onClick:o}){return jsxs(b$4,{children:[jsx(c$2,{asChild:true,children:jsx(b$1,{"aria-label":l,className:"fk:size-7 fk:shrink-0",disabled:n,size:"icon",variant:"ghost",onClick:o,children:jsx(Unlink2Icon,{className:"fk:size-4"})})}),jsx(e$1,{children:l})]})}function Xe({api:n$1,attachedIds:l$2,onAttached:o,onOpenChange:a,open:s$2,projectId:u,target:r,targetLabel:c$2}){let[p,h$2]=useState(""),m=useDeferredValue(p.trim()),[y,f]=useState(null),b$1=(k,K)=>!s$2||K&&!K.hasMore?null:c(u).sources({limit:Be,offset:k*Be,search:m||void 0}),{data:v,error:w,isLoading:x,setSize:i$1,size:d}=Qe(b$1,b,{keepPreviousData:true}),g=useMemo(()=>s(v?.flatMap(k=>k.sources)??[],l$2),[l$2,v]),L=v?.[v.length-1]?.hasMore??false,C=v!==void 0&&d>v.length;async function A(k){f(k.id);try{let K=await n$1.linkSource(k.id,r);qa.success(K.linked?`Attached "${k.title}".`:`"${k.title}" was already attached.`),o(k),a(!1);}catch(K){qa.error(h$1(K,"The document could not be attached."));}finally{f(null);}}let R;return w?R=jsx("p",{className:"fk:py-6 fk:text-center fk:text-sm fk:text-destructive",children:"The documents could not be loaded."}):x&&!v?R=jsxs("div",{"aria-busy":"true",className:"fk:flex fk:flex-col fk:gap-3 fk:py-2",children:[jsx(t$1,{className:"fk:h-10 fk:w-full"}),jsx(t$1,{className:"fk:h-10 fk:w-full"}),jsx(t$1,{className:"fk:h-10 fk:w-full"})]}):g.length===0&&!L?R=jsx("p",{className:"fk:py-6 fk:text-center fk:text-sm fk:text-muted-foreground",children:m?"No documents match your search.":"Every document is attached already, or there are none yet. Add documents in Knowledge first."}):R=jsxs("ul",{className:"fk:flex fk:max-h-80 fk:flex-col fk:overflow-y-auto fk:-mx-2",children:[g.map(k=>{let K=l$1(k),B=y===k.id;return jsx("li",{children:jsxs("button",{className:"fk:flex fk:w-full fk:min-w-0 fk:items-center fk:gap-3 fk:rounded-lg fk:px-2 fk:py-2 fk:text-left fk:transition-colors fk:hover:bg-accent fk:focus-visible:bg-accent fk:focus-visible:outline-none fk:disabled:opacity-60 fk:corner-squircle",disabled:y!==null,type:"button",onClick:()=>{A(k);},children:[jsx(m$1,{source:k}),jsxs("span",{className:"fk:min-w-0 fk:flex-1",children:[jsx("span",{className:"fk:block fk:truncate fk:text-sm fk:font-medium",children:k.title}),jsxs("span",{className:"fk:block fk:truncate fk:text-xs fk:text-muted-foreground",children:[j(k)," \xB7 ",K.detail]})]}),B?jsx(LoaderCircle,{className:"fk:size-4 fk:shrink-0 fk:animate-spin fk:text-muted-foreground"}):jsx(k$1,{label:K.label,tone:K.tone})]})},k.id)}),L&&!C?jsx("li",{"aria-hidden":true,children:jsx(n,{onVisible:()=>{i$1(k=>k+1);}})}):null,C?jsx("li",{className:"fk:flex fk:justify-center fk:py-2",children:jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin fk:text-muted-foreground"})}):null]}),jsx(c$1,{open:s$2,onOpenChange:a,children:jsxs(h,{className:"fk:sm:max-w-lg",children:[jsxs(i,{children:[jsx(k,{children:"Attach a document"}),jsx(l,{children:r.recordId===void 0?`Documents attached to every ${c$2} are searched before the rest of Knowledge when a question is about one of them, or about ${c$2} in general.`:`Documents attached to ${c$2} are searched before the rest of Knowledge when a question is about it.`})]}),jsxs("div",{className:"fk:relative",children:[jsx(SearchIcon,{className:"fk:pointer-events-none fk:absolute fk:left-2.5 fk:top-1/2 fk:size-4 fk:-translate-y-1/2 fk:text-muted-foreground"}),jsx(s$1,{"aria-label":"Search documents",autoFocus:true,className:"fk:pl-8",placeholder:"Search documents by title",value:p,onChange:k=>h$2(k.target.value)})]}),R]})})}function re({projectId:n,renderAction:l,sources:o}){return jsx("ul",{className:"fk:flex fk:flex-col fk:gap-1 fk:-mx-2",children:o.map(a=>{let s=l$1(a);return jsxs("li",{className:"fk:flex fk:min-w-0 fk:items-center fk:gap-2 fk:rounded-lg fk:px-2 fk:py-1.5 fk:corner-squircle",children:[jsxs(Link,{className:"fk:flex fk:min-w-0 fk:flex-1 fk:items-center fk:gap-3 fk:rounded-md fk:hover:underline fk:underline-offset-2",to:p$2(n,a.id),children:[jsx(m$1,{source:a}),jsxs("span",{className:"fk:min-w-0 fk:flex-1",children:[jsx("span",{className:"fk:block fk:truncate fk:text-sm fk:font-medium",children:a.title}),jsxs("span",{className:"fk:block fk:truncate fk:text-xs fk:text-muted-foreground",children:[j(a)," \xB7 ",s.detail]})]})]}),jsx(k$1,{label:s.label,tone:s.tone}),l?.(a)]},a.id)})})}function yt({entityName:n}){let{api:l,projectId:o}=e(),{currentProject:a$1}=f(),[s,u$1]=useState(false),r=u(a$1?.schema??[],n),c$1=!!r&&t(n),{data:p,error:h}=H(o&&c$1?c(o).entitySources(n):null,b);if(!l||!o||!r||!c$1||h instanceof a&&h.status===404)return null;let m=p?.sources.length??0;return jsxs(Fragment,{children:[jsxs(b$1,{"aria-label":`Knowledge for every ${v(r)}`,className:"fk:mr-2 fk:h-8","data-knowledge-entity-button":true,size:"sm",variant:"outline",onClick:()=>u$1(true),children:[jsx(BookOpenTextIcon,{}),"Knowledge",m>0?jsx(b$2,{className:"fk:corner-squircle",variant:"secondary",children:m}):null]}),jsx(Ue,{api:l,entityLabel:v(r),entityName:n,open:s,projectId:o,onOpenChange:u$1})]})}function Ue({api:n,entityLabel:l$1,entityName:o,onOpenChange:a,open:s,projectId:u}){let r=b$3(),[c$2,p]=useState(false),[h$2,m]=useState(null),{data:y,error:f,isLoading:b$4,mutate:v}=H(c(u).entitySources(o),b),w=y?.sources??[],x=useMemo(()=>({entity:o}),[o]);async function i$1(g$1){m(g$1.id);try{await n.unlinkSource(g$1.id,x),qa.success(`"${g$1.title}" no longer applies to every ${l$1}.`),await v({sources:w.filter(L=>L.id!==g$1.id)},{revalidate:!1}),g();}catch(L){qa.error(h$1(L,"The document could not be detached."));}finally{m(null);}}let d;return f?d=jsx("p",{className:"fk:text-sm fk:text-destructive",children:"The documents could not be loaded."}):b$4&&!y?d=jsxs("div",{"aria-busy":"true",className:"fk:flex fk:flex-col fk:gap-2",children:[jsx(t$1,{className:"fk:h-9 fk:w-full"}),jsx(t$1,{className:"fk:h-9 fk:w-2/3"})]}):w.length===0?d=jsxs("p",{className:"fk:text-sm fk:text-muted-foreground",children:["No documents apply to every ",l$1," yet. Attach a guide, a policy or a spec that holds for all of them and the agent searches it first when asked about any ",l$1,", or about ",l$1," in general."]}):d=jsx(re,{projectId:u,sources:w,renderAction:g=>r?jsx(fe,{disabled:h$2!==null,label:`Detach ${g.title}`,onClick:()=>{i$1(g);}}):null}),jsx(c$1,{open:s,onOpenChange:a,children:jsxs(h,{className:"fk:sm:max-w-lg","data-knowledge-entity-dialog":true,children:[jsxs(i,{children:[jsxs(k,{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(BookOpenTextIcon,{className:"fk:size-4 fk:text-muted-foreground"}),"Knowledge for every ",l$1,y?jsx(b$2,{className:"fk:corner-squircle",variant:"outline",children:w.length}):null]}),jsxs(l,{children:["Documents attached here apply to every ",l$1,"; each record can hold its own on top."]})]}),jsx("div",{className:"fk:max-h-80 fk:overflow-y-auto",children:d}),jsx("div",{className:"fk:flex fk:justify-end",children:jsx(na,{disabled:!r,children:jsxs(b$1,{disabled:!r,size:"sm",variant:"outline",onClick:()=>p(true),children:[jsx(PaperclipIcon,{}),"Attach document"]})})}),jsx(Xe,{api:n,attachedIds:w.map(g=>g.id),open:c$2,projectId:u,target:x,targetLabel:l$1,onAttached:g$1=>{v({sources:w.some(L=>L.id===g$1.id)?w:[...w,g$1]},{revalidate:false}),g();},onOpenChange:p})]})})}function bt({entityName:n,recordId:l,recordLabel:o}){let{api:a$2,projectId:s}=e(),{currentProject:u$1}=f(),r$1=b$3(),[c$1,p$1]=useState(false),[h,m]=useState(false),[y,f$1]=useState(null),b$4=useMemo(()=>({entity:n,recordId:l}),[n,l]),v$1=u(u$1?.schema??[],n),w=v$1?v(v$1):n,x=t(n),{data:i,error:d,isLoading:g$1,mutate:L}=H(s&&x?c(s).recordSources(b$4):null,b);if(!a$2||!s||!x||d instanceof a&&d.status===404)return null;let C=i?.sources??[],A=i?.inherited??[],R=C.map(N=>N.id),k=a$2;async function K(N){f$1(N.id);try{await k.unlinkSource(N.id,b$4),qa.success(`Detached "${N.title}".`),await L({sources:C.filter($=>$.id!==N.id),inherited:A},{revalidate:!1}),g();}catch($){qa.error(h$1($,"The document could not be detached."));}finally{f$1(null);}}let B;return d?B=jsx("p",{className:"fk:text-sm fk:text-destructive",children:"The attached documents could not be loaded."}):g$1&&!i?B=jsxs("div",{"aria-busy":"true",className:"fk:flex fk:flex-col fk:gap-2",children:[jsx(t$1,{className:"fk:h-9 fk:w-full"}),jsx(t$1,{className:"fk:h-9 fk:w-2/3"})]}):B=jsxs("div",{className:"fk:flex fk:flex-col fk:gap-4",children:[C.length===0?jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:A.length>0?"No documents attached to this record itself; the ones below apply to every record of its type.":"No documents attached. Attach a manual, spec or contract and the agent will use it alongside the record's data when asked about this record."}):jsx(re,{projectId:s,sources:C,renderAction:N=>r$1?jsx(fe,{disabled:y!==null,label:`Detach ${N.title}`,onClick:()=>{K(N);}}):null}),A.length>0?jsxs("div",{className:"fk:flex fk:flex-col fk:gap-1","data-knowledge-inherited":true,children:[jsxs("span",{className:"fk:text-xs fk:font-medium fk:uppercase fk:tracking-wide fk:text-muted-foreground",children:["Applies to every ",w]}),jsx(re,{projectId:s,sources:A})]}):null]}),jsx(a$1,{children:jsxs(p,{className:`fk:z-10 fk:flex fk:shrink-0 fk:flex-col fk:border-t fk:bg-background ${c$1?"fk:h-1/2":""}`,"data-knowledge-record-panel":true,open:c$1,onOpenChange:p$1,children:[jsxs("div",{className:"fk:flex fk:shrink-0 fk:items-center fk:gap-2 fk:pl-4 fk:pr-10 fk:py-2",children:[jsx(q,{asChild:true,children:jsxs("button",{className:"fk:flex fk:min-w-0 fk:flex-1 fk:items-center fk:gap-2 fk:rounded-md fk:py-1 fk:text-left fk:text-sm fk:font-semibold fk:tracking-tight fk:hover:text-foreground/80 fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-ring",type:"button",children:[jsx(ChevronRightIcon,{className:`fk:size-4 fk:shrink-0 fk:text-muted-foreground fk:transition-transform ${c$1?"fk:rotate-90":""}`}),jsx(BookOpenTextIcon,{className:"fk:size-4 fk:shrink-0 fk:text-muted-foreground"}),"Knowledge",i?jsx(b$2,{className:"fk:corner-squircle",variant:"outline",children:C.length+A.length}):null]})}),c$1?jsx(na,{disabled:!r$1,children:jsxs(b$1,{disabled:!r$1,size:"sm",variant:"outline",onClick:()=>m(true),children:[jsx(PaperclipIcon,{}),"Attach document"]})}):null]}),jsx(r,{className:"fk:min-h-0 fk:flex-1 fk:overflow-y-auto fk:px-10 fk:pb-6",children:B}),jsx(Xe,{api:a$2,attachedIds:R,open:h,projectId:s,target:b$4,targetLabel:o||`this ${n}`,onAttached:N=>{L({sources:C.some($=>$.id===N.id)?C:[...C,N],inherited:A.filter($=>$.id!==N.id)},{revalidate:false}),g();},onOpenChange:m})]})})}function Ze(n,l,o){let{scope:a}=c$4(),s=n.links.map(r=>r.recordId),{data:u}=w$1({entityNamePlural:n.entityPlural,schema:l,scope:a,selection:"display",includeCount:false,variables:{where:{_id:{in:s}},limit:s.length}});return useMemo(()=>{let r={};for(let c of u??[]){let p=c[o.name];typeof p=="string"&&p.trim()&&(r[c._id]=p);}return r},[u,o])}function Ye(n){let{currentProject:l}=f(),o=useMemo(()=>l?.schema??[],[l]),a=m$2(o,n.group.entityPlural),s=a$2(a);return !a||!s?jsx(Je,{...n,entityLabel:a?v(a):n.group.entityPlural,labels:{}}):jsx(et,{...n,displayAttribute:s,schema:o,entityLabel:v(a)})}function et({displayAttribute:n,entityLabel:l,schema:o,...a}){let s=Ze(a.group,o,n);return jsx(Je,{...a,entityLabel:l,labels:s})}function Je({canMutate:n,detachingKey:l,entityLabel:o,group:a,labels:s,onDetach:u}){let r=c$3();return jsxs("div",{className:"fk:flex fk:flex-col fk:gap-1",children:[jsx("span",{className:"fk:text-xs fk:font-medium fk:uppercase fk:tracking-wide fk:text-muted-foreground",children:o}),jsx("ul",{className:"fk:flex fk:flex-col fk:-mx-2",children:a.links.map(c=>{let p=q$2(c,s[c.recordId]),h=`${c.entity}:${c.recordId}`;return jsxs("li",{className:"fk:flex fk:min-w-0 fk:items-center fk:gap-2 fk:rounded-lg fk:px-2 fk:py-1 fk:corner-squircle",children:[jsx("button",{className:"fk:min-w-0 fk:flex-1 fk:truncate fk:text-left fk:text-sm fk:hover:underline fk:underline-offset-2",title:c.recordId,type:"button",onClick:()=>r({type:"EditEntity",payload:{entityId:c.recordId,entityNamePlural:a.entityPlural}}),children:p}),n?jsx(fe,{disabled:l!==null,label:`Detach from ${p}`,onClick:()=>u(c)}):null]},h)})})]})}function vt({api:n,projectId:l,source:o}){let a=b$3(),[s,u]=useState(null),{data:r,error:c$1,isLoading:p,mutate:h}=H(c(l).links(o.id),b),m=useMemo(()=>r?.links??[],[r]),y=useMemo(()=>r?.entities??[],[r]),f=useMemo(()=>r$1(m),[m]);async function b$1(i){u(`${i.entity}:${i.recordId}`);try{await n.unlinkSource(o.id,{entity:i.entity,recordId:i.recordId}),qa.success("Detached."),await h({links:m.filter(d=>d.entity!==i.entity||d.recordId!==i.recordId),entities:y},{revalidate:!1}),g();}catch(d){qa.error(h$1(d,"The document could not be detached."));}finally{u(null);}}async function v$1(i){u(`${i.entity}:*`);try{await n.unlinkSource(o.id,{entity:i.entity}),qa.success("Detached."),await h({links:m,entities:y.filter(d=>d.entity!==i.entity)},{revalidate:!1}),g();}catch(d){qa.error(h$1(d,"The document could not be detached."));}finally{u(null);}}async function w(i){u(`${i.name}:+`);try{let d=await n.linkSource(o.id,{entity:i.name});qa.success(d.linked?`Applies to every ${v(i)} now.`:`Already applied to every ${v(i)}.`),await h({links:m,entities:y.some(g=>g.entity===i.name)?y:[...y,{entity:i.name,entityPlural:i.plural}]},{revalidate:!1}),g();}catch(d){qa.error(h$1(d,"The document could not be attached."));}finally{u(null);}}let x;return c$1?x=jsx("p",{className:"fk:text-sm fk:text-destructive",children:"The linked records could not be loaded."}):p&&!r?x=jsxs("div",{"aria-busy":"true",className:"fk:flex fk:flex-col fk:gap-2",children:[jsx(t$1,{className:"fk:h-6 fk:w-1/2"}),jsx(t$1,{className:"fk:h-6 fk:w-1/3"})]}):f.length===0?x=jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:'Not attached to any record. Open a record in the Desk and use "Attach document" so the agent searches this document before the rest of Knowledge when asked about that record.'}):x=jsx("div",{className:"fk:flex fk:flex-col fk:gap-4",children:f.map(i=>jsx(Ye,{canMutate:a,detachingKey:s,group:i,onDetach:d=>{b$1(d);}},i.entityPlural))}),jsxs(Fragment,{children:[jsx(tt,{busy:s!==null,canMutate:a,entities:y,isLoading:p&&!r,onAttach:i=>{w(i);},onDetach:i=>{v$1(i);}}),jsxs("div",{className:"fk:mt-2 fk:flex fk:items-center fk:gap-2",children:[jsx(PaperclipIcon,{className:"fk:size-4 fk:text-muted-foreground"}),jsx("h3",{className:"fk:text-sm fk:font-semibold fk:tracking-tight",children:"Linked records"}),m.length>0?jsx(b$2,{className:"fk:corner-squircle",variant:"outline",children:m.length}):null]}),jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:"When a question is about one of these records, the agent searches this document before the rest."}),x]})}function tt({busy:n,canMutate:l,entities:o$1,isLoading:a,onAttach:s,onDetach:u$2}){let{currentProject:r}=f(),c=useMemo(()=>r?.schema??[],[r]),[p,h]=useState(false),m$1=useMemo(()=>w(c,o$1),[o$1,c]),y=f=>{let b=u(c,f.entity);return b?v(b):f.entityPlural};return jsxs("div",{className:"fk:flex fk:flex-col fk:gap-3","data-knowledge-applies-to":true,children:[jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(LayersIcon,{className:"fk:size-4 fk:text-muted-foreground"}),jsx("h3",{className:"fk:text-sm fk:font-semibold fk:tracking-tight",children:"Applies to"}),o$1.length>0?jsx(b$2,{className:"fk:corner-squircle",variant:"outline",children:o$1.length}):null]}),jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:"Attach this document to a whole entity type and the agent searches it before the rest of Knowledge for every record of that type, and for questions about the type in general."}),a?jsx(t$1,{className:"fk:h-7 fk:w-1/3"}):jsxs("div",{className:"fk:flex fk:flex-wrap fk:items-center fk:gap-2",children:[o$1.map(f=>{let b=y(f);return jsxs(b$2,{className:"fk:gap-1 fk:py-1 fk:pl-2.5 fk:pr-1 fk:corner-squircle",variant:"secondary",children:[jsx("span",{className:"fk:capitalize",children:b}),l?jsxs(b$4,{children:[jsx(c$2,{asChild:true,children:jsx("button",{"aria-label":`No longer apply to every ${b}`,className:"fk:rounded-sm fk:p-0.5 fk:text-muted-foreground fk:hover:text-foreground fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-ring fk:disabled:opacity-50",disabled:n,type:"button",onClick:()=>u$2(f),children:jsx(XIcon,{className:"fk:size-3"})})}),jsxs(e$1,{children:["No longer apply to every ",b]})]}):null]},f.entity)}),jsxs(t$2,{open:p,onOpenChange:h,children:[jsx(na,{disabled:!l,children:jsx(u$1,{asChild:true,children:jsxs(b$1,{className:"fk:h-7",disabled:!l||m$1.length===0,size:"sm",variant:"outline",children:[jsx(PlusIcon,{}),"Add entity type"]})})}),jsx(v$1,{align:"start",className:"fk:w-64 fk:p-0",children:jsxs(m,{children:[jsx(o,{placeholder:"Search entity types"}),jsxs(p$1,{children:[jsx(q$1,{children:"No entity type matches."}),jsx(r$2,{children:m$1.map(f=>jsx(t$3,{keywords:[v(f),f.name,f.plural],value:f.name,onSelect:()=>{h(false),s(f);},children:jsx("span",{className:"fk:capitalize",children:v(f)})},f.name))})]})]})})]})]})]})}export{yt as a,bt as b,vt as c};//# sourceMappingURL=chunk-ZKA2HKNI.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import'./index.css';import {e,c,b,a,g,h as h$1,m as m$1,k as k$1,n}from'./chunk-2P2QV3K6.js';import {m as m$2,w as w$1}from'./chunk-445XKMAG.js';import {b as b$3}from'./chunk-ZZRA4567.js';import {c as c$3}from'./chunk-BMO7JFAX.js';import {c as c$4}from'./chunk-XMOSCJOI.js';import {u,t,v,r as r$1,w,l as l$1,j,p as p$2,s,q as q$2}from'./chunk-A7XHA2P6.js';import {a as a$2}from'./chunk-ERDARDGB.js';import {f}from'./chunk-B7QMGBK5.js';import {na,p,q,r,t as t$2,u as u$1,v as v$1,qa,s as s$1}from'./chunk-DGIY4SKN.js';import {t as t$1}from'./chunk-SZEGGBOC.js';import {b as b$2,c as c$1,h,i,k,l,m,o,p as p$1,q as q$1,r as r$2,t as t$3}from'./chunk-32ZU4MLE.js';import {a as a$1,b as b$4,c as c$2,e as e$1}from'./chunk-USNXQOMJ.js';import {b as b$1}from'./chunk-6NRQMG26.js';import {useState,useMemo,useDeferredValue}from'react';import {BookOpenTextIcon,PaperclipIcon,ChevronRightIcon,LayersIcon,XIcon,PlusIcon,Unlink2Icon,LoaderCircle,SearchIcon}from'lucide-react';import {Link}from'react-router-dom';import H from'swr';import Qe from'swr/infinite';import {jsxs,Fragment,jsx}from'react/jsx-runtime';var Be=50;function fe({disabled:n,label:l,onClick:o}){return jsxs(b$4,{children:[jsx(c$2,{asChild:true,children:jsx(b$1,{"aria-label":l,className:"fk:size-7 fk:shrink-0",disabled:n,size:"icon",variant:"ghost",onClick:o,children:jsx(Unlink2Icon,{className:"fk:size-4"})})}),jsx(e$1,{children:l})]})}function Xe({api:n$1,attachedIds:l$2,onAttached:o,onOpenChange:a,open:s$2,projectId:u,target:r,targetLabel:c$2}){let[p,h$2]=useState(""),m=useDeferredValue(p.trim()),[y,f]=useState(null),b$1=(k,K)=>!s$2||K&&!K.hasMore?null:c(u).sources({limit:Be,offset:k*Be,search:m||void 0}),{data:v,error:w,isLoading:x,setSize:i$1,size:d}=Qe(b$1,b,{keepPreviousData:true}),g=useMemo(()=>s(v?.flatMap(k=>k.sources)??[],l$2),[l$2,v]),L=v?.[v.length-1]?.hasMore??false,C=v!==void 0&&d>v.length;async function A(k){f(k.id);try{let K=await n$1.linkSource(k.id,r);qa.success(K.linked?`Attached "${k.title}".`:`"${k.title}" was already attached.`),o(k),a(!1);}catch(K){qa.error(h$1(K,"The document could not be attached."));}finally{f(null);}}let R;return w?R=jsx("p",{className:"fk:py-6 fk:text-center fk:text-sm fk:text-destructive",children:"The documents could not be loaded."}):x&&!v?R=jsxs("div",{"aria-busy":"true",className:"fk:flex fk:flex-col fk:gap-3 fk:py-2",children:[jsx(t$1,{className:"fk:h-10 fk:w-full"}),jsx(t$1,{className:"fk:h-10 fk:w-full"}),jsx(t$1,{className:"fk:h-10 fk:w-full"})]}):g.length===0&&!L?R=jsx("p",{className:"fk:py-6 fk:text-center fk:text-sm fk:text-muted-foreground",children:m?"No documents match your search.":"Every document is attached already, or there are none yet. Add documents in Knowledge first."}):R=jsxs("ul",{className:"fk:flex fk:max-h-80 fk:flex-col fk:overflow-y-auto fk:-mx-2",children:[g.map(k=>{let K=l$1(k),B=y===k.id;return jsx("li",{children:jsxs("button",{className:"fk:flex fk:w-full fk:min-w-0 fk:items-center fk:gap-3 fk:rounded-lg fk:px-2 fk:py-2 fk:text-left fk:transition-colors fk:hover:bg-accent fk:focus-visible:bg-accent fk:focus-visible:outline-none fk:disabled:opacity-60 fk:corner-squircle",disabled:y!==null,type:"button",onClick:()=>{A(k);},children:[jsx(m$1,{source:k}),jsxs("span",{className:"fk:min-w-0 fk:flex-1",children:[jsx("span",{className:"fk:block fk:truncate fk:text-sm fk:font-medium",children:k.title}),jsxs("span",{className:"fk:block fk:truncate fk:text-xs fk:text-muted-foreground",children:[j(k)," \xB7 ",K.detail]})]}),B?jsx(LoaderCircle,{className:"fk:size-4 fk:shrink-0 fk:animate-spin fk:text-muted-foreground"}):jsx(k$1,{label:K.label,tone:K.tone})]})},k.id)}),L&&!C?jsx("li",{"aria-hidden":true,children:jsx(n,{onVisible:()=>{i$1(k=>k+1);}})}):null,C?jsx("li",{className:"fk:flex fk:justify-center fk:py-2",children:jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin fk:text-muted-foreground"})}):null]}),jsx(c$1,{open:s$2,onOpenChange:a,children:jsxs(h,{className:"fk:sm:max-w-lg",children:[jsxs(i,{children:[jsx(k,{children:"Attach a document"}),jsx(l,{children:r.recordId===void 0?`Documents attached to every ${c$2} are searched before the rest of Knowledge when a question is about one of them, or about ${c$2} in general.`:`Documents attached to ${c$2} are searched before the rest of Knowledge when a question is about it.`})]}),jsxs("div",{className:"fk:relative",children:[jsx(SearchIcon,{className:"fk:pointer-events-none fk:absolute fk:left-2.5 fk:top-1/2 fk:size-4 fk:-translate-y-1/2 fk:text-muted-foreground"}),jsx(s$1,{"aria-label":"Search documents",autoFocus:true,className:"fk:pl-8",placeholder:"Search documents by title",value:p,onChange:k=>h$2(k.target.value)})]}),R]})})}function re({projectId:n,renderAction:l,sources:o}){return jsx("ul",{className:"fk:flex fk:flex-col fk:gap-1 fk:-mx-2",children:o.map(a=>{let s=l$1(a);return jsxs("li",{className:"fk:flex fk:min-w-0 fk:items-center fk:gap-2 fk:rounded-lg fk:px-2 fk:py-1.5 fk:corner-squircle",children:[jsxs(Link,{className:"fk:flex fk:min-w-0 fk:flex-1 fk:items-center fk:gap-3 fk:rounded-md fk:hover:underline fk:underline-offset-2",to:p$2(n,a.id),children:[jsx(m$1,{source:a}),jsxs("span",{className:"fk:min-w-0 fk:flex-1",children:[jsx("span",{className:"fk:block fk:truncate fk:text-sm fk:font-medium",children:a.title}),jsxs("span",{className:"fk:block fk:truncate fk:text-xs fk:text-muted-foreground",children:[j(a)," \xB7 ",s.detail]})]})]}),jsx(k$1,{label:s.label,tone:s.tone}),l?.(a)]},a.id)})})}function yt({entityName:n}){let{api:l,projectId:o}=e(),{currentProject:a$1}=f(),[s,u$1]=useState(false),r=u(a$1?.schema??[],n),c$1=!!r&&t(n),{data:p,error:h}=H(o&&c$1?c(o).entitySources(n):null,b);if(!l||!o||!r||!c$1||h instanceof a&&h.status===404)return null;let m=p?.sources.length??0;return jsxs(Fragment,{children:[jsxs(b$1,{"aria-label":`Knowledge for every ${v(r)}`,className:"fk:mr-2 fk:h-8","data-knowledge-entity-button":true,size:"sm",variant:"outline",onClick:()=>u$1(true),children:[jsx(BookOpenTextIcon,{}),"Knowledge",m>0?jsx(b$2,{className:"fk:corner-squircle",variant:"secondary",children:m}):null]}),jsx(Ue,{api:l,entityLabel:v(r),entityName:n,open:s,projectId:o,onOpenChange:u$1})]})}function Ue({api:n,entityLabel:l$1,entityName:o,onOpenChange:a,open:s,projectId:u}){let r=b$3(),[c$2,p]=useState(false),[h$2,m]=useState(null),{data:y,error:f,isLoading:b$4,mutate:v}=H(c(u).entitySources(o),b),w=y?.sources??[],x=useMemo(()=>({entity:o}),[o]);async function i$1(g$1){m(g$1.id);try{await n.unlinkSource(g$1.id,x),qa.success(`"${g$1.title}" no longer applies to every ${l$1}.`),await v({sources:w.filter(L=>L.id!==g$1.id)},{revalidate:!1}),g();}catch(L){qa.error(h$1(L,"The document could not be detached."));}finally{m(null);}}let d;return f?d=jsx("p",{className:"fk:text-sm fk:text-destructive",children:"The documents could not be loaded."}):b$4&&!y?d=jsxs("div",{"aria-busy":"true",className:"fk:flex fk:flex-col fk:gap-2",children:[jsx(t$1,{className:"fk:h-9 fk:w-full"}),jsx(t$1,{className:"fk:h-9 fk:w-2/3"})]}):w.length===0?d=jsxs("p",{className:"fk:text-sm fk:text-muted-foreground",children:["No documents apply to every ",l$1," yet. Attach a guide, a policy or a spec that holds for all of them and the agent searches it first when asked about any ",l$1,", or about ",l$1," in general."]}):d=jsx(re,{projectId:u,sources:w,renderAction:g=>r?jsx(fe,{disabled:h$2!==null,label:`Detach ${g.title}`,onClick:()=>{i$1(g);}}):null}),jsx(c$1,{open:s,onOpenChange:a,children:jsxs(h,{className:"fk:sm:max-w-lg","data-knowledge-entity-dialog":true,children:[jsxs(i,{children:[jsxs(k,{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(BookOpenTextIcon,{className:"fk:size-4 fk:text-muted-foreground"}),"Knowledge for every ",l$1,y?jsx(b$2,{className:"fk:corner-squircle",variant:"outline",children:w.length}):null]}),jsxs(l,{children:["Documents attached here apply to every ",l$1,"; each record can hold its own on top."]})]}),jsx("div",{className:"fk:max-h-80 fk:overflow-y-auto",children:d}),jsx("div",{className:"fk:flex fk:justify-end",children:jsx(na,{disabled:!r,children:jsxs(b$1,{disabled:!r,size:"sm",variant:"outline",onClick:()=>p(true),children:[jsx(PaperclipIcon,{}),"Attach document"]})})}),jsx(Xe,{api:n,attachedIds:w.map(g=>g.id),open:c$2,projectId:u,target:x,targetLabel:l$1,onAttached:g$1=>{v({sources:w.some(L=>L.id===g$1.id)?w:[...w,g$1]},{revalidate:false}),g();},onOpenChange:p})]})})}function bt({entityName:n,recordId:l,recordLabel:o}){let{api:a$2,projectId:s}=e(),{currentProject:u$1}=f(),r$1=b$3(),[c$1,p$1]=useState(false),[h,m]=useState(false),[y,f$1]=useState(null),b$4=useMemo(()=>({entity:n,recordId:l}),[n,l]),v$1=u(u$1?.schema??[],n),w=v$1?v(v$1):n,x=t(n),{data:i,error:d,isLoading:g$1,mutate:L}=H(s&&x?c(s).recordSources(b$4):null,b);if(!a$2||!s||!x||d instanceof a&&d.status===404)return null;let C=i?.sources??[],A=i?.inherited??[],R=C.map(N=>N.id),k=a$2;async function K(N){f$1(N.id);try{await k.unlinkSource(N.id,b$4),qa.success(`Detached "${N.title}".`),await L({sources:C.filter($=>$.id!==N.id),inherited:A},{revalidate:!1}),g();}catch($){qa.error(h$1($,"The document could not be detached."));}finally{f$1(null);}}let B;return d?B=jsx("p",{className:"fk:text-sm fk:text-destructive",children:"The attached documents could not be loaded."}):g$1&&!i?B=jsxs("div",{"aria-busy":"true",className:"fk:flex fk:flex-col fk:gap-2",children:[jsx(t$1,{className:"fk:h-9 fk:w-full"}),jsx(t$1,{className:"fk:h-9 fk:w-2/3"})]}):B=jsxs("div",{className:"fk:flex fk:flex-col fk:gap-4",children:[C.length===0?jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:A.length>0?"No documents attached to this record itself; the ones below apply to every record of its type.":"No documents attached. Attach a manual, spec or contract and the agent will use it alongside the record's data when asked about this record."}):jsx(re,{projectId:s,sources:C,renderAction:N=>r$1?jsx(fe,{disabled:y!==null,label:`Detach ${N.title}`,onClick:()=>{K(N);}}):null}),A.length>0?jsxs("div",{className:"fk:flex fk:flex-col fk:gap-1","data-knowledge-inherited":true,children:[jsxs("span",{className:"fk:text-xs fk:font-medium fk:uppercase fk:tracking-wide fk:text-muted-foreground",children:["Applies to every ",w]}),jsx(re,{projectId:s,sources:A})]}):null]}),jsx(a$1,{children:jsxs(p,{className:`fk:z-10 fk:flex fk:shrink-0 fk:flex-col fk:border-t fk:bg-background ${c$1?"fk:h-1/2":""}`,"data-knowledge-record-panel":true,open:c$1,onOpenChange:p$1,children:[jsxs("div",{className:"fk:flex fk:shrink-0 fk:items-center fk:gap-2 fk:pl-4 fk:pr-10 fk:py-2",children:[jsx(q,{asChild:true,children:jsxs("button",{className:"fk:flex fk:min-w-0 fk:flex-1 fk:items-center fk:gap-2 fk:rounded-md fk:py-1 fk:text-left fk:text-sm fk:font-semibold fk:tracking-tight fk:hover:text-foreground/80 fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-ring",type:"button",children:[jsx(ChevronRightIcon,{className:`fk:size-4 fk:shrink-0 fk:text-muted-foreground fk:transition-transform ${c$1?"fk:rotate-90":""}`}),jsx(BookOpenTextIcon,{className:"fk:size-4 fk:shrink-0 fk:text-muted-foreground"}),"Knowledge",i?jsx(b$2,{className:"fk:corner-squircle",variant:"outline",children:C.length+A.length}):null]})}),c$1?jsx(na,{disabled:!r$1,children:jsxs(b$1,{disabled:!r$1,size:"sm",variant:"outline",onClick:()=>m(true),children:[jsx(PaperclipIcon,{}),"Attach document"]})}):null]}),jsx(r,{className:"fk:min-h-0 fk:flex-1 fk:overflow-y-auto fk:px-10 fk:pb-6",children:B}),jsx(Xe,{api:a$2,attachedIds:R,open:h,projectId:s,target:b$4,targetLabel:o||`this ${n}`,onAttached:N=>{L({sources:C.some($=>$.id===N.id)?C:[...C,N],inherited:A.filter($=>$.id!==N.id)},{revalidate:false}),g();},onOpenChange:m})]})})}function Ze(n,l,o){let{scope:a}=c$4(),s=n.links.map(r=>r.recordId),{data:u}=w$1({entityNamePlural:n.entityPlural,schema:l,scope:a,selection:"display",includeCount:false,variables:{where:{_id:{in:s}},limit:s.length}});return useMemo(()=>{let r={};for(let c of u??[]){let p=c[o.name];typeof p=="string"&&p.trim()&&(r[c._id]=p);}return r},[u,o])}function Ye(n){let{currentProject:l}=f(),o=useMemo(()=>l?.schema??[],[l]),a=m$2(o,n.group.entityPlural),s=a$2(a);return !a||!s?jsx(Je,{...n,entityLabel:a?v(a):n.group.entityPlural,labels:{}}):jsx(et,{...n,displayAttribute:s,schema:o,entityLabel:v(a)})}function et({displayAttribute:n,entityLabel:l,schema:o,...a}){let s=Ze(a.group,o,n);return jsx(Je,{...a,entityLabel:l,labels:s})}function Je({canMutate:n,detachingKey:l,entityLabel:o,group:a,labels:s,onDetach:u}){let r=c$3();return jsxs("div",{className:"fk:flex fk:flex-col fk:gap-1",children:[jsx("span",{className:"fk:text-xs fk:font-medium fk:uppercase fk:tracking-wide fk:text-muted-foreground",children:o}),jsx("ul",{className:"fk:flex fk:flex-col fk:-mx-2",children:a.links.map(c=>{let p=q$2(c,s[c.recordId]),h=`${c.entity}:${c.recordId}`;return jsxs("li",{className:"fk:flex fk:min-w-0 fk:items-center fk:gap-2 fk:rounded-lg fk:px-2 fk:py-1 fk:corner-squircle",children:[jsx("button",{className:"fk:min-w-0 fk:flex-1 fk:truncate fk:text-left fk:text-sm fk:hover:underline fk:underline-offset-2",title:c.recordId,type:"button",onClick:()=>r({type:"EditEntity",payload:{entityId:c.recordId,entityNamePlural:a.entityPlural}}),children:p}),n?jsx(fe,{disabled:l!==null,label:`Detach from ${p}`,onClick:()=>u(c)}):null]},h)})})]})}function vt({api:n,projectId:l,source:o}){let a=b$3(),[s,u]=useState(null),{data:r,error:c$1,isLoading:p,mutate:h}=H(c(l).links(o.id),b),m=useMemo(()=>r?.links??[],[r]),y=useMemo(()=>r?.entities??[],[r]),f=useMemo(()=>r$1(m),[m]);async function b$1(i){u(`${i.entity}:${i.recordId}`);try{await n.unlinkSource(o.id,{entity:i.entity,recordId:i.recordId}),qa.success("Detached."),await h({links:m.filter(d=>d.entity!==i.entity||d.recordId!==i.recordId),entities:y},{revalidate:!1}),g();}catch(d){qa.error(h$1(d,"The document could not be detached."));}finally{u(null);}}async function v$1(i){u(`${i.entity}:*`);try{await n.unlinkSource(o.id,{entity:i.entity}),qa.success("Detached."),await h({links:m,entities:y.filter(d=>d.entity!==i.entity)},{revalidate:!1}),g();}catch(d){qa.error(h$1(d,"The document could not be detached."));}finally{u(null);}}async function w(i){u(`${i.name}:+`);try{let d=await n.linkSource(o.id,{entity:i.name});qa.success(d.linked?`Applies to every ${v(i)} now.`:`Already applied to every ${v(i)}.`),await h({links:m,entities:y.some(g=>g.entity===i.name)?y:[...y,{entity:i.name,entityPlural:i.plural}]},{revalidate:!1}),g();}catch(d){qa.error(h$1(d,"The document could not be attached."));}finally{u(null);}}let x;return c$1?x=jsx("p",{className:"fk:text-sm fk:text-destructive",children:"The linked records could not be loaded."}):p&&!r?x=jsxs("div",{"aria-busy":"true",className:"fk:flex fk:flex-col fk:gap-2",children:[jsx(t$1,{className:"fk:h-6 fk:w-1/2"}),jsx(t$1,{className:"fk:h-6 fk:w-1/3"})]}):f.length===0?x=jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:'Not attached to any record. Open a record in the Desk and use "Attach document" so the agent searches this document before the rest of Knowledge when asked about that record.'}):x=jsx("div",{className:"fk:flex fk:flex-col fk:gap-4",children:f.map(i=>jsx(Ye,{canMutate:a,detachingKey:s,group:i,onDetach:d=>{b$1(d);}},i.entityPlural))}),jsxs(Fragment,{children:[jsx(tt,{busy:s!==null,canMutate:a,entities:y,isLoading:p&&!r,onAttach:i=>{w(i);},onDetach:i=>{v$1(i);}}),jsxs("div",{className:"fk:mt-2 fk:flex fk:items-center fk:gap-2",children:[jsx(PaperclipIcon,{className:"fk:size-4 fk:text-muted-foreground"}),jsx("h3",{className:"fk:text-sm fk:font-semibold fk:tracking-tight",children:"Linked records"}),m.length>0?jsx(b$2,{className:"fk:corner-squircle",variant:"outline",children:m.length}):null]}),jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:"When a question is about one of these records, the agent searches this document before the rest."}),x]})}function tt({busy:n,canMutate:l,entities:o$1,isLoading:a,onAttach:s,onDetach:u$2}){let{currentProject:r}=f(),c=useMemo(()=>r?.schema??[],[r]),[p,h]=useState(false),m$1=useMemo(()=>w(c,o$1),[o$1,c]),y=f=>{let b=u(c,f.entity);return b?v(b):f.entityPlural};return jsxs("div",{className:"fk:flex fk:flex-col fk:gap-3","data-knowledge-applies-to":true,children:[jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(LayersIcon,{className:"fk:size-4 fk:text-muted-foreground"}),jsx("h3",{className:"fk:text-sm fk:font-semibold fk:tracking-tight",children:"Applies to"}),o$1.length>0?jsx(b$2,{className:"fk:corner-squircle",variant:"outline",children:o$1.length}):null]}),jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:"Attach this document to a whole entity type and the agent searches it before the rest of Knowledge for every record of that type, and for questions about the type in general."}),a?jsx(t$1,{className:"fk:h-7 fk:w-1/3"}):jsxs("div",{className:"fk:flex fk:flex-wrap fk:items-center fk:gap-2",children:[o$1.map(f=>{let b=y(f);return jsxs(b$2,{className:"fk:gap-1 fk:py-1 fk:pl-2.5 fk:pr-1 fk:corner-squircle",variant:"secondary",children:[jsx("span",{className:"fk:capitalize",children:b}),l?jsxs(b$4,{children:[jsx(c$2,{asChild:true,children:jsx("button",{"aria-label":`No longer apply to every ${b}`,className:"fk:rounded-sm fk:p-0.5 fk:text-muted-foreground fk:hover:text-foreground fk:focus-visible:outline-none fk:focus-visible:ring-2 fk:focus-visible:ring-ring fk:disabled:opacity-50",disabled:n,type:"button",onClick:()=>u$2(f),children:jsx(XIcon,{className:"fk:size-3"})})}),jsxs(e$1,{children:["No longer apply to every ",b]})]}):null]},f.entity)}),jsxs(t$2,{open:p,onOpenChange:h,children:[jsx(na,{disabled:!l,children:jsx(u$1,{asChild:true,children:jsxs(b$1,{className:"fk:h-7",disabled:!l||m$1.length===0,size:"sm",variant:"outline",children:[jsx(PlusIcon,{}),"Add entity type"]})})}),jsx(v$1,{align:"start",className:"fk:w-64 fk:p-0",children:jsxs(m,{children:[jsx(o,{placeholder:"Search entity types"}),jsxs(p$1,{children:[jsx(q$1,{children:"No entity type matches."}),jsx(r$2,{children:m$1.map(f=>jsx(t$3,{keywords:[v(f),f.name,f.plural],value:f.name,onSelect:()=>{h(false),s(f);},children:jsx("span",{className:"fk:capitalize",children:v(f)})},f.name))})]})]})})]})]})]})}export{yt as a,bt as b,vt as c};//# sourceMappingURL=chunk-BXN72PW2.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-BXN72PW2.js.map
|