@knowlearning/agents 0.9.34 → 0.9.36

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.
@@ -59,8 +59,8 @@ function embed(environment, iframe) {
59
59
  }
60
60
  else if (type === 'environment') {
61
61
  const { context } = message
62
- const env = await Agent.environment()
63
- sendDown({ ...env, context: [...env.context, environment.id], mode: environment.mode })
62
+ const env = await (listeners.environment ? listeners.environment() : Agent.environment())
63
+ sendDown({ ...env, context: [...(env.context || []), environment.id], mode: environment.mode })
64
64
  }
65
65
  else if (type === 'interact') {
66
66
  const { scope, patch } = message
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.9.34",
3
+ "version": "0.9.36",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "node.js",
6
6
  "browser": "browser.js",
@@ -61,6 +61,7 @@ export default {
61
61
  this.embedding = Agent.embed({ id, mode }, iframe)
62
62
  this.embedding.on('state', e => this.$emit('state', e))
63
63
  this.embedding.on('mutate', e => this.$emit('mutate', e))
64
+ this.embedding.on('environment', e => this.$emit('environment', e))
64
65
  this.embedding.on('close', e => this.$emit('close', e))
65
66
  }
66
67
  }
@@ -1,8 +1,6 @@
1
1
  import { watchEffect, defineAsyncComponent } from 'vue'
2
2
  import { browserAgent } from '../../../browser.js'
3
3
 
4
- const Agent = browserAgent()
5
-
6
4
  // TODO: probably want to make this a util, and better fleshed out (with white instead of blacklist)
7
5
  function isScopeSerializable(v) {
8
6
  return !(
@@ -11,6 +9,7 @@ function isScopeSerializable(v) {
11
9
  }
12
10
 
13
11
  export default function (module, scope) {
12
+ const Agent = browserAgent()
14
13
  return defineAsyncComponent(async function () {
15
14
  const component = module.default ? { ...module.default } : { ...module } // copy component since we will mess with mounted and data functions
16
15