@naanlang/naan 1.5.0 → 1.7.0
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/LICENSE.md +2 -2
- package/README.md +2 -2
- package/bin/index.js +7 -3
- package/dist/env_web.js +162 -48
- package/dist/naan.min.js +11 -11
- package/frameworks/browser/https_request.nlg +2 -2
- package/frameworks/browser/sworker.js +28 -26
- package/frameworks/browser/terminals.nlg +295 -737
- package/frameworks/browser/worker.nlg +295 -0
- package/frameworks/browser/workers.nlg +6 -6
- package/frameworks/browser/ws_client.nlg +15 -10
- package/frameworks/client/apiclient.nlg +211 -9
- package/frameworks/client/psm_client.nlg +10 -14
- package/frameworks/client/relaycon.nlg +87 -161
- package/frameworks/common/common.nlg +2 -0
- package/frameworks/common/events.nlg +101 -0
- package/frameworks/common/repltools.nlg +80 -1
- package/frameworks/node/apiserver.nlg +38 -246
- package/frameworks/node/filesystem.nlg +31 -6
- package/frameworks/node/http_request.nlg +34 -13
- package/frameworks/node/https_request.nlg +8 -3
- package/frameworks/node/node.nlg +3 -0
- package/frameworks/node/pty.nlg +346 -0
- package/frameworks/node/shell.nlg +26 -3
- package/frameworks/node/worker.nlg +504 -560
- package/frameworks/node/ws_client.nlg +2 -2
- package/frameworks/project/build.nlg +56 -14
- package/frameworks/project/projects.nlg +1 -1
- package/frameworks/running/debugcom.nlg +20 -3
- package/frameworks/running/debugnub.nlg +33 -11
- package/frameworks/running/executors.nlg +40 -285
- package/frameworks/running/instances.nlg +394 -0
- package/frameworks/running/remote_req.nlg +139 -0
- package/frameworks/running/remote_res.nlg +89 -0
- package/frameworks/running/sourcecode.nlg +3 -2
- package/frameworks/running/taskexec.nlg +16 -59
- package/frameworks/service/imp.nlg +751 -0
- package/frameworks/service/model.nlg +71 -0
- package/frameworks/service/nubnode.nlg +136 -0
- package/frameworks/service/nubweb.nlg +124 -0
- package/frameworks/service/service.nlg +28 -0
- package/frameworks/storage/file_manager.nlg +3 -2
- package/lib/browser/env_web.js +169 -55
- package/lib/browser/env_webworker.js +89 -31
- package/lib/core/naanlib.js +11 -11
- package/lib/env_node.js +186 -27
- package/lib/env_nodeworker.js +82 -44
- package/lib/node_server_init.nlg +149 -0
- package/lib/node_worker.js +36 -0
- package/lib/node_worker_init.nlg +43 -0
- package/package.json +1 -1
- package/plugins/openSearch/openSearch.nlg +3 -2
- package/plugins/openSearch/os_dynamo.nlg +3 -2
- package/plugins/serviceAws/aws_cloudwatchlogs.nlg +44 -2
- package/plugins/serviceAws/aws_dynamo.nlg +144 -63
- package/plugins/serviceAws/aws_utils.nlg +6 -11
- package/plugins/serviceAws/serviceAws.nlg +3 -2
- package/plugins/serviceNexara/speechrec.nlg +10 -6
- package/test/test_01_core.nlg +2 -2
- package/test/test_02_context.nlg +32 -9
- package/test/test_03_jsinterop.nlg +3 -3
- package/test/test_07_lingo.nlg +1 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* column positioning: // // !
|
|
7
7
|
*
|
|
8
|
-
* Copyright (c) 2021-
|
|
8
|
+
* Copyright (c) 2021-2026 by Richard C. Zulch
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
/*
|
|
14
14
|
* TaskDispatcher
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* a peer to ExecutorContext in executors.nlg.
|
|
16
|
+
* Create a dispatcher for remote evaluation. The return value is a closure that processes incoming
|
|
17
|
+
* messages. All arguments optional. This code is a peer to ExecutorContext in executors.nlg.
|
|
19
18
|
*
|
|
20
19
|
*/
|
|
21
20
|
|
|
22
|
-
closure TaskDispatcher(replier, coder, local contexts, gohome, util) {
|
|
21
|
+
closure TaskDispatcher(replier, coder, name, local contexts, gohome, util) {
|
|
23
22
|
global()
|
|
24
23
|
contexts = { }
|
|
25
24
|
gohome = makeActivator()
|
|
26
25
|
util = modlist().Util.exports
|
|
27
|
-
|
|
26
|
+
name = name || ""
|
|
27
|
+
|
|
28
28
|
// ContextCoder
|
|
29
29
|
//
|
|
30
30
|
// A context-specific coder allowing remote-initiated communication.
|
|
@@ -49,7 +49,7 @@ closure TaskDispatcher(replier, coder, local contexts, gohome, util) {
|
|
|
49
49
|
contextID: contextID
|
|
50
50
|
}, contexts[contextID].coder)
|
|
51
51
|
if error {
|
|
52
|
-
ErrorDebuglog("
|
|
52
|
+
ErrorDebuglog("Remoter(${name}).ContextCoder failed:", error)
|
|
53
53
|
exec = false
|
|
54
54
|
return (list(error))
|
|
55
55
|
}
|
|
@@ -74,7 +74,7 @@ closure TaskDispatcher(replier, coder, local contexts, gohome, util) {
|
|
|
74
74
|
xmsg: "error"
|
|
75
75
|
xid: data.xid
|
|
76
76
|
_guid: data._guid || undefined
|
|
77
|
-
error: "unknown operation"
|
|
77
|
+
error: "Remoter(${name}): unknown operation"
|
|
78
78
|
}
|
|
79
79
|
try {
|
|
80
80
|
restorens = makeActivator()
|
|
@@ -108,9 +108,9 @@ closure TaskDispatcher(replier, coder, local contexts, gohome, util) {
|
|
|
108
108
|
//
|
|
109
109
|
context = contexts[data.contextID]
|
|
110
110
|
if !context
|
|
111
|
-
reply.error = "unknown context"
|
|
111
|
+
reply.error = "Remoter(${name}): unknown context"
|
|
112
112
|
else if !context.namespace
|
|
113
|
-
reply.error = "namespace missing"
|
|
113
|
+
reply.error = "Remoter(${name}): namespace missing"
|
|
114
114
|
else {
|
|
115
115
|
context.activator()
|
|
116
116
|
reply.xmsg = "evaluated"
|
|
@@ -122,7 +122,7 @@ closure TaskDispatcher(replier, coder, local contexts, gohome, util) {
|
|
|
122
122
|
objectDecoder: context.coder.decodeObject
|
|
123
123
|
})
|
|
124
124
|
expr = caar(expr)
|
|
125
|
-
if expr.0 == `\.invoke\-method
|
|
125
|
+
if tuple(expr) && expr.0 == `\.invoke\-method
|
|
126
126
|
expr = context.coder.invokeMethod(expr.1, expr.2) // object method, args
|
|
127
127
|
else
|
|
128
128
|
expr = evalactive(expr) // evaluate expression
|
|
@@ -152,9 +152,9 @@ closure TaskDispatcher(replier, coder, local contexts, gohome, util) {
|
|
|
152
152
|
//
|
|
153
153
|
context = contexts[data.contextID]
|
|
154
154
|
if !context
|
|
155
|
-
reply.error = "unknown context"
|
|
155
|
+
reply.error = "Remoter(${name}): unknown context"
|
|
156
156
|
else if !context.namespace
|
|
157
|
-
reply.error = "namespace missing"
|
|
157
|
+
reply.error = "Remoter(${name}): namespace missing"
|
|
158
158
|
else {
|
|
159
159
|
context.activator()
|
|
160
160
|
reply.xmsg = "executed"
|
|
@@ -183,7 +183,7 @@ closure TaskDispatcher(replier, coder, local contexts, gohome, util) {
|
|
|
183
183
|
result = exception.toarray.map(function(x){tostring(x)}).join(" - ")
|
|
184
184
|
else
|
|
185
185
|
result = tostring(exception)
|
|
186
|
-
reply.error = "exception: "
|
|
186
|
+
reply.error = "Remoter(${name}) exception: ${result}"
|
|
187
187
|
}
|
|
188
188
|
} finally {
|
|
189
189
|
restorens()
|
|
@@ -193,46 +193,6 @@ closure TaskDispatcher(replier, coder, local contexts, gohome, util) {
|
|
|
193
193
|
};
|
|
194
194
|
|
|
195
195
|
|
|
196
|
-
/*
|
|
197
|
-
* TaskExecutor
|
|
198
|
-
*
|
|
199
|
-
* Install an executor for remote evaluation in worker threads. This uses the OnMessage protocol
|
|
200
|
-
* available in the env_xxx.js Naan controllers. The return value is false if OnMessage is not there
|
|
201
|
-
* or true on success.
|
|
202
|
-
*
|
|
203
|
-
*/
|
|
204
|
-
|
|
205
|
-
closure TaskExecutor() {
|
|
206
|
-
|
|
207
|
-
// taskInstall
|
|
208
|
-
// Install the TaskDispatcher, and reload on state load.
|
|
209
|
-
//
|
|
210
|
-
function taskInstall() {
|
|
211
|
-
if !js.t.OnMessage
|
|
212
|
-
return (false) // false if not a worker
|
|
213
|
-
js.t.OnMessage(TaskDispatcher(js.t.ReplyMessage))
|
|
214
|
-
}()
|
|
215
|
-
LoadNotify(taskInstall)
|
|
216
|
-
|
|
217
|
-
// finis
|
|
218
|
-
|
|
219
|
-
true
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
/*
|
|
224
|
-
* TaskOnMessageHook
|
|
225
|
-
*
|
|
226
|
-
* OK, this is a kludge, but you call this function to specify a handler proc when a message
|
|
227
|
-
* comes in that we don't understand.
|
|
228
|
-
*
|
|
229
|
-
*/
|
|
230
|
-
|
|
231
|
-
function TaskOnMessageHook(hook) {
|
|
232
|
-
onMessageHook = hook
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
|
|
236
196
|
/*
|
|
237
197
|
* taxInit
|
|
238
198
|
*
|
|
@@ -241,14 +201,11 @@ function TaskOnMessageHook(hook) {
|
|
|
241
201
|
*/
|
|
242
202
|
|
|
243
203
|
function taxInit(local manifest) {
|
|
244
|
-
|
|
245
|
-
manifest = `(TaskDispatcher, TaskExecutor, TaskOnMessageHook, taxInit)
|
|
204
|
+
manifest = `(TaskDispatcher, TaskOnMessageHook, taxInit)
|
|
246
205
|
|
|
247
206
|
Naan.module.build(module.id, "taskexec", function(modobj, compobj) {
|
|
248
|
-
require("./running.nlg")
|
|
207
|
+
require("./running.nlg")
|
|
249
208
|
compobj.manifest = manifest
|
|
250
209
|
modobj.exports.TaskDispatcher = TaskDispatcher
|
|
251
|
-
modobj.exports.TaskExecutor = TaskExecutor
|
|
252
|
-
modobj.exports.TaskOnMessageHook = TaskOnMessageHook
|
|
253
210
|
})
|
|
254
211
|
} ();
|