openpond 0.0.63 → 0.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/chunks/{app-layer-TUAFALOE.js → app-layer-NCSTDSNQ.js} +2 -2
  2. package/dist/chunks/{app-server-runtime-O26LVUYH.js → app-server-runtime-6PDQHOBE.js} +6 -6
  3. package/dist/chunks/{apps-KSZRA7Y2.js → apps-HEG7FEEV.js} +2 -2
  4. package/dist/chunks/{chunk-JTFDOA2P.js → chunk-6FZNXLVN.js} +17 -5
  5. package/dist/chunks/{chunk-7UVEB2AZ.js → chunk-B63GTC7F.js} +2 -2
  6. package/dist/chunks/{chunk-IXA5PMXC.js → chunk-BRLUAT6S.js} +1 -1
  7. package/dist/chunks/{chunk-6FKBOGA4.js → chunk-EWP6VGHP.js} +1 -1
  8. package/dist/chunks/{chunk-V2CTXKS2.js → chunk-HJJYGJ36.js} +205 -141
  9. package/dist/chunks/{chunk-KGU437HZ.js → chunk-JMHOO2IG.js} +2 -2
  10. package/dist/chunks/{chunk-66KQLYSH.js → chunk-LNYGV6AM.js} +1 -1
  11. package/dist/chunks/{chunk-7IFPXSSJ.js → chunk-TW4YWBQR.js} +1 -1
  12. package/dist/chunks/{chunk-LEL5AQJU.js → chunk-U345JN44.js} +1 -1
  13. package/dist/chunks/{chunk-YDH34BGG.js → chunk-WT3THPTX.js} +32 -32
  14. package/dist/chunks/{cli-LPFU4ULD.js → cli-CQOUYUQ4.js} +5 -5
  15. package/dist/chunks/{core-commands-OEOBYFIW.js → core-commands-Y4ZMQXO4.js} +3 -3
  16. package/dist/chunks/{desktop-test-BRLZF3O7.js → desktop-test-YRFKONLO.js} +2 -2
  17. package/dist/chunks/{extension-5BUCIDKG.js → extension-4MFKIC6Q.js} +2 -2
  18. package/dist/chunks/{help-MT6VPW4X.js → help-STXVR4NO.js} +1 -1
  19. package/dist/chunks/{opchat-O4DVKNFW.js → opchat-CCVKI5GH.js} +2 -2
  20. package/dist/chunks/{organizations-ACNOJ57Q.js → organizations-AS76SGLP.js} +4 -4
  21. package/dist/chunks/{profile-7LLWXAJE.js → profile-QNWDNZY3.js} +2 -2
  22. package/dist/chunks/{project-agent-RVYQYTU2.js → project-agent-GPZL7KAL.js} +2 -2
  23. package/dist/chunks/{sandbox-command-QST23BX5.js → sandbox-command-LC63MMAA.js} +2 -2
  24. package/dist/chunks/{sandbox-template-N7UG3P6V.js → sandbox-template-FPQLZ4IP.js} +3 -3
  25. package/dist/chunks/{src-CPM5Q7T5.js → src-6NIBZPH2.js} +3 -3
  26. package/dist/chunks/{src-M37V6NVU.js → src-ESTRZ2YU.js} +12 -63
  27. package/dist/chunks/{teams-bot-ITTI47XS.js → teams-bot-YTX7IC2J.js} +2 -2
  28. package/dist/chunks/{workspaces-CYBR37US.js → workspaces-ODK2CTFF.js} +2 -2
  29. package/dist/cli.js +13 -13
  30. package/dist/web/assets/{AppDialog-wIb8mGQ0.js → AppDialog-DacC7BcY.js} +1 -1
  31. package/dist/web/assets/{AppsView-D097dPIV.js → AppsView-mkeAkrvr.js} +1 -1
  32. package/dist/web/assets/{BrowserSidebar-DrD-o_yB.js → BrowserSidebar-1aEC6gsF.js} +1 -1
  33. package/dist/web/assets/{CommandMenu-L5LelA2h.js → CommandMenu-BN6J3ecV.js} +1 -1
  34. package/dist/web/assets/{CommunityView-DUJ8NryS.js → CommunityView-B2v9Q4cw.js} +1 -1
  35. package/dist/web/assets/{ComposerCreateImproveStrip-BP-7DmQG.js → ComposerCreateImproveStrip-BH8Ath1h.js} +1 -1
  36. package/dist/web/assets/{GetStartedView-B7gB6Hii.js → GetStartedView-B-R-KSva.js} +1 -1
  37. package/dist/web/assets/{LabModelVersionDetailPage-CNDz2a6I.js → LabModelVersionDetailPage-Bhfa7T00.js} +1 -1
  38. package/dist/web/assets/{LabSkillSidebar-BImOQcjk.js → LabSkillSidebar-CbYdG0RN.js} +1 -1
  39. package/dist/web/assets/{LabsRoute-BauSK1is.js → LabsRoute-DFV5vV6Z.js} +3 -3
  40. package/dist/web/assets/{MainChatThread-BZvAqQO6.js → MainChatThread-COiXI7ri.js} +2 -2
  41. package/dist/web/assets/MainPane-CQCLhV5C.js +6 -0
  42. package/dist/web/assets/MarkdownText-R3MC5S30.js +9 -0
  43. package/dist/web/assets/{Messages-DijmQL-z.js → Messages-DpZ8mIz8.js} +1 -1
  44. package/dist/web/assets/{NativeSkillSidebar-aCkrdGa0.js → NativeSkillSidebar-BfcMqLHA.js} +1 -1
  45. package/dist/web/assets/{NewProjectDialog-D98WIQzr.js → NewProjectDialog-DqTX1Eeo.js} +1 -1
  46. package/dist/web/assets/{OutputsPage-BA0c6cfy.js → OutputsPage-DfZYswx2.js} +1 -1
  47. package/dist/web/assets/{RightChatPanelStack-DKDEmrEH.js → RightChatPanelStack-DH8QjiDY.js} +1 -1
  48. package/dist/web/assets/{ScheduledWorkPage-DeHi99mv.js → ScheduledWorkPage-DkaVUnwj.js} +1 -1
  49. package/dist/web/assets/SettingsView-BRPrJuP5.css +1 -0
  50. package/dist/web/assets/SettingsView-StVFsSJ6.js +6 -0
  51. package/dist/web/assets/{TeamChatView-D2mCoLZ3.js → TeamChatView-CqZOnQh2.js} +1 -1
  52. package/dist/web/assets/{TerminalOverlay-BHMsVp4L.js → TerminalOverlay-CnFv6FZT.js} +1 -1
  53. package/dist/web/assets/{TrainingCreationPanel-CPnMWgkt.js → TrainingCreationPanel-CWzyzmyT.js} +1 -1
  54. package/dist/web/assets/{TrainingDraftPanel-0scEtzSW.js → TrainingDraftPanel-BVHx0HZ0.js} +1 -1
  55. package/dist/web/assets/{UsageSettingsSection-COoCLLg6.js → UsageSettingsSection-Bdvm66WK.js} +1 -1
  56. package/dist/web/assets/{WorkspaceDiffPanel-BFTwZ_dB.js → WorkspaceDiffPanel-DUCjD1GA.js} +5 -5
  57. package/dist/web/assets/{WorkspaceEnvironmentMenu-DFlkdd9T.js → WorkspaceEnvironmentMenu-DHGrt_ie.js} +1 -1
  58. package/dist/web/assets/{WorkspaceGitDialogs-Dt3LO27Z.js → WorkspaceGitDialogs-hI57yjPL.js} +1 -1
  59. package/dist/web/assets/{WorkspaceMonacoEditor-3g05teoR.js → WorkspaceMonacoEditor-DPv-1uO6.js} +3 -3
  60. package/dist/web/assets/{arrow-up-right-DYGSWA2J.js → arrow-up-right-BDcNd1rt.js} +1 -1
  61. package/dist/web/assets/{chevron-up-4qfvI9iW.js → chevron-up-XTMMnfnf.js} +1 -1
  62. package/dist/web/assets/{cloud-upload-COReKxOy.js → cloud-upload-D6bS8rS2.js} +1 -1
  63. package/dist/web/assets/{cssMode-BbH67BYF.js → cssMode-CvN9o8bP.js} +1 -1
  64. package/dist/web/assets/{folder-open-9OjGqNgP.js → folder-open-8C5l7A93.js} +1 -1
  65. package/dist/web/assets/{folder-plus-DF5E6zr3.js → folder-plus-B9Wqb9yd.js} +1 -1
  66. package/dist/web/assets/{git-branch-eCwyZXMl.js → git-branch-C45ve7zh.js} +1 -1
  67. package/dist/web/assets/{git-commit-horizontal-cPm51DqY.js → git-commit-horizontal-CGoLIyKK.js} +1 -1
  68. package/dist/web/assets/{htmlMode-DD6Oge4x.js → htmlMode-DxLP6j5r.js} +1 -1
  69. package/dist/web/assets/index-BYgrO3wt.js +1 -0
  70. package/dist/web/assets/index-CHqMtVfF.css +1 -0
  71. package/dist/web/assets/{index-BO2W2U23.js → index-LrGasYyx.js} +29 -29
  72. package/dist/web/assets/{info-p1mFpqBI.js → info-DTObFlHw.js} +1 -1
  73. package/dist/web/assets/{jsonMode-C2Xd56A_.js → jsonMode-C3_fOSJu.js} +1 -1
  74. package/dist/web/assets/{lspLanguageFeatures-BjYEk4gJ.js → lspLanguageFeatures-0c-UKStE.js} +1 -1
  75. package/dist/web/assets/{monaco.contribution-quEPEMQZ.js → monaco.contribution-CF1DgPPC.js} +2 -2
  76. package/dist/web/assets/{monaco.contribution-C7WMqwmc.js → monaco.contribution-CFLEc9Ly.js} +2 -2
  77. package/dist/web/assets/{monaco.contribution-Bo-5m7yy.js → monaco.contribution-Cb7KlQ6G.js} +2 -2
  78. package/dist/web/assets/{monaco.contribution-DzWlEgU1.js → monaco.contribution-Dsug_FPj.js} +2 -2
  79. package/dist/web/assets/{play-Ctx-iMqd.js → play-Cbsyrwkw.js} +1 -1
  80. package/dist/web/assets/{python-Cm64qCpk.js → python-DVcVB2lF.js} +1 -1
  81. package/dist/web/assets/{refresh-cw-Bn28jIl0.js → refresh-cw-ChUK_QfF.js} +1 -1
  82. package/dist/web/assets/{save-BM5IQX65.js → save-Doep-KC7.js} +1 -1
  83. package/dist/web/assets/{square-DAGpFfSr.js → square-B5q2aneb.js} +1 -1
  84. package/dist/web/assets/{toggleHighContrast-DLW8Fnck.js → toggleHighContrast-CTZp7RE7.js} +1 -1
  85. package/dist/web/assets/{tsMode-BleUN_8S.js → tsMode-GfNadOOB.js} +1 -1
  86. package/dist/web/assets/{upload-vaAKFfxi.js → upload-DcewuCTa.js} +1 -1
  87. package/dist/web/assets/{useLocalAgentSchedules-Ccenbqf6.js → useLocalAgentSchedules-BwltnId8.js} +1 -1
  88. package/dist/web/assets/{wifi-off-DJA9KReb.js → wifi-off-cXPyKIzd.js} +1 -1
  89. package/dist/web/assets/{workers-CFG-afha.js → workers-CP6kCS63.js} +1 -1
  90. package/dist/web/assets/{yaml-Cs8iZKVC.js → yaml-w0GP6yKf.js} +1 -1
  91. package/dist/web/index.html +2 -2
  92. package/package.json +1 -1
  93. package/dist/web/assets/MainPane-CuhwxMxg.js +0 -6
  94. package/dist/web/assets/MarkdownText-gwAue4u5.js +0 -9
  95. package/dist/web/assets/SettingsView--fL3Ecuy.js +0 -6
  96. package/dist/web/assets/SettingsView-BS5m5vdt.css +0 -1
  97. package/dist/web/assets/index-BRLugX1S.js +0 -1
  98. package/dist/web/assets/index-Y7IoiSlQ.css +0 -1
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
3
3
  import {
4
4
  parseArgs
5
- } from "./chunks/chunk-LEL5AQJU.js";
5
+ } from "./chunks/chunk-U345JN44.js";
6
6
  import {
7
7
  resolveAccountOption,
8
8
  resolveBaseUrlOption
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  getInstalledCliVersion,
12
12
  runCliCommand
13
- } from "./chunks/chunk-YDH34BGG.js";
13
+ } from "./chunks/chunk-WT3THPTX.js";
14
14
  import "./chunks/chunk-KSRWKXRB.js";
