@knowlearning/agents 0.9.119 → 0.9.121

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.
@@ -126,7 +126,7 @@ export default function messageQueue({ token, domain, Connection, watchers, stat
126
126
  if (!sessionMetrics.connected) sessionMetrics.connected = Date.now()
127
127
  log('AUTHORIZING NEWLY OPENED CONNECTION FOR SESSION:', session)
128
128
  failedConnections = 0
129
- connection.send({ token: await token(), session })
129
+ connection.send({ token: await token(), session, domain })
130
130
  }
131
131
 
132
132
  connection.onmessage = async message => {
package/deno.js CHANGED
@@ -5,16 +5,16 @@ const AGENT_TOKEN = Deno.env.get('AGENT_TOKEN')
5
5
 
6
6
  const denoProcess = self
7
7
 
8
- function Connection(domain) {
8
+ function Connection() {
9
9
  const connection = crypto.randomUUID()
10
10
 
11
- this.send = message => denoProcess.postMessage({ ...message, domain, connection })
11
+ this.send = message => denoProcess.postMessage({ ...message, connection })
12
12
 
13
13
  denoProcess.addEventListener('message', ({ data }) => {
14
14
  if (data.connection === connection) this.onmessage(data)
15
15
  })
16
16
 
17
- // TODO: consider what onclose and onerror mean
17
+ // TODO: consider what onclose and onerror mean
18
18
  setTimeout(() => this.onopen())
19
19
 
20
20
  return this
@@ -29,7 +29,7 @@ function getAgent(domain, forceNew) {
29
29
  if (agents[domain] && !forceNew) return agents[domain]
30
30
 
31
31
  const agent = new Agent({
32
- Connection: new Connection(domain), // TODO: probably don't want to need to pass domain here, as first message from generic agent should pass it
32
+ Connection,
33
33
  domain,
34
34
  token: () => AGENT_TOKEN,
35
35
  uuid: () => crypto.randomUUID(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.9.119",
3
+ "version": "0.9.121",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "node.js",
6
6
  "browser": "browser.js",