openvibers/openvibe.network Commits
Actor may tell a task's owner that their agent needs them (identity.subject.resolve, network.notifications.push as app actor): Desks plan D4, hand it to me (#354)
Changes
@@@ -286,6 +286,11 @@ const DEFAULT_GRANTS = [// Each run is a chat you can open (consumer plan §4): Actor posts each passed run of a person's agent into their own// Vibe chat named after it (POST /internal/chat/vibe/deliver), while the agent's send_to_vibe is on.['actor', 'chat.vibe.deliver', 'openvibe.chat', []],++ // Desks plan D4, "hand it to me": when an agent needs its person for a step on its desk (a sign-in, a code, a++ // CAPTCHA), Actor tells them wherever they are, with the link to take the desk over. Actor resolves the task's++ // owner (a usr_ subject) to Network's user id, then pushes as app 'actor'.++ ['actor', 'identity.subject.resolve', SELF_AUDIENCE, []],++ ['actor', 'network.notifications.push', SELF_AUDIENCE, ['actor']],// Plan T18: OpenVibe.Watch relays watch.observation.recorded / watch.watch.triggered / watch.check.failed.['watch', 'events.event.publish', 'openvibe.events', []],// Plan T18 step 4: a watch's notification action tells its owner when the condition fires. Watch resolves the ownernnew file mode 100644@@@ -0,0 +1,21 @@++/**++ * OpenVibe.Actor's notification grants (Desks plan D4, "hand it to me"): when an agent needs its person for a step on++ * its desk, Actor resolves the task's owner and pushes them a notification as app 'actor', and holds nothing else of++ * Network's notifications. Each is a capability the pinned contracts offer, active.++ *++ * node test/actor-notify-grants.test.js++ */++'use strict';++const assert = require('assert');++const contracts = require('openvibe-contracts');++const principals = require('../server/identity/principals');++++const rows = principals.DEFAULT_GRANTS.filter((g) => g[0] === 'actor' && g[2] === principals.SELF_AUDIENCE);++const held = new Map(rows.map((g) => [g[1], g[3]]));++assert.ok(held.has('identity.subject.resolve'), 'actor resolves the task owner');++assert.deepStrictEqual(held.get('network.notifications.push'), ['actor'], 'actor pushes as its own app only');++for (const g of rows) {++ const cap = contracts.capabilities.get(g[1]);++ assert.ok(cap && cap.status === 'active', `${g[1]} is an active capability`);++}++console.log(`actor notify grants: ${rows.length}`);
@@ -286,6 +286,11 @@ const DEFAULT_GRANTS = [
@@ -286,6 +286,11 @@ const DEFAULT_GRANTS = [
// Each run is a chat you can open (consumer plan §4): Actor posts each passed run of a person's agent into their own
// Each run is a chat you can open (consumer plan §4): Actor posts each passed run of a person's agent into their own
// Vibe chat named after it (POST /internal/chat/vibe/deliver), while the agent's send_to_vibe is on.
// Vibe chat named after it (POST /internal/chat/vibe/deliver), while the agent's send_to_vibe is on.
['actor', 'chat.vibe.deliver', 'openvibe.chat', []],
['actor', 'chat.vibe.deliver', 'openvibe.chat', []],
+ // Desks plan D4, "hand it to me": when an agent needs its person for a step on its desk (a sign-in, a code, a
+ // CAPTCHA), Actor tells them wherever they are, with the link to take the desk over. Actor resolves the task's
+ // owner (a usr_ subject) to Network's user id, then pushes as app 'actor'.
+ ['actor', 'identity.subject.resolve', SELF_AUDIENCE, []],
+ ['actor', 'network.notifications.push', SELF_AUDIENCE, ['actor']],
// Plan T18: OpenVibe.Watch relays watch.observation.recorded / watch.watch.triggered / watch.check.failed.
// Plan T18: OpenVibe.Watch relays watch.observation.recorded / watch.watch.triggered / watch.check.failed.
['watch', 'events.event.publish', 'openvibe.events', []],
['watch', 'events.event.publish', 'openvibe.events', []],
// Plan T18 step 4: a watch's notification action tells its owner when the condition fires. Watch resolves the owner
// Plan T18 step 4: a watch's notification action tells its owner when the condition fires. Watch resolves the owner
new file mode 100644
new file mode 100644
@@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
+/**
+ * OpenVibe.Actor's notification grants (Desks plan D4, "hand it to me"): when an agent needs its person for a step on
+ * its desk, Actor resolves the task's owner and pushes them a notification as app 'actor', and holds nothing else of
+ * Network's notifications. Each is a capability the pinned contracts offer, active.
+ *
+ * node test/actor-notify-grants.test.js
+ */
+'use strict';
+const assert = require('assert');
+const contracts = require('openvibe-contracts');
+const principals = require('../server/identity/principals');
+
+const rows = principals.DEFAULT_GRANTS.filter((g) => g[0] === 'actor' && g[2] === principals.SELF_AUDIENCE);
+const held = new Map(rows.map((g) => [g[1], g[3]]));
+assert.ok(held.has('identity.subject.resolve'), 'actor resolves the task owner');
+assert.deepStrictEqual(held.get('network.notifications.push'), ['actor'], 'actor pushes as its own app only');
+for (const g of rows) {
+ const cap = contracts.capabilities.get(g[1]);
+ assert.ok(cap && cap.status === 'active', `${g[1]} is an active capability`);
+}
+console.log(`actor notify grants: ${rows.length}`);