circuschief 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/package.json +1 -1
  2. package/packages/web/dist/assets/{ActiveSessionsView-BQc76Jc8.js → ActiveSessionsView-2qqzd1tM.js} +1 -1
  3. package/packages/web/dist/assets/{AgentLogsView-CTCjHjsu.js → AgentLogsView-DbulYJ7p.js} +1 -1
  4. package/packages/web/dist/assets/{ArchiveConfirmModal-CCxSZ52u.js → ArchiveConfirmModal-Byx5Usg6.js} +1 -1
  5. package/packages/web/dist/assets/{CommandButtonDetailView-CF_-LXpU.js → CommandButtonDetailView-TMSVeeLH.js} +1 -1
  6. package/packages/web/dist/assets/{EffortLevelSelector-DPofLvm-.js → EffortLevelSelector-DIj0Wykj.js} +1 -1
  7. package/packages/web/dist/assets/{GeneralSettingsView-BY1G-Kv8.js → GeneralSettingsView-1a3MKUwM.js} +1 -1
  8. package/packages/web/dist/assets/{InterpolationHelp-CgdbNcJB.js → InterpolationHelp-DX4mjTd3.js} +1 -1
  9. package/packages/web/dist/assets/MarkdownEditor-DeCPmMTP.js +2 -0
  10. package/packages/web/dist/assets/{ModelSelector-BBn_Ve0D.js → ModelSelector-C9RlCVhC.js} +1 -1
  11. package/packages/web/dist/assets/{NewSessionView-Bo5l49nu.js → NewSessionView-B9W_35D0.js} +1 -1
  12. package/packages/web/dist/assets/{PathChooser-Cx9gQ-Qt.js → PathChooser-Di96sZpx.js} +1 -1
  13. package/packages/web/dist/assets/{ProjectEditView-BFuscj-V.js → ProjectEditView-ZnWKaSqt.js} +1 -1
  14. package/packages/web/dist/assets/{ProjectListView-Dj0jBZ46.js → ProjectListView-C_yWe1QB.js} +1 -1
  15. package/packages/web/dist/assets/{ProjectNewView-Brdp-xUu.js → ProjectNewView-ONPpDPNA.js} +1 -1
  16. package/packages/web/dist/assets/{ProvidersView-Cxc-1skq.js → ProvidersView-BPd0xozI.js} +1 -1
  17. package/packages/web/dist/assets/{QuickResponseSettings-B2eVAtHW.js → QuickResponseSettings-DB8MD7dm.js} +1 -1
  18. package/packages/web/dist/assets/{QuickResponsesPanel-lU8pW2B0.js → QuickResponsesPanel-D0B5nzGw.js} +1 -1
  19. package/packages/web/dist/assets/{ResizableTextarea-DSy1mWGY.js → ResizableTextarea-DDChlp5b.js} +1 -1
  20. package/packages/web/dist/assets/{SessionCard-BvjLwVYg.js → SessionCard-BD6MuoON.js} +1 -1
  21. package/packages/web/dist/assets/{SessionDetailView-BQbPg-RJ.js → SessionDetailView-lNqco-dG.js} +3 -3
  22. package/packages/web/dist/assets/{SessionFormOptions-BgqFR-5f.js → SessionFormOptions-Doyl_mON.js} +1 -1
  23. package/packages/web/dist/assets/{SessionListView-CYIHI8qF.js → SessionListView-B6emPw4T.js} +1 -1
  24. package/packages/web/dist/assets/{SessionLogStream-B-FwUMJQ.js → SessionLogStream-BFjl4wy7.js} +1 -1
  25. package/packages/web/dist/assets/{SettingsView-fZxpiGp7.js → SettingsView-CJNMi4aJ.js} +1 -1
  26. package/packages/web/dist/assets/{SlashCommandWizard-BgaOw9W3.js → SlashCommandWizard-CpNLU4vI.js} +1 -1
  27. package/packages/web/dist/assets/{SummarySettingsView-eeu1Xq86.js → SummarySettingsView-DGjXv3Px.js} +1 -1
  28. package/packages/web/dist/assets/{TemplateDetailView-DEPKSwDo.js → TemplateDetailView-DqA7M5Pe.js} +1 -1
  29. package/packages/web/dist/assets/{commandButtons-DNSHH8IA.js → commandButtons-CCojrcrv.js} +1 -1
  30. package/packages/web/dist/assets/{index-DkVb9W_J.js → index-02CN8N8c.js} +1 -1
  31. package/packages/web/dist/assets/{index-DmKHPbIa.js → index-B0XHqJYv.js} +1 -1
  32. package/packages/web/dist/assets/{index-DQkhDeTA.js → index-BGUUMf-N.js} +1 -1
  33. package/packages/web/dist/assets/{index-Bi3XvF_f.js → index-BN1MywtA.js} +1 -1
  34. package/packages/web/dist/assets/{index-BZlHgDSz.js → index-Bs1D4Ibo.js} +1 -1
  35. package/packages/web/dist/assets/{index-BqXoPf_D.js → index-BwySZO9U.js} +1 -1
  36. package/packages/web/dist/assets/{index-CYllQ3Vd.js → index-CLVE7KEk.js} +1 -1
  37. package/packages/web/dist/assets/{index-prTEzzgO.js → index-D3EUAUMi.js} +1 -1
  38. package/packages/web/dist/assets/{index-DWP8iCBp.js → index-DFFF6QRP.js} +1 -1
  39. package/packages/web/dist/assets/{index-CAuTOZSD.js → index-DGzmo-Vd.js} +1 -1
  40. package/packages/web/dist/assets/{index-BhWX8AfE.js → index-DJVf5YvL.js} +1 -1
  41. package/packages/web/dist/assets/{index-CpsfI08O.js → index-DSOHGmA9.js} +1 -1
  42. package/packages/web/dist/assets/{index-CKYk-fkb.js → index-DZZ8d3HG.js} +1 -1
  43. package/packages/web/dist/assets/{index-wqgejMCM.js → index-DZvIqKGE.js} +1 -1
  44. package/packages/web/dist/assets/{index-CVOJVSsC.js → index-LoOsRfMI.js} +8 -8
  45. package/packages/web/dist/assets/{index-CTumW_tV.js → index-Om-y-ZVA.js} +3 -3
  46. package/packages/web/dist/assets/{index-DrlQi03X.js → index-Xz0F6Or0.js} +1 -1
  47. package/packages/web/dist/assets/{index-yh0ZHIWw.js → index-ZKQQ6-mY.js} +1 -1
  48. package/packages/web/dist/assets/{index-CXK2Z3_z.js → index-jHzQFk08.js} +1 -1
  49. package/packages/web/dist/assets/{projects-DbBQQH-V.js → projects-DWX5jGcZ.js} +1 -1
  50. package/packages/web/dist/assets/{providers-ceCc4xRU.js → providers-CfGxUhUu.js} +1 -1
  51. package/packages/web/dist/assets/{sessions-D681M81k.js → sessions-i5xO8Qao.js} +1 -1
  52. package/packages/web/dist/assets/{settings-D0evez2V.js → settings-dSK3wckF.js} +1 -1
  53. package/packages/web/dist/index.html +1 -1
  54. package/packages/web/dist/assets/MarkdownEditor-CqT1U8lo.js +0 -2
