Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0 // Ruby on Rails Mountable Engine #420

Draft
wants to merge 41 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c039328
Create the new engine base structure
matthewblack Jun 27, 2024
d3db4d6
Set up engine routes and service configurations
emorissettegregoire Jul 11, 2024
e392c0e
WIP - Implement Stealth.event method to support new DSL for event dec…
emorissettegregoire Jul 19, 2024
f39ca09
Update MIT-LICENSE
matthewblack Jul 21, 2024
49e6c43
Setup a ServiceMessage
emorissettegregoire Aug 8, 2024
da51f07
Update copyright
emorissettegregoire Aug 8, 2024
fff945d
Separate routes & controllers for messages and calls
emorissettegregoire Aug 9, 2024
44e848e
Ruby Versions
matthewblack Aug 15, 2024
dc1e144
Base Service Client
matthewblack Aug 15, 2024
6a6d7f9
Add Slack Config
matthewblack Aug 15, 2024
099ab0e
Move everything to base
matthewblack Aug 15, 2024
3ec4057
Threads, Errors and Loggers
matthewblack Aug 15, 2024
f0ca069
TID belongs at module level
matthewblack Aug 15, 2024
06dc82e
Refactor down to dispatcher
matthewblack Aug 15, 2024
71ba312
Just change to event controller
matthewblack Aug 15, 2024
b8a8ae3
Refactoring down to event controller, dispatcher and a unified servic…
matthewblack Aug 15, 2024
3fff994
Get rid of service call and service message. Refactor this down to se…
matthewblack Aug 15, 2024
83f995b
Remove Bandwidth.
matthewblack Aug 18, 2024
b1a6304
require stealth/engine
emorissettegregoire Aug 21, 2024
babb2e6
Use single quote in base file
emorissettegregoire Aug 21, 2024
9df71aa
Rename dispatch_event method to avoid potential conflicts and fix JSO…
emorissettegregoire Aug 27, 2024
2b70214
Webhook subscription logic to EventController and add attributes to S…
emorissettegregoire Aug 29, 2024
b493b40
Add an event mapping
emorissettegregoire Sep 2, 2024
dd0815a
Add session file and expose convenience methods in DSL - WIP
emorissettegregoire Sep 5, 2024
cc88564
Update Gemfile.lock
emorissettegregoire Sep 10, 2024
9ed1ca4
Define Stealth::EventContext with core methods for accessing controll…
emorissettegregoire Sep 10, 2024
0480633
WIP - Add FlowManager class to support flow DSL
emorissettegregoire Sep 17, 2024
252f500
Remove unused files
emorissettegregoire Sep 17, 2024
cb20e69
Fix trigger_flow and ensure string sanitization in say method
emorissettegregoire Sep 20, 2024
f63809a
Refactor - Move say method to RepliesController
emorissettegregoire Sep 25, 2024
29fccd7
Add ReplyManager class to support reply DSL
emorissettegregoire Sep 25, 2024
51a1a67
Added idea to gitignore
kladaFOX Oct 7, 2024
a9ec5a2
Added intent classifier (#425)
kladaFOX Oct 14, 2024
b87521a
Setup ScheduledReplyJob and handle blank flow or state for session tr…
emorissettegregoire Oct 14, 2024
b9278ee
commit
emorissettegregoire Oct 14, 2024
78fa4ad
Fix typo in method name
emorissettegregoire Oct 14, 2024
e350a6b
Added ability to pass locals to step_to and update_session_to
kladaFOX Oct 16, 2024
3b96aed
Merge pull request #426 from hellostealth/feature/3.0-mountable-sessi…
matthewblack Oct 18, 2024
b400025
Dev Jumps
matthewblack Oct 18, 2024
fcf625b
Remove private so we can access in rails app
matthewblack Oct 18, 2024
e1b4653
WIP - Add support for dropdown message types
emorissettegregoire Nov 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
.yardoc
doc/
*.gem
/test/dummy
14 changes: 10 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
source 'https://rubygems.org'
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

# Specify your gem's dependencies in stealth.gemspec.
gemspec

platforms :mri do
gem 'oj', '~> 3.14'
end
gem "puma"

gem "sprockets-rails"

# Start debugger with binding.b [https://github.com/ruby/debug]
# gem "debug", ">= 1.0.0"
237 changes: 176 additions & 61 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,87 +1,202 @@
PATH
remote: .
specs:
stealth (2.0.0.beta7)
activesupport (~> 7.0)
multi_json (~> 1.12)
puma (~> 6.0)
redis (~> 5.0)
sidekiq (~> 7.0)
sinatra (>= 2, < 4)
thor (~> 1.0)
zeitwerk (~> 2.6)
stealth (3.0.0.alpha1)
rails (>= 7.1.3.4)

GEM
remote: https://rubygems.org/
specs:
activesupport (7.0.5)
actioncable (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.3.4)
actionpack (= 7.1.3.4)
activejob (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.3.4)
actionpack (= 7.1.3.4)
actionview (= 7.1.3.4)
activejob (= 7.1.3.4)
activesupport (= 7.1.3.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.2)
actionpack (7.1.3.4)
actionview (= 7.1.3.4)
activesupport (= 7.1.3.4)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.3.4)
actionpack (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.3.4)
activesupport (= 7.1.3.4)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.3.4)
activesupport (= 7.1.3.4)
globalid (>= 0.3.6)
activemodel (7.1.3.4)
activesupport (= 7.1.3.4)
activerecord (7.1.3.4)
activemodel (= 7.1.3.4)
activesupport (= 7.1.3.4)
timeout (>= 0.4.0)
activestorage (7.1.3.4)
actionpack (= 7.1.3.4)
activejob (= 7.1.3.4)
activerecord (= 7.1.3.4)
activesupport (= 7.1.3.4)
marcel (~> 1.0)
activesupport (7.1.3.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
concurrent-ruby (1.2.2)
base64 (0.2.0)
bigdecimal (3.1.6)
builder (3.2.4)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
diff-lcs (1.5.0)
i18n (1.13.0)
concurrent-ruby (~> 1.0)
minitest (5.18.0)
mock_redis (0.36.0)
crass (1.0.6)
date (3.3.4)
drb (2.2.0)
ruby2_keywords
multi_json (1.15.0)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
nio4r (2.5.9)
oj (3.14.3)
puma (6.3.0)
erubi (1.12.0)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
io-console (0.7.2)
irb (1.11.1)
rdoc
reline (>= 0.4.2)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
mini_mime (1.1.5)
minitest (5.24.0)
mutex_m (0.2.0)
net-imap (0.4.9.1)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0.1)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.2-arm64-darwin)
racc (~> 1.4)
psych (5.1.2)
stringio
puma (6.4.2)
nio4r (~> 2.0)
rack (2.2.7)
rack-protection (3.0.6)
rack
racc (1.8.0)
rack (3.1.4)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
redis (5.0.6)
redis-client (>= 0.9.0)
redis-client (0.14.1)
connection_pool
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.0)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails (7.1.3.4)
actioncable (= 7.1.3.4)
actionmailbox (= 7.1.3.4)
actionmailer (= 7.1.3.4)
actionpack (= 7.1.3.4)
actiontext (= 7.1.3.4)
actionview (= 7.1.3.4)
activejob (= 7.1.3.4)
activemodel (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
bundler (>= 1.15.0)
railties (= 7.1.3.4)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rake (13.1.0)
rdoc (6.6.2)
psych (>= 4.0.0)
reline (0.4.2)
io-console (~> 0.5)
ruby2_keywords (0.0.5)
sidekiq (7.1.2)
concurrent-ruby (< 2)
connection_pool (>= 2.3.0)
rack (>= 2.2.4)
redis-client (>= 0.14.0)
sinatra (3.0.6)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.0.6)
tilt (~> 2.0)
thor (1.2.2)
tilt (2.2.0)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
stringio (3.1.0)
thor (1.3.0)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
zeitwerk (2.6.8)
webrick (1.8.1)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.13)

