glimmervoid 0.46.2-next.164 → 0.46.2-next.166

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 (79) hide show
  1. package/dist/bin/glimmervoid.js +4 -4
  2. package/dist/chunks/{adapters-BEHP94Wf.js → adapters-DmzmKIDw.js} +1 -1
  3. package/dist/chunks/{adapters-CeXianY1.js → adapters-d3XIppeP.js} +1 -1
  4. package/dist/chunks/{agent-setup-cli-CbTPZyK7.js → agent-setup-cli-C7x4N5U6.js} +1 -1
  5. package/dist/chunks/{kimi-VBamp5vp.js → kimi-Be_QndbF.js} +406 -22
  6. package/dist/chunks/{main-CDJ_G4MN.js → main-Dyx_oiMS.js} +26 -2
  7. package/dist/client/assets/{alert-sound-BpSLIB7B.js → alert-sound-CMw9IYOa.js} +1 -1
  8. package/dist/client/assets/alert-sound-CMw9IYOa.js.br +0 -0
  9. package/dist/client/assets/{benchmark-panel-CCGDqJr-.js → benchmark-panel-12iKvivr.js} +1 -1
  10. package/dist/client/assets/benchmark-panel-12iKvivr.js.br +0 -0
  11. package/dist/client/assets/{celebration-player-CXZ_7pBQ.js → celebration-player-CpgG9DUA.js} +1 -1
  12. package/dist/client/assets/celebration-player-CpgG9DUA.js.br +0 -0
  13. package/dist/client/assets/{dialogs-He8NLJ05.js → dialogs-x_B527bk.js} +1 -1
  14. package/dist/client/assets/dialogs-x_B527bk.js.br +0 -0
  15. package/dist/client/assets/{doc-editor-ui-CTBMbMm-.js → doc-editor-ui-CIhJUO3J.js} +1 -1
  16. package/dist/client/assets/doc-editor-ui-CIhJUO3J.js.br +0 -0
  17. package/dist/client/assets/{feature-hint-5AlbguSC.js → feature-hint-MLJvjOT0.js} +1 -1
  18. package/dist/client/assets/feature-hint-MLJvjOT0.js.br +0 -0
  19. package/dist/client/assets/{first-run-checklist-DXRRzQlR.js → first-run-checklist-s4X-OM4Z.js} +1 -1
  20. package/dist/client/assets/first-run-checklist-s4X-OM4Z.js.br +0 -0
  21. package/dist/client/assets/{hooks-panel-EroOPQJe.js → hooks-panel-121qcKFE.js} +1 -1
  22. package/dist/client/assets/hooks-panel-121qcKFE.js.br +0 -0
  23. package/dist/client/assets/{index-Cb2I6OyB.js → index-BJ8diTZl.js} +5 -5
  24. package/dist/client/assets/index-BJ8diTZl.js.br +0 -0
  25. package/dist/client/assets/{issues-panel-wHP4NQtT.js → issues-panel-CMZFcUDT.js} +1 -1
  26. package/dist/client/assets/issues-panel-CMZFcUDT.js.br +0 -0
  27. package/dist/client/assets/{nyan-cat-CWOvLOgY.js → nyan-cat-BvxG-Hhz.js} +1 -1
  28. package/dist/client/assets/nyan-cat-BvxG-Hhz.js.br +0 -0
  29. package/dist/client/assets/{phone-shell-CHGFXoec.js → phone-shell-DtQYi3Yz.js} +1 -1
  30. package/dist/client/assets/phone-shell-DtQYi3Yz.js.br +0 -0
  31. package/dist/client/assets/{plan-face-d6GCOLvG.js → plan-face-BfwHo5re.js} +1 -1
  32. package/dist/client/assets/plan-face-BfwHo5re.js.br +0 -0
  33. package/dist/client/assets/{plan-render-Booa3Bo-.js → plan-render-QchOXg1E.js} +1 -1
  34. package/dist/client/assets/plan-render-QchOXg1E.js.br +0 -0
  35. package/dist/client/assets/{pr-scope-tabs-ymgl1HSU.js → pr-scope-tabs-BqPN4zAH.js} +1 -1
  36. package/dist/client/assets/pr-scope-tabs-BqPN4zAH.js.br +0 -0
  37. package/dist/client/assets/{radar-panel-zPNaBZ3v.js → radar-panel-DQCaWDNM.js} +1 -1
  38. package/dist/client/assets/radar-panel-DQCaWDNM.js.br +0 -0
  39. package/dist/client/assets/{resume-dialog-DK_3xJpx.js → resume-dialog-C_NFnnAx.js} +1 -1
  40. package/dist/client/assets/resume-dialog-C_NFnnAx.js.br +0 -0
  41. package/dist/client/assets/{review-queue-panel-CwPAHBMr.js → review-queue-panel-DTM1__rk.js} +1 -1
  42. package/dist/client/assets/review-queue-panel-DTM1__rk.js.br +0 -0
  43. package/dist/client/assets/{settings-panel-DzT428RT.js → settings-panel-k5MM_UFC.js} +2 -2
  44. package/dist/client/assets/settings-panel-k5MM_UFC.js.br +0 -0
  45. package/dist/client/assets/{shown-lightbox-uBt09HlZ.js → shown-lightbox-Bdv2LDYa.js} +1 -1
  46. package/dist/client/assets/shown-lightbox-Bdv2LDYa.js.br +0 -0
  47. package/dist/client/assets/{trace-panel-0V0cammV.js → trace-panel-BlczKgbw.js} +1 -1
  48. package/dist/client/assets/trace-panel-BlczKgbw.js.br +0 -0
  49. package/dist/client/assets/{usage-panel-xp0GhpuL.js → usage-panel-DeCYlwfG.js} +1 -1
  50. package/dist/client/assets/usage-panel-DeCYlwfG.js.br +0 -0
  51. package/dist/client/assets/{visions-panel-CMckrSY3.js → visions-panel-IoBQ4LJF.js} +1 -1
  52. package/dist/client/assets/visions-panel-IoBQ4LJF.js.br +0 -0
  53. package/dist/client/index.html +1 -1
  54. package/dist/client/index.html.br +0 -0
  55. package/dist/server/index.js +1 -1
  56. package/package.json +1 -1
  57. package/dist/client/assets/alert-sound-BpSLIB7B.js.br +0 -0
  58. package/dist/client/assets/benchmark-panel-CCGDqJr-.js.br +0 -0
  59. package/dist/client/assets/celebration-player-CXZ_7pBQ.js.br +0 -0
  60. package/dist/client/assets/dialogs-He8NLJ05.js.br +0 -0
  61. package/dist/client/assets/doc-editor-ui-CTBMbMm-.js.br +0 -0
  62. package/dist/client/assets/feature-hint-5AlbguSC.js.br +0 -0
  63. package/dist/client/assets/first-run-checklist-DXRRzQlR.js.br +0 -0
  64. package/dist/client/assets/hooks-panel-EroOPQJe.js.br +0 -0
  65. package/dist/client/assets/index-Cb2I6OyB.js.br +0 -0
  66. package/dist/client/assets/issues-panel-wHP4NQtT.js.br +0 -0
  67. package/dist/client/assets/nyan-cat-CWOvLOgY.js.br +0 -0
  68. package/dist/client/assets/phone-shell-CHGFXoec.js.br +0 -0
  69. package/dist/client/assets/plan-face-d6GCOLvG.js.br +0 -0
  70. package/dist/client/assets/plan-render-Booa3Bo-.js.br +0 -0
  71. package/dist/client/assets/pr-scope-tabs-ymgl1HSU.js.br +0 -0
  72. package/dist/client/assets/radar-panel-zPNaBZ3v.js.br +0 -0
  73. package/dist/client/assets/resume-dialog-DK_3xJpx.js.br +0 -0
  74. package/dist/client/assets/review-queue-panel-CwPAHBMr.js.br +0 -0
  75. package/dist/client/assets/settings-panel-DzT428RT.js.br +0 -0
  76. package/dist/client/assets/shown-lightbox-uBt09HlZ.js.br +0 -0
  77. package/dist/client/assets/trace-panel-0V0cammV.js.br +0 -0
  78. package/dist/client/assets/usage-panel-xp0GhpuL.js.br +0 -0
  79. package/dist/client/assets/visions-panel-CMckrSY3.js.br +0 -0
