stealth 1.1.2 → 2.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +18 -8
- data/CHANGELOG.md +100 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +49 -43
- data/LICENSE +4 -17
- data/README.md +9 -17
- data/VERSION +1 -1
- data/lib/stealth/base.rb +62 -13
- data/lib/stealth/cli.rb +1 -2
- data/lib/stealth/commands/console.rb +1 -1
- data/lib/stealth/configuration.rb +0 -3
- data/lib/stealth/controller/callbacks.rb +1 -1
- data/lib/stealth/controller/catch_all.rb +27 -4
- data/lib/stealth/controller/controller.rb +168 -49
- data/lib/stealth/controller/dev_jumps.rb +41 -0
- data/lib/stealth/controller/dynamic_delay.rb +4 -6
- data/lib/stealth/controller/interrupt_detect.rb +100 -0
- data/lib/stealth/controller/messages.rb +283 -0
- data/lib/stealth/controller/nlp.rb +50 -0
- data/lib/stealth/controller/replies.rb +179 -41
- data/lib/stealth/controller/unrecognized_message.rb +62 -0
- data/lib/stealth/core_ext.rb +5 -0
- data/lib/stealth/{flow/core_ext.rb → core_ext/numeric.rb} +0 -1
- data/lib/stealth/core_ext/string.rb +18 -0
- data/lib/stealth/dispatcher.rb +21 -0
- data/lib/stealth/errors.rb +12 -0
- data/lib/stealth/flow/base.rb +1 -2
- data/lib/stealth/flow/specification.rb +3 -2
- data/lib/stealth/flow/state.rb +3 -3
- data/lib/stealth/generators/builder/Gemfile +4 -3
- data/lib/stealth/generators/builder/bot/controllers/bot_controller.rb +42 -0
- data/lib/stealth/generators/builder/bot/controllers/catch_alls_controller.rb +2 -0
- data/lib/stealth/generators/builder/bot/controllers/goodbyes_controller.rb +2 -0
- data/lib/stealth/generators/builder/bot/controllers/hellos_controller.rb +2 -0
- data/lib/stealth/generators/builder/bot/controllers/interrupts_controller.rb +9 -0
- data/lib/stealth/generators/builder/bot/controllers/unrecognized_messages_controller.rb +9 -0
- data/lib/stealth/generators/builder/config/flow_map.rb +8 -0
- data/lib/stealth/generators/builder/config/initializers/autoload.rb +8 -0
- data/lib/stealth/generators/builder/config/initializers/inflections.rb +16 -0
- data/lib/stealth/generators/builder/config/puma.rb +15 -0
- data/lib/stealth/helpers/redis.rb +40 -0
- data/lib/stealth/lock.rb +83 -0
- data/lib/stealth/logger.rb +27 -18
- data/lib/stealth/nlp/client.rb +22 -0
- data/lib/stealth/nlp/result.rb +57 -0
- data/lib/stealth/reloader.rb +90 -0
- data/lib/stealth/reply.rb +17 -0
- data/lib/stealth/scheduled_reply.rb +3 -3
- data/lib/stealth/server.rb +4 -4
- data/lib/stealth/service_message.rb +3 -2
- data/lib/stealth/service_reply.rb +5 -1
- data/lib/stealth/services/base_reply_handler.rb +2 -2
- data/lib/stealth/session.rb +106 -53
- data/spec/configuration_spec.rb +9 -2
- data/spec/controller/callbacks_spec.rb +23 -28
- data/spec/controller/catch_all_spec.rb +81 -29
- data/spec/controller/controller_spec.rb +444 -43
- data/spec/controller/dynamic_delay_spec.rb +16 -18
- data/spec/controller/helpers_spec.rb +1 -2
- data/spec/controller/interrupt_detect_spec.rb +171 -0
- data/spec/controller/messages_spec.rb +744 -0
- data/spec/controller/nlp_spec.rb +93 -0
- data/spec/controller/replies_spec.rb +446 -11
- data/spec/controller/unrecognized_message_spec.rb +168 -0
- data/spec/dispatcher_spec.rb +79 -0
- data/spec/flow/flow_spec.rb +1 -2
- data/spec/flow/state_spec.rb +14 -3
- data/spec/helpers/redis_spec.rb +77 -0
- data/spec/lock_spec.rb +100 -0
- data/spec/nlp/client_spec.rb +23 -0
- data/spec/nlp/result_spec.rb +57 -0
- data/spec/replies/messages/say_msgs_without_breaks.yml +4 -0
- data/spec/replies/messages/say_randomize_speech.yml +10 -0
- data/spec/replies/messages/say_randomize_text.yml +10 -0
- data/spec/replies/messages/sub1/sub2/say_nested.yml +10 -0
- data/spec/reply_spec.rb +61 -0
- data/spec/scheduled_reply_spec.rb +23 -0
- data/spec/service_reply_spec.rb +1 -2
- data/spec/session_spec.rb +251 -12
- data/spec/spec_helper.rb +21 -0
- data/spec/support/controllers/vaders_controller.rb +24 -0
- data/spec/support/nlp_clients/dialogflow.rb +9 -0
- data/spec/support/nlp_clients/luis.rb +9 -0
- data/spec/support/nlp_results/luis_result.rb +163 -0
- data/spec/version_spec.rb +1 -2
- data/stealth.gemspec +6 -6
- metadata +83 -39
- data/docs/00-introduction.md +0 -37
- data/docs/01-getting-started.md +0 -21
- data/docs/02-local-development.md +0 -40
- data/docs/03-basics.md +0 -171
- data/docs/04-sessions.md +0 -29
- data/docs/05-controllers.md +0 -179
- data/docs/06-models.md +0 -39
- data/docs/07-replies.md +0 -114
- data/docs/08-catchalls.md +0 -49
- data/docs/09-messaging-integrations.md +0 -80
- data/docs/10-nlp-integrations.md +0 -13
- data/docs/11-analytics.md +0 -13
- data/docs/12-commands.md +0 -62
- data/docs/13-deployment.md +0 -50
- data/lib/stealth/generators/builder/config/initializers/.keep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c85085bed89600d8dfcf7741800c99c98333155316e59fb18bbc53e0fc07280
|
4
|
+
data.tar.gz: c34523527fba0de8f35bc7e7de465bc3209ca735fae3acaf3e9fc4f089cb6d31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf345a282a3256914fd2c15b8139e5d1fa7b96f6f53591c675b38b6f5d5bf8fc1fd95a9db2d199abe8a4aa691e8641e27824069327ad8467b81269e7404d1cee
|
7
|
+
data.tar.gz: 78bdf64b387ee7294cf51251553479aca0622d687fab25c0b14481775812b7ce59665384f3fd3af7f24eddc12f1f588aaec4ce88af5453a9658547a06f308a3a
|
data/.circleci/config.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
version: 2
|
2
2
|
|
3
3
|
jobs:
|
4
|
-
|
4
|
+
ruby_2_6:
|
5
5
|
docker:
|
6
|
-
- image: circleci/ruby:2.
|
6
|
+
- image: circleci/ruby:2.6-node-browsers
|
7
7
|
environment:
|
8
8
|
STEALTH_ENV: test
|
9
9
|
|
@@ -18,7 +18,12 @@ jobs:
|
|
18
18
|
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
19
19
|
# fallback to using the latest cache if no exact match is found
|
20
20
|
- v1-dependencies-
|
21
|
-
|
21
|
+
- run:
|
22
|
+
name: Configure Bundler
|
23
|
+
command: |
|
24
|
+
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
|
25
|
+
source $BASH_ENV
|
26
|
+
gem install bundler
|
22
27
|
- run:
|
23
28
|
name: install dependencies
|
24
29
|
command: |
|
@@ -49,9 +54,9 @@ jobs:
|
|
49
54
|
- store_artifacts:
|
50
55
|
path: /tmp/test-results
|
51
56
|
destination: test-results
|
52
|
-
|
57
|
+
ruby_2_7:
|
53
58
|
docker:
|
54
|
-
- image: circleci/ruby:2.
|
59
|
+
- image: circleci/ruby:2.7-node-browsers
|
55
60
|
environment:
|
56
61
|
STEALTH_ENV: test
|
57
62
|
|
@@ -66,7 +71,12 @@ jobs:
|
|
66
71
|
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
67
72
|
# fallback to using the latest cache if no exact match is found
|
68
73
|
- v1-dependencies-
|
69
|
-
|
74
|
+
- run:
|
75
|
+
name: Configure Bundler
|
76
|
+
command: |
|
77
|
+
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
|
78
|
+
source $BASH_ENV
|
79
|
+
gem install bundler
|
70
80
|
- run:
|
71
81
|
name: install dependencies
|
72
82
|
command: |
|
@@ -102,5 +112,5 @@ workflows:
|
|
102
112
|
version: 2
|
103
113
|
build:
|
104
114
|
jobs:
|
105
|
-
-
|
106
|
-
-
|
115
|
+
- ruby_2_6
|
116
|
+
- ruby_2_7
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,103 @@
|
|
1
|
+
# Changelog for Stealth v2.0.0
|
2
|
+
|
3
|
+
## Enhancements
|
4
|
+
|
5
|
+
* [Controllers] Added support for Dev Jumping. This feature allows developers to jump around flows and states for bot's in development.
|
6
|
+
* [NLP] Added base classes for `Stealth::Nlp::Result` and `Stealth::Nlp::Client` to be used by NLP drivers.
|
7
|
+
* [Controllers] Scheduled replies no longer call `controller.route` when they run. Instead we `step_to` to the flow and state directly. This ensures the `route` is reserved for incoming messages.
|
8
|
+
* [Catch All] Backtrace logging has been improved. The error message is now included first in the backtrace.
|
9
|
+
* [Logger] The thread's ID (TID) is now included in every logging entry preceding the log type, ie "[facebook]"
|
10
|
+
* [Interrupt] Interrupt detection has been added. See the docs for more info on this feature.
|
11
|
+
* [Controllers] When user's flow is set to `catch_all` or `interrupt`, Stealth will ignore incoming messages. If you have interactive states in either of these controllers, you will need to move those interactions to a different controller.
|
12
|
+
* [Sessions] Sessions can now be cleared by calling `session.clear_session`. Clearing a session removes the key from Redis.
|
13
|
+
* [Logging] `primary_session`, `previous_session`, and `back_to_session` now explicitly logged
|
14
|
+
* [Sessions] The session is no longer set on update or stepping witht destination flow and state match the existing session.
|
15
|
+
* [Scheduled Replies] The `service_message.target_id` is now set for scheduled replies. NOTE: scheduled replies that are already enqueued will NOT have this set.
|
16
|
+
* [Server] Updated to Puma 4.3
|
17
|
+
* [Server] Updated to Sinatra 2.1
|
18
|
+
* [Sessions] Added `to_s` for sessions to pretty print the slug. Useful when debugging.
|
19
|
+
* `send_reples` now supports two additional options for replies:
|
20
|
+
`send_replies(custom_reply: 'hello/say_hello')`
|
21
|
+
`send_replies(inline: [])`
|
22
|
+
* Dynamic delays for SMS platforms do not delay at the beginning of a reply.
|
23
|
+
* Added support for Bandwidth SMS
|
24
|
+
* The `ServiceMessage` (current_message) now contains a `target_id`. This can be set by the platform driver to provide more information about the intended target of a message.
|
25
|
+
* [Controller] Added a `do_nothing` method that prevents `catch_all` from firing when a controller action doesn't send replies nor progresses the session.
|
26
|
+
* [Replies] If `text` and `speech` replies are specified as an Array, Stealth will now randomize the selected text.
|
27
|
+
* [Generators] Added sample payload handling to generated bots since it can be tricky.
|
28
|
+
* [Generators] Added `inflections.rb` to generators since we rely on `ActiveSupport::Inflector` to derive flow and controller names.
|
29
|
+
* [Sessions] previous_session log entries now appear below current_session entries.
|
30
|
+
* [Logging] Add option, `Stealth.config.transcript_logging`, to log incoming and outgoing messages.
|
31
|
+
* [Server] The only HTTP header passed along to `handle_message_job` is now `HTTP_HOST`.
|
32
|
+
* [Controllers] Added `set_back_to` and `step_back` to allow user specified "redirect back". Useful for multi-state transitions that would otherwise not be possible with just `previous_session`.
|
33
|
+
* [Configuration] Stealth::Configuration now returns `nil` for a configuration option that is missing. It still returns a `NoMethodError` if attempting to access a key from a parent node that is also missing.
|
34
|
+
* [Reloading] Bots in development mode now hot reload! It's no longer necessary to stop your local server.
|
35
|
+
* [Production] Production bots now eager load bot code to improve copy-on-write performance. The `puma.rb` config has been updated with instructions for multiple workers.
|
36
|
+
* [Flows] You can now specify custom options when defining states. These options can later be accessed via the flow specification.
|
37
|
+
* [CoreExt] Added a `String#without_punctuation` method. Removes a lot of common punctuation.
|
38
|
+
* [CoreExt] `String#normalize` no longer removes quotation marks.
|
39
|
+
* [Controllers] Alpha ordinal checks are now done against a "normalized" string without punctuation. See above.
|
40
|
+
* [Controllers] `normalized_msg` and `homophone_translated_msg` are now memoized for performance.
|
41
|
+
* [Errors] `Stealth::Errors::MessageNotRecognized` has been renamed to `Stealth::Errors::UnrecognizedMessage`
|
42
|
+
* [Controllers] When `handle_message` or `get_match` raise a `Stealth::Errors::UnrecognizedMessage`, the user is first routed to a new `UnrecognizedMessagesController` to perform NLP. If that controller fails to match, the `catch_all` is run as normal.
|
43
|
+
* [Errors] Client errors now call respective BotController actions: `handle_opt_out` and `handle_invalid_session_id`. Each client is responsible for raising `Stealth::Errors::UserOptOut` or `Stealth::Errors::InvalidSessionId` errors.
|
44
|
+
* [Controllers] `handle_message` and `get_match` now detect homophones for alpha ordinals (A-Z)
|
45
|
+
* [Controllers] `handle_message` and `get_match` now ignore single and double quotes for alpha-ordinals
|
46
|
+
* [CoreExt] Strings now have a `normalize` method for removing padding and quotes
|
47
|
+
* [Controllers] Improved logging when `UnrecognizedMessagesController` runs.
|
48
|
+
* [Controllers] State transitions (via `step_to`, `update_session_to`, `step_to_at`, `step_to_in`, and `set_back_to`) now accept a session `slug` argument.
|
49
|
+
* [Replies] Added support for sub-state replies. `step_to` can now take a `pos` argument that will force any resulting `send_replies` to be sent starting at the `pos` specified. `pos` can also be negative, for example, `-1` will force `send_replies` to send replies starting at (only) the last reply.
|
50
|
+
* [Replies] Dynamic delays are automatically sent before each reply. This can be disabled by setting `Stealth.config.auto_insert_delays` to `false`. If a delay is already included, the auto-delay is skipped.
|
51
|
+
* [Controllers] `handle_message` now supports `Regexp` keys.
|
52
|
+
|
53
|
+
## Bug Fixes
|
54
|
+
|
55
|
+
* [Catch All] Errors triggered within CatchAlls no longer trigger a CatchAll. They are simply ignored. This prevents infinite looping scenarios.
|
56
|
+
* [Interrupt] If CatchAll runs and doesn't `step_to`, it releases the session lock.
|
57
|
+
* [Controller] Messages are no longer ignored in CatchAll and Interrupt controllers
|
58
|
+
* [Interrupts] After `send_replies`, we now release the session lock. This ensures replies that send buttons can properly receive responses from them.
|
59
|
+
* Callbacks specified in child controllers of `BotController` where not being called during `step_to`. While the fix was small, we've bumped the minor release to ensure this fix does not break existing codebases.
|
60
|
+
* Fixed another bug loading replies from a `custom_reply` path in `send_replies`
|
61
|
+
* Fixed bug loading replies from a `custom_reply` path in `send_replies`
|
62
|
+
* Leading dynamic delays in a reply are not sent again on SMS platforms.
|
63
|
+
* [Sessions] Sessions retrieved when session expiration was enabled would return as an Array rather than a slug.
|
64
|
+
* [Sessions] previous_session now respects session_ttl values.
|
65
|
+
* [Catch All] Log output from all catch_all logging now includes the session_id so they can be included in log searches.
|
66
|
+
* [NLP] Strip out values from single element arrays in the case of custom LUIS List entities.
|
67
|
+
|
68
|
+
## Deprecations
|
69
|
+
|
70
|
+
* [Controllers] current_user_id has now been completely removed since becoming deprecated in 1.1.0.
|
71
|
+
* [Ruby] MRI 2.4 is no longer supported as we depend on ActiveSupport 6.0 now. Rails 6.0 only supports Ruby MRI 2.5+.
|
72
|
+
|
73
|
+
# Changelog for Stealth v1.1.5
|
74
|
+
|
75
|
+
## Enhancements
|
76
|
+
|
77
|
+
* [Replies] Replies will now always send the `sender_id` that came in to the service drivers. This ensures `current_session_id` hasn't been modified which would cause replies to fail to send.
|
78
|
+
|
79
|
+
# Changelog for Stealth v1.1.4
|
80
|
+
|
81
|
+
## Bug Fixes
|
82
|
+
|
83
|
+
* [General] Fixed controller and model concern load order. Previously files in the concerns folder were not loading before their respective controllers or models causing LoadErrors.
|
84
|
+
|
85
|
+
# Changelog for Stealth v1.1.3
|
86
|
+
|
87
|
+
## Bug Fixes
|
88
|
+
|
89
|
+
* [Server] Additional CONTENT_TYPE fixes that would cause the server to 500 when it was missing.
|
90
|
+
|
91
|
+
# Changelog for Stealth v1.1.2
|
92
|
+
|
93
|
+
## Bug Fixes
|
94
|
+
|
95
|
+
* [Server] Handle cases where CONTENT_TYPE is missing from incoming requests.
|
96
|
+
|
97
|
+
## Enhancements
|
98
|
+
|
99
|
+
* [CI] Added Ruby 2.6 to build.
|
100
|
+
|
1
101
|
# Changelog for Stealth v1.1.1
|
2
102
|
|
3
103
|
## Bug Fixes
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,79 +1,85 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stealth (
|
5
|
-
activesupport (~>
|
4
|
+
stealth (2.0.0.beta1)
|
5
|
+
activesupport (~> 6.0)
|
6
6
|
multi_json (~> 1.12)
|
7
|
-
puma (
|
8
|
-
sidekiq (~>
|
7
|
+
puma (>= 4.2, < 5.0)
|
8
|
+
sidekiq (~> 6.0)
|
9
9
|
sinatra (~> 2.0)
|
10
|
-
thor (~> 0
|
10
|
+
thor (~> 1.0)
|
11
11
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activesupport (
|
15
|
+
activesupport (6.0.3.3)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
17
|
i18n (>= 0.7, < 2)
|
18
18
|
minitest (~> 5.1)
|
19
19
|
tzinfo (~> 1.1)
|
20
|
-
|
21
|
-
|
20
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
21
|
+
concurrent-ruby (1.1.7)
|
22
|
+
connection_pool (2.2.3)
|
22
23
|
diff-lcs (1.3)
|
23
|
-
i18n (1.
|
24
|
+
i18n (1.8.5)
|
24
25
|
concurrent-ruby (~> 1.0)
|
25
|
-
minitest (5.
|
26
|
-
mock_redis (0.
|
27
|
-
multi_json (1.
|
28
|
-
mustermann (1.
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
minitest (5.14.2)
|
27
|
+
mock_redis (0.23.0)
|
28
|
+
multi_json (1.15.0)
|
29
|
+
mustermann (1.1.1)
|
30
|
+
ruby2_keywords (~> 0.0.1)
|
31
|
+
nio4r (2.5.4)
|
32
|
+
oj (3.10.6)
|
33
|
+
puma (4.3.6)
|
34
|
+
nio4r (~> 2.0)
|
35
|
+
rack (2.2.3)
|
36
|
+
rack-protection (2.1.0)
|
33
37
|
rack
|
34
38
|
rack-test (1.1.0)
|
35
39
|
rack (>= 1.0, < 3)
|
36
|
-
redis (4.
|
37
|
-
rspec (3.
|
38
|
-
rspec-core (~> 3.
|
39
|
-
rspec-expectations (~> 3.
|
40
|
-
rspec-mocks (~> 3.
|
41
|
-
rspec-core (3.
|
42
|
-
rspec-support (~> 3.
|
43
|
-
rspec-expectations (3.
|
40
|
+
redis (4.2.2)
|
41
|
+
rspec (3.9.0)
|
42
|
+
rspec-core (~> 3.9.0)
|
43
|
+
rspec-expectations (~> 3.9.0)
|
44
|
+
rspec-mocks (~> 3.9.0)
|
45
|
+
rspec-core (3.9.1)
|
46
|
+
rspec-support (~> 3.9.1)
|
47
|
+
rspec-expectations (3.9.1)
|
44
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-mocks (3.
|
49
|
+
rspec-support (~> 3.9.0)
|
50
|
+
rspec-mocks (3.9.1)
|
47
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-support (3.
|
52
|
+
rspec-support (~> 3.9.0)
|
53
|
+
rspec-support (3.9.2)
|
50
54
|
rspec_junit_formatter (0.4.1)
|
51
55
|
rspec-core (>= 2, < 4, != 2.12.0)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
redis (>= 3.3.5, < 5)
|
56
|
-
sinatra (2.0.4)
|
57
|
-
mustermann (~> 1.0)
|
56
|
+
ruby2_keywords (0.0.2)
|
57
|
+
sidekiq (6.1.2)
|
58
|
+
connection_pool (>= 2.2.2)
|
58
59
|
rack (~> 2.0)
|
59
|
-
|
60
|
+
redis (>= 4.2.0)
|
61
|
+
sinatra (2.1.0)
|
62
|
+
mustermann (~> 1.0)
|
63
|
+
rack (~> 2.2)
|
64
|
+
rack-protection (= 2.1.0)
|
60
65
|
tilt (~> 2.0)
|
61
|
-
thor (0.
|
66
|
+
thor (1.0.1)
|
62
67
|
thread_safe (0.3.6)
|
63
|
-
tilt (2.0.
|
64
|
-
tzinfo (1.2.
|
68
|
+
tilt (2.0.10)
|
69
|
+
tzinfo (1.2.7)
|
65
70
|
thread_safe (~> 0.1)
|
71
|
+
zeitwerk (2.4.0)
|
66
72
|
|
67
73
|
PLATFORMS
|
68
74
|
ruby
|
69
75
|
|
70
76
|
DEPENDENCIES
|
71
|
-
mock_redis (~> 0.
|
72
|
-
oj (~> 3.
|
77
|
+
mock_redis (~> 0.22)
|
78
|
+
oj (~> 3.10)
|
73
79
|
rack-test (~> 1.1)
|
74
|
-
rspec (~> 3.
|
80
|
+
rspec (~> 3.9)
|
75
81
|
rspec_junit_formatter (~> 0.3)
|
76
82
|
stealth!
|
77
83
|
|
78
84
|
BUNDLED WITH
|
79
|
-
1.
|
85
|
+
2.1.4
|
data/LICENSE
CHANGED
@@ -1,20 +1,7 @@
|
|
1
|
-
Copyright (c) 2017 Mauricio Gomes,
|
1
|
+
Copyright (c) 2017-2020 Mauricio Gomes, Mav Automation Ventures Inc.
|
2
2
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
3
|
+
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:
|
10
4
|
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
13
6
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
7
|
+
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.
|
data/README.md
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
# <a href='https://hellostealth.org'><img src='logo.svg' height='120' alt='Stealth Logo' aria-label='hellostealth.org' /></a>
|
2
2
|
|
3
|
-
Stealth is a Ruby
|
3
|
+
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`.
|
4
4
|
|
5
|
-
[![
|
6
|
-
[![CircleCI](https://circleci.com/gh/hellostealth/stealth/tree/master.svg?style=shield)](https://circleci.com/gh/hellostealth/stealth/tree/master)
|
5
|
+
[![CircleCI](https://circleci.com/gh/hellostealth/stealth.svg?style=svg)](https://circleci.com/gh/hellostealth/stealth)
|
7
6
|
|
8
7
|
## Features
|
9
8
|
|
@@ -34,6 +33,9 @@ Currently, there are gems for:
|
|
34
33
|
* [Twilio SMS](https://github.com/hellostealth/stealth-twilio)
|
35
34
|
* [Smooch](https://github.com/hellostealth/stealth-smooch)
|
36
35
|
|
36
|
+
### Voice
|
37
|
+
* [Alexa Skill](https://github.com/hellostealth/stealth-alexa) (Early alpha)
|
38
|
+
|
37
39
|
### Natural Language Processing
|
38
40
|
* [AWS Comprehend](https://github.com/hellostealth/stealth-aws-comprehend)
|
39
41
|
|
@@ -42,22 +44,12 @@ Currently, there are gems for:
|
|
42
44
|
|
43
45
|
## Docs
|
44
46
|
|
45
|
-
You can find our full docs [here](https://
|
46
|
-
|
47
|
-
## Thanks
|
47
|
+
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.
|
48
48
|
|
49
|
-
|
49
|
+
## Versioning
|
50
50
|
|
51
|
-
|
52
|
-
* [Ruby on Rails](http://rubyonrails.org) for projects like `ActiveRecord` and serving as an inspiration;
|
53
|
-
* [Thor](http://whatisthor.com) for providing us with CLI tools and generators;
|
54
|
-
* [Sinatra](http://sinatrarb.com) for providing a fantastic, modular way for handling HTTP requests;
|
55
|
-
* [Sidekiq](https://sidekiq.org) for the super quick background jobs;
|
56
|
-
* [standalone-migrations](https://github.com/thuss/standalone-migrations) for the help with Rails migrations;
|
57
|
-
* [Dr. Robert Ford](http://westworld.wikia.com/wiki/Robert_Ford) a.k.a. Anthony Hopkins.
|
51
|
+
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.
|
58
52
|
|
59
53
|
## License
|
60
54
|
|
61
|
-
"Stealth" and the Stealth logo are
|
62
|
-
|
63
|
-
Stealth source code is released under the MIT License.
|
55
|
+
"Stealth" and the Stealth logo are Copyright (c) 2020 Mauricio Gomes and Mav Automation Ventures Inc.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0.beta1
|
data/lib/stealth/base.rb
CHANGED
@@ -16,8 +16,13 @@ end
|
|
16
16
|
# core
|
17
17
|
require 'stealth/version'
|
18
18
|
require 'stealth/errors'
|
19
|
+
require 'stealth/core_ext'
|
19
20
|
require 'stealth/logger'
|
20
21
|
require 'stealth/configuration'
|
22
|
+
require 'stealth/reloader'
|
23
|
+
|
24
|
+
# helpers
|
25
|
+
require 'stealth/helpers/redis'
|
21
26
|
|
22
27
|
module Stealth
|
23
28
|
|
@@ -30,6 +35,7 @@ module Stealth
|
|
30
35
|
end
|
31
36
|
|
32
37
|
def self.boot
|
38
|
+
load_services_config
|
33
39
|
load_environment
|
34
40
|
end
|
35
41
|
|
@@ -41,9 +47,33 @@ module Stealth
|
|
41
47
|
Thread.current[:configuration] = config
|
42
48
|
end
|
43
49
|
|
50
|
+
def self.default_autoload_paths
|
51
|
+
[
|
52
|
+
File.join(Stealth.root, 'bot', 'controllers', 'concerns'),
|
53
|
+
File.join(Stealth.root, 'bot', 'controllers'),
|
54
|
+
File.join(Stealth.root, 'bot', 'models', 'concerns'),
|
55
|
+
File.join(Stealth.root, 'bot', 'models'),
|
56
|
+
File.join(Stealth.root, 'bot', 'helpers'),
|
57
|
+
File.join(Stealth.root, 'config')
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.bot_reloader
|
62
|
+
@bot_reloader
|
63
|
+
end
|
64
|
+
|
44
65
|
def self.set_config_defaults(config)
|
45
|
-
config.dynamic_delay_muliplier
|
46
|
-
config.session_ttl
|
66
|
+
config.dynamic_delay_muliplier ||= 1.0
|
67
|
+
config.session_ttl ||= 0
|
68
|
+
config.lock_autorelease ||= 30
|
69
|
+
config.transcript_logging ||= false
|
70
|
+
config.hot_reload ||= Stealth.env.development?
|
71
|
+
config.eager_load ||= Stealth.env.production?
|
72
|
+
config.autoload_paths ||= Stealth.default_autoload_paths
|
73
|
+
config.autoload_ignore_paths ||= []
|
74
|
+
config.nlp_integration ||= nil
|
75
|
+
config.log_all_nlp_results ||= false
|
76
|
+
config.auto_insert_delays ||= true
|
47
77
|
end
|
48
78
|
|
49
79
|
# Loads the services.yml configuration unless one has already been loaded
|
@@ -76,31 +106,42 @@ module Stealth
|
|
76
106
|
load_services_config(services_yaml)
|
77
107
|
end
|
78
108
|
|
109
|
+
def self.load_bot!
|
110
|
+
@bot_reloader ||= begin
|
111
|
+
bot_reloader = Stealth::Reloader.new
|
112
|
+
bot_reloader.load_bot!
|
113
|
+
bot_reloader
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
79
117
|
def self.load_environment
|
80
118
|
require File.join(Stealth.root, 'config', 'boot')
|
81
|
-
require_directory(
|
119
|
+
require_directory('config/initializers')
|
82
120
|
|
83
|
-
|
84
|
-
require File.join(Stealth.root, 'bot', 'controllers', 'bot_controller')
|
85
|
-
require File.join(Stealth.root, 'bot', 'models', 'bot_record')
|
121
|
+
load_bot!
|
86
122
|
|
87
|
-
|
88
|
-
require_directory("bot")
|
123
|
+
Sidekiq.options[:reloader] = Stealth.bot_reloader
|
89
124
|
|
90
125
|
if defined?(ActiveRecord)
|
91
126
|
if ENV['DATABASE_URL'].present?
|
92
127
|
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])
|
93
128
|
else
|
94
|
-
ActiveRecord::Base.establish_connection(
|
129
|
+
ActiveRecord::Base.establish_connection(
|
130
|
+
YAML::load_file("config/database.yml")[Stealth.env]
|
131
|
+
)
|
95
132
|
end
|
96
133
|
end
|
97
134
|
end
|
98
135
|
|
99
|
-
|
136
|
+
def self.tid
|
137
|
+
Thread.current.object_id.to_s(36)
|
138
|
+
end
|
100
139
|
|
101
|
-
|
102
|
-
|
103
|
-
|
140
|
+
def self.require_directory(directory)
|
141
|
+
for_each_file_in(directory) { |file| require_relative(file) }
|
142
|
+
end
|
143
|
+
|
144
|
+
private
|
104
145
|
|
105
146
|
def self.for_each_file_in(directory, &blk)
|
106
147
|
directory = directory.to_s.gsub(%r{(\/|\\)}, File::SEPARATOR)
|
@@ -120,11 +161,19 @@ require 'stealth/scheduled_reply'
|
|
120
161
|
require 'stealth/service_reply'
|
121
162
|
require 'stealth/service_message'
|
122
163
|
require 'stealth/session'
|
164
|
+
require 'stealth/lock'
|
165
|
+
require 'stealth/nlp/result'
|
166
|
+
require 'stealth/nlp/client'
|
123
167
|
require 'stealth/controller/callbacks'
|
124
168
|
require 'stealth/controller/replies'
|
169
|
+
require 'stealth/controller/messages'
|
170
|
+
require 'stealth/controller/unrecognized_message'
|
125
171
|
require 'stealth/controller/catch_all'
|
126
172
|
require 'stealth/controller/helpers'
|
127
173
|
require 'stealth/controller/dynamic_delay'
|
174
|
+
require 'stealth/controller/interrupt_detect'
|
175
|
+
require 'stealth/controller/dev_jumps'
|
176
|
+
require 'stealth/controller/nlp'
|
128
177
|
require 'stealth/controller/controller'
|
129
178
|
require 'stealth/flow/base'
|
130
179
|
require 'stealth/services/base_client'
|