Class: Agentd::MessageCommands

Inherits:
Thor
  • Object
show all
Includes:
CLIHelpers
Defined in:
lib/agentd/cli.rb

Overview


Constant Summary collapse

CHANNELS =
%w[email telegram webhook nostr mcp].freeze

Instance Method Summary collapse

Methods included from CLIHelpers

#build_agent, #build_client, #format_json, #status_color

Instance Method Details

#listObject



192
193
194
195
196
197
198
199
# File 'lib/agentd/cli.rb', line 192

def list
  msgs = build_agent(options).messages(
    channel:   options[:channel],
    direction: options[:direction],
    per:       options[:per]
  )
  msgs.empty? ? say("No messages.", :yellow) : msgs.each { |m| print_message(m) }
end

#sendObject



178
179
180
181
182
183
184
185
186
# File 'lib/agentd/cli.rb', line 178

def send
  r = build_agent(options).send_message(
    options[:channel],
    to:      options[:to],
    body:    options[:body],
    subject: options[:subject]
  )
  say "Message ##{r["id"]} queued (#{r["channel"]}#{r["recipient"]})", :green
end