@kky42/pievo-server 2.4.12 → 2.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/SignIn-CDCdDD1a.js +1 -0
  3. package/.output/public/assets/{ui-s5IMg6RF.js → actionUi-D8m1FDHO.js} +1 -1
  4. package/.output/public/assets/app-PPhgN9iN.css +2 -0
  5. package/.output/public/assets/index-c0XPWXuz.js +10 -0
  6. package/.output/public/assets/loops._loopId-D7i_BGiE.js +67 -0
  7. package/.output/public/assets/loops._loopId_.runs._runId-CksSrEY7.js +3 -0
  8. package/.output/public/assets/{preload-helper-Bs7oCAsw.js → preload-helper-Zcmr31XG.js} +3 -3
  9. package/.output/public/assets/routes-79D939J4.js +1 -0
  10. package/.output/public/assets/routes-BYgl3Tmv.js +1 -0
  11. package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
  12. package/.output/server/_ssr/{MachinesModal-BhRw7oOx.mjs → MachinesModal-DBIP648Z.mjs} +18 -57
  13. package/.output/server/_ssr/{SignIn-BhoZIOUp.mjs → SignIn-Bp3uWaCQ.mjs} +3 -3
  14. package/.output/server/_ssr/{ui-DGz-q9MT.mjs → actionUi-C_WswNb1.mjs} +113 -2
  15. package/.output/server/_ssr/{artifactFiles-ChuJ4PzC.mjs → artifactFiles-BvVmixrs.mjs} +3 -3
  16. package/.output/server/_ssr/{artifactKind-DXumOv7c.mjs → artifactKind-DRCbYHZU.mjs} +6 -14
  17. package/.output/server/_ssr/artifacts-CzDJLaa6.mjs +2 -0
  18. package/.output/server/_ssr/{auth-LwPp_iim.mjs → auth-BV0MxVdo.mjs} +44 -124
  19. package/.output/server/_ssr/{SocialLinks-DVCLmql0.mjs → auth-client-RTpMpT4L.mjs} +143 -109
  20. package/.output/server/_ssr/boot-CsLXrLEa.mjs +2 -0
  21. package/.output/server/_ssr/{boot-BIxtZHU-.mjs → boot-U-CFI65B.mjs} +58 -331
  22. package/.output/server/_ssr/{bun-sqlite-dialect-BW9W1_Ps-CHMDkKqA.mjs → bun-sqlite-dialect-BW9W1_Ps-D9KUBJ-L.mjs} +2 -2
  23. package/.output/server/_ssr/{d1-sqlite-dialect-BLC8LXE6-DYum6qky.mjs → d1-sqlite-dialect-BLC8LXE6-CVHRzH1n.mjs} +2 -2
  24. package/.output/server/_ssr/db-BTX-xORB.mjs +2 -0
  25. package/.output/server/_ssr/{dist-bWqs5sTy.mjs → dist-D7UDVZ5G.mjs} +2 -2
  26. package/.output/server/_ssr/{factory-pBwrjVTI.mjs → factory-DYFx1fg-.mjs} +2 -2
  27. package/.output/server/_ssr/{kysely-adapter-DMf5pFTf.mjs → kysely-adapter-CwdB7yBh.mjs} +1 -1
  28. package/.output/server/_ssr/logger-CwiKSMp6.mjs +2 -0
  29. package/.output/server/_ssr/{loopApi-Im6JSK0p.mjs → loopApi-C4nN0msL.mjs} +29 -90
  30. package/.output/server/_ssr/{loopProjection-DIpGR6rp.mjs → loopProjection-DMSNHux6.mjs} +2 -2
  31. package/.output/server/_ssr/{loops._loopId-B5iPseDG.mjs → loops._loopId-Q4pRYPip.mjs} +19 -45
  32. package/.output/server/_ssr/{loops._loopId_.runs._runId-DVtG0xYb.mjs → loops._loopId_.runs._runId-DNXVmCt5.mjs} +6 -13
  33. package/.output/server/_ssr/{loops._loopId_.runs._runId-BA-P6sGA.mjs → loops._loopId_.runs._runId-ty3AhkOi.mjs} +31 -23
  34. package/.output/server/_ssr/{machineFns-Bb9KNXun.mjs → machineFns-CkNms3zA.mjs} +41 -108
  35. package/.output/server/_ssr/{node-sqlite-dialect-Dho9YjXb.mjs → node-sqlite-dialect-B_g92oFK.mjs} +2 -2
  36. package/.output/server/_ssr/{router-C8iotXtk.mjs → router-DCNZ2xLm.mjs} +26 -40
  37. package/.output/server/_ssr/routes-8JSF7bX_.mjs +27 -0
  38. package/.output/server/_ssr/{routes-FO0MFfYK.mjs → routes-B3fulW5I.mjs} +4 -9
  39. package/.output/server/_ssr/routes-BaanDO41.mjs +367 -0
  40. package/.output/server/_ssr/runDiff-D7CxAgYL.mjs +2 -0
  41. package/.output/server/_ssr/ssr.mjs +28 -88
  42. package/.output/server/_ssr/store-DSNbXxqz.mjs +2 -0
  43. package/.output/server/_ssr/tokens-DzUv7CCp.mjs +2 -0
  44. package/.output/server/_tanstack-start-manifest_v-DkmxsHDK.mjs +52 -0
  45. package/.output/server/drizzle/0002_remove_teams.sql +15 -0
  46. package/.output/server/drizzle/meta/_journal.json +7 -0
  47. package/.output/server/index.mjs +49 -98
  48. package/drizzle/0002_remove_teams.sql +15 -0
  49. package/drizzle/meta/_journal.json +7 -0
  50. package/package.json +2 -2
  51. package/.output/public/assets/MachinesModal-ByHejech.js +0 -1
  52. package/.output/public/assets/SignIn-Cf4HOpdF.js +0 -1
  53. package/.output/public/assets/actionUi-yYVvoOTn.js +0 -1
  54. package/.output/public/assets/app-D5Hy4BcS.css +0 -2
  55. package/.output/public/assets/index-D504r3X9.js +0 -10
  56. package/.output/public/assets/invite._token-B0EKVyrU.js +0 -1
  57. package/.output/public/assets/invite._token-BSnGRyUw.js +0 -1
  58. package/.output/public/assets/lifecycleUi-C0DaC6NM.js +0 -1
  59. package/.output/public/assets/loops._loopId-j5EB2PLW.js +0 -67
  60. package/.output/public/assets/loops._loopId_.runs._runId-BICo_pRz.js +0 -3
  61. package/.output/public/assets/routes-4N6mrQK_.js +0 -1
  62. package/.output/public/assets/routes-DZU0Tqka.js +0 -1
  63. package/.output/public/assets/t._teamId-CAUjvMZ6.js +0 -1
  64. package/.output/public/assets/t._teamId-Cqzd69sO.js +0 -1
  65. package/.output/server/_ssr/DashboardView-DrKNkmcX.mjs +0 -867
  66. package/.output/server/_ssr/actionUi-Cf6DuEC2.mjs +0 -119
  67. package/.output/server/_ssr/artifacts-DOLHJHcd.mjs +0 -2
  68. package/.output/server/_ssr/boot-D8cj4uZj.mjs +0 -2
  69. package/.output/server/_ssr/db-BphSJs66.mjs +0 -2
  70. package/.output/server/_ssr/invite._token-CPSvdDox.mjs +0 -27
  71. package/.output/server/_ssr/invite._token-CRBsTSTZ.mjs +0 -84
  72. package/.output/server/_ssr/invite._token-CaTLt92a.mjs +0 -20
  73. package/.output/server/_ssr/lifecycleUi-DauKavgx.mjs +0 -50
  74. package/.output/server/_ssr/logger-EinA2J6y.mjs +0 -2
  75. package/.output/server/_ssr/routes-CsV1weub.mjs +0 -26
  76. package/.output/server/_ssr/routes-fiMzFtcP.mjs +0 -39
  77. package/.output/server/_ssr/runDiff-BLdot9mi.mjs +0 -2
  78. package/.output/server/_ssr/store-CFCp_ggC.mjs +0 -2
  79. package/.output/server/_ssr/t._teamId-BYA4Dnjp.mjs +0 -43
  80. package/.output/server/_ssr/t._teamId-CKsrgN86.mjs +0 -32
  81. package/.output/server/_ssr/t._teamId-D1BTwhWf.mjs +0 -31
  82. package/.output/server/_ssr/teamCookie-B7hLOIie.mjs +0 -10
  83. package/.output/server/_ssr/teamFns-DfqtuBW2.mjs +0 -451
  84. package/.output/server/_ssr/teamFns-cI_tsiCv.mjs +0 -32
  85. package/.output/server/_ssr/tokens-CUz4LDLm.mjs +0 -2
  86. package/.output/server/_tanstack-start-manifest_v-xSxVtI1J.mjs +0 -86
