Add agent-facing wizard preview
Deploy / deploy (push) Successful in 1m30s
CI / Rust Checks (push) Successful in 5m33s
CI / UI Checks (push) Successful in 5s
CI / Deployment Manifests (push) Successful in 3s
CI / Frontend E2E (push) Successful in 4m19s

This commit is contained in:
github-ops
2026-06-20 20:06:30 +00:00
parent d79ec95028
commit 751a832fcb
5 changed files with 377 additions and 0 deletions
+165
View File
@@ -339,6 +339,171 @@ test('wizard edit mode hydrates fields from operation version snapshot', async (
await expect(page.locator('#wizard-test-input')).not.toHaveValue(/Ada/);
});
test('wizard shows agent-facing MCP preview from current draft fields', async ({ page }) => {
await login(page);
const workspace = await getCurrentWorkspace(page);
const operationId = 'frankfurter_monthly_rates';
const version = 7;
await page.route(
`/api/admin/workspaces/${encodeURIComponent(workspace.id)}/operations/${operationId}`,
async (route) => {
await route.fulfill({
contentType: 'application/json',
body: JSON.stringify({
id: operationId,
workspace_id: workspace.id,
name: operationId,
display_name: 'Frankfurter monthly rates',
category: 'finance',
protocol: 'rest',
security_level: 'standard',
status: 'draft',
current_draft_version: version,
latest_published_version: null,
created_at: '2026-06-19T00:00:00Z',
updated_at: '2026-06-19T00:00:00Z',
published_at: null,
draft_version_ref: { version, status: 'draft' },
published_version_ref: null,
agent_refs: [],
}),
});
},
);
await page.route(
`/api/admin/workspaces/${encodeURIComponent(workspace.id)}/operations/${operationId}/versions/${version}`,
async (route) => {
await route.fulfill({
contentType: 'application/json',
body: JSON.stringify({
operation_id: operationId,
workspace_id: workspace.id,
version,
status: 'draft',
change_note: null,
created_at: '2026-06-19T00:00:00Z',
created_by: null,
snapshot: {
id: operationId,
name: operationId,
display_name: 'Frankfurter monthly rates',
category: 'finance',
protocol: 'rest',
security_level: 'standard',
status: 'draft',
version,
target: {
kind: 'rest',
base_url: 'https://api.frankfurter.app',
method: 'GET',
path_template: '/2024-01..2024-03',
static_headers: { Accept: 'application/json' },
},
input_schema: {
type: 'object',
description: null,
required: false,
nullable: false,
default_value: null,
fields: {
from: {
type: 'string',
description: 'Base currency',
required: true,
nullable: false,
default_value: 'USD',
fields: {},
items: null,
enum_values: [],
variants: [],
},
to: {
type: 'string',
description: 'Quote currency',
required: false,
nullable: false,
default_value: 'EUR',
fields: {},
items: null,
enum_values: [],
variants: [],
},
},
items: null,
enum_values: [],
variants: [],
},
output_schema: {
type: 'object',
description: null,
required: false,
nullable: false,
default_value: null,
fields: {
rates: {
type: 'object',
description: 'Rates by date',
required: true,
nullable: false,
default_value: null,
fields: {},
items: null,
enum_values: [],
variants: [],
},
},
items: null,
enum_values: [],
variants: [],
},
input_mapping: { rules: [] },
output_mapping: {
rules: [{ source: '$.response.body.rates', target: '$.output.rates' }],
},
execution_config: {
timeout_ms: 9000,
retry_policy: null,
auth_profile_ref: null,
headers: {},
protocol_options: null,
streaming: null,
},
tool_description: {
title: 'Получить историю курсов за месяц',
description: 'Возвращает историю курсов валют Frankfurter за заданный период.',
tags: [],
examples: [],
},
wizard_state: {
input_sample: { from: 'USD', to: 'EUR' },
output_sample: { rates: { '2024-01': { EUR: 0.91 } } },
test_input: { from: 'GBP', to: 'USD' },
},
samples: [],
generated_draft: null,
config_export: null,
},
}),
});
},
);
await page.goto(`/wizard/?mode=edit&operationId=${operationId}`);
await page.locator('#btn-continue').click();
await page.locator('#btn-continue').click();
await page.locator('#btn-continue').click();
await page.locator('#btn-continue').click();
await expect(page.locator('#agent-preview-tool-name')).toHaveText(operationId);
await expect(page.locator('#agent-preview-tool-description')).toContainText('Frankfurter');
await expect(page.locator('#agent-preview-input-schema')).toHaveValue(/"from"/);
await expect(page.locator('#agent-preview-tool-call')).toHaveValue(/"name": "frankfurter_monthly_rates"/);
await expect(page.locator('#agent-preview-tool-call')).toHaveValue(/"from": "USD"/);
await expect(page.locator('#agent-preview-success-response')).toHaveValue(/0\.91/);
});
test('wizard edit mode preserves explicit request mapping targets on save', async ({ page }) => {
await login(page);
const workspace = await getCurrentWorkspace(page);