simplex-chat 6.5.0-beta.4.2 → 6.5.0-beta.4.4
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.
- package/README.md +5 -3
- package/binding.gyp +19 -4
- package/cpp/simplex.cc +12 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/examples/squaring-bot-readme.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Please share your use cases and implementations.
|
|
|
14
14
|
## Quick start: a simple bot
|
|
15
15
|
|
|
16
16
|
```
|
|
17
|
-
npm i simplex-chat@6.5.0-beta.4.
|
|
17
|
+
npm i simplex-chat@6.5.0-beta.4.4
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
Simple bot that replies with squares of numbers you send to it:
|
|
@@ -28,7 +28,7 @@ Simple bot that replies with squares of numbers you send to it:
|
|
|
28
28
|
profile: {displayName: "Squaring bot example", fullName: ""},
|
|
29
29
|
dbOpts: {dbFilePrefix: "./squaring_bot", dbKey: ""},
|
|
30
30
|
options: {
|
|
31
|
-
addressSettings: {welcomeMessage: "
|
|
31
|
+
addressSettings: {welcomeMessage: "Send a number, I will square it.",
|
|
32
32
|
},
|
|
33
33
|
onMessage: async (ci, content) => {
|
|
34
34
|
const n = +content.text
|
|
@@ -44,9 +44,11 @@ Simple bot that replies with squares of numbers you send to it:
|
|
|
44
44
|
If you installed this package as dependency, you can run this example with:
|
|
45
45
|
|
|
46
46
|
```sh
|
|
47
|
-
node ./node_modules/simplex-chat/examples/squaring-bot-readme.js
|
|
47
|
+
node ./node_modules/simplex-chat/examples/squaring-bot-readme.js
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
If you run it on Mac, the first time it will take 20-30 seconds for MacOS to verify the library.
|
|
51
|
+
|
|
50
52
|
If you cloned this repository, you can:
|
|
51
53
|
|
|
52
54
|
```
|
package/binding.gyp
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"dependencies": [
|
|
10
10
|
"<!(node -p \"require('node-addon-api').gyp\")"
|
|
11
11
|
],
|
|
12
|
-
"libraries": [
|
|
13
|
-
"-L<(module_root_dir)/libs",
|
|
14
|
-
"-lsimplex"
|
|
15
|
-
],
|
|
16
12
|
"cflags!": [ "-fno-exceptions" ],
|
|
17
13
|
"cflags_cc!": [ "-fno-exceptions" ],
|
|
18
14
|
"defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS" ],
|
|
19
15
|
"conditions": [
|
|
20
16
|
["OS=='mac'", {
|
|
17
|
+
"libraries": [
|
|
18
|
+
"-L<(module_root_dir)/libs",
|
|
19
|
+
"-lsimplex"
|
|
20
|
+
],
|
|
21
21
|
"xcode_settings": {
|
|
22
22
|
"OTHER_LDFLAGS": [
|
|
23
23
|
"-Wl,-rpath,@loader_path/../../libs"
|
|
@@ -25,9 +25,24 @@
|
|
|
25
25
|
}
|
|
26
26
|
}],
|
|
27
27
|
["OS=='linux'", {
|
|
28
|
+
"libraries": [
|
|
29
|
+
"-L<(module_root_dir)/libs",
|
|
30
|
+
"-lsimplex"
|
|
31
|
+
],
|
|
28
32
|
"ldflags": [
|
|
29
33
|
"-Wl,-rpath,'$$ORIGIN'/../../libs"
|
|
30
34
|
]
|
|
35
|
+
}],
|
|
36
|
+
["OS=='win'", {
|
|
37
|
+
"libraries": [
|
|
38
|
+
"<(module_root_dir)/libs/libsimplex.lib"
|
|
39
|
+
],
|
|
40
|
+
"copies": [{
|
|
41
|
+
"destination": "<(PRODUCT_DIR)",
|
|
42
|
+
"files": [
|
|
43
|
+
"<(module_root_dir)/libs/*"
|
|
44
|
+
]
|
|
45
|
+
}]
|
|
31
46
|
}]
|
|
32
47
|
]
|
|
33
48
|
}
|
package/cpp/simplex.cc
CHANGED
|
@@ -10,6 +10,17 @@ namespace simplex {
|
|
|
10
10
|
using namespace Napi;
|
|
11
11
|
|
|
12
12
|
void haskell_init() {
|
|
13
|
+
#ifdef _WIN32
|
|
14
|
+
// non-moving GC is broken on windows with GHC 9.4-9.6.3
|
|
15
|
+
int argc = 5;
|
|
16
|
+
const char *argv[] = {
|
|
17
|
+
"simplex",
|
|
18
|
+
"+RTS", // requires `hs_init_with_rtsopts`
|
|
19
|
+
"-A64m", // chunk size for new allocations
|
|
20
|
+
"-H64m", // initial heap size
|
|
21
|
+
"--install-signal-handlers=no",
|
|
22
|
+
nullptr};
|
|
23
|
+
#else
|
|
13
24
|
int argc = 6;
|
|
14
25
|
const char *argv[] = {
|
|
15
26
|
"simplex",
|
|
@@ -19,6 +30,7 @@ void haskell_init() {
|
|
|
19
30
|
"-xn", // non-moving GC
|
|
20
31
|
"--install-signal-handlers=no",
|
|
21
32
|
nullptr};
|
|
33
|
+
#endif
|
|
22
34
|
char **pargv = const_cast<char **>(argv);
|
|
23
35
|
hs_init_with_rtsopts(&argc, &pargv);
|
|
24
36
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple declarative API to run a chat-bot with a single function call.
|
|
3
|
+
* It automates creating and updating of the bot profile, address and bot commands shown in the app UI.
|
|
4
|
+
*/
|
|
5
|
+
export * as bot from "./bot";
|
|
6
|
+
/**
|
|
7
|
+
* An API to send chat commands and receive chat events to/from chat core.
|
|
8
|
+
* You need to use it in bot event handlers, and for any other use cases.
|
|
9
|
+
*/
|
|
10
|
+
export * as api from "./api";
|
|
11
|
+
/**
|
|
12
|
+
* A low level API to the core library - the same that is used in desktop clients.
|
|
13
|
+
* You are unlikely to ever need to use this module directly.
|
|
14
|
+
*/
|
|
1
15
|
export * as core from "./core";
|
|
16
|
+
/**
|
|
17
|
+
* Useful functions for chat events and types.
|
|
18
|
+
*/
|
|
2
19
|
export * as util from "./util";
|
|
3
|
-
export * as api from "./api";
|
|
4
|
-
export * as bot from "./bot";
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.util = exports.core = exports.api = exports.bot = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A simple declarative API to run a chat-bot with a single function call.
|
|
6
|
+
* It automates creating and updating of the bot profile, address and bot commands shown in the app UI.
|
|
7
|
+
*/
|
|
8
|
+
exports.bot = require("./bot");
|
|
9
|
+
/**
|
|
10
|
+
* An API to send chat commands and receive chat events to/from chat core.
|
|
11
|
+
* You need to use it in bot event handlers, and for any other use cases.
|
|
12
|
+
*/
|
|
13
|
+
exports.api = require("./api");
|
|
14
|
+
/**
|
|
15
|
+
* A low level API to the core library - the same that is used in desktop clients.
|
|
16
|
+
* You are unlikely to ever need to use this module directly.
|
|
17
|
+
*/
|
|
4
18
|
exports.core = require("./core");
|
|
19
|
+
/**
|
|
20
|
+
* Useful functions for chat events and types.
|
|
21
|
+
*/
|
|
5
22
|
exports.util = require("./util");
|
|
6
|
-
exports.api = require("./api");
|
|
7
|
-
exports.bot = require("./bot");
|
|
8
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+BAA4B;AAE5B;;;GAGG;AACH,+BAA4B;AAE5B;;;GAGG;AACH,iCAA8B;AAE9B;;GAEG;AACH,iCAA8B"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
profile: {displayName: "Squaring bot example", fullName: ""},
|
|
5
5
|
dbOpts: {dbFilePrefix: "./squaring_bot", dbKey: ""},
|
|
6
6
|
options: {
|
|
7
|
-
addressSettings: {welcomeMessage: "
|
|
7
|
+
addressSettings: {welcomeMessage: "Send a number, I will square it."},
|
|
8
8
|
},
|
|
9
9
|
onMessage: async (ci, content) => {
|
|
10
10
|
const n = +content.text
|