openvibers/openvibe.network Commits
Grant games ai.run.create on ai.generate (#586)
Changes
@@@ -764,6 +764,8 @@ const DEFAULT_GRANTS = [// (X-OV-Subject): the person's "Designs" project and its sites, and the deploy of the page.['design', 'space.site.manage', 'openvibe.space', []],['design', 'space.deploy.create', 'openvibe.space', []],++ // Games plays the AI duel itself: two pinned local offers through ai.generate (plan §6).++ ['games', 'ai.run.create', 'openvibe.ai', ['ai.generate']],// Games submits each AI duel as a Bench task, two priced seat entries, and one automatic outcome....['bench.task.create', 'bench.round.create', 'bench.entry.create', 'bench.judgement.cast'].map((cap) => ['games', cap, 'openvibe.bench', []]),@@@ -215,6 +215,11 @@ const server = http.createServer(app);t = await token({ client_id: 'games', client_secret: 'games-secret', audience: 'openvibe.bench' });assert.strictEqual(t.status, 200, JSON.stringify(t.body));assert.deepStrictEqual(t.body.scope.split(' '), ['bench.entry.create', 'bench.judgement.cast', 'bench.round.create', 'bench.task.create'], 'Games submits priced matches and automatic outcomes');++ t = await token({ client_id: 'games', client_secret: 'games-secret', audience: 'openvibe.ai' });++ assert.strictEqual(t.status, 200, JSON.stringify(t.body));++ const gamesAiClaims = serviceAuth.verifyServiceToken(t.body.access_token, { publicKey: keys.publicKey, issuer: ISSUER, audience: 'openvibe.ai' });++ assert.ok(gamesAiClaims.ok, gamesAiClaims.reason);++ assert.deepStrictEqual([gamesAiClaims.claims.cap, gamesAiClaims.claims.ns], [['ai.run.create'], ['ai.generate']], 'Games plays the duel through ai.generate');// OpenVibe.Bench (contracts 0.238.0): the account export/deletion pair, its account-event subscriptions,// ai.run.create (namespace ai.generate) to run its pinned rounds, and (B10) the model watch's one notification
@@ -764,6 +764,8 @@ const DEFAULT_GRANTS = [
@@ -764,6 +764,8 @@ const DEFAULT_GRANTS = [
// (X-OV-Subject): the person's "Designs" project and its sites, and the deploy of the page.
// (X-OV-Subject): the person's "Designs" project and its sites, and the deploy of the page.
['design', 'space.site.manage', 'openvibe.space', []],
['design', 'space.site.manage', 'openvibe.space', []],
['design', 'space.deploy.create', 'openvibe.space', []],
['design', 'space.deploy.create', 'openvibe.space', []],
+ // Games plays the AI duel itself: two pinned local offers through ai.generate (plan §6).
+ ['games', 'ai.run.create', 'openvibe.ai', ['ai.generate']],
// Games submits each AI duel as a Bench task, two priced seat entries, and one automatic outcome.
// Games submits each AI duel as a Bench task, two priced seat entries, and one automatic outcome.
...['bench.task.create', 'bench.round.create', 'bench.entry.create', 'bench.judgement.cast']
...['bench.task.create', 'bench.round.create', 'bench.entry.create', 'bench.judgement.cast']
.map((cap) => ['games', cap, 'openvibe.bench', []]),
.map((cap) => ['games', cap, 'openvibe.bench', []]),
@@ -215,6 +215,11 @@ const server = http.createServer(app);
@@ -215,6 +215,11 @@ const server = http.createServer(app);
t = await token({ client_id: 'games', client_secret: 'games-secret', audience: 'openvibe.bench' });
t = await token({ client_id: 'games', client_secret: 'games-secret', audience: 'openvibe.bench' });
assert.strictEqual(t.status, 200, JSON.stringify(t.body));
assert.strictEqual(t.status, 200, JSON.stringify(t.body));
assert.deepStrictEqual(t.body.scope.split(' '), ['bench.entry.create', 'bench.judgement.cast', 'bench.round.create', 'bench.task.create'], 'Games submits priced matches and automatic outcomes');
assert.deepStrictEqual(t.body.scope.split(' '), ['bench.entry.create', 'bench.judgement.cast', 'bench.round.create', 'bench.task.create'], 'Games submits priced matches and automatic outcomes');
+ t = await token({ client_id: 'games', client_secret: 'games-secret', audience: 'openvibe.ai' });
+ assert.strictEqual(t.status, 200, JSON.stringify(t.body));
+ const gamesAiClaims = serviceAuth.verifyServiceToken(t.body.access_token, { publicKey: keys.publicKey, issuer: ISSUER, audience: 'openvibe.ai' });
+ assert.ok(gamesAiClaims.ok, gamesAiClaims.reason);
+ assert.deepStrictEqual([gamesAiClaims.claims.cap, gamesAiClaims.claims.ns], [['ai.run.create'], ['ai.generate']], 'Games plays the duel through ai.generate');
// OpenVibe.Bench (contracts 0.238.0): the account export/deletion pair, its account-event subscriptions,
// OpenVibe.Bench (contracts 0.238.0): the account export/deletion pair, its account-event subscriptions,
// ai.run.create (namespace ai.generate) to run its pinned rounds, and (B10) the model watch's one notification
// ai.run.create (namespace ai.generate) to run its pinned rounds, and (B10) the model watch's one notification