Implementation:23blocks OS Ai maestro Agent Secret Requests Service
| Knowledge Sources | |
|---|---|
| Domains | Security, Services |
| Last Updated | 2026-10-26 18:00 GMT |
Overview
Concrete tool for the request-level secret request flow (F033) — an agent asks for a credential, the person answers in AI Maestro, the value goes to the vault and is never leaked, provided by AI Maestro's `services/agent-secret-requests-service.ts`.
Description
The agent-secret-requests-service (F033) handles secret requests at the request level. An agent runs `aim-secret request NAME` → a pending request card appears in AI Maestro. The person answers with a value or declines. The value is the one thing this file must never leak: it arrives in a request body, goes to the vault (`lib/secret-vault.mjs`, which hands it to the OS keychain on stdin), and is dropped. It is never logged, never put in an error message or response, never stored in a request record, and never sent to the agent — the agent is only told the NAME was stored. A remote agent's request is forwarded to its host (which owns the vault). Value max size is 64KB; proxy timeout 15s.
Usage
Call `createSecretRequest` from a POST route (agent asks), `listSecretRequests` from a GET route (chat polls), `answerSecretRequest` from a POST route (person answers).
Code Reference
Source Location
- Repository: ai-maestro
- File: services/agent-secret-requests-service.ts
- Lines: L1-L163
Signature
export async function createSecretRequest(agentId: string, body: { name?: string; note?: string }): Promise<ServiceResult<...>>
export async function listSecretRequests(agentId: string): Promise<ServiceResult<...>>
export async function answerSecretRequest(agentId: string, requestId: string, body: { value?: string; name?: string; decline?: boolean }): Promise<ServiceResult<...>>
Import
import { createSecretRequest, listSecretRequests, answerSecretRequest } from '@/services/agent-secret-requests-service'
I/O Contract
| Name | Type | Description |
|---|---|---|
| agentId | string | Agent requesting the secret |
| body.value | string | The secret value (never logged, never returned) |
| result | ServiceResult | Success or error (never includes the value) |
Usage Examples
import { answerSecretRequest } from '@/services/agent-secret-requests-service'
// Person types the value into the card
const result = await answerSecretRequest(agentId, requestId, { value: 'sk-...' })
// Value went to vault; agent is told 'OPENAI_API_KEY was stored'