@@ -1 +1 @@
1
- import{i as J,m as Z,x as q,l as h,_ as W,a as i,c as d,b as e,q as ee,F as R,r as F,j as E,v as A,n as te,t as k,u as t,h as z,e as N,a1 as se,d as Q,k as g,E as le,$ as G,o as oe}from"./index-CVOJVSsC.js";import{u as X}from"./providers-ceCc4xRU.js";import"./ApiClient-Dbs1H78V.js";function ae(U,b,p){const r=X(),c=J(),l=h({name:"",baseUrl:null,authToken:null,apiTimeoutMs:null,additionalEnvVars:{}}),_=h([]),f=h([]),T=h(!1),w=h(!1),C=h(!1),y=h(null),P=h(null),I=h(!1),B=q(()=>!!b.value),V=q(()=>l.value.name.trim().length>0),n=q(()=>l.value.baseUrl||l.value.authToken);Z(()=>[U.value,b.value],([s,a])=>{s&&(a?(l.value={name:a.name,baseUrl:a.baseUrl,authToken:a.authToken==="••••••••"?null:a.authToken,apiTimeoutMs:a.apiTimeoutMs,additionalEnvVars:a.additionalEnvVars?{...a.additionalEnvVars}:{}},f.value=Object.keys(l.value.additionalEnvVars),I.value=!1,_.value=(a.models||[]).map(v=>({_serverId:v.id,modelId:v.modelId,displayName:v.displayName,tier:v.tier||"custom"}))):(l.value={name:"",baseUrl:null,authToken:null,apiTimeoutMs:null,additionalEnvVars:{}},f.value=[],_.value=[],I.value=!0),T.value=!1,y.value=null,P.value=null)},{deep:!0});function u(){_.value.push({modelId:"",displayName:"",tier:"custom"})}function S(s){_.value.splice(s,1)}function H(){const s=`ENV_VAR_${Object.keys(l.value.additionalEnvVars).length+1}`;l.value.additionalEnvVars[s]="",f.value.push(s)}function K(s){delete l.value.additionalEnvVars[s],f.value=f.value.filter(a=>a!==s)}function L(s,a){const v=f.value[s];if(v!==a&&v.trim()){const M=l.value.additionalEnvVars[a];delete l.value.additionalEnvVars[a],l.value.additionalEnvVars[v]=M}}async function x(){C.value=!0,y.value=null,P.value=null;try{const s=_.value.find(v=>v.tier==="sonnet"),a={baseUrl:l.value.baseUrl||void 0,authToken:l.value.authToken||void 0,defaultSonnetModel:(s==null?void 0:s.modelId)||void 0,apiTimeoutMs:l.value.apiTimeoutMs||void 0};P.value=await r.testConnection(a)}catch(s){y.value=s.message}finally{C.value=!1}}function O(s,a){return s.modelId.trim()!==a.modelId||s.displayName.trim()!==a.displayName||s.tier!==a.tier}function j(s){return{modelId:s.modelId.trim(),displayName:s.displayName.trim()||s.modelId.trim(),tier:s.tier||"custom"}}async function o(s,a,v){if(!s._serverId&&s.modelId.trim()){await r.addModel(a,j(s));return}const M=v.get(s._serverId);M&&O(s,M)&&await r.updateModel(a,s._serverId,j(s))}async function m(s){var Y;const a=new Set(_.value.filter($=>$._serverId).map($=>$._serverId)),v=((Y=b.value)==null?void 0:Y.models)||[],M=new Map(v.map($=>[$.id,$]));for(const $ of v)a.has($.id)||await r.removeModel(s,$.id);for(const $ of _.value)await o($,s,M);await r.fetchProviders()}async function D(){var s,a;w.value=!0,y.value=null;try{const v={name:l.value.name.trim(),baseUrl:((s=l.value.baseUrl)==null?void 0:s.trim())||null,apiTimeoutMs:l.value.apiTimeoutMs||null,additionalEnvVars:Object.keys(l.value.additionalEnvVars).length>0?l.value.additionalEnvVars:null};I.value&&(v.authToken=((a=l.value.authToken)==null?void 0:a.trim())||null);let M;B.value?(M=await r.updateProvider(b.value.id,v),c.success("Provider updated successfully")):(M=await r.createProvider(v),c.success("Provider created successfully")),await m(M.id),p()}catch(v){y.value=v.message}finally{w.value=!1}}return{form:l,localModels:_,envVarKeys:f,showAuthToken:T,saving:w,testing:C,error:y,testResult:P,authTokenModified:I,isEditing:B,isValid:V,canTest:n,addLocalModel:u,removeLocalModel:S,addEnvVar:H,removeEnvVar:K,updateEnvVarKey:L,testConnection:x,save:D}}const ne={class:"models-section"},ie={key:0,class:"models-list"},de=["onUpdate:modelValue"],ue=["onUpdate:modelValue"],re=["onUpdate:modelValue"],ce=["onClick"],ve={key:1,class:"models-empty"},me={__name:"ProviderModelsList",props:{models:{type:Array,required:!0}},emits:["add","remove"],setup(U){return(b,p)=>(i(),d("div",ne,[p[3]||(p[3]=e("div",{class:"models-header"},[e("span",{class:"models-title"},"Models"),e("span",{class:"models-hint"},"Assign tiers to map provider models to Opus / Sonnet / Haiku roles")],-1)),U.models.length>0?(i(),d("div",ie,[p[2]||(p[2]=ee('<div class="model-row model-row-header" data-v-3aa7217a><span class="col-model-id" data-v-3aa7217a>Model ID</span><span class="col-display-name" data-v-3aa7217a>Display Name</span><span class="col-tier" data-v-3aa7217a>Tier</span><span class="col-actions" data-v-3aa7217a></span></div>',1)),(i(!0),d(R,null,F(U.models,(r,c)=>(i(),d("div",{key:c,class:"model-row"},[E(e("input",{"onUpdate:modelValue":l=>r.modelId=l,type:"text",placeholder:"anthropic.claude-3-sonnet-…",class:"col-model-id model-input"},null,8,de),[[A,r.modelId]]),E(e("input",{"onUpdate:modelValue":l=>r.displayName=l,type:"text",placeholder:"My Sonnet",class:"col-display-name model-input"},null,8,ue),[[A,r.displayName]]),E(e("select",{"onUpdate:modelValue":l=>r.tier=l,class:"col-tier model-input tier-select"},[...p[1]||(p[1]=[e("option",{value:"opus"}," Opus ",-1),e("option",{value:"sonnet"}," Sonnet ",-1),e("option",{value:"haiku"}," Haiku ",-1),e("option",{value:"custom"}," Custom ",-1)])],8,re),[[te,r.tier]]),e("button",{type:"button",class:"col-actions remove-model-btn",title:"Remove model",onClick:l=>b.$emit("remove",c)}," × ",8,ce)]))),128))])):(i(),d("div",ve," No models added yet. ")),e("button",{type:"button",class:"btn btn-sm btn-secondary add-model-btn",onClick:p[0]||(p[0]=r=>b.$emit("add"))}," + Add Model ")]))}},pe=W(me,[["__scopeId","data-v-3aa7217a"]]),be={class:"modal"},fe={class:"modal-header"},ye={class:"modal-body"},_e={class:"form-group"},ke={class:"form-group"},he={class:"form-group"},ge={class:"token-input-wrapper"},Ve=["type"],$e=["title"],Me={class:"expandable-section"},Te={class:"section-content"},Ce={class:"form-group"},Ee={class:"form-group"},Ue={class:"env-vars-list"},we=["onUpdate:modelValue","onBlur"],Pe=["onUpdate:modelValue"],Ie=["onClick"],Se={key:0,class:"error-message"},Ae={class:"test-result-header"},Ne={class:"test-icon"},Be={class:"test-message"},xe={key:0,class:"test-details"},De={key:0,class:"test-detail"},Oe={key:1,class:"test-detail"},Le={class:"modal-footer"},Re=["disabled"],Fe={class:"footer-actions"},He=["disabled"],Ke=["disabled"],je={__name:"ProviderForm",props:{isOpen:{type:Boolean,default:!1},provider:{type:Object,default:null}},emits:["close","saved"],setup(U,{emit:b}){const p=U,r=b,{form:c,localModels:l,envVarKeys:_,showAuthToken:f,saving:T,testing:w,error:C,testResult:y,authTokenModified:P,isEditing:I,isValid:B,canTest:V,addLocalModel:n,removeLocalModel:u,addEnvVar:S,removeEnvVar:H,updateEnvVarKey:K,testConnection:L,save:x}=ae(G(p,"isOpen"),G(p,"provider"),()=>r("saved"));function O(){r("close")}return(j,o)=>U.isOpen?(i(),d("div",{key:0,class:"modal-overlay",onClick:z(O,["self"])},[e("div",be,[e("div",fe,[e("h2",null,k(t(I)?"Edit Provider":"Add Provider"),1),e("button",{type:"button",class:"close-btn",title:"Close",onClick:O}," × ")]),e("div",ye,[e("form",{onSubmit:o[7]||(o[7]=z((...m)=>t(x)&&t(x)(...m),["prevent"]))},[e("div",_e,[o[10]||(o[10]=e("label",{for:"provider-name"},"Provider Name*",-1)),E(e("input",{id:"provider-name","onUpdate:modelValue":o[0]||(o[0]=m=>t(c).name=m),type:"text",placeholder:"e.g., AWS Bedrock",required:"",maxlength:"100"},null,512),[[A,t(c).name]])]),e("div",ke,[o[11]||(o[11]=e("label",{for:"base-url"},[N(" Base URL "),e("span",{class:"label-hint"},"(ANTHROPIC_BASE_URL)")],-1)),E(e("input",{id:"base-url","onUpdate:modelValue":o[1]||(o[1]=m=>t(c).baseUrl=m),type:"url",placeholder:"https://bedrock-runtime.us-east-1.amazonaws.com"},null,512),[[A,t(c).baseUrl]])]),e("div",he,[o[12]||(o[12]=e("label",{for:"auth-token"},[N(" Auth Token "),e("span",{class:"label-hint"},"(ANTHROPIC_AUTH_TOKEN)")],-1)),e("div",ge,[E(e("input",{id:"auth-token","onUpdate:modelValue":o[2]||(o[2]=m=>t(c).authToken=m),type:t(f)?"text":"password",placeholder:"Your authentication token",onInput:o[3]||(o[3]=m=>P.value=!0)},null,40,Ve),[[se,t(c).authToken]]),e("button",{type:"button",class:"toggle-visibility-btn",title:t(f)?"Hide":"Show",onClick:o[4]||(o[4]=m=>f.value=!t(f))},k(t(f)?"Hide":"Show"),9,$e)])]),Q(pe,{models:t(l),onAdd:t(n),onRemove:t(u)},null,8,["models","onAdd","onRemove"]),e("details",Me,[o[15]||(o[15]=e("summary",{class:"section-header"}," Advanced Settings ",-1)),e("div",Te,[e("div",Ce,[o[13]||(o[13]=e("label",{for:"api-timeout"},"API Timeout (ms)",-1)),E(e("input",{id:"api-timeout","onUpdate:modelValue":o[5]||(o[5]=m=>t(c).apiTimeoutMs=m),type:"number",placeholder:"120000",min:"1000",step:"1000"},null,512),[[A,t(c).apiTimeoutMs,void 0,{number:!0}]])]),e("div",Ee,[o[14]||(o[14]=e("label",null,"Additional Environment Variables",-1)),e("div",Ue,[(i(!0),d(R,null,F(t(c).additionalEnvVars,(m,D,s)=>(i(),d("div",{key:s,class:"env-var-row"},[E(e("input",{"onUpdate:modelValue":a=>t(_)[s]=a,type:"text",placeholder:"KEY",class:"env-key",onBlur:a=>t(K)(s,D)},null,40,we),[[A,t(_)[s]]]),E(e("input",{"onUpdate:modelValue":a=>t(c).additionalEnvVars[D]=a,type:"text",placeholder:"value",class:"env-value"},null,8,Pe),[[A,t(c).additionalEnvVars[D]]]),e("button",{type:"button",class:"remove-env-btn",title:"Remove",onClick:a=>t(H)(D)}," × ",8,Ie)]))),128)),e("button",{type:"button",class:"btn btn-sm btn-secondary",onClick:o[6]||(o[6]=(...m)=>t(S)&&t(S)(...m))}," + Add Variable ")])])])]),t(C)?(i(),d("div",Se,k(t(C)),1)):g("",!0),t(y)?(i(),d("div",{key:1,class:le(["test-result",t(y).success?"success":"failure"])},[e("div",Ae,[e("span",Ne,k(t(y).success?"✓":"✗"),1),e("span",Be,k(t(y).message),1)]),t(y).details?(i(),d("div",xe,[t(y).details.model?(i(),d("div",De,[o[16]||(o[16]=N(" Model: ",-1)),e("code",null,k(t(y).details.model),1)])):g("",!0),t(y).details.code?(i(),d("div",Oe,[o[17]||(o[17]=N(" Error Code: ",-1)),e("code",null,k(t(y).details.code),1)])):g("",!0)])):g("",!0)],2)):g("",!0)],32)]),e("div",Le,[e("button",{type:"button",class:"btn btn-secondary",disabled:t(T)||t(w)||!t(V),onClick:o[8]||(o[8]=(...m)=>t(L)&&t(L)(...m))},k(t(w)?"Testing...":"Test Connection"),9,Re),e("div",Fe,[e("button",{type:"button",class:"btn btn-secondary",disabled:t(T),onClick:O}," Cancel ",8,He),e("button",{type:"button",class:"btn btn-primary",disabled:t(T)||!t(B),onClick:o[9]||(o[9]=(...m)=>t(x)&&t(x)(...m))},k(t(T)?"Saving...":"Save"),9,Ke)])])])])):g("",!0)}},qe=W(je,[["__scopeId","data-v-a4048df1"]]),ze={class:"container"},We={key:0,class:"skeleton-list"},Ye={key:1,class:"error-message"},Ge={key:2,class:"provider-list"},Je={class:"provider-header"},Qe={class:"provider-title"},Xe={key:0,class:"built-in-badge"},Ze={class:"provider-actions"},et=["disabled","onClick"],tt=["onClick"],st=["onClick"],lt={class:"provider-details"},ot={key:0,class:"provider-detail"},at={class:"detail-value"},nt={key:1,class:"provider-detail"},it={class:"detail-value"},dt={key:2,class:"provider-detail"},ut={class:"modal confirm-modal"},rt={class:"modal-header"},ct={class:"modal-body"},vt={class:"modal-footer"},mt=["disabled"],pt={__name:"ProvidersView",setup(U){const b=X(),p=J(),r=h(!1),c=h(null),l=h(null),_=h(!1),f=h(null);oe(()=>{b.fetchProviders()});function T(){c.value=null,r.value=!0}function w(V){c.value=V,r.value=!0}function C(){r.value=!1,c.value=null}function y(){C(),b.fetchProviders()}async function P(V){f.value=V;try{const n=await b.testExistingProvider(V);n.success?p.success(`Connection successful (model: ${n.details.model})`):p.error(`Connection failed: ${n.message}`)}catch(n){p.error(`Test failed: ${n.message}`)}finally{f.value=null}}function I(V){l.value=V}async function B(){_.value=!0;try{await b.deleteProvider(l.value.id),p.success("Provider deleted"),l.value=null}catch(V){p.error(`Failed to delete provider: ${V.message}`)}finally{_.value=!1}}return(V,n)=>(i(),d("div",ze,[e("div",{class:"page-header"},[e("button",{class:"btn btn-primary",onClick:T},[...n[3]||(n[3]=[e("span",null,"+ Add Provider",-1)])])]),n[11]||(n[11]=e("p",{class:"page-description"}," Configure custom model providers to use Claude through alternative endpoints like AWS Bedrock, Google Vertex AI, or self-hosted proxies. ",-1)),t(b).loading?(i(),d("div",We,[(i(),d(R,null,F(3,u=>e("div",{key:u,class:"skeleton card",style:{height:"120px"}})),64))])):t(b).error?(i(),d("div",Ye,k(t(b).error),1)):(i(),d("div",Ge,[(i(!0),d(R,null,F(t(b).providers,u=>(i(),d("div",{key:u.id,class:"provider-card card"},[e("div",Je,[e("div",Qe,[e("h3",null,[N(k(u.name)+" ",1),u.isBuiltIn?(i(),d("span",Xe,"Built-in")):g("",!0)])]),e("div",Ze,[u.isBuiltIn?g("",!0):(i(),d("button",{key:0,class:"btn btn-sm",disabled:f.value===u.id,title:"Test Connection",onClick:S=>P(u.id)},k(f.value===u.id?"Testing...":"Test"),9,et)),u.isBuiltIn?g("",!0):(i(),d("button",{key:1,class:"btn btn-sm",onClick:S=>w(u)}," Edit ",8,tt)),u.isBuiltIn?g("",!0):(i(),d("button",{key:2,class:"btn btn-sm btn-danger",onClick:S=>I(u)}," Delete ",8,st))])]),e("div",lt,[u.baseUrl?(i(),d("div",ot,[n[4]||(n[4]=e("span",{class:"detail-label"},"Base URL:",-1)),e("code",at,k(u.baseUrl),1)])):g("",!0),u.defaultSonnetModel?(i(),d("div",nt,[n[5]||(n[5]=e("span",{class:"detail-label"},"Default Sonnet Model:",-1)),e("code",it,k(u.defaultSonnetModel),1)])):g("",!0),!u.baseUrl&&u.isBuiltIn?(i(),d("div",dt,[...n[6]||(n[6]=[e("span",{class:"detail-value"},"Uses official Anthropic API",-1)])])):g("",!0)])]))),128))])),Q(qe,{"is-open":r.value,provider:c.value,onClose:C,onSaved:y},null,8,["is-open","provider"]),l.value?(i(),d("div",{key:3,class:"modal-overlay",onClick:n[2]||(n[2]=z(u=>l.value=null,["self"]))},[e("div",ut,[e("div",rt,[n[7]||(n[7]=e("h2",null,"Delete Provider",-1)),e("button",{type:"button",class:"close-btn",onClick:n[0]||(n[0]=u=>l.value=null)}," × ")]),e("div",ct,[e("p",null,[n[8]||(n[8]=N("Are you sure you want to delete ",-1)),e("strong",null,k(l.value.name),1),n[9]||(n[9]=N("?",-1))]),n[10]||(n[10]=e("p",{class:"warning-text"}," This action cannot be undone. ",-1))]),e("div",vt,[e("button",{type:"button",class:"btn btn-secondary",onClick:n[1]||(n[1]=u=>l.value=null)}," Cancel "),e("button",{type:"button",class:"btn btn-danger",disabled:_.value,onClick:B},k(_.value?"Deleting...":"Delete"),9,mt)])])])):g("",!0)]))}},_t=W(pt,[["__scopeId","data-v-27d620fd"]]);export{_t as default};
1
+ import{i as J,m as Z,x as q,l as h,_ as W,a as i,c as d,b as e,q as ee,F as R,r as F,j as E,v as A,n as te,t as k,u as t,h as z,e as N,a1 as se,d as Q,k as g,E as le,$ as G,o as oe}from"./index-LoOsRfMI.js";import{u as X}from"./providers-CfGxUhUu.js";import"./ApiClient-Dbs1H78V.js";function ae(U,b,p){const r=X(),c=J(),l=h({name:"",baseUrl:null,authToken:null,apiTimeoutMs:null,additionalEnvVars:{}}),_=h([]),f=h([]),T=h(!1),w=h(!1),C=h(!1),y=h(null),P=h(null),I=h(!1),B=q(()=>!!b.value),V=q(()=>l.value.name.trim().length>0),n=q(()=>l.value.baseUrl||l.value.authToken);Z(()=>[U.value,b.value],([s,a])=>{s&&(a?(l.value={name:a.name,baseUrl:a.baseUrl,authToken:a.authToken==="••••••••"?null:a.authToken,apiTimeoutMs:a.apiTimeoutMs,additionalEnvVars:a.additionalEnvVars?{...a.additionalEnvVars}:{}},f.value=Object.keys(l.value.additionalEnvVars),I.value=!1,_.value=(a.models||[]).map(v=>({_serverId:v.id,modelId:v.modelId,displayName:v.displayName,tier:v.tier||"custom"}))):(l.value={name:"",baseUrl:null,authToken:null,apiTimeoutMs:null,additionalEnvVars:{}},f.value=[],_.value=[],I.value=!0),T.value=!1,y.value=null,P.value=null)},{deep:!0});function u(){_.value.push({modelId:"",displayName:"",tier:"custom"})}function S(s){_.value.splice(s,1)}function H(){const s=`ENV_VAR_${Object.keys(l.value.additionalEnvVars).length+1}`;l.value.additionalEnvVars[s]="",f.value.push(s)}function K(s){delete l.value.additionalEnvVars[s],f.value=f.value.filter(a=>a!==s)}function L(s,a){const v=f.value[s];if(v!==a&&v.trim()){const M=l.value.additionalEnvVars[a];delete l.value.additionalEnvVars[a],l.value.additionalEnvVars[v]=M}}async function x(){C.value=!0,y.value=null,P.value=null;try{const s=_.value.find(v=>v.tier==="sonnet"),a={baseUrl:l.value.baseUrl||void 0,authToken:l.value.authToken||void 0,defaultSonnetModel:(s==null?void 0:s.modelId)||void 0,apiTimeoutMs:l.value.apiTimeoutMs||void 0};P.value=await r.testConnection(a)}catch(s){y.value=s.message}finally{C.value=!1}}function O(s,a){return s.modelId.trim()!==a.modelId||s.displayName.trim()!==a.displayName||s.tier!==a.tier}function j(s){return{modelId:s.modelId.trim(),displayName:s.displayName.trim()||s.modelId.trim(),tier:s.tier||"custom"}}async function o(s,a,v){if(!s._serverId&&s.modelId.trim()){await r.addModel(a,j(s));return}const M=v.get(s._serverId);M&&O(s,M)&&await r.updateModel(a,s._serverId,j(s))}async function m(s){var Y;const a=new Set(_.value.filter($=>$._serverId).map($=>$._serverId)),v=((Y=b.value)==null?void 0:Y.models)||[],M=new Map(v.map($=>[$.id,$]));for(const $ of v)a.has($.id)||await r.removeModel(s,$.id);for(const $ of _.value)await o($,s,M);await r.fetchProviders()}async function D(){var s,a;w.value=!0,y.value=null;try{const v={name:l.value.name.trim(),baseUrl:((s=l.value.baseUrl)==null?void 0:s.trim())||null,apiTimeoutMs:l.value.apiTimeoutMs||null,additionalEnvVars:Object.keys(l.value.additionalEnvVars).length>0?l.value.additionalEnvVars:null};I.value&&(v.authToken=((a=l.value.authToken)==null?void 0:a.trim())||null);let M;B.value?(M=await r.updateProvider(b.value.id,v),c.success("Provider updated successfully")):(M=await r.createProvider(v),c.success("Provider created successfully")),await m(M.id),p()}catch(v){y.value=v.message}finally{w.value=!1}}return{form:l,localModels:_,envVarKeys:f,showAuthToken:T,saving:w,testing:C,error:y,testResult:P,authTokenModified:I,isEditing:B,isValid:V,canTest:n,addLocalModel:u,removeLocalModel:S,addEnvVar:H,removeEnvVar:K,updateEnvVarKey:L,testConnection:x,save:D}}const ne={class:"models-section"},ie={key:0,class:"models-list"},de=["onUpdate:modelValue"],ue=["onUpdate:modelValue"],re=["onUpdate:modelValue"],ce=["onClick"],ve={key:1,class:"models-empty"},me={__name:"ProviderModelsList",props:{models:{type:Array,required:!0}},emits:["add","remove"],setup(U){return(b,p)=>(i(),d("div",ne,[p[3]||(p[3]=e("div",{class:"models-header"},[e("span",{class:"models-title"},"Models"),e("span",{class:"models-hint"},"Assign tiers to map provider models to Opus / Sonnet / Haiku roles")],-1)),U.models.length>0?(i(),d("div",ie,[p[2]||(p[2]=ee('<div class="model-row model-row-header" data-v-3aa7217a><span class="col-model-id" data-v-3aa7217a>Model ID</span><span class="col-display-name" data-v-3aa7217a>Display Name</span><span class="col-tier" data-v-3aa7217a>Tier</span><span class="col-actions" data-v-3aa7217a></span></div>',1)),(i(!0),d(R,null,F(U.models,(r,c)=>(i(),d("div",{key:c,class:"model-row"},[E(e("input",{"onUpdate:modelValue":l=>r.modelId=l,type:"text",placeholder:"anthropic.claude-3-sonnet-…",class:"col-model-id model-input"},null,8,de),[[A,r.modelId]]),E(e("input",{"onUpdate:modelValue":l=>r.displayName=l,type:"text",placeholder:"My Sonnet",class:"col-display-name model-input"},null,8,ue),[[A,r.displayName]]),E(e("select",{"onUpdate:modelValue":l=>r.tier=l,class:"col-tier model-input tier-select"},[...p[1]||(p[1]=[e("option",{value:"opus"}," Opus ",-1),e("option",{value:"sonnet"}," Sonnet ",-1),e("option",{value:"haiku"}," Haiku ",-1),e("option",{value:"custom"}," Custom ",-1)])],8,re),[[te,r.tier]]),e("button",{type:"button",class:"col-actions remove-model-btn",title:"Remove model",onClick:l=>b.$emit("remove",c)}," × ",8,ce)]))),128))])):(i(),d("div",ve," No models added yet. ")),e("button",{type:"button",class:"btn btn-sm btn-secondary add-model-btn",onClick:p[0]||(p[0]=r=>b.$emit("add"))}," + Add Model ")]))}},pe=W(me,[["__scopeId","data-v-3aa7217a"]]),be={class:"modal"},fe={class:"modal-header"},ye={class:"modal-body"},_e={class:"form-group"},ke={class:"form-group"},he={class:"form-group"},ge={class:"token-input-wrapper"},Ve=["type"],$e=["title"],Me={class:"expandable-section"},Te={class:"section-content"},Ce={class:"form-group"},Ee={class:"form-group"},Ue={class:"env-vars-list"},we=["onUpdate:modelValue","onBlur"],Pe=["onUpdate:modelValue"],Ie=["onClick"],Se={key:0,class:"error-message"},Ae={class:"test-result-header"},Ne={class:"test-icon"},Be={class:"test-message"},xe={key:0,class:"test-details"},De={key:0,class:"test-detail"},Oe={key:1,class:"test-detail"},Le={class:"modal-footer"},Re=["disabled"],Fe={class:"footer-actions"},He=["disabled"],Ke=["disabled"],je={__name:"ProviderForm",props:{isOpen:{type:Boolean,default:!1},provider:{type:Object,default:null}},emits:["close","saved"],setup(U,{emit:b}){const p=U,r=b,{form:c,localModels:l,envVarKeys:_,showAuthToken:f,saving:T,testing:w,error:C,testResult:y,authTokenModified:P,isEditing:I,isValid:B,canTest:V,addLocalModel:n,removeLocalModel:u,addEnvVar:S,removeEnvVar:H,updateEnvVarKey:K,testConnection:L,save:x}=ae(G(p,"isOpen"),G(p,"provider"),()=>r("saved"));function O(){r("close")}return(j,o)=>U.isOpen?(i(),d("div",{key:0,class:"modal-overlay",onClick:z(O,["self"])},[e("div",be,[e("div",fe,[e("h2",null,k(t(I)?"Edit Provider":"Add Provider"),1),e("button",{type:"button",class:"close-btn",title:"Close",onClick:O}," × ")]),e("div",ye,[e("form",{onSubmit:o[7]||(o[7]=z((...m)=>t(x)&&t(x)(...m),["prevent"]))},[e("div",_e,[o[10]||(o[10]=e("label",{for:"provider-name"},"Provider Name*",-1)),E(e("input",{id:"provider-name","onUpdate:modelValue":o[0]||(o[0]=m=>t(c).name=m),type:"text",placeholder:"e.g., AWS Bedrock",required:"",maxlength:"100"},null,512),[[A,t(c).name]])]),e("div",ke,[o[11]||(o[11]=e("label",{for:"base-url"},[N(" Base URL "),e("span",{class:"label-hint"},"(ANTHROPIC_BASE_URL)")],-1)),E(e("input",{id:"base-url","onUpdate:modelValue":o[1]||(o[1]=m=>t(c).baseUrl=m),type:"url",placeholder:"https://bedrock-runtime.us-east-1.amazonaws.com"},null,512),[[A,t(c).baseUrl]])]),e("div",he,[o[12]||(o[12]=e("label",{for:"auth-token"},[N(" Auth Token "),e("span",{class:"label-hint"},"(ANTHROPIC_AUTH_TOKEN)")],-1)),e("div",ge,[E(e("input",{id:"auth-token","onUpdate:modelValue":o[2]||(o[2]=m=>t(c).authToken=m),type:t(f)?"text":"password",placeholder:"Your authentication token",onInput:o[3]||(o[3]=m=>P.value=!0)},null,40,Ve),[[se,t(c).authToken]]),e("button",{type:"button",class:"toggle-visibility-btn",title:t(f)?"Hide":"Show",onClick:o[4]||(o[4]=m=>f.value=!t(f))},k(t(f)?"Hide":"Show"),9,$e)])]),Q(pe,{models:t(l),onAdd:t(n),onRemove:t(u)},null,8,["models","onAdd","onRemove"]),e("details",Me,[o[15]||(o[15]=e("summary",{class:"section-header"}," Advanced Settings ",-1)),e("div",Te,[e("div",Ce,[o[13]||(o[13]=e("label",{for:"api-timeout"},"API Timeout (ms)",-1)),E(e("input",{id:"api-timeout","onUpdate:modelValue":o[5]||(o[5]=m=>t(c).apiTimeoutMs=m),type:"number",placeholder:"120000",min:"1000",step:"1000"},null,512),[[A,t(c).apiTimeoutMs,void 0,{number:!0}]])]),e("div",Ee,[o[14]||(o[14]=e("label",null,"Additional Environment Variables",-1)),e("div",Ue,[(i(!0),d(R,null,F(t(c).additionalEnvVars,(m,D,s)=>(i(),d("div",{key:s,class:"env-var-row"},[E(e("input",{"onUpdate:modelValue":a=>t(_)[s]=a,type:"text",placeholder:"KEY",class:"env-key",onBlur:a=>t(K)(s,D)},null,40,we),[[A,t(_)[s]]]),E(e("input",{"onUpdate:modelValue":a=>t(c).additionalEnvVars[D]=a,type:"text",placeholder:"value",class:"env-value"},null,8,Pe),[[A,t(c).additionalEnvVars[D]]]),e("button",{type:"button",class:"remove-env-btn",title:"Remove",onClick:a=>t(H)(D)}," × ",8,Ie)]))),128)),e("button",{type:"button",class:"btn btn-sm btn-secondary",onClick:o[6]||(o[6]=(...m)=>t(S)&&t(S)(...m))}," + Add Variable ")])])])]),t(C)?(i(),d("div",Se,k(t(C)),1)):g("",!0),t(y)?(i(),d("div",{key:1,class:le(["test-result",t(y).success?"success":"failure"])},[e("div",Ae,[e("span",Ne,k(t(y).success?"✓":"✗"),1),e("span",Be,k(t(y).message),1)]),t(y).details?(i(),d("div",xe,[t(y).details.model?(i(),d("div",De,[o[16]||(o[16]=N(" Model: ",-1)),e("code",null,k(t(y).details.model),1)])):g("",!0),t(y).details.code?(i(),d("div",Oe,[o[17]||(o[17]=N(" Error Code: ",-1)),e("code",null,k(t(y).details.code),1)])):g("",!0)])):g("",!0)],2)):g("",!0)],32)]),e("div",Le,[e("button",{type:"button",class:"btn btn-secondary",disabled:t(T)||t(w)||!t(V),onClick:o[8]||(o[8]=(...m)=>t(L)&&t(L)(...m))},k(t(w)?"Testing...":"Test Connection"),9,Re),e("div",Fe,[e("button",{type:"button",class:"btn btn-secondary",disabled:t(T),onClick:O}," Cancel ",8,He),e("button",{type:"button",class:"btn btn-primary",disabled:t(T)||!t(B),onClick:o[9]||(o[9]=(...m)=>t(x)&&t(x)(...m))},k(t(T)?"Saving...":"Save"),9,Ke)])])])])):g("",!0)}},qe=W(je,[["__scopeId","data-v-a4048df1"]]),ze={class:"container"},We={key:0,class:"skeleton-list"},Ye={key:1,class:"error-message"},Ge={key:2,class:"provider-list"},Je={class:"provider-header"},Qe={class:"provider-title"},Xe={key:0,class:"built-in-badge"},Ze={class:"provider-actions"},et=["disabled","onClick"],tt=["onClick"],st=["onClick"],lt={class:"provider-details"},ot={key:0,class:"provider-detail"},at={class:"detail-value"},nt={key:1,class:"provider-detail"},it={class:"detail-value"},dt={key:2,class:"provider-detail"},ut={class:"modal confirm-modal"},rt={class:"modal-header"},ct={class:"modal-body"},vt={class:"modal-footer"},mt=["disabled"],pt={__name:"ProvidersView",setup(U){const b=X(),p=J(),r=h(!1),c=h(null),l=h(null),_=h(!1),f=h(null);oe(()=>{b.fetchProviders()});function T(){c.value=null,r.value=!0}function w(V){c.value=V,r.value=!0}function C(){r.value=!1,c.value=null}function y(){C(),b.fetchProviders()}async function P(V){f.value=V;try{const n=await b.testExistingProvider(V);n.success?p.success(`Connection successful (model: ${n.details.model})`):p.error(`Connection failed: ${n.message}`)}catch(n){p.error(`Test failed: ${n.message}`)}finally{f.value=null}}function I(V){l.value=V}async function B(){_.value=!0;try{await b.deleteProvider(l.value.id),p.success("Provider deleted"),l.value=null}catch(V){p.error(`Failed to delete provider: ${V.message}`)}finally{_.value=!1}}return(V,n)=>(i(),d("div",ze,[e("div",{class:"page-header"},[e("button",{class:"btn btn-primary",onClick:T},[...n[3]||(n[3]=[e("span",null,"+ Add Provider",-1)])])]),n[11]||(n[11]=e("p",{class:"page-description"}," Configure custom model providers to use Claude through alternative endpoints like AWS Bedrock, Google Vertex AI, or self-hosted proxies. ",-1)),t(b).loading?(i(),d("div",We,[(i(),d(R,null,F(3,u=>e("div",{key:u,class:"skeleton card",style:{height:"120px"}})),64))])):t(b).error?(i(),d("div",Ye,k(t(b).error),1)):(i(),d("div",Ge,[(i(!0),d(R,null,F(t(b).providers,u=>(i(),d("div",{key:u.id,class:"provider-card card"},[e("div",Je,[e("div",Qe,[e("h3",null,[N(k(u.name)+" ",1),u.isBuiltIn?(i(),d("span",Xe,"Built-in")):g("",!0)])]),e("div",Ze,[u.isBuiltIn?g("",!0):(i(),d("button",{key:0,class:"btn btn-sm",disabled:f.value===u.id,title:"Test Connection",onClick:S=>P(u.id)},k(f.value===u.id?"Testing...":"Test"),9,et)),u.isBuiltIn?g("",!0):(i(),d("button",{key:1,class:"btn btn-sm",onClick:S=>w(u)}," Edit ",8,tt)),u.isBuiltIn?g("",!0):(i(),d("button",{key:2,class:"btn btn-sm btn-danger",onClick:S=>I(u)}," Delete ",8,st))])]),e("div",lt,[u.baseUrl?(i(),d("div",ot,[n[4]||(n[4]=e("span",{class:"detail-label"},"Base URL:",-1)),e("code",at,k(u.baseUrl),1)])):g("",!0),u.defaultSonnetModel?(i(),d("div",nt,[n[5]||(n[5]=e("span",{class:"detail-label"},"Default Sonnet Model:",-1)),e("code",it,k(u.defaultSonnetModel),1)])):g("",!0),!u.baseUrl&&u.isBuiltIn?(i(),d("div",dt,[...n[6]||(n[6]=[e("span",{class:"detail-value"},"Uses official Anthropic API",-1)])])):g("",!0)])]))),128))])),Q(qe,{"is-open":r.value,provider:c.value,onClose:C,onSaved:y},null,8,["is-open","provider"]),l.value?(i(),d("div",{key:3,class:"modal-overlay",onClick:n[2]||(n[2]=z(u=>l.value=null,["self"]))},[e("div",ut,[e("div",rt,[n[7]||(n[7]=e("h2",null,"Delete Provider",-1)),e("button",{type:"button",class:"close-btn",onClick:n[0]||(n[0]=u=>l.value=null)}," × ")]),e("div",ct,[e("p",null,[n[8]||(n[8]=N("Are you sure you want to delete ",-1)),e("strong",null,k(l.value.name),1),n[9]||(n[9]=N("?",-1))]),n[10]||(n[10]=e("p",{class:"warning-text"}," This action cannot be undone. ",-1))]),e("div",vt,[e("button",{type:"button",class:"btn btn-secondary",onClick:n[1]||(n[1]=u=>l.value=null)}," Cancel "),e("button",{type:"button",class:"btn btn-danger",disabled:_.value,onClick:B},k(_.value?"Deleting...":"Delete"),9,mt)])])])):g("",!0)]))}},_t=W(pt,[["__scopeId","data-v-27d620fd"]]);export{_t as default};
@@ -1 +1 @@
1
- import{L as F,_ as T,m as L,a as r,G as M,c as d,b as e,t as y,h as G,j as I,v as q,k as R,p as z,H as O,V,x as w,l as j,I as H,F as E,r as A,d as K}from"./index-CVOJVSsC.js";import{a as k}from"./ApiClient-Dbs1H78V.js";const Je=F("projectDefaults",{state:()=>({defaultsByProjectId:{},loading:!1,error:null}),getters:{getDefaultsForProject:l=>o=>l.defaultsByProjectId[o]||null},actions:{async fetchDefaults(l){this.loading=!0,this.error=null;try{const o=await k.getProjectSessionDefaults(l);return this.defaultsByProjectId[l]=o,o}catch(o){throw this.error=o.message,o}finally{this.loading=!1}},async updateDefaults(l,o){this.loading=!0,this.error=null;try{const s=await k.updateProjectSessionDefaults(l,o);return this.defaultsByProjectId[l]=s,s}catch(s){throw this.error=s.message,s}finally{this.loading=!1}},async resetDefaults(l){this.loading=!0,this.error=null;try{return await k.resetProjectSessionDefaults(l),this.defaultsByProjectId[l]={mode:null,thinkingEnabled:null,effortLevel:null,startImmediately:null,gitMode:null,gitBranch:null,model:null},this.defaultsByProjectId[l]}catch(o){throw this.error=o.message,o}finally{this.loading=!1}},clearProjectDefaults(l){delete this.defaultsByProjectId[l]},clearAllDefaults(){this.defaultsByProjectId={}}}}),U=F("quickResponses",{state:()=>({projectResponses:[],globalResponses:[],loading:!1,error:null,currentProjectId:null}),getters:{allResponses:l=>[...l.projectResponses,...l.globalResponses],hasResponses:l=>l.projectResponses.length>0||l.globalResponses.length>0},actions:{async fetchForProject(l){this.loading=!0,this.error=null,this.currentProjectId=l;try{const o=await k.getQuickResponses(l);return this.projectResponses=o.project,this.globalResponses=o.global,o}catch(o){throw this.error=o.message,o}finally{this.loading=!1}},async createResponse(l,o){this.loading=!0,this.error=null;try{const s=await k.createQuickResponse(l,o);return s.projectId===null?this.globalResponses.push(s):this.projectResponses.push(s),s}catch(s){throw this.error=s.message,s}finally{this.loading=!1}},async updateResponse(l,o){this.loading=!0,this.error=null;try{const s=await k.updateQuickResponse(l,o),c=this.projectResponses.findIndex(p=>p.id===l);if(c!==-1)this.projectResponses[c]=s;else{const p=this.globalResponses.findIndex(_=>_.id===l);p!==-1&&(this.globalResponses[p]=s)}return s}catch(s){throw this.error=s.message,s}finally{this.loading=!1}},async deleteResponse(l){this.loading=!0,this.error=null;try{await k.deleteQuickResponse(l);const o=this.projectResponses.findIndex(s=>s.id===l);if(o!==-1)this.projectResponses.splice(o,1);else{const s=this.globalResponses.findIndex(c=>c.id===l);s!==-1&&this.globalResponses.splice(s,1)}}catch(o){throw this.error=o.message,o}finally{this.loading=!1}},async reorderResponses(l,o){this.loading=!0,this.error=null;try{const s=o.map((c,p)=>({id:c,sortOrder:p}));if(l){const c=await k.reorderQuickResponses(l,s);this.projectResponses=c.project,this.globalResponses=c.global}else{const c=await k.reorderGlobalQuickResponses(s);this.globalResponses=c}}catch(s){throw this.error=s.message,s}finally{this.loading=!1}},clearResponses(){this.projectResponses=[],this.globalResponses=[],this.currentProjectId=null,this.error=null}}}),Y={class:"dialog-header"},J={class:"dialog-content"},W={class:"form-group"},X={key:0,class:"form-error"},Z={class:"form-group"},ee={key:0,class:"form-error"},se={class:"form-group"},te={class:"form-group"},le={class:"checkbox-label"},oe={key:0,class:"form-group"},ne={class:"radio-group"},ae={class:"radio-label"},ie={class:"radio-label"},re={key:1,class:"error-message"},ue={class:"dialog-footer"},ce=["disabled"],de={__name:"QuickResponseDialog",props:{isOpen:{type:Boolean,default:!1},projectId:{type:String,required:!0},editingResponse:{type:Object,default:null},defaultIsGlobal:{type:Boolean,default:!1}},emits:["close","saved"],setup(l,{emit:o}){const s=l,c=o,p=U(),_=j(null),v=`dialog-title-${Math.random().toString(36).slice(2)}`,n=j({label:"",content:"",category:"",autoSubmit:!1,isGlobal:!1}),g=j(!1),h=j(null),C=w(()=>!!s.editingResponse),S=w(()=>n.value.label&&n.value.label.length>50?"Label must be 50 characters or less":null),x=w(()=>n.value.content&&n.value.content.length>1e4?"Content must be 10,000 characters or less":null),P=w(()=>n.value.label.trim().length>0&&n.value.label.length<=50&&n.value.content.trim().length>0&&n.value.content.length<=1e4);L(()=>s.isOpen,b=>{b&&(s.editingResponse?n.value={label:s.editingResponse.label||"",content:s.editingResponse.content||"",category:s.editingResponse.category||"",autoSubmit:s.editingResponse.autoSubmit||!1,isGlobal:s.editingResponse.projectId===null}:n.value={label:"",content:"",category:"",autoSubmit:!1,isGlobal:s.defaultIsGlobal},h.value=null,H(()=>{var t;(t=_.value)==null||t.focus()}))}),L(()=>s.isOpen,b=>{if(b){const t=a=>{a.key==="Escape"&&$()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)}});function $(){c("close")}async function B(){if(!(!P.value||g.value)){g.value=!0,h.value=null;try{const b={label:n.value.label.trim(),content:n.value.content,category:n.value.category.trim()||null,autoSubmit:n.value.autoSubmit};C.value?await p.updateResponse(s.editingResponse.id,b):(b.isGlobal=n.value.isGlobal,await p.createResponse(s.projectId,b)),c("saved"),c("close")}catch(b){h.value=b.message||"Failed to save quick response"}finally{g.value=!1}}}return(b,t)=>(r(),M(V,{to:"body"},[l.isOpen?(r(),d("div",{key:0,class:"dialog-overlay",onClick:G($,["self"])},[e("div",{class:"dialog",role:"dialog","aria-modal":"true","aria-labelledby":v},[e("div",Y,[e("h2",{id:v,class:"dialog-title"},y(C.value?"Edit Quick Response":"Add Quick Response"),1),e("button",{class:"close-button","aria-label":"Close dialog",onClick:$}," × ")]),e("form",{class:"dialog-form",onSubmit:G(B,["prevent"])},[e("div",J,[e("div",W,[t[7]||(t[7]=e("label",{for:"qr-label",class:"form-label"},"Label *",-1)),I(e("input",{id:"qr-label",ref_key:"labelInput",ref:_,"onUpdate:modelValue":t[0]||(t[0]=a=>n.value.label=a),type:"text",class:"form-input",placeholder:"e.g., Yes, LGTM, Run tests",maxlength:"50",required:"",onBlur:t[1]||(t[1]=a=>n.value.label=n.value.label.trim())},null,544),[[q,n.value.label]]),t[8]||(t[8]=e("span",{class:"form-help"},"Short text shown on the button (max 50 characters)",-1)),S.value?(r(),d("span",X,y(S.value),1)):R("",!0)]),e("div",Z,[t[9]||(t[9]=e("label",{for:"qr-content",class:"form-label"},"Content *",-1)),I(e("textarea",{id:"qr-content","onUpdate:modelValue":t[2]||(t[2]=a=>n.value.content=a),class:"form-textarea",placeholder:"The full message that will be inserted into the prompt",rows:"4",maxlength:"10000",required:""},null,512),[[q,n.value.content]]),t[10]||(t[10]=e("span",{class:"form-help"},"The full message that will be inserted (max 10,000 characters)",-1)),x.value?(r(),d("span",ee,y(x.value),1)):R("",!0)]),e("div",se,[t[11]||(t[11]=e("label",{for:"qr-category",class:"form-label"},"Category (optional)",-1)),I(e("input",{id:"qr-category","onUpdate:modelValue":t[3]||(t[3]=a=>n.value.category=a),type:"text",class:"form-input",placeholder:"e.g., feedback, commands",maxlength:"50"},null,512),[[q,n.value.category]]),t[12]||(t[12]=e("span",{class:"form-help"},"Optional grouping for organization",-1))]),e("div",te,[e("label",le,[I(e("input",{"onUpdate:modelValue":t[4]||(t[4]=a=>n.value.autoSubmit=a),type:"checkbox",class:"checkbox-input"},null,512),[[z,n.value.autoSubmit]]),t[13]||(t[13]=e("span",{class:"checkbox-text"},"Auto-submit",-1))]),t[14]||(t[14]=e("span",{class:"form-help indent"},"Send immediately when clicked (no confirmation)",-1))]),C.value?R("",!0):(r(),d("div",oe,[t[17]||(t[17]=e("span",{class:"form-label"},"Scope",-1)),e("div",ne,[e("label",ae,[I(e("input",{"onUpdate:modelValue":t[5]||(t[5]=a=>n.value.isGlobal=a),type:"radio",value:!1,class:"radio-input"},null,512),[[O,n.value.isGlobal]]),t[15]||(t[15]=e("span",{class:"radio-text"},"Project-specific",-1))]),e("label",ie,[I(e("input",{"onUpdate:modelValue":t[6]||(t[6]=a=>n.value.isGlobal=a),type:"radio",value:!0,class:"radio-input"},null,512),[[O,n.value.isGlobal]]),t[16]||(t[16]=e("span",{class:"radio-text"},"Global (all projects)",-1))])])])),h.value?(r(),d("div",re,y(h.value),1)):R("",!0)]),e("div",ue,[e("button",{type:"button",class:"btn btn-secondary",onClick:$}," Cancel "),e("button",{type:"submit",class:"btn btn-primary",disabled:!P.value||g.value},y(g.value?"Saving...":C.value?"Save Changes":"Save Quick Response"),9,ce)])],32)])])):R("",!0)]))}},pe=T(de,[["__scopeId","data-v-f2c13fd9"]]),be={class:"settings-panel",role:"dialog","aria-modal":"true"},fe={class:"settings-header"},ve={class:"settings-content"},ge={class:"section"},he={class:"section-header"},me={key:0,class:"loading-state"},ye={key:1,class:"empty-state"},ke={key:2,class:"response-list"},Re={class:"response-info"},_e={class:"response-label"},je={class:"response-content"},Ce={key:0,class:"auto-badge"},we={class:"response-actions"},$e=["disabled","onClick"],Ie=["disabled","onClick"],Se=["onClick"],xe=["onClick"],De={class:"section"},Pe={class:"section-header"},Be={key:0,class:"loading-state"},Ge={key:1,class:"empty-state"},Qe={key:2,class:"response-list"},qe={class:"response-info"},Ee={class:"response-label"},Me={class:"response-content"},Ve={key:0,class:"auto-badge"},Le={class:"response-actions"},Oe=["disabled","onClick"],Ae=["disabled","onClick"],Fe=["onClick"],Te=["onClick"],Ue={class:"confirm-dialog"},Ne={class:"confirm-message"},ze={class:"confirm-actions"},He={__name:"QuickResponseSettings",props:{isOpen:{type:Boolean,default:!1},projectId:{type:String,required:!0}},emits:["close"],setup(l,{expose:o}){const s=U(),c=j(!1),p=j(null),_=j(!1),v=j(null),n=w(()=>s.loading),g=w(()=>s.projectResponses),h=w(()=>s.globalResponses);function C(a){return a.length<=60?a:`${a.substring(0,60)}...`}function S(a){p.value=null,_.value=a,c.value=!0}function x(a){p.value=a,_.value=a.projectId===null,c.value=!0}function P(){c.value=!1,p.value=null}function $(){}function B(a){v.value=a}async function b(){if(v.value)try{await s.deleteResponse(v.value.id),v.value=null}catch(a){console.error("Failed to delete response:",a)}}async function t(a,u,i,m){const f=i+m;if(f<0||f>=u.length)return;const D=[...u];[D[i],D[f]]=[D[f],D[i]];const N=D.map(Q=>Q.id);try{await s.reorderResponses(a,N)}catch(Q){console.error("Failed to reorder responses:",Q)}}return o({moveResponse:t}),(a,u)=>(r(),d(E,null,[(r(),M(V,{to:"body"},[l.isOpen?(r(),d("div",{key:0,class:"settings-overlay",onClick:u[3]||(u[3]=G(i=>a.$emit("close"),["self"]))},[e("div",be,[e("div",fe,[u[6]||(u[6]=e("h2",{class:"settings-title"}," Quick Responses ",-1)),e("button",{class:"close-button","aria-label":"Close settings",onClick:u[0]||(u[0]=i=>a.$emit("close"))}," × ")]),e("div",ve,[e("div",ge,[e("div",he,[u[7]||(u[7]=e("h3",{class:"section-title"}," Project Responses ",-1)),e("button",{class:"add-button",onClick:u[1]||(u[1]=i=>S(!1))}," + Add ")]),n.value?(r(),d("div",me," Loading... ")):g.value.length===0?(r(),d("div",ye," No project-specific quick responses yet. ")):(r(),d("ul",ke,[(r(!0),d(E,null,A(g.value,(i,m)=>(r(),d("li",{key:i.id,class:"response-item"},[e("div",Re,[e("span",_e,y(i.label),1),e("span",je,y(C(i.content)),1),i.autoSubmit?(r(),d("span",Ce,"Auto-submit")):R("",!0)]),e("div",we,[e("button",{class:"action-button",disabled:m===0,title:"Move up",onClick:f=>t(l.projectId,g.value,m,-1)}," ↑ ",8,$e),e("button",{class:"action-button",disabled:m===g.value.length-1,title:"Move down",onClick:f=>t(l.projectId,g.value,m,1)}," ↓ ",8,Ie),e("button",{class:"action-button",title:"Edit","aria-label":"Edit",onClick:f=>x(i)}," ✏️ ",8,Se),e("button",{class:"action-button action-danger",title:"Delete",onClick:f=>B(i)}," 🗑️ ",8,xe)])]))),128))]))]),e("div",De,[e("div",Pe,[u[8]||(u[8]=e("h3",{class:"section-title"}," Global Responses ",-1)),e("button",{class:"add-button",onClick:u[2]||(u[2]=i=>S(!0))}," + Add ")]),n.value?(r(),d("div",Be," Loading... ")):h.value.length===0?(r(),d("div",Ge," No global quick responses yet. Global responses appear in all projects. ")):(r(),d("ul",Qe,[(r(!0),d(E,null,A(h.value,(i,m)=>(r(),d("li",{key:i.id,class:"response-item"},[e("div",qe,[e("span",Ee,y(i.label),1),e("span",Me,y(C(i.content)),1),i.autoSubmit?(r(),d("span",Ve,"Auto-submit")):R("",!0)]),e("div",Le,[e("button",{class:"action-button",disabled:m===0,title:"Move up",onClick:f=>t(null,h.value,m,-1)}," ↑ ",8,Oe),e("button",{class:"action-button",disabled:m===h.value.length-1,title:"Move down",onClick:f=>t(null,h.value,m,1)}," ↓ ",8,Ae),e("button",{class:"action-button",title:"Edit","aria-label":"Edit",onClick:f=>x(i)}," ✏️ ",8,Fe),e("button",{class:"action-button action-danger",title:"Delete",onClick:f=>B(i)}," 🗑️ ",8,Te)])]))),128))]))])])])])):R("",!0)])),K(pe,{"is-open":c.value,"project-id":l.projectId,"editing-response":p.value,"default-is-global":_.value,onClose:P,onSaved:$},null,8,["is-open","project-id","editing-response","default-is-global"]),(r(),M(V,{to:"body"},[v.value?(r(),d("div",{key:0,class:"confirm-overlay",onClick:u[5]||(u[5]=G(i=>v.value=null,["self"]))},[e("div",Ue,[e("p",Ne,' Are you sure you want to delete "'+y(v.value.label)+'"? ',1),e("div",ze,[e("button",{class:"btn btn-secondary",onClick:u[4]||(u[4]=i=>v.value=null)}," Cancel "),e("button",{class:"btn btn-danger",onClick:b}," Delete ")])])])):R("",!0)]))],64))}},We=T(He,[["__scopeId","data-v-9fffa8ff"]]);export{We as Q,U as a,Je as u};
1
+ import{L as F,_ as T,m as L,a as r,G as M,c as d,b as e,t as y,h as G,j as I,v as q,k as R,p as z,H as O,V,x as w,l as j,I as H,F as E,r as A,d as K}from"./index-LoOsRfMI.js";import{a as k}from"./ApiClient-Dbs1H78V.js";const Je=F("projectDefaults",{state:()=>({defaultsByProjectId:{},loading:!1,error:null}),getters:{getDefaultsForProject:l=>o=>l.defaultsByProjectId[o]||null},actions:{async fetchDefaults(l){this.loading=!0,this.error=null;try{const o=await k.getProjectSessionDefaults(l);return this.defaultsByProjectId[l]=o,o}catch(o){throw this.error=o.message,o}finally{this.loading=!1}},async updateDefaults(l,o){this.loading=!0,this.error=null;try{const s=await k.updateProjectSessionDefaults(l,o);return this.defaultsByProjectId[l]=s,s}catch(s){throw this.error=s.message,s}finally{this.loading=!1}},async resetDefaults(l){this.loading=!0,this.error=null;try{return await k.resetProjectSessionDefaults(l),this.defaultsByProjectId[l]={mode:null,thinkingEnabled:null,effortLevel:null,startImmediately:null,gitMode:null,gitBranch:null,model:null},this.defaultsByProjectId[l]}catch(o){throw this.error=o.message,o}finally{this.loading=!1}},clearProjectDefaults(l){delete this.defaultsByProjectId[l]},clearAllDefaults(){this.defaultsByProjectId={}}}}),U=F("quickResponses",{state:()=>({projectResponses:[],globalResponses:[],loading:!1,error:null,currentProjectId:null}),getters:{allResponses:l=>[...l.projectResponses,...l.globalResponses],hasResponses:l=>l.projectResponses.length>0||l.globalResponses.length>0},actions:{async fetchForProject(l){this.loading=!0,this.error=null,this.currentProjectId=l;try{const o=await k.getQuickResponses(l);return this.projectResponses=o.project,this.globalResponses=o.global,o}catch(o){throw this.error=o.message,o}finally{this.loading=!1}},async createResponse(l,o){this.loading=!0,this.error=null;try{const s=await k.createQuickResponse(l,o);return s.projectId===null?this.globalResponses.push(s):this.projectResponses.push(s),s}catch(s){throw this.error=s.message,s}finally{this.loading=!1}},async updateResponse(l,o){this.loading=!0,this.error=null;try{const s=await k.updateQuickResponse(l,o),c=this.projectResponses.findIndex(p=>p.id===l);if(c!==-1)this.projectResponses[c]=s;else{const p=this.globalResponses.findIndex(_=>_.id===l);p!==-1&&(this.globalResponses[p]=s)}return s}catch(s){throw this.error=s.message,s}finally{this.loading=!1}},async deleteResponse(l){this.loading=!0,this.error=null;try{await k.deleteQuickResponse(l);const o=this.projectResponses.findIndex(s=>s.id===l);if(o!==-1)this.projectResponses.splice(o,1);else{const s=this.globalResponses.findIndex(c=>c.id===l);s!==-1&&this.globalResponses.splice(s,1)}}catch(o){throw this.error=o.message,o}finally{this.loading=!1}},async reorderResponses(l,o){this.loading=!0,this.error=null;try{const s=o.map((c,p)=>({id:c,sortOrder:p}));if(l){const c=await k.reorderQuickResponses(l,s);this.projectResponses=c.project,this.globalResponses=c.global}else{const c=await k.reorderGlobalQuickResponses(s);this.globalResponses=c}}catch(s){throw this.error=s.message,s}finally{this.loading=!1}},clearResponses(){this.projectResponses=[],this.globalResponses=[],this.currentProjectId=null,this.error=null}}}),Y={class:"dialog-header"},J={class:"dialog-content"},W={class:"form-group"},X={key:0,class:"form-error"},Z={class:"form-group"},ee={key:0,class:"form-error"},se={class:"form-group"},te={class:"form-group"},le={class:"checkbox-label"},oe={key:0,class:"form-group"},ne={class:"radio-group"},ae={class:"radio-label"},ie={class:"radio-label"},re={key:1,class:"error-message"},ue={class:"dialog-footer"},ce=["disabled"],de={__name:"QuickResponseDialog",props:{isOpen:{type:Boolean,default:!1},projectId:{type:String,required:!0},editingResponse:{type:Object,default:null},defaultIsGlobal:{type:Boolean,default:!1}},emits:["close","saved"],setup(l,{emit:o}){const s=l,c=o,p=U(),_=j(null),v=`dialog-title-${Math.random().toString(36).slice(2)}`,n=j({label:"",content:"",category:"",autoSubmit:!1,isGlobal:!1}),g=j(!1),h=j(null),C=w(()=>!!s.editingResponse),S=w(()=>n.value.label&&n.value.label.length>50?"Label must be 50 characters or less":null),x=w(()=>n.value.content&&n.value.content.length>1e4?"Content must be 10,000 characters or less":null),P=w(()=>n.value.label.trim().length>0&&n.value.label.length<=50&&n.value.content.trim().length>0&&n.value.content.length<=1e4);L(()=>s.isOpen,b=>{b&&(s.editingResponse?n.value={label:s.editingResponse.label||"",content:s.editingResponse.content||"",category:s.editingResponse.category||"",autoSubmit:s.editingResponse.autoSubmit||!1,isGlobal:s.editingResponse.projectId===null}:n.value={label:"",content:"",category:"",autoSubmit:!1,isGlobal:s.defaultIsGlobal},h.value=null,H(()=>{var t;(t=_.value)==null||t.focus()}))}),L(()=>s.isOpen,b=>{if(b){const t=a=>{a.key==="Escape"&&$()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)}});function $(){c("close")}async function B(){if(!(!P.value||g.value)){g.value=!0,h.value=null;try{const b={label:n.value.label.trim(),content:n.value.content,category:n.value.category.trim()||null,autoSubmit:n.value.autoSubmit};C.value?await p.updateResponse(s.editingResponse.id,b):(b.isGlobal=n.value.isGlobal,await p.createResponse(s.projectId,b)),c("saved"),c("close")}catch(b){h.value=b.message||"Failed to save quick response"}finally{g.value=!1}}}return(b,t)=>(r(),M(V,{to:"body"},[l.isOpen?(r(),d("div",{key:0,class:"dialog-overlay",onClick:G($,["self"])},[e("div",{class:"dialog",role:"dialog","aria-modal":"true","aria-labelledby":v},[e("div",Y,[e("h2",{id:v,class:"dialog-title"},y(C.value?"Edit Quick Response":"Add Quick Response"),1),e("button",{class:"close-button","aria-label":"Close dialog",onClick:$}," × ")]),e("form",{class:"dialog-form",onSubmit:G(B,["prevent"])},[e("div",J,[e("div",W,[t[7]||(t[7]=e("label",{for:"qr-label",class:"form-label"},"Label *",-1)),I(e("input",{id:"qr-label",ref_key:"labelInput",ref:_,"onUpdate:modelValue":t[0]||(t[0]=a=>n.value.label=a),type:"text",class:"form-input",placeholder:"e.g., Yes, LGTM, Run tests",maxlength:"50",required:"",onBlur:t[1]||(t[1]=a=>n.value.label=n.value.label.trim())},null,544),[[q,n.value.label]]),t[8]||(t[8]=e("span",{class:"form-help"},"Short text shown on the button (max 50 characters)",-1)),S.value?(r(),d("span",X,y(S.value),1)):R("",!0)]),e("div",Z,[t[9]||(t[9]=e("label",{for:"qr-content",class:"form-label"},"Content *",-1)),I(e("textarea",{id:"qr-content","onUpdate:modelValue":t[2]||(t[2]=a=>n.value.content=a),class:"form-textarea",placeholder:"The full message that will be inserted into the prompt",rows:"4",maxlength:"10000",required:""},null,512),[[q,n.value.content]]),t[10]||(t[10]=e("span",{class:"form-help"},"The full message that will be inserted (max 10,000 characters)",-1)),x.value?(r(),d("span",ee,y(x.value),1)):R("",!0)]),e("div",se,[t[11]||(t[11]=e("label",{for:"qr-category",class:"form-label"},"Category (optional)",-1)),I(e("input",{id:"qr-category","onUpdate:modelValue":t[3]||(t[3]=a=>n.value.category=a),type:"text",class:"form-input",placeholder:"e.g., feedback, commands",maxlength:"50"},null,512),[[q,n.value.category]]),t[12]||(t[12]=e("span",{class:"form-help"},"Optional grouping for organization",-1))]),e("div",te,[e("label",le,[I(e("input",{"onUpdate:modelValue":t[4]||(t[4]=a=>n.value.autoSubmit=a),type:"checkbox",class:"checkbox-input"},null,512),[[z,n.value.autoSubmit]]),t[13]||(t[13]=e("span",{class:"checkbox-text"},"Auto-submit",-1))]),t[14]||(t[14]=e("span",{class:"form-help indent"},"Send immediately when clicked (no confirmation)",-1))]),C.value?R("",!0):(r(),d("div",oe,[t[17]||(t[17]=e("span",{class:"form-label"},"Scope",-1)),e("div",ne,[e("label",ae,[I(e("input",{"onUpdate:modelValue":t[5]||(t[5]=a=>n.value.isGlobal=a),type:"radio",value:!1,class:"radio-input"},null,512),[[O,n.value.isGlobal]]),t[15]||(t[15]=e("span",{class:"radio-text"},"Project-specific",-1))]),e("label",ie,[I(e("input",{"onUpdate:modelValue":t[6]||(t[6]=a=>n.value.isGlobal=a),type:"radio",value:!0,class:"radio-input"},null,512),[[O,n.value.isGlobal]]),t[16]||(t[16]=e("span",{class:"radio-text"},"Global (all projects)",-1))])])])),h.value?(r(),d("div",re,y(h.value),1)):R("",!0)]),e("div",ue,[e("button",{type:"button",class:"btn btn-secondary",onClick:$}," Cancel "),e("button",{type:"submit",class:"btn btn-primary",disabled:!P.value||g.value},y(g.value?"Saving...":C.value?"Save Changes":"Save Quick Response"),9,ce)])],32)])])):R("",!0)]))}},pe=T(de,[["__scopeId","data-v-f2c13fd9"]]),be={class:"settings-panel",role:"dialog","aria-modal":"true"},fe={class:"settings-header"},ve={class:"settings-content"},ge={class:"section"},he={class:"section-header"},me={key:0,class:"loading-state"},ye={key:1,class:"empty-state"},ke={key:2,class:"response-list"},Re={class:"response-info"},_e={class:"response-label"},je={class:"response-content"},Ce={key:0,class:"auto-badge"},we={class:"response-actions"},$e=["disabled","onClick"],Ie=["disabled","onClick"],Se=["onClick"],xe=["onClick"],De={class:"section"},Pe={class:"section-header"},Be={key:0,class:"loading-state"},Ge={key:1,class:"empty-state"},Qe={key:2,class:"response-list"},qe={class:"response-info"},Ee={class:"response-label"},Me={class:"response-content"},Ve={key:0,class:"auto-badge"},Le={class:"response-actions"},Oe=["disabled","onClick"],Ae=["disabled","onClick"],Fe=["onClick"],Te=["onClick"],Ue={class:"confirm-dialog"},Ne={class:"confirm-message"},ze={class:"confirm-actions"},He={__name:"QuickResponseSettings",props:{isOpen:{type:Boolean,default:!1},projectId:{type:String,required:!0}},emits:["close"],setup(l,{expose:o}){const s=U(),c=j(!1),p=j(null),_=j(!1),v=j(null),n=w(()=>s.loading),g=w(()=>s.projectResponses),h=w(()=>s.globalResponses);function C(a){return a.length<=60?a:`${a.substring(0,60)}...`}function S(a){p.value=null,_.value=a,c.value=!0}function x(a){p.value=a,_.value=a.projectId===null,c.value=!0}function P(){c.value=!1,p.value=null}function $(){}function B(a){v.value=a}async function b(){if(v.value)try{await s.deleteResponse(v.value.id),v.value=null}catch(a){console.error("Failed to delete response:",a)}}async function t(a,u,i,m){const f=i+m;if(f<0||f>=u.length)return;const D=[...u];[D[i],D[f]]=[D[f],D[i]];const N=D.map(Q=>Q.id);try{await s.reorderResponses(a,N)}catch(Q){console.error("Failed to reorder responses:",Q)}}return o({moveResponse:t}),(a,u)=>(r(),d(E,null,[(r(),M(V,{to:"body"},[l.isOpen?(r(),d("div",{key:0,class:"settings-overlay",onClick:u[3]||(u[3]=G(i=>a.$emit("close"),["self"]))},[e("div",be,[e("div",fe,[u[6]||(u[6]=e("h2",{class:"settings-title"}," Quick Responses ",-1)),e("button",{class:"close-button","aria-label":"Close settings",onClick:u[0]||(u[0]=i=>a.$emit("close"))}," × ")]),e("div",ve,[e("div",ge,[e("div",he,[u[7]||(u[7]=e("h3",{class:"section-title"}," Project Responses ",-1)),e("button",{class:"add-button",onClick:u[1]||(u[1]=i=>S(!1))}," + Add ")]),n.value?(r(),d("div",me," Loading... ")):g.value.length===0?(r(),d("div",ye," No project-specific quick responses yet. ")):(r(),d("ul",ke,[(r(!0),d(E,null,A(g.value,(i,m)=>(r(),d("li",{key:i.id,class:"response-item"},[e("div",Re,[e("span",_e,y(i.label),1),e("span",je,y(C(i.content)),1),i.autoSubmit?(r(),d("span",Ce,"Auto-submit")):R("",!0)]),e("div",we,[e("button",{class:"action-button",disabled:m===0,title:"Move up",onClick:f=>t(l.projectId,g.value,m,-1)}," ↑ ",8,$e),e("button",{class:"action-button",disabled:m===g.value.length-1,title:"Move down",onClick:f=>t(l.projectId,g.value,m,1)}," ↓ ",8,Ie),e("button",{class:"action-button",title:"Edit","aria-label":"Edit",onClick:f=>x(i)}," ✏️ ",8,Se),e("button",{class:"action-button action-danger",title:"Delete",onClick:f=>B(i)}," 🗑️ ",8,xe)])]))),128))]))]),e("div",De,[e("div",Pe,[u[8]||(u[8]=e("h3",{class:"section-title"}," Global Responses ",-1)),e("button",{class:"add-button",onClick:u[2]||(u[2]=i=>S(!0))}," + Add ")]),n.value?(r(),d("div",Be," Loading... ")):h.value.length===0?(r(),d("div",Ge," No global quick responses yet. Global responses appear in all projects. ")):(r(),d("ul",Qe,[(r(!0),d(E,null,A(h.value,(i,m)=>(r(),d("li",{key:i.id,class:"response-item"},[e("div",qe,[e("span",Ee,y(i.label),1),e("span",Me,y(C(i.content)),1),i.autoSubmit?(r(),d("span",Ve,"Auto-submit")):R("",!0)]),e("div",Le,[e("button",{class:"action-button",disabled:m===0,title:"Move up",onClick:f=>t(null,h.value,m,-1)}," ↑ ",8,Oe),e("button",{class:"action-button",disabled:m===h.value.length-1,title:"Move down",onClick:f=>t(null,h.value,m,1)}," ↓ ",8,Ae),e("button",{class:"action-button",title:"Edit","aria-label":"Edit",onClick:f=>x(i)}," ✏️ ",8,Fe),e("button",{class:"action-button action-danger",title:"Delete",onClick:f=>B(i)}," 🗑️ ",8,Te)])]))),128))]))])])])])):R("",!0)])),K(pe,{"is-open":c.value,"project-id":l.projectId,"editing-response":p.value,"default-is-global":_.value,onClose:P,onSaved:$},null,8,["is-open","project-id","editing-response","default-is-global"]),(r(),M(V,{to:"body"},[v.value?(r(),d("div",{key:0,class:"confirm-overlay",onClick:u[5]||(u[5]=G(i=>v.value=null,["self"]))},[e("div",Ue,[e("p",Ne,' Are you sure you want to delete "'+y(v.value.label)+'"? ',1),e("div",ze,[e("button",{class:"btn btn-secondary",onClick:u[4]||(u[4]=i=>v.value=null)}," Cancel "),e("button",{class:"btn btn-danger",onClick:b}," Delete ")])])])):R("",!0)]))],64))}},We=T(He,[["__scopeId","data-v-9fffa8ff"]]);export{We as Q,U as a,Je as u};
@@ -1 +1 @@
1
- import{_ as j,a as l,c as o,b as t,k as r,F,r as z,t as k,h as v,l as S,E as B,x as $}from"./index-CVOJVSsC.js";import{a as E}from"./QuickResponseSettings-B2eVAtHW.js";function re(m){return function(d){d.key==="Enter"&&(d.metaKey||d.ctrlKey)&&(d.preventDefault(),m())}}const N=["accept"],Q={key:0,class:"drop-zone"},I={key:1,class:"attached-files"},L={class:"file-icon"},P=["title"],T={class:"file-size"},K=["onClick"],Z={__name:"FileAttachment",props:{maxFiles:{type:Number,default:10},maxSize:{type:Number,default:10*1024*1024},acceptTypes:{type:String,default:"image/*,text/*,.json,.md,.csv,.pdf,.js,.ts,.py,.java,.go,.rs,.c,.cpp,.h,.sh,.yaml,.yml,.xml,.html,.css"}},emits:["update:files"],setup(m,{expose:_,emit:d}){const p=m,u=d,i=S([]),f=S(!1),h=S(null);function b(){var e;(e=h.value)==null||e.click()}function y(e){const s=e.target;a(Array.from(s.files)),s.value=""}function x(){f.value=!0}function g(){f.value=!1}function n(e){f.value=!1,a(Array.from(e.dataTransfer.files))}function a(e){for(const s of e){if(i.value.length>=p.maxFiles){alert(`Maximum ${p.maxFiles} files allowed`);break}if(s.size>p.maxSize){alert(`File "${s.name}" exceeds maximum size of ${R(p.maxSize)}`);continue}i.value.some(c=>c.name===s.name&&c.size===s.size)||i.value.push(s)}u("update:files",i.value)}function w(e){i.value.splice(e,1),u("update:files",i.value)}function A(){i.value=[],u("update:files",[])}function D(e){const s=e.type||"";return s.startsWith("image/")?"🖼️":s.startsWith("text/")||s==="application/json"?"📄":s==="application/pdf"?"📕":s.includes("javascript")||s.includes("typescript")?"📜":"📎"}function R(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function M(e,s=25){if(e.length<=s)return e;const c=e.split(".").pop();return`${`${e.slice(0,e.length-c.length-1).slice(0,s-c.length-4)}...`}.${c}`}return _({clear:A,files:i,addFiles:a}),(e,s)=>(l(),o("div",{class:"file-attachments",onDragover:v(x,["prevent"]),onDragleave:v(g,["prevent"]),onDrop:v(n,["prevent"])},[t("input",{ref_key:"fileInput",ref:h,type:"file",multiple:"",accept:m.acceptTypes,class:"hidden-input",onChange:y},null,40,N),t("button",{type:"button",class:"attach-btn",title:"Attach files (drag & drop supported)",onClick:b},[...s[0]||(s[0]=[t("span",{class:"attach-icon"},"📎",-1),t("span",{class:"attach-text"},"Attach",-1)])]),f.value?(l(),o("div",Q,[...s[1]||(s[1]=[t("span",{class:"drop-text"},"Drop files here",-1)])])):r("",!0),i.value.length>0?(l(),o("div",I,[(l(!0),o(F,null,z(i.value,(c,C)=>(l(),o("div",{key:C,class:"file-chip"},[t("span",L,k(D(c)),1),t("span",{class:"file-name",title:c.name},k(M(c.name)),9,P),t("span",T,"("+k(R(c.size))+")",1),t("button",{type:"button",class:"remove-btn",title:"Remove file",onClick:q=>w(C)}," × ",8,K)]))),128))])):r("",!0)],32))}},pe=j(Z,[["__scopeId","data-v-7f03e84b"]]),O={class:"panel-header"},V={class:"header-left"},W=["aria-expanded"],G={key:0,class:"loading-state"},H={key:1,class:"empty-state"},J={key:2,class:"responses-content"},U={key:0,class:"response-section"},X={class:"responses-row"},Y=["title","onClick"],ee={class:"button-label"},te={key:0,class:"auto-icon",title:"Auto-submit"},se={key:1,class:"response-section"},ne={class:"responses-row"},ae=["title","onClick"],le={class:"button-label"},oe={key:0,class:"auto-icon",title:"Auto-submit"},ie=Object.assign({name:"QuickResponsesPanel"},{__name:"QuickResponsesPanel",props:{showEmpty:{type:Boolean,default:!0}},emits:["insert","openSettings"],setup(m,{emit:_}){const d=_,p=E(),u=S(!1),i=$(()=>p.loading),f=$(()=>p.projectResponses),h=$(()=>p.globalResponses),b=$(()=>p.hasResponses);function y(){u.value=!u.value}function x(g){d("insert",{content:g.content,autoSubmit:g.autoSubmit}),u.value=!1}return(g,n)=>b.value||m.showEmpty?(l(),o("div",{key:0,class:"quick-responses-panel cursor-pointer",onClick:y},[t("div",O,[t("div",V,[t("button",{type:"button",class:"toggle-button","aria-expanded":u.value,title:"Toggle quick responses panel","aria-label":"Toggle quick responses panel",onClick:v(y,["stop"])},[...n[1]||(n[1]=[t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",class:"chevron-icon"},[t("path",{"fill-rule":"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 1 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z","clip-rule":"evenodd"})],-1)])],8,W),n[2]||(n[2]=t("span",{class:"panel-title"},"Quick Responses",-1))]),u.value?(l(),o("button",{key:0,type:"button",class:"settings-button",title:"Manage quick responses","aria-label":"Manage quick responses",onClick:n[0]||(n[0]=v(a=>g.$emit("openSettings"),["stop"]))},[...n[3]||(n[3]=[t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",class:"settings-icon"},[t("path",{"fill-rule":"evenodd",d:"M7.84 1.804A1 1 0 0 1 8.82 1h2.36a1 1 0 0 1 .98.804l.331 1.652a6.993 6.993 0 0 1 1.929 1.115l1.598-.54a1 1 0 0 1 1.186.447l1.18 2.044a1 1 0 0 1-.205 1.251l-1.267 1.113a7.047 7.047 0 0 1 0 2.228l1.267 1.113a1 1 0 0 1 .206 1.25l-1.18 2.045a1 1 0 0 1-1.187.447l-1.598-.54a6.993 6.993 0 0 1-1.929 1.115l-.33 1.652a1 1 0 0 1-.98.804H8.82a1 1 0 0 1-.98-.804l-.331-1.652a6.993 6.993 0 0 1-1.929-1.115l-1.598.54a1 1 0 0 1-1.186-.447l-1.18-2.044a1 1 0 0 1 .205-1.251l1.267-1.114a7.05 7.05 0 0 1 0-2.227L1.821 7.773a1 1 0 0 1-.206-1.25l1.18-2.045a1 1 0 0 1 1.187-.447l1.598.54A6.993 6.993 0 0 1 7.51 3.456l.33-1.652ZM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z","clip-rule":"evenodd"})],-1)])])):r("",!0)]),i.value&&u.value?(l(),o("div",G,[...n[4]||(n[4]=[t("span",{class:"loading-text"},"Loading...",-1)])])):!b.value&&u.value?(l(),o("div",H,[...n[5]||(n[5]=[t("span",{class:"empty-text"},"No quick responses yet",-1)])])):r("",!0),u.value&&b.value&&!i.value?(l(),o("div",J,[f.value.length>0?(l(),o("div",U,[n[6]||(n[6]=t("span",{class:"section-label"},"Project",-1)),t("div",X,[(l(!0),o(F,null,z(f.value,a=>(l(),o("button",{key:a.id,type:"button",class:B(["response-button project-response",{"auto-submit":a.autoSubmit}]),title:a.content,onClick:v(w=>x(a),["stop"])},[t("span",ee,k(a.label),1),a.autoSubmit?(l(),o("span",te,"⚡")):r("",!0)],10,Y))),128))])])):r("",!0),h.value.length>0?(l(),o("div",se,[n[7]||(n[7]=t("span",{class:"section-label"},"Global",-1)),t("div",ne,[(l(!0),o(F,null,z(h.value,a=>(l(),o("button",{key:a.id,type:"button",class:B(["response-button global-response",{"auto-submit":a.autoSubmit}]),title:a.content,onClick:v(w=>x(a),["stop"])},[t("span",le,k(a.label),1),a.autoSubmit?(l(),o("span",oe,"⚡")):r("",!0)],10,ae))),128))])])):r("",!0)])):r("",!0)])):r("",!0)}}),de=j(ie,[["__scopeId","data-v-0f48dfd6"]]);export{pe as F,de as Q,re as u};
1
+ import{_ as j,a as l,c as o,b as t,k as r,F,r as z,t as k,h as v,l as S,E as B,x as $}from"./index-LoOsRfMI.js";import{a as E}from"./QuickResponseSettings-DB8MD7dm.js";function re(m){return function(d){d.key==="Enter"&&(d.metaKey||d.ctrlKey)&&(d.preventDefault(),m())}}const N=["accept"],Q={key:0,class:"drop-zone"},I={key:1,class:"attached-files"},L={class:"file-icon"},P=["title"],T={class:"file-size"},K=["onClick"],Z={__name:"FileAttachment",props:{maxFiles:{type:Number,default:10},maxSize:{type:Number,default:10*1024*1024},acceptTypes:{type:String,default:"image/*,text/*,.json,.md,.csv,.pdf,.js,.ts,.py,.java,.go,.rs,.c,.cpp,.h,.sh,.yaml,.yml,.xml,.html,.css"}},emits:["update:files"],setup(m,{expose:_,emit:d}){const p=m,u=d,i=S([]),f=S(!1),h=S(null);function b(){var e;(e=h.value)==null||e.click()}function y(e){const s=e.target;a(Array.from(s.files)),s.value=""}function x(){f.value=!0}function g(){f.value=!1}function n(e){f.value=!1,a(Array.from(e.dataTransfer.files))}function a(e){for(const s of e){if(i.value.length>=p.maxFiles){alert(`Maximum ${p.maxFiles} files allowed`);break}if(s.size>p.maxSize){alert(`File "${s.name}" exceeds maximum size of ${R(p.maxSize)}`);continue}i.value.some(c=>c.name===s.name&&c.size===s.size)||i.value.push(s)}u("update:files",i.value)}function w(e){i.value.splice(e,1),u("update:files",i.value)}function A(){i.value=[],u("update:files",[])}function D(e){const s=e.type||"";return s.startsWith("image/")?"🖼️":s.startsWith("text/")||s==="application/json"?"📄":s==="application/pdf"?"📕":s.includes("javascript")||s.includes("typescript")?"📜":"📎"}function R(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function M(e,s=25){if(e.length<=s)return e;const c=e.split(".").pop();return`${`${e.slice(0,e.length-c.length-1).slice(0,s-c.length-4)}...`}.${c}`}return _({clear:A,files:i,addFiles:a}),(e,s)=>(l(),o("div",{class:"file-attachments",onDragover:v(x,["prevent"]),onDragleave:v(g,["prevent"]),onDrop:v(n,["prevent"])},[t("input",{ref_key:"fileInput",ref:h,type:"file",multiple:"",accept:m.acceptTypes,class:"hidden-input",onChange:y},null,40,N),t("button",{type:"button",class:"attach-btn",title:"Attach files (drag & drop supported)",onClick:b},[...s[0]||(s[0]=[t("span",{class:"attach-icon"},"📎",-1),t("span",{class:"attach-text"},"Attach",-1)])]),f.value?(l(),o("div",Q,[...s[1]||(s[1]=[t("span",{class:"drop-text"},"Drop files here",-1)])])):r("",!0),i.value.length>0?(l(),o("div",I,[(l(!0),o(F,null,z(i.value,(c,C)=>(l(),o("div",{key:C,class:"file-chip"},[t("span",L,k(D(c)),1),t("span",{class:"file-name",title:c.name},k(M(c.name)),9,P),t("span",T,"("+k(R(c.size))+")",1),t("button",{type:"button",class:"remove-btn",title:"Remove file",onClick:q=>w(C)}," × ",8,K)]))),128))])):r("",!0)],32))}},pe=j(Z,[["__scopeId","data-v-7f03e84b"]]),O={class:"panel-header"},V={class:"header-left"},W=["aria-expanded"],G={key:0,class:"loading-state"},H={key:1,class:"empty-state"},J={key:2,class:"responses-content"},U={key:0,class:"response-section"},X={class:"responses-row"},Y=["title","onClick"],ee={class:"button-label"},te={key:0,class:"auto-icon",title:"Auto-submit"},se={key:1,class:"response-section"},ne={class:"responses-row"},ae=["title","onClick"],le={class:"button-label"},oe={key:0,class:"auto-icon",title:"Auto-submit"},ie=Object.assign({name:"QuickResponsesPanel"},{__name:"QuickResponsesPanel",props:{showEmpty:{type:Boolean,default:!0}},emits:["insert","openSettings"],setup(m,{emit:_}){const d=_,p=E(),u=S(!1),i=$(()=>p.loading),f=$(()=>p.projectResponses),h=$(()=>p.globalResponses),b=$(()=>p.hasResponses);function y(){u.value=!u.value}function x(g){d("insert",{content:g.content,autoSubmit:g.autoSubmit}),u.value=!1}return(g,n)=>b.value||m.showEmpty?(l(),o("div",{key:0,class:"quick-responses-panel cursor-pointer",onClick:y},[t("div",O,[t("div",V,[t("button",{type:"button",class:"toggle-button","aria-expanded":u.value,title:"Toggle quick responses panel","aria-label":"Toggle quick responses panel",onClick:v(y,["stop"])},[...n[1]||(n[1]=[t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",class:"chevron-icon"},[t("path",{"fill-rule":"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 1 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z","clip-rule":"evenodd"})],-1)])],8,W),n[2]||(n[2]=t("span",{class:"panel-title"},"Quick Responses",-1))]),u.value?(l(),o("button",{key:0,type:"button",class:"settings-button",title:"Manage quick responses","aria-label":"Manage quick responses",onClick:n[0]||(n[0]=v(a=>g.$emit("openSettings"),["stop"]))},[...n[3]||(n[3]=[t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",class:"settings-icon"},[t("path",{"fill-rule":"evenodd",d:"M7.84 1.804A1 1 0 0 1 8.82 1h2.36a1 1 0 0 1 .98.804l.331 1.652a6.993 6.993 0 0 1 1.929 1.115l1.598-.54a1 1 0 0 1 1.186.447l1.18 2.044a1 1 0 0 1-.205 1.251l-1.267 1.113a7.047 7.047 0 0 1 0 2.228l1.267 1.113a1 1 0 0 1 .206 1.25l-1.18 2.045a1 1 0 0 1-1.187.447l-1.598-.54a6.993 6.993 0 0 1-1.929 1.115l-.33 1.652a1 1 0 0 1-.98.804H8.82a1 1 0 0 1-.98-.804l-.331-1.652a6.993 6.993 0 0 1-1.929-1.115l-1.598.54a1 1 0 0 1-1.186-.447l-1.18-2.044a1 1 0 0 1 .205-1.251l1.267-1.114a7.05 7.05 0 0 1 0-2.227L1.821 7.773a1 1 0 0 1-.206-1.25l1.18-2.045a1 1 0 0 1 1.187-.447l1.598.54A6.993 6.993 0 0 1 7.51 3.456l.33-1.652ZM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z","clip-rule":"evenodd"})],-1)])])):r("",!0)]),i.value&&u.value?(l(),o("div",G,[...n[4]||(n[4]=[t("span",{class:"loading-text"},"Loading...",-1)])])):!b.value&&u.value?(l(),o("div",H,[...n[5]||(n[5]=[t("span",{class:"empty-text"},"No quick responses yet",-1)])])):r("",!0),u.value&&b.value&&!i.value?(l(),o("div",J,[f.value.length>0?(l(),o("div",U,[n[6]||(n[6]=t("span",{class:"section-label"},"Project",-1)),t("div",X,[(l(!0),o(F,null,z(f.value,a=>(l(),o("button",{key:a.id,type:"button",class:B(["response-button project-response",{"auto-submit":a.autoSubmit}]),title:a.content,onClick:v(w=>x(a),["stop"])},[t("span",ee,k(a.label),1),a.autoSubmit?(l(),o("span",te,"⚡")):r("",!0)],10,Y))),128))])])):r("",!0),h.value.length>0?(l(),o("div",se,[n[7]||(n[7]=t("span",{class:"section-label"},"Global",-1)),t("div",ne,[(l(!0),o(F,null,z(h.value,a=>(l(),o("button",{key:a.id,type:"button",class:B(["response-button global-response",{"auto-submit":a.autoSubmit}]),title:a.content,onClick:v(w=>x(a),["stop"])},[t("span",le,k(a.label),1),a.autoSubmit?(l(),o("span",oe,"⚡")):r("",!0)],10,ae))),128))])])):r("",!0)])):r("",!0)])):r("",!0)}}),de=j(ie,[["__scopeId","data-v-0f48dfd6"]]);export{pe as F,de as Q,re as u};
@@ -1 +1 @@
1
- import{_ as E,m as x,z as L,a as _,c as z,b as r,a2 as R,h as b,l as H}from"./index-CVOJVSsC.js";const w={class:"resizable-textarea-wrapper"},y=["value"],k={__name:"ResizableTextarea",props:{modelValue:{type:String,default:""},minHeight:{type:Number,default:80},maxHeight:{type:Number,default:null}},emits:["update:modelValue","input"],setup(c,{expose:m,emit:h}){const o=c,d=h;function p(e){d("update:modelValue",e.target.value),d("input",e)}const t=H(null);let u=!1;x(()=>o.modelValue,e=>{t.value&&t.value.value!==e&&(t.value.value=e)});function v(e){if(!t.value)return;u=!0;const a=e.type.startsWith("touch")?e.touches[0].clientY:e.clientY,f=t.value.offsetHeight,l=i=>{if(!u)return;const g=i.type.startsWith("touch")?i.touches[0].clientY:i.clientY;let s=f+(g-a);s=Math.max(o.minHeight,s),o.maxHeight&&(s=Math.min(o.maxHeight,s)),t.value.style.height=`${s}px`},n=()=>{u=!1,document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",n),document.removeEventListener("touchmove",l),document.removeEventListener("touchend",n),document.removeEventListener("touchcancel",n)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",n),document.addEventListener("touchmove",l,{passive:!1}),document.addEventListener("touchend",n),document.addEventListener("touchcancel",n)}return m({get value(){var e;return((e=t.value)==null?void 0:e.value)||""},set value(e){t.value&&(t.value.value=e)},focus(){var e;(e=t.value)==null||e.focus()},blur(){var e;(e=t.value)==null||e.blur()},select(){var e;(e=t.value)==null||e.select()},get selectionStart(){var e;return((e=t.value)==null?void 0:e.selectionStart)||0},set selectionStart(e){t.value&&(t.value.selectionStart=e)},get selectionEnd(){var e;return((e=t.value)==null?void 0:e.selectionEnd)||0},set selectionEnd(e){t.value&&(t.value.selectionEnd=e)},dispatchEvent(e){var a;return(a=t.value)==null?void 0:a.dispatchEvent(e)}}),L(()=>{u=!1}),(e,a)=>(_(),z("div",w,[r("textarea",R({ref_key:"textareaRef",ref:t},e.$attrs,{value:c.modelValue,onInput:p}),null,16,y),r("div",{class:"resize-handle","aria-hidden":"true",onMousedown:v,onTouchstart:b(v,["prevent"])},[...a[0]||(a[0]=[r("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},[r("path",{d:"M14 10L10 14M14 6L6 14",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])],32)]))}},Y=E(k,[["__scopeId","data-v-4771ec67"]]);export{Y as R};
1
+ import{_ as E,m as x,z as L,a as _,c as z,b as r,a2 as R,h as b,l as H}from"./index-LoOsRfMI.js";const w={class:"resizable-textarea-wrapper"},y=["value"],k={__name:"ResizableTextarea",props:{modelValue:{type:String,default:""},minHeight:{type:Number,default:80},maxHeight:{type:Number,default:null}},emits:["update:modelValue","input"],setup(c,{expose:m,emit:h}){const o=c,d=h;function p(e){d("update:modelValue",e.target.value),d("input",e)}const t=H(null);let u=!1;x(()=>o.modelValue,e=>{t.value&&t.value.value!==e&&(t.value.value=e)});function v(e){if(!t.value)return;u=!0;const a=e.type.startsWith("touch")?e.touches[0].clientY:e.clientY,f=t.value.offsetHeight,l=i=>{if(!u)return;const g=i.type.startsWith("touch")?i.touches[0].clientY:i.clientY;let s=f+(g-a);s=Math.max(o.minHeight,s),o.maxHeight&&(s=Math.min(o.maxHeight,s)),t.value.style.height=`${s}px`},n=()=>{u=!1,document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",n),document.removeEventListener("touchmove",l),document.removeEventListener("touchend",n),document.removeEventListener("touchcancel",n)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",n),document.addEventListener("touchmove",l,{passive:!1}),document.addEventListener("touchend",n),document.addEventListener("touchcancel",n)}return m({get value(){var e;return((e=t.value)==null?void 0:e.value)||""},set value(e){t.value&&(t.value.value=e)},focus(){var e;(e=t.value)==null||e.focus()},blur(){var e;(e=t.value)==null||e.blur()},select(){var e;(e=t.value)==null||e.select()},get selectionStart(){var e;return((e=t.value)==null?void 0:e.selectionStart)||0},set selectionStart(e){t.value&&(t.value.selectionStart=e)},get selectionEnd(){var e;return((e=t.value)==null?void 0:e.selectionEnd)||0},set selectionEnd(e){t.value&&(t.value.selectionEnd=e)},dispatchEvent(e){var a;return(a=t.value)==null?void 0:a.dispatchEvent(e)}}),L(()=>{u=!1}),(e,a)=>(_(),z("div",w,[r("textarea",R({ref_key:"textareaRef",ref:t},e.$attrs,{value:c.modelValue,onInput:p}),null,16,y),r("div",{class:"resize-handle","aria-hidden":"true",onMousedown:v,onTouchstart:b(v,["prevent"])},[...a[0]||(a[0]=[r("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},[r("path",{d:"M14 10L10 14M14 6L6 14",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])],32)]))}},Y=E(k,[["__scopeId","data-v-4771ec67"]]);export{Y as R};
@@ -1 +1 @@
1
- import{_ as A,o as H,a as t,c as o,b as e,t as b,k as c,h as k,l as R,u as q,q as W,x as y,f as z,d as D,w as G,e as K,G as C,F as E,r as J,E as L}from"./index-CVOJVSsC.js";import{u as Q}from"./sessions-D681M81k.js";import{u as X}from"./commandButtons-DNSHH8IA.js";import{u as Y,P as Z,S as _,B as ss,g as es,f as ts,b as ns}from"./SessionLogStream-B-FwUMJQ.js";import{a as os}from"./ApiClient-Dbs1H78V.js";const as={key:0,class:"session-summary"},is={class:"summary-text"},rs={class:"summary-meta"},ls={key:0,class:"summary-files"},us={key:1,class:"session-summary session-summary-loading"},ds={key:2,class:"session-summary session-summary-error"},cs={__name:"SessionCardSummary",props:{sessionId:{type:String,required:!0},summary:{type:Object,default:null},summaryLoading:{type:Boolean,default:!1},summaryError:{type:Boolean,default:!1}},emits:["retrySummary"],setup(s){const g=s,m=R(0);return H(async()=>{var f,l;try{const u=await os.getSessionFilesCount(g.sessionId);m.value=u.count||0}catch(u){console.warn("Failed to fetch files count:",u),(l=(f=g.summary)==null?void 0:f.filesModified)!=null&&l.length&&(m.value=g.summary.filesModified.length)}}),(f,l)=>s.summary?(t(),o("div",as,[e("p",is,b(s.summary.shortSummary),1),e("div",rs,[m.value>0?(t(),o("span",ls,b(m.value)+" "+b(m.value===1?"file":"files")+" modified ",1)):c("",!0)])])):s.summaryLoading?(t(),o("div",us,[...l[1]||(l[1]=[e("span",{class:"loading-spinner-small"},null,-1),e("span",null,"Loading summary...",-1)])])):s.summaryError?(t(),o("div",ds,[l[2]||(l[2]=e("span",{class:"error-icon"},"!",-1)),l[3]||(l[3]=e("span",null,"Summary unavailable",-1)),e("button",{class:"retry-btn",onClick:l[0]||(l[0]=k(u=>f.$emit("retrySummary"),["prevent"]))}," Retry ")])):c("",!0)}},ms=A(cs,[["__scopeId","data-v-a9b445b6"]]);function hs(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const vs={class:"session-header-actions"},ys={class:"session-date"},fs={key:0,class:"archive-actions"},ws=["title"],gs={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},ks={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},bs={__name:"SessionCardHeaderActions",props:{dateToShow:{type:String,default:null},isChild:{type:Boolean,default:!1},isOnBoard:{type:Boolean,default:!1},kanbanEnabled:{type:Boolean,default:!0},showArchive:{type:Boolean,default:!1},showUnarchive:{type:Boolean,default:!1},sessionStatus:{type:String,default:""},starred:{type:Boolean,default:!1}},emits:["archive","unarchive","star","addToBoard"],setup(s,{emit:g}){const m=s,f=g,l=y(()=>m.sessionStatus!=="running"&&m.sessionStatus!=="starting"),u=()=>{f("archive")},i=()=>{confirm("Restore this session to active?")&&f("unarchive")};return(S,r)=>(t(),o("div",vs,[e("div",ys,b(q(hs)(s.dateToShow)),1),s.isChild?c("",!0):(t(),o("div",fs,[s.kanbanEnabled&&!s.isOnBoard?(t(),o("button",{key:0,class:"add-to-board-btn",title:"Add to kanban board",onClick:r[0]||(r[0]=k(B=>S.$emit("addToBoard"),["stop","prevent"]))},[...r[2]||(r[2]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e("line",{x1:"9",y1:"3",x2:"9",y2:"21"}),e("line",{x1:"15",y1:"3",x2:"15",y2:"21"})],-1)])])):c("",!0),s.showArchive&&l.value?(t(),o("button",{key:1,class:"archive-btn",title:"Archive session",onClick:k(u,["stop","prevent"])},[...r[3]||(r[3]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("rect",{x:"2",y:"4",width:"20",height:"5",rx:"1",ry:"1"}),e("path",{d:"M4 9v9a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9"}),e("path",{d:"M10 13h4"})],-1)])])):c("",!0),s.showUnarchive?(t(),o("button",{key:2,class:"archive-btn",title:"Unarchive session",onClick:k(i,["stop","prevent"])},[...r[4]||(r[4]=[W('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-c4a198a4><rect x="2" y="4" width="20" height="5" rx="1" ry="1" data-v-c4a198a4></rect><path d="M4 9v9a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9" data-v-c4a198a4></path><path d="M12 11v6" data-v-c4a198a4></path><path d="M9 14l3-3 3 3" data-v-c4a198a4></path></svg>',1)])])):c("",!0),e("button",{class:"star-btn star-btn-mobile",title:s.starred?"Unstar session":"Star session",onClick:r[1]||(r[1]=k(B=>S.$emit("star"),["stop","prevent"]))},[s.starred?(t(),o("svg",gs,[...r[5]||(r[5]=[e("polygon",{points:"12 2 15.09 10.26 24 10.5 17.18 16.34 19.34 24.5 12 18.92 4.66 24.5 6.82 16.34 0 10.5 8.91 10.26 12 2"},null,-1)])])):(t(),o("svg",ks,[...r[6]||(r[6]=[e("polygon",{points:"12 2 15.09 10.26 24 10.5 17.18 16.34 19.34 24.5 12 18.92 4.66 24.5 6.82 16.34 0 10.5 8.91 10.26 12 2"},null,-1)])]))],8,ws)]))]))}},Ss=A(bs,[["__scopeId","data-v-c4a198a4"]]),ps={class:"workflow-card-wrapper"},Cs={class:"session-header-row"},Bs=["title"],xs={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},$s={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},As={class:"session-info"},js={class:"session-name"},Is={class:"session-meta"},Ms={key:0,class:"status-badge status-running"},Ts={key:1,class:"status-badge status-scheduled"},Us=["title"],Ds=["title","aria-label","onClick","innerHTML"],Es={key:0,class:"session-project"},Ls={class:"project-name"},Rs={__name:"SessionCard",props:{session:{type:Object,required:!0},showSummary:{type:Boolean,default:!1},showProject:{type:Boolean,default:!1},summary:{type:Object,default:null},summaryLoading:{type:Boolean,default:!1},summaryError:{type:Boolean,default:!1},isChild:{type:Boolean,default:!1},showArchive:{type:Boolean,default:!1},showUnarchive:{type:Boolean,default:!1},prUrl:{type:String,default:null},prSummary:{type:Object,default:null},kanbanEnabled:{type:Boolean,default:!0}},emits:["retrySummary","archive","unarchive","addToBoard"],setup(s,{emit:g}){const m=Q(),f=X(),l=Y(),u=R(null),i=s,S=g,r=y(()=>l.isSessionOnBoard(i.session.id)),B=()=>{S("addToBoard",i.session)},O=y(()=>i.session.lastActivityAt||i.session.updatedAt||i.session.createdAt);function x(){return m.getWorkflowSessions(i.session.id)}const j=y(()=>{const d=x(),n=["running","starting"];let h=0,a=0;for(const w of d)n.includes(w.status)&&h++,w.status==="scheduled"&&a++;return{runningCount:h,scheduledCount:a,totalCount:d.length,effectiveStatus:i.session.status}}),I=y(()=>{const d=["running","starting"];return x().filter(n=>d.includes(n.status)).map(n=>n.id)}),N=y(()=>I.value.length>0),p=y(()=>{const d=Date.now();if(i.session.status==="scheduled"&&i.session.scheduledAt)return i.session.scheduledAt;const n=x();let h=null;for(const a of n)if(a.id!==i.session.id&&a.status==="scheduled"&&a.scheduledAt){const w=new Date(a.scheduledAt).getTime();w>=d&&(h===null||w<h)&&(h=w)}return h}),M=y(()=>p.value?ts(new Date(p.value),{addSuffix:!0}):null),V=y(()=>p.value?ns(new Date(p.value),"MMM d, h:mm a"):null),F=y(()=>{const d=i.session.projectId;if(!d)return[];m.commandRunVersion;const n=f.getButtonsByProjectId(d),h=Object.fromEntries(n.map(v=>[v.id,v])),a=i.session.id,$=m.sessions.find(v=>v.id===a);return(($==null?void 0:$.latestCommandRuns)||i.session.latestCommandRuns||[]).filter(v=>{var U;return(U=h[v.buttonId])==null?void 0:U.showOnList}).map(v=>({buttonId:v.buttonId,label:h[v.buttonId].label,command:h[v.buttonId].command,status:v.status,latestRun:v}))}),P=d=>es(d),T=()=>{m.toggleSessionStar(i.session.id)};return(d,n)=>{const h=z("router-link");return t(),o(E,null,[e("div",ps,[D(h,{to:`/sessions/${s.session.id}`,class:L(["session-card card",{"is-child":s.isChild}])},{default:G(()=>[e("div",Cs,[s.isChild?c("",!0):(t(),o("button",{key:0,class:"star-btn",title:s.session.starred?"Unstar session":"Star session",onClick:k(T,["stop","prevent"])},[s.session.starred?(t(),o("svg",xs,[...n[4]||(n[4]=[e("polygon",{points:"12 2 15.09 10.26 24 10.5 17.18 16.34 19.34 24.5 12 18.92 4.66 24.5 6.82 16.34 0 10.5 8.91 10.26 12 2"},null,-1)])])):(t(),o("svg",$s,[...n[5]||(n[5]=[e("polygon",{points:"12 2 15.09 10.26 24 10.5 17.18 16.34 19.34 24.5 12 18.92 4.66 24.5 6.82 16.34 0 10.5 8.91 10.26 12 2"},null,-1)])]))],8,Bs)),e("div",As,[e("h3",js,b(s.session.name),1),e("p",Is,[j.value.runningCount>0?(t(),o("span",Ms," ● running ")):c("",!0),j.value.scheduledCount>0?(t(),o("span",Ts,[...n[6]||(n[6]=[e("svg",{class:"schedule-icon-inline",xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("polyline",{points:"12 6 12 12 16 14"})],-1),K(" scheduled ",-1)])])):c("",!0),M.value?(t(),o("span",{key:2,class:"scheduled-time",title:V.value},b(M.value),9,Us)):c("",!0),s.prUrl&&!s.isChild?(t(),C(Z,{key:3,"pr-url":s.prUrl,summary:s.prSummary,"data-testid":"session-card-pr-indicators"},null,8,["pr-url","summary"])):c("",!0),(t(!0),o(E,null,J(F.value,a=>(t(),o("span",{key:a.buttonId,class:L(["button-status-indicator",`button-status-${a.status}`]),title:a.label,"aria-label":a.status,onClick:k(w=>u.value=a,["stop","prevent"]),innerHTML:P(a.status)},null,10,Ds))),128))]),s.showProject&&s.session.projectName?(t(),o("p",Es,[e("span",Ls,b(s.session.projectName),1)])):c("",!0)]),D(Ss,{"date-to-show":O.value,"is-child":s.isChild,"is-on-board":r.value,"kanban-enabled":s.kanbanEnabled,"show-archive":s.showArchive,"show-unarchive":s.showUnarchive,"session-status":s.session.status,starred:!!s.session.starred,onArchive:n[0]||(n[0]=a=>d.$emit("archive",s.session.id)),onUnarchive:n[1]||(n[1]=a=>d.$emit("unarchive",s.session.id)),onStar:T,onAddToBoard:B},null,8,["date-to-show","is-child","is-on-board","kanban-enabled","show-archive","show-unarchive","session-status","starred"])]),s.showSummary?(t(),C(ms,{key:0,"session-id":s.session.id,summary:s.summary,"summary-loading":s.summaryLoading,"summary-error":s.summaryError,onRetrySummary:n[2]||(n[2]=a=>d.$emit("retrySummary",s.session.id))},null,8,["session-id","summary","summary-loading","summary-error"])):c("",!0),N.value?(t(),C(_,{key:1,"session-ids":I.value,"data-testid":"session-log-stream"},null,8,["session-ids"])):c("",!0)]),_:1},8,["to","class"])]),u.value?(t(),C(ss,{key:0,button:{id:u.value.buttonId,label:u.value.label,command:u.value.command},"latest-run":u.value.latestRun,"is-open":!!u.value,"session-id":s.session.id,onClose:n[3]||(n[3]=a=>u.value=null)},null,8,["button","latest-run","is-open","session-id"])):c("",!0)],64)}}},qs=A(Rs,[["__scopeId","data-v-b5ba654a"]]);export{qs as S};
1
+ import{_ as A,o as H,a as t,c as o,b as e,t as b,k as c,h as k,l as R,u as q,q as W,x as y,f as z,d as D,w as G,e as K,G as C,F as E,r as J,E as L}from"./index-LoOsRfMI.js";import{u as Q}from"./sessions-i5xO8Qao.js";import{u as X}from"./commandButtons-CCojrcrv.js";import{u as Y,P as Z,S as _,B as ss,g as es,f as ts,b as ns}from"./SessionLogStream-BFjl4wy7.js";import{a as os}from"./ApiClient-Dbs1H78V.js";const as={key:0,class:"session-summary"},is={class:"summary-text"},rs={class:"summary-meta"},ls={key:0,class:"summary-files"},us={key:1,class:"session-summary session-summary-loading"},ds={key:2,class:"session-summary session-summary-error"},cs={__name:"SessionCardSummary",props:{sessionId:{type:String,required:!0},summary:{type:Object,default:null},summaryLoading:{type:Boolean,default:!1},summaryError:{type:Boolean,default:!1}},emits:["retrySummary"],setup(s){const g=s,m=R(0);return H(async()=>{var f,l;try{const u=await os.getSessionFilesCount(g.sessionId);m.value=u.count||0}catch(u){console.warn("Failed to fetch files count:",u),(l=(f=g.summary)==null?void 0:f.filesModified)!=null&&l.length&&(m.value=g.summary.filesModified.length)}}),(f,l)=>s.summary?(t(),o("div",as,[e("p",is,b(s.summary.shortSummary),1),e("div",rs,[m.value>0?(t(),o("span",ls,b(m.value)+" "+b(m.value===1?"file":"files")+" modified ",1)):c("",!0)])])):s.summaryLoading?(t(),o("div",us,[...l[1]||(l[1]=[e("span",{class:"loading-spinner-small"},null,-1),e("span",null,"Loading summary...",-1)])])):s.summaryError?(t(),o("div",ds,[l[2]||(l[2]=e("span",{class:"error-icon"},"!",-1)),l[3]||(l[3]=e("span",null,"Summary unavailable",-1)),e("button",{class:"retry-btn",onClick:l[0]||(l[0]=k(u=>f.$emit("retrySummary"),["prevent"]))}," Retry ")])):c("",!0)}},ms=A(cs,[["__scopeId","data-v-a9b445b6"]]);function hs(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const vs={class:"session-header-actions"},ys={class:"session-date"},fs={key:0,class:"archive-actions"},ws=["title"],gs={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},ks={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},bs={__name:"SessionCardHeaderActions",props:{dateToShow:{type:String,default:null},isChild:{type:Boolean,default:!1},isOnBoard:{type:Boolean,default:!1},kanbanEnabled:{type:Boolean,default:!0},showArchive:{type:Boolean,default:!1},showUnarchive:{type:Boolean,default:!1},sessionStatus:{type:String,default:""},starred:{type:Boolean,default:!1}},emits:["archive","unarchive","star","addToBoard"],setup(s,{emit:g}){const m=s,f=g,l=y(()=>m.sessionStatus!=="running"&&m.sessionStatus!=="starting"),u=()=>{f("archive")},i=()=>{confirm("Restore this session to active?")&&f("unarchive")};return(S,r)=>(t(),o("div",vs,[e("div",ys,b(q(hs)(s.dateToShow)),1),s.isChild?c("",!0):(t(),o("div",fs,[s.kanbanEnabled&&!s.isOnBoard?(t(),o("button",{key:0,class:"add-to-board-btn",title:"Add to kanban board",onClick:r[0]||(r[0]=k(B=>S.$emit("addToBoard"),["stop","prevent"]))},[...r[2]||(r[2]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e("line",{x1:"9",y1:"3",x2:"9",y2:"21"}),e("line",{x1:"15",y1:"3",x2:"15",y2:"21"})],-1)])])):c("",!0),s.showArchive&&l.value?(t(),o("button",{key:1,class:"archive-btn",title:"Archive session",onClick:k(u,["stop","prevent"])},[...r[3]||(r[3]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("rect",{x:"2",y:"4",width:"20",height:"5",rx:"1",ry:"1"}),e("path",{d:"M4 9v9a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9"}),e("path",{d:"M10 13h4"})],-1)])])):c("",!0),s.showUnarchive?(t(),o("button",{key:2,class:"archive-btn",title:"Unarchive session",onClick:k(i,["stop","prevent"])},[...r[4]||(r[4]=[W('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-c4a198a4><rect x="2" y="4" width="20" height="5" rx="1" ry="1" data-v-c4a198a4></rect><path d="M4 9v9a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9" data-v-c4a198a4></path><path d="M12 11v6" data-v-c4a198a4></path><path d="M9 14l3-3 3 3" data-v-c4a198a4></path></svg>',1)])])):c("",!0),e("button",{class:"star-btn star-btn-mobile",title:s.starred?"Unstar session":"Star session",onClick:r[1]||(r[1]=k(B=>S.$emit("star"),["stop","prevent"]))},[s.starred?(t(),o("svg",gs,[...r[5]||(r[5]=[e("polygon",{points:"12 2 15.09 10.26 24 10.5 17.18 16.34 19.34 24.5 12 18.92 4.66 24.5 6.82 16.34 0 10.5 8.91 10.26 12 2"},null,-1)])])):(t(),o("svg",ks,[...r[6]||(r[6]=[e("polygon",{points:"12 2 15.09 10.26 24 10.5 17.18 16.34 19.34 24.5 12 18.92 4.66 24.5 6.82 16.34 0 10.5 8.91 10.26 12 2"},null,-1)])]))],8,ws)]))]))}},Ss=A(bs,[["__scopeId","data-v-c4a198a4"]]),ps={class:"workflow-card-wrapper"},Cs={class:"session-header-row"},Bs=["title"],xs={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},$s={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},As={class:"session-info"},js={class:"session-name"},Is={class:"session-meta"},Ms={key:0,class:"status-badge status-running"},Ts={key:1,class:"status-badge status-scheduled"},Us=["title"],Ds=["title","aria-label","onClick","innerHTML"],Es={key:0,class:"session-project"},Ls={class:"project-name"},Rs={__name:"SessionCard",props:{session:{type:Object,required:!0},showSummary:{type:Boolean,default:!1},showProject:{type:Boolean,default:!1},summary:{type:Object,default:null},summaryLoading:{type:Boolean,default:!1},summaryError:{type:Boolean,default:!1},isChild:{type:Boolean,default:!1},showArchive:{type:Boolean,default:!1},showUnarchive:{type:Boolean,default:!1},prUrl:{type:String,default:null},prSummary:{type:Object,default:null},kanbanEnabled:{type:Boolean,default:!0}},emits:["retrySummary","archive","unarchive","addToBoard"],setup(s,{emit:g}){const m=Q(),f=X(),l=Y(),u=R(null),i=s,S=g,r=y(()=>l.isSessionOnBoard(i.session.id)),B=()=>{S("addToBoard",i.session)},O=y(()=>i.session.lastActivityAt||i.session.updatedAt||i.session.createdAt);function x(){return m.getWorkflowSessions(i.session.id)}const j=y(()=>{const d=x(),n=["running","starting"];let h=0,a=0;for(const w of d)n.includes(w.status)&&h++,w.status==="scheduled"&&a++;return{runningCount:h,scheduledCount:a,totalCount:d.length,effectiveStatus:i.session.status}}),I=y(()=>{const d=["running","starting"];return x().filter(n=>d.includes(n.status)).map(n=>n.id)}),N=y(()=>I.value.length>0),p=y(()=>{const d=Date.now();if(i.session.status==="scheduled"&&i.session.scheduledAt)return i.session.scheduledAt;const n=x();let h=null;for(const a of n)if(a.id!==i.session.id&&a.status==="scheduled"&&a.scheduledAt){const w=new Date(a.scheduledAt).getTime();w>=d&&(h===null||w<h)&&(h=w)}return h}),M=y(()=>p.value?ts(new Date(p.value),{addSuffix:!0}):null),V=y(()=>p.value?ns(new Date(p.value),"MMM d, h:mm a"):null),F=y(()=>{const d=i.session.projectId;if(!d)return[];m.commandRunVersion;const n=f.getButtonsByProjectId(d),h=Object.fromEntries(n.map(v=>[v.id,v])),a=i.session.id,$=m.sessions.find(v=>v.id===a);return(($==null?void 0:$.latestCommandRuns)||i.session.latestCommandRuns||[]).filter(v=>{var U;return(U=h[v.buttonId])==null?void 0:U.showOnList}).map(v=>({buttonId:v.buttonId,label:h[v.buttonId].label,command:h[v.buttonId].command,status:v.status,latestRun:v}))}),P=d=>es(d),T=()=>{m.toggleSessionStar(i.session.id)};return(d,n)=>{const h=z("router-link");return t(),o(E,null,[e("div",ps,[D(h,{to:`/sessions/${s.session.id}`,class:L(["session-card card",{"is-child":s.isChild}])},{default:G(()=>[e("div",Cs,[s.isChild?c("",!0):(t(),o("button",{key:0,class:"star-btn",title:s.session.starred?"Unstar session":"Star session",onClick:k(T,["stop","prevent"])},[s.session.starred?(t(),o("svg",xs,[...n[4]||(n[4]=[e("polygon",{points:"12 2 15.09 10.26 24 10.5 17.18 16.34 19.34 24.5 12 18.92 4.66 24.5 6.82 16.34 0 10.5 8.91 10.26 12 2"},null,-1)])])):(t(),o("svg",$s,[...n[5]||(n[5]=[e("polygon",{points:"12 2 15.09 10.26 24 10.5 17.18 16.34 19.34 24.5 12 18.92 4.66 24.5 6.82 16.34 0 10.5 8.91 10.26 12 2"},null,-1)])]))],8,Bs)),e("div",As,[e("h3",js,b(s.session.name),1),e("p",Is,[j.value.runningCount>0?(t(),o("span",Ms," ● running ")):c("",!0),j.value.scheduledCount>0?(t(),o("span",Ts,[...n[6]||(n[6]=[e("svg",{class:"schedule-icon-inline",xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("polyline",{points:"12 6 12 12 16 14"})],-1),K(" scheduled ",-1)])])):c("",!0),M.value?(t(),o("span",{key:2,class:"scheduled-time",title:V.value},b(M.value),9,Us)):c("",!0),s.prUrl&&!s.isChild?(t(),C(Z,{key:3,"pr-url":s.prUrl,summary:s.prSummary,"data-testid":"session-card-pr-indicators"},null,8,["pr-url","summary"])):c("",!0),(t(!0),o(E,null,J(F.value,a=>(t(),o("span",{key:a.buttonId,class:L(["button-status-indicator",`button-status-${a.status}`]),title:a.label,"aria-label":a.status,onClick:k(w=>u.value=a,["stop","prevent"]),innerHTML:P(a.status)},null,10,Ds))),128))]),s.showProject&&s.session.projectName?(t(),o("p",Es,[e("span",Ls,b(s.session.projectName),1)])):c("",!0)]),D(Ss,{"date-to-show":O.value,"is-child":s.isChild,"is-on-board":r.value,"kanban-enabled":s.kanbanEnabled,"show-archive":s.showArchive,"show-unarchive":s.showUnarchive,"session-status":s.session.status,starred:!!s.session.starred,onArchive:n[0]||(n[0]=a=>d.$emit("archive",s.session.id)),onUnarchive:n[1]||(n[1]=a=>d.$emit("unarchive",s.session.id)),onStar:T,onAddToBoard:B},null,8,["date-to-show","is-child","is-on-board","kanban-enabled","show-archive","show-unarchive","session-status","starred"])]),s.showSummary?(t(),C(ms,{key:0,"session-id":s.session.id,summary:s.summary,"summary-loading":s.summaryLoading,"summary-error":s.summaryError,onRetrySummary:n[2]||(n[2]=a=>d.$emit("retrySummary",s.session.id))},null,8,["session-id","summary","summary-loading","summary-error"])):c("",!0),N.value?(t(),C(_,{key:1,"session-ids":I.value,"data-testid":"session-log-stream"},null,8,["session-ids"])):c("",!0)]),_:1},8,["to","class"])]),u.value?(t(),C(ss,{key:0,button:{id:u.value.buttonId,label:u.value.label,command:u.value.command},"latest-run":u.value.latestRun,"is-open":!!u.value,"session-id":s.session.id,onClose:n[3]||(n[3]=a=>u.value=null)},null,8,["button","latest-run","is-open","session-id"])):c("",!0)],64)}}},qs=A(Rs,[["__scopeId","data-v-b5ba654a"]]);export{qs as S};