@knowlearning/agents 0.9.156 → 0.9.157

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.
@@ -81,8 +81,22 @@ function embed(environment, iframe) {
81
81
  }
82
82
  else if (type === 'environment') {
83
83
  const { user } = message
84
+ const { mode, variables } = environment
85
+
84
86
  const env = await (listeners.environment ? listeners.environment(user) : Agent.environment(user))
85
- sendDown({ ...env, context: [...(env.context || []), environment.id], mode: environment.mode })
87
+
88
+ sendDown({
89
+ ...env,
90
+ context: [
91
+ ...(env.context || []),
92
+ environment.id
93
+ ],
94
+ variables: {
95
+ ...(env.variables || {}),
96
+ ...(variables || {})
97
+ },
98
+ mode // TODO: deprecate
99
+ })
86
100
  }
87
101
  else if (type === 'interact') {
88
102
  let { scope, patch } = message
@@ -18,7 +18,6 @@ export default function Agent({ Connection, domain, token, sid, uuid, fetch, app
18
18
  const keyToSubscriptionId = {}
19
19
  const lastInteractionResponse = {}
20
20
  const tagTypeToTargetCache = {}
21
- let mode = 'normal'
22
21
 
23
22
  log('INITIALIZING AGENT CONNECTION')
24
23
  const [
@@ -59,7 +58,8 @@ export default function Agent({ Connection, domain, token, sid, uuid, fetch, app
59
58
 
60
59
  function download(id) { return downloadImplementation(id, internalReferences) }
61
60
 
62
- function debug() { mode = 'debug' }
61
+ // TODO: deprecate
62
+ function debug() {}
63
63
 
64
64
  function log() { passedLog(...arguments) }
65
65
 
@@ -36,7 +36,7 @@ export default function messageQueue({ token, sid, domain, Connection, watchers,
36
36
  authenticated: null
37
37
  }
38
38
 
39
- async function environment() { return { ...(await environmentPromise), context: [] } }
39
+ async function environment() { return { variables: {}, ...(await environmentPromise), context: [] } }
40
40
 
41
41
  function queueMessage({ scope, patch }) {
42
42
  if (lastSynchronousScopePatched === scope) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.9.156",
3
+ "version": "0.9.157",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "node.js",
6
6
  "browser": "browser.js",