feat(profile): Add update-profile adapter with AI/external integration and unit tests for profile updates

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-06-04 00:55:25 -07:00
parent 031ba66338
commit 09d6b4c7b0
2 changed files with 6 additions and 2 deletions

View file

@ -63,6 +63,7 @@ function makeCtx(
return {
userId: 'user_1',
session,
autoExecuted: false, // update-profile is propose-only; never auto-executed.
platformApi: {
get: vi.fn(),
post: vi.fn(),

View file

@ -21,6 +21,7 @@ import {
type ActionDescriptor,
type AdapterContext,
type BlocklistEntry,
type PrecheckContext,
type SurfaceAdapterAction,
gateK3cGovtName,
precheckResult,
@ -91,7 +92,7 @@ function forbiddenNames(entries: readonly BlocklistEntry[]): string[] {
const action: SurfaceAdapterAction<Input, Output> = {
action: 'update-profile',
schema,
async precheck(input: Input, ctx: AdapterContext) {
async precheck(input: Input, ctx: PrecheckContext) {
const phrases = await ctx.blocklist.list('phrase');
const forbidden = forbiddenNames(phrases);
const combined = draftStrings(input).join('\n');
@ -116,7 +117,7 @@ const action: SurfaceAdapterAction<Input, Output> = {
targetKind: 'surface_profile',
stakes: 'medium',
confidence: 1,
autoExecuted: false,
autoExecuted: ctx.autoExecuted,
outcome: { external_id: externalId },
});
@ -130,4 +131,6 @@ export const descriptor: ActionDescriptor = {
verb: 'update-profile',
action: action as SurfaceAdapterAction<unknown, unknown>,
autoExecutable: false,
auditTargetKind: 'surface_profile',
auditStakes: 'medium',
};