@usine/server 0.2.1 → 0.3.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.
- package/README.md +37 -21
- package/dist/backend.d.ts +24 -5
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js +37 -16
- package/dist/backend.js.map +1 -1
- package/dist/backup.d.ts +6 -3
- package/dist/backup.d.ts.map +1 -1
- package/dist/backup.js +25 -5
- package/dist/backup.js.map +1 -1
- package/dist/cli.d.ts +20 -7
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +65 -15
- package/dist/cli.js.map +1 -1
- package/dist/export-run.d.ts +1 -1
- package/dist/export-run.d.ts.map +1 -1
- package/dist/export-run.js +3 -3
- package/dist/export-run.js.map +1 -1
- package/dist/failure-message.d.ts +13 -0
- package/dist/failure-message.d.ts.map +1 -0
- package/dist/failure-message.js +58 -0
- package/dist/failure-message.js.map +1 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +64 -23
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/instance-lock.d.ts +23 -0
- package/dist/instance-lock.d.ts.map +1 -0
- package/dist/instance-lock.js +58 -0
- package/dist/instance-lock.js.map +1 -0
- package/dist/main.js +4 -10
- package/dist/main.js.map +1 -1
- package/dist/reload-signal.d.ts +8 -0
- package/dist/reload-signal.d.ts.map +1 -0
- package/dist/reload-signal.js +21 -0
- package/dist/reload-signal.js.map +1 -0
- package/dist/shutdown.d.ts +5 -2
- package/dist/shutdown.d.ts.map +1 -1
- package/dist/shutdown.js +11 -5
- package/dist/shutdown.js.map +1 -1
- package/dist/up.d.ts +1 -1
- package/dist/up.d.ts.map +1 -1
- package/dist/up.js +29 -16
- package/dist/up.js.map +1 -1
- package/dist/web/assets/DialogTitle-DrHlwOSg.js +1 -0
- package/dist/web/assets/_agent-cBqm12lE.js +1 -0
- package/dist/web/assets/_loop-kf1h3qkS.js +1 -0
- package/dist/web/assets/_name-CKWcxUh0.js +2 -0
- package/dist/web/assets/_name-DCEDRHnF.js +1 -0
- package/dist/web/assets/_name-sJkGyn7O.js +1 -0
- package/dist/web/assets/_number-DbgcVg1N.js +1 -0
- package/dist/web/assets/_run-DqslP0y6.js +8 -0
- package/dist/web/assets/_worker-CH4UoJT_.js +1 -0
- package/dist/web/assets/action-DYT048Jm.js +1 -0
- package/dist/web/assets/agents-DIZolb0U.js +1 -0
- package/dist/web/assets/agents-DMhSMb9O.js +1 -0
- package/dist/web/assets/button-C4yvcSko.js +2 -0
- package/dist/web/assets/copy-BM1l6IGB.js +1 -0
- package/dist/web/assets/core-BUmsKffF.js +12 -0
- package/dist/web/assets/engine-javascript-D-6se_EF.js +141 -0
- package/dist/web/assets/error-alert-BrI00JbQ.js +1 -0
- package/dist/web/assets/file-error-C--_cWuj.js +1 -0
- package/dist/web/assets/index-BljdfRBm.js +10 -0
- package/dist/web/assets/index-YKcAk3No.css +2 -0
- package/dist/web/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/web/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/web/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/web/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/web/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/web/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/web/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/web/assets/item-rBBCTV8x.js +1 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/web/assets/label-badge-ohqvZnY7.js +1 -0
- package/dist/web/assets/loops-CXM3f90o.js +1 -0
- package/dist/web/assets/loops-DWLXyUPN.js +1 -0
- package/dist/web/assets/markdown-D07-JkYB.js +29 -0
- package/dist/web/assets/moves-RiWgdCxQ.js +5 -0
- package/dist/web/assets/operator-copy-DsM7LJx6.js +301 -0
- package/dist/web/assets/outcome-YiIf6xbJ.js +5 -0
- package/dist/web/assets/project-not-found-CQVclgb0.js +1 -0
- package/dist/web/assets/query-DWN8IHdt.js +1 -0
- package/dist/web/assets/repositories-CoTEmYmS.js +1 -0
- package/dist/web/assets/repositories-Cq7zGzNb.js +1 -0
- package/dist/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/web/assets/route-CE9U74a9.js +1 -0
- package/dist/web/assets/route-DNH2EwHP.js +1 -0
- package/dist/web/assets/routes-XAUJJqfj.js +1 -0
- package/dist/web/assets/run-again-DxjFCuNu.js +1 -0
- package/dist/web/assets/run-drawer-CyjxH5mf.js +1 -0
- package/dist/web/assets/section-BBnBOk-U.js +1 -0
- package/dist/web/assets/section-Cm-j3zHs.js +1 -0
- package/dist/web/assets/section-DkBCDv4D.js +1 -0
- package/dist/web/assets/settings-iZf872O5.js +1 -0
- package/dist/web/assets/status-badge-CNlyvwWL.js +1 -0
- package/dist/web/assets/table-B6NH8hTW.js +1 -0
- package/dist/web/assets/tasks-DhLW-1gg.js +1 -0
- package/dist/web/assets/usage-DPUTTLGs.js +1 -0
- package/dist/web/assets/use-now-CcFZyFvf.js +1 -0
- package/dist/web/assets/useNavigate-lXd3v3E0.js +1 -0
- package/dist/web/assets/usePositioner-WErrA3Ah.js +1 -0
- package/dist/web/assets/useScrollLock-BOb01sL8.js +1 -0
- package/dist/web/assets/useTriggerFocusGuards-B0FItfLc.js +1 -0
- package/dist/web/assets/utils-BEQKLGgi.js +1 -0
- package/dist/web/assets/with-selector-NsM_5qXG.js +1 -0
- package/dist/web/assets/workers-BgocBXT9.js +1 -0
- package/dist/web/assets/workers-Dw2uHY0Y.js +1 -0
- package/dist/web/index.html +13 -10
- package/package.json +13 -9
- package/dist/web/assets/_name-DdyMEUN6.js +0 -6
- package/dist/web/assets/_name-eoobiMh0.js +0 -1
- package/dist/web/assets/_name-pUxlKZt5.js +0 -1
- package/dist/web/assets/badge-t7m0Vk1K.js +0 -146
- package/dist/web/assets/button-BoOukj77.js +0 -1
- package/dist/web/assets/core-CLXRiB63.js +0 -12
- package/dist/web/assets/empty-DbVYU7bi.js +0 -1
- package/dist/web/assets/engine-javascript-h-x4hGa4.js +0 -141
- package/dist/web/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/web/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/web/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/web/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/web/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/dist/web/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/dist/web/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/dist/web/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/web/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/dist/web/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/dist/web/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/web/assets/index-CVBBoW6r.css +0 -2
- package/dist/web/assets/index-CsW8KcJW.js +0 -10
- package/dist/web/assets/loops-DghpuoiG.js +0 -1
- package/dist/web/assets/operator-copy-DIsVXn17.js +0 -1
- package/dist/web/assets/overview-DmCIVPwN.js +0 -1
- package/dist/web/assets/rolldown-runtime-hePW80VL.js +0 -1
- package/dist/web/assets/routes-BDyP7vCr.js +0 -1
- package/dist/web/assets/run-drawer-B-xhTXe4.js +0 -157
- package/dist/web/assets/status-badge-yblcElE0.js +0 -1
- package/dist/web/assets/table-B8cLYNvq.js +0 -1
- package/dist/web/assets/useCompositeItem-HmBmWxUW.js +0 -1
- package/dist/web/assets/with-selector-N6m4X0X_.js +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CurrentInstance } from "@usine/orchestrator/current-instance";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
/**
|
|
4
|
+
* Reloads the instance folder on each SIGHUP until the scope closes, instead of exiting. A SIGHUP
|
|
5
|
+
* during a reload triggers one more reload.
|
|
6
|
+
*/
|
|
7
|
+
export declare const reloadOnHangup: (instances: CurrentInstance["Service"]) => Effect.Effect<void, never, import("effect/Scope").Scope>;
|
|
8
|
+
//# sourceMappingURL=reload-signal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reload-signal.d.ts","sourceRoot":"","sources":["../src/reload-signal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAS,MAAM,QAAQ,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,cAAc,cAAe,eAAe,CAAC,SAAS,CAAC,6DAyBhE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Effect, Queue } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Reloads the instance folder on each SIGHUP until the scope closes, instead of exiting. A SIGHUP
|
|
4
|
+
* during a reload triggers one more reload.
|
|
5
|
+
*/
|
|
6
|
+
export const reloadOnHangup = (instances) => Effect.gen(function* () {
|
|
7
|
+
const signals = yield* Queue.sliding(1);
|
|
8
|
+
yield* Effect.acquireRelease(Effect.sync(() => {
|
|
9
|
+
const onSignal = () => {
|
|
10
|
+
Queue.offerUnsafe(signals, undefined);
|
|
11
|
+
};
|
|
12
|
+
process.on("SIGHUP", onSignal);
|
|
13
|
+
return onSignal;
|
|
14
|
+
}), (onSignal) => Effect.sync(() => {
|
|
15
|
+
process.removeListener("SIGHUP", onSignal);
|
|
16
|
+
}));
|
|
17
|
+
yield* Effect.forkScoped(Queue.take(signals).pipe(Effect.andThen(Effect.logInfo("SIGHUP received; reloading the instance folder")), Effect.andThen(instances.reload),
|
|
18
|
+
// The reload logs its own outcome.
|
|
19
|
+
Effect.ignore, Effect.forever));
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=reload-signal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reload-signal.js","sourceRoot":"","sources":["../src/reload-signal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEvC;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAqC,EAAE,EAAE,CACtE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAO,CAAC,CAAC,CAAC;IAC9C,KAAK,CAAC,CAAC,MAAM,CAAC,cAAc,CAC1B,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;QACf,MAAM,QAAQ,GAAG,GAAG,EAAE;YACpB,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACxC,CAAC,CAAC;QACF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC/B,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,EACF,CAAC,QAAQ,EAAE,EAAE,CACX,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;QACf,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC,CAAC,CACL,CAAC;IACF,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CACtB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CACtB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,gDAAgD,CAAC,CAAC,EAChF,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC;IAChC,mCAAmC;IACnC,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,OAAO,CACf,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/dist/shutdown.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Deferred, Duration, Effect, Scope } from "effect";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Runs `startup` and its work, and on shutdown drains them within `deadline` before runtime
|
|
4
|
+
* resources close. Reads `deadline` when the drain starts.
|
|
5
|
+
*/
|
|
3
6
|
export declare const withGracefulShutdown: <A, E, R, E2, R2>(startup: Effect.Effect<{
|
|
4
7
|
readonly running: Effect.Effect<A, E, R>;
|
|
5
8
|
readonly drain: Effect.Effect<void>;
|
|
6
|
-
}, E2, R2>, requested: Deferred.Deferred<void>, deadline: Duration.Duration) => Effect.Effect<A, E | E2, Exclude<Exclude<R, Scope.Scope>, Scope.Scope> | Exclude<Exclude<R2, Scope.Scope>, Scope.Scope>>;
|
|
9
|
+
}, E2, R2>, requested: Deferred.Deferred<void>, deadline: Effect.Effect<Duration.Duration>) => Effect.Effect<A, E | E2, Exclude<Exclude<R, Scope.Scope>, Scope.Scope> | Exclude<Exclude<R2, Scope.Scope>, Scope.Scope>>;
|
|
7
10
|
//# sourceMappingURL=shutdown.d.ts.map
|
package/dist/shutdown.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown.d.ts","sourceRoot":"","sources":["../src/shutdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAuB,KAAK,EAAE,MAAM,QAAQ,CAAC;AAuBhF
|
|
1
|
+
{"version":3,"file":"shutdown.d.ts","sourceRoot":"","sources":["../src/shutdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAuB,KAAK,EAAE,MAAM,QAAQ,CAAC;AAuBhF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,WACzC,MAAM,CAAC,MAAM,CACpB;IACE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CACrC,EACD,EAAE,EACF,EAAE,CACH,aACU,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,YACxB,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,6HAwEzC,CAAC"}
|
package/dist/shutdown.js
CHANGED
|
@@ -14,19 +14,23 @@ const observeSignals = (requested, forced) => Effect.acquireRelease(Effect.sync(
|
|
|
14
14
|
process.removeListener("SIGINT", onSignal);
|
|
15
15
|
process.removeListener("SIGTERM", onSignal);
|
|
16
16
|
}));
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Runs `startup` and its work, and on shutdown drains them within `deadline` before runtime
|
|
19
|
+
* resources close. Reads `deadline` when the drain starts.
|
|
20
|
+
*/
|
|
18
21
|
export const withGracefulShutdown = (startup, requested, deadline) => Effect.scoped(Effect.gen(function* () {
|
|
19
22
|
const forced = yield* Deferred.make();
|
|
20
23
|
yield* observeSignals(requested, forced);
|
|
21
|
-
// Acquired before the forks
|
|
22
|
-
//
|
|
24
|
+
// Acquired before the forks, so their shutdown completes while runtime resources (database,
|
|
25
|
+
// executor, HTTP) are still available.
|
|
23
26
|
const runtimeScope = yield* Effect.acquireRelease(Scope.make(), (scope, exit) => Scope.close(scope, exit));
|
|
24
27
|
const started = yield* Effect.forkScoped(Scope.provide(startup, runtimeScope));
|
|
25
28
|
const running = yield* Effect.forkScoped(Fiber.join(started).pipe(Effect.flatMap(({ running }) => Deferred.isDone(requested).pipe(Effect.flatMap((stopped) => stopped ? Effect.never : Scope.provide(running, runtimeScope))))));
|
|
26
29
|
return yield* Fiber.join(running).pipe(Effect.onInterrupt(() => Effect.gen(function* () {
|
|
27
30
|
yield* Deferred.succeed(requested, undefined);
|
|
31
|
+
const limit = yield* deadline;
|
|
28
32
|
yield* Effect.logInfo("Orchestrator shutdown started", {
|
|
29
|
-
deadlineMilliseconds: Duration.toMillis(
|
|
33
|
+
deadlineMilliseconds: Duration.toMillis(limit),
|
|
30
34
|
});
|
|
31
35
|
const stopping = yield* Effect.forkScoped(Fiber.interrupt(running).pipe(Effect.interruptible), { startImmediately: true });
|
|
32
36
|
const drain = Fiber.join(started).pipe(Effect.matchEffect({
|
|
@@ -35,7 +39,9 @@ export const withGracefulShutdown = (startup, requested, deadline) => Effect.sco
|
|
|
35
39
|
}));
|
|
36
40
|
// Finalizers are uninterruptible; raced waits must remain
|
|
37
41
|
// interruptible so the losing drain or signal wait can be stopped.
|
|
38
|
-
const outcome = yield* Effect.raceFirst(Effect.all([drain, Fiber.join(stopping)], { concurrency: "unbounded" }).pipe(
|
|
42
|
+
const outcome = yield* Effect.raceFirst(Effect.all([drain, Fiber.join(stopping)], { concurrency: "unbounded" }).pipe(
|
|
43
|
+
// An infinite deadline never elapses; only the second signal ends the drain.
|
|
44
|
+
Effect.timeoutOption(limit), Effect.map((result) => Option.isSome(result) ? "drained" : "deadline"), Effect.interruptible), Deferred.await(forced).pipe(Effect.as("forced"), Effect.interruptible));
|
|
39
45
|
if (outcome === "drained") {
|
|
40
46
|
yield* Effect.logInfo("Orchestrator exiting after graceful drain");
|
|
41
47
|
}
|
package/dist/shutdown.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../src/shutdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEhF,gFAAgF;AAChF,+EAA+E;AAC/E,MAAM,cAAc,GAAG,CAAC,SAAkC,EAAE,MAA+B,EAAE,EAAE,CAC7F,MAAM,CAAC,cAAc,CACnB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;IACf,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,MAAM,QAAQ,GAAG,GAAG,EAAE;QACpB,QAAQ,IAAI,CAAC,CAAC;QACd,QAAQ,CAAC,UAAU,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACxE,CAAC,CAAC;IACF,OAAO,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC5C,OAAO,CAAC,eAAe,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7C,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC,EACF,CAAC,QAAQ,EAAE,EAAE,CACX,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;IACf,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC3C,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC,CAAC,CACL,CAAC;AAEJ
|
|
1
|
+
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../src/shutdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KA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U,CACtB,2FAA2F,EAC3F,EAAE,MAAM,EAAE,OAAO,EAAE,CACpB,CAAC;YACF,8DAA8D;YAC9D,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CACf,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,EACvE,EAAE,WAAW,EAAE,WAAW,EAAE,CAC7B,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CACH,CACF,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
|
package/dist/up.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { type Port, VolatileInstanceDirectoryError } from "./cli.ts";
|
|
3
|
-
export declare const up: (port: Port, allowVolatileInstance: boolean) => Effect.Effect<never, import("@usine/github/github-app").AppAuthenticationError | import("@usine/engine/engine").AttemptCancellationError | import("@usine/executor").CredentialUnavailableError | import("@usine/engine/engine").EnginePersistenceError | import("@usine/executor").ExecutorOperationError | import("@usine/config/file").FactoryConfigError | import("./cli.ts").PortInUseError | import("@usine/engine/engine").RunInterventionRejectedError | import("@usine/engine/engine").RunNotFoundError | import("@usine/engine/engine").RunOperationRejectedError | import("./cli.ts").ServerStartError | import("@usine/orchestrator/scheduler").UnsupportedWorkerError | VolatileInstanceDirectoryError | import("@usine/executor").WorkerCapabilityError, import("effect/unstable/process/ChildProcessSpawner").ChildProcessSpawner>;
|
|
3
|
+
export declare const up: (port: Port, allowVolatileInstance: boolean) => Effect.Effect<never, import("@usine/github/github-app").AppAuthenticationError | import("@usine/engine/engine").AttemptCancellationError | import("@usine/executor").CredentialUnavailableError | import("@usine/durable/harness").DurableHarnessError | import("@usine/engine/engine").EnginePersistenceError | import("@usine/executor").ExecutorOperationError | import("@usine/config/file").FactoryConfigError | import("./instance-lock.ts").InstanceInUseError | import("./instance-lock.ts").InstanceLockError | import("./cli.ts").PortInUseError | import("@usine/engine/engine").RunInterventionRejectedError | import("@usine/engine/engine").RunNotFoundError | import("@usine/engine/engine").RunOperationRejectedError | import("@usine/engine/engine").RunRetryBlockedError | import("./cli.ts").ServerStartError | import("@usine/orchestrator/scheduler").UnsupportedWorkerError | VolatileInstanceDirectoryError | import("@usine/executor").WorkerCapabilityError, import("effect/unstable/process/ChildProcessSpawner").ChildProcessSpawner>;
|
|
4
4
|
//# sourceMappingURL=up.d.ts.map
|
package/dist/up.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"up.d.ts","sourceRoot":"","sources":["../src/up.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"up.d.ts","sourceRoot":"","sources":["../src/up.ts"],"names":[],"mappings":"AAcA,OAAO,EAML,MAAM,EAKP,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,KAAK,IAAI,EACT,8BAA8B,EAO/B,MAAM,UAAU,CAAC;AAyElB,eAAO,MAAM,EAAE,SAAU,IAAI,yBAAyB,OAAO,sgCAqF1D,CAAC"}
|
package/dist/up.js
CHANGED
|
@@ -8,23 +8,29 @@ import { RunEngine, RunEngineShutdown } from "@usine/engine/engine";
|
|
|
8
8
|
import { MarcbachmannCelLayer } from "@usine/expression/marcbachmann-cel";
|
|
9
9
|
import { GitHubCredentials } from "@usine/github/github-app";
|
|
10
10
|
import { loadLocalCredentials } from "@usine/github/local-secrets";
|
|
11
|
-
import {
|
|
11
|
+
import { CurrentInstance } from "@usine/orchestrator/current-instance";
|
|
12
|
+
import { Operator, OperatorConfiguration, OperatorObservation } from "@usine/orchestrator/operator";
|
|
12
13
|
import { Orchestrator } from "@usine/orchestrator/orchestrator";
|
|
13
|
-
import { operatorObservationLayer, runtimeLayer } from "@usine/orchestrator/
|
|
14
|
+
import { operatorObservationLayer, runtimeLayer } from "@usine/orchestrator/runtime";
|
|
14
15
|
import { Cause, Console, Context, Duration, Deferred, Effect, FileSystem, Layer, Option, Result, } from "effect";
|
|
15
16
|
import { liveBackendLayer, needsSetupBackendLayer } from "./backend.js";
|
|
16
|
-
import { VolatileInstanceDirectoryError, openBrowser, serverStartError, volatileRoot, volatileRoots, } from "./cli.js";
|
|
17
|
+
import { VolatileInstanceDirectoryError, openBrowser, portInUse, refuseTakenPort, serverStartError, volatileRoot, volatileRoots, } from "./cli.js";
|
|
17
18
|
import { serverLayer } from "./http.js";
|
|
19
|
+
import { holdInstance } from "./instance-lock.js";
|
|
20
|
+
import { reloadOnHangup } from "./reload-signal.js";
|
|
18
21
|
import { withGracefulShutdown } from "./shutdown.js";
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const instanceFolderLayer = InstanceFolder.layer.pipe(Layer.provide(ConfigParser.layer.pipe(Layer.provide(MarcbachmannCelLayer))), Layer.provide(NodeServices.layer));
|
|
23
|
+
/** Loads the instance folder and keeps it reloadable. Fails if `usine.yaml` is invalid. */
|
|
24
|
+
const loadInstance = Effect.fn("Server.loadInstance")(function* (directory) {
|
|
25
|
+
const context = yield* Layer.build(instanceFolderLayer);
|
|
26
|
+
const initial = yield* Context.get(context, InstanceFolder).load(directory);
|
|
27
|
+
const current = yield* Layer.build(CurrentInstance.layer(directory, initial).pipe(Layer.provide(Layer.succeedContext(context))));
|
|
28
|
+
return Context.get(current, CurrentInstance);
|
|
29
|
+
});
|
|
24
30
|
const serve = Effect.fn("Server.serve")(function* (options) {
|
|
25
|
-
yield* Layer.build(serverLayer(options.backend, options.webRoot, options.port)).pipe(Effect.mapError((error) => serverStartError(options.port, error)));
|
|
31
|
+
yield* Layer.build(serverLayer(options.backend, options.webRoot, options.port)).pipe(Effect.mapError((error) => serverStartError(options.port, error)), Effect.catchTag("PortInUseError", ({ port }) => portInUse(port)));
|
|
26
32
|
yield* Console.log(options.openSetupPage
|
|
27
|
-
? `usine is
|
|
33
|
+
? `usine is running in setup mode at ${options.url}`
|
|
28
34
|
: `usine is running at ${options.url}`);
|
|
29
35
|
if (options.openSetupPage) {
|
|
30
36
|
yield* openBrowser(options.url).pipe(Effect.tapError((error) => Effect.logWarning("The setup page could not be opened automatically", {
|
|
@@ -49,7 +55,11 @@ const refuseVolatileInstance = Effect.fn("Server.refuseVolatileInstance")(functi
|
|
|
49
55
|
export const up = (port, allowVolatileInstance) => Effect.scoped(Effect.gen(function* () {
|
|
50
56
|
const directory = InstanceDirectory.make(process.cwd());
|
|
51
57
|
yield* refuseVolatileInstance(directory, allowVolatileInstance).pipe(Effect.provide(NodeServices.layer));
|
|
52
|
-
|
|
58
|
+
// Acquired before any store opens and released after every store closes.
|
|
59
|
+
yield* holdInstance(directory).pipe(Effect.provide(NodeServices.layer));
|
|
60
|
+
yield* refuseTakenPort(port).pipe(Effect.provide(NodeServices.layer));
|
|
61
|
+
const instances = yield* loadInstance(directory);
|
|
62
|
+
yield* reloadOnHangup(instances);
|
|
53
63
|
const credentials = yield* loadLocalCredentials(directory).pipe(Effect.provide(NodeServices.layer), Effect.result);
|
|
54
64
|
const webRoot = resolve(dirname(fileURLToPath(import.meta.url)), "web");
|
|
55
65
|
const url = `http://127.0.0.1:${port}`;
|
|
@@ -61,12 +71,12 @@ export const up = (port, allowVolatileInstance) => Effect.scoped(Effect.gen(func
|
|
|
61
71
|
instanceDirectory: directory,
|
|
62
72
|
});
|
|
63
73
|
const observationContext = yield* Layer.build(operatorObservationLayer(directory));
|
|
64
|
-
const backend = needsSetupBackendLayer(
|
|
74
|
+
const backend = needsSetupBackendLayer(instances, error._tag, Context.get(observationContext, OperatorObservation), Context.get(observationContext, OperatorConfiguration));
|
|
65
75
|
return yield* serve({ backend, webRoot, port, url, openSetupPage: true });
|
|
66
76
|
}
|
|
67
77
|
const shutdown = yield* Deferred.make();
|
|
68
78
|
const startup = Effect.gen(function* () {
|
|
69
|
-
const runtime = runtimeLayer(directory
|
|
79
|
+
const runtime = runtimeLayer(directory).pipe(Layer.provide(Layer.succeed(GitHubCredentials, credentials.success)), Layer.provide(Layer.succeed(CurrentInstance, instances)));
|
|
70
80
|
const context = yield* Layer.build(runtime).pipe(Effect.provideService(RunEngineShutdown, shutdown));
|
|
71
81
|
const operator = Context.get(context, Operator);
|
|
72
82
|
const orchestrator = Context.get(context, Orchestrator);
|
|
@@ -74,18 +84,21 @@ export const up = (port, allowVolatileInstance) => Effect.scoped(Effect.gen(func
|
|
|
74
84
|
return {
|
|
75
85
|
drain: engine.drain(),
|
|
76
86
|
running: Effect.raceFirst(serve({
|
|
77
|
-
backend: liveBackendLayer(
|
|
87
|
+
backend: liveBackendLayer(instances, operator, Context.get(context, OperatorConfiguration)),
|
|
78
88
|
webRoot,
|
|
79
89
|
port,
|
|
80
90
|
url,
|
|
81
91
|
openSetupPage: false,
|
|
82
|
-
}), orchestrator.run
|
|
92
|
+
}), orchestrator.run.pipe(Effect.tapCause((cause) => Cause.hasInterruptsOnly(cause)
|
|
83
93
|
? Effect.void
|
|
84
94
|
: Effect.logFatal("Trigger streams stopped; shutting the server down", {
|
|
85
95
|
cause,
|
|
86
96
|
})))),
|
|
87
97
|
};
|
|
88
98
|
});
|
|
89
|
-
return yield* withGracefulShutdown(startup, shutdown,
|
|
99
|
+
return yield* withGracefulShutdown(startup, shutdown, Effect.map(instances.get, ({ config }) => Option.match(config.settings.maxAttemptMinutes, {
|
|
100
|
+
onNone: () => Duration.infinity,
|
|
101
|
+
onSome: Duration.minutes,
|
|
102
|
+
})));
|
|
90
103
|
}));
|
|
91
104
|
//# sourceMappingURL=up.js.map
|
package/dist/up.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"up.js","sourceRoot":"","sources":["../src/up.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EA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AAC;QACxD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC/C,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE;YACrB,OAAO,EAAE,MAAM,CAAC,SAAS,CACvB,KAAK,CAAC;gBACJ,OAAO,EAAE,gBAAgB,CACvB,SAAS,EACT,QAAQ,EACR,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAC5C;gBACD,OAAO;gBACP,IAAI;gBACJ,GAAG;gBACH,aAAa,EAAE,KAAK;aACrB,CAAC,EACF,YAAY,CAAC,GAAG,CAAC,IAAI,CACnB,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC;gBAC5B,CAAC,CAAC,MAAM,CAAC,IAAI;gBACb,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,mDAAmD,EAAE;oBACnE,KAAK;iBACN,CAAC,CACP,CACF,CACF;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC,CAAC,oBAAoB,CAChC,OAAO,EACP,QAAQ,EACR,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CACvC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE;QAC9C,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ;QAC/B,MAAM,EAAE,QAAQ,CAAC,OAAO;KACzB,CAAC,CACH,CACF,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{M as t,lt as n,o as r,r as i,s as a,ut as o}from"./button-C4yvcSko.js";import{E as s,Gt as c,K as l,Lt as u,N as d,Rt as f,T as p,X as m,_ as h,a as g,b as _,d as v,en as y,f as b,g as x,h as S,i as C,n as w,o as T,r as E,s as D,sn as O,st as k,t as A,tn as j,u as M,ut as N,v as P,x as F,y as I}from"./useScrollLock-BOb01sL8.js";var L=e(o(),1),R=L.createContext(void 0);function z(e){let t=L.useContext(R);if(!e&&t===void 0)throw Error(r(27));return t}var B=L.forwardRef(function(e,n){let{render:r,className:i,style:a,forceRender:o=!1,...s}=e,c=z(),l=c.useState(`open`),u=c.useState(`nested`),d=c.useState(`mounted`),p={open:l,transitionStatus:c.useState(`transitionStatus`)};return t(`div`,e,{state:p,ref:[c.context.backdropRef,n],stateAttributesMapping:f,props:[{role:`presentation`,hidden:!d,style:{userSelect:`none`,WebkitUserSelect:`none`}},s],enabled:o||!u})}),V=L.forwardRef(function(e,n){let{render:r,className:a,style:o,disabled:s=!1,nativeButton:c=!0,...u}=e,d=z(),f=d.useState(`open`),{getButtonProps:p,buttonRef:m}=i({disabled:s,native:c}),h={disabled:s};function g(e){f&&d.setOpen(!1,k(l,e.nativeEvent))}return t(`button`,e,{state:h,ref:[n,m],props:[{onClick:g},u,p]})}),H=L.forwardRef(function(e,n){let{render:r,className:i,style:a,id:o,...s}=e,c=z(),l=O(o);return c.useSyncedValueWithCleanup(`descriptionElementId`,l),t(`p`,e,{ref:n,props:[{id:l},s]})}),U=L.createContext(void 0);function W(){let e=L.useContext(U);if(e===void 0)throw Error(r(26));return e}var G=`--nested-dialogs`,K=`data-nested-dialog-open`,q={...u,...c,nestedDialogOpen(e){return e?{[K]:``}:null}},J=n(),Y=L.forwardRef(function(e,n){let{render:r,className:i,style:a,finalFocus:o,initialFocus:c,...l}=e,u=z(),d=u.useState(`descriptionElementId`),f=u.useState(`disablePointerDismissal`),p=u.useState(`floatingRootContext`),m=u.useState(`popupProps`),h=u.useState(`modal`),g=u.useState(`mounted`),_=u.useState(`nested`),y=u.useState(`nestedOpenDialogCount`),b=u.useState(`open`),x=u.useState(`openMethod`),w=u.useState(`titleElementId`),T=u.useState(`transitionStatus`),E=u.useState(`role`),D=p.useState(`floatingId`);W(),N({open:b,ref:u.context.popupRef,onComplete(){b&&u.context.onOpenChangeComplete?.(!0)}});let O=c===void 0?S(u.context.popupRef):c,k=y>0,A=u.useStateSetter(`popupElement`),j=t(`div`,e,{state:{open:b,nested:_,transitionStatus:T,nestedDialogOpen:k},props:[m,{id:D,"aria-labelledby":w,"aria-describedby":d,role:E,...v,hidden:!g,onKeyDown(e){C.has(e.key)&&e.stopPropagation()},style:{[G]:y}},l],ref:[n,u.context.popupRef,A],stateAttributesMapping:q});return(0,J.jsx)(s,{context:p,openInteractionType:x,disabled:!g,closeOnFocusOut:!f,initialFocus:O,returnFocus:o,modal:h!==!1,restoreFocus:`popup`,children:j})}),X=L.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=z(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,J.jsx)(U.Provider,{value:n,children:(0,J.jsxs)(d,{ref:t,...r,children:[a&&o===!0&&(0,J.jsx)(w,{ref:i.context.internalBackdropRef,inert:E(!s)}),e.children]})}):null});function Z({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`mounted`),o=e.useState(`disablePointerDismissal`),s=e.useState(`modal`),c=e.useState(`popupElement`),l=e.useState(`floatingRootContext`),[u,d]=L.useState(0),[f,m]=L.useState(0),h=u===0,g=p(l,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:s===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=j(t);if(h&&!o){if(s){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||y(n,c)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:h});return A(r&&s===!0,c),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{(e.select(`open`)||e.select(`mounted`))&&(d(t),m(n))}),a(()=>{!r&&!i&&(d(0),m(0))},[r,i]),a(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(u+1,f+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,u,f,t]),I(e,{activeTriggerProps:g.reference,inactiveTriggerProps:g.trigger,popupProps:g.floating,nestedOpenDialogCount:u,nestedOpenDrawerCount:f}),null}var Q={...T,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},$=class extends D{constructor(e,t,n){let r=new M,i=ee(e,r,t,n);super(i,te(r),Q)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(x(this.state,e,t.trigger)))}};function ee(e,t,n,r=!1){return{...g(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function te(e){return{popupRef:L.createRef(),backdropRef:L.createRef(),internalBackdropRef:L.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function ne(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,g=e===`alert-dialog`,v=g?!0:c,y=g||s,x=g?`alertdialog`:`dialog`,S=z(!0),C={modal:v,disablePointerDismissal:y,nested:S!=null,role:x},w=_((e,t)=>new $({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...C},e,t),!0);w.useControlledProp(`openProp`,r),w.useControlledProp(`triggerIdProp`,d),w.useSyncedValues(C),w.useContextCallback(`onOpenChange`,a),w.useContextCallback(`onOpenChangeComplete`,o);let T=w.useState(`open`),E=w.useState(`mounted`),D=w.useState(`payload`);F(w,T),h(w);let{forceUnmount:O}=P(T,w);L.useImperativeHandle(l,()=>({unmount:O,close:()=>w.setOpen(!1,k(m))}),[O,w]);let A=T||E||u!=null;return(0,J.jsxs)(R.Provider,{value:w,children:[u&&(0,J.jsx)(b,{handle:u,store:w}),A&&(0,J.jsx)(Z,{store:w,parentContext:S?.context,isDrawer:p}),typeof n==`function`?n({payload:D}):n]})}var re=L.forwardRef(function(e,n){let{render:r,className:i,style:a,id:o,...s}=e,c=z(),l=O(o);return c.useSyncedValueWithCleanup(`titleElementId`,l),t(`h2`,e,{ref:n,props:[{id:l},s]})});export{H as a,Y as i,ne as n,V as o,X as r,B as s,re as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{lt as e}from"./button-C4yvcSko.js";import{on as t}from"./operator-copy-DsM7LJx6.js";import{G as n,c as r}from"./index-BljdfRBm.js";import{t as i}from"./agents-DIZolb0U.js";var a=e(),o=()=>{let{agent:e}=r.useParams(),{data:o}=t(n());return(0,a.jsx)(i,{name:e,configuration:o})};export{o as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{lt as e}from"./button-C4yvcSko.js";import{on as t}from"./operator-copy-DsM7LJx6.js";import{t as n}from"./loops-DWLXyUPN.js";import{A as r,G as i,s as a}from"./index-BljdfRBm.js";var o=e(),s=()=>{let{loop:e}=a.useParams(),{data:s}=t(i());return(0,o.jsx)(n,{name:e,configuration:s,pause:r()})};export{s as component};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{H as t,k as n,lt as r,t as i,ut as a}from"./button-C4yvcSko.js";import{J as o,on as s}from"./operator-copy-DsM7LJx6.js";import{t as c}from"./error-alert-BrI00JbQ.js";import{n as l}from"./use-now-CcFZyFvf.js";import{C as u,E as d,S as f,T as p,_ as m,b as h,d as g,f as _,g as v,h as y,m as b,n as x,p as S,r as C,t as ee,u as w,v as T,w as E,x as D,y as O}from"./moves-RiWgdCxQ.js";import{K as k,Y as A,i as j,m as te}from"./index-BljdfRBm.js";import{a as ne,i as M,n as N,o as P,r as F,t as I}from"./table-B6NH8hTW.js";import{r as L,t as R}from"./status-badge-CNlyvwWL.js";import{n as z,t as B}from"./label-badge-ohqvZnY7.js";import{v as V}from"./copy-BM1l6IGB.js";import{t as H}from"./query-DWN8IHdt.js";import{t as U}from"./project-not-found-CQVclgb0.js";var W=e(a(),1),G=new Map([[`bold`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M204,64V168a12,12,0,0,1-24,0V93L72.49,200.49a12,12,0,0,1-17-17L163,76H88a12,12,0,0,1,0-24H192A12,12,0,0,1,204,64Z`}))],[`duotone`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M192,64V168L88,64Z`,opacity:`0.2`}),W.createElement(`path`,{d:`M192,56H88a8,8,0,0,0-5.66,13.66L128.69,116,58.34,186.34a8,8,0,0,0,11.32,11.32L140,127.31l46.34,46.35A8,8,0,0,0,200,168V64A8,8,0,0,0,192,56Zm-8,92.69-38.34-38.34h0L107.31,72H184Z`}))],[`fill`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-13.66,5.66L140,127.31,69.66,197.66a8,8,0,0,1-11.32-11.32L128.69,116,82.34,69.66A8,8,0,0,1,88,56H192A8,8,0,0,1,200,64Z`}))],[`light`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M198,64V168a6,6,0,0,1-12,0V78.48L68.24,196.24a6,6,0,0,1-8.48-8.48L177.52,70H88a6,6,0,0,1,0-12H192A6,6,0,0,1,198,64Z`}))],[`regular`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-16,0V83.31L69.66,197.66a8,8,0,0,1-11.32-11.32L172.69,72H88a8,8,0,0,1,0-16H192A8,8,0,0,1,200,64Z`}))],[`thin`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M196,64V168a4,4,0,0,1-8,0V73.66L66.83,194.83a4,4,0,0,1-5.66-5.66L182.34,68H88a4,4,0,0,1,0-8H192A4,4,0,0,1,196,64Z`}))]]),K=new Map([[`bold`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M140,40V216a12,12,0,0,1-24,0V40a12,12,0,0,1,24,0ZM64.49,87.51a12,12,0,0,0-17,17L59,116H16a12,12,0,0,0,0,24H59L47.51,151.51a12,12,0,0,0,17,17l32-32a12,12,0,0,0,0-17ZM240,116H197l11.52-11.51a12,12,0,0,0-17-17l-32,32a12,12,0,0,0,0,17l32,32a12,12,0,0,0,17-17L197,140h43a12,12,0,0,0,0-24Z`}))],[`duotone`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M240,56V200a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V56A16,16,0,0,1,32,40H224A16,16,0,0,1,240,56Z`,opacity:`0.2`}),W.createElement(`path`,{d:`M136,40V216a8,8,0,0,1-16,0V40a8,8,0,0,1,16,0ZM69.66,90.34a8,8,0,0,0-11.32,11.32L76.69,120H16a8,8,0,0,0,0,16H76.69L58.34,154.34a8,8,0,0,0,11.32,11.32l32-32a8,8,0,0,0,0-11.32ZM240,120H179.31l18.35-18.34a8,8,0,0,0-11.32-11.32l-32,32a8,8,0,0,0,0,11.32l32,32a8,8,0,0,0,11.32-11.32L179.31,136H240a8,8,0,0,0,0-16Z`}))],[`fill`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M101.66,122.34a8,8,0,0,1,0,11.32l-32,32A8,8,0,0,1,56,160V136H16a8,8,0,0,1,0-16H56V96a8,8,0,0,1,13.66-5.66ZM240,120H200V96a8,8,0,0,0-13.66-5.66l-32,32a8,8,0,0,0,0,11.32l32,32A8,8,0,0,0,200,160V136h40a8,8,0,0,0,0-16ZM128,32a8,8,0,0,0-8,8V216a8,8,0,0,0,16,0V40A8,8,0,0,0,128,32Z`}))],[`light`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M134,40V216a6,6,0,0,1-12,0V40a6,6,0,0,1,12,0ZM68.24,91.76a6,6,0,0,0-8.48,8.48L81.51,122H16a6,6,0,0,0,0,12H81.51L59.76,155.76a6,6,0,1,0,8.48,8.48l32-32a6,6,0,0,0,0-8.48ZM240,122H174.49l21.75-21.76a6,6,0,0,0-8.48-8.48l-32,32a6,6,0,0,0,0,8.48l32,32a6,6,0,0,0,8.48-8.48L174.49,134H240a6,6,0,0,0,0-12Z`}))],[`regular`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M136,40V216a8,8,0,0,1-16,0V40a8,8,0,0,1,16,0ZM69.66,90.34a8,8,0,0,0-11.32,11.32L76.69,120H16a8,8,0,0,0,0,16H76.69L58.34,154.34a8,8,0,0,0,11.32,11.32l32-32a8,8,0,0,0,0-11.32ZM240,120H179.31l18.35-18.34a8,8,0,0,0-11.32-11.32l-32,32a8,8,0,0,0,0,11.32l32,32a8,8,0,0,0,11.32-11.32L179.31,136H240a8,8,0,0,0,0-16Z`}))],[`thin`,W.createElement(W.Fragment,null,W.createElement(`path`,{d:`M132,40V216a4,4,0,0,1-8,0V40a4,4,0,0,1,8,0ZM66.83,93.17a4,4,0,0,0-5.66,5.66L86.34,124H16a4,4,0,0,0,0,8H86.34L61.17,157.17a4,4,0,0,0,5.66,5.66l32-32a4,4,0,0,0,0-5.66ZM240,124H169.66l25.17-25.17a4,4,0,1,0-5.66-5.66l-32,32a4,4,0,0,0,0,5.66l32,32a4,4,0,0,0,5.66-5.66L169.66,132H240a4,4,0,0,0,0-8Z`}))]]),q=W.forwardRef((e,n)=>W.createElement(t,{ref:n,...e,weights:G}));q.displayName=`ArrowUpRightIcon`;var J=W.forwardRef((e,n)=>W.createElement(t,{ref:n,...e,weights:K}));J.displayName=`ArrowsInLineHorizontalIcon`;var Y=r(),X=new Set([`Waiting`,`Queued`,`Running`]),Z=(e,t)=>new Map(e.flatMap((n,r)=>{let i=e[r+1];if(i===void 0||n._tag!==`WritableBoardLane`||i._tag!==`WritableBoardLane`)return[];let a=new Set(n.items.flatMap(e=>e.loops)),o=n.items.flatMap(({runs:e})=>e.filter(({state:e,loop:t})=>X.has(e)&&a.has(t))),s={next:i,loops:t.filter(({name:e})=>a.has(e)).map(({name:e,paused:t})=>({name:e,paused:t})),tone:o.some(({state:e})=>e!==`Waiting`)?`active`:o.length>0?`waiting`:`idle`};return[[n.id,s]]})),re=e=>e.map(({name:e,paused:t})=>t?`${e} (paused)`:e).join(`, `),ie=({flow:e})=>{let t=e.loops.length>0;return(0,Y.jsxs)(`p`,{"data-slot":`flow-arrow`,className:n(`-mr-3 ml-auto flex min-w-0 items-center gap-1.5 pl-2 text-xs`,e.tone===`active`?`text-run-active`:e.tone===`waiting`?`text-run-waiting`:`text-muted-foreground`),title:t?`Loops matching this lane: ${re(e.loops)}. Flows to ${e.next.name}`:void 0,children:[(0,Y.jsxs)(`span`,{className:`sr-only`,children:[`Flows to `,e.next.name]}),t&&(0,Y.jsx)(`span`,{className:`truncate`,children:e.loops.map(({name:e,paused:t},n)=>(0,Y.jsxs)(W.Fragment,{children:[n>0&&`, `,e,t&&(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:` paused`})]},e))}),(0,Y.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 22 8`,className:n(`h-2 w-5.5 shrink-0 fill-none stroke-current`,e.tone===`idle`&&`text-faint`),strokeWidth:`1`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,Y.jsx)(`path`,{d:`M0.5 4h18M15.5 1l3 3-3 3`})})]})},ae=e=>e.origin===`fallback`||e.sources.length>0&&e.sources.every(e=>`state`in e&&o(e.state)),oe=({sources:e,catalog:t})=>(0,Y.jsx)(`ul`,{"aria-label":`Lane sources`,className:`flex flex-wrap gap-1`,children:e.map(e=>(0,Y.jsx)(`li`,{className:`flex`,children:`label`in e?(0,Y.jsx)(B,{name:e.label,label:t.get(e.label)}):(0,Y.jsx)(z,{variant:`outline`,className:`text-muted-foreground`,children:e.state})},`label`in e?`label:${e.label}`:`state:${e.state}`))}),se=({lane:e,open:t})=>(0,Y.jsx)(`section`,{"aria-label":`${e.name} lane`,className:`w-10 shrink-0`,children:(0,Y.jsx)(`button`,{type:`button`,"aria-expanded":!1,title:`Open ${e.name}`,onClick:t,className:`flex h-full min-h-40 w-full items-start justify-center rounded-lg bg-card/60 ring-1 ring-border transition-colors outline-none hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring/70`,children:(0,Y.jsxs)(`span`,{className:`sticky top-0 flex flex-col-reverse items-center gap-2 py-3`,children:[(0,Y.jsx)(`span`,{className:`max-h-60 truncate text-sm font-semibold [writing-mode:vertical-rl]`,children:e.name}),` `,(0,Y.jsx)(`span`,{className:`text-sm text-muted-foreground tabular-nums`,children:e.items.length})]})})}),Q=({lane:e,lanes:t,flow:r,catalog:a,targeted:o,pending:s,readOnly:c,moves:l,stallOf:u,openRun:d,onMove:f,repository:p})=>{let h=ae(e),[g,_]=(0,W.useState)(h),v=e._tag===`WritableBoardLane`,{setNodeRef:b}=E({id:e.id,disabled:!v||s}),S=t.filter(t=>t._tag===`WritableBoardLane`&&t.id!==e.id),C=e.items.length;return h&&g?(0,Y.jsx)(se,{lane:e,open:()=>_(!1)}):(0,Y.jsxs)(`section`,{ref:b,"aria-label":`${e.name} lane`,className:n(`flex w-68 shrink-0 flex-col gap-2 rounded-lg transition-[background-color,box-shadow]`,o&&`bg-muted/40 ring-6 ring-muted/40`),children:[(0,Y.jsxs)(`header`,{className:n(`sticky top-0 z-20 -mx-0.5 flex flex-col gap-1.5 px-1 pt-1 pb-1`,!o&&`bg-background`),children:[(0,Y.jsxs)(`div`,{className:`flex h-6 items-center`,children:[(0,Y.jsxs)(`h2`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Y.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,Y.jsx)(`span`,{className:`text-sm text-muted-foreground tabular-nums`,children:C})]}),r!==void 0&&(0,Y.jsx)(ie,{flow:r}),h&&(0,Y.jsx)(i,{variant:`ghost`,size:`icon-xs`,"aria-expanded":!0,"aria-label":`Fold ${e.name}`,title:`Fold ${e.name}`,className:`ml-auto text-muted-foreground hover:text-foreground`,onClick:()=>_(!0),children:(0,Y.jsx)(J,{"aria-hidden":`true`})})]}),(0,Y.jsx)(`div`,{className:`min-h-5`,children:e.sources.length>0&&(0,Y.jsx)(oe,{sources:e.sources,catalog:a})})]}),(0,Y.jsx)(`div`,{className:`flex min-h-40 flex-col gap-2`,children:(0,Y.jsxs)(y,{items:e.items.map(({itemKey:e})=>e),strategy:m,children:[C===0&&(0,Y.jsx)(`p`,{className:`rounded-lg border border-dashed border-input px-3 py-2.5 text-xs text-muted-foreground`,children:`No tasks`}),e.items.map(t=>{let n=l.find(({itemKey:e})=>e===t.itemKey)?.phase,r=s||n!==void 0;return(0,Y.jsx)(x,{item:t,lane:e,catalog:a,draggable:!r&&S.length>0,phase:n,moves:{targets:S,disabled:r,onMove:f},stall:u(t),readOnly:c,openRun:d,repository:p},t.itemKey)})]})})]})},ce=e=>[...e.filter(({_tag:e})=>e===`WritableBoardLane`),...e.filter(({_tag:e,origin:t})=>e!==`WritableBoardLane`&&t!==`fallback`),...e.filter(({origin:e})=>e===`fallback`)],$=(e,t)=>t.find(t=>t.id===e)??t.find(t=>t.items.some(({itemKey:t})=>t===e)),le=e=>{let t=f(e);if(t.length>0)return t;if(e.pointerCoordinates===null){let t=f({...e,pointerCoordinates:{x:e.collisionRect.left+1,y:e.collisionRect.top+1}});if(t.length>0)return t}return u(e)},ue=e=>(t,n)=>{let r=t.code===`ArrowRight`;if(!r&&t.code!==`ArrowLeft`)return v(t,n);t.preventDefault();let{collisionRect:i,droppableRects:a,droppableContainers:o}=n.context;if(i===null)return;let s=new Set(e.map(({id:e})=>e)),[c]=o.getEnabled().flatMap(({id:e})=>{let t=a.get(e);return t!==void 0&&s.has(e)?[t]:[]}).filter(({left:e})=>r?e>i.left:e<i.left).sort((e,t)=>r?e.left-t.left:t.left-e.left);return c===void 0?void 0:{x:c.left,y:c.top}},de=(e,t)=>{let n=e.flatMap(({items:e})=>e).find(({itemKey:e})=>e===t.itemKey);if(n===void 0)return e;let r=new Set(e.flatMap(e=>e._tag===`WritableBoardLane`?e.labels:[])),i={...n,labels:n.labels.filter(e=>!r.has(e))};return e.map(e=>{let n=e.items.filter(({itemKey:e})=>e!==t.itemKey);return e.id===t.toLane?{...e,items:[i,...n]}:{...e,items:n}})},fe=e=>{let t=new Set(e.board.lanes.flatMap(({items:e})=>e.flatMap(({items:e})=>e.map(({itemKey:e})=>e))));return e.runs.filter(({itemKey:e})=>!t.has(e))},pe=({runs:e,openRun:t})=>(0,Y.jsxs)(w,{className:`sticky left-4 w-[min(64rem,calc(100cqw-2rem))] md:left-5 md:w-[min(64rem,calc(100cqw-2.5rem))]`,children:[(0,Y.jsxs)(S,{children:[(0,Y.jsx)(b,{children:`Runs without a card`}),(0,Y.jsxs)(_,{children:[e.length,` run`,e.length===1?``:`s`,` with no card on this board`]})]}),(0,Y.jsx)(g,{children:(0,Y.jsxs)(I,{children:[(0,Y.jsx)(ne,{children:(0,Y.jsxs)(P,{children:[(0,Y.jsx)(M,{children:`Loop`}),(0,Y.jsx)(M,{children:`Agent`}),(0,Y.jsx)(M,{children:`Item`}),(0,Y.jsx)(M,{children:`State`}),(0,Y.jsx)(M,{className:`w-0`})]})}),(0,Y.jsx)(N,{children:e.map(e=>(0,Y.jsxs)(P,{className:`cursor-pointer`,onClick:()=>t(e.id),children:[(0,Y.jsx)(F,{className:`font-medium`,children:e.loop}),(0,Y.jsx)(F,{children:e.agent}),(0,Y.jsx)(F,{className:`max-w-64 truncate font-mono text-xs`,children:e.itemKey}),(0,Y.jsx)(F,{children:(0,Y.jsx)(L,{state:e.state})}),(0,Y.jsx)(F,{className:`text-right`,children:(0,Y.jsx)(i,{variant:`ghost`,size:`icon-sm`,"aria-label":`Open run ${e.id}`,onClick:n=>{n.stopPropagation(),t(e.id)},children:(0,Y.jsx)(q,{"aria-hidden":`true`})})})]},e.id))})]})})]}),me=({project:e,loops:t,stalled:n,disabled:r,openRun:i})=>{let[a,o]=(0,W.useState)(null),[s,l]=(0,W.useState)(null),{moves:u,moveItem:f,isPending:m,error:g}=ee(e),_=fe(e),v=u.reduce(de,ce(e.board.lanes)),y=d(p(D,{activationConstraint:{distance:6}}),p(h,{coordinateGetter:ue(v)})),b=Z(v,t),x=v.reduce((e,t)=>e+t.items.length,0),S=e=>V(n,e),w=new Map(e.labels.map(e=>[e.name,e])),E=r||m,k=()=>{o(null),l(null)};return(0,Y.jsxs)(`div`,{className:`flex min-h-96 flex-1 flex-col gap-4 pt-5`,children:[(0,Y.jsx)(A,{title:e.repository,counts:`${v.length} lane${v.length===1?``:`s`}, ${x} item${x===1?``:`s`}`,className:`px-4 md:px-5`,children:e.status===`needs-you`&&(0,Y.jsx)(R,{})}),e.board.lanes.some(({origin:e})=>e===`proposed`)&&(0,Y.jsxs)(`p`,{className:`mx-4 max-w-3xl text-muted-foreground md:mx-5`,children:[`Proposed lanes are read-only. To enable moves, add lanes with labels for this project under `,(0,Y.jsx)(`code`,{children:`repos[].lanes`}),` in `,(0,Y.jsx)(`code`,{children:`usine.yaml`}),`, then reload the configuration from Configuration > Loops.`]}),e.board.failures.length>0&&(0,Y.jsx)(c,{className:`mx-4 max-w-3xl md:mx-5`,title:`${e.board.failures.length} ${e.board.failures.length===1?`item`:`items`} not shown on the board`,message:e.board.failures.map(e=>e.message).join(`
|
|
2
|
+
`)}),g!==null&&(0,Y.jsx)(c,{className:`mx-4 max-w-3xl md:mx-5`,message:g.message}),(0,Y.jsxs)(T,{sensors:y,collisionDetection:le,onDragStart:({active:e})=>{let t=v.find(({items:t})=>t.some(({itemKey:t})=>t===e.id)),n=t?.items.find(({itemKey:t})=>t===e.id);o(t===void 0||n===void 0?null:{item:n,lane:t})},onDragOver:({over:e})=>l(e===null?null:$(e.id,v)?.id??null),onDragEnd:({over:e})=>{if(k(),e===null||a===null)return;let t=$(e.id,v);t!==void 0&&f(a.item,t)},onDragCancel:k,children:[(0,Y.jsx)(`div`,{className:`@container min-h-0 flex-1 overflow-auto overscroll-contain`,"aria-label":`${e.repository} project board`,children:(0,Y.jsxs)(`div`,{className:`flex w-max min-w-full flex-col gap-6 px-4 pb-4 md:px-5`,children:[(0,Y.jsx)(`div`,{className:`flex gap-3`,children:v.map(t=>(0,Y.jsx)(Q,{lane:t,lanes:v,flow:b.get(t.id),catalog:w,targeted:a!==null&&s===t.id&&t.id!==a.lane.id&&t._tag===`WritableBoardLane`,pending:E,readOnly:r,moves:u,stallOf:S,openRun:i,onMove:f,repository:e.repository},t.id))}),_.length>0&&(0,Y.jsx)(pe,{runs:_,openRun:i})]})}),(0,Y.jsx)(O,{children:a!==null&&(0,Y.jsx)(C,{item:a.item,lane:a.lane,catalog:w,repository:e.repository,stall:S(a.item)})})]})]})},he=()=>{let{repository:e}=j.useParams(),{data:t}=s(k()),n=l(H()),r=te(),i=t.projects.find(t=>t.repository===e);return i===void 0?(0,Y.jsx)(U,{}):(0,Y.jsx)(me,{project:i,loops:t.loops,stalled:n.data?.notMoving??[],disabled:t._tag===`NeedsSetup`,openRun:r})};export{he as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./project-not-found-CQVclgb0.js";var t=e;export{t as notFoundComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{lt as e}from"./button-C4yvcSko.js";import{on as t}from"./operator-copy-DsM7LJx6.js";import{G as n,a as r}from"./index-BljdfRBm.js";import{n as i}from"./repositories-Cq7zGzNb.js";var a=e(),o=()=>{let{owner:e,name:o}=r.useParams(),{data:s}=t(n());return(0,a.jsx)(i,{owner:e,name:o,configuration:s})};export{o as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{U as t,k as n,lt as r,t as i,ut as a}from"./button-C4yvcSko.js";import{C as o,Ct as s,I as c,N as l,O as u,S as d,T as f,c as p,d as m,dt as h,f as g,h as _,l as v,m as y,nn as b,on as ee,st as te,tt as ne,w as re,wt as ie}from"./operator-copy-DsM7LJx6.js";import{t as x}from"./error-alert-BrI00JbQ.js";import{n as ae,t as oe}from"./use-now-CcFZyFvf.js";import{t as se}from"./useNavigate-lXd3v3E0.js";import{D as ce,O as S,a as C,c as w,i as le,l as T,o as E,s as D,t as ue}from"./moves-RiWgdCxQ.js";import{a as de,l as fe,o as pe,r as me}from"./item-rBBCTV8x.js";import{C as he,K as ge,S as _e,_ as ve,b as ye,d as be,et as O,f as k,g as A,h as j,m as M,p as N,q as P,t as xe,v as Se,x as Ce,y as we}from"./index-BljdfRBm.js";import{a as Te,i as F,n as I,o as L,r as R,t as z}from"./table-B6NH8hTW.js";import{n as B,t as Ee}from"./status-badge-CNlyvwWL.js";import{t as De}from"./label-badge-ohqvZnY7.js";import{c as Oe,i as ke,o as V,r as Ae,s as je,u as Me}from"./copy-BM1l6IGB.js";import{n as Ne,t as Pe}from"./run-again-DxjFCuNu.js";import{i as H,n as U,r as W,t as G}from"./section-DkBCDv4D.js";var K=r(),Fe=e=>e.postedAt===null?e.attemptEndedAt===null?null:{at:e.attemptEndedAt,title:`Posted during the attempt that ended ${u(e.attemptEndedAt)}`}:{at:e.postedAt,title:`Posted ${u(e.postedAt)}`},Ie=({task:e})=>{let n=new Map(e.runs.map(e=>[e.id,e])),r=new Map(e.items.map(e=>[e.itemKey,e]));return(0,K.jsxs)(`section`,{"aria-labelledby":`task-comments`,className:`flex flex-col gap-2`,children:[(0,K.jsx)(U,{id:`task-comments`,title:`Comments and reviews`,count:e.comments.length}),e.comments.length===0?(0,K.jsx)(G,{title:`No comments or reviews`,children:`Comments and reviews an agent posts on the task's items appear here after the attempt ends`}):(0,K.jsx)(`div`,{className:`-mx-2`,children:(0,K.jsx)(z,{"aria-labelledby":`task-comments`,children:(0,K.jsx)(I,{className:`border-t`,children:e.comments.map(e=>{let i=n.get(e.runId),a=i===void 0?void 0:r.get(i.itemKey),o=Fe(e);return(0,K.jsxs)(L,{className:W,children:[(0,K.jsx)(R,{className:`w-full py-3 whitespace-normal`,children:(0,K.jsxs)(`a`,{"data-row-link":!0,href:e.url,target:`_blank`,rel:`noreferrer`,className:`font-medium ${H}`,children:[ke(e.kind),a!==void 0&&(0,K.jsxs)(`span`,{className:`ml-2 font-mono text-xs font-normal text-muted-foreground`,children:[`on `,V(a)]}),(0,K.jsx)(S,{className:`ml-1.5 inline size-3.5 text-muted-foreground`,"aria-label":`Opens on GitHub`})]})}),(0,K.jsx)(R,{className:`py-3`,children:i!==void 0&&(0,K.jsx)(t,{to:`/projects/$owner/$name/runs/$run`,params:{...P(i.repository),run:i.id},className:`relative z-10 rounded-sm text-muted-foreground underline-offset-4 outline-none hover:text-foreground hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring/70 focus-visible:outline-solid`,children:i.loop})}),(0,K.jsx)(R,{className:`py-3 text-right`,children:o!==null&&(0,K.jsx)(`time`,{dateTime:o.at,title:o.title,className:`font-mono text-xs text-muted-foreground tabular-nums`,children:p(o.at)})})]},e.url)})})})})]})},Le=({task:e,project:t,disabled:n})=>{let r=ue(t),[a]=e.items,o=e.items.find(({itemKey:t})=>t===e.current)??a,s=t.board.lanes.flatMap(e=>e.items.map(t=>({lane:e,card:t}))).find(({card:t})=>t.itemKey===e.current),c=s===void 0?void 0:r.moves.find(({itemKey:e})=>e===s.card.itemKey),l=s===void 0?[]:t.board.lanes.filter(e=>e._tag===`WritableBoardLane`&&e.id!==s.lane.id),u=t.board.lanes.find(({id:e})=>e===c?.toLane)?.name??s?.lane.name??e.lane.name,d=new Set(t.board.lanes.flatMap(e=>e._tag===`WritableBoardLane`?e.labels:[])),f=s===void 0?o.labels:le(s.card,s.lane).filter(e=>c===void 0||!d.has(e)),p=new Map(t.labels.map(e=>[e.name,e])),m=`${y(o.kind).toLowerCase()} #${o.number}`,h=!n&&!r.isPending&&c===void 0&&l.length>0;return(0,K.jsxs)(`header`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-6`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2.5`,children:[(0,K.jsxs)(`a`,{href:a.url,target:`_blank`,rel:`noreferrer`,title:`Open ${y(a.kind).toLowerCase()} #${a.number} on GitHub`,className:`shrink-0 font-mono text-xs text-primary underline-offset-4 hover:underline`,children:[`#`,a.number]}),(0,K.jsx)(`h1`,{className:`text-xl font-semibold text-balance wrap-anywhere`,children:e.title})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 gap-y-1.5 text-sm text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:Oe(o,o.itemKey===a.itemKey)}),(0,K.jsxs)(`span`,{children:[`Lane `,(0,K.jsx)(`span`,{className:`text-foreground`,children:u})]}),c!==void 0&&(0,K.jsx)(`span`,{role:`status`,children:_(c.phase)}),f.length>0&&(0,K.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:f.map(e=>(0,K.jsx)(De,{name:e,label:p.get(e)},e))}),e.needsYou&&(0,K.jsx)(Ee,{})]})]}),s!==void 0&&h&&(0,K.jsxs)(C,{children:[(0,K.jsxs)(T,{render:(0,K.jsx)(i,{variant:`outline`,className:`self-start`}),"aria-label":`Move ${m} to another lane`,children:[`Move to`,(0,K.jsx)(fe,{"data-icon":`inline-end`,"aria-hidden":`true`})]}),(0,K.jsx)(E,{align:`end`,className:`w-auto min-w-40`,children:(0,K.jsx)(D,{children:l.map(e=>(0,K.jsx)(w,{onClick:()=>r.moveItem(s.card,e),children:e.name},e.id))})})]})]}),r.error!==null&&(0,K.jsx)(x,{className:`max-w-3xl`,message:r.error.message})]})},Re=({task:e})=>{let t=e.items.filter(({kind:e})=>e===`pr`);return(0,K.jsxs)(`section`,{"aria-labelledby":`task-pull-requests`,className:`flex flex-col gap-2`,children:[(0,K.jsx)(U,{id:`task-pull-requests`,title:`Pull requests`,count:t.length}),t.length===0?(0,K.jsx)(G,{title:`No pull requests`,children:`Pull requests that close the issue, or that a run on the issue opened, appear here`}):(0,K.jsx)(`div`,{className:`-mx-2`,children:(0,K.jsx)(z,{"aria-labelledby":`task-pull-requests`,children:(0,K.jsx)(I,{className:`border-t`,children:t.map(e=>(0,K.jsxs)(L,{className:W,children:[(0,K.jsxs)(R,{className:`w-0 py-3 font-mono text-xs text-muted-foreground`,children:[`#`,e.number]}),(0,K.jsx)(R,{className:`w-full py-3 whitespace-normal`,children:(0,K.jsxs)(`a`,{"data-row-link":!0,href:e.url,target:`_blank`,rel:`noreferrer`,className:`font-medium wrap-anywhere ${H}`,children:[e.title,(0,K.jsx)(S,{className:`ml-1.5 inline size-3.5 text-muted-foreground`,"aria-label":`Opens on GitHub`})]})}),(0,K.jsx)(R,{className:`py-3 text-right`,children:(0,K.jsxs)(`span`,{className:`inline-flex flex-col items-end gap-0.5 sm:flex-row sm:items-baseline sm:gap-3`,children:[e.conflicting&&(0,K.jsx)(`span`,{className:`text-xs text-destructive`,children:`Conflicts with base`}),(0,K.jsx)(`span`,{children:je(e.state)})]})})]},e.itemKey))})})})]})},ze=2e3,Be=15e3,Ve=(e,t)=>{let{owner:n,name:r}=te(e);return{queryKey:[`overview`,`task`,e,t],queryFn:()=>l(e=>e.task({params:{owner:n,repository:r,item:t}})),refetchInterval:e=>e.state.data?.runs.some(({canCancel:e})=>e)===!0?ze:Be}},q=e(a(),1),He=8,Ue=(e,t)=>`${e} ${t}${e===1?``:`s`}`,J=({url:e})=>(0,K.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`relative z-10 font-mono text-xs text-primary underline-offset-4 hover:underline`,children:b(me(e),{onNone:()=>`Pull request`,onSome:e=>`#${e}`})}),Y=({run:e})=>{let t=oe(3e4);return b(Ae(e,t),{onNone:()=>null,onSome:e=>(0,K.jsx)(`span`,{className:`font-mono text-xs tabular-nums`,title:`Total attempt time`,children:v(e)})})},X=({run:e})=>(0,K.jsx)(`time`,{dateTime:e.openedAt,title:`Opened ${u(e.openedAt)}`,className:`font-mono text-xs whitespace-nowrap tabular-nums`,children:p(e.openedAt)}),Z=({run:e})=>(0,K.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-0.5 text-xs text-muted-foreground xl:hidden`,children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground sm:hidden`,children:e.state}),(0,K.jsx)(`span`,{children:e.agent}),(0,K.jsx)(`span`,{children:Ue(e.attempts.length,`attempt`)}),(0,K.jsx)(Y,{run:e}),(0,K.jsx)(X,{run:e}),e.pullRequestUrl!==null&&(0,K.jsx)(J,{url:e.pullRequestUrl})]}),We=({run:e})=>b(Me(e),{onNone:()=>null,onSome:e=>(0,K.jsxs)(`p`,{className:`line-clamp-2 text-xs wrap-anywhere`,title:m(e),children:[(0,K.jsx)(`span`,{className:`font-medium text-destructive`,children:g(e)}),` `,(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:m(e)})]})}),Ge=e=>e.canApprove?`approve`:e.canRetry&&e.canResolveFailure?`retry`:null,Ke=({run:e,onEdit:t,openRun:n,status:r})=>{let a=k(),s=N(),[c,l]=(0,q.useState)(!1);if(a.isPending&&a.variables!==void 0)return(0,K.jsx)(`span`,{role:`status`,className:`text-xs text-muted-foreground`,children:o[a.variables.request.action]});if(s.isPending)return(0,K.jsx)(`span`,{role:`status`,className:`text-xs text-muted-foreground`,children:f});let u=t=>a.mutate({runId:e.id,request:t},{onSuccess:()=>r(null),onError:e=>r((0,K.jsx)(`span`,{className:`text-destructive`,children:e.message}))}),m=()=>s.mutate(be(e),{onSuccess:e=>{e._tag===`Claimed`?(r(null),n(e.runId)):r((0,K.jsx)(`span`,{className:`text-needs-you`,children:re}))},onError:e=>r((0,K.jsx)(`span`,{className:`text-destructive`,children:e.message}))}),h=e.attempts.at(-1),g=Ge(e),_=h?.outcome?._tag===`Failed`&&h.outcome.failure._tag===`QuestionFailure`,v=[];return e.canApprove&&g!==`approve`&&v.push({label:d.approve,select:()=>u({action:`approve`})}),e.canRetry&&g!==`retry`&&v.push({label:d.retry,select:()=>u({action:`retry`})}),e.canRetry&&v.push({label:`Edit and retry`,select:()=>t(`retry`)}),e.canRunAgain&&(v.push({label:d.runAgain,select:m}),v.push({label:`Edit and run again`,select:()=>t(`runAgain`)})),e.canResolveFailure&&h!==void 0&&v.push({label:_?`Mark answered`:`Mark resolved`,select:()=>u({action:`resolveFailure`,attemptId:h.id})}),e.canCancel&&v.push({label:d.cancel,destructive:!0,select:()=>l(!0)}),(0,K.jsxs)(`div`,{className:`relative z-10 flex items-center justify-end gap-1`,children:[g!==null&&(0,K.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>u({action:g}),children:d[g]}),v.length>0&&(0,K.jsxs)(C,{children:[(0,K.jsx)(T,{render:(0,K.jsx)(i,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground hover:text-foreground aria-expanded:text-foreground`}),"aria-label":`Actions for the ${e.loop} run opened ${p(e.openedAt)}`,children:(0,K.jsx)(ce,{weight:`bold`,className:`size-4`,"aria-hidden":`true`})}),(0,K.jsx)(E,{align:`end`,className:`w-auto min-w-44`,children:(0,K.jsx)(D,{children:v.map(({label:e,destructive:t,select:n})=>(0,K.jsx)(w,{variant:t===!0?`destructive`:`default`,onClick:n,children:e},e))})})]}),e.canCancel&&(0,K.jsx)(j,{open:c,onOpenChange:l,children:(0,K.jsxs)(Se,{children:[(0,K.jsxs)(Ce,{children:[(0,K.jsxs)(_e,{children:[`Cancel `,e.loop,`?`]}),(0,K.jsx)(we,{children:`The run stops, including any attempt in progress.`})]}),(0,K.jsxs)(ye,{children:[(0,K.jsx)(ve,{children:d.keepRunning}),(0,K.jsx)(A,{variant:`destructive`,onClick:()=>{l(!1),u({action:`cancel`})},children:d.confirmCancel})]})]})})]})},qe=({run:e,item:r,openRun:i})=>{let[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(null);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(L,{className:n(W,`[&>td]:align-top`),children:[(0,K.jsx)(R,{className:`hidden py-3 sm:table-cell`,children:(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-foreground`,children:[(0,K.jsx)(B,{state:e.state}),e.state]})}),(0,K.jsx)(R,{className:`w-full py-3 whitespace-normal`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,K.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,K.jsx)(B,{state:e.state,className:`self-center sm:hidden`}),(0,K.jsx)(t,{"data-row-link":!0,to:`/projects/$owner/$name/runs/$run`,params:{...P(e.repository),run:e.id},className:n(`font-medium wrap-anywhere`,H),children:e.loop}),r!==null&&(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:V(r)})]}),(0,K.jsx)(We,{run:e}),e.runAgain!==null&&(0,K.jsx)(Pe,{run:e,source:`link`,className:`text-xs`}),e.approval!==null&&(0,K.jsx)(Ne,{approval:e.approval,className:`text-xs`}),(0,K.jsx)(Z,{run:e}),s!==null&&(0,K.jsx)(`p`,{role:`status`,className:`text-xs`,children:s})]})}),(0,K.jsx)(R,{className:`hidden py-3 xl:table-cell`,children:e.agent}),(0,K.jsx)(R,{className:`hidden py-3 text-right tabular-nums xl:table-cell`,children:e.attempts.length}),(0,K.jsx)(R,{className:`hidden py-3 text-right xl:table-cell`,children:(0,K.jsx)(Y,{run:e})}),(0,K.jsx)(R,{className:`hidden py-3 xl:table-cell`,children:(0,K.jsx)(X,{run:e})}),(0,K.jsx)(R,{className:`hidden py-3 xl:table-cell`,children:e.pullRequestUrl!==null&&(0,K.jsx)(J,{url:e.pullRequestUrl})}),(0,K.jsx)(R,{className:`py-2.5`,children:(0,K.jsx)(Ke,{run:e,onEdit:o,openRun:i,status:c})})]}),a!==null&&pe(e,a)&&(0,K.jsx)(L,{className:`hover:bg-transparent`,children:(0,K.jsx)(R,{colSpan:He,className:`px-2 pt-1 pb-4 whitespace-normal`,children:(0,K.jsx)(de,{run:e,intent:a,close:()=>o(null),openRun:i,className:`max-w-2xl rounded-lg border p-4`},`${e.id}:${a}`)})})]})},Je=({task:e,openRun:t})=>{let n=new Map(e.items.map(e=>[e.itemKey,e])),r=e.items.length>1;return(0,K.jsxs)(`section`,{"aria-labelledby":`task-runs`,className:`flex flex-col gap-2`,children:[(0,K.jsx)(U,{id:`task-runs`,title:`Runs`,count:e.runs.length}),e.runs.length===0?(0,K.jsx)(G,{title:`No runs yet`,children:`A run opens when a loop's trigger matches one of the task's items`}):(0,K.jsx)(`div`,{className:`-mx-2`,children:(0,K.jsxs)(z,{children:[(0,K.jsx)(Te,{children:(0,K.jsxs)(L,{className:`hover:bg-transparent`,children:[(0,K.jsx)(F,{className:`hidden sm:table-cell`,children:`State`}),(0,K.jsx)(F,{children:`Run`}),(0,K.jsx)(F,{className:`hidden xl:table-cell`,children:`Agent`}),(0,K.jsx)(F,{className:`hidden text-right xl:table-cell`,children:`Attempts`}),(0,K.jsx)(F,{className:`hidden text-right xl:table-cell`,children:`Duration`}),(0,K.jsx)(F,{className:`hidden xl:table-cell`,children:`Opened`}),(0,K.jsx)(F,{className:`hidden xl:table-cell`,children:`Pull request`}),(0,K.jsx)(F,{children:(0,K.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,K.jsx)(I,{children:e.runs.map(e=>(0,K.jsx)(qe,{run:e,item:r?n.get(e.itemKey)??null:null,openRun:t},e.id))})]})})]})},Ye=ie(h.pipe(s(ne))),Q=({repository:e,number:n})=>(0,K.jsx)(he,{title:`Task not found`,description:`#${n} is not among the newest items on the ${e} board`,tone:`error`,inPanel:!0,children:(0,K.jsx)(i,{variant:`outline`,nativeButton:!1,render:(0,K.jsx)(t,{to:`/projects/$owner/$name`,params:P(e)}),children:`Back to the board`})}),Xe=()=>(0,K.jsxs)(`div`,{"aria-busy":`true`,"aria-label":`Loading the task`,className:`flex flex-col gap-8`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,K.jsx)(O,{className:`h-7 w-2/3 max-w-xl`}),(0,K.jsx)(O,{className:`h-4 w-1/2 max-w-sm`})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsx)(O,{className:`h-6 w-24`}),[0,1,2].map(e=>(0,K.jsx)(O,{className:`h-10 w-full`},e))]})]}),$=({children:e})=>(0,K.jsx)(`main`,{className:`px-4 pt-5 pb-10 md:px-5`,children:(0,K.jsx)(`div`,{className:`flex max-w-5xl flex-col gap-8`,children:e})}),Ze=({repository:e,number:t})=>{let{data:n}=ee(ge()),r=n.projects.find(t=>t.repository===e),i=M(),a=ae(Ve(e,t));if(a.error instanceof c&&a.error.error===`BoardItemNotFoundError`)return(0,K.jsx)(Q,{repository:e,number:String(t)});let o=a.isError&&(0,K.jsx)(x,{className:`max-w-3xl`,title:a.data===void 0?`Could not load the task`:`Could not refresh the task`,message:a.error.message}),s=a.data;return s===void 0?(0,K.jsx)($,{children:o===!1?(0,K.jsx)(Xe,{}):o}):s.number===t?(0,K.jsxs)($,{children:[o,r!==void 0&&(0,K.jsx)(Le,{task:s,project:r,disabled:n._tag===`NeedsSetup`}),(0,K.jsx)(Je,{task:s,openRun:i}),(0,K.jsx)(Re,{task:s}),(0,K.jsx)(Ie,{task:s})]}):(0,K.jsx)(se,{to:`/projects/$owner/$name/tasks/$number`,params:{...P(e),number:String(s.number)},search:e=>e,replace:!0})},Qe=({repository:e,number:t})=>b(Ye(t),{onNone:()=>(0,K.jsx)(Q,{repository:e,number:t}),onSome:t=>(0,K.jsx)(Ze,{repository:e,number:t})}),$e=()=>{let{repository:e,number:t}=xe.useParams();return(0,K.jsx)(Qe,{repository:e,number:t},`${e}#${t}`)};export{$e as component};
|