@@ -40,12 +40,7 @@ import {
4040import type { WalletResolution } from "./auth.js" ;
4141import type { RoutingConfig } from "./router/index.js" ;
4242import { BalanceMonitor } from "./balance.js" ;
43- import {
44- loadExcludeList ,
45- addExclusion ,
46- removeExclusion ,
47- clearExclusions ,
48- } from "./exclude-models.js" ;
43+ import { loadExcludeList } from "./exclude-models.js" ;
4944
5045/**
5146 * Wait for proxy health check to pass (quick check, not RPC).
@@ -83,6 +78,7 @@ import { privateKeyToAccount } from "viem/accounts";
8378import { getStats } from "./stats.js" ;
8479import { buildPartnerTools , PARTNER_SERVICES } from "./partners/index.js" ;
8580import { createStatsCommand } from "./commands/stats.js" ;
81+ import { createExcludeCommand } from "./commands/exclude.js" ;
8682
8783/**
8884 * Install ClawRouter skills into OpenClaw's workspace skills directory.
@@ -676,92 +672,7 @@ async function startProxyInBackground(api: OpenClawPluginApi): Promise<void> {
676672
677673// createStatsCommand moved to src/commands/stats.ts
678674
679- /**
680- * /exclude command handler for ClawRouter.
681- * Manages excluded models — /exclude add|remove|clear <model>
682- */
683- function createExcludeCommand ( ) : OpenClawPluginCommandDefinition {
684- return {
685- name : "exclude" ,
686- description : "Manage excluded models — /exclude add|remove|clear <model>" ,
687- acceptsArgs : true ,
688- requireAuth : true ,
689- handler : async ( ctx : PluginCommandContext ) => {
690- const args = ctx . args ?. trim ( ) || "" ;
691- const parts = args . split ( / \s + / ) ;
692- const subcommand = parts [ 0 ] ?. toLowerCase ( ) || "" ;
693- const modelArg = parts . slice ( 1 ) . join ( " " ) . trim ( ) ;
694-
695- // /exclude (no args) — show current list
696- if ( ! subcommand ) {
697- const list = loadExcludeList ( ) ;
698- if ( list . size === 0 ) {
699- return {
700- text : "No models excluded.\n\nUsage:\n /exclude add <model> — block a model\n /exclude remove <model> — unblock\n /exclude clear — remove all" ,
701- } ;
702- }
703- const models = [ ...list ]
704- . sort ( )
705- . map ( ( m ) => ` • ${ m } ` )
706- . join ( "\n" ) ;
707- return {
708- text : `Excluded models (${ list . size } ):\n${ models } \n\nUse /exclude remove <model> to unblock.` ,
709- } ;
710- }
711-
712- // /exclude add <model>
713- if ( subcommand === "add" ) {
714- if ( ! modelArg ) {
715- return {
716- text : "Usage: /exclude add <model>\nExample: /exclude add nvidia/gpt-oss-120b" ,
717- isError : true ,
718- } ;
719- }
720- const resolved = addExclusion ( modelArg ) ;
721- const list = loadExcludeList ( ) ;
722- return {
723- text : `Excluded: ${ resolved } \n\nActive exclusions (${ list . size } ):\n${ [ ...list ]
724- . sort ( )
725- . map ( ( m ) => ` • ${ m } ` )
726- . join ( "\n" ) } `,
727- } ;
728- }
729-
730- // /exclude remove <model>
731- if ( subcommand === "remove" ) {
732- if ( ! modelArg ) {
733- return { text : "Usage: /exclude remove <model>" , isError : true } ;
734- }
735- const removed = removeExclusion ( modelArg ) ;
736- if ( ! removed ) {
737- return { text : `Model "${ modelArg } " was not in the exclude list.` } ;
738- }
739- const list = loadExcludeList ( ) ;
740- return {
741- text : `Unblocked: ${ modelArg } \n\nActive exclusions (${ list . size } ):\n${
742- list . size > 0
743- ? [ ...list ]
744- . sort ( )
745- . map ( ( m ) => ` • ${ m } ` )
746- . join ( "\n" )
747- : " (none)"
748- } `,
749- } ;
750- }
751-
752- // /exclude clear
753- if ( subcommand === "clear" ) {
754- clearExclusions ( ) ;
755- return { text : "All model exclusions cleared." } ;
756- }
757-
758- return {
759- text : `Unknown subcommand: ${ subcommand } \n\nUsage:\n /exclude — show list\n /exclude add <model>\n /exclude remove <model>\n /exclude clear` ,
760- isError : true ,
761- } ;
762- } ,
763- } ;
764- }
675+ // createExcludeCommand moved to src/commands/exclude.ts
765676
766677/**
767678 * /wallet command handler for ClawRouter.
0 commit comments