@flexkit/studio 0.2.35 → 0.2.36

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 (85) hide show
  1. package/dist/{activity-nav-button-ZHQOZBCC.js → activity-nav-button-KOOMUTOW.js} +2 -2
  2. package/dist/{activity-nav-button-ZHQOZBCC.js.map → activity-nav-button-KOOMUTOW.js.map} +1 -1
  3. package/dist/chat-page-NDVHLH5Q.js +4 -0
  4. package/dist/chat-page-NDVHLH5Q.js.map +1 -0
  5. package/dist/{chunk-XYE6ZAUB.js → chunk-27JTWTU6.js} +2 -2
  6. package/dist/{chunk-XYE6ZAUB.js.map → chunk-27JTWTU6.js.map} +1 -1
  7. package/dist/{chunk-PZWEC6KD.js → chunk-2PBDHGRR.js} +2 -2
  8. package/dist/{chunk-PZWEC6KD.js.map → chunk-2PBDHGRR.js.map} +1 -1
  9. package/dist/{chunk-ZRTWLY77.js → chunk-474MQNDK.js} +3 -3
  10. package/dist/{chunk-ZRTWLY77.js.map → chunk-474MQNDK.js.map} +1 -1
  11. package/dist/{chunk-RFKMFD2O.js → chunk-CGMKGENV.js} +2 -2
  12. package/dist/{chunk-RFKMFD2O.js.map → chunk-CGMKGENV.js.map} +1 -1
  13. package/dist/{chunk-DEG7QP5C.js → chunk-FF5EBXYN.js} +3 -3
  14. package/dist/{chunk-DEG7QP5C.js.map → chunk-FF5EBXYN.js.map} +1 -1
  15. package/dist/{chunk-KEGJNZLW.js → chunk-FJS4SN3K.js} +3 -3
  16. package/dist/{chunk-KEGJNZLW.js.map → chunk-FJS4SN3K.js.map} +1 -1
  17. package/dist/{chunk-W7JDZHCV.js → chunk-FXUD4JRG.js} +2 -2
  18. package/dist/{chunk-W7JDZHCV.js.map → chunk-FXUD4JRG.js.map} +1 -1
  19. package/dist/{chunk-PWGLA33F.js → chunk-GTR4M2BQ.js} +3 -3
  20. package/dist/{chunk-PWGLA33F.js.map → chunk-GTR4M2BQ.js.map} +1 -1
  21. package/dist/{chunk-J6EGNRRT.js → chunk-HXPETSXC.js} +3 -3
  22. package/dist/{chunk-J6EGNRRT.js.map → chunk-HXPETSXC.js.map} +1 -1
  23. package/dist/{chunk-WU2KCXBC.js → chunk-L5Z56DDM.js} +2 -2
  24. package/dist/{chunk-WU2KCXBC.js.map → chunk-L5Z56DDM.js.map} +1 -1
  25. package/dist/{chunk-RAUQCO6W.js → chunk-LTM3MW2D.js} +2 -2
  26. package/dist/{chunk-RAUQCO6W.js.map → chunk-LTM3MW2D.js.map} +1 -1
  27. package/dist/{chunk-36DLIVZF.js → chunk-LVKBKU6Q.js} +2 -2
  28. package/dist/{chunk-36DLIVZF.js.map → chunk-LVKBKU6Q.js.map} +1 -1
  29. package/dist/{chunk-PMLDA2FF.js → chunk-LXLEUEWT.js} +2 -2
  30. package/dist/{chunk-PMLDA2FF.js.map → chunk-LXLEUEWT.js.map} +1 -1
  31. package/dist/{chunk-BTH7HU5Y.js → chunk-MHEFVYKP.js} +2 -2
  32. package/dist/{chunk-BTH7HU5Y.js.map → chunk-MHEFVYKP.js.map} +1 -1
  33. package/dist/{chunk-Q4CWQHBJ.js → chunk-NKDQQHCL.js} +2 -2
  34. package/dist/{chunk-Q4CWQHBJ.js.map → chunk-NKDQQHCL.js.map} +1 -1
  35. package/dist/{chunk-ZMONKGWJ.js → chunk-OJ4RI6IQ.js} +3 -3
  36. package/dist/{chunk-ZMONKGWJ.js.map → chunk-OJ4RI6IQ.js.map} +1 -1
  37. package/dist/chunk-PLCI2RJA.js +3 -0
  38. package/dist/chunk-PLCI2RJA.js.map +1 -0
  39. package/dist/{chunk-R6DPAMLC.js → chunk-SOA2F7Z6.js} +3 -3
  40. package/dist/{chunk-R6DPAMLC.js.map → chunk-SOA2F7Z6.js.map} +1 -1
  41. package/dist/{chunk-TI3EHLRE.js → chunk-TWA6OG5U.js} +3 -3
  42. package/dist/{chunk-TI3EHLRE.js.map → chunk-TWA6OG5U.js.map} +1 -1
  43. package/dist/{chunk-7N3LTSVX.js → chunk-VIBGMCLS.js} +2 -2
  44. package/dist/{chunk-7N3LTSVX.js.map → chunk-VIBGMCLS.js.map} +1 -1
  45. package/dist/{chunk-FJRDLP7V.js → chunk-YJ4NWJCC.js} +4 -4
  46. package/dist/{chunk-FJRDLP7V.js.map → chunk-YJ4NWJCC.js.map} +1 -1
  47. package/dist/{entry-NQRN7SWV.js → entry-XHH3NKN2.js} +2 -2
  48. package/dist/{entry-NQRN7SWV.js.map → entry-XHH3NKN2.js.map} +1 -1
  49. package/dist/index.js +2 -2
  50. package/dist/{list-RPIG75US.js → list-R64THLZD.js} +2 -2
  51. package/dist/{list-RPIG75US.js.map → list-R64THLZD.js.map} +1 -1
  52. package/dist/{list-7SCWJXUE.js → list-XIE55HYD.js} +3 -3
  53. package/dist/{list-7SCWJXUE.js.map → list-XIE55HYD.js.map} +1 -1
  54. package/dist/{pages-KXERA5Z6.js → pages-OWXBU64L.js} +3 -3
  55. package/dist/{pages-KXERA5Z6.js.map → pages-OWXBU64L.js.map} +1 -1
  56. package/dist/{plugin-pages-NXA4BT7Y.js → plugin-pages-JBJQHBIN.js} +2 -2
  57. package/dist/{plugin-pages-NXA4BT7Y.js.map → plugin-pages-JBJQHBIN.js.map} +1 -1
  58. package/dist/{project-selector-SA6UUVBK.js → project-selector-L2WZ3MB5.js} +2 -2
  59. package/dist/{project-selector-SA6UUVBK.js.map → project-selector-L2WZ3MB5.js.map} +1 -1
  60. package/dist/record-links-BEKOPDDR.js +2 -0
  61. package/dist/{record-links-RTMCYEPM.js.map → record-links-BEKOPDDR.js.map} +1 -1
  62. package/dist/{root-MBFQXX4E.js → root-B5XP6VYU.js} +2 -2
  63. package/dist/{root-MBFQXX4E.js.map → root-B5XP6VYU.js.map} +1 -1
  64. package/dist/{root-TZIXWEZO.js → root-DUQULYRX.js} +2 -2
  65. package/dist/{root-TZIXWEZO.js.map → root-DUQULYRX.js.map} +1 -1
  66. package/dist/{root-6H6K3YQF.js → root-I22KNOFC.js} +3 -3
  67. package/dist/{root-6H6K3YQF.js.map → root-I22KNOFC.js.map} +1 -1
  68. package/dist/{root-W5ZPSNQ2.js → root-O4DMQLEH.js} +2 -2
  69. package/dist/{root-W5ZPSNQ2.js.map → root-O4DMQLEH.js.map} +1 -1
  70. package/dist/{root-IBZPU2D4.js → root-RUOT5OSO.js} +3 -3
  71. package/dist/{root-IBZPU2D4.js.map → root-RUOT5OSO.js.map} +1 -1
  72. package/dist/{root-TSZ3CSJU.js → root-VLD6GNZL.js} +3 -3
  73. package/dist/{root-TSZ3CSJU.js.map → root-VLD6GNZL.js.map} +1 -1
  74. package/dist/{search-ZLEYFT3T.js → search-4UQR6ENH.js} +2 -2
  75. package/dist/{search-ZLEYFT3T.js.map → search-4UQR6ENH.js.map} +1 -1
  76. package/dist/{skills-pages-RPMWIBLS.js → skills-pages-VUIOUEYQ.js} +2 -2
  77. package/dist/{skills-pages-RPMWIBLS.js.map → skills-pages-VUIOUEYQ.js.map} +1 -1
  78. package/dist/{source-VYWE5EB5.js → source-L54C4T3X.js} +2 -2
  79. package/dist/{source-VYWE5EB5.js.map → source-L54C4T3X.js.map} +1 -1
  80. package/package.json +3 -3
  81. package/dist/chat-page-IR4RF46H.js +0 -4
  82. package/dist/chat-page-IR4RF46H.js.map +0 -1
  83. package/dist/chunk-U6VZY3V2.js +0 -3
  84. package/dist/chunk-U6VZY3V2.js.map +0 -1
  85. package/dist/record-links-RTMCYEPM.js +0 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/entities/assets-schema.ts","../src/entities/tags-schema.ts","../src/core/config/use-project-schemas.ts","../src/ui/components/loading.tsx","../src/core/apps/built-in-apps.tsx","../src/core/config/config-context.tsx"],"names":["assetSchema","tagSchema","fetchProjectSchema","projectId","response","apiPaths","message","body","project","error","toProjectSchemasState","outcomes","isLoading","projects","errors","outcome","SCHEMA_SWR_OPTIONS","keepLoadedSchema","previous","next","useProjectSchemas","projectIds","userId","key","data","useSWR","index","toProjectSchemaState","useProjectSchema","isProjectSchemaKey","revalidateProjectSchema","mutate","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","ConfigContext","createContext","NO_TEAMS","upsertReservedEntities","schema","entity","ConfigProvider","projectSummaries","teams","mode","children","currentProjectId","useParams","auth","useAuth","schemaUserId","allSchemas","currentSchema","loadedProjects","useMemo","value","currentProject","useConfig","useContext"],"mappings":"gXAEO,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,UAAA,CACP,KAAA,CAAO,QAAA,CACP,OAAA,CAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,QAAA,CACV,SAAA,CAAW,OACX,WAAA,CAAa,MAAA,CACb,aAAc,EAChB,CAAA,CACA,CACE,IAAA,CAAM,MAAA,CACN,KAAA,CAAO,MAAA,CACP,KAAA,CAA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,CAAS,CAAC,CAAA,CACpF,MAAA,CAAQK,CAAAA,EAAwCA,CAAAA,GAAY,MAAS,EACrE,GAAA,CAAKA,CAAAA,GAAa,CAAE,GAAGA,CAAAA,CAAS,MAAA,CAAQyE,GAAuBzE,CAAAA,CAAQ,MAAM,CAAE,CAAA,CAAE,CAAA,CACtF,CAACwF,EAAgB3E,CAAU,CAC7B,EAEM6E,CAAAA,CAAQD,OAAAA,CAAuB,IAAM,CACzC,IAAME,CAAAA,CAAiBtF,CAAAA,CAAS,IAAA,CAAML,CAAAA,EAAYA,EAAQ,SAAA,GAAciF,CAAgB,CAAA,CAExF,OAAO,CACL,IAAA,CAAAF,EACA,IAAA,CAAMhB,CAAAA,CACN,aAAA,CAAe,CAAE,IAAA,CAAMA,CAAY,EACnC,gBAAA,CAAAkB,CAAAA,CACA,eAAAU,CAAAA,CACA,oBAAA,CAAsBA,GAAgB,MAAA,EAAU,EAAC,CACjD,QAAA,CAAAtF,CAAAA,CACA,UAAA,CAAAQ,EACA,gBAAA,CAAAgE,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,YAAA,CAAcxE,CAAAA,CACd,iBAAkBF,CACpB,CACF,CAAA,CAAG,CAAC6E,CAAAA,CAAkB3E,CAAAA,CAAQF,EAAW2E,CAAAA,CAAMlE,CAAAA,CAAYgE,EAAkBxE,CAAAA,CAAUyE,CAAK,CAAC,CAAA,CAE7F,OAAOnD,GAAAA,CAAC2C,CAAAA,CAAc,QAAA,CAAd,CAAuB,MAAOoB,CAAAA,CAAQ,QAAA,CAAAV,CAAAA,CAAS,CACzD,CAEO,SAASY,IAA2B,CACzC,OAAOC,UAAAA,CAAWvB,CAAa,CACjC","file":"chunk-TI3EHLRE.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","'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\nexport type FetchOutcome =\n | { ok: true; project: ProjectUiConfig }\n | { ok: false; projectId: string; error: ProjectSchemaError };\n\nasync function fetchProjectSchema(projectId: string): Promise<FetchOutcome> {\n try {\n const response = await fetch(apiPaths(projectId).schema, {\n credentials: 'include',\n mode: 'cors',\n // Revalidate with the server on every fetch (304 when unchanged), so a\n // refetch after a deploy never reads a stale HTTP-cached schema.\n cache: 'no-cache',\n });\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 * Schemas change on deploy, which can happen outside this tab (the agent, the\n * CLI). Refetch when the user comes back to the tab, at most every 15s;\n * SWR compares the result, so an unchanged schema does not re-render.\n */\nconst SCHEMA_SWR_OPTIONS = {\n revalidateOnFocus: true,\n focusThrottleInterval: 15_000,\n revalidateOnReconnect: false,\n} as const;\n\n/**\n * A refetch (tab focus, reload button, watched deploy) must never replace a\n * schema that already loaded with an error: that would swap the whole app for\n * an error screen and drop an open edit drawer. Offline, an expired session or\n * revoked access still surface through the GraphQL requests themselves.\n */\nexport function keepLoadedSchema(previous: FetchOutcome | undefined, next: FetchOutcome): FetchOutcome {\n return !next.ok && previous?.ok ? previous : next;\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). The result is\n * refetched on tab focus, on the list's reload button and after a deploy the\n * Studio watched.\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(\n key,\n async (): Promise<FetchOutcome[]> => {\n const outcomes = await Promise.all(projectIds.map((projectId) => fetchProjectSchema(projectId)));\n\n // The key fixes the order of projectIds, so outcomes line up with the previous data.\n return outcomes.map((outcome, index) => keepLoadedSchema(data?.[index], outcome));\n },\n SCHEMA_SWR_OPTIONS\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(\n key,\n async (): Promise<FetchOutcome> => keepLoadedSchema(data, await fetchProjectSchema(projectId ?? '')),\n SCHEMA_SWR_OPTIONS\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","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 { 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, HostedTeam, 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 /** Hosted mode: the user's teams with their role; owners can create projects in them. */\n teams: HostedTeam[];\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 teams: [],\n schemaErrors: {},\n isLoadingSchemas: false,\n});\n\nconst NO_TEAMS: HostedTeam[] = [];\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 teams = NO_TEAMS,\n mode = 'projects',\n userId,\n children,\n}: {\n projectIds: string[];\n projectSummaries?: ProjectSummary[];\n teams?: HostedTeam[];\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 teams,\n schemaErrors: errors,\n isLoadingSchemas: isLoading,\n };\n }, [currentProjectId, errors, isLoading, mode, projectIds, projectSummaries, projects, teams]);\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/core/config/use-project-schemas.ts","../src/ui/components/loading.tsx","../src/core/apps/built-in-apps.tsx","../src/core/config/config-context.tsx"],"names":["assetSchema","tagSchema","fetchProjectSchema","projectId","response","apiPaths","message","body","project","error","toProjectSchemasState","outcomes","isLoading","projects","errors","outcome","SCHEMA_SWR_OPTIONS","keepLoadedSchema","previous","next","useProjectSchemas","projectIds","userId","key","data","useSWR","index","toProjectSchemaState","useProjectSchema","isProjectSchemaKey","revalidateProjectSchema","mutate","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","ConfigContext","createContext","NO_TEAMS","upsertReservedEntities","schema","entity","ConfigProvider","projectSummaries","teams","mode","children","currentProjectId","useParams","auth","useAuth","schemaUserId","allSchemas","currentSchema","loadedProjects","useMemo","value","currentProject","useConfig","useContext"],"mappings":"gXAEO,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,UAAA,CACP,KAAA,CAAO,QAAA,CACP,OAAA,CAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,QAAA,CACV,SAAA,CAAW,OACX,WAAA,CAAa,MAAA,CACb,aAAc,EAChB,CAAA,CACA,CACE,IAAA,CAAM,MAAA,CACN,KAAA,CAAO,MAAA,CACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,KAAA,CACV,UAAW,MAAA,CACX,WAAA,CAAa,MAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,IAAA,CAAM,OAAA,CACN,MAAO,OAAA,CACP,KAAA,CAAO,SACP,OAAA,CAAS,CACP,IAAA,CAAM,EACR,CAAA,CACA,QAAA,CAAU,MACV,SAAA,CAAW,MAAA,CACX,WAAA,CAAa,MAAA,CACb,YAAA,CAAc,EAChB,EACA,CACE,IAAA,CAAM,QAAA,CACN,KAAA,CAAO,QAAA,CACP,KAAA,CAAO,SACP,OAAA,CAAS,CACP,KAAM,GACR,CAAA,CACA,SAAU,KAAA,CAC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,CAAE,IAAA,CAAMA,CAAY,EACnC,gBAAA,CAAAkB,CAAAA,CACA,eAAAU,CAAAA,CACA,oBAAA,CAAsBA,GAAgB,MAAA,EAAU,EAAC,CACjD,QAAA,CAAAtF,CAAAA,CACA,UAAA,CAAAQ,EACA,gBAAA,CAAAgE,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,YAAA,CAAcxE,CAAAA,CACd,iBAAkBF,CACpB,CACF,CAAA,CAAG,CAAC6E,CAAAA,CAAkB3E,CAAAA,CAAQF,EAAW2E,CAAAA,CAAMlE,CAAAA,CAAYgE,EAAkBxE,CAAAA,CAAUyE,CAAK,CAAC,CAAA,CAE7F,OAAOnD,GAAAA,CAAC2C,CAAAA,CAAc,QAAA,CAAd,CAAuB,MAAOoB,CAAAA,CAAQ,QAAA,CAAAV,CAAAA,CAAS,CACzD,CAEO,SAASY,IAA2B,CACzC,OAAOC,UAAAA,CAAWvB,CAAa,CACjC","file":"chunk-TWA6OG5U.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","'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\nexport type FetchOutcome =\n | { ok: true; project: ProjectUiConfig }\n | { ok: false; projectId: string; error: ProjectSchemaError };\n\nasync function fetchProjectSchema(projectId: string): Promise<FetchOutcome> {\n try {\n const response = await fetch(apiPaths(projectId).schema, {\n credentials: 'include',\n mode: 'cors',\n // Revalidate with the server on every fetch (304 when unchanged), so a\n // refetch after a deploy never reads a stale HTTP-cached schema.\n cache: 'no-cache',\n });\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 * Schemas change on deploy, which can happen outside this tab (the agent, the\n * CLI). Refetch when the user comes back to the tab, at most every 15s;\n * SWR compares the result, so an unchanged schema does not re-render.\n */\nconst SCHEMA_SWR_OPTIONS = {\n revalidateOnFocus: true,\n focusThrottleInterval: 15_000,\n revalidateOnReconnect: false,\n} as const;\n\n/**\n * A refetch (tab focus, reload button, watched deploy) must never replace a\n * schema that already loaded with an error: that would swap the whole app for\n * an error screen and drop an open edit drawer. Offline, an expired session or\n * revoked access still surface through the GraphQL requests themselves.\n */\nexport function keepLoadedSchema(previous: FetchOutcome | undefined, next: FetchOutcome): FetchOutcome {\n return !next.ok && previous?.ok ? previous : next;\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). The result is\n * refetched on tab focus, on the list's reload button and after a deploy the\n * Studio watched.\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(\n key,\n async (): Promise<FetchOutcome[]> => {\n const outcomes = await Promise.all(projectIds.map((projectId) => fetchProjectSchema(projectId)));\n\n // The key fixes the order of projectIds, so outcomes line up with the previous data.\n return outcomes.map((outcome, index) => keepLoadedSchema(data?.[index], outcome));\n },\n SCHEMA_SWR_OPTIONS\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(\n key,\n async (): Promise<FetchOutcome> => keepLoadedSchema(data, await fetchProjectSchema(projectId ?? '')),\n SCHEMA_SWR_OPTIONS\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","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 { 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, HostedTeam, 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 /** Hosted mode: the user's teams with their role; owners can create projects in them. */\n teams: HostedTeam[];\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 teams: [],\n schemaErrors: {},\n isLoadingSchemas: false,\n});\n\nconst NO_TEAMS: HostedTeam[] = [];\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 teams = NO_TEAMS,\n mode = 'projects',\n userId,\n children,\n}: {\n projectIds: string[];\n projectSummaries?: ProjectSummary[];\n teams?: HostedTeam[];\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 teams,\n schemaErrors: errors,\n isLoadingSchemas: isLoading,\n };\n }, [currentProjectId, errors, isLoading, mode, projectIds, projectSummaries, projects, teams]);\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 {a,c as c$1,d,f as f$1,g as g$1,e as e$1,i,h as h$2}from'./chunk-4ZWQ44NZ.js';import {b as b$1}from'./chunk-DSLPTDZX.js';import {h}from'./chunk-7KLXWCDS.js';import {f}from'./chunk-TI3EHLRE.js';import {ma}from'./chunk-RULCANNM.js';import {e,g,h as h$1,j as j$1,o,n}from'./chunk-A4DPLZZF.js';import {b}from'./chunk-5JUG4BEF.js';import {c}from'./chunk-X3SHNHHM.js';import {put}from'@vercel/blob/client';import {useMemo,useRef,useEffect,useState}from'react';import {LoaderCircle,EllipsisVerticalIcon,DownloadIcon,ExternalLinkIcon,Trash2Icon}from'lucide-react';import {mutate}from'swr';import {Document}from'@untitledui/file-icons/dist/solid/document.mjs';import {Docx}from'@untitledui/file-icons/dist/solid/docx.mjs';import {Html}from'@untitledui/file-icons/dist/solid/html.mjs';import {Pdf}from'@untitledui/file-icons/dist/solid/pdf.mjs';import {Pptx}from'@untitledui/file-icons/dist/solid/pptx.mjs';import {Txt}from'@untitledui/file-icons/dist/solid/txt.mjs';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var u=class extends Error{code;status;constructor(n,t,r=null){super(t),this.name="KnowledgeApiError",this.code=r,this.status=n;}},k=class extends Error{status;constructor(n,t="Request failed"){super(t),this.name="FetcherError",this.status=n;}},fe=async e=>{let n=await fetch(e,{credentials:"include"});if(!n.ok)throw new k(n.status);return await n.json()};function j(e){let n=`/api/flexkit/${e}/knowledge`;return {entitySources:t=>`${n}/entities/${encodeURIComponent(t)}/sources`,file:t=>`${n}/sources/${encodeURIComponent(t)}/file`,job:t=>`${n}/jobs/${encodeURIComponent(t)}`,links:t=>`${n}/sources/${encodeURIComponent(t)}/links`,passages:(t,{from:r,to:o})=>`${n}/sources/${encodeURIComponent(t)}/passages?from=${String(r)}&to=${String(o)}`,recordSources:({entity:t,recordId:r})=>`${n}/records/${encodeURIComponent(t)}/${encodeURIComponent(r)}/sources`,source:t=>`${n}/sources/${encodeURIComponent(t)}`,sources:(t={})=>{let{limit:r=25,offset:o=0,search:i,status:a}=t,l=new URLSearchParams({limit:r.toString(),offset:o.toString()}),c=i?.trim();return c&&l.set("q",c),a&&l.set("status",a),`${n}/sources?${l.toString()}`},spaces:`/api/flexkit/${e}/spaces`}}function N(e){return typeof e=="string"&&e.includes("/knowledge/sources?")}function J(e){return typeof e=="string"&&(e.includes("/knowledge/records/")||e.includes("/knowledge/entities/")||e.includes("/knowledge/sources/")&&e.endsWith("/links"))}async function L(e,n){let t={};try{t=await e.json();}catch{}return new u(e.status,t.error?String(t.error):n,t.code??null)}function O(e){let n=`/api/flexkit/${e}/knowledge`;async function t(o,i){let{fallback:a,...l}=i,c=await fetch(o,{credentials:"include",headers:{"Content-Type":"application/json",...l.headers??{}},...l});if(!c.ok)throw await L(c,a);return await c.json()}function r(o){return t(`${n}/sources`,{body:JSON.stringify(o),fallback:"The document could not be added.",method:"POST"})}return {addFile:async(o,i)=>{let a=await fetch(`${n}/uploads`,{body:JSON.stringify({filename:o.name,mediaType:o.type||null,sizeBytes:o.size}),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST",signal:i?.signal});if(!a.ok)throw await L(a,"The file could not be uploaded.");let l=await a.json();if(!l.pathname||!l.token||!l.mediaType)throw new u(a.status,"The file could not be uploaded.");return await put(l.pathname,o,{abortSignal:i?.signal,access:"public",contentType:l.mediaType,token:l.token}),r({kind:"upload",pathname:l.pathname})},addUrl:({title:o,url:i})=>r({kind:"url",url:i,...o?{title:o}:{}}),addChatAttachment:({filename:o,url:i})=>r({filename:o,kind:"chat-attachment",url:i}),deleteSource:o=>t(`${n}/sources/${encodeURIComponent(o)}`,{fallback:"The document could not be removed.",method:"DELETE"}),linkSource:(o,i)=>t(`${n}/sources/${encodeURIComponent(o)}/links`,{body:JSON.stringify(i),fallback:"The document could not be attached.",method:"POST"}),reingestSource:o=>t(`${n}/sources/${encodeURIComponent(o)}/reingest`,{fallback:"The document could not be re-indexed.",method:"POST"}),unlinkSource:(o,{entity:i,recordId:a})=>t(`${n}/sources/${encodeURIComponent(o)}/links/${encodeURIComponent(i)}${a===void 0?"":`/${encodeURIComponent(a)}`}`,{fallback:"The document could not be detached.",method:"DELETE"}),updateSource:(o,i)=>t(`${n}/sources/${encodeURIComponent(o)}`,{body:JSON.stringify(i),fallback:"The document could not be updated.",method:"PATCH"})}}var ae={busy:"fk:bg-amber-500/15 fk:text-amber-700 fk:dark:text-amber-400",error:"fk:bg-destructive/15 fk:text-destructive",muted:"fk:bg-muted fk:text-muted-foreground",ready:"fk:bg-emerald-500/15 fk:text-emerald-700 fk:dark:text-emerald-400"};function le(){let{currentProjectId:e}=f();return {api:useMemo(()=>e?O(e):null,[e]),projectId:e}}function de(){return mutate(N,void 0,{revalidate:true})}function Pe(){return mutate(J,void 0,{revalidate:true})}function ce(e,n){return e instanceof u||e instanceof Error?e.message:n}function Ee(e,n){if(e.duplicate){ma.info(`"${e.source.title}" is already in Knowledge.`);return}ma.success(`Added ${n}. Indexing starts now.`);}function _e({children:e}){return jsx("div",{className:"fk:rounded-md fk:border fk:border-dashed fk:p-8 fk:text-center fk:text-sm fk:text-muted-foreground fk:corner-squircle",children:e})}function Me({label:e,tone:n}){return jsxs(b,{className:`fk:border-none fk:corner-squircle ${ae[n]}`,variant:"outline",children:[n==="busy"?jsx(LoaderCircle,{className:"fk:size-3 fk:animate-spin"}):null,e]})}var ue={document:Document,docx:Docx,html:Html,pdf:Pdf,pptx:Pptx,txt:Txt};function ge({className:e="",size:n=24,source:t}){let r=h(t),o=ue[r.icon];return jsx("span",{"aria-label":r.label,className:`fk:flex fk:shrink-0 fk:items-center fk:justify-center ${e}`,"data-knowledge-type":r.icon,role:"img",children:jsx(o,{size:n})})}function Ue({source:e}){return jsx(ge,{size:40,source:e})}function Le({onVisible:e}){let n=useRef(null),t=useRef(e);return t.current=e,useEffect(()=>{let r=n.current;if(!r)return;let o=new IntersectionObserver(i=>{i.some(a=>a.isIntersecting)&&t.current();});return o.observe(r),()=>{o.disconnect();}},[]),jsx("div",{"aria-hidden":true,className:"fk:h-px",ref:n})}function je({isBusy:e$2=false,onOpen:n$1,onRemoved:t,source:r,trigger:o$1="row"}){let{api:i$1,projectId:a$1}=le(),l=b$1(),[c$2,p]=useState(false),[f,b]=useState(false);if(!i$1||!a$1)return null;let X=i$1;async function H(){b(true);try{await X.deleteSource(r.id),ma.success(`Removed "${r.title}".`),p(!1),t(),de();}catch(w){ma.error(ce(w,"The document could not be removed."));}finally{b(false);}}return jsxs(Fragment,{children:[jsxs(e,{children:[jsx(g,{asChild:true,children:jsx(c,{"aria-label":`Actions for ${r.title}`,className:o$1==="row"?"fk:size-8 fk:shrink-0 fk:text-muted-foreground":void 0,"data-knowledge-menu":true,size:"icon-sm",variant:o$1==="row"?"ghost":"outline",children:jsx(EllipsisVerticalIcon,{className:"fk:size-4"})})}),jsxs(h$1,{align:"end",children:[n$1?jsx(j$1,{onSelect:n$1,children:"Open"}):null,r.path?jsx(j$1,{asChild:true,children:jsxs("a",{href:j(a$1).file(r.id),children:[jsx(DownloadIcon,{}),"Download"]})}):null,r.originUrl?jsx(j$1,{asChild:true,children:jsxs("a",{href:r.originUrl,rel:"noreferrer",target:"_blank",children:[jsx(ExternalLinkIcon,{}),"Open page"]})}):null,n$1||r.path||r.originUrl?jsx(o,{}):null,jsxs(j$1,{disabled:!l||e$2,variant:"destructive",onSelect:()=>p(true),children:[jsx(Trash2Icon,{}),"Remove"]}),l?null:jsx(n,{className:"fk:max-w-56 fk:whitespace-normal fk:text-xs fk:font-normal fk:text-muted-foreground",children:"Your member role cannot remove documents."})]})]}),jsx(a,{open:c$2,onOpenChange:p,children:jsxs(c$1,{children:[jsxs(d,{children:[jsx(f$1,{children:"Remove this document?"}),jsxs(g$1,{children:['"',r.title,'" and its indexed passages are deleted for everyone. Answers the agent gave earlier keep their citations, but the document can no longer be opened.']})]}),jsxs(e$1,{children:[jsx(i,{disabled:f,children:"Cancel"}),jsxs(h$2,{disabled:f,onClick:w=>{w.preventDefault(),H();},children:[f?jsx(LoaderCircle,{className:"fk:animate-spin"}):null,"Remove document"]})]})]})})]})}export{k as a,fe as b,j as c,O as d,le as e,de as f,Pe as g,ce as h,Ee as i,_e as j,Me as k,ge as l,Ue as m,Le as n,je as o};//# sourceMappingURL=chunk-7N3LTSVX.js.map
2
- //# sourceMappingURL=chunk-7N3LTSVX.js.map
1
+ import'./index.css';import {a,c as c$1,d,f as f$1,g as g$1,e as e$1,i,h as h$2}from'./chunk-4ZWQ44NZ.js';import {b as b$1}from'./chunk-DSLPTDZX.js';import {h}from'./chunk-7KLXWCDS.js';import {f}from'./chunk-TWA6OG5U.js';import {ma}from'./chunk-RULCANNM.js';import {e,g,h as h$1,j as j$1,o,n}from'./chunk-A4DPLZZF.js';import {b}from'./chunk-5JUG4BEF.js';import {c}from'./chunk-X3SHNHHM.js';import {put}from'@vercel/blob/client';import {useMemo,useRef,useEffect,useState}from'react';import {LoaderCircle,EllipsisVerticalIcon,DownloadIcon,ExternalLinkIcon,Trash2Icon}from'lucide-react';import {mutate}from'swr';import {Document}from'@untitledui/file-icons/dist/solid/document.mjs';import {Docx}from'@untitledui/file-icons/dist/solid/docx.mjs';import {Html}from'@untitledui/file-icons/dist/solid/html.mjs';import {Pdf}from'@untitledui/file-icons/dist/solid/pdf.mjs';import {Pptx}from'@untitledui/file-icons/dist/solid/pptx.mjs';import {Txt}from'@untitledui/file-icons/dist/solid/txt.mjs';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var u=class extends Error{code;status;constructor(n,t,r=null){super(t),this.name="KnowledgeApiError",this.code=r,this.status=n;}},k=class extends Error{status;constructor(n,t="Request failed"){super(t),this.name="FetcherError",this.status=n;}},fe=async e=>{let n=await fetch(e,{credentials:"include"});if(!n.ok)throw new k(n.status);return await n.json()};function j(e){let n=`/api/flexkit/${e}/knowledge`;return {entitySources:t=>`${n}/entities/${encodeURIComponent(t)}/sources`,file:t=>`${n}/sources/${encodeURIComponent(t)}/file`,job:t=>`${n}/jobs/${encodeURIComponent(t)}`,links:t=>`${n}/sources/${encodeURIComponent(t)}/links`,passages:(t,{from:r,to:o})=>`${n}/sources/${encodeURIComponent(t)}/passages?from=${String(r)}&to=${String(o)}`,recordSources:({entity:t,recordId:r})=>`${n}/records/${encodeURIComponent(t)}/${encodeURIComponent(r)}/sources`,source:t=>`${n}/sources/${encodeURIComponent(t)}`,sources:(t={})=>{let{limit:r=25,offset:o=0,search:i,status:a}=t,l=new URLSearchParams({limit:r.toString(),offset:o.toString()}),c=i?.trim();return c&&l.set("q",c),a&&l.set("status",a),`${n}/sources?${l.toString()}`},spaces:`/api/flexkit/${e}/spaces`}}function N(e){return typeof e=="string"&&e.includes("/knowledge/sources?")}function J(e){return typeof e=="string"&&(e.includes("/knowledge/records/")||e.includes("/knowledge/entities/")||e.includes("/knowledge/sources/")&&e.endsWith("/links"))}async function L(e,n){let t={};try{t=await e.json();}catch{}return new u(e.status,t.error?String(t.error):n,t.code??null)}function O(e){let n=`/api/flexkit/${e}/knowledge`;async function t(o,i){let{fallback:a,...l}=i,c=await fetch(o,{credentials:"include",headers:{"Content-Type":"application/json",...l.headers??{}},...l});if(!c.ok)throw await L(c,a);return await c.json()}function r(o){return t(`${n}/sources`,{body:JSON.stringify(o),fallback:"The document could not be added.",method:"POST"})}return {addFile:async(o,i)=>{let a=await fetch(`${n}/uploads`,{body:JSON.stringify({filename:o.name,mediaType:o.type||null,sizeBytes:o.size}),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST",signal:i?.signal});if(!a.ok)throw await L(a,"The file could not be uploaded.");let l=await a.json();if(!l.pathname||!l.token||!l.mediaType)throw new u(a.status,"The file could not be uploaded.");return await put(l.pathname,o,{abortSignal:i?.signal,access:"public",contentType:l.mediaType,token:l.token}),r({kind:"upload",pathname:l.pathname})},addUrl:({title:o,url:i})=>r({kind:"url",url:i,...o?{title:o}:{}}),addChatAttachment:({filename:o,url:i})=>r({filename:o,kind:"chat-attachment",url:i}),deleteSource:o=>t(`${n}/sources/${encodeURIComponent(o)}`,{fallback:"The document could not be removed.",method:"DELETE"}),linkSource:(o,i)=>t(`${n}/sources/${encodeURIComponent(o)}/links`,{body:JSON.stringify(i),fallback:"The document could not be attached.",method:"POST"}),reingestSource:o=>t(`${n}/sources/${encodeURIComponent(o)}/reingest`,{fallback:"The document could not be re-indexed.",method:"POST"}),unlinkSource:(o,{entity:i,recordId:a})=>t(`${n}/sources/${encodeURIComponent(o)}/links/${encodeURIComponent(i)}${a===void 0?"":`/${encodeURIComponent(a)}`}`,{fallback:"The document could not be detached.",method:"DELETE"}),updateSource:(o,i)=>t(`${n}/sources/${encodeURIComponent(o)}`,{body:JSON.stringify(i),fallback:"The document could not be updated.",method:"PATCH"})}}var ae={busy:"fk:bg-amber-500/15 fk:text-amber-700 fk:dark:text-amber-400",error:"fk:bg-destructive/15 fk:text-destructive",muted:"fk:bg-muted fk:text-muted-foreground",ready:"fk:bg-emerald-500/15 fk:text-emerald-700 fk:dark:text-emerald-400"};function le(){let{currentProjectId:e}=f();return {api:useMemo(()=>e?O(e):null,[e]),projectId:e}}function de(){return mutate(N,void 0,{revalidate:true})}function Pe(){return mutate(J,void 0,{revalidate:true})}function ce(e,n){return e instanceof u||e instanceof Error?e.message:n}function Ee(e,n){if(e.duplicate){ma.info(`"${e.source.title}" is already in Knowledge.`);return}ma.success(`Added ${n}. Indexing starts now.`);}function _e({children:e}){return jsx("div",{className:"fk:rounded-md fk:border fk:border-dashed fk:p-8 fk:text-center fk:text-sm fk:text-muted-foreground fk:corner-squircle",children:e})}function Me({label:e,tone:n}){return jsxs(b,{className:`fk:border-none fk:corner-squircle ${ae[n]}`,variant:"outline",children:[n==="busy"?jsx(LoaderCircle,{className:"fk:size-3 fk:animate-spin"}):null,e]})}var ue={document:Document,docx:Docx,html:Html,pdf:Pdf,pptx:Pptx,txt:Txt};function ge({className:e="",size:n=24,source:t}){let r=h(t),o=ue[r.icon];return jsx("span",{"aria-label":r.label,className:`fk:flex fk:shrink-0 fk:items-center fk:justify-center ${e}`,"data-knowledge-type":r.icon,role:"img",children:jsx(o,{size:n})})}function Ue({source:e}){return jsx(ge,{size:40,source:e})}function Le({onVisible:e}){let n=useRef(null),t=useRef(e);return t.current=e,useEffect(()=>{let r=n.current;if(!r)return;let o=new IntersectionObserver(i=>{i.some(a=>a.isIntersecting)&&t.current();});return o.observe(r),()=>{o.disconnect();}},[]),jsx("div",{"aria-hidden":true,className:"fk:h-px",ref:n})}function je({isBusy:e$2=false,onOpen:n$1,onRemoved:t,source:r,trigger:o$1="row"}){let{api:i$1,projectId:a$1}=le(),l=b$1(),[c$2,p]=useState(false),[f,b]=useState(false);if(!i$1||!a$1)return null;let X=i$1;async function H(){b(true);try{await X.deleteSource(r.id),ma.success(`Removed "${r.title}".`),p(!1),t(),de();}catch(w){ma.error(ce(w,"The document could not be removed."));}finally{b(false);}}return jsxs(Fragment,{children:[jsxs(e,{children:[jsx(g,{asChild:true,children:jsx(c,{"aria-label":`Actions for ${r.title}`,className:o$1==="row"?"fk:size-8 fk:shrink-0 fk:text-muted-foreground":void 0,"data-knowledge-menu":true,size:"icon-sm",variant:o$1==="row"?"ghost":"outline",children:jsx(EllipsisVerticalIcon,{className:"fk:size-4"})})}),jsxs(h$1,{align:"end",children:[n$1?jsx(j$1,{onSelect:n$1,children:"Open"}):null,r.path?jsx(j$1,{asChild:true,children:jsxs("a",{href:j(a$1).file(r.id),children:[jsx(DownloadIcon,{}),"Download"]})}):null,r.originUrl?jsx(j$1,{asChild:true,children:jsxs("a",{href:r.originUrl,rel:"noreferrer",target:"_blank",children:[jsx(ExternalLinkIcon,{}),"Open page"]})}):null,n$1||r.path||r.originUrl?jsx(o,{}):null,jsxs(j$1,{disabled:!l||e$2,variant:"destructive",onSelect:()=>p(true),children:[jsx(Trash2Icon,{}),"Remove"]}),l?null:jsx(n,{className:"fk:max-w-56 fk:whitespace-normal fk:text-xs fk:font-normal fk:text-muted-foreground",children:"Your member role cannot remove documents."})]})]}),jsx(a,{open:c$2,onOpenChange:p,children:jsxs(c$1,{children:[jsxs(d,{children:[jsx(f$1,{children:"Remove this document?"}),jsxs(g$1,{children:['"',r.title,'" and its indexed passages are deleted for everyone. Answers the agent gave earlier keep their citations, but the document can no longer be opened.']})]}),jsxs(e$1,{children:[jsx(i,{disabled:f,children:"Cancel"}),jsxs(h$2,{disabled:f,onClick:w=>{w.preventDefault(),H();},children:[f?jsx(LoaderCircle,{className:"fk:animate-spin"}):null,"Remove document"]})]})]})})]})}export{k as a,fe as b,j as c,O as d,le as e,de as f,Pe as g,ce as h,Ee as i,_e as j,Me as k,ge as l,Ue as m,Le as n,je as o};//# sourceMappingURL=chunk-VIBGMCLS.js.map
2
+ //# sourceMappingURL=chunk-VIBGMCLS.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/apps/knowledge/api.ts","../src/apps/knowledge/shared.tsx"],"names":["KnowledgeApiError","status","message","code","FetcherError","fetcher","url","response","knowledgePaths","projectId","basePath","entity","sourceId","jobId","from","to","recordId","options","limit","offset","search","params","trimmedSearch","isKnowledgeListKey","key","isKnowledgeLinkKey","readError","fallback","data","createKnowledgeApi","request","init","requestInit","register","body","file","tokenResponse","tokenData","put","title","filename","target","patch","STATUS_TONE_CLASSES","useProjectKnowledge","currentProjectId","useConfig","useMemo","invalidateKnowledgeLists","mutateGlobal","invalidateKnowledgeLinks","describeApiError","error","announceRegistered","result","name","toast","PageMessage","children","jsx","StatusBadge","label","tone","jsxs","Badge","LoaderCircle","FILE_ICONS","Document","Docx","Html","Pdf","Pptx","Txt","KnowledgeTypeIcon","className","size","source","format","getKnowledgeFormat","Icon","SourceIcon","InfiniteScrollSentinel","onVisible","sentinelRef","useRef","onVisibleRef","useEffect","node","observer","entries","entry","SourceActionsMenu","isBusy","onOpen","onRemoved","trigger","api","canMutate","useCanMutate","isConfirmingRemoval","setIsConfirmingRemoval","useState","isRemoving","setIsRemoving","knowledgeApi","remove","removeError","Fragment","DropdownMenu","DropdownMenuTrigger","Button","EllipsisVerticalIcon","DropdownMenuContent","DropdownMenuItem","DownloadIcon","ExternalLinkIcon","DropdownMenuSeparator","Trash2Icon","DropdownMenuLabel","AlertDialog","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","AlertDialogDescription","AlertDialogFooter","AlertDialogCancel","AlertDialogAction","event"],"mappings":"0gCAYO,IAAMA,CAAAA,CAAN,cAAgC,KAAM,CAC3C,IAAA,CACA,MAAA,CAEA,YAAYC,CAAAA,CAAgBC,CAAAA,CAAiBC,EAAsB,IAAA,CAAM,CACvE,MAAMD,CAAO,CAAA,CACb,IAAA,CAAK,IAAA,CAAO,oBACZ,IAAA,CAAK,IAAA,CAAOC,CAAAA,CACZ,IAAA,CAAK,OAASF,EAChB,CACF,CAAA,CAsBaG,CAAAA,CAAN,cAA2B,KAAM,CACtC,OAEA,WAAA,CAAYH,CAAAA,CAAgBC,EAAU,gBAAA,CAAkB,CACtD,KAAA,CAAMA,CAAO,EACb,IAAA,CAAK,IAAA,CAAO,cAAA,CACZ,IAAA,CAAK,OAASD,EAChB,CACF,CAAA,CAEaI,EAAAA,CAAU,MAAUC,CAAAA,EAA4B,CAC3D,IAAMC,CAAAA,CAAW,MAAM,MAAMD,CAAAA,CAAK,CAAE,WAAA,CAAa,SAAU,CAAC,CAAA,CAE5D,GAAI,CAACC,CAAAA,CAAS,EAAA,CACZ,MAAM,IAAIH,CAAAA,CAAaG,CAAAA,CAAS,MAAM,EAGxC,OAAQ,MAAMA,EAAS,IAAA,EACzB,EAEO,SAASC,CAAAA,CAAeC,CAAAA,CAc7B,CACA,IAAMC,CAAAA,CAAW,CAAA,aAAA,EAAgBD,CAAS,CAAA,UAAA,CAAA,CAE1C,OAAO,CACL,aAAA,CAAgBE,CAAAA,EAAW,CAAA,EAAGD,CAAQ,CAAA,UAAA,EAAa,kBAAA,CAAmBC,CAAM,CAAC,CAAA,QAAA,CAAA,CAC7E,KAAOC,CAAAA,EAAa,CAAA,EAAGF,CAAQ,CAAA,SAAA,EAAY,mB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AAAA,CAAY,IAAA,CACXtC,GAAAA,CAAC2D,EAAA,CAAkB,SAAA,CAAU,qFAAA,CAAsF,QAAA,CAAA,2CAAA,CAEnH,GAEJ,CAAA,CAAA,CACF,CAAA,CACA3D,IAAC4D,CAAAA,CAAA,CAAY,KAAMpB,GAAAA,CAAqB,YAAA,CAAcC,CAAAA,CACpD,QAAA,CAAArC,KAACyD,GAAAA,CAAA,CACC,UAAAzD,IAAAA,CAAC0D,CAAAA,CAAA,CACC,QAAA,CAAA,CAAA9D,GAAAA,CAAC+D,GAAAA,CAAA,CAAiB,iCAAqB,CAAA,CACvC3D,IAAAA,CAAC4D,IAAA,CAAuB,QAAA,CAAA,CAAA,GAAA,CACpB/C,EAAO,KAAA,CAAM,qJAAA,CAAA,CAEjB,CAAA,CAAA,CACF,CAAA,CACAb,KAAC6D,GAAAA,CAAA,CACC,QAAA,CAAA,CAAAjE,GAAAA,CAACkE,EAAA,CAAkB,QAAA,CAAUvB,CAAAA,CAAY,QAAA,CAAA,QAAA,CAAM,EAC/CvC,IAAAA,CAAC+D,GAAAA,CAAA,CACC,QAAA,CAAUxB,CAAAA,CACV,QAAUyB,CAAAA,EAAsB,CAC9BA,CAAAA,CAAM,cAAA,GACDtB,CAAAA,GACP,EAEC,QAAA,CAAA,CAAAH,CAAAA,CAAa3C,IAACM,YAAAA,CAAA,CAAa,SAAA,CAAU,iBAAA,CAAkB,EAAK,IAAA,CAAK,iBAAA,CAAA,CAEpE,GACF,CAAA,CAAA,CACF,CAAA,CACF,GACF,CAEJ","file":"chunk-7N3LTSVX.js","sourcesContent":["import { put } from '@vercel/blob/client';\nimport type {\n KnowledgeJob,\n KnowledgeLinkTarget,\n KnowledgeRecordRef,\n KnowledgeSource,\n KnowledgeSourcePatch,\n KnowledgeSourceStatus,\n RegisterKnowledgeSourceResult,\n} from './knowledge';\n\n/** The platform refused a knowledge request; `code` lets the UI tailor the message. */\nexport class KnowledgeApiError extends Error {\n code: string | null;\n status: number;\n\n constructor(status: number, message: string, code: string | null = null) {\n super(message);\n this.name = 'KnowledgeApiError';\n this.code = code;\n this.status = status;\n }\n}\n\nexport interface ProjectSpace {\n code: string;\n id: string;\n label: string;\n}\n\nexport interface KnowledgeApi {\n /** Uploads a document to the file store, then registers it; resolves once indexing is queued or the file was already there. */\n addFile: (_file: File, _options?: { signal?: AbortSignal }) => Promise<RegisterKnowledgeSourceResult>;\n addUrl: (_input: { title?: string; url: string }) => Promise<RegisterKnowledgeSourceResult>;\n /** Promotes a file the caller attached to a chat: the platform copies it into the knowledge folder. */\n addChatAttachment: (_input: { filename: string; url: string }) => Promise<RegisterKnowledgeSourceResult>;\n deleteSource: (_sourceId: string) => Promise<{ deleted: true }>;\n /** Attaches the document to a record, or to every record of an entity type; `linked` is false when it already was. */\n linkSource: (_sourceId: string, _target: KnowledgeLinkTarget) => Promise<{ linked: boolean }>;\n reingestSource: (_sourceId: string) => Promise<{ job: KnowledgeJob }>;\n unlinkSource: (_sourceId: string, _target: KnowledgeLinkTarget) => Promise<{ unlinked: boolean }>;\n updateSource: (_sourceId: string, _patch: KnowledgeSourcePatch) => Promise<{ source: KnowledgeSource }>;\n}\n\nexport class FetcherError extends Error {\n status: number;\n\n constructor(status: number, message = 'Request failed') {\n super(message);\n this.name = 'FetcherError';\n this.status = status;\n }\n}\n\nexport const fetcher = async <T>(url: string): Promise<T> => {\n const response = await fetch(url, { credentials: 'include' });\n\n if (!response.ok) {\n throw new FetcherError(response.status);\n }\n\n return (await response.json()) as T;\n};\n\nexport function knowledgePaths(projectId: string): {\n /** The documents attached to every record of an entity type. */\n entitySources: (_entity: string) => string;\n /** The original file of an uploaded document, served under its name. */\n file: (_sourceId: string) => string;\n job: (_jobId: string) => string;\n /** The records a document is attached to, and the entity types it applies to. */\n links: (_sourceId: string) => string;\n passages: (_sourceId: string, _options: { from: number; to: number }) => string;\n /** The documents attached to a record. */\n recordSources: (_record: KnowledgeRecordRef) => string;\n source: (_sourceId: string) => string;\n sources: (_options?: { limit?: number; offset?: number; search?: string; status?: KnowledgeSourceStatus }) => string;\n spaces: string;\n} {\n const basePath = `/api/flexkit/${projectId}/knowledge`;\n\n return {\n entitySources: (entity) => `${basePath}/entities/${encodeURIComponent(entity)}/sources`,\n file: (sourceId) => `${basePath}/sources/${encodeURIComponent(sourceId)}/file`,\n job: (jobId) => `${basePath}/jobs/${encodeURIComponent(jobId)}`,\n links: (sourceId) => `${basePath}/sources/${encodeURIComponent(sourceId)}/links`,\n passages: (sourceId, { from, to }) =>\n `${basePath}/sources/${encodeURIComponent(sourceId)}/passages?from=${String(from)}&to=${String(to)}`,\n recordSources: ({ entity, recordId }) =>\n `${basePath}/records/${encodeURIComponent(entity)}/${encodeURIComponent(recordId)}/sources`,\n source: (sourceId) => `${basePath}/sources/${encodeURIComponent(sourceId)}`,\n sources: (options = {}) => {\n const { limit = 25, offset = 0, search, status } = options;\n const params = new URLSearchParams({ limit: limit.toString(), offset: offset.toString() });\n const trimmedSearch = search?.trim();\n\n if (trimmedSearch) {\n params.set('q', trimmedSearch);\n }\n\n if (status) {\n params.set('status', status);\n }\n\n return `${basePath}/sources?${params.toString()}`;\n },\n spaces: `/api/flexkit/${projectId}/spaces`,\n };\n}\n\n/** Whether an SWR key is a page of the document list, whatever its filters. */\nexport function isKnowledgeListKey(key: unknown): boolean {\n return typeof key === 'string' && key.includes('/knowledge/sources?');\n}\n\n/** Whether an SWR key lists the documents of a record or an entity type, or the links of a document. */\nexport function isKnowledgeLinkKey(key: unknown): boolean {\n return (\n typeof key === 'string' &&\n (key.includes('/knowledge/records/') ||\n key.includes('/knowledge/entities/') ||\n (key.includes('/knowledge/sources/') && key.endsWith('/links')))\n );\n}\n\nasync function readError(response: Response, fallback: string): Promise<KnowledgeApiError> {\n let data: { code?: string; error?: string } = {};\n\n try {\n data = (await response.json()) as { code?: string; error?: string };\n } catch {\n // Non-JSON error bodies keep the fallback message.\n }\n\n return new KnowledgeApiError(response.status, data.error ? String(data.error) : fallback, data.code ?? null);\n}\n\nexport function createKnowledgeApi(projectId: string): KnowledgeApi {\n const basePath = `/api/flexkit/${projectId}/knowledge`;\n\n async function request<T>(url: string, init: RequestInit & { fallback: string }): Promise<T> {\n const { fallback, ...requestInit } = init;\n const response = await fetch(url, {\n credentials: 'include',\n headers: { 'Content-Type': 'application/json', ...(requestInit.headers ?? {}) },\n ...requestInit,\n });\n\n if (!response.ok) {\n throw await readError(response, fallback);\n }\n\n return (await response.json()) as T;\n }\n\n function register(body: Record<string, unknown>): Promise<RegisterKnowledgeSourceResult> {\n return request<RegisterKnowledgeSourceResult>(`${basePath}/sources`, {\n body: JSON.stringify(body),\n fallback: 'The document could not be added.',\n method: 'POST',\n });\n }\n\n return {\n addFile: async (file, options) => {\n // The platform issues a token pinned to one pathname, type and size; the\n // browser writes the bytes to the store itself, so a 20 MB document never\n // crosses the API function body limit. Registration then hashes the blob.\n const tokenResponse = await fetch(`${basePath}/uploads`, {\n body: JSON.stringify({ filename: file.name, mediaType: file.type || null, sizeBytes: file.size }),\n credentials: 'include',\n headers: { 'Content-Type': 'application/json' },\n method: 'POST',\n signal: options?.signal,\n });\n\n if (!tokenResponse.ok) {\n throw await readError(tokenResponse, 'The file could not be uploaded.');\n }\n\n const tokenData = (await tokenResponse.json()) as { mediaType?: string; pathname?: string; token?: string };\n\n if (!tokenData.pathname || !tokenData.token || !tokenData.mediaType) {\n throw new KnowledgeApiError(tokenResponse.status, 'The file could not be uploaded.');\n }\n\n await put(tokenData.pathname, file, {\n abortSignal: options?.signal,\n access: 'public',\n contentType: tokenData.mediaType,\n token: tokenData.token,\n });\n\n return register({ kind: 'upload', pathname: tokenData.pathname });\n },\n addUrl: ({ title, url }) => register({ kind: 'url', url, ...(title ? { title } : {}) }),\n addChatAttachment: ({ filename, url }) => register({ filename, kind: 'chat-attachment', url }),\n deleteSource: (sourceId) =>\n request<{ deleted: true }>(`${basePath}/sources/${encodeURIComponent(sourceId)}`, {\n fallback: 'The document could not be removed.',\n method: 'DELETE',\n }),\n linkSource: (sourceId, target) =>\n request<{ linked: boolean }>(`${basePath}/sources/${encodeURIComponent(sourceId)}/links`, {\n body: JSON.stringify(target),\n fallback: 'The document could not be attached.',\n method: 'POST',\n }),\n reingestSource: (sourceId) =>\n request<{ job: KnowledgeJob }>(`${basePath}/sources/${encodeURIComponent(sourceId)}/reingest`, {\n fallback: 'The document could not be re-indexed.',\n method: 'POST',\n }),\n unlinkSource: (sourceId, { entity, recordId }) =>\n request<{ unlinked: boolean }>(\n `${basePath}/sources/${encodeURIComponent(sourceId)}/links/${encodeURIComponent(entity)}${\n recordId === undefined ? '' : `/${encodeURIComponent(recordId)}`\n }`,\n { fallback: 'The document could not be detached.', method: 'DELETE' }\n ),\n updateSource: (sourceId, patch) =>\n request<{ source: KnowledgeSource }>(`${basePath}/sources/${encodeURIComponent(sourceId)}`, {\n body: JSON.stringify(patch),\n fallback: 'The document could not be updated.',\n method: 'PATCH',\n }),\n };\n}\n","import type { JSX, MouseEvent } from 'react';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { DownloadIcon, EllipsisVerticalIcon, ExternalLinkIcon, LoaderCircle, Trash2Icon } from 'lucide-react';\nimport { mutate as mutateGlobal } from 'swr';\n// File type icons: Untitled UI's free file icons, Solid variant. The set is\n// published as the MIT package `@untitledui/file-icons`; the page below shows\n// every icon and offers each as SVG or JSX should another format need one.\n// https://www.untitledui.com/resources/file-icons\nimport { Document } from '@untitledui/file-icons/dist/solid/document.mjs';\nimport { Docx } from '@untitledui/file-icons/dist/solid/docx.mjs';\nimport { Html } from '@untitledui/file-icons/dist/solid/html.mjs';\nimport { Pdf } from '@untitledui/file-icons/dist/solid/pdf.mjs';\nimport { Pptx } from '@untitledui/file-icons/dist/solid/pptx.mjs';\nimport { Txt } from '@untitledui/file-icons/dist/solid/txt.mjs';\nimport { useConfig } from '../../core/config/config-context';\nimport { useCanMutate } from '../../core/permissions';\nimport {\n Badge,\n Button,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n toast,\n} from '../../ui';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from '../../ui/primitives/alert-dialog';\nimport {\n createKnowledgeApi,\n isKnowledgeLinkKey,\n isKnowledgeListKey,\n KnowledgeApiError,\n knowledgePaths,\n type KnowledgeApi,\n} from './api';\nimport {\n getKnowledgeFormat,\n type KnowledgeFileIcon,\n type KnowledgeSource,\n type KnowledgeStatusTone,\n type RegisterKnowledgeSourceResult,\n} from './knowledge';\n\nconst STATUS_TONE_CLASSES: { [tone in KnowledgeStatusTone]: string } = {\n busy: 'fk:bg-amber-500/15 fk:text-amber-700 fk:dark:text-amber-400',\n error: 'fk:bg-destructive/15 fk:text-destructive',\n muted: 'fk:bg-muted fk:text-muted-foreground',\n ready: 'fk:bg-emerald-500/15 fk:text-emerald-700 fk:dark:text-emerald-400',\n};\n\nexport function useProjectKnowledge(): { api: KnowledgeApi | null; projectId: string | undefined } {\n const { currentProjectId } = useConfig();\n const api = useMemo(() => (currentProjectId ? createKnowledgeApi(currentProjectId) : null), [currentProjectId]);\n\n return { api, projectId: currentProjectId };\n}\n\n/** Drops every cached page of the document list, so the next visit fetches it afresh. */\nexport function invalidateKnowledgeLists(): Promise<unknown> {\n return mutateGlobal(isKnowledgeListKey, undefined, { revalidate: true });\n}\n\n/** Drops every cached link listing (a record's documents, a document's records) after a link changed. */\nexport function invalidateKnowledgeLinks(): Promise<unknown> {\n return mutateGlobal(isKnowledgeLinkKey, undefined, { revalidate: true });\n}\n\nexport function describeApiError(error: unknown, fallback: string): string {\n if (error instanceof KnowledgeApiError) {\n return error.message;\n }\n\n return error instanceof Error ? error.message : fallback;\n}\n\n/** What the user hears once a document was registered. */\nexport function announceRegistered(result: RegisterKnowledgeSourceResult, name: string): void {\n if (result.duplicate) {\n toast.info(`\"${result.source.title}\" is already in Knowledge.`);\n\n return;\n }\n\n toast.success(`Added ${name}. Indexing starts now.`);\n}\n\nexport function PageMessage({ children }: { children: string }): JSX.Element {\n return (\n <div className=\"fk:rounded-md fk:border fk:border-dashed fk:p-8 fk:text-center fk:text-sm fk:text-muted-foreground fk:corner-squircle\">\n {children}\n </div>\n );\n}\n\nexport function StatusBadge({ label, tone }: { label: string; tone: KnowledgeStatusTone }): JSX.Element {\n return (\n <Badge className={`fk:border-none fk:corner-squircle ${STATUS_TONE_CLASSES[tone]}`} variant=\"outline\">\n {tone === 'busy' ? <LoaderCircle className=\"fk:size-3 fk:animate-spin\" /> : null}\n {label}\n </Badge>\n );\n}\n\nconst FILE_ICONS: { [icon in KnowledgeFileIcon]: typeof Pdf } = {\n document: Document,\n docx: Docx,\n html: Html,\n pdf: Pdf,\n pptx: Pptx,\n txt: Txt,\n};\n\n/** The document's format as its file icon; the format's name is what a screen reader hears. */\nexport function KnowledgeTypeIcon({\n className = '',\n size = 24,\n source,\n}: {\n className?: string;\n size?: number;\n source: Pick<KnowledgeSource, 'kind' | 'mimeType'>;\n}): JSX.Element {\n const format = getKnowledgeFormat(source);\n const Icon = FILE_ICONS[format.icon];\n\n return (\n <span\n aria-label={format.label}\n className={`fk:flex fk:shrink-0 fk:items-center fk:justify-center ${className}`}\n data-knowledge-type={format.icon}\n role=\"img\"\n >\n <Icon size={size} />\n </span>\n );\n}\n\n/** The larger file icon of the document page and the record panel: the same icon as the list, at 40px. */\nexport function SourceIcon({ source }: { source: Pick<KnowledgeSource, 'kind' | 'mimeType'> }): JSX.Element {\n return <KnowledgeTypeIcon size={40} source={source} />;\n}\n\nexport function InfiniteScrollSentinel({ onVisible }: { onVisible: () => void }): JSX.Element {\n const sentinelRef = useRef<HTMLDivElement>(null);\n const onVisibleRef = useRef(onVisible);\n\n onVisibleRef.current = onVisible;\n\n useEffect(() => {\n const node = sentinelRef.current;\n\n if (!node) {\n return;\n }\n\n const observer = new IntersectionObserver((entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n onVisibleRef.current();\n }\n });\n\n observer.observe(node);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n return <div aria-hidden className=\"fk:h-px\" ref={sentinelRef} />;\n}\n\n/**\n * The actions of one document, behind a three-dots button: open (lists\n * only), download the original file (web pages open their address instead)\n * and remove, behind one confirmation. The list and the document page share\n * it so the copy, the download link and the busy rules stay the same.\n */\nexport function SourceActionsMenu({\n isBusy = false,\n onOpen,\n onRemoved,\n source,\n trigger = 'row',\n}: {\n /** Another action on the document is in flight; removing waits for it. */\n isBusy?: boolean;\n /** Offered as the first item when given (the document page is already open). */\n onOpen?: () => void;\n /** The document is gone: drop it from the list, or leave its page. The list invalidation is done here. */\n onRemoved: () => void;\n source: KnowledgeSource;\n /** How the button looks: a quiet icon in a row or card, an outlined one next to page actions. */\n trigger?: 'row' | 'page';\n}): JSX.Element | null {\n const { api, projectId } = useProjectKnowledge();\n const canMutate = useCanMutate();\n const [isConfirmingRemoval, setIsConfirmingRemoval] = useState(false);\n const [isRemoving, setIsRemoving] = useState(false);\n\n if (!api || !projectId) {\n return null;\n }\n\n const knowledgeApi = api;\n\n async function remove(): Promise<void> {\n setIsRemoving(true);\n\n try {\n await knowledgeApi.deleteSource(source.id);\n toast.success(`Removed \"${source.title}\".`);\n setIsConfirmingRemoval(false);\n onRemoved();\n void invalidateKnowledgeLists();\n } catch (removeError) {\n toast.error(describeApiError(removeError, 'The document could not be removed.'));\n } finally {\n setIsRemoving(false);\n }\n }\n\n return (\n <>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n aria-label={`Actions for ${source.title}`}\n className={trigger === 'row' ? 'fk:size-8 fk:shrink-0 fk:text-muted-foreground' : undefined}\n data-knowledge-menu\n size=\"icon-sm\"\n variant={trigger === 'row' ? 'ghost' : 'outline'}\n >\n <EllipsisVerticalIcon className=\"fk:size-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {onOpen ? <DropdownMenuItem onSelect={onOpen}>Open</DropdownMenuItem> : null}\n {source.path ? (\n <DropdownMenuItem asChild>\n <a href={knowledgePaths(projectId).file(source.id)}>\n <DownloadIcon />\n Download\n </a>\n </DropdownMenuItem>\n ) : null}\n {source.originUrl ? (\n <DropdownMenuItem asChild>\n <a href={source.originUrl} rel=\"noreferrer\" target=\"_blank\">\n <ExternalLinkIcon />\n Open page\n </a>\n </DropdownMenuItem>\n ) : null}\n {onOpen || source.path || source.originUrl ? <DropdownMenuSeparator /> : null}\n <DropdownMenuItem\n disabled={!canMutate || isBusy}\n variant=\"destructive\"\n onSelect={() => setIsConfirmingRemoval(true)}\n >\n <Trash2Icon />\n Remove\n </DropdownMenuItem>\n {canMutate ? null : (\n <DropdownMenuLabel className=\"fk:max-w-56 fk:whitespace-normal fk:text-xs fk:font-normal fk:text-muted-foreground\">\n Your member role cannot remove documents.\n </DropdownMenuLabel>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n <AlertDialog open={isConfirmingRemoval} onOpenChange={setIsConfirmingRemoval}>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Remove this document?</AlertDialogTitle>\n <AlertDialogDescription>\n \"{source.title}\" and its indexed passages are deleted for everyone. Answers the agent gave earlier keep\n their citations, but the document can no longer be opened.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel disabled={isRemoving}>Cancel</AlertDialogCancel>\n <AlertDialogAction\n disabled={isRemoving}\n onClick={(event: MouseEvent) => {\n event.preventDefault();\n void remove();\n }}\n >\n {isRemoving ? <LoaderCircle className=\"fk:animate-spin\" /> : null}\n Remove document\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/apps/knowledge/api.ts","../src/apps/knowledge/shared.tsx"],"names":["KnowledgeApiError","status","message","code","FetcherError","fetcher","url","response","knowledgePaths","projectId","basePath","entity","sourceId","jobId","from","to","recordId","options","limit","offset","search","params","trimmedSearch","isKnowledgeListKey","key","isKnowledgeLinkKey","readError","fallback","data","createKnowledgeApi","request","init","requestInit","register","body","file","tokenResponse","tokenData","put","title","filename","target","patch","STATUS_TONE_CLASSES","useProjectKnowledge","currentProjectId","useConfig","useMemo","invalidateKnowledgeLists","mutateGlobal","invalidateKnowledgeLinks","describeApiError","error","announceRegistered","result","name","toast","PageMessage","children","jsx","StatusBadge","label","tone","jsxs","Badge","LoaderCircle","FILE_ICONS","Document","Docx","Html","Pdf","Pptx","Txt","KnowledgeTypeIcon","className","size","source","format","getKnowledgeFormat","Icon","SourceIcon","InfiniteScrollSentinel","onVisible","sentinelRef","useRef","onVisibleRef","useEffect","node","observer","entries","entry","SourceActionsMenu","isBusy","onOpen","onRemoved","trigger","api","canMutate","useCanMutate","isConfirmingRemoval","setIsConfirmingRemoval","useState","isRemoving","setIsRemoving","knowledgeApi","remove","removeError","Fragment","DropdownMenu","DropdownMenuTrigger","Button","EllipsisVerticalIcon","DropdownMenuContent","DropdownMenuItem","DownloadIcon","ExternalLinkIcon","DropdownMenuSeparator","Trash2Icon","DropdownMenuLabel","AlertDialog","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","AlertDialogDescription","AlertDialogFooter","AlertDialogCancel","AlertDialogAction","event"],"mappings":"0gCAYO,IAAMA,CAAAA,CAAN,cAAgC,KAAM,CAC3C,IAAA,CACA,MAAA,CAEA,YAAYC,CAAAA,CAAgBC,CAAAA,CAAiBC,EAAsB,IAAA,CAAM,CACvE,MAAMD,CAAO,CAAA,CACb,IAAA,CAAK,IAAA,CAAO,oBACZ,IAAA,CAAK,IAAA,CAAOC,CAAAA,CACZ,IAAA,CAAK,OAASF,EAChB,CACF,CAAA,CAsBaG,CAAAA,CAAN,cAA2B,KAAM,CACtC,OAEA,WAAA,CAAYH,CAAAA,CAAgBC,EAAU,gBAAA,CAAkB,CACtD,KAAA,CAAMA,CAAO,EACb,IAAA,CAAK,IAAA,CAAO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,QAAA,CAAA,QAAA,CAAM,EAC/CvC,IAAAA,CAAC+D,GAAAA,CAAA,CACC,QAAA,CAAUxB,CAAAA,CACV,QAAUyB,CAAAA,EAAsB,CAC9BA,CAAAA,CAAM,cAAA,GACDtB,CAAAA,GACP,EAEC,QAAA,CAAA,CAAAH,CAAAA,CAAa3C,IAACM,YAAAA,CAAA,CAAa,SAAA,CAAU,iBAAA,CAAkB,EAAK,IAAA,CAAK,iBAAA,CAAA,CAEpE,GACF,CAAA,CAAA,CACF,CAAA,CACF,GACF,CAEJ","file":"chunk-VIBGMCLS.js","sourcesContent":["import { put } from '@vercel/blob/client';\nimport type {\n KnowledgeJob,\n KnowledgeLinkTarget,\n KnowledgeRecordRef,\n KnowledgeSource,\n KnowledgeSourcePatch,\n KnowledgeSourceStatus,\n RegisterKnowledgeSourceResult,\n} from './knowledge';\n\n/** The platform refused a knowledge request; `code` lets the UI tailor the message. */\nexport class KnowledgeApiError extends Error {\n code: string | null;\n status: number;\n\n constructor(status: number, message: string, code: string | null = null) {\n super(message);\n this.name = 'KnowledgeApiError';\n this.code = code;\n this.status = status;\n }\n}\n\nexport interface ProjectSpace {\n code: string;\n id: string;\n label: string;\n}\n\nexport interface KnowledgeApi {\n /** Uploads a document to the file store, then registers it; resolves once indexing is queued or the file was already there. */\n addFile: (_file: File, _options?: { signal?: AbortSignal }) => Promise<RegisterKnowledgeSourceResult>;\n addUrl: (_input: { title?: string; url: string }) => Promise<RegisterKnowledgeSourceResult>;\n /** Promotes a file the caller attached to a chat: the platform copies it into the knowledge folder. */\n addChatAttachment: (_input: { filename: string; url: string }) => Promise<RegisterKnowledgeSourceResult>;\n deleteSource: (_sourceId: string) => Promise<{ deleted: true }>;\n /** Attaches the document to a record, or to every record of an entity type; `linked` is false when it already was. */\n linkSource: (_sourceId: string, _target: KnowledgeLinkTarget) => Promise<{ linked: boolean }>;\n reingestSource: (_sourceId: string) => Promise<{ job: KnowledgeJob }>;\n unlinkSource: (_sourceId: string, _target: KnowledgeLinkTarget) => Promise<{ unlinked: boolean }>;\n updateSource: (_sourceId: string, _patch: KnowledgeSourcePatch) => Promise<{ source: KnowledgeSource }>;\n}\n\nexport class FetcherError extends Error {\n status: number;\n\n constructor(status: number, message = 'Request failed') {\n super(message);\n this.name = 'FetcherError';\n this.status = status;\n }\n}\n\nexport const fetcher = async <T>(url: string): Promise<T> => {\n const response = await fetch(url, { credentials: 'include' });\n\n if (!response.ok) {\n throw new FetcherError(response.status);\n }\n\n return (await response.json()) as T;\n};\n\nexport function knowledgePaths(projectId: string): {\n /** The documents attached to every record of an entity type. */\n entitySources: (_entity: string) => string;\n /** The original file of an uploaded document, served under its name. */\n file: (_sourceId: string) => string;\n job: (_jobId: string) => string;\n /** The records a document is attached to, and the entity types it applies to. */\n links: (_sourceId: string) => string;\n passages: (_sourceId: string, _options: { from: number; to: number }) => string;\n /** The documents attached to a record. */\n recordSources: (_record: KnowledgeRecordRef) => string;\n source: (_sourceId: string) => string;\n sources: (_options?: { limit?: number; offset?: number; search?: string; status?: KnowledgeSourceStatus }) => string;\n spaces: string;\n} {\n const basePath = `/api/flexkit/${projectId}/knowledge`;\n\n return {\n entitySources: (entity) => `${basePath}/entities/${encodeURIComponent(entity)}/sources`,\n file: (sourceId) => `${basePath}/sources/${encodeURIComponent(sourceId)}/file`,\n job: (jobId) => `${basePath}/jobs/${encodeURIComponent(jobId)}`,\n links: (sourceId) => `${basePath}/sources/${encodeURIComponent(sourceId)}/links`,\n passages: (sourceId, { from, to }) =>\n `${basePath}/sources/${encodeURIComponent(sourceId)}/passages?from=${String(from)}&to=${String(to)}`,\n recordSources: ({ entity, recordId }) =>\n `${basePath}/records/${encodeURIComponent(entity)}/${encodeURIComponent(recordId)}/sources`,\n source: (sourceId) => `${basePath}/sources/${encodeURIComponent(sourceId)}`,\n sources: (options = {}) => {\n const { limit = 25, offset = 0, search, status } = options;\n const params = new URLSearchParams({ limit: limit.toString(), offset: offset.toString() });\n const trimmedSearch = search?.trim();\n\n if (trimmedSearch) {\n params.set('q', trimmedSearch);\n }\n\n if (status) {\n params.set('status', status);\n }\n\n return `${basePath}/sources?${params.toString()}`;\n },\n spaces: `/api/flexkit/${projectId}/spaces`,\n };\n}\n\n/** Whether an SWR key is a page of the document list, whatever its filters. */\nexport function isKnowledgeListKey(key: unknown): boolean {\n return typeof key === 'string' && key.includes('/knowledge/sources?');\n}\n\n/** Whether an SWR key lists the documents of a record or an entity type, or the links of a document. */\nexport function isKnowledgeLinkKey(key: unknown): boolean {\n return (\n typeof key === 'string' &&\n (key.includes('/knowledge/records/') ||\n key.includes('/knowledge/entities/') ||\n (key.includes('/knowledge/sources/') && key.endsWith('/links')))\n );\n}\n\nasync function readError(response: Response, fallback: string): Promise<KnowledgeApiError> {\n let data: { code?: string; error?: string } = {};\n\n try {\n data = (await response.json()) as { code?: string; error?: string };\n } catch {\n // Non-JSON error bodies keep the fallback message.\n }\n\n return new KnowledgeApiError(response.status, data.error ? String(data.error) : fallback, data.code ?? null);\n}\n\nexport function createKnowledgeApi(projectId: string): KnowledgeApi {\n const basePath = `/api/flexkit/${projectId}/knowledge`;\n\n async function request<T>(url: string, init: RequestInit & { fallback: string }): Promise<T> {\n const { fallback, ...requestInit } = init;\n const response = await fetch(url, {\n credentials: 'include',\n headers: { 'Content-Type': 'application/json', ...(requestInit.headers ?? {}) },\n ...requestInit,\n });\n\n if (!response.ok) {\n throw await readError(response, fallback);\n }\n\n return (await response.json()) as T;\n }\n\n function register(body: Record<string, unknown>): Promise<RegisterKnowledgeSourceResult> {\n return request<RegisterKnowledgeSourceResult>(`${basePath}/sources`, {\n body: JSON.stringify(body),\n fallback: 'The document could not be added.',\n method: 'POST',\n });\n }\n\n return {\n addFile: async (file, options) => {\n // The platform issues a token pinned to one pathname, type and size; the\n // browser writes the bytes to the store itself, so a 20 MB document never\n // crosses the API function body limit. Registration then hashes the blob.\n const tokenResponse = await fetch(`${basePath}/uploads`, {\n body: JSON.stringify({ filename: file.name, mediaType: file.type || null, sizeBytes: file.size }),\n credentials: 'include',\n headers: { 'Content-Type': 'application/json' },\n method: 'POST',\n signal: options?.signal,\n });\n\n if (!tokenResponse.ok) {\n throw await readError(tokenResponse, 'The file could not be uploaded.');\n }\n\n const tokenData = (await tokenResponse.json()) as { mediaType?: string; pathname?: string; token?: string };\n\n if (!tokenData.pathname || !tokenData.token || !tokenData.mediaType) {\n throw new KnowledgeApiError(tokenResponse.status, 'The file could not be uploaded.');\n }\n\n await put(tokenData.pathname, file, {\n abortSignal: options?.signal,\n access: 'public',\n contentType: tokenData.mediaType,\n token: tokenData.token,\n });\n\n return register({ kind: 'upload', pathname: tokenData.pathname });\n },\n addUrl: ({ title, url }) => register({ kind: 'url', url, ...(title ? { title } : {}) }),\n addChatAttachment: ({ filename, url }) => register({ filename, kind: 'chat-attachment', url }),\n deleteSource: (sourceId) =>\n request<{ deleted: true }>(`${basePath}/sources/${encodeURIComponent(sourceId)}`, {\n fallback: 'The document could not be removed.',\n method: 'DELETE',\n }),\n linkSource: (sourceId, target) =>\n request<{ linked: boolean }>(`${basePath}/sources/${encodeURIComponent(sourceId)}/links`, {\n body: JSON.stringify(target),\n fallback: 'The document could not be attached.',\n method: 'POST',\n }),\n reingestSource: (sourceId) =>\n request<{ job: KnowledgeJob }>(`${basePath}/sources/${encodeURIComponent(sourceId)}/reingest`, {\n fallback: 'The document could not be re-indexed.',\n method: 'POST',\n }),\n unlinkSource: (sourceId, { entity, recordId }) =>\n request<{ unlinked: boolean }>(\n `${basePath}/sources/${encodeURIComponent(sourceId)}/links/${encodeURIComponent(entity)}${\n recordId === undefined ? '' : `/${encodeURIComponent(recordId)}`\n }`,\n { fallback: 'The document could not be detached.', method: 'DELETE' }\n ),\n updateSource: (sourceId, patch) =>\n request<{ source: KnowledgeSource }>(`${basePath}/sources/${encodeURIComponent(sourceId)}`, {\n body: JSON.stringify(patch),\n fallback: 'The document could not be updated.',\n method: 'PATCH',\n }),\n };\n}\n","import type { JSX, MouseEvent } from 'react';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { DownloadIcon, EllipsisVerticalIcon, ExternalLinkIcon, LoaderCircle, Trash2Icon } from 'lucide-react';\nimport { mutate as mutateGlobal } from 'swr';\n// File type icons: Untitled UI's free file icons, Solid variant. The set is\n// published as the MIT package `@untitledui/file-icons`; the page below shows\n// every icon and offers each as SVG or JSX should another format need one.\n// https://www.untitledui.com/resources/file-icons\nimport { Document } from '@untitledui/file-icons/dist/solid/document.mjs';\nimport { Docx } from '@untitledui/file-icons/dist/solid/docx.mjs';\nimport { Html } from '@untitledui/file-icons/dist/solid/html.mjs';\nimport { Pdf } from '@untitledui/file-icons/dist/solid/pdf.mjs';\nimport { Pptx } from '@untitledui/file-icons/dist/solid/pptx.mjs';\nimport { Txt } from '@untitledui/file-icons/dist/solid/txt.mjs';\nimport { useConfig } from '../../core/config/config-context';\nimport { useCanMutate } from '../../core/permissions';\nimport {\n Badge,\n Button,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n toast,\n} from '../../ui';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from '../../ui/primitives/alert-dialog';\nimport {\n createKnowledgeApi,\n isKnowledgeLinkKey,\n isKnowledgeListKey,\n KnowledgeApiError,\n knowledgePaths,\n type KnowledgeApi,\n} from './api';\nimport {\n getKnowledgeFormat,\n type KnowledgeFileIcon,\n type KnowledgeSource,\n type KnowledgeStatusTone,\n type RegisterKnowledgeSourceResult,\n} from './knowledge';\n\nconst STATUS_TONE_CLASSES: { [tone in KnowledgeStatusTone]: string } = {\n busy: 'fk:bg-amber-500/15 fk:text-amber-700 fk:dark:text-amber-400',\n error: 'fk:bg-destructive/15 fk:text-destructive',\n muted: 'fk:bg-muted fk:text-muted-foreground',\n ready: 'fk:bg-emerald-500/15 fk:text-emerald-700 fk:dark:text-emerald-400',\n};\n\nexport function useProjectKnowledge(): { api: KnowledgeApi | null; projectId: string | undefined } {\n const { currentProjectId } = useConfig();\n const api = useMemo(() => (currentProjectId ? createKnowledgeApi(currentProjectId) : null), [currentProjectId]);\n\n return { api, projectId: currentProjectId };\n}\n\n/** Drops every cached page of the document list, so the next visit fetches it afresh. */\nexport function invalidateKnowledgeLists(): Promise<unknown> {\n return mutateGlobal(isKnowledgeListKey, undefined, { revalidate: true });\n}\n\n/** Drops every cached link listing (a record's documents, a document's records) after a link changed. */\nexport function invalidateKnowledgeLinks(): Promise<unknown> {\n return mutateGlobal(isKnowledgeLinkKey, undefined, { revalidate: true });\n}\n\nexport function describeApiError(error: unknown, fallback: string): string {\n if (error instanceof KnowledgeApiError) {\n return error.message;\n }\n\n return error instanceof Error ? error.message : fallback;\n}\n\n/** What the user hears once a document was registered. */\nexport function announceRegistered(result: RegisterKnowledgeSourceResult, name: string): void {\n if (result.duplicate) {\n toast.info(`\"${result.source.title}\" is already in Knowledge.`);\n\n return;\n }\n\n toast.success(`Added ${name}. Indexing starts now.`);\n}\n\nexport function PageMessage({ children }: { children: string }): JSX.Element {\n return (\n <div className=\"fk:rounded-md fk:border fk:border-dashed fk:p-8 fk:text-center fk:text-sm fk:text-muted-foreground fk:corner-squircle\">\n {children}\n </div>\n );\n}\n\nexport function StatusBadge({ label, tone }: { label: string; tone: KnowledgeStatusTone }): JSX.Element {\n return (\n <Badge className={`fk:border-none fk:corner-squircle ${STATUS_TONE_CLASSES[tone]}`} variant=\"outline\">\n {tone === 'busy' ? <LoaderCircle className=\"fk:size-3 fk:animate-spin\" /> : null}\n {label}\n </Badge>\n );\n}\n\nconst FILE_ICONS: { [icon in KnowledgeFileIcon]: typeof Pdf } = {\n document: Document,\n docx: Docx,\n html: Html,\n pdf: Pdf,\n pptx: Pptx,\n txt: Txt,\n};\n\n/** The document's format as its file icon; the format's name is what a screen reader hears. */\nexport function KnowledgeTypeIcon({\n className = '',\n size = 24,\n source,\n}: {\n className?: string;\n size?: number;\n source: Pick<KnowledgeSource, 'kind' | 'mimeType'>;\n}): JSX.Element {\n const format = getKnowledgeFormat(source);\n const Icon = FILE_ICONS[format.icon];\n\n return (\n <span\n aria-label={format.label}\n className={`fk:flex fk:shrink-0 fk:items-center fk:justify-center ${className}`}\n data-knowledge-type={format.icon}\n role=\"img\"\n >\n <Icon size={size} />\n </span>\n );\n}\n\n/** The larger file icon of the document page and the record panel: the same icon as the list, at 40px. */\nexport function SourceIcon({ source }: { source: Pick<KnowledgeSource, 'kind' | 'mimeType'> }): JSX.Element {\n return <KnowledgeTypeIcon size={40} source={source} />;\n}\n\nexport function InfiniteScrollSentinel({ onVisible }: { onVisible: () => void }): JSX.Element {\n const sentinelRef = useRef<HTMLDivElement>(null);\n const onVisibleRef = useRef(onVisible);\n\n onVisibleRef.current = onVisible;\n\n useEffect(() => {\n const node = sentinelRef.current;\n\n if (!node) {\n return;\n }\n\n const observer = new IntersectionObserver((entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n onVisibleRef.current();\n }\n });\n\n observer.observe(node);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n return <div aria-hidden className=\"fk:h-px\" ref={sentinelRef} />;\n}\n\n/**\n * The actions of one document, behind a three-dots button: open (lists\n * only), download the original file (web pages open their address instead)\n * and remove, behind one confirmation. The list and the document page share\n * it so the copy, the download link and the busy rules stay the same.\n */\nexport function SourceActionsMenu({\n isBusy = false,\n onOpen,\n onRemoved,\n source,\n trigger = 'row',\n}: {\n /** Another action on the document is in flight; removing waits for it. */\n isBusy?: boolean;\n /** Offered as the first item when given (the document page is already open). */\n onOpen?: () => void;\n /** The document is gone: drop it from the list, or leave its page. The list invalidation is done here. */\n onRemoved: () => void;\n source: KnowledgeSource;\n /** How the button looks: a quiet icon in a row or card, an outlined one next to page actions. */\n trigger?: 'row' | 'page';\n}): JSX.Element | null {\n const { api, projectId } = useProjectKnowledge();\n const canMutate = useCanMutate();\n const [isConfirmingRemoval, setIsConfirmingRemoval] = useState(false);\n const [isRemoving, setIsRemoving] = useState(false);\n\n if (!api || !projectId) {\n return null;\n }\n\n const knowledgeApi = api;\n\n async function remove(): Promise<void> {\n setIsRemoving(true);\n\n try {\n await knowledgeApi.deleteSource(source.id);\n toast.success(`Removed \"${source.title}\".`);\n setIsConfirmingRemoval(false);\n onRemoved();\n void invalidateKnowledgeLists();\n } catch (removeError) {\n toast.error(describeApiError(removeError, 'The document could not be removed.'));\n } finally {\n setIsRemoving(false);\n }\n }\n\n return (\n <>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n aria-label={`Actions for ${source.title}`}\n className={trigger === 'row' ? 'fk:size-8 fk:shrink-0 fk:text-muted-foreground' : undefined}\n data-knowledge-menu\n size=\"icon-sm\"\n variant={trigger === 'row' ? 'ghost' : 'outline'}\n >\n <EllipsisVerticalIcon className=\"fk:size-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {onOpen ? <DropdownMenuItem onSelect={onOpen}>Open</DropdownMenuItem> : null}\n {source.path ? (\n <DropdownMenuItem asChild>\n <a href={knowledgePaths(projectId).file(source.id)}>\n <DownloadIcon />\n Download\n </a>\n </DropdownMenuItem>\n ) : null}\n {source.originUrl ? (\n <DropdownMenuItem asChild>\n <a href={source.originUrl} rel=\"noreferrer\" target=\"_blank\">\n <ExternalLinkIcon />\n Open page\n </a>\n </DropdownMenuItem>\n ) : null}\n {onOpen || source.path || source.originUrl ? <DropdownMenuSeparator /> : null}\n <DropdownMenuItem\n disabled={!canMutate || isBusy}\n variant=\"destructive\"\n onSelect={() => setIsConfirmingRemoval(true)}\n >\n <Trash2Icon />\n Remove\n </DropdownMenuItem>\n {canMutate ? null : (\n <DropdownMenuLabel className=\"fk:max-w-56 fk:whitespace-normal fk:text-xs fk:font-normal fk:text-muted-foreground\">\n Your member role cannot remove documents.\n </DropdownMenuLabel>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n <AlertDialog open={isConfirmingRemoval} onOpenChange={setIsConfirmingRemoval}>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Remove this document?</AlertDialogTitle>\n <AlertDialogDescription>\n \"{source.title}\" and its indexed passages are deleted for everyone. Answers the agent gave earlier keep\n their citations, but the document can no longer be opened.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel disabled={isRemoving}>Cancel</AlertDialogCancel>\n <AlertDialogAction\n disabled={isRemoving}\n onClick={(event: MouseEvent) => {\n event.preventDefault();\n void remove();\n }}\n >\n {isRemoving ? <LoaderCircle className=\"fk:animate-spin\" /> : null}\n Remove document\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </>\n );\n}\n"]}