@knowlearning/agents 0.9.113 → 0.9.115

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