diff --git a/server/src/__tests__/secret-binding-discovery.test.ts b/server/src/__tests__/secret-binding-discovery.test.ts new file mode 100644 index 00000000000..fa33024268f --- /dev/null +++ b/server/src/__tests__/secret-binding-discovery.test.ts @@ -0,0 +1,17 @@ +import { expect, it } from "vitest"; +import { searchRunnerApi } from "../services/native-runtime/runner-api-catalog.js"; + +it("finds the secret binding proposal when an agent searches for how to give an agent a company secret", () => { + for (const query of [ + "agent configuration update env secret", + "agent environment variables set secret ref", + "agent configuration environment variables bind secret reference", + "give agent access to company secret", + ]) { + const { results } = searchRunnerApi({ query, limit: 3 }); + expect(results.map(operation => operation.operationId), query).toContain("POST /api/agents/me/secret-proposals"); + } + const operation = searchRunnerApi({ query: "POST /api/agents/me/secret-proposals" }).results[0]!; + expect(operation.description).toContain("configPath"); + expect(operation.description).toContain("targetAgentId"); +}); diff --git a/server/src/routes/openapi.ts b/server/src/routes/openapi.ts index 843d85134c5..5a5a89497e6 100644 --- a/server/src/routes/openapi.ts +++ b/server/src/routes/openapi.ts @@ -3697,7 +3697,9 @@ registry.registerPath({ method: "post", path: "/api/agents/me/secret-proposals", tags: ["secrets"], - summary: "Propose a company secret or agent secret binding", + summary: "Bind an existing company secret to an agent's environment variable, or propose a new company secret, for board approval", + description: + "This is how an agent gives itself or an agent in its reporting line (targetAgentId) access to a company secret: send kind \"binding\" with the secret's id from the secrets catalog and the agent configuration path (configPath, e.g. env.DEPLOY_API_KEY). Agents cannot PATCH agent configuration with secret refs; a board member approves the proposal, which applies the binding. Send kind \"secret\" to propose storing a new value.", request: { body: jsonBody(createAgentSecretProposalSchema) }, responses: { 201: r.ok(),