Skip to content

Latest commit

 

History

History
255 lines (198 loc) · 11.1 KB

File metadata and controls

255 lines (198 loc) · 11.1 KB

TAP-RS Implementation Tasks

TAP WASM Agent v2 - Simplified Browser-First Implementation

PRD

Phase 1: Core WASM Bindings & Tests

  • Write tests for WasmTapAgent wrapper around existing TapAgent
  • Write tests for private key export functionality
  • Write tests for private key import functionality
  • Write tests for JsValue to Rust type conversions
  • Create WasmTapAgent wrapper struct in tap-wasm
  • Implement private key export from AgentKeyManager
  • Implement private key import to create TapAgent
  • Implement JsValue conversion layer

Phase 2: Message Operations & Tests

  • Write tests for delegating pack_message to existing TapAgent
  • Write tests for delegating unpack_message to existing TapAgent
  • Write tests for all TAP message types via WASM
  • Write tests for WASM-specific error handling
  • Implement pack_message delegation to TapAgent
  • Implement unpack_message delegation to TapAgent
  • Ensure TAP message type compatibility
  • Add WASM error conversion layer

Phase 3: WASM Bindings & JavaScript Interface

  • Write tests for WASM bindings (new, from_private_key, get_did)
  • Write tests for async pack_message and unpack_message
  • Write tests for utility functions (generate_private_key, generate_uuid)
  • Write tests for JavaScript type conversions (JsValue <-> Rust types)
  • Implement WASM bindings for TapAgent
  • Implement async message operations
  • Implement utility function exports
  • Implement type conversion layer
  • Update tap-wasm/CLAUDE.md

Phase 4: TypeScript Wrapper & npm Package

  • Write tests for TypeScript TapAgent class
  • Write tests for type mapping with @taprsvp/types
  • Write tests for static factory methods (create, fromPrivateKey)
  • Write tests for message creation helpers
  • Create TypeScript wrapper in tap-ts
  • Implement type mapping with @taprsvp/types
  • Implement factory methods and utilities
  • Setup npm package structure (@taprsvp/agent)
  • Create tap-ts/CLAUDE.md documentation

Phase 5: DID Resolution & Integration

  • Write tests for pluggable DID resolver interface
  • Write tests for resolution error handling
  • Implement pluggable resolver interface
  • Implement JavaScript resolver delegation

Phase 6: Interoperability Testing

  • Write tests for Veramo message format compatibility
  • Write tests for TAP -> Veramo message unpacking
  • Write tests for Veramo -> TAP message unpacking
  • Write cross-implementation test suite with real Veramo DIDComm library
  • Verify message format compatibility between TAP and Veramo agents
  • Test with real Veramo instances (15 comprehensive integration tests)
  • Document compatibility - Full DIDComm v2 compatibility confirmed
  • Create interoperability test fixtures and real integration tests

Phase 7: Bundle Optimization

  • Implement wee_alloc for smaller WASM
  • Remove unused dependencies
  • Optimize TypeScript bundle
  • Verify < 500KB WASM target (272KB gzipped ✅)
  • Verify < 50KB gzipped TypeScript (3.72KB gzipped ✅)

Phase 8: Documentation & Release

  • Write API documentation
  • Write getting started guide
  • Write example applications
  • Create API reference docs
  • Publish to npm as @taprsvp/agent
  • Update main README
  • Create release notes

TAP CLI - Command-Line Interface for TAP Agent Operations

PRD

Phase 1: Project Scaffold & Core Integration

  • Write tests for CLI argument parsing and global flags
  • Write tests for TapIntegration initialization from CLI args
  • Create tap-cli crate with Cargo.toml, add to workspace
  • Implement main.rs with global flags (--agent-did, --tap-root, --debug, --format)
  • Implement TapIntegration setup (reuse pattern from tap-mcp)
  • Implement output formatting layer (JSON and text modes)

Phase 2: Agent Management Commands

  • Write tests for agent create and agent list commands
  • Implement agent create subcommand
  • Implement agent list subcommand

Phase 3: Transaction Creation Commands

  • Write tests for transfer command
  • Write tests for payment command
  • Write tests for connect command
  • Write tests for escrow and capture commands
  • Implement transfer subcommand
  • Implement payment subcommand
  • Implement connect subcommand
  • Implement escrow subcommand
  • Implement capture subcommand

Phase 4: Transaction Action Commands

  • Write tests for authorize, reject, cancel commands
  • Write tests for settle and revert commands
  • Implement authorize subcommand
  • Implement reject subcommand
  • Implement cancel subcommand
  • Implement settle subcommand
  • Implement revert subcommand

Phase 5: Query Commands

  • Write tests for transaction list command
  • Write tests for delivery list command
  • Write tests for received list/pending/view commands
  • Implement transaction list subcommand
  • Implement delivery list subcommand
  • Implement received list, received pending, received view subcommands

Phase 6: Customer Management Commands

  • Write tests for customer CRUD commands
  • Implement customer list subcommand
  • Implement customer create subcommand
  • Implement customer details subcommand
  • Implement customer update subcommand
  • Implement customer ivms101 subcommand

