tesseract-agent 0.12.1-beta.4 → 0.12.1-beta.6

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.
@@ -6452,6 +6452,8 @@ var init_settings = __esm({
6452
6452
  updateChannel: "stable",
6453
6453
  // OFF. An unauthenticated debug port is never a default.
6454
6454
  cdpDebugger: false,
6455
+ // OFF until the person turns it on: it is not finished, and it reaches into the system's autofill.
6456
+ passwordManager: false,
6455
6457
  tasksRailOpen: true,
6456
6458
  stateRailOpen: true,
6457
6459
  shareThisMachine: true,
@@ -6530,7 +6532,7 @@ var init_settings = __esm({
6530
6532
  "combineFrameworks"
6531
6533
  ];
6532
6534
  RETIRED_EFFECTS = /* @__PURE__ */ new Set(["elevated", "pulse-running"]);
6533
- MACHINE_LOCAL_GENERAL_KEYS = ["shareThisMachine", "updateChannel", "autoUpdate", "cdpDebugger", "keepAwake", "connectionWatch"];
6535
+ MACHINE_LOCAL_GENERAL_KEYS = ["shareThisMachine", "updateChannel", "autoUpdate", "cdpDebugger", "keepAwake", "connectionWatch", "passwordManager"];
6534
6536
  }
6535
6537
  });
6536
6538
 
