@codeworksh/cli 0.8.0 → 0.9.0-canary.158.1.gdff28d0d
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/{acp-DodCRypZ.mjs → acp-D1X6PAQd.mjs} +16 -11
- package/acp-D1X6PAQd.mjs.map +1 -0
- package/{add-Dgy0iTEQ.mjs → add-BO0TXkKX.mjs} +8 -7
- package/add-BO0TXkKX.mjs.map +1 -0
- package/{add-31QB-o0_.mjs → add-BwC5Yb3Z.mjs} +5 -5
- package/add-BwC5Yb3Z.mjs.map +1 -0
- package/{catalog-XfqtqMDz.mjs → catalog-BhnZFkoq.mjs} +2 -2
- package/{catalog-XfqtqMDz.mjs.map → catalog-BhnZFkoq.mjs.map} +1 -1
- package/{check-BoANDJxT.mjs → check-n2oLWYrZ.mjs} +4 -4
- package/check-n2oLWYrZ.mjs.map +1 -0
- package/connect-CO-oR-Br.mjs +35 -0
- package/connect-CO-oR-Br.mjs.map +1 -0
- package/{control-CQxWGS4k.mjs → control-Clr9Xyw9.mjs} +10 -9
- package/control-Clr9Xyw9.mjs.map +1 -0
- package/devices-aPlpoGGA.mjs +29 -0
- package/devices-aPlpoGGA.mjs.map +1 -0
- package/disconnect-B7HoGP0E.mjs +21 -0
- package/disconnect-B7HoGP0E.mjs.map +1 -0
- package/disconnect-gKR8hsnU.mjs +2 -0
- package/{service-CjOS-xCw.mjs → discovery-D07MPnKd.mjs} +13 -37
- package/discovery-D07MPnKd.mjs.map +1 -0
- package/{entries-DpL4xhu0.mjs → entries-BzfySpSJ.mjs} +3 -3
- package/{entries-DpL4xhu0.mjs.map → entries-BzfySpSJ.mjs.map} +1 -1
- package/{error-CPyvkO4x.mjs → error-ippxl2z7.mjs} +775 -31
- package/error-ippxl2z7.mjs.map +1 -0
- package/{fork-CjZteIbk.mjs → fork-lbhh_6QP.mjs} +8 -7
- package/fork-lbhh_6QP.mjs.map +1 -0
- package/identity-DbK4fABs.mjs +26 -0
- package/identity-DbK4fABs.mjs.map +1 -0
- package/{thread-I6vNdC0y.mjs → ids-cNIRx0-c.mjs} +11 -5
- package/ids-cNIRx0-c.mjs.map +1 -0
- package/index.mjs +39 -34
- package/index.mjs.map +1 -1
- package/{install-BUfEBtrj.mjs → install-dfD5hzCS.mjs} +4 -4
- package/install-dfD5hzCS.mjs.map +1 -0
- package/jsonc-CWL4-4yz.mjs +33 -0
- package/jsonc-CWL4-4yz.mjs.map +1 -0
- package/{link-ZuzWj9qt.mjs → link-D1cicwAl.mjs} +8 -6
- package/link-D1cicwAl.mjs.map +1 -0
- package/{list-DDuzyNv0.mjs → list-BKJgNMJm.mjs} +10 -12
- package/list-BKJgNMJm.mjs.map +1 -0
- package/{list-6QTwXTKO.mjs → list-C3McEC0O.mjs} +4 -4
- package/list-C3McEC0O.mjs.map +1 -0
- package/{list-DPbF2uMB.mjs → list-CGT6jT-r.mjs} +4 -4
- package/list-CGT6jT-r.mjs.map +1 -0
- package/{list-BnIIcMI3.mjs → list-DZK016LF.mjs} +4 -4
- package/list-DZK016LF.mjs.map +1 -0
- package/{login-BtuROCPJ.mjs → login-DuFDeGH-.mjs} +4 -4
- package/login-DuFDeGH-.mjs.map +1 -0
- package/{login-CGXU21AK.mjs → login-XhIIF5Yu.mjs} +4 -4
- package/login-XhIIF5Yu.mjs.map +1 -0
- package/{logout-DUn8KSjX.mjs → logout-CA1No9_2.mjs} +4 -4
- package/logout-CA1No9_2.mjs.map +1 -0
- package/{logout-Bnk2hxfZ.mjs → logout-Dpqw8tQZ.mjs} +4 -4
- package/logout-Dpqw8tQZ.mjs.map +1 -0
- package/package-DgfSc9nY.mjs +6 -0
- package/package-DgfSc9nY.mjs.map +1 -0
- package/package.json +3 -3
- package/pair-BC8a_KYX.mjs +15 -0
- package/pair-BC8a_KYX.mjs.map +1 -0
- package/{providers-GEdlDJHp.mjs → providers--giKGohM.mjs} +4 -4
- package/providers--giKGohM.mjs.map +1 -0
- package/reconnect-I9-Do_DK.mjs +2 -0
- package/{refresh-DGJW3rSp.mjs → refresh-BIH3qn5A.mjs} +4 -4
- package/refresh-BIH3qn5A.mjs.map +1 -0
- package/{refresh-93t2pSpb.mjs → refresh-Dg8WvRcq.mjs} +4 -4
- package/refresh-Dg8WvRcq.mjs.map +1 -0
- package/{identity-LhURGrcS.mjs → registration-C6yiv31r.mjs} +27 -25
- package/registration-C6yiv31r.mjs.map +1 -0
- package/relay-CLPWErNw.mjs +319 -0
- package/relay-CLPWErNw.mjs.map +1 -0
- package/{relink-Djy5t7D2.mjs → relink-D8Koos_q.mjs} +9 -7
- package/relink-D8Koos_q.mjs.map +1 -0
- package/{reload-Dm464rPC.mjs → reload-C5-B0s9x.mjs} +6 -5
- package/{reload-Dm464rPC.mjs.map → reload-C5-B0s9x.mjs.map} +1 -1
- package/{remove-DBT19X2j.mjs → remove-6m5n17il.mjs} +4 -4
- package/remove-6m5n17il.mjs.map +1 -0
- package/{remove-f7C_vEOD.mjs → remove-VZO51J2m.mjs} +5 -5
- package/remove-VZO51J2m.mjs.map +1 -0
- package/{restart-DXMDjblc.mjs → restart-4NoPj76N.mjs} +5 -4
- package/restart-4NoPj76N.mjs.map +1 -0
- package/revoke-Gu5N3Vzy.mjs +13 -0
- package/revoke-Gu5N3Vzy.mjs.map +1 -0
- package/{run-CTFksYXE.mjs → run-RHrJN2Pv.mjs} +12 -14
- package/run-RHrJN2Pv.mjs.map +1 -0
- package/{runtime-CK2CunDw.mjs → runtime-CtLWuLd-.mjs} +48 -12
- package/runtime-CtLWuLd-.mjs.map +1 -0
- package/{serve-BntJRQed.mjs → serve-BZ5FAU3h.mjs} +586 -64
- package/serve-BZ5FAU3h.mjs.map +1 -0
- package/service-CRnqz89w.mjs +79 -0
- package/service-CRnqz89w.mjs.map +1 -0
- package/{settings-DasbTMFs.mjs → settings-DU140UBM.mjs} +3 -3
- package/settings-DU140UBM.mjs.map +1 -0
- package/{shared-CDyNsYBy.mjs → shared-CC4WukJX.mjs} +4 -4
- package/shared-CC4WukJX.mjs.map +1 -0
- package/{shared-CiSbTY59.mjs → shared-Dzwbs5Lk.mjs} +7 -9
- package/shared-Dzwbs5Lk.mjs.map +1 -0
- package/{start-CTYwK1Z4.mjs → start-COhahq2E.mjs} +5 -4
- package/start-COhahq2E.mjs.map +1 -0
- package/{status-CPKssQFk.mjs → status-Cau7bzuQ.mjs} +5 -4
- package/status-Cau7bzuQ.mjs.map +1 -0
- package/{status-CHcJyF_7.mjs → status-DJJOuCzL.mjs} +4 -4
- package/status-DJJOuCzL.mjs.map +1 -0
- package/{stop-CpQr3fUv.mjs → stop-CC--mxXp.mjs} +5 -4
- package/stop-CC--mxXp.mjs.map +1 -0
- package/{update-C3llbIB0.mjs → update-DMQLgDm3.mjs} +4 -4
- package/update-DMQLgDm3.mjs.map +1 -0
- package/acp-DodCRypZ.mjs.map +0 -1
- package/add-31QB-o0_.mjs.map +0 -1
- package/add-Dgy0iTEQ.mjs.map +0 -1
- package/check-BoANDJxT.mjs.map +0 -1
- package/control-CQxWGS4k.mjs.map +0 -1
- package/disconnect-BiLuV4JZ.mjs +0 -2
- package/error-CPyvkO4x.mjs.map +0 -1
- package/fork-CjZteIbk.mjs.map +0 -1
- package/identity-LhURGrcS.mjs.map +0 -1
- package/install-BUfEBtrj.mjs.map +0 -1
- package/jsonc-Ca0uQLm-.mjs +0 -58
- package/jsonc-Ca0uQLm-.mjs.map +0 -1
- package/link-ZuzWj9qt.mjs.map +0 -1
- package/list-6QTwXTKO.mjs.map +0 -1
- package/list-BnIIcMI3.mjs.map +0 -1
- package/list-DDuzyNv0.mjs.map +0 -1
- package/list-DPbF2uMB.mjs.map +0 -1
- package/login-BtuROCPJ.mjs.map +0 -1
- package/login-CGXU21AK.mjs.map +0 -1
- package/logout-Bnk2hxfZ.mjs.map +0 -1
- package/logout-DUn8KSjX.mjs.map +0 -1
- package/package-C5s94xPy.mjs +0 -6
- package/package-C5s94xPy.mjs.map +0 -1
- package/providers-GEdlDJHp.mjs.map +0 -1
- package/reconnect-ChE5ETwx.mjs +0 -2
- package/refresh-93t2pSpb.mjs.map +0 -1
- package/refresh-DGJW3rSp.mjs.map +0 -1
- package/relink-Djy5t7D2.mjs.map +0 -1
- package/remove-DBT19X2j.mjs.map +0 -1
- package/remove-f7C_vEOD.mjs.map +0 -1
- package/restart-DXMDjblc.mjs.map +0 -1
- package/run-CTFksYXE.mjs.map +0 -1
- package/runtime-CK2CunDw.mjs.map +0 -1
- package/serve-BntJRQed.mjs.map +0 -1
- package/service-CjOS-xCw.mjs.map +0 -1
- package/settings-DasbTMFs.mjs.map +0 -1
- package/shared-CDyNsYBy.mjs.map +0 -1
- package/shared-CiSbTY59.mjs.map +0 -1
- package/start-CTYwK1Z4.mjs.map +0 -1
- package/status-CHcJyF_7.mjs.map +0 -1
- package/status-CPKssQFk.mjs.map +0 -1
- package/stop-CpQr3fUv.mjs.map +0 -1
- package/thread-I6vNdC0y.mjs.map +0 -1
- package/update-C3llbIB0.mjs.map +0 -1
|
@@ -1,28 +1,41 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import {
|
|
1
|
+
import { $ as sign, A as decode, B as ticketsPath, C as Current, D as Unauthorized, E as Token, F as Exchange, I as Proof, J as fingerprint, L as Signed, M as Core, N as encode, O as layerToken, P as ofThread, Q as publicOf, R as devicesPath, S as path, T as Forbidden, V as ConnectError, X as peek, Z as peekClaims, at as make$3, b as OAuthError, et as thumbprint, f as writeError, i as renderError, it as layer$8, j as Connected, k as local, nt as encrypted, ot as matches, q as PublicKey, rt as peer, t as InvalidInputError, tt as verify, v as Api, w as Door, y as HostError, z as proofWindow } from "./error-ippxl2z7.mjs";
|
|
2
|
+
import { i as Cmd, t as handler } from "./runtime-CtLWuLd-.mjs";
|
|
3
3
|
import { t as harnessOptions } from "./harness-6d8TlAVk.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { a as register, o as write, r as log } from "./registration-C6yiv31r.mjs";
|
|
5
|
+
import { i as layer$9, t as Service$5 } from "./identity-DbK4fABs.mjs";
|
|
6
|
+
import { a as rename, c as read, i as heartbeat, n as connect, o as status, r as disconnect, s as identity, t as Client } from "./relay-CLPWErNw.mjs";
|
|
7
|
+
import { Cause, Clock, Config, Context, Data, DateTime, Deferred, Duration, Effect, Exit, Fiber, FileSystem, Layer, Logger, Option, Path, Predicate, PubSub, Queue, Ref, Schedule, Schema, Scope, Semaphore, Stream } from "effect";
|
|
6
8
|
import { Model } from "@codeworksh/aikit";
|
|
7
|
-
import { HttpRouter, HttpServer } from "effect/http";
|
|
8
|
-
import { Control, Event, EventList, EventRegistry, EventSchema, Git, Global, Harness, Mcp, ModelCatalog, Project, PromptSchema, Sandbox, Session, SessionStore, Settings, State, Store, Sync, ThreadSchema, ThreadStore, expandTilde } from "@codeworksh/harness/effect";
|
|
9
|
-
import
|
|
9
|
+
import { Headers, HttpRouter, HttpServer, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
10
|
+
import { Control, DaemonHost, Event, EventList, EventRegistry, EventSchema, Git, Global, Harness, Mcp, McpConfig, ModelCatalog, Project, PromptSchema, Sandbox, Session, SessionStore, Settings, SettingsFile, State, Store, Sync, ThreadSchema, ThreadStore, expandTilde } from "@codeworksh/harness/effect";
|
|
11
|
+
import * as NetAddress from "effect/net/NetAddress";
|
|
12
|
+
import { NodeHttpServer, NodeServices } from "@effect/platform-node";
|
|
10
13
|
import { RpcSerialization, RpcServer } from "effect/rpc";
|
|
11
14
|
import { summarizeGitHubCopilot, summarizeOpenAICodex } from "@codeworksh/aikit/oauth/summary";
|
|
12
15
|
import { GitHubCopilotOAuthClient, JsonGitHubCopilotAuthStorage } from "@codeworksh/aikit/oauth/github/copilot";
|
|
13
16
|
import { JsonOpenAICodexAuthStorage, OpenAICodexOAuthClient } from "@codeworksh/aikit/oauth/openai/codex";
|
|
14
|
-
import
|
|
15
|
-
import { createServer } from "node:http";
|
|
17
|
+
import { homedir } from "node:os";
|
|
16
18
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
19
|
+
import { createServer } from "node:http";
|
|
17
20
|
import { readdir } from "node:fs/promises";
|
|
18
|
-
|
|
21
|
+
//#region src/machine/heartbeat.ts
|
|
22
|
+
/**
|
|
23
|
+
* While the server runs, each connected workspace hears from this machine every 30 seconds; the relay
|
|
24
|
+
* shows it online for 90. `machine.json` is read on every beat, so a `codework connect` made while the
|
|
25
|
+
* server runs is picked up without a restart. Nothing here is fatal: local work never waits on the relay.
|
|
26
|
+
*/
|
|
27
|
+
const layer$7 = Layer.effectDiscard(Effect.gen(function* () {
|
|
28
|
+
const global = yield* Global.Service;
|
|
29
|
+
yield* heartbeat(global.home).pipe(Effect.catch((error) => Effect.logDebug("Machine heartbeat failed", error)), Effect.repeat(Schedule.spaced("30 seconds")), Effect.forkScoped);
|
|
30
|
+
}));
|
|
31
|
+
//#endregion
|
|
19
32
|
//#region src/server/clones.ts
|
|
20
33
|
/**
|
|
21
34
|
* Background clones into host folders. Each is tracked by its destination from start until 30 seconds
|
|
22
35
|
* after it is done (a failed or cancelled one stays until retried or discarded), and git's progress
|
|
23
36
|
* is streamed as it arrives. Tracking is in memory: a restart forgets every clone.
|
|
24
37
|
*/
|
|
25
|
-
var Service$
|
|
38
|
+
var Service$4 = class extends Context.Service()("@codeworksh/cli/server/clones/Service") {};
|
|
26
39
|
const DONE_RETENTION = "30 seconds";
|
|
27
40
|
const STALL_AFTER = "20 seconds";
|
|
28
41
|
const DETAIL_MAX = 200;
|
|
@@ -511,7 +524,7 @@ const make$2 = Effect.gen(function* () {
|
|
|
511
524
|
bufferSize: 1,
|
|
512
525
|
strategy: "sliding"
|
|
513
526
|
});
|
|
514
|
-
return Service$
|
|
527
|
+
return Service$4.of({
|
|
515
528
|
start: (input) => locked(start(input)),
|
|
516
529
|
cancel: (path) => locked(cancel(path)),
|
|
517
530
|
retry: (path) => locked(retry(path)),
|
|
@@ -520,7 +533,310 @@ const make$2 = Effect.gen(function* () {
|
|
|
520
533
|
stream
|
|
521
534
|
});
|
|
522
535
|
});
|
|
523
|
-
const layer$
|
|
536
|
+
const layer$6 = Layer.effect(Service$4, make$2);
|
|
537
|
+
//#endregion
|
|
538
|
+
//#region src/server/pairing.ts
|
|
539
|
+
/**
|
|
540
|
+
* How another computer becomes a device of this machine, as a key pairs over SSH. A person reads it a
|
|
541
|
+
* pairing code from `codework service pair`, which it exchanges at `POST /api/v1/devices` with its public
|
|
542
|
+
* key, and gets back this machine's identity key. For each socket it opens it then signs a proof with its
|
|
543
|
+
* key at `POST /api/v1/tickets`, and gets back a ticket signed with the identity key, which it offers where
|
|
544
|
+
* a local client offers the home's token. Codes, tickets and spent nonces live in memory; devices persist in
|
|
545
|
+
* `<home>/devices.json`: each one's public key, and whether its last request came over TLS.
|
|
546
|
+
*/
|
|
547
|
+
const codeLife = Duration.toMillis("10 minutes");
|
|
548
|
+
const ticketLife = Duration.toMillis("60 seconds");
|
|
549
|
+
/** How long a device may go without taking a ticket before it is refused. */
|
|
550
|
+
const idleLife = Duration.toMillis("30 days");
|
|
551
|
+
/** Crockford's base32: no I, L, O or U, so a code read aloud is typed back right. */
|
|
552
|
+
const alphabet = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
553
|
+
/** `length` random base32 characters, each from a byte's low 5 bits, so each is uniform. */
|
|
554
|
+
const random = (length) => Effect.sync(() => Array.from(crypto.getRandomValues(new Uint8Array(length)), (byte) => alphabet.charAt(byte & 31)).join(""));
|
|
555
|
+
/** A code as a person may type it back: any case, with or without its dash, I and L for 1, O for 0. */
|
|
556
|
+
const normalize = (code) => code.toUpperCase().replace(/[\s-]/g, "").replace(/[IL]/g, "1").replace(/O/g, "0");
|
|
557
|
+
const Device = Schema.Struct({
|
|
558
|
+
id: Schema.String,
|
|
559
|
+
label: Schema.String,
|
|
560
|
+
key: PublicKey,
|
|
561
|
+
createdAt: Schema.Finite,
|
|
562
|
+
seenAt: Schema.Finite,
|
|
563
|
+
encrypted: Schema.optional(Schema.Boolean)
|
|
564
|
+
});
|
|
565
|
+
const devicesJson = Schema.fromJsonString(Schema.Array(Device));
|
|
566
|
+
const isDevice = Schema.is(Device);
|
|
567
|
+
const decodeProof = Schema.decodeUnknownEffect(Proof);
|
|
568
|
+
/** The nonce a refusal echoes, read from a proof it never trusts, so only one a proof could carry. */
|
|
569
|
+
const decodeNonce = Schema.decodeUnknownEffect(Schema.Struct({ nonce: Schema.String.check(Schema.isMaxLength(64), Schema.isPattern(/^[A-Za-z0-9_-]+$/)) }));
|
|
570
|
+
/** `<home>/devices.json`: written by its server alone. */
|
|
571
|
+
const file = (home) => `${home}/devices.json`;
|
|
572
|
+
/** One-time secrets held until used or expired; each is taken at most once. */
|
|
573
|
+
const passes = () => {
|
|
574
|
+
let held = [];
|
|
575
|
+
return {
|
|
576
|
+
issue: (secret, expiresAt, value) => {
|
|
577
|
+
held = [...held, {
|
|
578
|
+
secret,
|
|
579
|
+
expiresAt,
|
|
580
|
+
value
|
|
581
|
+
}];
|
|
582
|
+
},
|
|
583
|
+
take: (given, now) => {
|
|
584
|
+
held = held.filter((pass) => pass.expiresAt > now);
|
|
585
|
+
const found = held.find((pass) => matches(given, pass.secret));
|
|
586
|
+
held = held.filter((pass) => pass !== found);
|
|
587
|
+
return found?.value;
|
|
588
|
+
},
|
|
589
|
+
drop: (value) => {
|
|
590
|
+
held = held.filter((pass) => pass.value !== value);
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
};
|
|
594
|
+
var Service$3 = class extends Context.Service()("@codeworksh/cli/server/pairing/Service") {};
|
|
595
|
+
const layer$5 = Layer.effect(Service$3, Effect.gen(function* () {
|
|
596
|
+
const fs = yield* FileSystem.FileSystem;
|
|
597
|
+
const files = yield* Effect.context();
|
|
598
|
+
const home = (yield* Global.Service).home;
|
|
599
|
+
const path = file(home);
|
|
600
|
+
const stored = (yield* fs.exists(path)) ? yield* fs.readFileString(path).pipe(Effect.flatMap(Schema.decodeEffect(Schema.fromJsonString(Schema.Array(Schema.Unknown)))), Effect.catch(() => Effect.die(`${path} is not a valid devices file`))) : [];
|
|
601
|
+
let devices = stored.filter(isDevice);
|
|
602
|
+
if (devices.length < stored.length) yield* Effect.logWarning(`${path}: ${stored.length - devices.length} device(s) must pair again`);
|
|
603
|
+
const codes = passes();
|
|
604
|
+
const tickets = passes();
|
|
605
|
+
/** Each proof's nonce, until its proof is past the window. */
|
|
606
|
+
const nonces = /* @__PURE__ */ new Map();
|
|
607
|
+
const lock = yield* Semaphore.make(1);
|
|
608
|
+
const save = (next) => Effect.gen(function* () {
|
|
609
|
+
yield* write(path, yield* Schema.encodeEffect(devicesJson)(next));
|
|
610
|
+
devices = next;
|
|
611
|
+
}).pipe(Effect.provideContext(files), Effect.orDie);
|
|
612
|
+
const identity$1 = identity(home).pipe(Effect.provideContext(files), Effect.orDie);
|
|
613
|
+
const fingerprint$1 = (key) => fingerprint(key).pipe(Effect.orDie);
|
|
614
|
+
/**
|
|
615
|
+
* The device a proof is good for, by id: signed by the key of the device it names, inside the window,
|
|
616
|
+
* its nonce unseen and now spent. Checked outside the lock, so a flood of bad proofs holds up no write.
|
|
617
|
+
*/
|
|
618
|
+
const proven = Effect.fnUntraced(function* (proof, now) {
|
|
619
|
+
const { kid } = yield* peek(proof);
|
|
620
|
+
const holders = yield* Effect.filter(devices, (device) => Effect.map(thumbprint(device.key), (thumbprint) => thumbprint === kid));
|
|
621
|
+
const [holder] = holders;
|
|
622
|
+
if (holder === void 0) return void 0;
|
|
623
|
+
const claims = yield* verify(proof, holder.key).pipe(Effect.flatMap(decodeProof));
|
|
624
|
+
const device = holders.find((each) => each.id === claims.device);
|
|
625
|
+
if (device === void 0 || claims.aud !== (yield* identity$1).keyId) return void 0;
|
|
626
|
+
if (Math.abs(now - claims.iat) > 3e5) return void 0;
|
|
627
|
+
for (const [nonce, until] of nonces) if (until < now) nonces.delete(nonce);
|
|
628
|
+
if (nonces.has(claims.nonce)) return void 0;
|
|
629
|
+
nonces.set(claims.nonce, claims.iat + proofWindow);
|
|
630
|
+
return {
|
|
631
|
+
id: device.id,
|
|
632
|
+
nonce: claims.nonce
|
|
633
|
+
};
|
|
634
|
+
}, Effect.orElseSucceed(() => void 0));
|
|
635
|
+
return Service$3.of({
|
|
636
|
+
code: Effect.gen(function* () {
|
|
637
|
+
const code = yield* random(10);
|
|
638
|
+
const expiresAt = (yield* Clock.currentTimeMillis) + codeLife;
|
|
639
|
+
const key = publicOf((yield* identity$1).key);
|
|
640
|
+
codes.issue(code, expiresAt, true);
|
|
641
|
+
return {
|
|
642
|
+
code: `${code.slice(0, 5)}-${code.slice(5)}`,
|
|
643
|
+
expiresAt,
|
|
644
|
+
fingerprint: yield* fingerprint$1(key)
|
|
645
|
+
};
|
|
646
|
+
}),
|
|
647
|
+
exchange: (code, label, key, encrypted) => Effect.gen(function* () {
|
|
648
|
+
const now = yield* Clock.currentTimeMillis;
|
|
649
|
+
if (codes.take(normalize(code), now) === void 0) return void 0;
|
|
650
|
+
const machine = publicOf((yield* identity$1).key);
|
|
651
|
+
const device = {
|
|
652
|
+
id: `dev_${(yield* random(10)).toLowerCase()}`,
|
|
653
|
+
label,
|
|
654
|
+
key,
|
|
655
|
+
createdAt: now,
|
|
656
|
+
seenAt: now,
|
|
657
|
+
encrypted
|
|
658
|
+
};
|
|
659
|
+
yield* lock.withPermit(Effect.suspend(() => save([...devices, device])));
|
|
660
|
+
return {
|
|
661
|
+
id: device.id,
|
|
662
|
+
machine
|
|
663
|
+
};
|
|
664
|
+
}),
|
|
665
|
+
ticket: (proof, encrypted) => Effect.gen(function* () {
|
|
666
|
+
const refuse = Effect.gen(function* () {
|
|
667
|
+
const echoed = yield* peekClaims(proof).pipe(Effect.flatMap(decodeNonce), Effect.option);
|
|
668
|
+
if (Option.isNone(echoed)) return { _tag: "Refused" };
|
|
669
|
+
const { key, keyId } = yield* identity$1;
|
|
670
|
+
const refusal = {
|
|
671
|
+
op: "ticket.refuse",
|
|
672
|
+
nonce: echoed.value.nonce,
|
|
673
|
+
at: yield* Clock.currentTimeMillis
|
|
674
|
+
};
|
|
675
|
+
return {
|
|
676
|
+
_tag: "Refused",
|
|
677
|
+
jws: yield* sign(refusal, key, { kid: keyId }).pipe(Effect.orDie)
|
|
678
|
+
};
|
|
679
|
+
});
|
|
680
|
+
const proved = yield* proven(proof, yield* Clock.currentTimeMillis);
|
|
681
|
+
if (proved === void 0) return yield* refuse;
|
|
682
|
+
const ticket = yield* lock.withPermit(Effect.gen(function* () {
|
|
683
|
+
const now = yield* Clock.currentTimeMillis;
|
|
684
|
+
const device = devices.find((each) => each.id === proved.id);
|
|
685
|
+
if (device === void 0 || now - device.seenAt > idleLife) return void 0;
|
|
686
|
+
yield* save(devices.map((each) => each === device ? {
|
|
687
|
+
...device,
|
|
688
|
+
seenAt: now,
|
|
689
|
+
encrypted
|
|
690
|
+
} : each));
|
|
691
|
+
const ticket = yield* make$3;
|
|
692
|
+
tickets.issue(ticket, now + ticketLife, device.id);
|
|
693
|
+
return ticket;
|
|
694
|
+
}));
|
|
695
|
+
if (ticket === void 0) return yield* refuse;
|
|
696
|
+
const { key, keyId } = yield* identity$1;
|
|
697
|
+
const grant = {
|
|
698
|
+
op: "ticket.grant",
|
|
699
|
+
ticket,
|
|
700
|
+
nonce: proved.nonce
|
|
701
|
+
};
|
|
702
|
+
return {
|
|
703
|
+
_tag: "Granted",
|
|
704
|
+
jws: yield* sign(grant, key, { kid: keyId }).pipe(Effect.orDie)
|
|
705
|
+
};
|
|
706
|
+
}),
|
|
707
|
+
redeem: (ticket) => Effect.map(Clock.currentTimeMillis, (now) => {
|
|
708
|
+
const id = tickets.take(ticket, now);
|
|
709
|
+
return devices.some((device) => device.id === id) ? id : void 0;
|
|
710
|
+
}),
|
|
711
|
+
list: Effect.suspend(() => Effect.forEach(devices, ({ id, label, key, createdAt, seenAt, encrypted }) => Effect.map(fingerprint$1(key), (fingerprint) => ({
|
|
712
|
+
id,
|
|
713
|
+
label,
|
|
714
|
+
fingerprint,
|
|
715
|
+
createdAt,
|
|
716
|
+
seenAt,
|
|
717
|
+
...encrypted === void 0 ? {} : { encrypted }
|
|
718
|
+
})))),
|
|
719
|
+
revoke: (id) => lock.withPermit(Effect.gen(function* () {
|
|
720
|
+
if (!devices.some((device) => device.id === id)) return false;
|
|
721
|
+
yield* save(devices.filter((device) => device.id !== id));
|
|
722
|
+
tickets.drop(id);
|
|
723
|
+
return true;
|
|
724
|
+
}))
|
|
725
|
+
});
|
|
726
|
+
})).pipe(Layer.provide(NodeServices.layer));
|
|
727
|
+
const refused = HttpServerResponse.empty({ status: 401 });
|
|
728
|
+
/** The peers besides loopback whose `X-Forwarded-Proto` the pairing routes believe. */
|
|
729
|
+
const TrustedProxy = Context.Reference("@codeworksh/cli/server/pairing/TrustedProxy", { defaultValue: () => [] });
|
|
730
|
+
/** The routes {@link routes} serves, which take no socket credential. */
|
|
731
|
+
const paths = [devicesPath, ticketsPath];
|
|
732
|
+
/** The pairing routes of the shared wire contract. */
|
|
733
|
+
const routes = HttpRouter.use((router) => Effect.gen(function* () {
|
|
734
|
+
const pairing = yield* Service$3;
|
|
735
|
+
const trusted = yield* TrustedProxy;
|
|
736
|
+
yield* router.add("POST", devicesPath, Effect.gen(function* () {
|
|
737
|
+
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
738
|
+
const body = yield* HttpServerRequest.schemaBodyJson(Exchange).pipe(Effect.option);
|
|
739
|
+
if (body._tag === "None") return HttpServerResponse.empty({ status: 400 });
|
|
740
|
+
const device = yield* pairing.exchange(body.value.code, body.value.label, body.value.key, encrypted(request, trusted));
|
|
741
|
+
return device === void 0 ? refused : HttpServerResponse.jsonUnsafe(device, { status: 201 });
|
|
742
|
+
}));
|
|
743
|
+
yield* router.add("POST", ticketsPath, Effect.gen(function* () {
|
|
744
|
+
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
745
|
+
const body = yield* HttpServerRequest.schemaBodyJson(Signed).pipe(Effect.option);
|
|
746
|
+
if (Option.isNone(body)) return refused;
|
|
747
|
+
const answer = yield* pairing.ticket(body.value.jws, encrypted(request, trusted));
|
|
748
|
+
if (answer.jws === void 0) return refused;
|
|
749
|
+
return HttpServerResponse.jsonUnsafe({ jws: answer.jws }, { status: answer._tag === "Granted" ? 201 : 401 });
|
|
750
|
+
}));
|
|
751
|
+
}));
|
|
752
|
+
//#endregion
|
|
753
|
+
//#region src/server/door.ts
|
|
754
|
+
/**
|
|
755
|
+
* How a caller gets in, and stays in only as long as it may. The door judges a socket's credential
|
|
756
|
+
* once, before the upgrade, and files the connection under a key it adds to the upgrade request as
|
|
757
|
+
* {@link header}. The upgrade request's headers come with every call on that socket, so each call
|
|
758
|
+
* finds its caller by that key. A key never leaves the server, so a client cannot claim another
|
|
759
|
+
* connection by sending one in a call's own headers, which would override the upgrade's.
|
|
760
|
+
*/
|
|
761
|
+
const header = "x-codework-connection";
|
|
762
|
+
/** The connections the door let in, by key. */
|
|
763
|
+
var Connections = class extends Context.Service()("@codeworksh/cli/server/door/Connections") {};
|
|
764
|
+
const layerConnections = Layer.sync(Connections, () => {
|
|
765
|
+
const held = /* @__PURE__ */ new Map();
|
|
766
|
+
const end = (key) => Effect.suspend(() => {
|
|
767
|
+
const connection = held.get(key);
|
|
768
|
+
held.delete(key);
|
|
769
|
+
return connection === void 0 ? Effect.void : Deferred.succeed(connection.ended, void 0);
|
|
770
|
+
});
|
|
771
|
+
return Connections.of({
|
|
772
|
+
open: (principal) => Effect.gen(function* () {
|
|
773
|
+
const key = yield* make$3;
|
|
774
|
+
held.set(key, {
|
|
775
|
+
principal,
|
|
776
|
+
ended: yield* Deferred.make()
|
|
777
|
+
});
|
|
778
|
+
return key;
|
|
779
|
+
}),
|
|
780
|
+
find: (key) => key === void 0 ? void 0 : held.get(key)?.principal,
|
|
781
|
+
device: (id) => [...held].flatMap(([key, { principal }]) => principal.kind === "device" && principal.id === id ? [key] : []),
|
|
782
|
+
end,
|
|
783
|
+
serve: (key, effect) => {
|
|
784
|
+
const connection = held.get(key);
|
|
785
|
+
if (connection === void 0) return Effect.succeed(HttpServerResponse.empty({ status: 401 }));
|
|
786
|
+
return Effect.raceFirst(effect, Deferred.await(connection.ended).pipe(Effect.as(HttpServerResponse.empty()))).pipe(Effect.ensuring(end(key)));
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
});
|
|
790
|
+
/** Whether `request` comes from this computer, by its peer address: no header can say so. */
|
|
791
|
+
const fromLoopback = (request) => {
|
|
792
|
+
const peer$1 = peer(request);
|
|
793
|
+
return peer$1 !== void 0 && NetAddress.isLoopback(peer$1);
|
|
794
|
+
};
|
|
795
|
+
const pathname = (request) => new URL(request.url, "http://localhost").pathname;
|
|
796
|
+
/**
|
|
797
|
+
* The listener's door before any upgrade: no browser origin is served. The pairing routes take no
|
|
798
|
+
* credential here, as each checks its own. The socket takes the home's token from a loopback peer,
|
|
799
|
+
* or a live ticket, which it spends.
|
|
800
|
+
*/
|
|
801
|
+
const listener = Layer.unwrap(Effect.gen(function* () {
|
|
802
|
+
const token = yield* Token;
|
|
803
|
+
const pairing = yield* Service$3;
|
|
804
|
+
const connections = yield* Connections;
|
|
805
|
+
const caller = (offered, request) => matches(offered, token) ? Effect.succeed(fromLoopback(request) ? { kind: "local" } : void 0) : Effect.map(pairing.redeem(offered), (id) => id === void 0 ? void 0 : {
|
|
806
|
+
kind: "device",
|
|
807
|
+
id
|
|
808
|
+
});
|
|
809
|
+
return layer$8({
|
|
810
|
+
origins: [],
|
|
811
|
+
admit: (offered, request) => Effect.gen(function* () {
|
|
812
|
+
const path$1 = pathname(request);
|
|
813
|
+
if (request.method === "POST" && paths.includes(path$1)) return request;
|
|
814
|
+
if (request.method !== "GET" || path$1 !== "/rpc/v1" || offered === void 0) return void 0;
|
|
815
|
+
const principal = yield* caller(offered, request);
|
|
816
|
+
if (principal === void 0) return void 0;
|
|
817
|
+
const key = yield* connections.open(principal);
|
|
818
|
+
return request.modify({ headers: Headers.set(request.headers, header, key) });
|
|
819
|
+
})
|
|
820
|
+
});
|
|
821
|
+
}));
|
|
822
|
+
/** The socket route of the RPC server: each connection runs until it closes or is ended. */
|
|
823
|
+
const protocol = Layer.effect(RpcServer.Protocol, Effect.gen(function* () {
|
|
824
|
+
const { httpEffect, protocol } = yield* RpcServer.makeProtocolWithHttpEffectWebsocket;
|
|
825
|
+
const connections = yield* Connections;
|
|
826
|
+
yield* (yield* HttpRouter.HttpRouter).add("GET", path, (request) => connections.serve(request.headers["x-codework-connection"] ?? "", Effect.scoped(httpEffect)));
|
|
827
|
+
return protocol;
|
|
828
|
+
}));
|
|
829
|
+
/** The door on every call: the caller of the connection it came on, which must still be open. */
|
|
830
|
+
const rpc = Layer.effect(Door, Effect.gen(function* () {
|
|
831
|
+
const connections = yield* Connections;
|
|
832
|
+
return Door.of((effect, { headers }) => {
|
|
833
|
+
const principal = connections.find(Option.getOrUndefined(Headers.get(headers, header)));
|
|
834
|
+
return principal === void 0 ? Effect.fail(new Unauthorized({ message: "This connection is not open to this server" })) : Effect.provideService(effect, Current, principal);
|
|
835
|
+
});
|
|
836
|
+
}));
|
|
837
|
+
//#endregion
|
|
838
|
+
//#region src/server/feed.ts
|
|
839
|
+
const SubscriberCapacity = 4096;
|
|
524
840
|
var Service$2 = class extends Context.Service()("@codeworksh/cli/server/feed/Service") {};
|
|
525
841
|
/**
|
|
526
842
|
* Fan-out for `event.subscribe`. One listener on the event bus encodes each
|
|
@@ -534,11 +850,11 @@ var Service$2 = class extends Context.Service()("@codeworksh/cli/server/feed/Ser
|
|
|
534
850
|
* before they can consume a client's capacity.
|
|
535
851
|
*/
|
|
536
852
|
const make$1 = Effect.fn("EventFeed.make")(function* (listen, options) {
|
|
537
|
-
const capacity = options?.capacity ??
|
|
853
|
+
const capacity = options?.capacity ?? SubscriberCapacity;
|
|
538
854
|
const registry = options?.registry ?? Core;
|
|
539
|
-
const subscribers = /* @__PURE__ */ new
|
|
855
|
+
const subscribers = /* @__PURE__ */ new Map();
|
|
540
856
|
const failAll = (error) => Effect.sync(() => {
|
|
541
|
-
const current = Array.from(subscribers);
|
|
857
|
+
const current = Array.from(subscribers.keys());
|
|
542
858
|
subscribers.clear();
|
|
543
859
|
for (const subscriber of current) Queue.failCauseUnsafe(subscriber, Cause.fail(error));
|
|
544
860
|
});
|
|
@@ -546,7 +862,8 @@ const make$1 = Effect.fn("EventFeed.make")(function* (listen, options) {
|
|
|
546
862
|
if (subscribers.size === 0) return;
|
|
547
863
|
if (registry(event.type) === void 0) return;
|
|
548
864
|
const envelope = yield* encode(event, registry);
|
|
549
|
-
for (const subscriber of subscribers) {
|
|
865
|
+
for (const [subscriber, filter] of subscribers) {
|
|
866
|
+
if (!accepts(filter, envelope)) continue;
|
|
550
867
|
if (Queue.offerUnsafe(subscriber, envelope)) continue;
|
|
551
868
|
subscribers.delete(subscriber);
|
|
552
869
|
Queue.failCauseUnsafe(subscriber, Cause.fail(new Event.SubscriptionOverflowError({ capacity })));
|
|
@@ -559,9 +876,27 @@ const make$1 = Effect.fn("EventFeed.make")(function* (listen, options) {
|
|
|
559
876
|
}).pipe(Effect.andThen(failAll(error))),
|
|
560
877
|
UnknownEventTypeError: Effect.die
|
|
561
878
|
}));
|
|
879
|
+
const accepts = (filter, envelope) => (filter.types === void 0 || filter.types.has(envelope.type)) && (filter.threadId === void 0 || ofThread(filter.threadId)(envelope));
|
|
880
|
+
const filtered = (filter, replay = () => []) => Effect.gen(function* () {
|
|
881
|
+
const queue = yield* Effect.acquireRelease(Queue.dropping(capacity), (queue) => Effect.sync(() => subscribers.delete(queue)).pipe(Effect.andThen(Queue.shutdown(queue))));
|
|
882
|
+
const missed = yield* Effect.sync(() => {
|
|
883
|
+
subscribers.set(queue, filter);
|
|
884
|
+
return replay();
|
|
885
|
+
});
|
|
886
|
+
const replayed = [];
|
|
887
|
+
for (const event of missed) {
|
|
888
|
+
if (registry(event.type) === void 0) continue;
|
|
889
|
+
const envelope = yield* encode(event, registry).pipe(Effect.option);
|
|
890
|
+
if (Option.isSome(envelope) && accepts(filter, envelope.value)) replayed.push(envelope.value);
|
|
891
|
+
}
|
|
892
|
+
return Stream.fromIterable(replayed).pipe(Stream.concat(Stream.fromQueue(queue)));
|
|
893
|
+
});
|
|
562
894
|
const unsubscribe = yield* listen(publish);
|
|
563
895
|
yield* Effect.addFinalizer(() => unsubscribe);
|
|
564
|
-
return Service$2.of({
|
|
896
|
+
return Service$2.of({
|
|
897
|
+
subscribe: filtered({}),
|
|
898
|
+
filtered
|
|
899
|
+
});
|
|
565
900
|
});
|
|
566
901
|
const layer$4 = Layer.effect(Service$2, Effect.gen(function* () {
|
|
567
902
|
const events = yield* Event.Service;
|
|
@@ -616,6 +951,18 @@ const parseRepository = (selector) => {
|
|
|
616
951
|
const host = first?.toLowerCase();
|
|
617
952
|
return parts.length === 3 && host !== void 0 && isGitHubHost(host) ? named(host, second, third) : void 0;
|
|
618
953
|
};
|
|
954
|
+
/**
|
|
955
|
+
* A remote URL safe to show: an http(s) URL loses its user and password, which may be a token
|
|
956
|
+
* (`https://x-access-token:...@github.com/...`). SSH and local forms carry none and pass as they are.
|
|
957
|
+
*/
|
|
958
|
+
const shownRemote = (url) => {
|
|
959
|
+
if (!/^https?:\/\//i.test(url)) return url;
|
|
960
|
+
const parsed = URL.parse(url);
|
|
961
|
+
if (parsed === null) return url;
|
|
962
|
+
parsed.username = "";
|
|
963
|
+
parsed.password = "";
|
|
964
|
+
return parsed.toString();
|
|
965
|
+
};
|
|
619
966
|
const decodeRepository = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Struct({
|
|
620
967
|
full_name: Schema.String,
|
|
621
968
|
html_url: Schema.String,
|
|
@@ -756,13 +1103,18 @@ const make = Effect.gen(function* () {
|
|
|
756
1103
|
sshUrl: found.ssh_url
|
|
757
1104
|
};
|
|
758
1105
|
});
|
|
1106
|
+
const remote = Effect.fn("Host.remote")(function* (directory) {
|
|
1107
|
+
const url = yield* git.remote(directory);
|
|
1108
|
+
return url === void 0 ? void 0 : shownRemote(url);
|
|
1109
|
+
});
|
|
759
1110
|
return Service$1.of({
|
|
760
1111
|
info,
|
|
761
1112
|
browse,
|
|
762
1113
|
add,
|
|
763
1114
|
create,
|
|
764
1115
|
status,
|
|
765
|
-
lookup
|
|
1116
|
+
lookup,
|
|
1117
|
+
remote
|
|
766
1118
|
});
|
|
767
1119
|
});
|
|
768
1120
|
const layer$3 = Layer.effect(Service$1, make).pipe(Layer.provide(Git.defaultLayer("/")));
|
|
@@ -843,8 +1195,23 @@ const watch = (start, page, synced) => Stream.unwrap(Effect.gen(function* () {
|
|
|
843
1195
|
}));
|
|
844
1196
|
/** `watch` from revision `after`: every row past it first, then the same live. */
|
|
845
1197
|
const follow = (after, page, synced) => watch((head) => range(after, head, page, synced), page, synced);
|
|
1198
|
+
/**
|
|
1199
|
+
* `follow` from `after` on the line of `boot`, the one the client's last `synced` carried: when the
|
|
1200
|
+
* store left that line (a restored backup), it reads from zero instead and the first `synced` is told
|
|
1201
|
+
* so by `reset`.
|
|
1202
|
+
*/
|
|
1203
|
+
const resume = (after, boot, page, synced) => Stream.unwrap(Effect.gen(function* () {
|
|
1204
|
+
const store = yield* Store.Service;
|
|
1205
|
+
let reset = after > 0 && boot !== void 0 && !(yield* store.onLine(boot, after));
|
|
1206
|
+
return follow(reset ? 0 : after, page, (head) => {
|
|
1207
|
+
const item = synced(head, reset);
|
|
1208
|
+
reset = false;
|
|
1209
|
+
return item;
|
|
1210
|
+
});
|
|
1211
|
+
}));
|
|
846
1212
|
//#endregion
|
|
847
1213
|
//#region src/server/handlers.ts
|
|
1214
|
+
const isConnectError = Schema.is(ConnectError);
|
|
848
1215
|
const toSandboxInfo = (info) => ({
|
|
849
1216
|
id: info.id,
|
|
850
1217
|
driver: info.driver,
|
|
@@ -885,6 +1252,7 @@ const toThreadSummary = (info) => ({
|
|
|
885
1252
|
runState: info.runState,
|
|
886
1253
|
...info.runStateAt === void 0 ? {} : { runStateAt: info.runStateAt },
|
|
887
1254
|
...info.lastRun === void 0 ? {} : { lastRun: info.lastRun },
|
|
1255
|
+
parked: info.parked,
|
|
888
1256
|
restarts: info.restarts,
|
|
889
1257
|
...info.attempt === void 0 ? {} : { attempt: info.attempt },
|
|
890
1258
|
createdSeq: info.createdSeq,
|
|
@@ -912,6 +1280,52 @@ const toIndexItem = (change) => {
|
|
|
912
1280
|
default: return change;
|
|
913
1281
|
}
|
|
914
1282
|
};
|
|
1283
|
+
const toUsageItem = (change) => {
|
|
1284
|
+
if (change._tag === "Tally") {
|
|
1285
|
+
const { hour, threadId, sessionId, projectId, kind, name, count, rev } = change.tally;
|
|
1286
|
+
return {
|
|
1287
|
+
_tag: "Tally",
|
|
1288
|
+
hour,
|
|
1289
|
+
threadId,
|
|
1290
|
+
sessionId,
|
|
1291
|
+
projectId,
|
|
1292
|
+
kind,
|
|
1293
|
+
name,
|
|
1294
|
+
count,
|
|
1295
|
+
rev
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
const row = change.usage;
|
|
1299
|
+
return {
|
|
1300
|
+
_tag: "Usage",
|
|
1301
|
+
hour: row.hour,
|
|
1302
|
+
threadId: row.threadId,
|
|
1303
|
+
sessionId: row.sessionId,
|
|
1304
|
+
projectId: row.projectId,
|
|
1305
|
+
provider: row.provider,
|
|
1306
|
+
model: row.model,
|
|
1307
|
+
thinking: row.thinking,
|
|
1308
|
+
requests: row.requests,
|
|
1309
|
+
tokens: {
|
|
1310
|
+
input: row.input,
|
|
1311
|
+
output: row.output,
|
|
1312
|
+
cacheRead: row.cacheRead,
|
|
1313
|
+
cacheWrite: row.cacheWrite,
|
|
1314
|
+
reasoning: row.reasoning
|
|
1315
|
+
},
|
|
1316
|
+
cost: {
|
|
1317
|
+
total: row.cost,
|
|
1318
|
+
input: row.costInput,
|
|
1319
|
+
output: row.costOutput,
|
|
1320
|
+
cacheRead: row.costCacheRead,
|
|
1321
|
+
cacheWrite: row.costCacheWrite
|
|
1322
|
+
},
|
|
1323
|
+
duration: row.duration,
|
|
1324
|
+
timed: row.timed,
|
|
1325
|
+
durations: row.durations,
|
|
1326
|
+
rev: row.rev
|
|
1327
|
+
};
|
|
1328
|
+
};
|
|
915
1329
|
const runtimeInput = (runtime) => ({
|
|
916
1330
|
...runtime?.model == null ? {} : { model: runtime.model },
|
|
917
1331
|
...runtime?.thinkingLevel == null ? {} : { thinkingLevel: runtime.thinkingLevel },
|
|
@@ -985,6 +1399,14 @@ const toDeltaItem = (envelope) => {
|
|
|
985
1399
|
})
|
|
986
1400
|
});
|
|
987
1401
|
};
|
|
1402
|
+
/** The `Synced` of `index.sync` and `usage.sync`. */
|
|
1403
|
+
const resynced = (head, reset) => ({
|
|
1404
|
+
_tag: "Synced",
|
|
1405
|
+
storeId: head.id,
|
|
1406
|
+
rev: head.rev,
|
|
1407
|
+
boot: head.boot,
|
|
1408
|
+
...reset ? { reset: true } : {}
|
|
1409
|
+
});
|
|
988
1410
|
/** Bytes of entries a first `thread.sync` or a `thread.page` sends when the client names no budget. */
|
|
989
1411
|
const defaultBudget = 1048576;
|
|
990
1412
|
const threadInfo = (threadId) => Session.threadInfo(threadId).pipe(Effect.map(toThreadInfo));
|
|
@@ -998,39 +1420,54 @@ const toLogItem = (registry) => (item) => Event.isSynced(item) ? Effect.succeed(
|
|
|
998
1420
|
const layer$1 = Api.toLayer(Effect.gen(function* () {
|
|
999
1421
|
const control = yield* Control.Service;
|
|
1000
1422
|
const feed = yield* Service$2;
|
|
1423
|
+
const daemons = yield* DaemonHost.Service;
|
|
1001
1424
|
const sessions = yield* SessionStore.Service;
|
|
1002
1425
|
const threads = yield* ThreadStore.Service;
|
|
1003
1426
|
const resolve = (ref) => control.resolve(ref).pipe(Effect.map((thread) => ThreadSchema.ID.make(thread.id)));
|
|
1004
1427
|
const state = yield* State.Service;
|
|
1005
1428
|
const oauth = yield* Service;
|
|
1006
|
-
const identity = yield* Service$
|
|
1429
|
+
const identity = yield* Service$5;
|
|
1007
1430
|
const events = yield* Event.Service;
|
|
1008
1431
|
const registry = yield* EventRegistry.Service;
|
|
1009
1432
|
const mcp = yield* Mcp.Service;
|
|
1010
1433
|
const host = yield* Service$1;
|
|
1011
|
-
const clones = yield* Service$
|
|
1434
|
+
const clones = yield* Service$4;
|
|
1012
1435
|
const store = yield* Store.Service;
|
|
1436
|
+
const global = yield* Global.Service;
|
|
1437
|
+
const pairing = yield* Service$3;
|
|
1438
|
+
const connections = yield* Connections;
|
|
1439
|
+
/** Forgets a device and ends its open connections; false when none has `id`. */
|
|
1440
|
+
const forget = (id) => pairing.revoke(id).pipe(Effect.tap(() => Effect.forEach(connections.device(id), connections.end, { discard: true })));
|
|
1013
1441
|
const mcpControl = (operation) => Effect.fnUntraced(function* ({ server, ...ref }) {
|
|
1014
1442
|
return yield* mcp[operation](yield* resolve(ref), server);
|
|
1015
1443
|
});
|
|
1444
|
+
const settings = yield* Settings.Service;
|
|
1445
|
+
/** The project's file is the one sessions in its main checkout read. */
|
|
1446
|
+
const settingsTarget = Effect.fnUntraced(function* (projectId, file) {
|
|
1447
|
+
if (projectId === void 0) return yield* settings.locate(void 0, file);
|
|
1448
|
+
const checkout = yield* Project.mainCheckout(projectId);
|
|
1449
|
+
if (checkout === void 0) return yield* new Project.ProjectCheckoutError({ projectId });
|
|
1450
|
+
return yield* settings.locate(checkout, file);
|
|
1451
|
+
});
|
|
1016
1452
|
return Api.of({
|
|
1017
1453
|
"server.info": Effect.fnUntraced(function* () {
|
|
1018
1454
|
const head = yield* store.head;
|
|
1455
|
+
const machine = yield* read(global.home).pipe(Effect.provide(NodeServices.layer), Effect.orElseSucceed(() => Option.none()));
|
|
1019
1456
|
return {
|
|
1020
|
-
|
|
1021
|
-
version: identity.version,
|
|
1457
|
+
...identity,
|
|
1022
1458
|
storeId: head.id,
|
|
1023
|
-
rev: head.rev
|
|
1459
|
+
rev: head.rev,
|
|
1460
|
+
...Option.isSome(machine) ? { machineId: machine.value.id } : {}
|
|
1024
1461
|
};
|
|
1025
1462
|
}),
|
|
1026
|
-
"index.sync": ({ after }) =>
|
|
1463
|
+
"index.sync": ({ after, boot }) => resume(after, boot, (from, upto) => Sync.index(from, upto, 500).pipe(Effect.map(({ items, next }) => ({
|
|
1027
1464
|
items: items.map(toIndexItem),
|
|
1028
1465
|
...next === void 0 ? {} : { next }
|
|
1029
|
-
}))),
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
})),
|
|
1466
|
+
}))), resynced),
|
|
1467
|
+
"usage.sync": ({ after, boot }) => resume(after, boot, (from, upto) => Sync.usage(from, upto, 500).pipe(Effect.map(({ items, next }) => ({
|
|
1468
|
+
items: items.map(toUsageItem),
|
|
1469
|
+
...next === void 0 ? {} : { next }
|
|
1470
|
+
}))), resynced),
|
|
1034
1471
|
"auth.save": ({ credentials }) => oauth.save(credentials),
|
|
1035
1472
|
"auth.status": ({ provider }) => oauth.status(provider),
|
|
1036
1473
|
"auth.refresh": ({ provider }) => oauth.refresh(provider),
|
|
@@ -1052,9 +1489,9 @@ const layer$1 = Api.toLayer(Effect.gen(function* () {
|
|
|
1052
1489
|
"model.list": Effect.fnUntraced(function* ({ hostDir }) {
|
|
1053
1490
|
const filter = hostDir === void 0 ? {} : { hostDir };
|
|
1054
1491
|
const loaded = yield* (yield* Settings.Service).load(hostDir);
|
|
1055
|
-
const { model } = loaded;
|
|
1056
1492
|
const providers = yield* ModelCatalog.available(filter);
|
|
1057
|
-
const
|
|
1493
|
+
const chosen = yield* ModelCatalog.selected(loaded, hostDir);
|
|
1494
|
+
const entry = chosen === void 0 ? void 0 : (yield* ModelCatalog.effective(loaded.models))[chosen.provider]?.[chosen.id];
|
|
1058
1495
|
return {
|
|
1059
1496
|
providers: providers.flatMap((provider) => {
|
|
1060
1497
|
const models = Object.values(provider.models);
|
|
@@ -1069,17 +1506,20 @@ const layer$1 = Api.toLayer(Effect.gen(function* () {
|
|
|
1069
1506
|
}))
|
|
1070
1507
|
}];
|
|
1071
1508
|
}),
|
|
1072
|
-
default: {
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
thinkingLevel: model.thinkingLevel,
|
|
1509
|
+
...chosen === void 0 ? {} : { default: {
|
|
1510
|
+
...chosen,
|
|
1511
|
+
thinkingLevel: loaded.model.thinkingLevel,
|
|
1076
1512
|
...entry === void 0 ? {} : {
|
|
1077
1513
|
name: entry.name,
|
|
1078
1514
|
providerName: entry.provider.name
|
|
1079
1515
|
}
|
|
1080
|
-
}
|
|
1516
|
+
} }
|
|
1081
1517
|
};
|
|
1082
1518
|
}),
|
|
1519
|
+
"project.remote": Effect.fnUntraced(function* ({ projectId }) {
|
|
1520
|
+
const checkout = yield* Project.mainCheckout(projectId);
|
|
1521
|
+
return { url: (checkout === void 0 ? void 0 : yield* host.remote(checkout)) ?? null };
|
|
1522
|
+
}),
|
|
1083
1523
|
"project.rename": Effect.fnUntraced(function* ({ projectId, name }) {
|
|
1084
1524
|
const renamed = yield* Project.rename({
|
|
1085
1525
|
projectId,
|
|
@@ -1090,6 +1530,39 @@ const layer$1 = Api.toLayer(Effect.gen(function* () {
|
|
|
1090
1530
|
name: renamed.name
|
|
1091
1531
|
};
|
|
1092
1532
|
}),
|
|
1533
|
+
"settings.read": Effect.fnUntraced(function* ({ projectId, file }) {
|
|
1534
|
+
const target = yield* settingsTarget(projectId, file);
|
|
1535
|
+
const current = yield* SettingsFile.read(target.path);
|
|
1536
|
+
const problem = yield* Effect.flip(SettingsFile.check(target, current.source)).pipe(Effect.option);
|
|
1537
|
+
const parsed = SettingsFile.parse(current.source);
|
|
1538
|
+
const below = file !== "settings" ? Option.none() : projectId === void 0 ? Option.some(Settings.defaults) : yield* settings.load(void 0).pipe(Effect.option);
|
|
1539
|
+
const merged = file !== "mcp" ? void 0 : yield* McpConfig.load({
|
|
1540
|
+
userDir: target.userDir,
|
|
1541
|
+
...target.root === void 0 ? {} : { root: target.root }
|
|
1542
|
+
});
|
|
1543
|
+
return {
|
|
1544
|
+
path: target.path,
|
|
1545
|
+
source: current.source,
|
|
1546
|
+
exists: current.exists,
|
|
1547
|
+
version: current.version,
|
|
1548
|
+
..."value" in parsed ? { value: parsed.value } : {},
|
|
1549
|
+
...Option.isSome(problem) ? { error: problem.value.detail } : {},
|
|
1550
|
+
...Option.isSome(below) ? { inherited: { retry: below.value.retry } } : {},
|
|
1551
|
+
...merged === void 0 ? {} : { servers: merged.servers.map((server) => ({
|
|
1552
|
+
name: server.name,
|
|
1553
|
+
from: server.file === target.path && target.scope === "project" ? "project" : "user",
|
|
1554
|
+
enabled: server.config.enabled !== false
|
|
1555
|
+
})) }
|
|
1556
|
+
};
|
|
1557
|
+
}),
|
|
1558
|
+
"settings.write": Effect.fnUntraced(function* ({ projectId, file, source, version }) {
|
|
1559
|
+
const target = yield* settingsTarget(projectId, file);
|
|
1560
|
+
return { version: yield* SettingsFile.replace(target, source, version) };
|
|
1561
|
+
}),
|
|
1562
|
+
"settings.set": Effect.fnUntraced(function* ({ projectId, file, at, value }) {
|
|
1563
|
+
const target = yield* settingsTarget(projectId, file);
|
|
1564
|
+
return { version: yield* SettingsFile.set(target, at, value) };
|
|
1565
|
+
}),
|
|
1093
1566
|
"plugin.reload": Effect.fnUntraced(function* () {
|
|
1094
1567
|
return yield* state.reload;
|
|
1095
1568
|
}),
|
|
@@ -1215,6 +1688,31 @@ const layer$1 = Api.toLayer(Effect.gen(function* () {
|
|
|
1215
1688
|
}),
|
|
1216
1689
|
"mcp.connect": mcpControl("connect"),
|
|
1217
1690
|
"mcp.disconnect": mcpControl("disconnect"),
|
|
1691
|
+
"machine.info": () => status(global.home).pipe(Effect.provide(NodeServices.layer), Effect.orDie),
|
|
1692
|
+
"machine.rename": ({ givenName }) => rename(global.home, givenName).pipe(Effect.tap(() => heartbeat(global.home).pipe(Effect.provide(NodeServices.layer), Effect.ignore, Effect.forkDetach)), Effect.provide(NodeServices.layer), Effect.orDie),
|
|
1693
|
+
"machine.disconnect": ({ workspaceId, keyId }) => disconnect(global.home, workspaceId, keyId).pipe(Effect.flatMap(({ revoked }) => status(global.home).pipe(Effect.map((status) => ({
|
|
1694
|
+
status,
|
|
1695
|
+
revoked
|
|
1696
|
+
})))), Effect.provide(NodeServices.layer), Effect.catchIf((error) => !isConnectError(error), (error) => Effect.fail(new ConnectError({ message: `Could not disconnect: ${String(error)}` })))),
|
|
1697
|
+
"machine.connect": ({ workspaceId }) => Stream.callback((queue) => connect({
|
|
1698
|
+
home: global.home,
|
|
1699
|
+
workspaceId,
|
|
1700
|
+
onCode: (userCode) => Queue.offer(queue, {
|
|
1701
|
+
_tag: "Code",
|
|
1702
|
+
userCode
|
|
1703
|
+
}).pipe(Effect.asVoid)
|
|
1704
|
+
}).pipe(Effect.tap(() => heartbeat(global.home).pipe(Effect.provide(NodeServices.layer), Effect.ignore, Effect.forkDetach)), Effect.flatMap((connected) => Queue.offer(queue, {
|
|
1705
|
+
_tag: "Connected",
|
|
1706
|
+
connected
|
|
1707
|
+
})), Effect.andThen(Queue.end(queue)), Effect.provide([Client.layer, NodeServices.layer]), Effect.catch((error) => Queue.fail(queue, isConnectError(error) ? error : new ConnectError({ message: `Could not connect: ${String(error)}` }))), Effect.forkScoped)),
|
|
1708
|
+
"device.pair": () => local(pairing.code),
|
|
1709
|
+
"device.list": () => local(pairing.list),
|
|
1710
|
+
"device.revoke": ({ id }) => local(Effect.map(forget(id), (applied) => ({ applied }))),
|
|
1711
|
+
"device.leave": () => Effect.gen(function* () {
|
|
1712
|
+
const caller = yield* Current;
|
|
1713
|
+
if (caller.kind !== "device") return yield* new Forbidden({ message: "This computer has no pairing to leave" });
|
|
1714
|
+
yield* forget(caller.id);
|
|
1715
|
+
}),
|
|
1218
1716
|
"host.info": () => Effect.succeed(host.info),
|
|
1219
1717
|
"host.browse": ({ path }) => host.browse(path),
|
|
1220
1718
|
"host.create": ({ name }) => host.create(name),
|
|
@@ -1247,11 +1745,18 @@ const layer$1 = Api.toLayer(Effect.gen(function* () {
|
|
|
1247
1745
|
"sandbox.stop": Effect.fnUntraced(function* ({ sandboxId }) {
|
|
1248
1746
|
yield* Sandbox.stop(sandboxId);
|
|
1249
1747
|
}),
|
|
1250
|
-
"event.subscribe": ({ threadId }) =>
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1748
|
+
"event.subscribe": ({ threadId, types }) => {
|
|
1749
|
+
const only = types === void 0 ? void 0 : new Set(types);
|
|
1750
|
+
return Stream.unwrap(feed.filtered({
|
|
1751
|
+
...only === void 0 ? {} : { types: only },
|
|
1752
|
+
...threadId === void 0 ? {} : { threadId }
|
|
1753
|
+
}, only === void 0 ? void 0 : () => daemons.last(only)).pipe(Effect.map((events) => Stream.make({
|
|
1754
|
+
id: EventSchema.ID.create(),
|
|
1755
|
+
type: Connected.type,
|
|
1756
|
+
data: {}
|
|
1757
|
+
}).pipe(Stream.concat(events)))));
|
|
1758
|
+
},
|
|
1759
|
+
"daemon.call": (input) => daemons.call(input)
|
|
1255
1760
|
});
|
|
1256
1761
|
}));
|
|
1257
1762
|
//#endregion
|
|
@@ -1277,45 +1782,47 @@ const managedShutdown = Layer.unwrap(Effect.gen(function* () {
|
|
|
1277
1782
|
/** Ends the stored runs the last server left open, before the listener opens: a client never sees them live. */
|
|
1278
1783
|
const sweep = Layer.effectDiscard(Effect.flatMap(Control.Service, (control) => control.sweep));
|
|
1279
1784
|
/**
|
|
1280
|
-
* Resumes the runs the last server left unfinished, whether it crashed or shut down
|
|
1281
|
-
*
|
|
1785
|
+
* Resumes the runs the last server left unfinished, whether it crashed or shut down, and the prompts
|
|
1786
|
+
* woken past a thread's head: the log and its projections record both, so this needs nothing from the
|
|
1787
|
+
* previous process.
|
|
1282
1788
|
*/
|
|
1283
1789
|
const resumeUnfinished = Layer.effectDiscard(Effect.gen(function* () {
|
|
1284
1790
|
const control = yield* Control.Service;
|
|
1285
1791
|
yield* Effect.forkScoped(control.resumeUnfinished);
|
|
1286
1792
|
}));
|
|
1287
1793
|
/**
|
|
1288
|
-
* Advertises the listener once it has an address:
|
|
1289
|
-
* the
|
|
1794
|
+
* Advertises the listener once it has an address: files the registration later
|
|
1795
|
+
* invocations discover it through, with the token they call it with, then logs
|
|
1796
|
+
* the endpoint, so whoever reads that line finds the server registered.
|
|
1290
1797
|
*/
|
|
1291
1798
|
const announce = Layer.unwrap(Effect.gen(function* () {
|
|
1292
1799
|
const server = yield* HttpServer.HttpServer;
|
|
1800
|
+
const token = yield* Token;
|
|
1293
1801
|
const global = yield* Global.Service;
|
|
1294
|
-
const identity = yield* Service$
|
|
1802
|
+
const identity = yield* Service$5;
|
|
1295
1803
|
const address = server.address;
|
|
1296
1804
|
const url = `${NetAddress.formatUrlUnsafe(address, "ws")}${path}`;
|
|
1297
|
-
|
|
1298
|
-
if (!NetAddress.isInetAddress(address)) return
|
|
1299
|
-
return register({
|
|
1805
|
+
const listening = Layer.effectDiscard(Effect.log(`codework serve listening on ${url}`));
|
|
1806
|
+
if (!NetAddress.isInetAddress(address)) return listening;
|
|
1807
|
+
return listening.pipe(Layer.provide(register({
|
|
1300
1808
|
home: global.home,
|
|
1301
1809
|
info: {
|
|
1302
1810
|
pid: identity.pid,
|
|
1303
1811
|
version: identity.version,
|
|
1304
1812
|
url,
|
|
1305
|
-
port: address.port
|
|
1813
|
+
port: address.port,
|
|
1814
|
+
token
|
|
1306
1815
|
}
|
|
1307
|
-
});
|
|
1816
|
+
})));
|
|
1308
1817
|
}));
|
|
1818
|
+
const trusted = (given) => Layer.effect(TrustedProxy, given === void 0 ? Effect.flatMap(Settings.Service, (settings) => settings.load(void 0)).pipe(Effect.map(({ server }) => server.trustedProxy.flatMap((entry) => Settings.proxyNetwork(entry) ?? []))) : Effect.succeed(given));
|
|
1819
|
+
/** The RPC endpoint for `group` and the pairing routes, behind the door, which turns a refused request away. */
|
|
1820
|
+
const endpoint = (group) => RpcServer.layer(group).pipe(Layer.provide(protocol), Layer.provide(layer$1.pipe(Layer.provide(layer$4))), Layer.provide(rpc), Layer.merge(routes), Layer.merge(listener), Layer.provide(layerConnections), Layer.provide(layer$5));
|
|
1309
1821
|
const layer = (options) => {
|
|
1310
|
-
|
|
1311
|
-
group: Api,
|
|
1312
|
-
path,
|
|
1313
|
-
protocol: "websocket"
|
|
1314
|
-
}).pipe(Layer.provide(layer$1.pipe(Layer.provide(layer$4))));
|
|
1315
|
-
return HttpRouter.serve(rpc, { disableListenLog: true }).pipe(Layer.provideMerge(managedShutdown), Layer.provideMerge(resumeUnfinished), Layer.provide(layer$2(options.harness.home === void 0 ? {} : { home: options.harness.home })), Layer.provide(layer$3), Layer.provide(layer$5)).pipe(Layer.provideMerge(announce), Layer.provideMerge(NodeHttpServer.layer(createServer, {
|
|
1822
|
+
return HttpRouter.serve(endpoint(Api), { disableListenLog: true }).pipe(Layer.provideMerge(managedShutdown), Layer.provideMerge(resumeUnfinished), Layer.provideMerge(layer$7), Layer.provide(layer$2(options.harness.home === void 0 ? {} : { home: options.harness.home })), Layer.provide(layer$3), Layer.provide(layer$6), Layer.provide(trusted(options.trustedProxy))).pipe(Layer.provideMerge(announce), Layer.provideMerge(NodeHttpServer.layer(createServer, {
|
|
1316
1823
|
host: options.host,
|
|
1317
1824
|
port: options.port
|
|
1318
|
-
})), Layer.provide(RpcSerialization.layerNdjson), Layer.provide(layer$
|
|
1825
|
+
})), Layer.provide(RpcSerialization.layerNdjson), Layer.provide(options.identity ?? layer$9), Layer.provide(layerToken), Layer.provide(sweep), Layer.provide(Harness.layer(options.harness)));
|
|
1319
1826
|
};
|
|
1320
1827
|
//#endregion
|
|
1321
1828
|
//#region src/cli/cmd/handlers/serve.ts
|
|
@@ -1323,17 +1830,32 @@ const failed = Effect.sync(() => {
|
|
|
1323
1830
|
process.exitCode = 1;
|
|
1324
1831
|
});
|
|
1325
1832
|
const report = (error) => writeError(renderError(error)).pipe(Effect.andThen(failed));
|
|
1326
|
-
|
|
1833
|
+
const entries = (values) => values.flatMap((value) => value.split(",")).map((entry) => entry.trim()).filter((entry) => entry !== "");
|
|
1834
|
+
/**
|
|
1835
|
+
* The proxies `--trusted-proxy` names, else `CODEWORK_TRUSTED_PROXY`; none from either leaves the
|
|
1836
|
+
* user settings' `server.trustedProxy`, which settings decode themselves.
|
|
1837
|
+
*/
|
|
1838
|
+
const trustedProxy = Effect.fn(function* (flag) {
|
|
1839
|
+
const env = entries([yield* Config.String("CODEWORK_TRUSTED_PROXY").pipe(Config.withDefault(""))]);
|
|
1840
|
+
const [source, given] = flag.length > 0 ? ["--trusted-proxy", entries(flag)] : ["CODEWORK_TRUSTED_PROXY", env];
|
|
1841
|
+
if (given.length === 0) return void 0;
|
|
1842
|
+
return yield* Effect.forEach(given, (entry) => {
|
|
1843
|
+
const network = Settings.proxyNetwork(entry);
|
|
1844
|
+
return network === void 0 ? Effect.fail(new InvalidInputError({ message: `${source}: "${entry}" is not an IP address or CIDR range` })) : Effect.succeed(network);
|
|
1845
|
+
});
|
|
1846
|
+
});
|
|
1847
|
+
var serve_default = handler(Cmd.commands.serve, Effect.fn("CLI.serve", { level: "Info" })(function* ({ host, port, service, trustedProxy: flag }) {
|
|
1327
1848
|
const shared = yield* Cmd.spec;
|
|
1328
1849
|
const harness = {
|
|
1329
1850
|
...harnessOptions(shared),
|
|
1330
1851
|
watchModels: true
|
|
1331
1852
|
};
|
|
1332
|
-
const serve = Layer.launch(layer({
|
|
1853
|
+
const serve = Effect.flatMap(trustedProxy(flag), (trusted) => Layer.launch(layer({
|
|
1333
1854
|
host,
|
|
1334
1855
|
port,
|
|
1335
|
-
harness
|
|
1336
|
-
|
|
1856
|
+
harness,
|
|
1857
|
+
...trusted === void 0 ? {} : { trustedProxy: trusted }
|
|
1858
|
+
})));
|
|
1337
1859
|
if (!service) return yield* serve.pipe(Effect.catch(report));
|
|
1338
1860
|
yield* Effect.gen(function* () {
|
|
1339
1861
|
const paths = yield* Global.resolve(harness.home === void 0 ? {} : { home: harness.home });
|
|
@@ -1345,4 +1867,4 @@ var serve_default = handler(Cmd.commands.serve, Effect.fn("CLI.serve", { level:
|
|
|
1345
1867
|
//#endregion
|
|
1346
1868
|
export { serve_default as default };
|
|
1347
1869
|
|
|
1348
|
-
//# sourceMappingURL=serve-
|
|
1870
|
+
//# sourceMappingURL=serve-BZ5FAU3h.mjs.map
|