glimmervoid 0.30.0 → 0.32.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 (68) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/glimmervoid.js +144 -57
  3. package/dist/chunks/{adapters-Dho1VSY5.js → adapters-BU74M4QZ.js} +1 -1
  4. package/dist/chunks/{adapters-zPDx1Xox.js → adapters-CoC18rdt.js} +56 -31
  5. package/dist/chunks/agent-api-cli-V_BkYhBI.js +142 -0
  6. package/dist/chunks/agent-api-core-B3YI8SYs.js +192 -0
  7. package/dist/chunks/{agent-setup-cli-B5Atxr3F.js → agent-setup-cli-D4956BfN.js} +11 -28
  8. package/dist/chunks/backoff-DjVpfHk7.js +14 -0
  9. package/dist/chunks/child-process-safe-B3zcPdFM.js +2 -0
  10. package/dist/chunks/{child-process-safe-DRGsp0TE.js → child-process-safe-DDELk9XC.js} +3 -2
  11. package/dist/chunks/coerce-NSst8oRP.js +32 -0
  12. package/dist/chunks/{contracts-DGkKNh9W.js → config-CZ4H51D0.js} +374 -1684
  13. package/dist/chunks/{config-store-mm7MgzoL.js → config-store-BVtdHkDK.js} +594 -329
  14. package/dist/chunks/config-store-Cp62jN1O.js +2 -0
  15. package/dist/chunks/contracts-DXujp-Zn.js +2131 -0
  16. package/dist/chunks/git-version-CrLW4a6r.js +58 -0
  17. package/dist/chunks/{grok-DuU8xVLZ.js → grok-C4lzPFEg.js} +24 -21
  18. package/dist/chunks/{hook-relay-core-BHfYFnYV.js → hook-relay-core-DA_bz2KA.js} +10 -5
  19. package/dist/chunks/{hook-tools-pSJia7ks.js → hook-tools-UX2fmt81.js} +3 -5
  20. package/dist/chunks/{ingest-editor-core-BuI1gMF_.js → ingest-editor-core-vR6Wv6bP.js} +24 -13
  21. package/dist/chunks/json-core-dfa_7Fak.js +23 -0
  22. package/dist/chunks/json-file-oEH9vt-0.js +352 -0
  23. package/dist/chunks/knowledge-graph-cli-Bjy9_kv5.js +1354 -0
  24. package/dist/chunks/{loopback-post-C7C22eYi.js → loopback-post-DepQfdcM.js} +40 -26
  25. package/dist/chunks/{main-CuIZQPhZ.js → main-DSbpYn2Y.js} +27880 -19139
  26. package/dist/chunks/{node-pty-preflight-CK1knGIR.js → node-pty-preflight-C8QIlrtU.js} +4 -6
  27. package/dist/chunks/{pair-cli-w-gCAF-1.js → pair-cli-CKn-wUw9.js} +4 -3
  28. package/dist/chunks/paths-CeJl2Vcg.js +55 -0
  29. package/dist/chunks/{remote-config-C2ytQwrs.js → remote-config-DP44Ybt9.js} +37 -41
  30. package/dist/chunks/{rtk-hook-core-Bl6gYHPN.js → rtk-hook-core-BmEz2aq9.js} +3 -5
  31. package/dist/chunks/rtk-resolver-CIVLE_xk.js +2 -0
  32. package/dist/chunks/{rtk-resolver-CLo-gZzw.js → rtk-resolver-jJxy_Mrt.js} +2 -2
  33. package/dist/chunks/{runtime-paths-Ci_ksSkj.js → runtime-paths-BPoxENmK.js} +2 -6
  34. package/dist/chunks/runtime-paths-DU5jBEEO.js +2 -0
  35. package/dist/chunks/{sandbox-deps-Dd5-kZnf.js → sandbox-deps-DuaNFq7n.js} +16 -13
  36. package/dist/chunks/sandbox-proxy-core-hnQgKR0T.js +27 -0
  37. package/dist/chunks/{session-Cez8aIWg.js → session-B8fJb_Or.js} +25 -2
  38. package/dist/chunks/text-DoirglWV.js +21 -0
  39. package/dist/chunks/timer-deps-u2DAQLok.js +15 -0
  40. package/dist/chunks/{visions-cli-BXQFIBCX.js → visions-cli-BhFdym5n.js} +1 -1
  41. package/dist/chunks/{visions-setup-CvVnOe1r.js → visions-setup-CfgNHiG3.js} +20 -357
  42. package/dist/client/assets/index-C_XKsDFx.css +1 -0
  43. package/dist/client/assets/index-CoqWjYxP.js +254 -0
  44. package/dist/client/fonts/CommitMono-OFL.txt +92 -0
  45. package/dist/client/fonts/commit-mono-400-italic.woff2 +0 -0
  46. package/dist/client/fonts/commit-mono-400-regular.woff2 +0 -0
  47. package/dist/client/fonts/commit-mono-700-italic.woff2 +0 -0
  48. package/dist/client/fonts/commit-mono-700-regular.woff2 +0 -0
  49. package/dist/client/index.html +7 -24
  50. package/dist/client/octicons-LICENSE.txt +21 -0
  51. package/dist/scripts/postinstall-path-check.js +1 -1
  52. package/dist/server/index.js +3 -3
  53. package/dist/session/command-hook-relay.js +1 -1
  54. package/dist/session/hook-relay.js +3 -3
  55. package/dist/session/hook-tool-relay.js +2 -2
  56. package/dist/session/sandbox-open-launcher.js +79 -0
  57. package/dist/session/statusline-relay.js +8 -18
  58. package/dist/session/visions-relay.js +20 -11
  59. package/package.json +4 -1
  60. package/dist/chunks/agent-api-cli-D0MmtEdz.js +0 -71
  61. package/dist/chunks/agent-api-core-Dz0r21y9.js +0 -103
  62. package/dist/chunks/child-process-safe-DvQjXsgz.js +0 -2
  63. package/dist/chunks/config-store-CC8T3okC.js +0 -2
  64. package/dist/chunks/ingest-core-DWI1Mbu4.js +0 -342
  65. package/dist/chunks/rtk-resolver-CMQAidlI.js +0 -2
  66. package/dist/chunks/runtime-paths-JLrZ3wyi.js +0 -2
  67. package/dist/client/assets/index-B1MFijjb.css +0 -1
  68. package/dist/client/assets/index-CU1iPPdn.js +0 -249
