mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-04 14:57:42 +00:00
* test: cover tool approval workflows end to end * fix: preserve tool approval state across resume * fix: preserve agent context in mock stream responses * fix: preserve nested approvals in collapsed groups
29 lines
875 B
JavaScript
29 lines
875 B
JavaScript
/**
|
|
* Dynamic approval-policy fixture for the mock Playwright suite.
|
|
*
|
|
* The `review` argument selects behavior that cannot be expressed by the static
|
|
* ask list: a restricted decision set, or an authoritative argument rewrite.
|
|
*/
|
|
module.exports = () => () => async (input) => {
|
|
if (input.toolInput.review === 'restricted') {
|
|
return {
|
|
decision: 'ask',
|
|
reason: 'E2E approval offers approve or reject only.',
|
|
allowedDecisions: ['approve', 'reject'],
|
|
};
|
|
}
|
|
|
|
if (input.toolInput.review === 'rewrite') {
|
|
const originalValue =
|
|
typeof input.toolInput.value === 'string' ? input.toolInput.value : 'original-missing';
|
|
return {
|
|
decision: 'ask',
|
|
reason: 'E2E approval reviews rewritten arguments.',
|
|
updatedInput: {
|
|
value: originalValue.replace(/^original-/, 'rewritten-'),
|
|
},
|
|
};
|
|
}
|
|
|
|
return {};
|
|
};
|