stealth 2.0.0.beta5 → 2.0.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.gitbook.yaml +1 -0
  3. data/.github/dependabot.yml +11 -0
  4. data/.github/workflows/ci.yml +50 -0
  5. data/CHANGELOG.md +1 -0
  6. data/Gemfile.lock +36 -35
  7. data/MAINTENANCE.md +28 -0
  8. data/SECURITY.md +13 -0
  9. data/VERSION +1 -1
  10. data/docs/.gitbook/assets/2880px-Turnstile_state_machine_colored.svg.png +0 -0
  11. data/docs/.gitbook/assets/Torniqueterevolution.jpg +0 -0
  12. data/docs/.gitbook/assets/logo.svg +28 -0
  13. data/docs/.gitbook/assets/ruby.png +0 -0
  14. data/docs/README.md +35 -0
  15. data/docs/SUMMARY.md +99 -0
  16. data/docs/basics.md +77 -0
  17. data/docs/building-components/message-services.md +7 -0
  18. data/docs/building-components/nlp.md +7 -0
  19. data/docs/config/services.yml.md +2 -0
  20. data/docs/config/settings.md +2 -0
  21. data/docs/controllers/available-data.md +77 -0
  22. data/docs/controllers/catch-alls.md +135 -0
  23. data/docs/controllers/controller-overview.md +130 -0
  24. data/docs/controllers/dev-jumps.md +47 -0
  25. data/docs/controllers/get_match/README.md +2 -0
  26. data/docs/controllers/get_match/alpha-ordinals.md +2 -0
  27. data/docs/controllers/get_match/entity-match.md +2 -0
  28. data/docs/controllers/get_match/exact-match.md +2 -0
  29. data/docs/controllers/handle_message/README.md +54 -0
  30. data/docs/controllers/handle_message/alpha-ordinal-matcher.md +40 -0
  31. data/docs/controllers/handle_message/homophone-detection.md +36 -0
  32. data/docs/controllers/handle_message/nil-matcher.md +44 -0
  33. data/docs/controllers/handle_message/nlp-matcher.md +51 -0
  34. data/docs/controllers/handle_message/regex-matcher.md +41 -0
  35. data/docs/controllers/handle_message/string-mather.md +23 -0
  36. data/docs/controllers/interrupt-detection.md +2 -0
  37. data/docs/controllers/platform-errors.md +2 -0
  38. data/docs/controllers/route.md +70 -0
  39. data/docs/controllers/sessions/README.md +2 -0
  40. data/docs/controllers/sessions/do_nothing.md +17 -0
  41. data/docs/controllers/sessions/intro.md +37 -0
  42. data/docs/controllers/sessions/step_back.md +88 -0
  43. data/docs/controllers/sessions/step_to.md +47 -0
  44. data/docs/controllers/sessions/step_to_at.md +43 -0
  45. data/docs/controllers/sessions/step_to_in.md +43 -0
  46. data/docs/controllers/sessions/update_session_to.md +47 -0
  47. data/docs/controllers/unrecognized-messages.md +2 -0
  48. data/docs/deployment/heroku.md +2 -0
  49. data/docs/deployment/overview.md +2 -0
  50. data/docs/dev-environment/README.md +2 -0
  51. data/docs/dev-environment/booting-up.md +33 -0
  52. data/docs/dev-environment/environment-variables.md +54 -0
  53. data/docs/dev-environment/hot-code-reloading.md +52 -0
  54. data/docs/dev-environment/logs.md +74 -0
  55. data/docs/dev-environment/procfile.md +22 -0
  56. data/docs/dev-environment/tunnels.md +18 -0
  57. data/docs/flows/flowmap.md +40 -0
  58. data/docs/flows/overview.md +43 -0
  59. data/docs/flows/state-naming.md +53 -0
  60. data/docs/flows/state-options.md +70 -0
  61. data/docs/getting-started.md +19 -0
  62. data/docs/glossary.md +21 -0
  63. data/docs/models/activerecord.md +2 -0
  64. data/docs/models/mongoid.md +2 -0
  65. data/docs/models/overview.md +2 -0
  66. data/docs/nlp-nlu/microsoft-luis.md +2 -0
  67. data/docs/nlp-nlu/openai.md +2 -0
  68. data/docs/nlp-nlu/overview.md +2 -0
  69. data/docs/platforms/alexa-skills.md +2 -0
  70. data/docs/platforms/facebook-messenger.md +2 -0
  71. data/docs/platforms/overview.md +2 -0
  72. data/docs/platforms/sms-whatsapp.md +2 -0
  73. data/docs/platforms/voice.md +2 -0
  74. data/docs/replies/delays.md +2 -0
  75. data/docs/replies/erb.md +2 -0
  76. data/docs/replies/inline-replies.md +2 -0
  77. data/docs/replies/reply-overview.md +2 -0
  78. data/docs/replies/variants.md +2 -0
  79. data/docs/replies/yaml-replies.md +2 -0
  80. data/docs/testing/integration-testing.md +2 -0
  81. data/docs/testing/untitled.md +2 -0
  82. data/lib/stealth/server.rb +10 -1
  83. data/stealth.gemspec +1 -1
  84. metadata +81 -5
  85. data/.circleci/config.yml +0 -226
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24ba7ba55d264e21395db7b9166ecf96064c2c0d8c8bc51d09dd274ecaf5fd34
4
- data.tar.gz: c42254f819550577f249fddb13266cfa6bc8e2f27760994e3efdf7798447ecdd
3
+ metadata.gz: 691209f0b8b7a49ffa802cb57919c23dccb5f85f3da86e7bfec70c7e0ea85c5f
4
+ data.tar.gz: 3399604a657b73ba4d608d3516321d360b46dfd4ad6b5656845156ba61fee21a
5
5
  SHA512:
6
- metadata.gz: 3f1af77ae1b811b4f53f85df2365fae399efe6caf9db77a801898250dfcdb732e366b06efa1641b255eda53e2a22fff38ca7a8ebd6577d6dcf860509d002c261
7
- data.tar.gz: 7146a30ad60302ccc322e6691c6676b6b281dee1625bc1acf674e133b87d371b5cc470c5d3d4eb6d50526d33992a81f424364fbf4b10e23d93910aed815b5864
6
+ metadata.gz: 5f11b7d1acf10695012b0c253622d8cd7e4885265517f596f40364b60a9d0547a104aa700c5da78ec2015c5fb5de7a6314dbba716e5262353b50fee154b3c82e
7
+ data.tar.gz: 6abe7e7278d7c6a7e13d8c86044baf8d26c266f980decf5415ea9dc0fcf0b9f40e01b233524a933c0c11852b300b7243eff44e27c007c6274aa606ac44b54a5f
data/.gitbook.yaml ADDED
@@ -0,0 +1 @@
1
+ root: ./docs/
@@ -0,0 +1,11 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "bundler" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "daily"
@@ -0,0 +1,50 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ tests:
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, macos-latest]
15
+ ruby: [ 2.7, 3.0, 3.1, truffleruby-head ]
16
+ exclude:
17
+ - os: ubuntu-22.04
18
+ ruby: 2.7
19
+ - os: ubuntu-22.04
20
+ ruby: truffleruby-head
21
+
22
+ runs-on: ${{ matrix.os }}
23
+
24
+ name: ${{ matrix.os }} - ${{ matrix.ruby }}
25
+
26
+ env:
27
+ BUNDLE_GEMFILE: Gemfile
28
+ STEALTH_ENV: test
29
+
30
+ steps:
31
+ - uses: actions/checkout@v2
32
+ - uses: ruby/setup-ruby@v1
33
+ with:
34
+ ruby-version: ${{ matrix.ruby }}
35
+ bundler-cache: true
36
+
37
+ - name: Run specs
38
+ if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
39
+ timeout-minutes: 10
40
+ run: bundle exec rspec
41
+ continue-on-error: ${{ startsWith(matrix.ruby, 'truffleruby') }}
42
+ check_status:
43
+ if: ${{ always() }}
44
+ runs-on: ubuntu-latest
45
+ name: CI Status (matrix)
46
+ needs: tests
47
+ steps:
48
+ - name: Check continue-on-error matrix status
49
+ if: ${{ needs.tests.result != 'success' }}
50
+ run: exit 1
data/CHANGELOG.md CHANGED
@@ -72,6 +72,7 @@
72
72
  * [Catch All] Log output from all catch_all logging now includes the session_id so they can be included in log searches.
73
73
  * [NLP] Strip out values from single element arrays in the case of custom LUIS List entities.
74
74
  * [Config] Attempting to overwrite default config values with `nil` or `false` now correctly sets those config values.
75
+ * [Server] Added support for Bandwidth respones. (thanks @emorissettegregoire)
75
76
 
76
77
  ## Deprecations
77
78
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stealth (2.0.0.beta5)
4
+ stealth (2.0.0.beta6)
5
5
  activesupport (~> 6.0)
6
6
  multi_json (~> 1.12)
7
7
  puma (>= 4.2, < 6.0)
@@ -12,62 +12,63 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (6.1.5)
15
+ activesupport (6.1.7)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 1.6, < 2)
18
18
  minitest (>= 5.1)
19
19
  tzinfo (~> 2.0)
20
20
  zeitwerk (~> 2.3)
21
21
  concurrent-ruby (1.1.10)
22
- connection_pool (2.2.5)
23
- diff-lcs (1.3)
24
- i18n (1.10.0)
22
+ connection_pool (2.3.0)
23
+ diff-lcs (1.5.0)
24
+ i18n (1.12.0)
25
25
  concurrent-ruby (~> 1.0)