@@ -1,9 +1,9 @@
1
- import { $t as validateLoopEdit, A as ensureServer, Ft as requestRunCancel, G as getMachine, J as getRun, Kt as tryDeleteLoop, N as forceDeleteLoop, Pt as requestDeleteLoop, Q as hasRunningRun, Tt as pauseLoop$1, Ut as stopLoop$1, Vt as startLoop$1, W as getLoop, X as getTeamMember, Y as getTeam, _t as listTeamsForUser, dt as listMachines, ft as listMachinesForTeam, ht as listRunsBefore, qt as updateLoop, ut as listLoops$1, xt as machinePresence } from "./boot-BIxtZHU-.mjs";
2
- import { a as toRunSummaries, i as toLoopSummaries, r as toLoopDetail, t as sortLoopSummariesByRecentRun } from "./loopProjection-DIpGR6rp.mjs";
3
- import { canAccessLoop, requestScope } from "./auth-LwPp_iim.mjs";
1
+ import { $ as listLoopsForUser, B as getRun, E as forceDeleteLoop, Et as stopLoop$1, H as hasRunningRun, I as getLoop, L as getMachine, Ot as tryDeleteLoop, Pt as validateLoopEdit, Q as listLoops$1, ct as machinePresence, et as listMachines, ft as pauseLoop$1, kt as updateLoop, rt as listRunsBefore, tt as listMachinesForUser, vt as requestDeleteLoop, w as ensureServer, wt as startLoop$1, yt as requestRunCancel } from "./boot-U-CFI65B.mjs";
2
+ import { a as toRunSummaries, i as toLoopSummaries, r as toLoopDetail, t as sortLoopSummariesByRecentRun } from "./loopProjection-DMSNHux6.mjs";
3
+ import { canAccessLoop, requestScope } from "./auth-BV0MxVdo.mjs";
4
4
  import { n as createServerFn } from "./ssr.mjs";
