Skip to content

[Refactor] Extract Ask/Say interaction flow into TaskInteractionManager from Task.ts #21

Open

Description

@doctarock

Parent Issue

Part of #8 — Code Refactor on Monolith Files

Summary

Extract the user interaction state machine (ask/say/approve/deny) from src/core/task/Task.ts into a dedicated TaskInteractionManager module.

Scope

Methods to extract:

  • ask()
  • say()
  • approveAsk()
  • denyAsk()
  • supersedePendingAsk()
  • cancelAutoApprovalTimeout()
  • handleWebviewAskResponse()

State owned:

  • idleAsk?, resumableAsk?, interactiveAsk? (TaskStatus asks)
  • askResponse?, askResponseText?, askResponseImages?
  • autoApprovalTimeoutRef?
  • autoApprovalHandler

Estimated size: ~600 lines

Notes

This is the most complex interaction cluster in Task.ts. The ask/say state machine drives all user-facing responses and approvals. Extracting it makes the ask lifecycle independently testable and removes ~600 lines from the monolith.

Constraints (from #8)

  • Preserve method names, call flow, and async timing exactly
  • Maintain event emission order
  • Only extract code with clear state ownership
  • Run type checks after extraction
  • One extraction per commit

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions