too-many-claw 1.0.0

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.
@@ -0,0 +1,650 @@
1
+ import { TextChannel } from 'discord.js';
2
+
3
+ /**
4
+ * Too Many Claw - Core Types and Interfaces
5
+ */
6
+ /** Agent state - DORMANT (inactive) or ACTIVE (participating in conversation) */
7
+ declare enum AgentState {
8
+ DORMANT = "DORMANT",
9
+ ACTIVE = "ACTIVE"
10
+ }
11
+ /** Model tier mapping to Claude models */
12
+ declare enum ModelTier {
13
+ OPUS = "claude-opus-4-5",
14
+ SONNET = "claude-sonnet-4-5",
15
+ HAIKU = "claude-haiku-4-5"
16
+ }
17
+ /** Agent categories for grouping */
18
+ declare enum AgentCategory {
19
+ CORE = "CORE",
20
+ RESEARCH = "RESEARCH",
21
+ PSYCHOLOGY = "PSYCHOLOGY",
22
+ PLANNING = "PLANNING",
23
+ DEVELOPMENT = "DEVELOPMENT",
24
+ TESTING = "TESTING",
25
+ CRITIQUE = "CRITIQUE",
26
+ SPECIAL = "SPECIAL"
27
+ }
28
+ /** Static agent definition */
29
+ interface AgentDefinition {
30
+ /** Unique agent ID (e.g., 'base', 'searcher') */
31
+ id: string;
32
+ /** Display name in Korean (e.g., '검색 전문가') */
33
+ name: string;
34
+ /** Single emoji for the agent */
35
+ emoji: string;
36
+ /** Detailed role description in Korean */
37
+ role: string;
38
+ /** Agent category */
39
+ category: AgentCategory;
40
+ /** Model tier to use */
41
+ model: ModelTier;
42
+ /** If true, agent is always active (only for base) */
43
+ alwaysActive?: boolean;
44
+ }
45
+ /** Runtime agent instance */
46
+ interface AgentInstance {
47
+ /** Static definition */
48
+ definition: AgentDefinition;
49
+ /** Current state */
50
+ state: AgentState;
51
+ /** When the agent was activated */
52
+ activatedAt?: Date;
53
+ /** Who activated the agent (agent id or 'user') */
54
+ activatedBy?: string;
55
+ }
56
+ /** Message in the conversation */
57
+ interface Message {
58
+ /** Unique message ID */
59
+ id: string;
60
+ /** Message content */
61
+ content: string;
62
+ /** Author's agent ID or 'user' */
63
+ authorId: string;
64
+ /** Author's display name */
65
+ authorName: string;
66
+ /** Author's emoji */
67
+ authorEmoji: string;
68
+ /** Message timestamp */
69
+ timestamp: Date;
70
+ /** Thread ID if in a thread */
71
+ threadId?: string;
72
+ /** Agent IDs mentioned in the message */
73
+ mentions: string[];
74
+ /** Is this an entry (입장) message */
75
+ isEntry?: boolean;
76
+ /** Is this an exit (퇴장) message */
77
+ isExit?: boolean;
78
+ }
79
+ /** Platform adapter interface for Discord, terminal, etc. */
80
+ interface PlatformAdapter {
81
+ /** Send a message to the chat */
82
+ sendMessage(message: Message): Promise<void>;
83
+ /** Send status update (enter/exit) to status channel */
84
+ sendStatusUpdate(agentId: string, status: 'enter' | 'exit'): Promise<void>;
85
+ /** Register message handler */
86
+ onMessage(handler: (message: Message) => void): void;
87
+ /** Create a new thread */
88
+ createThread(name: string): Promise<string>;
89
+ }
90
+ /** Agent configuration entry for openclaw.json */
91
+ interface AgentConfigEntry {
92
+ /** Agent ID */
93
+ id: string;
94
+ /** Display name */
95
+ name: string;
96
+ /** Model to use */
97
+ model: string;
98
+ /** Workspace path */
99
+ workspace: string;
100
+ /** Subagent configuration */
101
+ subagents: {
102
+ allowAgents: string[];
103
+ };
104
+ }
105
+ /** OpenClaw main configuration structure */
106
+ interface OpenClawConfig {
107
+ tools: {
108
+ agentToAgent: {
109
+ enabled: boolean;
110
+ allow: string[];
111
+ };
112
+ };
113
+ agents: {
114
+ list: AgentConfigEntry[];
115
+ };
116
+ }
117
+ /** Too Many Claw specific configuration */
118
+ interface TooManyClawConfig {
119
+ discord?: {
120
+ botToken?: string;
121
+ guildId?: string;
122
+ chatChannelId?: string;
123
+ statusChannelId?: string;
124
+ webhooks: Record<string, string>;
125
+ };
126
+ simulation?: {
127
+ enabled: boolean;
128
+ };
129
+ }
130
+ /** Combined configuration */
131
+ interface Config {
132
+ openclaw: OpenClawConfig;
133
+ tooManyClaw: TooManyClawConfig;
134
+ }
135
+
136
+ /**
137
+ * Too Many Claw - Agent Definitions
138
+ * All 35 agents with their metadata
139
+ */
140
+
141
+ /** All 35 agent definitions */
142
+ declare const AGENT_DEFINITIONS: AgentDefinition[];
143
+ /**
144
+ * Get agent definition by ID
145
+ */
146
+ declare function getAgentById(id: string): AgentDefinition | undefined;
147
+ /**
148
+ * Get all agents in a category
149
+ */
150
+ declare function getAgentsByCategory(category: AgentCategory): AgentDefinition[];
151
+ /**
152
+ * Get all agents using a specific model tier
153
+ */
154
+ declare function getAgentsByModel(model: ModelTier): AgentDefinition[];
155
+ /**
156
+ * Get all agent IDs
157
+ */
158
+ declare function getAllAgentIds(): string[];
159
+
160
+ /**
161
+ * Too Many Claw - Agent SOUL Templates
162
+ * Each template defines the agent's personality, expertise, and behavior
163
+ */
164
+ declare const SOUL_TEMPLATES: Record<string, string>;
165
+ /**
166
+ * Get SOUL template by agent ID
167
+ */
168
+ declare function getSoulTemplate(agentId: string): string | undefined;
169
+
170
+ /**
171
+ * Too Many Claw - State Manager
172
+ * Manages DORMANT/ACTIVE states for all 35 agents
173
+ */
174
+
175
+ declare class StateManager {
176
+ private agents;
177
+ constructor();
178
+ /**
179
+ * Initialize all agents - DORMANT by default, base is ACTIVE
180
+ */
181
+ private initialize;
182
+ /**
183
+ * Activate an agent
184
+ */
185
+ activateAgent(id: string, activatedBy: string): boolean;
186
+ /**
187
+ * Deactivate an agent (except alwaysActive agents)
188
+ */
189
+ deactivateAgent(id: string): boolean;
190
+ /**
191
+ * Get all active agents
192
+ */
193
+ getActiveAgents(): AgentInstance[];
194
+ /**
195
+ * Check if an agent is active
196
+ */
197
+ isActive(id: string): boolean;
198
+ /**
199
+ * Get a specific agent instance
200
+ */
201
+ getAgent(id: string): AgentInstance | undefined;
202
+ /**
203
+ * Get all agents
204
+ */
205
+ getAllAgents(): AgentInstance[];
206
+ /**
207
+ * Get count of active agents
208
+ */
209
+ getActiveCount(): number;
210
+ /**
211
+ * Get count of dormant agents
212
+ */
213
+ getDormantCount(): number;
214
+ /**
215
+ * Reset all agents to initial state
216
+ */
217
+ reset(): void;
218
+ }
219
+
220
+ /**
221
+ * Too Many Claw - Message Router
222
+ * Routes messages and parses @mentions
223
+ */
224
+
225
+ declare class MessageRouter {
226
+ private agentIds;
227
+ constructor();
228
+ /**
229
+ * Parse @mentions from message content
230
+ * Returns array of valid agent IDs mentioned
231
+ */
232
+ parseMentions(content: string): string[];
233
+ /**
234
+ * Check if content mentions a specific agent
235
+ */
236
+ mentionsAgent(content: string, agentId: string): boolean;
237
+ /**
238
+ * Get agent definitions for all mentioned agents
239
+ */
240
+ getMentionedAgents(content: string): AgentDefinition[];
241
+ /**
242
+ * Format entry message (입장)
243
+ * Example: "🔬 Tech Researcher (입장) 알겠어, 조사해볼게."
244
+ */
245
+ formatEntryMessage(agent: AgentDefinition, content: string): string;
246
+ /**
247
+ * Format exit message (퇴장)
248
+ * Example: "🔬 Tech Researcher 조사 완료. (퇴장)"
249
+ */
250
+ formatExitMessage(agent: AgentDefinition, content: string): string;
251
+ /**
252
+ * Format regular message
253
+ * Example: "🔬 Tech Researcher: 내용..."
254
+ */
255
+ formatMessage(agent: AgentDefinition, content: string): string;
256
+ /**
257
+ * Create a new Message object
258
+ */
259
+ createMessage(authorId: string, content: string, options?: {
260
+ threadId?: string;
261
+ isEntry?: boolean;
262
+ isExit?: boolean;
263
+ }): Message;
264
+ /**
265
+ * Create a user message
266
+ */
267
+ createUserMessage(content: string, threadId?: string): Message;
268
+ }
269
+
270
+ /**
271
+ * Too Many Claw - Agent Base Class
272
+ */
273
+
274
+ declare class Agent {
275
+ readonly definition: AgentDefinition;
276
+ private _state;
277
+ private _activatedAt?;
278
+ private _activatedBy?;
279
+ private messageRouter;
280
+ constructor(definition: AgentDefinition);
281
+ get state(): AgentState;
282
+ get isActive(): boolean;
283
+ get isDormant(): boolean;
284
+ get id(): string;
285
+ get name(): string;
286
+ get emoji(): string;
287
+ get activatedAt(): Date | undefined;
288
+ get activatedBy(): string | undefined;
289
+ /**
290
+ * Activate this agent
291
+ */
292
+ activate(activatedBy: string): boolean;
293
+ /**
294
+ * Deactivate this agent (unless alwaysActive)
295
+ */
296
+ deactivate(): boolean;
297
+ /**
298
+ * Send entry message (입장)
299
+ */
300
+ enter(platform: PlatformAdapter, content: string): Promise<void>;
301
+ /**
302
+ * Send exit message (퇴장)
303
+ */
304
+ exit(platform: PlatformAdapter, content: string): Promise<void>;
305
+ /**
306
+ * Send regular message
307
+ */
308
+ speak(platform: PlatformAdapter, content: string): Promise<void>;
309
+ /**
310
+ * Convert to AgentInstance format
311
+ */
312
+ toInstance(): AgentInstance;
313
+ }
314
+
315
+ /**
316
+ * Too Many Claw - Orchestrator
317
+ * Main coordinator that manages agent lifecycle and message routing
318
+ */
319
+
320
+ declare class Orchestrator {
321
+ private stateManager;
322
+ private messageRouter;
323
+ private platform;
324
+ private agents;
325
+ constructor(platform: PlatformAdapter);
326
+ /**
327
+ * Handle incoming user message
328
+ * Base agent analyzes and routes appropriately
329
+ */
330
+ handleUserMessage(message: Message): Promise<void>;
331
+ /**
332
+ * Summon an agent (activate and announce)
333
+ */
334
+ summonAgent(id: string, reason?: string): Promise<boolean>;
335
+ /**
336
+ * Dismiss an agent (deactivate and announce)
337
+ */
338
+ dismissAgent(id: string, reason?: string): Promise<boolean>;
339
+ /**
340
+ * Get all active agent IDs
341
+ */
342
+ getActiveAgentIds(): string[];
343
+ /**
344
+ * Get all active agents
345
+ */
346
+ getActiveAgents(): Agent[];
347
+ /**
348
+ * Check if an agent is active
349
+ */
350
+ isAgentActive(id: string): boolean;
351
+ /**
352
+ * Get a specific agent
353
+ */
354
+ getAgent(id: string): Agent | undefined;
355
+ /**
356
+ * Get current status summary
357
+ */
358
+ getStatus(): {
359
+ active: number;
360
+ dormant: number;
361
+ activeIds: string[];
362
+ };
363
+ /**
364
+ * Reset all agents to initial state
365
+ */
366
+ reset(): void;
367
+ }
368
+
369
+ /**
370
+ * Too Many Claw - Discord Bot
371
+ * Main Discord bot that receives messages
372
+ */
373
+
374
+ interface BotConfig {
375
+ token: string;
376
+ guildId: string;
377
+ chatChannelId: string;
378
+ statusChannelId?: string;
379
+ }
380
+ declare class Bot {
381
+ private client;
382
+ private config;
383
+ private messageHandlers;
384
+ private agentIds;
385
+ constructor(config: BotConfig);
386
+ private setupEventHandlers;
387
+ private convertMessage;
388
+ private cleanMessageContent;
389
+ private parseMentions;
390
+ /**
391
+ * Register a message handler
392
+ */
393
+ onMessage(handler: (message: Message) => void): void;
394
+ /**
395
+ * Connect to Discord
396
+ */
397
+ connect(): Promise<void>;
398
+ /**
399
+ * Disconnect from Discord
400
+ */
401
+ disconnect(): Promise<void>;
402
+ /**
403
+ * Send a message to a channel
404
+ */
405
+ sendMessage(channelId: string, content: string): Promise<void>;
406
+ /**
407
+ * Get the chat channel
408
+ */
409
+ getChatChannel(): Promise<TextChannel | null>;
410
+ /**
411
+ * Get the status channel
412
+ */
413
+ getStatusChannel(): Promise<TextChannel | null>;
414
+ /**
415
+ * Create a thread in the chat channel
416
+ */
417
+ createThread(name: string): Promise<string>;
418
+ /**
419
+ * Check if bot is connected
420
+ */
421
+ get isConnected(): boolean;
422
+ }
423
+
424
+ /**
425
+ * Too Many Claw - Discord Webhook Manager
426
+ * Manages webhooks for 35 agent personas
427
+ */
428
+ declare class WebhookManager {
429
+ private webhooks;
430
+ private clients;
431
+ /**
432
+ * Register a webhook URL for an agent
433
+ */
434
+ setWebhook(agentId: string, webhookUrl: string): void;
435
+ /**
436
+ * Bulk register webhooks from config
437
+ */
438
+ setWebhooks(webhooks: Record<string, string>): void;
439
+ /**
440
+ * Check if webhook exists for an agent
441
+ */
442
+ hasWebhook(agentId: string): boolean;
443
+ /**
444
+ * Send message as an agent via webhook
445
+ */
446
+ sendAsAgent(agentId: string, content: string): Promise<void>;
447
+ /**
448
+ * Get all registered agent IDs
449
+ */
450
+ getRegisteredAgents(): string[];
451
+ /**
452
+ * Remove a webhook
453
+ */
454
+ removeWebhook(agentId: string): void;
455
+ /**
456
+ * Destroy all webhook clients
457
+ */
458
+ destroy(): void;
459
+ }
460
+
461
+ /**
462
+ * Too Many Claw - Discord Platform Adapter
463
+ * Implements PlatformAdapter interface for Discord
464
+ */
465
+
466
+ declare class DiscordAdapter implements PlatformAdapter {
467
+ private bot;
468
+ private webhookManager;
469
+ private statusChannelId?;
470
+ constructor(config: BotConfig);
471
+ /**
472
+ * Send a message - uses webhook if available, otherwise bot
473
+ */
474
+ sendMessage(message: Message): Promise<void>;
475
+ /**
476
+ * Send status update to status channel
477
+ */
478
+ sendStatusUpdate(agentId: string, status: 'enter' | 'exit'): Promise<void>;
479
+ /**
480
+ * Register message handler
481
+ */
482
+ onMessage(handler: (message: Message) => void): void;
483
+ /**
484
+ * Create a new thread
485
+ */
486
+ createThread(name: string): Promise<string>;
487
+ /**
488
+ * Connect to Discord
489
+ */
490
+ connect(): Promise<void>;
491
+ /**
492
+ * Disconnect from Discord
493
+ */
494
+ disconnect(): Promise<void>;
495
+ /**
496
+ * Set webhook for an agent
497
+ */
498
+ setWebhook(agentId: string, webhookUrl: string): void;
499
+ /**
500
+ * Bulk set webhooks
501
+ */
502
+ setWebhooks(webhooks: Record<string, string>): void;
503
+ /**
504
+ * Check if agent has a webhook
505
+ */
506
+ hasWebhook(agentId: string): boolean;
507
+ /**
508
+ * Check if connected
509
+ */
510
+ get isConnected(): boolean;
511
+ }
512
+
513
+ /**
514
+ * Too Many Claw - Terminal Platform Adapter
515
+ * Implements PlatformAdapter for terminal simulation
516
+ */
517
+
518
+ declare class TerminalAdapter implements PlatformAdapter {
519
+ private messageHandler?;
520
+ private threadCounter;
521
+ /**
522
+ * Send a message - prints to console with colors
523
+ */
524
+ sendMessage(message: Message): Promise<void>;
525
+ /**
526
+ * Send status update
527
+ */
528
+ sendStatusUpdate(agentId: string, status: 'enter' | 'exit'): Promise<void>;
529
+ /**
530
+ * Register message handler
531
+ */
532
+ onMessage(handler: (message: Message) => void): void;
533
+ /**
534
+ * Simulate thread creation
535
+ */
536
+ createThread(name: string): Promise<string>;
537
+ /**
538
+ * Trigger a message from user input
539
+ */
540
+ triggerMessage(content: string): void;
541
+ private parseMentions;
542
+ private getAgentColor;
543
+ /**
544
+ * Print system message
545
+ */
546
+ printSystem(message: string): void;
547
+ /**
548
+ * Print error message
549
+ */
550
+ printError(message: string): void;
551
+ }
552
+
553
+ /**
554
+ * Too Many Claw - Terminal UI
555
+ * Interactive terminal interface for simulation
556
+ */
557
+ declare class TerminalUI {
558
+ private adapter;
559
+ private orchestrator;
560
+ private rl;
561
+ private isRunning;
562
+ constructor();
563
+ /**
564
+ * Start the terminal UI
565
+ */
566
+ start(): Promise<void>;
567
+ /**
568
+ * Stop the terminal UI
569
+ */
570
+ stop(): void;
571
+ private printWelcome;
572
+ private printHelp;
573
+ private inputLoop;
574
+ private prompt;
575
+ private handleInput;
576
+ private handleCommand;
577
+ private printStatus;
578
+ private printAllAgents;
579
+ private handleSummon;
580
+ private handleDismiss;
581
+ }
582
+
583
+ /**
584
+ * Too Many Claw - Configuration Manager
585
+ */
586
+ interface DiscordConfig {
587
+ token?: string;
588
+ guildId?: string;
589
+ chatChannelId?: string;
590
+ statusChannelId?: string;
591
+ }
592
+ declare class ConfigManager {
593
+ private configPath;
594
+ private config;
595
+ constructor();
596
+ /**
597
+ * Load configuration from disk
598
+ */
599
+ private load;
600
+ /**
601
+ * Save configuration to disk
602
+ */
603
+ private save;
604
+ /**
605
+ * Get Discord configuration
606
+ */
607
+ getDiscordConfig(): DiscordConfig;
608
+ /**
609
+ * Set Discord configuration
610
+ */
611
+ setDiscordConfig(discord: DiscordConfig): void;
612
+ /**
613
+ * Check if Discord is configured
614
+ */
615
+ isDiscordConfigured(): boolean;
616
+ /**
617
+ * Get webhook URL for an agent
618
+ */
619
+ getWebhook(agentId: string): string | undefined;
620
+ /**
621
+ * Set webhook URL for an agent
622
+ */
623
+ setWebhook(agentId: string, webhookUrl: string): void;
624
+ /**
625
+ * Check if agent has a webhook
626
+ */
627
+ hasWebhook(agentId: string): boolean;
628
+ /**
629
+ * Remove webhook for an agent
630
+ */
631
+ removeWebhook(agentId: string): void;
632
+ /**
633
+ * Get all webhooks
634
+ */
635
+ getAllWebhooks(): Record<string, string>;
636
+ /**
637
+ * Set all webhooks
638
+ */
639
+ setAllWebhooks(webhooks: Record<string, string>): void;
640
+ /**
641
+ * Get config file path
642
+ */
643
+ getConfigPath(): string;
644
+ /**
645
+ * Reset configuration
646
+ */
647
+ reset(): void;
648
+ }
649
+
650
+ export { AGENT_DEFINITIONS, Agent, AgentCategory, type AgentConfigEntry, type AgentDefinition, type AgentInstance, AgentState, Bot, type Config, ConfigManager, DiscordAdapter, type Message, MessageRouter, ModelTier, type OpenClawConfig, Orchestrator, type PlatformAdapter, SOUL_TEMPLATES, StateManager, TerminalAdapter, TerminalUI, type TooManyClawConfig, WebhookManager, getAgentById, getAgentsByCategory, getAgentsByModel, getAllAgentIds, getSoulTemplate };