hajimi-claw 0.1.0 → 0.1.2
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/LICENSE +21 -0
- package/README.md +202 -13
- package/bin/hajimi-claw.js +77 -3
- package/config.example.toml +33 -2
- package/npm/platforms/linux-arm64-gnu/LICENSE +1 -0
- package/npm/platforms/linux-arm64-gnu/README.md +3 -0
- package/npm/platforms/linux-arm64-gnu/bin/.gitkeep +1 -0
- package/npm/platforms/linux-arm64-gnu/index.js +3 -0
- package/npm/platforms/linux-arm64-gnu/package.json +21 -0
- package/npm/platforms/linux-x64-gnu/LICENSE +1 -0
- package/npm/platforms/linux-x64-gnu/README.md +3 -0
- package/npm/platforms/linux-x64-gnu/bin/.gitkeep +1 -0
- package/npm/platforms/linux-x64-gnu/index.js +3 -0
- package/npm/platforms/linux-x64-gnu/package.json +21 -0
- package/npm/platforms/win32-arm64-msvc/LICENSE +1 -0
- package/npm/platforms/win32-arm64-msvc/README.md +3 -0
- package/npm/platforms/win32-arm64-msvc/bin/.gitkeep +1 -0
- package/npm/platforms/win32-arm64-msvc/index.js +3 -0
- package/npm/platforms/win32-arm64-msvc/package.json +18 -0
- package/npm/platforms/win32-x64-msvc/LICENSE +1 -0
- package/npm/platforms/win32-x64-msvc/README.md +3 -0
- package/npm/platforms/win32-x64-msvc/bin/.gitkeep +1 -0
- package/npm/platforms/win32-x64-msvc/index.js +3 -0
- package/npm/platforms/win32-x64-msvc/package.json +18 -0
- package/package.json +20 -13
- package/scripts/stage-prebuilt.js +91 -0
- package/scripts/sync-npm-versions.js +46 -0
- package/Cargo.lock +0 -2602
- package/Cargo.toml +0 -57
- package/crates/hajimi-claw-agent/Cargo.toml +0 -25
- package/crates/hajimi-claw-agent/src/lib.rs +0 -351
- package/crates/hajimi-claw-bot/Cargo.toml +0 -18
- package/crates/hajimi-claw-bot/src/lib.rs +0 -305
- package/crates/hajimi-claw-daemon/Cargo.toml +0 -24
- package/crates/hajimi-claw-daemon/src/lib.rs +0 -173
- package/crates/hajimi-claw-exec/Cargo.toml +0 -21
- package/crates/hajimi-claw-exec/src/lib.rs +0 -419
- package/crates/hajimi-claw-gateway/Cargo.toml +0 -27
- package/crates/hajimi-claw-gateway/src/lib.rs +0 -747
- package/crates/hajimi-claw-llm/Cargo.toml +0 -19
- package/crates/hajimi-claw-llm/src/lib.rs +0 -367
- package/crates/hajimi-claw-policy/Cargo.toml +0 -14
- package/crates/hajimi-claw-policy/src/lib.rs +0 -381
- package/crates/hajimi-claw-store/Cargo.toml +0 -17
- package/crates/hajimi-claw-store/src/lib.rs +0 -730
- package/crates/hajimi-claw-tools/Cargo.toml +0 -21
- package/crates/hajimi-claw-tools/src/lib.rs +0 -758
- package/crates/hajimi-claw-types/Cargo.toml +0 -16
- package/crates/hajimi-claw-types/src/lib.rs +0 -300
- package/scripts/npm-install.js +0 -45
- package/src/main.rs +0 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dongshan_Randeng
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
# hajimi-claw
|
|
2
2
|
|
|
3
|
-
Single-user Telegram-first ops agent in Rust.
|
|
3
|
+
Single-user Telegram/Feishu-first ops agent in Rust.
|
|
4
4
|
|
|
5
5
|
## Current scope
|
|
6
6
|
|
|
7
7
|
- Telegram channel -> gateway -> runtime command flow
|
|
8
|
+
- Feishu webhook channel -> gateway -> runtime command flow
|
|
8
9
|
- Telegram long polling command surface
|
|
9
10
|
- Single active task gate
|
|
10
11
|
- Structured tools for file access, Docker, and systemd
|
|
11
|
-
- Guarded local command execution with
|
|
12
|
+
- Guarded local command execution with approval mode, short-lived elevated mode, and full elevated mode
|
|
12
13
|
- SQLite audit/task/session persistence
|
|
13
14
|
- Windows-safe execution mode with allowlist checks and Job Object cleanup
|
|
14
|
-
-
|
|
15
|
+
- Channel-aware onboarding for Telegram or Feishu plus provider/model setup
|
|
16
|
+
- Configurable multi-agent orchestration with coordinator/worker/integrator flow
|
|
15
17
|
|
|
16
18
|
## Running
|
|
17
19
|
|
|
18
|
-
1.
|
|
19
|
-
2.
|
|
20
|
-
3.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
5. Run `cargo run`.
|
|
24
|
-
6. In Telegram, use `/onboard` to add or switch providers interactively.
|
|
20
|
+
1. Run `cargo run -- onboard` or `hajimi onboard`.
|
|
21
|
+
2. `hajimi onboard` lets you choose `telegram`, `feishu`, or `skip`, verifies the channel credentials when configured, and then interactively guides provider model selection.
|
|
22
|
+
3. Start the daemon with `cargo run` or `hajimi`.
|
|
23
|
+
4. In Telegram, use `/menu` for the main quick-action panel, or just send plain text and let hajimi reply in natural language.
|
|
24
|
+
5. In Feishu mode, configure the app's event subscription URL to point at `http(s)://<your-host><event_path>` for the local webhook listener.
|
|
25
25
|
|
|
26
26
|
Set `HAJIMI_CLAW_CONFIG` if you want to load a different config path.
|
|
27
27
|
|
|
28
|
+
For background use without keeping a terminal open:
|
|
29
|
+
|
|
30
|
+
- `hajimi launch`
|
|
31
|
+
- `hajimi status`
|
|
32
|
+
- `hajimi stop`
|
|
33
|
+
|
|
28
34
|
## Install
|
|
29
35
|
|
|
30
36
|
### Windows
|
|
@@ -34,7 +40,7 @@ Set `HAJIMI_CLAW_CONFIG` if you want to load a different config path.
|
|
|
34
40
|
- System-wide install:
|
|
35
41
|
`powershell -ExecutionPolicy Bypass -File .\scripts\install.ps1 -System`
|
|
36
42
|
|
|
37
|
-
The installer copies `hajimi-claw.exe`
|
|
43
|
+
The installer copies `hajimi-claw.exe`, creates the `hajimi.exe` alias, copies `config.example.toml`, and updates `PATH`.
|
|
38
44
|
|
|
39
45
|
### Linux
|
|
40
46
|
|
|
@@ -45,7 +51,7 @@ The installer copies `hajimi-claw.exe` and `config.example.toml`, and updates `P
|
|
|
45
51
|
- System-wide install with systemd unit:
|
|
46
52
|
`sudo sh ./scripts/install.sh --system --install-service`
|
|
47
53
|
|
|
48
|
-
The Linux installer copies the binary to `PREFIX/bin` and `config.example.toml` to `PREFIX/share/hajimi-claw`.
|
|
54
|
+
The Linux installer copies the binary to `PREFIX/bin/hajimi-claw`, creates the `PREFIX/bin/hajimi` alias, and copies `config.example.toml` to `PREFIX/share/hajimi-claw`.
|
|
49
55
|
|
|
50
56
|
### npm
|
|
51
57
|
|
|
@@ -54,20 +60,203 @@ The Linux installer copies the binary to `PREFIX/bin` and `config.example.toml`
|
|
|
54
60
|
- Global install from the repo:
|
|
55
61
|
`npm install -g .`
|
|
56
62
|
|
|
57
|
-
The npm package
|
|
63
|
+
The npm package exposes both `hajimi` and `hajimi-claw`, but it no longer compiles Rust during
|
|
64
|
+
install. Instead:
|
|
65
|
+
|
|
66
|
+
- The root package is a small launcher package
|
|
67
|
+
- Platform-specific binaries are published as optional npm packages
|
|
68
|
+
- `npm install -g hajimi-claw` installs the matching prebuilt binary package when one is available
|
|
69
|
+
|
|
70
|
+
Supported prebuilt package names:
|
|
71
|
+
|
|
72
|
+
- `hajimi-claw-win32-x64-msvc`
|
|
73
|
+
- `hajimi-claw-win32-arm64-msvc`
|
|
74
|
+
- `hajimi-claw-linux-x64-gnu`
|
|
75
|
+
- `hajimi-claw-linux-arm64-gnu`
|
|
76
|
+
|
|
77
|
+
For local testing from the repo, stage a binary into the local platform package first:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
cargo build --release
|
|
81
|
+
npm run stage:binary
|
|
82
|
+
npm install -g .
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
For CI or release staging, you can target a specific package explicitly:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
node scripts/stage-prebuilt.js win32-x64-msvc path/to/hajimi-claw.exe
|
|
89
|
+
node scripts/stage-prebuilt.js linux-x64-gnu path/to/hajimi-claw
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Recommended publish order:
|
|
93
|
+
|
|
94
|
+
1. Build each platform binary in CI
|
|
95
|
+
2. Stage it into the matching `npm/platforms/<target>/bin/`
|
|
96
|
+
3. Publish each platform package
|
|
97
|
+
4. Publish the root `hajimi-claw` package last
|
|
98
|
+
|
|
99
|
+
Current GitHub Actions automation is wired for:
|
|
100
|
+
|
|
101
|
+
- `hajimi-claw-win32-x64-msvc`
|
|
102
|
+
- `hajimi-claw-linux-x64-gnu`
|
|
103
|
+
|
|
104
|
+
The arm64 package skeletons are present in the repo, but they are not yet part of the automated
|
|
105
|
+
publish matrix.
|
|
106
|
+
|
|
107
|
+
## npm Versioning
|
|
108
|
+
|
|
109
|
+
For npm releases, the root `package.json` is the single version source.
|
|
110
|
+
|
|
111
|
+
When you change `package.json.version`, run:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npm run sync:npm-versions
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
That script updates:
|
|
118
|
+
|
|
119
|
+
- the root package `optionalDependencies`
|
|
120
|
+
- every platform package version under `npm/platforms/*/package.json`
|
|
121
|
+
|
|
122
|
+
The release workflow also runs this sync step automatically, so you do not need to edit platform
|
|
123
|
+
package versions by hand.
|
|
124
|
+
|
|
125
|
+
## Channels
|
|
126
|
+
|
|
127
|
+
- `telegram`
|
|
128
|
+
- `feishu`
|
|
129
|
+
|
|
130
|
+
`hajimi onboard` now lets you pick the primary channel:
|
|
131
|
+
|
|
132
|
+
- `telegram`: verifies the bot token and can auto-pair the admin user/chat
|
|
133
|
+
- `feishu`: asks for `app_id` and `app_secret`, verifies them by requesting a tenant access token, and supports both `webhook` and `long-connection` modes
|
|
134
|
+
- `skip`: leaves channel setup empty for now so you can finish provider/model setup first
|
|
135
|
+
|
|
136
|
+
Current Feishu limitations:
|
|
137
|
+
|
|
138
|
+
- In `webhook` mode, you still need to configure the Feishu event subscription URL manually in the Feishu developer console
|
|
139
|
+
- In `long-connection` mode, message receive events can come through the WebSocket connection, but card button callbacks still need the lightweight HTTP callback path
|
|
140
|
+
- Feishu card support currently targets `menu/provider/model` style button flows; it is not a full parity implementation of Telegram inline interactions
|
|
141
|
+
|
|
142
|
+
## CLI
|
|
143
|
+
|
|
144
|
+
- `hajimi`
|
|
145
|
+
- `hajimi daemon`
|
|
146
|
+
- `hajimi launch`
|
|
147
|
+
- `hajimi stop`
|
|
148
|
+
- `hajimi status`
|
|
149
|
+
- `hajimi onboard`
|
|
150
|
+
- `hajimi providers`
|
|
151
|
+
- `hajimi provider current`
|
|
152
|
+
- `hajimi provider use <provider-id>`
|
|
153
|
+
- `hajimi provider models [provider-id]`
|
|
154
|
+
- `hajimi provider set-model <provider-id> <model>`
|
|
155
|
+
- `hajimi model current`
|
|
156
|
+
- `hajimi model use [model]`
|
|
157
|
+
- `hajimi models [provider-id]`
|
|
158
|
+
- `hajimi restart`
|
|
159
|
+
- `hajimi help`
|
|
160
|
+
|
|
161
|
+
## Multi-Agent
|
|
162
|
+
|
|
163
|
+
`hajimi` can split one natural-language request into multiple sub-agents. This is configured in
|
|
164
|
+
`config.toml` under `[multi_agent]`:
|
|
165
|
+
|
|
166
|
+
```toml
|
|
167
|
+
[multi_agent]
|
|
168
|
+
enabled = true
|
|
169
|
+
auto_delegate = false
|
|
170
|
+
default_workers = 3
|
|
171
|
+
max_workers = 8
|
|
172
|
+
worker_timeout_secs = 90
|
|
173
|
+
max_context_chars_per_worker = 24000
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Natural-language triggers:
|
|
177
|
+
|
|
178
|
+
- `use 4 agents to analyze this`
|
|
179
|
+
- `开 6 个 agent 帮我排查`
|
|
180
|
+
- `please use sub agents for this`
|
|
181
|
+
|
|
182
|
+
Behavior:
|
|
183
|
+
|
|
184
|
+
- If the prompt explicitly asks for `N agents` or `N workers`, hajimi uses that count up to
|
|
185
|
+
`max_workers`
|
|
186
|
+
- If the prompt says `sub agent` / `multi agent`, hajimi uses `default_workers`
|
|
187
|
+
- `auto_delegate = true` enables light automatic delegation for obviously parallel analysis tasks
|
|
188
|
+
- Worker agents only perform parallel reasoning in v1; local command execution still stays behind
|
|
189
|
+
the existing single runtime/policy path
|
|
190
|
+
- Session-level controls are available in chat:
|
|
191
|
+
- `/agents on`
|
|
192
|
+
- `/agents off`
|
|
193
|
+
- `/agents auto`
|
|
194
|
+
- `/agents status`
|
|
195
|
+
- When a natural-language task is about to run in multi-agent mode, Telegram now shows a temporary
|
|
196
|
+
progress card and Feishu sends a status card before the final reply
|
|
197
|
+
|
|
198
|
+
## Persona Files
|
|
199
|
+
|
|
200
|
+
`hajimi onboard` now creates empty persona files in `~/.hajimi/`:
|
|
201
|
+
|
|
202
|
+
- `soul.md`
|
|
203
|
+
- `agents.md`
|
|
204
|
+
- `tools.md`
|
|
205
|
+
- `skills.md`
|
|
206
|
+
|
|
207
|
+
`hajimi` reloads these files on each request, so Telegram edits take effect on the next `/ask`.
|
|
208
|
+
|
|
209
|
+
- Auto-discovered files: `soul.md`, `agents.md`, `AGENTS.md`, `tools.md`, `skills.md`
|
|
210
|
+
- Search roots: the current working directory, the config directory, and `~/.hajimi`
|
|
211
|
+
- Optional explicit list: set `[persona].prompt_files` in `config.toml`
|
|
212
|
+
|
|
213
|
+
Use these files for:
|
|
214
|
+
|
|
215
|
+
- `soul.md`: tone, temperament, and high-level persona
|
|
216
|
+
- `agents.md` or `AGENTS.md`: repo or operator instructions
|
|
217
|
+
- `tools.md`: tool-use policy and operational preferences
|
|
218
|
+
- `skills.md`: extra habits, playbooks, and skill-selection hints
|
|
58
219
|
|
|
59
220
|
## Telegram commands
|
|
60
221
|
|
|
61
222
|
- `/onboard`
|
|
62
223
|
- `/onboard cancel`
|
|
63
224
|
- `/provider list`
|
|
225
|
+
- `/provider add`
|
|
64
226
|
- `/provider current`
|
|
65
227
|
- `/provider use <id>`
|
|
66
228
|
- `/provider bind <id>`
|
|
67
229
|
- `/provider test [id]`
|
|
68
230
|
- `/provider models [id]`
|
|
231
|
+
- `/provider set-model <provider-id> <model>`
|
|
232
|
+
- `/model current`
|
|
233
|
+
- `/model use [model]`
|
|
234
|
+
- `/persona list`
|
|
235
|
+
- `/persona read <soul|agents|tools|skills>`
|
|
236
|
+
- `/persona write <file> <content>`
|
|
237
|
+
- `/persona append <file> <content>`
|
|
69
238
|
- `/ask <text>`
|
|
70
239
|
- `/shell open [name]`
|
|
71
240
|
- `/shell exec <cmd>`
|
|
72
241
|
- `/shell close`
|
|
73
242
|
- `/status`
|
|
243
|
+
- `/menu`
|
|
244
|
+
- `/elevated on`
|
|
245
|
+
- `/elevated off`
|
|
246
|
+
- `/elevated ask`
|
|
247
|
+
- `/elevated full`
|
|
248
|
+
|
|
249
|
+
Plain Telegram text now defaults to a natural-language task, so `/ask` is optional for normal requests. hajimi sends a Telegram `typing` action, posts a short placeholder, and then edits that message with the final answer.
|
|
250
|
+
|
|
251
|
+
The bot also registers Telegram slash commands with `setMyCommands` on startup and exposes an inline quick-action menu via `/menu` and `/help`. `/provider current` and `/model current` now return inline buttons so you can switch provider/model directly from Telegram without typing full commands.
|
|
252
|
+
|
|
253
|
+
## Provider And Model Switching
|
|
254
|
+
|
|
255
|
+
- Add a new provider: `hajimi onboard` or Telegram `/provider add`
|
|
256
|
+
- List configured providers: `hajimi providers` or Telegram `/provider list`
|
|
257
|
+
- Switch the default provider: `hajimi provider use <provider-id>` or Telegram `/provider use <id>`
|
|
258
|
+
- See the current model: `hajimi model current` or Telegram `/model current`
|
|
259
|
+
- Switch the current model on the active provider: `hajimi model use [model]` or Telegram `/model use [model]`
|
|
260
|
+
- Open the model picker with inline buttons: `hajimi model use` or Telegram `/model use`
|
|
261
|
+
- Switch a specific provider to a specific model: `hajimi provider set-model <provider-id> <model>` or Telegram `/provider set-model <provider-id> <model>`
|
|
262
|
+
- `hajimi onboard` now supports optional fallback models per provider; if the primary model fails, hajimi will retry the provider using the configured fallback models in order
|
package/bin/hajimi-claw.js
CHANGED
|
@@ -6,11 +6,85 @@ const { spawn } = require("child_process");
|
|
|
6
6
|
|
|
7
7
|
const root = path.resolve(__dirname, "..");
|
|
8
8
|
const binaryName = process.platform === "win32" ? "hajimi-claw.exe" : "hajimi-claw";
|
|
9
|
-
const binaryPath = path.join(root, "npm-dist", binaryName);
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
function detectLinuxLibc() {
|
|
11
|
+
if (process.platform !== "linux") {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const report = process.report && typeof process.report.getReport === "function"
|
|
15
|
+
? process.report.getReport()
|
|
16
|
+
: null;
|
|
17
|
+
const glibc = report && report.header && report.header.glibcVersionRuntime;
|
|
18
|
+
return glibc ? "gnu" : "musl";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function platformPackageName() {
|
|
22
|
+
if (process.platform === "win32" && process.arch === "x64") {
|
|
23
|
+
return "hajimi-claw-win32-x64-msvc";
|
|
24
|
+
}
|
|
25
|
+
if (process.platform === "win32" && process.arch === "arm64") {
|
|
26
|
+
return "hajimi-claw-win32-arm64-msvc";
|
|
27
|
+
}
|
|
28
|
+
const libc = detectLinuxLibc();
|
|
29
|
+
if (process.platform === "linux" && process.arch === "x64" && libc === "gnu") {
|
|
30
|
+
return "hajimi-claw-linux-x64-gnu";
|
|
31
|
+
}
|
|
32
|
+
if (process.platform === "linux" && process.arch === "arm64" && libc === "gnu") {
|
|
33
|
+
return "hajimi-claw-linux-arm64-gnu";
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function resolveInstalledBinary() {
|
|
39
|
+
const packageName = platformPackageName();
|
|
40
|
+
if (!packageName) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const entry = require.resolve(packageName, { paths: [root] });
|
|
45
|
+
const binaryPath = require(entry);
|
|
46
|
+
if (typeof binaryPath === "string" && fs.existsSync(binaryPath)) {
|
|
47
|
+
return binaryPath;
|
|
48
|
+
}
|
|
49
|
+
} catch (_) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function resolveLocalFallback() {
|
|
56
|
+
const localDirMap = {
|
|
57
|
+
"hajimi-claw-win32-x64-msvc": "win32-x64-msvc",
|
|
58
|
+
"hajimi-claw-win32-arm64-msvc": "win32-arm64-msvc",
|
|
59
|
+
"hajimi-claw-linux-x64-gnu": "linux-x64-gnu",
|
|
60
|
+
"hajimi-claw-linux-arm64-gnu": "linux-arm64-gnu",
|
|
61
|
+
};
|
|
62
|
+
const packageName = platformPackageName();
|
|
63
|
+
const candidates = [];
|
|
64
|
+
if (process.env.HAJIMI_CLAW_BINARY_PATH) {
|
|
65
|
+
candidates.push(process.env.HAJIMI_CLAW_BINARY_PATH);
|
|
66
|
+
}
|
|
67
|
+
if (packageName && localDirMap[packageName]) {
|
|
68
|
+
candidates.push(
|
|
69
|
+
path.join(root, "npm", "platforms", localDirMap[packageName], "bin", binaryName)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
candidates.push(path.join(root, "npm-dist", binaryName));
|
|
73
|
+
candidates.push(path.join(root, "target", "release", binaryName));
|
|
74
|
+
return candidates.find((candidate) => fs.existsSync(candidate)) || null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const binaryPath = resolveInstalledBinary() || resolveLocalFallback();
|
|
78
|
+
|
|
79
|
+
if (!binaryPath) {
|
|
80
|
+
const packageName = platformPackageName();
|
|
81
|
+
const targetLabel = packageName || `${process.platform}-${process.arch}`;
|
|
12
82
|
console.error(
|
|
13
|
-
|
|
83
|
+
[
|
|
84
|
+
`No prebuilt hajimi binary is available for ${targetLabel}.`,
|
|
85
|
+
"Install a published platform package, or stage a local binary with `npm run stage:binary`.",
|
|
86
|
+
"If you are publishing releases, publish the matching platform package before the root package."
|
|
87
|
+
].join("\n")
|
|
14
88
|
);
|
|
15
89
|
process.exit(1);
|
|
16
90
|
}
|
package/config.example.toml
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
[channel]
|
|
2
|
+
kind = "telegram"
|
|
3
|
+
|
|
1
4
|
[telegram]
|
|
2
5
|
bot_token = "123456:replace-me"
|
|
3
6
|
poll_timeout_secs = 30
|
|
4
7
|
|
|
8
|
+
[feishu]
|
|
9
|
+
# `mode = "webhook"`: expose listen_addr + event_path through your reverse proxy or public host.
|
|
10
|
+
# `mode = "long-connection"`: message events come from Feishu WebSocket; keep card_callback_path reachable if you want card button callbacks.
|
|
11
|
+
app_id = ""
|
|
12
|
+
app_secret = ""
|
|
13
|
+
mode = "webhook"
|
|
14
|
+
listen_addr = "0.0.0.0:8787"
|
|
15
|
+
event_path = "/feishu/events"
|
|
16
|
+
card_callback_path = "/feishu/card"
|
|
17
|
+
|
|
5
18
|
[llm]
|
|
6
19
|
# Optional bootstrap provider written into SQLite on first start.
|
|
7
20
|
base_url = "https://api.openai.com/v1"
|
|
@@ -9,6 +22,9 @@ api_key = "replace-me"
|
|
|
9
22
|
model = "gpt-4.1-mini"
|
|
10
23
|
static_fallback_response = "LLM backend not configured."
|
|
11
24
|
|
|
25
|
+
# Provider fallback models are stored in SQLite per provider by `hajimi onboard`.
|
|
26
|
+
# Example: gpt-4o-mini -> gpt-4.1-mini -> gpt-4.1
|
|
27
|
+
|
|
12
28
|
[storage]
|
|
13
29
|
sqlite_path = "./data/hajimi-claw.sqlite3"
|
|
14
30
|
|
|
@@ -19,11 +35,26 @@ master_key_env = "HAJIMI_CLAW_MASTER_KEY"
|
|
|
19
35
|
[execution]
|
|
20
36
|
mode = "auto"
|
|
21
37
|
|
|
38
|
+
[multi_agent]
|
|
39
|
+
enabled = true
|
|
40
|
+
auto_delegate = false
|
|
41
|
+
default_workers = 3
|
|
42
|
+
max_workers = 8
|
|
43
|
+
worker_timeout_secs = 90
|
|
44
|
+
max_context_chars_per_worker = 24000
|
|
45
|
+
|
|
46
|
+
[persona]
|
|
47
|
+
# hajimi onboard creates soul.md, agents.md, tools.md, and skills.md here.
|
|
48
|
+
directory = "~/.hajimi"
|
|
49
|
+
# Optional. If empty, hajimi auto-loads soul.md, agents.md, AGENTS.md, tools.md,
|
|
50
|
+
# and skills.md from the current working directory, the config directory, and persona.directory.
|
|
51
|
+
prompt_files = []
|
|
52
|
+
|
|
22
53
|
[policy]
|
|
23
54
|
admin_user_id = 123456789
|
|
24
55
|
admin_chat_id = 123456789
|
|
25
|
-
allowed_workdirs = ["./", "./data", "C:/temp"]
|
|
26
|
-
writable_workdirs = ["./data", "C:/temp"]
|
|
56
|
+
allowed_workdirs = ["./", "./data", "~/.hajimi", "C:/temp"]
|
|
57
|
+
writable_workdirs = ["./data", "~/.hajimi", "C:/temp"]
|
|
27
58
|
windows_safe_allowlist = ["cmd", "cmd.exe", "powershell", "powershell.exe", "pwsh", "pwsh.exe", "docker", "docker.exe", "systemctl"]
|
|
28
59
|
guarded_patterns = ["\\b(systemctl|docker)\\s+(restart|stop|rm)\\b", "\\b(chmod|chown|mv|cp)\\b"]
|
|
29
60
|
dangerous_patterns = ["\\b(rm|del)\\s+(-rf|/s|/q|/f)\\b", "\\b(sudo|su|passwd|shutdown|reboot)\\b", ">\\s*/", "format\\s+"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hajimi-claw-linux-arm64-gnu",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Prebuilt Linux arm64 glibc binary for hajimi-claw",
|
|
5
|
+
"os": [
|
|
6
|
+
"linux"
|
|
7
|
+
],
|
|
8
|
+
"cpu": [
|
|
9
|
+
"arm64"
|
|
10
|
+
],
|
|
11
|
+
"libc": [
|
|
12
|
+
"glibc"
|
|
13
|
+
],
|
|
14
|
+
"files": [
|
|
15
|
+
"bin",
|
|
16
|
+
"index.js",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"license": "MIT"
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hajimi-claw-linux-x64-gnu",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Prebuilt Linux x64 glibc binary for hajimi-claw",
|
|
5
|
+
"os": [
|
|
6
|
+
"linux"
|
|
7
|
+
],
|
|
8
|
+
"cpu": [
|
|
9
|
+
"x64"
|
|
10
|
+
],
|
|
11
|
+
"libc": [
|
|
12
|
+
"glibc"
|
|
13
|
+
],
|
|
14
|
+
"files": [
|
|
15
|
+
"bin",
|
|
16
|
+
"index.js",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"license": "MIT"
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hajimi-claw-win32-arm64-msvc",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Prebuilt Windows arm64 binary for hajimi-claw",
|
|
5
|
+
"os": [
|
|
6
|
+
"win32"
|
|
7
|
+
],
|
|
8
|
+
"cpu": [
|
|
9
|
+
"arm64"
|
|
10
|
+
],
|
|
11
|
+
"files": [
|
|
12
|
+
"bin",
|
|
13
|
+
"index.js",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT"
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hajimi-claw-win32-x64-msvc",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Prebuilt Windows x64 binary for hajimi-claw",
|
|
5
|
+
"os": [
|
|
6
|
+
"win32"
|
|
7
|
+
],
|
|
8
|
+
"cpu": [
|
|
9
|
+
"x64"
|
|
10
|
+
],
|
|
11
|
+
"files": [
|
|
12
|
+
"bin",
|
|
13
|
+
"index.js",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT"
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hajimi-claw",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Single-user Telegram-first ops agent in Rust",
|
|
5
5
|
"bin": {
|
|
6
|
+
"hajimi": "bin/hajimi-claw.js",
|
|
6
7
|
"hajimi-claw": "bin/hajimi-claw.js"
|
|
7
8
|
},
|
|
9
|
+
"preferGlobal": true,
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18"
|
|
13
|
+
},
|
|
14
|
+
"optionalDependencies": {
|
|
15
|
+
"hajimi-claw-linux-arm64-gnu": "0.1.2",
|
|
16
|
+
"hajimi-claw-linux-x64-gnu": "0.1.2",
|
|
17
|
+
"hajimi-claw-win32-arm64-msvc": "0.1.2",
|
|
18
|
+
"hajimi-claw-win32-x64-msvc": "0.1.2"
|
|
19
|
+
},
|
|
8
20
|
"files": [
|
|
9
|
-
"Cargo.toml",
|
|
10
|
-
"Cargo.lock",
|
|
11
|
-
"src",
|
|
12
|
-
"crates",
|
|
13
21
|
"bin",
|
|
14
|
-
"
|
|
22
|
+
"npm/platforms",
|
|
23
|
+
"scripts/sync-npm-versions.js",
|
|
24
|
+
"scripts/stage-prebuilt.js",
|
|
15
25
|
"config.example.toml",
|
|
16
|
-
"README.md"
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
17
28
|
],
|
|
18
29
|
"scripts": {
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"preferGlobal": true,
|
|
22
|
-
"license": "MIT",
|
|
23
|
-
"engines": {
|
|
24
|
-
"node": ">=18"
|
|
30
|
+
"sync:npm-versions": "node scripts/sync-npm-versions.js",
|
|
31
|
+
"stage:binary": "npm run sync:npm-versions && node scripts/stage-prebuilt.js"
|
|
25
32
|
}
|
|
26
33
|
}
|