kiteline 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/{auth-CYNu-f_h.mjs → auth-DfYnQl7W.mjs} +6 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/{control-BEq2N-wP.mjs → control-B4iYGngw.mjs} +1 -1
  4. package/dist/{control-BpOGsRCZ.mjs → control-BMOIrur6.mjs} +1 -1
  5. package/dist/{devices-command-Bubh46v1.mjs → devices-command-Bv_bsDPa.mjs} +1 -1
  6. package/dist/{package-D0hl72v4.mjs → package-CX75B96-.mjs} +1 -1
  7. package/dist/{pair-command-DHeG-ZsP.mjs → pair-command-DyAaiyGn.mjs} +1 -1
  8. package/dist/{service-Fzh98Meh.mjs → service-pIzAzHWX.mjs} +3 -3
  9. package/dist/{src-DekrqcQL.mjs → src-BIPu215q.mjs} +208 -51
  10. package/dist/web/assets/Check.es-BazDUJ8l.js +1 -0
  11. package/dist/web/assets/{Plus.es-wuLJIFEO.js → Plus.es-BTjK6Adi.js} +1 -1
  12. package/dist/web/assets/{MagnifyingGlass.es-DUOewsuL.js → X.es-BLVrGeYn.js} +1 -1
  13. package/dist/web/assets/composer-D3-nzQwm.js +1 -0
  14. package/dist/web/assets/copy-button-B5-YyZiJ.js +1 -0
  15. package/dist/web/assets/format-qC7-v1aY.js +9 -0
  16. package/dist/web/assets/{index-DA4jO1yh.js → index-DLCIIoKU.js} +3 -3
  17. package/dist/web/assets/index-Dfz5hLiZ.css +1 -0
  18. package/dist/web/assets/lazy/{core-B6TDb-vl.js → core-CU5HQPlE.js} +1 -1
  19. package/dist/web/assets/new-8iHRF9aP.js +1 -0
  20. package/dist/web/assets/prefs-CwnnVOOA.js +1 -0
  21. package/dist/web/assets/routes-BC1QwJvj.js +1 -0
  22. package/dist/web/assets/{s._sessionId-zegjksnG.js → s._sessionId-BH5Oq7PW.js} +8 -8
  23. package/dist/web/assets/{settings-Dvc2znbn.js → settings-CFJIOWmt.js} +1 -1
  24. package/dist/web/assets/{status-D-preq93.js → status-DNclzjzI.js} +1 -1
  25. package/dist/web/index.html +3 -3
  26. package/dist/web/sw.js +1 -1
  27. package/package.json +1 -1
  28. package/dist/web/assets/composer-3-vKn_3C.js +0 -1
  29. package/dist/web/assets/copy-button-CSWEBRJT.js +0 -1
  30. package/dist/web/assets/format-DYOlz7Mf.js +0 -9
  31. package/dist/web/assets/index-BRaZDA7B.css +0 -1
  32. package/dist/web/assets/new-BGVIKCzl.js +0 -1
  33. package/dist/web/assets/prefs-DzSTtEbH.js +0 -1
  34. package/dist/web/assets/routes-DpVY3ZGq.js +0 -1
@@ -91,10 +91,14 @@ var PairLimiter = class {
91
91
  }
92
92
  fail(key) {
93
93
  const entry = this.failures.get(key);
94
- const fresh = !entry || entry.until < Date.now();
94
+ const now = Date.now();
95
+ const fresh = !entry || entry.until < now;
96
+ if (this.failures.size > 200) {
97
+ for (const [other, old] of this.failures) if (old.until < now) this.failures.delete(other);
98
+ }
95
99
  this.failures.set(key, {
96
100
  count: fresh ? 1 : entry.count + 1,
97
- until: Date.now() + 6e5
101
+ until: now + 6e5
98
102
  });
99
103
  }
