glimmervoid 0.36.0 → 0.37.0

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 (41) hide show
  1. package/README.md +86 -84
  2. package/dist/bin/glimmervoid.js +54 -115
  3. package/dist/chunks/{adapters-BdnLyJjf.js → adapters-BmfVPxlH.js} +22 -15
  4. package/dist/chunks/adapters-CqFFmM2R.js +1 -0
  5. package/dist/chunks/{agent-api-cli-DIqRLvu3.js → agent-api-cli-BTHEyJKS.js} +1 -1
  6. package/dist/chunks/{agent-api-cli-d-Bgsshx.js → agent-api-cli-CBgOKXoO.js} +41 -12
  7. package/dist/chunks/{agent-api-core-BUC9WND7.js → agent-api-core-DzKhakCv.js} +94 -3
  8. package/dist/chunks/{agent-setup-cli-CH7EHsAX.js → agent-setup-cli-C8DGxlA-.js} +1 -1
  9. package/dist/chunks/{config-CuZ16F9W.js → config-BYc2z1Oc.js} +15 -10
  10. package/dist/chunks/{config-store-LqQ7MuyV.js → config-store-B7MpiYxG.js} +7 -7
  11. package/dist/chunks/config-store-CsUoy88Q.js +1 -0
  12. package/dist/chunks/{contracts-BLZAOP57.js → contracts-C6ipN_zw.js} +48 -9
  13. package/dist/chunks/git-version-6QFnKbWa.js +139 -0
  14. package/dist/chunks/{grok-Ch4-35_r.js → grok-CZ6kP_vD.js} +5 -1
  15. package/dist/chunks/guardrails-deps-Cb-ki4EU.js +70 -0
  16. package/dist/chunks/{sandbox-proxy-core-hnQgKR0T.js → guardrails-proxy-core-BI3rdY-m.js} +4 -4
  17. package/dist/chunks/{knowledge-graph-cli-DD7QvcFd.js → knowledge-graph-cli-DApeMzA8.js} +1 -1
  18. package/dist/chunks/{loopback-post-DepQfdcM.js → loopback-post-DJ6iYWuL.js} +9 -9
  19. package/dist/chunks/{main-Rmo83Ow-.js → main-BUfjroXE.js} +12976 -11532
  20. package/dist/chunks/{pair-cli-DzFeAmq5.js → pair-cli-GZ9t1mIO.js} +2 -2
  21. package/dist/chunks/{remote-config-CPdSF2Xi.js → remote-config-D2Is89Kj.js} +1 -1
  22. package/dist/chunks/{session-B8RhqQJe.js → session-BZbariv5.js} +54 -8
  23. package/dist/chunks/{session-routes-DB5aDKsx.js → session-routes-C4t8O8yg.js} +9 -9
  24. package/dist/chunks/{settings-cli-C2TY6hl-.js → settings-cli-DQOjmjev.js} +3 -3
  25. package/dist/chunks/{ssh-sign-cli-C2nUwJC-.js → ssh-sign-cli-LIBP8ppO.js} +2 -2
  26. package/dist/client/assets/index-B_Qt7fbZ.css +1 -0
  27. package/dist/client/assets/index-D-upBor0.js +265 -0
  28. package/dist/client/index.html +2 -2
  29. package/dist/scripts/postinstall-path-check.js +4 -4
  30. package/dist/server/index.js +1 -1
  31. package/dist/session/command-hook-relay.js +1 -1
  32. package/dist/session/{sandbox-open-launcher.js → guardrails-open-launcher.js} +10 -10
  33. package/dist/session/hook-relay.js +1 -1
  34. package/dist/session/statusline-relay.js +1 -1
  35. package/package.json +4 -3
  36. package/dist/chunks/adapters-BVozg-Lg.js +0 -1
  37. package/dist/chunks/config-store-tVmt_nfm.js +0 -1
  38. package/dist/chunks/git-version-CUcDtF5k.js +0 -58
  39. package/dist/chunks/sandbox-deps-CWiH1d1w.js +0 -70
  40. package/dist/client/assets/index-BIaSyXwH.css +0 -1
  41. package/dist/client/assets/index-Ddu7M4Ad.js +0 -259
