glimmervoid 0.38.0 → 0.38.2

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 (37) hide show
  1. package/dist/bin/glimmervoid.js +17 -15
  2. package/dist/chunks/{adapters-B-IkWl-r.js → adapters-CAHxZYT3.js} +4 -4
  3. package/dist/chunks/{adapters-Dt3vwxwY.js → adapters-DDjC7_vG.js} +1 -1
  4. package/dist/chunks/{agent-api-cli-BcZ9DLCF.js → agent-api-cli-B5Tm0wXO.js} +27 -8
  5. package/dist/chunks/{agent-api-cli-3hryuewm.js → agent-api-cli-BDu1CxZf.js} +1 -1
  6. package/dist/chunks/{agent-api-core--8WtU1xU.js → agent-api-core-B_mUSenR.js} +36 -4
  7. package/dist/chunks/{agent-setup-cli-BixDoCkF.js → agent-setup-cli-DmMfCw5O.js} +1 -1
  8. package/dist/chunks/{config-BHBZsCBc.js → browser-config-BrBT8269.js} +2 -217
  9. package/dist/chunks/config-CjawSOBk.js +219 -0
  10. package/dist/chunks/{config-store-DbfMbz4j.js → config-store-BUNZs4j7.js} +4 -3
  11. package/dist/chunks/config-store-MAVQhGMh.js +1 -0
  12. package/dist/chunks/{contracts-u40eJhaf.js → contracts-HVCEJfxs.js} +6 -239
  13. package/dist/chunks/factory-D7ryES9n.js +240 -0
  14. package/dist/chunks/{git-version-BpnTd8sU.js → git-version-rWZjF2Px.js} +1 -1
  15. package/dist/chunks/{grok-xFs6zIu4.js → grok-B6bsCgdd.js} +2 -2
  16. package/dist/chunks/{hook-tools-BkxllUHE.js → hook-tools-Dl7-r2Eb.js} +1 -1
  17. package/dist/chunks/{knowledge-graph-cli-DcspNqhz.js → knowledge-graph-cli-ByUJoKw_.js} +1 -1
  18. package/dist/chunks/{main-w01-P1oZ.js → main-BNSbP-Yk.js} +689 -523
  19. package/dist/chunks/{pair-cli-BdoyrDCr.js → pair-cli-DNp8i5L4.js} +2 -2
  20. package/dist/chunks/{remote-config-61zJ0hME.js → remote-config-C_s2pnLC.js} +1 -1
  21. package/dist/chunks/{rtk-hook-core-VrUafGAp.js → rtk-hook-core-B-MpzPin.js} +89 -83
  22. package/dist/chunks/rtk-resolver-BGE6Hd_L.js +1 -0
  23. package/dist/chunks/{rtk-resolver-C_micGrL.js → rtk-resolver-BgoPsEhT.js} +1 -1
  24. package/dist/chunks/{session-8Pv0y1vz.js → session-BlT68ppa.js} +5 -2
  25. package/dist/chunks/{session-routes-D-GZC-Sy.js → session-routes-CT1JrjoT.js} +1 -1
  26. package/dist/chunks/{settings-cli-DKJsm3AP.js → settings-cli-BbzxCyG5.js} +3 -3
  27. package/dist/chunks/{ssh-sign-cli-Dc2gOCwE.js → ssh-sign-cli-C74BGTQS.js} +2 -2
  28. package/dist/client/assets/index-B5uVtedd.css +1 -0
  29. package/dist/client/assets/index-b13-NGGS.js +275 -0
  30. package/dist/client/index.html +3 -2
  31. package/dist/server/index.js +1 -1
  32. package/dist/session/hook-tool-relay.js +1 -1
  33. package/package.json +3 -2
  34. package/dist/chunks/config-store-DYj3wYgw.js +0 -1
  35. package/dist/chunks/rtk-resolver-B8BPgN9L.js +0 -1
  36. package/dist/client/assets/index-BfqmOGgc.js +0 -275
  37. package/dist/client/assets/index-DxABp5yJ.css +0 -1
@@ -2,11 +2,11 @@
2
2
  import { o as nodePtyRebuildHint, r as firstLine, t as probeNodePty } from "../chunks/node-pty-preflight-C8QIlrtU.js";
3
3
  import { i as errorText } from "../chunks/text-DoirglWV.js";
4
4
  import { a as packageRoot } from "../chunks/runtime-paths-BkeftE60.js";
5
- import { t as AGENT_API_VERBS } from "../chunks/session-8Pv0y1vz.js";
5
+ import { t as AGENT_API_VERBS } from "../chunks/session-BlT68ppa.js";
6
6
  import { i as execSync } from "../chunks/child-process-safe-CbQnyh7D.js";
7
7
  import { t as renderTable } from "../chunks/ascii-figure-core-pDAwtlKO.js";
8
8
  import { n as glimmervoidHomeDir, t as decideConfigPath } from "../chunks/config-path-core-DFt-TemS.js";
9
- import { i as parseCommandLine, r as gitDoctorRows, t as probeGitVersion } from "../chunks/git-version-BpnTd8sU.js";
9
+ import { i as parseCommandLine, r as gitDoctorRows, t as probeGitVersion } from "../chunks/git-version-rWZjF2Px.js";
10
10
  import { i as guardrailsDoctorRows, r as probeGuardrailsDependencies } from "../chunks/guardrails-deps-Cb-ki4EU.js";
11
11
  import { i as pnpmGlobalBinDir, n as npmGlobalBinDir, r as onPath, t as formatPathNotice } from "../chunks/path-doctor-C23VAqeu.js";