100
104
  clear(key) {
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "./package-D0hl72v4.mjs";
2
+ import { t as version } from "./package-CX75B96-.mjs";
3
3
  import { h as startedFromCli, i as dim, r as bold, t as accent } from "./banner-C1Jj4n4W.mjs";
4
4
  import { parseArgs } from "node:util";
5
5
  // src/cli.ts
@@ -95,7 +95,7 @@ const [command, action, ...rest] = positionals;
95
95
  if (rest.length && !(command === "devices" && action !== void 0)) fail(`"${rest.join(" ")}" isn't something Kiteline takes. Run ${bold("kiteline --help")}.`);
96
96
  /** The commands that talk to the Kiteline already running, with what to do when it isn't. */
97
97
  async function talk(run) {
98
- const { Unreachable } = await import("./control-BpOGsRCZ.mjs");
98
+ const { Unreachable } = await import("./control-BMOIrur6.mjs");
99
99
  try {
100
100
  return await run();
101
101
  } catch (error) {
@@ -107,22 +107,22 @@ switch (command) {
107
107
  case void 0:
108
108
  case "start":
109
109
  if (action) fail(`"${action}" isn't something Kiteline takes. Run ${bold("kiteline --help")}.`);
110
- await import("./src-DekrqcQL.mjs");
110
+ await import("./src-BIPu215q.mjs");
111
111
  break;
112
112
  case "pair": {
113
113
  if (action) fail(`"${action}" isn't something kiteline pair takes. Run ${bold("kiteline --help")}.`);
114
- const { pairCommand } = await import("./pair-command-DHeG-ZsP.mjs");
114
+ const { pairCommand } = await import("./pair-command-DyAaiyGn.mjs");
115
115
  process.exit(await talk(pairCommand) ? 0 : 1);
116
116
  break;
117
117
  }
118
118
  case "devices": {
119
- const { devicesCommand } = await import("./devices-command-Bubh46v1.mjs");
119
+ const { devicesCommand } = await import("./devices-command-Bv_bsDPa.mjs");
120
120
  await talk(() => devicesCommand(action, rest.join(" "), { all: values.all === true }));
121
121
  process.exit(0);
122
122
  break;
123
123
  }
124
124
  case "service": {
125
- const { service } = await import("./service-Fzh98Meh.mjs");
125
+ const { service } = await import("./service-pIzAzHWX.mjs");
126
126
  await service(action, { force: values.force === true });
127
127
  break;
128
128
  }
@@ -1,5 +1,5 @@
1
1
  import { M as toArray, O as preventNativeAwait, l as toStandardLazyResponse, m as RECURSIVE_CLIENT_UNWRAP_KEYS, o as toFetchRequest, r as StandardRPCLink, t as CompositeStandardLinkPlugin, x as intercept } from "./client.BPI7fHX3-CSey2FaL.mjs";
2
- import { a as localAddress, o as readComputerKey, r as kitelineHome, s as readServerInfo } from "./auth-CYNu-f_h.mjs";
2
+ import { a as localAddress, o as readComputerKey, r as kitelineHome, s as readServerInfo } from "./auth-DfYnQl7W.mjs";
3
3
  import { f as command, m as readSettings, p as loadOwnEnvFile, r as bold } from "./banner-C1Jj4n4W.mjs";
4
4
  // ../../node_modules/.pnpm/@orpc+client@1.16.1_@opentelemetry+api@1.10.0/node_modules/@orpc/client/dist/index.mjs
5
5
  function resolveFriendlyClientOptions(options) {
@@ -1 +1 @@
1
- export { t as Unreachable, n as connectToKiteline } from "./control-BEq2N-wP.mjs";
1
+ export { t as Unreachable, n as connectToKiteline } from "./control-B4iYGngw.mjs";
@@ -1,5 +1,5 @@
1
1
  import { f as command, i as dim, r as bold, t as accent, u as spaced } from "./banner-C1Jj4n4W.mjs";
2
- import { n as connectToKiteline, t as Unreachable } from "./control-BEq2N-wP.mjs";
2
+ import { n as connectToKiteline, t as Unreachable } from "./control-B4iYGngw.mjs";
3
3
  import { createInterface } from "node:readline/promises";
4
4
  // src/devices-command.ts
5
5
  const say = (...lines) => console.log(["", ...lines.map((line) => line ? ` ${line}` : "")].join("\n"));
@@ -1,3 +1,3 @@
1
1
  // package.json
2
- var version = "0.3.2";
2
+ var version = "0.3.4";
3
3
  export { version as t };
@@ -1,5 +1,5 @@
1
1
  import { c as printPairingCode, f as command, i as dim, r as bold, t as accent, u as spaced } from "./banner-C1Jj4n4W.mjs";
2
- import { n as connectToKiteline } from "./control-BEq2N-wP.mjs";
2
+ import { n as connectToKiteline } from "./control-B4iYGngw.mjs";
3
3
  import { createInterface } from "node:readline/promises";
4
4
  // src/pair-command.ts
5
5
  const say = (...lines) => console.log(lines.map((line) => line ? ` ${line}` : "").join("\n"));
@@ -1,4 +1,4 @@
1
- import { a as localAddress, r as kitelineHome } from "./auth-CYNu-f_h.mjs";
1
+ import { a as localAddress, r as kitelineHome } from "./auth-DfYnQl7W.mjs";
2
2
  import { d as SettingsError, i as dim, m as readSettings, r as bold, t as accent } from "./banner-C1Jj4n4W.mjs";
3
3
  import { homedir, userInfo } from "node:os";
4
4
  import { copyFileSync, existsSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -179,11 +179,11 @@ async function install({ force }) {
179
179
  }
180
180
  if (!up) fail("The service is set up, but Kiteline didn't come up. See what it said with:", "", ` ${accent(`journalctl --user -u ${NAME} -n 40`)}`);
181
181
  say(`${bold("Kiteline runs in the background now.")} It starts with your computer and restarts if it stops.`, "", row("See what it's doing", `journalctl --user -u ${NAME} -f`), row("Pair a phone", "kiteline pair"), row("See paired devices", "kiteline devices"), row("Change its settings", "kiteline service install, with the new options"), row("Stop running it", "kiteline service uninstall"), ...lingerNote ? ["", lingerNote] : []);
182
- const { connectToKiteline } = await import("./control-BpOGsRCZ.mjs");
182
+ const { connectToKiteline } = await import("./control-BMOIrur6.mjs");
183
183
  const { client } = await connectToKiteline();
184
184
  const { devices } = await client.devices.list();
185
185
  if (!devices.length && process.stdin.isTTY && process.stdout.isTTY) {
186
- const { pairCommand } = await import("./pair-command-DHeG-ZsP.mjs");
186
+ const { pairCommand } = await import("./pair-command-DyAaiyGn.mjs");
187
187
  await pairCommand();
188
188
  }
189
189
  }
@@ -1,6 +1,6 @@
1
1
  import { A as runWithSpan, C as isObject$1, D as parseEmptyableJSON, E as overlayProxy, M as toArray, N as value, S as isAsyncIteratorObject, T as onError, _ as toORPCError, a as toHttpPath, b as asyncIteratorWithSpan, c as toStandardLazyRequest, d as HibernationEventIterator, f as flattenHeader, g as isORPCErrorStatus, h as fallbackORPCErrorStatus, i as StandardRPCSerializer, j as setSpanError, k as resolveMaybeOptionalOptions, n as StandardRPCJsonSerializer, p as ORPCError, s as toFetchResponse, u as mapEventIterator, v as NullProtoObj, w as isTypescriptObject, x as intercept, y as ORPC_NAME } from "./client.BPI7fHX3-CSey2FaL.mjs";
2
- import { t as version$1 } from "./package-D0hl72v4.mjs";
3
- import { a as localAddress, c as safeEqual, i as loadComputerKey, l as saveServerInfo, n as PairLimiter, r as kitelineHome, t as DEVICE_COOKIE } from "./auth-CYNu-f_h.mjs";
2
+ import { t as version$1 } from "./package-CX75B96-.mjs";
3
+ import { a as localAddress, c as safeEqual, i as loadComputerKey, l as saveServerInfo, n as PairLimiter, r as kitelineHome, t as DEVICE_COOKIE } from "./auth-DfYnQl7W.mjs";
4
4
  import { _ as RelayPath, a as pairingLinks, b as relaySocketUrl, c as printPairingCode, d as SettingsError, f as command, g as RelayClose, i as dim, l as printSettingsError, m as readSettings, n as addressesFor, o as printAlreadyRunning, r as bold, s as printBanner, t as accent, u as spaced, v as fromBase64Url, x as toBase64Url, y as hostIdFor } from "./banner-C1Jj4n4W.mjs";
5
5
  import { homedir, hostname, platform } from "node:os";
6
6
  import { createReadStream, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -1939,8 +1939,10 @@ function transcriptToItems(messages) {
1939
1939
  }
1940
1940
  // ../../packages/api/src/agent/run.ts
1941
1941
  const PHONE_NOTE = "The user is driving this session from Kiteline, a web client usually open on a phone. Keep replies easy to scan on a narrow screen: short paragraphs, and code blocks only when they help.";
1942
+ /** How many recent events a run keeps, for watchers picking up where a dropped connection left them. */
1943
+ const MAX_RECENT = 3e3;
1942
1944
  var Run = class {
1943
- emit;
1945
+ deliver;
1944
1946
  onEnd;
1945
1947
  sessionId;
1946
1948
  cwd;
@@ -1974,8 +1976,13 @@ var Run = class {
1974
1976
  /** Holds messages back until the session's effort is set, when the start options can't carry it. */
1975
1977
  hold = null;
1976
1978
  modelList = null;
1977
- constructor(options, emit, onEnd) {
1978
- this.emit = emit;
1979
+ /** The number of the last event sent. */
1980
+ seq = 0;
1981
+ /** The latest events, in order: every one numbered above `floor`. */
1982
+ recent = [];
1983
+ floor = 0;
1984
+ constructor(options, deliver, onEnd) {
1985
+ this.deliver = deliver;
1979
1986
  this.onEnd = onEnd;
1980
1987
  this.sessionId = options.sessionId;
1981
1988
  this.cwd = options.cwd;
@@ -2052,6 +2059,34 @@ var Run = class {
2052
2059
  await this.refreshEffort();
2053
2060
  });
2054
2061
  }
2062
+ /**
2063
+ * Numbers each event and keeps the latest, so a watcher that dropped can be sent only what it
2064
+ * missed. A snapshot replaces everything before it, so nothing earlier can be picked up from.
2065
+ */
2066
+ emit(event) {
2067
+ if (event.type === "snapshot") {
2068
+ this.recent = [];
2069
+ this.floor = this.seq;
2070
+ this.deliver(event);
2071
+ return;
2072
+ }
2073
+ const numbered = {
2074
+ ...event,
2075
+ seq: ++this.seq
2076
+ };
2077
+ this.recent.push(numbered);
2078
+ if (this.recent.length > MAX_RECENT) {
2079
+ const dropped = this.recent.splice(0, this.recent.length - MAX_RECENT);
2080
+ this.floor = dropped.at(-1)?.seq ?? this.floor;
2081
+ }
2082
+ this.deliver(numbered);
2083
+ }
2084
+ /** The events after `cursor`, or null when it's from another run or too far back: send a snapshot. */
2085
+ since(cursor) {
2086
+ if (cursor.startedAt !== this.startedAt) return null;
2087
+ if (cursor.seq < this.floor || cursor.seq > this.seq) return null;
2088
+ return this.recent.filter((event) => (event.seq ?? 0) > cursor.seq);
2089
+ }
2055
2090
  snapshot() {
2056
2091
  return {
2057
2092
  sessionId: this.sessionId,
@@ -2064,7 +2099,8 @@ var Run = class {
2064
2099
  error: this.error,
2065
2100
  permissions: [...this.pending.values()].map((p) => p.request),
2066
2101
  toolProgress: Object.fromEntries(this.toolProgress),
2067
- startedAt: this.startedAt
2102
+ startedAt: this.startedAt,
2103
+ seq: this.seq
2068
2104
  };
2069
2105
  }
2070
2106
  get pendingCount() {
@@ -2228,6 +2264,11 @@ var Run = class {
2228
2264
  this.input.close();
2229
2265
  this.q.close();
2230
2266
  }
2267
+ /** Put to sleep to make room: closed, and counted as closed at once rather than when the process has gone. */
2268
+ retire() {
2269
+ this.close();
2270
+ this.finish("closed", null);
2271
+ }
2231
2272
  canUseTool = (toolName, input, options) => new Promise((resolve) => {
2232
2273
  const id = options.toolUseID || randomUUID();
2233
2274
  const request = {
@@ -2283,6 +2324,7 @@ var Run = class {
2283
2324
  }
2284
2325
  }
2285
2326
  finish(status, error) {
2327
+ if (!this.isLive) return;
2286
2328
  this.flushDraft();
2287
2329
  for (const pending of this.pending.values()) pending.settle({
2288
2330
  behavior: "deny",
@@ -2498,6 +2540,8 @@ var Run = class {
2498
2540
  }
2499
2541
  };
2500
2542
  // ../../packages/api/src/agent/manager.ts
2543
+ /** How long a run that died with an error is remembered. */
2544
+ const FAILED_MS = 3e5;
2501
2545
  var RunManager = class {
2502
2546
  config;
2503
2547
  runs = /* @__PURE__ */ new Map();
@@ -2600,9 +2644,22 @@ var RunManager = class {
2600
2644
  run.send(text, input.images);
2601
2645
  return { sessionId: id };
2602
2646
  }
2647
+ /**
2648
+ * Makes room for one more session. A session that's only resting holds a place it isn't using, so
2649
+ * at the limit the one idle longest goes to sleep early; the limit only refuses when every session
2650
+ * is working or waiting for an answer.
2651
+ */
2603
2652
  checkLimit() {
2604
- const liveCount = [...this.runs.values()].filter((run) => run.isLive).length;
2605
- if (liveCount >= this.config.maxLiveRuns) throw new Error(`${liveCount} sessions are already running. Stop one before starting another.`);
2653
+ const live = [...this.runs.values()].filter((run) => run.isLive);
2654
+ if (live.length < this.config.maxLiveRuns) return;
2655
+ const resting = live.filter((run) => run.status === "idle" && run.pendingCount === 0).sort((a, b) => a.lastActivity - b.lastActivity);
2656
+ let count = live.length;
2657
+ for (const run of resting) {
2658
+ if (count < this.config.maxLiveRuns) break;
2659
+ run.retire();
2660
+ count--;
2661
+ }
2662
+ if (count >= this.config.maxLiveRuns) throw new Error(`${count} sessions are busy right now. Stop one before starting another.`);
2606
2663
  }
2607
2664
  respond(sessionId, permissionId, decision) {
2608
2665
  this.require(sessionId).respond(permissionId, decision);
@@ -2630,8 +2687,12 @@ var RunManager = class {
2630
2687
  stopAll() {
2631
2688
  for (const run of this.runs.values()) run.close();
2632
2689
  }
2633
- /** Snapshot first, then every event for this session, across process restarts. */
2634
- async *watchSession(sessionId, signal) {
2690
+ /**
2691
+ * Snapshot first, then every event for this session, across process restarts. A watcher coming
2692
+ * back after a dropped connection says where it got to, and is sent only what it missed when the
2693
+ * run still has it.
2694
+ */
2695
+ async *watchSession(sessionId, signal, since) {
2635
2696
  const queue = new AsyncQueue();
2636
2697
  let watchers = this.sessionWatchers.get(sessionId);
2637
2698
  if (!watchers) {
@@ -2644,12 +2705,16 @@ var RunManager = class {
2644
2705
  if (signal?.aborted) queue.close();
2645
2706
  try {
2646
2707
  const run = this.runs.get(sessionId);
2647
- const failed = this.failed.get(sessionId);
2648
- const recent = failed && Date.now() - failed.at < 3e5 ? failed.snapshot : null;
2649
- yield {
2650
- type: "snapshot",
2651
- run: run ? run.snapshot() : recent
2652
- };
2708
+ const missed = run && since ? run.since(since) : null;
2709
+ if (missed) yield* missed;
2710
+ else {
2711
+ const failed = this.failed.get(sessionId);
2712
+ const recent = failed && Date.now() - failed.at < FAILED_MS ? failed.snapshot : null;
2713
+ yield {
2714
+ type: "snapshot",
2715
+ run: run ? run.snapshot() : recent
2716
+ };
2717
+ }
2653
2718
  for await (const event of queue) yield event;
2654
2719
  } finally {
2655
2720
  signal?.removeEventListener("abort", stop);
@@ -2697,6 +2762,7 @@ var RunManager = class {
2697
2762
  }
2698
2763
  reap() {
2699
2764
  const now = Date.now();
2765
+ for (const [id, failed] of this.failed) if (now - failed.at > FAILED_MS) this.failed.delete(id);
2700
2766
  for (const run of this.runs.values()) if (run.status === "idle" && run.pendingCount === 0 && now - run.lastActivity > this.config.idleTimeoutMs) run.close();
2701
2767
  }
2702
2768
  };
@@ -2728,7 +2794,9 @@ var SessionTracker = class {
2728
2794
  recursive: true,
2729
2795
  mode: 448
2730
2796
  });
2731
- writeFileSync(this.file, `${JSON.stringify({ sessions: this.entries }, null, 2)}\n`, { mode: 384 });
2797
+ const temp = `${this.file}.${process.pid}.tmp`;
2798
+ writeFileSync(temp, `${JSON.stringify({ sessions: this.entries }, null, 2)}\n`, { mode: 384 });
2799
+ renameSync(temp, this.file);
2732
2800
  } catch {}
2733
2801
  }
2734
2802
  list() {
@@ -2959,26 +3027,53 @@ var Devices = class Devices extends EventEmitter {
2959
3027
  live = /* @__PURE__ */ new Map();
2960
3028
  watchers = /* @__PURE__ */ new Set();
2961
3029
  saveTimer = null;
3030
+ /** Where a devices file that couldn't be read was put aside, if one was: every device pairs again. */
3031
+ damaged;
2962
3032
  constructor(file) {
2963
3033
  super();
2964
3034
  this.file = file;
2965
- this.devices = Devices.load(file);
3035
+ const loaded = Devices.load(file);
3036
+ this.devices = loaded.devices;
3037
+ this.damaged = loaded.damaged;
2966
3038
  setInterval(() => this.sweep(), 15e3).unref();
2967
3039
  }
2968
3040
  static load(file) {
2969
3041
  try {
2970
- const data = JSON.parse(readFileSync(file, "utf8"));
2971
- return Array.isArray(data.devices) ? data.devices.filter(isStored).map((d) => ({
2972
- ...d,
2973
- name: cleanName(d.name),
2974
- lastSeen: typeof d.lastSeen === "string" ? d.lastSeen : null,
2975
- approvedBy: typeof d.approvedBy === "string" ? d.approvedBy : "terminal",
2976
- via: d.via === "relay" ? "relay" : "direct"
2977
- })) : [];
3042
+ return {
3043
+ devices: Devices.parse(readFileSync(file, "utf8")),
3044
+ damaged: null
3045
+ };
2978
3046
  } catch {
2979
- return [];
3047
+ if (!existsSync(file)) return {
3048
+ devices: [],
3049
+ damaged: null
3050
+ };
3051
+ const aside = `${file}.damaged-${Date.now()}`;
3052
+ try {
3053
+ renameSync(file, aside);
3054
+ return {
3055
+ devices: [],
3056
+ damaged: aside
3057
+ };
3058
+ } catch {
3059
+ return {
3060
+ devices: [],
3061
+ damaged: file
3062
+ };
3063
+ }
2980
3064
  }
2981
3065
  }
3066
+ static parse(text) {
3067
+ const data = JSON.parse(text);
3068
+ if (!data || typeof data !== "object") throw new Error("not a devices file");
3069
+ return Array.isArray(data.devices) ? data.devices.filter(isStored).map((d) => ({
3070
+ ...d,
3071
+ name: cleanName(d.name),
3072
+ lastSeen: typeof d.lastSeen === "string" ? d.lastSeen : null,
3073
+ approvedBy: typeof d.approvedBy === "string" ? d.approvedBy : "terminal",
3074
+ via: d.via === "relay" ? "relay" : "direct"
3075
+ })) : [];
3076
+ }
2982
3077
  get count() {
2983
3078
  return this.devices.length;
2984
3079
  }
@@ -9931,8 +10026,12 @@ const runsRouter = {
9931
10026
  list: protectedProcedure.handler(async function* ({ context, signal }) {
9932
10027
  yield* context.manager.watchList(signal);
9933
10028
  }),
9934
- watch: protectedProcedure.input(session).handler(async function* ({ input, context, signal }) {
9935
- yield* context.manager.watchSession(input.sessionId, signal);
10029
+ /** `since` is where this watcher got to before its connection dropped, to be sent only the rest. */
10030
+ watch: protectedProcedure.input(session.extend({ since: object({
10031
+ startedAt: number(),
10032
+ seq: number().int().min(0)
10033
+ }).optional() })).handler(async function* ({ input, context, signal }) {
10034
+ yield* context.manager.watchSession(input.sessionId, signal, input.since);
9936
10035
  }),
9937
10036
  send: protectedProcedure.input(object({
9938
10037
  sessionId: uuid().optional(),
@@ -12917,6 +13016,8 @@ var SocketTimeout = class extends Error {
12917
13016
  /** More than the biggest real request: six photos at the limit, base64 in JSON. */
12918
13017
  const MAX_BODY = 41943040;
12919
13018
  const HANDSHAKE_MS = 2e4;
13019
+ /** The phone pings every 20 seconds; a tunnel that's heard nothing for three of those is dead. */
13020
+ const SILENCE_MS$1 = 6e4;
12920
13021
  /**
12921
13022
  * The computer's end of one phone's tunnel. Answers the handshake with the key the phone names,
12922
13023
  * refuses a phone that can't prove it, then turns each request into a `Request` for `handle`, saying
@@ -12938,6 +13039,11 @@ async function serveTunnel(ws, keyFor, handle, hooks = {}) {
12938
13039
  const who = identity;
12939
13040
  hooks.opened?.(who, (code, reason) => socket.close(code, reason));
12940
13041
  socket.onClose(() => hooks.closed?.(who));
13042
+ let lastHeard = Date.now();
13043
+ const watchdog = setInterval(() => {
13044
+ if (Date.now() - lastHeard > SILENCE_MS$1) socket.close(1e3, "silent");
13045
+ }, 15e3);
13046
+ socket.onClose(() => clearInterval(watchdog));
12941
13047
  const streams = /* @__PURE__ */ new Map();
12942
13048
  let sending = Promise.resolve();
12943
13049
  let closed = false;
@@ -12986,6 +13092,7 @@ async function serveTunnel(ws, keyFor, handle, hooks = {}) {
12986
13092
  try {
12987
13093
  for (;;) {
12988
13094
  const frame = await socket.next();
13095
+ lastHeard = Date.now();
12989
13096
  const { type, stream: id, payload } = unpack(await cipher.open(frame));
12990
13097
  switch (type) {
12991
13098
  case Msg.Ping:
@@ -13042,6 +13149,15 @@ function joinChunks(chunks, size) {
13042
13149
  return out;
13043
13150
  }
13044
13151
  // src/relay.ts
13152
+ /**
13153
+ * This computer's side of the relay: one standing connection out to it, over which the relay asks
13154
+ * for a channel whenever a phone wants this computer. Each channel is a sealed tunnel, opened with the
13155
+ * phone's own key or, while it asks to pair, the one-time code it scanned; what comes through is
13156
+ * answered by the same API the phone would reach directly, as that device.
13157
+ */
13158
+ /** How often this computer pings the relay, and how long a quiet connection lasts before it's given up. */
13159
+ const PING_MS = 2e4;
13160
+ const SILENCE_MS = 5e4;
13045
13161
  /** The relay's secret for this computer, kept beside its other keys. Its hash is our address. */
13046
13162
  function relaySecret(home) {
13047
13163
  const file = join(home, "relay.json");
@@ -13110,24 +13226,59 @@ async function startRelay(options) {
13110
13226
  let connected = false;
13111
13227
  let stopped = false;
13112
13228
  let socket = null;
13113
- let silence = null;
13229
+ /** Stops the current connection's watchdog, when the relay connection is stopped for good. */
13230
+ let quiet = null;
13114
13231
  const connect = () => {
13115
13232
  if (stopped) return;
13116
13233
  const ws = new WebSocket(relaySocketUrl(options.relay, RelayPath.host));
13117
13234
  socket = ws;
13118
13235
  let lastHeard = Date.now();
13236
+ let gone = false;
13237
+ /**
13238
+ * Done with this connection, whether it closed or only went quiet. A dead one may never finish
13239
+ * closing, which can take a quarter of an hour, so this doesn't wait for it to: it reconnects.
13240
+ */
13241
+ const lost = (code) => {
13242
+ if (gone) return;
13243
+ gone = true;
13244
+ clearInterval(watchdog);
13245
+ try {
13246
+ ws.close();
13247
+ } catch {}
13248
+ if (stopped) return;
13249
+ if (code === RelayClose.Replaced) {
13250
+ stopped = true;
13251
+ connected = false;
13252
+ options.log("Another Kiteline on this computer took over the relay connection, so this one is off the relay now.");
13253
+ options.log("Phones still reach this one on your own network. Stop the other, then restart this, to bring it back.");
13254
+ return;
13255
+ }
13256
+ if (connected) options.log("Lost the relay; reconnecting.");
13257
+ else if (attempt === 0) {
13258
+ const why = code === RelayClose.TooMany ? "it's full right now" : "couldn't reach it";
13259
+ options.log(`The relay at ${options.relay} isn't answering (${why}); retrying in the background.`);
13260
+ }
13261
+ connected = false;
13262
+ attempt++;
13263
+ const wait = Math.min(3e4, 1e3 * 2 ** Math.min(attempt, 5)) + Math.random() * 1e3;
13264
+ setTimeout(connect, wait).unref();
13265
+ };
13266
+ const watchdog = setInterval(() => {
13267
+ if (Date.now() - lastHeard > SILENCE_MS) lost();
13268
+ else if (ws.readyState === WebSocket.OPEN) ws.send(JSON.stringify({ t: "ping" }));
13269
+ }, PING_MS);
13270
+ quiet = () => clearInterval(watchdog);
13119
13271
  ws.addEventListener("open", () => {
13272
+ if (gone) return;
13273
+ lastHeard = Date.now();
13120
13274
  ws.send(JSON.stringify({
13121
13275
  t: "hello",
13122
13276
  secret,
13123
13277
  version: options.version
13124
13278
  }));
13125
- silence = setInterval(() => {
13126
- if (Date.now() - lastHeard > 75e3) ws.close();
13127
- else ws.send(JSON.stringify({ t: "ping" }));
13128
- }, 3e4);
13129
13279
  });
13130
13280
  ws.addEventListener("message", (event) => {
13281
+ if (gone) return;
13131
13282
  lastHeard = Date.now();
13132
13283
  let message;
13133
13284
  try {
@@ -13150,19 +13301,7 @@ async function startRelay(options) {
13150
13301
  });
13151
13302
  }
13152
13303
  });
13153
- ws.addEventListener("close", (event) => {
13154
- if (silence) clearInterval(silence);
13155
- if (stopped) return;
13156
- if (connected) options.log("Lost the relay; reconnecting.");
13157
- else if (attempt === 0) {
13158
- const why = event.code === RelayClose.TooMany ? "it's full right now" : "couldn't reach it";
13159
- options.log(`The relay at ${options.relay} isn't answering (${why}); retrying in the background.`);
13160
- }
13161
- connected = false;
13162
- attempt++;
13163
- const wait = Math.min(3e4, 1e3 * 2 ** Math.min(attempt, 5)) + Math.random() * 1e3;
13164
- setTimeout(connect, wait).unref();
13165
- });
13304
+ ws.addEventListener("close", (event) => lost(event.code));
13166
13305
  ws.addEventListener("error", () => {});
13167
13306
  };
13168
13307
  connect();
@@ -13177,7 +13316,7 @@ async function startRelay(options) {
13177
13316
  },
13178
13317
  stop() {
13179
13318
  stopped = true;
13180
- if (silence) clearInterval(silence);
13319
+ quiet?.();
13181
13320
  socket?.close();
13182
13321
  }
13183
13322
  };
@@ -13249,6 +13388,15 @@ function callerOf(c) {
13249
13388
  if (header?.startsWith("Bearer ") && safeEqual(header.slice(7), computer.key)) return { kind: "terminal" };
13250
13389
  return null;
13251
13390
  }
13391
+ /**
13392
+ * The address a request came from, to count wrong pairing codes against. Behind Tailscale Serve or
13393
+ * another proxy on this computer every connection is from this computer, so there it's the address
13394
+ * the proxy passes on; that header is believed from nowhere else.
13395
+ */
13396
+ function remoteAddress(c) {
13397
+ const remote = getConnInfo(c).remote.address ?? "unknown";
13398
+ return (remote === "127.0.0.1" || remote === "::1" || remote === "::ffff:127.0.0.1" ? c.req.header("x-forwarded-for")?.split(",")[0]?.trim() : "") || remote;
13399
+ }
13252
13400
  const CLAIM_ERRORS = {
13253
13401
  unknown: `That pairing code isn't one this computer made. Make a new one with ${command("pair")}.`,
13254
13402
  expired: `That pairing code has expired. Make a new one with ${command("pair")}.`,
@@ -13342,7 +13490,7 @@ app.post("/auth/pair", async (c) => {
13342
13490
  via: "relay"
13343
13491
  });
13344
13492
  } else {
13345
- const ip = getConnInfo(c).remote.address ?? "unknown";
13493
+ const ip = remoteAddress(c);
13346
13494
  if (limiter.blocked(ip)) return c.json({
13347
13495
  ok: false,
13348
13496
  error: "Too many wrong codes. Wait ten minutes and try again."
@@ -13492,6 +13640,7 @@ const server = serve({
13492
13640
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
13493
13641
  });
13494
13642
  if (process.env.KITELINE_TOKEN?.trim()) log(`KITELINE_TOKEN isn't used any more: each device pairs with a one-time code from ${command("pair")}.`);
13643
+ if (devices.damaged) log(`The list of paired devices couldn't be read, so each phone needs pairing again. The old file is kept at ${devices.damaged}.`);
13495
13644
  if (startOver) log("Every device was unpaired.");
13496
13645
  else if (computer.replaced) log(`Pairing works differently from this version on: pair each phone again, once, with ${command("pair")}.`);
13497
13646
  if (interactive) startConsole({
@@ -13513,10 +13662,18 @@ const server = serve({
13513
13662
  });
13514
13663
  });
13515
13664
  server.on("error", (error) => {
13516
- if (error.code !== "EADDRINUSE") throw error;
13517
- printAlreadyRunning(port);
13665
+ if (error.code === "EADDRINUSE") printAlreadyRunning(port);
13666
+ else console.error(`\n Kiteline couldn't start listening on port ${port}: ${error.message}\n`);
13518
13667
  process.exit(1);
13519
13668
  });
13669
+ process.on("unhandledRejection", (reason) => {
13670
+ console.error(" Something went wrong inside Kiteline; it's still running.");
13671
+ console.error(reason instanceof Error ? reason.stack ?? reason.message : reason);
13672
+ });
13673
+ process.on("uncaughtException", (error) => {
13674
+ console.error(" Something went wrong inside Kiteline; it's still running.");
13675
+ console.error(error.stack ?? error.message);
13676
+ });
13520
13677
  function shutdown() {
13521
13678
  relay?.stop();
13522
13679
  manager.stopAll();
@@ -0,0 +1 @@
1
+ import{K as e,U as t,u as n}from"./format-qC7-v1aY.js";var r=e(t(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`CheckIcon`;export{a as t};
@@ -1 +1 @@
1
- import{K as e,U as t,u as n}from"./format-DYOlz7Mf.js";var r=e(t(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`PlusIcon`;export{a as t};
1
+ import{K as e,U as t,u as n}from"./format-qC7-v1aY.js";var r=e(t(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`PlusIcon`;export{a as t};
@@ -1 +1 @@
1
- import{K as e,U as t,u as n}from"./format-DYOlz7Mf.js";var r=e(t(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z`}))]]),a=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,68H132L105.33,48a20.12,20.12,0,0,0-12-4H40A20,20,0,0,0,20,64V200a20,20,0,0,0,20,20H216.89A19.13,19.13,0,0,0,236,200.89V88A20,20,0,0,0,216,68Zm-4,128H44V68H92l28.8,21.6A12,12,0,0,0,128,92h84Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,88V200.89a7.11,7.11,0,0,1-7.11,7.11H40a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H93.33a8,8,0,0,1,4.8,1.6L128,80h88A8,8,0,0,1,224,88Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232,88V200.89A15.13,15.13,0,0,1,216.89,216H40a16,16,0,0,1-16-16V64A16,16,0,0,1,40,48H93.33a16.12,16.12,0,0,1,9.6,3.2L130.67,72H216A16,16,0,0,1,232,88Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,74H130L101.73,52.8a14,14,0,0,0-8.4-2.8H40A14,14,0,0,0,26,64V200a14,14,0,0,0,14,14H216.89A13.12,13.12,0,0,0,230,200.89V88A14,14,0,0,0,216,74Zm2,126.89a1.11,1.11,0,0,1-1.11,1.11H40a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H93.33a2,2,0,0,1,1.2.4L124.4,84.8A6,6,0,0,0,128,86h88a2,2,0,0,1,2,2Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,76H129.33l-28.8-21.6a12.05,12.05,0,0,0-7.2-2.4H40A12,12,0,0,0,28,64V200a12,12,0,0,0,12,12H216.89A11.12,11.12,0,0,0,228,200.89V88A12,12,0,0,0,216,76Zm4,124.89a3.12,3.12,0,0,1-3.11,3.11H40a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H93.33a4,4,0,0,1,2.4.8L125.6,83.2a4,4,0,0,0,2.4.8h88a4,4,0,0,1,4,4Z`}))]]),o=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M236,64a36,36,0,1,0-48,33.94V112a4,4,0,0,1-4,4H96a27.8,27.8,0,0,0-4,.29V97.94a36,36,0,1,0-24,0v60.12a36,36,0,1,0,24,0V144a4,4,0,0,1,4-4h88a28,28,0,0,0,28-28V97.94A36.07,36.07,0,0,0,236,64ZM80,52A12,12,0,1,1,68,64,12,12,0,0,1,80,52Zm0,152a12,12,0,1,1,12-12A12,12,0,0,1,80,204ZM200,76a12,12,0,1,1,12-12A12,12,0,0,1,200,76Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,64a24,24,0,1,1-24-24A24,24,0,0,1,224,64Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192ZM200,80a16,16,0,1,1,16-16A16,16,0,0,1,200,80Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M230,64a30,30,0,1,0-36,29.4V112a10,10,0,0,1-10,10H96a21.84,21.84,0,0,0-10,2.42v-31a30,30,0,1,0-12,0v69.2a30,30,0,1,0,12,0V144a10,10,0,0,1,10-10h88a22,22,0,0,0,22-22V93.4A30.05,30.05,0,0,0,230,64ZM62,64A18,18,0,1,1,80,82,18,18,0,0,1,62,64ZM98,192a18,18,0,1,1-18-18A18,18,0,0,1,98,192ZM200,82a18,18,0,1,1,18-18A18,18,0,0,1,200,82Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192ZM200,80a16,16,0,1,1,16-16A16,16,0,0,1,200,80Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228,64a28,28,0,1,0-32,27.71V112a12,12,0,0,1-12,12H96a19.91,19.91,0,0,0-12,4V91.71a28,28,0,1,0-8,0v72.58a28,28,0,1,0,8,0V144a12,12,0,0,1,12-12h88a20,20,0,0,0,20-20V91.71A28,28,0,0,0,228,64ZM60,64A20,20,0,1,1,80,84,20,20,0,0,1,60,64Zm40,128a20,20,0,1,1-20-20A20,20,0,0,1,100,192ZM200,84a20,20,0,1,1,20-20A20,20,0,0,1,200,84Z`}))]]),s=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),c=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));c.displayName=`CaretRightIcon`;var l=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:a}));l.displayName=`FolderSimpleIcon`;var u=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:o}));u.displayName=`GitBranchIcon`;var d=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:s}));d.displayName=`MagnifyingGlassIcon`;export{c as i,u as n,l as r,d as t};
1
+ import{K as e,U as t,u as n}from"./format-qC7-v1aY.js";var r=e(t(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z`}))]]),a=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,68H132L105.33,48a20.12,20.12,0,0,0-12-4H40A20,20,0,0,0,20,64V200a20,20,0,0,0,20,20H216.89A19.13,19.13,0,0,0,236,200.89V88A20,20,0,0,0,216,68Zm-4,128H44V68H92l28.8,21.6A12,12,0,0,0,128,92h84Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,88V200.89a7.11,7.11,0,0,1-7.11,7.11H40a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H93.33a8,8,0,0,1,4.8,1.6L128,80h88A8,8,0,0,1,224,88Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232,88V200.89A15.13,15.13,0,0,1,216.89,216H40a16,16,0,0,1-16-16V64A16,16,0,0,1,40,48H93.33a16.12,16.12,0,0,1,9.6,3.2L130.67,72H216A16,16,0,0,1,232,88Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,74H130L101.73,52.8a14,14,0,0,0-8.4-2.8H40A14,14,0,0,0,26,64V200a14,14,0,0,0,14,14H216.89A13.12,13.12,0,0,0,230,200.89V88A14,14,0,0,0,216,74Zm2,126.89a1.11,1.11,0,0,1-1.11,1.11H40a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H93.33a2,2,0,0,1,1.2.4L124.4,84.8A6,6,0,0,0,128,86h88a2,2,0,0,1,2,2Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,76H129.33l-28.8-21.6a12.05,12.05,0,0,0-7.2-2.4H40A12,12,0,0,0,28,64V200a12,12,0,0,0,12,12H216.89A11.12,11.12,0,0,0,228,200.89V88A12,12,0,0,0,216,76Zm4,124.89a3.12,3.12,0,0,1-3.11,3.11H40a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H93.33a4,4,0,0,1,2.4.8L125.6,83.2a4,4,0,0,0,2.4.8h88a4,4,0,0,1,4,4Z`}))]]),o=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M236,64a36,36,0,1,0-48,33.94V112a4,4,0,0,1-4,4H96a27.8,27.8,0,0,0-4,.29V97.94a36,36,0,1,0-24,0v60.12a36,36,0,1,0,24,0V144a4,4,0,0,1,4-4h88a28,28,0,0,0,28-28V97.94A36.07,36.07,0,0,0,236,64ZM80,52A12,12,0,1,1,68,64,12,12,0,0,1,80,52Zm0,152a12,12,0,1,1,12-12A12,12,0,0,1,80,204ZM200,76a12,12,0,1,1,12-12A12,12,0,0,1,200,76Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,64a24,24,0,1,1-24-24A24,24,0,0,1,224,64Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192ZM200,80a16,16,0,1,1,16-16A16,16,0,0,1,200,80Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M230,64a30,30,0,1,0-36,29.4V112a10,10,0,0,1-10,10H96a21.84,21.84,0,0,0-10,2.42v-31a30,30,0,1,0-12,0v69.2a30,30,0,1,0,12,0V144a10,10,0,0,1,10-10h88a22,22,0,0,0,22-22V93.4A30.05,30.05,0,0,0,230,64ZM62,64A18,18,0,1,1,80,82,18,18,0,0,1,62,64ZM98,192a18,18,0,1,1-18-18A18,18,0,0,1,98,192ZM200,82a18,18,0,1,1,18-18A18,18,0,0,1,200,82Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192ZM200,80a16,16,0,1,1,16-16A16,16,0,0,1,200,80Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228,64a28,28,0,1,0-32,27.71V112a12,12,0,0,1-12,12H96a19.91,19.91,0,0,0-12,4V91.71a28,28,0,1,0-8,0v72.58a28,28,0,1,0,8,0V144a12,12,0,0,1,12-12h88a20,20,0,0,0,20-20V91.71A28,28,0,0,0,228,64ZM60,64A20,20,0,1,1,80,84,20,20,0,0,1,60,64Zm40,128a20,20,0,1,1-20-20A20,20,0,0,1,100,192ZM200,84a20,20,0,1,1,20-20A20,20,0,0,1,200,84Z`}))]]),s=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),c=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z`}))]]),l=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));l.displayName=`CaretRightIcon`;var u=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:a}));u.displayName=`FolderSimpleIcon`;var d=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:o}));d.displayName=`GitBranchIcon`;var f=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:s}));f.displayName=`MagnifyingGlassIcon`;var p=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:c}));p.displayName=`XIcon`;export{l as a,u as i,f as n,d as r,p as t};