Skip to content

feat(social): add party and trade commands to CommandExecutor (AIRO-34)#4147

Closed
matheustavaresdev wants to merge 15 commits intoOpenKore:masterfrom
matheustavaresdev:feature/AIRO-34-social
Closed

feat(social): add party and trade commands to CommandExecutor (AIRO-34)#4147
matheustavaresdev wants to merge 15 commits intoOpenKore:masterfrom
matheustavaresdev:feature/AIRO-34-social

Conversation

@matheustavaresdev
Copy link

Summary

  • Adds 13 new action handlers to CommandExecutor.pm: party_chat, party_create, party_invite_player, party_accept, party_decline, party_leave, deal_initiate, deal_accept, deal_decline, deal_add_item, deal_add_zeny, deal_finalize, deal_cancel
  • Follows the exact same pattern as existing _cmd_say/_cmd_whisper handlers (validate params, sanitize strings, Commands::run(), _send_ack/_send_error)
  • All commands use Commands::run() for proper OpenKore integration
  • Input validation and sanitization on all string parameters; quantity/amount params validated as positive integers

Part of AIRO-34 in the parent repo.

🤖 Generated with Claude Code

matheustavaresdev and others added 15 commits February 26, 2026 16:37
- AIVillageBridge.pl: main plugin entrypoint, 22 hooks, lifecycle management
- Protocol.pm: JSON message builders/parsers for TCP/JSON protocol
- Connection.pm: non-blocking TCP client, exponential backoff, ring buffer, heartbeat
- EventFilter.pm: deduplication cache, token-bucket rate limiter, significance checks
- NoveltyDetector.pm: 3-layer decision tree, ruleset matching, familiarity tracking
- CommandExecutor.pm: command validation, sanitization, OpenKore execution
- ConfigUpdater.pm: hot-reload for mon_control, items_control, config, ruleset, chat_resp
- StateSnapshot.pm: game state extraction from OpenKore globals
- control/ai-village/: template config files and default empty ruleset

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…commands (AIRO-15)

- onItemGathered: item hook arg is a string, not hashref — use directly
- onMapChanged: read old_map from args->{oldMap}, new_map from char->{map}
- onPartyInvite: use partyName/partyID fields (correct hook arg names)
- ConfigUpdater: use parseMonControl/parseItemsControl instead of parseDataFile2
- ConfigUpdater: write correct 10-col mon_control and 6-col items_control formats
- CommandExecutor: convert hex monster/item IDs to binary before %monsters/%items lookup
- CommandExecutor: replace Commands::run("a") with AI::attack(), Commands::run("take") with gather()
- CommandExecutor: sanitize map, skill, and target params
- Connection: echo ts field in pong response; clear send_buf on disconnect
- NoveltyDetector: player_exist reads data->{name} not data->{user}
- NoveltyDetector: add chat_resp pattern matching (step 1b) for local auto-responses
- EventFilter: add $limit param to get_overflow_events() for partial draining
- AIVillageBridge: cap overflow drain at 5 events per tick

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- CommandExecutor: qualify AI::attack/AI::gather (bare calls don't resolve)
- CommandExecutor: npc_talk — hex→binary for %npcs lookup; use binID for talk cmd
- EventFilter: remove item_gathered from significance filter (value not in hook args)
- AIVillageBridge: run NoveltyDetector before rate filter in _emit_event so
  overflow events don't bypass ruleset/chat_resp decisions
- AIVillageBridge: map 'respond' ruleset action to 'say' command in _emit_event

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Connection: fix dataWaiting call — pass socket object directly, not ref-to-ref
  (was silently suppressing all reads, making handshake/commands non-functional)
- CommandExecutor: guard binID before Commands::run("talk") in npc_talk handler
- AIVillageBridge: always return on 'local' action even when command is undef
  (prevents malformed ruleset entries from leaking events to the sidecar)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ay (AIRO-27)

Adds 4 new action types to the CommandExecutor:
- emote: trigger emotion animations via OpenKore 'e' command
- flee: clear attack/route and teleport to escape combat
- buy: purchase items from an open NPC store
- sell: sell items from inventory via open NPC sell dialog

Also adds configurable delay between command executions (default 0.5s)
to make bot behavior appear more natural. When delay is active, only
one command processes per AI tick.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review findings:
- equip: 'equip' → 'eq' (correct OpenKore command registration)
- flee: 'teleport' → 'tele' (correct OpenKore command registration)
- use_skill: support all target types via ss/sm/sp/sl commands
  (was only using ss which is self-targeting only)
- emote: accept emote_command param, document that OpenKore expects
  emotion command strings (lv, !, ho) not numeric IDs
- buy/sell: add prerequisite comments about NPC dialog state
- flee: add comment about Fly Wing requirement

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ction, idle timeout, metrics (AIRO-25)

- NoveltyDetector: add Step 4.5 — pub_msg/priv_msg always escalate when
  no chat_resp or ruleset rule matched, preventing familiar-player chat
  from being silently dropped
- NoveltyDetector: add metrics counters at every return path in analyze()
  with get_metrics()/reset_metrics() accessors
- EventFilter: add metrics counters in should_send(), get_overflow_events(),
  cleanup_cache() with get_metrics()/reset_metrics() accessors
- AIVillageBridge: add HP danger detection in onAIPre — emits hp_critical
  event when HP drops below threshold (default 25%), with hysteresis reset
  at threshold + 10%
- AIVillageBridge: add idle timeout detection in onMainLoopPost — emits
  idle_timeout meta-event bypassing filter when no significant event sent
  for configurable duration (default 300s)
- AIVillageBridge: log combined filter + novelty metrics every 5 minutes
  in periodic cleanup block

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-25)