12
12
  import fs from "node:fs";
@@ -43,6 +43,8 @@ Inside a Glimmervoid session:
43
43
  limits List which of these commands answer here and what the guardrails block
44
44
  factory status Print each factory intent's tickets, state, last reason and next action
45
45
  factory retry <id> Reopen the parked tickets of a factory intent
46
+ factory setup Prove and save the factory checks of this session's repository
47
+ factory queue <file> Queue a factory intent (a spec cut.ts file or Factory tab request) on this session's repository
46
48
  ssh-sign Sign a commit with the operator's forwarded ssh agent (git runs this)
47
49
 
48
50
  Experimental:
@@ -74,19 +76,19 @@ var SUBCOMMAND_RUNNERS = new Map([
74
76
  return 0;
75
77
  }],
76
78
  ["pair", async (subcommandArgs) => {
77
- const { runPairCli } = await import("../chunks/pair-cli-BdoyrDCr.js");
79
+ const { runPairCli } = await import("../chunks/pair-cli-DNp8i5L4.js");
78
80
  return runPairCli(subcommandArgs);
79
81
  }],
80
82
  ["agent", async (subcommandArgs) => {
81
- const { runAgentSetupCli } = await import("../chunks/agent-setup-cli-BixDoCkF.js");
83
+ const { runAgentSetupCli } = await import("../chunks/agent-setup-cli-DmMfCw5O.js");
82
84
  return runAgentSetupCli(subcommandArgs);
83
85
  }],
84
86
  ["kg", async (subcommandArgs) => {
85
- const { runKnowledgeGraphCommand } = await import("../chunks/knowledge-graph-cli-DcspNqhz.js");
87
+ const { runKnowledgeGraphCommand } = await import("../chunks/knowledge-graph-cli-ByUJoKw_.js");
86
88
  return runKnowledgeGraphCommand(subcommandArgs);
87
89
  }],
88
90
  ["settings", async (subcommandArgs) => {
89
- const { runSettingsCommand } = await import("../chunks/settings-cli-DKJsm3AP.js");
91
+ const { runSettingsCommand } = await import("../chunks/settings-cli-BbzxCyG5.js");
90
92
  return runSettingsCommand(subcommandArgs);
91
93
  }],
92
94
  ["visions", async (subcommandArgs) => {
@@ -94,21 +96,21 @@ var SUBCOMMAND_RUNNERS = new Map([
94
96
  return runVisionsCli(subcommandArgs);
95
97
  }],
96
98
  ["ssh-sign", async (subcommandArgs) => {
97
- const { runSshSignCli } = await import("../chunks/ssh-sign-cli-Dc2gOCwE.js");
99
+ const { runSshSignCli } = await import("../chunks/ssh-sign-cli-C74BGTQS.js");
98
100
  return runSshSignCli(subcommandArgs);
99
101
  }],
100
102
  ["factory", async (subcommandArgs) => {
101
- const { runAgentApiCli } = await import("../chunks/agent-api-cli-3hryuewm.js");
103
+ const { runAgentApiCli } = await import("../chunks/agent-api-cli-BDu1CxZf.js");
102
104
  return runAgentApiCli(["factory", ...subcommandArgs]);
103
105
  }],
104
106
  ...AGENT_API_VERBS.map((verb) => [verb, async (subcommandArgs, subcommandName) => {
105
- const { runAgentApiCli } = await import("../chunks/agent-api-cli-3hryuewm.js");
107
+ const { runAgentApiCli } = await import("../chunks/agent-api-cli-BDu1CxZf.js");
106
108
  return runAgentApiCli([subcommandName, ...subcommandArgs]);
107
109
  }])
108
110
  ]);
109
111
  async function printSessionLimits() {
110
112
  if (!process.env["GLIMMERVOID_AGENT_URL"]) return;
111
- const { sessionLimitsHelpLines } = await import("../chunks/agent-api-cli-3hryuewm.js");
113
+ const { sessionLimitsHelpLines } = await import("../chunks/agent-api-cli-BDu1CxZf.js");
112
114
  const limitsLines = await sessionLimitsHelpLines();
113
115
  console.log(`\n${limitsLines.join("\n")}`);
114
116
  }
@@ -165,7 +167,7 @@ async function readDeclaredCustomAgents() {
165
167
  declared: [],
166
168
  error: null
167
169
  };