package/README.md CHANGED
@@ -57,7 +57,7 @@ Update a clone with `git pull --ff-only && npm ci && npm run build`, then restar
57
57
  - **Claude Code CLI** on PATH, or another supported agent below.
58
58
  - **git** on PATH, for per-session worktrees.
59
59
  - **Linux only:** `build-essential` and `python3` for node-pty.
60
- - **Linux only:** `bubblewrap` (`bwrap`) and `socat` for Claude Code's sandbox, which team review, Keep mergeable, workflow sessions and benchmark runs use (`sudo apt install bubblewrap socat`). `glimmervoid doctor` reports both.
60
+ - **Linux only:** `bubblewrap` (`bwrap`), `socat` and `ripgrep` (`rg`) for the sandbox that sandboxed sessions and factory checks run in (`sudo apt install bubblewrap socat ripgrep`). `glimmervoid doctor` reports all three.
61
61
 
62
62
  ## Supported agents
63
63
 
@@ -1,15 +1,94 @@
1
1
  #!/usr/bin/env node
2
- import { o as nodePtyRebuildHint, t as probeNodePty } from "../chunks/node-pty-preflight-CK1knGIR.js";
3
- import { a as packageRoot } from "../chunks/runtime-paths-Ci_ksSkj.js";
4
- import { t as AGENT_API_VERBS } from "../chunks/session-Cez8aIWg.js";
5
- import { i as execSync } from "../chunks/child-process-safe-DRGsp0TE.js";
2
+ import { o as nodePtyRebuildHint, r as firstLine, t as probeNodePty } from "../chunks/node-pty-preflight-C8QIlrtU.js";
3
+ import { i as errorText } from "../chunks/text-DoirglWV.js";
4
+ import { a as packageRoot } from "../chunks/runtime-paths-BPoxENmK.js";
5
+ import { t as AGENT_API_VERBS } from "../chunks/session-B8fJb_Or.js";
6
+ import { i as execSync } from "../chunks/child-process-safe-DDELk9XC.js";
6
7
  import { t as renderTable } from "../chunks/ascii-figure-core-pDAwtlKO.js";
7
8
  import { n as glimmervoidHomeDir, t as decideConfigPath } from "../chunks/config-path-core-DFt-TemS.js";
8
- import { i as sandboxDoctorRows, r as probeSandboxDependencies } from "../chunks/sandbox-deps-Dd5-kZnf.js";
9
+ import { i as sandboxDoctorRows, r as probeSandboxDependencies } from "../chunks/sandbox-deps-DuaNFq7n.js";
10
+ import { r as gitDoctorRows, t as probeGitVersion } from "../chunks/git-version-CrLW4a6r.js";
9
11
  import { i as pnpmGlobalBinDir, n as npmGlobalBinDir, r as onPath, t as formatPathNotice } from "../chunks/path-doctor-C23VAqeu.js";
10
12
  import fs from "node:fs";
11
13
  import path from "node:path";
12
14
  import os from "node:os";
