@flexkit/studio 0.2.12 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/activity-nav-button-7SVTTHBQ.js +2 -0
  2. package/dist/{activity-nav-button-LZESIQL2.js.map → activity-nav-button-7SVTTHBQ.js.map} +1 -1
  3. package/dist/astro.js +1 -1
  4. package/dist/{chat-page-EKOGKEFR.js → chat-page-L427VVVR.js} +3 -3
  5. package/dist/{chat-page-EKOGKEFR.js.map → chat-page-L427VVVR.js.map} +1 -1
  6. package/dist/chunk-2HYQVMP3.js +3 -0
  7. package/dist/chunk-2HYQVMP3.js.map +1 -0
  8. package/dist/chunk-5CVDMZUI.js +3 -0
  9. package/dist/chunk-5CVDMZUI.js.map +1 -0
  10. package/dist/chunk-6YJ3DLIU.js +2 -0
  11. package/dist/{chunk-OFJOZMCR.js.map → chunk-6YJ3DLIU.js.map} +1 -1
  12. package/dist/{chunk-BOXFB6E6.js → chunk-7ELMTFZ4.js} +2 -2
  13. package/dist/{chunk-BOXFB6E6.js.map → chunk-7ELMTFZ4.js.map} +1 -1
  14. package/dist/chunk-ALCK2BJY.js +2 -0
  15. package/dist/chunk-ALCK2BJY.js.map +1 -0
  16. package/dist/chunk-CAZ6EUR2.js +2 -0
  17. package/dist/chunk-CAZ6EUR2.js.map +1 -0
  18. package/dist/chunk-D5WYD5M4.js +2 -0
  19. package/dist/chunk-D5WYD5M4.js.map +1 -0
  20. package/dist/{chunk-2AVINVYN.js → chunk-GFAOY74A.js} +28 -18
  21. package/dist/chunk-MGXG5PWU.js +384 -0
  22. package/dist/chunk-MGXG5PWU.js.map +1 -0
  23. package/dist/{chunk-EWBEPYML.js → chunk-MJVWFANP.js} +3 -3
  24. package/dist/{chunk-EWBEPYML.js.map → chunk-MJVWFANP.js.map} +1 -1
  25. package/dist/chunk-NLRSLQUT.js +3 -0
  26. package/dist/chunk-NLRSLQUT.js.map +1 -0
  27. package/dist/{chunk-F2DHCPWW.js → chunk-P5ZRTZ5Z.js} +2 -2
  28. package/dist/{chunk-F2DHCPWW.js.map → chunk-P5ZRTZ5Z.js.map} +1 -1
  29. package/dist/{chunk-QQSI7BPK.js → chunk-R64ELY3B.js} +3 -3
  30. package/dist/{chunk-QQSI7BPK.js.map → chunk-R64ELY3B.js.map} +1 -1
  31. package/dist/chunk-U5D3EDCY.js +2 -0
  32. package/dist/chunk-U5D3EDCY.js.map +1 -0
  33. package/dist/chunk-W7Z4MY43.js +2 -0
  34. package/dist/{chunk-7IHEL6LU.js.map → chunk-W7Z4MY43.js.map} +1 -1
  35. package/dist/chunk-XWBACTNR.js +3 -0
  36. package/dist/{chunk-C47FNPLK.js.map → chunk-XWBACTNR.js.map} +1 -1
  37. package/dist/chunk-ZZRA4567.js +2 -0
  38. package/dist/{chunk-V64P56OA.js.map → chunk-ZZRA4567.js.map} +1 -1
  39. package/dist/electron.d.ts +103 -0
  40. package/dist/electron.js +131 -0
  41. package/dist/index.css +9 -0
  42. package/dist/index.d.ts +33 -1
  43. package/dist/index.js +9 -9
  44. package/dist/index.js.map +1 -1
  45. package/dist/list-WJLU3K2X.js +2 -0
  46. package/dist/{list-DOTORSUC.js.map → list-WJLU3K2X.js.map} +1 -1
  47. package/dist/nextjs.js +1 -1
  48. package/dist/{pages-ILAXYS2J.js → pages-3EK5GS2T.js} +4 -4
  49. package/dist/{pages-ILAXYS2J.js.map → pages-3EK5GS2T.js.map} +1 -1
  50. package/dist/plugin-pages-PQO22EOE.js +2 -0
  51. package/dist/{plugin-pages-RKJRHKNL.js.map → plugin-pages-PQO22EOE.js.map} +1 -1
  52. package/dist/root-4EALW3G6.js +2 -0
  53. package/dist/{root-RE3ZNXQ3.js.map → root-4EALW3G6.js.map} +1 -1
  54. package/dist/root-BA7BLCFR.js +23 -0
  55. package/dist/root-BA7BLCFR.js.map +1 -0
  56. package/dist/root-YNGCF5QM.js +31 -0
  57. package/dist/{root-JB3NZZNZ.js.map → root-YNGCF5QM.js.map} +1 -1
  58. package/dist/root-ZF62TR5Z.js +2 -0
  59. package/dist/{root-76YQTZUI.js.map → root-ZF62TR5Z.js.map} +1 -1
  60. package/dist/search-QHMCAT7O.js +2 -0
  61. package/dist/{search-WUO6VWKU.js.map → search-QHMCAT7O.js.map} +1 -1
  62. package/dist/skills-pages-HIBSAVOP.js +2 -0
  63. package/dist/{skills-pages-POKCFHOL.js.map → skills-pages-HIBSAVOP.js.map} +1 -1
  64. package/dist/tanstack-start.js +1 -1
  65. package/dist/user-nav-36ACWXOW.js +2 -0
  66. package/dist/{user-nav-DCAHVWN7.js.map → user-nav-36ACWXOW.js.map} +1 -1
  67. package/package.json +10 -6
  68. package/dist/activity-nav-button-LZESIQL2.js +0 -2
  69. package/dist/chunk-2HSIWUH3.js +0 -3
  70. package/dist/chunk-2HSIWUH3.js.map +0 -1
  71. package/dist/chunk-6YOVF2AD.js +0 -384
  72. package/dist/chunk-6YOVF2AD.js.map +0 -1
  73. package/dist/chunk-7IHEL6LU.js +0 -2
  74. package/dist/chunk-ACS3TGGP.js +0 -2
  75. package/dist/chunk-ACS3TGGP.js.map +0 -1
  76. package/dist/chunk-C47FNPLK.js +0 -3
  77. package/dist/chunk-HYSTMQD7.js +0 -2
  78. package/dist/chunk-HYSTMQD7.js.map +0 -1
  79. package/dist/chunk-KXAGLQ2B.js +0 -2
  80. package/dist/chunk-KXAGLQ2B.js.map +0 -1
  81. package/dist/chunk-OFJOZMCR.js +0 -2
  82. package/dist/chunk-TYDYAOQ7.js +0 -3
  83. package/dist/chunk-TYDYAOQ7.js.map +0 -1
  84. package/dist/chunk-V64P56OA.js +0 -2
  85. package/dist/list-DOTORSUC.js +0 -2
  86. package/dist/plugin-pages-RKJRHKNL.js +0 -2
  87. package/dist/root-76YQTZUI.js +0 -2
  88. package/dist/root-A4VHAEK5.js +0 -23
  89. package/dist/root-A4VHAEK5.js.map +0 -1
  90. package/dist/root-JB3NZZNZ.js +0 -31
  91. package/dist/root-RE3ZNXQ3.js +0 -2
  92. package/dist/search-WUO6VWKU.js +0 -2
  93. package/dist/skills-pages-POKCFHOL.js +0 -2
  94. package/dist/user-nav-DCAHVWN7.js +0 -2
@@ -0,0 +1,2 @@
1
+ import'./index.css';import {g,f as f$1}from'./chunk-NLRSLQUT.js';import {b}from'./chunk-5CVDMZUI.js';import {a,b as b$1,c,e}from'./chunk-USNXQOMJ.js';import {b as b$2}from'./chunk-6NRQMG26.js';import {useEffect}from'react';import {BellIcon}from'lucide-react';import {Link}from'react-router-dom';import A from'swr';import {jsx,jsxs}from'react/jsx-runtime';function T(t){let{data:i}=A(t?g(t).activitySummary():null,f$1,{refreshInterval:3e4});return i}function f(t){return t>99?"99+":t.toString()}function $({projectId:t}){let i=T(t),e$1=i?.needsActionCount??0,r=i?.unreadCount??0;useEffect(()=>{let n=b();if(n)return n.setBadgeCount(e$1),()=>{n.setBadgeCount(0);}},[e$1]);let s=e$1>0?`Activity: ${f(e$1)} waiting for you`:r>0?`Activity: ${f(r)} unread`:"Activity";return jsx(a,{children:jsxs(b$1,{children:[jsx(c,{asChild:true,children:jsx(b$2,{asChild:true,"aria-label":s,className:"fk:relative fk:h-8 fk:w-8 fk:rounded-full",size:"icon",variant:"ghost",children:jsxs(Link,{to:`/${t}/ai/activity`,children:[jsx(BellIcon,{className:"fk:size-4"}),e$1>0?jsx("span",{className:"fk:absolute fk:-right-1 fk:-top-1 fk:flex fk:h-4 fk:min-w-4 fk:items-center fk:justify-center fk:rounded-full fk:bg-amber-500 fk:px-1 fk:text-[0.625rem] fk:font-semibold fk:leading-none fk:text-white",children:f(e$1)}):r>0?jsx("span",{className:"fk:absolute fk:right-1 fk:top-1 fk:size-2 fk:rounded-full fk:bg-success"}):null]})})}),jsx(e,{children:s})]})})}export{T as a,$ as b};//# sourceMappingURL=chunk-U5D3EDCY.js.map
2
+ //# sourceMappingURL=chunk-U5D3EDCY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/apps/ai/activity-nav-button.tsx"],"names":["useActivitySummary","projectId","data","useSWR","paths","fetcher","formatCount","count","ActivityNavButton","summary","needsAction","unread","useEffect","desktop","getDesktop","label","jsx","TooltipProvider","jsxs","Tooltip","TooltipTrigger","Button","Link","BellIcon","TooltipContent"],"mappings":"mWAeO,SAASA,CAAAA,CAAmBC,EAA4D,CAC7F,GAAM,CAAE,IAAA,CAAAC,CAAK,EAAIC,CAAAA,CAAwBF,CAAAA,CAAYG,EAAMH,CAAS,CAAA,CAAE,iBAAgB,CAAI,IAAA,CAAMI,IAAS,CACvG,eAAA,CAAiB,GACnB,CAAC,CAAA,CAED,OAAOH,CACT,CAEA,SAASI,EAAYC,CAAAA,CAAuB,CAC1C,OAAOA,CAAAA,CAAQ,EAAA,CAAK,MAAQA,CAAAA,CAAM,QAAA,EACpC,CAGO,SAASC,EAAkB,CAAE,SAAA,CAAAP,CAAU,CAAA,CAAuC,CACnF,IAAMQ,CAAAA,CAAUT,CAAAA,CAAmBC,CAAS,CAAA,CACtCS,GAAAA,CAAcD,GAAS,gBAAA,EAAoB,CAAA,CAC3CE,EAASF,CAAAA,EAAS,WAAA,EAAe,EAGvCG,SAAAA,CAAU,IAAM,CACd,IAAMC,CAAAA,CAAUC,GAAW,CAE3B,GAAKD,EAIL,OAAAA,CAAAA,CAAQ,cAAcH,GAAW,CAAA,CAE1B,IAAM,CACXG,CAAAA,CAAQ,aAAA,CAAc,CAAC,EACzB,CACF,EAAG,CAACH,GAAW,CAAC,CAAA,CAEhB,IAAMK,EACJL,GAAAA,CAAc,CAAA,CACV,aAAaJ,CAAAA,CAAYI,GAAW,CAAC,CAAA,gBAAA,CAAA,CACrCC,CAAAA,CAAS,EACP,CAAA,UAAA,EAAaL,CAAAA,CAAYK,CAAM,CAAC,CAAA,OAAA,CAAA,CAChC,WAER,OACEK,GAAAA,CAACC,EAAA,CACC,QAAA,CAAAC,KAACC,GAAAA,CAAA,CACC,UAAAH,GAAAA,CAACI,CAAAA,CAAA,CAAe,OAAA,CAAO,IAAA,CACrB,SAAAJ,GAAAA,CAACK,GAAAA,CAAA,CAAO,OAAA,CAAO,IAAA,CAAC,YAAA,CAAYN,CAAAA,CAAO,SAAA,CAAU,2CAAA,CAA4C,KAAK,MAAA,CAAO,OAAA,CAAQ,QAC3G,QAAA,CAAAG,IAAAA,CAACI,KAAA,CAAK,EAAA,CAAI,IAAIrB,CAAS,CAAA,YAAA,CAAA,CACrB,UAAAe,GAAAA,CAACO,QAAAA,CAAA,CAAS,SAAA,CAAU,WAAA,CAAY,EAC/Bb,GAAAA,CAAc,CAAA,CACbM,GAAAA,CAAC,MAAA,CAAA,CAAK,SAAA,CAAU,yMAAA,CACb,SAAAV,CAAAA,CAAYI,GAAW,EAC1B,CAAA,CACEC,CAAAA,CAAS,EACXK,GAAAA,CAAC,MAAA,CAAA,CAAK,UAAU,yEAAA,CAA0E,CAAA,CACxF,MACN,CAAA,CACF,CAAA,CACF,EACAA,GAAAA,CAACQ,CAAAA,CAAA,CAAgB,QAAA,CAAAT,CAAAA,CAAM,CAAA,CAAA,CACzB,CAAA,CACF,CAEJ","file":"chunk-U5D3EDCY.js","sourcesContent":["import { useEffect } from 'react';\nimport type { JSX } from 'react';\nimport { BellIcon } from 'lucide-react';\nimport { Link } from 'react-router-dom';\nimport useSWR from 'swr';\nimport { Button } from '../../ui/primitives/button';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../ui/primitives/tooltip';\nimport { getDesktop } from '../../core/desktop';\nimport { fetcher, paths } from './api';\nimport type { ActivitySummary } from './types';\n\n/**\n * The project's Activity badge counts. `ActivityNotifier` refreshes the same\n * SWR key on every poll, so every reader stays in sync with one request.\n */\nexport function useActivitySummary(projectId: string | undefined): ActivitySummary | undefined {\n const { data } = useSWR<ActivitySummary>(projectId ? paths(projectId).activitySummary() : null, fetcher, {\n refreshInterval: 30_000,\n });\n\n return data;\n}\n\nfunction formatCount(count: number): string {\n return count > 99 ? '99+' : count.toString();\n}\n\n/** Navbar shortcut to Activity, so pending items are visible from every app. */\nexport function ActivityNavButton({ projectId }: { projectId: string }): JSX.Element {\n const summary = useActivitySummary(projectId);\n const needsAction = summary?.needsActionCount ?? 0;\n const unread = summary?.unreadCount ?? 0;\n // The desktop app shows what waits for you on its dock or taskbar icon;\n // leaving the project or signing out clears it.\n useEffect(() => {\n const desktop = getDesktop();\n\n if (!desktop) {\n return;\n }\n\n desktop.setBadgeCount(needsAction);\n\n return () => {\n desktop.setBadgeCount(0);\n };\n }, [needsAction]);\n\n const label =\n needsAction > 0\n ? `Activity: ${formatCount(needsAction)} waiting for you`\n : unread > 0\n ? `Activity: ${formatCount(unread)} unread`\n : 'Activity';\n\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <Button asChild aria-label={label} className=\"fk:relative fk:h-8 fk:w-8 fk:rounded-full\" size=\"icon\" variant=\"ghost\">\n <Link to={`/${projectId}/ai/activity`}>\n <BellIcon className=\"fk:size-4\" />\n {needsAction > 0 ? (\n <span className=\"fk:absolute fk:-right-1 fk:-top-1 fk:flex fk:h-4 fk:min-w-4 fk:items-center fk:justify-center fk:rounded-full fk:bg-amber-500 fk:px-1 fk:text-[0.625rem] fk:font-semibold fk:leading-none fk:text-white\">\n {formatCount(needsAction)}\n </span>\n ) : unread > 0 ? (\n <span className=\"fk:absolute fk:right-1 fk:top-1 fk:size-2 fk:rounded-full fk:bg-success\" />\n ) : null}\n </Link>\n </Button>\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import'./index.css';import {c,e}from'./chunk-P6BZ4QP7.js';import {f}from'./chunk-XWBACTNR.js';import {d}from'./chunk-2HYQVMP3.js';import {useMemo}from'react';import A from'swr';import {find,propEq}from'ramda';function T(n,i){let{scope:c$1}=c(),{currentProject:e}=f(),o=useMemo(()=>e?.schema??[],[e]),a=e?.scopes?.find(t=>t.isDefault)?.name??"default",m=i?.commonParams.q?JSON.stringify(i):null,{data:r,error:s,isLoading:y}=A(m,()=>fetch(d(n).search,{headers:{"Content-Type":"application/json"},body:JSON.stringify(i),method:"POST",mode:"cors"}).then(t=>t.json()));return {results:useMemo(()=>E(r?.results??[],n,o,c$1,a)??[],[r,a,n,o,c$1]),error:s,isLoading:y}}function E(n,i,c,e$1,o){return n?.filter(l=>l?.hits?.length>0).map(l=>{let a=l,m=a.collection.replace(`${i}_`,"").replace(/_\d+$/,""),r=find(propEq(m,"plural"))(c);if(!r)return [];let s=e(r)?.name??"",y=r?.name??m;return a.hits.map(({document:u})=>{let t=u[s],b=(t&&typeof t!="string"?t[e$1]??t[o]:null)??u[s],N=Object.entries(u).reduce((d,[p,f])=>{if(p!==s&&p!=="id"&&p!=="_updatedAt"){let _=typeof f!="string"?f[e$1]??f[o]:f;d[p]=_;}return d},{});return {_id:u.id,_entityName:y,_entityNamePlural:m,[s]:b,...N}})}).flat()}export{T as a};//# sourceMappingURL=chunk-W7Z4MY43.js.map
2
+ //# sourceMappingURL=chunk-W7Z4MY43.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/use-search.tsx"],"names":["useSearch","projectId","searchRequest","scope","useAppContext","currentProject","useConfig","schema","useMemo","defaultScope","s","swrKey","data","error","isLoading","useSWR","apiPaths","res","mapResults","results","result","item","entityNamePlural","entitySchema","find","propEq","primaryAttributeName","getDisplayAttribute","entityName","document","primaryAttribute","primaryAttributeValue","attributes","acc","key","value","scopedValue"],"mappings":"wNAWO,SAASA,EACdC,CAAAA,CACAC,CAAAA,CACwE,CACxE,GAAM,CAAE,KAAA,CAAAC,GAAM,CAAA,CAAIC,GAAc,CAC1B,CAAE,cAAA,CAAAC,GAAe,CAAA,CAAIC,CAAAA,EAAU,CAC/BC,CAAAA,CAASC,QAAQ,IAAMH,GAAAA,EAAgB,MAAA,EAAU,EAAC,CAAG,CAACA,GAAc,CAAC,EAErEI,CAAAA,CADSJ,GAAAA,EAAgB,MAAA,EACF,IAAA,CAAM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AAA,CACxB,GAAGC,CACL,CACF,CAAC,CACH,CAAC,CAAA,CACA,MACL","file":"chunk-7IHEL6LU.js","sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\nimport useSWR from 'swr';\nimport { find, propEq } from 'ramda';\nimport { apiPaths } from './api-paths';\nimport { useAppContext } from './app-context';\nimport { useConfig } from './config/config-context';\nimport { getDisplayAttribute } from './get-display-attribute';\nimport type { Entity, RawResultItem, RawSearchResultItems, SearchRequestProps, SearchResultItem } from './types';\n\nexport function useSearch(\n projectId: string,\n searchRequest: SearchRequestProps | null\n): { results: SearchResultItem[] | []; error: Error; isLoading: boolean } {\n const { scope } = useAppContext();\n const { currentProject } = useConfig();\n const schema = useMemo(() => currentProject?.schema ?? [], [currentProject]);\n const scopes = currentProject?.scopes;\n const defaultScope = scopes?.find((s) => s.isDefault)?.name ?? 'default';\n const swrKey = searchRequest?.commonParams.q ? JSON.stringify(searchRequest) : null;\n const { data, error, isLoading } = useSWR(swrKey, () =>\n fetch(apiPaths(projectId).search, {\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(searchRequest),\n method: 'POST',\n mode: 'cors',\n }).then((res) => res.json() as Promise<{ results: RawSearchResultItems }>)\n );\n const results = useMemo(\n () => mapResults(data?.results ?? [], projectId, schema, scope, defaultScope) ?? [],\n [data, defaultScope, projectId, schema, scope]\n );\n\n return { results, error, isLoading };\n}\n\nfunction mapResults(\n results: RawSearchResultItems | undefined,\n projectId: string,\n schema: Entity[],\n scope: string,\n defaultScope: string\n): SearchResultItem[] | undefined {\n return results\n ?.filter((result) => (result as RawResultItem)?.hits?.length > 0)\n .map((result) => {\n const item = result as RawResultItem;\n const entityNamePlural = item.collection.replace(`${projectId}_`, '').replace(/_\\d+$/, '');\n const entitySchema = find<Entity>(propEq(entityNamePlural, 'plural'))(schema);\n\n if (!entitySchema) {\n return [];\n }\n\n const primaryAttributeName = getDisplayAttribute(entitySchema)?.name ?? '';\n const entityName = entitySchema?.name ?? entityNamePlural;\n\n // iterate over the hits and return an object with the primary attribute value first and then the rest of the attributes.\n return item.hits.map(({ document }) => {\n const primaryAttribute = document[primaryAttributeName];\n const scopedPrimaryAttribute =\n primaryAttribute && typeof primaryAttribute !== 'string'\n ? (primaryAttribute[scope] ?? primaryAttribute[defaultScope])\n : null;\n const primaryAttributeValue = scopedPrimaryAttribute ?? document[primaryAttributeName];\n const attributes = Object.entries(document).reduce(\n (acc: Omit<SearchResultItem, '_id' | '_entityName' | '_entityNamePlural'>, [key, value]) => {\n if (key !== primaryAttributeName && key !== 'id' && key !== '_updatedAt') {\n const scopedValue = typeof value !== 'string' ? (value[scope] ?? value[defaultScope]) : value;\n\n acc[key] = scopedValue;\n }\n\n return acc;\n },\n {}\n );\n\n return {\n _id: document.id,\n _entityName: entityName,\n _entityNamePlural: entityNamePlural,\n [primaryAttributeName]: primaryAttributeValue as string,\n ...attributes,\n };\n });\n })\n .flat();\n}\n"]}
1
+ {"version":3,"sources":["../src/core/use-search.tsx"],"names":["useSearch","projectId","searchRequest","scope","useAppContext","currentProject","useConfig","schema","useMemo","defaultScope","s","swrKey","data","error","isLoading","useSWR","apiPaths","res","mapResults","results","result","item","entityNamePlural","entitySchema","find","propEq","primaryAttributeName","getDisplayAttribute","entityName","document","primaryAttribute","primaryAttributeValue","attributes","acc","key","value","scopedValue"],"mappings":"iNAWO,SAASA,EACdC,CAAAA,CACAC,CAAAA,CACwE,CACxE,GAAM,CAAE,KAAA,CAAAC,GAAM,CAAA,CAAIC,GAAc,CAC1B,CAAE,cAAA,CAAAC,CAAe,CAAA,CAAIC,CAAAA,EAAU,CAC/BC,CAAAA,CAASC,QAAQ,IAAMH,CAAAA,EAAgB,MAAA,EAAU,EAAC,CAAG,CAACA,CAAc,CAAC,EAErEI,CAAAA,CADSJ,CAAAA,EAAgB,MAAA,EACF,IAAA,CAAMK,CAAAA,EAAMA,CAAAA,CAAE,SAAS,CAAA,EAAG,MAAQ,SAAA,CACzDC,CAAAA,CAAST,CAAAA,EAAe,Y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\n\nimport { useMemo } from 'react';\nimport useSWR from 'swr';\nimport { find, propEq } from 'ramda';\nimport { apiPaths } from './api-paths';\nimport { useAppContext } from './app-context';\nimport { useConfig } from './config/config-context';\nimport { getDisplayAttribute } from './get-display-attribute';\nimport type { Entity, RawResultItem, RawSearchResultItems, SearchRequestProps, SearchResultItem } from './types';\n\nexport function useSearch(\n projectId: string,\n searchRequest: SearchRequestProps | null\n): { results: SearchResultItem[] | []; error: Error; isLoading: boolean } {\n const { scope } = useAppContext();\n const { currentProject } = useConfig();\n const schema = useMemo(() => currentProject?.schema ?? [], [currentProject]);\n const scopes = currentProject?.scopes;\n const defaultScope = scopes?.find((s) => s.isDefault)?.name ?? 'default';\n const swrKey = searchRequest?.commonParams.q ? JSON.stringify(searchRequest) : null;\n const { data, error, isLoading } = useSWR(swrKey, () =>\n fetch(apiPaths(projectId).search, {\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(searchRequest),\n method: 'POST',\n mode: 'cors',\n }).then((res) => res.json() as Promise<{ results: RawSearchResultItems }>)\n );\n const results = useMemo(\n () => mapResults(data?.results ?? [], projectId, schema, scope, defaultScope) ?? [],\n [data, defaultScope, projectId, schema, scope]\n );\n\n return { results, error, isLoading };\n}\n\nfunction mapResults(\n results: RawSearchResultItems | undefined,\n projectId: string,\n schema: Entity[],\n scope: string,\n defaultScope: string\n): SearchResultItem[] | undefined {\n return results\n ?.filter((result) => (result as RawResultItem)?.hits?.length > 0)\n .map((result) => {\n const item = result as RawResultItem;\n const entityNamePlural = item.collection.replace(`${projectId}_`, '').replace(/_\\d+$/, '');\n const entitySchema = find<Entity>(propEq(entityNamePlural, 'plural'))(schema);\n\n if (!entitySchema) {\n return [];\n }\n\n const primaryAttributeName = getDisplayAttribute(entitySchema)?.name ?? '';\n const entityName = entitySchema?.name ?? entityNamePlural;\n\n // iterate over the hits and return an object with the primary attribute value first and then the rest of the attributes.\n return item.hits.map(({ document }) => {\n const primaryAttribute = document[primaryAttributeName];\n const scopedPrimaryAttribute =\n primaryAttribute && typeof primaryAttribute !== 'string'\n ? (primaryAttribute[scope] ?? primaryAttribute[defaultScope])\n : null;\n const primaryAttributeValue = scopedPrimaryAttribute ?? document[primaryAttributeName];\n const attributes = Object.entries(document).reduce(\n (acc: Omit<SearchResultItem, '_id' | '_entityName' | '_entityNamePlural'>, [key, value]) => {\n if (key !== primaryAttributeName && key !== 'id' && key !== '_updatedAt') {\n const scopedValue = typeof value !== 'string' ? (value[scope] ?? value[defaultScope]) : value;\n\n acc[key] = scopedValue;\n }\n\n return acc;\n },\n {}\n );\n\n return {\n _id: document.id,\n _entityName: entityName,\n _entityNamePlural: entityNamePlural,\n [primaryAttributeName]: primaryAttributeValue as string,\n ...attributes,\n };\n });\n })\n .flat();\n}\n"]}
@@ -0,0 +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,SquarePlay}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';import C,{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 B=o(()=>import('./root-4EALW3G6.js').then(e=>({default:e.Root}))),J=o(()=>import('./list-WJLU3K2X.js').then(e=>({default:e.List}))),W=o(()=>import('./edit-entity-PVT34FD7.js').then(e=>({default:e.EditEntity}))),X=o(()=>import('./root-BA7BLCFR.js').then(e=>({default:e.Root}))),q=o(()=>import('./root-YNGCF5QM.js').then(e=>({default:e.Root}))),K=o(()=>import('./root-ZF62TR5Z.js').then(e=>({default:e.Root}))),$=o(()=>import('./plugin-pages-PQO22EOE.js').then(e=>({default:e.PluginsPage}))),G=o(()=>import('./plugin-pages-PQO22EOE.js').then(e=>({default:e.InstalledPluginsPage}))),Q=o(()=>import('./plugin-pages-PQO22EOE.js').then(e=>({default:e.PluginDetailPage}))),T=o(()=>import('./chat-page-L427VVVR.js').then(e=>({default:e.AgentChatPage}))),Y=o(()=>import('./pages-3EK5GS2T.js').then(e=>({default:e.AutomationsPage}))),ee=o(()=>import('./pages-3EK5GS2T.js').then(e=>({default:e.RunHistoryPage}))),te=o(()=>import('./pages-3EK5GS2T.js').then(e=>({default:e.ApprovalsPage}))),oe=o(()=>import('./pages-3EK5GS2T.js').then(e=>({default:e.ActivityPage}))),ae=o(()=>import('./pages-3EK5GS2T.js').then(e=>({default:e.ActivityItemPage}))),ne=o(()=>import('./pages-3EK5GS2T.js').then(e=>({default:e.CreateAutomationPage}))),ie=o(()=>import('./pages-3EK5GS2T.js').then(e=>({default:e.AutomationDetailPage}))),re=o(()=>import('./pages-3EK5GS2T.js').then(e=>({default:e.RunsPage}))),se=o(()=>import('./pages-3EK5GS2T.js').then(e=>({default:e.RunDetailPage}))),pe=o(()=>import('./skills-pages-HIBSAVOP.js').then(e=>({default:e.SkillsPage}))),ce=o(()=>import('./skills-pages-HIBSAVOP.js').then(e=>({default:e.CreateSkillPage}))),le=o(()=>import('./skills-pages-HIBSAVOP.js').then(e=>({default:e.SkillDetailPage}))),l=[{name:"ai",icon:jsx(Bot,{strokeWidth:1.5}),title:"AI",component:K,routes:[{path:"plugins",component:$},{path:"plugins/installed",component:G},{path:"plugins/:pluginId",component:Q},{component:jsx(_,{replace:true,to:"agent"}),path:""},{component:T,path:"agent"},{component:T,path:"agent/chats/:chatId"},{component:Y,path:"automations"},{component:ee,path:"runs"},{component:te,path:"approvals"},{component:oe,path:"activity"},{component:ae,path:"activity/:itemId"},{component:ne,path:"automations/new"},{component:ie,path:"automations/:automationId"},{component:re,path:"automations/:automationId/runs"},{component:se,path:"automations/:automationId/runs/:runId"},{component:pe,path:"skills"},{component:ce,path:"skills/new"},{component:le,path:"skills/:skillId"}]},{name:"desk",icon:jsx(Layout,{strokeWidth:1.5}),title:"Desk",component:B,routes:[{path:"list/:entity",component:J,children:[{path:"edit/:id",component:W}]}]},{name:"asset-manager",icon:jsx(FileStack,{strokeWidth:1.5}),title:"Asset Manager",component:X,routes:[]},{name:"explorer",icon:jsx(SquarePlay,{strokeWidth:1.5}),title:"Explorer",component:q,routes:[]}];async function b(e){try{let t=await fetch(d$1(e).schema,{credentials:"include",mode:"cors"});if(!t.ok){let n=t.statusText||`Request failed with status ${String(t.status)}`;try{let i=await t.json();n=i.error??i.message??n;}catch{}return {ok:!1,projectId:e,error:{status:t.status,message:n}}}let a=await t.json();return {ok:!0,project:{...a,projectId:a.projectId||e}}}catch(t){return {ok:false,projectId:e,error:{status:0,message:t instanceof Error?t.message:"Network error"}}}}function w(e,t){let a=[],n={};for(let i of e??[])i.ok?a.push(i.project):n[i.projectId]=i.error;return {projects:a,errors:n,isLoading:t}}function A(e,t){let a=t&&e.length>0?["project-schemas",t,...e]:null,{data:n,isLoading:i}=C(a,()=>Promise.all(e.map(s=>b(s))),{revalidateOnFocus:false,revalidateOnReconnect:false});return w(n,!!a&&(i||n===void 0))}function ue(e,t){return w(e?[e]:void 0,t)}function L(e,t){let a=t&&e?["project-schema",t,e]:null,{data:n,isLoading:i}=C(a,()=>b(e??""),{revalidateOnFocus:false,revalidateOnReconnect:false});return ue(n,!!a&&(i||n===void 0))}function de(e,t){return Array.isArray(e)&&(e[0]==="project-schema"||e[0]==="project-schemas")&&e.slice(2).includes(t)}function Re(e){return mutate(t=>de(t,e))}var I=createContext({mode:"projects",apps:l,contributions:{apps:l},currentProjectId:void 0,currentProject:void 0,currentProjectSchema:[],projects:[],projectIds:[],projectSummaries:[],schemaErrors:{},isLoadingSchemas:false});function ye(e){return [...e.filter(a=>a.name!==d.name&&a.name!==f.name),d,f]}function De({projectIds:e,projectSummaries:t=[],mode:a="projects",userId:n,children:i}){let{projectId:s}=useParams(),[,R]=g(),h=R.user?.id??n,V=A(a==="projects"?e:[],h),O=L(a==="hosted"&&s&&e.includes(s)?s:void 0,h),{projects:y,errors:P,isLoading:S}=a==="hosted"?O:V,m=useMemo(()=>e.map(r=>y.find(u=>u.projectId===r)).filter(r=>r!==void 0).map(r=>({...r,schema:ye(r.schema)})),[y,e]),H=useMemo(()=>{let r=m.find(u=>u.projectId===s);return {mode:a,apps:l,contributions:{apps:l},currentProjectId:s,currentProject:r,currentProjectSchema:r?.schema??[],projects:m,projectIds:e,projectSummaries:t,schemaErrors:P,isLoadingSchemas:S}},[s,P,S,a,e,t,m]);return jsx(I.Provider,{value:H,children:i})}function Ze(){return useContext(I)}
2
+ export{x as a,d as b,f as c,Re as d,De as e,Ze as f};//# sourceMappingURL=chunk-XWBACTNR.js.map
3
+ //# sourceMappingURL=chunk-XWBACTNR.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","explorerRoot","aiRoot","aiPluginsPage","aiInstalledPluginsPage","aiPluginDetailPage","aiAgentChatPage","aiAutomationsPage","aiRunHistoryPage","aiApprovalsPage","aiActivityPage","aiActivityItemPage","aiCreateAutomationPage","aiAutomationDetailPage","aiRunsPage","aiRunDetailPage","aiSkillsPage","aiCreateSkillPage","aiSkillDetailPage","builtInApps","BotIcon","LayoutIcon","FileStackIcon","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":"yVAEO,IAAMA,CAAAA,CAAsB,CACjC,IAAA,CAAM,QAAA,CACN,OAAQ,SAAA,CACR,OAAA,CAAS,mBACT,IAAA,CAAM,CACJ,OAAQ,IACV,CAAA,CACA,WAAY,CACV,CACE,KAAM,MAAA,CACN,KAAA,CAAO,QACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,SACV,SAAA,CAAW,MAAA,CACX,YAAa,mBAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,KAAM,kBAAA,CACN,KAAA,C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AkBtB,CAAAA,CAAQF,CAAAA,CAAWsB,EAAMjB,CAAAA,CAAYgB,CAAAA,CAAkBpB,CAAQ,CAAC,CAAA,CAEtF,OAAOhD,GAAAA,CAAC8D,CAAAA,CAAc,SAAd,CAAuB,KAAA,CAAOkB,EAAQ,QAAA,CAAAV,CAAAA,CAAS,CACzD,CAEO,SAASY,IAA2B,CACzC,OAAOC,UAAAA,CAAWrB,CAAa,CACjC","file":"chunk-C47FNPLK.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 Bot as BotIcon,\n FileStack as FileStackIcon,\n Layout as LayoutIcon,\n SquarePlay as SquarePlayIcon,\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(() =>\n import('../../apps/asset-manager/root').then((m) => ({ default: m.Root }))\n);\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(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginsPage }))\n);\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(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.RunHistoryPage }))\n);\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(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillsPage }))\n);\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: '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","explorerRoot","aiRoot","aiPluginsPage","aiInstalledPluginsPage","aiPluginDetailPage","aiAgentChatPage","aiAutomationsPage","aiRunHistoryPage","aiApprovalsPage","aiActivityPage","aiActivityItemPage","aiCreateAutomationPage","aiAutomationDetailPage","aiRunsPage","aiRunDetailPage","aiSkillsPage","aiCreateSkillPage","aiSkillDetailPage","builtInApps","BotIcon","LayoutIcon","FileStackIcon","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":"gWAEO,IAAMA,CAAAA,CAAsB,CACjC,IAAA,CAAM,QAAA,CACN,OAAQ,SAAA,CACR,OAAA,CAAS,mBACT,IAAA,CAAM,CACJ,OAAQ,IACV,CAAA,CACA,WAAY,CACV,CACE,KAAM,MAAA,CACN,KAAA,CAAO,QACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,SACV,SAAA,CAAW,MAAA,CACX,YAAa,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,SACV,SAAA,CAAW,MAAA,CACX,YAAa,MAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,KAAM,MAAA,CACN,KAAA,CAAO,OACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,MACV,SAAA,CAAW,MAAA,CACX,YAAa,MAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,KAAM,OAAA,CACN,KAAA,CAAO,QACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,EACR,CAAA,CACA,QAAA,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AA,CAAKd,GAAcwC,CAAAA,CAAe,IAAA,CAAMnC,CAAAA,EAAYA,CAAAA,CAAQ,SAAA,GAAcL,CAAS,CAAC,CAAA,CACpF,MAAA,CAAQK,GAAwCA,CAAAA,GAAY,MAAS,EACrE,GAAA,CAAKA,CAAAA,GAAa,CAAE,GAAGA,CAAAA,CAAS,OAAQqB,EAAAA,CAAuBrB,CAAAA,CAAQ,MAAM,CAAE,CAAA,CAAE,EACtF,CAACmC,CAAAA,CAAgB1B,CAAU,CAC7B,CAAA,CAEM4B,EAAQD,OAAAA,CAAuB,IAAM,CACzC,IAAME,CAAAA,CAAiBjC,EAAS,IAAA,CAAML,CAAAA,EAAYA,EAAQ,SAAA,GAAc4B,CAAgB,EAExF,OAAO,CACL,KAAAF,CAAAA,CACA,IAAA,CAAMrC,EACN,aAAA,CAAe,CAAE,IAAA,CAAMA,CAAY,CAAA,CACnC,gBAAA,CAAAuC,EACA,cAAA,CAAAU,CAAAA,CACA,qBAAsBA,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,EAAkBtB,CAAAA,CAAQF,CAAAA,CAAWsB,EAAMjB,CAAAA,CAAYgB,CAAAA,CAAkBpB,CAAQ,CAAC,CAAA,CAEtF,OAAOhD,GAAAA,CAAC8D,CAAAA,CAAc,SAAd,CAAuB,KAAA,CAAOkB,EAAQ,QAAA,CAAAV,CAAAA,CAAS,CACzD,CAEO,SAASY,IAA2B,CACzC,OAAOC,UAAAA,CAAWrB,CAAa,CACjC","file":"chunk-XWBACTNR.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 Bot as BotIcon,\n FileStack as FileStackIcon,\n Layout as LayoutIcon,\n SquarePlay as SquarePlayIcon,\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(() =>\n import('../../apps/asset-manager/root').then((m) => ({ default: m.Root }))\n);\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(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginsPage }))\n);\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(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.RunHistoryPage }))\n);\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(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillsPage }))\n);\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: '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"]}
@@ -0,0 +1,2 @@
1
+ import'./index.css';import {g}from'./chunk-2HYQVMP3.js';function n(e){return e?e!=="viewer":true}function r(){let[,e]=g();return n(e.user?.role)}export{n as a,r as b};//# sourceMappingURL=chunk-ZZRA4567.js.map
2
+ //# sourceMappingURL=chunk-ZZRA4567.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/permissions.ts"],"names":["canMutateData","role","useCanMutate","auth","useAuth"],"mappings":"wDAWO,SAASA,CAAAA,CAAcC,CAAAA,CAA0C,CACtE,OAAKA,CAAAA,CAIEA,IAAS,QAAA,CAHP,IAIX,CAEO,SAASC,CAAAA,EAAwB,CACtC,GAAM,EAAGC,CAAI,CAAA,CAAIC,CAAAA,EAAQ,CAEzB,OAAOJ,CAAAA,CAAcG,CAAAA,CAAK,IAAA,EAAM,IAAI,CACtC","file":"chunk-V64P56OA.js","sourcesContent":["'use client';\n\nimport { useAuth } from '../auth/auth-context';\n\n/**\n * Viewers are read-only: the GraphQL route and the automations API reject\n * their mutations server-side. This helper only mirrors that rule in the UI\n * so restricted actions render as disabled instead of failing on submit.\n * While the role is still unknown (auth loading) actions stay enabled and\n * the server remains the source of truth.\n */\nexport function canMutateData(role: string | null | undefined): boolean {\n if (!role) {\n return true;\n }\n\n return role !== 'viewer';\n}\n\nexport function useCanMutate(): boolean {\n const [, auth] = useAuth();\n\n return canMutateData(auth.user?.role);\n}\n"]}
1
+ {"version":3,"sources":["../src/core/permissions.ts"],"names":["canMutateData","role","useCanMutate","auth","useAuth"],"mappings":"wDAWO,SAASA,CAAAA,CAAcC,CAAAA,CAA0C,CACtE,OAAKA,CAAAA,CAIEA,IAAS,QAAA,CAHP,IAIX,CAEO,SAASC,CAAAA,EAAwB,CACtC,GAAM,EAAGC,CAAI,CAAA,CAAIC,CAAAA,EAAQ,CAEzB,OAAOJ,CAAAA,CAAcG,CAAAA,CAAK,IAAA,EAAM,IAAI,CACtC","file":"chunk-ZZRA4567.js","sourcesContent":["'use client';\n\nimport { useAuth } from '../auth/auth-context';\n\n/**\n * Viewers are read-only: the GraphQL route and the automations API reject\n * their mutations server-side. This helper only mirrors that rule in the UI\n * so restricted actions render as disabled instead of failing on submit.\n * While the role is still unknown (auth loading) actions stay enabled and\n * the server remains the source of truth.\n */\nexport function canMutateData(role: string | null | undefined): boolean {\n if (!role) {\n return true;\n }\n\n return role !== 'viewer';\n}\n\nexport function useCanMutate(): boolean {\n const [, auth] = useAuth();\n\n return canMutateData(auth.user?.role);\n}\n"]}
@@ -0,0 +1,103 @@
1
+ export { F as FlexkitHandlerContext, a as FlexkitHandlerResult, h as handleFlexkitRequest } from './core-handler-XAVVKLhV.js';
2
+
3
+ /**
4
+ * Where the OAuth login hands the one-time session code to the desktop app.
5
+ * The app registers the `flexkit://` scheme with the operating system; the
6
+ * Flexkit backend allows exactly this URL as a login callback.
7
+ */
8
+ declare const DESKTOP_LOGIN_CALLBACK = "flexkit://auth/callback";
9
+ /**
10
+ * Where the desktop app keeps the Flexkit session. The app stores it encrypted
11
+ * with the operating system's keychain (Electron `safeStorage`); this module
12
+ * never sees where.
13
+ */
14
+ interface DesktopSessionStore {
15
+ get: () => Promise<string> | string;
16
+ set: (token: string) => Promise<void> | void;
17
+ clear: () => Promise<void> | void;
18
+ }
19
+ type SessionChange = {
20
+ type: 'set';
21
+ token: string;
22
+ } | {
23
+ type: 'clear';
24
+ };
25
+ /**
26
+ * Reads the session change the BFF core expresses as a `Set-Cookie` header.
27
+ * Returns null for cookies that are not the session.
28
+ */
29
+ declare function parseSessionCookie(setCookie: string): SessionChange | null;
30
+ /**
31
+ * The nonce the desktop app adds to a login it starts and the Flexkit backend
32
+ * echoes to the callback: only a callback carrying the expected one is
33
+ * exchanged, so a `flexkit://auth/callback` link from anywhere else cannot
34
+ * sign the app into another account.
35
+ */
36
+ declare const DESKTOP_LOGIN_STATE_PARAM = "state";
37
+ /**
38
+ * A login start URL on the Flexkit backend
39
+ * (`https://<flexkit>/auth/login/<provider>?origin=flexkit://auth/callback&...`).
40
+ * Only that host gets the nonce: it is the secret that lets a callback in.
41
+ */
42
+ declare function isDesktopLoginStart(url: string): boolean;
43
+ /** The login start URL with the app's nonce, for the backend to echo to the callback. */
44
+ declare function withDesktopLoginState(url: string, state: string): string;
45
+ /** What a `flexkit://auth/callback` URL carries. */
46
+ interface DesktopLoginCallback {
47
+ code: string;
48
+ /** In-app path to open after the login; always absolute within the app. */
49
+ redirect: string;
50
+ /** The nonce echoed from the login start, if any. */
51
+ state: string | null;
52
+ }
53
+ /**
54
+ * Parses the login callback the OS hands the app. Anything but the exact
55
+ * callback path is refused, and the redirect is kept inside the app: only an
56
+ * absolute path, never a URL (a `//host` prefix is a URL too).
57
+ */
58
+ declare function parseDesktopLoginCallback(url: string): DesktopLoginCallback | null;
59
+ interface CompleteDesktopLoginOptions {
60
+ /** The nonce of the login this app started; null when it started none. */
61
+ expectedState: string | null;
62
+ }
63
+ /**
64
+ * Finishes a desktop login: exchanges the code from the callback for a
65
+ * session and stores it. Resolves to the in-app path to open, or null when
66
+ * the callback, its state or the code was not accepted. A callback is only
67
+ * accepted for a login this app started (`expectedState`).
68
+ */
69
+ declare function completeDesktopLogin(url: string, sessionStore: DesktopSessionStore, { expectedState }: CompleteDesktopLoginOptions): Promise<string | null>;
70
+ interface FlexkitElectronHandlerOptions {
71
+ sessionStore: DesktopSessionStore;
72
+ }
73
+ /**
74
+ * The Studio BFF for the desktop app: the handler the main process gives
75
+ * `protocol.handle` for the Studio's `/api/flexkit/*` requests. It is the same
76
+ * core the Next.js, Astro and TanStack Start adapters wrap, with the session
77
+ * read from and written to the app's store instead of an HttpOnly cookie.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const handleApi = createFlexkitElectronHandler({ sessionStore });
82
+ *
83
+ * protocol.handle('flexkit', (request) => {
84
+ * const { pathname } = new URL(request.url);
85
+ *
86
+ * return pathname.startsWith('/api/flexkit/') ? handleApi(request) : serveStudio(request);
87
+ * });
88
+ * ```
89
+ */
90
+ declare function createFlexkitElectronHandler({ sessionStore, }: FlexkitElectronHandlerOptions): (request: Request) => Promise<Response>;
91
+
92
+ /**
93
+ * Exchange an OAuth authorization code for a session token.
94
+ * This function is framework-agnostic and can be used in any server environment.
95
+ *
96
+ * @param code - The OAuth authorization code received from the auth provider
97
+ * @returns A promise that resolves to an object containing the session ID
98
+ */
99
+ declare function getToken(code: string): Promise<{
100
+ sid: string;
101
+ }>;
102
+
103
+ export { type CompleteDesktopLoginOptions, DESKTOP_LOGIN_CALLBACK, DESKTOP_LOGIN_STATE_PARAM, type DesktopLoginCallback, type DesktopSessionStore, type FlexkitElectronHandlerOptions, type SessionChange, completeDesktopLogin, createFlexkitElectronHandler, getToken, isDesktopLoginStart, parseDesktopLoginCallback, parseSessionCookie, withDesktopLoginState };
@@ -0,0 +1,131 @@
1
+ import {
2
+ flexkitDomain,
3
+ getToken,
4
+ handleFlexkitRequest
5
+ } from "./chunk-GFAOY74A.js";
6
+
7
+ // src/auth/electron-api.ts
8
+ var DESKTOP_LOGIN_CALLBACK = "flexkit://auth/callback";
9
+ function parseSessionCookie(setCookie) {
10
+ const [pair = "", ...attributes] = setCookie.split(";");
11
+ const separator = pair.indexOf("=");
12
+ if (separator === -1 || pair.slice(0, separator).trim() !== "sessionToken") {
13
+ return null;
14
+ }
15
+ const token = pair.slice(separator + 1).trim();
16
+ const expired = attributes.some((attribute) => attribute.trim().toLowerCase() === "max-age=0");
17
+ if (!token || expired) {
18
+ return { type: "clear" };
19
+ }
20
+ return { type: "set", token };
21
+ }
22
+ var DESKTOP_LOGIN_STATE_PARAM = "state";
23
+ var LOGIN_STATE_PATTERN = /^[A-Za-z0-9_-]{16,128}$/;
24
+ function isDesktopLoginStart(url) {
25
+ let parsed;
26
+ try {
27
+ parsed = new URL(url);
28
+ } catch {
29
+ return false;
30
+ }
31
+ return parsed.protocol === "https:" && (parsed.host === flexkitDomain || parsed.host === `www.${flexkitDomain}`) && parsed.pathname.startsWith("/auth/login/") && parsed.searchParams.get("origin") === DESKTOP_LOGIN_CALLBACK;
32
+ }
33
+ function withDesktopLoginState(url, state) {
34
+ const parsed = new URL(url);
35
+ parsed.searchParams.set(DESKTOP_LOGIN_STATE_PARAM, state);
36
+ return parsed.toString();
37
+ }
38
+ function parseDesktopLoginCallback(url) {
39
+ let parsed;
40
+ try {
41
+ parsed = new URL(url);
42
+ } catch {
43
+ return null;
44
+ }
45
+ if (`${parsed.protocol}//${parsed.host}${parsed.pathname}` !== DESKTOP_LOGIN_CALLBACK || parsed.username || parsed.password) {
46
+ return null;
47
+ }
48
+ const code = parsed.searchParams.get("code") ?? "";
49
+ if (!/^[0-9a-f-]{36}$/i.test(code)) {
50
+ return null;
51
+ }
52
+ const redirect = parsed.searchParams.get("redirect") ?? "/";
53
+ const state = parsed.searchParams.get(DESKTOP_LOGIN_STATE_PARAM);
54
+ return {
55
+ code,
56
+ redirect: redirect.startsWith("/") && !redirect.startsWith("//") ? redirect : "/",
57
+ state: state !== null && LOGIN_STATE_PATTERN.test(state) ? state : null
58
+ };
59
+ }
60
+ async function completeDesktopLogin(url, sessionStore, { expectedState }) {
61
+ const callback = parseDesktopLoginCallback(url);
62
+ if (!callback || expectedState === null || callback.state !== expectedState) {
63
+ return null;
64
+ }
65
+ const { sid } = await getToken(callback.code);
66
+ if (!sid) {
67
+ return null;
68
+ }
69
+ await sessionStore.set(sid);
70
+ return callback.redirect;
71
+ }
72
+ function resultToResponse(result) {
73
+ const headers = new Headers(result.headers);
74
+ if (result.type === "redirect") {
75
+ return new Response(null, { status: 204 });
76
+ }
77
+ if (result.type === "text") {
78
+ return new Response(result.body, { status: result.status, headers });
79
+ }
80
+ if (result.type === "response") {
81
+ return new Response(result.body, { status: result.status, headers });
82
+ }
83
+ headers.set("Content-Type", "application/json");
84
+ return new Response(JSON.stringify(result.body), { status: result.status, headers });
85
+ }
86
+ function createFlexkitElectronHandler({
87
+ sessionStore
88
+ }) {
89
+ return async function handleElectronRequest(request) {
90
+ const { pathname, search } = new URL(request.url);
91
+ if (!pathname.startsWith("/api/flexkit/") || pathname === "/api/flexkit/get-token") {
92
+ return new Response("Not found", { status: 404 });
93
+ }
94
+ let result;
95
+ try {
96
+ result = await handleFlexkitRequest({
97
+ request,
98
+ pathname,
99
+ search,
100
+ sessionToken: await sessionStore.get(),
101
+ contentType: request.headers.get("content-type")
102
+ });
103
+ } catch (error) {
104
+ return Response.json(
105
+ { error: `Flexkit is not reachable: ${error instanceof Error ? error.message : String(error)}` },
106
+ { status: 502 }
107
+ );
108
+ }
109
+ if (result.setCookie) {
110
+ const change = parseSessionCookie(result.setCookie);
111
+ if (change?.type === "set") {
112
+ await sessionStore.set(change.token);
113
+ } else if (change?.type === "clear") {
114
+ await sessionStore.clear();
115
+ }
116
+ }
117
+ return resultToResponse(result);
118
+ };
119
+ }
120
+ export {
121
+ DESKTOP_LOGIN_CALLBACK,
122
+ DESKTOP_LOGIN_STATE_PARAM,
123
+ completeDesktopLogin,
124
+ createFlexkitElectronHandler,
125
+ getToken,
126
+ handleFlexkitRequest,
127
+ isDesktopLoginStart,
128
+ parseDesktopLoginCallback,
129
+ parseSessionCookie,
130
+ withDesktopLoginState
131
+ };
package/dist/index.css CHANGED
@@ -8441,6 +8441,15 @@ pre {
8441
8441
  border-radius: var(--border-radius-4);
8442
8442
  padding: var(--px-4);
8443
8443
  }
8444
+ html[data-desktop-platform] .flexkit-navbar {
8445
+ -webkit-app-region: drag;
8446
+ }
8447
+ html[data-desktop-platform] .flexkit-navbar :is(a, button, input, textarea, select, [role='button'], [role='combobox']) {
8448
+ -webkit-app-region: no-drag;
8449
+ }
8450
+ html[data-desktop-platform='darwin'] .flexkit-navbar {
8451
+ padding-left: 6.5rem;
8452
+ }
8444
8453
  @keyframes enter {
8445
8454
  from {
8446
8455
  opacity: var(--tw-enter-opacity, 1);
package/dist/index.d.ts CHANGED
@@ -548,6 +548,38 @@ type AuthService = [boolean, Auth];
548
548
 
549
549
  declare function useAuth(): AuthService;
550
550
 
551
+ /**
552
+ * The bridge the Flexkit Studio desktop app (Electron) exposes to the Studio
553
+ * through its preload script, as `window.flexkitDesktop`. Studio features
554
+ * check for the bridge (a capability), never for a platform, so the web
555
+ * Studio never sees any of this.
556
+ */
557
+ interface FlexkitDesktopBridge {
558
+ platform: 'darwin' | 'win32' | 'linux';
559
+ /** Installed app version; it tracks the `@flexkit/studio` version it bundles. */
560
+ version: string;
561
+ /** The Flexkit domain the app was built against (`flexkit.io`, or `flexkit.test` for local builds). */
562
+ domain: string;
563
+ /** The URL the OAuth login hands the session code to; the app registered its scheme with the OS. */
564
+ loginCallback: string;
565
+ /** Dock (macOS) or taskbar badge; 0 clears it. */
566
+ setBadgeCount: (count: number) => void;
567
+ /** Brings the Studio window to the front (a clicked notification, for example). */
568
+ focusWindow: () => void;
569
+ /** Paths the app asks the Studio to open: deep links and menu items. Returns the unsubscribe function. */
570
+ onNavigate: (listener: (path: string) => void) => () => void;
571
+ /** An update has been downloaded and installs on the next restart. Returns the unsubscribe function. */
572
+ onUpdateDownloaded: (listener: (update: {
573
+ version: string;
574
+ }) => void) => () => void;
575
+ /** Restarts into the downloaded update. */
576
+ installUpdate: () => void;
577
+ }
578
+ /** The desktop app's login callback (see `DESKTOP_LOGIN_CALLBACK` in the Electron adapter). */
579
+ declare const DESKTOP_LOGIN_CALLBACK = "flexkit://auth/callback";
580
+ /** The desktop bridge when the Studio runs inside the desktop app, otherwise undefined. */
581
+ declare function getDesktop(): FlexkitDesktopBridge | undefined;
582
+
551
583
  type Props$1 = {
552
584
  scope: string | undefined;
553
585
  checked: boolean;
@@ -834,4 +866,4 @@ declare const assetSchema: UiEntity;
834
866
 
835
867
  declare const tagSchema: UiEntity;
836
868
 
837
- export { ALL_FIELDS_GROUP, ALL_FIELDS_GROUP_NAME, type AgentChatDetail, type AgentChatSearchResult, type AgentChatsList, type AttributeValue, type Automation, type AutomationApprovals, type AutomationArtifact, type AutomationCreditBalance, type AutomationInput, type AutomationToolChannel, type AutomationToolProvider, type ConfigContext, DataTable, DataTableColumnHeader, DataTableFacetedFilter, DataTableRowActions, DataTableSortedBy, DataTableToolbar, DataTableViewOptions, DefaultValueSwitch, type EntityData, type EntityListRowPatch, FlexkitStudio, type FlexkitStudioProps, type FormEntityItem, type FormFieldParams, type FormFieldValue, type HostedUser, IMAGES_BASE_URL, type MappedEntityItem, ProjectDisabled, type ProjectSchemaError, type ProjectSummary, type ProjectUiConfig, type RunHistory, type RunHistoryRun, SchemaError, type SearchRequestProps, type SearchResultItem, type Skill, type SkillInput, type SkillsList, type StudioMode, type UploadedFileResult, assetSchema, canAccessSpaces, canMutateData, filterAttributesForSpaces, filterEntitiesForSpaces, getEntityCreateMutation, getEntityDeleteMutation, getEntityDeleteWhere, getEntityQuery, getEntitySchema, getEntityUpdateMutation, getSortNotNullWhere, tagSchema, useAppContext, useAppDispatch, useAuth, useCanMutate, useConfig, useDispatch, useEntityMutation, useEntityQuery, useGraphQLError, useGridColumnsDefinition, usePatchEntityList, useRefreshEntityList, useSearch, useUploadAssets };
869
+ export { ALL_FIELDS_GROUP, ALL_FIELDS_GROUP_NAME, type AgentChatDetail, type AgentChatSearchResult, type AgentChatsList, type AttributeValue, type Automation, type AutomationApprovals, type AutomationArtifact, type AutomationCreditBalance, type AutomationInput, type AutomationToolChannel, type AutomationToolProvider, type ConfigContext, DESKTOP_LOGIN_CALLBACK, DataTable, DataTableColumnHeader, DataTableFacetedFilter, DataTableRowActions, DataTableSortedBy, DataTableToolbar, DataTableViewOptions, DefaultValueSwitch, type EntityData, type EntityListRowPatch, type FlexkitDesktopBridge, FlexkitStudio, type FlexkitStudioProps, type FormEntityItem, type FormFieldParams, type FormFieldValue, type HostedUser, IMAGES_BASE_URL, type MappedEntityItem, ProjectDisabled, type ProjectSchemaError, type ProjectSummary, type ProjectUiConfig, type RunHistory, type RunHistoryRun, SchemaError, type SearchRequestProps, type SearchResultItem, type Skill, type SkillInput, type SkillsList, type StudioMode, type UploadedFileResult, assetSchema, canAccessSpaces, canMutateData, filterAttributesForSpaces, filterEntitiesForSpaces, getDesktop, getEntityCreateMutation, getEntityDeleteMutation, getEntityDeleteWhere, getEntityQuery, getEntitySchema, getEntityUpdateMutation, getSortNotNullWhere, tagSchema, useAppContext, useAppDispatch, useAuth, useCanMutate, useConfig, useDispatch, useEntityMutation, useEntityQuery, useGraphQLError, useGridColumnsDefinition, usePatchEntityList, useRefreshEntityList, useSearch, useUploadAssets };