openpond 0.2.15 → 0.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-server.d.ts +2 -0
- package/dist/app-server.js +1 -1
- package/dist/chunks/{app-layer-SSLVAUNI.js → app-layer-CFIW5CWC.js} +1 -1
- package/dist/chunks/{app-server-runtime-QUC4HPQU.js → app-server-runtime-Q7NJ6PXF.js} +1 -1
- package/dist/chunks/{apps-JEKTEGSW.js → apps-67PSSK6Q.js} +1 -1
- package/dist/chunks/{chunk-YNXFXNQM.js → chunk-BE35DIOI.js} +1 -1
- package/dist/chunks/{chunk-4E5ETWKU.js → chunk-CULWDNK3.js} +334 -332
- package/dist/chunks/{chunk-ZYG2PXY2.js → chunk-G54T4IWQ.js} +1 -1
- package/dist/chunks/{chunk-7I73OREC.js → chunk-GHKJKXDF.js} +1 -1
- package/dist/chunks/{chunk-K4ZKAHLG.js → chunk-MACBJI6D.js} +1 -1
- package/dist/chunks/{chunk-UOQHYTCK.js → chunk-N3KS3AJK.js} +1 -1
- package/dist/chunks/{chunk-FHBQ6OWG.js → chunk-PRA6LX2G.js} +1 -1
- package/dist/chunks/{chunk-VRXXKDF2.js → chunk-Q7QAKAGF.js} +1 -1
- package/dist/chunks/chunk-RB7BWSFJ.js +5 -0
- package/dist/chunks/{chunk-JTQDNX2J.js → chunk-SKKAWYCQ.js} +1 -1
- package/dist/chunks/{chunk-QLZ67Y6C.js → chunk-VL3RGI55.js} +2 -2
- package/dist/chunks/{cli-7YSRAC4Y.js → cli-BCBRWI2M.js} +1 -1
- package/dist/chunks/{configuration-command-DH4ZZUKL.js → configuration-command-D66B4TXT.js} +1 -1
- package/dist/chunks/{core-commands-TUUSA6WB.js → core-commands-D6OHIVUG.js} +1 -1
- package/dist/chunks/{desktop-test-S3RME4QT.js → desktop-test-RBRWSLEM.js} +1 -1
- package/dist/chunks/{extension-D64BYPFY.js → extension-MP3XCX56.js} +1 -1
- package/dist/chunks/{help-AOVE3SSY.js → help-XVBIPQHN.js} +1 -1
- package/dist/chunks/{opchat-KC2FL5TT.js → opchat-NYSALH7B.js} +1 -1
- package/dist/chunks/{organizations-AAES2P7W.js → organizations-ZCQX3SY3.js} +1 -1
- package/dist/chunks/{profile-FRYWK2IE.js → profile-PFR6PWNE.js} +1 -1
- package/dist/chunks/{project-agent-WPW6DWK7.js → project-agent-KSMTTZYC.js} +1 -1
- package/dist/chunks/{sandbox-command-ZHKJZ3FJ.js → sandbox-command-MVBSIKB6.js} +1 -1
- package/dist/chunks/{sandbox-template-SPVQIMG5.js → sandbox-template-2OWCTKBP.js} +1 -1
- package/dist/chunks/{src-LYFCDA5G.js → src-7TTHR4DL.js} +1 -1
- package/dist/chunks/{src-AADCZ2JW.js → src-ITECV3AD.js} +105 -105
- package/dist/chunks/{teams-bot-LD3QORJI.js → teams-bot-IUE3CWSW.js} +1 -1
- package/dist/chunks/{workspaces-P2WNCMXC.js → workspaces-WI56RXUN.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/web/assets/{App-kwt-UxX_.js → App-DQfdLgyV.js} +3 -3
- package/dist/web/assets/{AppDialog-LXQo_7oW.js → AppDialog-BnldMLvF.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-CUqrUrkA.js → AppTerminalPanel-DR5SeX9y.js} +2 -2
- package/dist/web/assets/{AppsView-5J2RX301.js → AppsView-Bu_XEgkd.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-mZ8RjUOr.js → BrowserSidebar-BdKPWbN8.js} +1 -1
- package/dist/web/assets/{CartesianChart-7x3SO8Hj.js → CartesianChart-CSkLcF_5.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-ByC9WJqu.js → CollaborationTabs-C9cRq5ob.js} +1 -1
- package/dist/web/assets/{CommandMenu-CqDb2Kb2.js → CommandMenu-Deqzk3u9.js} +1 -1
- package/dist/web/assets/{CommunityView-BmxYkWqC.js → CommunityView-B5dKYacH.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-2Tyj9KOQ.js → ComposerCreateImproveStrip-5LPlQFN4.js} +1 -1
- package/dist/web/assets/{GetStartedView-1WYkmevY.js → GetStartedView-DmuGykfx.js} +1 -1
- package/dist/web/assets/HostedModelLearningReview-BRPSFNza.js +1 -0
- package/dist/web/assets/{HostedModelLearningSettings-Brza5hSD.js → HostedModelLearningSettings-BsdX-CkH.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-C4WtQKER.js → LabModelVersionDetailPage-BUO5cpDh.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-D3g6E0Ap.js → LabSkillSidebar-mTpdM-G8.js} +1 -1
- package/dist/web/assets/{LabsRoute-BO0yEsCR.js → LabsRoute-BhfxBg5_.js} +4 -4
- package/dist/web/assets/{MainChatThread-CKPR_rY0.js → MainChatThread-BAxA18lN.js} +2 -2
- package/dist/web/assets/{MainPane-B8mDzSqi.js → MainPane-Dv5USGqR.js} +4 -4
- package/dist/web/assets/{MarkdownText-D6_UI4Ly.js → MarkdownText-DWGLUbdE.js} +1 -1
- package/dist/web/assets/{Messages-DptbENmQ.js → Messages-CuhCtaya.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-CF1NTAR6.js → NativeSkillSidebar-B8OMVpPT.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-CwlpLsXW.js → NewExperienceSwitcher-kIKV8_Wd.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-Ls4K9a5S.js → NewProjectDialog-B-7dHoT6.js} +1 -1
- package/dist/web/assets/{OutputsPage-ClNuidPW.js → OutputsPage-C4DRT8pF.js} +1 -1
- package/dist/web/assets/{ProjectsPage-Sj83NsdP.js → ProjectsPage-CLjW6Kc3.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-m5-cI0NL.js → RightChatPanelStack-C4-4VLb-.js} +1 -1
- package/dist/web/assets/{RightSidebarHomePanel-B--t--OJ.js → RightSidebarHomePanel-CVbfOg2p.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-JVfMtGMs.js → ScheduledWorkPage-CWzwbOOZ.js} +1 -1
- package/dist/web/assets/SettingsView-BIwO8elm.js +9 -0
- package/dist/web/assets/{SettingsView-B9Tn0_zX.css → SettingsView-BaWWvIJW.css} +1 -1
- package/dist/web/assets/{TeamChatView-D8ilbncz.js → TeamChatView-miR9w_53.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-A6nSxm5C.js → TerminalOverlay-BOmx_hJX.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-CwpnBbuN.js → TrainingCreationPanel-DSRejaYV.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-B_Gh_0yq.js → TrainingDraftPanel-XBH6Uh0_.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-qTX3k9-f.js → UsageSettingsSection-DROtDdak.js} +1 -1
- package/dist/web/assets/{WorkSidebarPanel-B-fDRRRs.js → WorkSidebarPanel-CHwObGs6.js} +1 -1
- package/dist/web/assets/{WorkspaceDiffPanel-CfvvifJg.js → WorkspaceDiffPanel-BoB_1R8w.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-BL6WHWLO.js → WorkspaceEnvironmentMenu-Dvqy2NJP.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-pyZQJL_2.js → WorkspaceGitDialogs-BC45mifk.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-C2cNf0UO.js → WorkspaceMonacoEditor-cDO3Elh0.js} +3 -3
- package/dist/web/assets/{arrow-up-right-BQv8RCGD.js → arrow-up-right-Dv3nebbh.js} +1 -1
- package/dist/web/assets/{chat-file-links-C3erG0P2.js → chat-file-links-DQYtkwit.js} +1 -1
- package/dist/web/assets/chevron-up-BUOpWd2a.js +1 -0
- package/dist/web/assets/{clipboard-BSPYX7yq.js → clipboard-CnNPmg50.js} +1 -1
- package/dist/web/assets/{cloud-upload-CJVhhG6P.js → cloud-upload-DisZOwXE.js} +1 -1
- package/dist/web/assets/{cssMode-RCJXPUO-.js → cssMode-Bd8sFlb5.js} +1 -1
- package/dist/web/assets/{folder-open-2a5riVSG.js → folder-open-D0PIN0Cj.js} +1 -1
- package/dist/web/assets/{folder-plus-DuVvIFve.js → folder-plus-DTNZNwa9.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-BifoV1dR.js → git-commit-horizontal-C0QdA7uv.js} +1 -1
- package/dist/web/assets/{htmlMode-DnEOXzjT.js → htmlMode-Cu-nKV7Z.js} +1 -1
- package/dist/web/assets/{index-B5RqBp_p.js → index-De4k_YMo.js} +2 -2
- package/dist/web/assets/{info-BWvLCbJ2.js → info-B-n_omgE.js} +1 -1
- package/dist/web/assets/{jsonMode-DQfml7E4.js → jsonMode-B377iBCv.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-WKs-7xHz.js → lspLanguageFeatures-BBHfVtV0.js} +1 -1
- package/dist/web/assets/{minimize-2-C-_iqAbt.js → minimize-2-C6JQGKgk.js} +1 -1
- package/dist/web/assets/{monaco.contribution-B5y78DUP.js → monaco.contribution-B0l6Oe3a.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DCekL-SI.js → monaco.contribution-BDLeUQLG.js} +2 -2
- package/dist/web/assets/{monaco.contribution-Qc1u700n.js → monaco.contribution-CCSCAu65.js} +2 -2
- package/dist/web/assets/{monaco.contribution-B29c98Aa.js → monaco.contribution-CIq6sYw4.js} +2 -2
- package/dist/web/assets/{play-DsP3gpGK.js → play-B5O4Hz_W.js} +1 -1
- package/dist/web/assets/{python-CJ1QdM8L.js → python-BQkq0gZA.js} +1 -1
- package/dist/web/assets/{refresh-cw-DaASy_i0.js → refresh-cw-D2E-pp4H.js} +1 -1
- package/dist/web/assets/{save-BBQ7L8VS.js → save-CPNNuWwp.js} +1 -1
- package/dist/web/assets/{square-DTl9YrMp.js → square-DUgXVoF0.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-D-DNRZ-D.js → toggleHighContrast-BbQBtO9I.js} +1 -1
- package/dist/web/assets/{tsMode-CmWbxnjM.js → tsMode-CsVhouTE.js} +1 -1
- package/dist/web/assets/{upload-juEp2zRQ.js → upload-t7xHt3GY.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-DF_bIseW.js → useLocalAgentSchedules-D4lJelHt.js} +1 -1
- package/dist/web/assets/{wifi-off-DrkIaS1O.js → wifi-off-B_QPKtA-.js} +1 -1
- package/dist/web/assets/{workers-LygfviY3.js → workers-p7TrE4Qa.js} +1 -1
- package/dist/web/assets/{yaml-BIpimtDQ.js → yaml-C8adeAyH.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-6C2EXO4H.js +0 -5
- package/dist/web/assets/HostedModelLearningReview-DHahsQJH.js +0 -1
- package/dist/web/assets/SettingsView-B7FnZ-b0.js +0 -9
- package/dist/web/assets/chevron-up-D9MMQKU3.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,j as e}from"./index-B5RqBp_p.js";import{S as Z,W as ee,B as se,a as ne}from"./wifi-off-DrkIaS1O.js";import{R as O}from"./refresh-cw-DaASy_i0.js";import{X as H,ar as te,aB as M,dT as F}from"./App-kwt-UxX_.js";import{k as ie,m as ae,P as le,n as oe,r as re,o as ce,R as de}from"./MainPane-B8mDzSqi.js";import{M as J}from"./MarkdownText-D6_UI4Ly.js";import{T as me}from"./chat-file-links-C3erG0P2.js";import"./cloud-upload-CJVhhG6P.js";import"./arrow-up-right-BQv8RCGD.js";import"./square-DTl9YrMp.js";import"./desktop-files-BQj1J-ob.js";const ue=2e4,R=10,he=12*1024*1024,ye=new Set(["image/png","image/jpeg","image/webp","image/gif"]);function ge(s){const[n,m]=l.useState(""),[a,y]=l.useState(0),[c,u]=l.useState([]),[f,i]=l.useState(null),[b,h]=l.useState(!1),[p,C]=l.useState([]),[N,v]=l.useState(0),[o,I]=l.useState(null),k=l.useRef(null),E=l.useRef(null),D=l.useRef(c);D.current=c;const g=l.useMemo(()=>xe(n,a),[n,a]),S=g?`${g.start}:${g.end}:${g.query}`:null,T=g?.query??null,w=l.useMemo(()=>{if(!g)return[];const t=new Map;for(const d of[...s.members,...p])t.set(d.userId,d);const r=g.query.toLowerCase();return[...t.values()].filter(d=>`${d.handle??""} ${d.name??""}`.toLowerCase().includes(r)).slice(0,8)},[g,s.members,p]),B=!!(g&&S!==o&&w.length>0),L=!!(s.disabled||s.busy||b),U=!L&&(!!n.trim()||c.length>0);l.useEffect(()=>{if(T==null){C([]);return}let t=!0;const r=window.setTimeout(()=>{s.onSearchMembers(T).then(d=>{t&&C(d)},()=>{t&&C([])})},150);return()=>{t=!1,window.clearTimeout(r)}},[T,s.onSearchMembers]),l.useEffect(()=>{v(0)},[S]),l.useEffect(()=>()=>K(D.current),[]);async function $(t){if(t?.preventDefault(),!!U){i(null),h(!0);try{const r=await Promise.all(c.map(re));if(!await s.onSend({body:n,mentionUserIds:fe(n,s.members),attachments:r,replyToMessageId:s.replyTo?.id??null}))return;K(c),m(""),y(0),u([]),s.onCancelReply()}catch(r){i(r instanceof Error?r.message:String(r))}finally{h(!1)}}}function V(t){if(B){if(t.key==="ArrowDown"){t.preventDefault(),v(r=>(r+1)%w.length);return}if(t.key==="ArrowUp"){t.preventDefault(),v(r=>(r-1+w.length)%w.length);return}if(t.key==="Enter"||t.key==="Tab"){t.preventDefault(),z(w[N]??w[0]);return}if(t.key==="Escape"){t.preventDefault(),I(S);return}}t.key!=="Enter"||t.shiftKey||t.nativeEvent.isComposing||(t.preventDefault(),$())}function G(t){if(!t)return;i(null);const r=Math.max(0,R-c.length);if(r===0){i(`You can attach up to ${R} images.`),A();return}const d=[...t],j=d.slice(0,r),P=j.find(x=>!ye.has(x.type)),q=j.find(x=>x.size<=0||x.size>he);if(P){i(`${P.name} is not a supported image type.`),A();return}if(q){i(`${q.name} must be smaller than 12 MB.`),A();return}const Q=j.map(x=>({id:ce(),file:x,name:x.name,mediaType:x.type,sizeBytes:x.size,kind:"image",previewUrl:URL.createObjectURL(x)}));u(x=>[...x,...Q]),d.length>r&&i(`Only ${R} images can be attached to one message.`),A()}function W(t){u(r=>{const d=r.find(j=>j.id===t);return d?.previewUrl&&URL.revokeObjectURL(d.previewUrl),r.filter(j=>j.id!==t)})}function A(){k.current&&(k.current.value="")}function z(t){if(!g)return;const r=`@${X(t)} `,d=`${n.slice(0,g.start)}${r}${n.slice(g.end)}`,j=g.start+r.length;m(d),y(j),I(null),window.requestAnimationFrame(()=>E.current?.focusAtPromptIndex(j))}return e.jsxs("form",{className:`composer dock community-composer${c.length>0?" has-attachments":""}${f?" has-attachment-error":""}`,onSubmit:$,children:[s.replyTo?e.jsxs("div",{className:"community-composer-reply",children:[e.jsxs("span",{children:[e.jsx("strong",{children:"Replying to"}),s.replyTo.body.slice(0,100)||"message"]}),e.jsx("button",{type:"button","aria-label":"Cancel reply",onClick:s.onCancelReply,children:e.jsx(H,{size:13})})]}):null,B?e.jsx("div",{className:"community-mention-menu",role:"listbox","aria-label":"Community members",children:w.map((t,r)=>e.jsxs("button",{type:"button",role:"option","aria-selected":r===N,onMouseDown:d=>d.preventDefault(),onClick:()=>z(t),children:[e.jsx("strong",{children:t.name??t.handle??"Community member"}),t.handle?e.jsxs("small",{children:["@",t.handle]}):null]},t.userId))}):null,e.jsxs("div",{className:"composer-input-shell",children:[c.length>0?e.jsx("div",{className:"composer-attachments","aria-label":"Selected attachments",children:c.map(t=>e.jsx(ie,{attachment:t,onRemove:()=>W(t.id)},t.id))}):null,f?e.jsx("div",{className:"composer-attachment-error",role:"status",children:f}):null,e.jsx("div",{className:"composer-textarea-frame",onClick:t=>{t.target===t.currentTarget&&E.current?.focusAtPromptIndex(a)},children:e.jsx(ae,{ref:E,disabled:L,onCursorChange:y,onKeyDown:V,onPromptChange:(t,r)=>{const d=t.slice(0,ue);m(d),y(Math.min(r,d.length))},onTokenPositionChange:()=>{},placeholder:s.disabled?"Accept the community rules to post":"Message community",prompt:n,token:null})}),e.jsxs("div",{className:"composer-primary-controls team-chat-composer-controls",children:[e.jsx("input",{ref:k,className:"composer-file-input",hidden:!0,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",multiple:!0,onChange:t=>G(t.currentTarget.files)}),e.jsx("button",{type:"button",className:"composer-icon","aria-label":"Attach images",disabled:L||c.length>=R,onClick:()=>k.current?.click(),children:e.jsx(le,{size:17})}),e.jsx("div",{className:"composer-spacer"}),e.jsx("button",{type:"submit",className:"send-button","aria-label":"Send message",disabled:!U,children:e.jsx(oe,{size:17})})]})]})]})}function xe(s,n=s.length){const m=Math.max(0,Math.min(n,s.length)),a=/(?:^|\s)@([\w-]*)$/.exec(s.slice(0,m));return!a||a.index==null?null:{start:a.index+a[0].indexOf("@"),end:m,query:a[1]??""}}function fe(s,n){const m=new Set([...s.matchAll(/(?:^|\s)@([\w-]+)/g)].map(a=>a[1]?.toLowerCase()));return n.filter(a=>m.has(X(a).toLowerCase())).map(a=>a.userId)}function X(s){return s.handle??s.name?.replace(/[^\w-]/g,"")??s.userId}function K(s){for(const n of s)n.previewUrl&&URL.revokeObjectURL(n.previewUrl)}function be(s){const[n,m]=l.useState(!1),[a,y]=l.useState(s.message.body),c=s.message.refs.find(i=>i.refType==="message_reply"),u=c?s.messagesById.get(c.refId)??null:null,f=u?.authorUserId?s.membersById.get(u.authorUserId)??null:null;return e.jsxs("article",{className:`community-message${s.own?" own":""}`,id:`community-message-${s.message.id}`,children:[e.jsx("div",{className:"community-avatar",children:je(s.author?.name??s.author?.handle??"?")}),e.jsxs("div",{className:"community-message-content",children:[e.jsxs("header",{children:[e.jsx("strong",{children:s.author?.name??s.author?.handle??"Community member"}),e.jsx("time",{dateTime:s.message.createdAt,children:pe(s.message.createdAt)}),s.message.editedAt?e.jsx("span",{children:"edited"}):null,s.message.deletedAt?null:e.jsxs("div",{className:"community-message-actions",children:[e.jsx("button",{type:"button","aria-label":"Reply",onClick:()=>s.onReply(s.message),children:e.jsx(de,{size:13})}),s.own?e.jsx("button",{type:"button","aria-label":"Edit",onClick:()=>m(!0),children:e.jsx(te,{size:13})}):null,s.own?e.jsx("button",{type:"button","aria-label":"Delete",onClick:()=>{s.onDelete(s.message.id)},children:e.jsx(me,{size:13})}):null]})]}),c?e.jsxs("button",{type:"button",className:"community-reply-quote",onClick:()=>document.getElementById(`community-message-${c.refId}`)?.scrollIntoView({behavior:"smooth",block:"center"}),children:[e.jsx("strong",{children:f?.name??"Community member"}),e.jsx("span",{children:u?.deletedAt?"Message deleted":u?.body??String(c.preview.body??"Earlier message")})]}):null,n?e.jsxs("form",{className:"community-message-edit",onSubmit:i=>{i.preventDefault(),s.onEdit(s.message.id,a).then(b=>{b&&m(!1)})},children:[e.jsx("textarea",{autoFocus:!0,value:a,onChange:i=>y(i.currentTarget.value)}),e.jsxs("div",{children:[e.jsx("button",{type:"button",onClick:()=>m(!1),children:"Cancel"}),e.jsx("button",{type:"submit",disabled:!a.trim(),children:"Save"})]})]}):s.message.deletedAt?e.jsx("div",{className:"community-message-deleted",children:"Message deleted"}):e.jsx(J,{content:s.message.body}),!s.message.deletedAt&&s.message.attachments.length>0?e.jsx("div",{className:"community-message-attachments",children:s.message.attachments.map(i=>s.attachmentsAccessible?e.jsxs("button",{type:"button",onClick:()=>{s.onDownloadAttachment(i.id)},children:[e.jsx("span",{children:i.name}),e.jsx("small",{children:_(i.sizeBytes)})]},i.id):e.jsxs("div",{className:"community-attachment-placeholder",children:[e.jsx("span",{children:i.name}),e.jsxs("small",{children:["Join to view · ",_(i.sizeBytes)]})]},i.id))}):null]})]})}function je(s){return s.split(/\s+/).slice(0,2).map(n=>n[0]?.toUpperCase()??"").join("")||"?"}function pe(s){const n=new Date(s);return Number.isNaN(n.getTime())?"":n.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function _(s){return s<1024?`${s} B`:s<1024*1024?`${Math.round(s/1024)} KB`:`${(s/1024/1024).toFixed(1)} MB`}function ve(s){const[n,m]=l.useState(!1),a=l.useRef(null),y=l.useRef(s.onClose);l.useEffect(()=>m(!1),[s.rules.id]),l.useEffect(()=>{y.current=s.onClose},[s.onClose]),l.useEffect(()=>{const u=document.activeElement instanceof HTMLElement?document.activeElement:null,f=a.current,i=()=>[...f?.querySelectorAll('button:not([disabled]), input:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')??[]];i()[0]?.focus();const b=h=>{if(h.key==="Escape"){h.preventDefault(),y.current();return}if(h.key!=="Tab")return;const p=i();if(p.length===0){h.preventDefault(),f?.focus();return}const C=p[0],N=p.at(-1);h.shiftKey&&document.activeElement===C?(h.preventDefault(),N.focus()):!h.shiftKey&&document.activeElement===N&&(h.preventDefault(),C.focus())};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b),u?.focus()}},[]);const c=s.mode!=="review";return e.jsx("div",{className:"community-dialog-backdrop",role:"presentation",onMouseDown:s.onClose,children:e.jsxs("section",{ref:a,className:"community-rules-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"community-rules-title",tabIndex:-1,onMouseDown:u=>u.stopPropagation(),children:[e.jsxs("header",{children:[e.jsxs("div",{children:[e.jsxs("small",{children:["Community rules · version ",s.rules.version]}),e.jsx("h2",{id:"community-rules-title",children:s.rules.title})]}),e.jsx("button",{type:"button","aria-label":"Close rules",onClick:s.onClose,children:e.jsx(H,{size:16})})]}),e.jsx("div",{className:"community-rules-body",children:e.jsx(J,{content:s.rules.bodyMarkdown})}),e.jsxs("footer",{children:[c?e.jsxs("label",{className:"community-rules-acceptance",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:u=>m(u.currentTarget.checked)}),e.jsx("span",{children:"I have read and agree to follow these rules."})]}):e.jsx("span",{}),e.jsxs("div",{children:[e.jsx("button",{type:"button",className:"secondary",onClick:s.onClose,children:"Cancel"}),c?e.jsx("button",{type:"button",disabled:!n||s.busy,onClick:()=>{s.onAccept().then(u=>{u&&s.onClose()})},children:s.busy?"Saving…":s.mode==="join"?"Agree and join":"Accept updated rules"}):null]})]})]})})}function De({communities:s,chat:n,currentUserId:m}){M(s.discoveryError),M(s.previewError),M(s.membershipError?.message),M(n.channelsError,{prefix:"Channels"}),M(n.messagesError,{prefix:"Messages"}),M(n.actionError);const[a,y]=l.useState(null),[c,u]=l.useState(null),f=l.useRef(null),i=s.preview,b=i?.membership?.status==="active",h=!!i?.capabilities.requiresRulesAcceptance,p=l.useMemo(()=>new Map(n.members.map(o=>[o.userId,o])),[n.members]),C=l.useMemo(()=>new Map(n.messages.map(o=>[o.id,o])),[n.messages]),N=n.messages.at(-1)?.sequence??0;if(l.useEffect(()=>{const o=f.current;o&&(o.scrollTop=o.scrollHeight)},[n.selectedChannelId,N]),l.useEffect(()=>{u(null),h&&i?.currentRules&&y("reaccept")},[i?.currentRules,h]),!s.selectedSummary)return e.jsx("section",{className:"community-empty-page",children:e.jsxs("div",{className:"community-discovery-card",children:[e.jsx(F,{size:30}),e.jsx("h1",{children:"Discover communities"}),e.jsx("p",{children:s.discoveryLoading&&s.items.length===0?"Finding communities…":"Preview public conversations and join after accepting each community's rules."}),s.items.length>0?e.jsx("div",{className:"community-discovery-list",children:s.items.map(o=>e.jsxs("button",{type:"button",onClick:()=>s.selectCommunity(o.id),children:[e.jsx(Y,{name:o.displayName,imageUrl:o.imageUrl}),e.jsxs("span",{children:[e.jsx("strong",{children:o.displayName}),e.jsx("small",{children:o.description})]}),e.jsx("em",{children:o.membership?.status==="active"?"Joined":o.featuredAt?"Featured":`${o.memberCount.toLocaleString()} members`})]},o.id))}):s.discoveryLoading?null:e.jsx("div",{className:"community-state",children:"No public communities are available yet."}),e.jsxs("div",{className:"community-discovery-actions",children:[e.jsxs("button",{type:"button",onClick:()=>{s.refresh()},disabled:s.discoveryLoading,children:[e.jsx(O,{size:14})," Refresh"]}),s.nextCursor?e.jsx("button",{type:"button",className:"secondary",onClick:()=>{s.loadMore()},disabled:s.discoveryLoading,children:"Load more"}):null]})]})});if(!i&&s.previewLoading)return e.jsx("section",{className:"community-empty-page",children:e.jsxs("div",{className:"community-empty-card",children:[e.jsx("span",{className:"community-spinner"})," Loading community…"]})});if(!i)return e.jsx("section",{className:"community-empty-page",children:e.jsxs("div",{className:"community-empty-card",children:[e.jsx("h1",{children:s.selectedSummary.displayName}),e.jsx("div",{className:"community-state",children:"This community preview is unavailable."}),e.jsxs("button",{type:"button",onClick:()=>s.selectCommunity(s.selectedSummary.id),children:[e.jsx(O,{size:14})," Retry preview"]})]})});const v=i.currentRules;return e.jsxs("section",{className:"community-view",children:[e.jsxs("header",{className:"community-header",children:[e.jsxs("div",{className:"community-heading",children:[e.jsx(Y,{name:i.displayName,imageUrl:i.imageUrl}),e.jsxs("div",{children:[e.jsx("small",{children:i.displayName}),e.jsx("h1",{children:n.selectedChannel?`# ${n.selectedChannel.displayName}`:i.displayName}),e.jsx("p",{children:n.selectedChannel?.topic||i.description})]})]}),e.jsxs("div",{className:"community-header-actions",children:[e.jsxs("span",{className:"community-member-count",children:[e.jsx(F,{size:14})," ",i.memberCount.toLocaleString()]}),v?e.jsxs("button",{type:"button",className:"secondary",onClick:()=>y("review"),children:[e.jsx(Z,{size:14})," Rules"]}):null,b?e.jsx(Ce,{mode:i.membership?.notificationMode??"mentions",busy:s.membershipBusy,onMode:s.updateNotifications,onLeave:s.leave}):null]})]}),e.jsxs("div",{className:"community-chat-main conversation-surface-main",children:[e.jsxs("div",{className:"community-chat-notices",children:[b?h?e.jsxs("div",{className:"community-preview-banner warning",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"The rules have changed"}),e.jsx("span",{children:"Accept the current rules to continue reading live updates and posting."})]}),e.jsx("button",{type:"button",disabled:!v||s.membershipBusy,onClick:()=>y("reaccept"),children:"Review updated rules"})]}):null:e.jsxs("div",{className:"community-preview-banner",children:[e.jsxs("div",{children:[e.jsxs("strong",{children:["Previewing ",i.displayName]}),e.jsx("span",{children:"Read the public conversation, then accept the rules to join and post."})]}),e.jsx("button",{type:"button",disabled:!v||s.membershipBusy,onClick:()=>y("join"),children:"Join community"})]}),n.realtimeError&&b&&!h?e.jsxs("div",{className:"community-realtime-state",children:[e.jsx(ee,{size:14}),e.jsx("span",{children:"Live updates are reconnecting. Loaded messages are still available."})]}):null,n.lostMembership?e.jsx("div",{className:"community-state error",children:"Your membership changed. Refresh the community before continuing."}):null,n.channelsError?e.jsx("button",{type:"button",className:"community-state",onClick:()=>{n.loadChannels()},children:"Retry loading channels"}):null]}),e.jsxs("div",{className:"community-message-pane conversation-message-scroll",ref:f,role:"log","aria-live":"polite","aria-relevant":"additions text","aria-busy":n.messagesLoading,"aria-label":n.selectedChannel?`${i.displayName}, ${n.selectedChannel.displayName}`:i.displayName,tabIndex:0,children:[n.hasMoreBefore?e.jsx("button",{type:"button",className:"community-load-older",disabled:n.olderMessagesLoading,onClick:()=>{n.loadOlder()},children:n.olderMessagesLoading?"Loading…":"Load earlier messages"}):null,n.messagesLoading&&n.messages.length===0?e.jsx("div",{className:"community-message-state",children:"Loading messages…"}):null,n.messagesError?e.jsxs("div",{className:"community-message-state",children:["Messages are unavailable. ",e.jsx("button",{type:"button",onClick:()=>{n.loadMessages()},children:"Retry"})]}):null,!n.messagesLoading&&!n.messagesError&&n.messages.length===0?e.jsx("div",{className:"community-message-state",children:"No messages in this channel yet."}):null,n.messages.map(o=>e.jsx(be,{message:o,author:o.authorUserId?p.get(o.authorUserId)??null:null,own:o.authorUserId===m,attachmentsAccessible:!n.previewMode,membersById:p,messagesById:C,onReply:u,onEdit:n.editMessage,onDelete:n.deleteMessage,onDownloadAttachment:n.downloadAttachment},o.id))]}),b?e.jsxs("div",{className:"community-composer-wrap conversation-composer-shell",children:[n.failedSend?e.jsxs("div",{className:"community-failed-send",children:[e.jsx("span",{children:"Message not sent."}),e.jsx("button",{type:"button",disabled:n.sending,onClick:()=>{n.retrySend()},children:"Retry"}),e.jsx("button",{type:"button",onClick:n.dismissFailedSend,children:"Dismiss"})]}):null,e.jsx(ge,{members:n.members,replyTo:c,busy:n.sending,disabled:h||n.lostMembership||!n.selectedChannel||n.selectedChannel.postingPolicy==="admins"&&i.membership?.role==="member",onCancelReply:()=>u(null),onSearchMembers:n.searchMembers,onSend:n.sendMessage})]}):null]}),a&&v?e.jsx(ve,{rules:v,mode:a,busy:s.membershipBusy,onAccept:a==="join"?s.join:s.acceptRules,onClose:()=>y(null)}):null]})}function Ce(s){const[n,m]=l.useState(!1);return e.jsxs("div",{className:"community-membership-menu",children:[e.jsxs("button",{type:"button",className:"secondary","aria-expanded":n,onClick:()=>m(a=>!a),children:[s.mode==="none"?e.jsx(se,{size:14}):e.jsx(ne,{size:14})," Joined"]}),n?e.jsxs("div",{className:"community-membership-popover",children:[e.jsx("strong",{children:"Notifications"}),["mentions","all","none"].map(a=>e.jsxs("label",{children:[e.jsx("input",{type:"radio",name:"community-notifications",checked:s.mode===a,disabled:s.busy,onChange:()=>{s.onMode(a)}})," ",a==="mentions"?"Mentions":a==="all"?"All messages":"Nothing"]},a)),e.jsx("button",{type:"button",className:"danger",disabled:s.busy,onClick:()=>{window.confirm("Leave this community? You can join again later by accepting the current rules.")&&s.onLeave().then(a=>{a&&m(!1)})},children:"Leave community"})]}):null]})}function Y({name:s,imageUrl:n}){return n?e.jsx("img",{className:"community-icon",src:n,alt:""}):e.jsx("span",{className:"community-icon fallback",children:s.slice(0,2).toUpperCase()})}export{De as CommunityView};
|
|
1
|
+
import{r as l,j as e}from"./index-De4k_YMo.js";import{S as Z,W as ee,B as se,a as ne}from"./wifi-off-B_QPKtA-.js";import{R as O}from"./refresh-cw-D2E-pp4H.js";import{X as H,ar as te,aB as M,dT as F}from"./App-DQfdLgyV.js";import{k as ie,m as ae,P as le,n as oe,r as re,o as ce,R as de}from"./MainPane-Dv5USGqR.js";import{M as J}from"./MarkdownText-DWGLUbdE.js";import{T as me}from"./chat-file-links-DQYtkwit.js";import"./cloud-upload-DisZOwXE.js";import"./arrow-up-right-Dv3nebbh.js";import"./square-DUgXVoF0.js";import"./desktop-files-BQj1J-ob.js";const ue=2e4,R=10,he=12*1024*1024,ye=new Set(["image/png","image/jpeg","image/webp","image/gif"]);function ge(s){const[n,m]=l.useState(""),[a,y]=l.useState(0),[c,u]=l.useState([]),[f,i]=l.useState(null),[b,h]=l.useState(!1),[p,C]=l.useState([]),[N,v]=l.useState(0),[o,I]=l.useState(null),k=l.useRef(null),E=l.useRef(null),D=l.useRef(c);D.current=c;const g=l.useMemo(()=>xe(n,a),[n,a]),S=g?`${g.start}:${g.end}:${g.query}`:null,T=g?.query??null,w=l.useMemo(()=>{if(!g)return[];const t=new Map;for(const d of[...s.members,...p])t.set(d.userId,d);const r=g.query.toLowerCase();return[...t.values()].filter(d=>`${d.handle??""} ${d.name??""}`.toLowerCase().includes(r)).slice(0,8)},[g,s.members,p]),B=!!(g&&S!==o&&w.length>0),L=!!(s.disabled||s.busy||b),U=!L&&(!!n.trim()||c.length>0);l.useEffect(()=>{if(T==null){C([]);return}let t=!0;const r=window.setTimeout(()=>{s.onSearchMembers(T).then(d=>{t&&C(d)},()=>{t&&C([])})},150);return()=>{t=!1,window.clearTimeout(r)}},[T,s.onSearchMembers]),l.useEffect(()=>{v(0)},[S]),l.useEffect(()=>()=>K(D.current),[]);async function $(t){if(t?.preventDefault(),!!U){i(null),h(!0);try{const r=await Promise.all(c.map(re));if(!await s.onSend({body:n,mentionUserIds:fe(n,s.members),attachments:r,replyToMessageId:s.replyTo?.id??null}))return;K(c),m(""),y(0),u([]),s.onCancelReply()}catch(r){i(r instanceof Error?r.message:String(r))}finally{h(!1)}}}function V(t){if(B){if(t.key==="ArrowDown"){t.preventDefault(),v(r=>(r+1)%w.length);return}if(t.key==="ArrowUp"){t.preventDefault(),v(r=>(r-1+w.length)%w.length);return}if(t.key==="Enter"||t.key==="Tab"){t.preventDefault(),z(w[N]??w[0]);return}if(t.key==="Escape"){t.preventDefault(),I(S);return}}t.key!=="Enter"||t.shiftKey||t.nativeEvent.isComposing||(t.preventDefault(),$())}function G(t){if(!t)return;i(null);const r=Math.max(0,R-c.length);if(r===0){i(`You can attach up to ${R} images.`),A();return}const d=[...t],j=d.slice(0,r),P=j.find(x=>!ye.has(x.type)),q=j.find(x=>x.size<=0||x.size>he);if(P){i(`${P.name} is not a supported image type.`),A();return}if(q){i(`${q.name} must be smaller than 12 MB.`),A();return}const Q=j.map(x=>({id:ce(),file:x,name:x.name,mediaType:x.type,sizeBytes:x.size,kind:"image",previewUrl:URL.createObjectURL(x)}));u(x=>[...x,...Q]),d.length>r&&i(`Only ${R} images can be attached to one message.`),A()}function W(t){u(r=>{const d=r.find(j=>j.id===t);return d?.previewUrl&&URL.revokeObjectURL(d.previewUrl),r.filter(j=>j.id!==t)})}function A(){k.current&&(k.current.value="")}function z(t){if(!g)return;const r=`@${X(t)} `,d=`${n.slice(0,g.start)}${r}${n.slice(g.end)}`,j=g.start+r.length;m(d),y(j),I(null),window.requestAnimationFrame(()=>E.current?.focusAtPromptIndex(j))}return e.jsxs("form",{className:`composer dock community-composer${c.length>0?" has-attachments":""}${f?" has-attachment-error":""}`,onSubmit:$,children:[s.replyTo?e.jsxs("div",{className:"community-composer-reply",children:[e.jsxs("span",{children:[e.jsx("strong",{children:"Replying to"}),s.replyTo.body.slice(0,100)||"message"]}),e.jsx("button",{type:"button","aria-label":"Cancel reply",onClick:s.onCancelReply,children:e.jsx(H,{size:13})})]}):null,B?e.jsx("div",{className:"community-mention-menu",role:"listbox","aria-label":"Community members",children:w.map((t,r)=>e.jsxs("button",{type:"button",role:"option","aria-selected":r===N,onMouseDown:d=>d.preventDefault(),onClick:()=>z(t),children:[e.jsx("strong",{children:t.name??t.handle??"Community member"}),t.handle?e.jsxs("small",{children:["@",t.handle]}):null]},t.userId))}):null,e.jsxs("div",{className:"composer-input-shell",children:[c.length>0?e.jsx("div",{className:"composer-attachments","aria-label":"Selected attachments",children:c.map(t=>e.jsx(ie,{attachment:t,onRemove:()=>W(t.id)},t.id))}):null,f?e.jsx("div",{className:"composer-attachment-error",role:"status",children:f}):null,e.jsx("div",{className:"composer-textarea-frame",onClick:t=>{t.target===t.currentTarget&&E.current?.focusAtPromptIndex(a)},children:e.jsx(ae,{ref:E,disabled:L,onCursorChange:y,onKeyDown:V,onPromptChange:(t,r)=>{const d=t.slice(0,ue);m(d),y(Math.min(r,d.length))},onTokenPositionChange:()=>{},placeholder:s.disabled?"Accept the community rules to post":"Message community",prompt:n,token:null})}),e.jsxs("div",{className:"composer-primary-controls team-chat-composer-controls",children:[e.jsx("input",{ref:k,className:"composer-file-input",hidden:!0,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",multiple:!0,onChange:t=>G(t.currentTarget.files)}),e.jsx("button",{type:"button",className:"composer-icon","aria-label":"Attach images",disabled:L||c.length>=R,onClick:()=>k.current?.click(),children:e.jsx(le,{size:17})}),e.jsx("div",{className:"composer-spacer"}),e.jsx("button",{type:"submit",className:"send-button","aria-label":"Send message",disabled:!U,children:e.jsx(oe,{size:17})})]})]})]})}function xe(s,n=s.length){const m=Math.max(0,Math.min(n,s.length)),a=/(?:^|\s)@([\w-]*)$/.exec(s.slice(0,m));return!a||a.index==null?null:{start:a.index+a[0].indexOf("@"),end:m,query:a[1]??""}}function fe(s,n){const m=new Set([...s.matchAll(/(?:^|\s)@([\w-]+)/g)].map(a=>a[1]?.toLowerCase()));return n.filter(a=>m.has(X(a).toLowerCase())).map(a=>a.userId)}function X(s){return s.handle??s.name?.replace(/[^\w-]/g,"")??s.userId}function K(s){for(const n of s)n.previewUrl&&URL.revokeObjectURL(n.previewUrl)}function be(s){const[n,m]=l.useState(!1),[a,y]=l.useState(s.message.body),c=s.message.refs.find(i=>i.refType==="message_reply"),u=c?s.messagesById.get(c.refId)??null:null,f=u?.authorUserId?s.membersById.get(u.authorUserId)??null:null;return e.jsxs("article",{className:`community-message${s.own?" own":""}`,id:`community-message-${s.message.id}`,children:[e.jsx("div",{className:"community-avatar",children:je(s.author?.name??s.author?.handle??"?")}),e.jsxs("div",{className:"community-message-content",children:[e.jsxs("header",{children:[e.jsx("strong",{children:s.author?.name??s.author?.handle??"Community member"}),e.jsx("time",{dateTime:s.message.createdAt,children:pe(s.message.createdAt)}),s.message.editedAt?e.jsx("span",{children:"edited"}):null,s.message.deletedAt?null:e.jsxs("div",{className:"community-message-actions",children:[e.jsx("button",{type:"button","aria-label":"Reply",onClick:()=>s.onReply(s.message),children:e.jsx(de,{size:13})}),s.own?e.jsx("button",{type:"button","aria-label":"Edit",onClick:()=>m(!0),children:e.jsx(te,{size:13})}):null,s.own?e.jsx("button",{type:"button","aria-label":"Delete",onClick:()=>{s.onDelete(s.message.id)},children:e.jsx(me,{size:13})}):null]})]}),c?e.jsxs("button",{type:"button",className:"community-reply-quote",onClick:()=>document.getElementById(`community-message-${c.refId}`)?.scrollIntoView({behavior:"smooth",block:"center"}),children:[e.jsx("strong",{children:f?.name??"Community member"}),e.jsx("span",{children:u?.deletedAt?"Message deleted":u?.body??String(c.preview.body??"Earlier message")})]}):null,n?e.jsxs("form",{className:"community-message-edit",onSubmit:i=>{i.preventDefault(),s.onEdit(s.message.id,a).then(b=>{b&&m(!1)})},children:[e.jsx("textarea",{autoFocus:!0,value:a,onChange:i=>y(i.currentTarget.value)}),e.jsxs("div",{children:[e.jsx("button",{type:"button",onClick:()=>m(!1),children:"Cancel"}),e.jsx("button",{type:"submit",disabled:!a.trim(),children:"Save"})]})]}):s.message.deletedAt?e.jsx("div",{className:"community-message-deleted",children:"Message deleted"}):e.jsx(J,{content:s.message.body}),!s.message.deletedAt&&s.message.attachments.length>0?e.jsx("div",{className:"community-message-attachments",children:s.message.attachments.map(i=>s.attachmentsAccessible?e.jsxs("button",{type:"button",onClick:()=>{s.onDownloadAttachment(i.id)},children:[e.jsx("span",{children:i.name}),e.jsx("small",{children:_(i.sizeBytes)})]},i.id):e.jsxs("div",{className:"community-attachment-placeholder",children:[e.jsx("span",{children:i.name}),e.jsxs("small",{children:["Join to view · ",_(i.sizeBytes)]})]},i.id))}):null]})]})}function je(s){return s.split(/\s+/).slice(0,2).map(n=>n[0]?.toUpperCase()??"").join("")||"?"}function pe(s){const n=new Date(s);return Number.isNaN(n.getTime())?"":n.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function _(s){return s<1024?`${s} B`:s<1024*1024?`${Math.round(s/1024)} KB`:`${(s/1024/1024).toFixed(1)} MB`}function ve(s){const[n,m]=l.useState(!1),a=l.useRef(null),y=l.useRef(s.onClose);l.useEffect(()=>m(!1),[s.rules.id]),l.useEffect(()=>{y.current=s.onClose},[s.onClose]),l.useEffect(()=>{const u=document.activeElement instanceof HTMLElement?document.activeElement:null,f=a.current,i=()=>[...f?.querySelectorAll('button:not([disabled]), input:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')??[]];i()[0]?.focus();const b=h=>{if(h.key==="Escape"){h.preventDefault(),y.current();return}if(h.key!=="Tab")return;const p=i();if(p.length===0){h.preventDefault(),f?.focus();return}const C=p[0],N=p.at(-1);h.shiftKey&&document.activeElement===C?(h.preventDefault(),N.focus()):!h.shiftKey&&document.activeElement===N&&(h.preventDefault(),C.focus())};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b),u?.focus()}},[]);const c=s.mode!=="review";return e.jsx("div",{className:"community-dialog-backdrop",role:"presentation",onMouseDown:s.onClose,children:e.jsxs("section",{ref:a,className:"community-rules-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"community-rules-title",tabIndex:-1,onMouseDown:u=>u.stopPropagation(),children:[e.jsxs("header",{children:[e.jsxs("div",{children:[e.jsxs("small",{children:["Community rules · version ",s.rules.version]}),e.jsx("h2",{id:"community-rules-title",children:s.rules.title})]}),e.jsx("button",{type:"button","aria-label":"Close rules",onClick:s.onClose,children:e.jsx(H,{size:16})})]}),e.jsx("div",{className:"community-rules-body",children:e.jsx(J,{content:s.rules.bodyMarkdown})}),e.jsxs("footer",{children:[c?e.jsxs("label",{className:"community-rules-acceptance",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:u=>m(u.currentTarget.checked)}),e.jsx("span",{children:"I have read and agree to follow these rules."})]}):e.jsx("span",{}),e.jsxs("div",{children:[e.jsx("button",{type:"button",className:"secondary",onClick:s.onClose,children:"Cancel"}),c?e.jsx("button",{type:"button",disabled:!n||s.busy,onClick:()=>{s.onAccept().then(u=>{u&&s.onClose()})},children:s.busy?"Saving…":s.mode==="join"?"Agree and join":"Accept updated rules"}):null]})]})]})})}function De({communities:s,chat:n,currentUserId:m}){M(s.discoveryError),M(s.previewError),M(s.membershipError?.message),M(n.channelsError,{prefix:"Channels"}),M(n.messagesError,{prefix:"Messages"}),M(n.actionError);const[a,y]=l.useState(null),[c,u]=l.useState(null),f=l.useRef(null),i=s.preview,b=i?.membership?.status==="active",h=!!i?.capabilities.requiresRulesAcceptance,p=l.useMemo(()=>new Map(n.members.map(o=>[o.userId,o])),[n.members]),C=l.useMemo(()=>new Map(n.messages.map(o=>[o.id,o])),[n.messages]),N=n.messages.at(-1)?.sequence??0;if(l.useEffect(()=>{const o=f.current;o&&(o.scrollTop=o.scrollHeight)},[n.selectedChannelId,N]),l.useEffect(()=>{u(null),h&&i?.currentRules&&y("reaccept")},[i?.currentRules,h]),!s.selectedSummary)return e.jsx("section",{className:"community-empty-page",children:e.jsxs("div",{className:"community-discovery-card",children:[e.jsx(F,{size:30}),e.jsx("h1",{children:"Discover communities"}),e.jsx("p",{children:s.discoveryLoading&&s.items.length===0?"Finding communities…":"Preview public conversations and join after accepting each community's rules."}),s.items.length>0?e.jsx("div",{className:"community-discovery-list",children:s.items.map(o=>e.jsxs("button",{type:"button",onClick:()=>s.selectCommunity(o.id),children:[e.jsx(Y,{name:o.displayName,imageUrl:o.imageUrl}),e.jsxs("span",{children:[e.jsx("strong",{children:o.displayName}),e.jsx("small",{children:o.description})]}),e.jsx("em",{children:o.membership?.status==="active"?"Joined":o.featuredAt?"Featured":`${o.memberCount.toLocaleString()} members`})]},o.id))}):s.discoveryLoading?null:e.jsx("div",{className:"community-state",children:"No public communities are available yet."}),e.jsxs("div",{className:"community-discovery-actions",children:[e.jsxs("button",{type:"button",onClick:()=>{s.refresh()},disabled:s.discoveryLoading,children:[e.jsx(O,{size:14})," Refresh"]}),s.nextCursor?e.jsx("button",{type:"button",className:"secondary",onClick:()=>{s.loadMore()},disabled:s.discoveryLoading,children:"Load more"}):null]})]})});if(!i&&s.previewLoading)return e.jsx("section",{className:"community-empty-page",children:e.jsxs("div",{className:"community-empty-card",children:[e.jsx("span",{className:"community-spinner"})," Loading community…"]})});if(!i)return e.jsx("section",{className:"community-empty-page",children:e.jsxs("div",{className:"community-empty-card",children:[e.jsx("h1",{children:s.selectedSummary.displayName}),e.jsx("div",{className:"community-state",children:"This community preview is unavailable."}),e.jsxs("button",{type:"button",onClick:()=>s.selectCommunity(s.selectedSummary.id),children:[e.jsx(O,{size:14})," Retry preview"]})]})});const v=i.currentRules;return e.jsxs("section",{className:"community-view",children:[e.jsxs("header",{className:"community-header",children:[e.jsxs("div",{className:"community-heading",children:[e.jsx(Y,{name:i.displayName,imageUrl:i.imageUrl}),e.jsxs("div",{children:[e.jsx("small",{children:i.displayName}),e.jsx("h1",{children:n.selectedChannel?`# ${n.selectedChannel.displayName}`:i.displayName}),e.jsx("p",{children:n.selectedChannel?.topic||i.description})]})]}),e.jsxs("div",{className:"community-header-actions",children:[e.jsxs("span",{className:"community-member-count",children:[e.jsx(F,{size:14})," ",i.memberCount.toLocaleString()]}),v?e.jsxs("button",{type:"button",className:"secondary",onClick:()=>y("review"),children:[e.jsx(Z,{size:14})," Rules"]}):null,b?e.jsx(Ce,{mode:i.membership?.notificationMode??"mentions",busy:s.membershipBusy,onMode:s.updateNotifications,onLeave:s.leave}):null]})]}),e.jsxs("div",{className:"community-chat-main conversation-surface-main",children:[e.jsxs("div",{className:"community-chat-notices",children:[b?h?e.jsxs("div",{className:"community-preview-banner warning",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"The rules have changed"}),e.jsx("span",{children:"Accept the current rules to continue reading live updates and posting."})]}),e.jsx("button",{type:"button",disabled:!v||s.membershipBusy,onClick:()=>y("reaccept"),children:"Review updated rules"})]}):null:e.jsxs("div",{className:"community-preview-banner",children:[e.jsxs("div",{children:[e.jsxs("strong",{children:["Previewing ",i.displayName]}),e.jsx("span",{children:"Read the public conversation, then accept the rules to join and post."})]}),e.jsx("button",{type:"button",disabled:!v||s.membershipBusy,onClick:()=>y("join"),children:"Join community"})]}),n.realtimeError&&b&&!h?e.jsxs("div",{className:"community-realtime-state",children:[e.jsx(ee,{size:14}),e.jsx("span",{children:"Live updates are reconnecting. Loaded messages are still available."})]}):null,n.lostMembership?e.jsx("div",{className:"community-state error",children:"Your membership changed. Refresh the community before continuing."}):null,n.channelsError?e.jsx("button",{type:"button",className:"community-state",onClick:()=>{n.loadChannels()},children:"Retry loading channels"}):null]}),e.jsxs("div",{className:"community-message-pane conversation-message-scroll",ref:f,role:"log","aria-live":"polite","aria-relevant":"additions text","aria-busy":n.messagesLoading,"aria-label":n.selectedChannel?`${i.displayName}, ${n.selectedChannel.displayName}`:i.displayName,tabIndex:0,children:[n.hasMoreBefore?e.jsx("button",{type:"button",className:"community-load-older",disabled:n.olderMessagesLoading,onClick:()=>{n.loadOlder()},children:n.olderMessagesLoading?"Loading…":"Load earlier messages"}):null,n.messagesLoading&&n.messages.length===0?e.jsx("div",{className:"community-message-state",children:"Loading messages…"}):null,n.messagesError?e.jsxs("div",{className:"community-message-state",children:["Messages are unavailable. ",e.jsx("button",{type:"button",onClick:()=>{n.loadMessages()},children:"Retry"})]}):null,!n.messagesLoading&&!n.messagesError&&n.messages.length===0?e.jsx("div",{className:"community-message-state",children:"No messages in this channel yet."}):null,n.messages.map(o=>e.jsx(be,{message:o,author:o.authorUserId?p.get(o.authorUserId)??null:null,own:o.authorUserId===m,attachmentsAccessible:!n.previewMode,membersById:p,messagesById:C,onReply:u,onEdit:n.editMessage,onDelete:n.deleteMessage,onDownloadAttachment:n.downloadAttachment},o.id))]}),b?e.jsxs("div",{className:"community-composer-wrap conversation-composer-shell",children:[n.failedSend?e.jsxs("div",{className:"community-failed-send",children:[e.jsx("span",{children:"Message not sent."}),e.jsx("button",{type:"button",disabled:n.sending,onClick:()=>{n.retrySend()},children:"Retry"}),e.jsx("button",{type:"button",onClick:n.dismissFailedSend,children:"Dismiss"})]}):null,e.jsx(ge,{members:n.members,replyTo:c,busy:n.sending,disabled:h||n.lostMembership||!n.selectedChannel||n.selectedChannel.postingPolicy==="admins"&&i.membership?.role==="member",onCancelReply:()=>u(null),onSearchMembers:n.searchMembers,onSend:n.sendMessage})]}):null]}),a&&v?e.jsx(ve,{rules:v,mode:a,busy:s.membershipBusy,onAccept:a==="join"?s.join:s.acceptRules,onClose:()=>y(null)}):null]})}function Ce(s){const[n,m]=l.useState(!1);return e.jsxs("div",{className:"community-membership-menu",children:[e.jsxs("button",{type:"button",className:"secondary","aria-expanded":n,onClick:()=>m(a=>!a),children:[s.mode==="none"?e.jsx(se,{size:14}):e.jsx(ne,{size:14})," Joined"]}),n?e.jsxs("div",{className:"community-membership-popover",children:[e.jsx("strong",{children:"Notifications"}),["mentions","all","none"].map(a=>e.jsxs("label",{children:[e.jsx("input",{type:"radio",name:"community-notifications",checked:s.mode===a,disabled:s.busy,onChange:()=>{s.onMode(a)}})," ",a==="mentions"?"Mentions":a==="all"?"All messages":"Nothing"]},a)),e.jsx("button",{type:"button",className:"danger",disabled:s.busy,onClick:()=>{window.confirm("Leave this community? You can join again later by accepting the current rules.")&&s.onLeave().then(a=>{a&&m(!1)})},children:"Leave community"})]}):null]})}function Y({name:s,imageUrl:n}){return n?e.jsx("img",{className:"community-icon",src:n,alt:""}):e.jsx("span",{className:"community-icon fallback",children:s.slice(0,2).toUpperCase()})}export{De as CommunityView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,j as e}from"./index-B5RqBp_p.js";import{aO as _,dK as A,aX as P,m as x,X as j,h as y,bm as w}from"./App-kwt-UxX_.js";import{P as q}from"./chat-file-links-C3erG0P2.js";import{P as C}from"./play-DsP3gpGK.js";import{R as k}from"./refresh-cw-DaASy_i0.js";function U({runtime:s}){const[a,i]=v.useState(!1),[o,l]=v.useState(""),[n,u]=v.useState(null),t=s.run,h=t.plan,g=N(t),c={run:t},f=E(t.state),r=S(t),R=r?.git?.pullRequest??t.releaseOutcome.pullRequest;v.useEffect(()=>{i(!1),l(""),u(null)},[t.id,t.revision,t.state,h?.id,g?.id]);async function d(p,b){if(!(!b||n)){u(p);try{await b()}finally{u(null)}}}return e.jsxs("section",{className:`composer-create-strip ${f}`,"aria-label":"Create or improve status",children:[e.jsxs("div",{className:"composer-create-strip-heading",children:[f==="danger"?e.jsx(_,{size:15}):t.state==="awaiting_questions"?e.jsx(A,{size:15}):I(t.state)?e.jsx(P,{className:"composer-create-spin",size:15}):e.jsx(x,{size:15}),e.jsx("span",{children:z(t)}),e.jsx("small",{children:t.target.kind})]}),t.state==="awaiting_questions"&&g?e.jsxs("div",{className:"composer-create-question",children:[e.jsx("p",{children:g.prompt}),e.jsx("div",{className:"composer-create-options",children:g.options.map(p=>e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d(`answer:${p.id}`,()=>s.onAnswerQuestion?s.onAnswerQuestion(c,g.id,p.value):Promise.resolve())},children:[e.jsx("span",{children:n===`answer:${p.id}`?"Saving":p.label}),p.description?e.jsx("small",{children:p.description}):null]},p.id))})]}):t.state==="awaiting_plan_approval"&&h?e.jsxs("div",{className:"composer-create-plan-summary",children:[e.jsx("p",{children:h.summary}),e.jsx(m,{run:t}),a?e.jsxs("div",{className:"composer-create-revision",children:[e.jsx("textarea",{rows:2,value:o,placeholder:"Describe the plan revision",onChange:p=>l(p.currentTarget.value)}),e.jsxs("div",{children:[e.jsxs("button",{type:"button",disabled:!o.trim()||!!n,onClick:()=>{d("revise",()=>s.onRevise?s.onRevise(c,o):Promise.resolve())},children:[e.jsx(x,{size:13}),e.jsx("span",{children:n==="revise"?"Saving":"Save revision"})]}),e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>i(!1),children:[e.jsx(j,{size:13}),e.jsx("span",{children:"Close"})]})]})]}):e.jsxs("div",{className:"composer-create-actions",children:[e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("approve",()=>s.onApprove?s.onApprove(c):Promise.resolve())},children:[e.jsx(y,{size:13}),e.jsx("span",{children:n==="approve"?"Confirming":"Confirm plan"})]}),e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>i(!0),children:[e.jsx(x,{size:13}),e.jsx("span",{children:"Edit plan"})]}),e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("cancel",()=>s.onCancel?s.onCancel(c):Promise.resolve())},children:[e.jsx(j,{size:13}),e.jsx("span",{children:n==="cancel"?"Cancelling":"Cancel"})]})]})]}):t.state==="paused"?e.jsxs("div",{className:"composer-create-status-body",children:[e.jsx("p",{children:"This work is paused. Resume it when you are ready to continue."}),e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("resume",()=>s.onResume?s.onResume(c):Promise.resolve())},children:[e.jsx(C,{size:13}),e.jsx("span",{children:n==="resume"?"Resuming":"Resume"})]})]}):t.state==="awaiting_promotion"&&r?e.jsxs("div",{className:"composer-create-status-body",children:[e.jsx("p",{children:T(t,r.id)}),e.jsxs("div",{className:"composer-create-actions",children:[e.jsxs("button",{type:"button",disabled:!!n||!$(t,r.id),onClick:()=>{d("apply-candidate",()=>s.onApplyCandidate?s.onApplyCandidate(c,r.id):Promise.resolve())},children:[e.jsx(y,{size:13}),e.jsx("span",{children:n==="apply-candidate"?"Applying":"Apply update"})]}),e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("reject-candidate",()=>s.onRejectCandidate?s.onRejectCandidate(c,r.id):Promise.resolve())},children:[e.jsx(j,{size:13}),e.jsx("span",{children:n==="reject-candidate"?"Keeping current version":"Keep current version"})]})]})]}):t.state==="pull_request_open"&&r&&R?e.jsxs("div",{className:"composer-create-status-body",children:[e.jsx("p",{children:t.target.kind==="agent"?"An Agent update review is open. Finish or close it, then refresh its status.":"An external review is open. Merge or close it, then refresh its status."}),e.jsxs("div",{className:"composer-create-actions",children:[e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("reconcile-pr",()=>s.onReconcilePullRequest?s.onReconcilePullRequest(c,r.id):Promise.resolve())},children:[e.jsx(k,{size:13}),e.jsx("span",{children:n==="reconcile-pr"?"Checking":"Refresh review"})]}),e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("reject-candidate",()=>s.onRejectCandidate?s.onRejectCandidate(c,r.id):Promise.resolve())},children:[e.jsx(j,{size:13}),e.jsx("span",{children:n==="reject-candidate"?"Closing":"Close review"})]})]})]}):t.state==="blocked"||t.state==="failed"||t.state==="cancelled"?e.jsxs("div",{className:"composer-create-status-body",children:[e.jsx("p",{children:t.blockedReason??"This work stopped before it was ready."}),t.state==="blocked"&&r?.git?.worktreePath&&["draft","checking"].includes(r.status)?e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("resume",()=>s.onResume?s.onResume(c):Promise.resolve())},children:[e.jsx(C,{size:13}),e.jsx("span",{children:n==="resume"?"Continuing":"Continue update"})]}):t.state==="blocked"&&r?.git?.pullRequest?.state==="merged"?e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("reconcile-pr",()=>s.onReconcilePullRequest?s.onReconcilePullRequest(c,r.id):Promise.resolve())},children:[e.jsx(k,{size:13}),e.jsx("span",{children:n==="reconcile-pr"?"Checking":"Re-run verification"})]}):null]}):t.state==="released"||t.state==="rejected"||t.state==="ready_local"||t.state==="ready"||t.state==="published_hosted"?e.jsxs("div",{className:"composer-create-status-body composer-create-status-body-reveals",children:[e.jsx("p",{children:t.state==="released"?"The Agent update is saved and its Evals passed.":t.state==="rejected"?"The Agent update was not applied.":t.state==="published_hosted"?"Published to the hosted Profile.":"The Agent and its actions are ready to use."}),e.jsx("div",{className:"composer-create-hover-details",children:e.jsx(m,{run:t})})]}):e.jsxs("div",{className:"composer-create-status-body",children:[e.jsx("p",{children:B(t)}),e.jsx(m,{run:t}),t.executionPolicy.pauseAllowed&&s.onPause?e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("pause",()=>s.onPause?.(c)??Promise.resolve())},children:[e.jsx(q,{size:13}),e.jsx("span",{children:n==="pause"?"Pausing":"Pause"})]}):null]})]})}function N(s){return s.questions.find(a=>a.status==="pending"&&a.required)??s.questions.find(a=>a.status==="pending")??null}function m({run:s}){const a=s.plan,i=s.target.kind==="agent",o=i?null:s.sourceRefs[0]??a?.sourcePlan[0]?.path??null,l=s.checkRefs.length||a?.checks.length||0,n=i?0:a?.requirements.length??0,u=i?[]:[...s.sourceRefs,...s.checkRefs].slice(0,4),t=w(a?.metadata);return!o&&l===0&&n===0&&u.length===0&&!t?null:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"composer-create-facts",children:[t?e.jsx("span",{title:t.detail,children:t.label}):null,o?e.jsx("span",{title:o,children:o}):null,l?e.jsx("span",{children:i?`${l} Evals`:s.checkRefs.length?`${s.checkRefs.length} check refs`:`${l} checks`}):null,n?e.jsxs("span",{children:[n," setup rows"]}):null]}),u.length?e.jsx("ul",{className:"composer-create-refs","aria-label":"Source and check refs",children:u.map(h=>e.jsx("li",{children:e.jsx("code",{title:h,children:h})},h))}):null]})}function z(s){const a=s.target.kind==="agent";return s.state==="awaiting_questions"?"Question":s.state==="awaiting_plan_approval"?"Plan":s.state==="applying_source"?a?"Saving Agent":"Applying source":s.state==="running_checks"?"Running Evals":s.state==="evaluating"?a?"Checking Agent":"Evaluating":s.state==="awaiting_promotion"?a?"Update ready":"Candidate ready":s.state==="opening_pull_request"?"Opening review":s.state==="pull_request_open"?"Review open":s.state==="reconciling_release"?a?"Applying update":"Merging change":s.state==="released"?a?"Agent updated":"Released":s.state==="rejected"?a?"Current Agent kept":"Rejected":s.state==="paused"?"Paused":s.state==="ready"||s.state==="ready_local"?"Ready":s.state==="published_hosted"?"Published":s.state==="cancelled"?"Cancelled":s.state==="blocked"?"Blocked":s.state==="failed"?"Failed":s.operation==="improve"?"Improve":"Create"}function B(s){const a=s.state,i=s.target.kind==="agent";return a==="applying_source"?i?"Saving the approved Agent plan.":"Applying the approved source changes.":a==="running_checks"?i?"Running Evals against the Agent.":"Running checks against the candidate.":a==="evaluating"?i?"Checking the Agent's behavior.":"Evaluating the candidate against its Evals.":a==="opening_pull_request"?i?"Preparing the Agent update review.":"Opening the candidate review.":a==="reconciling_release"?"Applying the change and verifying the active Profile.":a==="pushing_hosted"?"Pushing the Profile source.":a==="running_hosted_checks"?i?"Running hosted Evals.":"Running hosted checks.":"Preparing the work."}function E(s){return["released","ready","ready_local","published_hosted"].includes(s)?"success":["rejected","blocked","failed","cancelled"].includes(s)?"danger":["awaiting_questions","awaiting_plan_approval","awaiting_promotion","pull_request_open","paused"].includes(s)?"warning":"info"}function I(s){return["planning","applying_source","running_checks","evaluating","opening_pull_request","reconciling_release","pushing_hosted","running_hosted_checks"].includes(s)}function S(s){return[...s.candidates].reverse().find(a=>a.target.kind==="agent")??null}function $(s,a){const i=s.evaluationReceipts.filter(o=>o.candidateId===a&&o.subject==="candidate");return i.length>0&&i.every(o=>o.status==="passed"&&o.publishGate!=="failed")}function T(s,a){const i=s.evaluationReceipts.find(n=>n.candidateId===a&&n.subject==="active"),o=s.evaluationReceipts.find(n=>n.candidateId===a&&n.subject==="candidate"),l=n=>n?.summaryCounts?`${n.summaryCounts.passed}/${n.summaryCounts.total}`:n?.status??"not run";return s.target.kind==="agent"?`Current Agent: ${l(i)} Evals passed. Updated Agent: ${l(o)} Evals passed.`:`Base Evals: ${l(i)} passed. Candidate Evals: ${l(o)} passed.`}export{U as ComposerCreateImproveStrip};
|
|
1
|
+
import{r as v,j as e}from"./index-De4k_YMo.js";import{aO as _,dK as A,aX as P,m as x,X as j,h as y,bm as w}from"./App-DQfdLgyV.js";import{P as q}from"./chat-file-links-DQYtkwit.js";import{P as C}from"./play-B5O4Hz_W.js";import{R as k}from"./refresh-cw-D2E-pp4H.js";function U({runtime:s}){const[a,i]=v.useState(!1),[o,l]=v.useState(""),[n,u]=v.useState(null),t=s.run,h=t.plan,g=N(t),c={run:t},f=E(t.state),r=S(t),R=r?.git?.pullRequest??t.releaseOutcome.pullRequest;v.useEffect(()=>{i(!1),l(""),u(null)},[t.id,t.revision,t.state,h?.id,g?.id]);async function d(p,b){if(!(!b||n)){u(p);try{await b()}finally{u(null)}}}return e.jsxs("section",{className:`composer-create-strip ${f}`,"aria-label":"Create or improve status",children:[e.jsxs("div",{className:"composer-create-strip-heading",children:[f==="danger"?e.jsx(_,{size:15}):t.state==="awaiting_questions"?e.jsx(A,{size:15}):I(t.state)?e.jsx(P,{className:"composer-create-spin",size:15}):e.jsx(x,{size:15}),e.jsx("span",{children:z(t)}),e.jsx("small",{children:t.target.kind})]}),t.state==="awaiting_questions"&&g?e.jsxs("div",{className:"composer-create-question",children:[e.jsx("p",{children:g.prompt}),e.jsx("div",{className:"composer-create-options",children:g.options.map(p=>e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d(`answer:${p.id}`,()=>s.onAnswerQuestion?s.onAnswerQuestion(c,g.id,p.value):Promise.resolve())},children:[e.jsx("span",{children:n===`answer:${p.id}`?"Saving":p.label}),p.description?e.jsx("small",{children:p.description}):null]},p.id))})]}):t.state==="awaiting_plan_approval"&&h?e.jsxs("div",{className:"composer-create-plan-summary",children:[e.jsx("p",{children:h.summary}),e.jsx(m,{run:t}),a?e.jsxs("div",{className:"composer-create-revision",children:[e.jsx("textarea",{rows:2,value:o,placeholder:"Describe the plan revision",onChange:p=>l(p.currentTarget.value)}),e.jsxs("div",{children:[e.jsxs("button",{type:"button",disabled:!o.trim()||!!n,onClick:()=>{d("revise",()=>s.onRevise?s.onRevise(c,o):Promise.resolve())},children:[e.jsx(x,{size:13}),e.jsx("span",{children:n==="revise"?"Saving":"Save revision"})]}),e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>i(!1),children:[e.jsx(j,{size:13}),e.jsx("span",{children:"Close"})]})]})]}):e.jsxs("div",{className:"composer-create-actions",children:[e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("approve",()=>s.onApprove?s.onApprove(c):Promise.resolve())},children:[e.jsx(y,{size:13}),e.jsx("span",{children:n==="approve"?"Confirming":"Confirm plan"})]}),e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>i(!0),children:[e.jsx(x,{size:13}),e.jsx("span",{children:"Edit plan"})]}),e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("cancel",()=>s.onCancel?s.onCancel(c):Promise.resolve())},children:[e.jsx(j,{size:13}),e.jsx("span",{children:n==="cancel"?"Cancelling":"Cancel"})]})]})]}):t.state==="paused"?e.jsxs("div",{className:"composer-create-status-body",children:[e.jsx("p",{children:"This work is paused. Resume it when you are ready to continue."}),e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("resume",()=>s.onResume?s.onResume(c):Promise.resolve())},children:[e.jsx(C,{size:13}),e.jsx("span",{children:n==="resume"?"Resuming":"Resume"})]})]}):t.state==="awaiting_promotion"&&r?e.jsxs("div",{className:"composer-create-status-body",children:[e.jsx("p",{children:T(t,r.id)}),e.jsxs("div",{className:"composer-create-actions",children:[e.jsxs("button",{type:"button",disabled:!!n||!$(t,r.id),onClick:()=>{d("apply-candidate",()=>s.onApplyCandidate?s.onApplyCandidate(c,r.id):Promise.resolve())},children:[e.jsx(y,{size:13}),e.jsx("span",{children:n==="apply-candidate"?"Applying":"Apply update"})]}),e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("reject-candidate",()=>s.onRejectCandidate?s.onRejectCandidate(c,r.id):Promise.resolve())},children:[e.jsx(j,{size:13}),e.jsx("span",{children:n==="reject-candidate"?"Keeping current version":"Keep current version"})]})]})]}):t.state==="pull_request_open"&&r&&R?e.jsxs("div",{className:"composer-create-status-body",children:[e.jsx("p",{children:t.target.kind==="agent"?"An Agent update review is open. Finish or close it, then refresh its status.":"An external review is open. Merge or close it, then refresh its status."}),e.jsxs("div",{className:"composer-create-actions",children:[e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("reconcile-pr",()=>s.onReconcilePullRequest?s.onReconcilePullRequest(c,r.id):Promise.resolve())},children:[e.jsx(k,{size:13}),e.jsx("span",{children:n==="reconcile-pr"?"Checking":"Refresh review"})]}),e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("reject-candidate",()=>s.onRejectCandidate?s.onRejectCandidate(c,r.id):Promise.resolve())},children:[e.jsx(j,{size:13}),e.jsx("span",{children:n==="reject-candidate"?"Closing":"Close review"})]})]})]}):t.state==="blocked"||t.state==="failed"||t.state==="cancelled"?e.jsxs("div",{className:"composer-create-status-body",children:[e.jsx("p",{children:t.blockedReason??"This work stopped before it was ready."}),t.state==="blocked"&&r?.git?.worktreePath&&["draft","checking"].includes(r.status)?e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("resume",()=>s.onResume?s.onResume(c):Promise.resolve())},children:[e.jsx(C,{size:13}),e.jsx("span",{children:n==="resume"?"Continuing":"Continue update"})]}):t.state==="blocked"&&r?.git?.pullRequest?.state==="merged"?e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("reconcile-pr",()=>s.onReconcilePullRequest?s.onReconcilePullRequest(c,r.id):Promise.resolve())},children:[e.jsx(k,{size:13}),e.jsx("span",{children:n==="reconcile-pr"?"Checking":"Re-run verification"})]}):null]}):t.state==="released"||t.state==="rejected"||t.state==="ready_local"||t.state==="ready"||t.state==="published_hosted"?e.jsxs("div",{className:"composer-create-status-body composer-create-status-body-reveals",children:[e.jsx("p",{children:t.state==="released"?"The Agent update is saved and its Evals passed.":t.state==="rejected"?"The Agent update was not applied.":t.state==="published_hosted"?"Published to the hosted Profile.":"The Agent and its actions are ready to use."}),e.jsx("div",{className:"composer-create-hover-details",children:e.jsx(m,{run:t})})]}):e.jsxs("div",{className:"composer-create-status-body",children:[e.jsx("p",{children:B(t)}),e.jsx(m,{run:t}),t.executionPolicy.pauseAllowed&&s.onPause?e.jsxs("button",{type:"button",disabled:!!n,onClick:()=>{d("pause",()=>s.onPause?.(c)??Promise.resolve())},children:[e.jsx(q,{size:13}),e.jsx("span",{children:n==="pause"?"Pausing":"Pause"})]}):null]})]})}function N(s){return s.questions.find(a=>a.status==="pending"&&a.required)??s.questions.find(a=>a.status==="pending")??null}function m({run:s}){const a=s.plan,i=s.target.kind==="agent",o=i?null:s.sourceRefs[0]??a?.sourcePlan[0]?.path??null,l=s.checkRefs.length||a?.checks.length||0,n=i?0:a?.requirements.length??0,u=i?[]:[...s.sourceRefs,...s.checkRefs].slice(0,4),t=w(a?.metadata);return!o&&l===0&&n===0&&u.length===0&&!t?null:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"composer-create-facts",children:[t?e.jsx("span",{title:t.detail,children:t.label}):null,o?e.jsx("span",{title:o,children:o}):null,l?e.jsx("span",{children:i?`${l} Evals`:s.checkRefs.length?`${s.checkRefs.length} check refs`:`${l} checks`}):null,n?e.jsxs("span",{children:[n," setup rows"]}):null]}),u.length?e.jsx("ul",{className:"composer-create-refs","aria-label":"Source and check refs",children:u.map(h=>e.jsx("li",{children:e.jsx("code",{title:h,children:h})},h))}):null]})}function z(s){const a=s.target.kind==="agent";return s.state==="awaiting_questions"?"Question":s.state==="awaiting_plan_approval"?"Plan":s.state==="applying_source"?a?"Saving Agent":"Applying source":s.state==="running_checks"?"Running Evals":s.state==="evaluating"?a?"Checking Agent":"Evaluating":s.state==="awaiting_promotion"?a?"Update ready":"Candidate ready":s.state==="opening_pull_request"?"Opening review":s.state==="pull_request_open"?"Review open":s.state==="reconciling_release"?a?"Applying update":"Merging change":s.state==="released"?a?"Agent updated":"Released":s.state==="rejected"?a?"Current Agent kept":"Rejected":s.state==="paused"?"Paused":s.state==="ready"||s.state==="ready_local"?"Ready":s.state==="published_hosted"?"Published":s.state==="cancelled"?"Cancelled":s.state==="blocked"?"Blocked":s.state==="failed"?"Failed":s.operation==="improve"?"Improve":"Create"}function B(s){const a=s.state,i=s.target.kind==="agent";return a==="applying_source"?i?"Saving the approved Agent plan.":"Applying the approved source changes.":a==="running_checks"?i?"Running Evals against the Agent.":"Running checks against the candidate.":a==="evaluating"?i?"Checking the Agent's behavior.":"Evaluating the candidate against its Evals.":a==="opening_pull_request"?i?"Preparing the Agent update review.":"Opening the candidate review.":a==="reconciling_release"?"Applying the change and verifying the active Profile.":a==="pushing_hosted"?"Pushing the Profile source.":a==="running_hosted_checks"?i?"Running hosted Evals.":"Running hosted checks.":"Preparing the work."}function E(s){return["released","ready","ready_local","published_hosted"].includes(s)?"success":["rejected","blocked","failed","cancelled"].includes(s)?"danger":["awaiting_questions","awaiting_plan_approval","awaiting_promotion","pull_request_open","paused"].includes(s)?"warning":"info"}function I(s){return["planning","applying_source","running_checks","evaluating","opening_pull_request","reconciling_release","pushing_hosted","running_hosted_checks"].includes(s)}function S(s){return[...s.candidates].reverse().find(a=>a.target.kind==="agent")??null}function $(s,a){const i=s.evaluationReceipts.filter(o=>o.candidateId===a&&o.subject==="candidate");return i.length>0&&i.every(o=>o.status==="passed"&&o.publishGate!=="failed")}function T(s,a){const i=s.evaluationReceipts.find(n=>n.candidateId===a&&n.subject==="active"),o=s.evaluationReceipts.find(n=>n.candidateId===a&&n.subject==="candidate"),l=n=>n?.summaryCounts?`${n.summaryCounts.passed}/${n.summaryCounts.total}`:n?.status??"not run";return s.target.kind==="agent"?`Current Agent: ${l(i)} Evals passed. Updated Agent: ${l(o)} Evals passed.`:`Base Evals: ${l(i)} passed. Candidate Evals: ${l(o)} passed.`}export{U as ComposerCreateImproveStrip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as t}from"./index-B5RqBp_p.js";import{P as k}from"./play-DsP3gpGK.js";import{b4 as ae,g as se,X as ne,bL as I,bM as ie,bN as re,bO as oe,bP as de,w as D,bQ as le,bR as ce,bS as ue}from"./App-kwt-UxX_.js";import{A as pe}from"./AppDialog-LXQo_7oW.js";import{a as fe}from"./chat-file-links-C3erG0P2.js";function ge({badge:e,onPlay:a,titleElement:i="h3",video:s}){const[d,n]=x.useState(!1),r=x.useRef(null),u=i,l=`${s.id}-title`;function p(){if(a){a();return}ae.flushSync(()=>n(!0));const c=r.current;c&&(c.load(),c.play().catch(()=>{}))}return t.jsxs(t.Fragment,{children:[t.jsxs("article",{className:"get-started-course-card","aria-labelledby":l,children:[t.jsx("button",{"aria-haspopup":"dialog","aria-label":`Play ${s.title}`,className:"get-started-course-open",onClick:p,type:"button"}),t.jsxs("div",{className:"get-started-course-media",children:[t.jsx("img",{alt:"",className:"get-started-course-poster",decoding:"async",src:s.posterUrl}),t.jsx("span",{className:"get-started-course-play-icon","aria-hidden":"true",children:t.jsx(k,{fill:"currentColor",size:19})}),e?t.jsx("span",{className:"get-started-course-badge","aria-hidden":"true",children:e}):null]}),t.jsxs("div",{className:"get-started-course-copy",children:[t.jsx(u,{id:l,children:s.title}),t.jsxs("div",{className:"get-started-course-meta","aria-label":`${s.title} details`,children:[t.jsx("span",{children:s.eyebrow}),t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:s.duration})]}),s.description?t.jsx("p",{children:s.description}):null]})]}),d&&!a?t.jsx(L,{onClose:()=>n(!1),video:s,videoRef:r}):null]})}function L({autoAdvance:e=!1,contained:a=!1,inertExclusionSelector:i,navigation:s,onEnded:d,onClose:n,onPause:r,onTimeUpdate:u,video:l,videoRef:p}){return t.jsxs(pe,{ariaLabel:`${l.title} player`,backdropClassName:"get-started-course-player-backdrop",className:"get-started-course-player",contained:a,inertExclusionSelector:i,onClose:n,children:[t.jsxs("header",{className:"get-started-course-player-header",children:[t.jsxs("div",{className:"get-started-course-player-copy",children:[t.jsx("strong",{children:l.title}),t.jsxs("span",{children:[s?`Lesson ${s.currentIndex+1} of ${s.total}`:l.eyebrow," · ",l.duration]})]}),t.jsxs("div",{className:"get-started-course-player-actions",children:[s?t.jsxs(t.Fragment,{children:[t.jsx("button",{"aria-label":"Previous lesson",disabled:!s.onPrevious,onClick:s.onPrevious,title:"Previous lesson",type:"button",children:t.jsx(se,{size:17})}),t.jsx("button",{"aria-label":"Next lesson",disabled:!s.onNext,onClick:s.onNext,title:"Next lesson",type:"button",children:t.jsx(fe,{size:17})})]}):null,t.jsx("button",{"aria-label":"Close video player","data-autofocus":!0,onClick:n,title:"Close",type:"button",children:t.jsx(ne,{size:18})})]})]}),t.jsx("div",{className:"get-started-course-player-body",children:t.jsx("div",{className:"get-started-course-player-media",children:t.jsx("div",{className:"get-started-course-player-stage",children:t.jsx("video",{"aria-label":`${l.title} video`,className:"get-started-course-player-video",controls:!0,"data-auto-advance":e?"true":void 0,onEnded:c=>d?.(c.currentTarget),onPause:c=>r?.(c.currentTarget),onTimeUpdate:c=>u?.(c.currentTarget),playsInline:!0,poster:l.posterUrl,preload:"metadata",ref:p,src:l.videoUrl,children:l.captionsUrl?t.jsx("track",{kind:"captions",label:"English",src:l.captionsUrl,srcLang:"en"}):null},l.id)})})})]})}const me=[{id:"post-training-from-first-principles",fullVideoId:"post-training-full-course",status:"draft",title:"Post-training from first principles",videoIds:["post-training-01-how-post-training-works","post-training-02-definitions","post-training-03-on-policy-off-policy","post-training-04-rewards-credit-assignment","post-training-05-verifiable-rewards-rlvr","post-training-06-ppo-grpo","post-training-07-distillation","post-training-08-opsd-sdft-sdpo","post-training-09-credible-experiments","post-training-10-technical-appendix"]},{id:"how-to-make-an-agent",status:"published",title:"Agents",playAllVideoId:"make-agent-tutorial",videoIds:["make-agent-tutorial-create","make-agent-tutorial-use","make-agent-tutorial-improve"]}],be=[{id:"post-training-01-how-post-training-works",localPath:"courses/post-training/01-how-post-training-works.mp4",objectKey:"media/videos/aeb54dfb42eb940672df6e41bae075ffa5e45e1609e173a91e485c808b61fd4a.mp4",sha256:"aeb54dfb42eb940672df6e41bae075ffa5e45e1609e173a91e485c808b61fd4a",sizeBytes:2114638,durationSeconds:64.967},{id:"post-training-02-definitions",localPath:"courses/post-training/02-definitions.mp4",objectKey:"media/videos/c57d021989cdf058c683b9d017eb91bd23075e6bd00d0cc055e1285b3ea119fc.mp4",sha256:"c57d021989cdf058c683b9d017eb91bd23075e6bd00d0cc055e1285b3ea119fc",sizeBytes:11956956,durationSeconds:374.367},{id:"post-training-03-on-policy-off-policy",localPath:"courses/post-training/03-on-policy-off-policy.mp4",objectKey:"media/videos/a807bd7d704f8603addc875623a3cfcc938e60e0170d555d47569394a1c31762.mp4",sha256:"a807bd7d704f8603addc875623a3cfcc938e60e0170d555d47569394a1c31762",sizeBytes:2291518,durationSeconds:66.367},{id:"post-training-04-rewards-credit-assignment",localPath:"courses/post-training/04-rewards-credit-assignment.mp4",objectKey:"media/videos/685f7ecff7fcea262dd2cf60568079633816e9116efd80c069d0e20a4959a87f.mp4",sha256:"685f7ecff7fcea262dd2cf60568079633816e9116efd80c069d0e20a4959a87f",sizeBytes:5677418,durationSeconds:179.834},{id:"post-training-05-verifiable-rewards-rlvr",localPath:"courses/post-training/05-verifiable-rewards-rlvr.mp4",objectKey:"media/videos/0633584b2036843edd1ff9c63f0858db4272ddf55b10b160ec2ef6f7650c7d3a.mp4",sha256:"0633584b2036843edd1ff9c63f0858db4272ddf55b10b160ec2ef6f7650c7d3a",sizeBytes:5666892,durationSeconds:172.534},{id:"post-training-06-ppo-grpo",localPath:"courses/post-training/06-ppo-grpo.mp4",objectKey:"media/videos/66760fec7508c413844adb06c3f3920c5f7e3a874b18dc244ba090c55f452ff3.mp4",sha256:"66760fec7508c413844adb06c3f3920c5f7e3a874b18dc244ba090c55f452ff3",sizeBytes:5519257,durationSeconds:173.6},{id:"post-training-07-distillation",localPath:"courses/post-training/07-distillation.mp4",objectKey:"media/videos/3590f94325c1986f2025b42d182f04957e9eff6d5c06b1effc28dc369651c466.mp4",sha256:"3590f94325c1986f2025b42d182f04957e9eff6d5c06b1effc28dc369651c466",sizeBytes:4687640,durationSeconds:161.667},{id:"post-training-08-opsd-sdft-sdpo",localPath:"courses/post-training/08-opsd-sdft-sdpo.mp4",objectKey:"media/videos/3c45d8c1df0a24132ec425762dc6a4274b1e5cac6dfd220a2994f8754f431031.mp4",sha256:"3c45d8c1df0a24132ec425762dc6a4274b1e5cac6dfd220a2994f8754f431031",sizeBytes:5439835,durationSeconds:163.134},{id:"post-training-09-credible-experiments",localPath:"courses/post-training/09-credible-experiments.mp4",objectKey:"media/videos/fc701a8ba4b42de53bcaec3dcf191e6ec66f1dc0c48480f0aff01c3849aff023.mp4",sha256:"fc701a8ba4b42de53bcaec3dcf191e6ec66f1dc0c48480f0aff01c3849aff023",sizeBytes:6909405,durationSeconds:211.934},{id:"post-training-10-technical-appendix",localPath:"courses/post-training/10-technical-appendix.mp4",objectKey:"media/videos/17e6b5ef161fcdc97678e5b63650bffdb4b4b0d510ba75725a2af8a5db0d7e21.mp4",sha256:"17e6b5ef161fcdc97678e5b63650bffdb4b4b0d510ba75725a2af8a5db0d7e21",sizeBytes:5481950,durationSeconds:191.767},{id:"post-training-full-course",localPath:"courses/post-training/full-course.mp4",objectKey:"media/videos/d3df6a3b2ffe6c696b9dc0774ceaec19a2b8a92b170476cacb9df8dbdb2a526f.mp4",sha256:"d3df6a3b2ffe6c696b9dc0774ceaec19a2b8a92b170476cacb9df8dbdb2a526f",sizeBytes:55740426,durationSeconds:1760.192},{id:"openpond-agent-overview",localPath:"tutorials/what-is-an-openpond-agent.mp4",objectKey:"media/videos/421160f56d82abd6515df0d5ccf144591749e0ab1d58d630805c4807913812c7.mp4",sha256:"421160f56d82abd6515df0d5ccf144591749e0ab1d58d630805c4807913812c7",sizeBytes:5259848,durationSeconds:77.467},{id:"make-agent-tutorial",localPath:"tutorials/how-to-make-an-agent.mp4",objectKey:"media/videos/252d2f27076c904d85c9854c2f4c494fe9e92b3cea7d2c58ffbaa0323c17f255.mp4",sha256:"252d2f27076c904d85c9854c2f4c494fe9e92b3cea7d2c58ffbaa0323c17f255",sizeBytes:17339101,durationSeconds:273.067},{id:"make-agent-tutorial-create",localPath:"tutorials/how-to-make-an-agent-create.mp4",objectKey:"media/videos/322c999225d4759c34334eee22edee25a737fb06c5c6d66ee1f84485bb586c44.mp4",sha256:"322c999225d4759c34334eee22edee25a737fb06c5c6d66ee1f84485bb586c44",sizeBytes:6050301,durationSeconds:100.4},{id:"make-agent-tutorial-use",localPath:"tutorials/how-to-make-an-agent-use.mp4",objectKey:"media/videos/6e28bb710f90de8968fa18f996973b869e6748797739dd93cce49d8fbba564c1.mp4",sha256:"6e28bb710f90de8968fa18f996973b869e6748797739dd93cce49d8fbba564c1",sizeBytes:5084394,durationSeconds:75.1},{id:"make-agent-tutorial-improve",localPath:"tutorials/how-to-make-an-agent-improve.mp4",objectKey:"media/videos/fe8b62bf6ed5f5b933b0023dfdd9a06e69b5b352d4c702b671ec7677b395d58d.mp4",sha256:"fe8b62bf6ed5f5b933b0023dfdd9a06e69b5b352d4c702b671ec7677b395d58d",sizeBytes:6255324,durationSeconds:108.634}],he={playlists:me,videos:be},ye="https://media.openpond.ai",K=he,Te=new Map(K.playlists.map(e=>[e.id,e])),xe=new Map(K.videos.map(e=>[e.id,e]));function $(e){const a=Te.get(e);if(!a)throw new Error(`Public video manifest is missing playlist ${e}`);return a}function Ae(e,a){return a?`${ye}/${e.objectKey}`:I(e.localPath)}function E(e){const a=xe.get(e);if(!a)throw new Error(`Public video manifest is missing ${e}`);return Ae(a,!0)}const ve=E("make-agent-tutorial"),Pe=E("openpond-agent-overview");function je(e){return E(`make-agent-tutorial-${e}`)}const Ne={title:"How to make an agent"},Ie=[{id:"create",label:"Create",title:"Create an Agent",subtitle:"Turn a plain-language purpose into a working Account Health Agent.",outroTitle:"Account Health Agent created",outroSubtitle:"The agent is ready to use. · AI-generated narration",cardDuration:1.5},{id:"use",label:"Use",title:"Use the Agent",subtitle:"Chat with the Account Health Agent and run its actions with approval.",outroTitle:"First agent run complete",outroSubtitle:"The result and supporting evidence are ready to review. · AI-generated narration",cardDuration:1.5},{id:"improve",label:"Improve",title:"Improve the Agent",subtitle:"Use real run evidence and Evals to make the Account Health Agent better.",outroTitle:"Account Health Agent improved",outroSubtitle:"The updated agent passed its Evals. · AI-generated narration",cardDuration:1.5}],z={tutorial:Ne,chapters:Ie},Ee=$("how-to-make-an-agent"),B=z.chapters,Se={create:"1:24",use:"1:05",improve:"1:10"},w=Ee.title,we=z.tutorial.title,F="4:33",H={captionsUrl:re,chapterIds:B.map(e=>e.id),description:"Create, use, and improve an Account Health Agent in one continuous walkthrough.",duration:F,eyebrow:"Play all",id:"make-agent-tutorial",lessonNumber:null,posterUrl:ie,title:we,videoId:"play-all",videoUrl:ve},T=B.map((e,a)=>({captionsUrl:de(e.id),chapterIds:[e.id],description:e.subtitle,duration:Se[e.id],eyebrow:`Lesson ${a+1}`,id:`make-agent-tutorial-${e.id}`,lessonNumber:a+1,posterUrl:oe(e.id),title:e.title,videoId:e.id,videoUrl:je(e.id)})),Re=[H,...T];function W(e){return Re.find(a=>a.videoId===e)??H}function _e(e){const a=T.findIndex(i=>i.videoId===e);return a<0?null:T[a+1]?.videoId??null}const Oe=[2,1,0];function ke({activeVideoId:e="play-all",autoplay:a=!0,onClose:i,onOpen:s,onSelectVideo:d,open:n=!1,playRequestId:r=0}={}){const u=x.useRef(null),l=W(e);x.useEffect(()=>{if(!n)return;const c=u.current;c&&(c.load(),r>0&&c.play().catch(()=>{}))},[l.id,n,r]);function p(){if(!a||!d)return;const c=_e(e);c&&d(c)}return t.jsxs("section",{className:"get-started-series","aria-label":w,children:[t.jsxs("article",{className:"get-started-playlist-card","aria-labelledby":"make-agent-series-title",children:[t.jsx("button",{"aria-haspopup":"dialog","aria-label":`Open ${w} playlist`,className:"get-started-playlist-open",onClick:s,type:"button"}),t.jsxs("div",{className:"get-started-playlist-stack","aria-hidden":"true",children:[Oe.map((c,f)=>{const m=T[c];return t.jsx("div",{className:`get-started-playlist-poster layer-${f+1}`,children:t.jsx("img",{alt:"",decoding:"async",src:m.posterUrl})},m.id)}),t.jsx("span",{className:"get-started-course-play-icon",children:t.jsx(k,{fill:"currentColor",size:19})}),t.jsxs("span",{className:"get-started-playlist-count",children:[T.length," lessons"]})]}),t.jsxs("div",{className:"get-started-playlist-copy",children:[t.jsx("h1",{id:"make-agent-series-title",children:w}),t.jsxs("div",{className:"get-started-course-meta",children:[t.jsx("span",{children:"Walkthrough playlist"}),t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:F})]}),t.jsx("p",{children:"Create, use, and improve an Account Health Agent, or play the full walkthrough."})]})]}),n&&i&&d?t.jsx(Le,{activeVideoId:e,autoplay:a,contained:!0,inertExclusionSelector:".get-started-learning-panel",onClose:i,onEnded:p,onSelectVideo:d,videoRef:u}):null]})}function Le({activeVideoId:e="play-all",autoplay:a=!0,contained:i=!1,inertExclusionSelector:s,onClose:d,onEnded:n,onSelectVideo:r=()=>{},videoRef:u}){const l=W(e),p=T.findIndex(m=>m.videoId===e),c=p>=0?T[p+1]?.videoId:void 0,f=p>0?T[p-1]?.videoId:void 0;return t.jsx(L,{autoAdvance:a&&p>=0,contained:i,inertExclusionSelector:s,navigation:p>=0?{currentIndex:p,onNext:c?()=>r(c):void 0,onPrevious:f?()=>r(f):void 0,total:T.length}:void 0,onClose:d,onEnded:n?()=>n():void 0,video:l,videoRef:u})}const U=$("post-training-from-first-principles"),q=U.title,Ue=U.status;function h(e,a,i,s,d,n){const r=`courses/post-training/${a}`,u=`post-training-${a}`;return{captionsUrl:I(`${r}.vtt`),description:n,duration:d,eyebrow:s,id:u,lessonNumber:e,posterUrl:I(`${r}-poster.webp`),slug:a,title:i,videoUrl:E(u)}}const A=[h(1,"01-how-post-training-works","How post-training works","Start here","1:05","The choose, judge, and update loop behind every method in this series."),h(2,"02-definitions","Definitions","Reference","6:14","Policy notation, softmax, rollouts, advantages, gradients, GRPO, and the acronyms used throughout the series."),h(3,"03-on-policy-off-policy","On-policy and off-policy data","Data source","1:06","Why learner rollouts and teacher or stored data support different updates."),h(4,"04-rewards-credit-assignment","Rewards and credit assignment","RL foundation","3:00","Follow a code-repair trajectory from actions and observations to advantage."),h(5,"05-verifiable-rewards-rlvr","Verifiable rewards","RLVR","2:53","See how tests create scalable rewards—and how a model can exploit the checker."),h(6,"06-ppo-grpo","PPO and GRPO","Policy updates","2:54","Compare PPO's learned critic with GRPO's sibling-response baseline."),h(7,"07-distillation","Distillation","Teacher targets","2:42","Transfer a teacher's token distribution instead of copying one final answer."),h(8,"08-opsd-sdft-sdpo","OPSD, SDFT, and SDPO","Teacher evidence","2:43","Compare trusted solutions, demonstrations, and failure feedback at one prefix."),h(9,"09-credible-experiments","Credible experiments","Research design","3:32","Build versioned datasets, fair baselines, and claims that survive scrutiny."),h(10,"10-technical-appendix","Technical appendix","Advanced details","3:12","Inspect GRPO normalization, compressed teacher logits, reported method results, and sample routing.")],Ce="29 min",O=U.fullVideoId;if(!O)throw new Error("Post-training playlist is missing its full video");const Y={captionsUrl:I("courses/post-training/full-course.vtt"),description:"All ten lessons in one continuous video for watching, sharing, or uploading.",duration:"29:20",eyebrow:"Full course",id:O,posterUrl:I("courses/post-training/full-course-poster.webp"),title:q,videoUrl:E(O)};function J(e){const a=e+1;return a<A.length?a:null}const M="Subject to change, lesson work in progress";function Me(){const e=Ue==="draft"?"Draft":"Published";return t.jsx("span",{"aria-label":`${e}: ${M}`,className:"get-started-playlist-status app-tooltip","data-tooltip":M,tabIndex:0,children:e})}const X="openpond.post-training-progress.v1",j=Object.freeze({}),Ve=1e3,Q=new Set;let P=null,N=null,V=!1;function R(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Ge(e){if(!e||typeof e!="object"||Array.isArray(e))return j;const a={};for(const[i,s]of Object.entries(e)){if(!i||!s||typeof s!="object"||Array.isArray(s))continue;const d=s,n=R(d.duration),r=R(d.currentTime),u=R(d.updatedAt);if(n===null||n<=0||r===null)continue;const l=d.completed===!0;a[i]={completed:l,currentTime:l?n:Math.min(n,Math.max(0,r)),duration:n,updatedAt:u===null?0:Math.max(0,u)}}return Object.keys(a).length>0?a:j}function De(e){if(!e)return j;try{return Ge(JSON.parse(e))}catch{return j}}function Z(){if(typeof window>"u")return j;try{return De(D.getItem(X))}catch{return j}}function ee(){if(typeof window<"u"&&N!==null&&window.clearTimeout(N),N=null,!(typeof window>"u"||P===null))try{D.setItem(X,JSON.stringify(P))}catch{}}function Ke(){typeof window>"u"||N!==null||(N=window.setTimeout(ee,Ve))}function $e(){typeof window>"u"||V||(V=!0,window.addEventListener("pagehide",ee),le(()=>{P=Z(),Q.forEach(e=>e())}))}function te(){return P===null&&(P=Z()),$e(),P}function G({completed:e=!1,currentTime:a,duration:i,lessonId:s}){if(!s||!Number.isFinite(i)||i<=0||!Number.isFinite(a))return;const d=te(),n=d[s],r=!!(n?.completed||e),u=r?i:Math.min(i,Math.max(0,a));n&&n.completed===r&&Math.abs(n.currentTime-u)<.25&&Math.abs(n.duration-i)<.25||(P={...d,[s]:{completed:r,currentTime:u,duration:i,updatedAt:Date.now()}},Ke(),Q.forEach(l=>l()))}function ze(e){return!e||e.completed||e.currentTime<1?0:e.currentTime<e.duration-2?e.currentTime:0}const _=q,Be=[2,1,0];function Fe({activeLessonIndex:e,fullCourseSelected:a=!1,autoplay:i=!0,open:s,onClose:d,onOpen:n,onSelectLesson:r,playRequestId:u=0}){const l=x.useRef(null),p=x.useRef(null),c=A[e]??A[0],f=a?Y:c;x.useEffect(()=>{if(!s)return;const o=l.current;if(!o)return;let b=!1;p.current=null,o.load();const y=()=>{if(b)return;const C=ze(te()[f.id]);C>0&&(o.currentTime=C),u>0&&o.play().catch(()=>{})};return o.readyState>=HTMLMediaElement.HAVE_METADATA?y():o.addEventListener("loadedmetadata",y,{once:!0}),()=>{b=!0,o.removeEventListener("loadedmetadata",y),Number.isFinite(o.duration)&&o.duration>0&&o.currentTime>0&&G({completed:o.ended,currentTime:o.currentTime,duration:o.duration,lessonId:f.id})}},[f.id,s,u]);function m(o,b=!1){!Number.isFinite(o.duration)||o.duration<=0||G({completed:b,currentTime:b?o.duration:o.currentTime,duration:o.duration,lessonId:f.id})}function S(o){if(!Number.isFinite(o.duration)||o.duration<=0)return;const b=Math.min(99,Math.floor(o.currentTime/o.duration*100)),y=p.current;y?.lessonId===f.id&&y.percent===b||(p.current={lessonId:f.id,percent:b},m(o))}function v(o){m(o,!0),i&&!a&&g()}function g(){const o=J(e);o!==null&&r(o)}return t.jsxs("section",{className:"get-started-series","aria-label":_,children:[t.jsxs("article",{className:"get-started-playlist-card","aria-labelledby":"post-training-series-title",children:[t.jsx("button",{"aria-haspopup":"dialog","aria-label":`Open ${_} playlist`,className:"get-started-playlist-open",onClick:n,type:"button"}),t.jsxs("div",{className:"get-started-playlist-stack","aria-hidden":"true",children:[Be.map((o,b)=>{const y=A[o];return t.jsx("div",{className:`get-started-playlist-poster layer-${b+1}`,children:t.jsx("img",{alt:"",decoding:"async",src:y.posterUrl})},y.id)}),t.jsx("span",{className:"get-started-course-play-icon",children:t.jsx(k,{fill:"currentColor",size:19})}),t.jsxs("span",{className:"get-started-playlist-count",children:[A.length," lessons"]})]}),t.jsxs("div",{className:"get-started-playlist-copy",children:[t.jsxs("div",{className:"get-started-playlist-title",children:[t.jsx("h1",{id:"post-training-series-title",children:_}),t.jsx(Me,{})]}),t.jsxs("div",{className:"get-started-course-meta",children:[t.jsx("span",{children:"Learning series"}),t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:Ce})]}),t.jsx("p",{children:"Rewards, GRPO, RLVR, distillation, experiments, and a technical appendix."})]})]}),s?t.jsx(He,{activeLessonIndex:e,autoplay:i,fullCourseSelected:a,onClose:d,onEnded:v,onPause:m,onSelectLesson:r,onTimeUpdate:S,videoRef:l}):null]})}function He({activeLessonIndex:e,autoplay:a,fullCourseSelected:i,onClose:s,onEnded:d,onPause:n,onSelectLesson:r,onTimeUpdate:u,videoRef:l}){const p=A[e]??A[0],c=J(e),f=i?Y:p;return t.jsx(L,{autoAdvance:a&&!i,contained:!0,inertExclusionSelector:".get-started-learning-panel",navigation:i?void 0:{currentIndex:e,onNext:c!==null?()=>r(c):void 0,onPrevious:e>0?()=>r(e-1):void 0,total:A.length},onClose:s,onEnded:d,onPause:n,onTimeUpdate:u,video:f,videoRef:l})}const We={captionsUrl:ue,description:"See how Profile Agents combine chat, direct actions, shared runtime surfaces, and Evals.",duration:"1:16",eyebrow:"Agent overview",id:"openpond-agent-overview",posterUrl:ce,title:"What is an OpenPond Agent?",videoUrl:Pe};function Ze(e={}){const[a,i]=x.useState(null),[s,d]=x.useState(null),n=e.makeAgentTutorial===void 0?a:e.makeAgentTutorial,r=e.postTrainingCourse===void 0?s:e.postTrainingCourse,u=!!(r||n);function l(){if(e.onOpenMakeAgentTutorial){e.onOpenMakeAgentTutorial();return}d(null),i({autoplay:!0,playRequestId:0,videoId:"create"})}function p(){if(e.onCloseMakeAgentTutorial){e.onCloseMakeAgentTutorial();return}i(null)}function c(v){if(e.onSelectMakeAgentTutorialVideo){e.onSelectMakeAgentTutorialVideo(v);return}i(g=>g&&{...g,playRequestId:g.playRequestId+1,videoId:v})}function f(){if(e.onOpenPostTrainingCourse){e.onOpenPostTrainingCourse();return}i(null),d({autoplay:!0,fullCourseSelected:!1,lessonIndex:0,playRequestId:0})}function m(){if(e.onClosePostTrainingCourse){e.onClosePostTrainingCourse();return}d(null)}function S(v){if(e.onSelectPostTrainingLesson){e.onSelectPostTrainingLesson(v);return}d(g=>g&&{...g,fullCourseSelected:!1,lessonIndex:v,playRequestId:g.playRequestId+1})}return t.jsx("section",{className:`get-started-view ${u?"course-player-open":""}`,"aria-label":"Walkthroughs",children:t.jsxs("div",{className:"get-started-shell",children:[t.jsxs("section",{className:"get-started-start-here","aria-labelledby":"get-started-start-here-title",children:[t.jsx("header",{className:"get-started-section-heading",children:t.jsx("h2",{id:"get-started-start-here-title",children:"Start here"})}),t.jsx("div",{className:"get-started-learning-grid",children:t.jsx(ge,{titleElement:"h1",video:We})})]}),t.jsxs("section",{className:"get-started-walkthroughs","aria-labelledby":"get-started-walkthroughs-title",children:[t.jsx("header",{className:"get-started-section-heading",children:t.jsx("h2",{id:"get-started-walkthroughs-title",children:"Walkthroughs"})}),t.jsx("div",{className:"get-started-learning-grid",children:t.jsx(ke,{activeVideoId:n?.videoId??"create",autoplay:n?.autoplay??!0,onClose:p,onOpen:l,onSelectVideo:c,open:!!n,playRequestId:n?.playRequestId??0})})]}),t.jsxs("section",{className:"get-started-learn","aria-labelledby":"get-started-learn-title",children:[t.jsx("header",{className:"get-started-section-heading",children:t.jsx("h2",{id:"get-started-learn-title",children:"Learn deeper"})}),t.jsx("div",{className:"get-started-learning-grid",children:t.jsx(Fe,{activeLessonIndex:r?.lessonIndex??0,autoplay:r?.autoplay??!0,fullCourseSelected:r?.fullCourseSelected??!1,open:!!r,onClose:m,onOpen:f,onSelectLesson:S,playRequestId:r?.playRequestId??0})})]})]})})}export{Ze as GetStartedView};
|
|
1
|
+
import{r as x,j as t}from"./index-De4k_YMo.js";import{P as k}from"./play-B5O4Hz_W.js";import{b4 as ae,g as se,X as ne,bL as I,bM as ie,bN as re,bO as oe,bP as de,w as D,bQ as le,bR as ce,bS as ue}from"./App-DQfdLgyV.js";import{A as pe}from"./AppDialog-BnldMLvF.js";import{a as fe}from"./chat-file-links-DQYtkwit.js";function ge({badge:e,onPlay:a,titleElement:i="h3",video:s}){const[d,n]=x.useState(!1),r=x.useRef(null),u=i,l=`${s.id}-title`;function p(){if(a){a();return}ae.flushSync(()=>n(!0));const c=r.current;c&&(c.load(),c.play().catch(()=>{}))}return t.jsxs(t.Fragment,{children:[t.jsxs("article",{className:"get-started-course-card","aria-labelledby":l,children:[t.jsx("button",{"aria-haspopup":"dialog","aria-label":`Play ${s.title}`,className:"get-started-course-open",onClick:p,type:"button"}),t.jsxs("div",{className:"get-started-course-media",children:[t.jsx("img",{alt:"",className:"get-started-course-poster",decoding:"async",src:s.posterUrl}),t.jsx("span",{className:"get-started-course-play-icon","aria-hidden":"true",children:t.jsx(k,{fill:"currentColor",size:19})}),e?t.jsx("span",{className:"get-started-course-badge","aria-hidden":"true",children:e}):null]}),t.jsxs("div",{className:"get-started-course-copy",children:[t.jsx(u,{id:l,children:s.title}),t.jsxs("div",{className:"get-started-course-meta","aria-label":`${s.title} details`,children:[t.jsx("span",{children:s.eyebrow}),t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:s.duration})]}),s.description?t.jsx("p",{children:s.description}):null]})]}),d&&!a?t.jsx(L,{onClose:()=>n(!1),video:s,videoRef:r}):null]})}function L({autoAdvance:e=!1,contained:a=!1,inertExclusionSelector:i,navigation:s,onEnded:d,onClose:n,onPause:r,onTimeUpdate:u,video:l,videoRef:p}){return t.jsxs(pe,{ariaLabel:`${l.title} player`,backdropClassName:"get-started-course-player-backdrop",className:"get-started-course-player",contained:a,inertExclusionSelector:i,onClose:n,children:[t.jsxs("header",{className:"get-started-course-player-header",children:[t.jsxs("div",{className:"get-started-course-player-copy",children:[t.jsx("strong",{children:l.title}),t.jsxs("span",{children:[s?`Lesson ${s.currentIndex+1} of ${s.total}`:l.eyebrow," · ",l.duration]})]}),t.jsxs("div",{className:"get-started-course-player-actions",children:[s?t.jsxs(t.Fragment,{children:[t.jsx("button",{"aria-label":"Previous lesson",disabled:!s.onPrevious,onClick:s.onPrevious,title:"Previous lesson",type:"button",children:t.jsx(se,{size:17})}),t.jsx("button",{"aria-label":"Next lesson",disabled:!s.onNext,onClick:s.onNext,title:"Next lesson",type:"button",children:t.jsx(fe,{size:17})})]}):null,t.jsx("button",{"aria-label":"Close video player","data-autofocus":!0,onClick:n,title:"Close",type:"button",children:t.jsx(ne,{size:18})})]})]}),t.jsx("div",{className:"get-started-course-player-body",children:t.jsx("div",{className:"get-started-course-player-media",children:t.jsx("div",{className:"get-started-course-player-stage",children:t.jsx("video",{"aria-label":`${l.title} video`,className:"get-started-course-player-video",controls:!0,"data-auto-advance":e?"true":void 0,onEnded:c=>d?.(c.currentTarget),onPause:c=>r?.(c.currentTarget),onTimeUpdate:c=>u?.(c.currentTarget),playsInline:!0,poster:l.posterUrl,preload:"metadata",ref:p,src:l.videoUrl,children:l.captionsUrl?t.jsx("track",{kind:"captions",label:"English",src:l.captionsUrl,srcLang:"en"}):null},l.id)})})})]})}const me=[{id:"post-training-from-first-principles",fullVideoId:"post-training-full-course",status:"draft",title:"Post-training from first principles",videoIds:["post-training-01-how-post-training-works","post-training-02-definitions","post-training-03-on-policy-off-policy","post-training-04-rewards-credit-assignment","post-training-05-verifiable-rewards-rlvr","post-training-06-ppo-grpo","post-training-07-distillation","post-training-08-opsd-sdft-sdpo","post-training-09-credible-experiments","post-training-10-technical-appendix"]},{id:"how-to-make-an-agent",status:"published",title:"Agents",playAllVideoId:"make-agent-tutorial",videoIds:["make-agent-tutorial-create","make-agent-tutorial-use","make-agent-tutorial-improve"]}],be=[{id:"post-training-01-how-post-training-works",localPath:"courses/post-training/01-how-post-training-works.mp4",objectKey:"media/videos/aeb54dfb42eb940672df6e41bae075ffa5e45e1609e173a91e485c808b61fd4a.mp4",sha256:"aeb54dfb42eb940672df6e41bae075ffa5e45e1609e173a91e485c808b61fd4a",sizeBytes:2114638,durationSeconds:64.967},{id:"post-training-02-definitions",localPath:"courses/post-training/02-definitions.mp4",objectKey:"media/videos/c57d021989cdf058c683b9d017eb91bd23075e6bd00d0cc055e1285b3ea119fc.mp4",sha256:"c57d021989cdf058c683b9d017eb91bd23075e6bd00d0cc055e1285b3ea119fc",sizeBytes:11956956,durationSeconds:374.367},{id:"post-training-03-on-policy-off-policy",localPath:"courses/post-training/03-on-policy-off-policy.mp4",objectKey:"media/videos/a807bd7d704f8603addc875623a3cfcc938e60e0170d555d47569394a1c31762.mp4",sha256:"a807bd7d704f8603addc875623a3cfcc938e60e0170d555d47569394a1c31762",sizeBytes:2291518,durationSeconds:66.367},{id:"post-training-04-rewards-credit-assignment",localPath:"courses/post-training/04-rewards-credit-assignment.mp4",objectKey:"media/videos/685f7ecff7fcea262dd2cf60568079633816e9116efd80c069d0e20a4959a87f.mp4",sha256:"685f7ecff7fcea262dd2cf60568079633816e9116efd80c069d0e20a4959a87f",sizeBytes:5677418,durationSeconds:179.834},{id:"post-training-05-verifiable-rewards-rlvr",localPath:"courses/post-training/05-verifiable-rewards-rlvr.mp4",objectKey:"media/videos/0633584b2036843edd1ff9c63f0858db4272ddf55b10b160ec2ef6f7650c7d3a.mp4",sha256:"0633584b2036843edd1ff9c63f0858db4272ddf55b10b160ec2ef6f7650c7d3a",sizeBytes:5666892,durationSeconds:172.534},{id:"post-training-06-ppo-grpo",localPath:"courses/post-training/06-ppo-grpo.mp4",objectKey:"media/videos/66760fec7508c413844adb06c3f3920c5f7e3a874b18dc244ba090c55f452ff3.mp4",sha256:"66760fec7508c413844adb06c3f3920c5f7e3a874b18dc244ba090c55f452ff3",sizeBytes:5519257,durationSeconds:173.6},{id:"post-training-07-distillation",localPath:"courses/post-training/07-distillation.mp4",objectKey:"media/videos/3590f94325c1986f2025b42d182f04957e9eff6d5c06b1effc28dc369651c466.mp4",sha256:"3590f94325c1986f2025b42d182f04957e9eff6d5c06b1effc28dc369651c466",sizeBytes:4687640,durationSeconds:161.667},{id:"post-training-08-opsd-sdft-sdpo",localPath:"courses/post-training/08-opsd-sdft-sdpo.mp4",objectKey:"media/videos/3c45d8c1df0a24132ec425762dc6a4274b1e5cac6dfd220a2994f8754f431031.mp4",sha256:"3c45d8c1df0a24132ec425762dc6a4274b1e5cac6dfd220a2994f8754f431031",sizeBytes:5439835,durationSeconds:163.134},{id:"post-training-09-credible-experiments",localPath:"courses/post-training/09-credible-experiments.mp4",objectKey:"media/videos/fc701a8ba4b42de53bcaec3dcf191e6ec66f1dc0c48480f0aff01c3849aff023.mp4",sha256:"fc701a8ba4b42de53bcaec3dcf191e6ec66f1dc0c48480f0aff01c3849aff023",sizeBytes:6909405,durationSeconds:211.934},{id:"post-training-10-technical-appendix",localPath:"courses/post-training/10-technical-appendix.mp4",objectKey:"media/videos/17e6b5ef161fcdc97678e5b63650bffdb4b4b0d510ba75725a2af8a5db0d7e21.mp4",sha256:"17e6b5ef161fcdc97678e5b63650bffdb4b4b0d510ba75725a2af8a5db0d7e21",sizeBytes:5481950,durationSeconds:191.767},{id:"post-training-full-course",localPath:"courses/post-training/full-course.mp4",objectKey:"media/videos/d3df6a3b2ffe6c696b9dc0774ceaec19a2b8a92b170476cacb9df8dbdb2a526f.mp4",sha256:"d3df6a3b2ffe6c696b9dc0774ceaec19a2b8a92b170476cacb9df8dbdb2a526f",sizeBytes:55740426,durationSeconds:1760.192},{id:"openpond-agent-overview",localPath:"tutorials/what-is-an-openpond-agent.mp4",objectKey:"media/videos/421160f56d82abd6515df0d5ccf144591749e0ab1d58d630805c4807913812c7.mp4",sha256:"421160f56d82abd6515df0d5ccf144591749e0ab1d58d630805c4807913812c7",sizeBytes:5259848,durationSeconds:77.467},{id:"make-agent-tutorial",localPath:"tutorials/how-to-make-an-agent.mp4",objectKey:"media/videos/252d2f27076c904d85c9854c2f4c494fe9e92b3cea7d2c58ffbaa0323c17f255.mp4",sha256:"252d2f27076c904d85c9854c2f4c494fe9e92b3cea7d2c58ffbaa0323c17f255",sizeBytes:17339101,durationSeconds:273.067},{id:"make-agent-tutorial-create",localPath:"tutorials/how-to-make-an-agent-create.mp4",objectKey:"media/videos/322c999225d4759c34334eee22edee25a737fb06c5c6d66ee1f84485bb586c44.mp4",sha256:"322c999225d4759c34334eee22edee25a737fb06c5c6d66ee1f84485bb586c44",sizeBytes:6050301,durationSeconds:100.4},{id:"make-agent-tutorial-use",localPath:"tutorials/how-to-make-an-agent-use.mp4",objectKey:"media/videos/6e28bb710f90de8968fa18f996973b869e6748797739dd93cce49d8fbba564c1.mp4",sha256:"6e28bb710f90de8968fa18f996973b869e6748797739dd93cce49d8fbba564c1",sizeBytes:5084394,durationSeconds:75.1},{id:"make-agent-tutorial-improve",localPath:"tutorials/how-to-make-an-agent-improve.mp4",objectKey:"media/videos/fe8b62bf6ed5f5b933b0023dfdd9a06e69b5b352d4c702b671ec7677b395d58d.mp4",sha256:"fe8b62bf6ed5f5b933b0023dfdd9a06e69b5b352d4c702b671ec7677b395d58d",sizeBytes:6255324,durationSeconds:108.634}],he={playlists:me,videos:be},ye="https://media.openpond.ai",K=he,Te=new Map(K.playlists.map(e=>[e.id,e])),xe=new Map(K.videos.map(e=>[e.id,e]));function $(e){const a=Te.get(e);if(!a)throw new Error(`Public video manifest is missing playlist ${e}`);return a}function Ae(e,a){return a?`${ye}/${e.objectKey}`:I(e.localPath)}function E(e){const a=xe.get(e);if(!a)throw new Error(`Public video manifest is missing ${e}`);return Ae(a,!0)}const ve=E("make-agent-tutorial"),Pe=E("openpond-agent-overview");function je(e){return E(`make-agent-tutorial-${e}`)}const Ne={title:"How to make an agent"},Ie=[{id:"create",label:"Create",title:"Create an Agent",subtitle:"Turn a plain-language purpose into a working Account Health Agent.",outroTitle:"Account Health Agent created",outroSubtitle:"The agent is ready to use. · AI-generated narration",cardDuration:1.5},{id:"use",label:"Use",title:"Use the Agent",subtitle:"Chat with the Account Health Agent and run its actions with approval.",outroTitle:"First agent run complete",outroSubtitle:"The result and supporting evidence are ready to review. · AI-generated narration",cardDuration:1.5},{id:"improve",label:"Improve",title:"Improve the Agent",subtitle:"Use real run evidence and Evals to make the Account Health Agent better.",outroTitle:"Account Health Agent improved",outroSubtitle:"The updated agent passed its Evals. · AI-generated narration",cardDuration:1.5}],z={tutorial:Ne,chapters:Ie},Ee=$("how-to-make-an-agent"),B=z.chapters,Se={create:"1:24",use:"1:05",improve:"1:10"},w=Ee.title,we=z.tutorial.title,F="4:33",H={captionsUrl:re,chapterIds:B.map(e=>e.id),description:"Create, use, and improve an Account Health Agent in one continuous walkthrough.",duration:F,eyebrow:"Play all",id:"make-agent-tutorial",lessonNumber:null,posterUrl:ie,title:we,videoId:"play-all",videoUrl:ve},T=B.map((e,a)=>({captionsUrl:de(e.id),chapterIds:[e.id],description:e.subtitle,duration:Se[e.id],eyebrow:`Lesson ${a+1}`,id:`make-agent-tutorial-${e.id}`,lessonNumber:a+1,posterUrl:oe(e.id),title:e.title,videoId:e.id,videoUrl:je(e.id)})),Re=[H,...T];function W(e){return Re.find(a=>a.videoId===e)??H}function _e(e){const a=T.findIndex(i=>i.videoId===e);return a<0?null:T[a+1]?.videoId??null}const Oe=[2,1,0];function ke({activeVideoId:e="play-all",autoplay:a=!0,onClose:i,onOpen:s,onSelectVideo:d,open:n=!1,playRequestId:r=0}={}){const u=x.useRef(null),l=W(e);x.useEffect(()=>{if(!n)return;const c=u.current;c&&(c.load(),r>0&&c.play().catch(()=>{}))},[l.id,n,r]);function p(){if(!a||!d)return;const c=_e(e);c&&d(c)}return t.jsxs("section",{className:"get-started-series","aria-label":w,children:[t.jsxs("article",{className:"get-started-playlist-card","aria-labelledby":"make-agent-series-title",children:[t.jsx("button",{"aria-haspopup":"dialog","aria-label":`Open ${w} playlist`,className:"get-started-playlist-open",onClick:s,type:"button"}),t.jsxs("div",{className:"get-started-playlist-stack","aria-hidden":"true",children:[Oe.map((c,f)=>{const m=T[c];return t.jsx("div",{className:`get-started-playlist-poster layer-${f+1}`,children:t.jsx("img",{alt:"",decoding:"async",src:m.posterUrl})},m.id)}),t.jsx("span",{className:"get-started-course-play-icon",children:t.jsx(k,{fill:"currentColor",size:19})}),t.jsxs("span",{className:"get-started-playlist-count",children:[T.length," lessons"]})]}),t.jsxs("div",{className:"get-started-playlist-copy",children:[t.jsx("h1",{id:"make-agent-series-title",children:w}),t.jsxs("div",{className:"get-started-course-meta",children:[t.jsx("span",{children:"Walkthrough playlist"}),t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:F})]}),t.jsx("p",{children:"Create, use, and improve an Account Health Agent, or play the full walkthrough."})]})]}),n&&i&&d?t.jsx(Le,{activeVideoId:e,autoplay:a,contained:!0,inertExclusionSelector:".get-started-learning-panel",onClose:i,onEnded:p,onSelectVideo:d,videoRef:u}):null]})}function Le({activeVideoId:e="play-all",autoplay:a=!0,contained:i=!1,inertExclusionSelector:s,onClose:d,onEnded:n,onSelectVideo:r=()=>{},videoRef:u}){const l=W(e),p=T.findIndex(m=>m.videoId===e),c=p>=0?T[p+1]?.videoId:void 0,f=p>0?T[p-1]?.videoId:void 0;return t.jsx(L,{autoAdvance:a&&p>=0,contained:i,inertExclusionSelector:s,navigation:p>=0?{currentIndex:p,onNext:c?()=>r(c):void 0,onPrevious:f?()=>r(f):void 0,total:T.length}:void 0,onClose:d,onEnded:n?()=>n():void 0,video:l,videoRef:u})}const U=$("post-training-from-first-principles"),q=U.title,Ue=U.status;function h(e,a,i,s,d,n){const r=`courses/post-training/${a}`,u=`post-training-${a}`;return{captionsUrl:I(`${r}.vtt`),description:n,duration:d,eyebrow:s,id:u,lessonNumber:e,posterUrl:I(`${r}-poster.webp`),slug:a,title:i,videoUrl:E(u)}}const A=[h(1,"01-how-post-training-works","How post-training works","Start here","1:05","The choose, judge, and update loop behind every method in this series."),h(2,"02-definitions","Definitions","Reference","6:14","Policy notation, softmax, rollouts, advantages, gradients, GRPO, and the acronyms used throughout the series."),h(3,"03-on-policy-off-policy","On-policy and off-policy data","Data source","1:06","Why learner rollouts and teacher or stored data support different updates."),h(4,"04-rewards-credit-assignment","Rewards and credit assignment","RL foundation","3:00","Follow a code-repair trajectory from actions and observations to advantage."),h(5,"05-verifiable-rewards-rlvr","Verifiable rewards","RLVR","2:53","See how tests create scalable rewards—and how a model can exploit the checker."),h(6,"06-ppo-grpo","PPO and GRPO","Policy updates","2:54","Compare PPO's learned critic with GRPO's sibling-response baseline."),h(7,"07-distillation","Distillation","Teacher targets","2:42","Transfer a teacher's token distribution instead of copying one final answer."),h(8,"08-opsd-sdft-sdpo","OPSD, SDFT, and SDPO","Teacher evidence","2:43","Compare trusted solutions, demonstrations, and failure feedback at one prefix."),h(9,"09-credible-experiments","Credible experiments","Research design","3:32","Build versioned datasets, fair baselines, and claims that survive scrutiny."),h(10,"10-technical-appendix","Technical appendix","Advanced details","3:12","Inspect GRPO normalization, compressed teacher logits, reported method results, and sample routing.")],Ce="29 min",O=U.fullVideoId;if(!O)throw new Error("Post-training playlist is missing its full video");const Y={captionsUrl:I("courses/post-training/full-course.vtt"),description:"All ten lessons in one continuous video for watching, sharing, or uploading.",duration:"29:20",eyebrow:"Full course",id:O,posterUrl:I("courses/post-training/full-course-poster.webp"),title:q,videoUrl:E(O)};function J(e){const a=e+1;return a<A.length?a:null}const M="Subject to change, lesson work in progress";function Me(){const e=Ue==="draft"?"Draft":"Published";return t.jsx("span",{"aria-label":`${e}: ${M}`,className:"get-started-playlist-status app-tooltip","data-tooltip":M,tabIndex:0,children:e})}const X="openpond.post-training-progress.v1",j=Object.freeze({}),Ve=1e3,Q=new Set;let P=null,N=null,V=!1;function R(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Ge(e){if(!e||typeof e!="object"||Array.isArray(e))return j;const a={};for(const[i,s]of Object.entries(e)){if(!i||!s||typeof s!="object"||Array.isArray(s))continue;const d=s,n=R(d.duration),r=R(d.currentTime),u=R(d.updatedAt);if(n===null||n<=0||r===null)continue;const l=d.completed===!0;a[i]={completed:l,currentTime:l?n:Math.min(n,Math.max(0,r)),duration:n,updatedAt:u===null?0:Math.max(0,u)}}return Object.keys(a).length>0?a:j}function De(e){if(!e)return j;try{return Ge(JSON.parse(e))}catch{return j}}function Z(){if(typeof window>"u")return j;try{return De(D.getItem(X))}catch{return j}}function ee(){if(typeof window<"u"&&N!==null&&window.clearTimeout(N),N=null,!(typeof window>"u"||P===null))try{D.setItem(X,JSON.stringify(P))}catch{}}function Ke(){typeof window>"u"||N!==null||(N=window.setTimeout(ee,Ve))}function $e(){typeof window>"u"||V||(V=!0,window.addEventListener("pagehide",ee),le(()=>{P=Z(),Q.forEach(e=>e())}))}function te(){return P===null&&(P=Z()),$e(),P}function G({completed:e=!1,currentTime:a,duration:i,lessonId:s}){if(!s||!Number.isFinite(i)||i<=0||!Number.isFinite(a))return;const d=te(),n=d[s],r=!!(n?.completed||e),u=r?i:Math.min(i,Math.max(0,a));n&&n.completed===r&&Math.abs(n.currentTime-u)<.25&&Math.abs(n.duration-i)<.25||(P={...d,[s]:{completed:r,currentTime:u,duration:i,updatedAt:Date.now()}},Ke(),Q.forEach(l=>l()))}function ze(e){return!e||e.completed||e.currentTime<1?0:e.currentTime<e.duration-2?e.currentTime:0}const _=q,Be=[2,1,0];function Fe({activeLessonIndex:e,fullCourseSelected:a=!1,autoplay:i=!0,open:s,onClose:d,onOpen:n,onSelectLesson:r,playRequestId:u=0}){const l=x.useRef(null),p=x.useRef(null),c=A[e]??A[0],f=a?Y:c;x.useEffect(()=>{if(!s)return;const o=l.current;if(!o)return;let b=!1;p.current=null,o.load();const y=()=>{if(b)return;const C=ze(te()[f.id]);C>0&&(o.currentTime=C),u>0&&o.play().catch(()=>{})};return o.readyState>=HTMLMediaElement.HAVE_METADATA?y():o.addEventListener("loadedmetadata",y,{once:!0}),()=>{b=!0,o.removeEventListener("loadedmetadata",y),Number.isFinite(o.duration)&&o.duration>0&&o.currentTime>0&&G({completed:o.ended,currentTime:o.currentTime,duration:o.duration,lessonId:f.id})}},[f.id,s,u]);function m(o,b=!1){!Number.isFinite(o.duration)||o.duration<=0||G({completed:b,currentTime:b?o.duration:o.currentTime,duration:o.duration,lessonId:f.id})}function S(o){if(!Number.isFinite(o.duration)||o.duration<=0)return;const b=Math.min(99,Math.floor(o.currentTime/o.duration*100)),y=p.current;y?.lessonId===f.id&&y.percent===b||(p.current={lessonId:f.id,percent:b},m(o))}function v(o){m(o,!0),i&&!a&&g()}function g(){const o=J(e);o!==null&&r(o)}return t.jsxs("section",{className:"get-started-series","aria-label":_,children:[t.jsxs("article",{className:"get-started-playlist-card","aria-labelledby":"post-training-series-title",children:[t.jsx("button",{"aria-haspopup":"dialog","aria-label":`Open ${_} playlist`,className:"get-started-playlist-open",onClick:n,type:"button"}),t.jsxs("div",{className:"get-started-playlist-stack","aria-hidden":"true",children:[Be.map((o,b)=>{const y=A[o];return t.jsx("div",{className:`get-started-playlist-poster layer-${b+1}`,children:t.jsx("img",{alt:"",decoding:"async",src:y.posterUrl})},y.id)}),t.jsx("span",{className:"get-started-course-play-icon",children:t.jsx(k,{fill:"currentColor",size:19})}),t.jsxs("span",{className:"get-started-playlist-count",children:[A.length," lessons"]})]}),t.jsxs("div",{className:"get-started-playlist-copy",children:[t.jsxs("div",{className:"get-started-playlist-title",children:[t.jsx("h1",{id:"post-training-series-title",children:_}),t.jsx(Me,{})]}),t.jsxs("div",{className:"get-started-course-meta",children:[t.jsx("span",{children:"Learning series"}),t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:Ce})]}),t.jsx("p",{children:"Rewards, GRPO, RLVR, distillation, experiments, and a technical appendix."})]})]}),s?t.jsx(He,{activeLessonIndex:e,autoplay:i,fullCourseSelected:a,onClose:d,onEnded:v,onPause:m,onSelectLesson:r,onTimeUpdate:S,videoRef:l}):null]})}function He({activeLessonIndex:e,autoplay:a,fullCourseSelected:i,onClose:s,onEnded:d,onPause:n,onSelectLesson:r,onTimeUpdate:u,videoRef:l}){const p=A[e]??A[0],c=J(e),f=i?Y:p;return t.jsx(L,{autoAdvance:a&&!i,contained:!0,inertExclusionSelector:".get-started-learning-panel",navigation:i?void 0:{currentIndex:e,onNext:c!==null?()=>r(c):void 0,onPrevious:e>0?()=>r(e-1):void 0,total:A.length},onClose:s,onEnded:d,onPause:n,onTimeUpdate:u,video:f,videoRef:l})}const We={captionsUrl:ue,description:"See how Profile Agents combine chat, direct actions, shared runtime surfaces, and Evals.",duration:"1:16",eyebrow:"Agent overview",id:"openpond-agent-overview",posterUrl:ce,title:"What is an OpenPond Agent?",videoUrl:Pe};function Ze(e={}){const[a,i]=x.useState(null),[s,d]=x.useState(null),n=e.makeAgentTutorial===void 0?a:e.makeAgentTutorial,r=e.postTrainingCourse===void 0?s:e.postTrainingCourse,u=!!(r||n);function l(){if(e.onOpenMakeAgentTutorial){e.onOpenMakeAgentTutorial();return}d(null),i({autoplay:!0,playRequestId:0,videoId:"create"})}function p(){if(e.onCloseMakeAgentTutorial){e.onCloseMakeAgentTutorial();return}i(null)}function c(v){if(e.onSelectMakeAgentTutorialVideo){e.onSelectMakeAgentTutorialVideo(v);return}i(g=>g&&{...g,playRequestId:g.playRequestId+1,videoId:v})}function f(){if(e.onOpenPostTrainingCourse){e.onOpenPostTrainingCourse();return}i(null),d({autoplay:!0,fullCourseSelected:!1,lessonIndex:0,playRequestId:0})}function m(){if(e.onClosePostTrainingCourse){e.onClosePostTrainingCourse();return}d(null)}function S(v){if(e.onSelectPostTrainingLesson){e.onSelectPostTrainingLesson(v);return}d(g=>g&&{...g,fullCourseSelected:!1,lessonIndex:v,playRequestId:g.playRequestId+1})}return t.jsx("section",{className:`get-started-view ${u?"course-player-open":""}`,"aria-label":"Walkthroughs",children:t.jsxs("div",{className:"get-started-shell",children:[t.jsxs("section",{className:"get-started-start-here","aria-labelledby":"get-started-start-here-title",children:[t.jsx("header",{className:"get-started-section-heading",children:t.jsx("h2",{id:"get-started-start-here-title",children:"Start here"})}),t.jsx("div",{className:"get-started-learning-grid",children:t.jsx(ge,{titleElement:"h1",video:We})})]}),t.jsxs("section",{className:"get-started-walkthroughs","aria-labelledby":"get-started-walkthroughs-title",children:[t.jsx("header",{className:"get-started-section-heading",children:t.jsx("h2",{id:"get-started-walkthroughs-title",children:"Walkthroughs"})}),t.jsx("div",{className:"get-started-learning-grid",children:t.jsx(ke,{activeVideoId:n?.videoId??"create",autoplay:n?.autoplay??!0,onClose:p,onOpen:l,onSelectVideo:c,open:!!n,playRequestId:n?.playRequestId??0})})]}),t.jsxs("section",{className:"get-started-learn","aria-labelledby":"get-started-learn-title",children:[t.jsx("header",{className:"get-started-section-heading",children:t.jsx("h2",{id:"get-started-learn-title",children:"Learn deeper"})}),t.jsx("div",{className:"get-started-learning-grid",children:t.jsx(Fe,{activeLessonIndex:r?.lessonIndex??0,autoplay:r?.autoplay??!0,fullCourseSelected:r?.fullCourseSelected??!1,open:!!r,onClose:m,onOpen:f,onSelectLesson:S,playRequestId:r?.playRequestId??0})})]})]})})}export{Ze as GetStartedView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,j as e}from"./index-De4k_YMo.js";import{p as u}from"./LabsRoute-BhfxBg5_.js";import{d$ as n}from"./App-DQfdLgyV.js";import"./AppDialog-BnldMLvF.js";import"./cloud-upload-DisZOwXE.js";import"./MainPane-Dv5USGqR.js";import"./arrow-up-right-Dv3nebbh.js";import"./chat-file-links-DQYtkwit.js";import"./square-DUgXVoF0.js";import"./training-model-data-CKOkpBBL.js";import"./refresh-cw-D2E-pp4H.js";import"./info-B-n_omgE.js";/* empty css */import"./ComposerCreateImproveStrip-5LPlQFN4.js";import"./play-B5O4Hz_W.js";function H({api:o,policyId:r,sourceId:t,onBack:s}){const a=i.useMemo(()=>o.reviewClient(r,t),[o,r,t]),[p,m]=i.useState(null),[l,c]=i.useState(null);return e.jsxs("section",{"aria-label":"Hosted example review",children:[e.jsx("button",{type:"button",className:"training-button secondary",onClick:()=>{n(s)},children:"Back to continual learning"}),e.jsx("p",{children:"Reviewing hosted examples. Approved tasks become eligible for this policy's next training check."}),e.jsx(u,{client:a,selectedId:p,after:l,sourceId:t,onSelect:d=>{n(()=>m(d))},onPage:c})]})}export{H as HostedModelLearningReview};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as t}from"./index-
|
|
1
|
+
import{r as s,j as t}from"./index-De4k_YMo.js";import{u as J,n as K,o as W}from"./LabsRoute-BhfxBg5_.js";import{bX as I,co as Z,d_ as H,bY as U,cH as T,A as ee}from"./App-DQfdLgyV.js";import{A as ne}from"./AppDialog-BnldMLvF.js";import"./cloud-upload-DisZOwXE.js";import"./MainPane-Dv5USGqR.js";import"./arrow-up-right-Dv3nebbh.js";import"./chat-file-links-DQYtkwit.js";import"./square-DUgXVoF0.js";import"./training-model-data-CKOkpBBL.js";import"./refresh-cw-D2E-pp4H.js";import"./info-B-n_omgE.js";/* empty css */import"./ComposerCreateImproveStrip-5LPlQFN4.js";import"./play-B5O4Hz_W.js";function te(r,a){const n=a?.limits.maxIterationSpendUsd??r.trainingSetup.preferredMaximumSpendUsd??1;return{enabled:a?.enabled??!1,scheduled:!!(a&&["schedule","nightly","approved_count"].includes(a.trigger.kind)),intervalSeconds:a?.trigger.kind==="schedule"?a.trigger.intervalSeconds:86400,humanReviewRequired:a?.admission.mode!=="qualified_automatic",minimumApprovedExamples:a?.admission.minimumApprovedExamples??10,maxBatchExamples:a?.limits.maxBatchExamples??10,maxIterationSpendUsd:n,maxDailySpendUsd:a?.limits.maxDailySpendUsd??n,cooldownSeconds:a?.limits.cooldownSeconds??3600,maxRetries:a?.limits.maxRetries??0,maxBacklogExamples:a?.limits.maxBacklogExamples??1e3}}function ae(r){const{project:a,previous:n,settings:i}=r;if(n&&(n.id!==r.policyId||n.modelProjectId!==a.portableProjectId||n.executionOwner!=="hosted"))throw new I("learning_policy_model_mismatch",422,"Learning settings must belong to this hosted Model.");const g=r.applyModelConfiguration||!n,o=g?ie(a):null,h=g?a.trainingSetup.recipe?.method:n?.training.method,v=i.trigger??(i.scheduled?{kind:"schedule",intervalSeconds:i.intervalSeconds}:{kind:"manual"});if(i.enabled&&h!=="grpo")throw new I("learning_training_method_unsupported",422,"Hosted continual learning currently supports GRPO.");return Z.parse({schemaVersion:"openpond.learningPolicy.v1",id:r.policyId,revision:(n?.revision??0)+1,modelProjectId:a.portableProjectId,executionOwner:"hosted",enabled:i.enabled,sources:r.sources,taskDefinition:r.taskDefinition,rewardBinding:g?a.trainingSetup.rewardBindingRef:n?.rewardBinding,admission:{mode:i.humanReviewRequired?"human":"qualified_automatic",qualification:i.humanReviewRequired?null:n?.admission.qualification??null,minimumApprovedExamples:i.minimumApprovedExamples},trigger:v,trainingParent:o?.trainingParent??n?.trainingParent,teacher:n?.teacher??null,training:{method:h,recipe:o?.recipe??n?.training.recipe,retentionEvaluation:o?.retentionEvaluation??n?.training.retentionEvaluation,replayBatches:n?.training.replayBatches??[]},limits:{maxIterationSpendUsd:i.maxIterationSpendUsd,maxDailySpendUsd:i.maxDailySpendUsd,cooldownSeconds:i.cooldownSeconds,maxRetries:i.maxRetries,maxBatchExamples:i.maxBatchExamples,maxBacklogExamples:i.maxBacklogExamples},automation:{collect:!1,train:v.kind!=="manual",accept:!1,serve:!1},acceptance:n?.acceptance??{minimumScore:0,maximumRetentionRegression:0,requireImprovement:!0,rollbackVersion:null}})}function ie(r){const a=r.trainingSetup,n=a.baseModel??r.defaultBaseModel;if(!a.recipe||!n||!a.evaluationTasksetRef)throw new I("learning_model_configuration_incomplete",422,"Select a training recipe, starting model and retained evaluation before enabling hosted learning.");return{recipe:{id:`model-recipe-${r.etag}`,contentHash:H(a.recipe)},trainingParent:{id:n.modelId,contentHash:H(n)},retentionEvaluation:{id:a.evaluationTasksetRef.id,contentHash:a.evaluationTasksetRef.contentHash}}}function Se({client:r,project:a,policy:n,onClose:i}){const[g]=s.useState(()=>n?.id??`policy-${crypto.randomUUID()}`),[o]=s.useState(()=>te(a,n)),[h,v]=s.useState(o.enabled),[E,O]=s.useState(o.scheduled),[R,$]=s.useState(!n),[j,F]=s.useState(o.humanReviewRequired),[c,M]=s.useState(n?.sources??[]),[x,N]=s.useState(n?.taskDefinition??null),[d,V]=s.useState({interval:String(o.intervalSeconds/60),minimum:String(o.minimumApprovedExamples),batch:String(o.maxBatchExamples),spend:String(o.maxIterationSpendUsd),daily:String(o.maxDailySpendUsd),cooldown:String(o.cooldownSeconds/60),retries:String(o.maxRetries),backlog:String(o.maxBacklogExamples)}),[G,S]=s.useState(!1),[p,P]=s.useState(!1),[Q,q]=s.useState(null),[f,X]=s.useState(),[y,Y]=s.useState(null),[A,L]=s.useState(null),u=s.useRef(null),B=s.useRef(!1);s.useEffect(()=>{let e=!1;return r.sources(f).then(l=>{e||(Y({after:f,data:l}),L(null))},l=>{e||L(l instanceof Error?l.message:String(l))}),()=>{e=!0}},[r,f]);const k=y&&y.after===f?y.data:null,D=R?a.trainingSetup.rewardBindingRef:n?.rewardBinding;function z(e){const l=c.some(m=>m.id===e.id);M(l?c.filter(m=>m.id!==e.id):[...c,T(e)]),N(l&&c.length===1?null:x??e.taskDefinition),S(!0)}async function _(){if(B.current)return!1;B.current=!0,P(!0),q(null);try{if(!u.current){if(!x||!c.length||!D)throw new Error("Select task sources and a Model Reward before saving.");const e=ae({project:a,previous:n,policyId:g,applyModelConfiguration:R,sources:c,taskDefinition:x,settings:{enabled:h,scheduled:E,humanReviewRequired:j,intervalSeconds:Number(d.interval)*60,minimumApprovedExamples:Number(d.minimum),maxBatchExamples:Number(d.batch),maxIterationSpendUsd:Number(d.spend),maxDailySpendUsd:Number(d.daily),cooldownSeconds:Number(d.cooldown)*60,maxRetries:Number(d.retries),maxBacklogExamples:Number(d.backlog)}});u.current={action:"publish",kind:"policy",operationId:crypto.randomUUID(),expectedRevision:n?.revision??0,content:e}}return await r.command(u.current),u.current=null,S(!1),!0}catch(e){return e instanceof ee&&e.status>=400&&e.status<500&&![408,429].includes(e.status)&&(u.current=null),q(e instanceof Error?e.message:"Unable to save learning settings."),!1}finally{B.current=!1,P(!1)}}const w=J({name:"learning settings",dirty:G,busy:p,save:_});return t.jsxs(t.Fragment,{children:[t.jsxs(ne,{ariaLabel:"Continual learning settings",className:"labs-rename-dialog learning-workspace hosted-learning-settings",backdropClassName:"labs-rename-backdrop",dismissDisabled:p,onClose:()=>{w.requestLeave(i)},children:[t.jsx("h2",{children:"Continual learning settings"}),t.jsxs("p",{children:["Train ",a.name," from approved tasks. Acceptance and serving remain separate decisions."]}),t.jsx(K,{error:Q??A}),t.jsxs("form",{onSubmit:async e=>{e.preventDefault(),await _()&&(w.allowNextNavigation(),i())},children:[t.jsxs("fieldset",{disabled:p||!!u.current,onChange:()=>S(!0),children:[t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:h,onChange:e=>v(e.target.checked)})," Enable learning"]}),t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:j,disabled:j,onChange:()=>F(!0)})," Human review required"]}),t.jsx("p",{children:"New policies require human review. Qualified automatic admission cannot be configured here yet."}),n?t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:R,onChange:e=>$(e.target.checked)})," Use the Model’s current training configuration"]}):null,t.jsxs("fieldset",{children:[t.jsx("legend",{children:"Task sources"}),!k&&!A?t.jsx("p",{children:"Loading sources…"}):null,k?.sources.items.map(e=>{const l=k.definitions.find(C=>U(T(C),e.taskDefinition)),m=!!(D&&l&&U(D,l.rewardBinding)&&(!x||U(x,e.taskDefinition))),b=c.find(C=>C.id===e.id);return t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:!!b,disabled:!b&&(!e.enabled||!m),onChange:()=>z(e)})," ",e.name,b&&b.revision!==e.revision?t.jsxs("small",{children:["Using saved revision ",b.revision,"; clear and reselect to update."]}):m?null:t.jsx("small",{children:"Different task format or Reward."})]},e.id)}),t.jsxs("p",{children:[c.length," sources selected. ",t.jsx("button",{type:"button",onClick:()=>{M([]),N(null),S(!0)},children:"Clear selection"})]}),t.jsx(W,{after:f,next:k?.sources.nextCursor,onPage:e=>X(e??void 0)})]}),t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:E,onChange:e=>O(e.target.checked)})," Schedule training"]}),Object.keys(d).filter(e=>e!=="interval"||E).map(e=>t.jsxs("label",{children:[{interval:"Check interval (minutes)",minimum:"Minimum approved examples",batch:"Maximum examples per batch",spend:"Maximum spend per iteration ($)",daily:"Maximum daily spend ($)",cooldown:"Cooldown (minutes)",retries:"Automatic retries",backlog:"Maximum backlog"}[e],t.jsx("input",{type:"number",value:d[e],min:"0",step:e==="spend"||e==="daily"?"0.01":"1",onChange:l=>V(m=>({...m,[e]:l.target.value}))})]},e))]}),t.jsxs("div",{className:"model-build-actions",children:[t.jsx("button",{type:"submit",className:"training-button",disabled:p,children:p?"Saving…":u.current?"Retry save":"Save settings"}),t.jsx("button",{type:"button",className:"training-button secondary",disabled:p,onClick:()=>{w.requestLeave(i)},children:"Cancel"})]})]})]}),w.dialog]})}export{Se as HostedModelLearningSettings};
|