autoclaw 1.0.29 → 1.0.31

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/dist/index.js CHANGED
@@ -59,8 +59,9 @@ program
59
59
  program
60
60
  .command('setup')
61
61
  .description('Run the interactive setup wizard to configure API keys')
62
- .action(async () => {
63
- await runSetup();
62
+ .option('-p, --project', 'Save configuration to project-level (.autoclaw/setting.json)')
63
+ .action(async (options) => {
64
+ await runSetup(options);
64
65
  });
65
66
  program
66
67
  .command('chat [query...]', { isDefault: true })
@@ -70,10 +71,16 @@ program
70
71
  await runChat(queryParts, options);
71
72
  });
72
73
  program.parse(process.argv);
73
- async function runSetup() {
74
+ async function runSetup(options = {}) {
75
+ const isProject = options.project;
76
+ const targetFile = isProject ? LOCAL_CONFIG_FILE : GLOBAL_CONFIG_FILE;
77
+ const targetDir = isProject ? path.join(process.cwd(), '.autoclaw') : GLOBAL_CONFIG_DIR;
74
78
  console.log(chalk.bold.cyan("AutoClaw Setup Wizard šŸ¦ž\n"));
75
- console.log(chalk.dim(`Config will be saved to: ${GLOBAL_CONFIG_FILE}`));
76
- const currentConfig = loadJsonConfig(GLOBAL_CONFIG_FILE);
79
+ console.log(chalk.dim(`Config will be saved to: ${targetFile}`));
80
+ // Load both to show current effective values as defaults
81
+ const globalConfig = loadJsonConfig(GLOBAL_CONFIG_FILE);
82
+ const localConfig = loadJsonConfig(LOCAL_CONFIG_FILE);
83
+ const currentConfig = { ...globalConfig, ...localConfig };
77
84
  function maskSecret(secret) {
78
85
  if (!secret || secret.length < 8)
79
86
  return '******';
@@ -248,11 +255,11 @@ async function runSetup() {
248
255
  ...notifyConfig
249
256
  };
250
257
  try {
251
- if (!fs.existsSync(GLOBAL_CONFIG_DIR)) {
252
- fs.mkdirSync(GLOBAL_CONFIG_DIR, { recursive: true });
258
+ if (!fs.existsSync(targetDir)) {
259
+ fs.mkdirSync(targetDir, { recursive: true });
253
260
  }
254
- fs.writeFileSync(GLOBAL_CONFIG_FILE, JSON.stringify(newConfig, null, 2), { mode: 0o600 });
255
- console.log(chalk.green(`\nāœ… Configuration saved to ${GLOBAL_CONFIG_FILE}`));
261
+ fs.writeFileSync(targetFile, JSON.stringify(newConfig, null, 2), { mode: 0o600 });
262
+ console.log(chalk.green(`\nāœ… Configuration saved to ${targetFile}`));
256
263
  console.log(chalk.cyan("You can now run 'autoclaw' to start using the agent."));
257
264
  }
258
265
  catch (error) {
@@ -96,6 +96,10 @@ export const ScreenshotTool = {
96
96
  fullPage: {
97
97
  type: "boolean",
98
98
  description: "If true (default), takes a screenshot of the full scrollable page. Set to false for viewport only."
99
+ },
100
+ waitTime: {
101
+ type: "number",
102
+ description: "Optional delay in seconds to wait for page resources to load before capturing (default: 1)."
99
103
  }
100
104
  },
101
105
  required: ["url", "outputPath"]
@@ -155,8 +159,12 @@ export const ScreenshotTool = {
155
159
  });
156
160
  // Wait for fonts to be ready
157
161
  await page.evaluate(() => document.fonts.ready);
158
- // Additional small delay for dynamic content and font rendering
159
- await page.waitForTimeout(1000);
162
+ // Additional delay for dynamic content (user specified or default 1s)
163
+ const waitTimeMs = (args.waitTime || 1) * 1000;
164
+ if (waitTimeMs > 0) {
165
+ console.log(`Waiting for ${waitTimeMs}ms...`);
166
+ await page.waitForTimeout(waitTimeMs);
167
+ }
160
168
  await page.screenshot({
161
169
  path: args.outputPath,
162
170
  fullPage: args.fullPage !== false // Default to true if undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoclaw",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {