/** * Gateway REST helpers for multi-agent management. */ import { type ResolveManifestResult } from '../agent-manifest/resolver.js'; import type { AgentModelsConfig, Config } from '../config/schema.js'; import type { AgentTypedModel } from '../config/schema.js'; export type GatewayAgentTypedModelsInfo = { defaultRole: string; preset: AgentTypedModel[]; entry?: AgentTypedModel[]; effective: AgentTypedModel[]; }; export type GatewayAgentRow = { id: string; name?: string; description?: string; language?: string; role?: string; responsibilities?: { primary: string[]; secondary?: string[]; }; /** Value from `IDENTITY.md` **Avatar:** line when present (may be URL, `xopc:…`, etc.). */ avatar?: string; workspace: string; /** Absolute directory for profile Markdown (`SOUL.md`, …) and gateway avatars: `agents//profile/`. */ profileDir: string; model?: { primary?: string; fallbacks?: string[]; }; typedModels: GatewayAgentTypedModelsInfo; extends: string[]; isDefault: boolean; skills: { preset: string[]; entry?: string[]; effectiveAllowlist?: string[]; }; tools: { presetDenied: string[]; entryDisable: string[]; effectiveDisable: string[]; }; }; export type GatewayAgentsListResponse = { defaultId: string; agents: GatewayAgentRow[]; builtinToolIds: string[]; }; export type GatewayAgentEffectiveManifestResponse = ResolveManifestResult; /** Extract `**Avatar:**` value from profile IDENTITY.md (same line shape as the gateway console parser). */ export declare function extractAvatarFromIdentityMarkdown(content: string): string | undefined; export declare function parseIdentityMarkdown(content: string): { name?: string; description?: string; language?: string; avatar?: string; }; export declare function listGatewayAgents(cfg: Config, _options?: { locale?: string; }): Promise; export declare function getGatewayAgentEffectiveManifest(cfg: Config, agentIdRaw: string): AgentAdminResult; export type CreateAgentBody = { /** Optional id seed; normalized agent id defaults from `profileFiles["IDENTITY.md"]` name when omitted. */ id?: string; workspace: string; models?: AgentModelsConfig; /** Reusable capability plans applied after the global baseline. */ extends?: string[]; /** Initial `agents.list[].skills` for the new entry. */ skills?: string[]; /** Initial `agents.list[].tools` for the new entry. */ tools?: NonNullable[number]['tools']; /** Profile markdown files to write after seeding (e.g. `IDENTITY.md`, `SOUL.md`). */ profileFiles?: Record; /** Clone from an existing agent id — copies config entry fields and profile directory. */ cloneFrom?: string; }; export type AgentAdminHttpStatus = 400 | 404 | 409; export type AgentAdminResult = { ok: true; data: T; } | { ok: false; error: string; status?: AgentAdminHttpStatus; }; export declare function prepareCreateAgent(cfg: Config, body: CreateAgentBody): AgentAdminResult<{ nextConfig: Config; agentId: string; workspace: string; }>; export declare function finalizeCreateAgentDirs(cfg: Config, agentId: string, opts?: { profileFiles?: Record; cloneFrom?: string; }): Promise>; export type UpdateAgentBody = { workspace?: string; extends?: string[]; models?: { defaultRole?: string | null; roles?: Record; } | null; setDefault?: boolean; /** Replace `agents.list[].skills`; `null` resets to all skills. */ skills?: string[] | null; /** Replace `agents.list[].tools`; `null` resets to no explicit policies. */ tools?: NonNullable[number]['tools'] | null; }; export declare function prepareUpdateAgent(cfg: Config, agentIdRaw: string, body: UpdateAgentBody): AgentAdminResult<{ nextConfig: Config; }>; export declare function prepareDeleteAgent(cfg: Config, agentIdRaw: string): AgentAdminResult<{ nextConfig: Config; agentId: string; }>; export declare function runAfterDeletePurge(cfg: Config, agentId: string): Promise; export type AgentFileEntry = { name: string; missing: boolean; size?: number; updatedAtMs?: number; }; export declare function listAgentProfileFiles(cfg: Config, agentId: string): Promise>; export declare function readAgentProfileFile(cfg: Config, agentId: string, name: string): Promise>; export declare function writeAgentProfileFile(cfg: Config, agentId: string, name: string, content: string): Promise>; export declare function readAgentAvatarFile(cfg: Config, agentId: string): Promise>; export declare function writeAgentAvatarFromBase64(cfg: Config, agentId: string, base64: string, mimeType: string): Promise>; /** Remove any `agent-avatar.*` in the agent profile markdown root. Idempotent: ok even when no file existed. */ export declare function deleteAgentAvatarFile(cfg: Config, agentId: string): Promise>;