@kky42/pievo-server 2.2.0 → 2.4.1
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/.output/nitro.json +1 -1
- package/.output/public/assets/MachinesModal-CEddj7la.js +1 -0
- package/.output/public/assets/SignIn-BdkKWOSs.js +1 -0
- package/.output/public/assets/actionUi-BYBeYy7U.js +1 -0
- package/.output/public/assets/app-BAgHQVvr.css +2 -0
- package/.output/public/assets/index-BZLqD3JI.js +12 -0
- package/.output/public/assets/invite._token-BCLgmTO7.js +1 -0
- package/.output/public/assets/invite._token-ZnVQqqq4.js +1 -0
- package/.output/public/assets/lifecycleUi-C7dwHtbw.js +1 -0
- package/.output/public/assets/loops._loopId-X8PSlgdB.js +67 -0
- package/.output/public/assets/loops._loopId_.runs._runId-CA0-q1y5.js +3 -0
- package/.output/public/assets/preload-helper-CUIO87nJ.js +5 -0
- package/.output/public/assets/routes-BjKcDy6D.js +1 -0
- package/.output/public/assets/routes-bfMcArTT.js +1 -0
- package/.output/public/assets/t._teamId-B75J8h0x.js +1 -0
- package/.output/public/assets/t._teamId-D7WVPMDr.js +1 -0
- package/.output/public/assets/ui-DGOT8AoZ.js +1 -0
- package/.output/server/_libs/@base-ui/react+[...].mjs +4130 -4130
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
- package/.output/server/_libs/drizzle-orm+postgres.mjs +28 -1
- package/.output/server/_ssr/DashboardView-D_hKsCsv.mjs +1098 -0
- package/.output/server/_ssr/{notifyFns-DXMbgYu2.mjs → MachinesModal-DZ_9ErAU.mjs} +57 -35
- package/.output/server/_ssr/{SignIn-C4fSJl_j.mjs → SignIn-DjSrg0nO.mjs} +10 -24
- package/.output/server/_ssr/SocialLinks-BTjsnVOm.mjs +1051 -0
- package/.output/server/_ssr/{actionUi-BKF6xI3d.mjs → actionUi-D15R8L7R.mjs} +3 -3
- package/.output/server/_ssr/{artifactFiles-C8PQKN6V.mjs → artifactFiles-CV3OXxRD.mjs} +7 -8
- package/.output/server/_ssr/{artifactKind-BW0isV8L.mjs → artifactKind-ByzVa7fg.mjs} +27 -2
- package/.output/server/_ssr/artifacts-BhQvaGjF.mjs +2 -0
- package/.output/server/_ssr/{auth-Sie6sQHF.mjs → auth-CPCDf6Wr.mjs} +16 -19
- package/.output/server/_ssr/{boot-akwC2sQg.mjs → boot-BbWxaF-z.mjs} +1359 -3843
- package/.output/server/_ssr/boot-COHf8Gv3.mjs +2 -0
- package/.output/server/_ssr/{bun-sqlite-dialect-BW9W1_Ps-CLY8cORt.mjs → bun-sqlite-dialect-BW9W1_Ps-8MIh9jN1.mjs} +2 -2
- package/.output/server/_ssr/{d1-sqlite-dialect-BLC8LXE6-CRsXQNRe.mjs → d1-sqlite-dialect-BLC8LXE6-CcMQ01_d.mjs} +2 -2
- package/.output/server/_ssr/db-dw61xIt1.mjs +2 -0
- package/.output/server/_ssr/{dist-Cc_x6bBb.mjs → dist-AxCsRawm.mjs} +2 -2
- package/.output/server/_ssr/{factory-CDwHL_zY.mjs → factory-S7MaMVC2.mjs} +2 -2
- package/.output/server/_ssr/{invite._token-BlbVjz-o.mjs → invite._token-B1UgMbNQ.mjs} +3 -3
- package/.output/server/_ssr/{invite._token-BE_QUAVb.mjs → invite._token-BliJIGk4.mjs} +4 -5
- package/.output/server/_ssr/{invite._token-C7GjrJxr.mjs → invite._token-D296YVGd.mjs} +7 -7
- package/.output/server/_ssr/{kysely-adapter-zflsyYBA.mjs → kysely-adapter-DUdpqcCJ.mjs} +1 -1
- package/.output/server/_ssr/{lifecycleUi-Djb44Aj3.mjs → lifecycleUi-Dad3hvhm.mjs} +12 -11
- package/.output/server/_ssr/logger-DdUWuMdh.mjs +2 -0
- package/.output/server/_ssr/loopApi-Dy8ztANM.mjs +389 -0
- package/.output/server/_ssr/loopProjection-BZ1_IYCr.mjs +110 -0
- package/.output/server/_ssr/loops._loopId-CKsAnxMl.mjs +1255 -0
- package/.output/server/_ssr/{loops._loopId_.runs._runId-rBHW41dx.mjs → loops._loopId_.runs._runId-DG405pQs.mjs} +29 -74
- package/.output/server/_ssr/{loops._loopId_.runs._runId-Dk1QY49p.mjs → loops._loopId_.runs._runId-a_SyY8rX.mjs} +4 -5
- package/.output/server/_ssr/{machineFns-CoqLRLRh.mjs → machineFns-BSaE7K88.mjs} +3 -5
- package/.output/server/_ssr/{node-sqlite-dialect-dmrazfbM.mjs → node-sqlite-dialect-rWwVyt2J.mjs} +2 -2
- package/.output/server/_ssr/router-lMkobh5r.mjs +618 -0
- package/.output/server/_ssr/{routes-DebVUmCS.mjs → routes-CRHc9cLG.mjs} +6 -10
- package/.output/server/_ssr/{routes-Bx0bRxt9.mjs → routes-DNCZrs8z.mjs} +3 -3
- package/.output/server/_ssr/{routes-dQCBLTxY.mjs → routes-ufPbrGHs.mjs} +6 -6
- package/.output/server/_ssr/runDiff-CrZzjokj.mjs +2 -0
- package/.output/server/_ssr/ssr.mjs +65 -97
- package/.output/server/_ssr/store-CirPHuib.mjs +2 -0
- package/.output/server/_ssr/{t._teamId-BqOUF-0J.mjs → t._teamId-BoBoYEHL.mjs} +7 -7
- package/.output/server/_ssr/{t._teamId-D9nCEa2h.mjs → t._teamId-DcWOYjPf.mjs} +4 -4
- package/.output/server/_ssr/{t._teamId-BzWy4Ft2.mjs → t._teamId-QD2nN0wn.mjs} +7 -11
- package/.output/server/_ssr/{teamFns-BcnGMC-g.mjs → teamFns-BsmconJ1.mjs} +4 -4
- package/.output/server/_ssr/{teamFns-bm82twd5.mjs → teamFns-DcoVuWyH.mjs} +2 -2
- package/.output/server/_ssr/tokens-XngoyCU8.mjs +2 -0
- package/.output/server/_ssr/{ui-B6mE5-5v.mjs → ui-DmFKW2H_.mjs} +33 -47
- package/.output/server/{_tanstack-start-manifest_v-COr27bxK.mjs → _tanstack-start-manifest_v-Xd5bMpJe.mjs} +25 -33
- package/.output/server/drizzle/{0000_round_marauders.sql → 0000_baseline.sql} +102 -44
- package/.output/server/drizzle/meta/_journal.json +3 -115
- package/.output/server/index.mjs +82 -131
- package/drizzle/{0000_round_marauders.sql → 0000_baseline.sql} +102 -44
- package/drizzle/meta/_journal.json +3 -115
- package/package.json +2 -10
- package/scripts/pievo-server.mjs +3 -1
- package/scripts/server-cli-lib.mjs +23 -16
- package/.output/public/assets/CodeField-dOzyFQNH.js +0 -34
- package/.output/public/assets/LoopView-BTXoqfzM.js +0 -59
- package/.output/public/assets/Modal-Ba36NAkv.js +0 -1
- package/.output/public/assets/SignIn-Cc1zxGnA.js +0 -1
- package/.output/public/assets/actionUi-DDDfD0WX.js +0 -1
- package/.output/public/assets/app-D1cij_NJ.css +0 -2
- package/.output/public/assets/artifactView-Cd5wWPil.js +0 -66
- package/.output/public/assets/index-BGM1XGY0.js +0 -12
- package/.output/public/assets/invite._token-C3t4JfAY.js +0 -1
- package/.output/public/assets/invite._token-CUCNcN89.js +0 -1
- package/.output/public/assets/jsx-runtime-BseJUIpC.js +0 -1
- package/.output/public/assets/lifecycleUi-CMFw5Nlj.js +0 -1
- package/.output/public/assets/loopApi-CT1mMhlb.js +0 -3
- package/.output/public/assets/loops._loopId-CrSSvSVl.js +0 -4
- package/.output/public/assets/loops._loopId_.runs._runId-B5Qacloe.js +0 -3
- package/.output/public/assets/notifyFns-CYiZT7CK.js +0 -1
- package/.output/public/assets/preload-helper-DFkkpP6W.js +0 -3
- package/.output/public/assets/routes-B6Kg4mFC.js +0 -1
- package/.output/public/assets/routes-DsdcURfk.js +0 -1
- package/.output/public/assets/t._teamId-C9uEyAh_.js +0 -1
- package/.output/public/assets/t._teamId-Cmm4xdKj.js +0 -1
- package/.output/public/assets/ui-Gb1413-F.js +0 -1
- package/.output/public/assets/useRouter-DsjH8G0p.js +0 -1
- package/.output/server/_libs/@codemirror/autocomplete+[...].mjs +0 -19713
- package/.output/server/_libs/@codemirror/lang-css+[...].mjs +0 -2636
- package/.output/server/_libs/@codemirror/lang-html+[...].mjs +0 -2247
- package/.output/server/_libs/@codemirror/lang-json+[...].mjs +0 -79
- package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +0 -1736
- package/.output/server/_libs/@uiw/codemirror-extensions-basic-setup+[...].mjs +0 -76
- package/.output/server/_libs/babel__runtime.mjs +0 -30
- package/.output/server/_libs/clsx.mjs +0 -16
- package/.output/server/_libs/codemirror__commands.mjs +0 -1725
- package/.output/server/_libs/codemirror__lint.mjs +0 -565
- package/.output/server/_libs/codemirror__search.mjs +0 -1138
- package/.output/server/_libs/codemirror__theme-one-dark.mjs +0 -161
- package/.output/server/_libs/d3-array.mjs +0 -231
- package/.output/server/_libs/d3-color.mjs +0 -330
- package/.output/server/_libs/d3-format.mjs +0 -252
- package/.output/server/_libs/d3-interpolate.mjs +0 -163
- package/.output/server/_libs/d3-path.mjs +0 -77
- package/.output/server/_libs/d3-scale+[...].mjs +0 -1907
- package/.output/server/_libs/d3-shape.mjs +0 -818
- package/.output/server/_libs/decimal.js-light.mjs +0 -884
- package/.output/server/_libs/dom-serializer+[...].mjs +0 -708
- package/.output/server/_libs/domhandler.mjs +0 -461
- package/.output/server/_libs/domutils.mjs +0 -868
- package/.output/server/_libs/es-toolkit.mjs +0 -1737
- package/.output/server/_libs/eventemitter3.mjs +0 -236
- package/.output/server/_libs/html-dom-parser+htmlparser2.mjs +0 -1560
- package/.output/server/_libs/html-react-parser+[...].mjs +0 -1360
- package/.output/server/_libs/react-is.mjs +0 -48
- package/.output/server/_libs/react-redux+[...].mjs +0 -205
- package/.output/server/_libs/recharts+victory-vendor.mjs +0 -17303
- package/.output/server/_libs/uiw__codemirror-themes.mjs +0 -32
- package/.output/server/_libs/uiw__react-codemirror.mjs +0 -354
- package/.output/server/_ssr/CodeField-B7oOmmwH.mjs +0 -143
- package/.output/server/_ssr/DashboardView-0yoKh8Em.mjs +0 -2733
- package/.output/server/_ssr/LoopPlaybook-uq_sFfgU.mjs +0 -2105
- package/.output/server/_ssr/LoopView-BlOY-jfJ.mjs +0 -1300
- package/.output/server/_ssr/Modal-Bc_5TYGr.mjs +0 -49
- package/.output/server/_ssr/adapters-RReIIwAx.mjs +0 -134
- package/.output/server/_ssr/artifactView-iuPsp5aa.mjs +0 -304
- package/.output/server/_ssr/artifacts-B_F6vSih.mjs +0 -2
- package/.output/server/_ssr/boot-pVS0wjd0.mjs +0 -2
- package/.output/server/_ssr/db-Bdm9PFZF.mjs +0 -2
- package/.output/server/_ssr/logger-tfiliKTi.mjs +0 -2
- package/.output/server/_ssr/loopApi-8_KgBapr.mjs +0 -109
- package/.output/server/_ssr/loopApi-JzmqWENY.mjs +0 -564
- package/.output/server/_ssr/loops._loopId-D-aCCtrX.mjs +0 -1477
- package/.output/server/_ssr/loops._loopId-DZ-FjscA.mjs +0 -30
- package/.output/server/_ssr/notifyFns-CH7-bcmd.mjs +0 -118
- package/.output/server/_ssr/router-BFPzSTFx.mjs +0 -679
- package/.output/server/_ssr/runDiff-qA1C8R_L.mjs +0 -2
- package/.output/server/_ssr/store-DWUdkIq2.mjs +0 -2
- package/.output/server/_ssr/tokens-DG8z1GIg.mjs +0 -2
- package/.output/server/drizzle/0001_naive_silver_fox.sql +0 -25
- package/.output/server/drizzle/0002_funny_sage.sql +0 -12
- package/.output/server/drizzle/0003_optimal_slapstick.sql +0 -102
- package/.output/server/drizzle/0004_remove_grok_agent.sql +0 -5
- package/.output/server/drizzle/0005_heavy_gauntlet.sql +0 -8
- package/.output/server/drizzle/0006_tranquil_sharon_carter.sql +0 -1
- package/.output/server/drizzle/0007_faulty_starbolt.sql +0 -30
- package/.output/server/drizzle/0008_durable_lifecycle_evidence.sql +0 -15
- package/.output/server/drizzle/0009_ordinary_electro.sql +0 -1
- package/.output/server/drizzle/0010_workable_rage.sql +0 -14
- package/.output/server/drizzle/0011_steep_marvel_zombies.sql +0 -3
- package/.output/server/drizzle/0012_blocked_run_status.sql +0 -12
- package/.output/server/drizzle/0013_drop_run_outcome.sql +0 -2
- package/.output/server/drizzle/0014_luxuriant_scrambler.sql +0 -5
- package/.output/server/drizzle/0015_run_history_foundation.sql +0 -43
- package/.output/server/drizzle/0016_plural_machine_runs.sql +0 -4
- package/.output/server/drizzle/meta/0000_snapshot.json +0 -1333
- package/.output/server/drizzle/meta/0001_snapshot.json +0 -1498
- package/.output/server/drizzle/meta/0002_snapshot.json +0 -1576
- package/.output/server/drizzle/meta/0003_snapshot.json +0 -1666
- package/.output/server/drizzle/meta/0005_snapshot.json +0 -1666
- package/.output/server/drizzle/meta/0006_snapshot.json +0 -1672
- package/.output/server/drizzle/meta/0007_snapshot.json +0 -1787
- package/.output/server/drizzle/meta/0009_snapshot.json +0 -1793
- package/.output/server/drizzle/meta/0010_snapshot.json +0 -1891
- package/.output/server/drizzle/meta/0011_snapshot.json +0 -1872
- package/drizzle/0001_naive_silver_fox.sql +0 -25
- package/drizzle/0002_funny_sage.sql +0 -12
- package/drizzle/0003_optimal_slapstick.sql +0 -102
- package/drizzle/0004_remove_grok_agent.sql +0 -5
- package/drizzle/0005_heavy_gauntlet.sql +0 -8
- package/drizzle/0006_tranquil_sharon_carter.sql +0 -1
- package/drizzle/0007_faulty_starbolt.sql +0 -30
- package/drizzle/0008_durable_lifecycle_evidence.sql +0 -15
- package/drizzle/0009_ordinary_electro.sql +0 -1
- package/drizzle/0010_workable_rage.sql +0 -14
- package/drizzle/0011_steep_marvel_zombies.sql +0 -3
- package/drizzle/0012_blocked_run_status.sql +0 -12
- package/drizzle/0013_drop_run_outcome.sql +0 -2
- package/drizzle/0014_luxuriant_scrambler.sql +0 -5
- package/drizzle/0015_run_history_foundation.sql +0 -43
- package/drizzle/0016_plural_machine_runs.sql +0 -4
- package/drizzle/meta/0000_snapshot.json +0 -1333
- package/drizzle/meta/0001_snapshot.json +0 -1498
- package/drizzle/meta/0002_snapshot.json +0 -1576
- package/drizzle/meta/0003_snapshot.json +0 -1666
- package/drizzle/meta/0005_snapshot.json +0 -1666
- package/drizzle/meta/0006_snapshot.json +0 -1672
- package/drizzle/meta/0007_snapshot.json +0 -1787
- package/drizzle/meta/0009_snapshot.json +0 -1793
- package/drizzle/meta/0010_snapshot.json +0 -1891
- package/drizzle/meta/0011_snapshot.json +0 -1872
|
@@ -0,0 +1,1098 @@
|
|
|
1
|
+
import { o as __toESM } from "../_runtime.mjs";
|
|
2
|
+
import { g as require_react, h as require_jsx_runtime, s as TooltipProvider } from "../_libs/@base-ui/react+[...].mjs";
|
|
3
|
+
import { E as selectCls, S as rel, a as btn, b as labelCls, c as btnPrimaryPill, d as cronText, k as useHydrated, o as btnDanger, p as dotLabel, r as Pill, s as btnPrimary, t as ErrorBanner, u as btnSm, x as lastRunOf, y as inputCls } from "./ui-DmFKW2H_.mjs";
|
|
4
|
+
import { d as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
|
|
5
|
+
import { _ as listMyTeams, f as getConfig, g as listLoops, n as GitHubIcon, o as claimStatus, r as PievoLogo, t as GITHUB_URL, v as loadOlderRuns, y as mintClaim } from "./SocialLinks-BTjsnVOm.mjs";
|
|
6
|
+
import { t as setActiveTeamCookie } from "./teamCookie-B7hLOIie.mjs";
|
|
7
|
+
import { a as getTeamDetail, d as revokeTeamInvite, f as setTeamMemberRole, i as deleteTeam, l as removeTeamMember, n as createTeam, o as leaveTeam, r as createTeamInvite, s as listManagedTeams, t as addTeamMember, u as renameTeam } from "./teamFns-DcoVuWyH.mjs";
|
|
8
|
+
import { r as deriveLoopLifecycle } from "./lifecycleUi-Dad3hvhm.mjs";
|
|
9
|
+
import { a as Timeline, i as ModalSection, n as Modal, o as listMachines, r as ModalHead, s as mergeRuns, t as MachinesModal } from "./MachinesModal-DZ_9ErAU.mjs";
|
|
10
|
+
//#region node_modules/.nitro/vite/services/ssr/assets/DashboardView-D_hKsCsv.js
|
|
11
|
+
var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
12
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
13
|
+
function LoopCard({ loop, onOpen, onPickRun }) {
|
|
14
|
+
const en = loop.enabled;
|
|
15
|
+
const last = lastRunOf(loop);
|
|
16
|
+
const lifecycle = deriveLoopLifecycle(loop);
|
|
17
|
+
const hydrated = useHydrated();
|
|
18
|
+
const [older, setOlder] = (0, import_react.useState)([]);
|
|
19
|
+
const runs = (0, import_react.useMemo)(() => older.length ? mergeRuns(loop.runs ?? [], older) : loop.runs ?? [], [loop.runs, older]);
|
|
20
|
+
const newestRun = runs.at(-1);
|
|
21
|
+
const latestIncidentRun = newestRun?.reportIncident ? newestRun : void 0;
|
|
22
|
+
const loadMore = async () => {
|
|
23
|
+
const oldest = runs[0];
|
|
24
|
+
if (!oldest) return 0;
|
|
25
|
+
const more = await loadOlderRuns({ data: {
|
|
26
|
+
loopId: loop.id,
|
|
27
|
+
beforeTs: oldest.ts,
|
|
28
|
+
limit: 16
|
|
29
|
+
} });
|
|
30
|
+
if (more.length) setOlder((prev) => mergeRuns(prev, more));
|
|
31
|
+
return more.length;
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
34
|
+
onClick: () => onOpen(loop.id),
|
|
35
|
+
className: `mb-[18px] cursor-pointer rounded-card border border-hairline bg-surface px-[26px] pb-5 pt-[22px] shadow-card transition-colors hover:border-wire ${en || latestIncidentRun?.reportIncident || loop.pauseCause?.kind === "failure-streak" || loop.pauseCause?.kind === "blocked" ? "" : "opacity-60"}`,
|
|
36
|
+
style: { animation: "fadeIn .25s cubic-bezier(0.25,0.1,0.25,1) both" },
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
39
|
+
className: "mb-6 flex flex-wrap items-center gap-3",
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
42
|
+
type: "button",
|
|
43
|
+
onClick: (e) => {
|
|
44
|
+
e.stopPropagation();
|
|
45
|
+
onOpen(loop.id);
|
|
46
|
+
},
|
|
47
|
+
className: "cursor-pointer rounded-sm text-left text-[17px] font-semibold tracking-[-0.01em] text-display outline-none focus-visible:ring-2 focus-visible:ring-interactive focus-visible:ring-offset-4 focus-visible:ring-offset-surface",
|
|
48
|
+
children: loop.name
|
|
49
|
+
}),
|
|
50
|
+
lifecycle === "stopping" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, {
|
|
51
|
+
tone: "running",
|
|
52
|
+
dot: "pulse",
|
|
53
|
+
children: "Stopping"
|
|
54
|
+
}) : lifecycle === "paused-finishing" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, { children: loop.pauseCause?.kind === "blocked" ? "Paused — blocked · current run finishing" : loop.pauseCause?.kind === "owner" ? "Paused by owner · current run finishing" : "Paused · current run finishing" }) : lifecycle === "deleting" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, { children: "Deleting" }) : loop.running ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, {
|
|
55
|
+
tone: "running",
|
|
56
|
+
dot: "pulse",
|
|
57
|
+
children: "Running"
|
|
58
|
+
}) : loop.queued && loop.reconciliationBlocking ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, {
|
|
59
|
+
tone: "outline",
|
|
60
|
+
children: "Queued · waiting for machine recovery"
|
|
61
|
+
}) : loop.queued ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, {
|
|
62
|
+
tone: "outline",
|
|
63
|
+
children: "Queued"
|
|
64
|
+
}) : null,
|
|
65
|
+
lifecycle === "paused" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, {
|
|
66
|
+
tone: loop.pauseCause?.kind === "blocked" ? "accent" : void 0,
|
|
67
|
+
children: loop.pauseCause?.kind === "blocked" ? "Paused — blocked" : loop.pauseCause?.kind === "failure-streak" ? "Paused automatically" : loop.pauseCause?.kind === "owner" ? "Paused by owner" : "Paused"
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
70
|
+
className: "ml-auto min-w-0 text-right text-meta text-secondary",
|
|
71
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
72
|
+
className: "whitespace-nowrap",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
75
|
+
className: "text-primary",
|
|
76
|
+
title: loop.schedule.mode === "cron" ? loop.schedule.cron : void 0,
|
|
77
|
+
children: loop.schedule.mode === "continuous" ? `continuous · ${loop.schedule.delayMinutes}m` : `${cronText(loop.schedule.cron)} · ${loop.schedule.timezone} · ${loop.schedule.overlap}`
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
80
|
+
className: "mx-2.5 text-wire",
|
|
81
|
+
children: "·"
|
|
82
|
+
}),
|
|
83
|
+
loop.agent
|
|
84
|
+
]
|
|
85
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
86
|
+
className: "mt-1 truncate text-caption text-disabled",
|
|
87
|
+
title: loop.workdir,
|
|
88
|
+
children: [
|
|
89
|
+
loop.workdir,
|
|
90
|
+
" · Model: ",
|
|
91
|
+
loop.model || "default",
|
|
92
|
+
" · Reasoning: ",
|
|
93
|
+
loop.reasoningEffort || "default"
|
|
94
|
+
]
|
|
95
|
+
})]
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timeline, {
|
|
100
|
+
loop,
|
|
101
|
+
runs,
|
|
102
|
+
total: loop.runCount,
|
|
103
|
+
onLoadMore: loadMore,
|
|
104
|
+
onPickRun: (run) => onPickRun(loop.id, run)
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
107
|
+
className: "mt-[18px] flex items-center gap-2 text-label text-secondary",
|
|
108
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [loop.runCount, " runs"] }), last && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
109
|
+
"· last ",
|
|
110
|
+
dotLabel(last),
|
|
111
|
+
hydrated && ` · ${rel(last.ts)}`
|
|
112
|
+
] })]
|
|
113
|
+
}),
|
|
114
|
+
latestIncidentRun?.reportIncident && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
115
|
+
className: "mt-1.5 text-label text-secondary",
|
|
116
|
+
children: latestIncidentRun.phase === "error" ? "Last run failed · Terminal report rejected" : "Last run telemetry warning · Terminal report rejected"
|
|
117
|
+
})
|
|
118
|
+
]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Header team entry. Always visible when team data exists: a single-team user
|
|
123
|
+
* sees a quiet pill naming the active team (so the workspace context is never
|
|
124
|
+
* invisible); anyone who can reach more than one team gets the select.
|
|
125
|
+
*
|
|
126
|
+
* Switching NAVIGATES to `/t/<id>` (the explicit team URL — bookmarkable, and
|
|
127
|
+
* each tab keeps its own team). The cookie is still written, now only as the
|
|
128
|
+
* last-used default that the bare `/` redirect falls back to (no longer an
|
|
129
|
+
* authorization key). The navigation (and the route's `key={teamId}` remount) is
|
|
130
|
+
* what re-scopes the dashboard, so no refresh callback is needed.
|
|
131
|
+
*/
|
|
132
|
+
function TeamSwitcher({ data }) {
|
|
133
|
+
const navigate = useNavigate();
|
|
134
|
+
if (!data || data.teams.length === 0) return null;
|
|
135
|
+
const selectTeam = (id) => {
|
|
136
|
+
setActiveTeamCookie(id);
|
|
137
|
+
navigate({
|
|
138
|
+
to: "/t/$teamId",
|
|
139
|
+
params: { teamId: id }
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
if (data.teams.length === 1) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
143
|
+
title: "Active team",
|
|
144
|
+
className: "inline-flex items-center rounded-full bg-raised px-3 py-1 text-label font-medium text-secondary",
|
|
145
|
+
children: data.teams[0].name
|
|
146
|
+
});
|
|
147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("select", {
|
|
148
|
+
"aria-label": "Active team",
|
|
149
|
+
value: data.activeTeamId,
|
|
150
|
+
onChange: (e) => selectTeam(e.target.value),
|
|
151
|
+
className: "lp-select cursor-pointer rounded-full bg-raised py-1 pl-3 text-label font-medium text-secondary outline-none transition-colors hover:text-display",
|
|
152
|
+
children: data.teams.map((t) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
153
|
+
value: t.id,
|
|
154
|
+
children: t.name
|
|
155
|
+
}, t.id))
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function inviteUrl(token) {
|
|
159
|
+
return `${typeof window !== "undefined" ? window.location.origin : ""}/invite/${token}`;
|
|
160
|
+
}
|
|
161
|
+
function CopyLink({ text }) {
|
|
162
|
+
const [done, setDone] = (0, import_react.useState)(false);
|
|
163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
164
|
+
className: btnSm,
|
|
165
|
+
onClick: () => {
|
|
166
|
+
navigator.clipboard?.writeText(text);
|
|
167
|
+
setDone(true);
|
|
168
|
+
setTimeout(() => setDone(false), 1400);
|
|
169
|
+
},
|
|
170
|
+
children: done ? "Copied ✓" : "Copy link"
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Team settings — the owner-facing surface for the full lifecycle: create,
|
|
175
|
+
* rename, members (add-by-email + role + remove), invite links, leave, and
|
|
176
|
+
* delete (with the blocked-while-loops explanation). A master list of the
|
|
177
|
+
* caller's teams on the left; the selected team's detail below. Every action
|
|
178
|
+
* calls an EXPLICIT-teamId server fn (never the active cookie), so managing team
|
|
179
|
+
* B while the dashboard is on team A works. Owner-only controls are hidden for a
|
|
180
|
+
* plain member (the server re-authorizes regardless).
|
|
181
|
+
*/
|
|
182
|
+
function TeamsModal({ open, onClose, activeTeamId }) {
|
|
183
|
+
const navigate = useNavigate();
|
|
184
|
+
const [teams, setTeams] = (0, import_react.useState)([]);
|
|
185
|
+
const [selected, setSelected] = (0, import_react.useState)(null);
|
|
186
|
+
const [detail, setDetail] = (0, import_react.useState)(null);
|
|
187
|
+
const [err, setErr] = (0, import_react.useState)(null);
|
|
188
|
+
const [busy, setBusy] = (0, import_react.useState)(false);
|
|
189
|
+
const [newName, setNewName] = (0, import_react.useState)("");
|
|
190
|
+
const [renameVal, setRenameVal] = (0, import_react.useState)("");
|
|
191
|
+
const [email, setEmail] = (0, import_react.useState)("");
|
|
192
|
+
const [addRole, setAddRole] = (0, import_react.useState)("member");
|
|
193
|
+
const [inviteRole, setInviteRole] = (0, import_react.useState)("member");
|
|
194
|
+
const [freshInvite, setFreshInvite] = (0, import_react.useState)(null);
|
|
195
|
+
const loadTeams = (0, import_react.useCallback)(async () => {
|
|
196
|
+
try {
|
|
197
|
+
setTeams(await listManagedTeams());
|
|
198
|
+
} catch {}
|
|
199
|
+
}, []);
|
|
200
|
+
const loadDetail = (0, import_react.useCallback)(async (teamId) => {
|
|
201
|
+
const d = await getTeamDetail({ data: teamId });
|
|
202
|
+
if ("error" in d) {
|
|
203
|
+
setErr(d.error);
|
|
204
|
+
setDetail(null);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
setDetail(d);
|
|
208
|
+
setRenameVal(d.name);
|
|
209
|
+
}, []);
|
|
210
|
+
(0, import_react.useEffect)(() => {
|
|
211
|
+
if (!open) {
|
|
212
|
+
setErr(null);
|
|
213
|
+
setSelected(null);
|
|
214
|
+
setDetail(null);
|
|
215
|
+
setFreshInvite(null);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
loadTeams();
|
|
219
|
+
}, [open, loadTeams]);
|
|
220
|
+
(0, import_react.useEffect)(() => {
|
|
221
|
+
if (!open || !selected) return;
|
|
222
|
+
setFreshInvite(null);
|
|
223
|
+
loadDetail(selected);
|
|
224
|
+
}, [
|
|
225
|
+
open,
|
|
226
|
+
selected,
|
|
227
|
+
loadDetail
|
|
228
|
+
]);
|
|
229
|
+
async function withBusy(fn) {
|
|
230
|
+
setBusy(true);
|
|
231
|
+
setErr(null);
|
|
232
|
+
try {
|
|
233
|
+
return await fn();
|
|
234
|
+
} finally {
|
|
235
|
+
setBusy(false);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
async function doCreate() {
|
|
239
|
+
const name = newName.trim();
|
|
240
|
+
if (!name) return;
|
|
241
|
+
await withBusy(async () => {
|
|
242
|
+
const r = await createTeam({ data: name });
|
|
243
|
+
if (!r.ok) return setErr(r.error);
|
|
244
|
+
setNewName("");
|
|
245
|
+
await loadTeams();
|
|
246
|
+
setSelected(r.id);
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
async function doRename() {
|
|
250
|
+
if (!detail) return;
|
|
251
|
+
const name = renameVal.trim();
|
|
252
|
+
if (!name || name === detail.name) return;
|
|
253
|
+
await withBusy(async () => {
|
|
254
|
+
const r = await renameTeam({ data: {
|
|
255
|
+
teamId: detail.id,
|
|
256
|
+
name
|
|
257
|
+
} });
|
|
258
|
+
if (!r.ok) return setErr(r.error);
|
|
259
|
+
await loadTeams();
|
|
260
|
+
await loadDetail(detail.id);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
async function doDelete() {
|
|
264
|
+
if (!detail) return;
|
|
265
|
+
await withBusy(async () => {
|
|
266
|
+
const r = await deleteTeam({ data: detail.id });
|
|
267
|
+
if (!r.ok) return setErr(r.error);
|
|
268
|
+
const removed = detail.id;
|
|
269
|
+
setSelected(null);
|
|
270
|
+
setDetail(null);
|
|
271
|
+
await loadTeams();
|
|
272
|
+
if (removed === activeTeamId) {
|
|
273
|
+
onClose();
|
|
274
|
+
navigate({ to: "/" });
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
async function doLeave() {
|
|
279
|
+
if (!detail) return;
|
|
280
|
+
await withBusy(async () => {
|
|
281
|
+
const r = await leaveTeam({ data: detail.id });
|
|
282
|
+
if (!r.ok) return setErr(r.error);
|
|
283
|
+
const left = detail.id;
|
|
284
|
+
setSelected(null);
|
|
285
|
+
setDetail(null);
|
|
286
|
+
await loadTeams();
|
|
287
|
+
if (left === activeTeamId) {
|
|
288
|
+
onClose();
|
|
289
|
+
navigate({ to: "/" });
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
async function doAdd() {
|
|
294
|
+
if (!detail) return;
|
|
295
|
+
const addr = email.trim();
|
|
296
|
+
if (!addr) return;
|
|
297
|
+
await withBusy(async () => {
|
|
298
|
+
const r = await addTeamMember({ data: {
|
|
299
|
+
teamId: detail.id,
|
|
300
|
+
email: addr,
|
|
301
|
+
role: addRole
|
|
302
|
+
} });
|
|
303
|
+
if (!r.ok) return setErr(r.error);
|
|
304
|
+
setEmail("");
|
|
305
|
+
await loadDetail(detail.id);
|
|
306
|
+
await loadTeams();
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
async function doSetRole(userId, role) {
|
|
310
|
+
if (!detail) return;
|
|
311
|
+
await withBusy(async () => {
|
|
312
|
+
const r = await setTeamMemberRole({ data: {
|
|
313
|
+
teamId: detail.id,
|
|
314
|
+
userId,
|
|
315
|
+
role
|
|
316
|
+
} });
|
|
317
|
+
if (!r.ok) return setErr(r.error);
|
|
318
|
+
await loadDetail(detail.id);
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
async function doRemove(userId) {
|
|
322
|
+
if (!detail) return;
|
|
323
|
+
await withBusy(async () => {
|
|
324
|
+
const r = await removeTeamMember({ data: {
|
|
325
|
+
teamId: detail.id,
|
|
326
|
+
userId
|
|
327
|
+
} });
|
|
328
|
+
if (!r.ok) return setErr(r.error);
|
|
329
|
+
await loadDetail(detail.id);
|
|
330
|
+
await loadTeams();
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
async function doInvite() {
|
|
334
|
+
if (!detail) return;
|
|
335
|
+
await withBusy(async () => {
|
|
336
|
+
const r = await createTeamInvite({ data: {
|
|
337
|
+
teamId: detail.id,
|
|
338
|
+
role: inviteRole
|
|
339
|
+
} });
|
|
340
|
+
if (!r.ok) return setErr(r.error);
|
|
341
|
+
setFreshInvite(r.token);
|
|
342
|
+
await loadDetail(detail.id);
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
async function doRevoke(token) {
|
|
346
|
+
if (!detail) return;
|
|
347
|
+
await withBusy(async () => {
|
|
348
|
+
const r = await revokeTeamInvite({ data: {
|
|
349
|
+
teamId: detail.id,
|
|
350
|
+
token
|
|
351
|
+
} });
|
|
352
|
+
if (!r.ok) return setErr(r.error);
|
|
353
|
+
if (freshInvite === token) setFreshInvite(null);
|
|
354
|
+
await loadDetail(detail.id);
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
const isOwner = detail?.role === "owner";
|
|
358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Modal, {
|
|
359
|
+
open,
|
|
360
|
+
onClose,
|
|
361
|
+
wide: true,
|
|
362
|
+
children: [
|
|
363
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModalHead, {
|
|
364
|
+
title: "Teams",
|
|
365
|
+
sub: "Create teams, manage members and roles, and invite people. Team management is owner-only; any member can create loops."
|
|
366
|
+
}),
|
|
367
|
+
err && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBanner, {
|
|
368
|
+
message: err,
|
|
369
|
+
onDismiss: () => setErr(null),
|
|
370
|
+
className: "mb-2 mt-3"
|
|
371
|
+
}),
|
|
372
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
373
|
+
className: "mt-3 grid gap-6 md:grid-cols-[minmax(0,18rem)_minmax(0,1fr)]",
|
|
374
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
375
|
+
className: "min-w-0",
|
|
376
|
+
children: [
|
|
377
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModalSection, { children: "My teams" }),
|
|
378
|
+
teams.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
379
|
+
className: "py-2 text-body text-secondary",
|
|
380
|
+
children: "No teams yet."
|
|
381
|
+
}),
|
|
382
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
|
|
383
|
+
className: "flex flex-col gap-1.5",
|
|
384
|
+
children: teams.map((t) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
385
|
+
onClick: () => setSelected(t.id),
|
|
386
|
+
className: `flex w-full items-center justify-between gap-2 rounded-control border px-3 py-2 text-left transition-colors ${selected === t.id ? "border-display bg-raised" : "border-hairline bg-surface hover:bg-raised"}`,
|
|
387
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
388
|
+
className: "min-w-0 truncate text-[15px] font-medium text-display",
|
|
389
|
+
children: t.name
|
|
390
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
391
|
+
className: "flex shrink-0 items-center gap-1.5",
|
|
392
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, {
|
|
393
|
+
tone: t.role === "owner" ? "ink" : "neutral",
|
|
394
|
+
children: t.role
|
|
395
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
396
|
+
className: "text-label text-secondary",
|
|
397
|
+
children: [
|
|
398
|
+
t.memberCount,
|
|
399
|
+
" member",
|
|
400
|
+
t.memberCount === 1 ? "" : "s"
|
|
401
|
+
]
|
|
402
|
+
})]
|
|
403
|
+
})]
|
|
404
|
+
}) }, t.id))
|
|
405
|
+
}),
|
|
406
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
407
|
+
className: "mt-4 rounded-control border border-hairline bg-raised px-3 py-3",
|
|
408
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
409
|
+
className: `${labelCls} mt-0`,
|
|
410
|
+
children: "New team"
|
|
411
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
412
|
+
className: "flex gap-2",
|
|
413
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
414
|
+
className: inputCls,
|
|
415
|
+
value: newName,
|
|
416
|
+
onChange: (e) => setNewName(e.target.value),
|
|
417
|
+
placeholder: "e.g. Growth Squad",
|
|
418
|
+
onKeyDown: (e) => e.key === "Enter" && void doCreate()
|
|
419
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
420
|
+
className: btnPrimary,
|
|
421
|
+
disabled: busy || !newName.trim(),
|
|
422
|
+
onClick: () => void doCreate(),
|
|
423
|
+
children: "Create"
|
|
424
|
+
})]
|
|
425
|
+
})]
|
|
426
|
+
})
|
|
427
|
+
]
|
|
428
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
429
|
+
className: "min-w-0",
|
|
430
|
+
children: !detail ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
431
|
+
className: "flex h-full items-center justify-center py-10 text-body text-secondary",
|
|
432
|
+
children: "Select a team to manage it, or create one."
|
|
433
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
434
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ModalSection, {
|
|
435
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
436
|
+
className: btnSm,
|
|
437
|
+
onClick: () => {
|
|
438
|
+
setActiveTeamCookie(detail.id);
|
|
439
|
+
onClose();
|
|
440
|
+
navigate({
|
|
441
|
+
to: "/t/$teamId",
|
|
442
|
+
params: { teamId: detail.id }
|
|
443
|
+
});
|
|
444
|
+
},
|
|
445
|
+
children: "Open dashboard →"
|
|
446
|
+
}),
|
|
447
|
+
children: [detail.name, detail.personal ? " · personal" : ""]
|
|
448
|
+
}),
|
|
449
|
+
isOwner && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
450
|
+
className: "mb-4",
|
|
451
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
452
|
+
className: "mb-1.5 mt-3 block text-label font-medium text-secondary",
|
|
453
|
+
children: "Team name"
|
|
454
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
455
|
+
className: "flex gap-2",
|
|
456
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
457
|
+
"aria-label": "Team name",
|
|
458
|
+
className: inputCls,
|
|
459
|
+
value: renameVal,
|
|
460
|
+
onChange: (e) => setRenameVal(e.target.value)
|
|
461
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
462
|
+
className: btn,
|
|
463
|
+
disabled: busy || !renameVal.trim() || renameVal.trim() === detail.name,
|
|
464
|
+
onClick: () => void doRename(),
|
|
465
|
+
children: "Rename"
|
|
466
|
+
})]
|
|
467
|
+
})]
|
|
468
|
+
}),
|
|
469
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModalSection, { children: "Members" }),
|
|
470
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
|
|
471
|
+
className: "flex flex-col gap-2",
|
|
472
|
+
children: detail.members.map((m) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", {
|
|
473
|
+
className: "flex items-center justify-between gap-3 rounded-control border border-hairline bg-surface px-3 py-2.5",
|
|
474
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
475
|
+
className: "flex min-w-0 flex-col",
|
|
476
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
477
|
+
className: "truncate text-[15px] font-medium text-display",
|
|
478
|
+
children: [m.email ?? m.displayName ?? m.userId, m.isSelf && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
479
|
+
className: "ml-1.5 text-label text-secondary",
|
|
480
|
+
children: "(you)"
|
|
481
|
+
})]
|
|
482
|
+
})
|
|
483
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
484
|
+
className: "flex shrink-0 items-center gap-2",
|
|
485
|
+
children: isOwner && !m.isSelf ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", {
|
|
486
|
+
"aria-label": "Role",
|
|
487
|
+
className: `${selectCls} w-auto py-1.5`,
|
|
488
|
+
value: m.role,
|
|
489
|
+
onChange: (e) => void doSetRole(m.userId, e.target.value),
|
|
490
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
491
|
+
value: "owner",
|
|
492
|
+
children: "owner"
|
|
493
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
494
|
+
value: "member",
|
|
495
|
+
children: "member"
|
|
496
|
+
})]
|
|
497
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
498
|
+
className: btnDanger,
|
|
499
|
+
disabled: busy,
|
|
500
|
+
onClick: () => void doRemove(m.userId),
|
|
501
|
+
children: "Remove"
|
|
502
|
+
})] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, {
|
|
503
|
+
tone: m.role === "owner" ? "ink" : "neutral",
|
|
504
|
+
children: m.role
|
|
505
|
+
})
|
|
506
|
+
})]
|
|
507
|
+
}, m.userId))
|
|
508
|
+
}),
|
|
509
|
+
isOwner && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
511
|
+
className: "mt-4 rounded-control border border-hairline bg-raised px-3 py-3",
|
|
512
|
+
children: [
|
|
513
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
514
|
+
className: `mb-1.5 mt-3 block text-label font-medium text-secondary mt-0`,
|
|
515
|
+
children: "Add a member by email"
|
|
516
|
+
}),
|
|
517
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
518
|
+
className: "flex flex-wrap gap-2",
|
|
519
|
+
children: [
|
|
520
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
521
|
+
className: `${inputCls} min-w-[12rem] flex-1`,
|
|
522
|
+
value: email,
|
|
523
|
+
onChange: (e) => setEmail(e.target.value),
|
|
524
|
+
placeholder: "teammate@example.com",
|
|
525
|
+
onKeyDown: (e) => e.key === "Enter" && void doAdd()
|
|
526
|
+
}),
|
|
527
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", {
|
|
528
|
+
"aria-label": "Role for new member",
|
|
529
|
+
className: `${selectCls} w-auto`,
|
|
530
|
+
value: addRole,
|
|
531
|
+
onChange: (e) => setAddRole(e.target.value),
|
|
532
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
533
|
+
value: "member",
|
|
534
|
+
children: "member"
|
|
535
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
536
|
+
value: "owner",
|
|
537
|
+
children: "owner"
|
|
538
|
+
})]
|
|
539
|
+
}),
|
|
540
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
541
|
+
className: btnPrimary,
|
|
542
|
+
disabled: busy || !email.trim(),
|
|
543
|
+
onClick: () => void doAdd(),
|
|
544
|
+
children: "Add"
|
|
545
|
+
})
|
|
546
|
+
]
|
|
547
|
+
}),
|
|
548
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
549
|
+
className: "mt-1.5 text-label text-secondary",
|
|
550
|
+
children: "Adds an existing Pievo account immediately. No account yet? Generate an invite link below."
|
|
551
|
+
})
|
|
552
|
+
]
|
|
553
|
+
}),
|
|
554
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModalSection, { children: "Invite links" }),
|
|
555
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
556
|
+
className: "flex flex-wrap items-center gap-2",
|
|
557
|
+
children: [
|
|
558
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", {
|
|
559
|
+
"aria-label": "Invite role",
|
|
560
|
+
className: `${selectCls} w-auto`,
|
|
561
|
+
value: inviteRole,
|
|
562
|
+
onChange: (e) => setInviteRole(e.target.value),
|
|
563
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
564
|
+
value: "member",
|
|
565
|
+
children: "as member"
|
|
566
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
567
|
+
value: "owner",
|
|
568
|
+
children: "as owner"
|
|
569
|
+
})]
|
|
570
|
+
}),
|
|
571
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
572
|
+
className: btn,
|
|
573
|
+
disabled: busy,
|
|
574
|
+
onClick: () => void doInvite(),
|
|
575
|
+
children: "Generate invite link"
|
|
576
|
+
}),
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
578
|
+
className: "text-label text-secondary",
|
|
579
|
+
children: "Single-use · expires in 7 days"
|
|
580
|
+
})
|
|
581
|
+
]
|
|
582
|
+
}),
|
|
583
|
+
detail.invites.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
|
|
584
|
+
className: "mt-3 flex flex-col gap-2",
|
|
585
|
+
children: detail.invites.map((i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", {
|
|
586
|
+
className: "flex items-center justify-between gap-3 rounded-control border border-hairline bg-surface px-3 py-2.5",
|
|
587
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
588
|
+
className: "flex min-w-0 items-center gap-2",
|
|
589
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, {
|
|
590
|
+
tone: "neutral",
|
|
591
|
+
children: i.role
|
|
592
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
593
|
+
className: `min-w-0 truncate font-mono text-label ${freshInvite === i.token ? "text-display" : "text-secondary"}`,
|
|
594
|
+
children: inviteUrl(i.token)
|
|
595
|
+
})]
|
|
596
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
597
|
+
className: "flex shrink-0 items-center gap-2",
|
|
598
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyLink, { text: inviteUrl(i.token) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
599
|
+
className: btnDanger,
|
|
600
|
+
disabled: busy,
|
|
601
|
+
onClick: () => void doRevoke(i.token),
|
|
602
|
+
children: "Revoke"
|
|
603
|
+
})]
|
|
604
|
+
})]
|
|
605
|
+
}, i.token))
|
|
606
|
+
})
|
|
607
|
+
] }),
|
|
608
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
609
|
+
className: "mt-6 flex items-center justify-between gap-3 border-t border-hairline pt-4",
|
|
610
|
+
children: [!detail.personal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
611
|
+
className: btn,
|
|
612
|
+
disabled: busy,
|
|
613
|
+
onClick: () => void doLeave(),
|
|
614
|
+
children: "Leave team"
|
|
615
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
616
|
+
className: "text-label text-secondary",
|
|
617
|
+
children: "Your personal team can't be left or deleted."
|
|
618
|
+
}), isOwner && !detail.personal && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
619
|
+
className: btnDanger,
|
|
620
|
+
disabled: busy || detail.loopCount > 0,
|
|
621
|
+
title: detail.loopCount > 0 ? `Move or delete this team's ${detail.loopCount} loop${detail.loopCount === 1 ? "" : "s"} first` : void 0,
|
|
622
|
+
onClick: () => void doDelete(),
|
|
623
|
+
children: ["Delete team", detail.loopCount > 0 ? ` (${detail.loopCount} loop${detail.loopCount === 1 ? "" : "s"})` : ""]
|
|
624
|
+
})]
|
|
625
|
+
})
|
|
626
|
+
] })
|
|
627
|
+
})]
|
|
628
|
+
})
|
|
629
|
+
]
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
var SLOW_WAIT_MS = 1e5;
|
|
633
|
+
var AGENT_LABEL = {
|
|
634
|
+
"claude-code": "Claude Code",
|
|
635
|
+
codex: "Codex"
|
|
636
|
+
};
|
|
637
|
+
function ClaudeCodeMark({ size = 14 }) {
|
|
638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
|
|
639
|
+
"aria-hidden": true,
|
|
640
|
+
width: size,
|
|
641
|
+
height: size,
|
|
642
|
+
viewBox: "0 0 24 24",
|
|
643
|
+
fill: "#D97757",
|
|
644
|
+
fillRule: "evenodd",
|
|
645
|
+
className: "shrink-0",
|
|
646
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
647
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
648
|
+
clipRule: "evenodd",
|
|
649
|
+
d: "M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z"
|
|
650
|
+
})
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
/** Codex color mark (LobeHub icon set) — verbatim: white app tile + gradient glyph. */
|
|
654
|
+
function CodexMark({ size = 14 }) {
|
|
655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", {
|
|
656
|
+
"aria-hidden": true,
|
|
657
|
+
width: size,
|
|
658
|
+
height: size,
|
|
659
|
+
viewBox: "0 0 24 24",
|
|
660
|
+
className: "shrink-0",
|
|
661
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
662
|
+
children: [
|
|
663
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
664
|
+
d: "M19.503 0H4.496A4.496 4.496 0 000 4.496v15.007A4.496 4.496 0 004.496 24h15.007A4.496 4.496 0 0024 19.503V4.496A4.496 4.496 0 0019.503 0z",
|
|
665
|
+
fill: "#fff"
|
|
666
|
+
}),
|
|
667
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
668
|
+
d: "M9.064 3.344a4.578 4.578 0 012.285-.312c1 .115 1.891.54 2.673 1.275.01.01.024.017.037.021a.09.09 0 00.043 0 4.55 4.55 0 013.046.275l.047.022.116.057a4.581 4.581 0 012.188 2.399c.209.51.313 1.041.315 1.595a4.24 4.24 0 01-.134 1.223.123.123 0 00.03.115c.594.607.988 1.33 1.183 2.17.289 1.425-.007 2.71-.887 3.854l-.136.166a4.548 4.548 0 01-2.201 1.388.123.123 0 00-.081.076c-.191.551-.383 1.023-.74 1.494-.9 1.187-2.222 1.846-3.711 1.838-1.187-.006-2.239-.44-3.157-1.302a.107.107 0 00-.105-.024c-.388.125-.78.143-1.204.138a4.441 4.441 0 01-1.945-.466 4.544 4.544 0 01-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81 5.81 0 01-.37-.961 4.582 4.582 0 01-.014-2.298.124.124 0 00.006-.056.085.085 0 00-.027-.048 4.467 4.467 0 01-1.034-1.651 3.896 3.896 0 01-.251-1.192 5.189 5.189 0 01.141-1.6c.337-1.112.982-1.985 1.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098 0 00.065-.066 4.51 4.51 0 01.829-1.615 4.535 4.535 0 011.837-1.388zm3.482 10.565a.637.637 0 000 1.272h3.636a.637.637 0 100-1.272h-3.636zM8.462 9.23a.637.637 0 00-1.106.631l1.272 2.224-1.266 2.136a.636.636 0 101.095.649l1.454-2.455a.636.636 0 00.005-.64L8.462 9.23z",
|
|
669
|
+
fill: "url(#lobe-icons-codex-grad)"
|
|
670
|
+
}),
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", {
|
|
672
|
+
gradientUnits: "userSpaceOnUse",
|
|
673
|
+
id: "lobe-icons-codex-grad",
|
|
674
|
+
x1: "12",
|
|
675
|
+
x2: "12",
|
|
676
|
+
y1: "3",
|
|
677
|
+
y2: "21",
|
|
678
|
+
children: [
|
|
679
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#B1A7FF" }),
|
|
680
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", {
|
|
681
|
+
offset: ".5",
|
|
682
|
+
stopColor: "#7A9DFF"
|
|
683
|
+
}),
|
|
684
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", {
|
|
685
|
+
offset: "1",
|
|
686
|
+
stopColor: "#3941FF"
|
|
687
|
+
})
|
|
688
|
+
]
|
|
689
|
+
}) })
|
|
690
|
+
]
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
var instructionFor = (origin) => `Fetch ${origin}/api/bootstrap and help me build a loop.`;
|
|
694
|
+
/**
|
|
695
|
+
* New loop = capture-from-Claude-Code (paste-forward, no machine picker). The web
|
|
696
|
+
* mints a claim token, shows ONE instruction block, and waits. The user pastes it
|
|
697
|
+
* into their own Claude Code session (where they just did the task); Claude
|
|
698
|
+
* follows /api/bootstrap — ensures a daemon is running (the token authorizes a new
|
|
699
|
+
* machine, or the machine's stored token reuses an existing one) and POSTs the
|
|
700
|
+
* loop through /api/machine/cli with this token as `claim`. We poll until
|
|
701
|
+
* the loop lands, then close. No machine selection: the binding is decided on the
|
|
702
|
+
* machine, the claim just correlates the result back to this dialog.
|
|
703
|
+
*
|
|
704
|
+
* Pievo is BYOA-only: every loop runs on the connected machine; there is no
|
|
705
|
+
* hosted-agent option.
|
|
706
|
+
*/
|
|
707
|
+
function ComposeModal({ open, onClose, onCreated, teamId }) {
|
|
708
|
+
const [token, setToken] = (0, import_react.useState)(null);
|
|
709
|
+
const [config, setConfig] = (0, import_react.useState)(null);
|
|
710
|
+
const [created, setCreated] = (0, import_react.useState)(null);
|
|
711
|
+
const [copied, setCopied] = (0, import_react.useState)(false);
|
|
712
|
+
const [slow, setSlow] = (0, import_react.useState)(false);
|
|
713
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
714
|
+
const [configError, setConfigError] = (0, import_react.useState)(false);
|
|
715
|
+
const pollRef = (0, import_react.useRef)(null);
|
|
716
|
+
const onCreatedRef = (0, import_react.useRef)(onCreated);
|
|
717
|
+
onCreatedRef.current = onCreated;
|
|
718
|
+
const origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
719
|
+
const instruction = instructionFor(origin);
|
|
720
|
+
const configLines = token && config ? [
|
|
721
|
+
`server-url: ${origin}`,
|
|
722
|
+
`connect-key: ${token}`,
|
|
723
|
+
...config?.customCli ? [`pievo-cli: ${config.pievoCli}`] : []
|
|
724
|
+
].join("\n") : "";
|
|
725
|
+
const snippet = token && config ? [
|
|
726
|
+
instruction,
|
|
727
|
+
"",
|
|
728
|
+
configLines
|
|
729
|
+
].join("\n") : "";
|
|
730
|
+
(0, import_react.useEffect)(() => {
|
|
731
|
+
if (!open) return;
|
|
732
|
+
setToken(null);
|
|
733
|
+
setConfig(null);
|
|
734
|
+
setCreated(null);
|
|
735
|
+
setError(null);
|
|
736
|
+
setConfigError(false);
|
|
737
|
+
setCopied(false);
|
|
738
|
+
setSlow(false);
|
|
739
|
+
}, [open]);
|
|
740
|
+
(0, import_react.useEffect)(() => {
|
|
741
|
+
if (!open) return;
|
|
742
|
+
let active = true;
|
|
743
|
+
getConfig().then((value) => {
|
|
744
|
+
if (active) setConfig(value);
|
|
745
|
+
}).catch(() => {
|
|
746
|
+
if (active) setConfigError(true);
|
|
747
|
+
});
|
|
748
|
+
mintClaim({ data: teamId }).then((r) => {
|
|
749
|
+
if (active) "token" in r ? setToken(r.token) : setError(r.error);
|
|
750
|
+
}).catch(() => {
|
|
751
|
+
if (active) setError("could not mint a connect key");
|
|
752
|
+
});
|
|
753
|
+
return () => {
|
|
754
|
+
active = false;
|
|
755
|
+
};
|
|
756
|
+
}, [open, teamId]);
|
|
757
|
+
(0, import_react.useEffect)(() => {
|
|
758
|
+
if (!open || created || !token) return;
|
|
759
|
+
if (pollRef.current) clearInterval(pollRef.current);
|
|
760
|
+
pollRef.current = setInterval(() => {
|
|
761
|
+
claimStatus({ data: token }).then((s) => {
|
|
762
|
+
if (s.done) {
|
|
763
|
+
if (!s.id || !s.name || !s.agent) throw new Error("invalid claim response");
|
|
764
|
+
if (pollRef.current) clearInterval(pollRef.current);
|
|
765
|
+
setCreated({
|
|
766
|
+
id: s.id,
|
|
767
|
+
name: s.name,
|
|
768
|
+
agent: s.agent
|
|
769
|
+
});
|
|
770
|
+
onCreatedRef.current();
|
|
771
|
+
}
|
|
772
|
+
}).catch(() => {});
|
|
773
|
+
}, 2500);
|
|
774
|
+
const slowTimer = setTimeout(() => setSlow(true), SLOW_WAIT_MS);
|
|
775
|
+
return () => {
|
|
776
|
+
if (pollRef.current) clearInterval(pollRef.current);
|
|
777
|
+
clearTimeout(slowTimer);
|
|
778
|
+
};
|
|
779
|
+
}, [
|
|
780
|
+
open,
|
|
781
|
+
created,
|
|
782
|
+
token
|
|
783
|
+
]);
|
|
784
|
+
async function copy() {
|
|
785
|
+
try {
|
|
786
|
+
await navigator.clipboard.writeText(snippet);
|
|
787
|
+
setCopied(true);
|
|
788
|
+
setTimeout(() => setCopied(false), 1500);
|
|
789
|
+
} catch {
|
|
790
|
+
setError("could not copy - select the text and copy manually");
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
const snippetBox = (showInlineCopy = true) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
794
|
+
className: "min-w-0 flex-1",
|
|
795
|
+
children: [
|
|
796
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
797
|
+
className: "flex items-center justify-between gap-3",
|
|
798
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
|
|
799
|
+
className: "text-label font-semibold text-display",
|
|
800
|
+
children: "Paste to capture it"
|
|
801
|
+
}), showInlineCopy && snippet && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
802
|
+
className: btnSm,
|
|
803
|
+
onClick: () => void copy(),
|
|
804
|
+
children: copied ? "✓ Copied" : "Copy"
|
|
805
|
+
})]
|
|
806
|
+
}),
|
|
807
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
808
|
+
className: "mt-2 overflow-hidden rounded-control border border-hairline bg-raised p-3 font-mono text-label text-primary",
|
|
809
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
810
|
+
className: "leading-relaxed",
|
|
811
|
+
children: instruction
|
|
812
|
+
}), configLines ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
|
|
813
|
+
className: "mt-3 overflow-x-auto whitespace-pre-wrap border-t border-hairline pt-3 leading-relaxed text-secondary",
|
|
814
|
+
children: configLines
|
|
815
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
816
|
+
className: "mt-3 border-t border-hairline pt-3 leading-relaxed text-secondary",
|
|
817
|
+
children: configError ? "Could not load the CLI configuration. Close and try again." : token ? "Loading CLI configuration…" : "Minting a connect key…"
|
|
818
|
+
})]
|
|
819
|
+
}),
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
821
|
+
className: "mt-2 text-body leading-snug text-secondary",
|
|
822
|
+
children: "Paste it in that same session - reuses this machine automatically. Your agent will ask what the loop should do."
|
|
823
|
+
})
|
|
824
|
+
]
|
|
825
|
+
});
|
|
826
|
+
const wait = slow ? {
|
|
827
|
+
dot: "bg-secondary",
|
|
828
|
+
text: "Still waiting - check your coding agent is running in the right project, then paste again."
|
|
829
|
+
} : {
|
|
830
|
+
dot: "animate-pulse bg-rubik-orange",
|
|
831
|
+
text: "Waiting for your coding agent…"
|
|
832
|
+
};
|
|
833
|
+
const copyPromptButton = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
834
|
+
className: `${btnPrimaryPill} ml-auto`,
|
|
835
|
+
onClick: () => void copy(),
|
|
836
|
+
disabled: !snippet,
|
|
837
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
838
|
+
className: "inline-flex items-center gap-0.5",
|
|
839
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClaudeCodeMark, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodexMark, {})]
|
|
840
|
+
}), copied ? "✓ Copied" : "Copy prompt"]
|
|
841
|
+
});
|
|
842
|
+
if (created) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Modal, {
|
|
843
|
+
open,
|
|
844
|
+
onClose,
|
|
845
|
+
children: [
|
|
846
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModalHead, {
|
|
847
|
+
title: "Loop created",
|
|
848
|
+
sub: `Configured to run with ${AGENT_LABEL[created.agent]}.`
|
|
849
|
+
}),
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
851
|
+
className: "mt-5 rounded-card border border-hairline bg-surface p-5 shadow-card",
|
|
852
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
853
|
+
className: "text-[17px] font-medium text-display",
|
|
854
|
+
children: ["✓ ", created.name]
|
|
855
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
856
|
+
className: "mt-1 text-body text-secondary",
|
|
857
|
+
children: "It’s scheduled now and will run on the machine."
|
|
858
|
+
})]
|
|
859
|
+
}),
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
861
|
+
className: "mt-4",
|
|
862
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
863
|
+
className: btnPrimary,
|
|
864
|
+
onClick: onClose,
|
|
865
|
+
children: "Done"
|
|
866
|
+
})
|
|
867
|
+
})
|
|
868
|
+
]
|
|
869
|
+
});
|
|
870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Modal, {
|
|
871
|
+
open,
|
|
872
|
+
onClose,
|
|
873
|
+
children: [
|
|
874
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModalHead, { title: "New loop" }),
|
|
875
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
876
|
+
className: "mt-6",
|
|
877
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
878
|
+
className: "flex gap-3.5",
|
|
879
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
880
|
+
className: "flex flex-col items-center",
|
|
881
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
882
|
+
className: "flex size-5 shrink-0 items-center justify-center rounded-full border border-display text-micro font-medium leading-none text-display",
|
|
883
|
+
children: "1"
|
|
884
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mt-1 w-px flex-1 bg-hairline" })]
|
|
885
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
886
|
+
className: "pb-6",
|
|
887
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
|
|
888
|
+
className: "text-label font-semibold text-display",
|
|
889
|
+
children: "Do it once in your coding agent"
|
|
890
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
891
|
+
className: "mt-1.5 text-body leading-snug text-secondary",
|
|
892
|
+
children: "Run the task yourself first, to a real result you’re happy with."
|
|
893
|
+
})]
|
|
894
|
+
})]
|
|
895
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
896
|
+
className: "flex gap-3.5",
|
|
897
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
898
|
+
className: "flex size-5 shrink-0 items-center justify-center rounded-full border border-display text-micro font-medium leading-none text-display",
|
|
899
|
+
children: "2"
|
|
900
|
+
}), snippetBox(false)]
|
|
901
|
+
})]
|
|
902
|
+
}),
|
|
903
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
904
|
+
className: "mt-3 text-body text-accent",
|
|
905
|
+
children: ["Error: ", error]
|
|
906
|
+
}),
|
|
907
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
908
|
+
className: "mt-6 flex items-start gap-3",
|
|
909
|
+
children: [
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mt-1 inline-block h-2 w-2 shrink-0 rounded-full ${wait.dot}` }),
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
912
|
+
className: "text-label leading-relaxed text-secondary",
|
|
913
|
+
children: wait.text
|
|
914
|
+
}),
|
|
915
|
+
copyPromptButton
|
|
916
|
+
]
|
|
917
|
+
})
|
|
918
|
+
]
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
/** Loops, machines, and teams change between polls.
|
|
922
|
+
*
|
|
923
|
+
* `teamId` (the `/t/<id>` route's team, in id form or undefined in open mode)
|
|
924
|
+
* scopes every list fn EXPLICITLY - so a tab on /t/A and one on /t/B show
|
|
925
|
+
* different teams simultaneously, independent of the shared last-used cookie. */
|
|
926
|
+
async function fetchLiveData(teamId) {
|
|
927
|
+
const [loops, machines, teams] = await Promise.all([
|
|
928
|
+
listLoops({ data: teamId }),
|
|
929
|
+
listMachines({ data: teamId }),
|
|
930
|
+
listMyTeams({ data: teamId })
|
|
931
|
+
]);
|
|
932
|
+
return {
|
|
933
|
+
loops,
|
|
934
|
+
machines,
|
|
935
|
+
teams
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* The dashboard body, shared by the `/` (open mode) and `/t/<teamId>` routes. It
|
|
940
|
+
* renders from its own fetch-then-set poll state, seeded once from the route
|
|
941
|
+
* loader's data, and scopes every fetch to `teamId` so the view is pinned to the
|
|
942
|
+
* URL's team (multi-tab safe). The route mounts it with `key={teamId}` so a
|
|
943
|
+
* team switch (a `/t/<id>` navigation) re-seeds state from the new loader data.
|
|
944
|
+
*/
|
|
945
|
+
function DashboardView({ teamId, initial }) {
|
|
946
|
+
const [live, setLive] = (0, import_react.useState)(null);
|
|
947
|
+
const { loops, machines, teams } = live ?? initial;
|
|
948
|
+
const online = machines.filter((m) => m.online).length;
|
|
949
|
+
const navigate = useNavigate();
|
|
950
|
+
const [composeOpen, setComposeOpen] = (0, import_react.useState)(false);
|
|
951
|
+
const [machinesOpen, setMachinesOpen] = (0, import_react.useState)(false);
|
|
952
|
+
const [teamsOpen, setTeamsOpen] = (0, import_react.useState)(false);
|
|
953
|
+
const refetch = (0, import_react.useCallback)(async () => {
|
|
954
|
+
try {
|
|
955
|
+
setLive(await fetchLiveData(teamId));
|
|
956
|
+
} catch {}
|
|
957
|
+
}, [teamId]);
|
|
958
|
+
const openRef = (0, import_react.useRef)(false);
|
|
959
|
+
openRef.current = composeOpen || machinesOpen || teamsOpen;
|
|
960
|
+
const anyRunning = loops.some((j) => j.running);
|
|
961
|
+
(0, import_react.useEffect)(() => {
|
|
962
|
+
const t = setInterval(() => {
|
|
963
|
+
if (!openRef.current) refetch();
|
|
964
|
+
}, anyRunning ? 3e3 : 1e4);
|
|
965
|
+
return () => clearInterval(t);
|
|
966
|
+
}, [refetch, anyRunning]);
|
|
967
|
+
const refresh = () => void refetch();
|
|
968
|
+
const activeOn = loops.filter((j) => j.enabled).length;
|
|
969
|
+
const cardProps = () => ({
|
|
970
|
+
onOpen: (id) => void navigate({
|
|
971
|
+
to: "/loops/$loopId",
|
|
972
|
+
params: { loopId: id }
|
|
973
|
+
}),
|
|
974
|
+
onPickRun: (loopId, run) => void navigate({
|
|
975
|
+
to: "/loops/$loopId/runs/$runId",
|
|
976
|
+
params: {
|
|
977
|
+
loopId,
|
|
978
|
+
runId: run.id
|
|
979
|
+
}
|
|
980
|
+
})
|
|
981
|
+
});
|
|
982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TooltipProvider, {
|
|
983
|
+
delay: 120,
|
|
984
|
+
children: [
|
|
985
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("header", {
|
|
986
|
+
className: "glass glass-bar sticky top-0 z-50",
|
|
987
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
988
|
+
className: "mx-auto flex max-w-[1180px] items-center gap-3 px-8 py-2.5",
|
|
989
|
+
children: [
|
|
990
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PievoLogo, { size: 30 }),
|
|
991
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
992
|
+
className: "text-[18px] font-semibold tracking-[-0.015em] text-display",
|
|
993
|
+
children: "Pievo"
|
|
994
|
+
}),
|
|
995
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TeamSwitcher, { data: teams }),
|
|
996
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex-1" }),
|
|
997
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
|
|
998
|
+
href: GITHUB_URL,
|
|
999
|
+
target: "_blank",
|
|
1000
|
+
rel: "noreferrer",
|
|
1001
|
+
"aria-label": "GitHub repository",
|
|
1002
|
+
title: "GitHub",
|
|
1003
|
+
className: headerIconBtn,
|
|
1004
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GitHubIcon, { className: "size-[17px]" })
|
|
1005
|
+
}),
|
|
1006
|
+
teams && teams.teams.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
1007
|
+
onClick: () => setTeamsOpen(true),
|
|
1008
|
+
className: headerBtn,
|
|
1009
|
+
children: "Teams"
|
|
1010
|
+
}),
|
|
1011
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
1012
|
+
onClick: () => setMachinesOpen(true),
|
|
1013
|
+
className: `${headerBtn} gap-1.5`,
|
|
1014
|
+
children: [
|
|
1015
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `inline-block size-1.5 rounded-full ${online ? "bg-rubik-green" : "bg-disabled"}` }),
|
|
1016
|
+
online,
|
|
1017
|
+
" ",
|
|
1018
|
+
online === 1 ? "machine" : "machines",
|
|
1019
|
+
" online"
|
|
1020
|
+
]
|
|
1021
|
+
}),
|
|
1022
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
1023
|
+
onClick: () => setComposeOpen(true),
|
|
1024
|
+
className: "inline-flex shrink-0 cursor-pointer items-center rounded-full bg-display px-3.5 py-1.5 text-meta font-medium text-paper transition-opacity hover:opacity-85",
|
|
1025
|
+
children: "New Loop"
|
|
1026
|
+
})
|
|
1027
|
+
]
|
|
1028
|
+
})
|
|
1029
|
+
}),
|
|
1030
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", {
|
|
1031
|
+
className: "mx-auto max-w-[1180px] px-8 pb-24",
|
|
1032
|
+
children: [
|
|
1033
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
|
|
1034
|
+
className: "pb-2 pt-14 text-center",
|
|
1035
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
|
|
1036
|
+
className: "font-pixel text-[clamp(28px,4.5vw,38px)] leading-[1.15] text-display",
|
|
1037
|
+
children: "What should happen while you sleep?"
|
|
1038
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1039
|
+
className: "mt-7",
|
|
1040
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
1041
|
+
onClick: () => setComposeOpen(true),
|
|
1042
|
+
className: "inline-flex cursor-pointer items-center gap-1.5 rounded-full bg-display px-6 py-2.5 text-body font-medium text-paper transition-opacity hover:opacity-85",
|
|
1043
|
+
children: ["Start a new loop ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1044
|
+
"aria-hidden": true,
|
|
1045
|
+
children: "→"
|
|
1046
|
+
})]
|
|
1047
|
+
})
|
|
1048
|
+
})]
|
|
1049
|
+
}),
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1051
|
+
className: "mb-5 mt-12 flex items-baseline gap-2.5",
|
|
1052
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
|
|
1053
|
+
className: "text-body font-semibold text-display",
|
|
1054
|
+
children: "Active loops"
|
|
1055
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1056
|
+
className: "text-label text-secondary",
|
|
1057
|
+
children: loops.length ? `${activeOn} scheduled · ${loops.length} total` : ""
|
|
1058
|
+
})]
|
|
1059
|
+
}),
|
|
1060
|
+
loops.length ? loops.map((j) => /* @__PURE__ */ (0, import_react.createElement)(LoopCard, {
|
|
1061
|
+
loop: j,
|
|
1062
|
+
...cardProps(),
|
|
1063
|
+
key: j.id
|
|
1064
|
+
})) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1065
|
+
className: "py-16 text-center",
|
|
1066
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1067
|
+
className: "text-[15px] text-secondary",
|
|
1068
|
+
children: "No loops yet"
|
|
1069
|
+
}), !loops.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1070
|
+
className: "mt-1.5 text-body text-disabled",
|
|
1071
|
+
children: "Create a scheduled prompt for a connected machine."
|
|
1072
|
+
})]
|
|
1073
|
+
})
|
|
1074
|
+
]
|
|
1075
|
+
}),
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComposeModal, {
|
|
1077
|
+
open: composeOpen,
|
|
1078
|
+
teamId,
|
|
1079
|
+
onClose: () => setComposeOpen(false),
|
|
1080
|
+
onCreated: refresh
|
|
1081
|
+
}),
|
|
1082
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MachinesModal, {
|
|
1083
|
+
open: machinesOpen,
|
|
1084
|
+
onClose: () => setMachinesOpen(false),
|
|
1085
|
+
teamId
|
|
1086
|
+
}),
|
|
1087
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TeamsModal, {
|
|
1088
|
+
open: teamsOpen,
|
|
1089
|
+
onClose: () => setTeamsOpen(false),
|
|
1090
|
+
activeTeamId: teamId
|
|
1091
|
+
})
|
|
1092
|
+
]
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
var headerBtn = "inline-flex shrink-0 cursor-pointer items-center rounded-full px-3 py-1.5 text-meta font-medium text-secondary transition-colors hover:bg-raised hover:text-display";
|
|
1096
|
+
var headerIconBtn = "inline-flex shrink-0 cursor-pointer items-center rounded-full p-1.5 text-secondary transition-colors hover:bg-raised hover:text-display";
|
|
1097
|
+
//#endregion
|
|
1098
|
+
export { fetchLiveData as n, DashboardView as t };
|