15
+ //#region server/core/command-line-core.ts
16
+ var SUBCOMMANDS_HONORING_TRAILING_GLOBAL_OPTIONS = /* @__PURE__ */ new Set([
17
+ "doctor",
18
+ "pair",
19
+ "visions"
20
+ ]);
21
+ var SUBCOMMANDS_HONORING_A_LEADING_HELP_OR_VERSION = new Set(AGENT_API_VERBS);
22
+ var OPTIONS_TAKING_A_VALUE = {
23
+ "--config": "configPath",
24
+ "--port": "port"
25
+ };
26
+ function scanGlobalOption(argv, index, state) {
27
+ const token = argv[index];
28
+ const valueKey = OPTIONS_TAKING_A_VALUE[token];
29
+ if (valueKey) {
30
+ const value = argv[index + 1];
31
+ if (value !== void 0) state[valueKey] = value;
32
+ return index + 2;
33
+ }
34
+ if (token === "--help" || token === "-h") state.wantsHelp = true;
35
+ if (token === "--version") state.wantsVersion = true;
36
+ if (token === "--doctor") state.wantsDoctor = true;
37
+ return index + 1;
38
+ }
39
+ function scanTrailingGlobalOptions(subcommandArgs, state) {
40
+ let index = 0;
41
+ while (index < subcommandArgs.length) {
42
+ if (!subcommandArgs[index].startsWith("-")) {
43
+ index += 1;
44
+ continue;
45
+ }
46
+ index = scanGlobalOption(subcommandArgs, index, state);
47
+ }
48
+ }
49
+ function scanLeadingHelpOrVersion(subcommandArgs, state) {
50
+ const firstArgument = subcommandArgs[0];
51
+ if (firstArgument === "--help" || firstArgument === "-h") state.wantsHelp = true;
52
+ if (firstArgument === "--version") state.wantsVersion = true;
53
+ }
54
+ function parseCommandLine(argv) {
55
+ const state = {
56
+ configPath: null,
57
+ port: null,
58
+ wantsHelp: false,
59
+ wantsVersion: false,
60
+ wantsDoctor: false
61
+ };
62
+ let index = 0;
63
+ while (index < argv.length && argv[index].startsWith("-")) index = scanGlobalOption(argv, index, state);
64
+ const name = argv[index];
65
+ const subcommandArgs = argv.slice(index + 1);
66
+ if (name !== void 0 && SUBCOMMANDS_HONORING_TRAILING_GLOBAL_OPTIONS.has(name)) scanTrailingGlobalOptions(subcommandArgs, state);
67
+ if (name !== void 0 && SUBCOMMANDS_HONORING_A_LEADING_HELP_OR_VERSION.has(name)) scanLeadingHelpOrVersion(subcommandArgs, state);
68
+ if (state.wantsHelp) return { kind: "help" };
69
+ if (state.wantsVersion) return { kind: "version" };
70
+ const globalOptions = {
71
+ configPath: state.configPath,
72
+ port: state.port
73
+ };
74
+ if (state.wantsDoctor) return {
75
+ kind: "subcommand",
76
+ name: "doctor",
77
+ subcommandArgs: [],
78
+ globalOptions
79
+ };
80
+ if (name === void 0) return {
81
+ kind: "server",
82
+ globalOptions
83
+ };
84
+ return {
85
+ kind: "subcommand",
86
+ name,
87
+ subcommandArgs,
88
+ globalOptions
89
+ };
90
+ }
91
+ //#endregion
13
92
  //#region bin/glimmervoid.ts
14
93
  var args = process.argv.slice(2);
15
94
  var pkg = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf8"));
@@ -28,6 +107,8 @@ Commands:
28
107
  spawn <prompt> From inside a Glimmervoid session, start a sibling session on that prompt
29
108
  attention <note> From inside a Glimmervoid session, flag it as needing the operator
30
109
  board From inside a Glimmervoid session, list the live sessions
110
+ push From inside a Glimmervoid session, land its commits on the integration branch and push it
111
+ kg [command] Experimental typed knowledge and task graph (Settings > Lanes > Knowledge graph)
31
112
 
32
113
  Options:
33
114
  --name <label> Label for the device being paired (with: pair)
@@ -35,71 +116,75 @@ Options:
35
116
  --config <path> Path to config file (default: ~/.glimmervoid/config.json)
36
117
  --version Show version number