- Add `defined $char->{hp}` guard in HP danger detection
- Use `//` (defined-or) instead of `||` for danger_hp_pct and idle_timeout config vars
- Update $last_significant_event when draining overflow events
- Count flee actions as escalated in NoveltyDetector metrics
- Track overflow_dropped in EventFilter metrics

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…IRO-49, AIRO-50)

AIRO-49: Namespace dedup cache keys with event type prefix to prevent
cross-type collisions (e.g. player_exist "Alice" vs priv_msg "Alice").

AIRO-50: Add track_monster() for sighting-based familiarity tracking,
reorder all hook callbacks to emit before tracking so first-occurrence
checks in NoveltyDetector.analyze() are reachable, and update cleanup
to use last_seen field for monster context pruning.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…wn guard (AIRO-49, AIRO-50)

- Set last_killed => 0 in _init_monster so sighting-only entries don't
  get a false kill timestamp; explicitly set it in track_monster_kill
- Update docstring: threshold is sightings/kills, not just kills
- Guard against tracking 'unknown' placeholder in onMonsterExist

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e-bugfixes

fix(bridge): fix dedup collisions and monster familiarity tracking (AIRO-49, AIRO-50)
Adds ai_village_death.pl — a standalone OpenKore plugin that:
- Hooks the self_died event fired by Network::Receive when the bot dies
- Infers death cause/type from %damageTaken (highest-damage attacker)
- Reads/updates control/ai_village_lives.txt (current_life, lives_remaining)
- POSTs a death signal to the Temporal HTTP signal server at /signal/death
- Uses IO::Socket::INET (already in OpenKore) — no LWP dependency

Configured via env vars or config.txt:
  AIVILLAGE_SIGNAL_HOST / ai_village_signal_host (default: localhost)
  AIVILLAGE_SIGNAL_PORT / ai_village_signal_port (default: 7778)
  AIVILLAGE_BOT_ID      / ai_village_bot_id      (default: char name)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…stem

feat(lives): add death event plugin for 10-lives system (AIRO-31)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…IRO-34)

Add _escape helper to prevent quote injection when player names or item
names contain " or \ characters. Applied to:
- _cmd_whisper: $player inside double-quotes
- _cmd_party_create: $name inside double-quotes
- _cmd_deal_initiate: $player now quoted and escaped
- _cmd_deal_add_item: $item inside double-quotes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@matheustavaresdev matheustavaresdev closed this by deleting the head repository Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant