@lazyingart/agintiflow 0.20.121 → 0.20.122

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazyingart/agintiflow",
3
- "version": "0.20.121",
3
+ "version": "0.20.122",
4
4
  "type": "module",
5
5
  "description": "AgInTiFlow is a project-aware agent workspace for hybrid wet-dry R&D, hardware-aware intelligence, software automation, and industrial workflows.",
6
6
  "license": "Apache-2.0",
@@ -746,6 +746,30 @@ try {
746
746
  throw new Error("resume history should render full saved messages instead of compact previews");
747
747
  }
748
748
 
749
+ const explicitCwd = path.join(tempRoot, "explicit-cwd");
750
+ await fs.mkdir(explicitCwd, { recursive: true });
751
+ await runCli([
752
+ "--no-auto-update",
753
+ "--provider",
754
+ "mock",
755
+ "--routing",
756
+ "manual",
757
+ "--cwd",
758
+ explicitCwd,
759
+ "--sandbox-mode",
760
+ "host",
761
+ "--allow-file-tools",
762
+ "Create reports/cwd-smoke.md with a one-line cwd smoke note.",
763
+ ], "");
764
+ const explicitCwdOutput = path.join(explicitCwd, "reports", "cwd-smoke.md");
765
+ const wrongCwdOutput = path.join(tempRoot, "reports", "cwd-smoke.md");
766
+ if (!(await fs.stat(explicitCwdOutput).then((stat) => stat.isFile()).catch(() => false))) {
767
+ throw new Error("one-shot --cwd did not write into the explicit command cwd");
768
+ }
769
+ if (await fs.stat(wrongCwdOutput).then((stat) => stat.isFile()).catch(() => false)) {
770
+ throw new Error("one-shot --cwd wrote into the process cwd instead of the explicit command cwd");
771
+ }
772
+
749
773
  await runTmuxInterruptSmoke({ key: "Escape", expected: /Active run stopped|Session saved/ });
750
774
  await runTmuxInterruptSmoke({ key: "C-c", expected: /EXIT:130|Session stopped by ctrl-c|Interrupted\. Session saved/ });
751
775
 
@@ -787,6 +811,7 @@ try {
787
811
  "interactive-chat",
788
812
  "mock-file-write",
789
813
  "run-status",
814
+ "one-shot-cwd",
790
815
  "tmux-escape-active-run-stop",
791
816
  "tmux-ctrl-c-session-stop",
792
817
  "resume-latest",
@@ -65,6 +65,16 @@ async function main() {
65
65
  assert(parsedDanger.sandboxMode === "host", "danger should set host sandbox");
66
66
  assert(parsedDanger.allowDestructive === true, "danger should allow destructive shell");
67
67
  assert(parsedDanger.allowOutsideWorkspaceFileTools === true, "danger should allow outside workspace file tools");
68
+ const explicitPackageBeforeSafety = parseArgs(["--package-install-policy", "block", "-s", "normal", "--provider", "mock", "hello"]);
69
+ assert(
70
+ explicitPackageBeforeSafety.packageInstallPolicy === "block",
71
+ "CLI -s normal should not override an explicit earlier --package-install-policy block"
72
+ );
73
+ const explicitSandboxBeforeSafety = parseArgs(["--sandbox-mode", "docker-readonly", "-s", "danger", "--provider", "mock", "hello"]);
74
+ assert(
75
+ explicitSandboxBeforeSafety.sandboxMode === "docker-readonly",
76
+ "CLI -s danger should not override an explicit earlier --sandbox-mode docker-readonly"
77
+ );
68
78
 
69
79
  const safe = configFor("safe");
70
80
  assert(safe.permissionMode === "safe", "runtime safe mode not set");
package/src/cli.js CHANGED
@@ -513,7 +513,7 @@ export function parseArgs(argv) {
513
513
  }
514
514
  if (arg === "-s" || arg === "--safety" || arg === "--permission-mode") {
515
515
  const mode = normalizePermissionMode(readOption(argv, i), "");
516
- if (mode) applyPermissionMode(result, mode, { override: true });
516
+ if (mode) applyPermissionMode(result, mode, { override: false });
517
517
  i += 1;
518
518
  continue;
519
519
  }
@@ -1606,19 +1606,20 @@ export async function main(argv = process.argv.slice(2)) {
1606
1606
  if (commandArgv[0] === "doctor") {
1607
1607
  const parsed = parseArgs(commandArgv.slice(1).filter((arg) => arg !== "--json" && arg !== "--capabilities"));
1608
1608
  exitOnUnknownOptions(parsed);
1609
+ const effectiveCommandCwd = parsed.commandCwd || commandCwd;
1609
1610
  const config = loadConfig(
1610
1611
  {
1611
1612
  ...parsed,
1612
1613
  goal: "doctor",
1613
- commandCwd,
1614
+ commandCwd: effectiveCommandCwd,
1614
1615
  allowShellTool: parsed.allowShellTool ?? true,
1615
1616
  allowFileTools: parsed.allowFileTools ?? true,
1616
1617
  },
1617
- { packageDir, baseDir: commandCwd }
1618
+ { packageDir, baseDir: effectiveCommandCwd }
1618
1619
  );
1619
1620
  const report = commandArgv.includes("--capabilities")
1620
- ? await buildCapabilityReport(commandCwd, packageJson.version, config)
1621
- : await doctorReport(commandCwd, packageJson.version, config);
1621
+ ? await buildCapabilityReport(effectiveCommandCwd, packageJson.version, config)
1622
+ : await doctorReport(effectiveCommandCwd, packageJson.version, config);
1622
1623
  if (commandArgv.includes("--json")) console.log(JSON.stringify(report, null, 2));
1623
1624
  else if (commandArgv.includes("--capabilities")) printCapabilityReport(report);
1624
1625
  else printDoctorReport(report);
@@ -1628,17 +1629,18 @@ export async function main(argv = process.argv.slice(2)) {
1628
1629
  if (commandArgv[0] === "capabilities") {
1629
1630
  const parsed = parseArgs(commandArgv.slice(1).filter((arg) => arg !== "--json"));
1630
1631
  exitOnUnknownOptions(parsed);
1632
+ const effectiveCommandCwd = parsed.commandCwd || commandCwd;
1631
1633
  const config = loadConfig(
1632
1634
  {
1633
1635
  ...parsed,
1634
1636
  goal: "capabilities",
1635
- commandCwd,
1637
+ commandCwd: effectiveCommandCwd,
1636
1638
  allowShellTool: parsed.allowShellTool ?? true,
1637
1639
  allowFileTools: parsed.allowFileTools ?? true,
1638
1640
  },
1639
- { packageDir, baseDir: commandCwd }
1641
+ { packageDir, baseDir: effectiveCommandCwd }
1640
1642
  );
1641
- const report = await buildCapabilityReport(commandCwd, packageJson.version, config);
1643
+ const report = await buildCapabilityReport(effectiveCommandCwd, packageJson.version, config);
1642
1644
  if (commandArgv.includes("--json")) console.log(JSON.stringify(report, null, 2));
1643
1645
  else printCapabilityReport(report);
1644
1646
  return;
@@ -1732,7 +1734,7 @@ export async function main(argv = process.argv.slice(2)) {
1732
1734
  if (!prompt) {
1733
1735
  const parsedResumeOptions = parseArgs(resumeOptions.optionArgv);
1734
1736
  exitOnUnknownOptions(parsedResumeOptions);
1735
- await startInteractiveCli(agentDefaults({ ...parsedResumeOptions, resume: sessionId, commandCwd }), {
1737
+ await startInteractiveCli(agentDefaults({ ...parsedResumeOptions, resume: sessionId, commandCwd: parsedResumeOptions.commandCwd || commandCwd }), {
1736
1738
  packageDir,
1737
1739
  packageVersion: packageJson.version,
1738
1740
  });
@@ -1740,14 +1742,15 @@ export async function main(argv = process.argv.slice(2)) {
1740
1742
  }
1741
1743
  const parsedResumeArgs = parseArgs([...resumeOptions.optionArgv, prompt]);
1742
1744
  exitOnUnknownOptions(parsedResumeArgs);
1743
- const resumeArgs = agentDefaults({ ...parsedResumeArgs, resume: sessionId, goal: prompt, commandCwd });
1745
+ const resumeArgs = agentDefaults({ ...parsedResumeArgs, resume: sessionId, goal: prompt, commandCwd: parsedResumeArgs.commandCwd || commandCwd });
1744
1746
  if (!(await ensureDeepSeekKeyForOneShot(resumeArgs))) process.exit(1);
1745
1747
  const config = loadConfig(resumeArgs, { packageDir });
1746
1748
  await runAgent(config);
1747
1749
  return;
1748
1750
  }
1749
1751
 
1750
- const args = { ...parseArgs(commandArgv), commandCwd };
1752
+ const parsedArgs = parseArgs(commandArgv);
1753
+ const args = { ...parsedArgs, commandCwd: parsedArgs.commandCwd || commandCwd };
1751
1754
  exitOnUnknownOptions(args);
1752
1755
 
1753
1756
  if (args.web) {