@@ -0,0 +1,139 @@
1
+ import { t as AGENT_API_VERBS } from "./session-BZbariv5.js";
2
+ import { r as execFileSync } from "./child-process-safe-CbQnyh7D.js";
3
+ //#region server/core/command-line-core.ts
4
+ var SUBCOMMANDS_HONORING_TRAILING_GLOBAL_OPTIONS = /* @__PURE__ */ new Set([
5
+ "doctor",
6
+ "pair",
7
+ "visions"
8
+ ]);
9
+ var SUBCOMMANDS_HONORING_A_LEADING_HELP_OR_VERSION = /* @__PURE__ */ new Set([...AGENT_API_VERBS, "factory"]);
10
+ var OPTIONS_TAKING_A_VALUE = {
11
+ "--config": "configPath",
12
+ "--port": "port"
13
+ };
14
+ function scanGlobalOption(argv, index, state) {
15
+ const token = argv[index];
16
+ const valueKey = OPTIONS_TAKING_A_VALUE[token];
17
+ if (valueKey) {
18
+ const value = argv[index + 1];
19
+ if (value !== void 0) state[valueKey] = value;
20
+ return index + 2;
21
+ }
22
+ if (token === "--help" || token === "-h") state.wantsHelp = true;
23
+ if (token === "--version") state.wantsVersion = true;
24
+ if (token === "--doctor") state.wantsDoctor = true;
25
+ if (token === "--no-open") state.wantsNoOpen = true;
26
+ return index + 1;
27
+ }
28
+ function scanTrailingGlobalOptions(subcommandArgs, state) {
29
+ let index = 0;
30
+ while (index < subcommandArgs.length) {
31
+ if (!subcommandArgs[index].startsWith("-")) {
32
+ index += 1;
33
+ continue;
34
+ }
35
+ index = scanGlobalOption(subcommandArgs, index, state);
36
+ }
37
+ }
38
+ function scanLeadingHelpOrVersion(subcommandArgs, state) {
39
+ const firstArgument = subcommandArgs[0];
40
+ if (firstArgument === "--help" || firstArgument === "-h") state.wantsHelp = true;
41
+ if (firstArgument === "--version") state.wantsVersion = true;
42
+ }
43
+ function parseCommandLine(argv) {
44
+ const state = {
45
+ configPath: null,
46
+ port: null,
47
+ wantsHelp: false,
48
+ wantsVersion: false,
49
+ wantsDoctor: false,
50
+ wantsNoOpen: false
51
+ };
52
+ let index = 0;
53
+ while (index < argv.length && argv[index].startsWith("-")) index = scanGlobalOption(argv, index, state);
54
+ const name = argv[index];
55
+ const subcommandArgs = argv.slice(index + 1);
56
+ if (name !== void 0 && SUBCOMMANDS_HONORING_TRAILING_GLOBAL_OPTIONS.has(name)) scanTrailingGlobalOptions(subcommandArgs, state);
57
+ if (name !== void 0 && SUBCOMMANDS_HONORING_A_LEADING_HELP_OR_VERSION.has(name)) scanLeadingHelpOrVersion(subcommandArgs, state);
58
+ if (state.wantsHelp) return { kind: "help" };
59
+ if (state.wantsVersion) return { kind: "version" };
60
+ const globalOptions = {
61
+ configPath: state.configPath,
62
+ port: state.port
63
+ };
64
+ if (state.wantsDoctor) return {
65
+ kind: "subcommand",
66
+ name: "doctor",
67
+ subcommandArgs: [],
68
+ globalOptions
69
+ };
70
+ if (name === void 0) return {
71
+ kind: "server",
72
+ globalOptions,
73
+ isBrowserOpenSkipped: state.wantsNoOpen
74
+ };
75
+ return {
76
+ kind: "subcommand",
77
+ name,
78
+ subcommandArgs,
79
+ globalOptions
80
+ };
81
+ }
82
+ //#endregion
83
+ //#region server/git/core/git-version-core.ts
84
+ var NEW_WORK_ISOLATION_FLOOR = Object.freeze({
85
+ major: 2,
86
+ minor: 48
87
+ });
88
+ var NEW_WORK_ISOLATION_FLOOR_LABEL = `${NEW_WORK_ISOLATION_FLOOR.major}.${NEW_WORK_ISOLATION_FLOOR.minor}`;
89
+ var WHOLE_RANGE_CONSEQUENCE = "a team re-review cannot single out the author's new work and reviews the whole pull request range";
90
+ var GIT_UPDATE_HINT = `Update git to ${NEW_WORK_ISOLATION_FLOOR_LABEL} or newer`;
91
+ var UNKNOWN_GIT_VERSION = Object.freeze({
92
+ version: null,
93
+ isTooOldToIsolateNewWork: false
94
+ });
95
+ function gitVersionReport(versionOutput) {
96
+ const match = /^git version (\d+)\.(\d+)(?:\.(\d+))?/.exec(versionOutput?.trim() ?? "");
97
+ if (!match) return UNKNOWN_GIT_VERSION;
98
+ const [, major = "", minor = "", patch] = match;
99
+ const isBelowFloorMajor = Number(major) < NEW_WORK_ISOLATION_FLOOR.major;
100
+ const isBelowFloorMinor = Number(major) === NEW_WORK_ISOLATION_FLOOR.major && Number(minor) < NEW_WORK_ISOLATION_FLOOR.minor;
101
+ return {
102
+ version: [
103
+ major,
104
+ minor,
105
+ patch
106
+ ].filter((part) => part !== void 0).join("."),
107
+ isTooOldToIsolateNewWork: isBelowFloorMajor || isBelowFloorMinor
108
+ };
109
+ }
110
+ function gitBootWarning(report) {
111
+ if (!report.isTooOldToIsolateNewWork) return null;
112
+ return `[git] git ${report.version} is older than ${NEW_WORK_ISOLATION_FLOOR_LABEL}, so ${WHOLE_RANGE_CONSEQUENCE}. ${GIT_UPDATE_HINT}.`;
113
+ }
114
+ function gitDoctorRows(report) {
115
+ const versionRow = ["git", report.version ?? "unknown"];
116
+ if (!report.isTooOldToIsolateNewWork) return [versionRow];
117
+ return [versionRow, ["hint", `${GIT_UPDATE_HINT}: on an older one ${WHOLE_RANGE_CONSEQUENCE}`]];
118
+ }
119
+ //#endregion
120
+ //#region server/git/git-version.ts
121
+ function readGitVersionOutput() {
122
+ return execFileSync("git", ["--version"], {
123
+ encoding: "utf8",
124
+ timeout: 3e3
125
+ });
126
+ }
127
+ function probeGitVersion({ readVersionOutput = readGitVersionOutput } = {}) {
128
+ try {
129
+ return gitVersionReport(readVersionOutput());
130
+ } catch {
131
+ return gitVersionReport(null);
132
+ }
133
+ }
134
+ function warnWhenGitIsTooOld({ probe = probeGitVersion, log = console } = {}) {
135
+ const warning = gitBootWarning(probe());
136
+ if (warning !== null) log.warn(warning);
137
+ }
138
+ //#endregion
139
+ export { parseCommandLine as i, warnWhenGitIsTooOld as n, gitDoctorRows as r, probeGitVersion as t };
@@ -1,6 +1,6 @@
1
1
  import { r as errorMessage } from "./text-DoirglWV.js";
