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 +16 -9
- package/dist/tools/screenshot.js +10 -2
- package/package.json +1 -1
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
|
-
.
|
|
63
|
-
|
|
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: ${
|
|
76
|
-
|
|
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(
|
|
252
|
-
fs.mkdirSync(
|
|
258
|
+
if (!fs.existsSync(targetDir)) {
|
|
259
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
253
260
|
}
|
|
254
|
-
fs.writeFileSync(
|
|
255
|
-
console.log(chalk.green(`\nā
Configuration saved to ${
|
|
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) {
|
package/dist/tools/screenshot.js
CHANGED
|
@@ -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
|
|
159
|
-
|
|
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
|