openpond 0.0.35 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{app-layer-GUF2CKYH.js → app-layer-4AA4YYGK.js} +3 -3
- package/dist/chunks/{apps-DIVHAUOV.js → apps-V2JTB5MD.js} +3 -3
- package/dist/chunks/{chunk-FRPL5XPX.js → chunk-3DOOLZZM.js} +1 -1
- package/dist/chunks/{chunk-CRFB72X2.js → chunk-3JJBNVNX.js} +3 -3
- package/dist/chunks/{chunk-GUGFYXFS.js → chunk-65BVQIHR.js} +4 -4
- package/dist/chunks/{chunk-NTRTK6C6.js → chunk-6L5WJF7T.js} +2 -2
- package/dist/chunks/{chunk-SECNDLPQ.js → chunk-7IPF4X3K.js} +67 -1
- package/dist/chunks/{chunk-ZZOTKXRD.js → chunk-CJSD5ADV.js} +2 -2
- package/dist/chunks/{chunk-TXJ4TIDO.js → chunk-G6WW2656.js} +1 -1
- package/dist/chunks/{chunk-II2ERA2H.js → chunk-GALAW74P.js} +2 -2
- package/dist/chunks/{chunk-4Y25BACE.js → chunk-JAS6QZ2W.js} +1 -1
- package/dist/chunks/{chunk-EY52SLOQ.js → chunk-MJT7EW5Q.js} +1 -1
- package/dist/chunks/{chunk-2GV3QBBZ.js → chunk-MSX2J653.js} +1 -1
- package/dist/chunks/{chunk-YPK2W34Z.js → chunk-NVTC3XOA.js} +1 -1
- package/dist/chunks/{chunk-XIF53VR3.js → chunk-NWQTF6O4.js} +1 -1
- package/dist/chunks/{chunk-RLQGMSW7.js → chunk-NWVIUBJ3.js} +2 -2
- package/dist/chunks/{chunk-S3VA47DG.js → chunk-TYYR7KWY.js} +3 -3
- package/dist/chunks/{chunk-LUA5QGQP.js → chunk-YLULZMWE.js} +33 -33
- package/dist/chunks/{chunk-2I5TZW66.js → chunk-YRFQKUZD.js} +40 -1
- package/dist/chunks/{cli-3AEIYSMD.js → cli-4JA3SIDE.js} +6 -6
- package/dist/chunks/{cli-HUVI6ELM.js → cli-RJHEE4FA.js} +4 -4
- package/dist/chunks/{core-commands-2HUTKFHQ.js → core-commands-CQSPCVC4.js} +4 -4
- package/dist/chunks/{extend-PAJMXYKV.js → extend-4MZ75SHV.js} +9 -9
- package/dist/chunks/{harness-UWAS2VAN.js → harness-YVZU42S7.js} +3 -3
- package/dist/chunks/{help-M7D2XAOX.js → help-6SULYXVS.js} +1 -1
- package/dist/chunks/{opchat-FQ2CJVM6.js → opchat-XGS4AXHA.js} +5 -5
- package/dist/chunks/{organizations-L5N6LJ7O.js → organizations-4GFQ3NT2.js} +4 -4
- package/dist/chunks/{profile-KH5IKVNY.js → profile-VWMBIHIE.js} +7 -7
- package/dist/chunks/{project-agent-F4NHVRGY.js → project-agent-SQ6ODALG.js} +6 -6
- package/dist/chunks/{sandbox-command-DDXRQNB6.js → sandbox-command-34S2V7BN.js} +4 -4
- package/dist/chunks/{sandbox-template-5EEEQKR5.js → sandbox-template-VP5HMGQI.js} +5 -5
- package/dist/chunks/{src-34FV42HE.js → src-X3R3XIJT.js} +403 -28
- package/dist/chunks/{src-LHZWUSD7.js → src-YHUMH6W6.js} +2 -2
- package/dist/chunks/{teams-bot-HFWO5GOV.js → teams-bot-EIVRNO5S.js} +3 -3
- package/dist/chunks/{workspaces-LO44JAC2.js → workspaces-2N52V3BI.js} +2 -2
- package/dist/cli.js +10 -10
- package/dist/web/assets/{AppDialog-T3j6O3yg.js → AppDialog-j4N-gIi3.js} +1 -1
- package/dist/web/assets/{AppsView-70Qqf9eJ.js → AppsView-YiK3pqNb.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-CdBLHdNW.js → BrowserSidebar-BWFLEQ8j.js} +1 -1
- package/dist/web/assets/{CloudWorkView-C5-jvlOo.js → CloudWorkView-3sS_1bhN.js} +1 -1
- package/dist/web/assets/CommandMenu-B11OrTCq.js +1 -0
- package/dist/web/assets/{CommunityView-BHUJ9Hun.js → CommunityView-DXyXTWhP.js} +1 -1
- package/dist/web/assets/ComposerCreateImproveStrip-3NoRiJJq.js +1 -0
- package/dist/web/assets/{GetStartedView-CIXScviw.js → GetStartedView-CPV5lgVH.js} +1 -1
- package/dist/web/assets/LabsRoute-B_nsEZXy.js +3 -0
- package/dist/web/assets/LabsRoute-dNN-odU0.css +1 -0
- package/dist/web/assets/MainChatThread-Dg7p3R2O.js +2 -0
- package/dist/web/assets/{MakeAgentTutorialLearningPanel-r7jyZVc0.js → MakeAgentTutorialLearningPanel-C6F-kJQd.js} +2 -2
- package/dist/web/assets/{MarkdownText-E35C404I.js → MarkdownText-CkVkr3P1.js} +3 -3
- package/dist/web/assets/Messages-C7uHGoFw.js +10 -0
- package/dist/web/assets/{NativeSkillSidebar-Qgccncuc.js → NativeSkillSidebar-BPpoHjEW.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-BowacUmA.js → NewProjectDialog-DBMhkTvD.js} +1 -1
- package/dist/web/assets/{PostTrainingLearningPanel-oJu5qaHK.js → PostTrainingLearningPanel-B1Rp7iIL.js} +2 -2
- package/dist/web/assets/{PostTrainingStatusPill-B9Eoc4s0.js → PostTrainingStatusPill-BGZ9h5eW.js} +1 -1
- package/dist/web/assets/{ProfileSettingsSection-Dnh92gDH.js → ProfileSettingsSection-2NOHEz2b.js} +1 -1
- package/dist/web/assets/RightChatPanelStack-CLK7_zKe.js +1 -0
- package/dist/web/assets/{SettingsView-Bjehxwt1.js → SettingsView-BAqea_KX.js} +4 -4
- package/dist/web/assets/{TeamChatView-Tn4X5cuY.js → TeamChatView-qVscSedQ.js} +2 -2
- package/dist/web/assets/{TerminalOverlay-DoX5LYzK.js → TerminalOverlay-Bkw7XqMy.js} +1 -1
- package/dist/web/assets/TrainingCreationPanel-COg1wvw8.js +1 -0
- package/dist/web/assets/{TrainingDraftPanel-Da6uGu9y.js → TrainingDraftPanel-BNK2znmI.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-DKky0p47.js → UsageSettingsSection-CUxBaohC.js} +1 -1
- package/dist/web/assets/WorkspaceDiffPanel-qfFj8IRq.js +14 -0
- package/dist/web/assets/{WorkspaceEnvironmentMenu-Ba4M8z1N.js → WorkspaceEnvironmentMenu-C0-mH7oF.js} +3 -3
- package/dist/web/assets/{WorkspaceGitDialogs-CSepNOb8.js → WorkspaceGitDialogs-VvC2px0X.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-LhFdzCRs.js → WorkspaceMonacoEditor-CUIwoHv1.js} +3 -3
- package/dist/web/assets/{activity-bW02ZsBD.js → activity-BhqHgkfJ.js} +1 -1
- package/dist/web/assets/{boxes-B1dRA1pi.js → boxes-BpqUKFIm.js} +1 -1
- package/dist/web/assets/{chevron-up-CySy6WNq.js → chevron-up-BTn9DVRP.js} +1 -1
- package/dist/web/assets/{circle-x-DY8vKAKi.js → circle-x-B9Qa8o5a.js} +1 -1
- package/dist/web/assets/{copy-DuHI1UZ_.js → copy-BsYs6wBI.js} +1 -1
- package/dist/web/assets/{create-pipeline-request-CGBcdK9r.js → create-pipeline-request-vxgKoAvv.js} +3 -3
- package/dist/web/assets/{credit-card-Bot0OuTl.js → credit-card-BCePAwMI.js} +1 -1
- package/dist/web/assets/{cssMode-BIjAothW.js → cssMode-mw8RI2fR.js} +1 -1
- package/dist/web/assets/{git-branch-Cm02aNWq.js → git-branch-C7qQYFIs.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-FYILXW0v.js → git-commit-horizontal-CbX4pTOA.js} +1 -1
- package/dist/web/assets/{htmlMode-zO2xLLgL.js → htmlMode-Cc4Czh_M.js} +1 -1
- package/dist/web/assets/index-9tbdqUau.css +1 -0
- package/dist/web/assets/index-B_3z_lxq.js +1 -0
- package/dist/web/assets/index-Cr_RZ7GD.js +177 -0
- package/dist/web/assets/{info-DeuEU_RO.js → info-BNGbwgtq.js} +1 -1
- package/dist/web/assets/{jsonMode-D2A3mj4n.js → jsonMode-CbqbqGVz.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-aPSqvscU.js → lspLanguageFeatures-DKiKr5tH.js} +1 -1
- package/dist/web/assets/make-agent-tutorial-KKauJpB9.js +2 -0
- package/dist/web/assets/{monaco.contribution-KqCt1n9-.js → monaco.contribution-CNgwz_pw.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DAq6Jihl.js → monaco.contribution-CdUAX47Q.js} +2 -2
- package/dist/web/assets/{monaco.contribution-Do3Jjslo.js → monaco.contribution-D_-wu578.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CHVe9CQ9.js → monaco.contribution-Dxc4IxFM.js} +2 -2
- package/dist/web/assets/{monitor-DXvHWFeW.js → monitor-CNdx_GTg.js} +1 -1
- package/dist/web/assets/{play-BIHyH-Yu.js → play-BLRANWaV.js} +1 -1
- package/dist/web/assets/{python-g3mtmU2J.js → python-DYgDMu2R.js} +1 -1
- package/dist/web/assets/{refresh-cw-Daz0oqwK.js → refresh-cw-BFjjwYNf.js} +1 -1
- package/dist/web/assets/{reply-wu9DIBuK.js → reply-D012cuZl.js} +1 -1
- package/dist/web/assets/{rotate-cw-D7q9GgNc.js → rotate-cw-CTfjlR4G.js} +1 -1
- package/dist/web/assets/{save-BVFY6VTI.js → save-B1zYlRyN.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-D9C_WUDu.js → toggleHighContrast-D9XFH7EA.js} +1 -1
- package/dist/web/assets/{training-1du5QD-P.css → training-BN8CALIc.css} +1 -1
- package/dist/web/assets/{tsMode-B4lEUN5X.js → tsMode-BU-tuKsY.js} +1 -1
- package/dist/web/assets/{upload-DNbYB4Rl.js → upload-DU_81jvL.js} +1 -1
- package/dist/web/assets/{wifi-off-C5QLifIJ.js → wifi-off-TPsBnbGW.js} +1 -1
- package/dist/web/assets/{workers-CV4BZb_x.js → workers-NhWySRdT.js} +1 -1
- package/dist/web/assets/{yaml-3ah8oX43.js → yaml-DWXa_3ZL.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/CommandMenu-B3Y4MvmT.js +0 -1
- package/dist/web/assets/ComposerCreateImproveStrip-DeRI5XEO.js +0 -1
- package/dist/web/assets/LabsRoute-CgKtVYTP.css +0 -1
- package/dist/web/assets/LabsRoute-Cs_R1fuu.js +0 -3
- package/dist/web/assets/MainChatThread-h7VSA_Rc.js +0 -2
- package/dist/web/assets/Messages-BANZuAnA.js +0 -10
- package/dist/web/assets/RightChatPanelStack-pGwbt6Wy.js +0 -1
- package/dist/web/assets/TrainingCreationPanel-BLSf1Bnp.js +0 -1
- package/dist/web/assets/WorkspaceDiffPanel-DTRtW9n8.js +0 -14
- package/dist/web/assets/circle-alert-DMHz5tj_.js +0 -1
- package/dist/web/assets/index-B5AN29EO.js +0 -177
- package/dist/web/assets/index-BnwYyUgT.js +0 -1
- package/dist/web/assets/index-COGlKIJ4.css +0 -1
- package/dist/web/assets/make-agent-tutorial-A2W9Ajwv.js +0 -2
|
@@ -3,7 +3,7 @@ import { createRequire as __openpondCreateRequire } from "node:module"; var requ
|
|
|
3
3
|
import {
|
|
4
4
|
createReadyLineParser,
|
|
5
5
|
openUrlWithSystemBrowser
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MSX2J653.js";
|
|
7
7
|
import {
|
|
8
8
|
ApprovalSchema,
|
|
9
9
|
ContextUsageSnapshotSchema,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
DEFAULT_OPENPOND_CHAT_MODEL,
|
|
13
13
|
DEFAULT_OPENPOND_COMMAND_ACCESS_MODE,
|
|
14
14
|
OpenPondCommandAccessModeSchema
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7IPF4X3K.js";
|
|
16
16
|
import {
|
|
17
17
|
CONNECTED_APP_CATALOG,
|
|
18
18
|
buildConnectedAppInstallUrl,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
resolveSandboxClient
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-NWVIUBJ3.js";
|
|
5
|
+
import "./chunk-NVTC3XOA.js";
|
|
6
6
|
import {
|
|
7
7
|
optionString,
|
|
8
8
|
parseJsonOption,
|
|
9
9
|
requiredTeamId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-YLULZMWE.js";
|
|
11
11
|
import "./chunk-UACZUFIA.js";
|
|
12
12
|
|
|
13
13
|
// src/cli/teams-bot.ts
|
|
@@ -43,8 +43,8 @@ import {
|
|
|
43
43
|
truncatePatch,
|
|
44
44
|
uniqueSortedPaths,
|
|
45
45
|
workspaceImageContentType
|
|
46
|
-
} from "./chunk-
|
|
47
|
-
import "./chunk-
|
|
46
|
+
} from "./chunk-NWQTF6O4.js";
|
|
47
|
+
import "./chunk-MJT7EW5Q.js";
|
|
48
48
|
import "./chunk-UACZUFIA.js";
|
|
49
49
|
export {
|
|
50
50
|
MACOS_GIT_MISSING_DEVELOPER_TOOLS_ERROR,
|
package/dist/cli.js
CHANGED
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
parseArgs,
|
|
5
5
|
resolveAccountOption,
|
|
6
6
|
resolveBaseUrlOption
|
|
7
|
-
} from "./chunks/chunk-
|
|
7
|
+
} from "./chunks/chunk-NVTC3XOA.js";
|
|
8
8
|
import {
|
|
9
9
|
getInstalledCliVersion,
|
|
10
10
|
parseBooleanOption,
|
|
11
11
|
runCliCommand
|
|
12
|
-
} from "./chunks/chunk-
|
|
12
|
+
} from "./chunks/chunk-YLULZMWE.js";
|
|
13
13
|
import "./chunks/chunk-UACZUFIA.js";
|
|
14
14
|
|
|
15
15
|
// src/cli/top-level-action.ts
|
|
@@ -32,11 +32,11 @@ async function runOpenPondCli(argv = process.argv.slice(2)) {
|
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
if (action === "check-update") {
|
|
35
|
-
await (await import("./chunks/core-commands-
|
|
35
|
+
await (await import("./chunks/core-commands-CQSPCVC4.js")).runCheckUpdate();
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
if (action === "help") {
|
|
39
|
-
(await import("./chunks/help-
|
|
39
|
+
(await import("./chunks/help-6SULYXVS.js")).printHelp();
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
const selectedAccount = resolveAccountOption(options);
|
|
@@ -48,31 +48,31 @@ async function runOpenPondCli(argv = process.argv.slice(2)) {
|
|
|
48
48
|
process.env.OPENPOND_BASE_URL = selectedBaseUrl;
|
|
49
49
|
}
|
|
50
50
|
if (action === "tui") {
|
|
51
|
-
await (await import("./chunks/app-layer-
|
|
51
|
+
await (await import("./chunks/app-layer-4AA4YYGK.js")).runOpenPondTerminalCommand(options, rest);
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
if (action === "ui") {
|
|
55
|
-
await (await import("./chunks/app-layer-
|
|
55
|
+
await (await import("./chunks/app-layer-4AA4YYGK.js")).runOpenPondServerCommand("web", options, rest);
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
if (await runCliCommand({ command, options, rest })) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
(await import("./chunks/help-
|
|
61
|
+
(await import("./chunks/help-6SULYXVS.js")).printHelp();
|
|
62
62
|
process.exit(1);
|
|
63
63
|
}
|
|
64
64
|
async function runEmbeddedCompanion(argv) {
|
|
65
65
|
if (argv[0] === "__server") {
|
|
66
66
|
process.argv = [process.execPath, "openpond-server", ...argv.slice(1)];
|
|
67
67
|
const [{ createOpenPondServer }, { runOpenPondServerCli }] = await Promise.all([
|
|
68
|
-
import("./chunks/src-
|
|
69
|
-
import("./chunks/cli-
|
|
68
|
+
import("./chunks/src-X3R3XIJT.js"),
|
|
69
|
+
import("./chunks/cli-RJHEE4FA.js")
|
|
70
70
|
]);
|
|
71
71
|
await runOpenPondServerCli(createOpenPondServer);
|
|
72
72
|
return true;
|
|
73
73
|
}
|
|
74
74
|
if (argv[0] === "__terminal") {
|
|
75
|
-
await (await import("./chunks/src-
|
|
75
|
+
await (await import("./chunks/src-YHUMH6W6.js")).runOpenPondTerminalCli(argv.slice(1));
|
|
76
76
|
return true;
|
|
77
77
|
}
|
|
78
78
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as w}from"./index-
|
|
1
|
+
import{r as s,j as w}from"./index-Cr_RZ7GD.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,
|
|
1
|
+
import{r,b0 as b,n as L,j as e,S as I,a3 as k,X as P,b1 as E,T as F,E as U,b2 as T,b3 as R}from"./index-Cr_RZ7GD.js";const D=["For agents","Featured","Productivity","Developer tools"],M=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=O(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});V(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:W(g)}),e.jsxs("span",{children:[X(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:D.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 O(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:E})}),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(F,{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:G(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"?M.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 V(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 W(s){return s==="loading"?"Checking connections":s==="ready"?"Connection status current":s==="error"?"Connection status unavailable":"Connection status pending"}function X(s){return s.filter(n=>n.connected).length}function G(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,O as connectedAppSetupTeamId};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,
|
|
1
|
+
import{r as c,bE as v,j as a,aK as f,X as k,k as j,V as C,aH as g,ao as B,E as y,aL as N}from"./index-Cr_RZ7GD.js";import{R as T}from"./refresh-cw-BFjjwYNf.js";const x=[];function E(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 n=e.onState(o=>{o.conversationId===r&&l(o)});return()=>{s=!0,n()}},[e,r]);const u=c.useMemo(()=>b.tabs.find(s=>s.id===b.activeTabId)??null,[b.activeTabId,b.tabs]),t=c.useCallback(async(s,n={})=>{if(!e)return!1;const o=v(s,{explicitFile:n.explicitFile});return o?(n.newTab?await e.newTab({conversationId:r,url:o,explicitFile:n.explicitFile}):await e.open({conversationId:r,url:o,explicitFile:n.explicitFile}),!0):!1},[e,r]),i=u?{conversationId:r,tabId:u.id}:null;return{activeTab:u,available:!!e,bridge:e,state:b,back:()=>e&&i?e.back(i):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&&i?e.forward(i):Promise.resolve({ok:!1}),newTab:s=>e?e.newTab({conversationId:r,url:s}):Promise.resolve({ok:!1}),open:t,openExternal:()=>e&&i?e.openExternal(i):Promise.resolve({ok:!1}),reload:()=>e&&i?e.reload(i):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&&i?e.stop(i):Promise.resolve({ok:!1})}}function P({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:R(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 R(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:i,onReload:s,onStop:n}){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(g,{size:15})}),a.jsx("button",{type:"button",title:r?.loading?"Stop":"Reload","aria-label":r?.loading?"Stop":"Reload",disabled:!r,onClick:r?.loading?n:s,children:r?.loading?a.jsx(B,{size:13}):a.jsx(T,{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:i,children:a.jsx(y,{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(N,{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(n=>{const o=n?`${n.x}:${n.y}:${n.width}:${n.height}`:"null";l.current!==o&&(l.current=o,e(n))},[e]),i=c.useCallback(()=>{const n=b.current;if(!r||!n){t(null);return}const o=n.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,i()}))},[i]);return c.useLayoutEffect(()=>{l.current=null,i();const n=b.current;if(!r||!n)return t(null),()=>t(null);const o=new ResizeObserver(s);return o.observe(n),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,i,s]),a.jsx("div",{className:"browser-viewport",ref:b})}function L({conversationId:r,expanded:e,onResizeStart:b}){const l=E(r),u=c.useCallback(s=>{window.openpond?.browser?.setBounds({conversationId:r,bounds:s})},[r]),t=c.useCallback(s=>{l.open(s,{explicitFile:!0})},[l]),i=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(P,{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:i,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{L as BrowserSidebar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as ye,r,a6 as Ne,j as e,R as ke,b as B,am as ee,k as D,bP as se,bQ as ne,D as te,z as Se,bR as Ae,S as we,J as ie,W as H,aA as Re,X as Pe,bS as ae}from"./index-B5AN29EO.js";import{P as Te}from"./play-BIHyH-Yu.js";import{createPipelineAgentIdFromObjective as le,createPipelineSourceRootPathForAgent as _e}from"./create-pipeline-request-CGBcdK9r.js";function ze(s,t){return t==="archive"?!!s.archivedAt:t==="reviews"?s.status==="needs_review":!s.archivedAt}function $e(s){return s==="backlog"?"Task":s==="needs_review"?"Review":s.replace(/_/g," ")}function Me(s,t){const a=s.get(t);return a?.organizationName?`${a.organizationName} / ${a.name}`:a?.name??"Cloud Project"}function Ee(s){const t=s.filter(a=>!oe(a));return t.find(a=>a.role==="user")??t[0]??null}function oe(s){return s.metadata.source==="openpond_app_cloud_create_improve_link"||s.metadata.hidden===!0}function Oe(s){return s.adapter.kind==="local"?"Local profile":s.adapter.kind==="promote_local_to_hosted"?"Local to hosted":"Hosted profile"}function Le(s){return s?.plan?.checks?.length?s.plan.checks.map(t=>({name:t.name,command:t.command})):[{name:"inspect",command:"pnpm agent:inspect"},{name:"build",command:"pnpm build"},{name:"validate",command:"pnpm agent:validate"},{name:"eval",command:"pnpm agent:eval"}]}function De(s){return s?.plan?.requirements?.map(t=>({name:t.name,detail:[t.kind.replace(/_/g," "),t.status,t.detail].filter(Boolean).join(" / ")}))??[]}function He(s){const t=s?.workflowCapture;return t?[{name:"Actions",values:t.profileActions},{name:"Providers",values:t.externalProviders},{name:"Side effects",values:t.sideEffects},{name:"Files",values:t.files},{name:"Artifacts",values:t.outputArtifacts},{name:"Traces",values:t.traceRefs},{name:"Channels",values:t.channelTargets}].flatMap(({name:a,values:u})=>u.length?[{name:a,detail:u.join(", ")}]:[]):[]}function qe(s){if(s.plan?.sourcePlan?.length)return s.plan.sourcePlan;const t=s.operation==="improve"?"update":"create",a=s.target.kind==="agent"?s.target.id??le(s.objective):le(s.objective);return[{path:_e(a),operation:t,reason:s.objective},{path:"settings/profile.yaml",operation:"update",reason:"Expose the default chat action through the hosted profile catalog."}]}function Fe({workItem:s,detail:t,actionBusy:a,localProjectName:u,onApplyLocalPatch:x,onShowFiles:o}){const d=Je(s,t),m=s.status==="needs_review"&&!!(u&&x);return e.jsxs("article",{className:"cloud-work-boundary-strip",children:[e.jsxs("div",{children:[e.jsx("span",{children:Ke(s)}),e.jsx("small",{children:Ve(s)})]}),e.jsx("div",{className:"cloud-work-boundary-chips",children:d.map(j=>e.jsx("span",{children:j},j))}),s.status==="needs_review"?e.jsxs("button",{type:"button",onClick:()=>{x&&x()},disabled:a||!m,title:m?`Apply to ${u}`:"Link this Cloud Project to a local checkout before applying locally.",children:[e.jsx(ie,{size:13}),e.jsx("span",{children:m?"Apply locally":"No local checkout"})]}):null,o?e.jsxs("button",{type:"button",onClick:o,children:[e.jsx(H,{size:13}),e.jsx("span",{children:"Files"})]}):null]})}function Ke(s){return s.status==="needs_review"?"Cloud patch ready":s.status==="queued"||s.status==="running"?"Running in Cloud":s.status==="failed"?"Cloud task failed":"Cloud task"}function Ve(s){return s.status==="needs_review"?"Review files and apply locally only when ready.":s.status==="queued"||s.status==="running"?"The local checkout is unchanged while the sandbox works.":s.status==="failed"?"Open files/logs to inspect the remote run before retrying.":"Cloud changes stay remote until an explicit apply or pull action."}function Je(s,t){const a=[s.status.replace(/_/g," ")];return s.sourceRef&&a.push(s.sourceRef),s.latestSandboxId&&a.push("sandbox"),s.latestTaskRunId&&a.push("task run"),t?.activity.length&&a.push(`${t.activity.length} log${t.activity.length===1?"":"s"}`),s.status==="needs_review"&&a.push("patch only"),a.push("local unchanged"),a}function Qe({run:s,actionBusy:t,onApprove:a,onEdit:u,onCancel:x}){const o=s.state,d=s.plan,m=Le(s),j=De(s),f=He(s),N=qe(s),h=Re(d?.metadata),k=s.scope.targetProject?.name??s.scope.targetProject?.id??"Profile source",S=!!d&&o==="awaiting_plan_approval"&&(d?.status==="draft"||d?.status==="pending_approval"),A=(o==="planning"||o==="awaiting_plan_approval")&&(d?.status==="draft"||d?.status==="pending_approval");return e.jsxs("article",{className:"cloud-create-plan-review",children:[e.jsxs("div",{className:"cloud-create-plan-heading",children:[e.jsx(H,{size:16}),e.jsxs("div",{children:[e.jsx("span",{children:"Agent plan review"}),e.jsxs("small",{children:[s.operation," / ",Oe(s)," / ",o.replace(/_/g," ")]})]})]}),e.jsxs("div",{className:"cloud-create-plan-copy",children:[e.jsxs("section",{children:[e.jsx("span",{children:"Objective"}),e.jsx("p",{children:s.objective})]}),e.jsxs("section",{children:[e.jsx("span",{children:"Target"}),e.jsx("p",{children:k})]}),d?.capturedContextSummary?e.jsxs("section",{children:[e.jsx("span",{children:"Captured context"}),e.jsx("p",{children:d.capturedContextSummary})]}):s.context.targetRepoAssumptions.length?e.jsxs("section",{children:[e.jsx("span",{children:"Captured context"}),e.jsx("p",{children:s.context.targetRepoAssumptions.join("; ")})]}):null,s.context.attachments.length?e.jsxs("section",{children:[e.jsx("span",{children:"Inputs"}),e.jsx("p",{children:s.context.attachments.map(l=>l.name).join(", ")})]}):null,s.context.apps.length?e.jsxs("section",{children:[e.jsx("span",{children:"Apps"}),e.jsx("p",{children:s.context.apps.map(l=>l.name).join(", ")})]}):null,s.context.tools.length?e.jsxs("section",{children:[e.jsx("span",{children:"Tools"}),e.jsx("p",{children:s.context.tools.map(l=>l.name).join(", ")})]}):null,h?e.jsxs("section",{children:[e.jsx("span",{children:"Action shape"}),e.jsxs("p",{children:[h.label,": ",h.detail]})]}):null]}),e.jsxs("div",{className:"cloud-create-plan-grid",children:[h?e.jsxs("section",{children:[e.jsx("span",{children:"Actions"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("code",{children:h.defaultActionKey??"chat"}),e.jsx("small",{children:h.label})]}),h.directActionHint?e.jsxs("li",{children:[e.jsx("code",{children:"direct action"}),e.jsx("small",{children:h.directActionHint})]}):null]})]}):null,e.jsxs("section",{children:[e.jsx("span",{children:"Source plan"}),e.jsx("ul",{children:N.map(l=>e.jsxs("li",{children:[e.jsx("code",{children:l.path}),e.jsx("small",{children:l.operation})]},`${l.operation}:${l.path}`))})]}),e.jsxs("section",{children:[e.jsx("span",{children:"Checks"}),e.jsx("ul",{children:m.map(l=>e.jsxs("li",{children:[e.jsx("code",{children:l.name}),e.jsx("small",{children:l.command})]},`${l.name}:${l.command}`))})]}),j.length?e.jsxs("section",{children:[e.jsx("span",{children:"Requirements"}),e.jsx("ul",{children:j.map(l=>e.jsxs("li",{children:[e.jsx("code",{children:l.name}),e.jsx("small",{children:l.detail})]},`${l.name}:${l.detail}`))})]}):null,f.length?e.jsxs("section",{children:[e.jsx("span",{children:"Workflow evidence"}),e.jsx("ul",{children:f.map(l=>e.jsxs("li",{children:[e.jsx("code",{children:l.name}),e.jsx("small",{children:l.detail})]},`${l.name}:${l.detail}`))})]}):null]}),e.jsxs("div",{className:"cloud-create-plan-actions",children:[e.jsxs("button",{type:"button",onClick:a,disabled:t||!S,children:[e.jsx(ie,{size:14}),e.jsx("span",{children:"Confirm plan"})]}),e.jsxs("button",{type:"button",onClick:u,disabled:t||!A,children:[e.jsx(H,{size:14}),e.jsx("span",{children:"Edit plan"})]}),e.jsxs("button",{type:"button",onClick:x,disabled:t,children:[e.jsx(Pe,{size:14}),e.jsx("span",{children:"Cancel"})]})]})]})}function Ye({projects:s,workItems:t,selectedWorkItem:a,detail:u,loading:x,actionBusy:o,connection:d,error:m,model:j,showToast:f,onBack:N,onModelChange:h,onSetupCloudProject:k,onCreateWork:S,onSelectWorkItem:A,onSendMessage:l,onHandleBackground:q,onCancelCreatePlan:ce,onCancelTask:F,localProjectName:re,onApplyLocalPatch:de,onShowFiles:w}){ye(m);const[y,R]=r.useState(""),[b,g]=r.useState(""),K=r.useRef(null),P=r.useRef(null),[ue,V]=r.useState(0),[pe,T]=r.useState(0),[J,_]=r.useState(!1),[Q,U]=r.useState(!1),[C,z]=r.useState("tasks"),[$,he]=r.useState(""),[X,xe]=r.useState(()=>s[0]?.id??""),M=r.useMemo(()=>new Map(s.map(n=>[n.id,n])),[s]),v=M.has(X)?X:s[0]?.id??"",me=Ne("openpond",j),je=r.useMemo(()=>s.length?s.map(n=>({value:n.id,label:n.organizationName?`${n.organizationName} / ${n.name}`:n.name,shortLabel:n.name,description:n.sourceLabel??n.defaultBranch??void 0})):[{value:"",label:"No Cloud Project"}],[s]),G=r.useMemo(()=>{const n=$.trim().toLowerCase();return t.filter(c=>ze(c,C)?n?c.title.toLowerCase().includes(n):!0:!1)},[$,C,t]);async function Y(){const n=y.trim();!n||!v||o||(await S({projectId:v,prompt:n}),R(""),_(!1))}async function Z(){const n=b.trim();!n||o||(await l(n),g(""))}async function ve(){const n=b.trim();await q(n||null),g(""),U(!1)}function E(n){V(n.selectionStart??n.value.length)}function O(n){T(n.selectionStart??n.value.length)}function fe(n){const c=K.current,p=ae(y,n,c?.selectionStart??ue);R(p.value),V(p.cursorIndex),window.requestAnimationFrame(()=>{c?.focus(),c?.setSelectionRange(p.cursorIndex,p.cursorIndex)})}function be(n){const c=P.current,p=ae(b,n,c?.selectionStart??pe);g(p.value),T(p.cursorIndex),window.requestAnimationFrame(()=>{c?.focus(),c?.setSelectionRange(p.cursorIndex,p.cursorIndex)})}function ge(){g(n=>n||"Revise plan: "),window.requestAnimationFrame(()=>{const n=P.current,c=n?.value.length??0;n?.focus(),n?.setSelectionRange(c,c),T(c)})}if(a){const n=u?.messages??[],c=u?.activity??[],p=u?.createImproveRun??a.createImproveRun??null,W=Ee(n),L=W?.body??a.title,Ce=M.get(a.projectId)??null,I=a.status==="queued"||a.status==="running";return e.jsxs("section",{className:"cloud-work-view thread",children:[e.jsx("div",{className:"cloud-thread-body",children:e.jsxs("div",{className:"cloud-thread-timeline",children:[e.jsxs("div",{className:"cloud-thread-inline-nav",children:[e.jsxs("button",{type:"button",onClick:N,children:[e.jsx(ke,{size:15}),e.jsx("span",{children:"All tasks"})]}),e.jsx("span",{children:Ce?.name??"Cloud Project"}),a.sourceRef?e.jsx("span",{children:a.sourceRef}):null,w?e.jsx("button",{type:"button",onClick:w,children:e.jsx("span",{children:"Files"})}):null]}),L&&e.jsx("article",{className:"cloud-message user",children:e.jsx("p",{children:L})}),e.jsxs("div",{className:"cloud-worked-line",children:[e.jsx("span",{children:$e(a.status)}),e.jsx("span",{children:B(a.updatedAt)}),I&&e.jsxs("button",{type:"button",onClick:()=>{F()},disabled:o,children:[e.jsx(ee,{size:12}),e.jsx("span",{children:"Stop task"})]})]}),e.jsx(Fe,{workItem:a,detail:u,actionBusy:o,localProjectName:re,onApplyLocalPatch:de,onShowFiles:w}),p?e.jsx(Qe,{run:p,actionBusy:o,onApprove:()=>{q(null)},onEdit:ge,onCancel:()=>{ce()}}):null,n.filter(i=>i.id!==W?.id).filter(i=>!oe(i)).map(i=>e.jsx("article",{className:`cloud-message ${i.role}`,children:e.jsx("p",{children:i.body})},i.id)),c.map(i=>e.jsxs("article",{className:"cloud-activity",children:[e.jsx("span",{children:i.kind.replace(/_/g," ")}),e.jsx("p",{children:i.summary})]},i.id)),!x&&n.length===0&&c.length===0&&!L&&e.jsx("p",{className:"cloud-muted",children:"No messages yet."})]})}),e.jsxs("div",{className:"cloud-thread-composer",children:[e.jsx("button",{type:"button",className:`cloud-composer-plus ${Q?"active":""}`,onClick:()=>U(i=>!i),title:"Cloud task options",children:e.jsx(D,{size:18})}),Q&&e.jsxs("div",{className:"cloud-composer-options thread-options",children:[e.jsxs("button",{type:"button",onClick:()=>{ve()},disabled:o,children:[e.jsx(Te,{size:14}),e.jsx("span",{children:"Handle in background"})]}),I&&e.jsxs("button",{type:"button",onClick:()=>{F()},disabled:o,children:[e.jsx(ee,{size:14}),e.jsx("span",{children:"Stop task"})]})]}),e.jsx("textarea",{ref:P,value:b,rows:1,placeholder:"Request changes or ask a question",onChange:i=>{g(i.target.value),O(i.currentTarget)},onClick:i=>O(i.currentTarget),onSelect:i=>O(i.currentTarget),onKeyDown:i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),Z())}}),e.jsx(se,{buttonClassName:"cloud-composer-mic-button",connection:d,disabled:o,iconSize:17,wrapperClassName:"cloud-composer-mic",showToast:f,onTranscript:be}),e.jsx("button",{type:"button",className:"cloud-composer-submit",disabled:!b.trim()||o,onClick:()=>{Z()},title:"Send",children:e.jsx(ne,{size:17})})]})]})}return e.jsx("section",{className:"cloud-work-view home",children:e.jsxs("div",{className:"cloud-home-shell",children:[e.jsx("h1",{children:"What should we change next?"}),e.jsxs("div",{className:"cloud-home-composer",children:[e.jsx("textarea",{ref:K,value:y,rows:2,placeholder:"Describe a task",onChange:n=>{R(n.target.value),E(n.currentTarget)},onClick:n=>E(n.currentTarget),onSelect:n=>E(n.currentTarget),onKeyDown:n=>{n.key==="Enter"&&!n.shiftKey&&(n.preventDefault(),Y())}}),e.jsxs("div",{className:"cloud-home-composer-actions",children:[e.jsx("button",{type:"button",className:`cloud-composer-plus ${J?"active":""}`,onClick:()=>_(n=>!n),title:"Cloud task options",children:e.jsx(D,{size:18})}),e.jsxs("div",{className:"cloud-composer-selects",children:[e.jsx(te,{compact:!0,className:"cloud-project-select",disabled:o||s.length===0,label:"Cloud Project",options:je,placement:"top",value:v,onChange:xe}),e.jsx(te,{compact:!0,className:"cloud-model-select",disabled:o,label:"Model",options:Se("openpond"),placement:"top",value:me,onChange:h})]}),e.jsx(se,{buttonClassName:"cloud-composer-mic-button",connection:d,disabled:o,iconSize:17,wrapperClassName:"cloud-composer-mic",showToast:f,onTranscript:fe}),e.jsx("button",{type:"button",className:"cloud-composer-submit",disabled:!y.trim()||!v||o,onClick:()=>{Y()},title:"Handle in background",children:e.jsx(ne,{size:17})})]}),J&&e.jsxs("div",{className:"cloud-composer-options",children:[e.jsxs("button",{type:"button",onClick:()=>_(!1),disabled:o,children:[e.jsx(D,{size:14}),e.jsx("span",{children:"New task"})]}),e.jsxs("button",{type:"button",onClick:()=>k(v),disabled:!v||o,children:[e.jsx(Ae,{size:14}),e.jsx("span",{children:"Create environment"})]})]})]}),e.jsxs("div",{className:"cloud-task-list-toolbar",children:[e.jsxs("div",{className:"cloud-task-tabs",role:"tablist","aria-label":"Cloud tasks",children:[e.jsx("button",{type:"button",className:C==="tasks"?"active":"",onClick:()=>z("tasks"),children:"Tasks"}),e.jsx("button",{type:"button",className:C==="reviews"?"active":"",onClick:()=>z("reviews"),children:"Code reviews"}),e.jsx("button",{type:"button",className:C==="archive"?"active":"",onClick:()=>z("archive"),children:"Archive"})]}),e.jsxs("label",{className:"cloud-task-search",children:[e.jsx(we,{size:17}),e.jsx("input",{value:$,placeholder:"Search",onChange:n=>he(n.target.value)})]})]}),e.jsxs("div",{className:"cloud-task-list",children:[G.map(n=>e.jsxs("button",{type:"button",className:"cloud-task-row",onClick:()=>A(n),children:[e.jsx("span",{children:n.title}),e.jsxs("small",{children:[B(n.updatedAt)," · ",Me(M,n.projectId)]})]},n.id)),!x&&G.length===0&&e.jsx("p",{className:"cloud-empty",children:s.length?"No tasks yet":"Create or link a Cloud Project before starting a task"}),x&&e.jsx("p",{className:"cloud-empty",children:"Loading tasks..."})]})]})})}export{Ye as CloudWorkView};
|
|
1
|
+
import{u as ye,r,a8 as Ne,j as e,V as ke,b as B,ao as ee,k as D,bV as se,bW as ne,D as te,A as Se,bX as Ae,S as we,N as ie,Z as H,aC as Re,X as Te,bY as ae}from"./index-Cr_RZ7GD.js";import{P as Pe}from"./play-BLRANWaV.js";import{createPipelineAgentIdFromObjective as le,createPipelineSourceRootPathForAgent as _e}from"./create-pipeline-request-vxgKoAvv.js";function ze(s,t){return t==="archive"?!!s.archivedAt:t==="reviews"?s.status==="needs_review":!s.archivedAt}function $e(s){return s==="backlog"?"Task":s==="needs_review"?"Review":s.replace(/_/g," ")}function Me(s,t){const a=s.get(t);return a?.organizationName?`${a.organizationName} / ${a.name}`:a?.name??"Cloud Project"}function Ee(s){const t=s.filter(a=>!oe(a));return t.find(a=>a.role==="user")??t[0]??null}function oe(s){return s.metadata.source==="openpond_app_cloud_create_improve_link"||s.metadata.hidden===!0}function Oe(s){return s.adapter.kind==="local"?"Local profile":s.adapter.kind==="promote_local_to_hosted"?"Local to hosted":"Hosted profile"}function Le(s){return s?.plan?.checks?.length?s.plan.checks.map(t=>({name:t.name,command:t.command})):[{name:"inspect",command:"pnpm agent:inspect"},{name:"build",command:"pnpm build"},{name:"validate",command:"pnpm agent:validate"},{name:"eval",command:"pnpm agent:eval"}]}function De(s){return s?.plan?.requirements?.map(t=>({name:t.name,detail:[t.kind.replace(/_/g," "),t.status,t.detail].filter(Boolean).join(" / ")}))??[]}function He(s){const t=s?.workflowCapture;return t?[{name:"Actions",values:t.profileActions},{name:"Providers",values:t.externalProviders},{name:"Side effects",values:t.sideEffects},{name:"Files",values:t.files},{name:"Artifacts",values:t.outputArtifacts},{name:"Traces",values:t.traceRefs},{name:"Channels",values:t.channelTargets}].flatMap(({name:a,values:u})=>u.length?[{name:a,detail:u.join(", ")}]:[]):[]}function qe(s){if(s.plan?.sourcePlan?.length)return s.plan.sourcePlan;const t=s.operation==="improve"?"update":"create",a=s.target.kind==="agent"?s.target.id??le(s.objective):le(s.objective);return[{path:_e(a),operation:t,reason:s.objective},{path:"settings/profile.yaml",operation:"update",reason:"Expose the default chat action through the hosted profile catalog."}]}function Fe({workItem:s,detail:t,actionBusy:a,localProjectName:u,onApplyLocalPatch:x,onShowFiles:o}){const d=Xe(s,t),m=s.status==="needs_review"&&!!(u&&x);return e.jsxs("article",{className:"cloud-work-boundary-strip",children:[e.jsxs("div",{children:[e.jsx("span",{children:Ke(s)}),e.jsx("small",{children:Ve(s)})]}),e.jsx("div",{className:"cloud-work-boundary-chips",children:d.map(j=>e.jsx("span",{children:j},j))}),s.status==="needs_review"?e.jsxs("button",{type:"button",onClick:()=>{x&&x()},disabled:a||!m,title:m?`Apply to ${u}`:"Link this Cloud Project to a local checkout before applying locally.",children:[e.jsx(ie,{size:13}),e.jsx("span",{children:m?"Apply locally":"No local checkout"})]}):null,o?e.jsxs("button",{type:"button",onClick:o,children:[e.jsx(H,{size:13}),e.jsx("span",{children:"Files"})]}):null]})}function Ke(s){return s.status==="needs_review"?"Cloud patch ready":s.status==="queued"||s.status==="running"?"Running in Cloud":s.status==="failed"?"Cloud task failed":"Cloud task"}function Ve(s){return s.status==="needs_review"?"Review files and apply locally only when ready.":s.status==="queued"||s.status==="running"?"The local checkout is unchanged while the sandbox works.":s.status==="failed"?"Open files/logs to inspect the remote run before retrying.":"Cloud changes stay remote until an explicit apply or pull action."}function Xe(s,t){const a=[s.status.replace(/_/g," ")];return s.sourceRef&&a.push(s.sourceRef),s.latestSandboxId&&a.push("sandbox"),s.latestTaskRunId&&a.push("task run"),t?.activity.length&&a.push(`${t.activity.length} log${t.activity.length===1?"":"s"}`),s.status==="needs_review"&&a.push("patch only"),a.push("local unchanged"),a}function Ue({run:s,actionBusy:t,onApprove:a,onEdit:u,onCancel:x}){const o=s.state,d=s.plan,m=Le(s),j=De(s),f=He(s),N=qe(s),h=Re(d?.metadata),k=s.scope.targetProject?.name??s.scope.targetProject?.id??"Profile source",S=!!d&&o==="awaiting_plan_approval"&&(d?.status==="draft"||d?.status==="pending_approval"),A=(o==="planning"||o==="awaiting_plan_approval")&&(d?.status==="draft"||d?.status==="pending_approval");return e.jsxs("article",{className:"cloud-create-plan-review",children:[e.jsxs("div",{className:"cloud-create-plan-heading",children:[e.jsx(H,{size:16}),e.jsxs("div",{children:[e.jsx("span",{children:"Agent plan review"}),e.jsxs("small",{children:[s.operation," / ",Oe(s)," / ",o.replace(/_/g," ")]})]})]}),e.jsxs("div",{className:"cloud-create-plan-copy",children:[e.jsxs("section",{children:[e.jsx("span",{children:"Objective"}),e.jsx("p",{children:s.objective})]}),e.jsxs("section",{children:[e.jsx("span",{children:"Target"}),e.jsx("p",{children:k})]}),d?.capturedContextSummary?e.jsxs("section",{children:[e.jsx("span",{children:"Captured context"}),e.jsx("p",{children:d.capturedContextSummary})]}):s.context.targetRepoAssumptions.length?e.jsxs("section",{children:[e.jsx("span",{children:"Captured context"}),e.jsx("p",{children:s.context.targetRepoAssumptions.join("; ")})]}):null,s.context.attachments.length?e.jsxs("section",{children:[e.jsx("span",{children:"Inputs"}),e.jsx("p",{children:s.context.attachments.map(l=>l.name).join(", ")})]}):null,s.context.apps.length?e.jsxs("section",{children:[e.jsx("span",{children:"Apps"}),e.jsx("p",{children:s.context.apps.map(l=>l.name).join(", ")})]}):null,s.context.tools.length?e.jsxs("section",{children:[e.jsx("span",{children:"Tools"}),e.jsx("p",{children:s.context.tools.map(l=>l.name).join(", ")})]}):null,h?e.jsxs("section",{children:[e.jsx("span",{children:"Action shape"}),e.jsxs("p",{children:[h.label,": ",h.detail]})]}):null]}),e.jsxs("div",{className:"cloud-create-plan-grid",children:[h?e.jsxs("section",{children:[e.jsx("span",{children:"Actions"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("code",{children:h.defaultActionKey??"chat"}),e.jsx("small",{children:h.label})]}),h.directActionHint?e.jsxs("li",{children:[e.jsx("code",{children:"direct action"}),e.jsx("small",{children:h.directActionHint})]}):null]})]}):null,e.jsxs("section",{children:[e.jsx("span",{children:"Source plan"}),e.jsx("ul",{children:N.map(l=>e.jsxs("li",{children:[e.jsx("code",{children:l.path}),e.jsx("small",{children:l.operation})]},`${l.operation}:${l.path}`))})]}),e.jsxs("section",{children:[e.jsx("span",{children:"Checks"}),e.jsx("ul",{children:m.map(l=>e.jsxs("li",{children:[e.jsx("code",{children:l.name}),e.jsx("small",{children:l.command})]},`${l.name}:${l.command}`))})]}),j.length?e.jsxs("section",{children:[e.jsx("span",{children:"Requirements"}),e.jsx("ul",{children:j.map(l=>e.jsxs("li",{children:[e.jsx("code",{children:l.name}),e.jsx("small",{children:l.detail})]},`${l.name}:${l.detail}`))})]}):null,f.length?e.jsxs("section",{children:[e.jsx("span",{children:"Workflow evidence"}),e.jsx("ul",{children:f.map(l=>e.jsxs("li",{children:[e.jsx("code",{children:l.name}),e.jsx("small",{children:l.detail})]},`${l.name}:${l.detail}`))})]}):null]}),e.jsxs("div",{className:"cloud-create-plan-actions",children:[e.jsxs("button",{type:"button",onClick:a,disabled:t||!S,children:[e.jsx(ie,{size:14}),e.jsx("span",{children:"Confirm plan"})]}),e.jsxs("button",{type:"button",onClick:u,disabled:t||!A,children:[e.jsx(H,{size:14}),e.jsx("span",{children:"Edit plan"})]}),e.jsxs("button",{type:"button",onClick:x,disabled:t,children:[e.jsx(Te,{size:14}),e.jsx("span",{children:"Cancel"})]})]})]})}function Je({projects:s,workItems:t,selectedWorkItem:a,detail:u,loading:x,actionBusy:o,connection:d,error:m,model:j,showToast:f,onBack:N,onModelChange:h,onSetupCloudProject:k,onCreateWork:S,onSelectWorkItem:A,onSendMessage:l,onHandleBackground:q,onCancelCreatePlan:ce,onCancelTask:F,localProjectName:re,onApplyLocalPatch:de,onShowFiles:w}){ye(m);const[y,R]=r.useState(""),[b,g]=r.useState(""),K=r.useRef(null),T=r.useRef(null),[ue,V]=r.useState(0),[pe,P]=r.useState(0),[X,_]=r.useState(!1),[U,Y]=r.useState(!1),[C,z]=r.useState("tasks"),[$,he]=r.useState(""),[Z,xe]=r.useState(()=>s[0]?.id??""),M=r.useMemo(()=>new Map(s.map(n=>[n.id,n])),[s]),v=M.has(Z)?Z:s[0]?.id??"",me=Ne("openpond",j),je=r.useMemo(()=>s.length?s.map(n=>({value:n.id,label:n.organizationName?`${n.organizationName} / ${n.name}`:n.name,shortLabel:n.name,description:n.sourceLabel??n.defaultBranch??void 0})):[{value:"",label:"No Cloud Project"}],[s]),G=r.useMemo(()=>{const n=$.trim().toLowerCase();return t.filter(c=>ze(c,C)?n?c.title.toLowerCase().includes(n):!0:!1)},[$,C,t]);async function J(){const n=y.trim();!n||!v||o||(await S({projectId:v,prompt:n}),R(""),_(!1))}async function Q(){const n=b.trim();!n||o||(await l(n),g(""))}async function ve(){const n=b.trim();await q(n||null),g(""),Y(!1)}function E(n){V(n.selectionStart??n.value.length)}function O(n){P(n.selectionStart??n.value.length)}function fe(n){const c=K.current,p=ae(y,n,c?.selectionStart??ue);R(p.value),V(p.cursorIndex),window.requestAnimationFrame(()=>{c?.focus(),c?.setSelectionRange(p.cursorIndex,p.cursorIndex)})}function be(n){const c=T.current,p=ae(b,n,c?.selectionStart??pe);g(p.value),P(p.cursorIndex),window.requestAnimationFrame(()=>{c?.focus(),c?.setSelectionRange(p.cursorIndex,p.cursorIndex)})}function ge(){g(n=>n||"Revise plan: "),window.requestAnimationFrame(()=>{const n=T.current,c=n?.value.length??0;n?.focus(),n?.setSelectionRange(c,c),P(c)})}if(a){const n=u?.messages??[],c=u?.activity??[],p=u?.createImproveRun??a.createImproveRun??null,W=Ee(n),L=W?.body??a.title,Ce=M.get(a.projectId)??null,I=a.status==="queued"||a.status==="running";return e.jsxs("section",{className:"cloud-work-view thread",children:[e.jsx("div",{className:"cloud-thread-body",children:e.jsxs("div",{className:"cloud-thread-timeline",children:[e.jsxs("div",{className:"cloud-thread-inline-nav",children:[e.jsxs("button",{type:"button",onClick:N,children:[e.jsx(ke,{size:15}),e.jsx("span",{children:"All tasks"})]}),e.jsx("span",{children:Ce?.name??"Cloud Project"}),a.sourceRef?e.jsx("span",{children:a.sourceRef}):null,w?e.jsx("button",{type:"button",onClick:w,children:e.jsx("span",{children:"Files"})}):null]}),L&&e.jsx("article",{className:"cloud-message user",children:e.jsx("p",{children:L})}),e.jsxs("div",{className:"cloud-worked-line",children:[e.jsx("span",{children:$e(a.status)}),e.jsx("span",{children:B(a.updatedAt)}),I&&e.jsxs("button",{type:"button",onClick:()=>{F()},disabled:o,children:[e.jsx(ee,{size:12}),e.jsx("span",{children:"Stop task"})]})]}),e.jsx(Fe,{workItem:a,detail:u,actionBusy:o,localProjectName:re,onApplyLocalPatch:de,onShowFiles:w}),p?e.jsx(Ue,{run:p,actionBusy:o,onApprove:()=>{q(null)},onEdit:ge,onCancel:()=>{ce()}}):null,n.filter(i=>i.id!==W?.id).filter(i=>!oe(i)).map(i=>e.jsx("article",{className:`cloud-message ${i.role}`,children:e.jsx("p",{children:i.body})},i.id)),c.map(i=>e.jsxs("article",{className:"cloud-activity",children:[e.jsx("span",{children:i.kind.replace(/_/g," ")}),e.jsx("p",{children:i.summary})]},i.id)),!x&&n.length===0&&c.length===0&&!L&&e.jsx("p",{className:"cloud-muted",children:"No messages yet."})]})}),e.jsxs("div",{className:"cloud-thread-composer",children:[e.jsx("button",{type:"button",className:`cloud-composer-plus ${U?"active":""}`,onClick:()=>Y(i=>!i),title:"Cloud task options",children:e.jsx(D,{size:18})}),U&&e.jsxs("div",{className:"cloud-composer-options thread-options",children:[e.jsxs("button",{type:"button",onClick:()=>{ve()},disabled:o,children:[e.jsx(Pe,{size:14}),e.jsx("span",{children:"Handle in background"})]}),I&&e.jsxs("button",{type:"button",onClick:()=>{F()},disabled:o,children:[e.jsx(ee,{size:14}),e.jsx("span",{children:"Stop task"})]})]}),e.jsx("textarea",{ref:T,value:b,rows:1,placeholder:"Request changes or ask a question",onChange:i=>{g(i.target.value),O(i.currentTarget)},onClick:i=>O(i.currentTarget),onSelect:i=>O(i.currentTarget),onKeyDown:i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),Q())}}),e.jsx(se,{buttonClassName:"cloud-composer-mic-button",connection:d,disabled:o,iconSize:17,wrapperClassName:"cloud-composer-mic",showToast:f,onTranscript:be}),e.jsx("button",{type:"button",className:"cloud-composer-submit",disabled:!b.trim()||o,onClick:()=>{Q()},title:"Send",children:e.jsx(ne,{size:17})})]})]})}return e.jsx("section",{className:"cloud-work-view home",children:e.jsxs("div",{className:"cloud-home-shell",children:[e.jsx("h1",{children:"What should we change next?"}),e.jsxs("div",{className:"cloud-home-composer",children:[e.jsx("textarea",{ref:K,value:y,rows:2,placeholder:"Describe a task",onChange:n=>{R(n.target.value),E(n.currentTarget)},onClick:n=>E(n.currentTarget),onSelect:n=>E(n.currentTarget),onKeyDown:n=>{n.key==="Enter"&&!n.shiftKey&&(n.preventDefault(),J())}}),e.jsxs("div",{className:"cloud-home-composer-actions",children:[e.jsx("button",{type:"button",className:`cloud-composer-plus ${X?"active":""}`,onClick:()=>_(n=>!n),title:"Cloud task options",children:e.jsx(D,{size:18})}),e.jsxs("div",{className:"cloud-composer-selects",children:[e.jsx(te,{compact:!0,className:"cloud-project-select",disabled:o||s.length===0,label:"Cloud Project",options:je,placement:"top",value:v,onChange:xe}),e.jsx(te,{compact:!0,className:"cloud-model-select",disabled:o,label:"Model",options:Se("openpond"),placement:"top",value:me,onChange:h})]}),e.jsx(se,{buttonClassName:"cloud-composer-mic-button",connection:d,disabled:o,iconSize:17,wrapperClassName:"cloud-composer-mic",showToast:f,onTranscript:fe}),e.jsx("button",{type:"button",className:"cloud-composer-submit",disabled:!y.trim()||!v||o,onClick:()=>{J()},title:"Handle in background",children:e.jsx(ne,{size:17})})]}),X&&e.jsxs("div",{className:"cloud-composer-options",children:[e.jsxs("button",{type:"button",onClick:()=>_(!1),disabled:o,children:[e.jsx(D,{size:14}),e.jsx("span",{children:"New task"})]}),e.jsxs("button",{type:"button",onClick:()=>k(v),disabled:!v||o,children:[e.jsx(Ae,{size:14}),e.jsx("span",{children:"Create environment"})]})]})]}),e.jsxs("div",{className:"cloud-task-list-toolbar",children:[e.jsxs("div",{className:"cloud-task-tabs",role:"tablist","aria-label":"Cloud tasks",children:[e.jsx("button",{type:"button",className:C==="tasks"?"active":"",onClick:()=>z("tasks"),children:"Tasks"}),e.jsx("button",{type:"button",className:C==="reviews"?"active":"",onClick:()=>z("reviews"),children:"Code reviews"}),e.jsx("button",{type:"button",className:C==="archive"?"active":"",onClick:()=>z("archive"),children:"Archive"})]}),e.jsxs("label",{className:"cloud-task-search",children:[e.jsx(we,{size:17}),e.jsx("input",{value:$,placeholder:"Search",onChange:n=>he(n.target.value)})]})]}),e.jsxs("div",{className:"cloud-task-list",children:[G.map(n=>e.jsxs("button",{type:"button",className:"cloud-task-row",onClick:()=>A(n),children:[e.jsx("span",{children:n.title}),e.jsxs("small",{children:[B(n.updatedAt)," · ",Me(M,n.projectId)]})]},n.id)),!x&&G.length===0&&e.jsx("p",{className:"cloud-empty",children:s.length?"No tasks yet":"Create or link a Cloud Project before starting a task"}),x&&e.jsx("p",{className:"cloud-empty",children:"Loading tasks..."})]})]})})}export{Je as CloudWorkView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as j,j as e,S as g,a as b,i as x,C as k,F as C,P,B as v,M,b as S,c as w}from"./index-Cr_RZ7GD.js";function F({open:s,query:r,projects:n,sessions:o,onQueryChange:c,onClose:d,onNewChat:f,onOpenProject:u,onOpenSession:m}){const t=r.trim().toLowerCase(),l=j.useMemo(()=>L(o,t,10),[t,o]),i=j.useMemo(()=>z(n,t,8),[t,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=>c(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(C,{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(P,{size:15}):a.savedForLater?e.jsx(v,{size:15}):e.jsx(M,{size:15}),e.jsx("span",{children:a.title}),e.jsx("small",{children:a.appName??S(a.updatedAt)})]},a.id)),l.length===0&&e.jsx("div",{className:"command-empty",children:"No chats found"})]})]})]})})}function L(s,r,n){const o=[];for(const c of s)if((!r||`${c.title} ${c.appName??""}`.toLowerCase().includes(r))&&(o.push(c),o.length>=n))break;return o}function z(s,r,n){const o=[];for(const c of s)if((!r||$(c).toLowerCase().includes(r))&&(o.push(c),o.length>=n))break;return o}function $(s){return w(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,c5 as Z,c6 as ee,c7 as se,bQ as ne,c8 as te,c9 as ie,a as ae,T as le,u as M,ca as O,I as oe}from"./index-B5AN29EO.js";import{S as re,W as ce,B as de}from"./wifi-off-C5QLifIJ.js";import{R as F}from"./refresh-cw-Daz0oqwK.js";import{M as J}from"./MarkdownText-E35C404I.js";import{R as me}from"./reply-wu9DIBuK.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(te));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 W=j.map(x=>({id:ie(),file:x,name:x.name,mediaType:x.type,sizeBytes:x.size,kind:"image",previewUrl:URL.createObjectURL(x)}));u(x=>[...x,...W]),d.length>r&&i(`Only ${R} images can be attached to one message.`),A()}function Q(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(Z,{attachment:t,onRemove:()=>Q(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(ee,{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(se,{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(ne,{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(me,{size:13})}),s.own?e.jsx("button",{type:"button","aria-label":"Edit",onClick:()=>m(!0),children:e.jsx(ae,{size:13})}):null,s.own?e.jsx("button",{type:"button","aria-label":"Delete",onClick:()=>{s.onDelete(s.message.id)},children:e.jsx(le,{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 Re({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(re,{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(ce,{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(oe,{size:14}):e.jsx(de,{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{Re as CommunityView};
|
|
1
|
+
import{r as l,j as e,X as H,cb as Z,cc as ee,cd as se,bW as ne,ce as te,cf as ie,a as ae,U as le,u as M,cg as O,K as oe}from"./index-Cr_RZ7GD.js";import{S as re,W as ce,B as de}from"./wifi-off-TPsBnbGW.js";import{R as K}from"./refresh-cw-BFjjwYNf.js";import{M as J}from"./MarkdownText-CkVkr3P1.js";import{R as me}from"./reply-D012cuZl.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,L=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),T=!!(s.disabled||s.busy||b),U=!T&&(!!n.trim()||c.length>0);l.useEffect(()=>{if(L==null){C([]);return}let t=!0;const r=window.setTimeout(()=>{s.onSearchMembers(L).then(d=>{t&&C(d)},()=>{t&&C([])})},150);return()=>{t=!1,window.clearTimeout(r)}},[L,s.onSearchMembers]),l.useEffect(()=>{v(0)},[S]),l.useEffect(()=>()=>F(D.current),[]);async function $(t){if(t?.preventDefault(),!!U){i(null),h(!0);try{const r=await Promise.all(c.map(te));if(!await s.onSend({body:n,mentionUserIds:fe(n,s.members),attachments:r,replyToMessageId:s.replyTo?.id??null}))return;F(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 W(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:ie(),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 G(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(Z,{attachment:t,onRemove:()=>G(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(ee,{ref:E,disabled:T,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=>W(t.currentTarget.files)}),e.jsx("button",{type:"button",className:"composer-icon","aria-label":"Attach images",disabled:T||c.length>=R,onClick:()=>k.current?.click(),children:e.jsx(se,{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(ne,{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 F(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(me,{size:13})}),s.own?e.jsx("button",{type:"button","aria-label":"Edit",onClick:()=>m(!0),children:e.jsx(ae,{size:13})}):null,s.own?e.jsx("button",{type:"button","aria-label":"Delete",onClick:()=>{s.onDelete(s.message.id)},children:e.jsx(le,{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 Re({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(K,{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(K,{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(re,{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(ce,{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(oe,{size:14}):e.jsx(de,{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{Re as CommunityView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as _,r as v,j as e,v as A,O as P,Z as x,X as j,N as y,x as w,aC as q}from"./index-Cr_RZ7GD.js";import{P as k}from"./play-BLRANWaV.js";import{R as C}from"./refresh-cw-BFjjwYNf.js";const N=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],z=_("circle-question-mark",N);function L({runtime:s}){const[a,i]=v.useState(!1),[o,l]=v.useState(""),[n,u]=v.useState(null),t=s.run,h=t.plan,g=B(t),c={run:t},f=S(t.state),r=T(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(A,{size:15}):t.state==="awaiting_questions"?e.jsx(z,{size:15}):$(t.state)?e.jsx(P,{className:"composer-create-spin",size:15}):e.jsx(x,{size:15}),e.jsx("span",{children:E(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(k,{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:M(t,r.id)}),e.jsxs("div",{className:"composer-create-actions",children:[e.jsxs("button",{type:"button",disabled:!!n||!F(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(C,{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(k,{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(C,{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:I(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(w,{size:13}),e.jsx("span",{children:n==="pause"?"Pausing":"Pause"})]}):null]})]})}function B(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=q(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 E(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 I(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 S(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){return["planning","applying_source","running_checks","evaluating","opening_pull_request","reconciling_release","pushing_hosted","running_hosted_checks"].includes(s)}function T(s){return[...s.candidates].reverse().find(a=>a.target.kind==="agent")??null}function F(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 M(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{L as ComposerCreateImproveStrip};
|