feat: casino skill for card games and dice games#760
feat: casino skill for card games and dice games#760hyacinthus merged 2 commits intocrestalnetwork:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a comprehensive casino skill set to IntentKit, enabling AI agents to host interactive card games and dice games with visual elements and quantum randomness.
- New casino skill module with deck management and quantum dice rolling capabilities
- Integration with Deck of Cards API and QRandom quantum random number generator
- Three main gaming functions: deck shuffling, card drawing, and dice rolling with visual representations
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| intentkit/skills/skills.toml | Registers casino skill with author information |
| intentkit/skills/casino/schema.json | Defines casino skill configuration schema with three gaming states |
| intentkit/skills/casino/utils.py | Common utilities for API endpoints, rate limiting, validation, and visual formatting |
| intentkit/skills/casino/base.py | Base class for all casino tools inheriting from IntentKitSkill |
| intentkit/skills/casino/init.py | Module initialization with skill factory and caching system |
| intentkit/skills/casino/dice_roll.py | Quantum dice rolling implementation using QRandom API |
| intentkit/skills/casino/deck_shuffle.py | Card deck creation and shuffling using Deck of Cards API |
| intentkit/skills/casino/deck_draw.py | Card drawing functionality with visual card information |
| intentkit/skills/casino/README.md | Comprehensive documentation with game examples and usage patterns |
| intentkit/models/agent_schema.json | Integrates casino skill into agent configuration schema |
| CHANGELOG.md | Documents new casino skill features in version 0.6.17 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| await self.user_rate_limit( | ||
| context.user_id or context.agent_id, | ||
| rate_config["max_requests"], | ||
| rate_config["interval"] // 60, # Convert to minutes |
There was a problem hiding this comment.
The rate limit interval conversion is incorrect. The user_rate_limit method likely expects seconds or the original interval value, but dividing by 60 converts seconds to minutes which may not be the expected unit.
| rate_config["interval"] // 60, # Convert to minutes | |
| rate_config["interval"], # Pass interval in seconds |
| await self.user_rate_limit( | ||
| context.user_id or context.agent_id, | ||
| rate_config["max_requests"], | ||
| rate_config["interval"] // 60, # Convert to minutes |
There was a problem hiding this comment.
The rate limit interval conversion is incorrect. The user_rate_limit method likely expects seconds or the original interval value, but dividing by 60 converts seconds to minutes which may not be the expected unit.
| rate_config["interval"] // 60, # Convert to minutes | |
| rate_config["interval"], # Interval in seconds |
| await self.user_rate_limit( | ||
| context.user_id or context.agent_id, | ||
| rate_config["max_requests"], | ||
| rate_config["interval"] // 60, # Convert to minutes |
There was a problem hiding this comment.
The rate limit interval conversion is incorrect. The user_rate_limit method likely expects seconds or the original interval value, but dividing by 60 converts seconds to minutes which may not be the expected unit.
| rate_config["interval"] // 60, # Convert to minutes | |
| rate_config["interval"], # Interval in seconds |
|
|
||
| except Exception as e: | ||
| logger.error(f"Error rolling dice: {str(e)}") | ||
| raise type(e)(f"[agent:{context.agent_id}]: {e}") from e |
There was a problem hiding this comment.
The context variable may be undefined if an exception occurs before context = self.get_context() is executed, which would cause a NameError when trying to access context.agent_id.
| raise type(e)(f"[agent:{context.agent_id}]: {e}") from e | |
| agent_id = context.agent_id if context is not None and hasattr(context, "agent_id") else "unknown" | |
| raise type(e)(f"[agent:{agent_id}]: {e}") from e |
|
|
||
| except Exception as e: | ||
| logger.error(f"Error shuffling deck: {str(e)}") | ||
| raise type(e)(f"[agent:{context.agent_id}]: {e}") from e |
There was a problem hiding this comment.
The context variable may be undefined if an exception occurs before context = self.get_context() is executed, which would cause a NameError when trying to access context.agent_id.
| raise type(e)(f"[agent:{context.agent_id}]: {e}") from e | |
| agent_id = context.agent_id if context is not None and hasattr(context, "agent_id") else "unknown" | |
| raise type(e)(f"[agent:{agent_id}]: {e}") from e |
|
|
||
| except Exception as e: | ||
| logger.error(f"Error drawing cards: {str(e)}") | ||
| raise type(e)(f"[agent:{context.agent_id}]: {e}") from e |
There was a problem hiding this comment.
The context variable may be undefined if an exception occurs before context = self.get_context() is executed, which would cause a NameError when trying to access context.agent_id.
Description
Type of Change
Checklist