171
return { action: 'accept' };
172
}
173
>
// Field names come from an untrusted schema and may be `__proto__` or another
claudeElicitation.ts
174
>
// inherited key, so read answers with `Object.hasOwn` and materialize the
175
>
// content via `Object.fromEntries` (define semantics) so such a name lands as
176
>
// an own data property instead of mutating the prototype or being dropped.
177
>
const entries: [string, ElicitationFieldValue][] = [];
178
>
for (const [name, field] of schema.fields) {
179
>
const answer = answers && Object.hasOwn(answers, name) ? answers[name] : undefined;
180
>
const value = elicitationAnswerToValue(field, answer);
181
>
if (value !== undefined) {
182
entries.push([name, value]);
183
}
185
>
return { action: 'accept', content: Object.fromEntries(entries) };
186
>
}
187
188
/** Cancel result used when there is no session to route the elicitation to. */