Phase 7: Communication & DID Commands

  • Write tests for ping and message commands
  • Implement ping subcommand
  • Implement message subcommand
  • Integrate existing DID commands from tap-agent-cli (did generate, did lookup, did keys)

Phase 8: CI Validation & Polish

  • Run cargo fmt, clippy, and tests with CI flags
  • Fix any warnings or errors

Phase 9: Decision Management Commands

  • Write tests for decision list and decision resolve commands
  • Implement decision list subcommand
  • Implement decision resolve subcommand
  • Add auto-resolve to action commands (authorize, reject, cancel, settle, revert)
  • Add detailed help text to tap-cli and tap-http for agent discoverability
  • Update README with decision commands documentation
  • Run cargo fmt, clippy, and tests with CI flags

External Decision Executable for tap-http

PRD

Phase 1: Decision Log Storage (tap-node)

  • Write tests for decision_log insert, update status, list pending, and expire operations
  • Create migration 008_create_decision_log.sql with table, indexes, and status constraints
  • Add DecisionLogEntry model to models.rs
  • Implement insert_decision() in db.rs
  • Implement update_decision_status() in db.rs
  • Implement list_pending_decisions() in db.rs
  • Implement expire_decisions_for_transaction() in db.rs

Phase 2: Decision Expiration Handler (tap-node)

  • Write tests for automatic expiration when transactions reach terminal states
  • Implement DecisionExpirationHandler as an EventSubscriber that listens for TransactionStateChanged to terminal states and expires pending decisions

Phase 3: Decision MCP Tools (tap-mcp)

  • Write tests for tap_list_pending_decisions tool
  • Write tests for tap_resolve_decision tool
  • Implement tap_list_pending_decisions tool in tools/decision_tools.rs
  • Implement tap_resolve_decision tool (marks resolved + executes action via TapNode)
  • Register both tools in ToolRegistry

Phase 4: JSON-RPC Protocol Types (tap-http)

  • Write tests for serialization/deserialization of decision protocol messages (tap/decision, tap/event, tap/initialize)
  • Define protocol message types for stdin/stdout communication (decision requests, event notifications, initialization handshake)

Phase 5: External Decision Manager (tap-http)

  • Write tests for ExternalDecisionManager implementing DecisionHandler (writes to decision_log, sends via stdin)
  • Write tests for process lifecycle (spawn, detect exit, restart with backoff)
  • Write tests for stdout reader (parse JSON-RPC tool calls, route to ToolRegistry)
  • Write tests for decision replay on process reconnect
  • Implement ExternalDecisionManager struct with child process management
  • Implement DecisionHandler trait — insert into decision_log and send over stdin
  • Implement EventSubscriber trait — forward events when in "all" mode
  • Implement stdout reader task — parse JSON-RPC requests, dispatch to ToolRegistry
  • Implement stdin writer — send decisions, events, and initialization messages
  • Implement process health monitoring and restart with exponential backoff
  • Implement decision replay on reconnect (query pending/delivered, send in order)
  • Implement graceful shutdown (EOF on stdin, SIGTERM, SIGKILL timeout)

Phase 6: tap-http Integration

  • Write tests for CLI flag parsing (--decision-exec, --decision-exec-args, --decision-subscribe)
  • Add CLI flags and environment variables to main.rs
  • Wire ExternalDecisionManager into NodeConfig.decision_mode when --decision-exec is set
  • Subscribe ExternalDecisionManager to event bus
  • Disable auto_act when external decision executable is configured
  • Forward child process stderr to tap-http log output

Phase 7: Integration Testing

  • Create a mock external executable (auto-approve script) for testing
  • Write integration test: decision flow end-to-end (receive transfer → decision → authorize)
  • Write integration test: process crash and catch-up (kill process, accumulate decisions, restart, verify replay)
  • Write integration test: decision expiration (decision pending → transaction rejected → decision expired)
  • Write integration test: external process uses tool calls to act (tap_authorize via stdout)

Phase 8: CI Validation

  • Run cargo fmt, clippy, and tests with CI flags
  • Fix any warnings or errors

Phase 9: Poll Mode & Auto-Resolve

  • Add resolve_decisions_for_transaction() to Storage in tap-node
  • Create DecisionLogHandler in tap-node (implements DecisionHandler, writes to decision_log)
  • Rename DecisionExpirationHandler to DecisionStateHandler, add resolution on state changes
  • Add auto-resolve to tap_authorize tool (resolve authorization_required decisions)
  • Add auto-resolve to tap_reject tool (expire all pending decisions)
  • Add auto-resolve to tap_settle tool (resolve settlement_required decisions)
  • Add auto-resolve to tap_cancel tool (expire all pending decisions)
  • Add auto-resolve to tap_revert tool (expire all pending decisions)
  • Add --decision-mode CLI flag to tap-http (auto, poll)
  • Wire poll mode in tap-http main.rs (DecisionLogHandler + DecisionStateHandler)
  • Run cargo fmt, clippy, and tests with CI flags

Phase 10: Documentation

  • Update tap-http README with decision modes and configuration
  • Update tap-mcp README with decision tools and auto-resolve
  • Update tap-node README with decision log and DecisionLogHandler
  • Update main README with decision support overview