@kky42/pievo-server 2.4.14 → 4.1.0

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 (95) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/MarkdownView-BuFKr9Jg.js +66 -0
  3. package/.output/public/assets/{actionUi-5PtES4q0.js → actionUi-BZrLpgHT.js} +1 -1
  4. package/.output/public/assets/app-x1CeeY7N.css +2 -0
  5. package/.output/public/assets/index-D0FIKiiW.js +10 -0
  6. package/.output/public/assets/loops._loopId-DTkIz4C0.js +2 -0
  7. package/.output/public/assets/loops._loopId_.runs._runId-CsV2Ih4Z.js +3 -0
  8. package/.output/public/assets/preload-helper-BSxGu4d0.js +3 -0
  9. package/.output/public/assets/{routes-Dm_3J2aV.js → routes-BIOJZsig.js} +1 -1
  10. package/.output/public/assets/routes-m4Z90DTR.js +1 -0
  11. package/.output/server/_chunks/ssr-renderer.mjs +1 -1
  12. package/.output/server/_libs/{drizzle-orm+postgres.mjs → drizzle-orm.mjs} +93 -2218
  13. package/.output/server/_ssr/{MachinesModal-BaEtzycr.mjs → MachinesModal-CLBZxZkq.mjs} +47 -47
  14. package/.output/server/_ssr/MarkdownView-D1J7ImYF.mjs +70 -0
  15. package/.output/server/_ssr/{actionUi-5HOCZnom.mjs → actionUi-DE-Pb2tv.mjs} +1 -2
  16. package/.output/server/_ssr/artifactFiles-B0NPRDOR.mjs +52 -0
  17. package/.output/server/_ssr/{artifactKind-DwDr8IYc.mjs → artifactKind-a2oxT2wQ.mjs} +4 -10
  18. package/.output/server/_ssr/{boot-C472kLwY.mjs → boot-DmpKtb0A.mjs} +2659 -890
  19. package/.output/server/_ssr/lifecycleUi-DEjM8Etm.mjs +106 -0
  20. package/.output/server/_ssr/{loopApi-DT751TJA.mjs → loopApi-DK1lQPrx.mjs} +53 -69
  21. package/.output/server/_ssr/{loopProjection-qaD2I48a.mjs → loopProjection-DdFivf7-.mjs} +6 -24
  22. package/.output/server/_ssr/{loops._loopId-CXgw2Rz1.mjs → loops._loopId-DVCvGSEc.mjs} +36 -116
  23. package/.output/server/_ssr/{loops._loopId_.runs._runId-SASSqOfy.mjs → loops._loopId_.runs._runId-BXbTfLlC.mjs} +35 -39
  24. package/.output/server/_ssr/{loops._loopId_.runs._runId-Dk94Z0Jq.mjs → loops._loopId_.runs._runId-Dr6E-FA5.mjs} +3 -8
  25. package/.output/server/_ssr/{machineFns-BSrIgn3f.mjs → machineFns-DLRHgDdS.mjs} +13 -50
  26. package/.output/server/_ssr/networkAccess-CIlK3ION.mjs +30 -0
  27. package/.output/server/_ssr/router-BhHsTGqu.mjs +355 -0
  28. package/.output/server/_ssr/routes-CCallyCT.mjs +12 -0
  29. package/.output/server/_ssr/{routes-Cr-9yDEH.mjs → routes-CL2Kef-Q.mjs} +91 -50
  30. package/.output/server/_ssr/{routes-DRBS4Zi4.mjs → routes-ngpX7h8D.mjs} +2 -4
  31. package/.output/server/_ssr/ssr.mjs +25 -34
  32. package/.output/server/_ssr/start-B5_9Z5W-.mjs +35 -0
  33. package/.output/server/{_tanstack-start-manifest_v-DxLIQ0cc.mjs → _tanstack-start-manifest_v-BPiJ4yWT.mjs} +9 -15
  34. package/.output/server/drizzle/0000_baseline.sql +6 -97
  35. package/.output/server/drizzle/0001_loop_files.sql +9 -0
  36. package/.output/server/drizzle/meta/_journal.json +3 -17
  37. package/.output/server/index.mjs +50 -50
  38. package/drizzle/0000_baseline.sql +6 -97
  39. package/drizzle/0001_loop_files.sql +9 -0
  40. package/drizzle/meta/_journal.json +3 -17
  41. package/package.json +4 -8
  42. package/scripts/pievo-server.mjs +49 -47
  43. package/scripts/server-cli-lib.mjs +21 -12
  44. package/scripts/server-network.mjs +139 -0
  45. package/.output/public/assets/SignIn-CIFwnZtF.js +0 -1
  46. package/.output/public/assets/app-DvHMhs7S.css +0 -2
  47. package/.output/public/assets/index-CRX2pu0W.js +0 -10
  48. package/.output/public/assets/loops._loopId-BsuV-Rmf.js +0 -67
  49. package/.output/public/assets/loops._loopId_.runs._runId-DpK_fzmZ.js +0 -3
  50. package/.output/public/assets/preload-helper-sAZOZb3G.js +0 -5
  51. package/.output/public/assets/routes-DxF_s3cD.js +0 -1
  52. package/.output/server/_libs/@aws-crypto/crc32+[...].mjs +0 -419
  53. package/.output/server/_libs/@aws-sdk/checksums+[...].mjs +0 -10732
  54. package/.output/server/_libs/@aws-sdk/client-s3+[...].mjs +0 -9475
  55. package/.output/server/_libs/@aws-sdk/credential-provider-http+[...].mjs +0 -137
  56. package/.output/server/_libs/@aws-sdk/credential-provider-ini+[...].mjs +0 -440
  57. package/.output/server/_libs/@aws-sdk/credential-provider-process+[...].mjs +0 -62
  58. package/.output/server/_libs/@aws-sdk/credential-provider-sso+[...].mjs +0 -818
  59. package/.output/server/_libs/@aws-sdk/credential-provider-web-identity+[...].mjs +0 -59
  60. package/.output/server/_libs/@smithy/credential-provider-imds+[...].mjs +0 -342
  61. package/.output/server/_libs/aws-crypto__crc32c.mjs +0 -314
  62. package/.output/server/_libs/aws-sdk__nested-clients.mjs +0 -2671
  63. package/.output/server/_ssr/SignIn-sHQaBQJC.mjs +0 -53
  64. package/.output/server/_ssr/artifactFiles-DO43wwXA.mjs +0 -60
  65. package/.output/server/_ssr/artifacts-Cd7Qx3Qp.mjs +0 -2
  66. package/.output/server/_ssr/auth-0AamrwHo.mjs +0 -38355
  67. package/.output/server/_ssr/auth-client-lSMb_Idt.mjs +0 -1070
  68. package/.output/server/_ssr/bun-sqlite-dialect-BW9W1_Ps-DLIXocA0.mjs +0 -162
  69. package/.output/server/_ssr/core-RrmWoKne.mjs +0 -5
  70. package/.output/server/_ssr/d1-sqlite-dialect-BLC8LXE6-BoFMIPr_.mjs +0 -112
  71. package/.output/server/_ssr/db-BzvMQ2kx.mjs +0 -2
  72. package/.output/server/_ssr/dist-ClzqkwxD.mjs +0 -342
  73. package/.output/server/_ssr/factory-ixUjZqJn.mjs +0 -6903
  74. package/.output/server/_ssr/kysely-adapter-DkZbmKgV.mjs +0 -2
  75. package/.output/server/_ssr/kysely-migration-tables-JkVUjPF_-bPAX9LR_.mjs +0 -19
  76. package/.output/server/_ssr/logger-DDjsYB2X.mjs +0 -2
  77. package/.output/server/_ssr/loopTags-CXx5UdGf.mjs +0 -3356
  78. package/.output/server/_ssr/node-sqlite-dialect-BbUqnnYv.mjs +0 -162
  79. package/.output/server/_ssr/router-BlLlhfJe.mjs +0 -543
  80. package/.output/server/_ssr/routes-DTBltabU.mjs +0 -27
  81. package/.output/server/_ssr/start-4ifArtKx.mjs +0 -4
  82. package/.output/server/_ssr/store-vDZ9INSa.mjs +0 -2
  83. package/.output/server/_ssr/tokens-BHiCElYD.mjs +0 -2
  84. package/.output/server/drizzle/0001_add_pi_agent.sql +0 -9
  85. package/.output/server/drizzle/0002_remove_teams.sql +0 -15
  86. package/.output/server/drizzle/0003_add_loop_tags.sql +0 -5
  87. package/.output/server/node_modules/tslib/modules/index.js +0 -70
  88. package/.output/server/node_modules/tslib/modules/package.json +0 -3
  89. package/.output/server/node_modules/tslib/package.json +0 -47
  90. package/.output/server/node_modules/tslib/tslib.js +0 -484
  91. package/.output/server/package.json +0 -9
  92. package/drizzle/0001_add_pi_agent.sql +0 -9
  93. package/drizzle/0002_remove_teams.sql +0 -15
  94. package/drizzle/0003_add_loop_tags.sql +0 -5
  95. package/scripts/prestart.mjs +0 -66