2
2
  import { o as relayPath } from "./runtime-paths-BkeftE60.js";
3
- import { n as AGENT_URL_ENV, v as SIGN_URL_ENV } from "./session-B8RhqQJe.js";
3
+ import { T as SIGN_URL_ENV, n as AGENT_URL_ENV } from "./session-BZbariv5.js";
4
4
  import { t as HOOK_URL_ENV } from "./hook-relay-core-DA_bz2KA.js";
5
5
  import { n as isRecord } from "./coerce-NSst8oRP.js";
6
6
  import { o as SANE_YOLO_PATH_ENV, r as RTK_PATH_ENV, s as saneYoloEnv } from "./rtk-hook-core-VrUafGAp.js";
@@ -271,6 +271,9 @@ function mayContributeHooks(configText) {
271
271
  if (!isRecord(settings)) return false;
272
272
  return Object.hasOwn(settings, "hooks");
273
273
  }
274
+ function userConfigFolders() {
275
+ return [path.join(os.homedir(), ".claude")];
276
+ }
274
277
  function mapHookToSignal(event, payload) {
275
278
  const normalizedEvent = String(event || "").toLowerCase();
276
279
  if (normalizedEvent === "subagentstart") return "subagent-start";
@@ -403,6 +406,7 @@ var grok = {
403
406
  hookToolRelayPath: HOOK_TOOL_RELAY_PATH
404
407
  }),
405
408
  projectConfigCandidates: PROJECT_CONFIG_CANDIDATES,
409
+ userConfigFolders,
406
410
  mayContributeHooks
407
411
  }
408
412
  },
