UNPKG

@adonis-agora/agent

Version:

Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.

46 lines • 2.66 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { BaseCommand, flags } from '@adonisjs/core/ace'; import { appKeyOf } from '../src/app_key_of.js'; import { CliRefusal } from '../src/cli/agent_command.js'; import { publicJwk } from '../src/crypto-kit/index.js'; import { consoleCommandKeys } from '../src/federation/console.js'; /** * `agent:console-key [--prefix <prefix>]` — print this app's console-command public key: what a * federated console names as `controlPlane.publicKey` for this app in token mode. Derived from * `APP_KEY` and `consoleCommands.prefix`, so it changes when either does. Public: safe to copy into * the console's config or an env var. The console must take it from there, never from Redis. */ export class AgentConsoleKey extends BaseCommand { static commandName = 'agent:console-key'; static description = "Print this app's console-command public key (a federated console's controlPlane.publicKey)"; static options = { startApp: false }; async run() { try { const configured = this.app.config.get('agent', undefined)?.consoleCommands; const prefix = this.prefix !== undefined && this.prefix !== '' ? this.prefix : configured?.prefix; if (prefix === undefined || prefix === '') { throw new CliRefusal('No prefix: set `consoleCommands.prefix` in config/agent.ts or pass --prefix.'); } const appKey = await appKeyOf(this.app); if (appKey === undefined) { throw new CliRefusal('No APP_KEY: the console-command key is derived from it.'); } this.logger.log(JSON.stringify(publicJwk(consoleCommandKeys(appKey, prefix).publicKey))); } catch (error) { if (!(error instanceof CliRefusal)) throw error; this.logger.error(error.message); this.exitCode = 1; } } } __decorate([ flags.string({ description: 'The consoleCommands prefix (default: the one in config/agent.ts)' }) ], AgentConsoleKey.prototype, "prefix", void 0); //# sourceMappingURL=agent_console_key.js.map