15
15
  import {
16
16
  parseBooleanOption
@@ -37,11 +37,11 @@ async function runOpenPondCli(argv = process.argv.slice(2)) {
37
37
  return;
38
38
  }
39
39
  if (action === "check-update") {
40
- await (await import("./chunks/core-commands-OEOBYFIW.js")).runCheckUpdate();
40
+ await (await import("./chunks/core-commands-Y4ZMQXO4.js")).runCheckUpdate();
41
41
  return;
42
42
  }
43
43
  if (action === "help") {
44
- (await import("./chunks/help-MT6VPW4X.js")).printHelp();
44
+ (await import("./chunks/help-STXVR4NO.js")).printHelp();
45
45
  return;
46
46
  }
47
47
  const selectedAccount = resolveAccountOption(options);
@@ -53,25 +53,25 @@ async function runOpenPondCli(argv = process.argv.slice(2)) {
53
53
  process.env.OPENPOND_BASE_URL = selectedBaseUrl;
54
54
  }
55
55
  if (action === "tui") {
56
- await (await import("./chunks/app-layer-TUAFALOE.js")).runOpenPondTerminalCommand(options, rest);
56
+ await (await import("./chunks/app-layer-NCSTDSNQ.js")).runOpenPondTerminalCommand(options, rest);
57
57
  return;
58
58
  }
59
59
  if (action === "ui") {
60
- await (await import("./chunks/app-layer-TUAFALOE.js")).runOpenPondServerCommand("web", options, rest);
60
+ await (await import("./chunks/app-layer-NCSTDSNQ.js")).runOpenPondServerCommand("web", options, rest);
61
61
  return;
62
62
  }
63
63
  if (await runCliCommand({ command, options, rest })) {
64
64
  return;
65
65
  }
66
- (await import("./chunks/help-MT6VPW4X.js")).printHelp();
66
+ (await import("./chunks/help-STXVR4NO.js")).printHelp();
67
67
  process.exit(1);
68
68
  }
