mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 18:28:26 +00:00
refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -4,12 +4,12 @@ description: "Run BOOT.md on gateway startup"
|
||||
homepage: https://docs.molt.bot/hooks#boot-md
|
||||
metadata:
|
||||
{
|
||||
"clawdbot":
|
||||
"moltbot":
|
||||
{
|
||||
"emoji": "🚀",
|
||||
"events": ["gateway:startup"],
|
||||
"requires": { "config": ["workspace.dir"] },
|
||||
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Clawdbot" }],
|
||||
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Moltbot" }],
|
||||
},
|
||||
}
|
||||
---
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { CliDeps } from "../../../cli/deps.js";
|
||||
import { createDefaultDeps } from "../../../cli/deps.js";
|
||||
import type { ClawdbotConfig } from "../../../config/config.js";
|
||||
import type { MoltbotConfig } from "../../../config/config.js";
|
||||
import { runBootOnce } from "../../../gateway/boot.js";
|
||||
import type { HookHandler } from "../../hooks.js";
|
||||
|
||||
type BootHookContext = {
|
||||
cfg?: ClawdbotConfig;
|
||||
cfg?: MoltbotConfig;
|
||||
workspaceDir?: string;
|
||||
deps?: CliDeps;
|
||||
};
|
||||
|
||||
@@ -4,11 +4,11 @@ description: "Log all command events to a centralized audit file"
|
||||
homepage: https://docs.molt.bot/hooks#command-logger
|
||||
metadata:
|
||||
{
|
||||
"clawdbot":
|
||||
"moltbot":
|
||||
{
|
||||
"emoji": "📝",
|
||||
"events": ["command"],
|
||||
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Clawdbot" }],
|
||||
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Moltbot" }],
|
||||
},
|
||||
}
|
||||
---
|
||||
@@ -62,7 +62,7 @@ No configuration needed. The hook automatically:
|
||||
To disable this hook:
|
||||
|
||||
```bash
|
||||
clawdbot hooks disable command-logger
|
||||
moltbot hooks disable command-logger
|
||||
```
|
||||
|
||||
Or via config:
|
||||
@@ -90,7 +90,7 @@ The hook does not automatically rotate logs. To manage log size, you can:
|
||||
```
|
||||
|
||||
2. **Use logrotate** (Linux):
|
||||
Create `/etc/logrotate.d/clawdbot`:
|
||||
Create `/etc/logrotate.d/moltbot`:
|
||||
```
|
||||
/home/username/.clawdbot/logs/commands.log {
|
||||
weekly
|
||||
|
||||
@@ -4,12 +4,12 @@ description: "Save session context to memory when /new command is issued"
|
||||
homepage: https://docs.molt.bot/hooks#session-memory
|
||||
metadata:
|
||||
{
|
||||
"clawdbot":
|
||||
"moltbot":
|
||||
{
|
||||
"emoji": "💾",
|
||||
"events": ["command:new"],
|
||||
"requires": { "config": ["workspace.dir"] },
|
||||
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Clawdbot" }],
|
||||
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Moltbot" }],
|
||||
},
|
||||
}
|
||||
---
|
||||
@@ -68,7 +68,7 @@ No additional configuration required. The hook automatically:
|
||||
To disable this hook:
|
||||
|
||||
```bash
|
||||
clawdbot hooks disable session-memory
|
||||
moltbot hooks disable session-memory
|
||||
```
|
||||
|
||||
Or remove it from your config:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import os from "node:os";
|
||||
import type { ClawdbotConfig } from "../../../config/config.js";
|
||||
import type { MoltbotConfig } from "../../../config/config.js";
|
||||
import { resolveAgentWorkspaceDir } from "../../../agents/agent-scope.js";
|
||||
import { resolveAgentIdFromSessionKey } from "../../../routing/session-key.js";
|
||||
import type { HookHandler } from "../../hooks.js";
|
||||
@@ -67,7 +67,7 @@ const saveSessionToMemory: HookHandler = async (event) => {
|
||||
console.log("[session-memory] Hook triggered for /new command");
|
||||
|
||||
const context = event.context || {};
|
||||
const cfg = context.cfg as ClawdbotConfig | undefined;
|
||||
const cfg = context.cfg as MoltbotConfig | undefined;
|
||||
const agentId = resolveAgentIdFromSessionKey(event.sessionKey);
|
||||
const workspaceDir = cfg
|
||||
? resolveAgentWorkspaceDir(cfg, agentId)
|
||||
@@ -106,11 +106,11 @@ const saveSessionToMemory: HookHandler = async (event) => {
|
||||
// Dynamically import the LLM slug generator (avoids module caching issues)
|
||||
// When compiled, handler is at dist/hooks/bundled/session-memory/handler.js
|
||||
// Going up ../.. puts us at dist/hooks/, so just add llm-slug-generator.js
|
||||
const clawdbotRoot = path.resolve(
|
||||
const moltbotRoot = path.resolve(
|
||||
path.dirname(import.meta.url.replace("file://", "")),
|
||||
"../..",
|
||||
);
|
||||
const slugGenPath = path.join(clawdbotRoot, "llm-slug-generator.js");
|
||||
const slugGenPath = path.join(moltbotRoot, "llm-slug-generator.js");
|
||||
const { generateSlugViaLLM } = await import(slugGenPath);
|
||||
|
||||
// Use LLM to generate a descriptive slug
|
||||
|
||||
@@ -4,12 +4,12 @@ description: "Swap SOUL.md with SOUL_EVIL.md during a purge window or by random
|
||||
homepage: https://docs.molt.bot/hooks/soul-evil
|
||||
metadata:
|
||||
{
|
||||
"clawdbot":
|
||||
"moltbot":
|
||||
{
|
||||
"emoji": "😈",
|
||||
"events": ["agent:bootstrap"],
|
||||
"requires": { "config": ["hooks.internal.entries.soul-evil.enabled"] },
|
||||
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Clawdbot" }],
|
||||
"install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Moltbot" }],
|
||||
},
|
||||
}
|
||||
---
|
||||
@@ -31,7 +31,7 @@ You can change the filename via hook config.
|
||||
|
||||
## Configuration
|
||||
|
||||
Add this to your config (`~/.clawdbot/clawdbot.json`):
|
||||
Add this to your config (`~/.clawdbot/moltbot.json`):
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -67,5 +67,5 @@ Add this to your config (`~/.clawdbot/clawdbot.json`):
|
||||
## Enable
|
||||
|
||||
```bash
|
||||
clawdbot hooks enable soul-evil
|
||||
moltbot hooks enable soul-evil
|
||||
```
|
||||
|
||||
@@ -5,19 +5,19 @@ import { describe, expect, it } from "vitest";
|
||||
import handler from "./handler.js";
|
||||
import { createHookEvent } from "../../hooks.js";
|
||||
import type { AgentBootstrapHookContext } from "../../hooks.js";
|
||||
import type { ClawdbotConfig } from "../../../config/config.js";
|
||||
import type { MoltbotConfig } from "../../../config/config.js";
|
||||
import { makeTempWorkspace, writeWorkspaceFile } from "../../../test-helpers/workspace.js";
|
||||
|
||||
describe("soul-evil hook", () => {
|
||||
it("skips subagent sessions", async () => {
|
||||
const tempDir = await makeTempWorkspace("clawdbot-soul-");
|
||||
const tempDir = await makeTempWorkspace("moltbot-soul-");
|
||||
await writeWorkspaceFile({
|
||||
dir: tempDir,
|
||||
name: "SOUL_EVIL.md",
|
||||
content: "chaotic",
|
||||
});
|
||||
|
||||
const cfg: ClawdbotConfig = {
|
||||
const cfg: MoltbotConfig = {
|
||||
hooks: {
|
||||
internal: {
|
||||
entries: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ClawdbotConfig } from "../../../config/config.js";
|
||||
import type { MoltbotConfig } from "../../../config/config.js";
|
||||
import { isSubagentSessionKey } from "../../../routing/session-key.js";
|
||||
import { resolveHookConfig } from "../../config.js";
|
||||
import { isAgentBootstrapEvent, type HookHandler } from "../../hooks.js";
|
||||
@@ -11,7 +11,7 @@ const soulEvilHook: HookHandler = async (event) => {
|
||||
|
||||
const context = event.context;
|
||||
if (context.sessionKey && isSubagentSessionKey(context.sessionKey)) return;
|
||||
const cfg = context.cfg as ClawdbotConfig | undefined;
|
||||
const cfg = context.cfg as MoltbotConfig | undefined;
|
||||
const hookConfig = resolveHookConfig(cfg, HOOK_KEY);
|
||||
if (!hookConfig || hookConfig.enabled === false) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user