@mifune/agro 0.16.2 → 0.17.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 +27 -15
  2. package/package.json +1 -1
package/dist/agro.js CHANGED
@@ -1985,12 +1985,25 @@ import { basename as basename4, join as join5, sep as sep3 } from "node:path";
1985
1985
 
1986
1986
  // src/lib/execution/detect.ts
1987
1987
  import { existsSync as existsSync9 } from "node:fs";
1988
- var SANDBOX_MARKER_FILE = "/.dockerenv";
1989
- function runningInsideSandbox(env = process.env, fileExists = existsSync9) {
1988
+ var SANDBOX_MARKER_FILE = "/etc/agro/sandbox";
1989
+ var DOCKERENV_FILE = "/.dockerenv";
1990
+ function detectSandbox(env = process.env, fileExists = existsSync9) {
1990
1991
  const override = agroEnvValue(env, "EXECUTION_TARGET");
1991
- if (override === "local") return true;
1992
- if (override === "docker-compose") return false;
1993
- return fileExists(SANDBOX_MARKER_FILE) && (env.SANDBOX_NAME ?? "") !== "";
1992
+ if (override === "local") return { inside: true, rule: "override" };
1993
+ if (override === "docker-compose") return { inside: false, rule: "override" };
1994
+ if (fileExists(SANDBOX_MARKER_FILE)) return { inside: true, rule: "marker" };
1995
+ if (fileExists(DOCKERENV_FILE) && (env.SANDBOX_NAME ?? "") !== "") {
1996
+ return { inside: true, rule: "fallback" };
1997
+ }
1998
+ return { inside: false, rule: "none" };
1999
+ }
2000
+ function runningInsideSandbox(env = process.env, fileExists = existsSync9) {
2001
+ return detectSandbox(env, fileExists).inside;
2002
+ }
2003
+ function sandboxFallbackWarning(env = process.env, fileExists = existsSync9) {
2004
+ if (detectSandbox(env, fileExists).rule !== "fallback") return void 0;
2005
+ return `agro: warning: ${SANDBOX_MARKER_FILE} is missing; detected the sandbox from ${DOCKERENV_FILE} and SANDBOX_NAME. Upgrade the sandbox image.
2006
+ `;
1994
2007
  }
1995
2008
 
1996
2009
  // src/lib/execution/docker-compose-target.ts
@@ -2238,7 +2251,7 @@ function resolveExecutionTarget(opts) {
2238
2251
  }
2239
2252
 
2240
2253
  // src/lib/version.ts
2241
- var AGRO_VERSION = true ? "0.16.2" : "0.0.0-dev";
2254
+ var AGRO_VERSION = true ? "0.17.0" : "0.0.0-dev";
2242
2255
  var OFFICIAL_IMAGE = "ghcr.io/mifunedev/agro";
2243
2256
  var RELEASE_VERSION = /^[0-9]+\.[0-9]+\.[0-9]+(?:-[a-z][a-z0-9]*\.[0-9]+)?$/;
2244
2257
  function parseReleaseVersion(value) {
@@ -4886,10 +4899,13 @@ async function runHarnessStatus(name, opts, io) {
4886
4899
  function hermesTargetRoot(target) {
4887
4900
  return target.kind === "docker-compose" ? "/home/sandbox/harness" : target.workspace.targetRoot;
4888
4901
  }
4902
+ function hermesEnv(root) {
4903
+ return { ...agroEnvPair("PROJECT_ROOT", root), HERMES_HOME: `${root}/.hermes` };
4904
+ }
4889
4905
  async function reconcileHermes(target, io, bin, user, root = hermesTargetRoot(target)) {
4890
4906
  const result = await target.exec({
4891
4907
  argv: remoteControlDirScript(root, "scripts/link-providers.sh", ["--init", "--hermes-only"]),
4892
- env: agroEnvPair("PROJECT_ROOT", root),
4908
+ env: hermesEnv(root),
4893
4909
  ...user ? { user } : {},
4894
4910
  stdio: "inherit"
4895
4911
  });
@@ -4988,10 +5004,7 @@ Run: bash ${root}/.agro/scripts/link-providers.sh --init
4988
5004
  return 1;
4989
5005
  }
4990
5006
  const hermes = entry.id === "hermes";
4991
- const installEnv = hermes ? {
4992
- ...agroEnvPair("PROJECT_ROOT", root),
4993
- HERMES_HOME: `${root}/.hermes`
4994
- } : void 0;
5007
+ const installEnv = hermes ? hermesEnv(root) : void 0;
4995
5008
  if (hermes) {
4996
5009
  const code = await reconcileHermes(target, io, bin, void 0, root);
4997
5010
  if (code !== 0) return code;
@@ -5198,10 +5211,7 @@ async function runHarnessInstall(name, opts, io) {
5198
5211
  return await installOnHost(entry, opts, io, run, status);
5199
5212
  }
5200
5213
  const hermes = entry.id === "hermes";
5201
- const installEnv = hermes ? {
5202
- ...agroEnvPair("PROJECT_ROOT", hermesTargetRoot(target)),
5203
- HERMES_HOME: `${hermesTargetRoot(target)}/.hermes`
5204
- } : void 0;
5214
+ const installEnv = hermes ? hermesEnv(hermesTargetRoot(target)) : void 0;
5205
5215
  if (hermes) {
5206
5216
  const code = await reconcileHermes(target, io, opts.bin, "sandbox");
5207
5217
  if (code !== 0) return code;
@@ -7372,6 +7382,8 @@ async function main(argv) {
7372
7382
  return 0;
7373
7383
  }
7374
7384
  if (!Object.hasOwn(AGRO_COMMANDS, first)) return unknownCommand(first, product);
7385
+ const fallbackWarning = sandboxFallbackWarning();
7386
+ if (fallbackWarning !== void 0) process.stderr.write(fallbackWarning);
7375
7387
  if (first === "config") {
7376
7388
  const parsed = parseConfigArgs(argv.slice(1), bin);
7377
7389
  if (!parsed.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mifune/agro",
3
- "version": "0.16.2",
3
+ "version": "0.17.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",