@@ -264165,6 +264167,7 @@ __export(daemon_settings_exports, {
264165
264167
  readDaemonRunnerCacheKey: () => readDaemonRunnerCacheKey,
264166
264168
  readDaemonRunnerUnavailableReason: () => readDaemonRunnerUnavailableReason,
264167
264169
  readDaemonSchedulingEnabled: () => readDaemonSchedulingEnabled,
264170
+ readPasswordManagerEnabled: () => readPasswordManagerEnabled,
264168
264171
  readPasteHistoryEnabled: () => readPasteHistoryEnabled,
264169
264172
  readPasteHistoryShortcut: () => readPasteHistoryShortcut,
264170
264173
  readSpotlightShortcut: () => readSpotlightShortcut,
@@ -264329,6 +264332,14 @@ function readClipboardSyncEnabled() {
264329
264332
  return false;
264330
264333
  return readDaemonAgentSettings().clipboardSyncEnabled !== false;
264331
264334
  }
264335
+ function readPasswordManagerEnabled() {
264336
+ const env = process.env.CCB_PASSWORD_MANAGER;
264337
+ if (env === "1")
264338
+ return true;
264339
+ if (env === "0")
264340
+ return false;
264341
+ return readDaemonAgentSettings().passwordManager === true;
264342
+ }
264332
264343
  function snapshotSignature(path15) {
264333
264344
  try {
264334
264345
  const st = statSync53(path15, { bigint: true });
@@ -268084,7 +268095,8 @@ var manager_exports = {};
268084
268095
  __export(manager_exports, {
268085
268096
  VaultManager: () => VaultManager,
268086
268097
  getVaultManager: () => getVaultManager,
268087
- onVaultChanged: () => onVaultChanged
268098
+ onVaultChanged: () => onVaultChanged,
268099
+ refreshVaultSwitch: () => refreshVaultSwitch
268088
268100
  });
268089
268101
  import { createHash as createHash27 } from "node:crypto";
268090
268102
  import { mkdirSync as mkdirSync63, readFileSync as readFileSync88, writeFileSync as writeFileSync57 } from "node:fs";
@@ -268098,6 +268110,12 @@ function onVaultChanged(cb) {
268098
268110
  changeListeners.delete(cb);
268099
268111
  };
268100
268112
  }
268113
+ function refreshVaultSwitch() {
268114
+ singleton?.refreshLive();
268115
+ if (singleton && readPasswordManagerEnabled())
268116
+ void singleton.syncNow().catch(() => {
268117
+ });
268118
+ }
268101
268119
  function getVaultManager() {
268102
268120
  if (!singleton)
268103
268121
  singleton = new VaultManager();
@@ -268107,6 +268125,7 @@ var VaultManager, changeListeners, singleton;
268107
268125
  var init_manager2 = __esm({
268108
268126
  "../../packages/host-core/dist/vault/manager.js"() {
268109
268127
  "use strict";
268128
+ init_daemon_settings();
268110
268129
  init_passkey();
268111
268130
  init_base_paths();
268112
268131
  init_dist20();
@@ -268127,10 +268146,11 @@ var init_manager2 = __esm({
268127
268146
  idleTimer = null;
268128
268147
  constructor() {
268129
268148
  this.store = new VaultStore(makeVaultPersistence());
268130
- this.api = makeDaemonVaultApi(() => readCredentials()?.apiOrigin ?? "", () => readCredentials()?.accessToken ?? null);
268131
- this.sync = new VaultSync(this.store, this.api, () => readCredentials()?.accessToken ?? null);
268149
+ const token4 = () => readPasswordManagerEnabled() ? readCredentials()?.accessToken ?? null : null;
268150
+ this.api = makeDaemonVaultApi(() => readCredentials()?.apiOrigin ?? "", token4);
268151
+ this.sync = new VaultSync(this.store, this.api, token4);
268132
268152
  this.live = new VaultLive({
268133
- token: () => readCredentials()?.accessToken ?? null,
268153
+ token: token4,
268134
268154
  origin: () => readCredentials()?.apiOrigin ?? "",
268135
268155
  clientId: vaultClientId,
268136
268156
  pull: async () => {
@@ -268642,6 +268662,8 @@ async function daemonSignInVault() {
268642
268662
  const m = getVaultManager2();
268643
268663
  return {
268644
268664
  state: async () => {
268665
+ if (!readPasswordManagerEnabled())
268666
+ return "none";
268645
268667
  const s = await m.status();
268646
268668
  return !s.exists ? "none" : s.unlocked ? "unlocked" : "locked";
268647
268669
  },
@@ -268690,6 +268712,7 @@ var savedLogins, same, MASK_PASSWORD_MS, MASK_CODE_MS, MASK;
268690
268712
  var init_browser_sign_in = __esm({
268691
268713
  "../../packages/host-core/dist/browser-sign-in.js"() {
268692
268714
  "use strict";
268715
+ init_daemon_settings();
268693
268716
  init_dist20();
268694
268717
  savedLogins = null;
268695
268718
  same = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
@@ -317255,6 +317278,17 @@ function validateEdl(edl) {
317255
317278
  }
317256
317279
  });
317257
317280
  const busIds = new Set((Array.isArray(edl.buses) ? edl.buses : []).map((b) => b?.id).filter((id2) => typeof id2 === "string"));
317281
+ (Array.isArray(edl.buses) ? edl.buses : []).forEach((b, i) => {
317282
+ if (b?.output == null)
317283
+ return;
317284
+ if (!busIds.has(b.output))
317285
+ errors.push(`buses[${i}]: unknown output bus '${b.output}'.`);
317286
+ let at2 = b.output, steps = 0;
317287
+ while (at2 != null && steps++ <= busIds.size)
317288
+ at2 = edl.buses.find((x) => x?.id === at2)?.output;
317289
+ if (at2 != null)
317290
+ errors.push(`buses[${i}]: its outputs go round in a circle.`);
317291
+ });
317258
317292
  (edl.audio ?? []).forEach((t2, i) => {
317259
317293
  const asset = edl.assets?.[t2.asset];
317260
317294
  if (!asset)
@@ -317389,6 +317423,8 @@ function validateEdl(edl) {
317389
317423
  const lufs = edl.output?.loudnessLufs;
317390
317424
  if (lufs != null && (!isNum(lufs) || lufs < -30 || lufs > -5))
317391
317425
  errors.push("output.loudnessLufs must be -30..-5.");
317426
+ if (edl.output?.alpha && edl.output.format !== "gif" && edl.output.format !== "png")
317427
+ errors.push("output.alpha needs format gif or png.");
317392
317428
  const fps = edl.output?.fps;
317393
317429
  if (fps != null && (!isNum(fps) || fps < 1 || fps > 120))
317394
317430
  errors.push("output.fps must be 1\u2013120.");
@@ -317494,7 +317530,14 @@ function routeBuses(edl, labels, filters) {
317494
317530
  into.get(x.bus).push(`[snd${i}s${j}]`);
317495
317531
  });
317496
317532
  });
317497
- buses.forEach((b, k) => {
317533
+ const depth = (b) => {
317534
+ let n2 = 0;
317535
+ for (let at2 = b.output; at2 != null && n2 <= buses.length; n2++)
317536
+ at2 = buses.find((x) => x.id === at2)?.output;
317537
+ return n2;
317538
+ };
317539
+ const order2 = buses.map((b, k) => ({ b, k })).sort((x, y) => depth(y.b) - depth(x.b));
317540
+ order2.forEach(({ b, k }) => {
317498
317541
  const ins = into.get(b.id);
317499
317542
  if (!ins.length)
317500
317543
  return;
@@ -317506,7 +317549,7 @@ function routeBuses(edl, labels, filters) {
317506
317549
  ...p ? [`pan=stereo|c0=${round(Math.min(1, 1 - p))}*c0|c1=${round(Math.min(1, 1 + p))}*c1`] : []
317507
317550
  ];
317508
317551
  filters.push(`${ins.join("")}${chain2.join(",")}[bus${k}]`);
317509
- main3.push(`[bus${k}]`);
317552
+ (b.output != null && into.has(b.output) ? into.get(b.output) : main3).push(`[bus${k}]`);
317510
317553
  });
317511
317554
  return main3;
317512
317555
  }
@@ -317615,6 +317658,7 @@ function compileEdl(edl, opts) {
317615
317658
  const H3 = edl.output?.height ?? DEFAULTS2.height;
317616
317659
  const FPS = edl.output?.fps ?? DEFAULTS2.fps;
317617
317660
  const format4 = edl.output?.format ?? DEFAULTS2.format;
317661
+ const alpha = edl.output?.alpha === true;
317618
317662
  const inputs = [];
317619
317663
  const filters = [];
317620
317664
  let inputIdx = 0;
@@ -317655,9 +317699,11 @@ function compileEdl(edl, opts) {
317655
317699
  v.push(...effectFilters(seg.effects, "t", `s${i}`));
317656
317700
  if (moving2)
317657
317701
  v.push(...motionFilters(seg.motion, seg.motionAmount ?? 0.12, Math.max(1, Math.round(seg.durationSec * FPS)), W3, H3, FPS));
317702
+ else if (alpha)
317703
+ v.push(`scale=${W3}:${H3}:force_original_aspect_ratio=decrease`, "format=yuva420p", `pad=${W3}:${H3}:(ow-iw)/2:(oh-ih)/2:color=black@0`);
317658
317704
  else
317659
317705
  v.push(`scale=${W3}:${H3}:force_original_aspect_ratio=decrease`, `pad=${W3}:${H3}:(ow-iw)/2:(oh-ih)/2:color=black`);
317660
- v.push("setsar=1", `fps=${FPS}`, "format=yuv420p");
317706
+ v.push("setsar=1", `fps=${FPS}`, alpha ? "format=yuva420p" : "format=yuv420p");
317661
317707
  filters.push(`[${k}:v]${v.join(",")}[v${i}]`);
317662
317708
  const silent = asset.kind === "image" || seg.mute === true || probe3?.hasAudio === false;
317663
317709
  if (silent && dur != null) {
@@ -317807,8 +317853,8 @@ function compileEdl(edl, opts) {
317807
317853
  const timing = stillKeyed ? `setpts=PTS-STARTPTS+${round(start6)}/TB` : `trim=start=${round(o.in ?? 0)}:duration=${round((end2 - start6) * (o.speed ?? 1))},setpts=(PTS-STARTPTS)/${round(o.speed ?? 1)}+${round(start6)}/TB`;
317808
317854
  const s = keyedExpr(at3("scale"));
317809
317855
  const fades = ks.some((key7) => key7.opacity !== ks[0].opacity);
317810
- const alpha = fades ? `,geq=lum='lum(X\\,Y)':cb='cb(X\\,Y)':cr='cr(X\\,Y)':a='alpha(X\\,Y)*(${keyedExpr(at3("opacity"), "T")})'` : ks[0].opacity < 1 ? `,colorchannelmixer=aa=${round(ks[0].opacity)}` : "";
317811
- filters.push(`[${k}:v]${timing},${look.map((f3) => `${f3},`).join("")}scale=${W3}:${H3}:force_original_aspect_ratio=decrease,format=yuva420p,pad=${W3}:${H3}:(ow-iw)/2:(oh-ih)/2:color=black@0,setsar=1,fps=${FPS},scale=w='max(2\\,trunc(${W3}*(${s})/2)*2)':h='max(2\\,trunc(${H3}*(${s})/2)*2)':eval=frame${alpha}[ovs${i}]`);
317856
+ const alpha2 = fades ? `,geq=lum='lum(X\\,Y)':cb='cb(X\\,Y)':cr='cr(X\\,Y)':a='alpha(X\\,Y)*(${keyedExpr(at3("opacity"), "T")})'` : ks[0].opacity < 1 ? `,colorchannelmixer=aa=${round(ks[0].opacity)}` : "";
317857
+ filters.push(`[${k}:v]${timing},${look.map((f3) => `${f3},`).join("")}scale=${W3}:${H3}:force_original_aspect_ratio=decrease,format=yuva420p,pad=${W3}:${H3}:(ow-iw)/2:(oh-ih)/2:color=black@0,setsar=1,fps=${FPS},scale=w='max(2\\,trunc(${W3}*(${s})/2)*2)':h='max(2\\,trunc(${H3}*(${s})/2)*2)':eval=frame${alpha2}[ovs${i}]`);
317812
317858
  const out2 = `[vov${i}]`;
317813
317859
  filters.push(`${vt}[ovs${i}]overlay=x='${W3}*(${keyedExpr(at3("x"))})-w/2':y='${H3}*(${keyedExpr(at3("y"))})-h/2':eof_action=pass:enable='between(t\\,${round(start6)}\\,${round(end2)})'${out2}`);
317814
317860
  vt = out2;
@@ -317818,7 +317864,7 @@ function compileEdl(edl, opts) {
317818
317864
  const speed = o.speed ?? 1, ow = Math.round(o.width ?? W3), oh = Math.round(o.height ?? H3);
317819
317865
  filters.push(`[${k}:v]trim=start=${round(o.in)}:duration=${round((o.endSec - o.startSec) * speed)},setpts=(PTS-STARTPTS)/${round(speed)}+${round(o.startSec)}/TB,${look.map((f3) => `${f3},`).join("")}scale=${ow}:${oh}:force_original_aspect_ratio=decrease,format=yuva420p,pad=${ow}:${oh}:(ow-iw)/2:(oh-ih)/2:color=black@0,setsar=1,fps=${FPS}${fade}[ovs${i}]`);
317820
317866
  const out2 = `[vov${i}]`;
317821
- filters.push(`${vt}[ovs${i}]overlay=${Math.round(o.x)}:${Math.round(o.y)}:eof_action=pass:enable='between(t\\,${round(o.startSec)}\\,${round(o.endSec)})'${out2}`);
317867
+ filters.push(`${vt}[ovs${i}]overlay=${Math.round(o.x)}:${Math.round(o.y)}${alpha ? ":format=yuv420:alpha=straight" : ""}:eof_action=pass:enable='between(t\\,${round(o.startSec)}\\,${round(o.endSec)})'${out2}`);
317822
317868
  vt = out2;
317823
317869
  return;
317824
317870
  }
@@ -317836,7 +317882,7 @@ function compileEdl(edl, opts) {
317836
317882
  }
317837
317883
  const out = `[vov${i}]`;
317838
317884
  const enable = o.startSec != null || o.endSec != null ? `:enable='between(t\\,${round(o.startSec ?? 0)}\\,${round(o.endSec ?? 1e9)})'` : "";
317839
- filters.push(`${vt}${ovl}overlay=${Math.round(o.x)}:${Math.round(o.y)}${enable}${out}`);
317885
+ filters.push(`${vt}${ovl}overlay=${Math.round(o.x)}:${Math.round(o.y)}${alpha ? ":format=yuv420:alpha=straight" : ""}${enable}${out}`);
317840
317886
  vt = out;
317841
317887
  });
317842
317888
  }
@@ -317846,6 +317892,20 @@ function compileEdl(edl, opts) {
317846
317892
  }
317847
317893
  const encoder6 = opts.encoder ?? "libx264";
317848
317894
  const codec2 = format4 === "webm" ? ["-c:v", "libvpx-vp9", "-b:v", "0", "-crf", "32", "-c:a", "libopus"] : ["-c:v", encoder6, ...encoder6 === "libx264" ? ["-preset", "medium", "-crf", "20"] : ["-b:v", "8M"], "-pix_fmt", "yuv420p", "-c:a", "aac", "-b:a", "192k", ...format4 === "mp4" ? ["-movflags", "+faststart"] : []];
317895
+ if (format4 === "wav") {
317896
+ filters.push(`${vt}nullsink`);
317897
+ return { args: [...inputs, "-filter_complex", filters.join(";"), "-map", at2, "-vn", "-c:a", "pcm_s24le", opts.outPath], expectedDurationSec: expected != null ? round(expected) : null };
317898
+ }
317899
+ if (format4 === "gif" || format4 === "png") {
317900
+ filters.push(`${at2}anullsink`);
317901
+ let picture = vt;
317902
+ if (format4 === "gif") {
317903
+ filters.push(`${vt}split[gifa][gifb]`, `[gifa]palettegen=reserve_transparent=${alpha ? 1 : 0}:stats_mode=diff[gifp]`, `[gifb][gifp]paletteuse=dither=sierra2_4a:diff_mode=rectangle:alpha_threshold=128[gifo]`);
317904
+ picture = "[gifo]";
317905
+ }
317906
+ const encode10 = format4 === "gif" ? ["-loop", "0"] : ["-c:v", "png", "-pix_fmt", alpha ? "rgba" : "rgb24", "-f", "image2"];
317907
+ return { args: [...inputs, "-filter_complex", filters.join(";"), "-map", picture, "-an", "-r", String(FPS), ...encode10, opts.outPath], expectedDurationSec: expected != null ? round(expected) : null };
317908
+ }
317849
317909
  const args = [...inputs, "-filter_complex", filters.join(";"), "-map", vt, "-map", at2, "-r", String(FPS), ...codec2, opts.outPath];
317850
317910
  return { args, expectedDurationSec: expected != null ? round(expected) : null };
317851
317911
  }
@@ -318724,7 +318784,7 @@ var init_dist25 = __esm({
318724
318784
 
318725
318785
  // ../../packages/host-core/dist/video-edit.js
318726
318786
  import { spawn as spawn16 } from "node:child_process";
318727
- import { existsSync as existsSync85, mkdirSync as mkdirSync95, readFileSync as readFileSync125, readdirSync as readdirSync53, renameSync as renameSync49, rmSync as rmSync37, statSync as statSync72, utimesSync, writeFileSync as writeFileSync87 } from "node:fs";
318787
+ import { existsSync as existsSync85, lstatSync as lstatSync10, mkdirSync as mkdirSync95, readFileSync as readFileSync125, readdirSync as readdirSync53, renameSync as renameSync49, rmSync as rmSync37, rmdirSync as rmdirSync2, statSync as statSync72, statfsSync, utimesSync, writeFileSync as writeFileSync87 } from "node:fs";
318728
318788
  import { join as join164, isAbsolute as isAbsolute35, dirname as dirname70, resolve as resolve34, sep as sep25, basename as basename31 } from "node:path";
318729
318789
  import { createHash as createHash38, randomUUID as randomUUID60 } from "node:crypto";
318730
318790
  function requireAbsolutePath(p, label4 = "path") {
@@ -318830,7 +318890,10 @@ async function renderEdlOnce(edl, opts) {
318830
318890
  const dir2 = opts.outDir ?? workDir();
318831
318891
  mkdirSync95(dir2, { recursive: true });
318832
318892
  const format4 = edl.output?.format ?? "mp4";
318833
- const outPath2 = join164(dir2, `edit.${format4}`);
318893
+ const framesDir2 = format4 === "png" ? join164(dir2, "frames") : null;
318894
+ if (framesDir2)
318895
+ mkdirSync95(framesDir2, { recursive: true });
318896
+ const outPath2 = framesDir2 ? join164(framesDir2, "frame_%05d.png") : join164(dir2, `edit.${format4}`);
318834
318897
  let assFile;
318835
318898
  if (edl.captions?.cues.length) {
318836
318899
  assFile = join164(dir2, "captions.ass");
@@ -318883,7 +318946,7 @@ ${stderrTail}`));
318883
318946
  });
318884
318947
  });
318885
318948
  opts.onProgress?.(100, "Render complete");
318886
- return { path: outPath2, mime: MIME_BY_EXT[format4] ?? "video/mp4", durationSec: expectedDurationSec };
318949
+ return { path: framesDir2 ? join164(framesDir2, "frame_00001.png") : outPath2, mime: MIME_BY_EXT[format4] ?? "video/mp4", durationSec: expectedDurationSec };
318887
318950
  }
318888
318951
  async function enhanceVideo(path15, spec, opts) {
318889
318952
  path15 = requireAbsolutePath(path15, "path");
@@ -318996,6 +319059,45 @@ function framesDir() {
318996
319059
  mkdirSync95(dir2, { recursive: true });
318997
319060
  return dir2;
318998
319061
  }
319062
+ function clipAudioStale(heldAt, newestAt, now2) {
319063
+ return (heldAt === null || now2 - heldAt >= CLIP_AUDIO_HOLD_MS) && now2 - newestAt >= CLIP_AUDIO_MIN_AGE_MS;
319064
+ }
319065
+ function sweepClipAudio(root = join164(tesseractHome(), "media-work"), now2 = Date.now()) {
319066
+ let removed = 0, bytes3 = 0;
319067
+ if (!existsSync85(root))
319068
+ return { removed, bytes: bytes3 };
319069
+ for (const name of readdirSync53(root)) {
319070
+ const dir2 = join164(root, name, "frames");
319071
+ if (!WORK_DIR.test(name) || !existsSync85(dir2))
319072
+ continue;
319073
+ try {
319074
+ if (lstatSync10(join164(root, name)).isSymbolicLink() || lstatSync10(dir2).isSymbolicLink())
319075
+ continue;
319076
+ const fx = readdirSync53(dir2).filter((f3) => CLIP_AUDIO_FILE.test(f3)).map((f3) => {
319077
+ const p = join164(dir2, f3), s = statSync72(p);
319078
+ return { p, size: s.size, at: s.mtimeMs };
319079
+ });
319080
+ if (!fx.length)
319081
+ continue;
319082
+ const held3 = join164(dir2, CLIP_AUDIO_HELD_FILE), heldAt = existsSync85(held3) ? statSync72(held3).mtimeMs : null;
319083
+ if (!clipAudioStale(heldAt, Math.max(...fx.map((f3) => f3.at)), now2))
319084
+ continue;
319085
+ for (const f3 of fx) {
319086
+ rmSync37(f3.p, { force: true });
319087
+ removed += 1;
319088
+ bytes3 += f3.size;
319089
+ }
319090
+ rmSync37(held3, { force: true });
319091
+ if (!readdirSync53(dir2).length) {
319092
+ rmdirSync2(dir2);
319093
+ if (!readdirSync53(join164(root, name)).length)
319094
+ rmdirSync2(join164(root, name));
319095
+ }
319096
+ } catch {
319097
+ }
319098
+ }
319099
+ return { removed, bytes: bytes3 };
319100
+ }
318999
319101
  function ownFramesDir(dir2) {
319000
319102
  const root = resolve34(tesseractHome(), "media-work") + sep25, d = resolve34(requireAbsolutePath(dir2, "dir"));
319001
319103
  if (!d.startsWith(root) || basename31(d) !== "frames" || dirname70(dirname70(d)) + sep25 !== root)
@@ -319083,19 +319185,36 @@ async function extractAudio(path15, format4, outDir, opts) {
319083
319185
  throw new Error(`Audio export failed${r.timedOut ? " (timed out)" : ""}: ${r.stderr.slice(-300)}`);
319084
319186
  return { path: out, mime: MIME_BY_EXT[format4] ?? "audio/mp4" };
319085
319187
  }
319086
- function trimSoundCache(dir2, keep5, limit5 = SOUND_CACHE_BYTES) {
319087
- const list7 = readdirSync53(dir2).filter((f3) => f3.endsWith(".wav")).map((f3) => {
319088
- const p = join164(dir2, f3), s = statSync72(p);
319089
- return { p, size: s.size, at: s.mtimeMs };
319090
- }).sort((a, b) => b.at - a.at);
319091
- let total = list7.reduce((n2, f3) => n2 + f3.size, 0);
319092
- for (const f3 of list7.reverse()) {
319093
- if (total <= limit5)
319188
+ function soundCachePlan(files, o) {
319189
+ let total = files.reduce((n2, f3) => n2 + f3.size, 0), free = o.free;
319190
+ const evict2 = [], fits3 = () => total + o.needed <= o.limit && free - o.needed >= o.margin;
319191
+ for (const f3 of [...files].sort((a, b) => a.at - b.at)) {
319192
+ if (fits3())
319094
319193
  break;
319095
- if (f3.p === keep5)
319194
+ if (f3.p === o.keep)
319096
319195
  continue;
319097
- rmSync37(f3.p, { force: true });
319196
+ evict2.push(f3.p);
319098
319197
  total -= f3.size;
319198
+ free += f3.size;
319199
+ }
319200
+ return { evict: evict2, room: free - o.needed >= o.margin };
319201
+ }
319202
+ function trimSoundCache(dir2, keep5, limit5 = SOUND_CACHE_BYTES, needed = 0) {
319203
+ const plan = soundCachePlan(cacheFiles(dir2), { keep: keep5, limit: limit5, free: soundDisk.free(dir2), margin: SOUND_CACHE_MARGIN_BYTES, needed });
319204
+ for (const p of plan.evict)
319205
+ rmSync37(p, { force: true });
319206
+ return plan.room;
319207
+ }
319208
+ async function decodedSoundBytes(path15, rate) {
319209
+ const r = await run7(resolveFfprobe(), ["-v", "error", "-select_streams", "a:0", "-show_entries", "stream=channels:format=duration", "-of", "json", path15]).catch(() => null);
319210
+ if (!r?.ok)
319211
+ return 0;
319212
+ try {
319213
+ const j = JSON.parse(r.stdout || "{}");
319214
+ const seconds = Number(j.format?.duration), channels = j.streams?.[0]?.channels ?? 2;
319215
+ return Number.isFinite(seconds) && seconds > 0 ? Math.ceil(seconds * rate * channels * 4) : 0;
319216
+ } catch {
319217
+ return 0;
319099
319218
  }
319100
319219
  }
319101
319220
  async function decodeSound(path15, rate) {
@@ -319109,8 +319228,21 @@ async function decodeSound(path15, rate) {
319109
319228
  utimesSync(out, now2, now2);
319110
319229
  return { path: out, mime };
319111
319230
  }
319231
+ const needed = await decodedSoundBytes(path15, rate);
319232
+ if (!trimSoundCache(dir2, out, SOUND_CACHE_BYTES, needed + soundBytesPromised))
319233
+ throw noRoomForSound(needed);
319234
+ const cap = soundDisk.free(dir2) - SOUND_CACHE_MARGIN_BYTES - soundBytesPromised;
319235
+ if (cap <= 0)
319236
+ throw noRoomForSound(needed);
319112
319237
  const part = `${out}.${randomUUID60()}.part`;
319113
- const r = await run7(resolveFfmpeg(), ["-y", "-i", path15, "-map", "0:a:0", "-ar", String(rate), "-c:a", "pcm_f32le", "-rf64", "auto", "-f", "wav", part], { timeoutMs: SOUND_TIMEOUT_MS });
319238
+ soundBytesPromised += needed;
319239
+ const r = await run7(resolveFfmpeg(), ["-y", "-i", path15, "-map", "0:a:0", "-ar", String(rate), "-c:a", "pcm_f32le", "-rf64", "auto", "-fs", String(cap), "-f", "wav", part], { timeoutMs: SOUND_TIMEOUT_MS }).finally(() => {
319240
+ soundBytesPromised -= needed;
319241
+ });
319242
+ if (r.ok && existsSync85(part) && statSync72(part).size >= cap) {
319243
+ rmSync37(part, { force: true });
319244
+ throw noRoomForSound(Math.max(needed, cap));
319245
+ }
319114
319246
  if (r.ok && existsSync85(part)) {
319115
319247
  renameSync49(part, out);
319116
319248
  trimSoundCache(dir2, out);
@@ -319182,7 +319314,7 @@ function cleanupDir(dir2) {
319182
319314
  function readChunkBase64(path15) {
319183
319315
  return readFileSync125(path15).toString("base64");
319184
319316
  }
319185
- var mediaCwd, workDir, MIME_BY_EXT, DEFAULT_TIMEOUT_MS2, LONG_TIMEOUT_MS, MAX_FRAMES3, SOUND_TIMEOUT_MS, SOUND_CACHE_BYTES;
319317
+ var mediaCwd, workDir, MIME_BY_EXT, DEFAULT_TIMEOUT_MS2, LONG_TIMEOUT_MS, CLIP_AUDIO_FILE, WORK_DIR, CLIP_AUDIO_HELD_FILE, CLIP_AUDIO_HOLD_MS, CLIP_AUDIO_MIN_AGE_MS, CLIP_AUDIO_SWEEP_MS, clipAudioSweepDue, MAX_FRAMES3, SOUND_TIMEOUT_MS, SOUND_CACHE_BYTES, SOUND_CACHE_MARGIN_BYTES, soundDisk, cacheFiles, diskSize, noRoomForSound, soundBytesPromised;
319186
319318
  var init_video_edit = __esm({
319187
319319
  "../../packages/host-core/dist/video-edit.js"() {
319188
319320
  "use strict";
@@ -319209,9 +319341,28 @@ var init_video_edit = __esm({
319209
319341
  };
319210
319342
  DEFAULT_TIMEOUT_MS2 = 12e4;
319211
319343
  LONG_TIMEOUT_MS = 6e5;
319344
+ CLIP_AUDIO_FILE = /^fx-[01]\.wav$/;
319345
+ WORK_DIR = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
319346
+ CLIP_AUDIO_HELD_FILE = "held";
319347
+ CLIP_AUDIO_HOLD_MS = 36e5;
319348
+ CLIP_AUDIO_MIN_AGE_MS = 24 * 36e5;
319349
+ CLIP_AUDIO_SWEEP_MS = 6 * 36e5;
319350
+ clipAudioSweepDue = (lastTick, now2, interval = CLIP_AUDIO_SWEEP_MS) => now2 - lastTick < 2 * interval;
319212
319351
  MAX_FRAMES3 = 1e6;
319213
319352
  SOUND_TIMEOUT_MS = 2 * 36e5;
319214
319353
  SOUND_CACHE_BYTES = 20 * 1024 ** 3;
319354
+ SOUND_CACHE_MARGIN_BYTES = 1024 ** 3;
319355
+ soundDisk = { free: (dir2) => {
319356
+ const s = statfsSync(dir2);
319357
+ return Number(s.bavail) * Number(s.bsize);
319358
+ } };
319359
+ cacheFiles = (dir2) => readdirSync53(dir2).filter((f3) => f3.endsWith(".wav")).map((f3) => {
319360
+ const p = join164(dir2, f3), s = statSync72(p);
319361
+ return { p, size: s.size, at: s.mtimeMs };
319362
+ });
319363
+ diskSize = (n2) => n2 >= 1024 ** 3 ? `${(n2 / 1024 ** 3).toFixed(1)} GB` : `${Math.max(1, Math.ceil(n2 / 1024 ** 2))} MB`;
319364
+ noRoomForSound = (needed) => new Error(`Not enough free disk space to read this file's sound: it needs about ${diskSize(needed)}, and ${diskSize(SOUND_CACHE_MARGIN_BYTES)} must stay free. Free some space and try again.`);
319365
+ soundBytesPromised = 0;
319215
319366
  }
319216
319367
  });
319217
319368
 
@@ -392663,7 +392814,7 @@ __export(person_views_exports, {
392663
392814
  personViews: () => personViews,
392664
392815
  setPersonViews: () => setPersonViews
392665
392816
  });
392666
- import { closeSync as closeSync17, constants as constants7, fstatSync as fstatSync5, lstatSync as lstatSync10, openSync as openSync16, readdirSync as readdirSync62, readSync as readSync10 } from "node:fs";
392817
+ import { closeSync as closeSync17, constants as constants7, fstatSync as fstatSync5, lstatSync as lstatSync11, openSync as openSync16, readdirSync as readdirSync62, readSync as readSync10 } from "node:fs";
392667
392818
  import { extname as extname11, join as join204, normalize as normalize7, sep as sep35 } from "node:path";
392668
392819
  function madeFiles(folder) {
392669
392820
  const out = /* @__PURE__ */ new Map();
@@ -392683,7 +392834,7 @@ function madeFiles(folder) {
392683
392834
  const path15 = join204(dir2, name);
392684
392835
  let st;
392685
392836
  try {
392686
- st = lstatSync10(path15);
392837
+ st = lstatSync11(path15);
392687
392838
  } catch {
392688
392839
  continue;
392689
392840
  }
@@ -393933,7 +394084,7 @@ __export(person_exports, {
393933
394084
  writeHelpersList: () => writeHelpersList,
393934
394085
  writePersonCard: () => writePersonCard
393935
394086
  });
393936
- import { chmodSync as chmodSync17, existsSync as existsSync102, lchownSync as lchownSync5, lstatSync as lstatSync11, mkdirSync as mkdirSync114, readdirSync as readdirSync63, readFileSync as readFileSync149, renameSync as renameSync58, rmSync as rmSync49, statSync as statSync77, writeFileSync as writeFileSync104 } from "node:fs";
394087
+ import { chmodSync as chmodSync17, existsSync as existsSync102, lchownSync as lchownSync5, lstatSync as lstatSync12, mkdirSync as mkdirSync114, readdirSync as readdirSync63, readFileSync as readFileSync149, renameSync as renameSync58, rmSync as rmSync49, statSync as statSync77, writeFileSync as writeFileSync104 } from "node:fs";
393937
394088
  import { dirname as dirname87, join as join205 } from "node:path";
393938
394089
  function personCardFile() {
393939
394090
  return join205(personRoot(), PERSON_CARD_FILE);
@@ -394052,7 +394203,7 @@ function composeCharter(spec, t2, reach, teen = false) {
394052
394203
  function handHelperFolderOver(folder, u, fs31) {
394053
394204
  const n2 = handOver(folder, { tree: true, groupDirs: true }, u, fs31);
394054
394205
  try {
394055
- const st = lstatSync11(folder);
394206
+ const st = lstatSync12(folder);
394056
394207
  if (st.isDirectory() && !st.isSymbolicLink())
394057
394208
  (fs31?.chmod ?? chmodSync17)(folder, 1472);
394058
394209
  } catch {
@@ -394215,7 +394366,7 @@ function removeExactly(p) {
394215
394366
  if (!p.startsWith("/"))
394216
394367
  return false;
394217
394368
  try {
394218
- lstatSync11(p);
394369
+ lstatSync12(p);
394219
394370
  } catch {
394220
394371
  return false;
394221
394372
  }
@@ -431926,7 +432077,7 @@ var init_registry8 = __esm({
431926
432077
  // ../../packages/host-core/dist/crew/commit.js
431927
432078
  import { execFile as execFile32 } from "node:child_process";
431928
432079
  import { randomUUID as randomUUID86 } from "node:crypto";
431929
- import { lstatSync as lstatSync12, mkdirSync as mkdirSync126, rmSync as rmSync54 } from "node:fs";
432080
+ import { lstatSync as lstatSync13, mkdirSync as mkdirSync126, rmSync as rmSync54 } from "node:fs";
431930
432081
  import { join as join236 } from "node:path";
431931
432082
  function gitIdx(root, index, args, input) {
431932
432083
  const env = { ...process.env, GIT_INDEX_FILE: index, GIT_OPTIONAL_LOCKS: "0", LC_ALL: "C" };
@@ -432018,7 +432169,7 @@ async function planMine(root, tracker, sid, paths) {
432018
432169
  let mode = modes.get(f3.path);
432019
432170
  if (!mode) {
432020
432171
  try {
432021
- const st = lstatSync12(join236(root, f3.path));
432172
+ const st = lstatSync13(join236(root, f3.path));
432022
432173
  mode = st.isSymbolicLink() ? "120000" : st.mode & 73 ? "100755" : "100644";
432023
432174
  } catch {
432024
432175
  mode = "100644";
@@ -450804,7 +450955,7 @@ __export(crew_exports, {
450804
450955
  tapCrew: () => tapCrew
450805
450956
  });
450806
450957
  import { spawn as spawnProcess, spawnSync as spawnSync8 } from "node:child_process";
450807
- import { cpSync as cpSync6, existsSync as existsSync115, mkdirSync as mkdirSync134, mkdtempSync as mkdtempSync10, readFileSync as readFileSync174, realpathSync as realpathSync34, renameSync as renameSync69, rmdirSync as rmdirSync2, rmSync as rmSync56, statSync as statSync88, watch as watch5, writeFileSync as writeFileSync120 } from "node:fs";
450958
+ import { cpSync as cpSync6, existsSync as existsSync115, mkdirSync as mkdirSync134, mkdtempSync as mkdtempSync10, readFileSync as readFileSync174, realpathSync as realpathSync34, renameSync as renameSync69, rmdirSync as rmdirSync3, rmSync as rmSync56, statSync as statSync88, watch as watch5, writeFileSync as writeFileSync120 } from "node:fs";
450808
450959
  import { readFile as readFile38 } from "node:fs/promises";
450809
450960
  import { homedir as homedir56, tmpdir as tmpdir21 } from "node:os";
450810
450961
  import { basename as basename60, dirname as dirname109, isAbsolute as isAbsolute47, join as join243, relative as relative36, resolve as resolve47, sep as sep37 } from "node:path";
@@ -451495,7 +451646,7 @@ var init_crew2 = __esm({
451495
451646
  const kept2 = crewDir(root);
451496
451647
  rmSync56(kept2, { recursive: true, force: true });
451497
451648
  try {
451498
- rmdirSync2(dirname109(kept2));
451649
+ rmdirSync3(dirname109(kept2));
451499
451650
  } catch {
451500
451651
  }
451501
451652
  }
@@ -460840,7 +460991,7 @@ async function buildHandoff(req) {
460840
460991
  };
460841
460992
  try {
460842
460993
  const vault2 = getVaultManager();
460843
- if ((await vault2.status()).unlocked) {
460994
+ if (readPasswordManagerEnabled() && (await vault2.status()).unlocked) {
460844
460995
  const key7 = vault2.exportKeyForCompanion();
460845
460996
  if (key7)
460846
460997
  payload.vaultKey = key7;
@@ -460854,6 +461005,7 @@ var unb64u2;
460854
461005
  var init_companion_handoff = __esm({
460855
461006
  "../../packages/host-core/dist/companion-handoff.js"() {
460856
461007
  "use strict";
461008
+ init_daemon_settings();
460857
461009
  init_dist();
460858
461010
  init_credentials();
460859
461011
  init_host_scope();
@@ -483166,6 +483318,18 @@ async function runDaemon(opts = {}) {
483166
483318
  rdeskChannelClient = null;
483167
483319
  rdeskClientRef = null;
483168
483320
  }
483321
+ let passwordManagerOn = null;
483322
+ function syncAutofillBridge() {
483323
+ const on = readPasswordManagerEnabled();
483324
+ if (on === passwordManagerOn)
483325
+ return;
483326
+ passwordManagerOn = on;
483327
+ if (on)
483328
+ startAutofillBridge(log16);
483329
+ else
483330
+ stopAutofillBridge();
483331
+ refreshVaultSwitch();
483332
+ }
483169
483333
  function standDownFromMachine() {
483170
483334
  if (!ownsMachine)
483171
483335
  return;
@@ -483186,6 +483350,7 @@ async function runDaemon(opts = {}) {
483186
483350
  }
483187
483351
  try {
483188
483352
  stopAutofillBridge();
483353
+ passwordManagerOn = null;
483189
483354
  } catch {
483190
483355
  }
483191
483356
  try {
@@ -483226,7 +483391,7 @@ async function runDaemon(opts = {}) {
483226
483391
  }
483227
483392
  try {
483228
483393
  startFileProviderBridge(log16);
483229
- startAutofillBridge(log16);
483394
+ syncAutofillBridge();
483230
483395
  } catch {
483231
483396
  }
483232
483397
  startFileShare(log16);
@@ -483658,7 +483823,11 @@ async function runDaemon(opts = {}) {
483658
483823
  }
483659
483824
  if (ownsMachine) {
483660
483825
  startFileProviderBridge(log16);
483661
- startAutofillBridge(log16);
483826
+ syncAutofillBridge();
483827
+ onDaemonAgentSettingsChange(() => {
483828
+ if (ownsMachine)
483829
+ syncAutofillBridge();
483830
+ });
483662
483831
  startFileShare(log16);
483663
483832
  }
483664
483833
  if (ownsMachine)
@@ -483729,6 +483898,7 @@ var init_daemon_runtime = __esm({
483729
483898
  init_file_share_server();
483730
483899
  init_file_share_mount();
483731
483900
  init_autofill_bridge();
483901
+ init_manager2();
483732
483902
  init_power_node();
483733
483903
  init_local_server();
483734
483904
  init_native_host();
@@ -486082,7 +486252,7 @@ var init_interop_peers = __esm({
486082
486252
  });
486083
486253
 
486084
486254
  // ../../packages/host-core/dist/mesh/network-security.js
486085
- import { lstatSync as lstatSync13, realpathSync as realpathSync35 } from "node:fs";
486255
+ import { lstatSync as lstatSync14, realpathSync as realpathSync35 } from "node:fs";
486086
486256
  import { dirname as dirname126, win32 as win327 } from "node:path";
486087
486257
  function networkPowerShell(script) {
486088
486258
  return ["-NoLogo", "-NoProfile", "-NonInteractive", "-EncodedCommand", Buffer.from(script, "utf16le").toString("base64")];
@@ -486100,14 +486270,14 @@ async function requireNetworkAdmin(platform9, uid, run21) {
486100
486270
  }
486101
486271
  async function trustedNetworkPath(path15, platform9, ownerUid, run21, secret = false, directory = false) {
486102
486272
  const real4 = realpathSync35(path15);
486103
- const s = lstatSync13(path15);
486273
+ const s = lstatSync14(path15);
486104
486274
  if ((directory ? !s.isDirectory() : !s.isFile()) || s.isSymbolicLink())
486105
486275
  throw new Error("VPN path must be a non-redirected regular file or configuration directory");
486106
486276
  if (platform9 !== "win32") {
486107
486277
  if (s.uid !== ownerUid || (s.mode & (secret ? 63 : 18)) !== 0)
486108
486278
  throw new Error("VPN file must be administrator-owned with safe private permissions");
486109
486279
  for (let parent = dirname126(real4); ; parent = dirname126(parent)) {
486110
- const p = lstatSync13(parent);
486280
+ const p = lstatSync14(parent);
486111
486281
  if (!p.isDirectory() || p.isSymbolicLink() || p.uid !== ownerUid && p.uid !== 0 || (p.mode & 18) !== 0 && !((p.mode & 512) !== 0 && p.uid === 0)) {
486112
486282
  throw new Error("VPN executable parent directory is writable by another account");
486113
486283
  }
@@ -486138,7 +486308,7 @@ var init_network_security = __esm({
486138
486308
 
486139
486309
  // ../../packages/host-core/dist/mesh/tailscale-network.js
486140
486310
  import { execFile as execFile41 } from "node:child_process";
486141
- import { lstatSync as lstatSync14, realpathSync as realpathSync36 } from "node:fs";
486311
+ import { lstatSync as lstatSync15, realpathSync as realpathSync36 } from "node:fs";
486142
486312
  import { isIP as isIP4 } from "node:net";
486143
486313
  import { promisify as promisify17 } from "node:util";
486144
486314
  function parseTailscaleStatus(text45) {
@@ -486249,7 +486419,7 @@ function tailscaleNetwork(deps6 = defaults6) {
486249
486419
  const args = tailscaleJoinArgs(options, deps6.platform);
486250
486420
  if (options.authKeyFile) {
486251
486421
  const path15 = realpathSync36(options.authKeyFile);
486252
- const s = lstatSync14(options.authKeyFile);
486422
+ const s = lstatSync15(options.authKeyFile);
486253
486423
  if (!s.isFile() || s.isSymbolicLink())
486254
486424
  throw new Error("Tailscale auth key must be a private administrator-owned regular file");
486255
486425
  try {
@@ -491369,7 +491539,7 @@ var init_wireguard_export = __esm({
491369
491539
 
491370
491540
  // ../../packages/host-core/dist/mesh/tailnet-embedded.js
491371
491541
  import { execFile as execFile48 } from "node:child_process";
491372
- import { existsSync as existsSync152, lstatSync as lstatSync15, writeFileSync as writeFileSync153 } from "node:fs";
491542
+ import { existsSync as existsSync152, lstatSync as lstatSync16, writeFileSync as writeFileSync153 } from "node:fs";
491373
491543
  import { connect as connect7, isIP as isIP6 } from "node:net";
491374
491544
  import { win32 as win3210 } from "node:path";
491375
491545
  import { promisify as promisify24 } from "node:util";
@@ -491694,7 +491864,7 @@ function embeddedTailnets(deps6 = defaultEmbeddedTailnetDeps()) {
491694
491864
  if (!validTailnetId(args.id))
491695
491865
  throw new Error("a tailnet id is 1-32 lowercase letters, digits and hyphens");
491696
491866
  const control = controlUrl(args.control);
491697
- const s = lstatSync15(args.authKeyFile);
491867
+ const s = lstatSync16(args.authKeyFile);
491698
491868
  const isPrivate = platform9 === "win32" ? await trustedNetworkPath(args.authKeyFile, platform9, 0, deps6.run, true).then(() => true, () => false) : (s.mode & 63) === 0;
491699
491869
  if (!s.isFile() || s.isSymbolicLink() || !isPrivate) {
491700
491870
  throw new Error("the auth key must be a regular file only its owner can read");
@@ -491801,7 +491971,7 @@ var init_tailnet_embedded = __esm({
491801
491971
  });
491802
491972
 
491803
491973
  // ../../packages/host-core/dist/mesh/wireguard-windows.js
491804
- import { closeSync as closeSync22, constants as constants8, fstatSync as fstatSync6, lstatSync as lstatSync16, mkdirSync as mkdirSync167, openSync as openSync21, readFileSync as readFileSync211, readdirSync as readdirSync76, unlinkSync as unlinkSync19, writeFileSync as writeFileSync154 } from "node:fs";
491974
+ import { closeSync as closeSync22, constants as constants8, fstatSync as fstatSync6, lstatSync as lstatSync17, mkdirSync as mkdirSync167, openSync as openSync21, readFileSync as readFileSync211, readdirSync as readdirSync76, unlinkSync as unlinkSync19, writeFileSync as writeFileSync154 } from "node:fs";
491805
491975
  import { join as join302, win32 as win3211 } from "node:path";
491806
491976
  function windowsWireGuardNetworks(deps6, nameOf4, conflicts) {
491807
491977
  const binary = deps6.client ?? win3211.join(process.env.ProgramW6432 || process.env.ProgramFiles || "C:\\Program Files", "WireGuard", "wireguard.exe");
@@ -491821,7 +491991,7 @@ function windowsWireGuardNetworks(deps6, nameOf4, conflicts) {
491821
491991
  async function directory(create = false) {
491822
491992
  let stat28;
491823
491993
  try {
491824
- stat28 = lstatSync16(deps6.directory);
491994
+ stat28 = lstatSync17(deps6.directory);
491825
491995
  } catch (e) {
491826
491996
  if (e.code !== "ENOENT")
491827
491997
  throw e;
@@ -491829,7 +491999,7 @@ function windowsWireGuardNetworks(deps6, nameOf4, conflicts) {
491829
491999
  return false;
491830
492000
  mkdirSync167(deps6.directory, { recursive: true });
491831
492001
  await powershell(`& icacls.exe ${ps4(deps6.directory)} ${PRIVACY} | Out-Null; if($LASTEXITCODE -ne 0){exit 9}`, "could not protect WireGuard configuration directory");
491832
- stat28 = lstatSync16(deps6.directory);
492002
+ stat28 = lstatSync17(deps6.directory);
491833
492003
  }
491834
492004
  if (!stat28.isDirectory() || stat28.isSymbolicLink())
491835
492005
  throw new Error("WireGuard configuration directory must not be redirected");
@@ -491841,7 +492011,7 @@ function windowsWireGuardNetworks(deps6, nameOf4, conflicts) {
491841
492011
  return null;
491842
492012
  const path15 = file8(name);
491843
492013
  try {
491844
- lstatSync16(path15);
492014
+ lstatSync17(path15);
491845
492015
  } catch (e) {
491846
492016
  if (e.code === "ENOENT")
491847
492017
  return null;
@@ -491981,7 +492151,7 @@ var init_wireguard_windows = __esm({
491981
492151
  });
491982
492152
 
491983
492153
  // ../../packages/host-core/dist/mesh/wireguard-darwin.js
491984
- import { closeSync as closeSync23, constants as constants9, fchmodSync, fstatSync as fstatSync7, lstatSync as lstatSync17, mkdirSync as mkdirSync168, openSync as openSync22, readFileSync as readFileSync212, readdirSync as readdirSync77, unlinkSync as unlinkSync20, writeFileSync as writeFileSync155 } from "node:fs";
492154
+ import { closeSync as closeSync23, constants as constants9, fchmodSync, fstatSync as fstatSync7, lstatSync as lstatSync18, mkdirSync as mkdirSync168, openSync as openSync22, readFileSync as readFileSync212, readdirSync as readdirSync77, unlinkSync as unlinkSync20, writeFileSync as writeFileSync155 } from "node:fs";
491985
492155
  import { createPrivateKey as createPrivateKey4, createPublicKey as createPublicKey3 } from "node:crypto";
491986
492156
  import { networkInterfaces as networkInterfaces3 } from "node:os";
491987
492157
  import { dirname as dirname135, join as join303 } from "node:path";
@@ -492086,7 +492256,7 @@ function darwinWireGuardNetworks(deps6, nameOf4, conflicts) {
492086
492256
  }
492087
492257
  async function ownedJob(name) {
492088
492258
  try {
492089
- lstatSync17(plistFile(name));
492259
+ lstatSync18(plistFile(name));
492090
492260
  } catch (e) {
492091
492261
  if (e.code === "ENOENT")
492092
492262
  return false;
@@ -492122,13 +492292,13 @@ function darwinWireGuardNetworks(deps6, nameOf4, conflicts) {
492122
492292
  const path15 = join303(options.runtimeDirectory, `${nameOf4(name)}.name`);
492123
492293
  let file8;
492124
492294
  try {
492125
- file8 = lstatSync17(path15);
492295
+ file8 = lstatSync18(path15);
492126
492296
  } catch (e) {
492127
492297
  if (e.code === "ENOENT")
492128
492298
  return null;
492129
492299
  throw e;
492130
492300
  }
492131
- const parent = lstatSync17(options.runtimeDirectory);
492301
+ const parent = lstatSync18(options.runtimeDirectory);
492132
492302
  for (const s of [file8, parent]) {
492133
492303
  if (s.isSymbolicLink() || ![0, deps6.ownerUid].includes(s.uid) || (s.mode & 18) !== 0) {
492134
492304
  throw new Error("upstream WireGuard runtime mapping is not administrator-owned");
@@ -492338,7 +492508,7 @@ var init_wireguard_darwin = __esm({
492338
492508
 
492339
492509
  // ../../packages/host-core/dist/mesh/wireguard-network.js
492340
492510
  import { execFile as execFile49 } from "node:child_process";
492341
- import { closeSync as closeSync24, constants as constants10, fchmodSync as fchmodSync2, fstatSync as fstatSync8, lstatSync as lstatSync18, mkdirSync as mkdirSync169, openSync as openSync23, readFileSync as readFileSync213, readdirSync as readdirSync78, unlinkSync as unlinkSync21, writeFileSync as writeFileSync156 } from "node:fs";
492511
+ import { closeSync as closeSync24, constants as constants10, fchmodSync as fchmodSync2, fstatSync as fstatSync8, lstatSync as lstatSync19, mkdirSync as mkdirSync169, openSync as openSync23, readFileSync as readFileSync213, readdirSync as readdirSync78, unlinkSync as unlinkSync21, writeFileSync as writeFileSync156 } from "node:fs";
492342
492512
  import { isIP as isIP7 } from "node:net";
492343
492513
  import { join as join304 } from "node:path";
492344
492514
  import { promisify as promisify25 } from "node:util";
@@ -492405,7 +492575,7 @@ function wireGuardNetworks(deps6 = defaults7) {
492405
492575
  mkdirSync169(deps6.directory, { recursive: true, mode: 448 });
492406
492576
  let stat28;
492407
492577
  try {
492408
- stat28 = lstatSync18(deps6.directory);
492578
+ stat28 = lstatSync19(deps6.directory);
492409
492579
  } catch (e) {
492410
492580
  if (e.code === "ENOENT" && !create)
492411
492581
  return false;
@@ -492820,7 +492990,7 @@ var init_seed_files = __esm({
492820
492990
 
492821
492991
  // ../../packages/host-core/dist/assistant/boot.js
492822
492992
  import { createHash as createHash81 } from "node:crypto";
492823
- import { cpSync as cpSync7, existsSync as existsSync154, lstatSync as lstatSync19, mkdirSync as mkdirSync170, readdirSync as readdirSync79, readFileSync as readFileSync215, readlinkSync as readlinkSync4, renameSync as renameSync82, rmSync as rmSync73, statSync as statSync98, symlinkSync as symlinkSync3, writeFileSync as writeFileSync157, chmodSync as chmodSync29 } from "node:fs";
492993
+ import { cpSync as cpSync7, existsSync as existsSync154, lstatSync as lstatSync20, mkdirSync as mkdirSync170, readdirSync as readdirSync79, readFileSync as readFileSync215, readlinkSync as readlinkSync4, renameSync as renameSync82, rmSync as rmSync73, statSync as statSync98, symlinkSync as symlinkSync3, writeFileSync as writeFileSync157, chmodSync as chmodSync29 } from "node:fs";
492824
492994
  import { homedir as homedir68 } from "node:os";
492825
492995
  import { dirname as dirname137, join as join306, resolve as resolve51, sep as sep42 } from "node:path";
492826
492996
  function parse14(raw2, what, problems) {
@@ -493082,7 +493252,7 @@ function readableByAll(dir2) {
493082
493252
  const visit2 = (p, depth) => {
493083
493253
  let st;
493084
493254
  try {
493085
- st = lstatSync19(p);
493255
+ st = lstatSync20(p);
493086
493256
  } catch {
493087
493257
  return;
493088
493258
  }
@@ -493106,7 +493276,7 @@ function readableByAll(dir2) {
493106
493276
  visit2(dir2, 0);
493107
493277
  for (let d = dirname137(dir2); d.startsWith("/opt/") && d !== "/opt"; d = dirname137(d)) {
493108
493278
  try {
493109
- chmodSync29(d, lstatSync19(d).mode & 4095 | 493);
493279
+ chmodSync29(d, lstatSync20(d).mode & 4095 | 493);
493110
493280
  } catch {
493111
493281
  }
493112
493282
  }
@@ -493118,15 +493288,15 @@ function mergeMissing(from, to) {
493118
493288
  errorOnExist: false,
493119
493289
  verbatimSymlinks: true,
493120
493290
  filter: (src2, dest) => {
493121
- const d = lstatSync19(dest, { throwIfNoEntry: false });
493291
+ const d = lstatSync20(dest, { throwIfNoEntry: false });
493122
493292
  if (!d)
493123
493293
  return true;
493124
- return d.isDirectory() && lstatSync19(src2).isDirectory();
493294
+ return d.isDirectory() && lstatSync20(src2).isDirectory();
493125
493295
  }
493126
493296
  });
493127
493297
  }
493128
493298
  function linkKept(at2, there, movedFrom) {
493129
- const now2 = lstatSync19(at2, { throwIfNoEntry: false });
493299
+ const now2 = lstatSync20(at2, { throwIfNoEntry: false });
493130
493300
  if (now2?.isSymbolicLink() && readlinkSync4(at2) === there)
493131
493301
  return false;
493132
493302
  mkdirSync170(there, { recursive: true });
@@ -493183,7 +493353,7 @@ function persistFrameworkHome(u, assistantDir, problems, isVolume = onOwnVolume2
493183
493353
  const real4 = join306(volume, ".agent-home");
493184
493354
  try {
493185
493355
  mkdirSync170(real4, { recursive: true, mode: 448 });
493186
- const at2 = lstatSync19(u.home, { throwIfNoEntry: false });
493356
+ const at2 = lstatSync20(u.home, { throwIfNoEntry: false });
493187
493357
  if (at2 && !(at2.isSymbolicLink() && readlinkSync4(u.home) === real4))
493188
493358
  rmSync73(u.home, { recursive: true, force: true });
493189
493359
  if (!at2 || !(at2.isSymbolicLink() && readlinkSync4(u.home) === real4)) {
@@ -493202,10 +493372,10 @@ function migrateLegacyEngineHomes(home2, legacyDir, problems = []) {
493202
493372
  const from = join306(legacyDir, rel);
493203
493373
  const to = join306(home2, rel);
493204
493374
  try {
493205
- const st = lstatSync19(from, { throwIfNoEntry: false });
493375
+ const st = lstatSync20(from, { throwIfNoEntry: false });
493206
493376
  if (!st || !st.isDirectory())
493207
493377
  continue;
493208
- const there = lstatSync19(to, { throwIfNoEntry: false });
493378
+ const there = lstatSync20(to, { throwIfNoEntry: false });
493209
493379
  if (there?.isDirectory() && readdirSync79(to).length)
493210
493380
  continue;
493211
493381
  mkdirSync170(dirname137(to), { recursive: true });
@@ -493225,7 +493395,7 @@ function prepareFrameworkUser(u, tessHome, problems, upTo = "/", realHome = u.ho
493225
493395
  if (realHome !== u.home) {
493226
493396
  try {
493227
493397
  mkdirSync170(dirname137(u.home), { recursive: true });
493228
- if (!lstatSync19(u.home, { throwIfNoEntry: false }))
493398
+ if (!lstatSync20(u.home, { throwIfNoEntry: false }))
493229
493399
  symlinkSync3(realHome, u.home, "dir");
493230
493400
  } catch {
493231
493401
  }
@@ -493364,7 +493534,7 @@ async function bootAssistant(env = process.env) {
493364
493534
  problems.push(`its connections could not be taken in: ${e.message}`);
493365
493535
  }
493366
493536
  if (fu) {
493367
- const realHome = lstatSync19(fu.home, { throwIfNoEntry: false })?.isSymbolicLink() ? readlinkSync4(fu.home) : fu.home;
493537
+ const realHome = lstatSync20(fu.home, { throwIfNoEntry: false })?.isSymbolicLink() ? readlinkSync4(fu.home) : fu.home;
493368
493538
  const handed = handFrameworkAreasOver(fu, [realHome, ...folder ? [folder] : []]);
493369
493539
  report2.frameworkUser = { user: fu.user, handedOver: handed };
493370
493540
  }
@@ -493714,6 +493884,7 @@ __export(dist_exports8, {
493714
493884
  BUNDLED_MCP_SERVERS: () => BUNDLED_MCP_SERVERS,
493715
493885
  CATALOG_CATEGORIES: () => CATALOG_CATEGORIES,
493716
493886
  CERT_GENESIS_FP_OFFSET: () => CERT_GENESIS_FP_OFFSET,
493887
+ CLIP_AUDIO_SWEEP_MS: () => CLIP_AUDIO_SWEEP_MS,
493717
493888
  CLI_SHIM_MARKER: () => MARKER3,
493718
493889
  CONTROL_VERSION: () => CONTROL_VERSION,
493719
493890
  ConnectorAuthError: () => ConnectorAuthError,
@@ -493837,6 +494008,7 @@ __export(dist_exports8, {
493837
494008
  cleanupDir: () => cleanupDir,
493838
494009
  clearPeerKeyCache: () => clearPeerKeyCache,
493839
494010
  clientCapabilities: () => clientCapabilities,
494011
+ clipAudioSweepDue: () => clipAudioSweepDue,
493840
494012
  closeAllVfsSessions: () => closeAllVfsSessions,
493841
494013
  codexAuthJson: () => codexAuthJson,
493842
494014
  collectItems: () => collectItems,
@@ -494320,6 +494492,7 @@ __export(dist_exports8, {
494320
494492
  stopsOf: () => stopsOf,
494321
494493
  suggestLabel: () => suggestLabel,
494322
494494
  suggestLinkId: () => suggestLinkId,
494495
+ sweepClipAudio: () => sweepClipAudio,
494323
494496
  syncAdsPixel: () => syncAdsPixel,
494324
494497
  syncRoutes: () => syncRoutes,
494325
494498
  systemState: () => systemState,
@@ -518545,7 +518718,7 @@ async function meshCommand(rest, flags) {
518545
518718
  // src/deploy.ts
518546
518719
  init_hosting();
518547
518720
  import { execFileSync as execFileSync11 } from "node:child_process";
518548
- import { lstatSync as lstatSync20, readdirSync as readdirSync80, readFileSync as readFileSync223, statSync as statSync99 } from "node:fs";
518721
+ import { lstatSync as lstatSync21, readdirSync as readdirSync80, readFileSync as readFileSync223, statSync as statSync99 } from "node:fs";
518549
518722
  import { basename as basename70, join as join312, relative as relative41, resolve as resolve54, sep as sep43 } from "node:path";
518550
518723
  import { gzipSync as gzipSync3 } from "node:zlib";
518551
518724
  function listProjectFiles(root) {
@@ -518564,7 +518737,7 @@ function listProjectFiles(root) {
518564
518737
  const abs = join312(dir2, name);
518565
518738
  const rel = relative41(root, abs).split(sep43).join("/");
518566
518739
  if (!shouldUploadPath(rel)) continue;
518567
- const st = lstatSync20(abs);
518740
+ const st = lstatSync21(abs);
518568
518741
  if (st.isDirectory()) walk6(abs);
518569
518742
  else if (st.isFile()) out.push(rel);
518570
518743
  if (out.length > SOURCE_MAX_FILES) return;
@@ -518583,7 +518756,7 @@ function packProject(root) {
518583
518756
  for (const rel of rels) {
518584
518757
  const abs = join312(root, rel);
518585
518758
  try {
518586
- const st = lstatSync20(abs);
518759
+ const st = lstatSync21(abs);
518587
518760
  if (!st.isFile()) {
518588
518761
  skipped.push(rel);
518589
518762
  continue;
@@ -518746,7 +518919,7 @@ init_dist2();
518746
518919
  init_base_paths();
518747
518920
  import { spawnSync as spawnSync10 } from "node:child_process";
518748
518921
  import { createHash as createHash82 } from "node:crypto";
518749
- import { chmodSync as chmodSync32, existsSync as existsSync161, mkdirSync as mkdirSync175, readdirSync as readdirSync81, renameSync as renameSync85, rmSync as rmSync76, statSync as statSync100, symlinkSync as symlinkSync4, writeFileSync as writeFileSync164, lstatSync as lstatSync21, unlinkSync as unlinkSync22 } from "node:fs";
518922
+ import { chmodSync as chmodSync32, existsSync as existsSync161, mkdirSync as mkdirSync175, readdirSync as readdirSync81, renameSync as renameSync85, rmSync as rmSync76, statSync as statSync100, symlinkSync as symlinkSync4, writeFileSync as writeFileSync164, lstatSync as lstatSync22, unlinkSync as unlinkSync22 } from "node:fs";
518750
518923
  import { writeFile as writeFile30 } from "node:fs/promises";
518751
518924
  import { createRequire as createRequire8 } from "node:module";
518752
518925
  import { delimiter as delimiter4, join as join313 } from "node:path";
@@ -518929,7 +519102,7 @@ async function withLock2(tools3, fn) {
518929
519102
  }
518930
519103
  function clear(at2) {
518931
519104
  try {
518932
- lstatSync21(at2);
519105
+ lstatSync22(at2);
518933
519106
  unlinkSync22(at2);
518934
519107
  } catch {
518935
519108
  }