@@ -0,0 +1,106 @@
1
+ import { i as getServerFnById, r as createServerFn, t as TSS_SERVER_FUNCTION } from "./ssr.mjs";
2
+ //#region node_modules/.nitro/vite/services/ssr/assets/lifecycleUi-DEjM8Etm.js
3
+ var createSsrRpc = (functionId) => {
4
+ const url = "/_serverFn/" + functionId;
5
+ const serverFnMeta = { id: functionId };
6
+ const fn = async (...args) => {
7
+ return (await getServerFnById(functionId, { origin: "server" }))(...args);
8
+ };
9
+ return Object.assign(fn, {
10
+ url,
11
+ serverFnMeta,
12
+ [TSS_SERVER_FUNCTION]: true
13
+ });
14
+ };
15
+ /**
16
+ * Server functions backing the dashboard. They run server-side (createServerFn
17
+ * → RPC) and call the IN-PROCESS scheduler + store directly — the scheduler
18
+ * lives in this same TanStack process (booted on first call via ensureServer).
19
+ * The machine-facing poll, CLI, report, and run-file endpoints are sibling server
20
+ * routes in this same process, so one process owns the single scheduler.
21
+ */
22
+ /**
23
+ * Client config. `pievoCli` is the CLI invocation prefix the skill + connect
24
+ * dialog use for every verb (`daemon start`, `new`, …) — defaults to the globally
25
+ * installed `pievo`. Set PIEVO_CLI locally to a runnable command that points at the in-repo
26
+ * daemon, e.g. `tsx /abs/packages/daemon/src/cli.ts` or
27
+ * `node /abs/packages/daemon/dist/cli.js`, so loops created from THIS server tell
28
+ * Claude Code to run your local code instead of the registry build.
29
+ */
30
+ var getConfig = createServerFn({ method: "GET" }).handler(createSsrRpc("cbb6a1b09b309459bbba3dc3851ae85fc468658b3cda77e22b6c6f3e28b65af4"));
31
+ /** GET — visible loops as compact summaries, most recently run first. */
32
+ var listLoops = createServerFn({ method: "GET" }).handler(createSsrRpc("23e290b2b7483ceea6fe669024c35b12c2c4ddd76649f6fab21c958ceda02940"));
33
+ var getLoopDetail = createServerFn({ method: "GET" }).validator((id) => id).handler(createSsrRpc("b050455aacc84dd2a2c9a45517826ad10f91d8f1545e87cc7015784cc7116a97"));
34
+ var loadOlderRuns = createServerFn({ method: "GET" }).validator((d) => d).handler(createSsrRpc("85fdf73d4fee43aed762f93c5d47d33200fbff39e2d082647dc921f610d32698"));
35
+ var getArtifacts = createServerFn({ method: "GET" }).validator((d) => d).handler(createSsrRpc("b18bbec3d06dfc77714e1e527dfb9172fd7575a64a6c0d6e73ba6dc658dccf0d"));
36
+ var getArtifact = createServerFn({ method: "GET" }).validator((d) => d).handler(createSsrRpc("ed10d5fe79208e5e0e4e18e4a17b18d7f7db4dd16204c00c3ac90c4644668841"));
37
+ /** GET — a run's per-file diff vs the previous run. Lazy by runId like
38
+ * computed on the server at read time (no stored diffs). Old runs
39
+ * with no snapshot return `hasSnapshot: false` for the degrade copy. */
40
+ var getRunDiff = createServerFn({ method: "GET" }).validator((d) => d).handler(createSsrRpc("08c28b892712a1b491b120b74c7dcb81761988d31ccea60216d1807b73c1182c"));
41
+ var patchLoop = createServerFn({ method: "POST" }).validator((d) => d).handler(createSsrRpc("9befe6b8d67ccbbd7aa9b538bde2a161a9894761c8936761a9503fda1a88c0fc"));
42
+ /** Dedicated lifecycle operations. Dashboard callers never synthesize these
43
+ * transitions with patchLoop: each delegates to the loop-locked store operation. */
44
+ var pauseLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(createSsrRpc("95b7483b333d7649e70c848319417e83c2af6a0327bbcda2d0e331f626dffe05"));
45
+ var startLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(createSsrRpc("5660ea82ea5ff2549e0ce2f8f070c54f3e9e24fee84d547601ef5d6ef49a4016"));
46
+ var stopLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(createSsrRpc("e233a461e4526dec3cc4cbaa891a7c3621d5967ce7f32b4fb17e9fb645857b9a"));
47
+ /** Delete is one confirmed operation. Reachable machines get the graceful
48
+ * Stop-and-wait path; a machine already offline at click time cannot acknowledge
49
+ * Stop, so retire its execution authority and remove server data immediately.
50
+ * Local files are never touched by either path. */
51
+ var deleteLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(createSsrRpc("5e0d6b55f5629faac2f55a68661eeb82668b2be752192b16264ffb5cd1e6fabe"));
52
+ var runLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(createSsrRpc("08565e35f6a3dd06ef25401de0343976c47f7ae319d3baed6320b56dd3718311"));
53
+ /** Dedicated Stop-run operation. Pending work cancels immediately; running work
54
+ * records intent and stays Running until the daemon reports its actual result. */
55
+ var stopRun = createServerFn({ method: "POST" }).validator((id) => id).handler(createSsrRpc("6850ba403da9dec5aff45794eb52636ca540ddec2d9e59f5c75ccbb852bfeacb"));
56
+ /** Mint the key shown in the New-loop daemon connection command. */
57
+ var mintConnectKey = createServerFn({ method: "POST" }).handler(createSsrRpc("ce43dcb9366e7c8f7338a6ad28e4290b75a5ee3b13d0d2c9cb585020008f12c6"));
58
+ var DAEMON_UPGRADE_REQUIRED = "Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.";
59
+ function deriveLoopLifecycle(loop) {
60
+ if (loop.deleteRequestedAt != null) return "deleting";
61
+ const running = loop.runs.find((run) => run.phase === "running");
62
+ if (!loop.enabled && running?.cancelRequested) return "stopping";
63
+ if (!loop.enabled && (loop.running || running)) return "paused-finishing";
64
+ if (!loop.enabled) return "paused";
65
+ return "active";
66
+ }
67
+ /** Stable lifecycle badge shared by dashboard cards and loop detail. It shows
68
+ * only scheduling state and its durable pause cause; execution transients
69
+ * (queued/running/stopping) stay in the runs timeline and never replace it. */
70
+ function lifecyclePresentation(loop) {
71
+ if (loop.deleteRequestedAt != null) return {
72
+ label: "Deleting",
73
+ tone: "accent"
74
+ };
75
+ if (loop.enabled) return {
76
+ label: "Active",
77
+ tone: "success"
78
+ };
79
+ if (loop.pauseCause?.kind === "blocked") return {
80
+ label: "Paused · blocked",
81
+ tone: "attention"
82
+ };
83
+ if (loop.pauseCause?.kind === "failure-streak") return {
84
+ label: "Paused · failure streak",
85
+ tone: "attention"
86
+ };
87
+ if (loop.pauseCause?.kind === "owner") return {
88
+ label: "Paused · owner",
89
+ tone: "neutral"
90
+ };
91
+ return {
92
+ label: "Paused",
93
+ tone: "neutral"
94
+ };
95
+ }
96
+ function daemonStopSupport(protocol) {
97
+ return protocol === 5 ? {
98
+ supported: true,
99
+ label: `Daemon protocol 5 · Stop supported`
100
+ } : {
101
+ supported: false,
102
+ label: `Daemon protocol ${protocol ?? "unknown"} · upgrade required`
103
+ };
104
+ }
105
+ //#endregion
106
+ export { runLoop as _, deriveLoopLifecycle as a, stopRun as b, getConfig as c, lifecyclePresentation as d, listLoops as f, pauseLoop as g, patchLoop as h, deleteLoop as i, getLoopDetail as l, mintConnectKey as m, createSsrRpc as n, getArtifact as o, loadOlderRuns as p, daemonStopSupport as r, getArtifacts as s, DAEMON_UPGRADE_REQUIRED as t, getRunDiff as u, startLoop as v, stopLoop as y };
@@ -1,44 +1,30 @@
1
- import { $ as getLoop, An as updateLoop, Ct as listLoops$1, Dn as stopLoop$1, En as startLoop$1, Et as listMachinesForUser, Ft as machinePresence, Ot as listRunsBefore, Tt as listMachines, Vt as pauseLoop$1, W as forceDeleteLoop, ct as hasRunningRun, dn as requestDeleteLoop, et as getMachine, fn as requestRunCancel, it as getRun, kn as tryDeleteLoop, wt as listLoopsForUser } from "./loopTags-CXx5UdGf.mjs";
2
- import { h as validateLoopEdit, o as ensureServer } from "./boot-C472kLwY.mjs";
3
- import { a as toRunSummaries, i as toLoopSummaries, r as toLoopDetail, t as sortLoopSummariesByRecentRun } from "./loopProjection-qaD2I48a.mjs";
4
- import { canAccessLoop, requestScope } from "./auth-0AamrwHo.mjs";
5
- import { n as createServerFn } from "./ssr.mjs";
1
+ import { B as requestDeleteLoop, C as getRun, F as machinePresence, G as tryDeleteLoop, K as updateLoop, L as pauseLoop$1, O as listLoops$1, S as getMachine, T as hasRunningRun, U as startLoop$1, V as requestRunCancel, W as stopLoop$1, j as listRunsBefore, k as listMachines, m as validateLoopEdit, s as ensureServer, v as forceDeleteLoop, x as getLoop } from "./boot-DmpKtb0A.mjs";
2
+ import { a as toRunSummaries, i as toLoopSummaries, r as toLoopDetail, t as sortLoopSummariesByRecentRun } from "./loopProjection-DdFivf7-.mjs";
3
+ import { r as createServerFn } from "./ssr.mjs";
6
4
  import { t as createServerRpc } from "./createServerRpc-BD8Xn_0_.mjs";