PLATFORMS
ruby
arm64-darwin-21
arm64-darwin-22

DEPENDENCIES
mock_redis (~> 0.22)
oj (~> 3.14)
rack-test (~> 2.0)
rspec (~> 3.9)
puma
sprockets-rails
stealth!

BUNDLED WITH
2.3.26
2.2.3
20 changes: 20 additions & 0 deletions MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright Matthew Black
matthewblack marked this conversation as resolved.
Show resolved Hide resolved

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
68 changes: 19 additions & 49 deletions README.md
matthewblack marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,58 +1,28 @@
# <a href='https://hellostealth.org'><img src='logo.svg' height='120' alt='Stealth Logo' aria-label='hellostealth.org' /></a>
# Stealth
Short description and motivation.

Stealth is a Ruby framework for creating text and voice chatbots. It's design is inspired by Ruby on Rails's philosophy of convention over configuration. It has an MVC architecture with the slight caveat that `views` are aptly named `replies`.
## Usage
How to use my plugin.

![CircleCI](https://img.shields.io/circleci/build/github/hellostealth/stealth?style=for-the-badge)
![Gem (including prereleases)](https://img.shields.io/gem/v/stealth?include_prereleases&style=for-the-badge)

## Features

* Deploy anywhere, it's just a Rack app
* Variants allow you to use a single codebase on multiple messaging platforms
* Structured, universal reply format
* Sessions utilize a state-machine concept and are Redis backed
* Highly scalable. Incoming webhooks are processed via a Sidekiq queue
* Built-in best practices: catch-alls (error handling), hello flows, goodbye flows

## Getting Started

Getting started with Stealth is simple:
## Installation
Add this line to your application's Gemfile:

```ruby
gem "stealth"
```
> gem install stealth
> stealth new <bot>
```

## Service Integrations

Stealth is extensible. All service integrations are split out into separate Ruby Gems. Things like analytics and natural language processing ([NLP](https://en.wikipedia.org/wiki/Natural-language_processing)) can be added in as gems as well.

Currently, there are gems for:

### Messaging
* [Facebook Messenger](https://github.com/hellostealth/stealth-facebook)
* [Twilio SMS](https://github.com/hellostealth/stealth-twilio)
* [Bandwidth](https://github.com/hellostealth/stealth-bandwidth)
* [Smooch](https://github.com/hellostealth/stealth-smooch)

### Voice
* [Alexa Skill](https://github.com/hellostealth/stealth-alexa) (Early alpha)

### Natural Language Processing
* [Microsoft LUIS](https://github.com/hellostealth/stealth-luis)
* [AWS Comprehend](https://github.com/hellostealth/stealth-aws-comprehend)

### Analytics
* [Mixpanel](https://github.com/hellostealth/stealth-mixpanel)

## Docs

You can find our full docs [here](https://github.com/hellostealth/stealth/wiki). If something is not clear in the docs, please file an issue! We consider all shortcomings in the docs as bugs.
And then execute:
```bash
$ bundle
```

## Versioning
Or install it yourself as:
```bash
$ gem install stealth
```

Stealth is versioned using [Semantic Versioning](https://semver.org), but it's more like the Linux Kernel. Major version releases are just as arbitrary as minor version releases. We strive to never break anything with any version change. Patches are still issues as the "third dot" in the version string.
## Contributing
Contribution directions go here.

## License

"Stealth" and the Stealth logo are Copyright (c) 2017-2024 MAV Automated Ventures Inc.
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require "bundler/setup"

APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
load "rails/tasks/engine.rake"

load "rails/tasks/statistics.rake"

require "bundler/gem_tasks"
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

1 change: 1 addition & 0 deletions app/assets/config/stealth_manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//= link_directory ../stylesheets/stealth .css
Loading
Loading