@knowlearning/agents 0.9.113 → 0.9.114

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.
Files changed (2) hide show
  1. package/deno.js +7 -6
  2. package/package.json +1 -1
package/deno.js CHANGED
@@ -7,18 +7,18 @@ const denoProcess = self
7
7
 
8
8
  function Connection(domain) {
9
9
  const connection = crypto.randomUUID()
10
- const c = this
10
+ const thisConnection = this
11
11
 
12
- c.send = message => denoProcess.postMessage({ ...message, domain, connection })
12
+ thisConnection.send = message => denoProcess.postMessage({ ...message, domain, connection })
13
13
 
14
14
  denoProcess.addEventListener('message', ({ data }) => {
15
- if (data.connection === connection) c.onmessage(data)
15
+ if (data.connection === connection) thisConnection.onmessage(data)
16
16
  })
17
17
 
18
18
  // TODO: consider what onclose and onerror mean
19
- setTimeout(() => c.onopen())
19
+ setTimeout(() => thisConnection.onopen())
20
20
 
21
- return c
21
+ return thisConnection
22
22
  }
23
23
 
24
24
  const children = {}
@@ -30,7 +30,8 @@ function getAgent(domain, forceNew) {
30
30
  if (agents[domain] && !forceNew) return agents[domain]
31
31
 
32
32
  agents[domain] = new Agent({
33
- Connection: Connection(domain),
33
+ Connection: Connection(domain), // TODO: probably don't want to need to pass domain here, as first message from generic agent should pass it
34
+ domain,
34
35
  token: () => AGENT_TOKEN,
35
36
  uuid: () => crypto.randomUUID(),
36
37
  async log() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.9.113",
3
+ "version": "0.9.114",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "node.js",
6
6
  "browser": "browser.js",