autoclaw 1.0.3 ā 1.0.5
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/README.md +34 -14
- package/dist/agent.js +11 -11
- package/dist/index.js +25 -19
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
# AutoClaw š¦
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**The Docker-Native Headless Agent for Massive Scale Automation.**
|
|
4
|
+
|
|
5
|
+
AutoClaw is a hyper-lightweight AI agent designed to live inside **Docker containers**. Unlike heavy, GUI-dependent agents, AutoClaw is built for **headless, massive-scale concurrency**.
|
|
6
|
+
|
|
7
|
+
You can run one instance to fix a local script, or orchestrate **10,000+ instances** in a Kubernetes cluster to refactor codebases, audit servers, or process data streams in parallel.
|
|
8
|
+
|
|
9
|
+
## Why AutoClaw?
|
|
10
|
+
- š³ **Docker Native**: Built to run safely inside containers. Minimal footprint (Node.js/Alpine friendly).
|
|
11
|
+
- š **Massive Scalability**: Text-only, headless design means you can spawn thousands of agents without consuming graphical resources.
|
|
12
|
+
- š”ļø **Sandbox Safety**: Ideal for running untrusted code when isolated in Docker.
|
|
13
|
+
- š **Swarm Ready**: Stateless design allows for easy orchestration via K8s, Docker Swarm, or simple shell loops.
|
|
4
14
|
|
|
5
15
|
## Features
|
|
6
16
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
- š **
|
|
10
|
-
- š§ **Context Aware**:
|
|
11
|
-
- š **Model Agnostic**: Compatible with OpenAI, DeepSeek, LocalLLM, or any OpenAI-compatible API.
|
|
17
|
+
- š **Headless Execution**: No browsers, no GUIs. Pure terminal efficiency.
|
|
18
|
+
- š¤ **Non-Interactive**: Intelligent flag handling (`-y`) for zero-touch automation.
|
|
19
|
+
- š **Universal Control**: From simple file I/O to complex system administration.
|
|
20
|
+
- š§ **Context Aware**: Detects container environments to optimize command strategies.
|
|
12
21
|
|
|
13
22
|
## Installation
|
|
14
23
|
|
|
@@ -43,18 +52,29 @@ npm update -g autoclaw
|
|
|
43
52
|
|
|
44
53
|
## Configuration
|
|
45
54
|
|
|
46
|
-
AutoClaw uses a
|
|
47
|
-
You can also use a local `.env` file in your current directory to override global settings.
|
|
55
|
+
AutoClaw uses a hierarchical configuration system.
|
|
48
56
|
|
|
49
|
-
Priority
|
|
50
|
-
1.
|
|
51
|
-
2.
|
|
52
|
-
3.
|
|
57
|
+
**Priority Order (Highest to Lowest):**
|
|
58
|
+
1. **CLI Arguments**: (e.g., `-m gpt-4o`)
|
|
59
|
+
2. **Environment Variables**: (`OPENAI_API_KEY`, `.env` file)
|
|
60
|
+
3. **Project Config**: (`./.autoclaw/setting.json` in current directory)
|
|
61
|
+
4. **Global Config**: (`~/.autoclaw/setting.json`)
|
|
53
62
|
|
|
54
|
-
Supported Configuration Keys
|
|
63
|
+
### Supported Configuration Keys (JSON)
|
|
55
64
|
- `apiKey`: Your API Key.
|
|
56
65
|
- `baseUrl`: Custom Base URL.
|
|
57
|
-
- `model`: Default model to use
|
|
66
|
+
- `model`: Default model to use.
|
|
67
|
+
|
|
68
|
+
### Project-Level Config (Example)
|
|
69
|
+
Create a file at `.autoclaw/setting.json`:
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"model": "gpt-3.5-turbo",
|
|
73
|
+
"baseUrl": "https://api.example.com/v1"
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
> **ā ļø Security Warning**: If you store your `apiKey` in `.autoclaw/setting.json`, make sure to add `.autoclaw/` to your `.gitignore` file to prevent leaking secrets!
|
|
58
78
|
|
|
59
79
|
## License
|
|
60
80
|
|
package/dist/agent.js
CHANGED
|
@@ -25,22 +25,22 @@ System Information:
|
|
|
25
25
|
this.messages = [
|
|
26
26
|
{
|
|
27
27
|
role: "system",
|
|
28
|
-
content: `You are AutoClaw,
|
|
29
|
-
|
|
30
|
-
You have access to tools to execute shell commands and read/write files.
|
|
28
|
+
content: `You are AutoClaw, a Docker-Native Autonomous Agent designed for massive scale automation.
|
|
29
|
+
You are likely running inside a container or headless server, possibly as one of thousands of parallel units in a swarm.
|
|
31
30
|
|
|
32
31
|
CONTEXT:
|
|
33
32
|
${systemInfo}
|
|
34
33
|
|
|
34
|
+
ENVIRONMENT CONSTRAINTS:
|
|
35
|
+
1. HEADLESS: No GUI available. Do not try to open browsers or apps.
|
|
36
|
+
2. CONTAINER-OPTIMIZED: Assume you are in a sandbox. You can be aggressive with file creation but robust with errors.
|
|
37
|
+
3. NON-INTERACTIVE: Always use flags to suppress prompts (e.g., 'apt-get -y', 'rm -rf').
|
|
38
|
+
|
|
35
39
|
GUIDELINES:
|
|
36
|
-
1.
|
|
37
|
-
2.
|
|
38
|
-
3.
|
|
39
|
-
4.
|
|
40
|
-
5. If you need to write a file, use 'write_file'.
|
|
41
|
-
6. Be concise in your responses.
|
|
42
|
-
7. If the user's request is ambiguous, ask for clarification.
|
|
43
|
-
8. You are running on the user's local machine. Be careful with destructive commands (rm, etc.).
|
|
40
|
+
1. EFFICIENCY: Your goal is speed and success. Write scripts that just work.
|
|
41
|
+
2. ROBUSTNESS: Use standard Linux/Unix tools found in minimal images (Alpine/Debian).
|
|
42
|
+
3. TOOLS: Use 'execute_shell_command' for actions, 'write_file' for code generation.
|
|
43
|
+
4. CLARITY: Output concise logs. You are a worker unit, not a chat bot.
|
|
44
44
|
`
|
|
45
45
|
}
|
|
46
46
|
];
|
package/dist/index.js
CHANGED
|
@@ -8,15 +8,16 @@ import * as fs from 'fs';
|
|
|
8
8
|
import * as path from 'path';
|
|
9
9
|
import * as os from 'os';
|
|
10
10
|
import { fileURLToPath } from 'url';
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const GLOBAL_CONFIG_DIR = path.join(os.homedir(), '.autoclaw');
|
|
12
|
+
const GLOBAL_CONFIG_FILE = path.join(GLOBAL_CONFIG_DIR, 'setting.json');
|
|
13
|
+
const LOCAL_CONFIG_FILE = path.join(process.cwd(), '.autoclaw', 'setting.json');
|
|
14
|
+
function loadJsonConfig(filePath) {
|
|
15
|
+
if (fs.existsSync(filePath)) {
|
|
15
16
|
try {
|
|
16
|
-
return JSON.parse(fs.readFileSync(
|
|
17
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
|
17
18
|
}
|
|
18
19
|
catch (e) {
|
|
19
|
-
console.error(chalk.
|
|
20
|
+
console.error(chalk.yellow(`Warning: Failed to parse config file at ${filePath}`));
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
return {};
|
|
@@ -55,8 +56,8 @@ program
|
|
|
55
56
|
program.parse(process.argv);
|
|
56
57
|
async function runSetup() {
|
|
57
58
|
console.log(chalk.bold.cyan("AutoClaw Setup Wizard š¦\n"));
|
|
58
|
-
console.log(chalk.dim(`Config will be saved to: ${
|
|
59
|
-
const currentConfig =
|
|
59
|
+
console.log(chalk.dim(`Config will be saved to: ${GLOBAL_CONFIG_FILE}`));
|
|
60
|
+
const currentConfig = loadJsonConfig(GLOBAL_CONFIG_FILE);
|
|
60
61
|
const answers = await inquirer.prompt([
|
|
61
62
|
{
|
|
62
63
|
type: 'password',
|
|
@@ -85,11 +86,11 @@ async function runSetup() {
|
|
|
85
86
|
model: answers.model
|
|
86
87
|
};
|
|
87
88
|
try {
|
|
88
|
-
if (!fs.existsSync(
|
|
89
|
-
fs.mkdirSync(
|
|
89
|
+
if (!fs.existsSync(GLOBAL_CONFIG_DIR)) {
|
|
90
|
+
fs.mkdirSync(GLOBAL_CONFIG_DIR, { recursive: true });
|
|
90
91
|
}
|
|
91
|
-
fs.writeFileSync(
|
|
92
|
-
console.log(chalk.green(`\nā
Configuration saved to ${
|
|
92
|
+
fs.writeFileSync(GLOBAL_CONFIG_FILE, JSON.stringify(newConfig, null, 2), { mode: 0o600 });
|
|
93
|
+
console.log(chalk.green(`\nā
Configuration saved to ${GLOBAL_CONFIG_FILE}`));
|
|
93
94
|
console.log(chalk.cyan("You can now run 'autoclaw' to start using the agent."));
|
|
94
95
|
}
|
|
95
96
|
catch (error) {
|
|
@@ -98,12 +99,17 @@ async function runSetup() {
|
|
|
98
99
|
}
|
|
99
100
|
async function runChat(options) {
|
|
100
101
|
console.log(chalk.bold.cyan("Welcome to AutoClaw CLI š¦"));
|
|
101
|
-
// 1. Load Global
|
|
102
|
-
const globalConfig =
|
|
103
|
-
// 2.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
// 1. Load Global JSON
|
|
103
|
+
const globalConfig = loadJsonConfig(GLOBAL_CONFIG_FILE);
|
|
104
|
+
// 2. Load Local JSON (Project Level)
|
|
105
|
+
const localConfig = loadJsonConfig(LOCAL_CONFIG_FILE);
|
|
106
|
+
if (Object.keys(localConfig).length > 0) {
|
|
107
|
+
console.log(chalk.dim(`Loaded project config from ${LOCAL_CONFIG_FILE}`));
|
|
108
|
+
}
|
|
109
|
+
// 3. Merge: CLI > Env > Local JSON > Global JSON
|
|
110
|
+
let apiKey = process.env.OPENAI_API_KEY || localConfig.apiKey || globalConfig.apiKey;
|
|
111
|
+
let baseURL = process.env.OPENAI_BASE_URL || localConfig.baseUrl || globalConfig.baseUrl;
|
|
112
|
+
let model = options.model || process.env.OPENAI_MODEL || localConfig.model || globalConfig.model || 'gpt-4o';
|
|
107
113
|
if (!apiKey) {
|
|
108
114
|
console.log(chalk.yellow("API Key not found."));
|
|
109
115
|
const { doSetup } = await inquirer.prompt([
|
|
@@ -116,7 +122,7 @@ async function runChat(options) {
|
|
|
116
122
|
]);
|
|
117
123
|
if (doSetup) {
|
|
118
124
|
await runSetup();
|
|
119
|
-
const newConfig =
|
|
125
|
+
const newConfig = loadJsonConfig(GLOBAL_CONFIG_FILE);
|
|
120
126
|
apiKey = newConfig.apiKey;
|
|
121
127
|
baseURL = newConfig.baseUrl;
|
|
122
128
|
model = options.model || newConfig.model || 'gpt-4o';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autoclaw",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"chalk": "^5.6.2",
|
|
35
35
|
"commander": "^14.0.3",
|
|
36
|
-
"dotenv": "^
|
|
36
|
+
"dotenv": "^16.4.7",
|
|
37
37
|
"inquirer": "^13.2.2",
|
|
38
38
|
"openai": "^6.18.0",
|
|
39
39
|
"ora": "^9.3.0"
|