5
5
  import { t as createServerRpc } from "./createServerRpc-BD8Xn_0_.mjs";
6
- //#region node_modules/.nitro/vite/services/ssr/assets/loopApi-Im6JSK0p.js
6
+ //#region node_modules/.nitro/vite/services/ssr/assets/loopApi-C4nN0msL.js
7
7
  /**
8
8
  * Server functions backing the dashboard. They run server-side (createServerFn
9
9
  * → RPC) and call the IN-PROCESS scheduler + store directly — the scheduler
@@ -11,8 +11,8 @@ import { t as createServerRpc } from "./createServerRpc-BD8Xn_0_.mjs";
11
11
  * The machine-facing poll, CLI, report, and artifact-sync endpoints are sibling
12
12
  * server routes in this same process, so one process owns the single scheduler.
13
13
  *
14
- * Reads and writes are scoped through requestScope/ownedLoop so users only see
15
- * teams and loops their current session is authorized to access.
14
+ * Reads and writes are scoped through requestScope/ownedLoop so auth-mode users
15
+ * can access only their own loops. Open mode intentionally shares all loops.
16
16
  */
17
17
  function backend() {
18
18
  return ensureServer();
@@ -26,12 +26,8 @@ async function ownedLoop(id) {
26
26
  const loop = await getLoop(id);
27
27
  if (!loop) return void 0;
28
28
  const scope = await requestScope();
29
- if (!await canAccessLoop(loop.teamId, scope)) return void 0;
30
- return {
31
- loop,
32
- enforce: scope.enforce,
33
- teamId: scope.teamId
34
- };
29
+ if (!canAccessLoop(loop.userId, scope)) return void 0;
30
+ return { loop };
35
31
  }
36
32
  var getAuthState_createServerFn_handler = createServerRpc({
37
33
  id: "b8119d5fe6ca1ed9f609702aa2133b5ac5337030c0bdcf92dc7eba889d6bd2e6",
@@ -39,7 +35,7 @@ var getAuthState_createServerFn_handler = createServerRpc({
39
35
  filename: "src/server/loopApi.ts"
40
36
  }, (opts) => getAuthState.__executeServer(opts));
41
37
  var getAuthState = createServerFn({ method: "GET" }).handler(getAuthState_createServerFn_handler, async () => {
42
- const { authEnabled } = await import("./auth-LwPp_iim.mjs");
38
+ const { authEnabled } = await import("./auth-BV0MxVdo.mjs");
43
39
  return { enabled: authEnabled };
44
40
  });
45
41
  var getConfig_createServerFn_handler = createServerRpc({
@@ -56,57 +52,16 @@ var getConfig = createServerFn({ method: "GET" }).handler(getConfig_createServer
56
52
  customCli: !!custom
57
53
  };
58
54
  });
59
- var listMyTeams_createServerFn_handler = createServerRpc({
60
- id: "0fe12e769203c42f432a927b9cbf13a967a0f9db567b61843598f734afb4f5c6",
61
- name: "listMyTeams",
62
- filename: "src/server/loopApi.ts"
63
- }, (opts) => listMyTeams.__executeServer(opts));
64
- var listMyTeams = createServerFn({ method: "GET" }).validator((teamId) => teamId).handler(listMyTeams_createServerFn_handler, async ({ data: teamId }) => {
65
- await backend();
66
- const { enforce, userId, teamId: active } = await requestScope(teamId);
67
- if (!enforce || !userId) return {
68
- teams: [],
69
- activeTeamId: active
70
- };
71
- return {
72
- teams: (await listTeamsForUser(userId)).map((t) => ({
73
- id: t.id,
74
- name: t.name
75
- })),
76
- activeTeamId: active
77
- };
78
- });
79
- var canViewTeam_createServerFn_handler = createServerRpc({
80
- id: "7cc22b3a0f6b1c4c73463c3401e981ad42caf6487b479b738ee5aeacb11710da",
81
- name: "canViewTeam",
82
- filename: "src/server/loopApi.ts"
83
- }, (opts) => canViewTeam.__executeServer(opts));
84
- var canViewTeam = createServerFn({ method: "GET" }).validator((teamId) => teamId).handler(canViewTeam_createServerFn_handler, async ({ data: teamId }) => {
85
- await backend();
86
- const scope = await requestScope(teamId);
87
- if (!scope.enforce) return true;
88
- if (!scope.userId) return false;
89
- return scope.teamId === teamId;
90
- });
91
- var getDefaultTeam_createServerFn_handler = createServerRpc({
92
- id: "dc0ec955d0d53a150a3e9a4673f98f3509cfb4bd411c512079ae4e94c561b70c",
93
- name: "getDefaultTeam",
94
- filename: "src/server/loopApi.ts"
95
- }, (opts) => getDefaultTeam.__executeServer(opts));
96
- var getDefaultTeam = createServerFn({ method: "GET" }).handler(getDefaultTeam_createServerFn_handler, async () => {
97
- await backend();
98
- return (await requestScope()).teamId;
99
- });
100
55
  var listLoops_createServerFn_handler = createServerRpc({
101
56
  id: "23e290b2b7483ceea6fe669024c35b12c2c4ddd76649f6fab21c958ceda02940",
102
57
  name: "listLoops",
103
58
  filename: "src/server/loopApi.ts"
104
59
  }, (opts) => listLoops.__executeServer(opts));
105
- var listLoops = createServerFn({ method: "GET" }).validator((teamId) => teamId).handler(listLoops_createServerFn_handler, async ({ data: teamId }) => {
60
+ var listLoops = createServerFn({ method: "GET" }).handler(listLoops_createServerFn_handler, async () => {
106
61
  await backend();
107
- const { enforce, userId, teamId: active } = await requestScope(teamId);
108
- if (enforce && !userId) return [];
109
- const [loopRows, machines] = await Promise.all([listLoops$1(enforce ? active : void 0), enforce ? listMachinesForTeam(active) : listMachines()]);
62
+ const scope = await requestScope();
63
+ if (scope.enforce && !scope.userId) return [];
64
+ const [loopRows, machines] = await Promise.all([scope.enforce ? listLoopsForUser(scope.userId) : listLoops$1(), scope.enforce ? listMachinesForUser(scope.userId) : listMachines()]);
110
65
  return sortLoopSummariesByRecentRun(await toLoopSummaries(loopRows.sort((a, b) => a.createdAt < b.createdAt ? 1 : -1), machines));
111
66
  });
112
67
  var getLoopDetail_createServerFn_handler = createServerRpc({
@@ -118,17 +73,7 @@ var getLoopDetail = createServerFn({ method: "GET" }).validator((id) => id).hand
118
73
  await backend();
119
74
  const owned = await ownedLoop(id);
120
75
  if (!owned) throw new Error("This loop does not exist, or you do not have access to it.");
121
- const detail = await toLoopDetail(owned.loop);
122
- if (owned.enforce) {
123
- const team = await getTeam(owned.loop.teamId);
124
- if (!team) throw new Error(`invariant: loop ${owned.loop.id} references missing team ${owned.loop.teamId}`);
125
- detail.team = {
126
- id: owned.loop.teamId,
127
- name: team.name,
128
- isActive: owned.loop.teamId === owned.teamId
129
- };
130
- }
131
- return detail;
76
+ return toLoopDetail(owned.loop);
132
77
  });
133
78
  var loadOlderRuns_createServerFn_handler = createServerRpc({
134
79
  id: "85fdf73d4fee43aed762f93c5d47d33200fbff39e2d082647dc921f610d32698",
@@ -149,7 +94,7 @@ var getArtifacts_createServerFn_handler = createServerRpc({
149
94
  var getArtifacts = createServerFn({ method: "GET" }).validator((d) => d).handler(getArtifacts_createServerFn_handler, async ({ data }) => {
150
95
  await backend();
151
96
  if (!await ownedLoop(data.loopId)) return [];
152
- const { listLoopArtifacts } = await import("./artifactFiles-ChuJ4PzC.mjs");
97
+ const { listLoopArtifacts } = await import("./artifactFiles-BvVmixrs.mjs");
153
98
  return listLoopArtifacts(data.loopId);
154
99
  });
155
100
  var getArtifact_createServerFn_handler = createServerRpc({
@@ -160,7 +105,7 @@ var getArtifact_createServerFn_handler = createServerRpc({
160
105
  var getArtifact = createServerFn({ method: "GET" }).validator((d) => d).handler(getArtifact_createServerFn_handler, async ({ data }) => {
161
106
  await backend();
162
107
  if (!await ownedLoop(data.loopId)) return { error: "file not found" };
163
- const { readLoopArtifact } = await import("./artifactFiles-ChuJ4PzC.mjs");
108
+ const { readLoopArtifact } = await import("./artifactFiles-BvVmixrs.mjs");
164
109
  return readLoopArtifact(data.loopId, data.path);
165
110
  });
166
111
  var getRunDiff_createServerFn_handler = createServerRpc({
@@ -179,7 +124,7 @@ var getRunDiff = createServerFn({ method: "GET" }).validator((d) => d).handler(g
179
124
  hasSnapshot: false,
180
125
  files: []
181
126
  };
182
- const { computeRunDiff } = await import("./runDiff-BLdot9mi.mjs");
127
+ const { computeRunDiff } = await import("./runDiff-D7CxAgYL.mjs");
183
128
  return computeRunDiff(data.runId);
184
129
  });
185
130
  var patchLoop_createServerFn_handler = createServerRpc({
@@ -260,18 +205,15 @@ var deleteLoop = createServerFn({ method: "POST" }).validator((id) => id).handle
260
205
  if (!owned) return { error: "not found" };
261
206
  const machine = await getMachine(owned.loop.machineId);
262
207
  const unreachable = machinePresence(machine?.online, machine?.lastSeen) !== "online";
263
- const actor = await requestScope();
264
- const mayRetireAuthority = !owned.enforce || !!(actor.userId && owned.loop.teamId && (await getTeamMember(owned.loop.teamId, actor.userId))?.role === "owner");
265
208
  if (!unreachable && await hasRunningRun(id) && machine?.daemonProtocol !== 4) return { error: "Daemon upgrade required to stop a running process" };
266
209
  scheduler.removeLoop(id);
267
210
  if (!await requestDeleteLoop(id)) return { error: "not found" };
268
- if (unreachable && mayRetireAuthority) {
211
+ if (unreachable) {
269
212
  if (!await forceDeleteLoop(id)) return { error: "delete failed; server data was not deleted" };
270
- const { logger } = await import("./logger-EinA2J6y.mjs");
213
+ const { logger } = await import("./logger-CwiKSMp6.mjs");
271
214
  logger.child({ mod: "loop-lifecycle" }).warn({
272
215
  action: "unreachable-delete",
273
216
  loopId: id,
274
- actorUserId: actor.userId,
275
217
  machineId: owned.loop.machineId
276
218
  }, "unreachable-machine delete: retired execution authority and removed server data");
277
219
  return {
@@ -320,22 +262,19 @@ var stopRun = createServerFn({ method: "POST" }).validator((id) => id).handler(s
320
262
  waiting: result.phase === "running"
321
263
  } : { error: "run not found" };
322
264
  });
323
- var mintClaim_createServerFn_handler = createServerRpc({
324
- id: "4646f52fb09b83c9c9cef34836f3c9d03416423c879d9e5ceffcafd9a71ecba6",
325
- name: "mintClaim",
265
+ var mintConnectKey_createServerFn_handler = createServerRpc({
266
+ id: "ce43dcb9366e7c8f7338a6ad28e4290b75a5ee3b13d0d2c9cb585020008f12c6",
267
+ name: "mintConnectKey",
326
268
  filename: "src/server/loopApi.ts"
327
- }, (opts) => mintClaim.__executeServer(opts));
328
- var mintClaim = createServerFn({ method: "POST" }).validator((teamId) => teamId).handler(mintClaim_createServerFn_handler, async ({ data: teamId }) => {
269
+ }, (opts) => mintConnectKey.__executeServer(opts));
270
+ var mintConnectKey = createServerFn({ method: "POST" }).handler(mintConnectKey_createServerFn_handler, async () => {
329
271
  await backend();
330
- const { mintDeviceToken, rememberConnectKey } = await import("./tokens-CUz4LDLm.mjs");
331
- const { userId, teamId: active } = await requestScope(teamId);
332
- const owner = userId ?? "shared";
272
+ const scope = await requestScope();
273
+ if (scope.enforce && !scope.userId) return { error: "not signed in" };
274
+ const { mintDeviceToken, rememberConnectKey } = await import("./tokens-DzUv7CCp.mjs");
333
275
  const token = mintDeviceToken();
334
- await rememberConnectKey(token, {
335
- userId: owner,
336
- teamId: active
337
- });
276
+ await rememberConnectKey(token, { userId: scope.userId ?? "shared" });
338
277
  return { token };
339
278
  });
340
279
  //#endregion
341
- export { canViewTeam_createServerFn_handler, deleteLoop_createServerFn_handler, getArtifact_createServerFn_handler, getArtifacts_createServerFn_handler, getAuthState_createServerFn_handler, getConfig_createServerFn_handler, getDefaultTeam_createServerFn_handler, getLoopDetail_createServerFn_handler, getRunDiff_createServerFn_handler, listLoops_createServerFn_handler, listMyTeams_createServerFn_handler, loadOlderRuns_createServerFn_handler, mintClaim_createServerFn_handler, patchLoop_createServerFn_handler, pauseLoop_createServerFn_handler, runLoop_createServerFn_handler, startLoop_createServerFn_handler, stopLoop_createServerFn_handler, stopRun_createServerFn_handler };
280
+ export { deleteLoop_createServerFn_handler, getArtifact_createServerFn_handler, getArtifacts_createServerFn_handler, getAuthState_createServerFn_handler, getConfig_createServerFn_handler, getLoopDetail_createServerFn_handler, getRunDiff_createServerFn_handler, listLoops_createServerFn_handler, loadOlderRuns_createServerFn_handler, mintConnectKey_createServerFn_handler, patchLoop_createServerFn_handler, pauseLoop_createServerFn_handler, runLoop_createServerFn_handler, startLoop_createServerFn_handler, stopLoop_createServerFn_handler, stopRun_createServerFn_handler };
@@ -1,5 +1,5 @@
1
- import { G as getMachine, Ht as statusDefinitionsFromLoop, Ot as recentLoopUsage, Q as hasRunningRun, Rt as scheduleFromLoop, T as daemonNeedsUpdate, Z as hasPendingRun, kt as reconciliationStatesForRuns, mt as listRuns, u as MIN_DAEMON_VERSION, xt as machinePresence, y as countRuns } from "./boot-BIxtZHU-.mjs";
2
- //#region node_modules/.nitro/vite/services/ssr/assets/loopProjection-DIpGR6rp.js
1
+ import { H as hasRunningRun, L as getMachine, St as scheduleFromLoop, Tt as statusDefinitionsFromLoop, V as hasPendingRun, _ as countRuns, ct as machinePresence, gt as reconciliationStatesForRuns, ht as recentLoopUsage, nt as listRuns, u as MIN_DAEMON_VERSION, x as daemonNeedsUpdate } from "./boot-U-CFI65B.mjs";
2
+ //#region node_modules/.nitro/vite/services/ssr/assets/loopProjection-DMSNHux6.js
3
3
  var SUMMARY_RUNS = 18;
4
4
  var RECENT_USAGE_WINDOW_MS = 10080 * 60 * 1e3;
5
5
  /** Dashboard order: loops with runs first, most recent run first. The incoming
@@ -1,18 +1,15 @@
1
1
  import { o as __toESM } from "../_runtime.mjs";
2
- import { s as CODING_AGENTS } from "./boot-BIxtZHU-.mjs";
2
+ import { s as CODING_AGENTS } from "./boot-U-CFI65B.mjs";
3
3
  import { g as require_react, h as require_jsx_runtime } from "../_libs/@base-ui/react+[...].mjs";
4
4
  import { d as useNavigate, u as Link } from "../_libs/@tanstack/react-router+[...].mjs";
5
- import { C as startLoop, E as useSession, _ as loadOlderRuns, b as pauseLoop, c as getArtifact, l as getArtifacts, p as getLoopDetail, s as deleteLoop, w as stopLoop, x as runLoop, y as patchLoop } from "./SocialLinks-DVCLmql0.mjs";
6
- import { E as tsShort, S as runPulseStyle, T as selectCls, _ as inputCls, a as btn, b as rel, c as btnQuiet, d as dotLabel, g as humanBytes, m as fmt, n as Loading, o as btnDanger, p as dur, r as Pill, s as btnPrimary, t as ErrorBanner, u as dotColor, v as labelCls, w as sectionHeadCls } from "./ui-DGz-q9MT.mjs";
7
- import { t as setActiveTeamCookie } from "./teamCookie-B7hLOIie.mjs";
8
- import { t as SignIn } from "./SignIn-BhoZIOUp.mjs";
9
- import { i as useFlash, n as FlashLine, r as LoadErrorCard, t as ConfirmBar } from "./actionUi-Cf6DuEC2.mjs";
10
- import { n as daemonStopSupport, r as deriveLoopLifecycle, t as DAEMON_UPGRADE_REQUIRED } from "./lifecycleUi-DauKavgx.mjs";
11
- import { l as mergeRuns, n as MachinesModal, o as Timeline, t as LoopOverview } from "./MachinesModal-BhRw7oOx.mjs";
12
- import { n as artifactKind, t as Route } from "./artifactKind-DXumOv7c.mjs";
5
+ import { E as stopLoop, O as useSession, S as runLoop, T as startLoop, b as patchLoop, c as deleteLoop, d as getArtifacts, i as OpenModeWarning, l as deriveLoopLifecycle, m as getLoopDetail, s as daemonStopSupport, t as DAEMON_UPGRADE_REQUIRED, u as getArtifact, v as loadOlderRuns, x as pauseLoop } from "./auth-client-RTpMpT4L.mjs";
6
+ import { C as rel, D as sectionHeadCls, O as selectCls, T as runPulseStyle, _ as fmt, a as Loading, b as inputCls, c as btn, d as btnQuiet, g as dur, i as LoadErrorCard, j as useFlash, k as tsShort, l as btnDanger, m as dotLabel, n as ErrorBanner, p as dotColor, r as FlashLine, t as ConfirmBar, u as btnPrimary, x as labelCls, y as humanBytes } from "./actionUi-C_WswNb1.mjs";
7
+ import { a as Timeline, c as mergeRuns, n as MachinesModal, t as LoopOverview } from "./MachinesModal-DBIP648Z.mjs";
8
+ import { n as artifactKind, t as Route } from "./artifactKind-DRCbYHZU.mjs";
9
+ import { t as SignIn } from "./SignIn-Bp3uWaCQ.mjs";
13
10
  import { t as purify } from "../_libs/dompurify.mjs";
14
11
  import { t as g } from "../_libs/marked.mjs";
15
- //#region node_modules/.nitro/vite/services/ssr/assets/loops._loopId-B5iPseDG.js
12
+ //#region node_modules/.nitro/vite/services/ssr/assets/loops._loopId-Q4pRYPip.js
16
13
  var import_react = /* @__PURE__ */ __toESM(require_react());
17
14
  var import_jsx_runtime = require_jsx_runtime();
18
15
  /** Download URL for one artifact. Each path segment is encoded independently so
@@ -790,7 +787,6 @@ function LoopDetailView({ id }) {
790
787
  const canStop = !deleting && !!summary.running && stopSupport.supported;
791
788
  const online = detail.machine.online;
792
789
  const asleep = detail.machine.presence === "asleep";
793
- const crossTeam = detail.team && !detail.team.isActive ? detail.team : null;
794
790
  if (editing) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Shell, {
795
791
  back,
796
792
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditHead, {
@@ -854,24 +850,10 @@ function LoopDetailView({ id }) {
854
850
  loopId: id,
855
851
  runId: run.id
856
852
  }
857
- }),
858
- extraPill: crossTeam ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, {
859
- tone: "outline",
860
- children: crossTeam.name
861
- }) : void 0
853
+ })
862
854
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
863
855
  className: "mt-5 border-t border-hairline pt-4",
864
856
  children: [
865
- crossTeam && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TeamBanner, {
866
- team: crossTeam,
867
- onSwitch: () => {
868
- setActiveTeamCookie(crossTeam.id);
869
- navigate({
870
- to: "/t/$teamId",
871
- params: { teamId: crossTeam.id }
872
- });
873
- }
874
- }),
875
857
  detail.machine.needsUpdate && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MachineBanner, {
876
858
  tone: "warn",
877
859
  text: `Daemon update required · server requires v${detail.machine.requiredDaemonVersion}; machine reports ${detail.machine.daemonVersion ? `v${detail.machine.daemonVersion}` : "an unknown version"}.`,
@@ -1070,20 +1052,6 @@ function Config({ label, children }) {
1070
1052
  children
1071
1053
  })] });
1072
1054
  }
1073
- function TeamBanner({ team, onSwitch }) {
1074
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1075
- className: "mb-2.5 flex flex-wrap items-center gap-3 rounded-control border border-hairline bg-raised px-4 py-2.5 text-meta text-secondary",
1076
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
1077
- "Viewing a loop in ",
1078
- team.name,
1079
- " - not your active team."
1080
- ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1081
- onClick: onSwitch,
1082
- className: "ml-auto font-medium text-interactive underline",
1083
- children: "Switch to this team"
1084
- })]
1085
- });
1086
- }
1087
1055
  function MachineBanner({ text, action, onAction, tone }) {
1088
1056
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1089
1057
  className: `mb-2.5 flex flex-wrap items-center gap-3 rounded-control border px-4 py-2.5 text-meta ${tone === "warn" ? "border-warn/40 bg-warn/10" : "border-hairline bg-raised"}`,
@@ -1198,16 +1166,22 @@ function RunsSection({ loopId, summary, runs, older, onMore, onPickRun }) {
1198
1166
  * data + self-poll (ssr:false so the session cookie rides along with its fetches,
1199
1167
  * like the dashboard loader). Run rows link on to `/loops/$loopId/runs/$runId`.
1200
1168
  *
1201
- * Auth-gated exactly like the dashboard (`/`): the loader checks getAuthState +
1202
- * the session so a logged-out/expired DEEP LINK shows the sign-in CTA instead of
1203
- * a raw `loop not found` error from the ownership-blocked data fetch.
1169
+ * Auth-gated exactly like the dashboard (`/`): Better Auth's session hook keeps a
1170
+ * logged-out or expired deep link from mounting the ownership-scoped data view.
1204
1171
  */
1205
1172
  function LoopDetailPage() {
1206
1173
  const { loopId } = Route.useParams();
1207
1174
  const { auth } = Route.useLoaderData() ?? { auth: { enabled: false } };
1208
1175
  const { data: session, isPending } = useSession();
1209
- if (auth?.enabled && !isPending && !session) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SignIn, { callbackURL: `/loops/${loopId}` });
1210
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoopDetailView, { id: loopId });
1176
+ if (auth.enabled && isPending) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("main", {
1177
+ className: "mx-auto max-w-[1360px] px-8 pt-10",
1178
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {})
1179
+ });
1180
+ if (auth.enabled && !session) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SignIn, { callbackURL: `/loops/${loopId}` });
1181
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [!auth.enabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1182
+ className: "mx-auto max-w-[1360px] px-8 pt-6",
1183
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OpenModeWarning, {})
1184
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoopDetailView, { id: loopId })] });
1211
1185
  }
1212
1186
  //#endregion
1213
1187
  export { LoopDetailPage as component };
@@ -1,7 +1,7 @@
1
1
  import { c as createFileRoute, s as lazyRouteComponent } from "../_libs/@tanstack/react-router+[...].mjs";
2
- import { i as authClient, u as getAuthState } from "./SocialLinks-DVCLmql0.mjs";
3
- //#region node_modules/.nitro/vite/services/ssr/assets/loops._loopId_.runs._runId-DVtG0xYb.js
4
- var $$splitComponentImporter = () => import("./loops._loopId_.runs._runId-BA-P6sGA.mjs");
2
+ import { f as getAuthState } from "./auth-client-RTpMpT4L.mjs";
3
+ //#region node_modules/.nitro/vite/services/ssr/assets/loops._loopId_.runs._runId-DNXVmCt5.js
4
+ var $$splitComponentImporter = () => import("./loops._loopId_.runs._runId-ty3AhkOi.mjs");
5
5
  /**
6
6
  * Run detail PAGE — `/loops/$loopId/runs/$runId`. A standalone page (the trailing
7
7
  * `_` on the `$loopId` segment opts it out of the loop page's component so the run
@@ -9,19 +9,12 @@ var $$splitComponentImporter = () => import("./loops._loopId_.runs._runId-BA-P6s
9
9
  * modal or an inline panel. It resolves the run from the loop's detail payload
10
10
  * (reusing getLoopDetail) and the existing artifact diff.
11
11
  *
12
- * Auth-gated like the dashboard (`/`) so a logged-out/expired DEEP LINK shows the
13
- * sign-in CTA instead of a raw `loop not found` error from the blocked fetch.
12
+ * Auth-gated like the dashboard (`/`) so Better Auth's session hook keeps a
13
+ * logged-out or expired deep link from mounting the run view.
14
14
  */
15
15
  var Route = createFileRoute("/loops/$loopId_/runs/$runId")({
16
16
  ssr: false,
17
- loader: async () => {
18
- const auth = await getAuthState();
19
- if (auth.enabled) {
20
- const { data: session } = await authClient.getSession();
21
- if (!session) return { auth };
22
- }
23
- return { auth };
24
- },
17
+ loader: async () => ({ auth: await getAuthState() }),
25
18
  component: lazyRouteComponent($$splitComponentImporter, "component")
26
19
  });
27
20
  //#endregion
@@ -1,12 +1,11 @@
1
1
  import { o as __toESM } from "../_runtime.mjs";
2
2
  import { g as require_react, h as require_jsx_runtime } from "../_libs/@base-ui/react+[...].mjs";
3
3
  import { u as Link } from "../_libs/@tanstack/react-router+[...].mjs";
4
- import { E as useSession, T as stopRun, _ as loadOlderRuns, m as getRunDiff, p as getLoopDetail } from "./SocialLinks-DVCLmql0.mjs";
5
- import { S as runPulseStyle, a as btn, g as humanBytes, h as fnum, i as StatusPill, m as fmt, n as Loading, o as btnDanger, p as dur, r as Pill, w as sectionHeadCls } from "./ui-DGz-q9MT.mjs";
6
- import { t as SignIn } from "./SignIn-BhoZIOUp.mjs";
7
- import { r as LoadErrorCard } from "./actionUi-Cf6DuEC2.mjs";
8
- import { t as Route } from "./loops._loopId_.runs._runId-DVtG0xYb.mjs";
9
- //#region node_modules/.nitro/vite/services/ssr/assets/loops._loopId_.runs._runId-BA-P6sGA.js
4
+ import { D as stopRun, O as useSession, h as getRunDiff, i as OpenModeWarning, m as getLoopDetail, v as loadOlderRuns } from "./auth-client-RTpMpT4L.mjs";
5
+ import { D as sectionHeadCls, T as runPulseStyle, _ as fmt, a as Loading, c as btn, g as dur, i as LoadErrorCard, l as btnDanger, o as Pill, s as StatusPill, v as fnum, y as humanBytes } from "./actionUi-C_WswNb1.mjs";
6
+ import { t as SignIn } from "./SignIn-Bp3uWaCQ.mjs";
7
+ import { t as Route } from "./loops._loopId_.runs._runId-DNXVmCt5.mjs";
8
+ //#region node_modules/.nitro/vite/services/ssr/assets/loops._loopId_.runs._runId-ty3AhkOi.js
10
9
  var import_react = /* @__PURE__ */ __toESM(require_react());
11
10
  var import_jsx_runtime = require_jsx_runtime();
12
11
  /**
@@ -596,30 +595,39 @@ function RunDetailView({ loopId, runId }) {
596
595
  * modal or an inline panel. It resolves the run from the loop's detail payload
597
596
  * (reusing getLoopDetail) and the existing artifact diff.
598
597
  *
599
- * Auth-gated like the dashboard (`/`) so a logged-out/expired DEEP LINK shows the
600
- * sign-in CTA instead of a raw `loop not found` error from the blocked fetch.
598
+ * Auth-gated like the dashboard (`/`) so Better Auth's session hook keeps a
599
+ * logged-out or expired deep link from mounting the run view.
601
600
  */
602
601
  function RunDetailPage() {
603
602
  const { loopId, runId } = Route.useParams();
604
603
  const { auth } = Route.useLoaderData() ?? { auth: { enabled: false } };
605
604
  const { data: session, isPending } = useSession();
605
+ if (auth.enabled && isPending) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("main", {
606
+ className: "mx-auto max-w-[1360px] px-8 pt-10",
607
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {})
608
+ });
609
+ if (auth.enabled && !session) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SignIn, { callbackURL: `/loops/${loopId}/runs/${runId}` });
606
610
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", {
607
- className: "mx-auto max-w-[1360px] px-8 pb-24 pt-10",
608
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
609
- className: "mb-5",
610
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
611
- to: "/loops/$loopId",
612
- params: { loopId },
613
- className: "inline-flex items-center gap-1.5 text-label font-medium text-secondary transition-colors hover:text-display",
614
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
615
- "aria-hidden": true,
616
- children: "←"
617
- }), " Back to loop"]
611
+ className: "mx-auto max-w-[1360px] px-8 pb-24 pt-6",
612
+ children: [
613
+ !auth.enabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OpenModeWarning, { className: "mb-6" }),
614
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
615
+ className: "mb-5",
616
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
617
+ to: "/loops/$loopId",
618
+ params: { loopId },
619
+ className: "inline-flex items-center gap-1.5 text-label font-medium text-secondary transition-colors hover:text-display",
620
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
621
+ "aria-hidden": true,
622
+ children: "←"
623
+ }), " Back to loop"]
624
+ })
625
+ }),
626
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RunDetailView, {
627
+ loopId,
628
+ runId
618
629
  })
619
- }), auth?.enabled && !isPending && !session ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SignIn, { callbackURL: `/loops/${loopId}/runs/${runId}` }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RunDetailView, {
620
- loopId,
621
- runId
622
- })]
630
+ ]
623
631
  });
624
632
  }
625
633
  //#endregion