@@ -70,7 +70,7 @@ var OWN_SUBCOMMAND_RUNNERS = [
70
70
  return runPairCli(subcommandArgs);
71
71
  }],
72
72
  ["agent", async (subcommandArgs) => {
73
- const { runAgentSetupCli } = await import("../chunks/agent-setup-cli-CbTPZyK7.js");
73
+ const { runAgentSetupCli } = await import("../chunks/agent-setup-cli-C7x4N5U6.js");
74
74
  return runAgentSetupCli(subcommandArgs);
75
75
  }],
76
76
  ["settings", async (subcommandArgs) => {
@@ -235,7 +235,7 @@ async function runDoctor() {
235
235
  }
236
236
  switchSection("Agents");
237
237
  try {
238
- const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-CeXianY1.js");
238
+ const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-d3XIppeP.js");
239
239
  const declaredCustomAgents = await readDeclaredCustomAgents();
240
240
  if (declaredCustomAgents.error) line("config", declaredCustomAgents.error);
241
241
  setCustomAgents(declaredCustomAgents.declared);
@@ -243,7 +243,7 @@ async function runDoctor() {
243
243
  const { label, path: resolvedPath } = describeAgentResolvability(id);
244
244
  line(`${id} (${label})`, resolvedPath ?? missingAgentText(id));
245
245
  }
246
- const { inspectGrokAgentSetup, inspectKimiAgentSetup } = await import("../chunks/agent-setup-cli-CbTPZyK7.js");
246
+ const { inspectGrokAgentSetup, inspectKimiAgentSetup } = await import("../chunks/agent-setup-cli-C7x4N5U6.js");
247
247
  const grokSetup = inspectGrokAgentSetup();
248
248
  line("grok hook setup", `${grokSetup.classification}: ${grokSetup.filePath}`);
249
249
  const kimiSetup = inspectKimiAgentSetup();
@@ -262,7 +262,7 @@ async function runDoctor() {
262
262
  try {
263
263
  const { resolvePackageBin } = await import("../chunks/runtime-paths-Cc0_ZR6V.js");
264
264
  const { execFileSync } = await import("../chunks/child-process-safe-CjVtRjDD.js");
265
- const { inspectGrokAgentSetup } = await import("../chunks/agent-setup-cli-CbTPZyK7.js");
265
+ const { inspectGrokAgentSetup } = await import("../chunks/agent-setup-cli-C7x4N5U6.js");
266
266
  const binPath = resolvePackageBin("cc-safety-net", "cc-safety-net");
267
267
  line("Sane YOLO", binPath || "not installed");
268
268
  if (binPath) line("cc-safety-net version", execFileSync(process.execPath, [binPath, "--version"], {
@@ -7,7 +7,7 @@ import { c as textOr, i as numberOr, s as rawTextOr } from "./coerce-NSst8oRP.js
7
7
  import { n as resolveAgentCommand, t as buildAgentSpawnCommand } from "./spawn-command-Cc40FiZI.js";
8
8
  import { n as parseJsonRecord } from "./json-core-dfa_7Fak.js";
9
9
  import { r as nextBackoffMs } from "./backoff-DjVpfHk7.js";
10
- import { a as classifyAgentTitle, i as grok, o as isBrailleChar, s as isSpinnerChar, t as kimi, u as buildAgentEnv } from "./kimi-VBamp5vp.js";
10
+ import { a as classifyAgentTitle, i as grok, o as isBrailleChar, s as isSpinnerChar, t as kimi, u as buildAgentEnv } from "./kimi-Be_QndbF.js";
11
11
  import { t as buildHookCommand } from "./hook-command-core-qTNK-xMF.js";
12
12
  import { n as isExperimentalBuild, t as compareReleaseVersions } from "./build-channel-DqsP-nkH.js";
13
13
  import { n as mergeCodexPreToolUse, t as HOOK_TOOLS } from "./hook-tools-Cr97Vdap.js";
@@ -1 +1 @@
1
- export { a as describeAgentResolvability, l as listAgentIds, f as setCustomAgents } from "./adapters-BEHP94Wf.js";
1
+ export { a as describeAgentResolvability, l as listAgentIds, f as setCustomAgents } from "./adapters-DmzmKIDw.js";
@@ -1,5 +1,5 @@
1
1
  import { a as isMissingFileError, r as errorMessage } from "./text-DoirglWV.js";
2
- import { c as classifyGrokHooksFile, i as grok, l as renderGrokHooksFile, n as classifyKimiConfig, r as spliceKimiHooksBlock, t as kimi } from "./kimi-VBamp5vp.js";
2
+ import { c as classifyGrokHooksFile, i as grok, l as renderGrokHooksFile, n as classifyKimiConfig, r as spliceKimiHooksBlock, t as kimi } from "./kimi-Be_QndbF.js";
3
3
  import { p as writeTextAtomicSync } from "./json-file-BjFK_eSH.js";
4
4
  import fs from "node:fs";
5
5
  import path from "node:path";
@@ -1,5 +1,6 @@
1
- import { r as errorMessage } from "./text-DoirglWV.js";
1
+ import { a as isMissingFileError, r as errorMessage } from "./text-DoirglWV.js";
2
2
  import { s as relayPath } from "./runtime-paths-ghcH9CeW.js";
3
+ import { n as glimmervoidHomeDir } from "./config-path-core-DUWk0Lui.js";
3
4
  import { O as SIGN_URL_ENV, n as AGENT_URL_ENV, r as ASK_USER_QUESTION_TOOL_NAME } from "./session-B2Wieg0a.js";
4
5
  import { r as execFileSync } from "./child-process-safe-D4hyVIXj.js";
5
6
  import { n as isRecord } from "./coerce-NSst8oRP.js";
@@ -7,6 +8,7 @@ import { n as resolveAgentCommand, t as buildAgentSpawnCommand } from "./spawn-c
7
8
  import { t as HOOK_URL_ENV } from "./hook-relay-core-DA_bz2KA.js";
8
9
  import { a as KIMI_SANE_YOLO_FLAVOR, o as SANE_YOLO_PATH_ENV, r as RTK_PATH_ENV, s as saneYoloEnv } from "./rtk-hook-core-23_GM8RQ.js";
9
10
  import { t as buildHookCommand } from "./hook-command-core-qTNK-xMF.js";
11
+ import { p as writeTextAtomicSync } from "./json-file-BjFK_eSH.js";
10
12
  import fs from "node:fs";
11
13
  import path from "node:path";
12
14
  import os from "node:os";
@@ -557,11 +559,400 @@ function spliceKimiHooksBlock(configText, block) {
557
559
  changed: true
558
560
  };
559
561
  }
562
+ var KIMI_CONFIG_NAME = "config.toml";
563
+ var KIMI_SOURCES_NAME = ".glimmervoid-sources.json";
564
+ var KIMI_CONFLICTS_NAME = ".glimmervoid-conflicts";
565
+ var GENERATED_ONLY_NAMES = /* @__PURE__ */ new Set([
566
+ KIMI_CONFIG_NAME,
567
+ KIMI_SOURCES_NAME,
568
+ KIMI_CONFLICTS_NAME
569
+ ]);
570
+ var FILE_STAMP_PREFIX = "file:";
571
+ function generatedKimiConfig(realConfigText, hooksBlock) {
572
+ const configText = realConfigText ?? "";
573
+ const span = locateBlock(configText);
574
+ if (span === "foreign") return { refusal: "its Glimmervoid hooks block markers are unbalanced" };
575
+ const operatorText = span === "absent" ? configText : `${configText.slice(0, span.start)}${configText.slice(span.end)}`;
576
+ if (definesHooksOutsideArrayTables(operatorText)) return { refusal: "it defines hooks as a key or [hooks] table, which a [[hooks]] block cannot extend" };
577
+ const spliced = spliceKimiHooksBlock(operatorText, hooksBlock);
578
+ if ("refused" in spliced) return { refusal: `its hooks are ${spliced.refused}` };
579
+ return {
580
+ text: spliced.contents,
581
+ hadBlock: span !== "absent"
582
+ };
583
+ }
584
+ function configSourceStamp(realConfigText, hooksBlock) {
585
+ return createHash("sha256").update(realConfigText ?? "").update("\0").update(hooksBlock).digest("hex");
586
+ }
587
+ function linkKindFor(kind, platform) {
588
+ if (platform !== "win32") return "symlink";
589
+ return kind === "folder" ? "junction" : "hardlink";
590
+ }
591
+ function fileStampKey(name) {
592
+ return `${FILE_STAMP_PREFIX}${name}`;
593
+ }
594
+ function planReplacedFile(real, target, lastFileStamp) {
595
+ if (real.fileStamp !== null && real.fileStamp === lastFileStamp) return {
596
+ kind: "promote",
597
+ name: real.name,
598
+ target
599
+ };
600
+ return {
601
+ kind: "set-aside",
602
+ name: real.name
603
+ };
604
+ }
605
+ function planPrivateFolder(real, generated, target) {
606
+ const realChildNames = new Set(real.childNames);
607
+ if (generated.childNames.some((childName) => realChildNames.has(childName))) return "private";
608
+ return {
609
+ kind: "adopt",
610
+ name: real.name,
611
+ target,
612
+ childNames: generated.childNames
613
+ };
614
+ }
615
+ function planEntryLink(real, generated, inputs) {
616
+ const target = path.join(inputs.realHome, real.name);
617
+ const link = {
618
+ kind: "link",
619
+ name: real.name,
620
+ target,
621
+ linkKind: linkKindFor(real.kind, inputs.platform)
622
+ };
623
+ if (!generated) return [link];
624
+ if (generated.kind === "link") return generated.linkTarget === target ? [] : [{
625
+ kind: "unlink",
626
+ name: real.name
627
+ }, link];
628
+ if (generated.kind === "file" && real.kind === "file") return [planReplacedFile(real, target, inputs.sourceStamps[fileStampKey(real.name)]), link];
629
+ if (generated.kind !== "folder" || real.kind !== "folder") return "private";
630
+ const adoption = planPrivateFolder(real, generated, target);
631
+ return adoption === "private" ? adoption : [adoption, link];
632
+ }
633
+ function planKimiHome(inputs) {
634
+ const config = generatedKimiConfig(inputs.realConfigText, inputs.hooksBlock);
635
+ if ("refusal" in config) return {
636
+ kind: "refused",
637
+ reason: `the real ${KIMI_CONFIG_NAME} cannot take the hooks block: ${config.refusal}`
638
+ };
639
+ const steps = [];
640
+ const configStamp = configSourceStamp(inputs.realConfigText, inputs.hooksBlock);
641
+ if (!(inputs.generatedConfigText !== null && inputs.sourceStamps["config.toml"] === configStamp && classifyKimiConfig(inputs.generatedConfigText, inputs.hooksBlock) === "current")) steps.push({
642
+ kind: "write-config",
643
+ text: config.text
644
+ });
645
+ const generatedByName = new Map(inputs.generatedEntries.map((entry) => [entry.name, entry]));
646
+ const realNames = /* @__PURE__ */ new Set();
647
+ const privateNames = [];
648
+ for (const real of inputs.realEntries) {
649
+ if (GENERATED_ONLY_NAMES.has(real.name)) continue;
650
+ realNames.add(real.name);
651
+ const entrySteps = planEntryLink(real, generatedByName.get(real.name), inputs);
652
+ if (entrySteps === "private") {
653
+ privateNames.push(real.name);
654
+ continue;
655
+ }
656
+ steps.push(...entrySteps);
657
+ }
658
+ for (const generated of inputs.generatedEntries) if (generated.kind === "link" && !realNames.has(generated.name)) steps.push({
659
+ kind: "unlink",
660
+ name: generated.name
661
+ });
662
+ return {
663
+ kind: "ready",
664
+ steps,
665
+ sourceStamps: { [KIMI_CONFIG_NAME]: configStamp },
666
+ privateNames,
667
+ hasStaleBlockInRealConfig: config.hadBlock
668
+ };
669
+ }
670
+ //#endregion
671
+ //#region session/kimi-home.ts
672
+ var GENERATED_HOME_MODE = 448;
673
+ var GENERATED_FILE_MODE = 384;
674
+ function realKimiHome(env = process.env, homeDir = os.homedir()) {
675
+ const configuredHome = typeof env.KIMI_CODE_HOME === "string" ? env.KIMI_CODE_HOME.trim() : "";
676
+ if (configuredHome) return path.resolve(configuredHome);
677
+ return path.join(homeDir, ".kimi-code");
678
+ }
679
+ function generatedKimiHomePath(env = process.env, homeDir = os.homedir()) {
680
+ return path.join(glimmervoidHomeDir(homeDir, env), "agent-homes", "kimi");
681
+ }
682
+ function listFolder(folder) {
683
+ try {
684
+ return fs.readdirSync(folder, { withFileTypes: true });
685
+ } catch (error) {
686
+ if (isMissingFileError(error)) return [];
687
+ throw error;
688
+ }
689
+ }
690
+ function statOrNull(entryPath) {
691
+ try {
692
+ return fs.statSync(entryPath);
693
+ } catch {
694
+ return null;
695
+ }
696
+ }
697
+ function fileStampOf(entryStat) {
698
+ return `${entryStat.size}:${entryStat.mtimeMs}`;
699
+ }
700
+ function childNamesOf(folder) {
701
+ return listFolder(folder).map((dirent) => dirent.name);
702
+ }
703
+ function listRealEntries(realHome, privateFolderNames) {
704
+ const entries = [];
705
+ for (const dirent of listFolder(realHome)) {
706
+ const entryPath = path.join(realHome, dirent.name);
707
+ const entryStat = statOrNull(entryPath);
708
+ if (!entryStat) continue;
709
+ if (entryStat.isDirectory()) {
710
+ const childNames = privateFolderNames.has(dirent.name) ? childNamesOf(entryPath) : [];
711
+ entries.push({
712
+ name: dirent.name,
713
+ kind: "folder",
714
+ fileStamp: null,
715
+ childNames
716
+ });
717
+ continue;
718
+ }
719
+ entries.push({
720
+ name: dirent.name,
721
+ kind: "file",
722
+ fileStamp: fileStampOf(entryStat),
723
+ childNames: []
724
+ });
725
+ }
726
+ return entries;
727
+ }
728
+ function isSameFile(first, second) {
729
+ return first.dev === second.dev && first.ino === second.ino;
730
+ }
731
+ function hardLinkTarget(entryStat, realHome, name) {
732
+ if (entryStat.nlink < 2) return null;
733
+ const realPath = path.join(realHome, name);
734
+ try {
735
+ return isSameFile(entryStat, fs.statSync(realPath)) ? realPath : null;
736
+ } catch {
737
+ return null;
738
+ }
739
+ }
740
+ function describeGeneratedEntry(generatedHome, realHome, name) {
741
+ const entryPath = path.join(generatedHome, name);
742
+ const entryStat = fs.lstatSync(entryPath);
743
+ if (entryStat.isSymbolicLink()) return {
744
+ name,
745
+ kind: "link",
746
+ linkTarget: path.resolve(generatedHome, fs.readlinkSync(entryPath)),
747
+ childNames: []
748
+ };
749
+ if (entryStat.isDirectory()) return {
750
+ name,
751
+ kind: "folder",
752
+ linkTarget: null,
753
+ childNames: childNamesOf(entryPath)
754
+ };
755
+ const hardLinkedTo = hardLinkTarget(entryStat, realHome, name);
756
+ if (hardLinkedTo) return {
757
+ name,
758
+ kind: "link",
759
+ linkTarget: hardLinkedTo,
760
+ childNames: []
761
+ };
762
+ return {
763
+ name,
764
+ kind: "file",
765
+ linkTarget: null,
766
+ childNames: []
767
+ };
768
+ }
769
+ function readOptionalText(filePath) {
770
+ try {
771
+ return fs.readFileSync(filePath, "utf8");
772
+ } catch (error) {
773
+ if (isMissingFileError(error)) return null;
774
+ throw error;
775
+ }
776
+ }
777
+ function readRealConfig(realHome) {
778
+ const configPath = path.join(realHome, KIMI_CONFIG_NAME);
779
+ try {
780
+ return { text: fs.readFileSync(configPath, "utf8") };
781
+ } catch (error) {
782
+ if (isMissingFileError(error)) return { text: null };
783
+ return { refusal: `the real ${configPath} cannot be read: ${errorMessage(error)}` };
784
+ }
785
+ }
786
+ function readSourceStamps(generatedHome) {
787
+ try {
788
+ const parsed = JSON.parse(fs.readFileSync(path.join(generatedHome, KIMI_SOURCES_NAME), "utf8"));
789
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
790
+ return Object.fromEntries(Object.entries(parsed).filter((entry) => typeof entry[1] === "string"));
791
+ } catch {
792
+ return {};
793
+ }
794
+ }
795
+ function inspectKimiHome(options) {
796
+ const realHome = realKimiHome(options.env, options.homeDir);
797
+ const generatedHome = generatedKimiHomePath(options.env, options.homeDir);
798
+ try {
799
+ return {
800
+ generatedHome,
801
+ realHome,
802
+ plan: planFromDisk(options, realHome, generatedHome)
803
+ };
804
+ } catch (error) {
805
+ return {
806
+ generatedHome,
807
+ realHome,
808
+ plan: {
809
+ kind: "refused",
810
+ reason: `${realHome} or ${generatedHome} cannot be listed: ${errorMessage(error)}`
811
+ }
812
+ };
813
+ }
814
+ }
815
+ function planFromDisk({ hooksBlock, platform = process.platform }, realHome, generatedHome) {
816
+ const realConfig = readRealConfig(realHome);
817
+ if ("refusal" in realConfig) return {
818
+ kind: "refused",
819
+ reason: realConfig.refusal
820
+ };
821
+ const generatedEntries = childNamesOf(generatedHome).map((name) => describeGeneratedEntry(generatedHome, realHome, name));
822
+ return planKimiHome({
823
+ realHome,
824
+ realEntries: listRealEntries(realHome, new Set(generatedEntries.filter((entry) => entry.kind === "folder").map((entry) => entry.name))),
825
+ generatedEntries,
826
+ realConfigText: realConfig.text,
827
+ generatedConfigText: readOptionalText(path.join(generatedHome, KIMI_CONFIG_NAME)),
828
+ hooksBlock,
829
+ sourceStamps: readSourceStamps(generatedHome),
830
+ platform
831
+ });
832
+ }
833
+ function stepEntryPath(generatedHome, step) {
834
+ return path.join(generatedHome, step.kind === "write-config" ? KIMI_CONFIG_NAME : step.name);
835
+ }
836
+ function promoteIntoRealHome(entryPath, target) {
837
+ const resolvedTarget = fs.realpathSync(target);
838
+ const stagedPath = `${resolvedTarget}.glimmervoid-${process.pid}`;
839
+ try {
840
+ fs.copyFileSync(entryPath, stagedPath);
841
+ fs.chmodSync(stagedPath, fs.statSync(resolvedTarget).mode & 511);
842
+ fs.renameSync(stagedPath, resolvedTarget);
843
+ } catch (error) {
844
+ fs.rmSync(stagedPath, { force: true });
845
+ throw error;
846
+ }
847
+ fs.unlinkSync(entryPath);
848
+ }
849
+ function setAside(generatedHome, entryPath, name) {
850
+ const conflictsFolder = path.join(generatedHome, KIMI_CONFLICTS_NAME);
851
+ fs.mkdirSync(conflictsFolder, {
852
+ recursive: true,
853
+ mode: GENERATED_HOME_MODE
854
+ });
855
+ let copyNumber = 1;
856
+ while (fs.existsSync(path.join(conflictsFolder, `${name}.${copyNumber}`))) copyNumber += 1;
857
+ fs.renameSync(entryPath, path.join(conflictsFolder, `${name}.${copyNumber}`));
858
+ }
859
+ function moveAcrossVolumes(source, destination) {
860
+ try {
861
+ fs.renameSync(source, destination);
862
+ } catch (error) {
863
+ if (!(error instanceof Error && "code" in error && error.code === "EXDEV")) throw error;
864
+ fs.cpSync(source, destination, {
865
+ recursive: true,
866
+ errorOnExist: true,
867
+ force: false,
868
+ preserveTimestamps: true
869
+ });
870
+ fs.rmSync(source, { recursive: true });
871
+ }
872
+ }
873
+ function adoptFolder(entryPath, target, childNames) {
874
+ for (const childName of childNames) moveAcrossVolumes(path.join(entryPath, childName), path.join(target, childName));
875
+ fs.rmdirSync(entryPath);
876
+ }
877
+ function applyStep(generatedHome, step) {
878
+ const entryPath = stepEntryPath(generatedHome, step);
879
+ switch (step.kind) {
880
+ case "write-config":
881
+ writeTextAtomicSync(entryPath, step.text, {
882
+ mode: GENERATED_FILE_MODE,
883
+ enforceMode: true
884
+ });
885
+ return;
886
+ case "unlink":
887
+ fs.unlinkSync(entryPath);
888
+ return;
889
+ case "promote":
890
+ promoteIntoRealHome(entryPath, step.target);
891
+ return;
892
+ case "set-aside":
893
+ setAside(generatedHome, entryPath, step.name);
894
+ return;
895
+ case "adopt":
896
+ adoptFolder(entryPath, step.target, step.childNames);
897
+ return;
898
+ }
899
+ if (step.linkKind === "hardlink") {
900
+ fs.linkSync(step.target, entryPath);
901
+ return;
902
+ }
903
+ fs.symlinkSync(step.target, entryPath, step.linkKind === "junction" ? "junction" : void 0);
904
+ }
905
+ function stepFailure(generatedHome, step, error) {
906
+ const entryPath = stepEntryPath(generatedHome, step);
907
+ if (step.kind === "link") return `${entryPath} cannot be linked to ${step.target}: ${errorMessage(error)}`;
908
+ if (step.kind === "promote") return `${entryPath} cannot be moved into ${step.target}: ${errorMessage(error)}`;
909
+ return `${entryPath} cannot be written: ${errorMessage(error)}`;
910
+ }
911
+ function realFileStamps(realHome) {
912
+ const stamps = {};
913
+ for (const entry of listRealEntries(realHome, /* @__PURE__ */ new Set())) if (entry.fileStamp !== null) stamps[fileStampKey(entry.name)] = entry.fileStamp;
914
+ return stamps;
915
+ }
916
+ function prepareKimiHome(options) {
917
+ const generatedHome = generatedKimiHomePath(options.env, options.homeDir);
918
+ try {
919
+ fs.mkdirSync(generatedHome, {
920
+ recursive: true,
921
+ mode: GENERATED_HOME_MODE
922
+ });
923
+ fs.chmodSync(generatedHome, GENERATED_HOME_MODE);
924
+ } catch (error) {
925
+ return { refusal: `${generatedHome} cannot be created: ${errorMessage(error)}` };
926
+ }
927
+ const { plan } = inspectKimiHome(options);
928
+ if (plan.kind === "refused") return { refusal: plan.reason };
929
+ const keptPrivateNames = /* @__PURE__ */ new Set();
930
+ for (const step of plan.steps) {
931
+ if (step.kind !== "write-config" && keptPrivateNames.has(step.name)) continue;
932
+ try {
933
+ applyStep(generatedHome, step);
934
+ } catch (error) {
935
+ if (step.kind !== "adopt") return { refusal: stepFailure(generatedHome, step, error) };
936
+ keptPrivateNames.add(step.name);
937
+ }
938
+ }
939
+ const realHome = realKimiHome(options.env, options.homeDir);
940
+ try {
941
+ const sourceStamps = {
942
+ ...plan.sourceStamps,
943
+ ...realFileStamps(realHome)
944
+ };
945
+ writeTextAtomicSync(path.join(generatedHome, KIMI_SOURCES_NAME), `${JSON.stringify(sourceStamps, null, 2)}\n`, { mode: GENERATED_FILE_MODE });
946
+ } catch (error) {
947
+ return { refusal: `${path.join(generatedHome, KIMI_SOURCES_NAME)} cannot be written: ${errorMessage(error)}` };
948
+ }
949
+ return { home: generatedHome };
950
+ }
560
951
  //#endregion
561
952
  //#region session/adapters/kimi.ts
562
953
  var ID = "kimi";
563
954
  var COMMAND_NAME = "kimi";
564
- var SETUP_COMMAND = "glimmervoid agent setup kimi";
955
+ var HOME_ENV_NAME = "KIMI_CODE_HOME";
565
956
  var RELAY_PATH = relayPath("hook-relay");
566
957
  var HOOK_TOOL_RELAY_PATH = relayPath("hook-tool-relay");
567
958
  var HOOK_EVENTS = Object.freeze([
@@ -655,13 +1046,8 @@ var titleProfile = {
655
1046
  agentSuffix: null
656
1047
  }
657
1048
  };
658
- function kimiHome(env = process.env, homedir = os.homedir()) {
659
- const configuredHome = typeof env.KIMI_CODE_HOME === "string" ? env.KIMI_CODE_HOME.trim() : "";
660
- if (configuredHome) return path.resolve(configuredHome);
661
- return path.join(homedir, ".kimi-code");
662
- }
663
- function configFilePath(env = process.env, homedir = os.homedir()) {
664
- return path.join(kimiHome(env, homedir), "config.toml");
1049
+ function configFilePath(env = process.env, homedir) {
1050
+ return path.join(realKimiHome(env, homedir), "config.toml");
665
1051
  }
666
1052
  function expectedHooksBlock() {
667
1053
  return renderKimiHooksBlock({
@@ -676,10 +1062,13 @@ function expectedHooksBlock() {
676
1062
  }
677
1063
  });
678
1064
  }
679
- function classifyConfigContents(contents) {
680
- const expectedBlock = expectedHooksBlock();
681
- if (expectedBlock === null) return "unrenderable";
682
- return classifyKimiConfig(contents, expectedBlock);
1065
+ function prepareHome(env) {
1066
+ const hooksBlock = expectedHooksBlock();
1067
+ if (hooksBlock === null) return { refusal: "the hook relay path cannot be written into a kimi hooks block" };
1068
+ return prepareKimiHome({
1069
+ env,
1070
+ hooksBlock
1071
+ });
683
1072
  }
684
1073
  var WINDOWS_SHAPED_ROOT = /^(?:[A-Za-z]:\/|\/\/)/;
685
1074
  var MAX_WORKSPACE_SLUG_LENGTH = 40;
@@ -703,7 +1092,7 @@ function physicalPathOf(cwd) {
703
1092
  function isWorkspaceTrusted(cwd, env = process.env) {
704
1093
  const physicalCwd = physicalPathOf(cwd);
705
1094
  if (physicalCwd === null) return false;
706
- return fs.existsSync(path.join(kimiHome(env), "workspace-trust", workspaceTrustKey(physicalCwd)));
1095
+ return fs.existsSync(path.join(realKimiHome(env), "workspace-trust", workspaceTrustKey(physicalCwd)));
707
1096
  }
708
1097
  function resolveCommand({ platform, execFile = execFileSync, pathExists = fs.existsSync } = {}) {
709
1098
  return resolveAgentCommand({
@@ -743,14 +1132,9 @@ var kimi = {
743
1132
  mapPromptKind: mapHookPromptKind,
744
1133
  mapPayload: mapHookPayload,
745
1134
  injection: {
746
- kind: "home-hooks-file",
747
- setupCommand: SETUP_COMMAND,
748
- filePath: configFilePath,
749
- classifyContents: classifyConfigContents,
750
- isSaneYoloReady: (contents) => classifyConfigContents(contents) === "current",
751
- projectConfigCandidates: [],
752
- userConfigFolders: () => [],
753
- mayContributeHooks: () => false
1135
+ kind: "generated-home",
1136
+ homeEnvName: HOME_ENV_NAME,
1137
+ prepareHome
754
1138
  }
755
1139
  },
756
1140
  resolveCommand,
@@ -20,12 +20,12 @@ import { _ as lineStartOffsets, a as projectForUri, b as replacedSpanOfWholeText
20
20
  import { n as DEFAULT_MAX_MS, r as nextBackoffMs, t as DEFAULT_BASE_MS } from "./backoff-DjVpfHk7.js";
21
21
  import { n as unrefTimer, t as DEFAULT_TIMER_FNS } from "./timer-deps-u2DAQLok.js";
22
22
  import { a as readPageTitle, i as filesAfterRetention, n as decideShownKind, o as shownMimeForFilename, r as describeOverCap, t as SHOWN_SNIFF_BYTES } from "./shown-files-core-C7ER2sw2.js";
23
- import { t as kimi } from "./kimi-VBamp5vp.js";
23
+ import { t as kimi } from "./kimi-Be_QndbF.js";
24
24
  import { n as shellQuote } from "./hook-command-core-qTNK-xMF.js";
25
25
  import { C as parseCgroupBytes, S as memoryReserveBytes, T as parseMemAvailableBytes, _ as createSpawnGate, a as jsonStateLoadError, b as cgroupLimitBytes, c as loadedJsonValue, d as writeJsonAtomicSync, f as writeTextAtomic, g as createSerialQueue, h as createMemoryAdmission, i as createJsonStateWriter, m as createKeyedSerialQueue, n as appendJsonLines, o as loadJsonStateFile, p as writeTextAtomicSync, r as createJsonStateStore, s as loadJsonStateFileSync, t as appendJsonLine, u as writeJsonAtomic, v as isQueueAdmissionTimeout, w as parseCgroupV2Path, x as headroomFromReadings, y as cgroupAncestorPaths } from "./json-file-BjFK_eSH.js";
26
26
  import { $ as resolveProjectToken, B as buildAiGenerationEvents, G as claudeAccountUuidOf, H as buildExceptionProperties, I as FIRST_RUN_NOTICE, J as decideRemoteTelemetryState, K as codexUserIdOf, L as TELEMETRY_BATCH_URL, Q as parsePosthogReleaseId, R as TELEMETRY_FLAGS_URL, S as validateSettingsBlock, U as buildPersonProperties, V as buildBrowserExceptionProperties, W as classifySessionExit, X as exceptionFingerprint, Y as decideTelemetryConsent, Z as nodeMajorVersion, _ as isRtkBinaryName, a as ensureProjectIds, at as matchedPrefix, b as mergeSettingsBlock, ct as sessionIdFromBranch, dt as canonicalizePath, ft as comparableDirectoryPath, g as installTargetPath, h as findEscapingArchiveMember, i as createConfigStore, it as DEFAULT_BRANCH_GC_PREFIXES, lt as usablePrefixes, m as decideRtkInstall, n as DEFAULT_CONFIG, nt as stableConfigKey, o as generateProjectId, ot as planBranchGc, p as assetForPlatform, pt as isSameDirectoryPath, q as decideIsDevInstall, s as glimmervoidHomeDir$1, st as planWorktreeGc, t as ABORT_CONFIG_SAVE, ut as worktreeIntegrationTips, v as verifyDigest, x as settingsBlockSpecFor, z as adapterBucket } from "./config-store-B6tDGKyB.js";
27
27
  import { _ as TelemetryState, a as DEEP_HISTORY_SCROLLBACK_LINES, c as describeDataAttach, d as DashboardTelemetryReport, h as TELEMETRY_EVENT_SCHEMAS, i as HookEnvelope, l as parseDataAttach, m as PendingCrashReport, r as HTTP_URL_RE, s as LOGGED_FAST_CLOSE_COUNTS, u as parseDataClientMessage } from "./build-channel-DqsP-nkH.js";
28
- import { $ as identityFromRelPath, A as decideFileRead, B as sessionsRootCandidates, C as pickNewestPublished, D as codexRootCandidates, E as codexHomes, F as kimiHomes, G as kimiSessionIdFromPath, H as shouldPersistWarehouse, I as passOutcome, J as dedupKeys, K as parseKimiUsageLine, L as projectDirCandidates, M as expandTilde, N as grokHomes, O as codexSessionIdFromPath, P as isUsageFile, Q as foldReplacementIntoGenerationRollup, R as resolveProjectsDirs, S as parseResolvedSha, T as codexFallbackRoots, U as splitLines$1, V as shouldEvaluateDespiteIoFailures, W as kimiDedupIdentity, X as expandAdvisorIterations, Y as emptyTotals, Z as foldEntryIntoGenerationRollup, _ as isCheckFresh, a as describeAgentResolvability, at as totalTokensOf$1, b as parseRegistryDeprecation, c as isKnownAgentId, d as resolveAdapter, et as isWithinGenerationRecencyWindow, f as setCustomAgents, g as decideUpdateStatus, h as decideInstallFlavor, i as customAgentFingerprint, it as shouldReplace, j as dedupeCodexFiles, k as continuationDelayMs, l as listAgentIds, m as readHostCodexVersion, n as cachedAgentResolvability, nt as parseJsonLine, o as getAdapter, ot as vendorUsageEntry, p as codex, q as addEntryToTotals, r as commandFor, rt as parseUsageLine, s as hookProfileOf, st as claudeCode, t as DEFAULT_AGENT_ID, tt as mergeGenerationRollups, u as resetCommandCache, v as normalizeSha, w as shortSha$1, x as parseRegistryLatest, y as normalizeUpdateChannel, z as scopedClaudeRoots } from "./adapters-BEHP94Wf.js";
28
+ import { $ as identityFromRelPath, A as decideFileRead, B as sessionsRootCandidates, C as pickNewestPublished, D as codexRootCandidates, E as codexHomes, F as kimiHomes, G as kimiSessionIdFromPath, H as shouldPersistWarehouse, I as passOutcome, J as dedupKeys, K as parseKimiUsageLine, L as projectDirCandidates, M as expandTilde, N as grokHomes, O as codexSessionIdFromPath, P as isUsageFile, Q as foldReplacementIntoGenerationRollup, R as resolveProjectsDirs, S as parseResolvedSha, T as codexFallbackRoots, U as splitLines$1, V as shouldEvaluateDespiteIoFailures, W as kimiDedupIdentity, X as expandAdvisorIterations, Y as emptyTotals, Z as foldEntryIntoGenerationRollup, _ as isCheckFresh, a as describeAgentResolvability, at as totalTokensOf$1, b as parseRegistryDeprecation, c as isKnownAgentId, d as resolveAdapter, et as isWithinGenerationRecencyWindow, f as setCustomAgents, g as decideUpdateStatus, h as decideInstallFlavor, i as customAgentFingerprint, it as shouldReplace, j as dedupeCodexFiles, k as continuationDelayMs, l as listAgentIds, m as readHostCodexVersion, n as cachedAgentResolvability, nt as parseJsonLine, o as getAdapter, ot as vendorUsageEntry, p as codex, q as addEntryToTotals, r as commandFor, rt as parseUsageLine, s as hookProfileOf, st as claudeCode, t as DEFAULT_AGENT_ID, tt as mergeGenerationRollups, u as resetCommandCache, v as normalizeSha, w as shortSha$1, x as parseRegistryLatest, y as normalizeUpdateChannel, z as scopedClaudeRoots } from "./adapters-DmzmKIDw.js";
29
29
  import { t as HOOK_TOOLS } from "./hook-tools-Cr97Vdap.js";
30
30
  import { a as formatSshPublicKey, c as orderAgentSockets, i as commitSigningShimText, l as parseSshPublicKey, n as NO_AGENT_HOLDS_KEY, o as isForwardedAgentDirName, r as agentListsKey, s as isSignableGitObject, t as COMMIT_SIGNING_SHIM_NAME } from "./ssh-signing-core-CRhVVWNW.js";
31
31
  import { a as configSiblingPath, c as defaultPairingsPath, d as decideDeviceAuth, f as deviceNameFromUserAgent, l as defaultSeenPath, n as normalizeRemoteConfig, o as createPairingsStore, p as hashSecret, r as validateRemoteConfig, s as createSeenStore, t as decideBindHost, u as DEFAULT_DEVICE_MAX_AGE_MS } from "./remote-config-DKXELcNh.js";
@@ -16662,6 +16662,25 @@ function createSessionHookLifecycle(options) {
16662
16662
  const isSaneYoloHookInFile = injection.isSaneYoloReady(contents);
16663
16663
  return registerRelayHooks(port, [], saneYoloTool() !== void 0 && isSaneYoloHookInFile);
16664
16664
  }
16665
+ function injectGeneratedHomeHooks(port, injection) {
16666
+ const prepared = injection.prepareHome(process.env);
16667
+ if ("refusal" in prepared) return {
16668
+ ...NO_HOOK_INJECTION,
16669
+ refusal: `${options.agentId} cannot start: ${prepared.refusal}`
16670
+ };
16671
+ const relayHooks = registerRelayHooks(port, [], saneYoloTool() !== void 0);
16672
+ if (relayHooks === NO_HOOK_INJECTION) return {
16673
+ ...NO_HOOK_INJECTION,
16674
+ refusal: `${options.agentId} cannot start: its hooks could not be registered`
16675
+ };
16676
+ return {
16677
+ ...relayHooks,
16678
+ env: {
16679
+ ...relayHooks.env,
16680
+ [injection.homeEnvName]: prepared.home
16681
+ }
16682
+ };
16683
+ }
16665
16684
  function resolveListenerPort() {
16666
16685
  if (!options.getHookPort) return null;
16667
16686
  try {
@@ -16681,6 +16700,7 @@ function createSessionHookLifecycle(options) {
16681
16700
  const injection = hookProfile.injection;
16682
16701
  if (injection?.kind === "argv-config") return injectRelayHooks(port, injection);
16683
16702
  if (injection?.kind === "home-hooks-file") return injectHomeRelayHooks(port, injection);
16703
+ if (injection?.kind === "generated-home") return injectGeneratedHomeHooks(port, injection);
16684
16704
  try {
16685
16705
  const buildSettingsArgs = options.adapter.settingsArgs;
16686
16706
  if (typeof buildSettingsArgs !== "function") throw new TypeError(`agent ${options.agentId} carries no settings-file argv`);
@@ -20372,6 +20392,10 @@ var Session = class extends EventEmitter {
20372
20392
  }
20373
20393
  const isRemoteCodex = remoteLaunch !== null && this.agentId === "codex";
20374
20394
  const hookInjection = this._hooks.inject();
20395
+ if (hookInjection.refusal) {
20396
+ this._abandonSpawn(new Error(hookInjection.refusal));
20397
+ return;
20398
+ }
20375
20399
  this._isSaneYoloActive = remoteLaunch === null && hookInjection.isSaneYoloActive;
20376
20400
  if (this._hooks.isRequiredGuardrailsMissing()) {
20377
20401
  this._abandonSpawn(/* @__PURE__ */ new Error(GUARDRAILS_UNAPPLIED_ERROR));
@@ -1 +1 @@
1
- import{Gi as e,Hi as t,Ji as n,Ki as r,Ui as i,Wi as a,Yi as o,qi as s}from"./index-Cb2I6OyB.js";var c=.3,l=null;function u(){return o(l)}function d(e){return n(e,l)}async function f(){try{let e=await fetch(t,{credentials:`same-origin`,cache:`no-store`});e.ok&&(l=s(await e.json()))}catch{}}function p(){let e=new AudioContext;return e.state===`suspended`&&e.resume(),e}function m(e,t){setTimeout(()=>e.close().catch(()=>{}),(t+.1)*1e3)}function h(e){g(a[e]??a.chime)}function g(e){let t=p(),n=t.createGain();n.gain.value=e.peakGain,n.connect(t.destination);let r=t.currentTime,i=0;for(let a of e.tones){let e=r+a.startSeconds,o=e+a.durationSeconds,s=t.createOscillator(),c=t.createGain();s.type=a.waveform,s.frequency.setValueAtTime(a.frequency,e),a.endFrequency&&s.frequency.exponentialRampToValueAtTime(a.endFrequency,o),c.gain.setValueAtTime(.001,e),c.gain.exponentialRampToValueAtTime(a.gain??1,e+.01),c.gain.exponentialRampToValueAtTime(.001,o),s.connect(c),c.connect(n),s.start(e),s.stop(o),i=Math.max(i,a.startSeconds+a.durationSeconds)}m(t,i)}async function _(e){try{let t=await fetch(r(e),{credentials:`same-origin`});return t.ok?await t.arrayBuffer():null}catch{return null}}async function v(e){let t=await _(e);if(!t)return!1;let n=p();try{let e=await n.decodeAudioData(t),r=n.createGain();r.gain.value=c,r.connect(n.destination);let i=n.createBufferSource();return i.buffer=e,i.connect(r),i.start(),m(n,e.duration),!0}catch{return n.close().catch(()=>{}),!1}}var y=[659.25,830.61,987.77,1108.73,987.77,830.61,739.99,659.25,739.99,830.61,987.77,1108.73,987.77,830.61];function b(){try{let e=new AudioContext;if(e.state===`suspended`&&e.resume(),e.state===`suspended`)return;let t=e.createGain();t.gain.value=.05,t.connect(e.destination);let n=.125,r=e.currentTime;for(let i=0;i<y.length;i++){let a=r+i*n,o=e.createOscillator(),s=e.createGain();o.type=`square`,o.frequency.value=y[i],s.gain.setValueAtTime(.001,a),s.gain.exponentialRampToValueAtTime(1,a+.01),s.gain.exponentialRampToValueAtTime(.001,a+n*.9),o.connect(s),s.connect(t),o.start(a),o.stop(a+n)}let i=r+y.length*n;t.gain.setValueAtTime(.05,i-.05),t.gain.exponentialRampToValueAtTime(.001,i),setTimeout(()=>e.close().catch(()=>{}),(i-r+.1)*1e3)}catch{}}function x(){try{h(i)}catch{}}function S(t){try{let n=d(t),r=e(n);if(!r){h(n);return}v(r).then(e=>{e||x()})}catch{}}export{f as loadCustomSounds,S as playAlertSound,b as playNyanJingle,g as playToneSequence,d as resolveSoundId,u as soundOptions};
1
+ import{Gi as e,Hi as t,Ji as n,Ki as r,Ui as i,Wi as a,Yi as o,qi as s}from"./index-BJ8diTZl.js";var c=.3,l=null;function u(){return o(l)}function d(e){return n(e,l)}async function f(){try{let e=await fetch(t,{credentials:`same-origin`,cache:`no-store`});e.ok&&(l=s(await e.json()))}catch{}}function p(){let e=new AudioContext;return e.state===`suspended`&&e.resume(),e}function m(e,t){setTimeout(()=>e.close().catch(()=>{}),(t+.1)*1e3)}function h(e){g(a[e]??a.chime)}function g(e){let t=p(),n=t.createGain();n.gain.value=e.peakGain,n.connect(t.destination);let r=t.currentTime,i=0;for(let a of e.tones){let e=r+a.startSeconds,o=e+a.durationSeconds,s=t.createOscillator(),c=t.createGain();s.type=a.waveform,s.frequency.setValueAtTime(a.frequency,e),a.endFrequency&&s.frequency.exponentialRampToValueAtTime(a.endFrequency,o),c.gain.setValueAtTime(.001,e),c.gain.exponentialRampToValueAtTime(a.gain??1,e+.01),c.gain.exponentialRampToValueAtTime(.001,o),s.connect(c),c.connect(n),s.start(e),s.stop(o),i=Math.max(i,a.startSeconds+a.durationSeconds)}m(t,i)}async function _(e){try{let t=await fetch(r(e),{credentials:`same-origin`});return t.ok?await t.arrayBuffer():null}catch{return null}}async function v(e){let t=await _(e);if(!t)return!1;let n=p();try{let e=await n.decodeAudioData(t),r=n.createGain();r.gain.value=c,r.connect(n.destination);let i=n.createBufferSource();return i.buffer=e,i.connect(r),i.start(),m(n,e.duration),!0}catch{return n.close().catch(()=>{}),!1}}var y=[659.25,830.61,987.77,1108.73,987.77,830.61,739.99,659.25,739.99,830.61,987.77,1108.73,987.77,830.61];function b(){try{let e=new AudioContext;if(e.state===`suspended`&&e.resume(),e.state===`suspended`)return;let t=e.createGain();t.gain.value=.05,t.connect(e.destination);let n=.125,r=e.currentTime;for(let i=0;i<y.length;i++){let a=r+i*n,o=e.createOscillator(),s=e.createGain();o.type=`square`,o.frequency.value=y[i],s.gain.setValueAtTime(.001,a),s.gain.exponentialRampToValueAtTime(1,a+.01),s.gain.exponentialRampToValueAtTime(.001,a+n*.9),o.connect(s),s.connect(t),o.start(a),o.stop(a+n)}let i=r+y.length*n;t.gain.setValueAtTime(.05,i-.05),t.gain.exponentialRampToValueAtTime(.001,i),setTimeout(()=>e.close().catch(()=>{}),(i-r+.1)*1e3)}catch{}}function x(){try{h(i)}catch{}}function S(t){try{let n=d(t),r=e(n);if(!r){h(n);return}v(r).then(e=>{e||x()})}catch{}}export{f as loadCustomSounds,S as playAlertSound,b as playNyanJingle,g as playToneSequence,d as resolveSoundId,u as soundOptions};
@@ -1 +1 @@
1
- import"./updates-view-core-D1HrhoS5.js";import{n as e,o as t,r as n}from"./dom-helpers-C7P3_59O.js";import{J as r,Y as i,q as a}from"./index-Cb2I6OyB.js";var o={mine:`Mine`,run:`Run`,cancel:`Cancel`},s=null;function c(e){return e===null?`n/a`:`${Math.round(e*100)}%`}function l(e){if(e===null)return`n/a`;let t=Math.round(e*100);return t>0?`+${t}`:String(t)}function u(e,n,i){let a=t(`button`,`bench-action-button`,o[n]);return a.type=`button`,a.disabled=i,a.addEventListener(`click`,()=>r(e.id,n)),a}function d(e,t){let n=e.inFlight;if(!n||n.suiteId!==t.id)return``;let r=n.caseId?`case ${n.caseId}, `:``;return`Cell ${n.cellIndex+1} of ${n.cellCount}: ${r}arm ${n.armId}, trial ${n.trial}, ${n.phase}.`}function f(e){let n=t(`td`,`bench-score`,c(e?.recall??null));return e&&e.invalid>0&&(n.title=`${e.invalid} invalid or failed cell(s)`),e&&e.degraded>0&&(n.dataset.degraded=`true`),n}function p(e){let n=e.armIds.filter(t=>t!==e.baselineArm),r=t(`table`,`bench-table`),i=t(`tr`);i.append(t(`th`,null,`Case`),...e.armIds.map(n=>t(`th`,null,n===e.baselineArm?`${n} (baseline)`:n))),i.append(...n.map(e=>t(`th`,null,`${e} vs baseline`))),r.append(i);for(let i of e.rows){let a=t(`tr`);a.append(t(`td`,`bench-case`,i.caseId),...e.armIds.map(e=>f(i.arms[e]))),a.append(...n.map(e=>t(`td`,`bench-delta`,l(i.deltaVsBaseline[e]??null)))),r.append(a)}let a=[...new Set(e.armIds.flatMap(t=>Object.keys(e.totals[t]?.recallByTag??{})))].sort(),o=t(`tr`,`bench-total`);o.append(t(`td`,`bench-case`,`Paired recall`),...e.armIds.map(t=>f(e.totals[t]))),r.append(o);for(let n of a){let i=t(`tr`,`bench-total`);i.append(t(`td`,`bench-case`,`Recall, ${n}`),...e.armIds.map(r=>t(`td`,`bench-score`,c(e.totals[r]?.recallByTag[n]??null)))),r.append(i)}return r}function m(e,r){let{isServerConnected:i,pendingActionBySuite:o,outcomeBySuite:s}=a(),c=t(`div`,`bench-suite`),l=e.inFlight?.suiteId===r.id,f=!!e.inFlight&&!l,m=o.has(r.id)||!i,h=t(`div`,`bench-summary`);h.append(t(`span`,`bench-suite-title`,r.title),n(`bench`,r.caseCount===1?`case`:`cases`,String(r.caseCount)),n(`bench`,r.candidateCount===1?`candidate`:`candidates`,String(r.candidateCount)),n(`bench`,`arms`,String(r.armIds.length))),c.append(h);let g=t(`div`,`bench-controls`),_=e.configured===!0&&r.error===null;g.append(u(r,`mine`,!_||m||l),u(r,`run`,!_||m||l||f||r.caseCount===0),u(r,`cancel`,m||!l));let v=t(`span`,`bench-status`,(i?``:`Not connected to the server. Reconnecting.`)||d(e,r)||s.get(r.id)||``);if(v.setAttribute(`role`,`status`),g.append(v),c.append(g),r.error)return c.append(t(`p`,`bench-error`,r.error)),c;let y=r.latestReport;return y?(c.append(t(`p`,`bench-run-line`,`Latest run ${y.runId}: ${y.status}. Only cases every arm scored count toward paired recall.`)),y.rows.length>0&&c.append(p(y)),c):(c.append(t(`p`,`bench-empty`,r.caseCount===0?`Move approved candidates into the cases folder, then choose Run.`:`No run yet.`)),c)}function h(){if(!s)return;s.textContent=``;let{status:n}=a(),r=e(`bench`,`Benchmarks`,`Suites from the benchmarks folder of the Glimmervoid home, one run at a time.`);if(s.append(r),!n)s.append(t(`p`,`bench-empty`,`Waiting for the server.`));else if(!n.configured)s.append(t(`p`,`bench-empty`,n.reason||`Benchmarks are off.`));else if(n.suites.length===0)s.append(t(`p`,`bench-empty`,`No suites yet. Create a folder holding suite.json under benchmarks in the Glimmervoid home.`));else for(let e of n.suites)s.append(m(n,e))}function g(e){s||(s=t(`div`,`bench-content`),e.append(s),i(h),h())}var _={mount:g};export{_ as view};
1
+ import"./updates-view-core-D1HrhoS5.js";import{n as e,o as t,r as n}from"./dom-helpers-C7P3_59O.js";import{J as r,Y as i,q as a}from"./index-BJ8diTZl.js";var o={mine:`Mine`,run:`Run`,cancel:`Cancel`},s=null;function c(e){return e===null?`n/a`:`${Math.round(e*100)}%`}function l(e){if(e===null)return`n/a`;let t=Math.round(e*100);return t>0?`+${t}`:String(t)}function u(e,n,i){let a=t(`button`,`bench-action-button`,o[n]);return a.type=`button`,a.disabled=i,a.addEventListener(`click`,()=>r(e.id,n)),a}function d(e,t){let n=e.inFlight;if(!n||n.suiteId!==t.id)return``;let r=n.caseId?`case ${n.caseId}, `:``;return`Cell ${n.cellIndex+1} of ${n.cellCount}: ${r}arm ${n.armId}, trial ${n.trial}, ${n.phase}.`}function f(e){let n=t(`td`,`bench-score`,c(e?.recall??null));return e&&e.invalid>0&&(n.title=`${e.invalid} invalid or failed cell(s)`),e&&e.degraded>0&&(n.dataset.degraded=`true`),n}function p(e){let n=e.armIds.filter(t=>t!==e.baselineArm),r=t(`table`,`bench-table`),i=t(`tr`);i.append(t(`th`,null,`Case`),...e.armIds.map(n=>t(`th`,null,n===e.baselineArm?`${n} (baseline)`:n))),i.append(...n.map(e=>t(`th`,null,`${e} vs baseline`))),r.append(i);for(let i of e.rows){let a=t(`tr`);a.append(t(`td`,`bench-case`,i.caseId),...e.armIds.map(e=>f(i.arms[e]))),a.append(...n.map(e=>t(`td`,`bench-delta`,l(i.deltaVsBaseline[e]??null)))),r.append(a)}let a=[...new Set(e.armIds.flatMap(t=>Object.keys(e.totals[t]?.recallByTag??{})))].sort(),o=t(`tr`,`bench-total`);o.append(t(`td`,`bench-case`,`Paired recall`),...e.armIds.map(t=>f(e.totals[t]))),r.append(o);for(let n of a){let i=t(`tr`,`bench-total`);i.append(t(`td`,`bench-case`,`Recall, ${n}`),...e.armIds.map(r=>t(`td`,`bench-score`,c(e.totals[r]?.recallByTag[n]??null)))),r.append(i)}return r}function m(e,r){let{isServerConnected:i,pendingActionBySuite:o,outcomeBySuite:s}=a(),c=t(`div`,`bench-suite`),l=e.inFlight?.suiteId===r.id,f=!!e.inFlight&&!l,m=o.has(r.id)||!i,h=t(`div`,`bench-summary`);h.append(t(`span`,`bench-suite-title`,r.title),n(`bench`,r.caseCount===1?`case`:`cases`,String(r.caseCount)),n(`bench`,r.candidateCount===1?`candidate`:`candidates`,String(r.candidateCount)),n(`bench`,`arms`,String(r.armIds.length))),c.append(h);let g=t(`div`,`bench-controls`),_=e.configured===!0&&r.error===null;g.append(u(r,`mine`,!_||m||l),u(r,`run`,!_||m||l||f||r.caseCount===0),u(r,`cancel`,m||!l));let v=t(`span`,`bench-status`,(i?``:`Not connected to the server. Reconnecting.`)||d(e,r)||s.get(r.id)||``);if(v.setAttribute(`role`,`status`),g.append(v),c.append(g),r.error)return c.append(t(`p`,`bench-error`,r.error)),c;let y=r.latestReport;return y?(c.append(t(`p`,`bench-run-line`,`Latest run ${y.runId}: ${y.status}. Only cases every arm scored count toward paired recall.`)),y.rows.length>0&&c.append(p(y)),c):(c.append(t(`p`,`bench-empty`,r.caseCount===0?`Move approved candidates into the cases folder, then choose Run.`:`No run yet.`)),c)}function h(){if(!s)return;s.textContent=``;let{status:n}=a(),r=e(`bench`,`Benchmarks`,`Suites from the benchmarks folder of the Glimmervoid home, one run at a time.`);if(s.append(r),!n)s.append(t(`p`,`bench-empty`,`Waiting for the server.`));else if(!n.configured)s.append(t(`p`,`bench-empty`,n.reason||`Benchmarks are off.`));else if(n.suites.length===0)s.append(t(`p`,`bench-empty`,`No suites yet. Create a folder holding suite.json under benchmarks in the Glimmervoid home.`));else for(let e of n.suites)s.append(m(n,e))}function g(e){s||(s=t(`div`,`bench-content`),e.append(s),i(h),h())}var _={mount:g};export{_ as view};