@elizaos/plugin-commands 2.0.0-beta.1 → 2.0.11-beta.7

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shaw Walters and elizaOS Contributors
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 ADDED
@@ -0,0 +1,83 @@
1
+ # @elizaos/plugin-commands
2
+
3
+ Chat command system for [elizaOS](https://github.com/elizaos/eliza) agents. Adds a `/help`-style slash-command surface with a shared registry, parser, and LLM context provider.
4
+
5
+ ## What it does
6
+
7
+ - Provides a typed command registry that other plugins and the agent runtime use to register slash commands.
8
+ - Detects `/` and `!`-prefixed messages and parses them into structured `ParsedCommand` objects.
9
+ - Injects a `COMMAND_REGISTRY` provider into the LLM context — full command documentation only when the message is a command, an empty hint otherwise (keeps normal-message prompts clean).
10
+ - Ships 25 built-in command *definitions* grouped by category. The actual Action handlers live in the agent or other plugins.
11
+
12
+ ## Built-in commands
13
+
14
+ | Category | Commands |
15
+ |---|---|
16
+ | Status | `/help` (`/h`, `/?`), `/commands` (`/cmds`), `/status` (`/s`), `/context` (`/ctx`), `/whoami` (`/who`) |
17
+ | Session | `/stop` (`/abort`, `/cancel`), `/restart`\*, `/reset`\*, `/new`, `/compact` |
18
+ | Options | `/think` (`/thinking`, `/t`), `/verbose` (`/v`), `/reasoning` (`/reason`), `/elevated`\* (`/elev`), `/model` (`/m`), `/models`, `/usage`, `/queue` (`/q`) |
19
+ | Management | `/allowlist`\* (`/allow`), `/approve`\*, `/subagents`\* (`/sub`), `/config`\*† (`/cfg`), `/debug`\*† |
20
+ | Media | `/tts` (`/voice`) |
21
+ | Tools | `/bash`\*‡ (`/sh`, `/!`) |
22
+
23
+ \* Requires auth (`requiresAuth: true`).
24
+ † Disabled by default.
25
+ ‡ Requires elevated permissions AND is disabled by default.
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ bun add @elizaos/plugin-commands
31
+ ```
32
+
33
+ The plugin is **opt-in**. It auto-enables when `config.features.commands` is truthy in your agent configuration.
34
+
35
+ ## Configuration
36
+
37
+ Add to your agent's character/config file:
38
+
39
+ ```json
40
+ {
41
+ "features": {
42
+ "commands": true
43
+ }
44
+ }
45
+ ```
46
+
47
+ ### Environment variables
48
+
49
+ | Variable | Default | Description |
50
+ |---|---|---|
51
+ | `COMMANDS_CONFIG_ENABLED` | `false` | Enable `/config` command |
52
+ | `COMMANDS_DEBUG_ENABLED` | `false` | Enable `/debug` command |
53
+ | `COMMANDS_BASH_ENABLED` | `false` | Enable `/bash` shell execution (elevated) |
54
+ | `COMMANDS_RESTART_ENABLED` | `true` | Enable `/restart` command |
55
+
56
+ ## Registering a custom command
57
+
58
+ ```ts
59
+ import { registerCommand } from "@elizaos/plugin-commands";
60
+
61
+ registerCommand({
62
+ key: "ping",
63
+ description: "Ping the agent",
64
+ textAliases: ["/ping"],
65
+ scope: "both",
66
+ category: "status",
67
+ acceptsArgs: false,
68
+ });
69
+ ```
70
+
71
+ You still need an `Action` in your plugin to handle the command. Use `hasCommand()` and `detectCommand()` from `@elizaos/plugin-commands` in your action's `validate()` to match the right key.
72
+
73
+ ## Parser API
74
+
75
+ ```ts
76
+ import { hasCommand, detectCommand, normalizeCommandBody } from "@elizaos/plugin-commands";
77
+
78
+ hasCommand("/help"); // true
79
+ hasCommand("hello world"); // false
80
+ detectCommand("/think:high"); // { isCommand: true, command: { key: "think", args: ["high"], ... } }
81
+ normalizeCommandBody("@bot /status", "bot"); // "/status"
82
+ ```
83
+
package/auto-enable.ts CHANGED
@@ -10,7 +10,7 @@ function isFeatureEnabled(
10
10
  config: PluginAutoEnableContext["config"],
11
11
  key: string,
12
12
  ): boolean {
13
- const f = (config?.features as Record<string, unknown> | undefined)?.[key];
13
+ const f = (config.features as Record<string, unknown> | undefined)?.[key];
14
14
  if (f === true) return true;
15
15
  if (f && typeof f === "object" && f !== null) {
16
16
  return (f as Record<string, unknown>).enabled !== false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/plugin-commands",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.11-beta.7",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -15,8 +15,24 @@
15
15
  "./package.json": "./package.json",
16
16
  ".": {
17
17
  "types": "./dist/index.d.ts",
18
+ "eliza-source": {
19
+ "types": "./src/index.ts",
20
+ "import": "./src/index.ts",
21
+ "default": "./src/index.ts"
22
+ },
18
23
  "import": "./dist/index.js",
19
24
  "default": "./dist/index.js"
25
+ },
26
+ "./*.css": "./dist/*.css",
27
+ "./*": {
28
+ "types": "./dist/*.d.ts",
29
+ "eliza-source": {
30
+ "types": "./src/*.ts",
31
+ "import": "./src/*.ts",
32
+ "default": "./src/*.ts"
33
+ },
34
+ "import": "./dist/*.js",
35
+ "default": "./dist/*.js"
20
36
  }
21
37
  },
22
38
  "files": [
@@ -32,7 +48,7 @@
32
48
  }
33
49
  },
34
50
  "dependencies": {
35
- "@elizaos/core": "2.0.0-beta.1"
51
+ "@elizaos/core": "2.0.11-beta.7"
36
52
  },
37
53
  "devDependencies": {
38
54
  "@biomejs/biome": "^2.4.14",
@@ -42,15 +58,15 @@
42
58
  "vitest": "^4.0.18"
43
59
  },
44
60
  "scripts": {
45
- "build": "bun run build.ts",
61
+ "build": "bun run build.ts && tsc --emitDeclarationOnly",
46
62
  "dev": "bun --hot build.ts",
47
63
  "test": "vitest run",
48
64
  "clean": "rm -rf dist .turbo .turbo-tsconfig.json tsconfig.tsbuildinfo",
49
- "format": "../../node_modules/.bin/biome format --write .",
50
- "format:check": "../../node_modules/.bin/biome format .",
51
- "lint": "../../node_modules/.bin/biome check --write --unsafe .",
52
- "lint:check": "../../node_modules/.bin/biome check .",
53
- "typecheck": "tsc --noEmit"
65
+ "format": "bunx @biomejs/biome format --write .",
66
+ "format:check": "bunx @biomejs/biome format .",
67
+ "lint": "bunx @biomejs/biome check --write --unsafe .",
68
+ "lint:check": "bunx @biomejs/biome check .",
69
+ "typecheck": "tsgo --noEmit"
54
70
  },
55
71
  "publishConfig": {
56
72
  "access": "public"
@@ -58,13 +74,6 @@
58
74
  "agentConfig": {
59
75
  "pluginType": "elizaos:plugin:1.0.0",
60
76
  "pluginParameters": {
61
- "COMMANDS_ENABLED": {
62
- "type": "boolean",
63
- "description": "Enable command system",
64
- "required": false,
65
- "default": "true",
66
- "sensitive": false
67
- },
68
77
  "COMMANDS_CONFIG_ENABLED": {
69
78
  "type": "boolean",
70
79
  "description": "Enable /config command",
@@ -103,5 +112,6 @@
103
112
  "platformDetails": {
104
113
  "node": "Default export (Node.js)"
105
114
  }
106
- }
115
+ },
116
+ "gitHead": "cdbc876f793d96073d7eb0d09715a031ce0cd32e"
107
117
  }