168
- const { loadConfigFile } = await import("../chunks/config-store-DYj3wYgw.js");
170
+ const { loadConfigFile } = await import("../chunks/config-store-MAVQhGMh.js");
169
171
  try {
170
172
  const loaded = loadConfigFile(decided.path, { exitOnError: false });
171
173
  if (!loaded.config) return {
@@ -241,7 +243,7 @@ async function runDoctor() {
241
243
  }
242
244
  switchSection("Agents");
243
245
  try {
244
- const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-Dt3vwxwY.js");
246
+ const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-DDjC7_vG.js");
245
247
  const declaredCustomAgents = await readDeclaredCustomAgents();
246
248
  if (declaredCustomAgents.error) line("config", declaredCustomAgents.error);
247
249
  setCustomAgents(declaredCustomAgents.declared);
@@ -249,7 +251,7 @@ async function runDoctor() {
249
251
  const { label, path: resolvedPath } = describeAgentResolvability(id);
250
252
  line(`${id} (${label})`, resolvedPath ?? "not found on PATH");
251
253
  }
252
- const { inspectGrokAgentSetup } = await import("../chunks/agent-setup-cli-BixDoCkF.js");
254
+ const { inspectGrokAgentSetup } = await import("../chunks/agent-setup-cli-DmMfCw5O.js");
253
255
  const grokSetup = inspectGrokAgentSetup();
254
256
  line("grok hook setup", `${grokSetup.classification}: ${grokSetup.filePath}`);
255
257
  } catch (err) {
@@ -257,7 +259,7 @@ async function runDoctor() {
257
259
  }
258
260
  switchSection("rtk");
259
261
  try {
260
- const { getRtkPath } = await import("../chunks/rtk-resolver-B8BPgN9L.js");
262
+ const { getRtkPath } = await import("../chunks/rtk-resolver-BGE6Hd_L.js");
261
263
  line("rtk", getRtkPath() || "not installed (Glimmervoid installs it when the rtk setting is on)");
262
264
  } catch (err) {
263
265
  line("rtk", `probe failed: ${firstLine(errorText(err))}`);
@@ -266,7 +268,7 @@ async function runDoctor() {
266
268
  try {
267
269
  const { resolvePackageBin } = await import("../chunks/runtime-paths-DSmormp7.js");
268
270
  const { execFileSync } = await import("../chunks/child-process-safe-ChRmWAJP.js");
269
- const { inspectGrokAgentSetup } = await import("../chunks/agent-setup-cli-BixDoCkF.js");
271
+ const { inspectGrokAgentSetup } = await import("../chunks/agent-setup-cli-DmMfCw5O.js");
270
272
  const binPath = resolvePackageBin("cc-safety-net", "cc-safety-net");
271
273
  line("Sane YOLO", binPath || "not installed");
272
274
  if (binPath) line("cc-safety-net version", execFileSync(process.execPath, [binPath, "--version"], {
@@ -3,11 +3,11 @@ import { r as execFileSync } from "./child-process-safe-CbQnyh7D.js";
3
3
  import { n as resolveAgentCommand, t as buildAgentSpawnCommand } from "./spawn-command-Cc40FiZI.js";
4
4
  import { s as rawTextOr } from "./coerce-NSst8oRP.js";
5
5
  import { r as nextBackoffMs } from "./backoff-DjVpfHk7.js";
6
- import { l as supervisionLine } from "./session-routes-D-GZC-Sy.js";
7
- import { c as buildAgentEnv, i as isSpinnerChar, n as classifyAgentTitle, r as isBrailleChar, t as grok } from "./grok-xFs6zIu4.js";
6
+ import { l as supervisionLine } from "./session-routes-CT1JrjoT.js";
7
+ import { c as buildAgentEnv, i as isSpinnerChar, n as classifyAgentTitle, r as isBrailleChar, t as grok } from "./grok-B6bsCgdd.js";
8
8
  import { t as buildHookCommand } from "./hook-command-core-qTNK-xMF.js";
9
- import "./contracts-u40eJhaf.js";
10
- import { n as mergeCodexPreToolUse, t as HOOK_TOOLS } from "./hook-tools-BkxllUHE.js";
9
+ import "./contracts-HVCEJfxs.js";
10
+ import { n as mergeCodexPreToolUse, t as HOOK_TOOLS } from "./hook-tools-Dl7-r2Eb.js";
11
11
  import fs from "node:fs";
12
12
  import path from "node:path";
13
13
  //#region session/adapters/claude-code.ts
@@ -1 +1 @@
1
- export { a as describeAgentResolvability, l as listAgentIds, f as setCustomAgents } from "./adapters-B-IkWl-r.js";
1
+ export { a as describeAgentResolvability, l as listAgentIds, f as setCustomAgents } from "./adapters-CAHxZYT3.js";
@@ -1,10 +1,12 @@
1
1
  import { t as errorCode } from "./text-DoirglWV.js";
2
- import { a as AgentDispatchRequest, c as AgentFactoryStatusRequest, d as AgentTicketRequest, l as AgentLimitsReply, n as AGENT_URL_ENV, s as AgentFactoryRetryRequest } from "./session-8Pv0y1vz.js";
2
+ import { a as AgentDispatchRequest, f as AgentTicketRequest, l as AgentFactoryStatusRequest, n as AGENT_URL_ENV, s as AgentFactoryRetryRequest, u as AgentLimitsReply } from "./session-BlT68ppa.js";
3
3
  import { i as resolveHookTarget } from "./hook-relay-core-DA_bz2KA.js";
4
4
  import { n as decideGuardrailsProxy } from "./guardrails-proxy-core-BI3rdY-m.js";
5
+ import { n as isRecord } from "./coerce-NSst8oRP.js";
5
6
  import { t as parseJsonOrNull } from "./json-core-dfa_7Fak.js";
6
- import { a as formatSessionLimits } from "./session-routes-D-GZC-Sy.js";
7
- import { m as isOrchestratorAgentVerb, p as isAgentApiVerb } from "./agent-api-core--8WtU1xU.js";
7
+ import { a as formatSessionLimits } from "./session-routes-CT1JrjoT.js";
8
+ import { g as isOrchestratorAgentVerb, h as isAgentApiVerb } from "./agent-api-core-B_mUSenR.js";
9
+ import { readFileSync } from "node:fs";
8
10
  import path from "node:path";
9
11
  import http from "node:http";
10
12
  //#region server/agent-api-cli.ts
@@ -47,8 +49,25 @@ var BODY_BUILDERS = {
47
49
  if (rest.length !== 1) return null;
48
50
  const parsed = AgentFactoryRetryRequest.safeParse({ intentId: rest[0] });
49
51
  return parsed.success ? parsed.data : null;
52
+ },
53
+ "factory-setup": (rest) => rest.length === 0 ? {} : null,
54
+ "factory-queue": (rest) => {
55
+ if (rest.length !== 1) return null;
56
+ const intent = parseJsonOrNull(readFileSync(rest[0], "utf8"));
57
+ if (!isRecord(intent)) return null;
58
+ const { name: _name, type: _type, requestId: _requestId, projectId: _projectId, ...request } = intent;
59
+ return request;
50
60
  }
51
61
  };
62
+ var FACTORY_USAGE = Object.freeze({
63
+ "factory-status": "status [--project <projectId>]",
64
+ "factory-retry": "retry <intentId>",
65
+ "factory-setup": "setup",
66
+ "factory-queue": "queue <intent.json>"
67
+ });
68
+ function isFactoryVerb(verb) {
69
+ return verb in FACTORY_USAGE;
70
+ }
52
71
  function bodySaysOk(text) {
53
72
  try {
54
73
  const parsed = JSON.parse(text);
@@ -63,7 +82,7 @@ function limitsLines(replyText) {
63
82
  return formatSessionLimits(limits.data);
64
83
  }
65
84
  function printableReply(verb, replyText) {
66
- if (verb === "factory-status" || verb === "factory-retry") {
85
+ if (isFactoryVerb(verb)) {
67
86
  const reply = parseJsonOrNull(replyText);
68
87
  if (typeof reply !== "object" || reply === null) return replyText;
69
88
  if ("text" in reply && typeof reply.text === "string") return reply.text;
@@ -170,8 +189,8 @@ async function sessionLimitsHelpLines({ timeoutMs = HELP_LIMITS_TIMEOUT_MS } = {
170
189
  }
171
190
  async function runAgentApiCli(args) {
172
191
  if (args[0] === "factory") {
173
- if (args[1] !== "status" && args[1] !== "retry") {
174
- console.error("glimmervoid factory: expected status [--project <projectId>] or retry <intentId>");
192
+ if (!(`factory-${args[1]}` in FACTORY_USAGE)) {
193
+ console.error(`glimmervoid factory: expected ${Object.values(FACTORY_USAGE).join(", or ")}`);
175
194
  return 1;
176
195
  }
177
196
  return runAgentApiCli([`factory-${args[1]}`, ...args.slice(2)]);
@@ -183,8 +202,8 @@ async function runAgentApiCli(args) {
183
202
  }
184
203
  const body = BODY_BUILDERS[verb](args.slice(1));
185
204
  if (!body) {
186
- if (verb === "factory-status" || verb === "factory-retry") {
187
- console.error(`glimmervoid factory: expected ${verb === "factory-status" ? "status [--project <projectId>]" : "retry <intentId>"}`);
205
+ if (isFactoryVerb(verb)) {
206
+ console.error(`glimmervoid factory: expected ${FACTORY_USAGE[verb]}`);
188
207
  return 1;
189
208
  }
190
209
  if (isOrchestratorAgentVerb(verb)) {
@@ -1 +1 @@
1
- export { n as runAgentApiCli, r as sessionLimitsHelpLines } from "./agent-api-cli-BcZ9DLCF.js";
1
+ export { n as runAgentApiCli, r as sessionLimitsHelpLines } from "./agent-api-cli-B5Tm0wXO.js";
@@ -1,5 +1,7 @@
1
- import { c as AgentFactoryStatusRequest, i as AgentAttentionRequest, o as AgentEditRequest, s as AgentFactoryRetryRequest, t as AGENT_API_VERBS, u as AgentSpawnRequest, y as ORCHESTRATOR_AGENT_VERBS } from "./session-8Pv0y1vz.js";
2
- import { c as spawnRoute, i as editRoute, n as attentionRoute, s as pushRoute, t as NO_OWN_WORKTREE_REASON } from "./session-routes-D-GZC-Sy.js";
1
+ import { b as ORCHESTRATOR_AGENT_VERBS, c as AgentFactorySetupRequest, d as AgentSpawnRequest, i as AgentAttentionRequest, l as AgentFactoryStatusRequest, o as AgentEditRequest, s as AgentFactoryRetryRequest, t as AGENT_API_VERBS } from "./session-BlT68ppa.js";
2
+ import { c as spawnRoute, i as editRoute, n as attentionRoute, s as pushRoute, t as NO_OWN_WORKTREE_REASON } from "./session-routes-CT1JrjoT.js";
3
+ import { t as AgentFactoryQueueRequest } from "./factory-D7ryES9n.js";
4
+ import path from "node:path";
3
5
  import crypto from "node:crypto";
4
6
  var MAX_SPAWNS_IN_FLIGHT = 1;
5
7
  var SPAWNABLE_DEPTH = 0;
@@ -81,7 +83,7 @@ function factoryControlRoute({ factoryRole, isEphemeral, isSpawnedChild }) {
81
83
  if (!(factoryRole !== null || isEphemeral && !isSpawnedChild)) return { answers: true };
82
84
  return {
83
85
  answers: false,
84
- reason: "only an operator session or a session it spawned may read factory status or retry parked work, so factory and lane sessions stay on their own task"
86
+ reason: "only an operator session or a session it spawned may use the factory commands, so factory and lane sessions stay on their own task"
85
87
  };
86
88
  }
87
89
  function decideFactoryControlAllowance(caller) {
@@ -165,6 +167,24 @@ function parseAgentVerb(verb, payload) {
165
167
  request: parsed.data
166
168
  };
167
169
  }
170
+ if (verb === "factory-setup") {
171
+ const parsed = AgentFactorySetupRequest.safeParse(payload);
172
+ if (!parsed.success) return refuseInvalidBody(parsed.error.issues);
173
+ return {
174
+ ok: true,
175
+ verb,
176
+ request: parsed.data
177
+ };
178
+ }
179
+ if (verb === "factory-queue") {
180
+ const parsed = AgentFactoryQueueRequest.safeParse(payload);
181
+ if (!parsed.success) return refuseInvalidBody(parsed.error.issues);
182
+ return {
183
+ ok: true,
184
+ verb,
185
+ request: parsed.data
186
+ };
187
+ }
168
188
  if (isOrchestratorAgentVerb(verb)) return {
169
189
  ok: false,
170
190
  status: 403,
@@ -305,5 +325,17 @@ function formatFactoryStatus(projects, buildDigest) {
305
325
  }
306
326
  return lines.join("\n") || "No factory projects.";
307
327
  }
328
+ function findSessionProjectId(projects, sessionPath) {
329
+ const resolvedSessionPath = path.resolve(sessionPath);
330
+ return projects?.find((project) => path.resolve(project.path) === resolvedSessionPath)?.id ?? null;
331
+ }
332
+ var FACTORY_QUEUE_STEP = "glimmervoid factory queue <intent.json>, with an intent cut by the spec skill or written in the Factory tab request shape";
333
+ function describeFactorySetupProfile(profile, isFactoryProject) {
334
+ return [
335
+ `Factory checks: ${profile.checks?.join(", ") || "none"}`,
336
+ `Focused test command: ${profile.focusedTestCommand ?? "none proven, so every ticket runs the full checks"}`,
337
+ isFactoryProject ? `Next: ${FACTORY_QUEUE_STEP}` : `Next: commit a coherence.config.json holding {} at the repository root, land it with glimmervoid push, then ${FACTORY_QUEUE_STEP}`
338
+ ].join("\n");
339
+ }
308
340
  //#endregion
309
- export { decideFactoryControlAllowance as a, deriveChildSessionName as c, describeUnavailableFactoryState as d, formatFactoryStatus as f, parseAgentVerb as h, decideEditAllowance as i, describePushLanding as l, isOrchestratorAgentVerb as m, decideAgentRequest as n, decideSpawnAllowance as o, isAgentApiVerb as p, decideAttentionAllowance as r, decideTicketAction as s, REFUSAL_REASON as t, describePushRouteRefusal as u };
341
+ export { parseAgentVerb as _, decideFactoryControlAllowance as a, deriveChildSessionName as c, describePushRouteRefusal as d, describeUnavailableFactoryState as f, isOrchestratorAgentVerb as g, isAgentApiVerb as h, decideEditAllowance as i, describeFactorySetupProfile as l, formatFactoryStatus as m, decideAgentRequest as n, decideSpawnAllowance as o, findSessionProjectId as p, decideAttentionAllowance as r, decideTicketAction as s, REFUSAL_REASON as t, describePushLanding as u };
@@ -1,5 +1,5 @@
1
1
  import { a as isMissingFileError, r as errorMessage } from "./text-DoirglWV.js";
2
- import { a as classifyGrokHooksFile, o as renderGrokHooksFile, t as grok } from "./grok-xFs6zIu4.js";
2
+ import { a as classifyGrokHooksFile, o as renderGrokHooksFile, t as grok } from "./grok-B6bsCgdd.js";
3
3
  import { p as writeTextAtomicSync } from "./json-file-CIJf0Cel.js";
4
4
  import fs from "node:fs";
5
5
  import path from "node:path";
@@ -1,6 +1,5 @@
1
- import { $ as repositoryName, Ft as repoParts, K as MyPrSearchNode, Mt as GH_SEGMENT, N as TaskTitle, Q as SessionPrLinks, et as CommitSha } from "./session-8Pv0y1vz.js";
1
+ import { It as repoParts, Nt as GH_SEGMENT, et as repositoryName, q as MyPrSearchNode, tt as CommitSha } from "./session-BlT68ppa.js";
2
2
  import { n as isRecord } from "./coerce-NSst8oRP.js";
3
- import path from "node:path";
4
3
  import { z } from "zod";
5
4
  //#region shared/contracts/coherence.ts
6
5
  var CoherenceRisk = z.enum([
@@ -760,218 +759,4 @@ var createBrowserConfigShape = (isAbsolutePath) => ({
760
759
  });
761
760
  var createBrowserConfig = (isAbsolutePath) => z.object(createBrowserConfigShape(isAbsolutePath));
762
761
  //#endregion
763
- //#region shared/contracts/config.ts
764
- var BrowserConfig = createBrowserConfig(path.isAbsolute);
765
- var BROWSER_CONFIG_SHAPE = BrowserConfig.shape;
766
- var ConfigUpdate = z.object({
767
- ...BROWSER_CONFIG_SHAPE,
768
- notifyDebounceMs: z.number({ error: "notifyDebounceMs must be a positive number" }).finite().positive({ error: "notifyDebounceMs must be a positive number" }).optional(),
769
- phoneEscalationMs: z.number({ error: "phoneEscalationMs must be a positive number" }).finite().positive({ error: "phoneEscalationMs must be a positive number" }).optional(),
770
- branchGc: BranchGcControlSettings,
771
- worktreeAutoRebase: optionalBoolean("worktreeAutoRebase"),
772
- worktreeSyncOnStart: optionalBoolean("worktreeSyncOnStart"),
773
- worktreeRerere: optionalBoolean("worktreeRerere"),
774
- workflows: WorkflowsSettingsUpdate.optional()
775
- }).omit({
776
- port: true,
777
- worktreeShare: true
778
- }).strict();
779
- var AGENT_ID_RE = /^[a-z][a-z0-9-]{1,31}$/;
780
- var BUILTIN_AGENT_IDS = Object.freeze([
781
- "claude-code",
782
- "codex",
783
- "grok"
784
- ]);
785
- var AGENT_ID_SHAPE_MESSAGE = "an agent id of 2 to 32 characters of lowercase letters, digits and dashes, starting with a letter";
786
- var AGENT_COMMAND_BASENAME_RE = /^[A-Za-z0-9._+-]+$/;
787
- var AGENT_COMMAND_ABSOLUTE_RE = /^(?:\/|[A-Za-z]:[\\/])[A-Za-z0-9._+\-\\/]*[A-Za-z0-9._+-]$/;
788
- var AGENT_COMMAND_SHAPE_MESSAGE = "a bare command name or an absolute path, built only from letters, digits, dot, underscore, plus, dash and path separators";
789
- function isSpawnableCommand(command) {
790
- if (AGENT_COMMAND_BASENAME_RE.test(command)) return true;
791
- return AGENT_COMMAND_ABSOLUTE_RE.test(command);
792
- }
793
- var GIT_BRANCH_FORBIDDEN_PUNCTUATION_RE = /[~^:?*[\\]/;
794
- var GIT_BRANCH_FORBIDDEN_SEQUENCES = [
795
- "..",
796
- "@{",
797
- "//"
798
- ];
799
- function isControlOrSpaceCharacter(character) {
800
- const codePoint = character.charCodeAt(0);
801
- return codePoint <= 32 || codePoint === 127;
802
- }
803
- function isGitBranchName(name) {
804
- if (name === "" || name === "@" || name === "HEAD") return false;
805
- if (name.startsWith("-") || name.startsWith("/") || name.endsWith("/") || name.endsWith(".")) return false;
806
- if (GIT_BRANCH_FORBIDDEN_SEQUENCES.some((sequence) => name.includes(sequence))) return false;
807
- if (GIT_BRANCH_FORBIDDEN_PUNCTUATION_RE.test(name) || [...name].some(isControlOrSpaceCharacter)) return false;
808
- return name.split("/").every((component) => !component.startsWith(".") && !component.endsWith(".lock"));
809
- }
810
- var CustomAgentDeclaration = z.object({
811
- id: z.string({ error: "customAgents[].id must be a string" }).regex(AGENT_ID_RE, { error: `customAgents[].id must be ${AGENT_ID_SHAPE_MESSAGE}` }),
812
- label: z.string({ error: "customAgents[].label must be a string" }).min(1, { error: "customAgents[].label must not be empty" }).max(60, { error: "customAgents[].label must be at most 60 characters" }),
813
- command: z.string({ error: "customAgents[].command must be a string" }).min(1, { error: "customAgents[].command must not be empty" }).refine((command) => command.trim().length > 0, { error: "customAgents[].command must not be blank" }).refine(isSpawnableCommand, { error: `customAgents[].command must be ${AGENT_COMMAND_SHAPE_MESSAGE}` }),
814
- args: z.array(z.string({ error: "customAgents[].args must be an array of strings" }), { error: "customAgents[].args must be an array of strings" }).default([]),
815
- idleTitle: z.string({ error: "customAgents[].idleTitle must be a string" }).optional(),
816
- busyTitle: z.string({ error: "customAgents[].busyTitle must be a string" }).optional()
817
- }).strict();
818
- var CustomAgentDeclarations = z.array(CustomAgentDeclaration, { error: "customAgents must be an array" }).superRefine((declarations, ctx) => {
819
- const claimedIds = new Set(BUILTIN_AGENT_IDS);
820
- for (const [index, declaration] of declarations.entries()) {
821
- if (!claimedIds.has(declaration.id)) {
822
- claimedIds.add(declaration.id);
823
- continue;
824
- }
825
- const message = BUILTIN_AGENT_IDS.some((builtinAgentId) => builtinAgentId === declaration.id) ? `customAgents[${index}].id "${declaration.id}" collides with the builtin agent of the same id` : `customAgents[${index}].id "${declaration.id}" is declared more than once`;
826
- ctx.addIssue({
827
- code: "custom",
828
- path: [index, "id"],
829
- message
830
- });
831
- }
832
- });
833
- var TaskTitleSources = z.object({
834
- customTitle: TaskTitle.nullable().optional(),
835
- pendingPromptTitle: TaskTitle.nullable().optional(),
836
- refinedTitle: TaskTitle.nullable().optional(),
837
- aiTitle: TaskTitle.nullable().optional(),
838
- oscTitle: TaskTitle.nullable().optional(),
839
- promptTitle: TaskTitle.nullable().optional()
840
- }).strict();
841
- var TASK_TITLE_SOURCE_PRIORITY = [
842
- "customTitle",
843
- "pendingPromptTitle",
844
- "refinedTitle",
845
- "aiTitle",
846
- "oscTitle",
847
- "promptTitle"
848
- ];
849
- var PersistedTaskTitle = z.object({
850
- taskTitle: TaskTitle.min(1),
851
- isCustom: z.boolean(),
852
- sources: TaskTitleSources
853
- }).strict().refine(({ taskTitle, isCustom, sources }) => {
854
- const source = TASK_TITLE_SOURCE_PRIORITY.find((candidate) => sources[candidate]?.trim());
855
- if (!source) return false;
856
- return sources[source]?.replace(/\s+/g, " ").trim() === taskTitle && isCustom === (source === "customTitle");
857
- });
858
- var ProjectConfig = z.object({
859
- id: z.string().optional(),
860
- name: z.string().optional(),
861
- customTitle: TaskTitle.optional(),
862
- taskTitleState: PersistedTaskTitle.optional().catch(void 0),
863
- prLinks: SessionPrLinks.optional().catch(void 0),
864
- path: z.string(),
865
- repos: z.array(z.string()).min(2).optional(),
866
- baseBranch: z.string().refine(isGitBranchName, { error: "projects[].baseBranch must be a git branch name" }).optional(),
867
- agent: z.string({ error: "projects[].agent must be a string" }).regex(AGENT_ID_RE, { error: `projects[].agent must be ${AGENT_ID_SHAPE_MESSAGE}` }).optional(),
868
- codexBypassHookTrust: z.boolean().optional(),
869
- conversationView: z.boolean({ error: "projects[].conversationView must be a boolean" }).optional(),
870
- dangerouslySkipPermissions: z.boolean({ error: "projects[].dangerouslySkipPermissions must be a boolean" }).optional(),
871
- unguarded: z.boolean({ error: "projects[].unguarded must be a boolean" }).optional(),
872
- factoryProfile: FactorySettings.unwrap().unwrap().extend({
873
- focusedTestCommand: z.string().trim().min(1).optional(),
874
- widenableScopes: z.array(z.string().trim().min(1)).optional()
875
- }).optional()
876
- }).passthrough();
877
- var FILE_CONFIG_SHAPE = {
878
- ...BROWSER_CONFIG_SHAPE,
879
- changeMap: ChangeMapSettings,
880
- branchGc: optionalLooseObject("branchGc"),
881
- coder: z.object({ appSlug: z.string().optional() }).loose().optional(),
882
- visions: optionalLooseObject("visions"),
883
- github: GithubSettings,
884
- teamReview: optionalLooseObject("teamReview"),
885
- benchmarks: optionalLooseObject("benchmarks"),
886
- factory: FactorySettings,
887
- knowledgeGraph: optionalLooseObject("knowledgeGraph"),
888
- posthog: optionalLooseObject("posthog"),
889
- usage: optionalLooseObject("usage"),
890
- telegram: optionalLooseObject("telegram"),
891
- ingest: optionalLooseObject("ingest"),
892
- workflows: optionalLooseObject("workflows"),
893
- guardrails: GuardrailsFileSettings,
894
- telemetry: TelemetryFileSettings,
895
- trace: TraceSettings,
896
- planReview: PlanReviewSettings,
897
- customAgents: CustomAgentDeclarations.optional()
898
- };
899
- var Config = z.object({
900
- ...FILE_CONFIG_SHAPE,
901
- detectScheduledWakeups: optionalBoolean("detectScheduledWakeups"),
902
- worktreeAutoRebase: optionalBoolean("worktreeAutoRebase"),
903
- worktreeSyncOnStart: optionalBoolean("worktreeSyncOnStart"),
904
- worktreeRerere: optionalBoolean("worktreeRerere"),
905
- postTurnChecks: z.record(z.string(), z.unknown()).optional(),
906
- hooks: z.unknown().optional(),
907
- remote: z.object({
908
- enabled: z.boolean().optional(),
909
- port: z.number().int().min(1).max(65535).nullable().optional(),
910
- publicHost: z.string().optional(),
911
- allowedOrigins: z.array(z.string()).optional(),
912
- ownerLogin: z.string().optional()
913
- }).passthrough().optional(),
914
- projects: z.array(ProjectConfig)
915
- }).passthrough().superRefine((config, ctx) => {
916
- if (!Array.isArray(config.projects)) return;
917
- const declaredAgentIds = new Set(BUILTIN_AGENT_IDS);
918
- for (const declaration of config.customAgents ?? []) declaredAgentIds.add(declaration.id);
919
- for (const [index, project] of config.projects.entries()) {
920
- const agent = project?.agent;
921
- if (typeof agent !== "string" || !AGENT_ID_RE.test(agent)) continue;
922
- if (declaredAgentIds.has(agent)) continue;
923
- ctx.addIssue({
924
- code: "custom",
925
- path: [
926
- "projects",
927
- index,
928
- "agent"
929
- ],
930
- message: `projects[${index}].agent "${agent}" names no known agent; declare it under customAgents or use one of ${[...declaredAgentIds].join(", ")}`
931
- });
932
- }
933
- });
934
- var CONFIG_BLOCK_KEYS = Object.freeze([
935
- "changeMap",
936
- "taskTitle",
937
- "branchGc",
938
- "postTurnChecks",
939
- "visions",
940
- "github",
941
- "teamReview",
942
- "benchmarks",
943
- "factory",
944
- "knowledgeGraph",
945
- "posthog",
946
- "usage",
947
- "telegram",
948
- "ingest",
949
- "guardrails",
950
- "telemetry",
951
- "workflows",
952
- "coder"
953
- ]);
954
- var CONFIG_SCALAR_KEYS = Object.freeze(Object.keys(BROWSER_CONFIG_SHAPE).filter((key) => {
955
- if (CONFIG_BLOCK_KEYS.includes(key)) return false;
956
- return key !== "port" && key !== "repoRoots" && key !== "worktreeShare";
957
- }));
958
- var RUNTIME_CONFIG_SCALAR_KEYS = Object.freeze([
959
- ...CONFIG_SCALAR_KEYS,
960
- "worktreeAutoRebase",
961
- "worktreeSyncOnStart",
962
- "worktreeRerere"
963
- ]);
964
- Object.freeze([
965
- "detectScheduledWakeups",
966
- "worktreeAutoRebase",
967
- "worktreeSyncOnStart",
968
- "worktreeRerere",
969
- "hooks",
970
- "remote",
971
- "projects"
972
- ]);
973
- function configIssueMessage(error) {
974
- return error.issues[0]?.message || "settings are invalid";
975
- }
976
- //#endregion
977
- export { CoherenceWorkCreated as $, FLYING_ANIMALS_GAP_RANGE as A, POSTHOG_TRAFFIC_MULTIPLIER_RANGE as B, USAGE_COST_MODES as C, FACTORY_MAX_LIVE_WORKERS_RANGE as D, CHANGE_MAP_NARRATOR_TIMEOUT_RANGE as E, PORT_RANGE as F, USAGE_RETAIN_DAYS_RANGE as G, TASK_TITLE_TIMEOUT_RANGE as H, POSITIVE_NUMBER_RANGE as I, WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE as J, USAGE_SCAN_INTERVAL_RANGE as K, POSTHOG_FIX_TIMEOUT_RANGE as L, KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE as M, MEMORY_RESERVE_MB_RANGE as N, FLYING_ANIMALS_DEFAULTS as O, NON_NEGATIVE_NUMBER_RANGE as P, CoherenceTicketCreated as Q, POSTHOG_TRAFFIC_BASELINE_RANGE as R, WorkflowsState as S, normalizeLegacyConfigNumbers as T, USAGE_BUDGET_RANGE as U, REPLAY_BUFFER_KB_RANGE as V, USAGE_INTEGER_RANGES as W, CoherenceReadiness as X, CoherenceOrient as Y, CoherenceRisk as Z, UPDATE_CHANNELS as _, ConfigUpdate as a, WorkflowSearchNode as b, RUNTIME_CONFIG_SCALAR_KEYS as c, BranchGcFileSettings as d, CoherenceWorkInspect as et, CHANGE_MAP_NARRATOR_ENGINES as f, POST_TURN_CHECK_MODES as g, FactorySettings as h, Config as i, FLYING_ANIMALS_SCALE_RANGE as j, FLYING_ANIMALS_DURATION_RANGE as k, TASK_TITLE_SOURCE_PRIORITY as l, DEFAULT_FACTORY_PROTECTED_PATHS as m, BUILTIN_AGENT_IDS as n, PersistedTaskTitle as o, DEFAULT_FACTORY_CHECKS as p, WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE as q, BrowserConfig as r, ProjectConfig as s, AGENT_ID_SHAPE_MESSAGE as t, CoherenceWorkState as tt, configIssueMessage as u, WorkflowCommentBody as v, USAGE_VENDOR_KEYS as w, WorkflowsSettings as x, WorkflowLabelName as y, POSTHOG_TRAFFIC_MIN_USERS_RANGE as z };
762
+ export { CoherenceTicketCreated as $, FLYING_ANIMALS_DURATION_RANGE as A, POSTHOG_TRAFFIC_MIN_USERS_RANGE as B, WorkflowsState as C, CHANGE_MAP_NARRATOR_TIMEOUT_RANGE as D, normalizeLegacyConfigNumbers as E, NON_NEGATIVE_NUMBER_RANGE as F, USAGE_INTEGER_RANGES as G, REPLAY_BUFFER_KB_RANGE as H, PORT_RANGE as I, WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE as J, USAGE_RETAIN_DAYS_RANGE as K, POSITIVE_NUMBER_RANGE as L, FLYING_ANIMALS_SCALE_RANGE as M, KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE as N, FACTORY_MAX_LIVE_WORKERS_RANGE as O, MEMORY_RESERVE_MB_RANGE as P, CoherenceRisk as Q, POSTHOG_FIX_TIMEOUT_RANGE as R, WorkflowsSettingsUpdate as S, USAGE_VENDOR_KEYS as T, TASK_TITLE_TIMEOUT_RANGE as U, POSTHOG_TRAFFIC_MULTIPLIER_RANGE as V, USAGE_BUDGET_RANGE as W, CoherenceOrient as X, WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE as Y, CoherenceReadiness as Z, optionalLooseObject as _, DEFAULT_FACTORY_CHECKS as a, WorkflowSearchNode as b, GithubSettings as c, PlanReviewSettings as d, CoherenceWorkCreated as et, TelemetryFileSettings as f, optionalBoolean as g, createBrowserConfig as h, ChangeMapSettings as i, FLYING_ANIMALS_GAP_RANGE as j, FLYING_ANIMALS_DEFAULTS as k, GuardrailsFileSettings as l, UPDATE_CHANNELS as m, BranchGcFileSettings as n, CoherenceWorkState as nt, DEFAULT_FACTORY_PROTECTED_PATHS as o, TraceSettings as p, USAGE_SCAN_INTERVAL_RANGE as q, CHANGE_MAP_NARRATOR_ENGINES as r, FactorySettings as s, BranchGcControlSettings as t, CoherenceWorkInspect as tt, POST_TURN_CHECK_MODES as u, WorkflowCommentBody as v, USAGE_COST_MODES as w, WorkflowsSettings as x, WorkflowLabelName as y, POSTHOG_TRAFFIC_BASELINE_RANGE as z };