openvibers/openvibe.network Commits

Meme runs AI's generate operation: the judge that writes its entries (#471)

OP OpenVibers committed 13 days ago · f31390be15 · 2 files, +9 −0

OpenVibe.Meme's judge scores each candidate from its own citations and writes
the entry from that material, and the encyclopedia's writing pass does the same
for the classic internet memes. Both call OpenVibe.AI's generate operation as
the service `meme`, the way Design and Bench do.

The grant is ai.run.create for the ai.generate namespace; nothing else changes.

Changes

ddiff --git a/server/identity/principals.js b/server/identity/principals.js
iindex 04241d17..e214acf7 100644
---- a/server/identity/principals.js
++++ b/server/identity/principals.js
@@@ -606,8 +606,11 @@ const DEFAULT_GRANTS = [
['domains', 'events.subscription.manage', 'openvibe.events', []],
// OpenVibe.Meme (contracts 0.234.0): its public entries in Search through the owner API (owner meme), and its
// account-event subscriptions at boot; its export and deletion grants are with the other services' above.
++ // It also runs OpenVibe.AI's generate operation (the judge that scores a candidate from its own citations and
++ // writes the entry, and the writing pass for the encyclopedia), the same way Design and Bench do.
['meme', 'search.document.write', 'openvibe.search', []],
['meme', 'events.subscription.manage', 'openvibe.events', []],
++ ['meme', 'ai.run.create', 'openvibe.ai', ['ai.generate']],
// OpenVibe.Vision (contracts 0.235.0): model calls through AI's OpenAI-compatible endpoint (workflow ai.complete),
// its account-event subscriptions, and the export/deletion pair above. It has no public records, so no Search grant.
['vision', 'ai.run.create', 'openvibe.ai', ['ai.complete']],
ddiff --git a/test/principals.test.js b/test/principals.test.js
iindex dc82fbc1..f064217f 100644
---- a/test/principals.test.js
++++ b/test/principals.test.js
@@@ -103,6 +103,12 @@ const server = http.createServer(app);
assert.strictEqual(t.body.scope, 'events.subscription.manage', 'Meme subscribes to the account events at boot');
t = await token({ client_id: 'meme', client_secret: 'meme-secret', audience: 'openvibe.network' });
assert.deepStrictEqual(t.body.scope.split(' '), ['network.account.deletion.confirm', 'network.account.export.contribute'], 'Meme answers account export and deletion, and holds no identity.subject.resolve');
++ // Meme's judge and the encyclopedia's writing pass run OpenVibe.AI's generate operation, like Design and Bench.
++ t = await token({ client_id: 'meme', client_secret: 'meme-secret', audience: 'openvibe.ai' });
++ assert.strictEqual(t.status, 200, JSON.stringify(t.body));
++ const memeAiClaims = serviceAuth.verifyServiceToken(t.body.access_token, { publicKey: keys.publicKey, issuer: ISSUER, audience: 'openvibe.ai' });
++ assert.ok(memeAiClaims.ok, memeAiClaims.reason);
++ assert.deepStrictEqual([memeAiClaims.claims.cap, memeAiClaims.claims.ns], [['ai.run.create'], ['ai.generate']], 'Meme runs AI workflow ai.generate for its judge');
// OpenVibe.Vision and OpenVibe.Exchange (contracts 0.235.0): both answer account export and deletion and create
// their two account-event subscriptions at boot; Vision runs AI workflow ai.complete, Exchange feeds Search.