@knowlearning/agents 0.3.3 → 0.3.5
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/agents/generic.js +11 -0
- package/package.json +1 -1
package/agents/generic.js
CHANGED
|
@@ -180,6 +180,12 @@ export default function Agent({ host, token, WebSocket, protocol='ws', uuid, fet
|
|
|
180
180
|
const { ii, state } = await lastMessageResponse()
|
|
181
181
|
sessionData[session].subscriptions[k] = ii
|
|
182
182
|
resolve(state)
|
|
183
|
+
if (ii === -1) {
|
|
184
|
+
// -1 indicates the result is a computed scope, so
|
|
185
|
+
// ii does not apply (we clear out the subscription to not cache value)
|
|
186
|
+
delete states[k]
|
|
187
|
+
delete sessionData[session].subscriptions[k]
|
|
188
|
+
}
|
|
183
189
|
})
|
|
184
190
|
}
|
|
185
191
|
|
|
@@ -287,6 +293,10 @@ export default function Agent({ host, token, WebSocket, protocol='ws', uuid, fet
|
|
|
287
293
|
}
|
|
288
294
|
}
|
|
289
295
|
|
|
296
|
+
async function claim(domain) {
|
|
297
|
+
return interact('claims', [{ op: 'add', path: [domain], value: null }])
|
|
298
|
+
}
|
|
299
|
+
|
|
290
300
|
async function mutate(scope, initialize=true) {
|
|
291
301
|
const initial = initialize ? copy(await state(scope) || {}) : {}
|
|
292
302
|
return new MutableProxy(initial, patch => interact(scope, patch))
|
|
@@ -320,6 +330,7 @@ export default function Agent({ host, token, WebSocket, protocol='ws', uuid, fet
|
|
|
320
330
|
download,
|
|
321
331
|
interact,
|
|
322
332
|
patch,
|
|
333
|
+
claim,
|
|
323
334
|
mutate,
|
|
324
335
|
reset,
|
|
325
336
|
metadata,
|