37
118
  --help, -h Show this help message`;
38
- if (args.includes("--help") || args.includes("-h")) {
119
+ var commandLine = parseCommandLine(args);
120
+ if (commandLine.kind === "help") {
39
121
  console.log(USAGE);
40
122
  process.exit(0);
41
123
  }
42
- if (args.includes("--version")) {
124
+ if (commandLine.kind === "version") {
43
125
  console.log(pkg.version);
44
126
  process.exit(0);
45
127
  }
46
- function getArgValue(flag) {
47
- const idx = args.indexOf(flag);
48
- if (idx !== -1 && idx + 1 < args.length) return args[idx + 1];
49
- return null;
50
- }
51
- var configArg = getArgValue("--config");
52
- if (configArg) process.env.GLIMMERVOID_CONFIG = configArg;
53
- var portArg = getArgValue("--port");
54
- if (portArg) process.env.GLIMMERVOID_PORT = portArg;
128
+ if (commandLine.globalOptions.configPath) process.env.GLIMMERVOID_CONFIG = commandLine.globalOptions.configPath;
129
+ if (commandLine.globalOptions.port) process.env.GLIMMERVOID_PORT = commandLine.globalOptions.port;
55
130
  var SUBCOMMAND_RUNNERS = new Map([
56
131
  ["doctor", async () => {
57
132
  await runDoctor();
58
133
  return 0;
59
134
  }],
60
- ["pair", async (commandArgs) => {
61
- const { runPairCli } = await import("../chunks/pair-cli-w-gCAF-1.js");
62
- return runPairCli(commandArgs.slice(1));
135
+ ["pair", async (subcommandArgs) => {
136
+ const { runPairCli } = await import("../chunks/pair-cli-CKn-wUw9.js");
137
+ return runPairCli(subcommandArgs);
138
+ }],
139
+ ["agent", async (subcommandArgs) => {
140
+ const { runAgentSetupCli } = await import("../chunks/agent-setup-cli-D4956BfN.js");
141
+ return runAgentSetupCli(subcommandArgs);
63
142
  }],
64
- ["agent", async (commandArgs) => {
65
- const { runAgentSetupCli } = await import("../chunks/agent-setup-cli-B5Atxr3F.js");
66
- return runAgentSetupCli(commandArgs.slice(1));
143
+ ["kg", async (subcommandArgs) => {
144
+ const { runKnowledgeGraphCommand } = await import("../chunks/knowledge-graph-cli-Bjy9_kv5.js");
145
+ return runKnowledgeGraphCommand(subcommandArgs);
67
146
  }],
68
- ["visions", async (commandArgs) => {
69
- const { runVisionsCli } = await import("../chunks/visions-cli-BXQFIBCX.js");
70
- return runVisionsCli(commandArgs.slice(1));
147
+ ["visions", async (subcommandArgs) => {
148
+ const { runVisionsCli } = await import("../chunks/visions-cli-BhFdym5n.js");
149
+ return runVisionsCli(subcommandArgs);
71
150
  }],
72
- ...AGENT_API_VERBS.map((verb) => [verb, async (commandArgs) => {
73
- const { runAgentApiCli } = await import("../chunks/agent-api-cli-D0MmtEdz.js");
74
- return runAgentApiCli(commandArgs);
151
+ ...AGENT_API_VERBS.map((verb) => [verb, async (subcommandArgs, subcommandName) => {
152
+ const { runAgentApiCli } = await import("../chunks/agent-api-cli-V_BkYhBI.js");
153
+ return runAgentApiCli([subcommandName, ...subcommandArgs]);
75
154
  }])
76
155
  ]);
156
+ function flushStream(stream) {
157
+ return new Promise((resolve) => {
158
+ stream.once("error", () => resolve());
159
+ stream.write("", () => resolve());
160
+ });
161
+ }
162
+ async function exitAfterOutputDrains(exitCode) {
163
+ await Promise.all([flushStream(process.stdout), flushStream(process.stderr)]);
164
+ process.exit(exitCode);
165
+ }
166
+ async function runSubcommandToExitCode(runSubcommand, subcommandArgs, subcommandName) {
167
+ try {
168
+ return await runSubcommand(subcommandArgs, subcommandName);
169
+ } catch (err) {
170
+ console.error(errorText(err));
171
+ return 1;
172
+ }
173
+ }
77
174
  async function dispatchCommandLine() {
78
- const requestedSubcommand = args.includes("--doctor") ? "doctor" : args[0];
79
- if (!requestedSubcommand || requestedSubcommand.startsWith("-")) {
175
+ if (commandLine.kind !== "subcommand") {
80
176
  await import("../server/index.js");
81
177
  return;
82
178
  }
83
- const runSubcommand = SUBCOMMAND_RUNNERS.get(requestedSubcommand);
179
+ const runSubcommand = SUBCOMMAND_RUNNERS.get(commandLine.name);
84
180
  if (!runSubcommand) {
85
- console.error(`Unknown command: ${requestedSubcommand}\n${USAGE}`);
86
- process.exit(1);
87
- }
88
- try {
89
- process.exit(await runSubcommand(args));
90
- } catch (err) {
91
- console.error(messageOf(err));
92
- process.exit(1);
181
+ console.error(`Unknown command: ${commandLine.name}\n${USAGE}`);
182
+ await exitAfterOutputDrains(1);
183
+ return;
93
184
  }
185
+ await exitAfterOutputDrains(await runSubcommandToExitCode(runSubcommand, commandLine.subcommandArgs, commandLine.name));
94
186
  }
95
187
  await dispatchCommandLine();
96
- function messageOf(error) {
97
- if (error instanceof Error && error.message) return error.message;
98
- return String(error);
99
- }
100
- function firstLineOf(error) {
101
- return messageOf(error).split("\n")[0];
102
- }
103
188
  function decideReadOnlyConfigPath() {
104
189
  return decideConfigPath({
105
190
  env: process.env,
@@ -118,7 +203,7 @@ async function readDeclaredCustomAgents() {
118
203
  declared: [],
119
204
  error: null
120
205
  };
121
- const { loadConfigFile } = await import("../chunks/config-store-CC8T3okC.js");
206
+ const { loadConfigFile } = await import("../chunks/config-store-Cp62jN1O.js");
122
207
  try {
123
208
  const loaded = loadConfigFile(decided.path, { exitOnError: false });
124
209
  if (!loaded.config) return {
@@ -132,7 +217,7 @@ async function readDeclaredCustomAgents() {
132
217
  } catch (err) {
133
218
  return {
134
219
  declared: [],
135
- error: `could not read ${decided.path}: ${firstLineOf(err)}`
220
+ error: `could not read ${decided.path}: ${firstLine(errorText(err))}`
136
221
  };
137
222
  }
138
223
  }
@@ -194,7 +279,7 @@ async function runDoctor() {
194
279
  }
195
280
  switchSection("Agents");
196
281
  try {
197
- const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-Dho1VSY5.js");
282
+ const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-BU74M4QZ.js");
198
283
  const declaredCustomAgents = await readDeclaredCustomAgents();
199
284
  if (declaredCustomAgents.error) line("config", declaredCustomAgents.error);
200
285
  setCustomAgents(declaredCustomAgents.declared);
@@ -202,24 +287,24 @@ async function runDoctor() {
202
287
  const { label, path: resolvedPath } = describeAgentResolvability(id);
203
288
  line(`${id} (${label})`, resolvedPath ?? "not found on PATH");
204
289
  }
205
- const { inspectGrokAgentSetup } = await import("../chunks/agent-setup-cli-B5Atxr3F.js");
290
+ const { inspectGrokAgentSetup } = await import("../chunks/agent-setup-cli-D4956BfN.js");
206
291
  const grokSetup = inspectGrokAgentSetup();
207
292
  line("grok hook setup", `${grokSetup.classification}: ${grokSetup.filePath}`);
208
293
  } catch (err) {
209
- line("agents", `probe failed: ${firstLineOf(err)}`);
294
+ line("agents", `probe failed: ${firstLine(errorText(err))}`);
210
295
  }
211
296
  switchSection("rtk");
212
297
  try {
213
- const { getRtkPath } = await import("../chunks/rtk-resolver-CMQAidlI.js");
298
+ const { getRtkPath } = await import("../chunks/rtk-resolver-CIVLE_xk.js");
214
299
  line("rtk", getRtkPath() || "not installed (Glimmervoid installs it when the rtk setting is on)");
215
300
  } catch (err) {
216
- line("rtk", `probe failed: ${firstLineOf(err)}`);
301
+ line("rtk", `probe failed: ${firstLine(errorText(err))}`);
217
302
  }
218
303
  switchSection("Sane YOLO");
219
304
  try {
220
- const { resolvePackageBin } = await import("../chunks/runtime-paths-JLrZ3wyi.js");
221
- const { execFileSync } = await import("../chunks/child-process-safe-DvQjXsgz.js");
222
- const { inspectGrokAgentSetup } = await import("../chunks/agent-setup-cli-B5Atxr3F.js");
305
+ const { resolvePackageBin } = await import("../chunks/runtime-paths-DU5jBEEO.js");
306
+ const { execFileSync } = await import("../chunks/child-process-safe-B3zcPdFM.js");
307
+ const { inspectGrokAgentSetup } = await import("../chunks/agent-setup-cli-D4956BfN.js");
223
308
  const binPath = resolvePackageBin("cc-safety-net", "cc-safety-net");
224
309
  line("Sane YOLO", binPath || "not installed");
225
310
  if (binPath) line("cc-safety-net version", execFileSync(process.execPath, [binPath, "--version"], {
@@ -229,7 +314,7 @@ async function runDoctor() {
229
314
  line("Codex hook trust", "Sane YOLO is inactive unless Codex trusts the injected hooks.");
230
315
  line("Grok Sane YOLO", inspectGrokAgentSetup().saneYoloReady ? "installed" : "inactive; run glimmervoid agent setup grok");
231
316
  } catch (err) {
232
- line("Sane YOLO", `probe failed: ${firstLineOf(err)}`);
317
+ line("Sane YOLO", `probe failed: ${firstLine(errorText(err))}`);
233
318
  }
234
319
  switchSection("Native module");
235
320
  const nodePty = await probeNodePty();
@@ -244,6 +329,8 @@ async function runDoctor() {
244
329
  platform,
245
330
  exec: execSync
246
331
  }))) line(label, value);
332
+ switchSection("Git");
333
+ for (const [label, value] of gitDoctorRows(probeGitVersion())) line(label, value);
247
334
  switchSection("Config");
248
335
  line("resolved config", resolveConfigPathReadOnly());
249
336
  flush();
@@ -1,2 +1,2 @@
1
- import { a as describeAgentResolvability, d as setCustomAgents, l as listAgentIds } from "./adapters-zPDx1Xox.js";
1
+ import { a as describeAgentResolvability, d as setCustomAgents, l as listAgentIds } from "./adapters-CoC18rdt.js";
2
2
  export { describeAgentResolvability, listAgentIds, setCustomAgents };
@@ -1,26 +1,13 @@
1
- import { o as relayPath } from "./runtime-paths-Ci_ksSkj.js";
2
- import { _ as toolDetailFieldValue, c as PendingPromptQuestion, g as firstDetailLine, o as PROMPT_DETAIL_HIDDEN_CHARACTERS } from "./session-Cez8aIWg.js";
3
- import { r as execFileSync } from "./child-process-safe-DRGsp0TE.js";
1
+ import { o as relayPath } from "./runtime-paths-BPoxENmK.js";
2
+ import { b as toolDetailFieldValue, d as PendingPromptQuestion, l as PROMPT_DETAIL_HIDDEN_CHARACTERS, y as firstDetailLine } from "./session-B8fJb_Or.js";
3
+ import { r as execFileSync } from "./child-process-safe-DDELk9XC.js";
4
4
  import { n as resolveAgentCommand, t as buildAgentSpawnCommand } from "./spawn-command-Cc40FiZI.js";
5
- import { i as isSpinnerChar, n as classifyAgentTitle, r as isBrailleChar, s as buildAgentEnv, t as grok } from "./grok-DuU8xVLZ.js";
5
+ import { n as isRecord } from "./coerce-NSst8oRP.js";
6
+ import { c as buildAgentEnv, i as isSpinnerChar, n as classifyAgentTitle, r as isBrailleChar, t as grok } from "./grok-C4lzPFEg.js";
6
7
  import { t as buildHookCommand } from "./hook-command-core-DclEoE9e.js";
7
- import "./contracts-DGkKNh9W.js";
8
- import { n as mergeCodexPreToolUse, t as HOOK_TOOLS } from "./hook-tools-pSJia7ks.js";
8
+ import "./contracts-DXujp-Zn.js";
9
+ import { n as mergeCodexPreToolUse, t as HOOK_TOOLS } from "./hook-tools-UX2fmt81.js";
9
10
  import fs from "node:fs";
10
- //#region session/core/anti-slop-prompt.ts
11
- var ANTI_SLOP_NOTE = [
12
- "Code hygiene for this session:",
13
- "Write comments only to explain why, never narration that restates the code (no Now-we, This-function, or Step-1 openers).",
14
- "Do not leave debug statements (console.log, print, debugger) in committed code.",
15
- "Never swallow exceptions: no empty catch blocks and no catch that only logs and continues.",
16
- "No placeholder stubs or in-a-real-implementation hand-waving; implement the real thing or stop and ask.",
17
- "Do not silence type or lint errors with as-any, ts-ignore, or eslint-disable; fix the cause.",
18
- "Avoid speculative wrappers and single-use indirection. Prefer deleting code over adding it."
19
- ].join(" ");
20
- function buildAntiSlopArgs(enabled) {
21
- return enabled ? ["--append-system-prompt", ANTI_SLOP_NOTE] : [];
22
- }
23
- //#endregion
24
11
  //#region session/adapters/claude-code.ts
25
12
  var ID$1 = "claude-code";
26
13
  var COMMAND_NAME$1 = "claude";
@@ -87,9 +74,6 @@ function mapHookPromptDetail(event, payload) {
87
74
  question: answerableQuestionOf(toolName, payload?.tool_input)
88
75
  };
89
76
  }
90
- function isRecord(value) {
91
- return typeof value === "object" && value !== null && !Array.isArray(value);
92
- }
93
77
  function answerableQuestionOf(toolName, toolInput) {
94
78
  if (toolName !== "AskUserQuestion" || !isRecord(toolInput)) return null;
95
79
  const questions = toolInput.questions;
@@ -123,6 +107,8 @@ function isWholeBashCommandShown(toolName, toolInput, fieldValue, summary) {
123
107
  function mapHookToSignal$1(event, payload) {
124
108
  switch (String(event || "").toLowerCase()) {
125
109
  case "sessionstart": return "session-start";
110
+ case "precompact": return "compaction-start";
111
+ case "postcompact": return "compaction-end";
126
112
  case "sessionend": return "session-end";
127
113
  case "userpromptsubmit": return "resume";
128
114
  case "stop": return "ready";
@@ -175,11 +161,40 @@ function buildEnv$1(baseEnv, extraEnv, options) {
175
161
  return buildAgentEnv(baseEnv, extraEnv, envProfile$2, options);
176
162
  }
177
163
  var settingsArgs = (settingsPath) => ["--settings", settingsPath];
178
- function buildArgs$1({ dangerouslySkipPermissions = false, resumeSessionId = null, extraArgs = [], antiSlopPrompt = false, initialPrompt = null } = {}) {
164
+ var SESSION_ID_FLAG = "--session-id";
165
+ function requestedSessionId(extraArgs) {
166
+ const flagIndex = extraArgs.indexOf(SESSION_ID_FLAG);
167
+ if (flagIndex !== -1) return extraArgs[flagIndex + 1] ?? null;
168
+ const assignment = extraArgs.find((argument) => argument.startsWith(`${SESSION_ID_FLAG}=`));
169
+ return assignment ? assignment.slice(13) : null;
170
+ }
171
+ function launchSessionId({ resumeSessionId, extraArgs, generatedId }) {
172
+ const knownSessionId = resumeSessionId ?? requestedSessionId(extraArgs);
173
+ if (knownSessionId) return {
174
+ agentSessionId: knownSessionId,
175
+ extraArgs: [...extraArgs]
176
+ };
177
+ return {
178
+ agentSessionId: generatedId,
179
+ extraArgs: [
180
+ ...extraArgs,
181
+ SESSION_ID_FLAG,
182
+ generatedId
183
+ ]
184
+ };
185
+ }
186
+ function buildArgs$1({ dangerouslySkipPermissions = false, resumeSessionId = null, extraArgs = [], initialPrompt = null } = {}) {
179
187
  const args = dangerouslySkipPermissions ? ["--dangerously-skip-permissions"] : [];
180
188
  if (resumeSessionId) args.push("--resume", resumeSessionId);
181
- if (extraArgs.length > 0) args.push(...extraArgs);
182
- args.push(...buildAntiSlopArgs(antiSlopPrompt));
189
+ for (let index = 0; index < extraArgs.length; index += 1) {
190
+ const argument = extraArgs[index];
191
+ if (resumeSessionId && argument === "--session-id") {
192
+ index += 1;
193
+ continue;
194
+ }
195
+ if (resumeSessionId && argument.startsWith("--session-id=")) continue;
196
+ args.push(argument);
197
+ }
183
198
  if (initialPrompt != null) args.push(initialPrompt);
184
199
  return args;
185
200
  }
@@ -196,6 +211,7 @@ var claudeCode = {
196
211
  buildEnv: buildEnv$1,
197
212
  buildArgs: buildArgs$1,
198
213
  settingsArgs,
214
+ launchSessionId,
199
215
  capabilities: {
200
216
  hooks: true,
201
217
  awaitingInput: true,
@@ -204,7 +220,6 @@ var claudeCode = {
204
220
  statusLine: true,
205
221
  rtk: true,
206
222
  saneYolo: true,
207
- antiSlop: true,
208
223
  compactQuiet: true,
209
224
  skipPermissionsFlag: true,
210
225
  headless: true
@@ -344,10 +359,22 @@ var SKIP_PERMISSIONS_ARGS = [
344
359
  "-s",
345
360
  "workspace-write"
346
361
  ];
347
- function buildArgs({ dangerouslySkipPermissions = false, resumeSessionId = null, extraArgs = [], initialPrompt = null } = {}) {
362
+ var OUTER_SANDBOX_ARGS = ["-s", "danger-full-access"];
363
+ var OUTER_SANDBOX_SKIP_PERMISSIONS_ARGS = [
364
+ "-a",
365
+ "never",
366
+ ...OUTER_SANDBOX_ARGS
367
+ ];
368
+ function permissionArgs(dangerouslySkipPermissions, hasOuterSandbox) {
369
+ if (hasOuterSandbox && dangerouslySkipPermissions) return OUTER_SANDBOX_SKIP_PERMISSIONS_ARGS;
370
+ if (hasOuterSandbox) return OUTER_SANDBOX_ARGS;
371
+ if (dangerouslySkipPermissions) return SKIP_PERMISSIONS_ARGS;
372
+ return [];
373
+ }
374
+ function buildArgs({ dangerouslySkipPermissions = false, resumeSessionId = null, extraArgs = [], initialPrompt = null, hasOuterSandbox = false } = {}) {
348
375
  const args = [...UPDATE_CHECK_ARGS];
349
376
  if (resumeSessionId) args.push("resume", resumeSessionId);
350
- if (dangerouslySkipPermissions) args.push(...SKIP_PERMISSIONS_ARGS);
377
+ args.push(...permissionArgs(dangerouslySkipPermissions, hasOuterSandbox));
351
378
  if (extraArgs.length > 0) args.push(...extraArgs);
352
379
  if (initialPrompt != null) args.push(initialPrompt);
353
380
  return args;
@@ -387,7 +414,6 @@ var codex = {
387
414
  statusLine: false,
388
415
  rtk: true,
389
416
  saneYolo: true,
390
- antiSlop: false,
391
417
  compactQuiet: false,
392
418
  skipPermissionsFlag: true,
393
419
  headless: true
@@ -407,7 +433,6 @@ var TITLE_ONLY_CAPABILITIES = Object.freeze({
407
433
  statusLine: false,
408
434
  rtk: false,
409
435
  saneYolo: false,
410
- antiSlop: false,
411
436
  compactQuiet: false,
412
437
  skipPermissionsFlag: false,
413
438
  headless: false
@@ -0,0 +1,142 @@
1
+ import { t as errorCode } from "./text-DoirglWV.js";
2
+ import { a as AgentDispatchRequest, n as AGENT_URL_ENV, s as AgentTicketRequest } from "./session-B8fJb_Or.js";
3
+ import { i as resolveHookTarget } from "./hook-relay-core-DA_bz2KA.js";
4
+ import { n as decideSandboxProxy } from "./sandbox-proxy-core-hnQgKR0T.js";
5
+ import { c as isAgentApiVerb, l as isOrchestratorAgentVerb } from "./agent-api-core-B3YI8SYs.js";
6
+ import http from "node:http";
7
+ //#region server/agent-api-cli.ts
8
+ var AGENT_PATH_PREFIX = "/agent/";
9
+ function ticketBody(rest) {
10
+ const parsed = AgentTicketRequest.safeParse({ workId: rest[0] });
11
+ return parsed.success ? parsed.data : null;
12
+ }
13
+ var BODY_BUILDERS = {
14
+ spawn: (rest) => {
15
+ const prompt = rest.join(" ").trim();
16
+ return prompt ? { prompt } : null;
17
+ },
18
+ attention: (rest) => {
19
+ const note = rest.join(" ").trim();
20
+ return note ? { note } : null;
21
+ },
22
+ board: () => ({}),
23
+ push: () => ({}),
24
+ dispatch: (rest) => {
25
+ const parsed = AgentDispatchRequest.safeParse(rest[0] === "--ready" ? { readyIntent: rest[1] } : { workId: rest[0] });
26
+ return parsed.success ? parsed.data : null;
27
+ },
28
+ reopen: (rest) => ticketBody(rest),
29
+ cancel: (rest) => ticketBody(rest)
30
+ };
31
+ function bodySaysOk(text) {
32
+ try {
33
+ const parsed = JSON.parse(text);
34
+ return typeof parsed === "object" && parsed !== null && parsed.ok === true;
35
+ } catch {
36
+ return false;
37
+ }
38
+ }
39
+ function verbEndpoint(rawUrl, verb) {
40
+ const target = resolveHookTarget(rawUrl, verb, AGENT_PATH_PREFIX);
41
+ if (!target.url) return { ok: false };
42
+ const endpoint = new URL(target.url);
43
+ const token = endpoint.searchParams.get("t") || "";
44
+ endpoint.search = "";
45
+ return {
46
+ ok: true,
47
+ endpoint,
48
+ token
49
+ };
50
+ }
51
+ async function postDirectly(endpoint, headers, bodyText) {
52
+ const response = await fetch(endpoint, {
53
+ method: "POST",
54
+ headers,
55
+ body: bodyText
56
+ });
57
+ return {
58
+ hasSuccessStatus: response.ok,
59
+ text: await response.text()
60
+ };
61
+ }
62
+ function postThroughSandboxProxy(sandboxProxy, endpoint, headers, bodyText) {
63
+ const proxyHeaders = sandboxProxy.authorization ? { "proxy-authorization": sandboxProxy.authorization } : {};
64
+ return new Promise((resolve, reject) => {
65
+ const request = http.request({
66
+ host: sandboxProxy.hostname,
67
+ port: sandboxProxy.port,
68
+ method: "POST",
69
+ path: endpoint.href,
70
+ headers: {
71
+ ...headers,
72
+ ...proxyHeaders,
73
+ host: endpoint.host,
74
+ "content-length": String(Buffer.byteLength(bodyText))
75
+ }
76
+ }, (response) => {
77
+ const chunks = [];
78
+ response.on("data", (chunk) => {
79
+ chunks.push(chunk);
80
+ });
81
+ response.on("error", reject);
82
+ response.on("end", () => {
83
+ const statusCode = response.statusCode ?? 0;
84
+ resolve({
85
+ hasSuccessStatus: statusCode >= 200 && statusCode < 300,
86
+ text: Buffer.concat(chunks).toString("utf8")
87
+ });
88
+ });
89
+ });
90
+ request.on("error", reject);
91
+ request.end(bodyText);
92
+ });
93
+ }
94
+ function wasConnectionRefused(error) {
95
+ return errorCode(error?.cause) === "ECONNREFUSED";
96
+ }
97
+ async function postToAgentIngress(endpoint, token, body) {
98
+ const headers = {
99
+ "content-type": "application/json",
100
+ authorization: `Bearer ${token}`
101
+ };
102
+ const bodyText = JSON.stringify(body);
103
+ try {
104
+ return await postDirectly(endpoint, headers, bodyText);
105
+ } catch (error) {
106
+ if (!wasConnectionRefused(error)) throw error;
107
+ const sandboxProxy = decideSandboxProxy(process.env);
108
+ if (!sandboxProxy) throw error;
109
+ return postThroughSandboxProxy(sandboxProxy, endpoint, headers, bodyText);
110
+ }
111
+ }
112
+ async function runAgentApiCli(args) {
113
+ const verb = args[0];
114
+ if (!verb || !isAgentApiVerb(verb)) {
115
+ console.error(`glimmervoid: ${verb || "that"} is not an agent command`);
116
+ return 1;
117
+ }
118
+ const body = BODY_BUILDERS[verb](args.slice(1));
119
+ if (!body) {
120
+ if (isOrchestratorAgentVerb(verb)) {
121
+ console.error(`glimmervoid ${verb}: expected a work id matching wrk-[0-9a-f]{16}`);
122
+ return 1;
123
+ }
124
+ console.error(`glimmervoid ${verb}: this command needs text, for example "glimmervoid ${verb} check the failing test"`);
125
+ return 1;
126
+ }
127
+ const rawUrl = process.env[AGENT_URL_ENV];
128
+ if (!rawUrl) {
129
+ console.error(`glimmervoid: ${AGENT_URL_ENV} is not set, so this is not a Glimmervoid session with the agent API turned on`);
130
+ return 1;
131
+ }
132
+ const target = verbEndpoint(rawUrl, verb);
133
+ if (!target.ok) {
134
+ console.error(`glimmervoid: ${AGENT_URL_ENV} must be a loopback http url under ${AGENT_PATH_PREFIX}, so nothing was sent`);
135
+ return 1;
136
+ }
137
+ const reply = await postToAgentIngress(target.endpoint, target.token, body);
138
+ console.log(reply.text);
139
+ return reply.hasSuccessStatus && bodySaysOk(reply.text) ? 0 : 1;
140
+ }
141
+ //#endregion
142
+ export { runAgentApiCli };