nano-bots 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +5 -5
- data/README.md +88 -8
- data/controllers/security.rb +3 -4
- data/docker-compose.example.yml +3 -4
- data/static/fennel/LICENSE +0 -2
- data/static/fennel/fennel.lua +791 -703
- data/static/gem.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c992bede26be258d71c430d42cde2bf369f0ca90b3b835998829008612c7e1aa
|
4
|
+
data.tar.gz: 122564e6d76bab01b3f18e825c75209ca4a6c531957a5f7ed94e8921e40a3d3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55e3ee927659469db0c0533c55241e752ebee17869fe290f9f242de28e3503f74ba7e5c69530d886ce8614b7c68e079c1bf912264c717cb61061e3bfc445e63e
|
7
|
+
data.tar.gz: 8e990faf709f6c720f9ba8f9aab59196e729416f762968f6a02badfe7879b9f24de5ff833b102e99d6aed53a694710f6712b1995e336403c40203dbbff621e1b
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nano-bots (1.0.
|
4
|
+
nano-bots (1.0.1)
|
5
5
|
babosa (~> 2.0)
|
6
6
|
concurrent-ruby (~> 1.2, >= 1.2.2)
|
7
7
|
dotenv (~> 2.8, >= 2.8.1)
|
@@ -32,7 +32,7 @@ GEM
|
|
32
32
|
multipart-post (~> 2)
|
33
33
|
faraday-net_http (3.0.2)
|
34
34
|
ffi (1.16.3)
|
35
|
-
json (2.
|
35
|
+
json (2.7.0)
|
36
36
|
language_server-protocol (3.17.0.3)
|
37
37
|
method_source (1.0.0)
|
38
38
|
multipart-post (2.3.0)
|
@@ -65,7 +65,7 @@ GEM
|
|
65
65
|
diff-lcs (>= 1.2.0, < 2.0)
|
66
66
|
rspec-support (~> 3.12.0)
|
67
67
|
rspec-support (3.12.1)
|
68
|
-
rubocop (1.
|
68
|
+
rubocop (1.58.0)
|
69
69
|
json (~> 2.3)
|
70
70
|
language_server-protocol (>= 3.17.0)
|
71
71
|
parallel (~> 1.10)
|
@@ -73,7 +73,7 @@ GEM
|
|
73
73
|
rainbow (>= 2.2.2, < 4.0)
|
74
74
|
regexp_parser (>= 1.8, < 3.0)
|
75
75
|
rexml (>= 3.2.5, < 4.0)
|
76
|
-
rubocop-ast (>= 1.
|
76
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
77
77
|
ruby-progressbar (~> 1.7)
|
78
78
|
unicode-display_width (>= 2.4.0, < 3.0)
|
79
79
|
rubocop-ast (1.30.0)
|
@@ -103,7 +103,7 @@ DEPENDENCIES
|
|
103
103
|
nano-bots!
|
104
104
|
pry-byebug (~> 3.10, >= 3.10.1)
|
105
105
|
rspec (~> 3.12)
|
106
|
-
rubocop (~> 1.
|
106
|
+
rubocop (~> 1.58)
|
107
107
|
rubocop-rspec (~> 2.25)
|
108
108
|
|
109
109
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -13,6 +13,8 @@ https://user-images.githubusercontent.com/113217272/238141567-c58a240c-7b67-4b3b
|
|
13
13
|
- [Command Line](#command-line)
|
14
14
|
- [Library](#library)
|
15
15
|
- [Cartridges](#cartridges)
|
16
|
+
- [Tools (Functions)](#tools-functions)
|
17
|
+
- [Experimental Clojure Support](#experimental-clojure-support)
|
16
18
|
- [Marketplace](#marketplace)
|
17
19
|
- [Security and Privacy](#security-and-privacy)
|
18
20
|
- [Cryptography](#cryptography)
|
@@ -28,13 +30,13 @@ https://user-images.githubusercontent.com/113217272/238141567-c58a240c-7b67-4b3b
|
|
28
30
|
For a system usage:
|
29
31
|
|
30
32
|
```sh
|
31
|
-
gem install nano-bots -v 1.0.
|
33
|
+
gem install nano-bots -v 1.0.1
|
32
34
|
```
|
33
35
|
|
34
36
|
To use it in a project, add it to your `Gemfile`:
|
35
37
|
|
36
38
|
```ruby
|
37
|
-
gem 'nano-bots', '~> 1.0.
|
39
|
+
gem 'nano-bots', '~> 1.0.1'
|
38
40
|
```
|
39
41
|
|
40
42
|
```sh
|
@@ -80,12 +82,11 @@ cp docker-compose.example.yml docker-compose.yml
|
|
80
82
|
Set your provider credentials and choose your desired directory for the cartridges files:
|
81
83
|
|
82
84
|
```yaml
|
83
|
-
|
84
|
-
|
85
|
+
---
|
85
86
|
services:
|
86
87
|
nano-bots:
|
87
|
-
image: ruby:3.2.2-slim-
|
88
|
-
command: sh -c "gem install nano-bots -v 1.0.
|
88
|
+
image: ruby:3.2.2-slim-bookworm
|
89
|
+
command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 1.0.1 && bash"
|
89
90
|
environment:
|
90
91
|
OPENAI_API_ADDRESS: https://api.openai.com
|
91
92
|
OPENAI_API_KEY: your-access-token
|
@@ -249,7 +250,7 @@ meta:
|
|
249
250
|
symbol: 🤖
|
250
251
|
name: Nano Bot Name
|
251
252
|
author: Your Name
|
252
|
-
version: 1.0.
|
253
|
+
version: 1.0.1
|
253
254
|
license: CC0-1.0
|
254
255
|
description: A helpful assistant.
|
255
256
|
|
@@ -271,6 +272,85 @@ Check the Nano Bots specification to learn more about [how to build cartridges](
|
|
271
272
|
|
272
273
|
Try the [Nano Bots Clinic (Live Editor)](https://clinic.nbots.io) to learn about creating Cartridges.
|
273
274
|
|
275
|
+
### Tools (Functions)
|
276
|
+
|
277
|
+
Nano Bots can also be powered by _Tools_ (Functions):
|
278
|
+
|
279
|
+
```yaml
|
280
|
+
---
|
281
|
+
tools:
|
282
|
+
- name: random-number
|
283
|
+
description: Generates a random number between 1 and 100.
|
284
|
+
fennel: |
|
285
|
+
(math.random 1 100)
|
286
|
+
```
|
287
|
+
|
288
|
+
```
|
289
|
+
🤖> please generate a random number
|
290
|
+
|
291
|
+
random-number {} [yN] y
|
292
|
+
|
293
|
+
random-number {}
|
294
|
+
59
|
295
|
+
|
296
|
+
The randomly generated number is 59.
|
297
|
+
|
298
|
+
🤖> |
|
299
|
+
```
|
300
|
+
|
301
|
+
To successfully use Tools (Functions), you need to specify a provider and a model that support them. As of the writing of this README, the provider that supports them is [OpenAI](https://platform.openai.com/docs/models), with models `gpt-3.5-turbo-1106` and `gpt-4-1106-preview`:
|
302
|
+
|
303
|
+
```yaml
|
304
|
+
---
|
305
|
+
provider:
|
306
|
+
id: openai
|
307
|
+
credentials:
|
308
|
+
address: ENV/OPENAI_API_ADDRESS
|
309
|
+
access-token: ENV/OPENAI_API_KEY
|
310
|
+
settings:
|
311
|
+
user: ENV/NANO_BOTS_END_USER
|
312
|
+
model: gpt-4-1106-preview
|
313
|
+
```
|
314
|
+
|
315
|
+
Check the [Nano Bots specification](https://spec.nbots.io/#/README?id=tools-functions-2) to learn more about them.
|
316
|
+
|
317
|
+
#### Experimental Clojure Support
|
318
|
+
|
319
|
+
We are exploring the use of [Clojure](https://clojure.org) through [Babashka](https://babashka.org), powered by [GraalVM](https://www.graalvm.org).
|
320
|
+
|
321
|
+
The experimental support for Clojure would be similar to Lua and Fennel, using the `clojure:` key:
|
322
|
+
|
323
|
+
```yaml
|
324
|
+
---
|
325
|
+
clojure: |
|
326
|
+
(-> (java.time.ZonedDateTime/now)
|
327
|
+
(.format (java.time.format.DateTimeFormatter/ofPattern "yyyy-MM-dd HH:mm"))
|
328
|
+
(clojure.string/trimr))
|
329
|
+
```
|
330
|
+
|
331
|
+
Unlike Lua and Fennel, Clojure support is not _embedded_ in this implementation. It relies on having the Babashka binary (`bb`) available in your environment where the Nano Bot is running.
|
332
|
+
|
333
|
+
Here's [how to install Babashka](https://github.com/babashka/babashka#quickstart):
|
334
|
+
|
335
|
+
```sh
|
336
|
+
curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash
|
337
|
+
```
|
338
|
+
|
339
|
+
This is a quick check to ensure that it is available and working:
|
340
|
+
```sh
|
341
|
+
bb -e '{:hello "world"}'
|
342
|
+
# => {:hello "world"}
|
343
|
+
```
|
344
|
+
|
345
|
+
We don't have sandbox support for Clojure; this means that you need to disable it to be able to run Clojure code, which you do at your own risk:
|
346
|
+
|
347
|
+
```yaml
|
348
|
+
---
|
349
|
+
safety:
|
350
|
+
functions:
|
351
|
+
sandboxed: false
|
352
|
+
```
|
353
|
+
|
274
354
|
### Marketplace
|
275
355
|
|
276
356
|
You can explore the Nano Bots [Marketplace](https://nbots.io) to discover new Cartridges that can help you.
|
@@ -408,5 +488,5 @@ gem build nano-bots.gemspec
|
|
408
488
|
|
409
489
|
gem signin
|
410
490
|
|
411
|
-
gem push nano-bots-1.0.
|
491
|
+
gem push nano-bots-1.0.1.gem
|
412
492
|
```
|
data/controllers/security.rb
CHANGED
@@ -18,11 +18,10 @@ module NanoBot
|
|
18
18
|
password = 'UNSAFE' unless password && password != ''
|
19
19
|
|
20
20
|
{
|
21
|
-
encryption:
|
21
|
+
encryption:
|
22
22
|
Components::Crypto.encrypt('SAFE') != 'SAFE' &&
|
23
|
-
|
24
|
-
|
25
|
-
),
|
23
|
+
Components::Crypto.encrypt('SAFE') != Components::Crypto.encrypt('SAFE') &&
|
24
|
+
Components::Crypto.decrypt(Components::Crypto.encrypt('SAFE')) == 'SAFE',
|
26
25
|
password: password != 'UNSAFE'
|
27
26
|
}
|
28
27
|
end
|
data/docker-compose.example.yml
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
---
|
3
2
|
services:
|
4
3
|
nano-bots:
|
5
|
-
image: ruby:3.2.2-slim-
|
6
|
-
command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev && gem install nano-bots -v 1.0.
|
4
|
+
image: ruby:3.2.2-slim-bookworm
|
5
|
+
command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 1.0.1 && bash"
|
7
6
|
environment:
|
8
7
|
OPENAI_API_ADDRESS: https://api.openai.com
|
9
8
|
OPENAI_API_KEY: your-access-token
|
data/static/fennel/LICENSE
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
|
-
Copyright © 2016-2022 Calvin Rose and contributors
|
4
|
-
|
5
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
4
|
of this software and associated documentation files (the "Software"), to deal
|
7
5
|
in the Software without restriction, including without limitation the rights
|