@elizaos/plugin-commands 2.0.0-alpha.8 → 2.0.0-beta.1
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/auto-enable.ts +24 -0
- package/dist/cjs/index.cjs +23 -408
- package/dist/cjs/index.cjs.map +5 -10
- package/dist/index.js +23 -408
- package/dist/index.js.map +5 -10
- package/package.json +105 -96
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import {
|
|
3
|
-
logger
|
|
3
|
+
logger
|
|
4
4
|
} from "@elizaos/core";
|
|
5
5
|
|
|
6
6
|
// src/registry.ts
|
|
@@ -513,400 +513,16 @@ function extractCommand(text) {
|
|
|
513
513
|
return { command, remainingText: command.rawArgs };
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
-
// src/actions/commands-list.ts
|
|
517
|
-
var commandsListAction = {
|
|
518
|
-
name: "COMMANDS_LIST",
|
|
519
|
-
description: "List all available commands with their aliases. Only activates for /commands or /cmds slash commands.",
|
|
520
|
-
similes: ["/commands", "/cmds"],
|
|
521
|
-
validate: async (runtime, message) => {
|
|
522
|
-
const textRaw = message.content?.text ?? "";
|
|
523
|
-
const text = textRaw.toLowerCase();
|
|
524
|
-
const hasKeyword = text.includes("/commands") || text.includes("/cmds") || text.includes("commands");
|
|
525
|
-
const hasRegex = /^(?:\/|!)\s*(?:commands|cmds)\b/i.test(textRaw);
|
|
526
|
-
const hasContext = Boolean(runtime?.agentId || message?.roomId || message?.content);
|
|
527
|
-
const hasInput = textRaw.trim().length > 0;
|
|
528
|
-
if (!(hasKeyword && hasRegex && hasContext && hasInput)) {
|
|
529
|
-
return false;
|
|
530
|
-
}
|
|
531
|
-
const detection = detectCommand(textRaw);
|
|
532
|
-
return detection.isCommand && detection.command?.key === "commands";
|
|
533
|
-
},
|
|
534
|
-
async handler(_runtime, _message, _state, _options, callback) {
|
|
535
|
-
const commands = getEnabledCommands();
|
|
536
|
-
const lines = [`**Commands (${commands.length}):**
|
|
537
|
-
`];
|
|
538
|
-
for (const cmd of commands) {
|
|
539
|
-
const aliases = cmd.textAliases.join(", ");
|
|
540
|
-
const authNote = cmd.requiresAuth ? " [auth]" : "";
|
|
541
|
-
const elevatedNote = cmd.requiresElevated ? " [elevated]" : "";
|
|
542
|
-
lines.push(`• **${cmd.key}**: ${aliases}${authNote}${elevatedNote}`);
|
|
543
|
-
}
|
|
544
|
-
const replyText = lines.join(`
|
|
545
|
-
`);
|
|
546
|
-
await callback?.({ text: replyText });
|
|
547
|
-
return {
|
|
548
|
-
success: true,
|
|
549
|
-
text: replyText,
|
|
550
|
-
data: { commandCount: commands.length }
|
|
551
|
-
};
|
|
552
|
-
},
|
|
553
|
-
examples: [
|
|
554
|
-
[
|
|
555
|
-
{ name: "user", content: { text: "/commands" } },
|
|
556
|
-
{
|
|
557
|
-
name: "assistant",
|
|
558
|
-
content: {
|
|
559
|
-
text: `**Commands (15):**
|
|
560
|
-
|
|
561
|
-
• **help**: /help, /h, /?
|
|
562
|
-
• **status**: /status, /s...`
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
]
|
|
566
|
-
]
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
// src/actions/help.ts
|
|
570
|
-
function formatCommandList(commands) {
|
|
571
|
-
const lines = [`**Available Commands:**
|
|
572
|
-
`];
|
|
573
|
-
const categories = [
|
|
574
|
-
{ key: "status", name: "Status" },
|
|
575
|
-
{ key: "session", name: "Session" },
|
|
576
|
-
{ key: "options", name: "Options" },
|
|
577
|
-
{ key: "management", name: "Management" },
|
|
578
|
-
{ key: "media", name: "Media" },
|
|
579
|
-
{ key: "tools", name: "Tools" }
|
|
580
|
-
];
|
|
581
|
-
for (const cat of categories) {
|
|
582
|
-
const catCommands = commands.filter((c) => c.category === cat.key);
|
|
583
|
-
if (catCommands.length === 0)
|
|
584
|
-
continue;
|
|
585
|
-
lines.push(`
|
|
586
|
-
**${cat.name}:**`);
|
|
587
|
-
for (const cmd of catCommands) {
|
|
588
|
-
const aliases = cmd.textAliases.slice(0, 2).join(", ");
|
|
589
|
-
lines.push(`• ${aliases} - ${cmd.description}`);
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
const uncategorized = commands.filter((c) => !c.category);
|
|
593
|
-
if (uncategorized.length > 0) {
|
|
594
|
-
lines.push(`
|
|
595
|
-
**Other:**`);
|
|
596
|
-
for (const cmd of uncategorized) {
|
|
597
|
-
const aliases = cmd.textAliases.slice(0, 2).join(", ");
|
|
598
|
-
lines.push(`• ${aliases} - ${cmd.description}`);
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
return lines.join(`
|
|
602
|
-
`);
|
|
603
|
-
}
|
|
604
|
-
var helpAction = {
|
|
605
|
-
name: "HELP_COMMAND",
|
|
606
|
-
description: "Show available commands and their descriptions. Only activates for /help, /h, or /? slash commands.",
|
|
607
|
-
similes: ["/help", "/h", "/?"],
|
|
608
|
-
validate: async (runtime, message) => {
|
|
609
|
-
const textRaw = message.content?.text ?? "";
|
|
610
|
-
const text = textRaw.toLowerCase();
|
|
611
|
-
const hasKeyword = text.includes("/help") || text.includes("/h") || text.includes("/?");
|
|
612
|
-
const hasRegex = /^(?:\/|!)\s*(?:help|h|\?)(?:\s|$|:)/i.test(textRaw);
|
|
613
|
-
const hasContext = Boolean(runtime?.agentId || message?.roomId || message?.content);
|
|
614
|
-
const hasInput = textRaw.trim().length > 0;
|
|
615
|
-
if (!(hasKeyword && hasRegex && hasContext && hasInput)) {
|
|
616
|
-
return false;
|
|
617
|
-
}
|
|
618
|
-
const detection = detectCommand(textRaw);
|
|
619
|
-
return detection.isCommand && detection.command?.key === "help";
|
|
620
|
-
},
|
|
621
|
-
async handler(_runtime, _message, _state, _options, callback) {
|
|
622
|
-
const commands = getEnabledCommands();
|
|
623
|
-
const helpText = formatCommandList(commands);
|
|
624
|
-
await callback?.({ text: helpText });
|
|
625
|
-
return {
|
|
626
|
-
success: true,
|
|
627
|
-
text: helpText,
|
|
628
|
-
data: { commandCount: commands.length }
|
|
629
|
-
};
|
|
630
|
-
},
|
|
631
|
-
examples: [
|
|
632
|
-
[
|
|
633
|
-
{ name: "user", content: { text: "/help" } },
|
|
634
|
-
{
|
|
635
|
-
name: "assistant",
|
|
636
|
-
content: {
|
|
637
|
-
text: `**Available Commands:**
|
|
638
|
-
|
|
639
|
-
**Status:**
|
|
640
|
-
• /help - Show available commands...`
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
],
|
|
644
|
-
[
|
|
645
|
-
{ name: "user", content: { text: "/?" } },
|
|
646
|
-
{
|
|
647
|
-
name: "assistant",
|
|
648
|
-
content: {
|
|
649
|
-
text: `**Available Commands:**
|
|
650
|
-
|
|
651
|
-
**Status:**
|
|
652
|
-
• /help - Show available commands...`
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
]
|
|
656
|
-
]
|
|
657
|
-
};
|
|
658
|
-
|
|
659
|
-
// src/actions/models.ts
|
|
660
|
-
import { logger, ModelType } from "@elizaos/core";
|
|
661
|
-
function describeModelType(modelType) {
|
|
662
|
-
const descriptions = {
|
|
663
|
-
[ModelType.TEXT_SMALL]: "Text (Small)",
|
|
664
|
-
[ModelType.TEXT_LARGE]: "Text (Large)",
|
|
665
|
-
[ModelType.TEXT_REASONING_SMALL]: "Reasoning (Small)",
|
|
666
|
-
[ModelType.TEXT_REASONING_LARGE]: "Reasoning (Large)",
|
|
667
|
-
[ModelType.TEXT_COMPLETION]: "Text Completion",
|
|
668
|
-
[ModelType.TEXT_EMBEDDING]: "Embedding",
|
|
669
|
-
[ModelType.IMAGE]: "Image Generation",
|
|
670
|
-
[ModelType.IMAGE_DESCRIPTION]: "Image Description",
|
|
671
|
-
[ModelType.TRANSCRIPTION]: "Transcription",
|
|
672
|
-
[ModelType.TEXT_TO_SPEECH]: "Text-to-Speech",
|
|
673
|
-
[ModelType.AUDIO]: "Audio",
|
|
674
|
-
[ModelType.VIDEO]: "Video",
|
|
675
|
-
[ModelType.OBJECT_SMALL]: "Object (Small)",
|
|
676
|
-
[ModelType.OBJECT_LARGE]: "Object (Large)",
|
|
677
|
-
[ModelType.RESEARCH]: "Research"
|
|
678
|
-
};
|
|
679
|
-
return descriptions[modelType] ?? modelType;
|
|
680
|
-
}
|
|
681
|
-
var modelsAction = {
|
|
682
|
-
name: "MODELS_COMMAND",
|
|
683
|
-
description: "List available AI models and providers. Only activates for /models slash command.",
|
|
684
|
-
similes: ["/models"],
|
|
685
|
-
validate: async (runtime, message) => {
|
|
686
|
-
const textRaw = message.content?.text ?? "";
|
|
687
|
-
const text = textRaw.toLowerCase();
|
|
688
|
-
const hasKeyword = text.includes("/models") || text.includes("models");
|
|
689
|
-
const hasRegex = /^(?:\/|!)\s*models\b/i.test(textRaw);
|
|
690
|
-
const hasContext = Boolean(runtime?.agentId || message?.roomId || message?.content);
|
|
691
|
-
const hasInput = textRaw.trim().length > 0;
|
|
692
|
-
if (!(hasKeyword && hasRegex && hasContext && hasInput)) {
|
|
693
|
-
return false;
|
|
694
|
-
}
|
|
695
|
-
const detection = detectCommand(textRaw);
|
|
696
|
-
return detection.isCommand && detection.command?.key === "models";
|
|
697
|
-
},
|
|
698
|
-
async handler(runtime, _message, _state, _options, callback) {
|
|
699
|
-
const lines = [`**Available Models:**
|
|
700
|
-
`];
|
|
701
|
-
try {
|
|
702
|
-
const registeredTypes = [];
|
|
703
|
-
const seen = new Set;
|
|
704
|
-
for (const modelType of Object.values(ModelType)) {
|
|
705
|
-
if (seen.has(modelType))
|
|
706
|
-
continue;
|
|
707
|
-
seen.add(modelType);
|
|
708
|
-
try {
|
|
709
|
-
const handler = runtime.getModel(modelType);
|
|
710
|
-
if (handler) {
|
|
711
|
-
registeredTypes.push(modelType);
|
|
712
|
-
}
|
|
713
|
-
} catch {}
|
|
714
|
-
}
|
|
715
|
-
if (registeredTypes.length > 0) {
|
|
716
|
-
lines.push("**Registered Model Types:**");
|
|
717
|
-
for (const modelType of registeredTypes) {
|
|
718
|
-
lines.push(`• ${describeModelType(modelType)} (\`${modelType}\`)`);
|
|
719
|
-
}
|
|
720
|
-
} else {
|
|
721
|
-
lines.push("No model handlers are currently registered.");
|
|
722
|
-
}
|
|
723
|
-
const modelProvider = runtime.getSetting("MODEL_PROVIDER");
|
|
724
|
-
const modelName = runtime.getSetting("MODEL_NAME");
|
|
725
|
-
if (modelProvider || modelName) {
|
|
726
|
-
lines.push(`
|
|
727
|
-
**Current Configuration:**`);
|
|
728
|
-
if (modelProvider)
|
|
729
|
-
lines.push(`• Provider: ${modelProvider}`);
|
|
730
|
-
if (modelName)
|
|
731
|
-
lines.push(`• Model: ${modelName}`);
|
|
732
|
-
}
|
|
733
|
-
} catch (err) {
|
|
734
|
-
logger.warn({ src: "plugin-commands", err }, "Error querying runtime models");
|
|
735
|
-
lines.push("Unable to query available models.");
|
|
736
|
-
}
|
|
737
|
-
lines.push(`
|
|
738
|
-
|
|
739
|
-
_Use /model <provider/model> to switch models._`);
|
|
740
|
-
const replyText = lines.join(`
|
|
741
|
-
`);
|
|
742
|
-
await callback?.({ text: replyText });
|
|
743
|
-
return {
|
|
744
|
-
success: true,
|
|
745
|
-
text: replyText
|
|
746
|
-
};
|
|
747
|
-
},
|
|
748
|
-
examples: [
|
|
749
|
-
[
|
|
750
|
-
{ name: "user", content: { text: "/models" } },
|
|
751
|
-
{
|
|
752
|
-
name: "assistant",
|
|
753
|
-
content: {
|
|
754
|
-
text: "**Available Models:**\n\n**Registered Model Types:**\n• Text (Large) (`text_large`)\n• Text (Small) (`text_small`)..."
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
]
|
|
758
|
-
]
|
|
759
|
-
};
|
|
760
|
-
|
|
761
|
-
// src/actions/status.ts
|
|
762
|
-
async function buildStatusReport(runtime, roomId) {
|
|
763
|
-
const lines = [`**Session Status:**
|
|
764
|
-
`];
|
|
765
|
-
lines.push(`**Agent:** ${runtime.character.name ?? runtime.agentId}`);
|
|
766
|
-
lines.push(`**Room:** ${roomId}`);
|
|
767
|
-
try {
|
|
768
|
-
const directiveService = runtime.getService("directive-parser");
|
|
769
|
-
if (directiveService) {
|
|
770
|
-
const state = directiveService.getSessionState?.(roomId);
|
|
771
|
-
if (state) {
|
|
772
|
-
lines.push(`
|
|
773
|
-
**Directives:**`);
|
|
774
|
-
lines.push(`• Thinking: ${state.thinking}`);
|
|
775
|
-
lines.push(`• Verbose: ${state.verbose}`);
|
|
776
|
-
lines.push(`• Reasoning: ${state.reasoning}`);
|
|
777
|
-
lines.push(`• Elevated: ${state.elevated}`);
|
|
778
|
-
if (state.model?.provider || state.model?.model) {
|
|
779
|
-
const modelStr = state.model.provider ? `${state.model.provider}/${state.model.model}` : state.model.model;
|
|
780
|
-
lines.push(`• Model: ${modelStr}`);
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
} catch {}
|
|
785
|
-
try {
|
|
786
|
-
const tasks = await runtime.getTasks({ roomId });
|
|
787
|
-
if (tasks.length > 0) {
|
|
788
|
-
lines.push(`
|
|
789
|
-
**Tasks:** ${tasks.length} pending`);
|
|
790
|
-
}
|
|
791
|
-
} catch {}
|
|
792
|
-
return lines.join(`
|
|
793
|
-
`);
|
|
794
|
-
}
|
|
795
|
-
var statusAction = {
|
|
796
|
-
name: "STATUS_COMMAND",
|
|
797
|
-
description: "Show session directive settings via /status slash command. Only activates for /status or /s prefix.",
|
|
798
|
-
similes: ["/status", "/s"],
|
|
799
|
-
validate: async (runtime, message) => {
|
|
800
|
-
const textRaw = message.content?.text ?? "";
|
|
801
|
-
const text = textRaw.toLowerCase();
|
|
802
|
-
const hasKeyword = text.includes("/status") || text.includes("/s") || text.includes("status");
|
|
803
|
-
const hasRegex = /^(?:\/|!)\s*(?:status|s)\b/i.test(textRaw);
|
|
804
|
-
const hasContext = Boolean(runtime?.agentId || message?.roomId || message?.content);
|
|
805
|
-
const hasInput = textRaw.trim().length > 0;
|
|
806
|
-
if (!(hasKeyword && hasRegex && hasContext && hasInput)) {
|
|
807
|
-
return false;
|
|
808
|
-
}
|
|
809
|
-
const detection = detectCommand(textRaw);
|
|
810
|
-
return detection.isCommand && detection.command?.key === "status";
|
|
811
|
-
},
|
|
812
|
-
async handler(runtime, message, _state, _options, callback) {
|
|
813
|
-
const statusText = await buildStatusReport(runtime, message.roomId);
|
|
814
|
-
await callback?.({ text: statusText });
|
|
815
|
-
return {
|
|
816
|
-
success: true,
|
|
817
|
-
text: statusText
|
|
818
|
-
};
|
|
819
|
-
},
|
|
820
|
-
examples: [
|
|
821
|
-
[
|
|
822
|
-
{ name: "user", content: { text: "/status" } },
|
|
823
|
-
{
|
|
824
|
-
name: "assistant",
|
|
825
|
-
content: {
|
|
826
|
-
text: `**Session Status:**
|
|
827
|
-
|
|
828
|
-
**Agent:** Eliza
|
|
829
|
-
**Room:** room-456
|
|
830
|
-
|
|
831
|
-
**Directives:**
|
|
832
|
-
• Thinking: low...`
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
]
|
|
836
|
-
]
|
|
837
|
-
};
|
|
838
|
-
|
|
839
|
-
// src/actions/stop.ts
|
|
840
|
-
import { EventType, logger as logger2 } from "@elizaos/core";
|
|
841
|
-
var stopAction = {
|
|
842
|
-
name: "STOP_COMMAND",
|
|
843
|
-
description: "Stop current operation or abort running tasks. Triggered by /stop, /abort, or /cancel slash commands only.",
|
|
844
|
-
similes: ["/stop", "/abort", "/cancel"],
|
|
845
|
-
validate: async (runtime, message) => {
|
|
846
|
-
const textRaw = message.content?.text ?? "";
|
|
847
|
-
const text = textRaw.toLowerCase();
|
|
848
|
-
const hasKeyword = text.includes("/stop") || text.includes("/abort") || text.includes("/cancel") || text.includes("stop");
|
|
849
|
-
const hasRegex = /^(?:\/|!)\s*(?:stop|abort|cancel)\b/i.test(textRaw);
|
|
850
|
-
const hasContext = Boolean(runtime?.agentId || message?.roomId || message?.content);
|
|
851
|
-
const hasInput = textRaw.trim().length > 0;
|
|
852
|
-
if (!(hasKeyword && hasRegex && hasContext && hasInput)) {
|
|
853
|
-
return false;
|
|
854
|
-
}
|
|
855
|
-
const detection = detectCommand(textRaw);
|
|
856
|
-
return detection.isCommand && ["stop", "abort", "cancel"].includes(detection.command?.key ?? "");
|
|
857
|
-
},
|
|
858
|
-
async handler(runtime, message, _state, _options, callback) {
|
|
859
|
-
try {
|
|
860
|
-
await runtime.emitEvent(EventType.HOOK_COMMAND_STOP, {
|
|
861
|
-
runtime,
|
|
862
|
-
sessionKey: message.roomId,
|
|
863
|
-
messages: [],
|
|
864
|
-
timestamp: new Date,
|
|
865
|
-
context: {
|
|
866
|
-
entityId: message.entityId,
|
|
867
|
-
source: message.content?.source
|
|
868
|
-
},
|
|
869
|
-
command: "stop",
|
|
870
|
-
senderId: message.entityId,
|
|
871
|
-
commandSource: message.content?.source
|
|
872
|
-
});
|
|
873
|
-
} catch (err) {
|
|
874
|
-
logger2.warn({ src: "plugin-commands", err }, "Failed to emit HOOK_COMMAND_STOP event");
|
|
875
|
-
}
|
|
876
|
-
const replyText = "✓ Stop requested. Current operations will be cancelled.";
|
|
877
|
-
await callback?.({ text: replyText });
|
|
878
|
-
return {
|
|
879
|
-
success: true,
|
|
880
|
-
text: replyText
|
|
881
|
-
};
|
|
882
|
-
},
|
|
883
|
-
examples: [
|
|
884
|
-
[
|
|
885
|
-
{ name: "user", content: { text: "/stop" } },
|
|
886
|
-
{
|
|
887
|
-
name: "assistant",
|
|
888
|
-
content: {
|
|
889
|
-
text: "✓ Stop requested. Current operations will be cancelled."
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
],
|
|
893
|
-
[
|
|
894
|
-
{ name: "user", content: { text: "/abort" } },
|
|
895
|
-
{
|
|
896
|
-
name: "assistant",
|
|
897
|
-
content: {
|
|
898
|
-
text: "✓ Stop requested. Current operations will be cancelled."
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
]
|
|
902
|
-
]
|
|
903
|
-
};
|
|
904
|
-
|
|
905
516
|
// src/index.ts
|
|
906
517
|
var commandRegistryProvider = {
|
|
907
518
|
name: "COMMAND_REGISTRY",
|
|
908
519
|
description: "Available chat commands and their descriptions",
|
|
520
|
+
descriptionCompressed: "Available chat commands and descriptions.",
|
|
909
521
|
dynamic: true,
|
|
522
|
+
contexts: ["general", "automation"],
|
|
523
|
+
contextGate: { anyOf: ["general", "automation"] },
|
|
524
|
+
cacheStable: true,
|
|
525
|
+
cacheScope: "agent",
|
|
910
526
|
async get(runtime, message, _state) {
|
|
911
527
|
useRuntime(runtime.agentId);
|
|
912
528
|
const text = message.content?.text ?? "";
|
|
@@ -963,13 +579,12 @@ var commandsPlugin = {
|
|
|
963
579
|
name: "commands",
|
|
964
580
|
description: "Chat command system with /help, /status, /reset, etc.",
|
|
965
581
|
providers: [commandRegistryProvider],
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
],
|
|
582
|
+
autoEnable: {
|
|
583
|
+
shouldEnable: (_env, config) => {
|
|
584
|
+
const f = config?.features?.commands;
|
|
585
|
+
return f === true || typeof f === "object" && f !== null && f.enabled !== false;
|
|
586
|
+
}
|
|
587
|
+
},
|
|
973
588
|
config: {
|
|
974
589
|
COMMANDS_ENABLED: "true",
|
|
975
590
|
COMMANDS_CONFIG_ENABLED: "false",
|
|
@@ -993,7 +608,7 @@ var commandsPlugin = {
|
|
|
993
608
|
if (hasCommand("hello world")) {
|
|
994
609
|
throw new Error("Should not detect plain text as command");
|
|
995
610
|
}
|
|
996
|
-
|
|
611
|
+
logger.success("Command prefix detection works correctly");
|
|
997
612
|
}
|
|
998
613
|
},
|
|
999
614
|
{
|
|
@@ -1009,7 +624,7 @@ var commandsPlugin = {
|
|
|
1009
624
|
if (detection.command?.args[0] !== "high") {
|
|
1010
625
|
throw new Error(`Expected arg 'high', got '${detection.command?.args[0]}'`);
|
|
1011
626
|
}
|
|
1012
|
-
|
|
627
|
+
logger.success("Command argument parsing works correctly");
|
|
1013
628
|
}
|
|
1014
629
|
},
|
|
1015
630
|
{
|
|
@@ -1023,7 +638,7 @@ var commandsPlugin = {
|
|
|
1023
638
|
if (normalized2 !== "/help") {
|
|
1024
639
|
throw new Error(`Expected '/help', got '${normalized2}'`);
|
|
1025
640
|
}
|
|
1026
|
-
|
|
641
|
+
logger.success("Command normalization works correctly");
|
|
1027
642
|
}
|
|
1028
643
|
},
|
|
1029
644
|
{
|
|
@@ -1036,7 +651,7 @@ var commandsPlugin = {
|
|
|
1036
651
|
if (cmd.key !== "help") {
|
|
1037
652
|
throw new Error(`Expected key 'help', got '${cmd.key}'`);
|
|
1038
653
|
}
|
|
1039
|
-
|
|
654
|
+
logger.success("Command alias lookup works correctly");
|
|
1040
655
|
}
|
|
1041
656
|
},
|
|
1042
657
|
{
|
|
@@ -1049,7 +664,7 @@ var commandsPlugin = {
|
|
|
1049
664
|
if (cmd.key !== "status") {
|
|
1050
665
|
throw new Error(`Expected key 'status', got '${cmd.key}'`);
|
|
1051
666
|
}
|
|
1052
|
-
|
|
667
|
+
logger.success("Command key lookup works correctly");
|
|
1053
668
|
}
|
|
1054
669
|
}
|
|
1055
670
|
]
|
|
@@ -1069,7 +684,7 @@ var commandsPlugin = {
|
|
|
1069
684
|
if (!cmdHelp || !cmdStatus) {
|
|
1070
685
|
throw new Error("Should have help and status commands");
|
|
1071
686
|
}
|
|
1072
|
-
|
|
687
|
+
logger.success("Command registry works correctly");
|
|
1073
688
|
}
|
|
1074
689
|
},
|
|
1075
690
|
{
|
|
@@ -1091,7 +706,7 @@ var commandsPlugin = {
|
|
|
1091
706
|
if (notFound) {
|
|
1092
707
|
throw new Error("Should not find unregistered command");
|
|
1093
708
|
}
|
|
1094
|
-
|
|
709
|
+
logger.success("Custom command registration works correctly");
|
|
1095
710
|
}
|
|
1096
711
|
},
|
|
1097
712
|
{
|
|
@@ -1105,14 +720,14 @@ var commandsPlugin = {
|
|
|
1105
720
|
if (!allStatus) {
|
|
1106
721
|
throw new Error("All returned commands should be in status category");
|
|
1107
722
|
}
|
|
1108
|
-
|
|
723
|
+
logger.success("Command categorization works correctly");
|
|
1109
724
|
}
|
|
1110
725
|
}
|
|
1111
726
|
]
|
|
1112
727
|
}
|
|
1113
728
|
],
|
|
1114
729
|
async init(config, runtime) {
|
|
1115
|
-
|
|
730
|
+
logger.log("[plugin-commands] Initializing command system");
|
|
1116
731
|
initForRuntime(runtime.agentId);
|
|
1117
732
|
const configEnabled = config.COMMANDS_CONFIG_ENABLED === "true";
|
|
1118
733
|
const debugEnabled = config.COMMANDS_DEBUG_ENABLED === "true";
|
|
@@ -1135,7 +750,7 @@ var commandsPlugin = {
|
|
|
1135
750
|
restartCmd.enabled = restartEnabled;
|
|
1136
751
|
}
|
|
1137
752
|
const enabledCount = getEnabledCommands().length;
|
|
1138
|
-
|
|
753
|
+
logger.log(`[plugin-commands] ${enabledCount} commands enabled for agent ${runtime.agentId}`);
|
|
1139
754
|
}
|
|
1140
755
|
};
|
|
1141
756
|
var src_default = commandsPlugin;
|
|
@@ -1166,4 +781,4 @@ export {
|
|
|
1166
781
|
commandRegistryProvider
|
|
1167
782
|
};
|
|
1168
783
|
|
|
1169
|
-
//# debugId=
|
|
784
|
+
//# debugId=BAB16333EBF522DA64756E2164756E21
|