@knowlearning/agents 0.9.155 → 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.
@@ -166,7 +166,7 @@ export default function EmbeddedAgent() {
166
166
  const res = await download(id)
167
167
  const { name } = await metadata(id)
168
168
  const type = res.headers.get('Content-Type')
169
- const blob = new Blob([ await res.blob() ], { type })
169
+ const blob = new Blob([ await res.blob() ], { type })
170
170
  const url = window.URL.createObjectURL(blob)
171
171
  const a = document.createElement('a')
172
172
  a.style.display = 'none'
@@ -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
@@ -28,7 +28,7 @@ export default function download (id, { create, lastMessageResponse, fetch, meta
28
28
  const res = await download(id, { create, lastMessageResponse, fetch, metadata })
29
29
  const { name } = await metadata(id)
30
30
  const type = res.headers.get('Content-Type')
31
- const blob = new Blob([ await res.blob() ], { type })
31
+ const blob = new Blob([ await res.blob() ], { type })
32
32
  const url = window.URL.createObjectURL(blob)
33
33
  const a = document.createElement('a')
34
34
  a.style.display = 'none'
@@ -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.155",
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",
@@ -30,7 +30,7 @@ export default {
30
30
  required: false
31
31
  },
32
32
  namespace: {
33
- type: String,
33
+ type: [Object, String],
34
34
  required: false
35
35
  },
36
36
  environmentProxy: {