@mifune/agro 0.17.0 → 0.18.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 (2) hide show
  1. package/dist/agro.js +84 -3
  2. package/package.json +1 -1
package/dist/agro.js CHANGED
@@ -2251,7 +2251,7 @@ function resolveExecutionTarget(opts) {
2251
2251
  }
2252
2252
 
2253
2253
  // src/lib/version.ts
2254
- var AGRO_VERSION = true ? "0.17.0" : "0.0.0-dev";
2254
+ var AGRO_VERSION = true ? "0.18.0" : "0.0.0-dev";
2255
2255
  var OFFICIAL_IMAGE = "ghcr.io/mifunedev/agro";
2256
2256
  var RELEASE_VERSION = /^[0-9]+\.[0-9]+\.[0-9]+(?:-[a-z][a-z0-9]*\.[0-9]+)?$/;
2257
2257
  function parseReleaseVersion(value) {
@@ -3206,6 +3206,21 @@ var HARNESS_CATALOG = [
3206
3206
  kind: "installable",
3207
3207
  bypassPermissionsFlag: "--dangerously-skip-permissions"
3208
3208
  },
3209
+ {
3210
+ id: "fx",
3211
+ title: "fx",
3212
+ binary: "fx",
3213
+ installArgv: [
3214
+ "bash",
3215
+ "-lc",
3216
+ `set -o pipefail; curl -fsSL https://fx.sh/setup.sh | FX_INSTALL_DIR="${HARNESS_PREFIX_TOKEN}/bin" bash -s v0.0.13`
3217
+ ],
3218
+ installUser: "sandbox",
3219
+ verifyArgv: ["fx", "--version"],
3220
+ uninstallArgv: ["rm", "-f", `${HARNESS_PREFIX_TOKEN}/bin/fx`],
3221
+ docsPath: "docs/harnesses/fx.md",
3222
+ kind: "installable"
3223
+ },
3209
3224
  {
3210
3225
  id: "t3code",
3211
3226
  title: "T3 Code",
@@ -4899,6 +4914,13 @@ async function runHarnessStatus(name, opts, io) {
4899
4914
  function hermesTargetRoot(target) {
4900
4915
  return target.kind === "docker-compose" ? "/home/sandbox/harness" : target.workspace.targetRoot;
4901
4916
  }
4917
+ function shellPath(path4) {
4918
+ return `'${path4.replaceAll("'", "'\\''")}'`;
4919
+ }
4920
+ function hermesLaunch(io, root) {
4921
+ io.stdout(`Run Hermes in the AGRO workspace: HERMES_HOME=${shellPath(`${root}/.hermes`)} hermes
4922
+ `);
4923
+ }
4902
4924
  function hermesEnv(root) {
4903
4925
  return { ...agroEnvPair("PROJECT_ROOT", root), HERMES_HOME: `${root}/.hermes` };
4904
4926
  }
@@ -4915,6 +4937,43 @@ async function reconcileHermes(target, io, bin, user, root = hermesTargetRoot(ta
4915
4937
  }
4916
4938
  return result.exitCode;
4917
4939
  }
4940
+ async function validateHermesHome(target, io, bin, user, inheritedHome, root = hermesTargetRoot(target)) {
4941
+ const result = await target.exec({
4942
+ argv: remoteControlDirScript(root, "scripts/hermes-workspace.sh", [
4943
+ "check",
4944
+ root,
4945
+ `${root}/.hermes`,
4946
+ inheritedHome ?? ""
4947
+ ]),
4948
+ env: hermesEnv(root),
4949
+ ...user ? { user } : {},
4950
+ stdio: "capture"
4951
+ });
4952
+ if (result.exitCode !== 0) {
4953
+ io.stderr(result.stderr || `${bin} harness: could not validate Hermes runtime home; explicitly select HERMES_HOME=${shellPath(`${root}/.hermes`)} before retrying.
4954
+ `);
4955
+ }
4956
+ return result.exitCode;
4957
+ }
4958
+ async function configureHermes(target, io, bin, user, root = hermesTargetRoot(target)) {
4959
+ const result = await target.exec({
4960
+ argv: remoteControlDirScript(root, "scripts/hermes-workspace.sh", [
4961
+ "configure",
4962
+ root,
4963
+ `${root}/.hermes`,
4964
+ root,
4965
+ "hermes"
4966
+ ]),
4967
+ env: hermesEnv(root),
4968
+ ...user ? { user } : {},
4969
+ stdio: "inherit"
4970
+ });
4971
+ if (result.exitCode !== 0) {
4972
+ io.stderr(`${bin} harness: Hermes workspace configuration failed (exit ${result.exitCode}); run HERMES_HOME=${shellPath(`${root}/.hermes`)} hermes config set terminal.cwd ${shellPath(root)}
4973
+ `);
4974
+ }
4975
+ return result.exitCode;
4976
+ }
4918
4977
  function unreachableReason(status) {
4919
4978
  return runtimeIsAbsent(status) ? "No container runtime is on PATH." : `The sandbox is not running (${status}).`;
4920
4979
  }
@@ -4990,6 +5049,11 @@ async function installOnHost(entry, opts, io, run, status) {
4990
5049
  `);
4991
5050
  const prefix = hostPrefix(home);
4992
5051
  const target = hostTargetFor(root, prefix, run, env);
5052
+ const hermes = entry.id === "hermes";
5053
+ if (hermes) {
5054
+ const code = await validateHermesHome(target, io, bin, void 0, env.HERMES_HOME, root);
5055
+ if (code !== 0) return code;
5056
+ }
4993
5057
  const linked = await target.exec({
4994
5058
  argv: remoteControlDirScript(root, "scripts/link-providers.sh", ["--init"]),
4995
5059
  env: agroEnvPair("PROJECT_ROOT", root),
@@ -5003,7 +5067,6 @@ Run: bash ${root}/.agro/scripts/link-providers.sh --init
5003
5067
  );
5004
5068
  return 1;
5005
5069
  }
5006
- const hermes = entry.id === "hermes";
5007
5070
  const installEnv = hermes ? hermesEnv(root) : void 0;
5008
5071
  if (hermes) {
5009
5072
  const code = await reconcileHermes(target, io, bin, void 0, root);
@@ -5018,6 +5081,10 @@ Run: bash ${root}/.agro/scripts/link-providers.sh --init
5018
5081
  return 1;
5019
5082
  }
5020
5083
  if (await probeInstalled(target, entry, prefix, void 0, installEnv) === true && (hasReceipt || !hostBinaryUnderPrefix(entry, prefix))) {
5084
+ if (hermes) {
5085
+ const code = await configureHermes(target, io, bin, void 0, root);
5086
+ if (code !== 0) return code;
5087
+ }
5021
5088
  io.stdout(`${entry.id}: already installed (${entry.binary})
5022
5089
  `);
5023
5090
  try {
@@ -5027,6 +5094,7 @@ Run: bash ${root}/.agro/scripts/link-providers.sh --init
5027
5094
  `);
5028
5095
  return 1;
5029
5096
  }
5097
+ if (hermes) hermesLaunch(io, root);
5030
5098
  return 0;
5031
5099
  }
5032
5100
  io.stdout(`installing ${entry.title} on the host\u2026
@@ -5049,6 +5117,8 @@ Run: bash ${root}/.agro/scripts/link-providers.sh --init
5049
5117
  }
5050
5118
  const code = await reconcileHermes(target, io, bin, void 0, root);
5051
5119
  if (code !== 0) return code;
5120
+ const configured = await configureHermes(target, io, bin, void 0, root);
5121
+ if (configured !== 0) return configured;
5052
5122
  }
5053
5123
  const receipt = {
5054
5124
  prefix,
@@ -5079,7 +5149,8 @@ Run: bash ${root}/.agro/scripts/link-providers.sh --init
5079
5149
  io.stdout(`Add this line to your shell profile: export PATH="${harnessBinPath(prefix)}:$PATH"
5080
5150
  `);
5081
5151
  }
5082
- io.stdout(`Run ${entry.title} in the AGRO workspace: cd ${root} && ${harnessLaunchCommand(entry)}
5152
+ if (hermes) hermesLaunch(io, root);
5153
+ else io.stdout(`Run ${entry.title} in the AGRO workspace: cd ${root} && ${harnessLaunchCommand(entry)}
5083
5154
  `);
5084
5155
  return 0;
5085
5156
  }
@@ -5213,13 +5284,20 @@ async function runHarnessInstall(name, opts, io) {
5213
5284
  const hermes = entry.id === "hermes";
5214
5285
  const installEnv = hermes ? hermesEnv(hermesTargetRoot(target)) : void 0;
5215
5286
  if (hermes) {
5287
+ const checked = await validateHermesHome(target, io, opts.bin, "sandbox", env.HERMES_HOME);
5288
+ if (checked !== 0) return checked;
5216
5289
  const code = await reconcileHermes(target, io, opts.bin, "sandbox");
5217
5290
  if (code !== 0) return code;
5218
5291
  }
5219
5292
  const already = await probeInstalled(target, entry, SANDBOX_HARNESS_PREFIX, "sandbox", installEnv);
5220
5293
  if (already === true && await sandboxMarkerExists(target, entry)) {
5294
+ if (hermes) {
5295
+ const code = await configureHermes(target, io, opts.bin, "sandbox");
5296
+ if (code !== 0) return code;
5297
+ }
5221
5298
  io.stdout(`${entry.id}: already installed (${entry.binary})
5222
5299
  `);
5300
+ if (hermes) hermesLaunch(io, hermesTargetRoot(target));
5223
5301
  return 0;
5224
5302
  }
5225
5303
  if (already === null) {
@@ -5247,6 +5325,8 @@ async function runHarnessInstall(name, opts, io) {
5247
5325
  }
5248
5326
  const code = await reconcileHermes(target, io, opts.bin, "sandbox");
5249
5327
  if (code !== 0) return code;
5328
+ const configured = await configureHermes(target, io, opts.bin, "sandbox");
5329
+ if (configured !== 0) return configured;
5250
5330
  }
5251
5331
  const marker = sandboxMarkerPath(entry);
5252
5332
  const marked = await target.exec({
@@ -5261,6 +5341,7 @@ async function runHarnessInstall(name, opts, io) {
5261
5341
  }
5262
5342
  io.stdout(`${entry.id}: installed \u2014 see ${sourceDocsUrl(entry.docsPath)} for authentication
5263
5343
  `);
5344
+ if (hermes) hermesLaunch(io, hermesTargetRoot(target));
5264
5345
  return 0;
5265
5346
  }
5266
5347
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mifune/agro",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "AGRO CLI — create and manage sandboxes for coding agents.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mifunedev/agro#readme",