source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20161004120214_update_pushover_agent_options.rb | Ruby | mit | 49,192 | master | 1,633 | class UpdatePushoverAgentOptions < ActiveRecord::Migration[4.2]
DEFAULT_OPTIONS = {
'message' => '{{ message | default: text }}',
'device' => '{{ device }}',
'title' => '{{ title | default: subject }}',
'url' => '{{ url }}',
'url_title' => '{{ url_title }}',
'priority' => '{{ priority }}',
... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20150808115436_remove_requirement_from_users_invitation_code.rb | Ruby | mit | 49,192 | master | 204 | class RemoveRequirementFromUsersInvitationCode < ActiveRecord::Migration[4.2]
def change
change_column_null :users, :invitation_code, true, ENV['INVITATION_CODE'].presence || 'try-huginn'
end
end |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140730005210_convert_efa_skip_created_at.rb | Ruby | mit | 49,192 | master | 686 | class ConvertEfaSkipCreatedAt < ActiveRecord::Migration[4.2]
def up
Agent.where(type: 'Agents::EventFormattingAgent').each do |agent|
agent.options_will_change!
unless agent.options.delete('skip_created_at').to_s == 'true'
agent.options['instructions'] = {
'created_at' => '{{created_... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20130819160603_create_agent_logs.rb | Ruby | mit | 49,192 | master | 343 | class CreateAgentLogs < ActiveRecord::Migration[4.2]
def change
create_table :agent_logs do |t|
t.integer :agent_id, :null => false
t.text :message, :null => false
t.integer :level, :default => 3, :null => false
t.integer :inbound_event_id
t.integer :outbound_event_id
t.timest... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140723110551_adopt_xpath_in_website_agent.rb | Ruby | mit | 49,192 | master | 834 | class AdoptXpathInWebsiteAgent < ActiveRecord::Migration[4.2]
class Agent < ActiveRecord::Base
include JsonSerializedField
json_serialize :options
end
def up
Agent.where(type: 'Agents::WebsiteAgent').each do |agent|
extract = agent.options['extract']
next unless extract.is_a?(Hash) && ext... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20160108221620_website_agent_does_not_use_event_url.rb | Ruby | mit | 49,192 | master | 1,103 | class WebsiteAgentDoesNotUseEventUrl < ActiveRecord::Migration[4.2]
def up
# Until this migration, if a WebsiteAgent received Events and did not have a `url_from_event` option set,
# it would use the `url` from the Event's payload. If the Event did not have a `url` in its payload, the
# WebsiteAgent woul... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140531232016_add_fields_to_scenarios.rb | Ruby | mit | 49,192 | master | 359 | class AddFieldsToScenarios < ActiveRecord::Migration[4.2]
def change
add_column :scenarios, :description, :text
add_column :scenarios, :public, :boolean, :default => false, :null => false
add_column :scenarios, :guid, :string
change_column :scenarios, :guid, :string, :null => false
add_column :sce... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140901143732_add_control_links.rb | Ruby | mit | 49,192 | master | 366 | class AddControlLinks < ActiveRecord::Migration[4.2]
def change
create_table :control_links do |t|
t.integer :controller_id, null: false
t.integer :control_target_id, null: false
t.timestamps
end
add_index :control_links, [:controller_id, :control_target_id], unique: true
add_index... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20131227000021_add_cached_dates_to_agent.rb | Ruby | mit | 49,192 | master | 605 | class AddCachedDatesToAgent < ActiveRecord::Migration[4.2]
def up
add_column :agents, :last_event_at, :datetime
execute "UPDATE agents SET last_event_at = (SELECT created_at FROM events WHERE events.agent_id = agents.id ORDER BY id DESC LIMIT 1)"
add_column :agents, :last_error_log_at, :datetime
exec... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20160405072512_post_agent_set_event_header_style.rb | Ruby | mit | 49,192 | master | 376 | class PostAgentSetEventHeaderStyle < ActiveRecord::Migration[4.2]
def up
Agent.of_type("Agents::PostAgent").each do |post_agent|
if post_agent.send(:boolify, post_agent.options['emit_events']) &&
!post_agent.options.key?('event_headers_style')
post_agent.options['event_headers_style'] = 'ra... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20150507153436_update_keep_events_for_to_be_in_seconds.rb | Ruby | mit | 49,192 | master | 339 | class UpdateKeepEventsForToBeInSeconds < ActiveRecord::Migration[4.2]
class Agent < ActiveRecord::Base; end
SECONDS_IN_DAY = 60 * 60 * 24
def up
Agent.update_all ['keep_events_for = keep_events_for * ?', SECONDS_IN_DAY]
end
def down
Agent.update_all ['keep_events_for = keep_events_for / ?', SECONDS... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20160807000122_remove_queue_from_email_digest_agent_memory.rb | Ruby | mit | 49,192 | master | 222 | class RemoveQueueFromEmailDigestAgentMemory < ActiveRecord::Migration[4.2]
def up
Agents::EmailDigestAgent.find_each do |agent|
agent.memory.delete("queue")
agent.save!(validate: false)
end
end
end |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140213053001_add_event_id_at_creation_to_links.rb | Ruby | mit | 49,192 | master | 839 | class AddEventIdAtCreationToLinks < ActiveRecord::Migration[4.2]
class Link < ActiveRecord::Base; end
class Event < ActiveRecord::Base; end
def up
add_column :links, :event_id_at_creation, :integer, :null => false, :default => 0
Link.all.find_each do |link|
last_event_id = execute(
<<-SQL
... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20161007030910_reset_data_output_agents.rb | Ruby | mit | 49,192 | master | 225 | class ResetDataOutputAgents < ActiveRecord::Migration[4.2]
def up
Agents::DataOutputAgent.find_each do |agent|
agent.memory = {}
agent.save(validate: false)
agent.latest_events(true)
end
end
end |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140906030139_set_events_count_default.rb | Ruby | mit | 49,192 | master | 314 | class SetEventsCountDefault < ActiveRecord::Migration[4.2]
def up
change_column_default(:agents, :events_count, 0)
change_column_null(:agents, :events_count, false, 0)
end
def down
change_column_null(:agents, :events_count, true)
change_column_default(:agents, :events_count, nil)
end
end |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20161124065838_add_templates_to_resolve_url.rb | Ruby | mit | 49,192 | master | 437 | class AddTemplatesToResolveUrl < ActiveRecord::Migration[5.0]
def up
Agents::WebsiteAgent.find_each do |agent|
if agent.event_keys.try!(:include?, 'url')
agent.options['template'] = (agent.options['template'] || {}).tap { |template|
template['url'] ||= '{{ url | to_uri: _response_.url }}'
... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140216201250_add_propagate_immediately_to_agent.rb | Ruby | mit | 49,192 | master | 247 | class AddPropagateImmediatelyToAgent < ActiveRecord::Migration[4.2]
def up
add_column :agents, :propagate_immediately, :boolean, :default => false, :null => false
end
def down
remove_column :agents, :propagate_immediately
end
end |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140127164931_change_handler_to_medium_text.rb | Ruby | mit | 49,192 | master | 428 | # Increase handler size to 16MB (consistent with events.payload)
class ChangeHandlerToMediumText < ActiveRecord::Migration[4.2]
def up
if mysql?
change_column :delayed_jobs, :handler, :text, :limit => 16777215
end
end
def down
if mysql?
change_column :delayed_jobs, :handler, :text, :limi... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20170419073748_set_rss_content_type.rb | Ruby | mit | 49,192 | master | 451 | class SetRssContentType < ActiveRecord::Migration[5.0]
def up
Agents::DataOutputAgent.find_each do |agent|
if agent.options['rss_content_type'].nil?
agent.options['rss_content_type'] = 'text/xml'
agent.save(validate: false)
end
end
end
def down
Agents::DataOutputAgent.find... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20130107050049_add_invitation_code_to_users.rb | Ruby | mit | 49,192 | master | 202 | class AddInvitationCodeToUsers < ActiveRecord::Migration[4.2]
def change
add_column :users, :invitation_code, :string
change_column :users, :invitation_code, :string, :null => false
end
end |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20131223032112_switch_to_json_serialization.rb | Ruby | mit | 49,192 | master | 2,580 | class SwitchToJsonSerialization < ActiveRecord::Migration[4.2]
FIELDS = {
:agents => [:options, :memory],
:events => [:payload]
}
def up
if data_exists?
puts "This migration will update tables to use UTF-8 encoding and will update Agent and Event storage from YAML to JSON."
puts "It shoul... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140603104211_rename_digest_email_to_email_digest.rb | Ruby | mit | 49,192 | master | 731 | class RenameDigestEmailToEmailDigest < ActiveRecord::Migration[4.2]
def up
sql = <<-SQL
UPDATE #{ActiveRecord::Base.connection.quote_table_name('agents')}
SET #{ActiveRecord::Base.connection.quote_column_name('type')} = 'Agents::EmailDigestAgent'
WHERE #{ActiveRecord::Base.connection.quote_colum... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140515211100_create_services.rb | Ruby | mit | 49,192 | master | 498 | class CreateServices < ActiveRecord::Migration[4.2]
def change
create_table :services do |t|
t.integer :user_id, null: false
t.string :provider, null: false
t.string :name, null: false
t.text :token, null: false
t.text :secret
t.text :refresh_token
t.datetime :expires_at
... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20160307085545_warn_about_duplicate_usernames.rb | Ruby | mit | 49,192 | master | 804 | class WarnAboutDuplicateUsernames < ActiveRecord::Migration[4.2]
def up
names = User.group('LOWER(username)').having('count(*) > 1').pluck('LOWER(username)')
if names.length > 0
puts "-----------------------------------------------------"
puts "--------------------- WARNiNG -----------------------... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20130126080736_change_memory_to_long_text.rb | Ruby | mit | 49,192 | master | 593 | # PG allows arbitrarily long text fields but MySQL has default limits. Make those limits larger if we're using MySQL.
class ChangeMemoryToLongText < ActiveRecord::Migration[4.2]
def up
if mysql?
change_column :agents, :memory, :text, :limit => 4294967295
change_column :events, :payload, :text, :limit... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20241027081918_website_agent_rename_array_to_single_array.rb | Ruby | mit | 49,192 | master | 814 | class WebsiteAgentRenameArrayToSingleArray < ActiveRecord::Migration[6.1]
def up
Agents::WebsiteAgent.find_each do |agent|
case extract = agent.options['extract']
when Hash
extract.each_value do |details|
if details.is_a?(Hash) && details.key?('array')
details['single_arr... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140121075418_create_user_credentials.rb | Ruby | mit | 49,192 | master | 378 | class CreateUserCredentials < ActiveRecord::Migration[4.2]
def change
create_table :user_credentials do |t|
t.integer :user_id, :null => false
t.string :credential_name, :null => false
t.text :credential_value, :null => false
t.timestamps
end
add_index :user_credentials... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140509170420_create_scenarios.rb | Ruby | mit | 49,192 | master | 298 | class CreateScenarios < ActiveRecord::Migration[4.2]
def change
create_table :scenarios do |t|
t.string :name, :null => false
t.integer :user_id, :null => false
t.timestamps
end
add_column :users, :scenario_count, :integer, :null => false, :default => 0
end
end |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140813110107_set_charset_for_mysql.rb | Ruby | mit | 49,192 | master | 2,093 | class SetCharsetForMysql < ActiveRecord::Migration[4.2]
def all_models
@all_models ||= [
Agent,
AgentLog,
Event,
Link,
Scenario,
ScenarioMembership,
User,
UserCredential,
Delayed::Job,
]
end
def change
# This is migration is for MySQL only.
re... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20121220053905_create_agents.rb | Ruby | mit | 49,192 | master | 492 | class CreateAgents < ActiveRecord::Migration[4.2]
def change
create_table :agents do |t|
t.integer :user_id
t.text :options
t.string :type
t.string :name
t.string :schedule
t.integer :events_count
t.datetime :last_check_at
t.datetime :last_receive_at
t.integer... |
github | huginn/huginn | https://github.com/huginn/huginn | db/migrate/20140525150140_migrate_agents_to_service_authentication.rb | Ruby | mit | 49,192 | master | 1,967 | class MigrateAgentsToServiceAuthentication < ActiveRecord::Migration[4.2]
def twitter_consumer_key(agent)
agent.options['consumer_key'].presence || agent.credential('twitter_consumer_key')
end
def twitter_consumer_secret(agent)
agent.options['consumer_secret'].presence || agent.credential('twitter_consum... |
github | huginn/huginn | https://github.com/huginn/huginn | db/seeds/seeder.rb | Ruby | mit | 49,192 | master | 894 | class Seeder
def self.seed
if User.any?
puts "At least one User already exists, not seeding."
exit
end
user = User.find_or_initialize_by(:email => ENV['SEED_EMAIL'].presence || "admin@example.com")
user.username = ENV['SEED_USERNAME'].presence || "admin"
user.password = ENV['SEED_PASS... |
github | huginn/huginn | https://github.com/huginn/huginn | db/native_json_migrate/20260403000000_change_agents_options_and_events_payload_to_native_json.rb | Ruby | mit | 49,192 | master | 2,912 | # Optionally upgrades serialized text columns to native JSON column types.
class ChangeAgentsOptionsAndEventsPayloadToNativeJson < ActiveRecord::Migration[8.1]
def up
return unless ENV["NATIVE_JSON_COLUMNS"].present?
case ActiveRecord::Base.connection.adapter_name
when /mysql/i
normalize_blank_json... |
github | huginn/huginn | https://github.com/huginn/huginn | bin/agent_runner.rb | Ruby | mit | 49,192 | master | 349 | #!/usr/bin/env ruby
# This process is used to maintain Huginn's upkeep behavior, automatically running scheduled Agents and
# periodically propagating and expiring Events. It also running TwitterStreamAgents and Agents that support long running
# background jobs.
require_relative './pre_runner_boot'
AgentRunner.new(... |
github | huginn/huginn | https://github.com/huginn/huginn | bin/threaded.rb | Ruby | mit | 49,192 | master | 244 | #!/usr/bin/env ruby
require_relative './pre_runner_boot'
agent_runner = AgentRunner.new
# We need to wait a bit to let delayed_job set it's traps so we can override them
Thread.new do
sleep 5
agent_runner.set_traps
end
agent_runner.run |
github | huginn/huginn | https://github.com/huginn/huginn | bin/twitter_stream.rb | Ruby | mit | 49,192 | master | 369 | #!/usr/bin/env ruby
# This process is used by TwitterStreamAgents to watch the Twitter stream in real time. It periodically checks for
# new or changed TwitterStreamAgents and starts to follow the stream for them. It is typically run by foreman via
# the included Procfile.
require_relative './pre_runner_boot'
Agen... |
github | huginn/huginn | https://github.com/huginn/huginn | bin/decrypt_backup.rb | Ruby | mit | 49,192 | master | 446 | #!/usr/bin/env ruby
# If you're using the backup gem, described on the Huginn wiki and at doc/deployment/backup, then you can use this
# utility to decrypt backups.
in_file = ARGV.shift
out_file = ARGV.shift || "decrypted_backup.tar"
puts "About to decrypt #{in_file} and write it to #{out_file}."
cmd = "bundle exec... |
github | huginn/huginn | https://github.com/huginn/huginn | bin/schedule.rb | Ruby | mit | 49,192 | master | 313 | #!/usr/bin/env ruby
# This process is used to maintain Huginn's upkeep behavior, automatically running scheduled Agents and
# periodically propagating and expiring Events. It's typically run via foreman and the included Procfile.
require_relative './pre_runner_boot'
AgentRunner.new(only: HuginnScheduler).run |
github | huginn/huginn | https://github.com/huginn/huginn | bin/pre_runner_boot.rb | Ruby | mit | 49,192 | master | 276 | unless defined?(Rails)
puts
puts "Please run me with rails runner, for example:"
puts " RAILS_ENV=production bundle exec rails runner bin/#{File.basename($0)}"
puts
exit 1
end
Rails.configuration.cache_classes = true
Dotenv.load if ENV['APP_SECRET_TOKEN'].blank? |
github | huginn/huginn | https://github.com/huginn/huginn | app/helpers/jobs_helper.rb | Ruby | mit | 49,192 | master | 1,268 | module JobsHelper
def status(job)
case
when job.failed_at
content_tag :span, 'failed', class: 'label label-danger'
when job.locked_at && job.locked_by
content_tag :span, 'running', class: 'label label-info'
else
content_tag :span, 'queued', class: 'label label-warning'
end
end
... |
github | huginn/huginn | https://github.com/huginn/huginn | app/helpers/dot_helper.rb | Ruby | mit | 49,192 | master | 6,869 | module DotHelper
def render_agents_diagram(agents, layout: nil)
if svg = dot_to_svg(agents_dot(agents, rich: true, layout:))
decorate_svg(svg, agents).html_safe
else
# Google chart request url
faraday = Faraday.new { |builder|
builder.request :url_encoded
builder.adapter Fara... |
github | huginn/huginn | https://github.com/huginn/huginn | app/helpers/scenario_helper.rb | Ruby | mit | 49,192 | master | 544 | module ScenarioHelper
def style_colors(scenario)
{
color: scenario.tag_fg_color || default_scenario_fg_color,
background_color: scenario.tag_bg_color || default_scenario_bg_color
}.map { |key, value| "#{key.to_s.dasherize}:#{value}" }.join(';')
end
def scenario_label(scenario, text = nil)
... |
github | huginn/huginn | https://github.com/huginn/huginn | app/helpers/application_helper.rb | Ruby | mit | 49,192 | master | 3,911 | module ApplicationHelper
def icon_tag(name, options = {})
dom_class = options[:class]
case name
when /\Aglyphicon-/
"<span class='glyphicon #{name}#{' ' if dom_class}#{dom_class}'></span>".html_safe
when /\Afa-/
"<i class='#{'fa-solid ' unless /(?:\A| )fa-(?:solid|brands)(?: |\z)/.match?(... |
github | huginn/huginn | https://github.com/huginn/huginn | app/helpers/agent_helper.rb | Ruby | mit | 49,192 | master | 3,999 | module AgentHelper
def agent_show_view(agent)
path = File.join('agents', 'agent_views', @agent.short_type.underscore, 'show')
return self.controller.template_exists?(path, [], true) ? path : nil
end
def toggle_disabled_text
if cookies[:huginn_view_only_enabled_agents]
" Show Disabled Agents"
... |
github | huginn/huginn | https://github.com/huginn/huginn | app/helpers/users_helper.rb | Ruby | mit | 49,192 | master | 460 | module UsersHelper
def user_account_state(user)
if !user.active?
content_tag :span, 'inactive', class: 'label label-danger'
elsif user.access_locked?
content_tag :span, 'locked', class: 'label label-danger'
elsif ENV['REQUIRE_CONFIRMED_EMAIL'] == 'true' && !user.confirmed?
content_tag :s... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agent_log.rb | Ruby | mit | 49,192 | master | 1,618 | # AgentLogs are temporary records of Agent activity, intended for debugging and error tracking. They can be viewed
# in Agents' detail pages. AgentLogs with a `level` of 4 or greater are considered "errors" and automatically update
# Agents' `last_error_log_at` column. These are often used to determine if an Agent i... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/user.rb | Ruby | mit | 49,192 | master | 3,110 | # Huginn is designed to be a multi-User system. Users have many Agents (and Events created by those Agents).
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable,
:validatable, :lockable, :omniauthable,
*(:confirmable if E... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/event.rb | Ruby | mit | 49,192 | master | 3,875 | require 'location'
# Events are how Huginn Agents communicate and log information about the world. Events can be emitted and received by
# Agents. They contain a serialized `payload` of arbitrary JSON data, as well as optional `lat`, `lng`, and `expires_at`
# fields.
class Event < ActiveRecord::Base
include JsonSe... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/service.rb | Ruby | mit | 49,192 | master | 5,513 | class Service < ActiveRecord::Base
include JsonSerializedField
json_serialize :options
belongs_to :user, inverse_of: :services
has_many :agents, inverse_of: :service
validates_presence_of :user_id, :provider, :name, :token
before_destroy :disable_agents
scope :available_to_user, lambda { |user| where... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/control_link.rb | Ruby | mit | 49,192 | master | 324 | # A ControlLink connects Agents in a control flow from the `controller` to the `control_target`.
class ControlLink < ActiveRecord::Base
belongs_to :controller, class_name: 'Agent', inverse_of: :control_links_as_controller
belongs_to :control_target, class_name: 'Agent', inverse_of: :control_links_as_control_target
... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/link.rb | Ruby | mit | 49,192 | master | 452 | # A Link connects Agents in a directed Event flow from the `source` to the `receiver`.
class Link < ActiveRecord::Base
belongs_to :source, class_name: "Agent", inverse_of: :links_as_source
belongs_to :receiver, class_name: "Agent", inverse_of: :links_as_receiver
before_create :store_event_id_at_creation
def s... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/scenario.rb | Ruby | mit | 49,192 | master | 1,283 | class Scenario < ActiveRecord::Base
include HasGuid
belongs_to :user, counter_cache: :scenario_count, inverse_of: :scenarios
has_many :scenario_memberships, dependent: :destroy, inverse_of: :scenario
has_many :agents, through: :scenario_memberships, inverse_of: :scenarios
validates_presence_of :name, :user
... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/user_credential.rb | Ruby | mit | 49,192 | master | 566 | class UserCredential < ActiveRecord::Base
MODES = %w[text java_script]
belongs_to :user
validates :credential_name, presence: true, uniqueness: { case_sensitive: true, scope: :user_id }
validates :credential_value, presence: true
validates :mode, inclusion: { in: MODES }
validates :user_id, presence: true... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agent.rb | Ruby | mit | 49,192 | master | 15,004 | require 'utils'
# Agent is the core class in Huginn, representing a configurable, schedulable, reactive system with memory that can
# be sub-classed for many different purposes. Agents can emit Events, as well as receive them and react in many different ways.
# The basic Agent API is detailed on the Huginn wiki: http... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/stubhub_agent.rb | Ruby | mit | 49,192 | master | 2,637 | module Agents
class StubhubAgent < Agent
cannot_receive_events!
description <<~MD
The StubHub Agent creates an event for a given StubHub Event.
It can be used to track how many tickets are available for the event and the minimum and maximum price. All that is required is that you paste in the ur... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/shell_command_agent.rb | Ruby | mit | 49,192 | master | 5,402 | module Agents
class ShellCommandAgent < Agent
default_schedule "never"
can_dry_run!
no_bulk_receive!
def self.should_run?
ENV['ENABLE_INSECURE_AGENTS'] == "true"
end
description <<~MD
The Shell Command Agent will execute commands on your local system, returning the output.
... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/weibo_publish_agent.rb | Ruby | mit | 49,192 | master | 3,696 | require "open-uri"
module Agents
class WeiboPublishAgent < Agent
include WeiboConcern
cannot_be_scheduled!
description <<~MD
The Weibo Publish Agent publishes posts from the events it receives.
You must first set up a Weibo app and generate an `access_token` for the user that will be used ... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/post_agent.rb | Ruby | mit | 49,192 | master | 9,283 | module Agents
class PostAgent < Agent
include EventHeadersConcern
include WebRequestConcern
include FileHandling
consumes_file_pointer!
MIME_RE = /\A\w+\/.+\z/
can_dry_run!
no_bulk_receive!
default_schedule "never"
description do
<<~MD
A Post Agent receives events... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/witai_agent.rb | Ruby | mit | 49,192 | master | 2,416 | module Agents
class WitaiAgent < Agent
cannot_be_scheduled!
no_bulk_receive!
description <<~MD
The `wit.ai` agent receives events, sends a text query to your `wit.ai` instance and generates outcome events.
Fill in `Server Access Token` of your `wit.ai` instance. Use [Liquid](https://github.c... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/change_detector_agent.rb | Ruby | mit | 49,192 | master | 2,702 | module Agents
class ChangeDetectorAgent < Agent
cannot_be_scheduled!
description <<~MD
The Change Detector Agent receives a stream of events and emits a new event when a property of the received event changes.
`property` specifies a [Liquid](https://github.com/huginn/huginn/wiki/Formatting-Event... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/webhook_agent.rb | Ruby | mit | 49,192 | master | 6,190 | module Agents
class WebhookAgent < Agent
include EventHeadersConcern
include WebRequestConcern # to make reCAPTCHA verification requests
cannot_be_scheduled!
cannot_receive_events!
description do
<<~MD
The Webhook Agent will create events by receiving webhooks from any source. In ... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/de_duplication_agent.rb | Ruby | mit | 49,192 | master | 2,527 | module Agents
class DeDuplicationAgent < Agent
include FormConfigurable
cannot_be_scheduled!
description <<~MD
The De-duplication Agent receives a stream of events and remits the event if it is not a duplicate.
`property` the value that should be used to determine the uniqueness of the event... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/twilio_receive_text_agent.rb | Ruby | mit | 49,192 | master | 3,451 | module Agents
class TwilioReceiveTextAgent < Agent
cannot_be_scheduled!
cannot_receive_events!
gem_dependency_check { defined?(Twilio) }
description do
<<~MD
The Twilio Receive Text Agent receives text messages from Twilio and emits them as events.
#{'## Include `twilio-ruby` ... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/imap_folder_agent.rb | Ruby | mit | 49,192 | master | 19,872 | require 'base64'
require 'delegate'
require 'net/imap'
require 'mail'
module Agents
class ImapFolderAgent < Agent
include GoogleOauth2Concern
include EventHeadersConcern
cannot_receive_events!
can_dry_run!
default_schedule "every_30m"
description <<~MD
The Imap Folder Agent checks a... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/scheduler_agent.rb | Ruby | mit | 49,192 | master | 3,296 | require 'fugit'
module Agents
class SchedulerAgent < Agent
include AgentControllerConcern
cannot_be_scheduled!
cannot_receive_events!
cannot_create_events!
@@second_precision_enabled = ENV['ENABLE_SECOND_PRECISION_SCHEDULE'] == 'true'
cattr_reader :second_precision_enabled
description... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/key_value_store_agent.rb | Ruby | mit | 49,192 | master | 4,083 | # frozen_string_literal: true
module Agents
class KeyValueStoreAgent < Agent
can_control_other_agents!
cannot_be_scheduled!
cannot_create_events!
description <<~MD
The Key-Value Store Agent is a data storage that keeps an associative array in its memory. It receives events to store values and... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/openai_speech_agent.rb | Ruby | mit | 49,192 | master | 9,192 | module Agents
class OpenaiSpeechAgent < Agent
include OpenaiConcern
include FileHandling
consumes_file_pointer!
can_dry_run!
no_bulk_receive!
default_schedule "never"
description <<~MD
The OpenAI Speech Agent provides both **speech-to-text** (Whisper) and **text-to-speech** (TTS) ... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/delay_agent.rb | Ruby | mit | 49,192 | master | 4,603 | module Agents
class DelayAgent < Agent
include FormConfigurable
default_schedule 'every_12h'
description <<~MD
The DelayAgent stores received Events and emits copies of them on a schedule. Use this as a buffer or queue of Events.
`max_events` should be set to the maximum number of events th... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/csv_agent.rb | Ruby | mit | 49,192 | master | 6,790 | require 'csv'
module Agents
class CsvAgent < Agent
include FormConfigurable
include FileHandling
cannot_be_scheduled!
consumes_file_pointer!
def default_options
{
'mode' => 'parse',
'separator' => ',',
'use_fields' => '',
'output' => 'event_per_row',
... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/threads_user_agent.rb | Ruby | mit | 49,192 | master | 4,312 | module Agents
class ThreadsUserAgent < Agent
include ThreadsConcern
can_dry_run!
cannot_receive_events!
description <<~MD
The Threads User Agent follows the posts created by a specific Threads user, or your authenticated Threads account by default.
#{threads_dependencies_missing if depe... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/digest_agent.rb | Ruby | mit | 49,192 | master | 2,808 | module Agents
class DigestAgent < Agent
include FormConfigurable
default_schedule "6am"
description <<~MD
The Digest Agent collects any Events sent to it and emits them as a single event.
The resulting Event will have a payload message of `message`. You can use liquid templating in the `mes... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/sentiment_agent.rb | Ruby | mit | 49,192 | master | 2,784 | require 'csv'
module Agents
class SentimentAgent < Agent
class_attribute :anew
cannot_be_scheduled!
description <<~MD
The Sentiment Agent generates `good-bad` (psychological valence or happiness index), `active-passive` (arousal), and `strong-weak` (dominance) score. It will output a value betwe... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/peak_detector_agent.rb | Ruby | mit | 49,192 | master | 5,723 | module Agents
class PeakDetectorAgent < Agent
cannot_be_scheduled!
DEFAULT_SEARCH_URL = 'https://twitter.com/search?q={q}'
description <<~MD
The Peak Detector Agent will watch for peaks in an event stream. When a peak is detected, the resulting Event will have a payload message of `message`. You... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/twitter_user_agent.rb | Ruby | mit | 49,192 | master | 3,827 | module Agents
class TwitterUserAgent < Agent
include TwitterConcern
can_dry_run!
cannot_receive_events!
description <<~MD
The Twitter User Agent either follows the timeline of a specific Twitter user or follows your own home timeline including both your tweets and tweets from people whom you a... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/liquid_output_agent.rb | Ruby | mit | 49,192 | master | 8,707 | module Agents
class LiquidOutputAgent < Agent
include FormConfigurable
cannot_be_scheduled!
cannot_create_events!
DATE_UNITS = %w[second seconds minute minutes hour hours day days week weeks month months year years]
description do
<<~MD
The Liquid Output Agent outputs events thro... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/email_digest_agent.rb | Ruby | mit | 49,192 | master | 2,676 | require 'net/smtp'
module Agents
class EmailDigestAgent < Agent
include EmailConcern
default_schedule "5am"
cannot_create_events!
description <<~MD
The Email Digest Agent collects any Events sent to it and sends them all via email when scheduled. The number of
used events also relies o... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/mqtt_agent.rb | Ruby | mit | 49,192 | master | 4,849 | require "json"
module Agents
class MqttAgent < Agent
gem_dependency_check { defined?(MQTT) }
description <<~MD
The MQTT Agent allows both publication and subscription to an MQTT topic.
#{'## Include `mqtt` in your Gemfile to use this Agent!' if dependencies_missing?}
MQTT is a generic tr... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/twitter_favorites.rb | Ruby | mit | 49,192 | master | 2,897 | module Agents
class TwitterFavorites < Agent
include TwitterConcern
can_dry_run!
cannot_receive_events!
description <<~MD
The Twitter Favorites List Agent follows the favorites list of a specified Twitter user.
#{twitter_dependencies_missing if dependencies_missing?}
To be able t... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/gap_detector_agent.rb | Ruby | mit | 49,192 | master | 2,169 | module Agents
class GapDetectorAgent < Agent
default_schedule "every_10m"
description <<~MD
The Gap Detector Agent will watch for holes or gaps in a stream of incoming Events and generate "no data alerts".
The `value_path` value is a [JSONPath](http://goessner.net/articles/JsonPath/) to a value ... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/jira_agent.rb | Ruby | mit | 49,192 | master | 5,053 | #!/usr/bin/env ruby
require 'cgi'
require 'httparty'
require 'date'
module Agents
class JiraAgent < Agent
include WebRequestConcern
cannot_receive_events!
description <<~MD
The Jira Agent subscribes to Jira issue updates.
- `jira_url` specifies the full URL of the jira installation, inclu... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/google_calendar_publish_agent.rb | Ruby | mit | 49,192 | master | 5,809 | require 'json'
require 'google/apis/calendar_v3'
module Agents
class GoogleCalendarPublishAgent < Agent
cannot_be_scheduled!
no_bulk_receive!
gem_dependency_check { defined?(Google) && defined?(Google::Apis::CalendarV3) }
description <<~MD
The Google Calendar Publish Agent creates events on y... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/openai_llm_agent.rb | Ruby | mit | 49,192 | master | 5,852 | module Agents
class OpenaiLlmAgent < Agent
include OpenaiConcern
can_dry_run!
no_bulk_receive!
default_schedule "never"
description <<~MD
The OpenAI LLM Agent sends chat completion requests to any OpenAI-compatible API and emits the response as an event.
It works with OpenAI, Azure ... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/openai_image_generation_agent.rb | Ruby | mit | 49,192 | master | 5,503 | module Agents
class OpenaiImageGenerationAgent < Agent
include OpenaiConcern
can_dry_run!
no_bulk_receive!
default_schedule "never"
description <<~MD
The OpenAI Image Generation Agent generates images using any OpenAI-compatible image generation API (DALL-E 2, DALL-E 3, or compatible servi... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/weather_agent.rb | Ruby | mit | 49,192 | master | 7,456 | require 'date'
require 'cgi'
module Agents
class WeatherAgent < Agent
cannot_receive_events!
gem_dependency_check { defined?(ForecastIO) }
description <<~MD
The Weather Agent creates an event for the day's weather at a given `location`.
#{'## Include `forecast_io` in your Gemfile to use th... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/twitter_stream_agent.rb | Ruby | mit | 49,192 | master | 9,413 | module Agents
class TwitterStreamAgent < Agent
include TwitterConcern
include LongRunnable
cannot_receive_events!
description <<~MD
The Twitter Stream Agent follows the Twitter stream in real time, watching for certain keywords, or filters, that you provide.
#{twitter_dependencies_missi... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/json_parse_agent.rb | Ruby | mit | 49,192 | master | 1,911 | module Agents
class JsonParseAgent < Agent
include FormConfigurable
cannot_be_scheduled!
can_dry_run!
description <<~MD
The JSON Parse Agent parses a JSON string and emits the data in a new event or merge with with the original event.
`data` is the JSON to parse. Use [Liquid](https://gi... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/twitter_publish_agent.rb | Ruby | mit | 49,192 | master | 3,444 | module Agents
class TwitterPublishAgent < Agent
include TwitterConcern
cannot_be_scheduled!
description <<~MD
The Twitter Publish Agent publishes tweets from the events it receives.
#{twitter_dependencies_missing if dependencies_missing?}
To be able to use this Agent you need to auth... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/google_translation_agent.rb | Ruby | mit | 49,192 | master | 4,432 | module Agents
class GoogleTranslationAgent < Agent
cannot_be_scheduled!
can_dry_run!
gem_dependency_check do
require 'google/cloud/translate/v2'
rescue LoadError
false
else
true
end
description <<~MD
The Translation Agent will attempt to translate text between nat... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/dropbox_watch_agent.rb | Ruby | mit | 49,192 | master | 3,544 | module Agents
class DropboxWatchAgent < Agent
include DropboxConcern
cannot_receive_events!
default_schedule "every_1m"
description <<~MD
The Dropbox Watch Agent watches the given `dir_to_watch` and emits events with the detected changes.
#{'## Set `DROPBOX_OAUTH_KEY` and `DROPBOX_OAUTH... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/s3_agent.rb | Ruby | mit | 49,192 | master | 6,449 | module Agents
class S3Agent < Agent
include FormConfigurable
include FileHandling
emits_file_pointer!
no_bulk_receive!
default_schedule 'every_1h'
gem_dependency_check { defined?(Aws::S3) }
description do
<<~MD
The S3Agent can watch a bucket for changes or emit an event f... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/event_formatting_agent.rb | Ruby | mit | 49,192 | master | 7,033 | module Agents
class EventFormattingAgent < Agent
cannot_be_scheduled!
can_dry_run!
description <<~MD
The Event Formatting Agent allows you to format incoming Events, adding new fields as needed.
For example, here is a possible Event:
{
"high": {
"celsius"... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/data_output_agent.rb | Ruby | mit | 49,192 | master | 16,565 | module Agents
class DataOutputAgent < Agent
include WebRequestConcern
cannot_be_scheduled!
cannot_create_events!
description do
<<~MD
The Data Output Agent outputs received events as either RSS or JSON. Use it to output a public or private stream of Huginn data.
This Agent wi... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/pushover_agent.rb | Ruby | mit | 49,192 | master | 5,392 | module Agents
class PushoverAgent < Agent
can_dry_run!
cannot_be_scheduled!
cannot_create_events!
no_bulk_receive!
API_URL = 'https://api.pushover.net/1/messages.json'
description <<~MD
The Pushover Agent receives and collects events and sends them via push notification to a user/group... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/pushbullet_agent.rb | Ruby | mit | 49,192 | master | 4,317 | module Agents
class PushbulletAgent < Agent
include FormConfigurable
cannot_be_scheduled!
cannot_create_events!
no_bulk_receive!
before_validation :create_device, on: :create
API_BASE = 'https://api.pushbullet.com/v2/'
TYPE_TO_ATTRIBUTES = {
'note' => [:title, :body],
'link'... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/telegram_agent.rb | Ruby | mit | 49,192 | master | 8,120 | require 'httmultiparty'
module Agents
class TelegramAgent < Agent
include FormConfigurable
cannot_be_scheduled!
cannot_create_events!
no_bulk_receive!
can_dry_run!
description <<~MD
The Telegram Agent receives and collects events and sends them via [Telegram](https://telegram.org/).
... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/twitter_action_agent.rb | Ruby | mit | 49,192 | master | 2,935 | module Agents
class TwitterActionAgent < Agent
include TwitterConcern
cannot_be_scheduled!
description <<~MD
The Twitter Action Agent is able to retweet or favorite tweets from the events it receives.
#{twitter_dependencies_missing if dependencies_missing?}
It expects to consume even... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/dropbox_file_url_agent.rb | Ruby | mit | 49,192 | master | 4,082 | module Agents
class DropboxFileUrlAgent < Agent
include DropboxConcern
cannot_be_scheduled!
no_bulk_receive!
can_dry_run!
description <<~MD
The _DropboxFileUrlAgent_ is used to work with Dropbox. It takes a file path (or multiple files paths) and emits events with either [temporary links](... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/ftpsite_agent.rb | Ruby | mit | 49,192 | master | 7,993 | require 'uri'
require 'time'
module Agents
class FtpsiteAgent < Agent
include FileHandling
default_schedule "every_12h"
gem_dependency_check { defined?(Net::FTP) && defined?(Net::FTP::List) }
emits_file_pointer!
description do
<<~MD
The Ftp Site Agent checks an FTP site and creat... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/openai_video_generation_agent.rb | Ruby | mit | 49,192 | master | 11,960 | module Agents
class OpenaiVideoGenerationAgent < Agent
include OpenaiConcern
can_dry_run!
no_bulk_receive!
default_schedule "never"
MAX_PENDING_GENERATIONS = 50
PENDING_GENERATION_TTL = 24.hours
description <<~MD
The OpenAI Video Generation Agent generates videos using any OpenAI-... |
github | huginn/huginn | https://github.com/huginn/huginn | app/models/agents/slack_agent.rb | Ruby | mit | 49,192 | master | 3,176 | module Agents
class SlackAgent < Agent
DEFAULT_USERNAME = 'Huginn'
ALLOWED_PARAMS = ['channel', 'username', 'unfurl_links', 'attachments', 'blocks']
can_dry_run!
cannot_be_scheduled!
cannot_create_events!
no_bulk_receive!
gem_dependency_check { defined?(Slack) }
description <<~MD
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.