69
69
  async function runEmbeddedCompanion(argv) {
70
70
  if (argv[0] === "__app-server") {
71
71
  process.argv = [process.execPath, "openpond-app-server", ...argv.slice(1)];
72
72
  const [{ createOpenPondAppServer }, { runOpenPondAppServerCli }] = await Promise.all([
73
- import("./chunks/app-server-runtime-O26LVUYH.js"),
74
- import("./chunks/cli-LPFU4ULD.js")
73
+ import("./chunks/app-server-runtime-6PDQHOBE.js"),
74
+ import("./chunks/cli-CQOUYUQ4.js")
75
75
  ]);
76
76
  await runOpenPondAppServerCli(createOpenPondAppServer);
77
77
  return true;
@@ -79,15 +79,15 @@ async function runEmbeddedCompanion(argv) {
79
79
  if (argv[0] === "__server") {
80
80
  process.argv = [process.execPath, "openpond-server", ...argv.slice(1)];
81
81
  const [{ createOpenPondServer }, { runOpenPondServerCli }] = await Promise.all([
82
- import("./chunks/src-M37V6NVU.js"),
83
- import("./chunks/cli-LPFU4ULD.js")
82
+ import("./chunks/src-ESTRZ2YU.js"),
83
+ import("./chunks/cli-CQOUYUQ4.js")
84
84
  ]);
85
- const { createOpenPondAppServer } = await import("./chunks/app-server-runtime-O26LVUYH.js");
85
+ const { createOpenPondAppServer } = await import("./chunks/app-server-runtime-6PDQHOBE.js");
86
86
  await runOpenPondServerCli({ createOpenPondServer, createOpenPondAppServer });
87
87
  return true;
88
88
  }
89
89
  if (argv[0] === "__terminal") {
90
- await (await import("./chunks/src-CPM5Q7T5.js")).runOpenPondTerminalCli(argv.slice(1));
90
+ await (await import("./chunks/src-6NIBZPH2.js")).runOpenPondTerminalCli(argv.slice(1));
91
91
  return true;
92
92
  }
93
93
  return false;
@@ -1 +1 @@
1
- import{r as s,j as w}from"./index-BO2W2U23.js";const d=[],v=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])","[contenteditable='true']"].join(",");function T({ariaLabel:r,backdropClassName:o="training-dialog-backdrop",children:a,className:i,contained:t=!1,dismissDisabled:e=!1,initialFocusKey:u,inertExclusionSelector:p,onClose:m}){const f=s.useRef(null),A=s.useRef(Symbol("app-dialog")),b=s.useRef(null),h=s.useRef(e),g=s.useRef(m);h.current=e,g.current=m,s.useEffect(()=>{const n=A.current;b.current=document.activeElement instanceof HTMLElement?document.activeElement:null,d.push(n);const l=t?f.current?.closest(".main-pane")??null:null,E=I(f.current,l,p);function y(c){if(d.at(-1)===n){if(c.key==="Escape"){c.preventDefault(),c.stopPropagation(),h.current||g.current();return}c.key!=="Tab"||t||F(c,f.current)}}return document.addEventListener("keydown",y,!0),()=>{document.removeEventListener("keydown",y,!0);const c=d.lastIndexOf(n);c>=0&&d.splice(c,1),E();const x=b.current;x?.isConnected&&x.focus()}},[t,p]),s.useEffect(()=>{const n=window.requestAnimationFrame(()=>{const l=f.current;(l?.querySelector("[data-autofocus]")??l)?.focus()});return()=>window.cancelAnimationFrame(n)},[u]);function R(n){n.target===n.currentTarget&&!e&&m()}function k(n){n.key==="Escape"&&n.stopPropagation()}return w.jsx("div",{className:o,role:"presentation",onMouseDown:R,children:w.jsx("section",{ref:f,"aria-busy":e||void 0,"aria-label":r,"aria-modal":t?void 0:"true",className:i,role:"dialog",tabIndex:-1,onKeyDown:k,onMouseDown:n=>n.stopPropagation(),children:a})})}function D(r){return r?Array.from(r.querySelectorAll(v)).filter(o=>!o.hidden&&o.getAttribute("aria-hidden")!=="true"):[]}function F(r,o){if(!o)return;const a=D(o);if(a.length===0){r.preventDefault(),o.focus();return}const i=a.indexOf(document.activeElement),t=r.shiftKey?i<=0?a.length-1:i-1:i<0||i===a.length-1?0:i+1;r.preventDefault(),a[t]?.focus()}function I(r,o=null,a){if(!r)return()=>{};const i=[];let t=r.parentElement??r;for(;t.parentElement&&t!==document.body;){const e=t.parentElement;for(const u of Array.from(e.children))u===t||!(u instanceof HTMLElement)||a&&u.matches(a)||(i.push({element:u,ariaHidden:u.getAttribute("aria-hidden"),inert:u.inert}),u.inert=!0,u.setAttribute("aria-hidden","true"));if(t=e,o&&t===o)break}return()=>{for(const e of i.reverse())e.element.inert=e.inert,e.ariaHidden===null?e.element.removeAttribute("aria-hidden"):e.element.setAttribute("aria-hidden",e.ariaHidden)}}export{T as A};
1
+ import{r as s,j as w}from"./index-LrGasYyx.js";const d=[],v=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])","[contenteditable='true']"].join(",");function T({ariaLabel:r,backdropClassName:o="training-dialog-backdrop",children:a,className:i,contained:t=!1,dismissDisabled:e=!1,initialFocusKey:u,inertExclusionSelector:p,onClose:m}){const f=s.useRef(null),A=s.useRef(Symbol("app-dialog")),b=s.useRef(null),h=s.useRef(e),g=s.useRef(m);h.current=e,g.current=m,s.useEffect(()=>{const n=A.current;b.current=document.activeElement instanceof HTMLElement?document.activeElement:null,d.push(n);const l=t?f.current?.closest(".main-pane")??null:null,E=I(f.current,l,p);function y(c){if(d.at(-1)===n){if(c.key==="Escape"){c.preventDefault(),c.stopPropagation(),h.current||g.current();return}c.key!=="Tab"||t||F(c,f.current)}}return document.addEventListener("keydown",y,!0),()=>{document.removeEventListener("keydown",y,!0);const c=d.lastIndexOf(n);c>=0&&d.splice(c,1),E();const x=b.current;x?.isConnected&&x.focus()}},[t,p]),s.useEffect(()=>{const n=window.requestAnimationFrame(()=>{const l=f.current;(l?.querySelector("[data-autofocus]")??l)?.focus()});return()=>window.cancelAnimationFrame(n)},[u]);function R(n){n.target===n.currentTarget&&!e&&m()}function k(n){n.key==="Escape"&&n.stopPropagation()}return w.jsx("div",{className:o,role:"presentation",onMouseDown:R,children:w.jsx("section",{ref:f,"aria-busy":e||void 0,"aria-label":r,"aria-modal":t?void 0:"true",className:i,role:"dialog",tabIndex:-1,onKeyDown:k,onMouseDown:n=>n.stopPropagation(),children:a})})}function D(r){return r?Array.from(r.querySelectorAll(v)).filter(o=>!o.hidden&&o.getAttribute("aria-hidden")!=="true"):[]}function F(r,o){if(!o)return;const a=D(o);if(a.length===0){r.preventDefault(),o.focus();return}const i=a.indexOf(document.activeElement),t=r.shiftKey?i<=0?a.length-1:i-1:i<0||i===a.length-1?0:i+1;r.preventDefault(),a[t]?.focus()}function I(r,o=null,a){if(!r)return()=>{};const i=[];let t=r.parentElement??r;for(;t.parentElement&&t!==document.body;){const e=t.parentElement;for(const u of Array.from(e.children))u===t||!(u instanceof HTMLElement)||a&&u.matches(a)||(i.push({element:u,ariaHidden:u.getAttribute("aria-hidden"),inert:u.inert}),u.inert=!0,u.setAttribute("aria-hidden","true"));if(t=e,o&&t===o)break}return()=>{for(const e of i.reverse())e.element.inert=e.inert,e.ariaHidden===null?e.element.removeAttribute("aria-hidden"):e.element.setAttribute("aria-hidden",e.ariaHidden)}}export{T as A};
@@ -1 +1 @@
1
- import{r,bF as b,p as L,j as e,ar as I,a as k,X as P,O as F,a4 as E,ba as U,bG as T,h as R}from"./index-BO2W2U23.js";const O=["For agents","Featured","Productivity","Developer tools"],D=new Set(["slack","google","github","mcp"]);function J({account:s,connection:n,defaultTeamId:a,onToast:o}){const[c,f]=r.useState(null),[p,v]=r.useState(""),[i,y]=r.useState("For agents"),[u,h]=r.useState(()=>b()),[g,d]=r.useState("idle"),[w,x]=r.useState(null),S=s?.baseUrl??s?.activeProfile?.baseUrl??null,C=M(a,w),N=r.useMemo(()=>u.filter(t=>z(t,i)).filter(t=>q(t,p)),[i,p,u]);r.useEffect(()=>{let t=!0;return n?(d("loading"),L.connectedAppStatus(n,{status:"all"}).then(l=>{t&&(h(l.apps),x(l.teamId?.trim()||null),d("ready"))}).catch(l=>{t&&(console.warn("Unable to load connected app status.",l),h(b()),x(null),d("error"))}),()=>{t=!1}):(h(b()),d("idle"),x(null),()=>{t=!1})},[n]);function A(t){const l=T({appId:t.id,baseUrl:S,teamId:C});G(l).catch(j=>{o?.(j instanceof Error?j.message:String(j),"error")})}return e.jsxs("section",{className:"connected-apps-view","aria-label":"Apps",children:[e.jsxs("div",{className:"connected-apps-header",children:[e.jsxs("div",{children:[e.jsx("h1",{children:"Apps"}),e.jsx("p",{children:"Connect apps that agents can use for chat, knowledge, files, and workflow actions."})]}),e.jsxs("label",{className:"connected-apps-search",children:[e.jsx(I,{size:15}),e.jsx("input",{"aria-label":"Search apps",onChange:t=>v(t.target.value),placeholder:"Search apps",type:"search",value:p})]})]}),e.jsxs("div",{className:`connected-apps-status-strip ${g}`,children:[e.jsx("span",{children:V(g)}),e.jsxs("span",{children:[W(u)," connected"]})]}),e.jsxs("section",{className:"connected-apps-hero","aria-label":"App context",children:[e.jsxs("div",{className:"connected-apps-hero-copy",children:[e.jsx("span",{className:"connected-apps-hero-icon",children:e.jsx(m,{appId:"github"})}),e.jsx("h2",{children:"Work with your apps"}),e.jsx("p",{children:"Bring repositories, documents, chat, calendars, and custom MCP tools into OpenPond."})]}),e.jsxs("div",{className:"connected-apps-context-card","aria-hidden":"true",children:[e.jsx("strong",{children:"Agent context"}),e.jsxs("div",{children:[e.jsx("span",{className:"files",children:"Files"}),e.jsx("span",{className:"chat",children:"Chat"}),e.jsx("span",{className:"oauth",children:"OAuth"}),e.jsx("span",{className:"mcp",children:"MCP"})]})]})]}),e.jsx("div",{className:"connected-apps-filters",role:"tablist","aria-label":"App categories",children:O.map(t=>e.jsx("button",{"aria-selected":i===t,className:i===t?"active":"",onClick:()=>y(t),role:"tab",type:"button",children:t},t))}),e.jsxs("div",{className:"connected-apps-list",children:[N.map(t=>e.jsx(_,{app:t,onSelect:()=>f(t)},t.id)),N.length===0?e.jsx("div",{className:"connected-apps-empty",children:"No apps match the current search."}):null]}),c?e.jsx($,{app:c,onClose:()=>f(null),onInstall:()=>A(c)}):null]})}function M(s,n){const a=s?.trim();return a||n?.trim()||null}function _({app:s,onSelect:n}){return e.jsxs("button",{className:"connected-app-row",onClick:n,type:"button",children:[e.jsxs("span",{className:"connected-app-row-main",children:[e.jsx(m,{appId:s.id}),e.jsxs("span",{className:"connected-app-copy",children:[e.jsxs("span",{className:"connected-app-title",children:[e.jsx("strong",{children:s.label}),e.jsxs("span",{children:[s.shortLabel!==s.label?s.shortLabel:s.category," / ",s.setupSurfaceLabel]})]}),e.jsx("span",{children:s.description}),e.jsxs("span",{className:"connected-app-capability-row",children:[s.capabilityLabels.slice(0,2).map(a=>e.jsx("span",{children:a},a)),s.capabilityLabels.length>2?e.jsxs("span",{children:["+",s.capabilityLabels.length-2]}):null]})]})]}),e.jsx("span",{className:`connected-app-status-pill ${s.status}`,children:s.statusLabel}),e.jsx(k,{size:16})]})}function $({app:s,onClose:n,onInstall:a}){const o=s.connections.filter(c=>c.status==="active");return e.jsx("div",{className:"connected-app-dialog-backdrop",role:"presentation",onMouseDown:c=>{c.target===c.currentTarget&&n()},children:e.jsxs("section",{className:"connected-app-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"connected-app-dialog-title",children:[e.jsx("button",{className:"connected-app-dialog-close",type:"button","aria-label":"Close app details",onClick:n,children:e.jsx(P,{size:17})}),e.jsxs("div",{className:"connected-app-dialog-identity",children:[e.jsx("span",{className:"openpond-mark",children:e.jsx("img",{alt:"",src:F})}),e.jsxs("span",{className:"connection-dots","aria-hidden":"true",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]}),e.jsx(m,{appId:s.id})]}),e.jsxs("h2",{id:"connected-app-dialog-title",children:["Connect ",s.label]}),e.jsxs("div",{className:"connected-app-approval",children:[e.jsx(E,{size:16}),e.jsx("span",{children:s.statusLabel})]}),e.jsxs("div",{className:"connected-app-dialog-body",children:[e.jsxs("section",{children:[e.jsx("h3",{children:s.setupSurfaceLabel}),e.jsx("p",{children:"The web flow shows the provider account, workspace, and requested access before anything is connected."})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Connected account"}),e.jsx("p",{children:X(o)})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Available capabilities"}),e.jsx("div",{className:"connected-app-dialog-capabilities",children:s.capabilities.map(c=>e.jsx("span",{children:c.label},c.id))})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Sandbox lease policy"}),e.jsx("p",{children:s.leasePolicy.leaseable?`Leaseable for ${s.leasePolicy.defaultTtlSeconds??0} seconds with scoped proxy access.`:"Managed as setup or tool discovery; no OAuth lease is required."})]})]}),e.jsxs("button",{className:"connected-app-dialog-primary",type:"button",onClick:a,children:[e.jsx("span",{children:s.installLabel}),e.jsx(U,{size:15})]})]})})}function m({appId:s}){return e.jsx("span",{className:`connected-app-icon app-${s}`,children:e.jsx("img",{alt:"",src:B(s)})})}function z(s,n){return n==="For agents"?!0:n==="Featured"?D.has(s.id):n==="Productivity"?s.category==="Productivity"||s.category==="Chat":s.category==="Developer tools"||s.id==="mcp"}function q(s,n){const a=n.trim().toLowerCase();return a?[s.id,s.label,s.shortLabel,s.category,s.description,s.providerFamily,s.setupSurface].some(o=>o.toLowerCase().includes(a)):!0}function B(s){return R(s)}async function G(s){const n=window.openpond?.browser;if(n){const a=await n.openExternal({conversationId:"connected-apps",url:s});if(!a.ok)throw new Error(a.error??"Unable to open app setup.");return}window.open(s,"_blank","noopener,noreferrer")}function V(s){return s==="loading"?"Checking connections":s==="ready"?"Connection status current":s==="error"?"Connection status unavailable":"Connection status pending"}function W(s){return s.filter(n=>n.connected).length}function X(s){return s.length===0?"No active OAuth connection for this setup surface.":s.map(n=>{const a=n.accountLabel??"Connected account";return n.workspaceLabel?`${a} / ${n.workspaceLabel}`:a}).join(", ")}export{J as AppsView,_ as ConnectedAppRow,M as connectedAppSetupTeamId};
1
+ import{r,bF as b,p as L,j as e,ar as I,a as k,X as P,O as F,a4 as E,ba as U,bG as T,h as R}from"./index-LrGasYyx.js";const O=["For agents","Featured","Productivity","Developer tools"],D=new Set(["slack","google","github","mcp"]);function J({account:s,connection:n,defaultTeamId:a,onToast:o}){const[c,f]=r.useState(null),[p,v]=r.useState(""),[i,y]=r.useState("For agents"),[u,h]=r.useState(()=>b()),[g,d]=r.useState("idle"),[w,x]=r.useState(null),S=s?.baseUrl??s?.activeProfile?.baseUrl??null,C=M(a,w),N=r.useMemo(()=>u.filter(t=>z(t,i)).filter(t=>q(t,p)),[i,p,u]);r.useEffect(()=>{let t=!0;return n?(d("loading"),L.connectedAppStatus(n,{status:"all"}).then(l=>{t&&(h(l.apps),x(l.teamId?.trim()||null),d("ready"))}).catch(l=>{t&&(console.warn("Unable to load connected app status.",l),h(b()),x(null),d("error"))}),()=>{t=!1}):(h(b()),d("idle"),x(null),()=>{t=!1})},[n]);function A(t){const l=T({appId:t.id,baseUrl:S,teamId:C});G(l).catch(j=>{o?.(j instanceof Error?j.message:String(j),"error")})}return e.jsxs("section",{className:"connected-apps-view","aria-label":"Apps",children:[e.jsxs("div",{className:"connected-apps-header",children:[e.jsxs("div",{children:[e.jsx("h1",{children:"Apps"}),e.jsx("p",{children:"Connect apps that agents can use for chat, knowledge, files, and workflow actions."})]}),e.jsxs("label",{className:"connected-apps-search",children:[e.jsx(I,{size:15}),e.jsx("input",{"aria-label":"Search apps",onChange:t=>v(t.target.value),placeholder:"Search apps",type:"search",value:p})]})]}),e.jsxs("div",{className:`connected-apps-status-strip ${g}`,children:[e.jsx("span",{children:V(g)}),e.jsxs("span",{children:[W(u)," connected"]})]}),e.jsxs("section",{className:"connected-apps-hero","aria-label":"App context",children:[e.jsxs("div",{className:"connected-apps-hero-copy",children:[e.jsx("span",{className:"connected-apps-hero-icon",children:e.jsx(m,{appId:"github"})}),e.jsx("h2",{children:"Work with your apps"}),e.jsx("p",{children:"Bring repositories, documents, chat, calendars, and custom MCP tools into OpenPond."})]}),e.jsxs("div",{className:"connected-apps-context-card","aria-hidden":"true",children:[e.jsx("strong",{children:"Agent context"}),e.jsxs("div",{children:[e.jsx("span",{className:"files",children:"Files"}),e.jsx("span",{className:"chat",children:"Chat"}),e.jsx("span",{className:"oauth",children:"OAuth"}),e.jsx("span",{className:"mcp",children:"MCP"})]})]})]}),e.jsx("div",{className:"connected-apps-filters",role:"tablist","aria-label":"App categories",children:O.map(t=>e.jsx("button",{"aria-selected":i===t,className:i===t?"active":"",onClick:()=>y(t),role:"tab",type:"button",children:t},t))}),e.jsxs("div",{className:"connected-apps-list",children:[N.map(t=>e.jsx(_,{app:t,onSelect:()=>f(t)},t.id)),N.length===0?e.jsx("div",{className:"connected-apps-empty",children:"No apps match the current search."}):null]}),c?e.jsx($,{app:c,onClose:()=>f(null),onInstall:()=>A(c)}):null]})}function M(s,n){const a=s?.trim();return a||n?.trim()||null}function _({app:s,onSelect:n}){return e.jsxs("button",{className:"connected-app-row",onClick:n,type:"button",children:[e.jsxs("span",{className:"connected-app-row-main",children:[e.jsx(m,{appId:s.id}),e.jsxs("span",{className:"connected-app-copy",children:[e.jsxs("span",{className:"connected-app-title",children:[e.jsx("strong",{children:s.label}),e.jsxs("span",{children:[s.shortLabel!==s.label?s.shortLabel:s.category," / ",s.setupSurfaceLabel]})]}),e.jsx("span",{children:s.description}),e.jsxs("span",{className:"connected-app-capability-row",children:[s.capabilityLabels.slice(0,2).map(a=>e.jsx("span",{children:a},a)),s.capabilityLabels.length>2?e.jsxs("span",{children:["+",s.capabilityLabels.length-2]}):null]})]})]}),e.jsx("span",{className:`connected-app-status-pill ${s.status}`,children:s.statusLabel}),e.jsx(k,{size:16})]})}function $({app:s,onClose:n,onInstall:a}){const o=s.connections.filter(c=>c.status==="active");return e.jsx("div",{className:"connected-app-dialog-backdrop",role:"presentation",onMouseDown:c=>{c.target===c.currentTarget&&n()},children:e.jsxs("section",{className:"connected-app-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"connected-app-dialog-title",children:[e.jsx("button",{className:"connected-app-dialog-close",type:"button","aria-label":"Close app details",onClick:n,children:e.jsx(P,{size:17})}),e.jsxs("div",{className:"connected-app-dialog-identity",children:[e.jsx("span",{className:"openpond-mark",children:e.jsx("img",{alt:"",src:F})}),e.jsxs("span",{className:"connection-dots","aria-hidden":"true",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]}),e.jsx(m,{appId:s.id})]}),e.jsxs("h2",{id:"connected-app-dialog-title",children:["Connect ",s.label]}),e.jsxs("div",{className:"connected-app-approval",children:[e.jsx(E,{size:16}),e.jsx("span",{children:s.statusLabel})]}),e.jsxs("div",{className:"connected-app-dialog-body",children:[e.jsxs("section",{children:[e.jsx("h3",{children:s.setupSurfaceLabel}),e.jsx("p",{children:"The web flow shows the provider account, workspace, and requested access before anything is connected."})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Connected account"}),e.jsx("p",{children:X(o)})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Available capabilities"}),e.jsx("div",{className:"connected-app-dialog-capabilities",children:s.capabilities.map(c=>e.jsx("span",{children:c.label},c.id))})]}),e.jsxs("section",{children:[e.jsx("h3",{children:"Sandbox lease policy"}),e.jsx("p",{children:s.leasePolicy.leaseable?`Leaseable for ${s.leasePolicy.defaultTtlSeconds??0} seconds with scoped proxy access.`:"Managed as setup or tool discovery; no OAuth lease is required."})]})]}),e.jsxs("button",{className:"connected-app-dialog-primary",type:"button",onClick:a,children:[e.jsx("span",{children:s.installLabel}),e.jsx(U,{size:15})]})]})})}function m({appId:s}){return e.jsx("span",{className:`connected-app-icon app-${s}`,children:e.jsx("img",{alt:"",src:B(s)})})}function z(s,n){return n==="For agents"?!0:n==="Featured"?D.has(s.id):n==="Productivity"?s.category==="Productivity"||s.category==="Chat":s.category==="Developer tools"||s.id==="mcp"}function q(s,n){const a=n.trim().toLowerCase();return a?[s.id,s.label,s.shortLabel,s.category,s.description,s.providerFamily,s.setupSurface].some(o=>o.toLowerCase().includes(a)):!0}function B(s){return R(s)}async function G(s){const n=window.openpond?.browser;if(n){const a=await n.openExternal({conversationId:"connected-apps",url:s});if(!a.ok)throw new Error(a.error??"Unable to open app setup.");return}window.open(s,"_blank","noopener,noreferrer")}function V(s){return s==="loading"?"Checking connections":s==="ready"?"Connection status current":s==="error"?"Connection status unavailable":"Connection status pending"}function W(s){return s.filter(n=>n.connected).length}function X(s){return s.length===0?"No active OAuth connection for this setup surface.":s.map(n=>{const a=n.accountLabel??"Connected account";return n.workspaceLabel?`${a} / ${n.workspaceLabel}`:a}).join(", ")}export{J as AppsView,_ as ConnectedAppRow,M as connectedAppSetupTeamId};
@@ -1 +1 @@
1
- import{r as c,c2 as v,j as a,a1 as f,X as k,P as j,A as C,ba as g,bp as B}from"./index-BO2W2U23.js";import{A as y}from"./MarkdownText-gwAue4u5.js";import{R as N}from"./refresh-cw-Bn28jIl0.js";import{S as T}from"./square-DAGpFfSr.js";const x=[];function P(r){const e=window.openpond?.browser,[b,l]=c.useState(()=>({conversationId:r,activeTabId:null,tabs:x}));c.useEffect(()=>{if(l({conversationId:r,activeTabId:null,tabs:x}),!e)return;let s=!1;e.getState({conversationId:r}).then(o=>{s||l(o)});const i=e.onState(o=>{o.conversationId===r&&l(o)});return()=>{s=!0,i()}},[e,r]);const u=c.useMemo(()=>b.tabs.find(s=>s.id===b.activeTabId)??null,[b.activeTabId,b.tabs]),t=c.useCallback(async(s,i={})=>{if(!e)return!1;const o=v(s,{explicitFile:i.explicitFile});return o?(i.newTab?await e.newTab({conversationId:r,url:o,explicitFile:i.explicitFile}):await e.open({conversationId:r,url:o,explicitFile:i.explicitFile}),!0):!1},[e,r]),n=u?{conversationId:r,tabId:u.id}:null;return{activeTab:u,available:!!e,bridge:e,state:b,back:()=>e&&n?e.back(n):Promise.resolve({ok:!1}),clearData:()=>e?e.clearData({conversationId:r}):Promise.resolve({ok:!1}),closeTab:s=>e?e.closeTab({conversationId:r,tabId:s}):Promise.resolve({ok:!1}),forward:()=>e&&n?e.forward(n):Promise.resolve({ok:!1}),newTab:s=>e?e.newTab({conversationId:r,url:s}):Promise.resolve({ok:!1}),open:t,openExternal:()=>e&&n?e.openExternal(n):Promise.resolve({ok:!1}),reload:()=>e&&n?e.reload(n):Promise.resolve({ok:!1}),snapshot:(s={})=>e?e.snapshot({conversationId:r,...s}):Promise.resolve({ok:!1,output:"Desktop browser bridge unavailable."}),moveCursor:s=>e?e.moveCursor({conversationId:r,...s}):Promise.resolve({ok:!1,output:"Desktop browser bridge unavailable."}),click:s=>e?e.click({conversationId:r,...s}):Promise.resolve({ok:!1,output:"Desktop browser bridge unavailable."}),typeText:s=>e?e.typeText({conversationId:r,...s}):Promise.resolve({ok:!1,output:"Desktop browser bridge unavailable."}),key:s=>e?e.key({conversationId:r,...s}):Promise.resolve({ok:!1,output:"Desktop browser bridge unavailable."}),scroll:s=>e?e.scroll({conversationId:r,...s}):Promise.resolve({ok:!1,output:"Desktop browser bridge unavailable."}),selectTab:s=>e?e.selectTab({conversationId:r,tabId:s}):Promise.resolve({ok:!1}),setBounds:s=>e?e.setBounds({conversationId:r,bounds:s}):Promise.resolve({ok:!1}),stop:()=>e&&n?e.stop(n):Promise.resolve({ok:!1})}}function R({activeTabId:r,tabs:e,onCloseTab:b,onNewTab:l,onSelectTab:u}){return a.jsxs("div",{className:"browser-tabs",role:"tablist","aria-label":"Browser tabs",children:[e.map(t=>a.jsxs("div",{className:`browser-tab ${t.id===r?"active":""}`,children:[a.jsx("span",{className:"browser-tab-favicon","aria-hidden":"true",children:t.faviconUrl?a.jsx("img",{alt:"",referrerPolicy:"no-referrer",src:t.faviconUrl}):a.jsx(f,{size:13})}),a.jsx("button",{type:"button",className:"browser-tab-main",role:"tab","aria-selected":t.id===r,title:t.url,onClick:()=>u(t.id),children:E(t)}),a.jsx("button",{type:"button",className:"browser-tab-close",title:"Close tab","aria-label":"Close tab",onClick:()=>b(t.id),children:a.jsx(k,{size:12})})]},t.id)),a.jsx("button",{type:"button",className:"browser-tab-add",title:"New tab","aria-label":"New tab",onClick:l,children:a.jsx(j,{size:14})})]})}function E(r){if(r.title?.trim())return r.title.trim();try{return new URL(r.url).host||r.url}catch{return r.url||"New tab"}}function z({activeTab:r,available:e,onBack:b,onClearData:l,onForward:u,onNavigate:t,onOpenExternal:n,onReload:s,onStop:i}){const[o,d]=c.useState(""),[p,m]=c.useState(!1);c.useEffect(()=>{d(r?.url??"")},[r?.url]);function h(w){w.preventDefault(),t(o)}return a.jsxs("div",{className:"browser-toolbar",children:[a.jsxs("div",{className:"browser-nav-actions",children:[a.jsx("button",{type:"button",title:"Back","aria-label":"Back",disabled:!r?.canGoBack,onClick:b,children:a.jsx(C,{size:15})}),a.jsx("button",{type:"button",title:"Forward","aria-label":"Forward",disabled:!r?.canGoForward,onClick:u,children:a.jsx(y,{size:15})}),a.jsx("button",{type:"button",title:r?.loading?"Stop":"Reload","aria-label":r?.loading?"Stop":"Reload",disabled:!r,onClick:r?.loading?i:s,children:r?.loading?a.jsx(T,{size:13}):a.jsx(N,{size:14})})]}),a.jsx("form",{className:"browser-address-form",onSubmit:h,children:a.jsx("input",{"aria-label":"Browser address",disabled:!e,placeholder:e?"Search or enter address":"Desktop browser unavailable",spellCheck:!1,value:o,onChange:w=>d(w.target.value)})}),a.jsxs("div",{className:"browser-panel-actions",children:[a.jsx("button",{type:"button",title:"Open external","aria-label":"Open external",disabled:!r,onClick:n,children:a.jsx(g,{size:14})}),a.jsxs("div",{className:"browser-menu-anchor",children:[a.jsx("button",{type:"button",title:"Browser actions","aria-label":"Browser actions",onClick:()=>m(w=>!w),children:a.jsx(B,{size:15})}),p&&a.jsx("div",{className:"browser-options-menu",role:"menu",children:a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{m(!1),l()},children:"Clear Browser Data..."})})]})]})]})}function D({active:r,onBounds:e}){const b=c.useRef(null),l=c.useRef(null),u=c.useRef(null),t=c.useCallback(i=>{const o=i?`${i.x}:${i.y}:${i.width}:${i.height}`:"null";l.current!==o&&(l.current=o,e(i))},[e]),n=c.useCallback(()=>{const i=b.current;if(!r||!i){t(null);return}const o=i.getBoundingClientRect(),d=Math.max(0,Math.round(o.width)),p=Math.max(0,Math.round(o.height));if(d===0||p===0){t(null);return}t({x:Math.round(o.left),y:Math.round(o.top),width:d,height:p})},[r,t]),s=c.useCallback(()=>{u.current===null&&(u.current=window.requestAnimationFrame(()=>{u.current=null,n()}))},[n]);return c.useLayoutEffect(()=>{l.current=null,n();const i=b.current;if(!r||!i)return t(null),()=>t(null);const o=new ResizeObserver(s);return o.observe(i),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null),o.disconnect(),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0),t(null)}},[r,t,n,s]),a.jsx("div",{className:"browser-viewport",ref:b})}function A({conversationId:r,expanded:e,onResizeStart:b}){const l=P(r),u=c.useCallback(s=>{window.openpond?.browser?.setBounds({conversationId:r,bounds:s})},[r]),t=c.useCallback(s=>{l.open(s,{explicitFile:!0})},[l]),n=c.useCallback(()=>{window.confirm("Clear browser data for this conversation? Tabs, cookies, cache, and local storage for this conversation will be removed.")&&l.clearData()},[l]);return a.jsxs("aside",{className:`workspace-diff-panel browser-sidebar-panel ${e?"expanded":""}`,"aria-label":"Browser",children:[!e&&a.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize browser panel",onPointerDown:b}),a.jsx(R,{activeTabId:l.state.activeTabId,tabs:l.state.tabs,onCloseTab:s=>{l.closeTab(s)},onNewTab:()=>{l.newTab()},onSelectTab:s=>{l.selectTab(s)}}),a.jsx(z,{activeTab:l.activeTab,available:l.available,onBack:()=>{l.back()},onClearData:n,onForward:()=>{l.forward()},onNavigate:t,onOpenExternal:()=>{l.openExternal()},onReload:()=>{l.reload()},onStop:()=>{l.stop()}}),a.jsxs("div",{className:"browser-content",children:[l.available?l.state.tabs.length===0?a.jsxs("div",{className:"browser-empty-state",children:[a.jsx(f,{size:18}),a.jsx("span",{children:"Enter a URL to open a browser tab for this conversation."})]}):null:a.jsxs("div",{className:"browser-empty-state",children:[a.jsx(f,{size:18}),a.jsx("span",{children:"Desktop browser bridge unavailable."})]}),a.jsx(D,{active:l.available&&l.state.tabs.length>0,onBounds:u})]})]})}export{A as BrowserSidebar};
1
+ import{r as c,c2 as v,j as a,a1 as f,X as k,P as j,A as C,ba as g,bp as B}from"./index-LrGasYyx.js";import{c as y}from"./MarkdownText-R3MC5S30.js";import{R as N}from"./refresh-cw-ChUK_QfF.js";import{S as T}from"./square-B5q2aneb.js";const x=[];function P(r){const e=window.openpond?.browser,[b,l]=c.useState(()=>({conversationId:r,activeTabId:null,tabs:x}));c.useEffect(()=>{if(l({conversationId:r,activeTabId:null,tabs:x}),!e)return;let s=!1;e.getState({conversationId:r}).then(o=>{s||l(o)});const i=e.onState(o=>{o.conversationId===r&&l(o)});return()=>{s=!0,i()}},[e,r]);const u=c.useMemo(()=>b.tabs.find(s=>s.id===b.activeTabId)??null,[b.activeTabId,b.tabs]),t=c.useCallback(async(s,i={})=>{if(!e)return!1;const o=v(s,{explicitFile:i.explicitFile});return o?(i.newTab?await e.newTab({conversationId:r,url:o,explicitFile:i.explicitFile}):await e.open({conversationId:r,url:o,explicitFile:i.explicitFile}),!0):!1},[e,r]),n=u?{conversationId:r,tabId:u.id}:null;return{activeTab:u,available:!!e,bridge:e,state:b,back:()=>e&&n?e.back(n):Promise.resolve({ok:!1}),clearData:()=>e?e.clearData({conversationId:r}):Promise.resolve({ok:!1}),closeTab:s=>e?e.closeTab({conversationId:r,tabId:s}):Promise.resolve({ok:!1}),forward:()=>e&&n?e.forward(n):Promise.resolve({ok:!1}),newTab:s=>e?e.newTab({conversationId:r,url:s}):Promise.resolve({ok:!1}),open:t,openExternal:()=>e&&n?e.openExternal(n):Promise.resolve({ok:!1}),reload:()=>e&&n?e.reload(n):Promise.resolve({ok:!1}),snapshot:(s={})=>e?e.snapshot({conversationId:r,...s}):Promise.resolve({ok:!1,output:"Desktop browser bridge unavailable."}),moveCursor:s=>e?e.moveCursor({conversationId:r,...s}):Promise.resolve({ok:!1,output:"Desktop browser bridge unavailable."}),click:s=>e?e.click({conversationId:r,...s}):Promise.resolve({ok:!1,output:"Desktop browser bridge unavailable."}),typeText:s=>e?e.typeText({conversationId:r,...s}):Promise.resolve({ok:!1,output:"Desktop browser bridge unavailable."}),key:s=>e?e.key({conversationId:r,...s}):Promise.resolve({ok:!1,output:"Desktop browser bridge unavailable."}),scroll:s=>e?e.scroll({conversationId:r,...s}):Promise.resolve({ok:!1,output:"Desktop browser bridge unavailable."}),selectTab:s=>e?e.selectTab({conversationId:r,tabId:s}):Promise.resolve({ok:!1}),setBounds:s=>e?e.setBounds({conversationId:r,bounds:s}):Promise.resolve({ok:!1}),stop:()=>e&&n?e.stop(n):Promise.resolve({ok:!1})}}function R({activeTabId:r,tabs:e,onCloseTab:b,onNewTab:l,onSelectTab:u}){return a.jsxs("div",{className:"browser-tabs",role:"tablist","aria-label":"Browser tabs",children:[e.map(t=>a.jsxs("div",{className:`browser-tab ${t.id===r?"active":""}`,children:[a.jsx("span",{className:"browser-tab-favicon","aria-hidden":"true",children:t.faviconUrl?a.jsx("img",{alt:"",referrerPolicy:"no-referrer",src:t.faviconUrl}):a.jsx(f,{size:13})}),a.jsx("button",{type:"button",className:"browser-tab-main",role:"tab","aria-selected":t.id===r,title:t.url,onClick:()=>u(t.id),children:E(t)}),a.jsx("button",{type:"button",className:"browser-tab-close",title:"Close tab","aria-label":"Close tab",onClick:()=>b(t.id),children:a.jsx(k,{size:12})})]},t.id)),a.jsx("button",{type:"button",className:"browser-tab-add",title:"New tab","aria-label":"New tab",onClick:l,children:a.jsx(j,{size:14})})]})}function E(r){if(r.title?.trim())return r.title.trim();try{return new URL(r.url).host||r.url}catch{return r.url||"New tab"}}function z({activeTab:r,available:e,onBack:b,onClearData:l,onForward:u,onNavigate:t,onOpenExternal:n,onReload:s,onStop:i}){const[o,d]=c.useState(""),[p,m]=c.useState(!1);c.useEffect(()=>{d(r?.url??"")},[r?.url]);function h(w){w.preventDefault(),t(o)}return a.jsxs("div",{className:"browser-toolbar",children:[a.jsxs("div",{className:"browser-nav-actions",children:[a.jsx("button",{type:"button",title:"Back","aria-label":"Back",disabled:!r?.canGoBack,onClick:b,children:a.jsx(C,{size:15})}),a.jsx("button",{type:"button",title:"Forward","aria-label":"Forward",disabled:!r?.canGoForward,onClick:u,children:a.jsx(y,{size:15})}),a.jsx("button",{type:"button",title:r?.loading?"Stop":"Reload","aria-label":r?.loading?"Stop":"Reload",disabled:!r,onClick:r?.loading?i:s,children:r?.loading?a.jsx(T,{size:13}):a.jsx(N,{size:14})})]}),a.jsx("form",{className:"browser-address-form",onSubmit:h,children:a.jsx("input",{"aria-label":"Browser address",disabled:!e,placeholder:e?"Search or enter address":"Desktop browser unavailable",spellCheck:!1,value:o,onChange:w=>d(w.target.value)})}),a.jsxs("div",{className:"browser-panel-actions",children:[a.jsx("button",{type:"button",title:"Open external","aria-label":"Open external",disabled:!r,onClick:n,children:a.jsx(g,{size:14})}),a.jsxs("div",{className:"browser-menu-anchor",children:[a.jsx("button",{type:"button",title:"Browser actions","aria-label":"Browser actions",onClick:()=>m(w=>!w),children:a.jsx(B,{size:15})}),p&&a.jsx("div",{className:"browser-options-menu",role:"menu",children:a.jsx("button",{type:"button",role:"menuitem",onClick:()=>{m(!1),l()},children:"Clear Browser Data..."})})]})]})]})}function D({active:r,onBounds:e}){const b=c.useRef(null),l=c.useRef(null),u=c.useRef(null),t=c.useCallback(i=>{const o=i?`${i.x}:${i.y}:${i.width}:${i.height}`:"null";l.current!==o&&(l.current=o,e(i))},[e]),n=c.useCallback(()=>{const i=b.current;if(!r||!i){t(null);return}const o=i.getBoundingClientRect(),d=Math.max(0,Math.round(o.width)),p=Math.max(0,Math.round(o.height));if(d===0||p===0){t(null);return}t({x:Math.round(o.left),y:Math.round(o.top),width:d,height:p})},[r,t]),s=c.useCallback(()=>{u.current===null&&(u.current=window.requestAnimationFrame(()=>{u.current=null,n()}))},[n]);return c.useLayoutEffect(()=>{l.current=null,n();const i=b.current;if(!r||!i)return t(null),()=>t(null);const o=new ResizeObserver(s);return o.observe(i),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null),o.disconnect(),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0),t(null)}},[r,t,n,s]),a.jsx("div",{className:"browser-viewport",ref:b})}function U({conversationId:r,expanded:e,onResizeStart:b}){const l=P(r),u=c.useCallback(s=>{window.openpond?.browser?.setBounds({conversationId:r,bounds:s})},[r]),t=c.useCallback(s=>{l.open(s,{explicitFile:!0})},[l]),n=c.useCallback(()=>{window.confirm("Clear browser data for this conversation? Tabs, cookies, cache, and local storage for this conversation will be removed.")&&l.clearData()},[l]);return a.jsxs("aside",{className:`workspace-diff-panel browser-sidebar-panel ${e?"expanded":""}`,"aria-label":"Browser",children:[!e&&a.jsx("div",{className:"workspace-diff-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize browser panel",onPointerDown:b}),a.jsx(R,{activeTabId:l.state.activeTabId,tabs:l.state.tabs,onCloseTab:s=>{l.closeTab(s)},onNewTab:()=>{l.newTab()},onSelectTab:s=>{l.selectTab(s)}}),a.jsx(z,{activeTab:l.activeTab,available:l.available,onBack:()=>{l.back()},onClearData:n,onForward:()=>{l.forward()},onNavigate:t,onOpenExternal:()=>{l.openExternal()},onReload:()=>{l.reload()},onStop:()=>{l.stop()}}),a.jsxs("div",{className:"browser-content",children:[l.available?l.state.tabs.length===0?a.jsxs("div",{className:"browser-empty-state",children:[a.jsx(f,{size:18}),a.jsx("span",{children:"Enter a URL to open a browser tab for this conversation."})]}):null:a.jsxs("div",{className:"browser-empty-state",children:[a.jsx(f,{size:18}),a.jsx("span",{children:"Desktop browser bridge unavailable."})]}),a.jsx(D,{active:l.available&&l.state.tabs.length>0,onBounds:u})]})]})}export{U as BrowserSidebar};
@@ -1 +1 @@
1
- import{r as j,j as e,ar as g,as as b,at as x,e as k,F as v,au as C,av as P,a2 as w,aw as M,ax as L}from"./index-BO2W2U23.js";function F({open:s,query:r,projects:n,sessions:o,onQueryChange:t,onClose:d,onNewChat:f,onOpenProject:u,onOpenSession:m}){const c=r.trim().toLowerCase(),l=j.useMemo(()=>S(o,c,10),[c,o]),i=j.useMemo(()=>z(n,c,8),[c,n]);if(!s)return null;const N=()=>{const a=i[0];if(a){u(a);return}const p=l[0];p&&m(p)};return e.jsx("div",{className:"command-overlay",role:"presentation",onMouseDown:d,children:e.jsxs("section",{className:"command-menu",role:"dialog","aria-modal":"true","aria-label":"Search chats and projects",onMouseDown:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"command-input-row",children:[e.jsx(g,{size:17}),e.jsx("input",{autoFocus:!0,value:r,onChange:a=>t(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),N()),a.key==="Escape"&&(a.preventDefault(),d())},placeholder:"Search chats and projects"}),e.jsx("kbd",{children:"Esc"})]}),e.jsxs("div",{className:"command-results",children:[e.jsxs("button",{className:"command-result command-create",onClick:f,children:[e.jsx(b,{size:15}),e.jsx("span",{children:"New local task"}),e.jsx("small",{children:"General"})]}),e.jsxs(h,{label:"Projects",children:[i.map(a=>e.jsxs("button",{className:"command-result",onClick:()=>u(a),children:[x(a)?e.jsx(k,{size:15}):e.jsx(v,{size:15}),e.jsx("span",{children:a.project.name}),e.jsx("small",{children:D(a)})]},a.project.id)),i.length===0&&e.jsx("div",{className:"command-empty",children:"No projects found"})]}),e.jsxs(h,{label:"Chats",children:[l.map(a=>e.jsxs("button",{className:"command-result",onClick:()=>m(a),children:[a.pinned?e.jsx(C,{size:15}):a.savedForLater?e.jsx(P,{size:15}):e.jsx(w,{size:15}),e.jsx("span",{children:a.title}),e.jsx("small",{children:a.appName??M(a.updatedAt)})]},a.id)),l.length===0&&e.jsx("div",{className:"command-empty",children:"No chats found"})]})]})]})})}function S(s,r,n){const o=[];for(const t of s)if((!r||`${t.title} ${t.appName??""}`.toLowerCase().includes(r))&&(o.push(t),o.length>=n))break;return o}function z(s,r,n){const o=[];for(const t of s)if((!r||$(t).toLowerCase().includes(r))&&(o.push(t),o.length>=n))break;return o}function $(s){return L(s)?`${s.project.name} ${s.project.path} ${s.project.workspacePath}`:`${s.project.name} ${s.project.sourceLabel??""} ${s.project.organizationName??""}`}function D(s){return x(s)?s.project.organizationName??"Cloud Project":s.project.linkedOpenPondApp?"OpenPond project":s.project.source==="git"?"Local Git":"Local folder"}function h({label:s,children:r}){return e.jsxs("div",{className:"command-group",children:[e.jsx("div",{className:"command-group-label",children:s}),r]})}export{F as CommandMenu};
1
+ import{r as j,j as e,ar as g,as as b,at as x,e as k,F as v,au as C,av as P,a2 as w,aw as M,ax as L}from"./index-LrGasYyx.js";function F({open:s,query:r,projects:n,sessions:o,onQueryChange:t,onClose:d,onNewChat:f,onOpenProject:u,onOpenSession:m}){const c=r.trim().toLowerCase(),l=j.useMemo(()=>S(o,c,10),[c,o]),i=j.useMemo(()=>z(n,c,8),[c,n]);if(!s)return null;const N=()=>{const a=i[0];if(a){u(a);return}const p=l[0];p&&m(p)};return e.jsx("div",{className:"command-overlay",role:"presentation",onMouseDown:d,children:e.jsxs("section",{className:"command-menu",role:"dialog","aria-modal":"true","aria-label":"Search chats and projects",onMouseDown:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"command-input-row",children:[e.jsx(g,{size:17}),e.jsx("input",{autoFocus:!0,value:r,onChange:a=>t(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),N()),a.key==="Escape"&&(a.preventDefault(),d())},placeholder:"Search chats and projects"}),e.jsx("kbd",{children:"Esc"})]}),e.jsxs("div",{className:"command-results",children:[e.jsxs("button",{className:"command-result command-create",onClick:f,children:[e.jsx(b,{size:15}),e.jsx("span",{children:"New local task"}),e.jsx("small",{children:"General"})]}),e.jsxs(h,{label:"Projects",children:[i.map(a=>e.jsxs("button",{className:"command-result",onClick:()=>u(a),children:[x(a)?e.jsx(k,{size:15}):e.jsx(v,{size:15}),e.jsx("span",{children:a.project.name}),e.jsx("small",{children:D(a)})]},a.project.id)),i.length===0&&e.jsx("div",{className:"command-empty",children:"No projects found"})]}),e.jsxs(h,{label:"Chats",children:[l.map(a=>e.jsxs("button",{className:"command-result",onClick:()=>m(a),children:[a.pinned?e.jsx(C,{size:15}):a.savedForLater?e.jsx(P,{size:15}):e.jsx(w,{size:15}),e.jsx("span",{children:a.title}),e.jsx("small",{children:a.appName??M(a.updatedAt)})]},a.id)),l.length===0&&e.jsx("div",{className:"command-empty",children:"No chats found"})]})]})]})})}function S(s,r,n){const o=[];for(const t of s)if((!r||`${t.title} ${t.appName??""}`.toLowerCase().includes(r))&&(o.push(t),o.length>=n))break;return o}function z(s,r,n){const o=[];for(const t of s)if((!r||$(t).toLowerCase().includes(r))&&(o.push(t),o.length>=n))break;return o}function $(s){return L(s)?`${s.project.name} ${s.project.path} ${s.project.workspacePath}`:`${s.project.name} ${s.project.sourceLabel??""} ${s.project.organizationName??""}`}function D(s){return x(s)?s.project.organizationName??"Cloud Project":s.project.linkedOpenPondApp?"OpenPond project":s.project.source==="git"?"Local Git":"Local folder"}function h({label:s,children:r}){return e.jsxs("div",{className:"command-group",children:[e.jsx("div",{className:"command-group-label",children:s}),r]})}export{F as CommandMenu};
@@ -1 +1 @@
1
- import{r as l,j as e,X as H,as as Z,ay as M,co as O}from"./index-BO2W2U23.js";import{S as ee,W as se,B as ne,a as te}from"./wifi-off-DJA9KReb.js";import{R as F}from"./refresh-cw-Bn28jIl0.js";import{i as ie,j as ae,k as le,l as oe,r as re,m as ce,R as de}from"./MainPane-CuhwxMxg.js";import{T as me,b as J}from"./MarkdownText-gwAue4u5.js";import"./cloud-upload-COReKxOy.js";import"./arrow-up-right-DYGSWA2J.js";import"./square-DAGpFfSr.js";import"./folder-open-9OjGqNgP.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(Z,{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 Le({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(O,{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(F,{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(F,{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(O,{size:14})," ",i.memberCount.toLocaleString()]}),v?e.jsxs("button",{type:"button",className:"secondary",onClick:()=>y("review"),children:[e.jsx(ee,{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(se,{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(ne,{size:14}):e.jsx(te,{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{Le as CommunityView};
1
+ import{r as l,j as e,X as H,as as Z,ay as M,co as O}from"./index-LrGasYyx.js";import{S as ee,W as se,B as ne,a as te}from"./wifi-off-cXPyKIzd.js";import{R as F}from"./refresh-cw-ChUK_QfF.js";import{i as ie,j as ae,k as le,l as oe,r as re,m as ce,R as de}from"./MainPane-CQCLhV5C.js";import{T as me,b as J}from"./MarkdownText-R3MC5S30.js";import"./cloud-upload-D6bS8rS2.js";import"./arrow-up-right-BDcNd1rt.js";import"./square-B5q2aneb.js";import"./folder-open-8C5l7A93.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(Z,{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 Le({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(O,{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(F,{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(F,{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(O,{size:14})," ",i.memberCount.toLocaleString()]}),v?e.jsxs("button",{type:"button",className:"secondary",onClick:()=>y("review"),children:[e.jsx(ee,{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(se,{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(ne,{size:14}):e.jsx(te,{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{Le as CommunityView};
@@ -1 +1 @@
1
- import{r as v,j as e,aK as _,cp as A,aS as P,i as x,X as j,d as y,bk as w}from"./index-BO2W2U23.js";import{P as q}from"./MarkdownText-gwAue4u5.js";import{P as C}from"./play-Ctx-iMqd.js";import{R as k}from"./refresh-cw-Bn28jIl0.js";function K({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=I(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}):S(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 S(s){return["planning","applying_source","running_checks","evaluating","opening_pull_request","reconciling_release","pushing_hosted","running_hosted_checks"].includes(s)}function I(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{K as ComposerCreateImproveStrip};
1
+ import{r as v,j as e,aK as _,cp as A,aS as P,i as x,X as j,d as y,bk as w}from"./index-LrGasYyx.js";import{P as q}from"./MarkdownText-R3MC5S30.js";import{P as C}from"./play-Cbsyrwkw.js";import{R as k}from"./refresh-cw-ChUK_QfF.js";function K({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=I(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}):S(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 S(s){return["planning","applying_source","running_checks","evaluating","opening_pull_request","reconciling_release","pushing_hosted","running_hosted_checks"].includes(s)}function I(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{K as ComposerCreateImproveStrip};
@@ -1 +1 @@
1
- import{r as x,j as t,A as te,X as ae,b5 as I,bH as ne,bI as se,bJ as ie,bK as re,bL as oe,bM as de}from"./index-BO2W2U23.js";import{P as k}from"./play-Ctx-iMqd.js";import{r as le}from"./index-BRLugX1S.js";import{A as ce}from"./AppDialog-wIb8mGQ0.js";import{A as ue}from"./MarkdownText-gwAue4u5.js";function pe({badge:e,onPlay:a,titleElement:i="h3",video:n}){const[d,s]=x.useState(!1),r=x.useRef(null),u=i,l=`${n.id}-title`;function p(){if(a){a();return}le.flushSync(()=>s(!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 ${n.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:n.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:n.title}),t.jsxs("div",{className:"get-started-course-meta","aria-label":`${n.title} details`,children:[t.jsx("span",{children:n.eyebrow}),t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:n.duration})]}),n.description?t.jsx("p",{children:n.description}):null]})]}),d&&!a?t.jsx(L,{onClose:()=>s(!1),video:n,videoRef:r}):null]})}function L({autoAdvance:e=!1,contained:a=!1,inertExclusionSelector:i,navigation:n,onEnded:d,onClose:s,onPause:r,onTimeUpdate:u,video:l,videoRef:p}){return t.jsxs(ce,{ariaLabel:`${l.title} player`,backdropClassName:"get-started-course-player-backdrop",className:"get-started-course-player",contained:a,inertExclusionSelector:i,onClose:s,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:[n?`Lesson ${n.currentIndex+1} of ${n.total}`:l.eyebrow," · ",l.duration]})]}),t.jsxs("div",{className:"get-started-course-player-actions",children:[n?t.jsxs(t.Fragment,{children:[t.jsx("button",{"aria-label":"Previous lesson",disabled:!n.onPrevious,onClick:n.onPrevious,title:"Previous lesson",type:"button",children:t.jsx(te,{size:17})}),t.jsx("button",{"aria-label":"Next lesson",disabled:!n.onNext,onClick:n.onNext,title:"Next lesson",type:"button",children:t.jsx(ue,{size:17})})]}):null,t.jsx("button",{"aria-label":"Close video player","data-autofocus":!0,onClick:s,title:"Close",type:"button",children:t.jsx(ae,{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 fe=[{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"]}],ge=[{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}],me={playlists:fe,videos:ge},be="https://media.openpond.ai",K=me,he=new Map(K.playlists.map(e=>[e.id,e])),ye=new Map(K.videos.map(e=>[e.id,e]));function $(e){const a=he.get(e);if(!a)throw new Error(`Public video manifest is missing playlist ${e}`);return a}function Te(e,a){return a?`${be}/${e.objectKey}`:I(e.localPath)}function E(e){const a=ye.get(e);if(!a)throw new Error(`Public video manifest is missing ${e}`);return Te(a,!0)}const xe=E("make-agent-tutorial"),Ae=E("openpond-agent-overview");function ve(e){return E(`make-agent-tutorial-${e}`)}const Pe={title:"How to make an agent"},je=[{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:Pe,chapters:je},Ne=$("how-to-make-an-agent"),B=z.chapters,Ie={create:"1:24",use:"1:05",improve:"1:10"},S=Ne.title,Ee=z.tutorial.title,F="4:33",H={captionsUrl:se,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:ne,title:Ee,videoId:"play-all",videoUrl:xe},T=B.map((e,a)=>({captionsUrl:re(e.id),chapterIds:[e.id],description:e.subtitle,duration:Ie[e.id],eyebrow:`Lesson ${a+1}`,id:`make-agent-tutorial-${e.id}`,lessonNumber:a+1,posterUrl:ie(e.id),title:e.title,videoId:e.id,videoUrl:ve(e.id)})),we=[H,...T];function W(e){return we.find(a=>a.videoId===e)??H}function Se(e){const a=T.findIndex(i=>i.videoId===e);return a<0?null:T[a+1]?.videoId??null}const Re=[2,1,0];function _e({activeVideoId:e="play-all",autoplay:a=!0,onClose:i,onOpen:n,onSelectVideo:d,open:s=!1,playRequestId:r=0}={}){const u=x.useRef(null),l=W(e);x.useEffect(()=>{if(!s)return;const c=u.current;c&&(c.load(),r>0&&c.play().catch(()=>{}))},[l.id,s,r]);function p(){if(!a||!d)return;const c=Se(e);c&&d(c)}return t.jsxs("section",{className:"get-started-series","aria-label":S,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 ${S} playlist`,className:"get-started-playlist-open",onClick:n,type:"button"}),t.jsxs("div",{className:"get-started-playlist-stack","aria-hidden":"true",children:[Re.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:S}),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."})]})]}),s&&i&&d?t.jsx(Oe,{activeVideoId:e,autoplay:a,contained:!0,inertExclusionSelector:".get-started-learning-panel",onClose:i,onEnded:p,onSelectVideo:d,videoRef:u}):null]})}function Oe({activeVideoId:e="play-all",autoplay:a=!0,contained:i=!1,inertExclusionSelector:n,onClose:d,onEnded:s,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:n,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:s?()=>s():void 0,video:l,videoRef:u})}const U=$("post-training-from-first-principles"),q=U.title,ke=U.status;function h(e,a,i,n,d,s){const r=`courses/post-training/${a}`,u=`post-training-${a}`;return{captionsUrl:I(`${r}.vtt`),description:s,duration:d,eyebrow:n,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.")],Le="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 V="Subject to change, lesson work in progress";function Ue(){const e=ke==="draft"?"Draft":"Published";return t.jsx("span",{"aria-label":`${e}: ${V}`,className:"get-started-playlist-status app-tooltip","data-tooltip":V,tabIndex:0,children:e})}const C="openpond.post-training-progress.v1",j=Object.freeze({}),Ce=1e3,X=new Set;let P=null,N=null,G=!1;function R(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Me(e){if(!e||typeof e!="object"||Array.isArray(e))return j;const a={};for(const[i,n]of Object.entries(e)){if(!i||!n||typeof n!="object"||Array.isArray(n))continue;const d=n,s=R(d.duration),r=R(d.currentTime),u=R(d.updatedAt);if(s===null||s<=0||r===null)continue;const l=d.completed===!0;a[i]={completed:l,currentTime:l?s:Math.min(s,Math.max(0,r)),duration:s,updatedAt:u===null?0:Math.max(0,u)}}return Object.keys(a).length>0?a:j}function Q(e){if(!e)return j;try{return Me(JSON.parse(e))}catch{return j}}function Ve(){if(typeof window>"u")return j;try{return Q(window.localStorage.getItem(C))}catch{return j}}function Z(){if(typeof window<"u"&&N!==null&&window.clearTimeout(N),N=null,!(typeof window>"u"||P===null))try{window.localStorage.setItem(C,JSON.stringify(P))}catch{}}function Ge(){typeof window>"u"||N!==null||(N=window.setTimeout(Z,Ce))}function De(){typeof window>"u"||G||(G=!0,window.addEventListener("pagehide",Z),window.addEventListener("storage",e=>{e.key===C&&(P=Q(e.newValue),X.forEach(a=>a()))}))}function ee(){return P===null&&(P=Ve()),De(),P}function D({completed:e=!1,currentTime:a,duration:i,lessonId:n}){if(!n||!Number.isFinite(i)||i<=0||!Number.isFinite(a))return;const d=ee(),s=d[n],r=!!(s?.completed||e),u=r?i:Math.min(i,Math.max(0,a));s&&s.completed===r&&Math.abs(s.currentTime-u)<.25&&Math.abs(s.duration-i)<.25||(P={...d,[n]:{completed:r,currentTime:u,duration:i,updatedAt:Date.now()}},Ge(),X.forEach(l=>l()))}function Ke(e){return!e||e.completed||e.currentTime<1?0:e.currentTime<e.duration-2?e.currentTime:0}const _=q,$e=[2,1,0];function ze({activeLessonIndex:e,fullCourseSelected:a=!1,autoplay:i=!0,open:n,onClose:d,onOpen:s,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(!n)return;const o=l.current;if(!o)return;let b=!1;p.current=null,o.load();const y=()=>{if(b)return;const M=Ke(ee()[f.id]);M>0&&(o.currentTime=M),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&&D({completed:o.ended,currentTime:o.currentTime,duration:o.duration,lessonId:f.id})}},[f.id,n,u]);function m(o,b=!1){!Number.isFinite(o.duration)||o.duration<=0||D({completed:b,currentTime:b?o.duration:o.currentTime,duration:o.duration,lessonId:f.id})}function w(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:s,type:"button"}),t.jsxs("div",{className:"get-started-playlist-stack","aria-hidden":"true",children:[$e.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(Ue,{})]}),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:Le})]}),t.jsx("p",{children:"Rewards, GRPO, RLVR, distillation, experiments, and a technical appendix."})]})]}),n?t.jsx(Be,{activeLessonIndex:e,autoplay:i,fullCourseSelected:a,onClose:d,onEnded:v,onPause:m,onSelectLesson:r,onTimeUpdate:w,videoRef:l}):null]})}function Be({activeLessonIndex:e,autoplay:a,fullCourseSelected:i,onClose:n,onEnded:d,onPause:s,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:n,onEnded:d,onPause:s,onTimeUpdate:u,video:f,videoRef:l})}const Fe={captionsUrl:de,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:oe,title:"What is an OpenPond Agent?",videoUrl:Ae};function Xe(e={}){const[a,i]=x.useState(null),[n,d]=x.useState(null),s=e.makeAgentTutorial===void 0?a:e.makeAgentTutorial,r=e.postTrainingCourse===void 0?n:e.postTrainingCourse,u=!!(r||s);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 w(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(pe,{titleElement:"h1",video:Fe})})]}),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(_e,{activeVideoId:s?.videoId??"create",autoplay:s?.autoplay??!0,onClose:p,onOpen:l,onSelectVideo:c,open:!!s,playRequestId:s?.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(ze,{activeLessonIndex:r?.lessonIndex??0,autoplay:r?.autoplay??!0,fullCourseSelected:r?.fullCourseSelected??!1,open:!!r,onClose:m,onOpen:f,onSelectLesson:w,playRequestId:r?.playRequestId??0})})]})]})})}export{Xe as GetStartedView};
1
+ import{r as x,j as t,A as te,X as ae,b5 as I,bH as ne,bI as se,bJ as ie,bK as re,bL as oe,bM as de}from"./index-LrGasYyx.js";import{P as k}from"./play-Cbsyrwkw.js";import{r as le}from"./index-BYgrO3wt.js";import{A as ce}from"./AppDialog-DacC7BcY.js";import{c as ue}from"./MarkdownText-R3MC5S30.js";function pe({badge:e,onPlay:a,titleElement:i="h3",video:n}){const[d,s]=x.useState(!1),r=x.useRef(null),u=i,l=`${n.id}-title`;function p(){if(a){a();return}le.flushSync(()=>s(!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 ${n.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:n.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:n.title}),t.jsxs("div",{className:"get-started-course-meta","aria-label":`${n.title} details`,children:[t.jsx("span",{children:n.eyebrow}),t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:n.duration})]}),n.description?t.jsx("p",{children:n.description}):null]})]}),d&&!a?t.jsx(L,{onClose:()=>s(!1),video:n,videoRef:r}):null]})}function L({autoAdvance:e=!1,contained:a=!1,inertExclusionSelector:i,navigation:n,onEnded:d,onClose:s,onPause:r,onTimeUpdate:u,video:l,videoRef:p}){return t.jsxs(ce,{ariaLabel:`${l.title} player`,backdropClassName:"get-started-course-player-backdrop",className:"get-started-course-player",contained:a,inertExclusionSelector:i,onClose:s,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:[n?`Lesson ${n.currentIndex+1} of ${n.total}`:l.eyebrow," · ",l.duration]})]}),t.jsxs("div",{className:"get-started-course-player-actions",children:[n?t.jsxs(t.Fragment,{children:[t.jsx("button",{"aria-label":"Previous lesson",disabled:!n.onPrevious,onClick:n.onPrevious,title:"Previous lesson",type:"button",children:t.jsx(te,{size:17})}),t.jsx("button",{"aria-label":"Next lesson",disabled:!n.onNext,onClick:n.onNext,title:"Next lesson",type:"button",children:t.jsx(ue,{size:17})})]}):null,t.jsx("button",{"aria-label":"Close video player","data-autofocus":!0,onClick:s,title:"Close",type:"button",children:t.jsx(ae,{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 fe=[{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"]}],ge=[{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}],me={playlists:fe,videos:ge},be="https://media.openpond.ai",K=me,he=new Map(K.playlists.map(e=>[e.id,e])),ye=new Map(K.videos.map(e=>[e.id,e]));function $(e){const a=he.get(e);if(!a)throw new Error(`Public video manifest is missing playlist ${e}`);return a}function Te(e,a){return a?`${be}/${e.objectKey}`:I(e.localPath)}function E(e){const a=ye.get(e);if(!a)throw new Error(`Public video manifest is missing ${e}`);return Te(a,!0)}const xe=E("make-agent-tutorial"),Ae=E("openpond-agent-overview");function ve(e){return E(`make-agent-tutorial-${e}`)}const Pe={title:"How to make an agent"},je=[{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:Pe,chapters:je},Ne=$("how-to-make-an-agent"),B=z.chapters,Ie={create:"1:24",use:"1:05",improve:"1:10"},S=Ne.title,Ee=z.tutorial.title,F="4:33",H={captionsUrl:se,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:ne,title:Ee,videoId:"play-all",videoUrl:xe},T=B.map((e,a)=>({captionsUrl:re(e.id),chapterIds:[e.id],description:e.subtitle,duration:Ie[e.id],eyebrow:`Lesson ${a+1}`,id:`make-agent-tutorial-${e.id}`,lessonNumber:a+1,posterUrl:ie(e.id),title:e.title,videoId:e.id,videoUrl:ve(e.id)})),we=[H,...T];function W(e){return we.find(a=>a.videoId===e)??H}function Se(e){const a=T.findIndex(i=>i.videoId===e);return a<0?null:T[a+1]?.videoId??null}const Re=[2,1,0];function _e({activeVideoId:e="play-all",autoplay:a=!0,onClose:i,onOpen:n,onSelectVideo:d,open:s=!1,playRequestId:r=0}={}){const u=x.useRef(null),l=W(e);x.useEffect(()=>{if(!s)return;const c=u.current;c&&(c.load(),r>0&&c.play().catch(()=>{}))},[l.id,s,r]);function p(){if(!a||!d)return;const c=Se(e);c&&d(c)}return t.jsxs("section",{className:"get-started-series","aria-label":S,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 ${S} playlist`,className:"get-started-playlist-open",onClick:n,type:"button"}),t.jsxs("div",{className:"get-started-playlist-stack","aria-hidden":"true",children:[Re.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:S}),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."})]})]}),s&&i&&d?t.jsx(Oe,{activeVideoId:e,autoplay:a,contained:!0,inertExclusionSelector:".get-started-learning-panel",onClose:i,onEnded:p,onSelectVideo:d,videoRef:u}):null]})}function Oe({activeVideoId:e="play-all",autoplay:a=!0,contained:i=!1,inertExclusionSelector:n,onClose:d,onEnded:s,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:n,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:s?()=>s():void 0,video:l,videoRef:u})}const U=$("post-training-from-first-principles"),q=U.title,ke=U.status;function h(e,a,i,n,d,s){const r=`courses/post-training/${a}`,u=`post-training-${a}`;return{captionsUrl:I(`${r}.vtt`),description:s,duration:d,eyebrow:n,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.")],Le="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 V="Subject to change, lesson work in progress";function Ue(){const e=ke==="draft"?"Draft":"Published";return t.jsx("span",{"aria-label":`${e}: ${V}`,className:"get-started-playlist-status app-tooltip","data-tooltip":V,tabIndex:0,children:e})}const C="openpond.post-training-progress.v1",j=Object.freeze({}),Ce=1e3,X=new Set;let P=null,N=null,G=!1;function R(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Me(e){if(!e||typeof e!="object"||Array.isArray(e))return j;const a={};for(const[i,n]of Object.entries(e)){if(!i||!n||typeof n!="object"||Array.isArray(n))continue;const d=n,s=R(d.duration),r=R(d.currentTime),u=R(d.updatedAt);if(s===null||s<=0||r===null)continue;const l=d.completed===!0;a[i]={completed:l,currentTime:l?s:Math.min(s,Math.max(0,r)),duration:s,updatedAt:u===null?0:Math.max(0,u)}}return Object.keys(a).length>0?a:j}function Q(e){if(!e)return j;try{return Me(JSON.parse(e))}catch{return j}}function Ve(){if(typeof window>"u")return j;try{return Q(window.localStorage.getItem(C))}catch{return j}}function Z(){if(typeof window<"u"&&N!==null&&window.clearTimeout(N),N=null,!(typeof window>"u"||P===null))try{window.localStorage.setItem(C,JSON.stringify(P))}catch{}}function Ge(){typeof window>"u"||N!==null||(N=window.setTimeout(Z,Ce))}function De(){typeof window>"u"||G||(G=!0,window.addEventListener("pagehide",Z),window.addEventListener("storage",e=>{e.key===C&&(P=Q(e.newValue),X.forEach(a=>a()))}))}function ee(){return P===null&&(P=Ve()),De(),P}function D({completed:e=!1,currentTime:a,duration:i,lessonId:n}){if(!n||!Number.isFinite(i)||i<=0||!Number.isFinite(a))return;const d=ee(),s=d[n],r=!!(s?.completed||e),u=r?i:Math.min(i,Math.max(0,a));s&&s.completed===r&&Math.abs(s.currentTime-u)<.25&&Math.abs(s.duration-i)<.25||(P={...d,[n]:{completed:r,currentTime:u,duration:i,updatedAt:Date.now()}},Ge(),X.forEach(l=>l()))}function Ke(e){return!e||e.completed||e.currentTime<1?0:e.currentTime<e.duration-2?e.currentTime:0}const _=q,$e=[2,1,0];function ze({activeLessonIndex:e,fullCourseSelected:a=!1,autoplay:i=!0,open:n,onClose:d,onOpen:s,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(!n)return;const o=l.current;if(!o)return;let b=!1;p.current=null,o.load();const y=()=>{if(b)return;const M=Ke(ee()[f.id]);M>0&&(o.currentTime=M),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&&D({completed:o.ended,currentTime:o.currentTime,duration:o.duration,lessonId:f.id})}},[f.id,n,u]);function m(o,b=!1){!Number.isFinite(o.duration)||o.duration<=0||D({completed:b,currentTime:b?o.duration:o.currentTime,duration:o.duration,lessonId:f.id})}function w(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:s,type:"button"}),t.jsxs("div",{className:"get-started-playlist-stack","aria-hidden":"true",children:[$e.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(Ue,{})]}),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:Le})]}),t.jsx("p",{children:"Rewards, GRPO, RLVR, distillation, experiments, and a technical appendix."})]})]}),n?t.jsx(Be,{activeLessonIndex:e,autoplay:i,fullCourseSelected:a,onClose:d,onEnded:v,onPause:m,onSelectLesson:r,onTimeUpdate:w,videoRef:l}):null]})}function Be({activeLessonIndex:e,autoplay:a,fullCourseSelected:i,onClose:n,onEnded:d,onPause:s,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:n,onEnded:d,onPause:s,onTimeUpdate:u,video:f,videoRef:l})}const Fe={captionsUrl:de,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:oe,title:"What is an OpenPond Agent?",videoUrl:Ae};function Xe(e={}){const[a,i]=x.useState(null),[n,d]=x.useState(null),s=e.makeAgentTutorial===void 0?a:e.makeAgentTutorial,r=e.postTrainingCourse===void 0?n:e.postTrainingCourse,u=!!(r||s);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 w(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(pe,{titleElement:"h1",video:Fe})})]}),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(_e,{activeVideoId:s?.videoId??"create",autoplay:s?.autoplay??!0,onClose:p,onOpen:l,onSelectVideo:c,open:!!s,playRequestId:s?.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(ze,{activeLessonIndex:r?.lessonIndex??0,autoplay:r?.autoplay??!0,fullCourseSelected:r?.fullCourseSelected??!1,open:!!r,onClose:m,onOpen:f,onSelectLesson:w,playRequestId:r?.playRequestId??0})})]})]})})}export{Xe as GetStartedView};