@knowlearning/agents 0.9.70 → 0.9.72
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/deno.js +7 -5
- package/package.json +1 -1
package/deno.js
CHANGED
|
@@ -4,18 +4,20 @@ import Agent from './agents/generic/index.js'
|
|
|
4
4
|
const SERVE_HOST = Deno.env.get("SERVE_HOST")
|
|
5
5
|
const SERVICE_ACCOUNT_TOKEN = Deno.env.get("SERVICE_ACCOUNT_TOKEN")
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const denoProcess = self
|
|
8
8
|
|
|
9
9
|
function Connection() {
|
|
10
|
-
|
|
10
|
+
const thisConnection = this
|
|
11
|
+
|
|
12
|
+
thisConnection.send = message => denoProcess.postMessage(message)
|
|
11
13
|
|
|
12
14
|
(async function () {
|
|
13
|
-
await new Promise(r => setTimeout(r))
|
|
14
|
-
|
|
15
|
+
await new Promise(r => setTimeout(r, 1))
|
|
16
|
+
thisConnection.onopen && thisConnection.onopen()
|
|
15
17
|
})()
|
|
16
18
|
|
|
17
19
|
// TODO: consider what onclose and onerror mean in this case
|
|
18
|
-
return
|
|
20
|
+
return thisConnection
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export default new Agent({
|