@knowlearning/agents 0.9.122 → 0.9.125

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.
@@ -11,6 +11,10 @@ function isLocal() { return localStorage.getItem('api') === 'local' }
11
11
 
12
12
  const API_HOST = isLocal() ? DEVELOPMENT_HOST : REMOTE_HOST
13
13
 
14
+ // TODO: remove this hack when we can set sid cookie through websocket handshake
15
+ fetch(`http${ SECURE ? 's' : '' }://${API_HOST}/_sid-check`, { method: 'GET', credentials: 'include' })
16
+ .then(response => response.status === 201 && location.reload())
17
+
14
18
  export default options => {
15
19
  const { host } = window.location
16
20
 
@@ -142,6 +142,7 @@ export default function messageQueue({ token, domain, Connection, watchers, stat
142
142
 
143
143
  authed = true
144
144
  if (!user) { // this is the first authed websocket connection
145
+ console.log('INIT MESSAGE', message)
145
146
  sessionMetrics.authenticated = Date.now()
146
147
  user = message.auth.user
147
148
  session = message.session
package/deno.js CHANGED
@@ -11,8 +11,8 @@ function Connection() {
11
11
  this.send = message => denoProcess.postMessage({ ...message, connection })
12
12
 
13
13
  denoProcess.addEventListener('message', ({ data }) => {
14
- if (data && data.connection === connection) this.onmessage(data)
15
- else this.onmessage(data) // think of better way that doesn't pass all heartbeats to all agents inside domain agent
14
+ if (!data) this.onmessage(data) // think of better way that doesn't pass all heartbeats to all agents inside domain agent
15
+ else if (data.connection === connection) this.onmessage(data)
16
16
  })
17
17
 
18
18
  // TODO: consider what onclose and onerror mean
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.9.122",
3
+ "version": "0.9.125",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "node.js",
6
6
  "browser": "browser.js",