@flexkit/studio 0.2.13 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activity-nav-button-7SVTTHBQ.js +2 -0
- package/dist/{activity-nav-button-RDL5GIWG.js.map → activity-nav-button-7SVTTHBQ.js.map} +1 -1
- package/dist/astro.js +1 -1
- package/dist/{chat-page-B2IOPTUP.js → chat-page-L427VVVR.js} +3 -3
- package/dist/{chat-page-B2IOPTUP.js.map → chat-page-L427VVVR.js.map} +1 -1
- package/dist/chunk-2HYQVMP3.js +3 -0
- package/dist/chunk-2HYQVMP3.js.map +1 -0
- package/dist/chunk-5CVDMZUI.js +3 -0
- package/dist/chunk-5CVDMZUI.js.map +1 -0
- package/dist/chunk-6YJ3DLIU.js +2 -0
- package/dist/{chunk-CJGP4Y5Y.js.map → chunk-6YJ3DLIU.js.map} +1 -1
- package/dist/{chunk-C5Y6OZFR.js → chunk-7ELMTFZ4.js} +2 -2
- package/dist/{chunk-C5Y6OZFR.js.map → chunk-7ELMTFZ4.js.map} +1 -1
- package/dist/chunk-ALCK2BJY.js +2 -0
- package/dist/chunk-ALCK2BJY.js.map +1 -0
- package/dist/{chunk-ZLWYVTGO.js → chunk-D5WYD5M4.js} +2 -2
- package/dist/{chunk-ZLWYVTGO.js.map → chunk-D5WYD5M4.js.map} +1 -1
- package/dist/{chunk-DJPVRAFE.js → chunk-GFAOY74A.js} +9 -1
- package/dist/{chunk-TOY7ZRK2.js → chunk-MGXG5PWU.js} +3 -3
- package/dist/{chunk-TOY7ZRK2.js.map → chunk-MGXG5PWU.js.map} +1 -1
- package/dist/{chunk-KNESQOI5.js → chunk-MJVWFANP.js} +3 -3
- package/dist/{chunk-KNESQOI5.js.map → chunk-MJVWFANP.js.map} +1 -1
- package/dist/chunk-NLRSLQUT.js +3 -0
- package/dist/chunk-NLRSLQUT.js.map +1 -0
- package/dist/{chunk-VPTDAFFZ.js → chunk-P5ZRTZ5Z.js} +2 -2
- package/dist/{chunk-VPTDAFFZ.js.map → chunk-P5ZRTZ5Z.js.map} +1 -1
- package/dist/{chunk-N53TGGN5.js → chunk-R64ELY3B.js} +3 -3
- package/dist/{chunk-N53TGGN5.js.map → chunk-R64ELY3B.js.map} +1 -1
- package/dist/{chunk-APVKB4FT.js → chunk-U5D3EDCY.js} +2 -2
- package/dist/{chunk-APVKB4FT.js.map → chunk-U5D3EDCY.js.map} +1 -1
- package/dist/chunk-W7Z4MY43.js +2 -0
- package/dist/{chunk-ETQ3Q472.js.map → chunk-W7Z4MY43.js.map} +1 -1
- package/dist/chunk-XWBACTNR.js +3 -0
- package/dist/{chunk-CWJWOJRO.js.map → chunk-XWBACTNR.js.map} +1 -1
- package/dist/chunk-ZZRA4567.js +2 -0
- package/dist/{chunk-V64P56OA.js.map → chunk-ZZRA4567.js.map} +1 -1
- package/dist/electron.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/list-WJLU3K2X.js +2 -0
- package/dist/{list-4NZLZRX3.js.map → list-WJLU3K2X.js.map} +1 -1
- package/dist/nextjs.js +1 -1
- package/dist/{pages-7MFZAVLV.js → pages-3EK5GS2T.js} +4 -4
- package/dist/{pages-7MFZAVLV.js.map → pages-3EK5GS2T.js.map} +1 -1
- package/dist/plugin-pages-PQO22EOE.js +2 -0
- package/dist/{plugin-pages-RNB46YPQ.js.map → plugin-pages-PQO22EOE.js.map} +1 -1
- package/dist/root-4EALW3G6.js +2 -0
- package/dist/{root-5RDJ2HAV.js.map → root-4EALW3G6.js.map} +1 -1
- package/dist/{root-NCLIQPJA.js → root-BA7BLCFR.js} +3 -3
- package/dist/{root-NCLIQPJA.js.map → root-BA7BLCFR.js.map} +1 -1
- package/dist/root-YNGCF5QM.js +31 -0
- package/dist/{root-4XPMKRHZ.js.map → root-YNGCF5QM.js.map} +1 -1
- package/dist/{root-OHZDY47O.js → root-ZF62TR5Z.js} +2 -2
- package/dist/{root-OHZDY47O.js.map → root-ZF62TR5Z.js.map} +1 -1
- package/dist/search-QHMCAT7O.js +2 -0
- package/dist/{search-OWF3LEWH.js.map → search-QHMCAT7O.js.map} +1 -1
- package/dist/skills-pages-HIBSAVOP.js +2 -0
- package/dist/{skills-pages-VCXZFQFD.js.map → skills-pages-HIBSAVOP.js.map} +1 -1
- package/dist/tanstack-start.js +1 -1
- package/dist/user-nav-36ACWXOW.js +2 -0
- package/dist/{user-nav-DCAHVWN7.js.map → user-nav-36ACWXOW.js.map} +1 -1
- package/package.json +5 -5
- package/dist/activity-nav-button-RDL5GIWG.js +0 -2
- package/dist/chunk-2HSIWUH3.js +0 -3
- package/dist/chunk-2HSIWUH3.js.map +0 -1
- package/dist/chunk-CJGP4Y5Y.js +0 -2
- package/dist/chunk-CWJWOJRO.js +0 -3
- package/dist/chunk-ETQ3Q472.js +0 -2
- package/dist/chunk-KXAGLQ2B.js +0 -2
- package/dist/chunk-KXAGLQ2B.js.map +0 -1
- package/dist/chunk-TYDYAOQ7.js +0 -3
- package/dist/chunk-TYDYAOQ7.js.map +0 -1
- package/dist/chunk-V64P56OA.js +0 -2
- package/dist/chunk-XDLTO6VU.js +0 -3
- package/dist/chunk-XDLTO6VU.js.map +0 -1
- package/dist/list-4NZLZRX3.js +0 -2
- package/dist/plugin-pages-RNB46YPQ.js +0 -2
- package/dist/root-4XPMKRHZ.js +0 -31
- package/dist/root-5RDJ2HAV.js +0 -2
- package/dist/search-OWF3LEWH.js +0 -2
- package/dist/skills-pages-VCXZFQFD.js +0 -2
- package/dist/user-nav-DCAHVWN7.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flexkit/studio",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "Flexkit Studio - Build custom internal tools like PIMs, CRMs, and ERPs with a flexible React UI and a graph-backed API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"flexkit",
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"tailwindcss-animate": "1.0.7",
|
|
76
76
|
"tsup": "8.5.1",
|
|
77
77
|
"typescript": "^5.3.3",
|
|
78
|
+
"eslint-config-custom": "0.0.0",
|
|
78
79
|
"tailwind-config": "0.0.1",
|
|
79
|
-
"tsconfig": "0.0.0"
|
|
80
|
-
"eslint-config-custom": "0.0.0"
|
|
80
|
+
"tsconfig": "0.0.0"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@ai-sdk/react": "3.0.118",
|
|
@@ -161,8 +161,8 @@
|
|
|
161
161
|
"uuid": "^9.0.1",
|
|
162
162
|
"vaul": "1.1.2",
|
|
163
163
|
"zod": "4.4.3",
|
|
164
|
-
"@flexkit/
|
|
165
|
-
"@flexkit/
|
|
164
|
+
"@flexkit/agent-protocol": "^0.3.9",
|
|
165
|
+
"@flexkit/schema": "0.2.14"
|
|
166
166
|
},
|
|
167
167
|
"peerDependencies": {
|
|
168
168
|
"react": "^19.0.0",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';export{b as ActivityNavButton,a as useActivitySummary}from'./chunk-APVKB4FT.js';import'./chunk-XDLTO6VU.js';import'./chunk-2HSIWUH3.js';import'./chunk-USNXQOMJ.js';import'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';//# sourceMappingURL=activity-nav-button-RDL5GIWG.js.map
|
|
2
|
-
//# sourceMappingURL=activity-nav-button-RDL5GIWG.js.map
|
package/dist/chunk-2HSIWUH3.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {put}from'@vercel/blob/client';function S(s,o){let l=o.trim();return l?s.trim()?/\s$/.test(s)||/^[.,!?;:]/.test(l)?`${s}${l}`:`${s} ${l}`:s.length===0?l:`${s}${l}`:s}async function h(s){if(typeof window>"u")throw new Error("Dictation is only available in the browser.");let o=window.AudioContext??window.webkitAudioContext;if(!o)throw new Error("This browser cannot decode recorded audio.");let l=await s.arrayBuffer(),u=new o;try{let n=await u.decodeAudioData(l.slice(0)),i=C(n),t=y(i,n.sampleRate,24e3),e=$(t),a=t.length/24e3;if(a<.25)throw new Error("No speech was captured. Try again.");if(a>60)throw new Error(`Dictation is limited to ${String(60)} seconds.`);return {durationSeconds:a,pcm:new Blob([e],{type:"audio/pcm"})}}finally{await u.close();}}function C(s){let{length:o,numberOfChannels:l}=s;if(l===1)return s.getChannelData(0).slice();let u=new Float32Array(o);for(let n=0;n<o;n+=1){let i=0;for(let t=0;t<l;t+=1)i+=s.getChannelData(t)[n]??0;u[n]=i/l;}return u}function y(s,o,l){if(o===l)return s;let u=o/l,n=Math.max(1,Math.round(s.length/u)),i=new Float32Array(n);for(let t=0;t<n;t+=1){let e=t*u,a=Math.floor(e),r=Math.min(a+1,s.length-1),c=e-a,g=s[a]??0,m=s[r]??0;i[t]=g+(m-g)*c;}return i}function $(s){let o=new ArrayBuffer(s.length*2),l=new DataView(o);for(let u=0;u<s.length;u+=1){let n=Math.max(-1,Math.min(1,s[u]??0));l.setInt16(u*2,n<0?n*32768:n*32767,true);}return o}var d=class extends Error{code;status;constructor(o,l,u=null){super(l),this.name="AgentUploadError",this.code=u,this.status=o;}};function f(){if(typeof window>"u")return "flexkit.io";let{hostname:s}=window.location;return s==="localhost"||s==="127.0.0.1"||s==="flexkit.test"||s.endsWith(".flexkit.test")?"flexkit.test":"flexkit.io"}function w(){return `https://${f()}`}function T(s,o){return `https://${s}.api.${f()}/automations/webhook/${encodeURIComponent(o)}`}function _(s){let o=`/api/flexkit/${s}`,l=`${o}/automations`,u=`${o}/skills`,n=`${o}/agent/chats`;async function i(t,e){let a=await fetch(t,{credentials:"include",headers:{"Content-Type":"application/json",...e?.headers??{}},...e}),r=await a.json();if(!a.ok){let c=r&&typeof r=="object"&&"error"in r?String(r.error):"Request failed";throw new Error(c)}return r}return {connectPlugins:t=>i(`${o}/plugins/connect`,{method:"POST",body:JSON.stringify(t)}),pluginOAuthStatus:t=>i(`${o}/plugins/oauth-transactions/${encodeURIComponent(t)}`),updatePluginConnection:(t,e)=>i(`${o}/plugin-connections/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(e)}),disconnectPlugin:t=>i(`${o}/plugin-connections/${encodeURIComponent(t)}`,{method:"DELETE"}),installPlugin:t=>i(`${o}/plugins/${encodeURIComponent(t)}/installation`,{method:"PUT",body:JSON.stringify({})}),setPluginPolicy:(t,e)=>i(`${o}/plugins/${encodeURIComponent(t)}/policy`,{method:"PATCH",body:JSON.stringify(e)}),refreshPluginTools:t=>i(`${o}/plugin-connections/${encodeURIComponent(t)}/tools/refresh`,{method:"POST"}),cancelRun:async t=>i(`${l}/runs/${encodeURIComponent(t)}/cancel`,{method:"POST"}),createAgentChat:async t=>i(n,{body:JSON.stringify({modelId:t?.modelId??null}),method:"POST"}),deleteAgentChat:async t=>i(`${n}/${encodeURIComponent(t)}`,{method:"DELETE"}),getAgentChatStreamUrl:(t,e)=>`${n}/${encodeURIComponent(t)}/stream?workflowRunId=${encodeURIComponent(e)}`,renameAgentChat:async(t,e)=>i(`${n}/${encodeURIComponent(t)}`,{body:JSON.stringify({title:e}),method:"PATCH"}),sendAgentChatMessage:async(t,e)=>i(`${n}/${encodeURIComponent(t)}/messages`,{body:JSON.stringify(e),method:"POST"}),announcePluginConnected:async(t,e)=>i(`${n}/${encodeURIComponent(t)}/plugin-connected`,{body:JSON.stringify({pluginId:e}),method:"POST"}),sendAgentChatFollowUp:async(t,e)=>i(`${n}/${encodeURIComponent(t)}/follow-ups`,{body:JSON.stringify(e),method:"POST"}),answerAgentChatQuestion:async(t,e,a)=>{let r=await fetch(`${n}/${encodeURIComponent(t)}/questions/${encodeURIComponent(e)}/answer`,{body:JSON.stringify(a),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST"}),c=await r.json();if(!r.ok&&!c.question)throw new Error(c.errorMessage??c.error??"Request failed");return {errorMessage:r.ok?void 0:c.errorMessage,question:c.question}},startAgentChat:async({attachments:t,content:e,modelId:a})=>i(n,{body:JSON.stringify({message:{attachments:t,content:e},modelId:a??null}),method:"POST"}),startQueuedAgentChatMessage:async(t,e)=>i(`${n}/${encodeURIComponent(t)}/follow-ups/${encodeURIComponent(e)}/start`,{method:"POST"}),stopAgentChat:async t=>i(`${n}/${encodeURIComponent(t)}/stop`,{method:"POST"}),stopAgentChatMonitor:async(t,e)=>i(`${n}/${encodeURIComponent(t)}/monitors/${encodeURIComponent(e)}/stop`,{method:"POST"}),transcribeAgentAudio:async(t,e)=>{let{durationSeconds:a,pcm:r}=await h(t),c=new FormData;c.append("file",r,"audio.pcm"),c.append("durationSeconds",String(a));let g=await fetch(`${o}/agent/transcribe`,{body:c,credentials:"include",method:"POST",signal:e}),m=await g.json();if(!g.ok){let A=m&&typeof m=="object"&&m.error?String(m.error):"Request failed";throw new Error(A)}if(!m.text?.trim())throw new Error("No speech was recognized. Try again.");return {text:m.text}},uploadAgentChatAttachment:async(t,e)=>{let a=await fetch(`${o}/agent/uploads`,{body:JSON.stringify({filename:t.name,mediaType:t.type||null,sizeBytes:t.size}),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST",signal:e}),r=await a.json();if(!a.ok||!r.pathname||!r.token||!r.mediaType)throw new d(a.status,r.error?String(r.error):"The file could not be uploaded.",r.code??null);let c=await put(r.pathname,t,{abortSignal:e,access:"public",contentType:r.mediaType,token:r.token});return {filename:t.name,mediaType:r.mediaType,sizeBytes:t.size,url:c.url}},decideApproval:async(t,e)=>{let a=await fetch(`${l}/approvals/${encodeURIComponent(t)}/decide`,{body:JSON.stringify(e),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST"}),r=await a.json();if(!a.ok&&typeof r.success!="boolean")throw new Error(r.error?String(r.error):"Request failed");return r},markActivityRead:async t=>i(`${o}/activity/read`,{body:JSON.stringify(t==="all"?{all:true}:{ids:t}),method:"POST"}),setActivityItemState:async(t,e)=>i(`${o}/activity/${encodeURIComponent(t)}`,{body:JSON.stringify({state:e}),method:"PATCH"}),createAutomation:async t=>i(l,{body:JSON.stringify(t),method:"POST"}),createSkill:async t=>i(u,{body:JSON.stringify(t),method:"POST"}),deleteAutomation:async t=>i(`${l}/${encodeURIComponent(t)}`,{method:"DELETE"}),deleteSkill:async t=>i(`${u}/${encodeURIComponent(t)}`,{method:"DELETE"}),getArtifactUrl:(t,e)=>{let a=e?.download?"?download=1":"";return `${l}/artifacts/${encodeURIComponent(t)}/content${a}`},getRunArtifacts:async t=>i(`${l}/runs/${encodeURIComponent(t)}/artifacts`).then(e=>e.artifacts),getStreamUrl:t=>`${l}/runs/${encodeURIComponent(t)}/stream`,getTranscriptUrl:t=>`${l}/runs/${encodeURIComponent(t)}/transcript`,listChannels:async(t,e)=>{let a=e?`${o}/plugin-connections/${encodeURIComponent(e)}/channels`:`${o}/plugins/${t}/channels`,r=await fetch(a,{credentials:"include",headers:{"Content-Type":"application/json"}}),c=await r.json();if(r.ok)return {channels:c.channels??[],errorMessage:c.errorMessage,success:c.success??true};if(c.success===false)return {channels:c.channels??[],errorMessage:c.errorMessage??`Failed to load ${t==="slack"?"Slack":"Teams"} channels.`,success:false};let g=c.error?String(c.error):"Request failed";throw new Error(g)},runAutomation:async t=>i(`${l}/${encodeURIComponent(t)}/runs`,{method:"POST"}),updateAutomation:async(t,e)=>i(`${l}/${encodeURIComponent(t)}`,{body:JSON.stringify(e),method:"PATCH"}),updateSkill:async(t,e)=>i(`${u}/${encodeURIComponent(t)}`,{body:JSON.stringify(e),method:"PATCH"})}}var p=class extends Error{status;constructor(o,l="Request failed"){super(l),this.name="FetcherError",this.status=o;}},k=async s=>{let o=await fetch(s,{credentials:"include"});if(!o.ok)throw new p(o.status);return await o.json()};function U(s){let o=`/api/flexkit/${s}/automations`,l=`/api/flexkit/${s}/skills`,u=`/api/flexkit/${s}/agent/chats`;return {activity:(n={})=>{let{filter:i="all",limit:t=25,offset:e=0}=n,a=new URLSearchParams({filter:i,limit:t.toString(),offset:e.toString()});return `/api/flexkit/${s}/activity?${a.toString()}`},activityItem:n=>`/api/flexkit/${s}/activity/${encodeURIComponent(n)}`,activitySummary:n=>n?`/api/flexkit/${s}/activity/summary?since=${encodeURIComponent(n)}`:`/api/flexkit/${s}/activity/summary`,agentChat:n=>`${u}/${encodeURIComponent(n)}`,agentChatSearch:n=>`${u}/search?q=${encodeURIComponent(n)}`,agentChats:(n=0)=>`${u}?offset=${n.toString()}`,agentProfile:()=>`/api/flexkit/${s}/agent/profile`,approval:n=>`${o}/approvals/${encodeURIComponent(n)}`,approvals:(n={})=>{let{limit:i=25,offset:t=0,runId:e,status:a}=n,r=new URLSearchParams({limit:i.toString(),offset:t.toString()});return a&&r.set("status",a),e&&r.set("runId",e),`${o}/approvals?${r.toString()}`},approvalsCount:`${o}/approvals?limit=1`,automation:n=>`${o}/${encodeURIComponent(n)}`,automationRuns:(n,i=0,t=25)=>`${o}/${encodeURIComponent(n)}/runs?offset=${i.toString()}&limit=${t.toString()}`,automations:(n={})=>{let{enabled:i,limit:t=25,offset:e=0,search:a,visibility:r}=n,c=new URLSearchParams({limit:t.toString(),offset:e.toString()});i&&i.length>0&&c.set("enabled",i.map(m=>m?"true":"false").join(",")),r&&r.length>0&&c.set("visibility",r.join(","));let g=a?.trim();return g&&c.set("q",g),`${o}?${c.toString()}`},creditBalance:`${o}/credits`,entities:`${o}/entities`,run:n=>`${o}/runs/${encodeURIComponent(n)}`,runHistory:(n,i=0,t=25)=>`${o}/runs?scope=${n}&offset=${i.toString()}&limit=${t.toString()}`,skill:n=>`${l}/${encodeURIComponent(n)}`,skills:(n={})=>{let{limit:i=25,offset:t=0,search:e,visibility:a}=n,r=new URLSearchParams({limit:i.toString(),offset:t.toString()});a&&a.length>0&&r.set("visibility",a.join(","));let c=e?.trim();return c&&r.set("q",c),`${l}?${r.toString()}`},spaces:`/api/flexkit/${s}/spaces`,members:n=>n?`/api/flexkit/${s}/members?spaceId=${encodeURIComponent(n)}`:`/api/flexkit/${s}/members`,tools:n=>n?`${o}/${encodeURIComponent(n)}/tools`:`${o}/tools`}}
|
|
2
|
-
export{S as a,w as b,T as c,_ as d,p as e,k as f,U as g};//# sourceMappingURL=chunk-2HSIWUH3.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-2HSIWUH3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/apps/ai/agent/dictation.ts","../src/apps/ai/api.ts"],"names":["appendDictatedText","existing","transcript","dictated","convertRecordedAudioToPcm","blob","AudioContextCtor","arrayBuffer","audioContext","audioBuffer","mono","mixToMono","resampled","resample","pcm","floatToPcm16","durationSeconds","buffer","length","channelCount","index","sum","channel","samples","sourceRate","targetRate","ratio","outputLength","output","sourceIndex","left","right","fraction","leftSample","rightSample","view","sample","AgentUploadError","status","message","code","getApiRootDomain","hostname","getPlatformOrigin","getWebhookTriggerUrl","projectId","token","createApiClient","projectBasePath","automationsBasePath","skillsBasePath","agentChatsBasePath","request","url","init","response","data","error","input","id","runId","chatId","workflowRunId","title","pluginId","questionId","result","attachments","content","modelId","messageId","monitorId","audio","signal","formData","file","tokenResponse","tokenData","put","approvalId","ids","itemId","state","automationId","skillId","artifactId","options","suffix","provider","connectionId","FetcherError","fetcher","paths","basePath","filter","limit","offset","params","since","query","enabled","search","visibility","value","trimmedSearch","scope","spaceId"],"mappings":"0DAIO,SAASA,CAAAA,CAAmBC,CAAAA,CAAkBC,CAAAA,CAA4B,CAC/E,IAAMC,CAAAA,CAAWD,CAAAA,CAAW,IAAA,EAAK,CAEjC,OAAKC,CAAAA,CAIAF,CAAAA,CAAS,IAAA,EAAK,CAIf,KAAA,CAAM,IAAA,CAAKA,CAAQ,CAAA,EAAK,WAAA,CAAY,IAAA,CAAKE,CAAQ,CAAA,CAC5C,CAAA,EAAGF,CAAQ,CAAA,EAAGE,CAAQ,CAAA,CAAA,CAGxB,CAAA,EAAGF,CAAQ,CAAA,CAAA,EAAIE,CAAQ,CAAA,CAAA,CAPrBF,CAAAA,CAAS,MAAA,GAAW,CAAA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AAA,EAAgBpD,CAAS,CAAA,OAAA,CAAA,CACjC,OAAA,CAAU6D,CAAAA,EACRA,CAAAA,CACI,CAAA,aAAA,EAAgB7D,CAAS,CAAA,iBAAA,EAAoB,kBAAA,CAAmB6D,CAAO,CAAC,CAAA,CAAA,CACxE,CAAA,aAAA,EAAgB7D,CAAS,CAAA,QAAA,CAAA,CAC/B,KAAA,CAAQsC,CAAAA,EACNA,CAAAA,CAAe,CAAA,EAAGU,CAAQ,CAAA,CAAA,EAAI,kBAAA,CAAmBV,CAAY,CAAC,CAAA,MAAA,CAAA,CAAW,CAAA,EAAGU,CAAQ,QACxF,CACF","file":"chunk-2HSIWUH3.js","sourcesContent":["export const DICTATION_SAMPLE_RATE = 24_000;\nexport const DICTATION_MAX_DURATION_SECONDS = 60;\nexport const DICTATION_MIN_DURATION_SECONDS = 0.25;\n\nexport function appendDictatedText(existing: string, transcript: string): string {\n const dictated = transcript.trim();\n\n if (!dictated) {\n return existing;\n }\n\n if (!existing.trim()) {\n return existing.length === 0 ? dictated : `${existing}${dictated}`;\n }\n\n if (/\\s$/.test(existing) || /^[.,!?;:]/.test(dictated)) {\n return `${existing}${dictated}`;\n }\n\n return `${existing} ${dictated}`;\n}\n\nexport async function convertRecordedAudioToPcm(blob: Blob): Promise<{ durationSeconds: number; pcm: Blob }> {\n if (typeof window === 'undefined') {\n throw new Error('Dictation is only available in the browser.');\n }\n\n const AudioContextCtor = window.AudioContext ?? window.webkitAudioContext;\n\n if (!AudioContextCtor) {\n throw new Error('This browser cannot decode recorded audio.');\n }\n\n const arrayBuffer = await blob.arrayBuffer();\n const audioContext = new AudioContextCtor();\n\n try {\n const audioBuffer = await audioContext.decodeAudioData(arrayBuffer.slice(0));\n const mono = mixToMono(audioBuffer);\n const resampled = resample(mono, audioBuffer.sampleRate, DICTATION_SAMPLE_RATE);\n const pcm = floatToPcm16(resampled);\n const durationSeconds = resampled.length / DICTATION_SAMPLE_RATE;\n\n if (durationSeconds < DICTATION_MIN_DURATION_SECONDS) {\n throw new Error('No speech was captured. Try again.');\n }\n\n if (durationSeconds > DICTATION_MAX_DURATION_SECONDS) {\n throw new Error(`Dictation is limited to ${String(DICTATION_MAX_DURATION_SECONDS)} seconds.`);\n }\n\n return {\n durationSeconds,\n pcm: new Blob([pcm], { type: 'audio/pcm' }),\n };\n } finally {\n await audioContext.close();\n }\n}\n\nfunction mixToMono(buffer: AudioBuffer): Float32Array {\n const { length, numberOfChannels: channelCount } = buffer;\n\n if (channelCount === 1) {\n return buffer.getChannelData(0).slice();\n }\n\n const mono = new Float32Array(length);\n\n for (let index = 0; index < length; index += 1) {\n let sum = 0;\n\n for (let channel = 0; channel < channelCount; channel += 1) {\n sum += buffer.getChannelData(channel)[index] ?? 0;\n }\n\n mono[index] = sum / channelCount;\n }\n\n return mono;\n}\n\nfunction resample(samples: Float32Array, sourceRate: number, targetRate: number): Float32Array {\n if (sourceRate === targetRate) {\n return samples;\n }\n\n const ratio = sourceRate / targetRate;\n const outputLength = Math.max(1, Math.round(samples.length / ratio));\n const output = new Float32Array(outputLength);\n\n for (let index = 0; index < outputLength; index += 1) {\n const sourceIndex = index * ratio;\n const left = Math.floor(sourceIndex);\n const right = Math.min(left + 1, samples.length - 1);\n const fraction = sourceIndex - left;\n const leftSample = samples[left] ?? 0;\n const rightSample = samples[right] ?? 0;\n output[index] = leftSample + (rightSample - leftSample) * fraction;\n }\n\n return output;\n}\n\nfunction floatToPcm16(samples: Float32Array): ArrayBuffer {\n const buffer = new ArrayBuffer(samples.length * 2);\n const view = new DataView(buffer);\n\n for (let index = 0; index < samples.length; index += 1) {\n const sample = Math.max(-1, Math.min(1, samples[index] ?? 0));\n view.setInt16(index * 2, sample < 0 ? sample * 0x8000 : sample * 0x7fff, true);\n }\n\n return buffer;\n}\n\ndeclare global {\n interface Window {\n webkitAudioContext?: typeof AudioContext;\n }\n}\n","import type { PluginConnection, PluginScope, PluginTools } from './plugin-types';\nimport { put } from '@vercel/blob/client';\nimport { convertRecordedAudioToPcm } from './agent/dictation';\nimport type {\n ActivityItem,\n ActivityItemState,\n AgentChat,\n AgentChatAttachment,\n AgentChatFollowUpResult,\n AgentChatMessage,\n AgentChatMonitor,\n AgentChatQuestion,\n AgentChatQuestionResponse,\n AgentChatTurn,\n Automation,\n AutomationApproval,\n AutomationApprovalStatus,\n AutomationArtifact,\n AutomationInput,\n AutomationToolChannel,\n AutomationToolProvider,\n AutomationVisibility,\n MutationResult,\n Skill,\n SkillInput,\n} from './types';\n\nexport interface DecideApprovalInput {\n /** Approve and always allow this plugin tool for the automation. */\n remember?: boolean;\n approved: boolean;\n /** For a proposed automation: the approver's edited instructions and whether to run it once now. */\n automationEdits?: { instructions?: string; runOnce?: boolean };\n force?: boolean;\n reason?: string;\n}\n\nexport interface SendAgentChatMessageInput {\n attachments?: AgentChatAttachment[];\n content: string;\n modelId?: string | null;\n}\n\n/** A new chat and its first turn, started by one request. */\nexport interface StartAgentChatResult {\n chat: AgentChat;\n turn: AgentChatTurn;\n}\n\n/** Thrown when the API refuses an upload; `code` lets the UI tailor the message. */\nexport class AgentUploadError 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 = 'AgentUploadError';\n this.code = code;\n this.status = status;\n }\n}\n\nexport interface ApiClient {\n /** Starts OAuth for a new account, or for `connectionId` to reconnect that specific account. */\n connectPlugins: (_input: {\n pluginId: string;\n scope: PluginScope;\n studioOrigin: string;\n connectionId?: string;\n }) => Promise<{ transactionId: string; authorizeUrl: string; completionOrigin: string; launchTicket: string }>;\n /** Renames (label null resets to the provider name) or makes a connection primary. */\n updatePluginConnection: (\n _id: string,\n _input: { label?: string | null; primary?: true }\n ) => Promise<{ connection: PluginConnection }>;\n pluginOAuthStatus: (_id: string) => Promise<{ id: string; status: 'pending' | 'exchanging' | 'complete' | 'failed'; expires_at: string }>;\n disconnectPlugin: (_id: string) => Promise<{ success: boolean }>;\n installPlugin: (_id: string) => Promise<unknown>;\n setPluginPolicy: (_id: string, _input: { enabled: boolean; allowPersonal: boolean }) => Promise<{ success: boolean }>;\n refreshPluginTools: (_id: string) => Promise<PluginTools>;\n\n cancelRun: (_runId: string) => Promise<MutationResult>;\n createAgentChat: (_input?: { modelId?: string | null }) => Promise<{ chat: AgentChat }>;\n deleteAgentChat: (_chatId: string) => Promise<{ success: boolean }>;\n getAgentChatStreamUrl: (_chatId: string, _workflowRunId: string) => string;\n renameAgentChat: (_chatId: string, _title: string) => Promise<{ chat: AgentChat }>;\n sendAgentChatMessage: (_chatId: string, _input: SendAgentChatMessageInput) => Promise<AgentChatTurn>;\n /**\n * Sends a message while the chat's turn is running. The platform decides\n * whether it steers that turn or waits as the next one; if the turn has\n * meanwhile ended, the message starts the next turn.\n */\n sendAgentChatFollowUp: (_chatId: string, _input: SendAgentChatMessageInput) => Promise<AgentChatFollowUpResult>;\n /** The user connected a plugin from the chat's connect card: starts the turn that uses it, or queues it. */\n announcePluginConnected: (\n _chatId: string,\n _pluginId: string\n ) => Promise<Extract<AgentChatFollowUpResult, { followUp: unknown } | { turn: unknown }>>;\n /** Answers (or dismisses) the questions a chat turn waits on; a settled question comes back with an error. */\n answerAgentChatQuestion: (\n _chatId: string,\n _questionId: string,\n _response: AgentChatQuestionResponse\n ) => Promise<{ errorMessage?: string; question?: AgentChatQuestion }>;\n /** Creates a chat and sends its first message in one request. */\n startAgentChat: (_input: SendAgentChatMessageInput) => Promise<StartAgentChatResult>;\n /** Starts the next turn from a queued follow-up once the previous turn has ended. */\n startQueuedAgentChatMessage: (_chatId: string, _messageId: string) => Promise<AgentChatTurn>;\n stopAgentChat: (_chatId: string) => Promise<{ message: AgentChatMessage }>;\n stopAgentChatMonitor: (_chatId: string, _monitorId: string) => Promise<{ monitor: AgentChatMonitor }>;\n transcribeAgentAudio: (_audio: Blob, _signal?: AbortSignal) => Promise<{ text: string }>;\n /** Uploads a chat attachment straight to the platform file store. */\n uploadAgentChatAttachment: (_file: File, _signal?: AbortSignal) => Promise<AgentChatAttachment>;\n decideApproval: (\n _approvalId: string,\n _input: DecideApprovalInput\n ) => Promise<MutationResult & { approval?: AutomationApproval }>;\n createAutomation: (_input: AutomationInput) => Promise<MutationResult & { automation?: Automation }>;\n createSkill: (_input: SkillInput) => Promise<MutationResult & { skill?: Skill }>;\n deleteAutomation: (_automationId: string) => Promise<MutationResult>;\n deleteSkill: (_skillId: string) => Promise<MutationResult>;\n getArtifactUrl: (_artifactId: string, _options?: { download?: boolean }) => string;\n getRunArtifacts: (_workflowRunId: string) => Promise<AutomationArtifact[]>;\n getStreamUrl: (_workflowRunId: string) => string;\n /** JSON transcript of a finished run (owners and developers). */\n getTranscriptUrl: (_runId: string) => string;\n /** Lists delivery channels of `connectionId`, or of the provider's primary project account when omitted. */\n listChannels: (_provider: AutomationToolProvider, _connectionId?: string | null) => Promise<{\n channels: AutomationToolChannel[];\n errorMessage?: string;\n success: boolean;\n }>;\n runAutomation: (_automationId: string) => Promise<MutationResult & { runId?: string }>;\n updateAutomation: (\n _automationId: string,\n _input: AutomationInput\n ) => Promise<MutationResult & { automation?: Automation }>;\n updateSkill: (_skillId: string, _input: SkillInput) => Promise<MutationResult & { skill?: Skill }>;\n /** Marks the caller's Activity items read; `'all'` marks every unread item. */\n markActivityRead: (_ids: string[] | 'all') => Promise<{ success: boolean }>;\n setActivityItemState: (\n _itemId: string,\n _state: Extract<ActivityItemState, 'unread' | 'read' | 'dismissed'>\n ) => Promise<{ item: ActivityItem }>;\n}\n\n\nfunction getApiRootDomain(): string {\n if (typeof window === 'undefined') {\n return 'flexkit.io';\n }\n\n const { hostname } = window.location;\n const isDevHost =\n hostname === 'localhost' ||\n hostname === '127.0.0.1' ||\n hostname === 'flexkit.test' ||\n hostname.endsWith('.flexkit.test');\n\n return isDevHost ? 'flexkit.test' : 'flexkit.io';\n}\n\n/** Origin that hosts plugin OAuth start and completion. */\nexport function getPlatformOrigin(): string {\n return `https://${getApiRootDomain()}`;\n}\n\n/** Public URL an external system calls to fire a webhook trigger. */\nexport function getWebhookTriggerUrl(projectId: string, token: string): string {\n return `https://${projectId}.api.${getApiRootDomain()}/automations/webhook/${encodeURIComponent(token)}`;\n}\n\nexport function createApiClient(projectId: string): ApiClient {\n const projectBasePath = `/api/flexkit/${projectId}`;\n const automationsBasePath = `${projectBasePath}/automations`;\n const skillsBasePath = `${projectBasePath}/skills`;\n const agentChatsBasePath = `${projectBasePath}/agent/chats`;\n\n async function request<T>(url: string, init?: RequestInit): Promise<T> {\n const response = await fetch(url, {\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n ...(init?.headers ?? {}),\n },\n ...init,\n });\n const data = (await response.json()) as T;\n\n if (!response.ok) {\n const error = data && typeof data === 'object' && 'error' in data ? String(data.error) : 'Request failed';\n\n throw new Error(error);\n }\n\n return data;\n }\n\n return {\n connectPlugins: (input) => request(`${projectBasePath}/plugins/connect`, { method: 'POST', body: JSON.stringify(input) }),\n pluginOAuthStatus: (id) => request(`${projectBasePath}/plugins/oauth-transactions/${encodeURIComponent(id)}`),\n updatePluginConnection: (id, input) =>\n request(`${projectBasePath}/plugin-connections/${encodeURIComponent(id)}`, { method: 'PATCH', body: JSON.stringify(input) }),\n disconnectPlugin: (id) => request(`${projectBasePath}/plugin-connections/${encodeURIComponent(id)}`, { method: 'DELETE' }),\n installPlugin: (id) => request(`${projectBasePath}/plugins/${encodeURIComponent(id)}/installation`, { method: 'PUT', body: JSON.stringify({}) }),\n setPluginPolicy: (id, input) => request(`${projectBasePath}/plugins/${encodeURIComponent(id)}/policy`, { method: 'PATCH', body: JSON.stringify(input) }),\n refreshPluginTools: (id) => request(`${projectBasePath}/plugin-connections/${encodeURIComponent(id)}/tools/refresh`, { method: 'POST' }),\n cancelRun: async (runId) =>\n request<MutationResult>(`${automationsBasePath}/runs/${encodeURIComponent(runId)}/cancel`, { method: 'POST' }),\n createAgentChat: async (input) =>\n request<{ chat: AgentChat }>(agentChatsBasePath, {\n body: JSON.stringify({ modelId: input?.modelId ?? null }),\n method: 'POST',\n }),\n deleteAgentChat: async (chatId) =>\n request<{ success: boolean }>(`${agentChatsBasePath}/${encodeURIComponent(chatId)}`, { method: 'DELETE' }),\n getAgentChatStreamUrl: (chatId, workflowRunId) =>\n `${agentChatsBasePath}/${encodeURIComponent(chatId)}/stream?workflowRunId=${encodeURIComponent(workflowRunId)}`,\n renameAgentChat: async (chatId, title) =>\n request<{ chat: AgentChat }>(`${agentChatsBasePath}/${encodeURIComponent(chatId)}`, {\n body: JSON.stringify({ title }),\n method: 'PATCH',\n }),\n sendAgentChatMessage: async (chatId, input) =>\n request<AgentChatTurn>(`${agentChatsBasePath}/${encodeURIComponent(chatId)}/messages`, {\n body: JSON.stringify(input),\n method: 'POST',\n }),\n announcePluginConnected: async (chatId, pluginId) =>\n request(`${agentChatsBasePath}/${encodeURIComponent(chatId)}/plugin-connected`, {\n body: JSON.stringify({ pluginId }),\n method: 'POST',\n }),\n sendAgentChatFollowUp: async (chatId, input) =>\n request<AgentChatFollowUpResult>(`${agentChatsBasePath}/${encodeURIComponent(chatId)}/follow-ups`, {\n body: JSON.stringify(input),\n method: 'POST',\n }),\n answerAgentChatQuestion: async (chatId, questionId, response) => {\n const result = await fetch(\n `${agentChatsBasePath}/${encodeURIComponent(chatId)}/questions/${encodeURIComponent(questionId)}/answer`,\n {\n body: JSON.stringify(response),\n credentials: 'include',\n headers: { 'Content-Type': 'application/json' },\n method: 'POST',\n }\n );\n const data = (await result.json()) as { errorMessage?: string; error?: string; question?: AgentChatQuestion };\n\n // A question settled elsewhere (409) comes back with its final state for the card to show.\n if (!result.ok && !data.question) {\n throw new Error(data.errorMessage ?? data.error ?? 'Request failed');\n }\n\n return { errorMessage: result.ok ? undefined : data.errorMessage, question: data.question };\n },\n startAgentChat: async ({ attachments, content, modelId }) =>\n request<StartAgentChatResult>(agentChatsBasePath, {\n body: JSON.stringify({ message: { attachments, content }, modelId: modelId ?? null }),\n method: 'POST',\n }),\n startQueuedAgentChatMessage: async (chatId, messageId) =>\n request<AgentChatTurn>(\n `${agentChatsBasePath}/${encodeURIComponent(chatId)}/follow-ups/${encodeURIComponent(messageId)}/start`,\n { method: 'POST' }\n ),\n stopAgentChat: async (chatId) =>\n request<{ message: AgentChatMessage }>(`${agentChatsBasePath}/${encodeURIComponent(chatId)}/stop`, {\n method: 'POST',\n }),\n stopAgentChatMonitor: async (chatId, monitorId) =>\n request<{ monitor: AgentChatMonitor }>(\n `${agentChatsBasePath}/${encodeURIComponent(chatId)}/monitors/${encodeURIComponent(monitorId)}/stop`,\n { method: 'POST' }\n ),\n transcribeAgentAudio: async (audio, signal) => {\n const { durationSeconds, pcm } = await convertRecordedAudioToPcm(audio);\n const formData = new FormData();\n formData.append('file', pcm, 'audio.pcm');\n formData.append('durationSeconds', String(durationSeconds));\n\n const response = await fetch(`${projectBasePath}/agent/transcribe`, {\n body: formData,\n credentials: 'include',\n method: 'POST',\n signal,\n });\n const data = (await response.json()) as { error?: string; text?: string };\n\n if (!response.ok) {\n const error = data && typeof data === 'object' && data.error ? String(data.error) : 'Request failed';\n\n throw new Error(error);\n }\n\n if (!data.text?.trim()) {\n throw new Error('No speech was recognized. Try again.');\n }\n\n return { text: data.text };\n },\n uploadAgentChatAttachment: async (file, signal) => {\n // The platform issues a token scoped to one pathname, type and size; the\n // browser then writes the bytes to the store directly, so large files\n // never pass through the API function body limit.\n const tokenResponse = await fetch(`${projectBasePath}/agent/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,\n });\n const tokenData = (await tokenResponse.json()) as {\n code?: string;\n error?: string;\n mediaType?: string;\n pathname?: string;\n token?: string;\n };\n\n if (!tokenResponse.ok || !tokenData.pathname || !tokenData.token || !tokenData.mediaType) {\n throw new AgentUploadError(\n tokenResponse.status,\n tokenData.error ? String(tokenData.error) : 'The file could not be uploaded.',\n tokenData.code ?? null\n );\n }\n\n const blob = await put(tokenData.pathname, file, {\n abortSignal: signal,\n access: 'public',\n contentType: tokenData.mediaType,\n token: tokenData.token,\n });\n\n return {\n filename: file.name,\n mediaType: tokenData.mediaType,\n sizeBytes: file.size,\n url: blob.url,\n };\n },\n decideApproval: async (approvalId, input) => {\n const response = await fetch(`${automationsBasePath}/approvals/${encodeURIComponent(approvalId)}/decide`, {\n body: JSON.stringify(input),\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n });\n const data = (await response.json()) as MutationResult & { approval?: AutomationApproval; error?: string };\n\n // Business errors (stale_preview, already_decided) come back as 400\n // with a structured body the caller must be able to inspect.\n if (!response.ok && typeof data.success !== 'boolean') {\n throw new Error(data.error ? String(data.error) : 'Request failed');\n }\n\n return data;\n },\n markActivityRead: async (ids) =>\n request<{ success: boolean }>(`${projectBasePath}/activity/read`, {\n body: JSON.stringify(ids === 'all' ? { all: true } : { ids }),\n method: 'POST',\n }),\n setActivityItemState: async (itemId, state) =>\n request<{ item: ActivityItem }>(`${projectBasePath}/activity/${encodeURIComponent(itemId)}`, {\n body: JSON.stringify({ state }),\n method: 'PATCH',\n }),\n createAutomation: async (input) =>\n request<MutationResult & { automation?: Automation }>(automationsBasePath, {\n body: JSON.stringify(input),\n method: 'POST',\n }),\n createSkill: async (input) =>\n request<MutationResult & { skill?: Skill }>(skillsBasePath, {\n body: JSON.stringify(input),\n method: 'POST',\n }),\n deleteAutomation: async (automationId) =>\n request<MutationResult>(`${automationsBasePath}/${encodeURIComponent(automationId)}`, { method: 'DELETE' }),\n deleteSkill: async (skillId) =>\n request<MutationResult>(`${skillsBasePath}/${encodeURIComponent(skillId)}`, { method: 'DELETE' }),\n getArtifactUrl: (artifactId, options) => {\n const suffix = options?.download ? '?download=1' : '';\n\n return `${automationsBasePath}/artifacts/${encodeURIComponent(artifactId)}/content${suffix}`;\n },\n getRunArtifacts: async (workflowRunId) =>\n request<{ artifacts: AutomationArtifact[] }>(\n `${automationsBasePath}/runs/${encodeURIComponent(workflowRunId)}/artifacts`\n ).then((response) => response.artifacts),\n getStreamUrl: (workflowRunId) => `${automationsBasePath}/runs/${encodeURIComponent(workflowRunId)}/stream`,\n getTranscriptUrl: (runId) => `${automationsBasePath}/runs/${encodeURIComponent(runId)}/transcript`,\n listChannels: async (provider, connectionId) => {\n const url = connectionId\n ? `${projectBasePath}/plugin-connections/${encodeURIComponent(connectionId)}/channels`\n : `${projectBasePath}/plugins/${provider}/channels`;\n const response = await fetch(url, {\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n const data = (await response.json()) as {\n channels?: AutomationToolChannel[];\n error?: string;\n errorMessage?: string;\n success?: boolean;\n };\n\n if (response.ok) {\n return {\n channels: data.channels ?? [],\n errorMessage: data.errorMessage,\n success: data.success ?? true,\n };\n }\n\n if (data.success === false) {\n return {\n channels: data.channels ?? [],\n errorMessage: data.errorMessage ?? `Failed to load ${provider === 'slack' ? 'Slack' : 'Teams'} channels.`,\n success: false,\n };\n }\n\n const error = data.error ? String(data.error) : 'Request failed';\n\n throw new Error(error);\n },\n runAutomation: async (automationId) =>\n request<MutationResult & { runId?: string }>(`${automationsBasePath}/${encodeURIComponent(automationId)}/runs`, {\n method: 'POST',\n }),\n updateAutomation: async (automationId, input) =>\n request<MutationResult & { automation?: Automation }>(\n `${automationsBasePath}/${encodeURIComponent(automationId)}`,\n {\n body: JSON.stringify(input),\n method: 'PATCH',\n }\n ),\n updateSkill: async (skillId, input) =>\n request<MutationResult & { skill?: Skill }>(`${skillsBasePath}/${encodeURIComponent(skillId)}`, {\n body: JSON.stringify(input),\n method: 'PATCH',\n }),\n };\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 paths(projectId: string): {\n activity: (_options?: { filter?: 'all' | 'needs_action'; limit?: number; offset?: number }) => string;\n activityItem: (_itemId: string) => string;\n /** Badge counts; with `since`, also the unread items created after it. */\n activitySummary: (_since?: string | null) => string;\n agentChat: (_chatId: string) => string;\n agentChatSearch: (_query: string) => string;\n agentChats: (_offset?: number) => string;\n agentProfile: () => string;\n approval: (_approvalId: string) => string;\n approvals: (_options?: {\n limit?: number;\n offset?: number;\n runId?: string;\n status?: AutomationApprovalStatus;\n }) => string;\n approvalsCount: string;\n automation: (_automationId: string) => string;\n automationRuns: (_automationId: string, _offset?: number, _limit?: number) => string;\n automations: (_options?: {\n enabled?: boolean[];\n limit?: number;\n offset?: number;\n search?: string;\n visibility?: AutomationVisibility[];\n }) => string;\n creditBalance: string;\n entities: string;\n run: (_runId: string) => string;\n runHistory: (_scope: 'mine' | 'team', _offset?: number, _limit?: number) => string;\n skill: (_skillId: string) => string;\n skills: (_options?: { limit?: number; offset?: number; search?: string; visibility?: AutomationVisibility[] }) => string;\n spaces: string;\n /** Members for pickers; with a space id, only members who can see that space. */\n members: (_spaceId?: string | null) => string;\n tools: (_automationId?: string) => string;\n} {\n const basePath = `/api/flexkit/${projectId}/automations`;\n const skillsBasePath = `/api/flexkit/${projectId}/skills`;\n const agentChatsBasePath = `/api/flexkit/${projectId}/agent/chats`;\n\n return {\n activity: (options = {}) => {\n const { filter = 'all', limit = 25, offset = 0 } = options;\n const params = new URLSearchParams({ filter, limit: limit.toString(), offset: offset.toString() });\n\n return `/api/flexkit/${projectId}/activity?${params.toString()}`;\n },\n activityItem: (itemId) => `/api/flexkit/${projectId}/activity/${encodeURIComponent(itemId)}`,\n activitySummary: (since) =>\n since\n ? `/api/flexkit/${projectId}/activity/summary?since=${encodeURIComponent(since)}`\n : `/api/flexkit/${projectId}/activity/summary`,\n agentChat: (chatId) => `${agentChatsBasePath}/${encodeURIComponent(chatId)}`,\n agentChatSearch: (query) => `${agentChatsBasePath}/search?q=${encodeURIComponent(query)}`,\n agentChats: (offset = 0) => `${agentChatsBasePath}?offset=${offset.toString()}`,\n agentProfile: () => `/api/flexkit/${projectId}/agent/profile`,\n approval: (approvalId) => `${basePath}/approvals/${encodeURIComponent(approvalId)}`,\n approvals: (options = {}) => {\n const { limit = 25, offset = 0, runId, status } = options;\n const params = new URLSearchParams({\n limit: limit.toString(),\n offset: offset.toString(),\n });\n\n if (status) {\n params.set('status', status);\n }\n\n if (runId) {\n params.set('runId', runId);\n }\n\n return `${basePath}/approvals?${params.toString()}`;\n },\n approvalsCount: `${basePath}/approvals?limit=1`,\n automation: (automationId) => `${basePath}/${encodeURIComponent(automationId)}`,\n automationRuns: (automationId, offset = 0, limit = 25) =>\n `${basePath}/${encodeURIComponent(automationId)}/runs?offset=${offset.toString()}&limit=${limit.toString()}`,\n automations: (options = {}) => {\n const { enabled, limit = 25, offset = 0, search, visibility } = options;\n const params = new URLSearchParams({\n limit: limit.toString(),\n offset: offset.toString(),\n });\n\n if (enabled && enabled.length > 0) {\n params.set('enabled', enabled.map((value) => (value ? 'true' : 'false')).join(','));\n }\n\n if (visibility && visibility.length > 0) {\n params.set('visibility', visibility.join(','));\n }\n\n const trimmedSearch = search?.trim();\n\n if (trimmedSearch) {\n params.set('q', trimmedSearch);\n }\n\n return `${basePath}?${params.toString()}`;\n },\n creditBalance: `${basePath}/credits`,\n entities: `${basePath}/entities`,\n run: (runId) => `${basePath}/runs/${encodeURIComponent(runId)}`,\n runHistory: (scope, offset = 0, limit = 25) =>\n `${basePath}/runs?scope=${scope}&offset=${offset.toString()}&limit=${limit.toString()}`,\n skill: (skillId) => `${skillsBasePath}/${encodeURIComponent(skillId)}`,\n skills: (options = {}) => {\n const { limit = 25, offset = 0, search, visibility } = options;\n const params = new URLSearchParams({\n limit: limit.toString(),\n offset: offset.toString(),\n });\n\n if (visibility && visibility.length > 0) {\n params.set('visibility', visibility.join(','));\n }\n\n const trimmedSearch = search?.trim();\n\n if (trimmedSearch) {\n params.set('q', trimmedSearch);\n }\n\n return `${skillsBasePath}?${params.toString()}`;\n },\n spaces: `/api/flexkit/${projectId}/spaces`,\n members: (spaceId) =>\n spaceId\n ? `/api/flexkit/${projectId}/members?spaceId=${encodeURIComponent(spaceId)}`\n : `/api/flexkit/${projectId}/members`,\n tools: (automationId) =>\n automationId ? `${basePath}/${encodeURIComponent(automationId)}/tools` : `${basePath}/tools`,\n };\n}\n"]}
|
package/dist/chunk-CJGP4Y5Y.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {q as q$1,o,r}from'./chunk-TOY7ZRK2.js';import {f}from'./chunk-CWJWOJRO.js';import {e}from'./chunk-TYDYAOQ7.js';import {useCallback}from'react';import {toast}from'sonner';import {useApolloClient}from'@apollo/client/react';function E(i){let{currentProjectSchema:t}=f();return useCallback(a=>{t&&q$1(o(i,t),a);},[i,t])}var g=["image/jpeg","image/png","image/webp","image/vnd.microsoft.icon","image/bmp","image/gif","image/tiff","image/svg+xml","image/avif","image/heic","image/heif","image/heic-sequence","image/heif-sequence","image/apng","audio/aac","audio/mpeg","audio/wav","audio/webm","audio/midi","audio/x-midi","audio/ogg","video/x-msvideo","video/mp4","video/mpeg","video/webm","video/quicktime","video/ogg","video/mp2t","video/3gpp","video/3gpp2","application/x-7z-compressed","application/zip","application/vnd.amazon.ebook","application/octet-stream","application/epub+zip","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-fontobject","application/gzip","application/x-gzip","application/java-archive","application/json","application/ld+json","text/javascript","application/vnd.oasis.opendocument.presentation","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.text","application/ogg","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.rar","application/x-tar","application/vnd.visio","application/xhtml+xml","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/xml"];function F(i,t){if(!i.type)return true;let a=t?t.split(",").map(e=>e.trim()).filter(Boolean):g;return a.length===0?true:a.some(e=>e.endsWith("/*")?i.type.startsWith(e.slice(0,-1)):i.type===e)}async function x(i,t){let a=new URLSearchParams({filename:i.name}),e$1=await fetch(`${e(t).assets}?${a.toString()}`,{method:"POST",headers:{"Content-Type":i.type||"application/octet-stream"},body:i});if(!e$1.ok)throw new Error(`Upload failed for ${i.name}`);let n=await e$1.json(),o={_id:n._id,path:n.path??"",originalFilename:n.originalFilename??i.name,size:n.size??i.size,mimeType:n.mimeType??i.type,lqip:n.lqip??"",width:n.width??0,height:n.height??0};return {pathname:o.path,lqip:o.lqip||void 0,originalFilename:o.originalFilename,size:o.size,mimeType:o.mimeType,width:o.width||void 0,height:o.height||void 0,_id:o._id,asset:o}}async function h(i,t){let{projectId:a,accept:e,maxBytes:n=4*1024*1024,onUploadStart:o}=t,l=[];for(let p of Array.from(i)){if(p.size>n){toast.error(`File size too big (max ${(n/(1024*1024)).toFixed(0)}MB): ${p.name}`);continue}if(!F(p,e)){toast.error(`Unsupported file type: ${p.name}`);continue}l.push(p);}if(l.length===0)return [];o?.();try{let p=await Promise.all(l.map(async f=>x(f,a)));return p.length>0&&toast.success(`Uploaded ${p.length} file${p.length>1?"s":""}`),p}catch(p){return console.error(p),toast.error("Upload failed. Please try again."),[]}}async function b(i){let{accept:t,multiple:a=true}=i,e=document.createElement("input");e.type="file",e.accept=t??g.join(","),e.multiple=a,e.style.display="none",document.body.appendChild(e);try{let n=await new Promise(o=>{e.addEventListener("change",()=>o(e.files),{once:!0}),e.addEventListener("cancel",()=>o(null),{once:!0}),e.click();});return !n||n.length===0?[]:h(n,i)}finally{document.body.removeChild(e);}}function q(){let i=useApolloClient();return useCallback(async t=>{let a=t.files?await h(t.files,t):await b(t);return a.length>0&&await r(i,"GetAssets").catch(e=>{console.error("Error refreshing asset lists after upload:",e);}),a},[i])}export{E as a,x as b,q as c};//# sourceMappingURL=chunk-CJGP4Y5Y.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-CJGP4Y5Y.js.map
|
package/dist/chunk-CWJWOJRO.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {h,e}from'./chunk-TYDYAOQ7.js';import {b as b$1}from'./chunk-U45E5X3H.js';import {createContext,lazy,Suspense,useMemo,useContext}from'react';import {Navigate,useParams}from'react-router-dom';import {Bot,Layout,FileStack,SquarePlay}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';import C,{mutate}from'swr';var d={name:"_asset",plural:"_assets",display:"originalFilename",menu:{hidden:true},attributes:[{name:"path",label:"Asset",scope:"global",options:{size:140},dataType:"string",inputType:"text",previewType:"assetPreviewField",defaultValue:""},{name:"originalFilename",label:"Filename",scope:"global",options:{size:320},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"size",label:"Size",scope:"global",options:{size:120},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"width",label:"Width",scope:"global",options:{size:90},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"height",label:"Height",scope:"global",options:{size:100},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"mimeType",label:"Mime Type",scope:"global",options:{size:160},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"lqip",label:"lqip",scope:"global",hidden:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"url",label:"URL",scope:"global",hidden:true,readOnly:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"tags",label:"Tags",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",previewType:"tags",options:{size:300},relationship:{mode:"multiple",field:"name",entity:"_tag"}}]};var f={name:"_tag",plural:"_tags",display:"name",menu:{hidden:true},attributes:[{name:"name",label:"Tag Name",scope:"global",options:{size:220},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"assets",label:"Assets",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",relationship:{mode:"multiple",field:"originalFilename",entity:"_asset"}}]};function x(){let{resolvedTheme:e}=b$1();return jsx("div",{className:"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background",children:jsxs("div",{className:"fk:flex fk:flex-col fk:items-center",children:[e==="dark"?jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"#020817"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"white"})]}):jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"white"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"#020817"})]}),jsx("div",{className:"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse",children:"Loading..."})]})})}var _=Navigate;function o(e){let t=lazy(e);return jsx(Suspense,{fallback:jsx(x,{}),children:jsx(t,{})})}var B=o(()=>import('./root-5RDJ2HAV.js').then(e=>({default:e.Root}))),J=o(()=>import('./list-4NZLZRX3.js').then(e=>({default:e.List}))),W=o(()=>import('./edit-entity-PVT34FD7.js').then(e=>({default:e.EditEntity}))),X=o(()=>import('./root-NCLIQPJA.js').then(e=>({default:e.Root}))),q=o(()=>import('./root-4XPMKRHZ.js').then(e=>({default:e.Root}))),K=o(()=>import('./root-OHZDY47O.js').then(e=>({default:e.Root}))),$=o(()=>import('./plugin-pages-RNB46YPQ.js').then(e=>({default:e.PluginsPage}))),G=o(()=>import('./plugin-pages-RNB46YPQ.js').then(e=>({default:e.InstalledPluginsPage}))),Q=o(()=>import('./plugin-pages-RNB46YPQ.js').then(e=>({default:e.PluginDetailPage}))),T=o(()=>import('./chat-page-B2IOPTUP.js').then(e=>({default:e.AgentChatPage}))),Y=o(()=>import('./pages-7MFZAVLV.js').then(e=>({default:e.AutomationsPage}))),ee=o(()=>import('./pages-7MFZAVLV.js').then(e=>({default:e.RunHistoryPage}))),te=o(()=>import('./pages-7MFZAVLV.js').then(e=>({default:e.ApprovalsPage}))),oe=o(()=>import('./pages-7MFZAVLV.js').then(e=>({default:e.ActivityPage}))),ae=o(()=>import('./pages-7MFZAVLV.js').then(e=>({default:e.ActivityItemPage}))),ne=o(()=>import('./pages-7MFZAVLV.js').then(e=>({default:e.CreateAutomationPage}))),ie=o(()=>import('./pages-7MFZAVLV.js').then(e=>({default:e.AutomationDetailPage}))),re=o(()=>import('./pages-7MFZAVLV.js').then(e=>({default:e.RunsPage}))),se=o(()=>import('./pages-7MFZAVLV.js').then(e=>({default:e.RunDetailPage}))),pe=o(()=>import('./skills-pages-VCXZFQFD.js').then(e=>({default:e.SkillsPage}))),ce=o(()=>import('./skills-pages-VCXZFQFD.js').then(e=>({default:e.CreateSkillPage}))),le=o(()=>import('./skills-pages-VCXZFQFD.js').then(e=>({default:e.SkillDetailPage}))),l=[{name:"ai",icon:jsx(Bot,{strokeWidth:1.5}),title:"AI",component:K,routes:[{path:"plugins",component:$},{path:"plugins/installed",component:G},{path:"plugins/:pluginId",component:Q},{component:jsx(_,{replace:true,to:"agent"}),path:""},{component:T,path:"agent"},{component:T,path:"agent/chats/:chatId"},{component:Y,path:"automations"},{component:ee,path:"runs"},{component:te,path:"approvals"},{component:oe,path:"activity"},{component:ae,path:"activity/:itemId"},{component:ne,path:"automations/new"},{component:ie,path:"automations/:automationId"},{component:re,path:"automations/:automationId/runs"},{component:se,path:"automations/:automationId/runs/:runId"},{component:pe,path:"skills"},{component:ce,path:"skills/new"},{component:le,path:"skills/:skillId"}]},{name:"desk",icon:jsx(Layout,{strokeWidth:1.5}),title:"Desk",component:B,routes:[{path:"list/:entity",component:J,children:[{path:"edit/:id",component:W}]}]},{name:"asset-manager",icon:jsx(FileStack,{strokeWidth:1.5}),title:"Asset Manager",component:X,routes:[]},{name:"explorer",icon:jsx(SquarePlay,{strokeWidth:1.5}),title:"Explorer",component:q,routes:[]}];async function b(e$1){try{let t=await fetch(e(e$1).schema,{credentials:"include",mode:"cors"});if(!t.ok){let n=t.statusText||`Request failed with status ${String(t.status)}`;try{let i=await t.json();n=i.error??i.message??n;}catch{}return {ok:!1,projectId:e$1,error:{status:t.status,message:n}}}let a=await t.json();return {ok:!0,project:{...a,projectId:a.projectId||e$1}}}catch(t){return {ok:false,projectId:e$1,error:{status:0,message:t instanceof Error?t.message:"Network error"}}}}function w(e,t){let a=[],n={};for(let i of e??[])i.ok?a.push(i.project):n[i.projectId]=i.error;return {projects:a,errors:n,isLoading:t}}function A(e,t){let a=t&&e.length>0?["project-schemas",t,...e]:null,{data:n,isLoading:i}=C(a,()=>Promise.all(e.map(s=>b(s))),{revalidateOnFocus:false,revalidateOnReconnect:false});return w(n,!!a&&(i||n===void 0))}function ue(e,t){return w(e?[e]:void 0,t)}function L(e,t){let a=t&&e?["project-schema",t,e]:null,{data:n,isLoading:i}=C(a,()=>b(e??""),{revalidateOnFocus:false,revalidateOnReconnect:false});return ue(n,!!a&&(i||n===void 0))}function de(e,t){return Array.isArray(e)&&(e[0]==="project-schema"||e[0]==="project-schemas")&&e.slice(2).includes(t)}function Re(e){return mutate(t=>de(t,e))}var I=createContext({mode:"projects",apps:l,contributions:{apps:l},currentProjectId:void 0,currentProject:void 0,currentProjectSchema:[],projects:[],projectIds:[],projectSummaries:[],schemaErrors:{},isLoadingSchemas:false});function ye(e){return [...e.filter(a=>a.name!==d.name&&a.name!==f.name),d,f]}function De({projectIds:e,projectSummaries:t=[],mode:a="projects",userId:n,children:i}){let{projectId:s}=useParams(),[,R]=h(),h$1=R.user?.id??n,V=A(a==="projects"?e:[],h$1),O=L(a==="hosted"&&s&&e.includes(s)?s:void 0,h$1),{projects:y,errors:P,isLoading:S}=a==="hosted"?O:V,m=useMemo(()=>e.map(r=>y.find(u=>u.projectId===r)).filter(r=>r!==void 0).map(r=>({...r,schema:ye(r.schema)})),[y,e]),H=useMemo(()=>{let r=m.find(u=>u.projectId===s);return {mode:a,apps:l,contributions:{apps:l},currentProjectId:s,currentProject:r,currentProjectSchema:r?.schema??[],projects:m,projectIds:e,projectSummaries:t,schemaErrors:P,isLoadingSchemas:S}},[s,P,S,a,e,t,m]);return jsx(I.Provider,{value:H,children:i})}function Ze(){return useContext(I)}
|
|
2
|
-
export{x as a,d as b,f as c,Re as d,De as e,Ze as f};//# sourceMappingURL=chunk-CWJWOJRO.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-CWJWOJRO.js.map
|
package/dist/chunk-ETQ3Q472.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {c,e as e$1}from'./chunk-P6BZ4QP7.js';import {f}from'./chunk-CWJWOJRO.js';import {e}from'./chunk-TYDYAOQ7.js';import {useMemo}from'react';import A from'swr';import {find,propEq}from'ramda';function T(n,i){let{scope:c$1}=c(),{currentProject:e$1}=f(),o=useMemo(()=>e$1?.schema??[],[e$1]),a=e$1?.scopes?.find(t=>t.isDefault)?.name??"default",m=i?.commonParams.q?JSON.stringify(i):null,{data:r,error:s,isLoading:y}=A(m,()=>fetch(e(n).search,{headers:{"Content-Type":"application/json"},body:JSON.stringify(i),method:"POST",mode:"cors"}).then(t=>t.json()));return {results:useMemo(()=>E(r?.results??[],n,o,c$1,a)??[],[r,a,n,o,c$1]),error:s,isLoading:y}}function E(n,i,c,e,o){return n?.filter(l=>l?.hits?.length>0).map(l=>{let a=l,m=a.collection.replace(`${i}_`,"").replace(/_\d+$/,""),r=find(propEq(m,"plural"))(c);if(!r)return [];let s=e$1(r)?.name??"",y=r?.name??m;return a.hits.map(({document:u})=>{let t=u[s],b=(t&&typeof t!="string"?t[e]??t[o]:null)??u[s],N=Object.entries(u).reduce((d,[p,f])=>{if(p!==s&&p!=="id"&&p!=="_updatedAt"){let _=typeof f!="string"?f[e]??f[o]:f;d[p]=_;}return d},{});return {_id:u.id,_entityName:y,_entityNamePlural:m,[s]:b,...N}})}).flat()}export{T as a};//# sourceMappingURL=chunk-ETQ3Q472.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-ETQ3Q472.js.map
|
package/dist/chunk-KXAGLQ2B.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {b}from'./chunk-2HSIWUH3.js';var T="/plugins/oauth/start",g=class extends Error{code="account_mismatch";constructor(){super('You signed in with a different account. Use "Connect another account" to add it.'),this.name="PluginAccountMismatchError";}};function y(o){let e;try{e=new URL(o);}catch{return null}return e.protocol!=="https:"||e.username!==""||e.password!==""?null:e}function E(o,e){let s=b(),r=y(o),n=y(e);return !r||!n||r.origin!==s||r.pathname!==T||n.origin!==s||n.pathname!=="/"?null:{href:r.href,origin:s}}async function C(o,e,s,r){let n=window.open("about:blank",`flexkit-plugin-${crypto.randomUUID()}`,"popup,width=560,height=720");if(!n)throw new Error("Allow popups for Studio, then connect again.");let i;try{i=await o.connectPlugins({pluginId:e,scope:s,studioOrigin:window.location.origin,...r?.connectionId?{connectionId:r.connectionId}:{}});}catch(d){throw n.close(),d}let l=E(i.authorizeUrl,i.completionOrigin);if(!l)throw n.close(),new Error("Connection could not be started.");let f=l.origin;await new Promise((d,I)=>{let u=false,p=false,c=t=>{if(!p){if(p=true,window.clearInterval(A),window.clearTimeout(P),window.removeEventListener("message",h),n.close(),t){I(t);return}d();}},w=async()=>{if(u||p)return;u=true;let t;try{t=await o.pluginOAuthStatus(i.transactionId);}catch{u=false;return}if(u=false,t.status==="complete"){c();return}if(n.closed&&t.status==="pending"){c(new Error("Connection window was closed."));return}(t.status==="failed"||new Date(t.expires_at).getTime()<Date.now())&&c(new Error("Connection was not completed. Please try again."));},h=t=>{if(t.origin!==f||t.source!==n||!t.data||typeof t.data!="object")return;let a=t.data;if(a.type==="flexkit:plugin-oauth-ready"&&a.transactionId===i.transactionId){n.postMessage({type:"flexkit:plugin-oauth-start",transactionId:i.transactionId,ticket:i.launchTicket},f);return}if(a.type==="flexkit:plugin-oauth"&&a.transactionId===i.transactionId){if(a.status==="failed"&&a.error==="account_mismatch"){c(new g);return}w();}},A=window.setInterval(()=>{w();},2e3),P=window.setTimeout(()=>c(new Error("Connection timed out. Please try again.")),6e5);window.addEventListener("message",h),n.location.href=l.href;});}export{g as a,C as b};//# sourceMappingURL=chunk-KXAGLQ2B.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-KXAGLQ2B.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/apps/ai/plugin-oauth.ts"],"names":["OAUTH_START_PATH","PluginAccountMismatchError","httpsUrl","value","url","trustedPluginOAuthTargets","authorizeUrl","completionOrigin","origin","getPlatformOrigin","authorize","completion","connectPluginPopup","api","pluginId","scope","options","popup","transaction","error","targets","expectedOrigin","resolve","reject","polling","finished","finish","interval","timeout","onMessage","poll","status","event","payload"],"mappings":"wDAGA,IAAMA,CAAAA,CAAmB,uBAGZC,CAAAA,CAAN,cAAyC,KAAM,CAC3C,IAAA,CAAO,mBAEhB,WAAA,EAAc,CACZ,MAAM,kFAAkF,CAAA,CACxF,KAAK,IAAA,CAAO,6BACd,CACF,EAEA,SAASC,CAAAA,CAASC,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PluginScope } from './plugin-types';\n\nconst OAUTH_START_PATH = '/plugins/oauth/start';\n\n/** A Reconnect was completed with a different provider account than the one being reconnected. */\nexport class PluginAccountMismatchError extends Error {\n readonly code = 'account_mismatch';\n\n constructor() {\n super('You signed in with a different account. Use \"Connect another account\" to add it.');\n this.name = 'PluginAccountMismatchError';\n }\n}\n\nfunction httpsUrl(value: string): URL | null {\n let url: URL;\n\n try {\n url = new URL(value);\n } catch {\n return null;\n }\n\n if (url.protocol !== 'https:' || url.username !== '' || url.password !== '') {\n return null;\n }\n\n return url;\n}\n\n/** Popup navigation and postMessage stay on the platform OAuth start page. */\nfunction trustedPluginOAuthTargets(\n authorizeUrl: string,\n completionOrigin: string\n): { href: string; origin: string } | null {\n const origin = getPlatformOrigin();\n const authorize = httpsUrl(authorizeUrl);\n const completion = httpsUrl(completionOrigin);\n\n if (!authorize || !completion) {\n return null;\n }\n\n if (authorize.origin !== origin || authorize.pathname !== OAUTH_START_PATH) {\n return null;\n }\n\n if (completion.origin !== origin || completion.pathname !== '/') {\n return null;\n }\n\n return { href: authorize.href, origin };\n}\n\n/** Must be called directly from the click handler so browsers allow the popup. */\nexport async function connectPluginPopup(\n api: ApiClient,\n pluginId: string,\n scope: PluginScope,\n options?: { connectionId?: string }\n): Promise<void> {\n const popup = window.open('about:blank', `flexkit-plugin-${crypto.randomUUID()}`, 'popup,width=560,height=720');\n\n if (!popup) {\n throw new Error('Allow popups for Studio, then connect again.');\n }\n\n let transaction: Awaited<ReturnType<ApiClient['connectPlugins']>>;\n\n try {\n transaction = await api.connectPlugins({\n pluginId,\n scope,\n studioOrigin: window.location.origin,\n ...(options?.connectionId ? { connectionId: options.connectionId } : {}),\n });\n } catch (error) {\n popup.close();\n throw error;\n }\n\n const targets = trustedPluginOAuthTargets(transaction.authorizeUrl, transaction.completionOrigin);\n\n if (!targets) {\n popup.close();\n throw new Error('Connection could not be started.');\n }\n\n const expectedOrigin = targets.origin;\n\n await new Promise<void>((resolve, reject) => {\n let polling = false;\n let finished = false;\n const finish = (error?: Error) => {\n if (finished) {\n return;\n }\n\n finished = true;\n window.clearInterval(interval);\n window.clearTimeout(timeout);\n window.removeEventListener('message', onMessage);\n popup.close();\n\n if (error) {\n reject(error);\n\n return;\n }\n\n resolve();\n };\n const poll = async () => {\n if (polling || finished) {\n return;\n }\n\n polling = true;\n let status: Awaited<ReturnType<ApiClient['pluginOAuthStatus']>>;\n\n try {\n status = await api.pluginOAuthStatus(transaction.transactionId);\n } catch {\n polling = false;\n\n return;\n }\n\n polling = false;\n\n if (status.status === 'complete') {\n finish();\n\n return;\n }\n\n if (popup.closed && status.status === 'pending') {\n finish(new Error('Connection window was closed.'));\n\n return;\n }\n\n if (status.status === 'failed' || new Date(status.expires_at).getTime() < Date.now()) {\n finish(new Error('Connection was not completed. Please try again.'));\n }\n };\n const onMessage = (event: MessageEvent<unknown>) => {\n if (event.origin !== expectedOrigin || event.source !== popup || !event.data || typeof event.data !== 'object') {\n return;\n }\n\n const payload = event.data as { type?: string; transactionId?: string; status?: string; error?: string };\n\n if (payload.type === 'flexkit:plugin-oauth-ready' && payload.transactionId === transaction.transactionId) {\n popup.postMessage(\n {\n type: 'flexkit:plugin-oauth-start',\n transactionId: transaction.transactionId,\n ticket: transaction.launchTicket,\n },\n expectedOrigin\n );\n\n return;\n }\n\n if (payload.type === 'flexkit:plugin-oauth' && payload.transactionId === transaction.transactionId) {\n if (payload.status === 'failed' && payload.error === 'account_mismatch') {\n finish(new PluginAccountMismatchError());\n\n return;\n }\n\n void poll();\n }\n };\n const interval = window.setInterval(() => {\n void poll();\n }, 2000);\n const timeout = window.setTimeout(() => finish(new Error('Connection timed out. Please try again.')), 600_000);\n window.addEventListener('message', onMessage);\n popup.location.href = targets.href;\n });\n}\n"]}
|
package/dist/chunk-TYDYAOQ7.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {createContext,useContext}from'react';import $ from'swr';import {useParams,useHref}from'react-router-dom';import {jsx}from'react/jsx-runtime';var l="flexkit.io",S={"flexkit.io":true,"flexkit.test":true};function A(){let t=globalThis.process?.env?.FLEXKIT_DOMAIN?.trim();return t&&S[t]?t:l}var n=A();var p=n,f=`https://${p}`,a=t=>t?`https://${t}.api.${p}`:f,L=`${f}/images/`,i="-",m={authProviders:`/api/flexkit/${i}/auth/providers`,logout:`/api/flexkit/${i}/auth/logout`,me:`/api/flexkit/${i}/me`,notificationPreferences:`/api/flexkit/${i}/me/notification-preferences`,push:`/api/flexkit/${i}/me/push`,otpConfirm:`/api/flexkit/${i}/auth/otp/confirm`,otpSend:`/api/flexkit/${i}/auth/otp/send`};function u(t=""){return {assets:`/api/flexkit/${t}/assets`,authProviders:`/api/flexkit/${t}/auth/providers`,completion:`/api/flexkit/${t}/completion`,currentUser:`/api/flexkit/${t}/users/me`,loginOtpConfirm:`${a(t)}/auth/otp/confirm`,loginOtpSend:`${a(t)}/auth/otp/send`,logout:e=>{let o=new URLSearchParams({redirect:e});return `/api/flexkit/${t}/auth/logout?${o.toString()}`},schema:`/api/flexkit/${t}/schema`,search:`/api/flexkit/${t}/search`,sessionId:`${a(t)}/api/auth/login/session`}}async function h(t){try{await fetch(m.logout,{credentials:"same-origin",method:"POST"});}catch{}await fetch("/api/flexkit/logout",{credentials:"include",method:"GET"}),window.location.assign(t);}function c(t="projects"){let{projectId:e}=useParams(),o=useHref(`/${e??""}`),r=useHref("/"),{data:x,isLoading:k}=$(e?u(e).currentUser:null,P=>fetch(P,{mode:"cors",credentials:"include"}).then(s=>s.json()).then(s=>({...s,spaces:s.spaces??[]})));return [!!e&&k,{user:x,logout:async()=>{if(t==="hosted"){await h(r);return}await fetch(u(e??"").logout(o),{method:"POST",mode:"cors",credentials:"include"}),await fetch("/api/flexkit/logout",{method:"GET",credentials:"include"}),window.location.reload();}}]}var g=createContext([true,{user:null,logout:()=>Promise.resolve()}]);function B({children:t,mode:e="projects"}){let[o,r]=c(e);return jsx(g.Provider,{value:[o,r],children:t})}function J(){return useContext(g)}
|
|
2
|
-
export{n as a,f as b,L as c,m as d,u as e,h as f,B as g,J as h};//# sourceMappingURL=chunk-TYDYAOQ7.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-TYDYAOQ7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/domains.ts","../src/core/api-paths.ts","../src/auth/hosted-logout.ts","../src/auth/use-auth-service.ts","../src/auth/auth-context.tsx"],"names":["defaultFlexkitDomain","allowedFlexkitDomains","getConfiguredFlexkitDomain","configuredDomain","flexkitDomain","domain","baseApiUrl","baseProjectApiUrl","projectId","IMAGES_BASE_URL","USER_API_SEGMENT","userApiPaths","apiPaths","redirectPath","params","signOutHosted","rootHref","useAuthService","mode","useParams","projectHref","useHref","user","isLoadingUser","useSWR","url","res","data","AuthContext","createContext","AuthProvider","children","isLoading","auth","jsx","useAuth","useContext"],"mappings":"yKAAA,IAAMA,CAAAA,CAAuB,aAEvBC,CAAAA,CAAoD,CACxD,aAAc,IAAA,CACd,cAAA,CAAgB,IAClB,CAAA,CAUA,SAASC,GAAqC,CAC5C,IAAMC,EAAoB,UAAA,CAAoC,OAAA,EAAS,KAAK,cAAA,EAAgB,IAAA,GAE5F,OAAKA,CAAAA,EAIDF,EAAsBE,CAAgB,CAAA,CACjCA,EAJAH,CAQX,KAEaI,CAAAA,CAAgBF,CAAAA,GC3B7B,IAAMG,EAASD,CAAAA,CACFE,CAAAA,CAAa,WAAWD,CAAM,CAAA,CAAA,CACrCE,CAAAA,CAAqBC,CAAAA,EACzBA,CAAAA,CAAY,CAAA,QAAA,EAAWA,CAAS,CAAA,KAAA,EAAQH,CAAM,GAAKC,CAAAA,CAiBxCG,CAAAA,CAAkB,GAAGH,CAAU,CAAA,QAAA,CAAA,CAQ/BI,EAAmB,GAAA,CAEnBC,CAAAA,CAAe,CAC1B,aAAA,CAAe,CAAA,aAAA,EAAgBD,CAAgB,CAAA,eAAA,CAAA,CAC/C,MAAA,CAAQ,gBAAgBA,CAAg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CACF,CCxCA,IAAMQ,CAAAA,CAAcC,aAAAA,CAAc,CAChC,IAAA,CACA,CACE,KAAM,IAAA,CACN,MAAA,CAAQ,IAAM,OAAA,CAAQ,OAAA,EACxB,CACF,CAAC,EAEM,SAASC,CAAAA,CAAa,CAC3B,QAAA,CAAAC,CAAAA,CACA,KAAAb,CAAAA,CAAO,UACT,EAGgB,CACd,GAAM,CAACc,CAAAA,CAAWC,CAAI,CAAA,CAAIhB,EAAeC,CAAI,CAAA,CAE7C,OAAOgB,GAAAA,CAACN,CAAAA,CAAY,SAAZ,CAAqB,KAAA,CAAO,CAACI,CAAAA,CAAWC,CAAI,EAAI,QAAA,CAAAF,CAAAA,CAAS,CACnE,CAEO,SAASI,GAAuB,CACrC,OAAOC,UAAAA,CAAWR,CAAW,CAC/B","file":"chunk-TYDYAOQ7.js","sourcesContent":["const defaultFlexkitDomain = 'flexkit.io';\n\nconst allowedFlexkitDomains: { [domain: string]: true } = {\n 'flexkit.io': true,\n 'flexkit.test': true,\n};\n\ntype GlobalWithProcessEnv = typeof globalThis & {\n process?: {\n env?: {\n [key: string]: string | undefined;\n };\n };\n};\n\nfunction getConfiguredFlexkitDomain(): string {\n const configuredDomain = (globalThis as GlobalWithProcessEnv).process?.env?.FLEXKIT_DOMAIN?.trim();\n\n if (!configuredDomain) {\n return defaultFlexkitDomain;\n }\n\n if (allowedFlexkitDomains[configuredDomain]) {\n return configuredDomain;\n }\n\n return defaultFlexkitDomain;\n}\n\nexport const flexkitDomain = getConfiguredFlexkitDomain();\nexport const flexkitApiDomain = `api.${flexkitDomain}`;\n","import { flexkitDomain } from './domains';\n\nconst domain = flexkitDomain;\nexport const baseApiUrl = `https://${domain}`;\nconst baseProjectApiUrl = (projectId?: string): string =>\n projectId ? `https://${projectId}.api.${domain}` : baseApiUrl;\n\ninterface ApiPaths {\n assets: string;\n authProviders: string;\n completion: string;\n currentUser: string;\n loginOtpConfirm: string;\n loginOtpSend: string;\n /** `redirectPath` is the absolute in-app path to return to after logout. */\n logout: (redirectPath: string) => string;\n /** Deployed project schema, scopes, spaces, title and menu groups. */\n schema: string;\n search: string;\n sessionId: string;\n}\n\nexport const IMAGES_BASE_URL = `${baseApiUrl}/images/`;\n\n/**\n * Reserved BFF segment for user-level (project-less) Flexkit API calls:\n * `/api/flexkit/-/me` is proxied to `https://<flexkitDomain>/api/me` with the\n * session as a bearer token. Project ids are ten characters, so `-` can never\n * collide with one.\n */\nexport const USER_API_SEGMENT = '-';\n\nexport const userApiPaths = {\n authProviders: `/api/flexkit/${USER_API_SEGMENT}/auth/providers`,\n logout: `/api/flexkit/${USER_API_SEGMENT}/auth/logout`,\n /** Signed-in user plus every project they can open. */\n me: `/api/flexkit/${USER_API_SEGMENT}/me`,\n /** The signed-in user's notification preferences (desktop kinds, approval email). */\n notificationPreferences: `/api/flexkit/${USER_API_SEGMENT}/me/notification-preferences`,\n /** Web Push: GET the VAPID public key, POST or DELETE this browser's subscription. */\n push: `/api/flexkit/${USER_API_SEGMENT}/me/push`,\n otpConfirm: `/api/flexkit/${USER_API_SEGMENT}/auth/otp/confirm`,\n otpSend: `/api/flexkit/${USER_API_SEGMENT}/auth/otp/send`,\n} as const;\n\nexport function apiPaths(projectId = ''): ApiPaths {\n return {\n assets: `/api/flexkit/${projectId}/assets`,\n authProviders: `/api/flexkit/${projectId}/auth/providers`,\n completion: `/api/flexkit/${projectId}/completion`,\n currentUser: `/api/flexkit/${projectId}/users/me`,\n loginOtpConfirm: `${baseProjectApiUrl(projectId)}/auth/otp/confirm`,\n loginOtpSend: `${baseProjectApiUrl(projectId)}/auth/otp/send`,\n logout: (redirectPath: string) => {\n const params = new URLSearchParams({ redirect: redirectPath });\n\n return `/api/flexkit/${projectId}/auth/logout?${params.toString()}`;\n },\n schema: `/api/flexkit/${projectId}/schema`,\n search: `/api/flexkit/${projectId}/search`,\n sessionId: `${baseProjectApiUrl(projectId)}/api/auth/login/session`,\n };\n}\n","import { userApiPaths } from '../core/api-paths';\n\n/** Hosted mode sign-out: end the Flexkit session, drop the first-party cookie, go back to the Studio root. */\nexport async function signOutHosted(rootHref: string): Promise<void> {\n try {\n await fetch(userApiPaths.logout, { credentials: 'same-origin', method: 'POST' });\n } catch {\n // The cookie is cleared below either way; the session expires server-side.\n }\n\n await fetch('/api/flexkit/logout', { credentials: 'include', method: 'GET' });\n window.location.assign(rootHref);\n}\n","'use client';\n\nimport useSWR from 'swr';\nimport { useHref, useParams } from 'react-router-dom';\nimport { apiPaths } from '../core/api-paths';\nimport type { StudioMode } from '../core/config/types';\nimport { signOutHosted } from './hosted-logout';\nimport type { AuthService, User } from './types';\n\nexport default function useAuthService(mode: StudioMode = 'projects'): AuthService {\n const { projectId } = useParams();\n // Absolute path of the current project under the router basename.\n const projectHref = useHref(`/${projectId ?? ''}`);\n const rootHref = useHref('/');\n // Role and spaces are per project, so there is nothing to ask until a project is open.\n const { data: user, isLoading: isLoadingUser } = useSWR(projectId ? apiPaths(projectId).currentUser : null, (url: string) =>\n fetch(url, { mode: 'cors', credentials: 'include' })\n .then((res) => res.json() as Promise<User>)\n .then((data) => ({ ...data, spaces: data.spaces ?? [] }))\n );\n const isLoading = Boolean(projectId) && isLoadingUser;\n\n return [\n isLoading,\n {\n user,\n logout: async () => {\n if (mode === 'hosted') {\n await signOutHosted(rootHref);\n\n return;\n }\n\n // wipe remote session\n await fetch(apiPaths(projectId ?? '').logout(projectHref), {\n method: 'POST',\n mode: 'cors',\n credentials: 'include',\n });\n\n // delete first-party auth cookie\n await fetch('/api/flexkit/logout', { method: 'GET', credentials: 'include' });\n\n window.location.reload();\n },\n },\n ];\n}\n","'use client';\n\nimport { createContext, JSX, useContext } from 'react';\nimport useAuthService from './use-auth-service';\nimport type { Auth, AuthService, User } from './types';\nimport type { StudioMode } from '../core/config/types';\n\nconst AuthContext = createContext([\n true,\n {\n user: null as User | null,\n logout: () => Promise.resolve(),\n } as Auth,\n]);\n\nexport function AuthProvider({\n children,\n mode = 'projects',\n}: {\n children: React.ReactNode;\n mode?: StudioMode;\n}): JSX.Element {\n const [isLoading, auth] = useAuthService(mode);\n\n return <AuthContext.Provider value={[isLoading, auth]}>{children}</AuthContext.Provider>;\n}\n\nexport function useAuth(): AuthService {\n return useContext(AuthContext) as AuthService;\n}\n"]}
|
package/dist/chunk-V64P56OA.js
DELETED
package/dist/chunk-XDLTO6VU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/desktop.ts"],"names":["DESKTOP_LOGIN_CALLBACK","getDesktop"],"mappings":"oBAyBO,IAAMA,CAAAA,CAAyB,0BAK/B,SAASC,CAAAA,EAA+C,CAC7D,GAAI,EAAA,OAAO,MAAA,CAAW,GAAA,CAAA,CAItB,OAAQ,MAAA,CAAwC,cAClD","file":"chunk-XDLTO6VU.js","sourcesContent":["/**\n * The bridge the Flexkit Studio desktop app (Electron) exposes to the Studio\n * through its preload script, as `window.flexkitDesktop`. Studio features\n * check for the bridge (a capability), never for a platform, so the web\n * Studio never sees any of this.\n */\nexport interface FlexkitDesktopBridge {\n platform: 'darwin' | 'win32' | 'linux';\n /** Installed app version; it tracks the `@flexkit/studio` version it bundles. */\n version: string;\n /** The URL the OAuth login hands the session code to; the app registered its scheme with the OS. */\n loginCallback: string;\n /** Dock (macOS) or taskbar badge; 0 clears it. */\n setBadgeCount: (count: number) => void;\n /** Brings the Studio window to the front (a clicked notification, for example). */\n focusWindow: () => void;\n /** Paths the app asks the Studio to open: deep links and menu items. Returns the unsubscribe function. */\n onNavigate: (listener: (path: string) => void) => () => void;\n /** An update has been downloaded and installs on the next restart. Returns the unsubscribe function. */\n onUpdateDownloaded: (listener: (update: { version: string }) => void) => () => void;\n /** Restarts into the downloaded update. */\n installUpdate: () => void;\n}\n\n/** The desktop app's login callback (see `DESKTOP_LOGIN_CALLBACK` in the Electron adapter). */\nexport const DESKTOP_LOGIN_CALLBACK = 'flexkit://auth/callback';\n\ntype WindowWithDesktop = { flexkitDesktop?: FlexkitDesktopBridge };\n\n/** The desktop bridge when the Studio runs inside the desktop app, otherwise undefined. */\nexport function getDesktop(): FlexkitDesktopBridge | undefined {\n if (typeof window === 'undefined') {\n return undefined;\n }\n\n return (window as unknown as WindowWithDesktop).flexkitDesktop;\n}\n"]}
|
package/dist/list-4NZLZRX3.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {c as c$2,a}from'./chunk-KNESQOI5.js';import {s,m as m$1,K,d,u,v,w,y}from'./chunk-TOY7ZRK2.js';import {c}from'./chunk-P6BZ4QP7.js';import'./chunk-CAZ6EUR2.js';import'./chunk-V64P56OA.js';import'./chunk-2DXR5NJV.js';import {f}from'./chunk-CWJWOJRO.js';import'./chunk-TYDYAOQ7.js';import {N}from'./chunk-YCCFUGWJ.js';import {v as v$1}from'./chunk-32ZU4MLE.js';import'./chunk-HDOIOXMP.js';import {t}from'./chunk-SZEGGBOC.js';import'./chunk-U45E5X3H.js';import {b,c as c$1,e}from'./chunk-USNXQOMJ.js';import'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';import {useState,useMemo,useCallback}from'react';import {useParams,useLocation,Outlet}from'react-router-dom';import {jsx,jsxs}from'react/jsx-runtime';var m=36,ct=[{_updatedAt:"DESC"},{_id:"DESC"}];function vt(){let{entity:t}=useParams(),{search:a}=useLocation(),g=new URLSearchParams(a).get("id"),{scope:j}=c(),{schemaErrorMessage:G}=s(),{currentProject:Q}=f(),h=Q?.schema??[],n=m$1(h,t??""),[r,S]=useState([]),[W,B]=useState(0),[O,F]=useState(t);t!==O&&(F(t),S([]));let k=K({attributesSchema:n?.attributes??[],actionsComponent:o=>ut({entityName:n?.name??"",entityNamePlural:t??"",row:o}),checkboxSelect:"multiple",enableColumnSorting:true}),f$1=useMemo(()=>{if(r.length===0)return ct;let o=r.map(({id:u,desc:it})=>({[u]:it?"DESC":"ASC"}));return o.some(u=>"_id"in u)?o:[...o,{_id:"DESC"}]},[r]),y$1=useMemo(()=>{if(r.length!==0)return d(f$1,n)},[n,f$1,r.length]),H=g?{where:{_id:{eq:g}}}:{offset:0,limit:m,sort:f$1,...y$1?{where:y$1}:{}},{isLoading:Y,isLoadingMore:Z,fetchMore:b$1,reload:C,count:i,data:l,isProjectDisabled:$}=u({entityNamePlural:t??"",schema:h,scope:j,variables:H,selection:"list"});function tt(o){S(o);}let N$1=l?.length??0,et=i>0&&N$1>0&&N$1<i,ot=useCallback(()=>{b$1({variables:{offset:0,limit:m}});},[b$1]),nt=useCallback(()=>{B(o=>o+1),C();},[C]),rt=Array(m).fill({}),at=pt(k),s$1=Y&&(l==null||l.length===0);return $?jsx("div",{className:"fk:flex fk:flex-col fk:h-full fk:px-4 fk:pt-3",children:jsx(v,{})}):jsxs("div",{className:"fk:flex fk:flex-col fk:h-full fk:px-4 fk:pt-3",children:[jsx(w,{}),jsxs("div",{className:"fk:flex fk:items-center fk:mb-4 fk:gap-2",children:[jsxs(b,{children:[jsx(c$1,{asChild:true,children:jsx(N,{className:"fk:-ml-1 fk:w-4 fk:h-4"})}),jsx(e,{children:"Toggle Sidebar"})]}),jsx(v$1,{orientation:"vertical",className:"fk:h-4"}),jsx("h2",{className:"fk:text-lg fk:font-semibold fk:leading-none fk:tracking-tight",children:ft(n?.menu?.label??n?.plural??"")}),s$1?null:jsxs("span",{className:"fk:ml-auto fk:text-sm fk:font-normal fk:text-muted-foreground",children:[i.toLocaleString()," ",i===1?"record":"records"]})]}),G?null:jsx(y,{columns:s$1?at:k,data:s$1?rt:l??[],entityName:n?.name??"",hasMore:et,isLoadingMore:Z,pageSize:m,scrollToTopKey:W,sorting:r,onLoadMore:ot,onSortingChange:tt,toolbarComponent:o=>jsx(c$2,{entityName:n?.name??"",isReloading:s$1,onReload:nt,table:o})}),jsx(Outlet,{})]})}function ft(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ut({entityName:t,entityNamePlural:a$1,row:d}){return jsx(a,{entityName:t,entityNamePlural:a$1,row:d})}function pt(t$1){return t$1.map(a=>({...a,cell:()=>jsx(t,{className:"fk:h-4 fk:w-full",style:{marginTop:"7px",marginBottom:"6px"}})}))}export{vt as List};//# sourceMappingURL=list-4NZLZRX3.js.map
|
|
2
|
-
//# sourceMappingURL=list-4NZLZRX3.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';export{b as CatalogHeader,d as InstalledPluginsPage,a as PluginConnectControl,e as PluginDetailPage,c as PluginsPage}from'./chunk-C5Y6OZFR.js';import'./chunk-KXAGLQ2B.js';import'./chunk-2HSIWUH3.js';import'./chunk-CWJWOJRO.js';import'./chunk-TYDYAOQ7.js';import'./chunk-YCCFUGWJ.js';import'./chunk-32ZU4MLE.js';import'./chunk-HDOIOXMP.js';import'./chunk-SZEGGBOC.js';import'./chunk-U45E5X3H.js';import'./chunk-USNXQOMJ.js';import'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';//# sourceMappingURL=plugin-pages-RNB46YPQ.js.map
|
|
2
|
-
//# sourceMappingURL=plugin-pages-RNB46YPQ.js.map
|
package/dist/root-4XPMKRHZ.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {f}from'./chunk-CWJWOJRO.js';import'./chunk-TYDYAOQ7.js';import {x,y as y$1,ga,ha,ia,ja,z}from'./chunk-YCCFUGWJ.js';import {v,w,x as x$1}from'./chunk-32ZU4MLE.js';import'./chunk-HDOIOXMP.js';import'./chunk-SZEGGBOC.js';import'./chunk-U45E5X3H.js';import {b,c,e}from'./chunk-USNXQOMJ.js';import {b as b$1}from'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';import {useMemo,useState,useRef,useEffect,Children,useCallback,Fragment as Fragment$1}from'react';import {createGraphiQLFetcher}from'@graphiql/toolkit';import {GraphiQLProvider,useEditorContext,useExecutionContext,useSchemaContext,useStorageContext,usePluginContext,useCopyQuery,useMergeQuery,usePrettifyEditors,useTheme,ToolbarButton,PrettifyIcon,MergeIcon,CopyIcon,Tooltip,UnStyledButton,PlusIcon,ReloadIcon,KeyboardShortcutIcon,SettingsIcon,Tabs,Tab,QueryEditor,ExecuteButton,VariableEditor,Spinner,ResponseEditor,Dialog,ButtonGroup,Button,isMacOs}from'@graphiql/react';import {HISTORY_PLUGIN,HistoryContextProvider}from'@graphiql/plugin-history';import {ChevronsRight,ChevronsLeft}from'lucide-react';import {jsx,Fragment,jsxs}from'react/jsx-runtime';import'@graphiql/react/style.css';import'@graphiql/plugin-history/style.css';function y({dangerouslyAssumeSchemaIsValid:t,confirmCloseTab:i,defaultQuery:n,defaultTabs:l,externalFragments:f,fetcher:s,getDefaultFieldNames:d,headers:E,inputValueDeprecation:k,introspectionQueryName:M,maxHistoryLength:h,onEditOperationName:A,onSchemaChange:O,onTabChange:B,onTogglePluginVisibility:T,operationName:L,plugins:p,query:C,response:v,schema:R,schemaDescription:I,shouldPersistHeaders:Q,storage:z,validationRules:w,variables:F,visiblePlugin:D,defaultHeaders:U,...m}){if(typeof s!="function")throw new TypeError("The `GraphiQL` component requires a `fetcher` function to be passed as prop.");let V=useMemo(()=>{let S=p??[];return S.some($=>$.title===HISTORY_PLUGIN.title)?S:[HISTORY_PLUGIN,...S]},[p]);return jsx(GraphiQLProvider,{getDefaultFieldNames:d,dangerouslyAssumeSchemaIsValid:t,defaultQuery:n,defaultHeaders:U,defaultTabs:l,externalFragments:f,fetcher:s,headers:E,inputValueDeprecation:k,introspectionQueryName:M,onEditOperationName:A,onSchemaChange:O,onTabChange:B,onTogglePluginVisibility:T,plugins:V,visiblePlugin:D,operationName:L,query:C,response:v,schema:R,schemaDescription:I,shouldPersistHeaders:Q,storage:z,validationRules:w,variables:F,children:jsx(HistoryContextProvider,{maxHistoryLength:h,children:jsx(lt,{confirmCloseTab:i,showPersistHeadersSettings:Q!==false,disableTabs:m.disableTabs??false,forcedTheme:m.forcedTheme,...m})})})}y.Toolbar=ge;y.Footer=ye;var at=["light","dark","system"],H="graphiql-session-tab-",pe="flexkit-explorer:layout",me=3;function it(t){if(typeof t=="number")return t;if(typeof t!="object"||t===null||!("asPercentage"in t))return;let i=t.asPercentage;if(typeof i=="number")return i}function ot(t){return !t||typeof t!="object"||Array.isArray(t)?false:Object.values(t).every(i=>typeof i=="number")}function nt(t){if(typeof window>"u")return;let i=window.localStorage.getItem(t);if(i)try{let n=JSON.parse(i);if(ot(n))return n}catch{return}}function rt(t,i){if(!(typeof window>"u"))try{window.localStorage.setItem(t,JSON.stringify(i));}catch{}}function lt(t){let i=useEditorContext({nonNull:true}),n=useExecutionContext({nonNull:true}),l=useSchemaContext({nonNull:true}),f=useStorageContext(),s=usePluginContext(),[d,E]=useState(false),k=useRef(null),M=useMemo(()=>nt(pe),[]),h=useMemo(()=>t.forcedTheme&&at.includes(t.forcedTheme)?t.forcedTheme:void 0,[t.forcedTheme]),A=useCopyQuery({onCopyQuery:t.onCopyQuery}),O=useMergeQuery(),B=usePrettifyEditors(),{setTheme:T}=useTheme(t.defaultTheme);useEffect(()=>{h==="system"?T(null):(h==="light"||h==="dark")&&T(h);},[h,T]),useEffect(()=>{s?.setVisiblePlugin(s.plugins[0]);},[s]);let[L,p]=useState(null),[C,v$1]=useState(null),R=Children.toArray(t.children),I=R.find(a=>be(a,y.Toolbar))??jsxs(Fragment,{children:[jsx(ToolbarButton,{onClick:B,label:"Prettify query (Shift-Ctrl-P)",children:jsx(PrettifyIcon,{className:"fk:w-6 fk:h-6 fk:block","aria-hidden":"true"})}),jsx(ToolbarButton,{onClick:O,label:"Merge fragments into query (Shift-Ctrl-M)",children:jsx(MergeIcon,{className:"fk:w-6 fk:h-6 fk:block","aria-hidden":"true"})}),jsx(ToolbarButton,{onClick:A,label:"Copy query (Shift-Ctrl-C)",children:jsx(CopyIcon,{className:"fk:w-6 fk:h-6 fk:block","aria-hidden":"true"})}),t.toolbar?.additionalContent,t.toolbar?.additionalComponent&&jsx(t.toolbar.additionalComponent,{})]}),Q=R.find(a=>be(a,y.Footer)),z$1=useCallback(()=>{try{f?.clear(),v$1("success");}catch{v$1("error");}},[f]),w$1=useCallback(a=>{i.setShouldPersistHeaders(a.currentTarget.dataset.value==="true");},[i]),F=()=>{i.addTab();},D=()=>{l.introspect();},U=a=>{i.moveTab(a);},m=useCallback(a=>{p(a.currentTarget.dataset.value);},[]),V=useCallback(a=>{let r=s,u=Number(a.currentTarget.dataset.index);if(!r)return;let x=r.plugins.find((mt,xe)=>u===xe)??null;if(x===r.visiblePlugin){r.setVisiblePlugin(null);return}r.setVisiblePlugin(x);},[s]),S=useCallback(a=>{a||p(null);},[]),$=useCallback(a=>{a||(p(null),v$1(null));},[]),ke=jsx(Tooltip,{label:"Add tab",children:jsx(UnStyledButton,{type:"button",className:"graphiql-tab-add",onClick:F,"aria-label":"Add tab",children:jsx(PlusIcon,{"aria-hidden":"true"})})}),Te=t.className?` ${t.className}`:"",_=t.confirmCloseTab,Ce=useCallback(async a=>{let r=a.currentTarget.previousSibling,u=Number(r.id.replace(H,""));(!_||await _(u))&&(i.activeTabIndex===u&&n.stop(),i.closeTab(u));},[_,i,n]),ve=useCallback(a=>{let r=Number(a.currentTarget.id.replace(H,""));n.stop(),i.changeTab(r);},[i,n]),Se=useCallback(a=>{rt(pe,a);},[]);return jsx(Tooltip.Provider,{children:jsxs("div",{className:`graphiql-container${Te}`,children:[jsxs(x,{className:"fk:h-full fk:max-h-full",defaultLayout:M,id:"explorer",onLayoutChanged:Se,orientation:"horizontal",children:[jsxs(y$1,{collapsible:true,collapsedSize:`${me}%`,defaultSize:"22%",id:"explorer-sidebar",minSize:"10%",onResize:a=>{let r=k.current;if(r){E(r.isCollapsed());return}let u=it(a);u!==void 0&&E(u<=me);},panelRef:k,children:[jsx("div",{className:"fk:flex fk:w-full fk:h-full fk:pb-6",children:jsxs(ga,{className:"fk:w-full",defaultValue:s?.plugins[0].title,children:[jsxs("div",{className:`fk:flex fk:items-center fk:py-1 ${d?"":"fk:px-3"}`,children:[jsx(ha,{className:d?"fk:hidden":"",children:s?.plugins.map((a,r)=>{let x=`${a===s.visiblePlugin?"Hide":"Show"} ${a.title}`;return jsx(ia,{"aria-label":x,className:"fk:text-muted-foreground","data-index":r,onClick:V,value:a.title,children:jsx(a.icon,{"aria-hidden":"true"})},a.title)})}),jsxs(b,{children:[jsx(c,{asChild:true,children:jsx(b$1,{className:d?"fk:ml-1.5":"fk:ml-auto",onClick:()=>{let a=k.current;d?a?.expand():a?.collapse();},size:"icon",variant:"ghost",children:d?jsxs(Fragment,{children:[jsx(ChevronsRight,{className:"fk:w-4 fk:h-4"}),jsx("span",{className:"fk:sr-only",children:"Expand"})]}):jsxs(Fragment,{children:[jsx(ChevronsLeft,{className:"fk:w-4 fk:h-4"}),jsx("span",{className:"fk:sr-only",children:"Collapse"})]})})}),jsx(e,{children:d?"Expand":"Collapse"})]})]}),d?null:jsx(v,{}),s?.plugins.map(a=>jsx(ja,{className:`fk:flex fk:w-full fk:max-h-full fk:mt-0 ${d?"fk:hidden":""}`,value:a.title,children:jsxs(w,{className:"fk:flex fk:w-full fk:max-h-full fk:overflow-auto fk:pl-3 fk:pr-6 fk:pt-3 fk:pb-6 fk:mb-3 fk:[&>div>div]:block!",children:[jsx(a.content,{}),jsx(x$1,{orientation:"horizontal"})]})},a.title))]})}),jsx(Tooltip,{label:"Re-fetch GraphQL schema",children:jsx(UnStyledButton,{type:"button",disabled:l.isFetching,onClick:D,"aria-label":"Re-fetch GraphQL schema",children:jsx(ReloadIcon,{className:l.isFetching?"graphiql-spin":"","aria-hidden":"true"})})}),jsx(Tooltip,{label:"Open short keys dialog",children:jsx(UnStyledButton,{type:"button","data-value":"short-keys",onClick:m,"aria-label":"Open short keys dialog",children:jsx(KeyboardShortcutIcon,{"aria-hidden":"true"})})}),jsx(Tooltip,{label:"Open settings dialog",children:jsx(UnStyledButton,{type:"button","data-value":"settings",onClick:m,"aria-label":"Open settings dialog",children:jsx(SettingsIcon,{"aria-hidden":"true"})})})]}),jsx(z,{className:"fk:hover:bg-blue-500 fk:transition-colors",withHandle:true}),jsx(y$1,{className:"fk:bg-muted",defaultSize:"40%",id:"explorer-editor",children:jsxs("div",{className:"fk:flex fk:flex-col fk:h-full",children:[jsxs("div",{className:"fk:flex fk:items-center fk:py-1 fk:px-4 fk:gap-6 fk:bg-muted",children:[!t.disableTabs&&jsx(Tabs,{"aria-label":"Select active operation",className:"fk:p-1! fk:bg-muted fk:rounded-md",onReorder:U,values:i.tabs,children:i.tabs.length>0&&jsx(Fragment,{children:i.tabs.map((a,r)=>jsxs(Tab,{isActive:r===i.activeTabIndex,value:a,children:[jsx(Tab.Button,{"aria-controls":"graphiql-session",id:`${H}${r.toString()}`,onClick:ve,children:a.title}),jsx(Tab.Close,{onClick:Ce})]},a.id))})}),ke]}),jsx("div",{role:"tabpanel",id:"graphiql-session",className:"graphiql-session","aria-labelledby":`${H}${i.activeTabIndex}`,children:jsx("div",{className:`graphiql-editors${i.tabs.length===1?" full-height":""}`,children:jsxs(x,{orientation:"vertical",children:[jsxs(y$1,{className:"fk:flex fk:w-full fk:gap-x-4 fk:px-4 fk:py-2",defaultSize:"80%",children:[jsx(QueryEditor,{editorTheme:t.editorTheme,keyMap:t.keyMap,onCopyQuery:t.onCopyQuery,onEdit:t.onEditQuery,readOnly:t.readOnly}),jsxs("div",{className:"graphiql-toolbar",role:"toolbar","aria-label":"Editor Commands",children:[jsx(ExecuteButton,{}),I]})]}),jsx(z,{className:"fk:hover:bg-blue-500 fk:transition-colors",withHandle:true}),jsxs(y$1,{className:"fk:bg-muted fk:px-4 fk:pt-2",defaultSize:"20%",children:[jsx("div",{className:"fk:text-sm fk:font-medium fk:text-muted-foreground",children:"Variables"}),jsx(VariableEditor,{editorTheme:t.editorTheme,isHidden:false,keyMap:t.keyMap,onEdit:t.onEditVariables,readOnly:t.readOnly})]})]})})})]})}),jsx(z,{className:"fk:hover:bg-blue-500 fk:transition-colors",withHandle:true}),jsx(y$1,{className:"fk:px-5 fk:pt-10 fk:relative",defaultSize:"38%",id:"explorer-response",children:jsxs("div",{className:"graphiql-response fk:h-full",children:[n.isFetching?jsx(Spinner,{}):null,jsx(ResponseEditor,{editorTheme:t.editorTheme,responseTooltip:t.responseTooltip,keyMap:t.keyMap}),Q]})})]}),jsxs(Dialog,{open:L==="short-keys",onOpenChange:S,children:[jsxs("div",{className:"graphiql-dialog-header",children:[jsx(Dialog.Title,{className:"graphiql-dialog-title",children:"Short Keys"}),jsx(Dialog.Close,{})]}),jsx("div",{className:"graphiql-dialog-section",children:jsx(dt,{keyMap:t.keyMap||"sublime"})})]}),jsxs(Dialog,{open:L==="settings",onOpenChange:$,children:[jsxs("div",{className:"graphiql-dialog-header",children:[jsx(Dialog.Title,{className:"graphiql-dialog-title",children:"Settings"}),jsx(Dialog.Close,{})]}),t.showPersistHeadersSettings?jsxs("div",{className:"graphiql-dialog-section",children:[jsxs("div",{children:[jsx("div",{className:"graphiql-dialog-section-title",children:"Persist headers"}),jsxs("div",{className:"graphiql-dialog-section-caption",children:["Save headers upon reloading."," ",jsx("span",{className:"graphiql-warning-text",children:"Only enable if you trust this device."})]})]}),jsxs(ButtonGroup,{children:[jsx(Button,{type:"button",id:"enable-persist-headers",className:i.shouldPersistHeaders?"active":"","data-value":"true",onClick:w$1,children:"On"}),jsx(Button,{type:"button",id:"disable-persist-headers",className:i.shouldPersistHeaders?"":"active",onClick:w$1,children:"Off"})]})]}):null,f?jsxs("div",{className:"graphiql-dialog-section",children:[jsxs("div",{children:[jsx("div",{className:"graphiql-dialog-section-title",children:"Clear storage"}),jsx("div",{className:"graphiql-dialog-section-caption",children:"Remove all locally stored data and start fresh."})]}),jsx(Button,{type:"button",state:C||void 0,disabled:C==="success",onClick:z$1,children:{success:"Cleared data",error:"Failed"}[C]||"Clear data"})]}):null]})]})})}var Y=isMacOs?"\u2318":"Ctrl",st=Object.entries({"Search in editor":[Y,"F"],"Search in documentation":[Y,"K"],"Execute query":[Y,"Enter"],"Prettify editors":["Ctrl","Shift","P"],"Merge fragments definitions into operation definition":["Ctrl","Shift","M"],"Copy query":["Ctrl","Shift","C"],"Re-fetch schema using introspection":["Ctrl","Shift","R"]});function dt({keyMap:t}){return jsxs("div",{children:[jsxs("table",{className:"graphiql-table",children:[jsx("thead",{children:jsxs("tr",{children:[jsx("th",{children:"Short Key"}),jsx("th",{children:"Function"})]})}),jsx("tbody",{children:st.map(([i,n])=>jsxs("tr",{children:[jsx("td",{children:n.map((l,f,s)=>jsxs(Fragment$1,{children:[jsx("code",{className:"graphiql-key",children:l}),f!==s.length-1&&" + "]},l))}),jsx("td",{children:i})]},i))})]}),jsxs("p",{children:["The editors use"," ",jsx("a",{href:"https://codemirror.net/5/doc/manual.html#keymaps",target:"_blank",rel:"noopener noreferrer",children:"CodeMirror Key Maps"})," ","that add more short keys. This instance of Graph",jsx("em",{children:"i"}),"QL uses ",jsx("code",{children:t}),"."]})]})}function ge(t){return jsx(Fragment,{children:t.children})}ge.displayName="GraphiQLToolbar";function ye(t){return jsx("div",{className:"graphiql-footer",children:t.children})}ye.displayName="GraphiQLFooter";function be(t,i){let n=typeof t=="object"&&t!==null?t:null;if(!n)return false;let l=n.type;return typeof l=="object"&&l!==null&&"displayName"in l&&typeof l.displayName=="string"&&l.displayName===i.displayName?true:n.type===i}var ft=`# Welcome to Flexkit Explorer
|
|
2
|
-
#
|
|
3
|
-
# Explorer is where you write, validate and run GraphQL queries
|
|
4
|
-
# against your Flexkit project.
|
|
5
|
-
#
|
|
6
|
-
# Type queries into this side of the screen, and you will see intelligent
|
|
7
|
-
# typeaheads aware of the current GraphQL schema and live syntax and
|
|
8
|
-
# validation errors highlighted within the text.
|
|
9
|
-
#
|
|
10
|
-
# GraphQL queries typically start with a "{" character. Lines that start
|
|
11
|
-
# with a # are ignored.
|
|
12
|
-
#
|
|
13
|
-
# An example GraphQL query might look like:
|
|
14
|
-
#
|
|
15
|
-
# {
|
|
16
|
-
# field(arg: "value") {
|
|
17
|
-
# subField
|
|
18
|
-
# }
|
|
19
|
-
# }
|
|
20
|
-
#
|
|
21
|
-
# Keyboard shortcuts:
|
|
22
|
-
#
|
|
23
|
-
# Prettify query: Shift-Ctrl-P (or press the prettify button)
|
|
24
|
-
#
|
|
25
|
-
# Merge fragments: Shift-Ctrl-M (or press the merge button)
|
|
26
|
-
#
|
|
27
|
-
# Run Query: Ctrl-Enter (or press the play button)
|
|
28
|
-
#
|
|
29
|
-
# Auto Complete: Ctrl-Space (or just start typing)
|
|
30
|
-
#`;function Qt(){let{currentProjectId:t}=f(),i=`/api/flexkit/${t}/graphql`,n=useMemo(()=>createGraphiQLFetcher({url:i}),[i]);return jsx(y,{fetcher:n,forcedTheme:"light",defaultQuery:ft})}export{Qt as Root};//# sourceMappingURL=root-4XPMKRHZ.js.map
|
|
31
|
-
//# sourceMappingURL=root-4XPMKRHZ.js.map
|
package/dist/root-5RDJ2HAV.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {c}from'./chunk-2DXR5NJV.js';import {f}from'./chunk-CWJWOJRO.js';import {h}from'./chunk-TYDYAOQ7.js';import {L,Y,P}from'./chunk-YCCFUGWJ.js';import'./chunk-32ZU4MLE.js';import'./chunk-HDOIOXMP.js';import'./chunk-SZEGGBOC.js';import'./chunk-U45E5X3H.js';import'./chunk-USNXQOMJ.js';import'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';import {Outlet}from'react-router-dom';import {jsxs,jsx}from'react/jsx-runtime';var S="flexkit:sidebar:state";function A(){let[,a]=h(),{currentProject:t}=f(),c$1=t?.schema??[],u=t?.menuGroups??[],p=c(c$1,a.user?.spaces),f$1=document.cookie.split("; ").find(d=>d.startsWith(`${S}=`))?.split("=")[1]!=="false";return jsxs(L,{defaultOpen:f$1,children:[jsx(Y,{schema:p,menuGroups:u}),jsx(P,{children:jsx(Outlet,{})})]})}export{A as Root};//# sourceMappingURL=root-5RDJ2HAV.js.map
|
|
2
|
-
//# sourceMappingURL=root-5RDJ2HAV.js.map
|
package/dist/search-OWF3LEWH.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {a}from'./chunk-ETQ3Q472.js';import'./chunk-P6BZ4QP7.js';import'./chunk-CWJWOJRO.js';import'./chunk-TYDYAOQ7.js';import {z,m,w,q,p,r,t,b as b$1}from'./chunk-32ZU4MLE.js';import {a as a$1,d,c,e,g}from'./chunk-HDOIOXMP.js';import'./chunk-U45E5X3H.js';import {b}from'./chunk-6NRQMG26.js';import {a as a$2}from'./chunk-O2QMYUPS.js';import {useState,useMemo,useRef}from'react';import {LoaderCircle,Search,X}from'lucide-react';import {Command}from'cmdk';import {useNavigate}from'react-router-dom';import {jsxs,jsx}from'react/jsx-runtime';var i="all";function ee(t){let n=t.replace(/([A-Z])/g," $1");return n.charAt(0).toUpperCase()+n.slice(1).trim()}function re(t){return t.filter(n=>n.attributes.some(a=>a.searchable))}function te(t,n){return n===i?t.map(a=>a.plural):t.filter(a=>a.plural===n).map(a=>a.plural)}function ne(t,n){return n===i?i:t.some(a=>a.plural===n)?n:i}function ae(t,n){return {searchRequests:{searches:t.map(a=>({collection:a}))},commonParams:{q:n}}}function oe(t){return t.menu?.label??ee(t.plural)}function be({onSelect:t$1,searchPlaceholder:n="Search...",noResultsMsg:a$3="Nothing found",className:_,onSearchChange:y,projectId:V,schema:v}){let[D,l]=useState(false),[s,S]=useState(""),[G,M]=useState(i),f=useMemo(()=>re(v),[v]),m$1=ne(f,G),C=useMemo(()=>te(f,m$1),[f,m$1]),X$1=useMemo(()=>ae(C,s),[C,s]),c$1=useRef(null),{results:k,isLoading:d$1}=a(V,X$1),j=D&&(k.length>0||!d$1),z$1=useNavigate();function F(e){S(e),e.length>0&&l(true),e.length===0&&l(false),y&&y(e);}function J(e){M(e),s.length>0&&l(true);}function U(){S(""),l(false),c$1.current&&(c$1.current.value="");let e=new URL(window.location.href);e.searchParams.has("id")&&(e.searchParams.delete("id"),z$1(e.pathname+e.search));}return jsxs(z,{children:[jsxs(a$1,{onValueChange:J,value:m$1,children:[jsx(d,{"aria-label":"Filter search by entity",className:"fk:w-36 fk:h-9 fk:py-1 fk:rounded-r-none fk:border-border fk:shadow-none fk:corner-squircle",children:jsx(c,{})}),jsxs(e,{children:[jsx(g,{value:i,children:"All"}),f.map(e=>jsx(g,{value:e.plural,children:oe(e)},e.plural))]})]}),jsxs(m,{className:"fk:relative fk:overflow-visible fk:h-auto fk:justify-center fk:rounded-none fk:bg-transparent fk:corner-squircle",onBlur:()=>{setTimeout(()=>{l(false);},300);},onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),l(false));},shouldFilter:false,children:[jsxs("div",{className:a$2("fk:flex fk:items-center fk:border-y fk:border-r fk:border-border fk:rounded-r-md fk:bg-background fk:pl-3 fk:pr-2 fk:h-9 fk:md:w-25 fk:lg:w-75 fk:corner-squircle","fk:outline-none fk:transition-[color,box-shadow] fk:has-[input:focus-visible]:border-ring fk:has-[input:focus-visible]:ring-[3px] fk:has-[input:focus-visible]:ring-ring/50"),children:[d$1?jsx(LoaderCircle,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:shrink-0 fk:opacity-50 fk:animate-spin"}):jsx(Search,{className:"fk:mr-2 fk:h-4 fk:w-4 fk:shrink-0 fk:opacity-50"}),jsx(Command.Input,{className:a$2("fk:flex fk:h-9 fk:w-full fk:rounded-none fk:bg-transparent fk:py-1 fk:text-sm fk:outline-hidden fk:placeholder:text-muted-foreground fk:disabled:cursor-not-allowed fk:disabled:opacity-50 fk:corner-squircle",_),placeholder:n,onMouseDown:()=>{(c$1.current?.value.length??0)>0&&l(true);},onValueChange:F,ref:c$1,value:s}),s&&jsx(b,{"aria-label":"Clear search",className:"fk:flex fk:items-center fk:justify-center fk:ml-2 fk:h-6 fk:w-6 fk:text-muted-foreground fk:hover:text-foreground fk:hover:bg-foreground/10 fk:cursor-pointer fk:rounded-full fk:bg-transparent fk:corner-squircle",onClick:U,type:"button",children:jsx(X,{className:"fk:h-4 fk:w-4"})})]}),jsx("div",{className:"fk:relative fk:max-w-150",children:jsx("div",{className:a$2("fk:mt-1 fk:animate-in fk:fade-in-0 fk:zoom-in-95 fk:absolute fk:top-0 fk:z-50 fk:w-full fk:rounded-md fk:bg-popover fk:outline-hidden fk:drop-shadow-md fk:border fk:border-border fk:corner-squircle",j?"fk:block":"fk:hidden"),children:jsxs(w,{className:"fk:max-h-55 fk:overflow-auto",children:[!d$1&&jsx(q,{children:a$3}),jsx(p,{children:jsxs(r,{children:[k.length>0&&jsx(t,{"aria-hidden":"true",className:"fk:hidden!",value:"-"}),k.map(e=>jsxs(t,{className:"fk:flex",value:e._id,onSelect:H=>{t$1({entityName:e._entityName,entityNamePlural:e._entityNamePlural,entityId:H});},children:[jsx("span",{className:"fk:basis-full",children:e[Object.keys(e)[3]]}),jsx(b$1,{className:"fk:py-px fk:text-[0.6875rem] fk:leading-3 fk:bg-teal-400",children:e._entityName})]},e._id))]})})]})})})]})]})}export{be as Search};//# sourceMappingURL=search-OWF3LEWH.js.map
|
|
2
|
-
//# sourceMappingURL=search-OWF3LEWH.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {b as b$1}from'./chunk-C5Y6OZFR.js';import'./chunk-KXAGLQ2B.js';import {f,g,d as d$1}from'./chunk-2HSIWUH3.js';import {b}from'./chunk-V64P56OA.js';import {f as f$1}from'./chunk-CWJWOJRO.js';import {h}from'./chunk-TYDYAOQ7.js';import {Rc,Tc,s,ma,oa,N,e as e$2,ga,ha,ia}from'./chunk-YCCFUGWJ.js';import {v,w,b as b$4}from'./chunk-32ZU4MLE.js';import {a,d,c,e,g as g$1}from'./chunk-HDOIOXMP.js';import {t}from'./chunk-SZEGGBOC.js';import'./chunk-U45E5X3H.js';import {b as b$3,c as c$1,e as e$1}from'./chunk-USNXQOMJ.js';import {b as b$2}from'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';import {useState,useRef,useMemo,useEffect}from'react';import {Plus,LoaderCircle,Trash2,GraduationCapIcon,ArrowLeft,Info,PenLine,Eye}from'lucide-react';import Pt from'react-markdown';import {useNavigate,Link,useParams}from'react-router-dom';import ve from'swr';import At from'swr/infinite';import {history,defaultKeymap,historyKeymap,indentWithTab}from'@codemirror/commands';import {markdown}from'@codemirror/lang-markdown';import {languages}from'@codemirror/language-data';import {foldGutter,indentOnInput,bracketMatching,foldKeymap}from'@codemirror/language';import {highlightSelectionMatches,searchKeymap}from'@codemirror/search';import {Compartment,EditorState,Prec}from'@codemirror/state';import {EditorView,lineNumbers,highlightActiveLineGutter,highlightSpecialChars,drawSelection,dropCursor,highlightActiveLine,keymap,placeholder}from'@codemirror/view';import {tags}from'@lezer/highlight';import {createTheme}from'@uiw/codemirror-themes';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var je="var(--font-geist-mono), ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",Q="#212121",Y="#fafafa";function ze(t,i,o){return [t,EditorView.theme({"&":{backgroundColor:i},".cm-scroller":{backgroundColor:i},".cm-gutters":{backgroundColor:o}})]}var ce=ze(createTheme({settings:{background:Q,caret:"#f8f8f0",fontFamily:je,foreground:"#f8f8f2",gutterBackground:Q,gutterBorder:"transparent",gutterForeground:"#6d8a88",lineHighlight:"rgba(255, 255, 255, 0.1)",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)"},styles:[{color:"#6272a4",tag:[tags.comment,tags.quote,tags.strikethrough]},{color:"#6272a4",tag:[tags.meta,tags.processingInstruction]},{color:"#f1fa8c",tag:tags.string},{color:"#f91f6f",tag:[tags.atom,tags.bool,tags.number,tags.heading]},{color:"#ff79c6",tag:[tags.keyword,tags.operator,tags.tagName]},{color:"#8be9fd",tag:[tags.typeName,tags.link,tags.url]},{color:"#009fb8",tag:[tags.className,tags.attributeName,tags.monospace]},{color:"#66d9ef",tag:[tags.propertyName,tags.function(tags.propertyName)]},{color:"#009fb8",tag:[tags.definition(tags.variableName),tags.function(tags.variableName)]},{color:"#0072f5",tag:[tags.strong,tags.emphasis]},{color:"#ff5555",tag:tags.invalid}],theme:"dark"}),Q,Q),de=ze(createTheme({settings:{background:Y,caret:"#526fff",fontFamily:je,foreground:"#383a42",gutterBackground:Y,gutterBorder:"transparent",gutterForeground:"#9d9d9f",lineHighlight:"#383a420c",selection:"#e5e5e6",selectionMatch:"#e5e5e6"},styles:[{color:"#a0a1a7",tag:[tags.comment,tags.quote,tags.strikethrough]},{color:"#a0a1a7",tag:[tags.meta,tags.processingInstruction]},{color:"#50a14f",tag:tags.string},{color:"#986801",tag:[tags.attributeName]},{color:"#a626a4",tag:tags.keyword},{color:"#0072f5",tag:[tags.operator,tags.strong,tags.emphasis]},{color:"#f91f6f",tag:[tags.atom,tags.bool,tags.number,tags.heading]},{color:"#c18401",tag:[tags.typeName,tags.className]},{color:"#009fb8",tag:[tags.tagName,tags.propertyName,tags.monospace]},{color:"#4078f2",tag:[tags.link,tags.url,tags.function(tags.variableName),tags.definition(tags.variableName)]},{color:"#f91f6f",tag:tags.invalid}],theme:"light"}),Y,Y);function me(){let t=document.documentElement;return t.getAttribute("data-theme")==="dark"||t.classList.contains("dark")||t.style.colorScheme==="dark"}var xt=EditorView.theme({"&":{fontSize:"13px",height:"100%",maxHeight:"100%",maxWidth:"100%",minHeight:"0",minWidth:"0",width:"100%"},"&.cm-focused":{outline:"none"},".cm-scroller":{height:"100%",lineHeight:"1.6",minHeight:"0",minWidth:"0",overflow:"auto",width:"100%"},".cm-content":{fontSize:"13px",fontStyle:"normal",fontWeight:"400",minWidth:"0 !important",padding:"12px 0"},".cm-line, .cm-line span":{fontSize:"inherit",fontStyle:"inherit",fontWeight:"inherit",lineHeight:"inherit"},".cm-gutters":{borderRight:"1px solid transparent"},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none"}});function ue(t){return [t?ce:de,xt]}function He(t){return [EditorState.readOnly.of(t),EditorView.editable.of(!t)]}function Oe(t){let i={"aria-multiline":"true",role:"textbox"};return t.ariaLabel&&(i["aria-label"]=t.ariaLabel),t.ariaLabelledBy&&(i["aria-labelledby"]=t.ariaLabelledBy),t.ariaDescribedBy&&(i["aria-describedby"]=t.ariaDescribedBy),t.ariaInvalid&&(i["aria-invalid"]="true"),t.readOnly&&(i["aria-readonly"]="true"),i}function Xe({ariaDescribedBy:t,ariaInvalid:i,ariaLabel:o,ariaLabelledBy:l,className:f,onBlur:d,onChange:k,onSave:u,placeholder:m,readOnly:c=false,value:p}){let h=useRef(null),y=useRef(null),L=useRef(new Compartment),P=useRef(new Compartment),N=useRef(new Compartment),C=useRef(d),w=useRef(k),I=useRef(u),v=useRef(p);return C.current=d,w.current=k,I.current=u,v.current=p,useEffect(()=>{let s=h.current;if(!s)return;let g=new EditorView({parent:s,state:EditorState.create({doc:v.current,extensions:[lineNumbers(),highlightActiveLineGutter(),highlightSpecialChars(),history(),foldGutter(),drawSelection(),dropCursor(),EditorState.allowMultipleSelections.of(true),indentOnInput(),bracketMatching(),highlightActiveLine(),highlightSelectionMatches(),EditorView.lineWrapping,markdown({codeLanguages:languages}),keymap.of([...defaultKeymap,...historyKeymap,...searchKeymap,...foldKeymap,indentWithTab]),Prec.highest(keymap.of([{key:"Mod-s",run:()=>(I.current?.(),true)}])),EditorView.updateListener.of(B=>{B.docChanged&&w.current?.(B.state.doc.toString()),B.focusChanged&&!B.view.hasFocus&&C.current?.();}),L.current.of(ue(me())),P.current.of(He(c)),N.current.of(EditorView.contentAttributes.of(Oe({ariaDescribedBy:t,ariaInvalid:i,ariaLabel:o,ariaLabelledBy:l,readOnly:c}))),...m?[placeholder(m)]:[]]})});y.current=g;let K=new ResizeObserver(()=>{g.requestMeasure();});K.observe(s);let G=new MutationObserver(()=>{g.dispatch({effects:L.current.reconfigure(ue(me()))});});return G.observe(document.documentElement,{attributeFilter:["class","data-theme","style"],attributes:true}),()=>{K.disconnect(),G.disconnect(),g.destroy(),y.current=null;}},[]),useEffect(()=>{let s=y.current;s&&s.dispatch({effects:L.current.reconfigure(ue(me()))});},[de,ce]),useEffect(()=>{let s=y.current;if(!s)return;let g=s.state.doc.toString();g!==p&&s.dispatch({changes:{from:0,to:g.length,insert:p}});},[p]),useEffect(()=>{let s=y.current;s&&s.dispatch({effects:[P.current.reconfigure(He(c)),N.current.reconfigure(EditorView.contentAttributes.of(Oe({ariaDescribedBy:t,ariaInvalid:i,ariaLabel:o,ariaLabelledBy:l,readOnly:c})))]});},[t,i,o,l,c]),jsx("div",{className:f??"fk:h-full fk:min-h-0 fk:min-w-0 fk:w-full fk:overflow-hidden",ref:h})}var Je=25,Bt=[{descriptionWidth:"fk:w-44",id:"skill-a",nameWidth:"fk:w-28"},{descriptionWidth:"fk:w-52",id:"skill-b",nameWidth:"fk:w-20"},{descriptionWidth:"fk:w-40",id:"skill-c",nameWidth:"fk:w-36"},{descriptionWidth:"fk:w-48",id:"skill-d",nameWidth:"fk:w-24"},{descriptionWidth:"fk:w-36",id:"skill-e",nameWidth:"fk:w-32"},{descriptionWidth:"fk:w-56",id:"skill-f",nameWidth:"fk:w-16"}];function Wt(){return jsxs("div",{"aria-busy":"true",className:"fk:grid fk:grid-cols-1 fk:gap-x-16 fk:gap-y-1 fk:lg:grid-cols-2",children:[jsx("span",{className:"fk:sr-only",children:"Loading skills"}),Bt.map(t$1=>jsxs("div",{className:"fk:-mx-3 fk:flex fk:min-w-0 fk:items-center fk:gap-3 fk:px-3 fk:py-2",children:[jsx(t,{className:"fk:size-10 fk:shrink-0 fk:rounded-lg"}),jsxs("span",{className:"fk:flex fk:min-w-0 fk:flex-1 fk:flex-col fk:gap-1.5",children:[jsx(t,{className:`fk:h-4 ${t$1.nameWidth}`}),jsx(t,{className:`fk:h-4 ${t$1.descriptionWidth}`})]})]},t$1.id))]})}var Rt={code({children:t,className:i,node:o,...l}){return typeof i=="string"&&i.split(" ").some(d=>d.startsWith("language-"))?jsx("code",{className:i,...l,children:t}):jsx("code",{className:"fk:rounded fk:bg-muted fk:px-1.5 fk:py-0.5 fk:font-mono fk:text-[0.875em] fk:font-medium fk:before:content-none fk:after:content-none fk:corner-squircle",...l,children:t})}};function be(){let{currentProjectId:t}=f$1();return {api:useMemo(()=>t?d$1(t):null,[t]),projectId:t}}function ie({children:t}){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:t})}function jt({onVisible:t}){let i=useRef(null),o=useRef(t);return o.current=t,useEffect(()=>{let l=i.current;if(!l)return;let f=new IntersectionObserver(d=>{d.some(k=>k.isIntersecting)&&o.current();});return f.observe(l),()=>{f.disconnect();}},[]),jsx("div",{"aria-hidden":true,className:"fk:h-px",ref:i})}function zt(t,i){return t.visibility==="space"?(t.spaceId?i.get(t.spaceId):void 0)??"Space":t.visibility==="personal"?"Personal":"Project"}function Dt({skill:t}){return t.logoUrl?jsx("img",{alt:"",className:"fk:size-10 fk:shrink-0 fk:rounded-lg fk:corner-squircle",src:t.logoUrl}):jsx("span",{className:"fk:flex fk:size-10 fk:shrink-0 fk:items-center fk:justify-center fk:rounded-lg fk:bg-muted fk:text-muted-foreground fk:corner-squircle",children:jsx(GraduationCapIcon,{className:"fk:size-5"})})}function hi(){let{api:t,projectId:i}=be(),o=useNavigate(),[l,f$1]=useState(""),d=b(),k=l.trim().length>0,u=(s,g$1)=>!i||g$1&&!g$1.hasMore?null:g(i).skills({limit:Je,offset:s*Je,search:l.trim()||void 0}),{data:m,isLoading:c,setSize:p,size:h}=At(u,f),y=m?.flatMap(s=>s.skills)??[],P=m?.[m.length-1]?.hasMore??false,N=m!==void 0&&h>m.length,C=c&&y.length===0;if(!i||!t)return jsx(ie,{children:"Select a project to view skills."});function w(){p(s=>s+1);}let I="No skills yet.";k&&(I="No skills match your search.");let v=jsx("div",{className:"fk:grid fk:grid-cols-1 fk:gap-x-16 fk:gap-y-1 fk:lg:grid-cols-2",children:y.map(s=>jsxs("button",{type:"button",onClick:()=>o(s.id),className:"fk:-mx-3 fk:flex fk:min-w-0 fk:items-center fk:gap-3 fk:rounded-lg fk:px-3 fk:py-2 fk:text-left fk:transition-colors fk:hover:bg-accent fk:focus-visible:bg-accent fk:focus-visible:outline-none fk:corner-squircle",children:[jsx(Dt,{skill:s}),jsxs("span",{className:"fk:min-w-0 fk:flex-1",children:[jsx("span",{className:"fk:block fk:truncate fk:text-sm fk:font-medium",children:s.name}),jsx("span",{className:"fk:block fk:truncate fk:text-sm fk:text-muted-foreground",children:s.description})]})]},s.id))});return C?v=jsx(Wt,{}):y.length===0&&(v=jsx(Rc,{children:jsx(Tc,{children:I})})),jsxs("main",{className:"fk:flex fk:min-h-0 fk:flex-1 fk:flex-col",children:[jsx(b$1,{}),jsx("div",{className:"fk:min-h-0 fk:flex-1 fk:overflow-auto",children:jsxs("div",{className:"fk:mx-auto fk:flex fk:w-full fk:max-w-4xl fk:flex-col fk:gap-8 fk:py-6 fk:pl-4 fk:pr-6",children:[jsxs("div",{children:[jsx("h2",{className:"fk:text-2xl fk:font-semibold",children:"Skills for your agents"}),jsx("p",{className:"fk:mt-2 fk:text-muted-foreground",children:"Reusable Markdown instructions that agents load when relevant, or always when attached to an automation."})]}),jsxs("div",{className:"fk:flex fk:flex-wrap fk:items-center fk:gap-3",children:[jsx(s,{"aria-label":"Search skills",className:"fk:w-full fk:max-w-xs",placeholder:"Search skills\u2026",value:l,onChange:s=>{p(1),f$1(s.target.value);}}),d?jsx(b$2,{asChild:true,className:"fk:ml-auto",size:"sm",children:jsxs(Link,{to:"new",children:[jsx(Plus,{}),"New Skill"]})}):jsx(ma,{disabled:true,children:jsxs(b$2,{className:"fk:ml-auto",disabled:true,size:"sm",children:[jsx(Plus,{}),"New Skill"]})})]}),v,P&&!N?jsx(jt,{onVisible:w}):null,N?jsxs("div",{className:"fk:flex fk:items-center fk:justify-center fk:gap-2 fk:py-4 fk:text-sm fk:text-muted-foreground",children:[jsx(LoaderCircle,{className:"fk:size-4 fk:animate-spin"}),jsx("span",{children:"Loading more skills..."})]}):null]})})]})}function te({className:t,id:i,message:o}){return jsx("p",{className:`fk:text-sm fk:text-destructive ${t??""}`,id:i,children:o})}function D({children:t,hint:i,htmlFor:o,id:l}){return jsxs("div",{className:"fk:mb-1.5 fk:pl-2.5 fk:flex fk:items-center fk:gap-1",children:[jsx(e$2,{htmlFor:o,id:l,children:t}),jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx("button",{"aria-label":`About ${t.toLowerCase()}`,className:"fk:rounded-sm fk:text-muted-foreground hover:fk:text-foreground fk:corner-squircle",type:"button",children:jsx(Info,{className:"fk:size-3.5"})})}),jsx(e$1,{className:"fk:max-w-xs",children:i})]})]})}function Se({actions:t,title:i}){return jsxs(Fragment,{children:[jsxs("div",{className:"fk:flex fk:shrink-0 fk:items-center fk:gap-2 fk:pr-4",children:[jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx(N,{className:"fk:-ml-1 fk:h-4 fk:w-4"})}),jsx(e$1,{children:"Toggle Sidebar"})]}),jsx(v,{orientation:"vertical",className:"fk:h-4"}),jsx("h1",{className:"fk:min-w-0 fk:flex-1 fk:truncate fk:text-lg fk:font-semibold fk:leading-none fk:tracking-tight",children:i}),t]}),jsx(b$2,{asChild:true,className:"fk:shrink-0 fk:w-fit",size:"sm",variant:"ghost",children:jsxs(Link,{relative:"path",to:"..",children:[jsx(ArrowLeft,{className:"fk:mr-2 fk:size-4"}),"Skills"]})})]})}function Ht(){return jsxs("div",{"aria-busy":"true",className:"fk:flex fk:h-full fk:min-h-0 fk:min-w-0 fk:flex-col fk:gap-3 fk:overflow-hidden fk:pb-3",children:[jsx("span",{className:"fk:sr-only",children:"Loading skill"}),jsx(Se,{actions:jsx(t,{className:"fk:h-8 fk:w-24"}),title:jsx(t,{className:"fk:h-5 fk:w-40"})}),jsxs("div",{className:"fk:m-auto fk:flex fk:min-h-0 fk:w-full fk:max-w-6xl fk:flex-1 fk:flex-col fk:gap-8 fk:px-6",children:[jsxs("div",{className:"fk:grid fk:shrink-0 fk:gap-3 fk:lg:grid-cols-[minmax(0,1fr)_minmax(0,1.6fr)_auto]",children:[["name","description"].map(t$1=>jsxs("div",{className:"fk:flex fk:flex-col fk:gap-2",children:[jsx(t,{className:"fk:h-4 fk:w-20"}),jsx(t,{className:"fk:h-9 fk:w-full"})]},t$1)),jsxs("div",{className:"fk:flex fk:flex-col fk:gap-2",children:[jsx(t,{className:"fk:h-4 fk:w-20"}),jsx(t,{className:"fk:h-9 fk:w-32"})]})]}),jsxs("div",{className:"fk:flex fk:min-h-0 fk:flex-1 fk:flex-col fk:gap-1.5",children:[jsx(t,{className:"fk:h-4 fk:w-16"}),jsx(t,{className:"fk:min-h-48 fk:flex-1 fk:rounded-md"})]})]})]})}function Ke({content:t,onBlur:i,onChange:o,onSave:l,readOnly:f=false,showContentError:d,validationMessage:k}){let[u,m]=useState("write"),c=t.length>5e4,p;return t.trim()?p=jsx(Pt,{components:Rt,children:t}):p=jsx("p",{className:"fk:text-muted-foreground",children:"Nothing to preview."}),jsxs("div",{className:"fk:flex fk:min-h-0 fk:min-w-0 fk:flex-1 fk:flex-col fk:gap-1.5",children:[jsxs("div",{className:"fk:pl-3.25 fk:flex fk:shrink-0 fk:items-center fk:gap-1",children:[jsx(e$2,{htmlFor:"skill-content",id:"skill-content-label",children:"Content"}),jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx("button",{"aria-label":"About skill content",className:"fk:rounded-sm fk:text-muted-foreground hover:fk:text-foreground fk:corner-squircle",type:"button",children:jsx(Info,{className:"fk:size-3.5"})})}),jsx(e$1,{className:"fk:max-w-sm",children:"The skill itself, in Markdown. Write it like instructions for a capable colleague: procedures, rules, examples, and edge cases. Attached skills are always loaded; other visible skills are loaded on demand."})]})]}),jsxs("div",{className:`fk:flex fk:min-h-0 fk:min-w-0 fk:flex-1 fk:flex-col fk:ml-0.75 fk:overflow-hidden fk:rounded-md fk:border ${d?"fk:border-destructive":""} fk:corner-squircle`,children:[jsxs("div",{className:"fk:flex fk:shrink-0 fk:items-center fk:justify-between fk:gap-2 fk:border-b fk:px-2.5 fk:py-1",children:[jsx(ga,{value:u,onValueChange:h=>{m(h==="preview"?"preview":"write");},children:jsxs(ha,{children:[jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx("span",{className:"fk:inline-flex",children:jsx(ia,{"aria-label":"Write",className:"fk:px-2.5",value:"write",children:jsx(PenLine,{className:"fk:size-3.5"})})})}),jsx(e$1,{children:"Write"})]}),jsxs(b$3,{children:[jsx(c$1,{asChild:true,children:jsx("span",{className:"fk:inline-flex",children:jsx(ia,{"aria-label":"Preview",className:"fk:px-2.5",value:"preview",children:jsx(Eye,{className:"fk:size-3.5"})})})}),jsx(e$1,{children:"Preview"})]})]})}),jsxs("span",{className:c?"fk:text-xs fk:text-destructive":"fk:text-xs fk:text-muted-foreground",children:[t.length.toLocaleString()," / ",5e4.toLocaleString()]})]}),jsx("div",{className:"fk:min-h-0 fk:min-w-0 fk:flex-1 fk:overflow-hidden",hidden:u!=="write",children:jsx(Xe,{ariaDescribedBy:d?"skill-content-error":void 0,ariaInvalid:d,ariaLabelledBy:"skill-content-label",className:"fk:h-full fk:min-h-0 fk:min-w-0 fk:w-full fk:overflow-hidden",readOnly:f,value:t,onBlur:i,onChange:o,onSave:l})}),u==="preview"?jsx(w,{className:"fk:min-h-0 fk:flex-1",children:jsx("div",{className:"fk:prose fk:prose-sm fk:dark:prose-invert fk:max-w-none fk:px-4 fk:py-3",children:p})}):null,d&&k?jsx(te,{className:"fk:border-t fk:px-3 fk:py-2",id:"skill-content-error",message:k}):null]})]})}function Ge({api:t,mode:i,onSaved:o,projectId:l,skill:f$1}){let[d$1,k]=useState(f$1?.name??""),[u,m]=useState(f$1?.description??""),[c$1,p]=useState(f$1?.content??""),[h$1,y]=useState(f$1?.visibility??"project"),[L,P]=useState(f$1?.spaceId??null),[N,C]=useState(false),w=useRef(false),[I,v]=useState(""),[s$1,g$2]=useState({content:false,description:false,name:false}),K=useNavigate(),{data:G}=ve(g(l).spaces,f),[,B]=h(),H=b(),$e=B.user?.spaces??[],xe=(G?.spaces??[]).filter(a=>$e.includes(a.code)),ne="";c$1.trim()?c$1.length>5e4&&(ne=`Content must be at most ${String(5e4)} characters`):ne="Content is required";let b$1={content:ne,description:u.trim()?"":"Description is required",name:d$1.trim()?"":"Name is required",space:h$1==="space"&&!L?"Select a space":""},ae=!b$1.content&&!b$1.description&&!b$1.name&&!b$1.space,$=s$1.name&&!!b$1.name,U=s$1.description&&!!b$1.description,Ue=s$1.content&&!!b$1.content,Ze=i==="create"?"New Skill":f$1?.name??"Skill",se="Update skill";N?se="Saving...":i==="create"&&(se="Create skill");async function ye(){if(!H||w.current)return;if(!ae){g$2({content:true,description:true,name:true});return}w.current=true,C(true),v("");let a={content:c$1,description:u,name:d$1,spaceId:h$1==="space"?L:null,visibility:h$1};try{let M=i==="create"||!f$1?await t.createSkill(a):await t.updateSkill(f$1.id,a);if(!M.success){v(Array.isArray(M.errorMessage)?M.errorMessage.join(", "):M.errorMessage);return}oa.success(i==="create"||!f$1?"Skill created.":"Skill saved."),o(M.skill);}catch(M){v(M instanceof Error?M.message:"Failed to save skill.");}finally{w.current=false,C(false);}}async function Qe(a){a.preventDefault(),await ye();}async function Ye(){if(!(!f$1||!H||w.current)){w.current=true,C(true),v("");try{let a=await t.deleteSkill(f$1.id);if(!a.success){v(Array.isArray(a.errorMessage)?a.errorMessage.join(", "):a.errorMessage);return}K("..",{relative:"path"});}catch(a){v(a instanceof Error?a.message:"Failed to delete skill.");}finally{w.current=false,C(false);}}}return jsxs("div",{className:"fk:flex fk:h-full fk:min-h-0 fk:min-w-0 fk:flex-col fk:gap-3 fk:pb-3",children:[jsx(Se,{actions:jsxs("div",{className:"fk:flex fk:items-center fk:gap-3",children:[ae?null:jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:"Complete the required fields to save"}),i==="edit"&&f$1?jsxs(b$2,{disabled:N||!H,size:"sm",type:"button",variant:"outline",onClick:()=>{Ye();},children:[jsx(Trash2,{}),"Delete"]}):null,jsx(ma,{disabled:!H,children:jsx(b$2,{disabled:N||!ae||!H,form:"skill-editor-form",size:"sm",type:"submit",children:se})})]}),title:Ze}),I?jsx("div",{className:"fk:shrink-0 fk:rounded-md fk:border fk:border-destructive/30 fk:bg-destructive/5 fk:p-3 fk:text-sm fk:text-destructive fk:corner-squircle",children:I}):null,jsxs("form",{className:"fk:flex fk:min-h-0 fk:min-w-0 fk:flex-1 fk:flex-col fk:gap-6 fk:w-full fk:max-w-6xl fk:m-auto fk:gap-8 fk:px-4",id:"skill-editor-form",onSubmit:a=>{Qe(a);},children:[jsxs("div",{className:"fk:grid fk:min-w-0 fk:shrink-0 fk:gap-3 fk:px-0.75 fk:lg:grid-cols-[minmax(0,1fr)_minmax(0,1.6fr)_auto]",children:[jsxs("div",{children:[jsx(D,{hint:"Identifying label for this skill",htmlFor:"skill-name",children:"Name"}),jsx(s,{"aria-describedby":$?"skill-name-error":void 0,"aria-invalid":$,className:$?"fk:border-destructive focus-visible:fk:ring-destructive":"",id:"skill-name",value:d$1,onBlur:()=>g$2(a=>({...a,name:true})),onChange:a=>k(a.target.value)}),$?jsx(te,{id:"skill-name-error",message:b$1.name}):null]}),jsxs("div",{children:[jsx(D,{hint:"One or two sentences describing when to use this skill. Agents rely on it to decide whether the skill applies to their current task.",htmlFor:"skill-description",children:"Description"}),jsx(s,{"aria-describedby":U?"skill-description-error":void 0,"aria-invalid":U,className:U?"fk:border-destructive focus-visible:fk:ring-destructive":"",id:"skill-description",placeholder:"e.g. Rules for writing product descriptions in our brand voice",value:u,onBlur:()=>g$2(a=>({...a,description:true})),onChange:a=>m(a.target.value)}),U?jsx(te,{id:"skill-description-error",message:b$1.description}):null]}),jsxs("div",{children:[jsx(D,{hint:"Who can see and use this skill. Space skills are only visible to members of the selected space and only usable by automations in that space; personal skills are private to you.",htmlFor:"skill-visibility",children:"Visibility"}),jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsxs(a,{value:h$1,onValueChange:a=>{y(a==="space"||a==="personal"?a:"project"),a!=="space"&&P(null);},children:[jsx(d,{"aria-label":"Visibility",className:"fk:w-fit fk:min-w-26",id:"skill-visibility",children:jsx(c,{})}),jsxs(e,{align:"start",children:[jsx(g$1,{value:"project",children:"Project"}),jsx(g$1,{disabled:xe.length===0,value:"space",children:"Space"}),jsx(g$1,{value:"personal",children:"Personal"})]})]}),h$1==="space"?jsxs(a,{value:L??"",onValueChange:a=>{P(a||null);},children:[jsx(d,{"aria-label":"Space",className:"fk:w-fit fk:min-w-34",children:jsx(c,{placeholder:"Select a space"})}),jsx(e,{align:"start",children:xe.map(a=>jsx(g$1,{value:a.id,children:a.label},a.id))})]}):null]}),h$1==="space"&&b$1.space?jsx(te,{message:b$1.space}):null]})]}),jsx(Ke,{content:c$1,showContentError:Ue,validationMessage:b$1.content,onBlur:()=>g$2(a=>({...a,content:true})),onChange:p,onSave:()=>{ye();}})]})]})}function Ot({projectId:t,skill:i,spaceLabelById:o}){let l=b(),f=useNavigate(),[d$1,k]=useState(false),[u,m]=useState("");async function c$1(){k(true),m("");let p;try{p=await fetch(`/api/flexkit/${t}/skills/${i.id}/fork`,{method:"POST",credentials:"include"});}catch{m("Unable to create a copy. Try again."),k(false);return}if(k(false),!p.ok){m("Unable to create a copy. Check your permissions.");return}f("..",{relative:"path"});}return jsxs("div",{className:"fk:flex fk:h-full fk:min-h-0 fk:min-w-0 fk:flex-col fk:gap-3 fk:pb-3",children:[jsx(Se,{actions:jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(b$4,{variant:"secondary",children:i.source==="plugin"?"Plugin":"Code"}),i.source==="plugin"&&jsx(b$2,{type:"button",disabled:d$1||!l,onClick:()=>{c$1();},size:"sm",children:"Edit a copy"})]}),title:i.name}),jsxs("div",{className:"fk:flex fk:flex-col fk:h-full fk:px-4 fk:gap-3 fk:max-w-6xl fk:m-auto",children:[jsxs("div",{className:"fk:shrink-0 fk:rounded-md fk:border fk:bg-muted/30 fk:px-3 fk:py-2 fk:corner-squircle",children:[jsx("p",{className:"fk:text-sm fk:font-medium",children:"Version-controlled skill"}),jsx("p",{className:"fk:text-sm fk:text-muted-foreground",children:i.source==="plugin"?"This skill is managed by its plugin. Edit a copy to create a personal Studio skill.":"Edit this skill in your repository and re-sync it from the Custom Tools settings."})]}),jsxs("div",{className:"fk:grid fk:min-w-0 fk:shrink-0 fk:gap-3 fk:lg:grid-cols-[minmax(0,1fr)_minmax(0,1.6fr)_auto]",children:[jsxs("div",{children:[jsx(D,{hint:"Identifying label for this skill",htmlFor:"skill-name",children:"Name"}),jsx(s,{className:"fk:opacity-100!",disabled:true,id:"skill-name",value:i.name})]}),jsxs("div",{children:[jsx(D,{hint:"One or two sentences describing when to use this skill. Agents rely on it to decide whether the skill applies to their current task.",htmlFor:"skill-description",children:"Description"}),jsx(s,{className:"fk:opacity-100!",disabled:true,id:"skill-description",placeholder:"e.g. Rules for writing product descriptions in our brand voice",value:i.description})]}),jsxs("div",{children:[jsx(D,{hint:"Who can see and use this skill. Space skills are only visible to members of the selected space and only usable by automations in that space; personal skills are private to you.",htmlFor:"skill-visibility",children:"Visibility"}),jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsxs(a,{disabled:true,value:i.visibility,children:[jsx(d,{"aria-label":"Visibility",className:"fk:w-fit fk:min-w-26 fk:opacity-100!",id:"skill-visibility",children:jsx(c,{})}),jsxs(e,{align:"start",children:[jsx(g$1,{value:"project",children:"Project"}),jsx(g$1,{disabled:!i.spaceId,value:"space",children:"Space"}),jsx(g$1,{value:"personal",children:"Personal"})]})]}),i.visibility==="space"?jsxs(a,{disabled:true,value:i.spaceId??"",children:[jsx(d,{"aria-label":"Space",className:"fk:w-fit fk:min-w-34 fk:opacity-100!",children:jsx(c,{placeholder:"Select a space"})}),jsx(e,{align:"start",children:jsx(g$1,{value:i.spaceId??"",children:zt(i,o)})})]}):null]})]})]}),u&&jsx("p",{role:"alert",children:u}),jsx(Ke,{content:i.content,readOnly:true})]})]})}function vi(){let{api:t,projectId:i}=be(),o=useNavigate();return !i||!t?jsx(ie,{children:"Select a project to create skills."}):jsx(Ge,{api:t,mode:"create",projectId:i,onSaved:()=>o("..",{relative:"path"})})}function bi(){let{api:t,projectId:i}=be(),{skillId:o}=useParams(),{data:l,error:f$1,isLoading:d,mutate:k}=ve(i&&o?g(i).skill(o):null,f),{data:u}=ve(i?g(i).spaces:null,f);if(!i||!t||!o)return jsx(ie,{children:"Select a skill."});if(f$1)return jsx(ie,{children:"Failed to load skill."});if(d||!l?.skill)return jsx(Ht,{});let m=new Map((u?.spaces??[]).map(c=>[c.id,c.label]));return l.skill.source!=="studio"?jsx(Ot,{projectId:i,skill:l.skill,spaceLabelById:m}):jsx(Ge,{api:t,mode:"edit",projectId:i,skill:l.skill,onSaved:c=>{c?k({skill:c},{revalidate:false}):k();}})}export{vi as CreateSkillPage,bi as SkillDetailPage,Ge as SkillForm,hi as SkillsPage};//# sourceMappingURL=skills-pages-VCXZFQFD.js.map
|
|
2
|
-
//# sourceMappingURL=skills-pages-VCXZFQFD.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {h}from'./chunk-TYDYAOQ7.js';import {t,e,g,a,b as b$2,c,h as h$1,n,o,k,j,p}from'./chunk-SZEGGBOC.js';import {b}from'./chunk-U45E5X3H.js';import {b as b$1}from'./chunk-6NRQMG26.js';import'./chunk-O2QMYUPS.js';import v from'boring-avatars';import {Monitor,Moon,Sun}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';var A=["#06d9b6","#a4f479","#d4d323","#fb468f","#0ec4f1"];function F({projectId:D}){let{theme:r,setTheme:t$1}=b(),[C,n$1]=h();return C?jsx(t,{className:"fk:h-8 fk:w-8 fk:rounded-full"}):jsxs(e,{children:[jsx(g,{asChild:true,children:jsx(b$1,{className:"fk:relative fk:h-8 fk:w-8 fk:rounded-full",variant:"ghost",children:jsxs(a,{className:"fk:h-8 fk:w-8",children:[n$1.user?.avatar_url?jsx(b$2,{alt:n$1.user.display_name,src:n$1.user.avatar_url}):null,jsx(c,{className:"fk:bg-transparent",children:jsx(v,{className:"fk:size-8",colors:A,name:n$1.user?.id??"user",size:32,variant:"marble"})})]})})}),jsxs(h$1,{align:"end",className:"fk:w-56",forceMount:true,children:[jsx(n,{className:"font-normal",children:jsxs("div",{className:"fk:flex fk:flex-col fk:space-y-1",children:[jsx("p",{className:"fk:text-sm fk:font-medium fk:leading-none",children:n$1.user?.display_name}),jsx("p",{className:"fk:text-xs fk:leading-none fk:text-muted-foreground",children:n$1.user?.email})]})}),jsx(o,{}),jsx(n,{children:"Theme"}),jsxs(k,{checked:r==="system",onCheckedChange:()=>{t$1("system");},children:[jsx(Monitor,{className:"fk:mr-2 fk:h-4 fk:w-4"}),jsx("span",{children:"System"})]}),jsxs(k,{checked:r==="dark",onCheckedChange:()=>{t$1("dark");},children:[jsx(Moon,{className:"fk:mr-2 fk:h-4 fk:w-4"}),jsx("span",{children:"Dark"})]}),jsxs(k,{checked:r==="light",onCheckedChange:()=>{t$1("light");},children:[jsx(Sun,{className:"fk:mr-2 fk:h-4 fk:w-4"}),jsx("span",{children:"Light"})]}),jsx(o,{}),jsxs(j,{onClick:()=>{n$1.logout(D).then(()=>{}).catch(()=>{});},children:["Log out",jsx(p,{children:"\u21E7\u2318Q"})]})]})]})}export{F as UserNav};//# sourceMappingURL=user-nav-DCAHVWN7.js.map
|
|
2
|
-
//# sourceMappingURL=user-nav-DCAHVWN7.js.map
|