26
- minitest (5.15.0)
27
- mock_redis (0.23.0)
26
+ minitest (5.16.3)
27
+ mock_redis (0.32.0)
28
+ ruby2_keywords
28
29
  multi_json (1.15.0)
29
- mustermann (1.1.1)
30
+ mustermann (2.0.2)
30
31
  ruby2_keywords (~> 0.0.1)
31
32
  nio4r (2.5.8)
32
33
  oj (3.10.6)
33
- puma (5.6.2)
34
+ puma (5.6.5)
34
35
  nio4r (~> 2.0)
35
- rack (2.2.3)
36
- rack-protection (2.2.0)
36
+ rack (2.2.4)
37
+ rack-protection (2.2.2)
37
38
  rack
38
- rack-test (1.1.0)
39
- rack (>= 1.0, < 3)
40
- redis (4.6.0)
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)
39
+ rack-test (2.0.2)
40
+ rack (>= 1.3)
41
+ redis (4.8.0)
42
+ rspec (3.11.0)
43
+ rspec-core (~> 3.11.0)
44
+ rspec-expectations (~> 3.11.0)
45
+ rspec-mocks (~> 3.11.0)
46
+ rspec-core (3.11.0)
47
+ rspec-support (~> 3.11.0)
48
+ rspec-expectations (3.11.0)
48
49
  diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.9.0)
50
- rspec-mocks (3.9.1)
50
+ rspec-support (~> 3.11.0)
51
+ rspec-mocks (3.11.1)
51
52
  diff-lcs (>= 1.2.0, < 2.0)
52
- rspec-support (~> 3.9.0)
53
- rspec-support (3.9.2)
53
+ rspec-support (~> 3.11.0)
54
+ rspec-support (3.11.0)
54
55
  rspec_junit_formatter (0.4.1)
55
56
  rspec-core (>= 2, < 4, != 2.12.0)
56
57
  ruby2_keywords (0.0.5)
57
- sidekiq (6.4.1)
58
- connection_pool (>= 2.2.2)
58
+ sidekiq (6.5.6)
59
+ connection_pool (>= 2.2.5)
59
60
  rack (~> 2.0)
60
- redis (>= 4.2.0)
61
- sinatra (2.2.0)
62
- mustermann (~> 1.0)
61
+ redis (>= 4.5.0, < 5)
62
+ sinatra (2.2.2)
63
+ mustermann (~> 2.0)
63
64
  rack (~> 2.2)
64
- rack-protection (= 2.2.0)
65
+ rack-protection (= 2.2.2)
65
66
  tilt (~> 2.0)
66
67
  thor (1.2.1)
67
- tilt (2.0.10)
68
- tzinfo (2.0.4)
68
+ tilt (2.0.11)
69
+ tzinfo (2.0.5)
69
70
  concurrent-ruby (~> 1.0)
70
- zeitwerk (2.5.4)
71
+ zeitwerk (2.6.0)
71
72
 
72
73
  PLATFORMS
73
74
  ruby
@@ -75,7 +76,7 @@ PLATFORMS
75
76
  DEPENDENCIES
76
77
  mock_redis (~> 0.22)
77
78
  oj (~> 3.10)
78
- rack-test (~> 1.1)
79
+ rack-test (~> 2.0)
79
80
  rspec (~> 3.9)
80
81
  rspec_junit_formatter (~> 0.3)
81
82
  stealth!
