Skip to content

Agent command#240

Merged
Justkog merged 30 commits intostagingfrom
agentCommand
May 7, 2026
Merged

Agent command#240
Justkog merged 30 commits intostagingfrom
agentCommand

Conversation

@Justkog
Copy link
Copy Markdown
Owner

@Justkog Justkog commented May 7, 2026

Summary

What does this change do? Why?
it adds a new agent command (discord and slack support so far)

Type of change

Select the best fit (you can delete the ones that don’t apply):

  • 🐛 Bug fix
  • ✨ Enhancement / new feature
  • 📚 Documentation change
  • 🧰 Refactor / maintenance (no behavior change)
  • 🚨 Breaking change

Release impact (labels)

Maintainers use PR labels to drive versioning and GitHub release notes.

Please suggest exactly one release-impact label for this PR:

  • release:patch — bug fix or internal change, no user-visible impact
  • release:minor — new feature or backward-compatible behavior change
  • release:major — breaking change (config, CLI, behavior, data formats)
  • release:none — docs/CI/refactor; no release impact

Maintainers will apply/adjust the final release:* label during review.

Checklist

  • I targeted the staging branch (unless a maintainer asked otherwise).
  • I ran relevant checks/tests locally (or explained why I couldn’t).
  • I updated docs/config examples if behavior changed.
  • I added/updated tests where it makes sense.

Justkog and others added 30 commits April 29, 2026 19:06
…onfiguration (step 1 & 2)

- Added `workspaceResolver.ts` to handle workspace resolution for agent commands.
- Introduced types for agent command configuration, workspaces, and profiles in `types.ts`.
- Enhanced `env.ts` to parse agent command configuration from TOML, including validation for workspaces and profiles.
- Updated `env.test.ts` with tests for agent command configuration parsing and validation.
- Created a roadmap document for the new Discord `/agent` command feature, outlining goals, user experience, and implementation steps.
- Modified `sniptail.worker.toml` to include configuration options for the agent command, such as enabling the command, setting default workspace and profile, and defining interaction timeout and output debounce settings.
…nagement in Discord bot (step 4: Discord /agent Command Skeleton)
…storage

implementation of step 5 (Bot-to-Worker Session Events) and step 6 (Worker OpenCode Prompt Runner)

- Added a new SQLite table for agent sessions to track their state and metadata.
- Implemented functions to create, load, and update agent sessions in the registry.
- Integrated agent session handling into the worker event system, allowing for session start, message handling, and interaction resolution.
- Enhanced OpenCode prompt runner to manage agent sessions, including session ID updates and status changes.
- Added tests for agent session functionality to ensure reliability and correctness.
…grate with assistant message handling (step 7: Debounced Discord Output)
…p Active Prompt)

- Added `buildDiscordAgentStopComponents` and related functions to create stop buttons for agent sessions in Discord.
- Integrated agent stop handling in the Discord command handler to respond to stop button interactions.
- Created `activeOpenCodeRuntimes` module to manage active OpenCode session references.
- Implemented `stopAgentPrompt` function to handle stopping OpenCode sessions and updating session statuses.
- Added tests for stopping agent prompts and handling session states.
- Updated OpenCode session management to support aborting sessions and notifying users.
- Introduced `editDiscordMessage` and `fetchDiscordMessage` functions to handle message editing and retrieval in Discord.
- Added types for message editing and fetching options.

feat: implement pending OpenCode permission handling (step 9: Permission Interaction Bridge)

- Created `PendingOpenCodePermission` type and related functions to manage pending permissions for OpenCode sessions.
- Enhanced active OpenCode runtime management to include pending permissions.

test: add tests for debounced agent output and OpenCode permission resolution

- Added tests to ensure proper flushing of buffered output and handling of permission requests in OpenCode sessions.

feat: resolve OpenCode interaction events

- Implemented `resolveAgentInteraction` function to handle agent interaction resolutions for OpenCode permissions.
- Integrated permission request handling with Discord bot events.

feat: enhance Discord components for agent permissions

- Added functions to build and parse custom IDs for agent permission buttons in Discord.
- Updated tests to cover new permission button functionalities.

fix: update OpenCode permission reply handling

- Refactored `replyOpenCodePermission` to include workspace and message options.
- Improved error handling for permission replies.

chore: update bot event types for permission requests and updates

- Added new event types for agent permission requests and updates to the bot event payload map.

Co-authored-by: Copilot <copilot@github.com>
… Question Interaction Bridge)

- Added support for OpenCode question requests in the agent command.
- Introduced new functions for replying to and rejecting OpenCode questions.
- Updated the event handling to publish question requests and updates to Discord.
- Enhanced the test suite to cover new question request scenarios and interactions.
- Modified existing types and components to accommodate question handling logic.
…ep 11: Follow-Up Messages In Thread)

- Add `handleAgentFollowUpButton` function to manage follow-up actions (queue and steer) for agent sessions.
- Create tests for follow-up button interactions to ensure correct event handling and authorization.
- Introduce new components for follow-up actions in Discord, including buttons for queuing and steering messages.
- Update existing event handling to support follow-up messages and integrate with the OpenCode prompt system.
- Enhance worker event types to include a mode for follow-up actions (run, queue, steer).
- Refactor related components and tests to accommodate the new follow-up functionality.
…ment and state tracking, to show only one permission at once and wait before showing other permissions after clicking always allow
…ing unnecessary functions and consolidating logic
…lback and improve event streaming logic to leverage 'message.part.updated' events
… management and timeout logic

Co-authored-by: Copilot <copilot@github.com>
…ance command handling for workspace and profile selections (step 12: Sticky Defaults)
…t and interaction handling

- Added Copilot agent integration with customizable model and reasoning effort settings.
- Refactored agent command profiles to include optional fields for model, model provider, and reasoning effort.
- Updated tests to validate new Copilot profile configurations and interactions.
- Enhanced OpenCode agent options to support model and variant configurations.
- Improved error handling and logging for unsupported interactions and prompts.
- Introduced `idleTimeoutMs` configuration for Copilot across various components, including agent commands, tests, and configuration files.
- Updated tests to reflect the new idle timeout functionality and ensure proper handling of permission and user input requests.
- Refactored interaction handling to utilize the new timeout settings, enhancing the responsiveness and reliability of Copilot interactions.
- Improved Discord component handling to provide fallback options for question headers.
- Implemented Codex agent integration in the interactive agent registry.
- Created codexInteractionState for managing active Codex runtimes.
- Developed codexInteractiveAgent with functions for running, steering, and stopping Codex prompts.
- Enhanced stopAgentPrompt tests to include Codex scenarios.
- Updated configuration to accept Codex profiles with validation for model and reasoning effort.
- Modified core types to support Codex runtime and agent profiles.
- Adjusted bot event types to include Codex provider.
fix: add dotenv dependency to package/core (not sure how it could work before without it)
@Justkog Justkog added enhancement New feature or request release:patch Bug fix, internal change, no user-visible behavior change labels May 7, 2026
@Justkog Justkog requested a review from Copilot May 7, 2026 11:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@Justkog Justkog merged commit 4c3b162 into staging May 7, 2026
4 checks passed
@Justkog Justkog deleted the agentCommand branch May 7, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request release:patch Bug fix, internal change, no user-visible behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants