slop-polis-3-casino-games

This commit is contained in:
Russell Ballestrini 2025-04-05 20:52:58 +00:00
parent d071f6f37e
commit 294e264808
3 changed files with 943 additions and 70 deletions

View file

@ -1,12 +1,12 @@
openapi: 3.0.0
info:
title: SLOP API
description: A SLOP pattern implementation with dynamic model endpoints, tools, memory, resources, and payment simulation.
description: A SLOP pattern implementation with dynamic model endpoints, tools, memory, resources, and payment simulation, including casino games.
version: 1.0.0
servers:
- url: https://slop.unturf.com
description: Production unturf. SLOP server
description: Production unturf SLOP server
- url: http://localhost:31337
description: Local development SLOP server
@ -76,20 +76,101 @@ paths:
required: true
schema:
type: string
enum: [calculator, greet]
enum: [calculator, greet, slots, blackjack]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ToolRequest'
oneOf:
- $ref: '#/components/schemas/CalculatorToolRequest'
- $ref: '#/components/schemas/GreetToolRequest'
- $ref: '#/components/schemas/SlotsToolRequest'
- $ref: '#/components/schemas/BlackjackToolRequest'
examples:
calculator:
summary: Calculator tool request
value:
expression: "2 + 2"
greet:
summary: Greet tool request
value:
name: "Alice"
slots:
summary: Slots game request
value:
bet: 50
agent_id: "player1"
blackjackStart:
summary: Start a new blackjack game
value:
bet: 100
agent_id: "player1"
blackjackHit:
summary: Hit in an existing blackjack game
value:
agent_id: "player1"
game_id: "550e8400-e29b-41d4-a716-446655440000"
action: "hit"
responses:
'200':
description: Tool execution result
content:
application/json:
schema:
$ref: '#/components/schemas/ToolResponse'
oneOf:
- $ref: '#/components/schemas/CalculatorToolResponse'
- $ref: '#/components/schemas/GreetToolResponse'
- $ref: '#/components/schemas/SlotsToolResponse'
- $ref: '#/components/schemas/BlackjackToolResponse'
examples:
calculator:
summary: Calculator result
value:
result: 4
greet:
summary: Greet result
value:
result: "Hello, Alice!"
slots:
summary: Slots game result
value:
explanation: "Slot Machine Rules: Bet an amount to spin three reels once. Match all 3 symbols for 10x your bet, 2 symbols for 2x your bet, or lose your bet if no match. Symbols: ['🍒', '🍋', '🍊', '🍇', '🔔', '💎']. You (agent player1) bet 50. Reels: ['🍒', '🍒', '🍒']. Jackpot! You matched all three symbols."
game_state:
reels: ["🍒", "🍒", "🍒"]
payout: 500
bet: 50
agent_id: "player1"
new_balance: 1450
game_complete: true
blackjackStart:
summary: Start of a blackjack game
value:
explanation: "Blackjack Rules: Bet to play against the dealer. Goal is to get closer to 21 without going over. Number cards = face value, Face cards = 10, Ace = 1 or 11 (adjusted automatically). Hit to draw cards, stand to finish. Dealer stands on 17+. Win pays 2x, tie returns bet, loss takes bet. You (agent player1) started a new game with bet 100. Your hand: [10, 7] (Total: 17). Dealers up card: [6]."
game_id: "550e8400-e29b-41d4-a716-446655440000"
game_state:
player_hand: [10, 7]
player_total: 17
dealer_hand: [6]
dealer_total: 6
bet: 100
agent_id: "player1"
new_balance: 1000
game_complete: false
blackjackHitBust:
summary: Hit resulting in bust
value:
explanation: "Blackjack: You chose to hit. Your hand: [10, 7, 8] (Total: 25). Dealers up card: [6]. Bust! You went over 21 and lose."
game_id: "550e8400-e29b-41d4-a716-446655440000"
game_state:
player_hand: [10, 7, 8]
player_total: 25
dealer_hand: [6]
dealer_total: 6
bet: 100
agent_id: "player1"
new_balance: 900
game_complete: true
'400':
description: Missing required parameter
content:
@ -102,6 +183,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/memory:
get:
summary: List all memory keys
@ -252,6 +339,18 @@ paths:
content: "Nested Foo Bar"
- id: "foo/baz"
content: "Nested Foo Baz"
blackjackGame:
summary: Blackjack game state
value:
id: "casino/blackjack/games/550e8400-e29b-41d4-a716-446655440000"
content:
agent_id: "player1"
bet: 100
player_hand: [10, 7]
player_total: 17
dealer_hand: [6]
dealer_total: 6
status: "active"
'404':
description: No resource or nested resources found
content:
@ -307,6 +406,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/PayResponse'
components:
schemas:
ChatRequest:
@ -370,29 +470,192 @@ components:
type: string
description:
type: string
arguments:
type: array
items:
type: object
properties:
name:
type: string
type:
type: string
description:
type: string
optional:
type: boolean
required:
- name
- type
- description
required:
- id
- description
- arguments
required:
- tools
ToolRequest:
CalculatorToolRequest:
type: object
properties:
expression:
type: string
nullable: true
description: The math expression to evaluate (e.g., "2 + 2")
required:
- expression
GreetToolRequest:
type: object
properties:
name:
type: string
description: The name of the person to greet
required:
- name
SlotsToolRequest:
type: object
properties:
bet:
type: integer
minimum: 1
description: Amount to bet on the slot spin
agent_id:
type: string
description: Unique identifier for the agent/player
required:
- bet
- agent_id
BlackjackToolRequest:
type: object
properties:
bet:
type: integer
minimum: 1
description: Amount to bet (required to start a new game)
nullable: true
ToolResponse:
agent_id:
type: string
description: Unique identifier for the agent/player
game_id:
type: string
description: UUID of an existing game (required for hit/stand actions)
nullable: true
action:
type: string
enum: [hit, stand]
description: Action to take in an existing game (required if game_id is provided)
nullable: true
required:
- agent_id
CalculatorToolResponse:
type: object
properties:
result:
oneOf:
- type: string
- type: integer
type: integer
description: The result of the calculation
required:
- result
GreetToolResponse:
type: object
properties:
result:
type: string
description: The greeting message
required:
- result
SlotsToolResponse:
type: object
properties:
explanation:
type: string
description: Description of the game rules and outcome
game_state:
type: object
properties:
reels:
type: array
items:
type: string
description: The symbols on the slot reels
required:
- reels
payout:
type: integer
description: Amount won from the spin (0 if lost)
bet:
type: integer
description: The amount bet on the spin
agent_id:
type: string
description: The agent/player identifier
new_balance:
type: integer
description: Updated balance after the spin
game_complete:
type: boolean
description: Indicates if the game is complete (always true for slots)
required:
- explanation
- game_state
- payout
- bet
- agent_id
- new_balance
- game_complete
BlackjackToolResponse:
type: object
properties:
explanation:
type: string
description: Description of the game rules and current action outcome
game_id:
type: string
description: UUID of the blackjack game (returned when starting a new game)
nullable: true
game_state:
type: object
properties:
player_hand:
type: array
items:
type: integer
description: Cards in the player's hand
player_total:
type: integer
description: Total value of the player's hand
dealer_hand:
type: array
items:
type: integer
description: Cards in the dealer's hand (partial view until game ends)
dealer_total:
type: integer
description: Total value of the dealer's hand (partial until game ends)
required:
- player_hand
- player_total
- dealer_hand
- dealer_total
payout:
type: integer
description: Amount won (0 if ongoing or lost, set when game completes)
nullable: true
bet:
type: integer
description: The amount bet on the game
agent_id:
type: string
description: The agent/player identifier
new_balance:
type: integer
description: Updated balance (updated only when game completes)
game_complete:
type: boolean
description: Indicates if the game is complete (true on bust or stand)
required:
- explanation
- game_state
- bet
- agent_id
- new_balance
- game_complete
MemoryStoreRequest:
type: object
properties:
@ -439,7 +702,8 @@ components:
id:
type: string
content:
type: string
type: object
additionalProperties: true
required:
- id
- content
@ -451,7 +715,8 @@ components:
id:
type: string
content:
type: string
type: object
additionalProperties: true
required:
- id
- content
@ -499,4 +764,4 @@ components:
error:
type: string
required:
- error
- error