openpond 0.0.32 → 0.0.34

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 (92) hide show
  1. package/dist/chunks/{app-layer-CUQQUVJS.js → app-layer-UQQNF5VZ.js} +3 -3
  2. package/dist/chunks/{apps-TAYMUCWX.js → apps-7NSC56K5.js} +3 -3
  3. package/dist/chunks/{chunk-W2DJR3FA.js → chunk-2GCNPJMD.js} +1 -1
  4. package/dist/chunks/{chunk-GYZYZGKS.js → chunk-5MM3P5KY.js} +2 -2
  5. package/dist/chunks/{chunk-E5RVRUJB.js → chunk-B5CFIWWU.js} +1 -1
  6. package/dist/chunks/{chunk-FQW3AQVJ.js → chunk-BZPAW4JY.js} +31 -0
  7. package/dist/chunks/{chunk-5RHZKQRK.js → chunk-E3RLJ5XT.js} +2 -2
  8. package/dist/chunks/{chunk-3UOLQG6N.js → chunk-EBCLEJRO.js} +1 -1
  9. package/dist/chunks/{chunk-D264OHTR.js → chunk-F6FFL3AA.js} +2 -2
  10. package/dist/chunks/{chunk-PJXJ2HRT.js → chunk-G7XOSECC.js} +33 -0
  11. package/dist/chunks/{chunk-EONKWOLU.js → chunk-HGZ3O4TS.js} +2 -2
  12. package/dist/chunks/{chunk-DCNAXREU.js → chunk-JVTACGKD.js} +3 -3
  13. package/dist/chunks/{chunk-Y4F4XD5V.js → chunk-MMDKFTJB.js} +1 -1
  14. package/dist/chunks/{chunk-4HQURM3N.js → chunk-TF234YN4.js} +1 -1
  15. package/dist/chunks/{chunk-3ZJIEA5F.js → chunk-U4TUOBXO.js} +1 -1
  16. package/dist/chunks/{chunk-4M4WAORL.js → chunk-UASXM3RR.js} +4 -4
  17. package/dist/chunks/{chunk-OXQG773T.js → chunk-V7SHAMUN.js} +33 -33
  18. package/dist/chunks/{chunk-Q5MZCRJA.js → chunk-ZDEBKTWR.js} +1 -1
  19. package/dist/chunks/{chunk-XADW35CL.js → chunk-ZRNFOHFH.js} +3 -3
  20. package/dist/chunks/{cli-WW5BVN5Z.js → cli-4ETE5RS2.js} +4 -4
  21. package/dist/chunks/{cli-ZOCP7X5M.js → cli-VEDK2B42.js} +6 -6
  22. package/dist/chunks/{core-commands-SYGK7K57.js → core-commands-J3IQGQOL.js} +4 -4
  23. package/dist/chunks/{extend-Q5HZ7TMA.js → extend-3F3LLDOF.js} +9 -9
  24. package/dist/chunks/{harness-ZPBPQVAS.js → harness-JER7P6MJ.js} +3 -3
  25. package/dist/chunks/{help-3V3TRQNX.js → help-75NFCYJ4.js} +1 -1
  26. package/dist/chunks/{opchat-OUPMEFE5.js → opchat-UT5V7MR2.js} +5 -5
  27. package/dist/chunks/{organizations-5CSLBDAW.js → organizations-ERKRLVNQ.js} +4 -4
  28. package/dist/chunks/{profile-OQYSXHOG.js → profile-A3CUSDIF.js} +7 -7
  29. package/dist/chunks/{project-agent-TBTWOUJF.js → project-agent-FCV5HPYT.js} +6 -6
  30. package/dist/chunks/{sandbox-command-HCHPY7KW.js → sandbox-command-L2QPIWZ5.js} +4 -4
  31. package/dist/chunks/{sandbox-template-PNTOZ6W3.js → sandbox-template-XOIWROEK.js} +5 -5
  32. package/dist/chunks/{src-C6MXLDYQ.js → src-ENVQ7ARM.js} +2 -2
  33. package/dist/chunks/{src-GZT4UX6I.js → src-V4FUQNHR.js} +676 -462
  34. package/dist/chunks/{teams-bot-CQ76XI6T.js → teams-bot-OR3ZJHQ5.js} +3 -3
  35. package/dist/chunks/{workspaces-DHVVOTVR.js → workspaces-L73SRLPA.js} +2 -2
  36. package/dist/cli.js +10 -10
  37. package/dist/web/assets/{AppsView-CF2g-7FH.js → AppsView-CLjjVkjr.js} +1 -1
  38. package/dist/web/assets/{BrowserSidebar-lUsLUl20.js → BrowserSidebar-CkNO8723.js} +1 -1
  39. package/dist/web/assets/{CloudWorkView-BnfGW4OV.js → CloudWorkView-Cu_VqkaD.js} +1 -1
  40. package/dist/web/assets/{CommandMenu-BsS4Bgb6.js → CommandMenu-DWtdkvmq.js} +1 -1
  41. package/dist/web/assets/{CommunityView-C8qVOwlp.js → CommunityView-f03qOTER.js} +1 -1
  42. package/dist/web/assets/{ComposerCreateImproveStrip-C_LIpfSq.js → ComposerCreateImproveStrip-CZpiQJsJ.js} +1 -1
  43. package/dist/web/assets/{GetStartedView-Du533wOh.js → GetStartedView-CLMmryTG.js} +1 -1
  44. package/dist/web/assets/LabsRoute-BwR2g71k.js +4 -0
  45. package/dist/web/assets/{NewProjectDialog-DH7wA1z9.js → NewProjectDialog-PrbA4fL6.js} +1 -1
  46. package/dist/web/assets/{ProfileSettingsSection-D7JvMZdW.js → ProfileSettingsSection-CD_x_V8d.js} +1 -1
  47. package/dist/web/assets/SettingsView-BMmlKvlB.js +63 -0
  48. package/dist/web/assets/SettingsView-CAPf81v3.css +1 -0
  49. package/dist/web/assets/{TeamChatView-D_CE7br9.js → TeamChatView-B5SlhDso.js} +2 -2
  50. package/dist/web/assets/{TerminalOverlay-CC-VDSlp.js → TerminalOverlay-DaGfEprz.js} +1 -1
  51. package/dist/web/assets/TrainingComputeDialog-BFY6E0yU.js +1 -0
  52. package/dist/web/assets/{TrainingCreationPanel-NFCoaBUI.js → TrainingCreationPanel-Cp66gMed.js} +1 -1
  53. package/dist/web/assets/{TrainingDraftPanel-BWEmVFjM.js → TrainingDraftPanel-BX5CCqlO.js} +1 -1
  54. package/dist/web/assets/{WorkspaceDiffPanel-SlLlGZM1.js → WorkspaceDiffPanel-D7ZEbryF.js} +3 -3
  55. package/dist/web/assets/{WorkspaceEnvironmentMenu-BAoMBTVD.js → WorkspaceEnvironmentMenu-D4DmAJaS.js} +1 -1
  56. package/dist/web/assets/{WorkspaceGitDialogs-CVIFrzyl.js → WorkspaceGitDialogs-DHOfJxbL.js} +1 -1
  57. package/dist/web/assets/{WorkspaceMonacoEditor-0trp0-TI.js → WorkspaceMonacoEditor-C0fDue2d.js} +3 -3
  58. package/dist/web/assets/{boxes-CFihgX2z.js → boxes-CXLqRF98.js} +1 -1
  59. package/dist/web/assets/{create-pipeline-request-AJWLMTyw.js → create-pipeline-request-C26NOc7v.js} +1 -1
  60. package/dist/web/assets/{cssMode-HvqfCFyP.js → cssMode-DmtwKUVm.js} +1 -1
  61. package/dist/web/assets/{git-commit-horizontal-C5mUmACv.js → git-commit-horizontal-CDDZl4iA.js} +1 -1
  62. package/dist/web/assets/{htmlMode-C8btgUt-.js → htmlMode-Box0EOm1.js} +1 -1
  63. package/dist/web/assets/index-BUyeKpY6.js +1 -0
  64. package/dist/web/assets/{index-D7Vr3zcV.js → index-CKmte5ok.js} +55 -55
  65. package/dist/web/assets/{info-D0xuy5IB.js → info-4Iy6BKvT.js} +1 -1
  66. package/dist/web/assets/{jsonMode-5zVz9G0X.js → jsonMode-g7t_3HFv.js} +1 -1
  67. package/dist/web/assets/{lspLanguageFeatures-DxlSSL7c.js → lspLanguageFeatures-CwhFOYc9.js} +1 -1
  68. package/dist/web/assets/{monaco.contribution-BKpVvKK9.js → monaco.contribution-B-QC_ls9.js} +2 -2
  69. package/dist/web/assets/{monaco.contribution-B1pWWwqT.js → monaco.contribution-CW2ctrTm.js} +2 -2
  70. package/dist/web/assets/{monaco.contribution-BXdXsSWI.js → monaco.contribution-CwMt3eHi.js} +2 -2
  71. package/dist/web/assets/{monaco.contribution-CIjjzpUR.js → monaco.contribution-DGZAePHI.js} +2 -2
  72. package/dist/web/assets/{monitor-B4-9Shtp.js → monitor-DOVjBLkr.js} +1 -1
  73. package/dist/web/assets/{play-BJdhBqQE.js → play-DLCuESeG.js} +1 -1
  74. package/dist/web/assets/{python-CEK8J4w_.js → python-DRNmHcYd.js} +1 -1
  75. package/dist/web/assets/{refresh-cw-DE0u_nmZ.js → refresh-cw-JNUovwk4.js} +1 -1
  76. package/dist/web/assets/{reply-2MfLJ93n.js → reply-D4QvJyzE.js} +1 -1
  77. package/dist/web/assets/{save-CBIVKaf8.js → save-BR4O4UDP.js} +1 -1
  78. package/dist/web/assets/{toggleHighContrast-CC73mtvA.js → toggleHighContrast-CrfdWIsV.js} +1 -1
  79. package/dist/web/assets/training-DeVTd0m8.css +1 -0
  80. package/dist/web/assets/{tsMode-Bhn9wr_1.js → tsMode-ZuV9go1B.js} +1 -1
  81. package/dist/web/assets/useComputeSettings-DUNS6uOl.js +1 -0
  82. package/dist/web/assets/useComputeSettings-R2Sw621I.css +1 -0
  83. package/dist/web/assets/{wifi-off-BKTqnqj0.js → wifi-off-XFVqsf4c.js} +1 -1
  84. package/dist/web/assets/{workers-C_adgrEg.js → workers-CJpO1Wzj.js} +1 -1
  85. package/dist/web/assets/{yaml-DDRAcADU.js → yaml-AQ4ok5ED.js} +1 -1
  86. package/dist/web/index.html +1 -1
  87. package/package.json +1 -1
  88. package/dist/web/assets/LabsRoute-yk8lNMQc.js +0 -3
  89. package/dist/web/assets/SettingsView-C9TgCaWG.js +0 -63
  90. package/dist/web/assets/SettingsView-DwbGu8Kj.css +0 -1
  91. package/dist/web/assets/index-DUqAiF57.js +0 -1
  92. package/dist/web/assets/training-BY8siNUK.css +0 -1
