mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 10:30:37 +09:00
[codex] Provider vault secrets UX (#6381)
## Thinking Path > - Paperclip orchestrates AI agents that need scoped, auditable access to secrets > - Hosted and external deployments need provider vault configuration without exposing secret values in Paperclip metadata > - AWS Secrets Manager vault setup previously required too much manual operator knowledge > - Provider vault discovery and removal belong together as an independent secrets-management improvement > - This pull request adds AWS provider vault discovery/prefill plus vault removal flows > - The benefit is a safer operator path for configuring external secret storage before higher-level cloud workflows depend on it ## What Changed - Added shared validators/types for AWS provider vault discovery payloads and safe provider metadata. - Implemented AWS provider vault discovery preview on the server. - Added provider vault removal service/route behavior. - Added Secrets page UI for discovery prefill, removal messaging, and related rendering coverage. - Added Storybook provider-vault fixtures and captured screenshots for the new UX states. ## Verification - `pnpm install --frozen-lockfile --ignore-scripts` - `pnpm exec vitest run packages/shared/src/validators/secret.test.ts server/src/__tests__/aws-secrets-manager-provider.test.ts server/src/__tests__/secrets-routes.test.ts server/src/__tests__/secrets-service.test.ts ui/src/pages/Secrets.render.test.tsx` - Result: 4 files passed, 1 embedded Postgres-backed file skipped on this host because local Postgres init was unavailable. - `pnpm --filter @paperclipai/ui exec vitest run src/pages/Secrets.render.test.tsx` - `pnpm --filter @paperclipai/ui typecheck` - Storybook screenshot capture against `Product/Secrets` on `http://127.0.0.1:60381/iframe.html?id=product-secrets--secrets-inventory&viewMode=story&globals=theme:dark` ## Screenshots Provider vaults tab after this change:  AWS discovery candidate flow:  Provider vault removal confirmation:  ## Risks - Secret provider metadata handling must remain non-sensitive; validators reject credential-bearing Vault URLs and sensitive AWS discovery keys. - AWS discovery depends on deployment credentials being configured correctly outside Paperclip-managed company secrets. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - OpenAI Codex, GPT-5-based coding agent with local shell/git/tool use. Exact hosted model ID and context-window size are not exposed by the local Paperclip adapter runtime. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] If this change affects the UI, I have included before/after screenshots - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
9c29394f4d
commit
d67347be77
23 changed files with 1602 additions and 13 deletions
|
|
@ -20,6 +20,7 @@ import type {
|
|||
RemoteSecretImportCandidate,
|
||||
RemoteSecretImportConflict,
|
||||
RemoteSecretImportRowResult,
|
||||
SecretProviderConfigDiscoveryPreviewResult,
|
||||
SecretBindingTargetType,
|
||||
SecretProvider,
|
||||
SecretProviderConfigHealthResponse,
|
||||
|
|
@ -34,6 +35,7 @@ import {
|
|||
isUuidLike,
|
||||
normalizeAgentUrlKey,
|
||||
secretProviderConfigPayloadSchema,
|
||||
secretProviderConfigDiscoveryPreviewSchema,
|
||||
updateSecretProviderConfigSchema,
|
||||
} from "@paperclipai/shared";
|
||||
import { conflict, HttpError, notFound, unprocessable } from "../errors.js";
|
||||
|
|
@ -471,6 +473,19 @@ export function secretService(db: Db) {
|
|||
return parsed.data.config;
|
||||
}
|
||||
|
||||
function toDraftProviderVaultRuntimeConfig(input: {
|
||||
companyId: string;
|
||||
provider: SecretProvider;
|
||||
config: Record<string, unknown>;
|
||||
}): SecretProviderVaultRuntimeConfig {
|
||||
return {
|
||||
id: `discovery-preview-${input.companyId}`,
|
||||
provider: input.provider,
|
||||
status: "ready",
|
||||
config: validateProviderConfigPayload(input.provider, input.config),
|
||||
};
|
||||
}
|
||||
|
||||
function providerConfigHealth(input: {
|
||||
id: string;
|
||||
provider: SecretProvider;
|
||||
|
|
@ -949,6 +964,54 @@ export function secretService(db: Db) {
|
|||
|
||||
checkProviders: () => checkSecretProviders(),
|
||||
|
||||
previewProviderConfigDiscovery: async (
|
||||
companyId: string,
|
||||
input: {
|
||||
provider: SecretProvider;
|
||||
config?: Record<string, unknown>;
|
||||
query?: string | null;
|
||||
nextToken?: string | null;
|
||||
pageSize?: number;
|
||||
},
|
||||
): Promise<SecretProviderConfigDiscoveryPreviewResult> => {
|
||||
const parsed = secretProviderConfigDiscoveryPreviewSchema.safeParse({
|
||||
provider: input.provider,
|
||||
config: input.config ?? {},
|
||||
query: input.query,
|
||||
nextToken: input.nextToken,
|
||||
pageSize: input.pageSize,
|
||||
});
|
||||
if (!parsed.success) {
|
||||
throw unprocessable("Invalid provider vault discovery config", parsed.error.flatten());
|
||||
}
|
||||
const providerId = parsed.data.provider as SecretProvider;
|
||||
const provider = getSecretProvider(providerId);
|
||||
if (!provider.discoverProviderConfigs) {
|
||||
throw unprocessable(`${providerId} provider does not support provider vault discovery`);
|
||||
}
|
||||
const runtimeConfig = toDraftProviderVaultRuntimeConfig({
|
||||
companyId,
|
||||
provider: providerId,
|
||||
config: parsed.data.config,
|
||||
});
|
||||
try {
|
||||
return await provider.discoverProviderConfigs({
|
||||
companyId,
|
||||
providerConfig: runtimeConfig,
|
||||
query: parsed.data.query,
|
||||
nextToken: parsed.data.nextToken,
|
||||
pageSize: parsed.data.pageSize,
|
||||
});
|
||||
} catch (error) {
|
||||
throw remoteProviderHttpError(error, {
|
||||
companyId,
|
||||
provider: providerId,
|
||||
providerConfigId: "discovery-preview",
|
||||
operation: "secret_provider_config.discovery.preview",
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
listProviderConfigs: (companyId: string) =>
|
||||
db
|
||||
.select()
|
||||
|
|
@ -1071,6 +1134,13 @@ export function secretService(db: Db) {
|
|||
.then((rows) => rows[0] ?? null);
|
||||
},
|
||||
|
||||
removeProviderConfig: async (id: string) =>
|
||||
db
|
||||
.delete(companySecretProviderConfigs)
|
||||
.where(eq(companySecretProviderConfigs.id, id))
|
||||
.returning()
|
||||
.then((rows) => rows[0] ?? null),
|
||||
|
||||
setDefaultProviderConfig: async (id: string) => {
|
||||
const existing = await getProviderConfigById(id);
|
||||
if (!existing) return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue