@knowlearning/agents 0.9.150 → 0.9.152

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.
package/deno.js CHANGED
@@ -6,7 +6,7 @@ const AGENT_TOKEN = Deno.env.get('AGENT_TOKEN')
6
6
  const denoProcess = self
7
7
 
8
8
  denoProcess.addEventListener('message', ({ data }) => {
9
- if (!data) denoProcess.postMessage() // ping response
9
+ if (!data) denoProcess.postMessage(undefined) // ping response
10
10
  })
11
11
 
12
12
  function Connection() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.9.150",
3
+ "version": "0.9.152",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "node.js",
6
6
  "browser": "browser.js",
@@ -13,6 +13,8 @@
13
13
  </template>
14
14
 
15
15
  <script>
16
+ import browserAgent from '../../../agents/browser/initialize.js'
17
+
16
18
  export default {
17
19
  props: {
18
20
  id: {
@@ -55,7 +57,7 @@ export default {
55
57
  startWatching() {
56
58
  if (this.stopWatching) this.stopWatching()
57
59
  if (this.path.length) {
58
- this.stopWatching = Agent.watch([this.id, ...this.path], value => {
60
+ this.stopWatching = browserAgent().watch([this.id, ...this.path], value => {
59
61
  // TODO: ensure resolved value is uuid or URL
60
62
  this.resolvedId = value
61
63
  })
@@ -66,8 +68,8 @@ export default {
66
68
  if (!iframe || this.iframe === iframe) return
67
69
 
68
70
  this.iframe = iframe
69
- this.embedding = Agent.embed({ id, mode, namespace }, iframe)
70
- this.embedding.on('environment', e => this.environmentProxy ? this.environmentProxy(e) : Agent.environment(e))
71
+ this.embedding = browserAgent().embed({ id, mode, namespace }, iframe)
72
+ this.embedding.on('environment', e => this.environmentProxy ? this.environmentProxy(e) : browserAgent().environment(e))
71
73
  this.embedding.on('state', e => this.$emit('state', e))
72
74
  this.embedding.on('mutate', e => this.$emit('mutate', e))
73
75
  this.embedding.on('close', e => this.$emit('close', e))
@@ -8,6 +8,8 @@
8
8
  </template>
9
9
 
10
10
  <script>
11
+ import browserAgent from '../../../agents/browser/initialize.js'
12
+
11
13
  export default {
12
14
  props: {
13
15
  id: String
@@ -19,7 +21,7 @@
19
21
  }
20
22
  },
21
23
  async created() {
22
- this.metadata = await Agent.metadata(this.id)
24
+ this.metadata = await browserAgent().metadata(this.id)
23
25
  this.loading = false
24
26
  },
25
27
  computed: {
@@ -6,6 +6,7 @@
6
6
 
7
7
  <script setup>
8
8
  import { ref, watch, onMounted, onBeforeUnmount, computed } from 'vue'
9
+ import browserAgent from '../../../agents/browser/initialize.js'
9
10
 
10
11
  const props = defineProps({
11
12
  id: String,
@@ -26,10 +27,10 @@
26
27
  value.value = undefined
27
28
  }
28
29
  else if (props.metadata) {
29
- const metadata = await Agent.metadata(props.id)
30
+ const metadata = await browserAgent().metadata(props.id)
30
31
  value.value = props.path.length === 1 ? metadata[props.path[0]] : metadata
31
32
  } else {
32
- stopWatching = Agent.watch([props.id, ...props.path], v => value.value = v)
33
+ stopWatching = browserAgent().watch([props.id, ...props.path], v => value.value = v)
33
34
  }
34
35
  loading.value = false
35
36
  }