holycodex 0.7.0-dev.29548804255.1 → 0.7.0-dev.29549405174.1

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 (2) hide show
  1. package/dist/cli.js +39 -9
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@ import { existsSync } from "node:fs";
7
7
  import { pluginRoot } from "@holycodex/plugin";
8
8
  import { Buffer } from "node:buffer";
9
9
  //#region packages/cli/src/catalog.ts
10
- var VERSION = "0.7.0-dev.29548804255.1";
10
+ var VERSION = "0.7.0-dev.29549405174.1";
11
11
  var SKILLS = [
12
12
  "ast-grep",
13
13
  "caveman",
@@ -181,7 +181,11 @@ function missing(checkedPaths) {
181
181
  //#endregion
182
182
  //#region packages/mcp-stdio-core/src/process.ts
183
183
  var TRUNCATED_MARKER = "\n... diagnostic output truncated ...\n";
184
- async function runManagedProcess(input) {
184
+ var defaultManagedProcessRuntime = {
185
+ terminationGraceMs: 2e3,
186
+ kill: killProcessTree
187
+ };
188
+ async function runManagedProcess(input, runtime = defaultManagedProcessRuntime) {
185
189
  return await new Promise((resolve) => {
186
190
  const child = spawn(input.command, [...input.args], {
187
191
  ...input.cwd === void 0 ? {} : { cwd: input.cwd },
@@ -207,12 +211,12 @@ async function runManagedProcess(input) {
207
211
  let timedOut = false;
208
212
  let matched = false;
209
213
  let settled = false;
210
- let terminationFallback;
214
+ let forceKillTimeout;
211
215
  const finish = (exitCode, error) => {
212
216
  if (settled) return;
213
217
  settled = true;
214
218
  clearTimeout(timeout);
215
- if (terminationFallback !== void 0) clearTimeout(terminationFallback);
219
+ if (forceKillTimeout !== void 0) clearTimeout(forceKillTimeout);
216
220
  resolve({
217
221
  exitCode,
218
222
  stdout: outputText(stdout),
@@ -224,9 +228,12 @@ async function runManagedProcess(input) {
224
228
  });
225
229
  };
226
230
  const terminate = () => {
227
- killProcessTree(child, input.platform);
228
- terminationFallback ??= setTimeout(() => finish(child.exitCode), 2e3);
229
- terminationFallback.unref();
231
+ if (forceKillTimeout !== void 0) return;
232
+ runtime.kill(child, input.platform, "SIGTERM");
233
+ forceKillTimeout = setTimeout(() => {
234
+ runtime.kill(child, input.platform, "SIGKILL");
235
+ }, runtime.terminationGraceMs);
236
+ forceKillTimeout.unref();
230
237
  };
231
238
  const inspectMatch = () => {
232
239
  if (matched || input.matchOutput === void 0) return;
@@ -381,6 +388,7 @@ function autonomy(config) {
381
388
  async function doctor(home = process.env.CODEX_HOME ?? join(homedir(), ".codex"), runtime = defaultRuntime$1) {
382
389
  const checks = [];
383
390
  const pluginRoot = join(home, "plugins", "cache", "holycodex", "holycodex", VERSION);
391
+ const agentRoot = join(home, "holycodex", "agents");
384
392
  const configPath = join(home, "config.toml");
385
393
  const missing = await missingFiles(pluginRoot, [
386
394
  ".codex-plugin/plugin.json",
@@ -444,7 +452,7 @@ async function doctor(home = process.env.CODEX_HOME ?? join(homedir(), ".codex")
444
452
  checks.push(codex.ok ? check("codex", "ok", "codex-version", codex.output || "Codex is available.") : check("codex", "warning", "codex-version-unavailable", "Codex version could not be read; status-line compatibility cannot be independently confirmed."));
445
453
  const agentModelFailures = [];
446
454
  for (const agent of AGENTS) try {
447
- const text = await readFile(join(pluginRoot, "agents", `${agent}.toml`), "utf8");
455
+ const text = await readFile(join(agentRoot, `${agent}.toml`), "utf8");
448
456
  const expected = AGENT_MODELS[agent];
449
457
  if (!text.includes(`model = "${expected.model}"`) || !text.includes(`model_reasoning_effort = "${expected.reasoningEffort}"`)) agentModelFailures.push(agent);
450
458
  } catch {
@@ -556,7 +564,7 @@ function preserveManagedRootPreferences(input, base) {
556
564
  }
557
565
  function mergedStatusLine(original) {
558
566
  if (original === void 0) return "[\"model-with-reasoning\", \"context-remaining\", \"current-dir\"]";
559
- const items = [...original.slice(original.indexOf("=") + 1).matchAll(/"((?:\\.|[^"\\])*)"|'([^']*)'/g)].map((match) => {
567
+ const items = [...tomlArrayValue(original.slice(original.indexOf("=") + 1)).matchAll(/"((?:\\.|[^"\\])*)"|'([^']*)'/g)].map((match) => {
560
568
  if (match[1] === void 0) return match[2] ?? "";
561
569
  const parsed = JSON.parse(`"${match[1]}"`);
562
570
  if (typeof parsed !== "string") throw new Error("Invalid status-line string");
@@ -565,6 +573,28 @@ function mergedStatusLine(original) {
565
573
  if (!items.includes("context-remaining")) items.push("context-remaining");
566
574
  return `[${items.map((item) => JSON.stringify(item)).join(", ")}]`;
567
575
  }
576
+ function tomlArrayValue(input) {
577
+ const start = input.indexOf("[");
578
+ if (start < 0) return input;
579
+ let quote;
580
+ let escaped = false;
581
+ for (let index = start + 1; index < input.length; index += 1) {
582
+ const character = input[index];
583
+ if (quote === "\"") {
584
+ if (escaped) escaped = false;
585
+ else if (character === "\\") escaped = true;
586
+ else if (character === "\"") quote = void 0;
587
+ continue;
588
+ }
589
+ if (quote === "'") {
590
+ if (character === "'") quote = void 0;
591
+ continue;
592
+ }
593
+ if (character === "\"" || character === "'") quote = character;
594
+ else if (character === "]") return input.slice(start, index + 1);
595
+ }
596
+ return input.slice(start);
597
+ }
568
598
  function installConfig(input, mode, _platform) {
569
599
  const base = preserveManagedRootPreferences(input, removeLegacyOmo(removeManaged(input)));
570
600
  const firstTable = base.search(/^\s*\[/m);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "holycodex",
3
- "version": "0.7.0-dev.29548804255.1",
3
+ "version": "0.7.0-dev.29549405174.1",
4
4
  "description": "Lean Codex-only agent toolkit installer and doctor",
5
5
  "keywords": [
6
6
  "agents",
@@ -39,7 +39,7 @@
39
39
  "prepack": "vp run --workspace-root build"
40
40
  },
41
41
  "dependencies": {
42
- "@holycodex/plugin": "0.7.0-dev.29548804255.1"
42
+ "@holycodex/plugin": "0.7.0-dev.29549405174.1"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=20"