Spaces:
Running
Running
| import{r as p,j as e}from"./react-CIdJ77ke.js";import{T as r}from"./@google-CcUHq7Ay.js";import{u as b,g as T,A as g,l as j,C as N,L as C}from"./index-CX7Qxd1D.js";import{F as E}from"./taxonomyService-CBHwv5t5.js";import{A as k,e as S}from"./workspaceConnectorService-KhhKdOYD.js";import"./@braintree-DzxiOROe.js";import"./react-dom-R9L8nDNe.js";import"./scheduler-CoSDG3-6.js";import"./idb-Dob3nYDb.js";import"./marked-BrGMJkBT.js";import"./mermaid-KwKZWwy0.js";import"./dayjs-CeEF-NGT.js";import"./d3-transition-CiCB8KJE.js";import"./d3-timer-DdKHrDhs.js";import"./d3-dispatch-kxCwF96_.js";import"./d3-interpolate-CtIaNujU.js";import"./d3-color-amxIadob.js";import"./d3-selection-C52G7wmG.js";import"./d3-ease-DRPgKoYJ.js";import"./d3-zoom-BYoC3mS3.js";import"./dompurify-J5RlrwSC.js";import"./dagre-d3-es-CTpFWynZ.js";import"./lodash-es-Dt6r0yiR.js";import"./d3-shape-CX8xTzfR.js";import"./d3-path-CimkQT29.js";import"./d3-fetch-BOsq7VnW.js";import"./khroma-DUX6PT6k.js";import"./uuid-DhYbOkY1.js";import"./d3-scale-DRZz3QW5.js";import"./internmap-BkD7Hj8s.js";import"./d3-array-DGRYoJHh.js";import"./d3-format-CzD4bSOQ.js";import"./d3-time-format-CUNN4Ell.js";import"./d3-time-6cSPyVSY.js";import"./d3-axis-DSWTncID.js";import"./elkjs-oKFFZvz7.js";import"./cytoscape-DtBltrT8.js";import"./cytoscape-cose-bilkent-Cgr1thlj.js";import"./cose-base-CwCxnKwh.js";import"./layout-base-CMXQqlmj.js";import"./d3-sankey-DgqkLiUE.js";import"./d3-scale-chromatic-B-NsZVaP.js";import"./ts-dedent-DrFu-skq.js";import"./stylis-D5iaQeiq.js";import"./mdast-util-from-markdown-CLAsVoWb.js";import"./micromark-CTBPIv-_.js";import"./micromark-util-combine-extensions-Bka6Sc1c.js";import"./micromark-util-chunked-DrRIdSP-.js";import"./micromark-factory-space-x2vfxbz5.js";import"./micromark-util-character-Bcm1tP9o.js";import"./micromark-core-commonmark-AH8VCgT7.js";import"./micromark-util-classify-character-Cq7Fg3xE.js";import"./micromark-util-resolve-all-PQCKh0dx.js";import"./decode-named-character-reference-C3-224fz.js";import"./micromark-util-subtokenize-QwsxNXk2.js";import"./micromark-factory-destination-CypD_wgM.js";import"./micromark-factory-label-CRHH4ZHP.js";import"./micromark-factory-title-B7kCBvC9.js";import"./micromark-factory-whitespace-B322EA6O.js";import"./micromark-util-normalize-identifier-C9ANKk3v.js";import"./micromark-util-html-tag-name-DbKNfynz.js";import"./micromark-util-decode-numeric-character-reference-DRnCnno4.js";import"./micromark-util-decode-string-DJl8Y_PO.js";import"./unist-util-stringify-position-Ch_qCilz.js";import"./mdast-util-to-string-C_aolqmU.js";import"./jszip-CFFhfFtd.js";import"./octokit-B6bKu3NB.js";import"./@octokit-MBEWYTsi.js";import"./bottleneck-D_vuF9V7.js";import"./universal-user-agent-CLgqIJsR.js";import"./before-after-hook-y8XtM9xW.js";import"./fast-content-type-parse-3SwieiST.js";const w=[{name:"navigateTo",description:"Navigates to a specific feature page.",parameters:{type:r.OBJECT,properties:{featureId:{type:r.STRING,description:"The ID of the feature to navigate to.",enum:g}},required:["featureId"]}},{name:"runFeatureWithInput",description:"Navigates to a feature and passes initial data to it.",parameters:{type:r.OBJECT,properties:{featureId:{type:r.STRING,description:"The ID of the feature to run.",enum:g},props:{type:r.OBJECT,description:"An object containing the initial properties for the feature, based on its required inputs.",properties:{initialCode:{type:r.STRING},initialPrompt:{type:r.STRING},beforeCode:{type:r.STRING},afterCode:{type:r.STRING},logInput:{type:r.STRING},diff:{type:r.STRING},codeInput:{type:r.STRING},jsonInput:{type:r.STRING}}}},required:["featureId","props"]}}],v=[...w,{name:"runWorkspaceAction",description:"Executes a defined action on a connected workspace service like Jira, Slack, or GitHub.",parameters:{type:r.OBJECT,properties:{actionId:{type:r.STRING,description:"The unique identifier for the action to execute.",enum:[...k.keys()]},params:{type:r.OBJECT,description:"An object containing the parameters for the action, matching its required inputs."}},required:["actionId","params"]}}],R=E.map(o=>`- ${o.name} (${o.id}): ${o.description} Inputs: ${o.inputs}`).join(` | |
| `),u=({text:o,onClick:i})=>e.jsx("button",{onClick:()=>i(o),className:"px-3 py-1.5 bg-surface border border-border rounded-full text-xs hover:bg-gray-100 dark:hover:bg-slate-700 transition-colors",children:o}),He=()=>{const{dispatch:o}=b(),[i,m]=p.useState(""),[c,f]=p.useState(!1),[x,a]=p.useState(""),h=p.useCallback(async()=>{if(i.trim()){f(!0),a("");try{const t=await T(i,v,R);if(t.functionCalls&&t.functionCalls.length>0){const I=t.functionCalls[0],{name:d,args:n}=I;switch(a(`Understood! Executing command: ${d}`),d){case"navigateTo":o({type:"SET_VIEW",payload:{view:n.featureId}});break;case"runFeatureWithInput":o({type:"SET_VIEW",payload:{view:n.featureId,props:n.props}});break;case"runWorkspaceAction":try{const s=await S(n.actionId,n.params);a(`Action '${n.actionId}' executed successfully. | |
| Result: \`\`\`json | |
| ${JSON.stringify(s,null,2)} | |
| \`\`\``)}catch(s){a(`Action failed: ${s instanceof Error?s.message:"Unknown error"}`)}break;default:a(`Unknown command: ${d}`)}m("")}else a(t.text)}catch(t){j(t,{prompt:i}),a(t instanceof Error?t.message:"An unknown error occurred.")}finally{f(!1)}}},[i,o]),y=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),h())},l=t=>{m(t)};return e.jsxs("div",{className:"h-full flex flex-col p-4 sm:p-6 lg:p-8 text-text-primary",children:[e.jsxs("header",{className:"mb-6 text-center",children:[e.jsxs("h1",{className:"text-4xl font-extrabold tracking-tight flex items-center justify-center",children:[e.jsx(N,{}),e.jsx("span",{className:"ml-3",children:"AI Command Center"})]}),e.jsx("p",{className:"mt-2 text-lg text-text-secondary",children:"What would you like to do?"})]}),e.jsxs("div",{className:"flex-grow flex flex-col justify-end max-w-3xl w-full mx-auto",children:[x&&e.jsx("div",{className:"mb-4 p-4 bg-surface rounded-lg text-text-primary border border-border",children:e.jsxs("p",{children:[e.jsx("strong",{children:"AI:"})," ",x]})}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{value:i,onChange:t=>m(t.target.value),onKeyDown:y,disabled:c,placeholder:'Try "explain this code: const a = 1;" or "open the theme designer"',className:"w-full p-4 pr-28 rounded-lg bg-surface border border-border focus:ring-2 focus:ring-primary focus:outline-none resize-none shadow-sm",rows:2}),e.jsx("button",{onClick:h,disabled:c,className:"btn-primary absolute right-3 top-1/2 -translate-y-1/2 px-4 py-2",children:c?e.jsx(C,{}):"Send"})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2 mt-4",children:[e.jsx(u,{text:"Open Theme Designer",onClick:l}),e.jsx(u,{text:"Generate a commit for a bug fix",onClick:l}),e.jsx(u,{text:"Create a regex for email validation",onClick:l})]}),e.jsx("p",{className:"text-xs text-text-secondary text-center mt-2",children:"Press Enter to send, Shift+Enter for new line."})]})]})};export{He as AiCommandCenter}; | |
| //# sourceMappingURL=AiCommandCenter-ClG32klM.js.map | |