@@ -0,0 +1,70 @@
1
+ import { i as execSync } from "./child-process-safe-CbQnyh7D.js";
2
+ import { r as resolvePathCommandMatches } from "./spawn-command-Cc40FiZI.js";
3
+ //#region server/guardrails/core/guardrails-deps-core.ts
4
+ var LINUX_GUARDRAILS_BINARIES = Object.freeze([
5
+ "bwrap",
6
+ "socat",
7
+ "rg"
8
+ ]);
9
+ var NO_GUARDRAILS_BINARIES = Object.freeze([]);
10
+ var GUARDRAILS_INSTALL_HINT = "Install bubblewrap, socat and ripgrep, for example: sudo apt install bubblewrap socat ripgrep";
11
+ var GUARDED_WORK = "guarded sessions and factory checks";
12
+ function requiredGuardrailsBinaries(platform) {
13
+ return platform === "linux" ? LINUX_GUARDRAILS_BINARIES : NO_GUARDRAILS_BINARIES;
14
+ }
15
+ function guardrailsDependencyReport({ platform, binariesOnPath }) {
16
+ const requiredBinaries = requiredGuardrailsBinaries(platform);
17
+ const missingBinaries = requiredBinaries.filter((binary) => !binariesOnPath.has(binary));
18
+ return {
19
+ platform,
20
+ requiredBinaries,
21
+ missingBinaries,
22
+ installHint: missingBinaries.length > 0 ? GUARDRAILS_INSTALL_HINT : null
23
+ };
24
+ }
25
+ function namesList(names) {
26
+ if (names.length <= 1) return names.join("");
27
+ return `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`;
28
+ }
29
+ function missingBinariesPhrase(report) {
30
+ return `${namesList(report.missingBinaries)} ${report.missingBinaries.length === 1 ? "is" : "are"} not on PATH`;
31
+ }
32
+ function guardrailsSpawnRefusal(report) {
33
+ if (report.missingBinaries.length === 0) return null;
34
+ return `not started: the guardrails need ${namesList(report.requiredBinaries)}, and ${missingBinariesPhrase(report)}. ${report.installHint}`;
35
+ }
36
+ function guardrailsBootWarning(report) {
37
+ if (report.missingBinaries.length === 0) return null;
38
+ return `[guardrails] ${missingBinariesPhrase(report)}, so ${GUARDED_WORK} will refuse to start. ${report.installHint}`;
39
+ }
40
+ function guardrailsDoctorRows(report) {
41
+ if (report.requiredBinaries.length === 0) return [["guardrails", `nothing to check on ${report.platform}`]];
42
+ const binaryRows = report.requiredBinaries.map((binary) => [binary, report.missingBinaries.includes(binary) ? "MISSING" : "found"]);
43
+ if (report.installHint === null) return binaryRows;
44
+ return [...binaryRows, ["hint", report.installHint]];
45
+ }
46
+ function guardrailsInstallNotice(report) {
47
+ if (report.installHint === null) return null;
48
+ return `glimmervoid: ${missingBinariesPhrase(report)}; ${GUARDED_WORK} need ${namesList(report.requiredBinaries)}. ${report.installHint}`;
49
+ }
50
+ //#endregion
51
+ //#region server/guardrails/guardrails-deps.ts
52
+ function probeGuardrailsDependencies({ platform = process.platform, exec = execSync } = {}) {
53
+ return guardrailsDependencyReport({
54
+ platform,
55
+ binariesOnPath: new Set(requiredGuardrailsBinaries(platform).filter((binary) => resolvePathCommandMatches(binary, {
56
+ platform,
57
+ exec
58
+ }).length > 0))
59
+ });
60
+ }
61
+ function checkGuardrailsDependencies({ probe = probeGuardrailsDependencies, log = console } = {}) {
62
+ const report = probe();
63
+ const warning = guardrailsBootWarning(report);
64
+ if (warning !== null) log.warn(warning);
65
+ const refusal = guardrailsSpawnRefusal(report);
66
+ return () => refusal;
67
+ }
68
+ var allowGuardedSpawn = () => null;
69
+ //#endregion
70
+ export { guardrailsInstallNotice as a, guardrailsDoctorRows as i, checkGuardrailsDependencies as n, probeGuardrailsDependencies as r, allowGuardedSpawn as t };
@@ -1,6 +1,6 @@
1
1
  import { a as isLoopbackHostname } from "./hook-relay-core-DA_bz2KA.js";