7
- //#region node_modules/.nitro/vite/services/ssr/assets/loopApi-DT751TJA.js
5
+ //#region node_modules/.nitro/vite/services/ssr/assets/loopApi-DK1lQPrx.js
8
6
  /**
9
7
  * Server functions backing the dashboard. They run server-side (createServerFn
10
8
  * → RPC) and call the IN-PROCESS scheduler + store directly — the scheduler
11
9
  * lives in this same TanStack process (booted on first call via ensureServer).
12
- * The machine-facing poll, CLI, report, and artifact-sync endpoints are sibling
13
- * server routes in this same process, so one process owns the single scheduler.
14
- *
15
- * Reads and writes are scoped through requestScope/ownedLoop so auth-mode users
16
- * can access only their own loops. Open mode intentionally shares all loops.
10
+ * The machine-facing poll, CLI, report, and run-file endpoints are sibling server
11
+ * routes in this same process, so one process owns the single scheduler.
17
12
  */
18
13
  function backend() {
19
14
  return ensureServer();
20
15
  }
21
- /**
22
- * Resolve a loop and authorize the request against its owner. Returns the loop,
23
- * or undefined when it's missing OR (gate on) owned by a different user — callers
24
- * treat both as "not found" so existence never leaks across users.
25
- */
26
- async function ownedLoop(id) {
16
+ async function findLoop(id) {
27
17
  const loop = await getLoop(id);
28
- if (!loop) return void 0;
29
- const scope = await requestScope();
30
- if (!canAccessLoop(loop.userId, scope)) return void 0;
31
- return { loop };
18
+ return loop ? { loop } : void 0;
32
19
  }
33
- var getAuthState_createServerFn_handler = createServerRpc({
34
- id: "b8119d5fe6ca1ed9f609702aa2133b5ac5337030c0bdcf92dc7eba889d6bd2e6",
35
- name: "getAuthState",
36
- filename: "src/server/loopApi.ts"
37
- }, (opts) => getAuthState.__executeServer(opts));
38
- var getAuthState = createServerFn({ method: "GET" }).handler(getAuthState_createServerFn_handler, async () => {
39
- const { authEnabled } = await import("./auth-0AamrwHo.mjs");
40
- return { enabled: authEnabled };
41
- });
20
+ /**
21
+ * Client config. `pievoCli` is the CLI invocation prefix the skill + connect
22
+ * dialog use for every verb (`daemon start`, `new`, …) — defaults to the globally
23
+ * installed `pievo`. Set PIEVO_CLI locally to a runnable command that points at the in-repo
24
+ * daemon, e.g. `tsx /abs/packages/daemon/src/cli.ts` or
25
+ * `node /abs/packages/daemon/dist/cli.js`, so loops created from THIS server tell
26
+ * Claude Code to run your local code instead of the registry build.
27
+ */
42
28
  var getConfig_createServerFn_handler = createServerRpc({
43
29
  id: "cbb6a1b09b309459bbba3dc3851ae85fc468658b3cda77e22b6c6f3e28b65af4",
44
30
  name: "getConfig",
@@ -50,7 +36,9 @@ var getConfig = createServerFn({ method: "GET" }).handler(getConfig_createServer
50
36
  pievoCli: custom || "pievo",
51
37
  /** True when a non-default (dev) CLI is configured — the New-loop paste then
52
38
  * carries an explicit `pievo-cli:` line so Claude Code uses it verbatim. */
53
- customCli: !!custom
39
+ customCli: !!custom,
40
+ /** Best URL for other devices, published by the launcher (HTTPS, Tailscale, then LAN). */
41
+ publicUrl: process.env.PIEVO_PUBLIC_URL?.trim() || null
54
42
  };
55
43
  });
56
44
  var listLoops_createServerFn_handler = createServerRpc({
@@ -60,9 +48,7 @@ var listLoops_createServerFn_handler = createServerRpc({
60
48
  }, (opts) => listLoops.__executeServer(opts));
61
49
  var listLoops = createServerFn({ method: "GET" }).handler(listLoops_createServerFn_handler, async () => {
62
50
  await backend();
63
- const scope = await requestScope();
64
- if (scope.enforce && !scope.userId) return [];
65
- const [loopRows, machines] = await Promise.all([scope.enforce ? listLoopsForUser(scope.userId) : listLoops$1(), scope.enforce ? listMachinesForUser(scope.userId) : listMachines()]);
51
+ const [loopRows, machines] = await Promise.all([listLoops$1(), listMachines()]);
66
52
  return sortLoopSummariesByRecentRun(await toLoopSummaries(loopRows.sort((a, b) => a.createdAt < b.createdAt ? 1 : -1), machines));
67
53
  });
68
54
  var getLoopDetail_createServerFn_handler = createServerRpc({
@@ -72,9 +58,9 @@ var getLoopDetail_createServerFn_handler = createServerRpc({
72
58
  }, (opts) => getLoopDetail.__executeServer(opts));
73
59
  var getLoopDetail = createServerFn({ method: "GET" }).validator((id) => id).handler(getLoopDetail_createServerFn_handler, async ({ data: id }) => {
74
60
  await backend();
75
- const owned = await ownedLoop(id);
76
- if (!owned) throw new Error("This loop does not exist, or you do not have access to it.");
77
- return toLoopDetail(owned.loop);
61
+ const found = await findLoop(id);
62
+ if (!found) throw new Error("This loop does not exist.");
63
+ return toLoopDetail(found.loop);
78
64
  });
79
65
  var loadOlderRuns_createServerFn_handler = createServerRpc({
80
66
  id: "85fdf73d4fee43aed762f93c5d47d33200fbff39e2d082647dc921f610d32698",
@@ -83,7 +69,7 @@ var loadOlderRuns_createServerFn_handler = createServerRpc({
83
69
  }, (opts) => loadOlderRuns.__executeServer(opts));
84
70
  var loadOlderRuns = createServerFn({ method: "GET" }).validator((d) => d).handler(loadOlderRuns_createServerFn_handler, async ({ data }) => {
85
71
  await backend();
86
- if (!await ownedLoop(data.loopId)) return [];
72
+ if (!await findLoop(data.loopId)) return [];
87
73
  const limit = Math.min(Math.max(data.limit ?? 16, 1), 100);
88
74
  return toRunSummaries(data.loopId, await listRunsBefore(data.loopId, data.beforeTs, limit));
89
75
  });
@@ -94,8 +80,8 @@ var getArtifacts_createServerFn_handler = createServerRpc({
94
80
  }, (opts) => getArtifacts.__executeServer(opts));
95
81
  var getArtifacts = createServerFn({ method: "GET" }).validator((d) => d).handler(getArtifacts_createServerFn_handler, async ({ data }) => {
96
82
  await backend();
97
- if (!await ownedLoop(data.loopId)) return [];
98
- const { listLoopArtifacts } = await import("./artifactFiles-DO43wwXA.mjs");
83
+ if (!await findLoop(data.loopId)) return [];
84
+ const { listLoopArtifacts } = await import("./artifactFiles-B0NPRDOR.mjs");
99
85
  return listLoopArtifacts(data.loopId);
100
86
  });
101
87
  var getArtifact_createServerFn_handler = createServerRpc({
@@ -105,8 +91,8 @@ var getArtifact_createServerFn_handler = createServerRpc({
105
91
  }, (opts) => getArtifact.__executeServer(opts));
106
92
  var getArtifact = createServerFn({ method: "GET" }).validator((d) => d).handler(getArtifact_createServerFn_handler, async ({ data }) => {
107
93
  await backend();
108
- if (!await ownedLoop(data.loopId)) return { error: "file not found" };
109
- const { readLoopArtifact } = await import("./artifactFiles-DO43wwXA.mjs");
94
+ if (!await findLoop(data.loopId)) return { error: "file not found" };
95
+ const { readLoopArtifact } = await import("./artifactFiles-B0NPRDOR.mjs");
110
96
  return readLoopArtifact(data.loopId, data.path);
111
97
  });
112
98
  var getRunDiff_createServerFn_handler = createServerRpc({
@@ -121,11 +107,11 @@ var getRunDiff = createServerFn({ method: "GET" }).validator((d) => d).handler(g
121
107
  hasSnapshot: false,
122
108
  files: []
123
109
  };
124
- if (!await ownedLoop(run.loopId)) return {
110
+ if (!await findLoop(run.loopId)) return {
125
111
  hasSnapshot: false,
126
112
  files: []
127
113
  };
128
- const { computeRunDiff } = await import("./boot-C472kLwY.mjs").then((n) => n.i).then((n) => n.i);
114
+ const { computeRunDiff } = await import("./boot-DmpKtb0A.mjs").then((n) => n.r).then((n) => n.i);
129
115
  return computeRunDiff(data.runId);
130
116
  });
131
117
  var patchLoop_createServerFn_handler = createServerRpc({
@@ -135,11 +121,11 @@ var patchLoop_createServerFn_handler = createServerRpc({
135
121
  }, (opts) => patchLoop.__executeServer(opts));
136
122
  var patchLoop = createServerFn({ method: "POST" }).validator((d) => d).handler(patchLoop_createServerFn_handler, async ({ data }) => {
137
123
  const { scheduler } = await backend();
138
- const owned = await ownedLoop(data.id);
139
- if (!owned) return { error: "not found" };
124
+ const found = await findLoop(data.id);
125
+ if (!found) return { error: "not found" };
140
126
  const p = data.patch;
141
127
  {
142
- const validated = validateLoopEdit(owned.loop, p);
128
+ const validated = validateLoopEdit(found.loop, p);
143
129
  if (!validated.ok) return { error: validated.detail };
144
130
  const loop = await updateLoop(data.id, validated.value);
145
131
  if (!loop) return { error: "not found" };
@@ -155,7 +141,7 @@ var pauseLoop_createServerFn_handler = createServerRpc({
155
141
  }, (opts) => pauseLoop.__executeServer(opts));
156
142
  var pauseLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(pauseLoop_createServerFn_handler, async ({ data: id }) => {
157
143
  const { scheduler } = await backend();
158
- if (!await ownedLoop(id)) return { error: "not found" };
144
+ if (!await findLoop(id)) return { error: "not found" };
159
145
  if (!await pauseLoop$1(id)) return { error: "not found" };
160
146
  scheduler.removeLoop(id);
161
147
  return { ok: true };
@@ -167,9 +153,9 @@ var startLoop_createServerFn_handler = createServerRpc({
167
153
  }, (opts) => startLoop.__executeServer(opts));
168
154
  var startLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(startLoop_createServerFn_handler, async ({ data: id }) => {
169
155
  const { scheduler } = await backend();
170
- const owned = await ownedLoop(id);
171
- if (!owned) return { error: "not found" };
172
- if (owned.loop.deleteRequestedAt) return { error: "loop is being deleted" };
156
+ const found = await findLoop(id);
157
+ if (!found) return { error: "not found" };
158
+ if (found.loop.deleteRequestedAt) return { error: "loop is being deleted" };
173
159
  const loop = await startLoop$1(id);
174
160
  if (!loop) return { error: "not found" };
175
161
  scheduler.addLoop(loop);
@@ -182,10 +168,10 @@ var stopLoop_createServerFn_handler = createServerRpc({
182
168
  }, (opts) => stopLoop.__executeServer(opts));
183
169
  var stopLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(stopLoop_createServerFn_handler, async ({ data: id }) => {
184
170
  const { scheduler } = await backend();
185
- const owned = await ownedLoop(id);
186
- if (!owned) return { error: "not found" };
171
+ const found = await findLoop(id);
172
+ if (!found) return { error: "not found" };
187
173
  if (await hasRunningRun(id)) {
188
- if ((await getMachine(owned.loop.machineId))?.daemonProtocol !== 4) return { error: "Daemon upgrade required to stop a running process" };
174
+ if ((await getMachine(found.loop.machineId))?.daemonProtocol !== 5) return { error: "Daemon upgrade required to stop a running process" };
189
175
  }
190
176
  const stopped = await stopLoop$1(id);
191
177
  if (!stopped) return { error: "not found" };
@@ -202,20 +188,20 @@ var deleteLoop_createServerFn_handler = createServerRpc({
202
188
  }, (opts) => deleteLoop.__executeServer(opts));
203
189
  var deleteLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(deleteLoop_createServerFn_handler, async ({ data: id }) => {
204
190
  const { scheduler } = await backend();
205
- const owned = await ownedLoop(id);
206
- if (!owned) return { error: "not found" };
207
- const machine = await getMachine(owned.loop.machineId);
191
+ const found = await findLoop(id);
192
+ if (!found) return { error: "not found" };
193
+ const machine = await getMachine(found.loop.machineId);
208
194
  const unreachable = machinePresence(machine?.online, machine?.lastSeen) !== "online";
209
- if (!unreachable && await hasRunningRun(id) && machine?.daemonProtocol !== 4) return { error: "Daemon upgrade required to stop a running process" };
195
+ if (!unreachable && await hasRunningRun(id) && machine?.daemonProtocol !== 5) return { error: "Daemon upgrade required to stop a running process" };
210
196
  scheduler.removeLoop(id);
211
197
  if (!await requestDeleteLoop(id)) return { error: "not found" };
212
198
  if (unreachable) {
213
199
  if (!await forceDeleteLoop(id)) return { error: "delete failed; server data was not deleted" };
214
- const { logger } = await import("./logger-DDjsYB2X.mjs");
200
+ const { logger } = await import("./boot-DmpKtb0A.mjs").then((n) => n.M).then((n) => n.Qt);
215
201
  logger.child({ mod: "loop-lifecycle" }).warn({
216
202
  action: "unreachable-delete",
217
203
  loopId: id,
218
- machineId: owned.loop.machineId
204
+ machineId: found.loop.machineId
219
205
  }, "unreachable-machine delete: retired execution authority and removed server data");
220
206
  return {
221
207
  ok: true,
@@ -236,7 +222,7 @@ var runLoop_createServerFn_handler = createServerRpc({
236
222
  }, (opts) => runLoop.__executeServer(opts));
237
223
  var runLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(runLoop_createServerFn_handler, async ({ data: id }) => {
238
224
  const { scheduler } = await backend();
239
- if (!await ownedLoop(id)) return { error: "not found" };
225
+ if (!await findLoop(id)) return { error: "not found" };
240
226
  const queued = await scheduler.runNow(id);
241
227
  if (!("run" in queued)) return { error: queued.reason };
242
228
  return {
@@ -254,9 +240,9 @@ var stopRun_createServerFn_handler = createServerRpc({
254
240
  var stopRun = createServerFn({ method: "POST" }).validator((id) => id).handler(stopRun_createServerFn_handler, async ({ data: id }) => {
255
241
  await backend();
256
242
  const run = await getRun(id);
257
- const owned = run ? await ownedLoop(run.loopId) : void 0;
258
- if (!run || !owned) return { error: "run not found" };
259
- if (run.phase === "running" && (await getMachine(owned.loop.machineId))?.daemonProtocol !== 4) return { error: "Daemon upgrade required to stop a running process" };
243
+ const found = run ? await findLoop(run.loopId) : void 0;
244
+ if (!run || !found) return { error: "run not found" };
245
+ if (run.phase === "running" && (await getMachine(found.loop.machineId))?.daemonProtocol !== 5) return { error: "Daemon upgrade required to stop a running process" };
260
246
  const result = await requestRunCancel(run.loopId, id);
261
247
  return result ? {
262
248
  ok: true,
@@ -270,12 +256,10 @@ var mintConnectKey_createServerFn_handler = createServerRpc({
270
256
  }, (opts) => mintConnectKey.__executeServer(opts));
271
257
  var mintConnectKey = createServerFn({ method: "POST" }).handler(mintConnectKey_createServerFn_handler, async () => {
272
258
  await backend();
273
- const scope = await requestScope();
274
- if (scope.enforce && !scope.userId) return { error: "not signed in" };
275
- const { mintDeviceToken, rememberConnectKey } = await import("./tokens-BHiCElYD.mjs");
259
+ const { mintDeviceToken, rememberConnectKey } = await import("./boot-DmpKtb0A.mjs").then((n) => n.M).then((n) => n.g);
276
260
  const token = mintDeviceToken();
277
- await rememberConnectKey(token, { userId: scope.userId ?? "shared" });
261
+ await rememberConnectKey(token);
278
262
  return { token };
279
263
  });
280
264
  //#endregion
281
- 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 };
265
+ export { deleteLoop_createServerFn_handler, getArtifact_createServerFn_handler, getArtifacts_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,6 +1,5 @@
1
- import { D as countRuns, Dt as listRuns, Ft as machinePresence, Qt as recentLoopUsage, ct as hasRunningRun, et as getMachine, nn as reconciliationStatesForRuns, st as hasPendingRun } from "./loopTags-CXx5UdGf.mjs";
2
- import { a as daemonNeedsUpdate, d as statusDefinitionsFromLoop, n as MIN_DAEMON_VERSION, u as scheduleFromLoop } from "./boot-C472kLwY.mjs";
3
- //#region node_modules/.nitro/vite/services/ssr/assets/loopProjection-qaD2I48a.js
1
+ import { A as listRuns, F as machinePresence, R as recentLoopUsage, S as getMachine, T as hasRunningRun, a as canonicalLoopSummary, g as countRuns, i as canonicalLoopEnvelope, o as daemonNeedsUpdate, t as MIN_DAEMON_VERSION, w as hasPendingRun, z as reconciliationStatesForRuns } from "./boot-DmpKtb0A.mjs";
2
+ //#region node_modules/.nitro/vite/services/ssr/assets/loopProjection-DdFivf7-.js
4
3
  var SUMMARY_RUNS = 18;
5
4
  var RECENT_USAGE_WINDOW_MS = 10080 * 60 * 1e3;
6
5
  /** Dashboard order: loops with runs first, most recent run first. The incoming
@@ -40,7 +39,8 @@ function toRunSummary(r, reconciliation) {
40
39
  } : null,
41
40
  error: r.error ?? null,
42
41
  sessionId: r.sessionId ?? null,
43
- reportIncident: r.reportIncident ?? null
42
+ reportIncident: r.reportIncident ?? null,
43
+ fileNotices: r.fileNotices ?? null
44
44
  };
45
45
  }
46
46
  async function toRunSummaries(loopId, rows) {
@@ -61,14 +61,7 @@ async function toLoopSummaryWithMachine(loop, machine) {
61
61
  const recentUsage = await recentLoopUsage(loop.id, (/* @__PURE__ */ new Date(Date.now() - RECENT_USAGE_WINDOW_MS)).toISOString());
62
62
  const presence = machinePresence(machine?.online, machine?.lastSeen);
63
63
  return {
64
- id: loop.id,
65
- name: loop.name,
66
- tags: loop.tags,
67
- schedule: scheduleFromLoop(loop),
68
- workdir: loop.workdir,
69
- agent: loop.agent,
70
- model: loop.model ?? null,
71
- reasoningEffort: loop.reasoningEffort ?? null,
64
+ ...canonicalLoopSummary(loop),
72
65
  machine: {
73
66
  id: loop.machineId,
74
67
  name: machine?.name || "",
@@ -97,18 +90,7 @@ async function toLoopSummaries(loops, machines) {
97
90
  }
98
91
  function toLoopFull(loop) {
99
92
  return {
100
- id: loop.id,
101
- name: loop.name,
102
- tags: loop.tags,
103
- schedule: scheduleFromLoop(loop),
104
- workdir: loop.workdir,
105
- agent: loop.agent,
106
- model: loop.model ?? null,
107
- reasoningEffort: loop.reasoningEffort ?? null,
108
- prompt: loop.prompt,
109
- statusDefinitions: statusDefinitionsFromLoop(loop),
110
- artifacts: loop.artifacts,
111
- enabled: loop.enabled,
93
+ ...canonicalLoopEnvelope(loop),
112
94
  pauseCause: loop.pauseCause ?? null,
113
95
  createdAt: loop.createdAt,
114
96
  updatedAt: loop.updatedAt