@knowlearning/agents 0.9.65 → 0.9.67
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.
|
@@ -177,6 +177,14 @@ export default function messageQueue({ token, protocol, host, WebSocket, watcher
|
|
|
177
177
|
if (watchers[qualifiedScope]) {
|
|
178
178
|
states[qualifiedScope] = await states[qualifiedScope]
|
|
179
179
|
|
|
180
|
+
if (states[qualifiedScope].ii + 1 !== message.ii) {
|
|
181
|
+
console.warn('OUT OF ORDER WATCHER RECEIVED', qualifiedScope, states[qualifiedScope], message)
|
|
182
|
+
return
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// TODO: this should come down with patch...
|
|
186
|
+
states[qualifiedScope].ii = message.ii
|
|
187
|
+
|
|
180
188
|
const lastResetPatchIndex = message.patch.findLastIndex(p => p.path.length === 0)
|
|
181
189
|
if (lastResetPatchIndex > -1) states[qualifiedScope] = message.patch[lastResetPatchIndex].value
|
|
182
190
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Agent from './generic/index.js'
|
|
1
|
+
import fastJSONPatch from 'npm:fast-json-patch@3.1.1'
|
|
2
|
+
import Agent from './agents/generic/index.js'
|
|
3
3
|
|
|
4
4
|
const SERVE_HOST = Deno.env.get("SERVE_HOST")
|
|
5
5
|
const SERVICE_ACCOUNT_TOKEN = Deno.env.get("SERVICE_ACCOUNT_TOKEN")
|
|
@@ -10,6 +10,6 @@ export default new Agent({
|
|
|
10
10
|
WebSocket,
|
|
11
11
|
uuid: () => crypto.randomUUID(),
|
|
12
12
|
fetch,
|
|
13
|
-
applyPatch,
|
|
13
|
+
applyPatch: fastJSONPatch.applyPatch,
|
|
14
14
|
reboot: () => Deno.exit(1)
|
|
15
15
|
})
|