@@ -1 +1 @@
1
- import{d as G,r as x,m,j as e,V as H,w as T,h as z,ai as C,ao as D,X as $,ay as U}from"./index-D7Vr3zcV.js";import{G as P}from"./git-commit-horizontal-C5mUmACv.js";import{P as q}from"./play-BJdhBqQE.js";import{R as B}from"./refresh-cw-DE0u_nmZ.js";/* empty css */const _=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],W=G("rotate-ccw",_),V=5e3;function Q(s){const[a,t]=x.useState([]),[l,n]=x.useState(!1),[o,c]=x.useState(null),[d,p]=x.useState(()=>new Set);x.useEffect(()=>{if(!s){t([]),c(null),n(!1);return}let i=!1,r=null;async function f(b){if(!(!s||i)){b&&n(!0);try{const y=await m.localAgentSchedules(s);if(i)return;t(y.schedules),c(null)}catch(y){i||c(S(y))}finally{!i&&b&&n(!1)}}}return f(!0),r=window.setInterval(()=>{f(!1)},V),()=>{i=!0,r!==null&&window.clearInterval(r)}},[s]);async function j(){if(s){n(!0);try{const i=await m.syncLocalAgentSchedules(s);t(i.schedules),c(null)}catch(i){c(S(i))}finally{n(!1)}}}async function g(i){if(!(!s||d.has(i.id))){h(i.id,!0);try{await m.runLocalAgentSchedule(s,i.id);const r=await m.localAgentSchedules(s);t(r.schedules),c(null)}catch(r){c(S(r))}finally{h(i.id,!1)}}}async function u(i){if(!(!s||d.has(i.id))){h(i.id,!0);try{await m.patchLocalAgentSchedule(s,i.id,{enabled:!i.enabled});const r=await m.localAgentSchedules(s);t(r.schedules),c(null)}catch(r){c(S(r))}finally{h(i.id,!1)}}}function h(i,r){p(f=>{const b=new Set(f);return r?b.add(i):b.delete(i),b})}return{error:o,loading:l,pendingScheduleIds:d,refresh:j,run:g,schedules:a,toggle:u}}function S(s){return s instanceof Error?s.message:String(s)}function X({connection:s,profile:a,selectedDefaultTeamId:t}){const l=Q(s);return e.jsxs("div",{className:"account-list profile-agent-list","aria-label":"Profile agents",children:[e.jsxs("div",{className:"account-list-heading profile-agent-list-heading",children:[e.jsx("span",{children:"Agents"}),e.jsx("div",{className:"profile-skill-heading-actions",children:e.jsx("small",{children:Y(l.schedules.length,l.loading)})})]}),a.agents.length||l.schedules.length?e.jsx("div",{className:"profile-agent-table-frame",children:e.jsxs("table",{className:"profile-agent-table","aria-label":"Profile agents table",children:[e.jsxs("colgroup",{children:[e.jsx("col",{className:"profile-agent-column"}),e.jsx("col",{className:"profile-action-column"}),e.jsx("col",{className:"profile-check-column"}),e.jsx("col",{className:"profile-sync-column"})]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"Agent"}),e.jsx("th",{scope:"col",children:"Action"}),e.jsx("th",{scope:"col",children:"Check"}),e.jsx("th",{scope:"col",children:"Sync"})]})}),e.jsxs("tbody",{children:[a.agents.map(n=>e.jsx(J,{agent:n,defaultAction:a.summary.defaultAction,profile:a,selectedDefaultTeamId:t},n.id)),l.schedules.map(n=>e.jsx(K,{pending:l.pendingScheduleIds.has(n.id),schedule:n,refreshing:l.loading,onRefresh:()=>{l.refresh()},onRun:()=>{l.run(n)},onToggle:()=>{l.toggle(n)}},n.id))]})]})}):e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"No profile agents found"}),e.jsx("span",{children:"Create an agent, then run Profile checks to add it to the catalog."})]}),l.error?e.jsxs("div",{className:"profile-footline warning profile-agent-list-note",children:["Local schedules: ",l.error]}):null]})}function J({agent:s,defaultAction:a,profile:t,selectedDefaultTeamId:l}){const n=se(t,s,l);return e.jsxs("tr",{className:"profile-agent-row",children:[e.jsx("td",{children:e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(H,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:s.name}),e.jsx("span",{title:s.path,children:s.path})]})]})}),e.jsx("td",{children:e.jsx("div",{className:"profile-agent-action",children:e.jsx("span",{children:a??"None"})})}),e.jsx("td",{children:e.jsx(A,{status:n.check})}),e.jsx("td",{children:e.jsx(A,{status:n.sync})})]})}function K({pending:s,refreshing:a,schedule:t,onRefresh:l,onRun:n,onToggle:o}){const c=Z(t),d=t.enabled?"Pause schedule":"Resume schedule";return e.jsxs("tr",{className:"profile-agent-row profile-schedule-agent-row",children:[e.jsx("td",{children:e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(H,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:t.localProjectName}),e.jsxs("span",{title:t.scheduleName,children:["schedule: ",t.scheduleName]})]})]})}),e.jsx("td",{children:e.jsx("div",{className:"profile-agent-action",children:e.jsx("span",{title:t.targetAction,children:t.targetAction})})}),e.jsx("td",{children:e.jsx(A,{status:c})}),e.jsx("td",{children:e.jsxs("div",{className:"profile-schedule-actions",children:[e.jsx("span",{className:"profile-schedule-expression",title:ee(t),children:t.enabled?t.scheduleExpression:"Paused"}),e.jsxs("div",{className:"profile-schedule-controls","aria-label":`${t.scheduleName} schedule controls`,children:[e.jsx("button",{className:"settings-icon-button profile-schedule-button",disabled:a,type:"button",title:"Refresh local schedules","aria-label":"Refresh local schedules",onClick:l,children:e.jsx(B,{size:14,className:a?"settings-spin":void 0})}),e.jsx("button",{className:"settings-icon-button profile-schedule-button",disabled:s,type:"button",title:"Run now","aria-label":`Run ${t.scheduleName} now`,onClick:n,children:e.jsx(W,{size:14})}),e.jsx("button",{className:"settings-icon-button profile-schedule-button",disabled:s,type:"button",title:d,"aria-label":`${d}: ${t.scheduleName}`,onClick:o,children:t.enabled?e.jsx(T,{size:14}):e.jsx(q,{size:14})})]})]})})]})}function A({status:s}){return e.jsx("span",{className:`profile-status-text ${s.state}`,children:s.label})}function Y(s,a){return a&&s===0?"Loading schedules":a?`${s} scheduled, refreshing`:s===1?"1 scheduled":s>1?`${s} scheduled`:"No schedules"}function Z(s){return s.enabled?s.lastError||s.lastRunStatus==="failed"?{state:"warning",label:"Failed"}:s.lastRunStatus==="running"?{state:"loading",label:"Running"}:s.lastRunStatus==="queued"?{state:"loading",label:"Queued"}:s.lastRunStatus==="skipped"?{state:"warning",label:"Skipped"}:s.lastRunStatus==="succeeded"?{state:"ready",label:"Succeeded"}:{state:"loading",label:"Scheduled"}:{state:"disabled",label:"Paused"}}function ee(s){const a=[`${s.scheduleType}: ${s.scheduleExpression}`];return s.nextRunAt&&a.push(`next ${R(s.nextRunAt)}`),s.lastRunAt&&a.push(`last ${R(s.lastRunAt)}`),a.join(" - ")}function R(s){const a=new Date(s);return Number.isFinite(a.getTime())?a.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):s}function se(s,a,t){if(!a.enabled)return{check:{state:"disabled",label:"Disabled"},sync:{state:"disabled",label:"Disabled"}};if(s.error)return{check:{state:"warning",label:"Error"},sync:{state:"warning",label:"Blocked"}};if(s.setupGate.blockingCount>0)return{check:{state:"warning",label:"Setup"},sync:{state:"warning",label:"Blocked"}};if(s.git?.dirty||ae(s,a)>0)return{check:{state:"loading",label:"Pending"},sync:{state:"warning",label:"Changed"}};if(s.catalog.stale)return{check:{state:"loading",label:"Stale"},sync:{state:"loading",label:"Waiting"}};if(!s.lastCheck)return{check:{state:"loading",label:"Unchecked"},sync:{state:"loading",label:"Waiting"}};if(s.lastCheck.status==="failed")return{check:{state:"warning",label:"Failed"},sync:{state:"warning",label:"Blocked"}};if(!s.summary.checkFresh)return{check:{state:"loading",label:"Stale"},sync:{state:"loading",label:"Waiting"}};if(te(s,t))return{check:{state:"ready",label:"Passed"},sync:{state:"warning",label:"Sync acct"}};const l=s.summary.localHead??s.git?.head??null,n=s.hosted?.lastPushedLocalHead??null;return!(s.summary.hostedHead??s.hosted?.sourceCommitSha??null)&&!n?{check:{state:"ready",label:"Passed"},sync:{state:"loading",label:"Not synced"}}:l&&n&&l!==n?{check:{state:"ready",label:"Passed"},sync:{state:"loading",label:"Needed"}}:{check:{state:"ready",label:"Passed"},sync:{state:"ready",label:"Synced"}}}function te(s,a){const t=s.hosted?.teamId?.trim()??"";return!!(t&&a&&t!==a)}function ae(s,a){let t=0;s.diff.changedAgents.includes(a.id)&&(t+=1),s.diff.newAgents.includes(a.id)&&(t+=1),s.diff.deletedAgents.includes(a.id)&&(t+=1);const l=a.path.replace(/^profiles\/[^/]+\//,"");for(const n of s.diff.files){const o=n.path.replace(/^profiles\/[^/]+\//,"");(o===l||o.startsWith(`${l}/`)||o.startsWith(`agents/${a.id}/`))&&(t+=1)}return t}function be({section:s="all",payload:a,connection:t,onPayload:l,onError:n,onToast:o,onSkillCommand:c,overviewContent:d}){const[p,j]=x.useState(""),[g,u]=x.useState(null),h=a?.profile??null,i=a?.preferences.defaultTeamId?.trim()||"",r=s==="all"||s==="profile"||s==="controls",f=s==="all"||s==="agents",b=s==="all"||s==="profile";async function y(w){t&&(l(await m.bootstrap(t)),o?.(w,"success"))}async function v(w,O){if(!(!t||g)){u(w),n(null);try{await O()}catch(k){n(k instanceof Error?k.message:String(k))}finally{u(null)}}}function M(){v("init",async()=>{await m.profileInit(t,{}),await y("Profile initialized")})}function F(){v("commit",async()=>{await m.profileCommit(t,{message:p.trim()||null}),j(""),await y("Profile commit complete")})}function I(){v("push",async()=>{if(!i)throw new Error("Select a default team before syncing a hosted profile.");await m.profileCheck(t,{kind:"all"}),await m.profilePush(t,{teamId:i,ensureHosted:!0,message:null}),await y("Profile synced to hosted profile repo")})}return e.jsx("section",{className:"account-settings",children:h?.mode==="local"?e.jsxs(e.Fragment,{children:[r?e.jsxs(e.Fragment,{children:[e.jsx(ne,{connection:t,profile:h,profileBusy:g,profileCommitMessage:p,selectedDefaultTeamId:i,syncDisabledReason:ue(h,i),setProfileCommitMessage:j,submitProfileCommit:F,submitProfilePush:I}),d]}):null,f?e.jsx(X,{connection:t,profile:h,selectedDefaultTeamId:i}):null,b?e.jsx(ce,{onSkillCommand:c,profile:h}):null]}):s==="agents"?e.jsxs("div",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Agents"}),e.jsx("small",{children:"Profile required"})]}),e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"No local Profile loaded"}),e.jsx("span",{children:"Open the Profile tab to create or load a Profile before managing agents."})]})]}):e.jsxs("div",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Summary"}),e.jsx("small",{children:"Not loaded"})]}),e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"No local profile loaded"}),e.jsx("span",{children:"OpenPond uses one Git-backed Profile in the default repo."}),e.jsxs("button",{className:"settings-secondary",disabled:!t||!!g,type:"button",onClick:M,children:[e.jsx(z,{size:14}),e.jsx("span",{children:g==="init"?"Creating":"Create default Profile"})]})]})]})})}function ne({connection:s,profile:a,profileBusy:t,profileCommitMessage:l,selectedDefaultTeamId:n,syncDisabledReason:o,setProfileCommitMessage:c,submitProfileCommit:d,submitProfilePush:p}){const[j,g]=x.useState(!1),[u,h]=x.useState(!1),[i,r]=x.useState(!1),f=!s||!!t;return e.jsxs("div",{className:"profile-control-panel",children:[e.jsxs("div",{className:"profile-control-toolbar",children:[e.jsxs("div",{className:"profile-control-actions",children:[e.jsxs("button",{className:"settings-secondary",disabled:f,type:"button",onClick:()=>h(!0),children:[e.jsx(P,{size:14}),e.jsx("span",{children:t==="commit"?"Committing":"Commit"})]}),e.jsxs("button",{className:"settings-secondary",disabled:f||!a,type:"button",onClick:()=>r(!0),children:[e.jsx(C,{size:14}),e.jsx("span",{children:t==="push"?"Syncing":"Sync"})]}),e.jsxs("button",{className:"settings-secondary",disabled:!!t||!a,type:"button",onClick:()=>g(!0),children:[e.jsx(D,{size:14}),e.jsx("span",{children:"Repo"})]}),a?e.jsxs("span",{className:"profile-hosted-status",title:`Hosted profile status: ${L(a,n)}`,children:[e.jsx(C,{size:14}),e.jsx("span",{children:"Hosted"}),e.jsx("strong",{children:L(a,n)})]}):null]}),a?e.jsx("span",{className:`profile-local-status ${a.summary.state}`,title:a.summary.message,children:a.summary.message}):null]}),j&&a?e.jsx(oe,{profile:a,profileBusy:t,onClose:()=>g(!1)}):null,u?e.jsx(le,{disabled:f,profileBusy:t,profileCommitMessage:l,setProfileCommitMessage:c,submitProfileCommit:d,onClose:()=>h(!1)}):null,i&&a?e.jsx(ie,{disabled:f,profile:a,profileBusy:t,selectedDefaultTeamId:n,syncDisabledReason:o,submitProfilePush:p,onClose:()=>r(!1)}):null]})}function le({disabled:s,profileBusy:a,profileCommitMessage:t,setProfileCommitMessage:l,submitProfileCommit:n,onClose:o}){function c(d){d.preventDefault(),!s&&(n(),o())}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:o,children:e.jsxs("form",{className:"git-dialog profile-commit-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-commit-dialog-title",onMouseDown:d=>d.stopPropagation(),onSubmit:c,children:[e.jsx("button",{className:"git-dialog-close",disabled:!!a,type:"button",title:"Close","aria-label":"Close",onClick:o,children:e.jsx($,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(P,{size:18})}),e.jsx("h2",{id:"profile-commit-dialog-title",children:"Commit profile"}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Commit message"}),e.jsx("input",{autoFocus:!0,value:t,disabled:!!a,placeholder:"Update OpenPond profile",onChange:d=>l(d.target.value)})]}),e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:!!a,type:"button",onClick:o,children:"Cancel"}),e.jsxs("button",{className:"git-dialog-primary",disabled:s,type:"submit",children:[e.jsx(P,{size:14}),e.jsx("span",{children:a==="commit"?"Committing":"Commit"})]})]})]})})}function ie({disabled:s,profile:a,profileBusy:t,selectedDefaultTeamId:l,syncDisabledReason:n,submitProfilePush:o,onClose:c}){const d=he(a,l),p=d.reduce((u,h)=>u+h.count,0),j=!s&&!n;function g(u){u.preventDefault(),j&&(o(),c())}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:c,children:e.jsxs("form",{className:"git-dialog profile-sync-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-sync-dialog-title",onMouseDown:u=>u.stopPropagation(),onSubmit:g,children:[e.jsx("button",{className:"git-dialog-close",disabled:!!t,type:"button",title:"Close","aria-label":"Close",onClick:c,children:e.jsx($,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(C,{size:18})}),e.jsx("h2",{id:"profile-sync-dialog-title",children:"Sync profile"}),e.jsxs("div",{className:"profile-dialog-summary",children:[e.jsxs("strong",{children:[p," ",p===1?"item":"items"," out of sync"]}),e.jsxs("span",{children:["Local ",N(a.summary.localHead??a.git?.head)," - Last pushed"," ",N(a.hosted?.lastPushedLocalHead)]})]}),d.length?e.jsx("div",{className:"profile-dialog-diff-list","aria-label":"Profile sync differences",children:d.map(u=>e.jsxs("div",{className:`profile-dialog-diff-row ${u.tone??""}`,children:[e.jsx("strong",{children:u.label}),e.jsx("span",{children:u.detail})]},u.label))}):e.jsx("div",{className:"profile-dialog-diff-list","aria-label":"Profile sync differences",children:e.jsxs("div",{className:"profile-dialog-diff-row",children:[e.jsx("strong",{children:"Aligned"}),e.jsx("span",{children:"Current local profile source has already been pushed."})]})}),n?e.jsx("div",{className:"profile-dialog-warning",children:n}):null,e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:!!t,type:"button",onClick:c,children:"Cancel"}),e.jsxs("button",{className:"git-dialog-primary",disabled:!j,type:"submit",children:[e.jsx(C,{size:14}),e.jsx("span",{children:t==="push"?"Syncing":"Confirm sync"})]})]})]})})}function oe({profile:s,profileBusy:a,onClose:t}){return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:t,children:e.jsxs("div",{className:"git-dialog profile-path-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-path-dialog-title",onMouseDown:l=>l.stopPropagation(),children:[e.jsx("button",{className:"git-dialog-close",disabled:!!a,type:"button",title:"Close","aria-label":"Close",onClick:t,children:e.jsx($,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(D,{size:18})}),e.jsx("h2",{id:"profile-path-dialog-title",children:"Profile repo"}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Profile repo path"}),e.jsx("input",{"aria-label":"Profile repo path",readOnly:!0,value:s.repoPath??""})]}),e.jsxs("div",{className:"profile-dialog-summary",children:[e.jsx("strong",{children:s.git?.isRepo?"Git-backed":"Git setup required"}),e.jsxs("span",{children:[s.git?.branch??"No branch"," · ",N(s.git?.head)]})]}),e.jsx("div",{className:"git-dialog-footer",children:e.jsx("button",{className:"git-dialog-secondary",disabled:!!a,type:"button",onClick:t,children:"Close"})})]})})}function ce({onSkillCommand:s,profile:a}){const t=a.skills.slice().sort((o,c)=>o.name.localeCompare(c.name)),l=!s;function n(o){s?.(o)}return e.jsxs("div",{className:"account-list profile-skill-list",children:[e.jsxs("div",{className:"account-list-heading profile-agent-list-heading",children:[e.jsx("span",{children:"Skills"}),e.jsxs("div",{className:"profile-skill-heading-actions",children:[e.jsxs("small",{children:[a.skillCatalog.skillCount," tracked"]}),e.jsxs("button",{className:"settings-secondary",disabled:l,type:"button",title:"Create profile skill",onClick:()=>n("/skill create "),children:[e.jsx(z,{size:14}),e.jsx("span",{children:"Create"})]})]})]}),t.length?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"profile-skill-table-head","aria-hidden":"true",children:[e.jsx("span",{children:"Skill"}),e.jsx("span",{children:"Trigger"}),e.jsx("span",{children:"Status"}),e.jsx("span",{children:"Source"}),e.jsx("span",{children:"Actions"})]}),t.map(o=>e.jsx(de,{commandDisabled:l,onSkillCommand:n,skill:o},o.name))]}):e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"No profile skills found"}),e.jsx("span",{children:"Use /skill create to add reusable profile instructions."})]})]})}function de({commandDisabled:s,onSkillCommand:a,skill:t}){const l=t.validationStatus==="valid"?{state:"ready",label:"valid"}:{state:"warning",label:t.validationStatus};return e.jsxs("div",{className:"product-row profile-skill-row",children:[e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(U,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:t.name}),e.jsx("span",{title:t.path,children:t.path})]})]}),e.jsx("div",{className:"profile-skill-description",title:t.description,children:t.description||"No description"}),e.jsx(re,{status:l}),e.jsx("div",{className:"profile-agent-action",children:e.jsx("span",{title:t.sourcePath,children:t.sourcePath})}),e.jsxs("div",{className:"profile-skill-actions",children:[e.jsx("button",{className:"settings-secondary compact",disabled:s||!t.enabled,type:"button",title:`Use ${t.name}`,onClick:()=>a(`$${t.name} `),children:e.jsx("span",{children:"Use"})}),e.jsx("button",{className:"settings-secondary compact",disabled:s,type:"button",title:`Edit ${t.name}`,onClick:()=>a(`/skill edit ${t.name} `),children:e.jsx("span",{children:"Edit"})})]})]})}function re({status:s}){return e.jsx("span",{className:`profile-status-text ${s.state}`,children:s.label})}function N(s){return s?s.slice(0,10):"None"}function L(s,a){return E(s,a)?"Sync this account":s.hosted?.sourceCommitSha?`${s.hosted.promotionStatus??"uploaded"} ${N(s.hosted.sourceCommitSha)}`:"Not pushed"}function ue(s,a){return a?s.git?.head?s.git.dirty?"Commit local profile changes before syncing.":null:"Commit the profile before syncing.":"Select a default team before syncing."}function he(s,a){const t=[],l=s.summary.localHead??s.git?.head??null,n=s.hosted?.lastPushedLocalHead??null,o=s.summary.hostedHead??s.hosted?.sourceCommitSha??null;if(E(s,a)&&t.push({label:"Account",detail:"Hosted profile metadata was synced under a different default team.",count:1,tone:"warning"}),!o&&!n?t.push({label:"Hosted source",detail:"No hosted profile commit has been recorded.",count:1}):l&&n&&l!==n&&t.push({label:"Commit",detail:`Local ${N(l)} has not been pushed since ${N(n)}.`,count:1}),s.git?.dirty){const d=s.git.files.length||s.diff.files.length||1;t.push({label:"Uncommitted files",detail:`${d} local ${d===1?"file":"files"} changed.`,count:d,tone:"warning"})}const c=s.diff.changedAgents.length+s.diff.newAgents.length+s.diff.deletedAgents.length+s.diff.changedSkills.length+s.diff.changedActions.length+s.diff.changedExtensions.length+s.diff.setupChanges.length+s.diff.envRequirementChanges.length;return c>0&&t.push({label:"Profile changes",detail:ge(s),count:c,tone:s.git?.dirty?"warning":void 0}),s.catalog.stale&&t.push({label:"Catalog",detail:"Action catalog artifacts are stale or missing.",count:1,tone:"warning"}),s.setupGate.blockingCount>0&&t.push({label:"Setup",detail:`${s.setupGate.blockingCount} blocking setup ${s.setupGate.blockingCount===1?"requirement":"requirements"}.`,count:s.setupGate.blockingCount,tone:"warning"}),t}function ge(s){const a=[],t=s.diff.changedAgents.length+s.diff.newAgents.length+s.diff.deletedAgents.length;return t&&a.push(`${t} agent ${t===1?"change":"changes"}`),s.diff.changedActions.length&&a.push(`${s.diff.changedActions.length} action ${s.diff.changedActions.length===1?"change":"changes"}`),s.diff.changedSkills.length&&a.push(`${s.diff.changedSkills.length} skill ${s.diff.changedSkills.length===1?"change":"changes"}`),s.diff.changedExtensions.length&&a.push(`${s.diff.changedExtensions.length} extension ${s.diff.changedExtensions.length===1?"change":"changes"}`),s.diff.setupChanges.length&&a.push(`${s.diff.setupChanges.length} setup ${s.diff.setupChanges.length===1?"change":"changes"}`),s.diff.envRequirementChanges.length&&a.push(`${s.diff.envRequirementChanges.length} env ${s.diff.envRequirementChanges.length===1?"change":"changes"}`),a.join(", ")||"Profile source has local changes."}function E(s,a){const t=s.hosted?.teamId?.trim()??"";return!!(t&&a&&t!==a)}export{be as P,W as R};
1
+ import{d as G,r as x,m,j as e,V as H,w as T,h as z,ai as C,ao as D,X as $,ay as U}from"./index-CKmte5ok.js";import{G as P}from"./git-commit-horizontal-CDDZl4iA.js";import{P as q}from"./play-DLCuESeG.js";import{R as B}from"./refresh-cw-JNUovwk4.js";/* empty css */const _=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],W=G("rotate-ccw",_),V=5e3;function Q(s){const[a,t]=x.useState([]),[l,n]=x.useState(!1),[o,c]=x.useState(null),[d,p]=x.useState(()=>new Set);x.useEffect(()=>{if(!s){t([]),c(null),n(!1);return}let i=!1,r=null;async function f(b){if(!(!s||i)){b&&n(!0);try{const y=await m.localAgentSchedules(s);if(i)return;t(y.schedules),c(null)}catch(y){i||c(S(y))}finally{!i&&b&&n(!1)}}}return f(!0),r=window.setInterval(()=>{f(!1)},V),()=>{i=!0,r!==null&&window.clearInterval(r)}},[s]);async function j(){if(s){n(!0);try{const i=await m.syncLocalAgentSchedules(s);t(i.schedules),c(null)}catch(i){c(S(i))}finally{n(!1)}}}async function g(i){if(!(!s||d.has(i.id))){h(i.id,!0);try{await m.runLocalAgentSchedule(s,i.id);const r=await m.localAgentSchedules(s);t(r.schedules),c(null)}catch(r){c(S(r))}finally{h(i.id,!1)}}}async function u(i){if(!(!s||d.has(i.id))){h(i.id,!0);try{await m.patchLocalAgentSchedule(s,i.id,{enabled:!i.enabled});const r=await m.localAgentSchedules(s);t(r.schedules),c(null)}catch(r){c(S(r))}finally{h(i.id,!1)}}}function h(i,r){p(f=>{const b=new Set(f);return r?b.add(i):b.delete(i),b})}return{error:o,loading:l,pendingScheduleIds:d,refresh:j,run:g,schedules:a,toggle:u}}function S(s){return s instanceof Error?s.message:String(s)}function X({connection:s,profile:a,selectedDefaultTeamId:t}){const l=Q(s);return e.jsxs("div",{className:"account-list profile-agent-list","aria-label":"Profile agents",children:[e.jsxs("div",{className:"account-list-heading profile-agent-list-heading",children:[e.jsx("span",{children:"Agents"}),e.jsx("div",{className:"profile-skill-heading-actions",children:e.jsx("small",{children:Y(l.schedules.length,l.loading)})})]}),a.agents.length||l.schedules.length?e.jsx("div",{className:"profile-agent-table-frame",children:e.jsxs("table",{className:"profile-agent-table","aria-label":"Profile agents table",children:[e.jsxs("colgroup",{children:[e.jsx("col",{className:"profile-agent-column"}),e.jsx("col",{className:"profile-action-column"}),e.jsx("col",{className:"profile-check-column"}),e.jsx("col",{className:"profile-sync-column"})]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"Agent"}),e.jsx("th",{scope:"col",children:"Action"}),e.jsx("th",{scope:"col",children:"Check"}),e.jsx("th",{scope:"col",children:"Sync"})]})}),e.jsxs("tbody",{children:[a.agents.map(n=>e.jsx(J,{agent:n,defaultAction:a.summary.defaultAction,profile:a,selectedDefaultTeamId:t},n.id)),l.schedules.map(n=>e.jsx(K,{pending:l.pendingScheduleIds.has(n.id),schedule:n,refreshing:l.loading,onRefresh:()=>{l.refresh()},onRun:()=>{l.run(n)},onToggle:()=>{l.toggle(n)}},n.id))]})]})}):e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"No profile agents found"}),e.jsx("span",{children:"Create an agent, then run Profile checks to add it to the catalog."})]}),l.error?e.jsxs("div",{className:"profile-footline warning profile-agent-list-note",children:["Local schedules: ",l.error]}):null]})}function J({agent:s,defaultAction:a,profile:t,selectedDefaultTeamId:l}){const n=se(t,s,l);return e.jsxs("tr",{className:"profile-agent-row",children:[e.jsx("td",{children:e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(H,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:s.name}),e.jsx("span",{title:s.path,children:s.path})]})]})}),e.jsx("td",{children:e.jsx("div",{className:"profile-agent-action",children:e.jsx("span",{children:a??"None"})})}),e.jsx("td",{children:e.jsx(A,{status:n.check})}),e.jsx("td",{children:e.jsx(A,{status:n.sync})})]})}function K({pending:s,refreshing:a,schedule:t,onRefresh:l,onRun:n,onToggle:o}){const c=Z(t),d=t.enabled?"Pause schedule":"Resume schedule";return e.jsxs("tr",{className:"profile-agent-row profile-schedule-agent-row",children:[e.jsx("td",{children:e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(H,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:t.localProjectName}),e.jsxs("span",{title:t.scheduleName,children:["schedule: ",t.scheduleName]})]})]})}),e.jsx("td",{children:e.jsx("div",{className:"profile-agent-action",children:e.jsx("span",{title:t.targetAction,children:t.targetAction})})}),e.jsx("td",{children:e.jsx(A,{status:c})}),e.jsx("td",{children:e.jsxs("div",{className:"profile-schedule-actions",children:[e.jsx("span",{className:"profile-schedule-expression",title:ee(t),children:t.enabled?t.scheduleExpression:"Paused"}),e.jsxs("div",{className:"profile-schedule-controls","aria-label":`${t.scheduleName} schedule controls`,children:[e.jsx("button",{className:"settings-icon-button profile-schedule-button",disabled:a,type:"button",title:"Refresh local schedules","aria-label":"Refresh local schedules",onClick:l,children:e.jsx(B,{size:14,className:a?"settings-spin":void 0})}),e.jsx("button",{className:"settings-icon-button profile-schedule-button",disabled:s,type:"button",title:"Run now","aria-label":`Run ${t.scheduleName} now`,onClick:n,children:e.jsx(W,{size:14})}),e.jsx("button",{className:"settings-icon-button profile-schedule-button",disabled:s,type:"button",title:d,"aria-label":`${d}: ${t.scheduleName}`,onClick:o,children:t.enabled?e.jsx(T,{size:14}):e.jsx(q,{size:14})})]})]})})]})}function A({status:s}){return e.jsx("span",{className:`profile-status-text ${s.state}`,children:s.label})}function Y(s,a){return a&&s===0?"Loading schedules":a?`${s} scheduled, refreshing`:s===1?"1 scheduled":s>1?`${s} scheduled`:"No schedules"}function Z(s){return s.enabled?s.lastError||s.lastRunStatus==="failed"?{state:"warning",label:"Failed"}:s.lastRunStatus==="running"?{state:"loading",label:"Running"}:s.lastRunStatus==="queued"?{state:"loading",label:"Queued"}:s.lastRunStatus==="skipped"?{state:"warning",label:"Skipped"}:s.lastRunStatus==="succeeded"?{state:"ready",label:"Succeeded"}:{state:"loading",label:"Scheduled"}:{state:"disabled",label:"Paused"}}function ee(s){const a=[`${s.scheduleType}: ${s.scheduleExpression}`];return s.nextRunAt&&a.push(`next ${R(s.nextRunAt)}`),s.lastRunAt&&a.push(`last ${R(s.lastRunAt)}`),a.join(" - ")}function R(s){const a=new Date(s);return Number.isFinite(a.getTime())?a.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):s}function se(s,a,t){if(!a.enabled)return{check:{state:"disabled",label:"Disabled"},sync:{state:"disabled",label:"Disabled"}};if(s.error)return{check:{state:"warning",label:"Error"},sync:{state:"warning",label:"Blocked"}};if(s.setupGate.blockingCount>0)return{check:{state:"warning",label:"Setup"},sync:{state:"warning",label:"Blocked"}};if(s.git?.dirty||ae(s,a)>0)return{check:{state:"loading",label:"Pending"},sync:{state:"warning",label:"Changed"}};if(s.catalog.stale)return{check:{state:"loading",label:"Stale"},sync:{state:"loading",label:"Waiting"}};if(!s.lastCheck)return{check:{state:"loading",label:"Unchecked"},sync:{state:"loading",label:"Waiting"}};if(s.lastCheck.status==="failed")return{check:{state:"warning",label:"Failed"},sync:{state:"warning",label:"Blocked"}};if(!s.summary.checkFresh)return{check:{state:"loading",label:"Stale"},sync:{state:"loading",label:"Waiting"}};if(te(s,t))return{check:{state:"ready",label:"Passed"},sync:{state:"warning",label:"Sync acct"}};const l=s.summary.localHead??s.git?.head??null,n=s.hosted?.lastPushedLocalHead??null;return!(s.summary.hostedHead??s.hosted?.sourceCommitSha??null)&&!n?{check:{state:"ready",label:"Passed"},sync:{state:"loading",label:"Not synced"}}:l&&n&&l!==n?{check:{state:"ready",label:"Passed"},sync:{state:"loading",label:"Needed"}}:{check:{state:"ready",label:"Passed"},sync:{state:"ready",label:"Synced"}}}function te(s,a){const t=s.hosted?.teamId?.trim()??"";return!!(t&&a&&t!==a)}function ae(s,a){let t=0;s.diff.changedAgents.includes(a.id)&&(t+=1),s.diff.newAgents.includes(a.id)&&(t+=1),s.diff.deletedAgents.includes(a.id)&&(t+=1);const l=a.path.replace(/^profiles\/[^/]+\//,"");for(const n of s.diff.files){const o=n.path.replace(/^profiles\/[^/]+\//,"");(o===l||o.startsWith(`${l}/`)||o.startsWith(`agents/${a.id}/`))&&(t+=1)}return t}function be({section:s="all",payload:a,connection:t,onPayload:l,onError:n,onToast:o,onSkillCommand:c,overviewContent:d}){const[p,j]=x.useState(""),[g,u]=x.useState(null),h=a?.profile??null,i=a?.preferences.defaultTeamId?.trim()||"",r=s==="all"||s==="profile"||s==="controls",f=s==="all"||s==="agents",b=s==="all"||s==="profile";async function y(w){t&&(l(await m.bootstrap(t)),o?.(w,"success"))}async function v(w,O){if(!(!t||g)){u(w),n(null);try{await O()}catch(k){n(k instanceof Error?k.message:String(k))}finally{u(null)}}}function M(){v("init",async()=>{await m.profileInit(t,{}),await y("Profile initialized")})}function F(){v("commit",async()=>{await m.profileCommit(t,{message:p.trim()||null}),j(""),await y("Profile commit complete")})}function I(){v("push",async()=>{if(!i)throw new Error("Select a default team before syncing a hosted profile.");await m.profileCheck(t,{kind:"all"}),await m.profilePush(t,{teamId:i,ensureHosted:!0,message:null}),await y("Profile synced to hosted profile repo")})}return e.jsx("section",{className:"account-settings",children:h?.mode==="local"?e.jsxs(e.Fragment,{children:[r?e.jsxs(e.Fragment,{children:[e.jsx(ne,{connection:t,profile:h,profileBusy:g,profileCommitMessage:p,selectedDefaultTeamId:i,syncDisabledReason:ue(h,i),setProfileCommitMessage:j,submitProfileCommit:F,submitProfilePush:I}),d]}):null,f?e.jsx(X,{connection:t,profile:h,selectedDefaultTeamId:i}):null,b?e.jsx(ce,{onSkillCommand:c,profile:h}):null]}):s==="agents"?e.jsxs("div",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Agents"}),e.jsx("small",{children:"Profile required"})]}),e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"No local Profile loaded"}),e.jsx("span",{children:"Open the Profile tab to create or load a Profile before managing agents."})]})]}):e.jsxs("div",{className:"account-list",children:[e.jsxs("div",{className:"account-list-heading",children:[e.jsx("span",{children:"Summary"}),e.jsx("small",{children:"Not loaded"})]}),e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"No local profile loaded"}),e.jsx("span",{children:"OpenPond uses one Git-backed Profile in the default repo."}),e.jsxs("button",{className:"settings-secondary",disabled:!t||!!g,type:"button",onClick:M,children:[e.jsx(z,{size:14}),e.jsx("span",{children:g==="init"?"Creating":"Create default Profile"})]})]})]})})}function ne({connection:s,profile:a,profileBusy:t,profileCommitMessage:l,selectedDefaultTeamId:n,syncDisabledReason:o,setProfileCommitMessage:c,submitProfileCommit:d,submitProfilePush:p}){const[j,g]=x.useState(!1),[u,h]=x.useState(!1),[i,r]=x.useState(!1),f=!s||!!t;return e.jsxs("div",{className:"profile-control-panel",children:[e.jsxs("div",{className:"profile-control-toolbar",children:[e.jsxs("div",{className:"profile-control-actions",children:[e.jsxs("button",{className:"settings-secondary",disabled:f,type:"button",onClick:()=>h(!0),children:[e.jsx(P,{size:14}),e.jsx("span",{children:t==="commit"?"Committing":"Commit"})]}),e.jsxs("button",{className:"settings-secondary",disabled:f||!a,type:"button",onClick:()=>r(!0),children:[e.jsx(C,{size:14}),e.jsx("span",{children:t==="push"?"Syncing":"Sync"})]}),e.jsxs("button",{className:"settings-secondary",disabled:!!t||!a,type:"button",onClick:()=>g(!0),children:[e.jsx(D,{size:14}),e.jsx("span",{children:"Repo"})]}),a?e.jsxs("span",{className:"profile-hosted-status",title:`Hosted profile status: ${L(a,n)}`,children:[e.jsx(C,{size:14}),e.jsx("span",{children:"Hosted"}),e.jsx("strong",{children:L(a,n)})]}):null]}),a?e.jsx("span",{className:`profile-local-status ${a.summary.state}`,title:a.summary.message,children:a.summary.message}):null]}),j&&a?e.jsx(oe,{profile:a,profileBusy:t,onClose:()=>g(!1)}):null,u?e.jsx(le,{disabled:f,profileBusy:t,profileCommitMessage:l,setProfileCommitMessage:c,submitProfileCommit:d,onClose:()=>h(!1)}):null,i&&a?e.jsx(ie,{disabled:f,profile:a,profileBusy:t,selectedDefaultTeamId:n,syncDisabledReason:o,submitProfilePush:p,onClose:()=>r(!1)}):null]})}function le({disabled:s,profileBusy:a,profileCommitMessage:t,setProfileCommitMessage:l,submitProfileCommit:n,onClose:o}){function c(d){d.preventDefault(),!s&&(n(),o())}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:o,children:e.jsxs("form",{className:"git-dialog profile-commit-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-commit-dialog-title",onMouseDown:d=>d.stopPropagation(),onSubmit:c,children:[e.jsx("button",{className:"git-dialog-close",disabled:!!a,type:"button",title:"Close","aria-label":"Close",onClick:o,children:e.jsx($,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(P,{size:18})}),e.jsx("h2",{id:"profile-commit-dialog-title",children:"Commit profile"}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Commit message"}),e.jsx("input",{autoFocus:!0,value:t,disabled:!!a,placeholder:"Update OpenPond profile",onChange:d=>l(d.target.value)})]}),e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:!!a,type:"button",onClick:o,children:"Cancel"}),e.jsxs("button",{className:"git-dialog-primary",disabled:s,type:"submit",children:[e.jsx(P,{size:14}),e.jsx("span",{children:a==="commit"?"Committing":"Commit"})]})]})]})})}function ie({disabled:s,profile:a,profileBusy:t,selectedDefaultTeamId:l,syncDisabledReason:n,submitProfilePush:o,onClose:c}){const d=he(a,l),p=d.reduce((u,h)=>u+h.count,0),j=!s&&!n;function g(u){u.preventDefault(),j&&(o(),c())}return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:c,children:e.jsxs("form",{className:"git-dialog profile-sync-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-sync-dialog-title",onMouseDown:u=>u.stopPropagation(),onSubmit:g,children:[e.jsx("button",{className:"git-dialog-close",disabled:!!t,type:"button",title:"Close","aria-label":"Close",onClick:c,children:e.jsx($,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(C,{size:18})}),e.jsx("h2",{id:"profile-sync-dialog-title",children:"Sync profile"}),e.jsxs("div",{className:"profile-dialog-summary",children:[e.jsxs("strong",{children:[p," ",p===1?"item":"items"," out of sync"]}),e.jsxs("span",{children:["Local ",N(a.summary.localHead??a.git?.head)," - Last pushed"," ",N(a.hosted?.lastPushedLocalHead)]})]}),d.length?e.jsx("div",{className:"profile-dialog-diff-list","aria-label":"Profile sync differences",children:d.map(u=>e.jsxs("div",{className:`profile-dialog-diff-row ${u.tone??""}`,children:[e.jsx("strong",{children:u.label}),e.jsx("span",{children:u.detail})]},u.label))}):e.jsx("div",{className:"profile-dialog-diff-list","aria-label":"Profile sync differences",children:e.jsxs("div",{className:"profile-dialog-diff-row",children:[e.jsx("strong",{children:"Aligned"}),e.jsx("span",{children:"Current local profile source has already been pushed."})]})}),n?e.jsx("div",{className:"profile-dialog-warning",children:n}):null,e.jsxs("div",{className:"git-dialog-footer",children:[e.jsx("button",{className:"git-dialog-secondary",disabled:!!t,type:"button",onClick:c,children:"Cancel"}),e.jsxs("button",{className:"git-dialog-primary",disabled:!j,type:"submit",children:[e.jsx(C,{size:14}),e.jsx("span",{children:t==="push"?"Syncing":"Confirm sync"})]})]})]})})}function oe({profile:s,profileBusy:a,onClose:t}){return e.jsx("div",{className:"git-dialog-backdrop",role:"presentation",onMouseDown:t,children:e.jsxs("div",{className:"git-dialog profile-path-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"profile-path-dialog-title",onMouseDown:l=>l.stopPropagation(),children:[e.jsx("button",{className:"git-dialog-close",disabled:!!a,type:"button",title:"Close","aria-label":"Close",onClick:t,children:e.jsx($,{size:14})}),e.jsx("div",{className:"git-dialog-icon",children:e.jsx(D,{size:18})}),e.jsx("h2",{id:"profile-path-dialog-title",children:"Profile repo"}),e.jsxs("label",{className:"git-dialog-field",children:[e.jsx("span",{children:"Profile repo path"}),e.jsx("input",{"aria-label":"Profile repo path",readOnly:!0,value:s.repoPath??""})]}),e.jsxs("div",{className:"profile-dialog-summary",children:[e.jsx("strong",{children:s.git?.isRepo?"Git-backed":"Git setup required"}),e.jsxs("span",{children:[s.git?.branch??"No branch"," · ",N(s.git?.head)]})]}),e.jsx("div",{className:"git-dialog-footer",children:e.jsx("button",{className:"git-dialog-secondary",disabled:!!a,type:"button",onClick:t,children:"Close"})})]})})}function ce({onSkillCommand:s,profile:a}){const t=a.skills.slice().sort((o,c)=>o.name.localeCompare(c.name)),l=!s;function n(o){s?.(o)}return e.jsxs("div",{className:"account-list profile-skill-list",children:[e.jsxs("div",{className:"account-list-heading profile-agent-list-heading",children:[e.jsx("span",{children:"Skills"}),e.jsxs("div",{className:"profile-skill-heading-actions",children:[e.jsxs("small",{children:[a.skillCatalog.skillCount," tracked"]}),e.jsxs("button",{className:"settings-secondary",disabled:l,type:"button",title:"Create profile skill",onClick:()=>n("/skill create "),children:[e.jsx(z,{size:14}),e.jsx("span",{children:"Create"})]})]})]}),t.length?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"profile-skill-table-head","aria-hidden":"true",children:[e.jsx("span",{children:"Skill"}),e.jsx("span",{children:"Trigger"}),e.jsx("span",{children:"Status"}),e.jsx("span",{children:"Source"}),e.jsx("span",{children:"Actions"})]}),t.map(o=>e.jsx(de,{commandDisabled:l,onSkillCommand:n,skill:o},o.name))]}):e.jsxs("div",{className:"empty-account-list",children:[e.jsx("strong",{children:"No profile skills found"}),e.jsx("span",{children:"Use /skill create to add reusable profile instructions."})]})]})}function de({commandDisabled:s,onSkillCommand:a,skill:t}){const l=t.validationStatus==="valid"?{state:"ready",label:"valid"}:{state:"warning",label:t.validationStatus};return e.jsxs("div",{className:"product-row profile-skill-row",children:[e.jsxs("div",{className:"profile-agent-identity",children:[e.jsx(U,{size:18}),e.jsxs("div",{children:[e.jsx("strong",{children:t.name}),e.jsx("span",{title:t.path,children:t.path})]})]}),e.jsx("div",{className:"profile-skill-description",title:t.description,children:t.description||"No description"}),e.jsx(re,{status:l}),e.jsx("div",{className:"profile-agent-action",children:e.jsx("span",{title:t.sourcePath,children:t.sourcePath})}),e.jsxs("div",{className:"profile-skill-actions",children:[e.jsx("button",{className:"settings-secondary compact",disabled:s||!t.enabled,type:"button",title:`Use ${t.name}`,onClick:()=>a(`$${t.name} `),children:e.jsx("span",{children:"Use"})}),e.jsx("button",{className:"settings-secondary compact",disabled:s,type:"button",title:`Edit ${t.name}`,onClick:()=>a(`/skill edit ${t.name} `),children:e.jsx("span",{children:"Edit"})})]})]})}function re({status:s}){return e.jsx("span",{className:`profile-status-text ${s.state}`,children:s.label})}function N(s){return s?s.slice(0,10):"None"}function L(s,a){return E(s,a)?"Sync this account":s.hosted?.sourceCommitSha?`${s.hosted.promotionStatus??"uploaded"} ${N(s.hosted.sourceCommitSha)}`:"Not pushed"}function ue(s,a){return a?s.git?.head?s.git.dirty?"Commit local profile changes before syncing.":null:"Commit the profile before syncing.":"Select a default team before syncing."}function he(s,a){const t=[],l=s.summary.localHead??s.git?.head??null,n=s.hosted?.lastPushedLocalHead??null,o=s.summary.hostedHead??s.hosted?.sourceCommitSha??null;if(E(s,a)&&t.push({label:"Account",detail:"Hosted profile metadata was synced under a different default team.",count:1,tone:"warning"}),!o&&!n?t.push({label:"Hosted source",detail:"No hosted profile commit has been recorded.",count:1}):l&&n&&l!==n&&t.push({label:"Commit",detail:`Local ${N(l)} has not been pushed since ${N(n)}.`,count:1}),s.git?.dirty){const d=s.git.files.length||s.diff.files.length||1;t.push({label:"Uncommitted files",detail:`${d} local ${d===1?"file":"files"} changed.`,count:d,tone:"warning"})}const c=s.diff.changedAgents.length+s.diff.newAgents.length+s.diff.deletedAgents.length+s.diff.changedSkills.length+s.diff.changedActions.length+s.diff.changedExtensions.length+s.diff.setupChanges.length+s.diff.envRequirementChanges.length;return c>0&&t.push({label:"Profile changes",detail:ge(s),count:c,tone:s.git?.dirty?"warning":void 0}),s.catalog.stale&&t.push({label:"Catalog",detail:"Action catalog artifacts are stale or missing.",count:1,tone:"warning"}),s.setupGate.blockingCount>0&&t.push({label:"Setup",detail:`${s.setupGate.blockingCount} blocking setup ${s.setupGate.blockingCount===1?"requirement":"requirements"}.`,count:s.setupGate.blockingCount,tone:"warning"}),t}function ge(s){const a=[],t=s.diff.changedAgents.length+s.diff.newAgents.length+s.diff.deletedAgents.length;return t&&a.push(`${t} agent ${t===1?"change":"changes"}`),s.diff.changedActions.length&&a.push(`${s.diff.changedActions.length} action ${s.diff.changedActions.length===1?"change":"changes"}`),s.diff.changedSkills.length&&a.push(`${s.diff.changedSkills.length} skill ${s.diff.changedSkills.length===1?"change":"changes"}`),s.diff.changedExtensions.length&&a.push(`${s.diff.changedExtensions.length} extension ${s.diff.changedExtensions.length===1?"change":"changes"}`),s.diff.setupChanges.length&&a.push(`${s.diff.setupChanges.length} setup ${s.diff.setupChanges.length===1?"change":"changes"}`),s.diff.envRequirementChanges.length&&a.push(`${s.diff.envRequirementChanges.length} env ${s.diff.envRequirementChanges.length===1?"change":"changes"}`),a.join(", ")||"Profile source has local changes."}function E(s,a){const t=s.hosted?.teamId?.trim()??"";return!!(t&&a&&t!==a)}export{be as P,W as R};