refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -33,7 +33,7 @@ Delivery:
|
||||
|
||||
### 2) Plugin Runtime (execution surface, injected)
|
||||
Scope: everything that touches core runtime behavior.
|
||||
Accessed via `ClawdbotPluginApi.runtime` so plugins never import `src/**`.
|
||||
Accessed via `MoltbotPluginApi.runtime` so plugins never import `src/**`.
|
||||
|
||||
Proposed surface (minimal but complete):
|
||||
```ts
|
||||
@@ -41,8 +41,8 @@ export type PluginRuntime = {
|
||||
channel: {
|
||||
text: {
|
||||
chunkMarkdownText(text: string, limit: number): string[];
|
||||
resolveTextChunkLimit(cfg: ClawdbotConfig, channel: string, accountId?: string): number;
|
||||
hasControlCommand(text: string, cfg: ClawdbotConfig): boolean;
|
||||
resolveTextChunkLimit(cfg: MoltbotConfig, channel: string, accountId?: string): number;
|
||||
hasControlCommand(text: string, cfg: MoltbotConfig): boolean;
|
||||
};
|
||||
reply: {
|
||||
dispatchReplyWithBufferedBlockDispatcher(params: {
|
||||
@@ -83,18 +83,18 @@ export type PluginRuntime = {
|
||||
): Promise<{ path: string; contentType?: string }>;
|
||||
};
|
||||
mentions: {
|
||||
buildMentionRegexes(cfg: ClawdbotConfig, agentId?: string): RegExp[];
|
||||
buildMentionRegexes(cfg: MoltbotConfig, agentId?: string): RegExp[];
|
||||
matchesMentionPatterns(text: string, regexes: RegExp[]): boolean;
|
||||
};
|
||||
groups: {
|
||||
resolveGroupPolicy(cfg: ClawdbotConfig, channel: string, accountId: string, groupId: string): {
|
||||
resolveGroupPolicy(cfg: MoltbotConfig, channel: string, accountId: string, groupId: string): {
|
||||
allowlistEnabled: boolean;
|
||||
allowed: boolean;
|
||||
groupConfig?: unknown;
|
||||
defaultConfig?: unknown;
|
||||
};
|
||||
resolveRequireMention(
|
||||
cfg: ClawdbotConfig,
|
||||
cfg: MoltbotConfig,
|
||||
channel: string,
|
||||
accountId: string,
|
||||
groupId: string,
|
||||
@@ -109,7 +109,7 @@ export type PluginRuntime = {
|
||||
onFlush: (entries: T[]) => Promise<void>;
|
||||
onError?: (err: unknown) => void;
|
||||
}): { push: (v: T) => void; flush: () => Promise<void> };
|
||||
resolveInboundDebounceMs(cfg: ClawdbotConfig, channel: string): number;
|
||||
resolveInboundDebounceMs(cfg: MoltbotConfig, channel: string): number;
|
||||
};
|
||||
commands: {
|
||||
resolveCommandAuthorizedFromAuthorizers(params: {
|
||||
@@ -123,7 +123,7 @@ export type PluginRuntime = {
|
||||
getChildLogger(name: string): PluginLogger;
|
||||
};
|
||||
state: {
|
||||
resolveStateDir(cfg: ClawdbotConfig): string;
|
||||
resolveStateDir(cfg: MoltbotConfig): string;
|
||||
};
|
||||
};
|
||||
```
|
||||
@@ -137,7 +137,7 @@ Notes:
|
||||
|
||||
### Phase 0: scaffolding
|
||||
- Introduce `@clawdbot/plugin-sdk`.
|
||||
- Add `api.runtime` to `ClawdbotPluginApi` with the surface above.
|
||||
- Add `api.runtime` to `MoltbotPluginApi` with the surface above.
|
||||
- Maintain existing imports during a transition window (deprecation warnings).
|
||||
|
||||
### Phase 1: bridge cleanup (low risk)
|
||||
@@ -165,7 +165,7 @@ Notes:
|
||||
## Compatibility and versioning
|
||||
- SDK: semver, published, documented changes.
|
||||
- Runtime: versioned per core release. Add `api.runtime.version`.
|
||||
- Plugins declare a required runtime range (e.g., `clawdbotRuntime: ">=2026.2.0"`).
|
||||
- Plugins declare a required runtime range (e.g., `moltbotRuntime: ">=2026.2.0"`).
|
||||
|
||||
## Testing strategy
|
||||
- Adapter-level unit tests (runtime functions exercised with real core implementation).
|
||||
|
||||
@@ -23,12 +23,12 @@ read_when:
|
||||
- `plugins.entries.<id>.config` must be validated by the plugin’s schema.
|
||||
- If a plugin lacks a schema, **reject plugin load** and surface a clear error.
|
||||
- Unknown `channels.<id>` keys are errors unless a plugin manifest declares the channel id.
|
||||
- Plugin manifests (`clawdbot.plugin.json`) are required for all plugins.
|
||||
- Plugin manifests (`moltbot.plugin.json`) are required for all plugins.
|
||||
|
||||
## Plugin schema enforcement
|
||||
- Each plugin provides a strict JSON Schema for its config (inline in the manifest).
|
||||
- Plugin load flow:
|
||||
1) Resolve plugin manifest + schema (`clawdbot.plugin.json`).
|
||||
1) Resolve plugin manifest + schema (`moltbot.plugin.json`).
|
||||
2) Validate config against the schema.
|
||||
3) If missing schema or invalid config: block plugin load, record error.
|
||||
- Error message includes:
|
||||
@@ -41,22 +41,22 @@ read_when:
|
||||
- Doctor runs **every time** config is loaded (dry-run by default).
|
||||
- If config invalid:
|
||||
- Print a summary + actionable errors.
|
||||
- Instruct: `clawdbot doctor --fix`.
|
||||
- `clawdbot doctor --fix`:
|
||||
- Instruct: `moltbot doctor --fix`.
|
||||
- `moltbot doctor --fix`:
|
||||
- Applies migrations.
|
||||
- Removes unknown keys.
|
||||
- Writes updated config.
|
||||
|
||||
## Command gating (when config is invalid)
|
||||
Allowed (diagnostic-only):
|
||||
- `clawdbot doctor`
|
||||
- `clawdbot logs`
|
||||
- `clawdbot health`
|
||||
- `clawdbot help`
|
||||
- `clawdbot status`
|
||||
- `clawdbot gateway status`
|
||||
- `moltbot doctor`
|
||||
- `moltbot logs`
|
||||
- `moltbot health`
|
||||
- `moltbot help`
|
||||
- `moltbot status`
|
||||
- `moltbot gateway status`
|
||||
|
||||
Everything else must hard-fail with: “Config invalid. Run `clawdbot doctor --fix`.”
|
||||
Everything else must hard-fail with: “Config invalid. Run `moltbot doctor --fix`.”
|
||||
|
||||
## Error UX format
|
||||
- Single summary header.
|
||||
|
||||
Reference in New Issue
Block a user