@nail00749/agent-gvozd 0.1.5 → 0.1.7

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 +46 -22
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -7336,7 +7336,7 @@ function buildAgentPermissions(agent, mcpServers) {
7336
7336
 
7337
7337
  // src/release-metadata.ts
7338
7338
  var PACKAGE_NAME = "@nail00749/agent-gvozd";
7339
- var PACKAGE_VERSION = "0.1.5";
7339
+ var PACKAGE_VERSION = "0.1.7";
7340
7340
  var PACKAGE_SPEC = `${PACKAGE_NAME}@${PACKAGE_VERSION}`;
7341
7341
  var SUPPORTED_OPENCODE_VERSION = "2.0.2";
7342
7342
  var CONFIG_SCHEMA_VERSION = 2;
@@ -7435,15 +7435,16 @@ function redactDiagnostic(error) {
7435
7435
  import { spawn } from "node:child_process";
7436
7436
  import { isAbsolute as isAbsolute4 } from "node:path";
7437
7437
  var MAX_OUTPUT_BYTES = 64 * 1024;
7438
+ var AGENT_OUTPUT_BYTES = 4 * 1024 * 1024;
7438
7439
  var DEFAULT_TIMEOUT_MS = 15000;
7439
- function appendBounded(current, chunk) {
7440
- if (Buffer.byteLength(current) >= MAX_OUTPUT_BYTES)
7441
- return current;
7442
- const remaining = MAX_OUTPUT_BYTES - Buffer.byteLength(current);
7443
- return current + chunk.subarray(0, remaining).toString("utf8");
7444
- }
7445
7440
  var defaultProcessRunner = {
7446
- run(executable, args, timeoutMs = DEFAULT_TIMEOUT_MS) {
7441
+ run(executable, args, timeoutMs = DEFAULT_TIMEOUT_MS, maxOutputBytes = MAX_OUTPUT_BYTES) {
7442
+ const appendBounded = (current, chunk) => {
7443
+ if (Buffer.byteLength(current) >= maxOutputBytes)
7444
+ return current;
7445
+ const remaining = maxOutputBytes - Buffer.byteLength(current);
7446
+ return current + chunk.subarray(0, remaining).toString("utf8");
7447
+ };
7447
7448
  return new Promise((resolve, reject) => {
7448
7449
  const grouped = process.platform !== "win32";
7449
7450
  const child = spawn(executable, [...args], {
@@ -7540,16 +7541,16 @@ var defaultProcessRunner = {
7540
7541
  });
7541
7542
  }
7542
7543
  };
7543
- function bounded(value) {
7544
- return Buffer.from(value).subarray(0, MAX_OUTPUT_BYTES).toString("utf8");
7544
+ function bounded(value, maxOutputBytes = MAX_OUTPUT_BYTES) {
7545
+ return Buffer.from(value).subarray(0, maxOutputBytes).toString("utf8");
7545
7546
  }
7546
- async function checked(runner, executable, args, timeoutMs) {
7547
- const result = await runner.run(executable, args, timeoutMs);
7547
+ async function checked(runner, executable, args, timeoutMs, maxOutputBytes) {
7548
+ const result = await runner.run(executable, args, timeoutMs, maxOutputBytes);
7548
7549
  if (result.code !== 0) {
7549
7550
  const detail = redactDiagnostic(bounded(result.stderr).trim());
7550
7551
  throw new Error(`OpenCode command exited ${result.code}${detail ? `: ${detail}` : ""}`);
7551
7552
  }
7552
- return bounded(result.stdout);
7553
+ return bounded(result.stdout, maxOutputBytes);
7553
7554
  }
7554
7555
  function parseDebugPaths(output) {
7555
7556
  const paths = {};
@@ -7567,6 +7568,16 @@ function parseDebugPaths(output) {
7567
7568
  function parseOpenCodeVersion(output) {
7568
7569
  return output.match(/(?:^|\s)v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)(?=$|\s)/)?.[1];
7569
7570
  }
7571
+ function parseAgentIdentifiers(output) {
7572
+ try {
7573
+ const parsed = JSON.parse(output);
7574
+ if (!Array.isArray(parsed))
7575
+ return output.trim();
7576
+ return parsed.map((entry) => entry && typeof entry === "object" && ("id" in entry) ? String(entry.id) : "").filter(Boolean).join(" ");
7577
+ } catch {
7578
+ return output.trim();
7579
+ }
7580
+ }
7570
7581
  function createClient(executable, runner) {
7571
7582
  return {
7572
7583
  executable,
@@ -7588,8 +7599,9 @@ function createClient(executable, runner) {
7588
7599
  pluginCheck(spec) {
7589
7600
  return checked(runner, executable, spec ? ["plugin", "check", spec] : ["plugin", "check"], 30000);
7590
7601
  },
7591
- debugAgents() {
7592
- return checked(runner, executable, ["debug", "agents"]);
7602
+ async debugAgents() {
7603
+ const raw = await checked(runner, executable, ["debug", "agents"], 60000, AGENT_OUTPUT_BYTES);
7604
+ return parseAgentIdentifiers(raw);
7593
7605
  },
7594
7606
  serviceStatus() {
7595
7607
  return checked(runner, executable, ["service", "status"]);
@@ -8690,7 +8702,16 @@ function syncAgentsUnlocked(config, options) {
8690
8702
  }
8691
8703
  const pluginTarget = join9(pluginDestination, "index.ts");
8692
8704
  const pluginContent = renderPluginEntrypoint(config, pluginDestination);
8693
- if (!assertRegularFile(pluginTarget)) {
8705
+ if (!options.devPlugin) {
8706
+ if (assertRegularFile(pluginTarget)) {
8707
+ const current = readFileSync8(pluginTarget, "utf8");
8708
+ if (hasGeneratedPluginMarker(current)) {
8709
+ result.removed.push(pluginTarget);
8710
+ removals.set(pluginTarget, current);
8711
+ options.onDiff?.(renderDiff(pluginTarget, current, ""));
8712
+ }
8713
+ }
8714
+ } else if (!assertRegularFile(pluginTarget)) {
8694
8715
  result.created.push(pluginTarget);
8695
8716
  pluginWrite = { target: pluginTarget, content: pluginContent, replace: false };
8696
8717
  } else {
@@ -8711,11 +8732,12 @@ function syncAgentsUnlocked(config, options) {
8711
8732
  const writablePluginDestination = safeDirectory(config.projectRoot, [".opencode", "plugins", "agent-gvozd"], true);
8712
8733
  for (const target of result.removed) {
8713
8734
  if (!assertRegularFile(target)) {
8714
- throw new Error(`Refusing to remove a changed or unsafe agent file: ${target}`);
8735
+ throw new Error(`Refusing to remove a changed or unsafe generated file: ${target}`);
8715
8736
  }
8716
8737
  const current = readFileSync8(target, "utf8");
8717
- if (!hasGeneratedAgentMarker(current) || current !== removals.get(target)) {
8718
- throw new Error(`Refusing to remove a concurrently changed agent file: ${target}`);
8738
+ const generated = target.endsWith("index.ts") ? hasGeneratedPluginMarker(current) : hasGeneratedAgentMarker(current);
8739
+ if (!generated || current !== removals.get(target)) {
8740
+ throw new Error(`Refusing to remove a concurrently changed generated file: ${target}`);
8719
8741
  }
8720
8742
  unlinkSync4(target);
8721
8743
  }
@@ -8806,7 +8828,8 @@ var HELP = [
8806
8828
  " setup [--yes] Install or upgrade the global agent team",
8807
8829
  " config [--yes] Configure model preferences",
8808
8830
  " doctor [--json] Diagnose the global installation",
8809
- " sync [--check] Maintain the legacy project-local installation",
8831
+ " sync [--check] [--dev-plugin] Maintain the project-local installation",
8832
+ " --dev-plugin also writes the local plugin entrypoint (dev repositories only)",
8810
8833
  " trust-project [directory] Print the current project trust token",
8811
8834
  "",
8812
8835
  "Options:",
@@ -8876,12 +8899,13 @@ async function runCli(args, io = defaultIO, commands = { setup: runSetup, config
8876
8899
  return report.status === "fail" ? 1 : 0;
8877
8900
  }
8878
8901
  if (command === "sync") {
8879
- const parsed = parseFlags(rest, ["--check"]);
8902
+ const parsed = parseFlags(rest, ["--check", "--dev-plugin"]);
8880
8903
  if (!parsed || parsed.positional.length > 1)
8881
8904
  return usage(io);
8882
8905
  const check = parsed.flags.has("--check");
8906
+ const devPlugin = parsed.flags.has("--dev-plugin");
8883
8907
  const config = loadConfig(parsed.positional[0] ?? io.cwd());
8884
- const result = syncAgents(config, { check, onDiff: (diff) => io.stdout(`${diff}
8908
+ const result = syncAgents(config, { check, devPlugin, onDiff: (diff) => io.stdout(`${diff}
8885
8909
  `) });
8886
8910
  io.stdout(formatSyncResult(result, check));
8887
8911
  return check && result.created.length + result.updated.length + result.removed.length > 0 ? 1 : 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nail00749/agent-gvozd",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "A globally configured, permission-aware agent team for OpenCode V2",
5
5
  "license": "MIT",
6
6
  "keywords": [