@knowlearning/agents 0.9.185 → 0.9.187

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.
@@ -50,6 +50,8 @@ export default options => {
50
50
  })
51
51
 
52
52
  this.send = message => {
53
+ // TODO: more sophisticated enable/disable of debug messaging
54
+ debugLog('SEND', message)
53
55
  try {
54
56
  socket.emit('message', message)
55
57
  } catch (err) {
@@ -67,6 +69,7 @@ export default options => {
67
69
  })
68
70
 
69
71
  socket.on('message', (data) => {
72
+ debugLog('RECV', data)
70
73
  if (this.onmessage) this.onmessage(data)
71
74
  })
72
75
 
@@ -110,3 +113,7 @@ export default options => {
110
113
 
111
114
  return agent
112
115
  }
116
+
117
+ function debugLog() {
118
+ if (localStorage.getItem('__default_knowlearning_agent.debug')) console.log(...arguments)
119
+ }
@@ -1,5 +1,6 @@
1
1
  import { validate as isUUID } from 'uuid'
2
2
  import { standardJSONPatch } from '@knowlearning/patch-proxy'
3
+ import pkg from '../../package.json' assert { type: 'json' }
3
4
 
4
5
  const HEARTBEAT_TIMEOUT = 10000
5
6
  const DOMAIN_MESSAGES = { open: true, mutate: true, close: true }
@@ -36,7 +37,15 @@ export default function messageQueue({ token, sid, domain, Connection, watchers,
36
37
  authenticated: null
37
38
  }
38
39
 
39
- async function environment() { return { variables, ...(await environmentPromise), context: [] } }
40
+ async function environment() {
41
+ const { version } = pkg
42
+ return {
43
+ variables,
44
+ ...(await environmentPromise),
45
+ context: [],
46
+ version
47
+ }
48
+ }
40
49
 
41
50
  function queueMessage({ scope, patch, context }) {
42
51
  if (lastSynchronousScopePatched === scope) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.9.185",
3
+ "version": "0.9.187",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "node.js",
6
6
  "browser": "browser.js",