glimmervoid 0.47.1-next.242 → 0.47.1-next.244

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 (92) hide show
  1. package/dist/bin/glimmervoid.js +3 -3
  2. package/dist/chunks/{adapters-D0Qsu_Py.js → adapters-CCDF7Syx.js} +391 -4
  3. package/dist/chunks/{adapters-B1Y-kxGb.js → adapters-DWwTuF0s.js} +1 -1
  4. package/dist/chunks/{kimi-CyIJoMgO.js → kimi-B35I7Rlu.js} +1 -1
  5. package/dist/chunks/kimi-BhmoA__R.js +1 -0
  6. package/dist/chunks/{kimi-home-D7RE58XY.js → kimi-home-4-aMoqJC.js} +1 -1
  7. package/dist/chunks/kimi-home-Czh-wcQ_.js +1 -0
  8. package/dist/chunks/{main-CmCEfyOt.js → main-CFJRfoa4.js} +142 -301
  9. package/dist/client/assets/{alert-sound-BaDBKXUL.js → alert-sound-BsooAPwA.js} +1 -1
  10. package/dist/client/assets/alert-sound-BsooAPwA.js.br +0 -0
  11. package/dist/client/assets/{benchmark-panel-CU3AkWJE.js → benchmark-panel-ByXk6p7l.js} +1 -1
  12. package/dist/client/assets/benchmark-panel-ByXk6p7l.js.br +0 -0
  13. package/dist/client/assets/{celebration-player-CFtX3BDS.js → celebration-player-Bs7gFFtp.js} +1 -1
  14. package/dist/client/assets/celebration-player-Bs7gFFtp.js.br +0 -0
  15. package/dist/client/assets/{community-panel-CHO3hJ7x.js → community-panel-39A78I3s.js} +1 -1
  16. package/dist/client/assets/community-panel-39A78I3s.js.br +0 -0
  17. package/dist/client/assets/{dialogs-fwdQdsvI.js → dialogs-D7Ik8557.js} +1 -1
  18. package/dist/client/assets/dialogs-D7Ik8557.js.br +0 -0
  19. package/dist/client/assets/{doc-editor-ui-BNffHlsa.js → doc-editor-ui-BMlW3hMQ.js} +1 -1
  20. package/dist/client/assets/doc-editor-ui-BMlW3hMQ.js.br +0 -0
  21. package/dist/client/assets/{feature-hint-CsUsVidL.js → feature-hint-7oF2VoGV.js} +1 -1
  22. package/dist/client/assets/feature-hint-7oF2VoGV.js.br +0 -0
  23. package/dist/client/assets/{first-run-checklist-D7iNSe7f.js → first-run-checklist-T3bgDD_Y.js} +1 -1
  24. package/dist/client/assets/first-run-checklist-T3bgDD_Y.js.br +0 -0
  25. package/dist/client/assets/{hooks-panel-D1GFEYiO.js → hooks-panel-dkxe7M5s.js} +1 -1
  26. package/dist/client/assets/hooks-panel-dkxe7M5s.js.br +0 -0
  27. package/dist/client/assets/{index-DwCd9c0Y.js → index-CRgdx1Xc.js} +5 -5
  28. package/dist/client/assets/index-CRgdx1Xc.js.br +0 -0
  29. package/dist/client/assets/{issues-panel-B7cwOVfh.js → issues-panel-C7LCc9pn.js} +1 -1
  30. package/dist/client/assets/issues-panel-C7LCc9pn.js.br +0 -0
  31. package/dist/client/assets/{my-prs-panel-BGkT1xws.js → my-prs-panel-xDGZSKms.js} +1 -1
  32. package/dist/client/assets/my-prs-panel-xDGZSKms.js.br +0 -0
  33. package/dist/client/assets/{nyan-cat-CX067CJI.js → nyan-cat-D2sqNEGz.js} +1 -1
  34. package/dist/client/assets/nyan-cat-D2sqNEGz.js.br +0 -0
  35. package/dist/client/assets/{phone-shell-wneaCUIP.js → phone-shell-BXG-nu2t.js} +1 -1
  36. package/dist/client/assets/phone-shell-BXG-nu2t.js.br +0 -0
  37. package/dist/client/assets/{plan-face-3yZcTAZZ.js → plan-face-C0SQSmm1.js} +1 -1
  38. package/dist/client/assets/plan-face-C0SQSmm1.js.br +0 -0
  39. package/dist/client/assets/{plan-render-DIvMPcax.js → plan-render-CTnwBprZ.js} +1 -1
  40. package/dist/client/assets/plan-render-CTnwBprZ.js.br +0 -0
  41. package/dist/client/assets/{pr-queue-columns-BZL2U5ra.js → pr-queue-columns-pCxhZs75.js} +1 -1
  42. package/dist/client/assets/pr-queue-columns-pCxhZs75.js.br +0 -0
  43. package/dist/client/assets/{radar-panel-ByLIOKWq.js → radar-panel-BnOAGnLf.js} +1 -1
  44. package/dist/client/assets/radar-panel-BnOAGnLf.js.br +0 -0
  45. package/dist/client/assets/{repo-roots-adder-CO4ElO5l.js → repo-roots-adder-6Xw2eJJL.js} +1 -1
  46. package/dist/client/assets/repo-roots-adder-6Xw2eJJL.js.br +0 -0
  47. package/dist/client/assets/{resume-dialog-OwPnS219.js → resume-dialog-BlBMmw7T.js} +1 -1
  48. package/dist/client/assets/resume-dialog-BlBMmw7T.js.br +0 -0
  49. package/dist/client/assets/{review-queue-panel-D-Eh17Ap.js → review-queue-panel-DkZ-z-xU.js} +1 -1
  50. package/dist/client/assets/review-queue-panel-DkZ-z-xU.js.br +0 -0
  51. package/dist/client/assets/{settings-panel-oVfura3J.js → settings-panel-Dv3yDW9j.js} +2 -2
  52. package/dist/client/assets/settings-panel-Dv3yDW9j.js.br +0 -0
  53. package/dist/client/assets/{shown-lightbox-CxuHBWAz.js → shown-lightbox-Cs0B9BVC.js} +1 -1
  54. package/dist/client/assets/shown-lightbox-Cs0B9BVC.js.br +0 -0
  55. package/dist/client/assets/{team-review-panel-CddwVo5X.js → team-review-panel-DlZsSf4v.js} +1 -1
  56. package/dist/client/assets/team-review-panel-DlZsSf4v.js.br +0 -0
  57. package/dist/client/assets/{trace-panel-Dc5EDgTP.js → trace-panel-BwgE6R62.js} +1 -1
  58. package/dist/client/assets/trace-panel-BwgE6R62.js.br +0 -0
  59. package/dist/client/assets/{usage-panel-xp6uRq3o.js → usage-panel-BqOrJHYS.js} +1 -1
  60. package/dist/client/assets/usage-panel-BqOrJHYS.js.br +0 -0
  61. package/dist/client/index.html +1 -1
  62. package/dist/client/index.html.br +0 -0
  63. package/dist/server/index.js +1 -1
  64. package/package.json +1 -1
  65. package/dist/chunks/kimi-CnRiVzTi.js +0 -1
  66. package/dist/chunks/kimi-home-BvT2PKvb.js +0 -1
  67. package/dist/client/assets/alert-sound-BaDBKXUL.js.br +0 -0
  68. package/dist/client/assets/benchmark-panel-CU3AkWJE.js.br +0 -0
  69. package/dist/client/assets/celebration-player-CFtX3BDS.js.br +0 -0
  70. package/dist/client/assets/community-panel-CHO3hJ7x.js.br +0 -0
  71. package/dist/client/assets/dialogs-fwdQdsvI.js.br +0 -0
  72. package/dist/client/assets/doc-editor-ui-BNffHlsa.js.br +0 -0
  73. package/dist/client/assets/feature-hint-CsUsVidL.js.br +0 -0
  74. package/dist/client/assets/first-run-checklist-D7iNSe7f.js.br +0 -0
  75. package/dist/client/assets/hooks-panel-D1GFEYiO.js.br +0 -0
  76. package/dist/client/assets/index-DwCd9c0Y.js.br +0 -0
  77. package/dist/client/assets/issues-panel-B7cwOVfh.js.br +0 -0
  78. package/dist/client/assets/my-prs-panel-BGkT1xws.js.br +0 -0
  79. package/dist/client/assets/nyan-cat-CX067CJI.js.br +0 -0
  80. package/dist/client/assets/phone-shell-wneaCUIP.js.br +0 -0
  81. package/dist/client/assets/plan-face-3yZcTAZZ.js.br +0 -0
  82. package/dist/client/assets/plan-render-DIvMPcax.js.br +0 -0
  83. package/dist/client/assets/pr-queue-columns-BZL2U5ra.js.br +0 -0
  84. package/dist/client/assets/radar-panel-ByLIOKWq.js.br +0 -0
  85. package/dist/client/assets/repo-roots-adder-CO4ElO5l.js.br +0 -0
  86. package/dist/client/assets/resume-dialog-OwPnS219.js.br +0 -0
  87. package/dist/client/assets/review-queue-panel-D-Eh17Ap.js.br +0 -0
  88. package/dist/client/assets/settings-panel-oVfura3J.js.br +0 -0
  89. package/dist/client/assets/shown-lightbox-CxuHBWAz.js.br +0 -0
  90. package/dist/client/assets/team-review-panel-CddwVo5X.js.br +0 -0
  91. package/dist/client/assets/trace-panel-Dc5EDgTP.js.br +0 -0
  92. package/dist/client/assets/usage-panel-xp6uRq3o.js.br +0 -0