2
- //#region session/core/sandbox-proxy-core.ts
3
- var HOOK_VIA_SANDBOX_PROXY_ENV = "GLIMMERVOID_HOOK_VIA_SANDBOX_PROXY";
2
+ //#region session/core/guardrails-proxy-core.ts
3
+ var HOOK_VIA_GUARDRAILS_PROXY_ENV = "GLIMMERVOID_HOOK_VIA_GUARDRAILS_PROXY";
4
4
  function decodeProxyCredential(percentEncoded) {
5
5
  try {
6
6
  return decodeURIComponent(percentEncoded);
@@ -8,7 +8,7 @@ function decodeProxyCredential(percentEncoded) {
8
8
  return null;
9
9
  }
10
10
  }
11
- function decideSandboxProxy(env) {
11
+ function decideGuardrailsProxy(env) {
12
12
  if (env.SANDBOX_RUNTIME !== "1") return null;
13
13
  const rawProxyUrl = env.HTTP_PROXY || env.http_proxy || "";
14
14
  if (!URL.canParse(rawProxyUrl)) return null;
@@ -24,4 +24,4 @@ function decideSandboxProxy(env) {
24
24
  };
25
25
  }
26
26
  //#endregion
27
- export { decideSandboxProxy as n, HOOK_VIA_SANDBOX_PROXY_ENV as t };
27
+ export { decideGuardrailsProxy as n, HOOK_VIA_GUARDRAILS_PROXY_ENV as t };
@@ -2,7 +2,7 @@ import { r as errorMessage } from "./text-DoirglWV.js";
2
2
  import { s as resolvePackageBin } from "./runtime-paths-BkeftE60.js";
3
3
  import { r as execFileSync } from "./child-process-safe-CbQnyh7D.js";
4
4
  import { n as glimmervoidHomeDir, t as decideConfigPath } from "./config-path-core-DFt-TemS.js";
5
- import { r as BrowserConfig } from "./config-CuZ16F9W.js";
5
+ import { r as BrowserConfig } from "./config-BYc2z1Oc.js";
6
6
  import fs, { closeSync, constants, existsSync, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync } from "node:fs";
7
7
  import path, { dirname, join, posix, resolve, win32 } from "node:path";
8
8
  import os from "node:os";
@@ -1,5 +1,5 @@
1
1
  import { a as isLoopbackHostname } from "./hook-relay-core-DA_bz2KA.js";
2
- import { n as decideSandboxProxy } from "./sandbox-proxy-core-hnQgKR0T.js";
2
+ import { n as decideGuardrailsProxy } from "./guardrails-proxy-core-BI3rdY-m.js";
3
3
  import http from "node:http";
4
4
  //#region session/loopback-post.ts
5
5
  var POST_TIMEOUT_MS = 1500;
@@ -16,11 +16,11 @@ function directRoute(target) {
16
16
  path: `${target.pathname}${target.search}`
17
17
  };
18
18
  }
19
- function sandboxProxyRoute(sandboxProxy, target) {
20
- const proxyHeaders = sandboxProxy.authorization ? { "proxy-authorization": sandboxProxy.authorization } : {};
19
+ function guardrailsProxyRoute(guardrailsProxy, target) {
20
+ const proxyHeaders = guardrailsProxy.authorization ? { "proxy-authorization": guardrailsProxy.authorization } : {};
21
21
  return {
22
- hostname: sandboxProxy.hostname,
23
- port: sandboxProxy.port,
22
+ hostname: guardrailsProxy.hostname,
23
+ port: guardrailsProxy.port,
24
24
  path: target.href,
25
25
  headers: {
26
26
  ...proxyHeaders,
@@ -81,10 +81,10 @@ async function postToLoopback(url, body, env = process.env) {
81
81
  const target = new URL(url);
82
82
  if (target.protocol !== "http:") return refusal("not-http");
83
83
  if (!isLoopbackHostname(target.hostname)) return refusal("not-loopback");
84
- if (env["GLIMMERVOID_HOOK_VIA_SANDBOX_PROXY"] !== "1") return sendPost(directRoute(target), body);
85
- const sandboxProxy = decideSandboxProxy(env);
86
- if (!sandboxProxy) return refusal("sandbox-proxy-missing");
87
- return sendPost(sandboxProxyRoute(sandboxProxy, target), body);
84
+ if (env["GLIMMERVOID_HOOK_VIA_GUARDRAILS_PROXY"] !== "1") return sendPost(directRoute(target), body);
85
+ const guardrailsProxy = decideGuardrailsProxy(env);
86
+ if (!guardrailsProxy) return refusal("guardrails-proxy-missing");
87
+ return sendPost(guardrailsProxyRoute(guardrailsProxy, target), body);
88
88
  }
89
89
  async function postPayload(url, body) {
90
90
  return (await postToLoopback(url, body)).responseBody;