data/MAINTENANCE.md ADDED
@@ -0,0 +1,28 @@
1
+ ## Maintenance Policy
2
+
3
+ <a href='https://hellostealth.org'><img src='logo.svg' height='120' alt='Xip Logo' aria-label='hellostealth.org' /></a>
4
+
5
+ ## Versioning
6
+
7
+ Stealth follows [semantic versioning](https://semver.org).
8
+
9
+ ```
10
+ MAJOR.MINOR.PATCH
11
+ ```
12
+
13
+ While we intend to do our best to ensure that even MAJOR version changes do not introduce breaking changes, we can't guarantee it yet at this point in the project.
14
+
15
+ Rest assured, though, that all feature deprecations will be either "gently" removed or just permanently deprecated.
16
+
17
+
18
+ ## Currently Maintained Versions
19
+
20
+ * :white_check_mark: - These versions will receive feature updates, bugfixes, and security updates.
21
+ * :heavy_check_mark: - These versions will only receive bugfixes and security updates.
22
+ * :x: - These versions are no longer maintained. Please upgrade.
23
+
24
+ | Version | Supported |
25
+ | ------- | ------------------ |
26
+ | 2.x | :white_check_mark: |
27
+ | 1.1.x | :heavy_check_mark: |
28
+ | < 1.1 | :x: |
data/SECURITY.md ADDED
@@ -0,0 +1,13 @@
1
+ ## Security Policy
2
+
3
+ <a href='https://hiremav.com/security'><img src='logo.svg' height='120' alt='Stealth Logo' aria-label='Stealth security' /></a>
4
+
5
+ ## Reporting a Vulnerability
6
+
7
+ **Do not open up a GitHub issue if the bug is a security vulnerability in Stealth**.
8
+
9
+ Instead, please refer to Mav's [security policy](https://hiremav.com/security).
10
+
11
+ ## Supported Versions
12
+
13
+ Please see our [maintenance policy](https://github.com/hellostealth/stealth/blob/master/MAINTENANCE.md) for currently supported versions.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.beta5
1
+ 2.0.0.beta6
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="180px" height="180px" viewBox="0 0 180 180" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>stealth_app_logo</title>
4
+ <defs>
5
+ <rect id="path-1" x="0" y="0" width="180" height="180"></rect>
6
+ <path d="M51.3778558,-2.07572687e-15 L128.622144,2.07572687e-15 C146.487344,-1.20605709e-15 152.965697,1.86013822 159.496947,5.35308895 C166.028197,8.84603967 171.15396,13.9718029 174.646911,20.5030529 C178.139862,27.0343029 180,33.512656 180,51.3778558 L180,128.622144 C180,146.487344 178.139862,152.965697 174.646911,159.496947 C171.15396,166.028197 166.028197,171.15396 159.496947,174.646911 C152.965697,178.139862 146.487344,180 128.622144,180 L51.3778558,180 C33.512656,180 27.0343029,178.139862 20.5030529,174.646911 C13.9718029,171.15396 8.84603967,166.028197 5.35308895,159.496947 C1.86013822,152.965697 8.04038057e-16,146.487344 -1.38381791e-15,128.622144 L1.38381791e-15,51.3778558 C-8.04038057e-16,33.512656 1.86013822,27.0343029 5.35308895,20.5030529 C8.84603967,13.9718029 13.9718029,8.84603967 20.5030529,5.35308895 C27.0343029,1.86013822 33.512656,1.20605709e-15 51.3778558,-2.07572687e-15 Z" id="path-3"></path>
7
+ </defs>
8
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
9
+ <g id="icon@180">
10
+ <g id="icon">
11
+ <mask id="mask-2" fill="white">
12
+ <use xlink:href="#path-1"></use>
13
+ </mask>
14
+ <g id="Mask"></g>
15
+ <g id="Rectangle" mask="url(#mask-2)">
16
+ <mask id="mask-4" fill="white">
17
+ <use xlink:href="#path-3"></use>
18
+ </mask>
19
+ <use id="Mask" fill="#FFFFFF" xlink:href="#path-3"></use>
20
+ </g>
21
+ </g>
22
+ <g id="logo" transform="translate(24.960938, 18.984375)" fill="#000A38">
23
+ <path d="M65.0390625,0 L44.0583093,20.9046079 L41.9615065,22.9953504 L23.077556,41.8106246 L20.9807532,43.9013672 L0,64.8073839 L23.077556,87.8027344 L44.0583093,66.8967176 L65.0390625,87.8027344 L86.0198157,66.8967176 L106.999155,87.8027344 L130.078125,64.8073839 L109.098786,43.9013672 L106.999155,41.8106246 L88.1180324,22.9953504 L86.0198157,20.9046079 L65.0390625,0 Z M55.5970873,32.403692 L46.156526,22.9953504 L65.0390625,4.18007626 L83.921599,22.9953504 L74.4810377,32.403692 L65.0390625,41.8106246 L55.5970873,32.403692 Z M67.1372792,43.9013672 L76.5778405,34.4944345 L86.0198157,25.086093 L104.902352,43.9013672 L95.460377,53.3097087 L86.0198157,62.7166414 L67.1372792,43.9013672 Z M34.617748,53.3097087 L25.1771867,43.9013672 L44.0583093,25.086093 L53.5002845,34.4944345 L62.9408458,43.9013672 L44.0583093,62.7166414 L34.617748,53.3097087 Z M88.1180324,64.8073839 L97.5585938,55.3990424 L106.999155,45.9921097 L125.883105,64.8073839 L106.999155,83.6226581 L88.1180324,64.8073839 Z M46.156526,64.8073839 L65.0390625,45.9921097 L83.921599,64.8073839 L65.0390625,83.6226581 L46.156526,64.8073839 Z M4.19501953,64.8073839 L23.077556,45.9921097 L32.5195313,55.3990424 L41.9615065,64.8073839 L23.077556,83.6226581 L4.19501953,64.8073839 Z" id="glyph"></path>
24
+ <path d="M7.93868906,127.899703 C11.7243984,127.899703 14.7190641,125.865591 14.7190641,122.305894 C14.7190641,119.621995 13.0804734,118.011656 10.1140594,117.305367 L6.72387188,116.514323 C5.81982188,116.316562 5.28304219,115.892789 5.28304219,115.129997 C5.28304219,114.169444 6.15884063,113.604412 7.4584125,113.604412 C8.95574531,113.604412 9.74678906,114.338953 10.1140594,115.299506 L14.5495547,115.299506 C14.0692781,112.304841 11.6678953,109.988213 7.43016094,109.988213 C3.58794844,109.988213 0.762792188,112.220086 0.762792188,115.610273 C0.762792188,118.548436 2.68389844,119.876259 5.22653906,120.441291 L8.56022344,121.14758 C9.66203438,121.401844 10.1988141,121.769114 10.1988141,122.588409 C10.1988141,123.661969 9.23826094,124.255252 7.85393438,124.255252 C6.44135625,124.255252 5.4243,123.661969 5.05702969,122.475403 L0.33901875,122.475403 C0.960553125,125.893842 3.78570938,127.899703 7.93868906,127.899703 Z M28.539987,127.617187 L28.539987,114.169444 L33.9077839,114.169444 L33.9077839,110.270728 L18.6519401,110.270728 L18.6519401,114.169444 L23.9914855,114.169444 L23.9914855,127.617187 L28.539987,127.617187 Z M51.1753975,127.617187 L51.1753975,123.69022 L43.2367084,123.69022 L43.2367084,120.695555 L50.49736,120.695555 L50.49736,116.881594 L43.2367084,116.881594 L43.2367084,114.169444 L51.1753975,114.169444 L51.1753975,110.270728 L38.7729615,110.270728 L38.7729615,127.617187 L51.1753975,127.617187 Z M59.8262845,127.617187 L61.0411017,124.255252 L67.3412001,124.255252 L68.5842689,127.617187 L73.1892736,127.617187 L66.5784079,110.270728 L61.9451517,110.270728 L55.3342861,127.617187 L59.8262845,127.617187 Z M65.9851251,120.526045 L62.4254283,120.526045 L64.2052767,115.638525 L65.9851251,120.526045 Z M90.0048622,127.617187 L90.0048622,123.69022 L82.2356825,123.69022 L82.2356825,110.270728 L77.6871809,110.270728 L77.6871809,127.617187 L90.0048622,127.617187 Z M101.650415,127.617187 L101.650415,114.169444 L107.018212,114.169444 L107.018212,110.270728 L91.7623679,110.270728 L91.7623679,114.169444 L97.1019132,114.169444 L97.1019132,127.617187 L101.650415,127.617187 Z M116.431891,127.617187 L116.431891,120.752058 L123.127511,120.752058 L123.127511,127.617187 L127.676013,127.617187 L127.676013,110.270728 L123.127511,110.270728 L123.127511,116.853342 L116.431891,116.853342 L116.431891,110.270728 L111.883389,110.270728 L111.883389,127.617187 L116.431891,127.617187 Z" id="STEALTH" fill-rule="nonzero"></path>
25
+ </g>
26
+ </g>
27
+ </g>
28
+ </svg>
Binary file
data/docs/README.md ADDED
@@ -0,0 +1,35 @@
1
+ ---
2
+ description: >-
3
+ Stealth includes everything you need to build amazing conversational bots with
4
+ tools you know and love. From two-way SMS-based bots to Facebook Messenger,
5
+ Stealth offers the best developer experience.
6
+ ---
7
+
8
+ # Intro
9
+
10
+ ## ![](.gitbook/assets/logo.svg)
11
+
12
+ ## What's Stealth?
13
+
14
+ Stealth is an open source, <img src=".gitbook/assets/ruby.png" alt="" data-size="line"> Ruby framework for conversational voice and text chatbots.
15
+
16
+ Stealth is inspired by the Model-View-Controller (MVC) pattern. However, instead of calling them _Views,_ Stealth refers to them as _Replies_ to better match the chatbot domain.
17
+
18
+ * The [Model](models/overview.md) layer represents your data model (such as Account, User, Quote, etc.) and encapsulates the business logic that is specific to your bot. By default, Stealth uses [ActiveRecord](models/activerecord.md), but you can use any library that you prefer.
19
+ * The [Controller](controllers/controller-overview.md) layer is responsible for handling incoming requests from messaging platforms and providing and transmitting the response (reply).
20
+ * The [Reply](replies/reply-overview.md) layer is composed of “templates” that are responsible for constructing the respective reply.
21
+
22
+ In addition to being inspired by Model-View-Controller (MVC) pattern, Stealth has a few other awesome things built in for you.
23
+
24
+ * **Plug and play components.** Every service integration in Stealth is a Ruby gem. One bot can support multiple [messaging platforms](platforms/overview.md) (i.e. Facebook Messenger, SMS, Alexa, and more) and multiple NLP/NLU services.
25
+ * **Innovative.** Stealth is constantly improving and evolving. There are many innovations in Stealth such as: [interrupt detection](controllers/interrupt-detection.md), [homophone detection](controllers/handle\_message/homophone-detection.md), [hot-code reloading](dev-environment/hot-code-reloading.md), [multi-level catch-all handling](controllers/catch-alls.md), and more that make your bots perform better.
26
+ * **Advanced tooling.** From web servers to continuous integration testing, Stealth is built to take advantage of all the great work done by the web development community.
27
+ * **Hosting you trust.** Stealth bots are Rack applications. That means your bots can be [deployed](deployment/overview.md) using familiar services like Docker and Heroku.
28
+ * **Ready for production.** Stealth already powers bots for large, well-known brands. You can rest assured your bot will be in good hands with Stealth.
29
+ * **Open source.** Stealth is MIT licensed to ensure you own your bot's source code. More importantly, we welcome contributors to help make Stealth even better for everyone.
30
+
31
+ ## Prerequisites
32
+
33
+ While it's helpful to have some familiarity with Ruby, we think you can get started with Stealth without yet knowing Ruby or even programming. Building text-based bots or Alexa Skills is a great starting point into the world of programming and we think Ruby is an excellent first programming language.
34
+
35
+ We welcome contributors and questions from programmers of all experience levels.
data/docs/SUMMARY.md ADDED
@@ -0,0 +1,99 @@
1
+ # Table of contents
2
+
3
+ * [Intro](README.md)
4
+ * [Getting Started](getting-started.md)
5
+ * [Basics](basics.md)
6
+ * [Dev Environment](dev-environment/README.md)
7
+ * [Booting Up](dev-environment/booting-up.md)
8
+ * [Hot-Code Reloading](dev-environment/hot-code-reloading.md)
9
+ * [Procfile](dev-environment/procfile.md)
10
+ * [Tunnels](dev-environment/tunnels.md)
11
+ * [Environment Variables](dev-environment/environment-variables.md)
12
+ * [Logs](dev-environment/logs.md)
13
+ * [Glossary](glossary.md)
14
+
15
+ ## Flows
16
+
17
+ * [Flows & States](flows/overview.md)
18
+ * [State Naming](flows/state-naming.md)
19
+ * [FlowMap](flows/flowmap.md)
20
+ * [State Options](flows/state-options.md)
21
+
22
+ ## Controllers
23
+
24
+ * [Controller Overview](controllers/controller-overview.md)
25
+ * [Sessions](controllers/sessions/README.md)
26
+ * [Session Overview](controllers/sessions/intro.md)
27
+ * [step\_to](controllers/sessions/step\_to.md)
28
+ * [step\_to\_in](controllers/sessions/step\_to\_in.md)
29
+ * [step\_to\_at](controllers/sessions/step\_to\_at.md)
30
+ * [update\_session\_to](controllers/sessions/update\_session\_to.md)
31
+ * [step\_back](controllers/sessions/step\_back.md)
32
+ * [do\_nothing](controllers/sessions/do\_nothing.md)
33
+ * [route](controllers/route.md)
34
+ * [Available Data](controllers/available-data.md)
35
+ * [handle\_message](controllers/handle\_message/README.md)
36
+ * [String Matcher](controllers/handle\_message/string-mather.md)
37
+ * [Alpha Ordinal Matcher](controllers/handle\_message/alpha-ordinal-matcher.md)
38
+ * [Homophone Detection](controllers/handle\_message/homophone-detection.md)
39
+ * [NLP Matcher](controllers/handle\_message/nlp-matcher.md)
40
+ * [Regex Matcher](controllers/handle\_message/regex-matcher.md)
41
+ * [Nil Matcher](controllers/handle\_message/nil-matcher.md)
42
+ * [get\_match](controllers/get\_match/README.md)
43
+ * [Exact Match](controllers/get\_match/exact-match.md)
44
+ * [Alpha Ordinals](controllers/get\_match/alpha-ordinals.md)
45
+ * [Entity Match](controllers/get\_match/entity-match.md)
46
+ * [Catch-Alls](controllers/catch-alls.md)
47
+ * [Dev Jumps](controllers/dev-jumps.md)
48
+ * [Interrupt Detection](controllers/interrupt-detection.md)
49
+ * [Unrecognized Messages](controllers/unrecognized-messages.md)
50
+ * [Platform Errors](controllers/platform-errors.md)
51
+
52
+ ## Replies
53
+
54
+ * [Reply Overview](replies/reply-overview.md)
55
+ * [YAML Replies](replies/yaml-replies.md)
56
+ * [ERB](replies/erb.md)
57
+ * [Delays](replies/delays.md)
58
+ * [Variants](replies/variants.md)
59
+ * [Inline Replies](replies/inline-replies.md)
60
+
61
+ ## Models
62
+
63
+ * [Model Overview](models/overview.md)
64
+ * [ActiveRecord](models/activerecord.md)
65
+ * [Mongoid](models/mongoid.md)
66
+
67
+ ## Platforms
68
+
69
+ * [Platform Overview](platforms/overview.md)
70
+ * [Facebook Messenger](platforms/facebook-messenger.md)
71
+ * [SMS/Whatsapp](platforms/sms-whatsapp.md)
72
+ * [Alexa Skills](platforms/alexa-skills.md)
73
+ * [Voice](platforms/voice.md)
74
+
75
+ ## NLP/NLU
76
+
77
+ * [NLP Overview](nlp-nlu/overview.md)
78
+ * [Microsoft LUIS](nlp-nlu/microsoft-luis.md)
79
+ * [OpenAI](nlp-nlu/openai.md)
80
+
81
+ ## Config
82
+
83
+ * [Settings](config/settings.md)
84
+ * [services.yml](config/services.yml.md)
85
+
86
+ ## Testing
87
+
88
+ * [Specs](testing/untitled.md)
89
+ * [Integration Testing](testing/integration-testing.md)
90
+
91
+ ## Deployment
92
+
93
+ * [Deployment Overview](deployment/overview.md)
94
+ * [Heroku](deployment/heroku.md)
95
+
96
+ ## Building Components
97
+
98
+ * [Message Services](building-components/message-services.md)
99
+ * [NLP](building-components/nlp.md)
data/docs/basics.md ADDED
@@ -0,0 +1,77 @@
1
+ ---
2
+ description: A quick primer of the various pieces that comprise Stealth.
3
+ ---
4
+
5
+ # Basics
6
+
7
+ ## Anatomy of a Stealth Bot
8
+
9
+ A Stealth bot has two primary processes: a _web server_, and a _background job processer_. If the messaging platform being used supports it, Stealth will push a message to a queue where a reply will be constructured by a background job. This allows you to easily scale your Stealth bot across many threads and processes.
10
+
11
+ ### Data Store
12
+
13
+ Stealth requires Redis. Redis is used for [session storage](controllers/sessions/intro.md) as well as the queue for background jobs. You can access the Redis store yourself via the global variable: `$redis`. You can use it as your primary data store if you are building a simple bot, but you'll likely want to use a SQL or NoSQL database for more complex bots.
14
+
15
+ ### Environments
16
+
17
+ Stealth bots can be booted into three environment types: `development`, `testing`, `production`. By default, if an environment is not specified via the `STEALTH_ENV` environment variable, the `development` environment will be used. The `testing` environment is automatically used when running your specs.
18
+
19
+ ### ActiveSupport
20
+
21
+ Stealth automatically includes [active\_support](https://guides.rubyonrails.org/active\_support\_core\_extensions.html). So if you're used to using certain core extensions in Ruby on Rails, you can continue to use them in your Stealth bots!
22
+
23
+ ## Lifecycle of a Message
24
+
25
+ This is just a brief outline of the lifecycle of a message to help you understand how Stealth processes messages. For more detailed information that you can use to build your own message platform components, check out [those docs](building-components/message-services.md).
26
+
27
+ 1. A message is received by the web server.
28
+ 2. If the message platform supports it, the message is backgrounded to be processed by a background job. If the message platform does not support it ([Alexa Skill](platforms/alexa-skills.md) or [Voice](platforms/voice.md)), the message is processed inline by the web server process.
29
+ 3. Stealth uses the respective message platform component to normalize the message into a standard format.
30
+ 4. Stealth calls the [route](controllers/route.md) method in `BotController`. If a session exists for the user, they are routed to their current state. If a session does not exist, by default the `route` method will route the user to the `HellosController#say_hello` method.
31
+ 5. The controller action will either do nothing, step to another state, update the session, or generate a reply. In the latter case, the reply will be delivered via the message platform component.
32
+
33
+ ## Directory Structure
34
+
35
+ When you use the generator `stealth new` to instantiate a new bot, here is the directory structure that will be created:
36
+
37
+ ```
38
+ ├── Gemfile
39
+ ├── Procfile.dev
40
+ ├── README.md
41
+ ├── Rakefile
42
+ ├── bot
43
+ │   ├── controllers
44
+ │   │   ├── bot_controller.rb
45
+ │   │   ├── catch_alls_controller.rb
46
+ │   │   ├── concerns
47
+ │   │   ├── goodbyes_controller.rb
48
+ │   │   ├── hellos_controller.rb
49
+ │   │   ├── interrupts_controller.rb
50
+ │   │   └── unrecognized_messages_controller.rb
51
+ │   ├── helpers
52
+ │   │   └── bot_helper.rb
53
+ │   ├── models
54
+ │   │   ├── bot_record.rb
55
+ │   │   └── concerns
56
+ │   └── replies
57
+ │   ├── catch_alls
58
+ │   │   └── level1.yml
59
+ │   ├── goodbyes
60
+ │   │   └── say_goodbye.yml
61
+ │   └── hellos
62
+ │   └── say_hello.yml
63
+ ├── config
64
+ │   ├── boot.rb
65
+ │   ├── database.yml
66
+ │   ├── environment.rb
67
+ │   ├── flow_map.rb
68
+ │   ├── initializers
69
+ │   │   ├── autoload.rb
70
+ │   │   └── inflections.rb
71
+ │   ├── puma.rb
72
+ │   ├── services.yml
73
+ │   └── sidekiq.yml
74
+ ├── config.ru
75
+ └── db
76
+ └── seeds.rb
77
+ ```
@@ -0,0 +1,7 @@
1
+ ---
2
+ description: Guide to creating your own message platform component.
3
+ ---
4
+
5
+ # Message Services
6
+
7
+ ## Coming Soon...
@@ -0,0 +1,7 @@
1
+ ---
2
+ description: Guide to creating your own NLP component.
3
+ ---
4
+
5
+ # NLP
6
+
7
+ ## Coming Soon...
@@ -0,0 +1,2 @@
1
+ # services.yml
2
+
@@ -0,0 +1,2 @@
1
+ # Settings
2
+
@@ -0,0 +1,77 @@
1
+ # Available Data
2
+
3
+ Within each controller action, you have access to a few objects containing information about the session and the received message.&#x20;
4
+
5
+ {% hint style="info" %}
6
+ Other Stealth components might make additional data available (e.g., sentiment analysis, etc).
7
+ {% endhint %}
8
+
9
+ ## `current_message`
10
+
11
+ The current message being processed is available via `current_message`. This is a `Stealth::ServiceMessage` object. It has a few important methods:
12
+
13
+ `sender_id`: The ID of the user sending the message. This will vary based on the message service component. This is also the ID that will be used as the user's session ID.
14
+
15
+ `target_id`: The ID of the target. This will vary based on the service sending the message, but for Facebook it will be the `page_id` of the Facebook page receiving the message and for SMS will be the number receiving the SMS message. For other services, this may be `nil`.&#x20;
16
+
17
+ `timestamp`: Ruby `DateTime` object containing the timestamp of when the message was transmitted. This might differ from the current time.
18
+
19
+ `service`: String indicating the message service from where the message originated (i.e., `facebook`, or `twilio`).&#x20;
20
+
21
+ `message`: String of the message contents.
22
+
23
+ `payload`: This will vary per message service component.
24
+
25
+ `nlp_result`: The raw result of the NLP performed on this message. This will vary per NLP component.
26
+
27
+ `catch_all_reason`: This is a hash that contains two keys: `:err` and `:err_msg`. The `:err` key is a string of the exception class that was raised and the `:err_msg` is the message associated with that exception. See [Catch-All Reasons](catch-alls.md#catch-all-reasons) for more info.
28
+
29
+ `location`: This will vary per message service component.&#x20;
30
+
31
+ `attachments`: This will vary per message service component.&#x20;
32
+
33
+ `referral`: This will vary per message service component.
34
+
35
+ ## `current_session`
36
+
37
+ The user's session is accessible via `current_session`. This is a `Stealth::Session` object. It has a few important methods:
38
+
39
+ `flow_string`: Returns the name of the flow.&#x20;
40
+
41
+ `state_string`: Returns the name of the state.
42
+
43
+ `to_s`: Returns the session canonical session slug string.&#x20;
44
+
45
+ `current_session + 2.states`: Returns a new session object 2 states after the current state. If we've exceeded the last state in flow (as defined in the [FlowMap](../flows/flowmap.md)), the last state is returned.
46
+
47
+ `current_session - 2.states`: Returns a new session object 2 states before the current state. If we've exceeded the first state in the flow (as defined in the [FlowMap](../flows/flowmap.md)), the first state is returned.
48
+
49
+ `==`: Compare two sessions and returns `true` if they point to the same flow and state and `false` if they do not.
50
+
51
+ {% hint style="warning" %}
52
+ Use the session arithmetic operators (`+` and `-`) sparingly. They are primarily designed for use in [Catch](catch-alls.md)[Alls](catch-alls.md) when a `fails_to` state has not been specified.
53
+ {% endhint %}
54
+
55
+ ## `current_service`
56
+
57
+ Returns a string indicating the message platform from where the message originated (i.e., `facebook`, or `twilio`).&#x20;
58
+
59
+ {% hint style="info" %}
60
+ This is an alias of `current_message.service`
61
+ {% endhint %}
62
+
63
+ ## `current_session_id`
64
+
65
+ Returns the session ID. This will vary by message service, but for Facebook Messenger this will be the user's PSID and for SMS and Whatsapp this will be the user's phone number in [E.164](https://en.m.wikipedia.org/wiki/E.164) format.
66
+
67
+ {% hint style="info" %}
68
+ This is an alias of `current_message.sender_id`
69
+ {% endhint %}
70
+
71
+ ## `has_location?`
72
+
73
+ Returns `true` or `false` depending on whether or not the `current_message` contains location data.
74
+
75
+ ## `has_attachments?`
76
+
77
+ Returns `true` or `false` depending on whether or not the `current_message` contains file or media attachments.