@@ -223,7 +223,7 @@ async function runDoctor() {
223
223
  }
224
224
  switchSection("Agents");
225
225
  try {
226
- const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-B1Y-kxGb.js");
226
+ const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-DWwTuF0s.js");
227
227
  const declaredCustomAgents = await readDeclaredCustomAgents();
228
228
  if (declaredCustomAgents.error) line("config", declaredCustomAgents.error);
229
229
  setCustomAgents(declaredCustomAgents.declared);
@@ -234,8 +234,8 @@ async function runDoctor() {
234
234
  const { inspectGrokAgentSetup } = await import("../chunks/agent-setup-cli-BvHppwtG.js");
235
235
  const grokSetup = inspectGrokAgentSetup();
236
236
  line("grok hook setup", `${grokSetup.classification}: ${grokSetup.filePath}`);
237
- const { default: kimi } = await import("../chunks/kimi-CnRiVzTi.js");
238
- const { describeKimiHome } = await import("../chunks/kimi-home-BvT2PKvb.js");
237
+ const { default: kimi } = await import("../chunks/kimi-BhmoA__R.js");
238
+ const { describeKimiHome } = await import("../chunks/kimi-home-Czh-wcQ_.js");
239
239
  line("kimi home", describeKimiHome(kimi.expectedHooksBlock()));
240
240
  } catch (err) {
241
241
  line("agents", `probe failed: ${firstLine(errorText(err))}`);
@@ -1,4 +1,5 @@
1
- import { o as relayPath } from "./runtime-paths-D_ZjJLE0.js";
1
+ import { a as isMissingFileError } from "./text-DoirglWV.js";
2
+ import { o as relayPath, u as isPathInside } from "./runtime-paths-D_ZjJLE0.js";
2
3
  import { Vt as shortSha$1, zt as FULL_SHA_RE } from "./session-BQaAlkib.js";
3
4
  import { i as execFileSync, r as execFileAsync } from "./child-process-safe-BCOoKfxG.js";
4
5
  import { Ot as UpdateChannel, S as InstallFlavor, c as SHELL_AGENT_ID } from "./config-DtB-yGnd.js";
@@ -12,9 +13,10 @@ import { t as buildHookCommand } from "./hook-command-core-qTNK-xMF.js";
12
13
  import { i as isSpinnerChar, n as classifyAgentTitle, r as isBrailleChar, t as grok } from "./grok-Co0r53k-.js";
13
14
  import { O as nextBackoffMs } from "./json-file-AKRVPqG1.js";
14
15
  import { n as isExperimentalBuild, t as compareReleaseVersions } from "./build-channel-CUO-Zbyn.js";
15
- import { t as kimi } from "./kimi-CyIJoMgO.js";
16
+ import { t as kimi } from "./kimi-B35I7Rlu.js";
16
17
  import fs from "node:fs";
17
18
  import path from "node:path";
19
+ import { z } from "zod";
18
20
  //#region session/adapters/claude-code.ts
19
21
  var ID$1 = "claude-code";
20
22
  var COMMAND_NAME$1 = "claude";
@@ -796,6 +798,338 @@ function codexSessionIdFromPath(filePath) {
796
798
  return base || null;
797
799
  }
798
800
  //#endregion
801
+ //#region server/core/trace-tail-core.ts
802
+ var MAX_TRANSCRIPT_READ_BYTES = 1048576;
803
+ var MAX_PARTIAL_LINE_BYTES = 8388608;
804
+ var TRACE_TAIL_SCAN_BYTES = MAX_TRANSCRIPT_READ_BYTES;
805
+ var MAX_REMEMBERED_TRANSCRIPTS = 16;
806
+ function wholeNumber(value, fallback) {
807
+ const parsed = Number(value);
808
+ if (!Number.isFinite(parsed)) return fallback;
809
+ return Math.max(0, Math.floor(parsed));
810
+ }
811
+ function planContiguousRead(state, stat, { maxReadBytes = MAX_TRANSCRIPT_READ_BYTES } = {}) {
812
+ const committedOffset = wholeNumber(state?.offset, 0);
813
+ if (!state || !stat || !Number.isFinite(Number(stat.size))) return {
814
+ action: "skip",
815
+ start: committedOffset,
816
+ end: committedOffset,
817
+ reset: false
818
+ };
819
+ const size = wholeNumber(stat.size, 0);
820
+ const reset = size < committedOffset;
821
+ const start = reset ? 0 : committedOffset;
822
+ const end = Math.min(size, start + Math.max(1, Math.floor(maxReadBytes)));
823
+ if (end <= start) return {
824
+ action: "skip",
825
+ start,
826
+ end: start,
827
+ reset
828
+ };
829
+ return {
830
+ action: "read",
831
+ start,
832
+ end,
833
+ reset
834
+ };
835
+ }
836
+ function completeLineBytes(chunk) {
837
+ return chunk.lastIndexOf(10) + 1;
838
+ }
839
+ function committedOffsetFor(offsets, transcriptPath) {
840
+ if (!offsets || typeof offsets !== "object" || Array.isArray(offsets)) return 0;
841
+ return wholeNumber(offsets[transcriptPath], 0);
842
+ }
843
+ function withCommittedOffset(offsets, transcriptPath, offset, { maxRemembered = MAX_REMEMBERED_TRANSCRIPTS } = {}) {
844
+ const remembered = {};
845
+ for (const [knownPath, knownOffset] of Object.entries(offsets)) {
846
+ if (knownPath === transcriptPath) continue;
847
+ remembered[knownPath] = knownOffset;
848
+ }
849
+ remembered[transcriptPath] = wholeNumber(offset, 0);
850
+ const rememberedPaths = Object.keys(remembered);
851
+ const rememberedLimit = Math.max(1, wholeNumber(maxRemembered, MAX_REMEMBERED_TRANSCRIPTS));
852
+ const overflow = rememberedPaths.length - rememberedLimit;
853
+ if (overflow <= 0) return remembered;
854
+ for (const stalePath of rememberedPaths.slice(0, overflow)) delete remembered[stalePath];
855
+ return remembered;
856
+ }
857
+ function committedOffsetFromTraceTailOrNull(tailText, { transcriptPath, pathBeforeWindow = null, isWholeFile = false }) {
858
+ const lines = tailText.split("\n");
859
+ if (!isWholeFile) lines.shift();
860
+ const records = [];
861
+ for (const line of lines) {
862
+ const record = parseJsonRecord(line);
863
+ if (record) records.push(record);
864
+ }
865
+ let pathOfCurrentRun = records.some((record) => record.kind === "session") ? null : pathBeforeWindow;
866
+ let hasSeenTargetRun = pathOfCurrentRun === transcriptPath;
867
+ let tracedOffset = 0;
868
+ for (const record of records) {
869
+ if (record.kind === "session") pathOfCurrentRun = typeof record.transcriptPath === "string" ? record.transcriptPath : null;
870
+ if (pathOfCurrentRun !== transcriptPath) continue;
871
+ hasSeenTargetRun = true;
872
+ tracedOffset = Math.max(tracedOffset, wholeNumber(record.transcriptOffset, 0));
873
+ }
874
+ if (!hasSeenTargetRun) return null;
875
+ return tracedOffset;
876
+ }
877
+ function resumeOffsetFrom(checkpoint, { transcriptPath, size, alreadyTracedOffset = 0, traceSize = 0 }) {
878
+ const transcriptSize = wholeNumber(size, 0);
879
+ if (!checkpoint && alreadyTracedOffset === null && wholeNumber(traceSize, 0) > 0) return {
880
+ offset: transcriptSize,
881
+ didReset: false,
882
+ didFallbackToTranscriptEnd: true
883
+ };
884
+ const fromLatestPath = checkpoint && checkpoint.transcriptPath === transcriptPath ? wholeNumber(checkpoint.offset, 0) : 0;
885
+ const committed = Math.max(fromLatestPath, committedOffsetFor(checkpoint?.offsetByTranscriptPath, transcriptPath), wholeNumber(alreadyTracedOffset, 0));
886
+ if (committed === 0) return {
887
+ offset: 0,
888
+ didReset: false,
889
+ didFallbackToTranscriptEnd: false
890
+ };
891
+ if (committed > transcriptSize) return {
892
+ offset: 0,
893
+ didReset: true,
894
+ didFallbackToTranscriptEnd: false
895
+ };
896
+ return {
897
+ offset: committed,
898
+ didReset: false,
899
+ didFallbackToTranscriptEnd: false
900
+ };
901
+ }
902
+ function containmentRefusalReason(error) {
903
+ return isMissingFileError(error) ? "missing" : "unreadable";
904
+ }
905
+ function isOversizedPartialLine(carry, { maxPartialLineBytes = MAX_PARTIAL_LINE_BYTES } = {}) {
906
+ return (Buffer.isBuffer(carry) ? carry.length : Buffer.byteLength(carry, "utf8")) > Math.max(1, Math.floor(maxPartialLineBytes));
907
+ }
908
+ //#endregion
909
+ //#region server/core/upload-core.ts
910
+ var IMAGE_EXTENSION_BY_MIME = Object.freeze({
911
+ "image/png": ".png",
912
+ "image/jpeg": ".jpg",
913
+ "image/webp": ".webp",
914
+ "image/gif": ".gif"
915
+ });
916
+ var MAX_UPLOAD_BYTES = 15728640;
917
+ var UPLOAD_RETAIN_FILES = 20;
918
+ var PASTE_START = "\x1B[200~";
919
+ var PASTE_END = "\x1B[201~";
920
+ var SAFE_SEGMENT_RE = /^[A-Za-z0-9._-]+$/;
921
+ var CLIENT_NAME_EXTENSION_RE = /\.([A-Za-z0-9]{1,16})$/;
922
+ var UPLOAD_FILENAME_RE = /^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z-[0-9a-f]{8}(\.[a-z0-9]{1,16})?$/;
923
+ function extensionForImageMime(contentTypeHeader) {
924
+ if (typeof contentTypeHeader !== "string") return null;
925
+ return IMAGE_EXTENSION_BY_MIME[contentTypeHeader.split(";")[0].trim().toLowerCase()] || null;
926
+ }
927
+ function decodeUploadName(uploadNameHeader) {
928
+ if (typeof uploadNameHeader !== "string" || uploadNameHeader.length === 0) return null;
929
+ try {
930
+ const decoded = decodeURIComponent(uploadNameHeader);
931
+ if (decoded.length === 0) return null;
932
+ return decoded;
933
+ } catch {
934
+ return null;
935
+ }
936
+ }
937
+ function extensionForUploadName(uploadNameHeader) {
938
+ const clientName = decodeUploadName(uploadNameHeader);
939
+ if (clientName === null) return null;
940
+ const trailingExtension = CLIENT_NAME_EXTENSION_RE.exec(clientName);
941
+ if (!trailingExtension) return "";
942
+ return `.${trailingExtension[1].toLowerCase()}`;
943
+ }
944
+ function decideUploadType(contentTypeHeader, uploadNameHeader) {
945
+ const imageExtension = extensionForImageMime(contentTypeHeader);
946
+ if (imageExtension) return {
947
+ ok: true,
948
+ extension: imageExtension
949
+ };
950
+ const namedExtension = extensionForUploadName(uploadNameHeader);
951
+ if (namedExtension === null) return {
952
+ ok: false,
953
+ status: 415,
954
+ error: "unsupported upload type"
955
+ };
956
+ return {
957
+ ok: true,
958
+ extension: namedExtension
959
+ };
960
+ }
961
+ function exceedsUploadCap(bytesReceived, cap = MAX_UPLOAD_BYTES) {
962
+ return bytesReceived > cap;
963
+ }
964
+ function isSafePathSegment(segment) {
965
+ if (typeof segment !== "string" || segment.length === 0) return false;
966
+ if (segment === "." || segment === "..") return false;
967
+ if (path.basename(segment) !== segment) return false;
968
+ return SAFE_SEGMENT_RE.test(segment);
969
+ }
970
+ function buildUploadFilename({ now, randomSuffix, extension }) {
971
+ return `${new Date(now).toISOString().replace(/[:.]/g, "-")}-${randomSuffix}${extension}`;
972
+ }
973
+ function framePathPaste(absolutePath) {
974
+ return `${PASTE_START}${absolutePath} ${PASTE_END}`;
975
+ }
976
+ function planUploadRetention(filenames, { keep = UPLOAD_RETAIN_FILES, justWritten = null } = {}) {
977
+ if (!Array.isArray(filenames) || keep <= 0) return [];
978
+ const uploads = filenames.filter((name) => isUploadFilename(name));
979
+ if (justWritten && !uploads.includes(justWritten)) uploads.push(justWritten);
980
+ uploads.sort().reverse();
981
+ return uploads.slice(keep).filter((name) => name !== justWritten);
982
+ }
983
+ function isUploadFilename(name) {
984
+ if (typeof name !== "string") return false;
985
+ return UPLOAD_FILENAME_RE.test(name);
986
+ }
987
+ function imageMimeForUploadFilename(name) {
988
+ if (!isUploadFilename(name)) return null;
989
+ const extension = path.extname(name).toLowerCase();
990
+ const imageEntry = Object.entries(IMAGE_EXTENSION_BY_MIME).find(([, imageExtension]) => imageExtension === extension);
991
+ return imageEntry ? imageEntry[0] : null;
992
+ }
993
+ //#endregion
994
+ //#region server/contained-file.ts
995
+ async function containedPathForMissingFile(candidate, realRoot) {
996
+ const fileName = path.basename(candidate);
997
+ if (!isSafePathSegment(fileName)) return {
998
+ ok: false,
999
+ reason: "outside-root"
1000
+ };
1001
+ try {
1002
+ const realDirectory = await fs.promises.realpath(path.dirname(candidate));
1003
+ const realPath = path.join(realDirectory, fileName);
1004
+ if (!isPathInside(realRoot, realPath, { allowEqual: false })) return {
1005
+ ok: false,
1006
+ reason: "outside-root"
1007
+ };
1008
+ if (!(await fs.promises.lstat(realDirectory)).isDirectory()) return {
1009
+ ok: false,
1010
+ reason: "missing"
1011
+ };
1012
+ return {
1013
+ ok: true,
1014
+ file: { realPath }
1015
+ };
1016
+ } catch (error) {
1017
+ return {
1018
+ ok: false,
1019
+ reason: containmentRefusalReason(error)
1020
+ };
1021
+ }
1022
+ }
1023
+ async function openContainedFile(candidate, root, allowsMissingFile = false, opensForWriting = false) {
1024
+ let realRoot;
1025
+ try {
1026
+ realRoot = await fs.promises.realpath(root);
1027
+ } catch {
1028
+ return {
1029
+ ok: false,
1030
+ reason: "root-unresolvable"
1031
+ };
1032
+ }
1033
+ let realCandidate;
1034
+ try {
1035
+ realCandidate = await fs.promises.realpath(candidate);
1036
+ } catch (error) {
1037
+ const reason = containmentRefusalReason(error);
1038
+ if (!allowsMissingFile || reason !== "missing") return {
1039
+ ok: false,
1040
+ reason
1041
+ };
1042
+ return containedPathForMissingFile(candidate, realRoot);
1043
+ }
1044
+ if (!isPathInside(realRoot, realCandidate, { allowEqual: false })) return {
1045
+ ok: false,
1046
+ reason: "outside-root"
1047
+ };
1048
+ let handle = null;
1049
+ try {
1050
+ const accessFlag = opensForWriting ? fs.constants.O_RDWR : fs.constants.O_RDONLY;
1051
+ handle = await fs.promises.open(realCandidate, accessFlag | fs.constants.O_NONBLOCK);
1052
+ const stat = await handle.stat();
1053
+ if (stat.isFile()) return {
1054
+ ok: true,
1055
+ file: {
1056
+ handle,
1057
+ realPath: realCandidate,
1058
+ stat
1059
+ }
1060
+ };
1061
+ await handle.close().catch(() => {});
1062
+ return {
1063
+ ok: false,
1064
+ reason: "not-a-regular-file"
1065
+ };
1066
+ } catch (error) {
1067
+ if (handle) await handle.close().catch(() => {});
1068
+ return {
1069
+ ok: false,
1070
+ reason: containmentRefusalReason(error)
1071
+ };
1072
+ }
1073
+ }
1074
+ //#endregion
1075
+ //#region session/core/codex-plan-rollout-core.ts
1076
+ var PROPOSED_PLAN_TAG = "<proposed_plan>";
1077
+ var PLAN_COLLABORATION_MODE = "plan";
1078
+ var RELEVANT_LINE_MARKERS = ["\"task_started\"", "\"final_answer\""];
1079
+ var TaskStartedLine = z.object({
1080
+ type: z.literal("event_msg"),
1081
+ payload: z.object({
1082
+ type: z.literal("task_started"),
1083
+ turn_id: z.string(),
1084
+ collaboration_mode_kind: z.string().optional()
1085
+ })
1086
+ });
1087
+ var AssistantFinalAnswerLine = z.object({
1088
+ type: z.literal("response_item"),
1089
+ payload: z.object({
1090
+ type: z.literal("message"),
1091
+ role: z.literal("assistant"),
1092
+ phase: z.literal("final_answer"),
1093
+ content: z.array(z.object({
1094
+ type: z.string(),
1095
+ text: z.string().optional()
1096
+ })),
1097
+ internal_chat_message_metadata_passthrough: z.object({ turn_id: z.string() })
1098
+ })
1099
+ });
1100
+ function parseRolloutLine(line) {
1101
+ try {
1102
+ return JSON.parse(line);
1103
+ } catch {
1104
+ return null;
1105
+ }
1106
+ }
1107
+ function isRelevantRolloutLine(line) {
1108
+ return RELEVANT_LINE_MARKERS.some((marker) => line.includes(marker));
1109
+ }
1110
+ function isTurnStartLine(line, turnId) {
1111
+ if (!line.includes("\"task_started\"")) return false;
1112
+ const taskStarted = TaskStartedLine.safeParse(parseRolloutLine(line));
1113
+ return taskStarted.success && taskStarted.data.payload.turn_id === turnId;
1114
+ }
1115
+ function turnEndedWithProposedPlan(rolloutLines, turnId) {
1116
+ let didTurnRunInPlanMode = false;
1117
+ let finalAnswerText = "";
1118
+ for (const line of rolloutLines) {
1119
+ if (!isRelevantRolloutLine(line)) continue;
1120
+ const record = parseRolloutLine(line);
1121
+ const taskStarted = TaskStartedLine.safeParse(record);
1122
+ if (taskStarted.success && taskStarted.data.payload.turn_id === turnId) {
1123
+ didTurnRunInPlanMode = taskStarted.data.payload.collaboration_mode_kind === PLAN_COLLABORATION_MODE;
1124
+ continue;
1125
+ }
1126
+ const finalAnswer = AssistantFinalAnswerLine.safeParse(record);
1127
+ if (!finalAnswer.success || finalAnswer.data.payload.internal_chat_message_metadata_passthrough.turn_id !== turnId) continue;
1128
+ finalAnswerText = finalAnswer.data.payload.content.map((part) => part.text ?? "").join("");
1129
+ }
1130
+ return didTurnRunInPlanMode && finalAnswerText.includes(PROPOSED_PLAN_TAG);
1131
+ }
1132
+ //#endregion
799
1133
  //#region shared/repo.ts
800
1134
  var REPO_SLUG = "johncwaters/glimmervoid";
801
1135
  //#endregion
@@ -1040,6 +1374,9 @@ function codexHookPlanFor(installedVersion) {
1040
1374
  var ID = "codex";
1041
1375
  var COMMAND_NAME = "codex";
1042
1376
  var RELAY_PATH = relayPath("hook-relay");
1377
+ var PLAN_PROPOSED_FIELD = "glimmervoid_plan_proposed";
1378
+ var ROLLOUT_CHUNK_BYTES = 1048576;
1379
+ var ROLLOUT_SCAN_LIMIT_BYTES = 64 * ROLLOUT_CHUNK_BYTES;
1043
1380
  var HOOK_TOOL_RELAY_PATH = relayPath("hook-tool-relay");
1044
1381
  var HOOK_EVENTS = LEGACY_HOOK_EVENTS;
1045
1382
  var envProfile$2 = {
@@ -1070,13 +1407,61 @@ var REQUEST_USER_INPUT_TOOL_NAME = "request_user_input";
1070
1407
  function isRequestUserInput(event, payload) {
1071
1408
  return event === "pretooluse" && payload?.tool_name === REQUEST_USER_INPUT_TOOL_NAME;
1072
1409
  }
1410
+ function isProposedPlanStop(event, payload) {
1411
+ return event === "stop" && payload?.[PLAN_PROPOSED_FIELD] === true;
1412
+ }
1413
+ async function readTurnRolloutLines(handle, fileSize, turnId) {
1414
+ const scanFloor = Math.max(0, fileSize - ROLLOUT_SCAN_LIMIT_BYTES);
1415
+ const relevantLines = [];
1416
+ let chunkEnd = fileSize;
1417
+ let carriedBytes = Buffer.alloc(0);
1418
+ while (chunkEnd > scanFloor) {
1419
+ const chunkStart = Math.max(scanFloor, chunkEnd - ROLLOUT_CHUNK_BYTES);
1420
+ const chunk = Buffer.alloc(chunkEnd - chunkStart);
1421
+ const { bytesRead } = await handle.read(chunk, 0, chunk.length, chunkStart);
1422
+ const window = Buffer.concat([chunk.subarray(0, bytesRead), carriedBytes]);
1423
+ const firstNewline = chunkStart === 0 ? -1 : window.indexOf(10);
1424
+ carriedBytes = window.subarray(0, firstNewline + 1);
1425
+ const chunkLines = window.subarray(firstNewline + 1).toString("utf8").split("\n").filter(isRelevantRolloutLine);
1426
+ relevantLines.unshift(...chunkLines);
1427
+ if (chunkLines.some((line) => isTurnStartLine(line, turnId))) return relevantLines;
1428
+ chunkEnd = chunkStart;
1429
+ }
1430
+ if (scanFloor > 0) console.warn(`codex rollout scan stopped at ${ROLLOUT_SCAN_LIMIT_BYTES} bytes without the start of turn ${turnId}`);
1431
+ return relevantLines;
1432
+ }
1433
+ async function readTurnRolloutLinesFromCodexHome(transcriptPath, turnId, agentEnv) {
1434
+ for (const codexHome of codexHomes(agentEnv, null)) {
1435
+ const opened = await openContainedFile(path.resolve(transcriptPath), path.join(codexHome, "sessions"));
1436
+ if (!opened.ok) continue;
1437
+ const { handle, stat } = opened.file;
1438
+ try {
1439
+ return await readTurnRolloutLines(handle, stat.size, turnId);
1440
+ } finally {
1441
+ await handle.close();
1442
+ }
1443
+ }
1444
+ return null;
1445
+ }
1446
+ async function enrichHookPayload(event, payload, agentEnv) {
1447
+ if (String(event || "").toLowerCase() !== "stop") return payload;
1448
+ const { transcript_path: transcriptPath, session_id: sessionId, turn_id: turnId } = payload;
1449
+ if (typeof transcriptPath !== "string" || typeof sessionId !== "string" || typeof turnId !== "string") return payload;
1450
+ if (codexSessionIdFromPath(transcriptPath) !== sessionId) return payload;
1451
+ const rolloutLines = await readTurnRolloutLinesFromCodexHome(transcriptPath, turnId, agentEnv);
1452
+ if (!rolloutLines || !turnEndedWithProposedPlan(rolloutLines, turnId)) return payload;
1453
+ return {
1454
+ ...payload,
1455
+ [PLAN_PROPOSED_FIELD]: true
1456
+ };
1457
+ }
1073
1458
  function mapHookToSignal(event, payload) {
1074
1459
  const e = String(event || "").toLowerCase();
1075
1460
  switch (e) {
1076
1461
  case "sessionstart": return "session-start";
1077
1462
  case "sessionend": return "session-end";
1078
1463
  case "userpromptsubmit": return "resume";
1079
- case "stop": return "ready";
1464
+ case "stop": return isProposedPlanStop(e, payload) ? "awaiting-input" : "ready";
1080
1465
  case "permissionrequest": return "awaiting-input";
1081
1466
  case "precompact": return "compaction-start";
1082
1467
  case "postcompact": return "compaction-end";
@@ -1094,6 +1479,7 @@ function mapHookPromptKind(event, payload) {
1094
1479
  const e = String(event || "").toLowerCase();
1095
1480
  if (e === "permissionrequest") return "permission";
1096
1481
  if (isRequestUserInput(e, payload)) return "elicitation";
1482
+ if (isProposedPlanStop(e, payload)) return "plan";
1097
1483
  return null;
1098
1484
  }
1099
1485
  function sessionIdOf(payload) {
@@ -1214,6 +1600,7 @@ var hooks = {
1214
1600
  mapSignal: mapHookToSignal,
1215
1601
  mapConfidence: mapHookConfidence,
1216
1602
  mapPromptKind: mapHookPromptKind,
1603
+ enrichPayload: enrichHookPayload,
1217
1604
  injection: {
1218
1605
  kind: "argv-config",
1219
1606
  relayPath: RELAY_PATH,
@@ -1577,4 +1964,4 @@ function resetCommandCache() {
1577
1964
  resolvedCommands.clear();
1578
1965
  }
1579
1966
  //#endregion
1580
- export { isWithinGenerationRecencyWindow as $, decideFileRead as A, sessionsRootCandidates as B, pickNewestPublished as C, codexRootCandidates as D, codexHomes as E, kimiHomes as F, parseKimiUsageLine as G, shouldPersistWarehouse as H, passOutcome as I, emptyTotals as J, addEntryToTotals as K, projectDirCandidates as L, expandTilde as M, grokHomes as N, codexSessionIdFromPath as O, isUsageFile as P, identityFromRelPath as Q, resolveProjectsDirs as R, parseResolvedSha as S, codexFallbackRoots as T, splitLines as U, shouldEvaluateDespiteIoFailures as V, kimiDedupIdentity as W, foldEntryIntoGenerationRollup as X, expandAdvisorIterations as Y, foldReplacementIntoGenerationRollup as Z, isCheckFresh as _, describeAgentResolvability as a, vendorUsageEntry as at, parseRegistryDeprecation as b, isKnownAgentId as c, resolveAdapter as d, mergeGenerationRollups as et, setCustomAgents as f, decideUpdateStatus as g, decideInstallFlavor as h, customAgentFingerprint as i, totalTokensOf as it, dedupeCodexFiles as j, continuationDelayMs as k, listAgentIds as l, readHostCodexVersion as m, cachedAgentResolvability as n, parseUsageLine as nt, getAdapter as o, HOOK_TOOLS as ot, codex as p, dedupKeys as q, commandFor as r, shouldReplace as rt, hookProfileOf as s, claudeCode as st, DEFAULT_AGENT_ID as t, parseJsonLine as tt, resetCommandCache as u, normalizeSha as v, shortSha as w, parseRegistryLatest as x, normalizeUpdateChannel as y, scopedClaudeRoots as z };
1967
+ export { kimiHomes as $, framePathPaste as A, planContiguousRead as B, pickNewestPublished as C, vendorUsageEntry as Ct, buildUploadFilename as D, MAX_UPLOAD_BYTES as E, TRACE_TAIL_SCAN_BYTES as F, codexRootCandidates as G, withCommittedOffset as H, committedOffsetFromTraceTailOrNull as I, decideFileRead as J, codexSessionIdFromPath as K, completeLineBytes as L, isSafePathSegment as M, planUploadRetention as N, decideUploadType as O, MAX_TRANSCRIPT_READ_BYTES as P, isUsageFile as Q, containmentRefusalReason as R, parseResolvedSha as S, totalTokensOf as St, openContainedFile as T, claudeCode as Tt, codexFallbackRoots as U, resumeOffsetFrom as V, codexHomes as W, expandTilde as X, dedupeCodexFiles as Y, grokHomes as Z, isCheckFresh as _, isWithinGenerationRecencyWindow as _t, describeAgentResolvability as a, shouldEvaluateDespiteIoFailures as at, parseRegistryDeprecation as b, parseUsageLine as bt, isKnownAgentId as c, kimiDedupIdentity as ct, resolveAdapter as d, dedupKeys as dt, passOutcome as et, setCustomAgents as f, emptyTotals as ft, decideUpdateStatus as g, identityFromRelPath as gt, decideInstallFlavor as h, foldReplacementIntoGenerationRollup as ht, customAgentFingerprint as i, sessionsRootCandidates as it, imageMimeForUploadFilename as j, exceedsUploadCap as k, listAgentIds as l, parseKimiUsageLine as lt, readHostCodexVersion as m, foldEntryIntoGenerationRollup as mt, cachedAgentResolvability as n, resolveProjectsDirs as nt, getAdapter as o, shouldPersistWarehouse as ot, codex as p, expandAdvisorIterations as pt, continuationDelayMs as q, commandFor as r, scopedClaudeRoots as rt, hookProfileOf as s, splitLines as st, DEFAULT_AGENT_ID as t, projectDirCandidates as tt, resetCommandCache as u, addEntryToTotals as ut, normalizeSha as v, mergeGenerationRollups as vt, shortSha as w, HOOK_TOOLS as wt, parseRegistryLatest as x, shouldReplace as xt, normalizeUpdateChannel as y, parseJsonLine as yt, isOversizedPartialLine as z };
@@ -1 +1 @@
1
- export { a as describeAgentResolvability, l as listAgentIds, f as setCustomAgents } from "./adapters-D0Qsu_Py.js";
1
+ export { a as describeAgentResolvability, l as listAgentIds, f as setCustomAgents } from "./adapters-CCDF7Syx.js";
@@ -4,7 +4,7 @@ import { i as execFileSync } from "./child-process-safe-BCOoKfxG.js";
4
4
  import { n as resolveAgentCommand, t as buildAgentSpawnCommand } from "./spawn-command-CQECOvjC.js";
5
5
  import { t as KIMI_SANE_YOLO_FLAVOR } from "./sane-yolo-DSyFqbVE.js";
6
6
  import { t as buildAgentEnv } from "./spawn-env-Dh1MZR4M.js";
7
- import { a as prepareKimiHome, i as kimiHomeLinkRefusal, n as generatedKimiHomePath, o as realKimiHome, p as renderKimiHooksBlock, r as holdKimiHome, s as releaseKimiHome } from "./kimi-home-D7RE58XY.js";
7
+ import { a as prepareKimiHome, i as kimiHomeLinkRefusal, m as renderKimiHooksBlock, n as generatedKimiHomePath, o as realKimiHome, r as holdKimiHome, s as releaseKimiHome } from "./kimi-home-4-aMoqJC.js";
8
8
  import fs from "node:fs";
9
9
  import path from "node:path";
10
10
  import { createHash } from "node:crypto";
@@ -0,0 +1 @@
1
+ export { t as default } from "./kimi-B35I7Rlu.js";
@@ -870,4 +870,4 @@ function releaseUnheldKimiHomeSecrets(generatedHome) {
870
870
  releaseSecretsUnlessHeldElsewhere(generatedHome, { whenLocksMissing: "keep" });
871
871
  }
872
872
  //#endregion
873
- export { prepareKimiHome as a, releaseUnheldKimiHomeSecrets as c, sessionIdOfLockFile as d, trashSessionTempFolderOnceUnheld as f, kimiHomeLinkRefusal as i, createHeldSessionTempFolder as l, generatedKimiHomePath as n, realKimiHome as o, renderKimiHooksBlock as p, holdKimiHome as r, releaseKimiHome as s, describeKimiHome as t, releaseSessionLock as u };
873
+ export { prepareKimiHome as a, releaseUnheldKimiHomeSecrets as c, sessionIdOfLockFile as d, trashSessionTempFolderOnceUnheld as f, kimiHomeLinkRefusal as i, createHeldSessionTempFolder as l, renderKimiHooksBlock as m, generatedKimiHomePath as n, realKimiHome as o, definesHooksOutsideArrayTables as p, holdKimiHome as r, releaseKimiHome as s, describeKimiHome as t, releaseSessionLock as u };
@@ -0,0 +1 @@
1
+ export { t as describeKimiHome } from "./kimi-home-4-aMoqJC.js";