0d986f60bd
web-platform-ci / Standalone decision service (no cloud credentials) (push) Has been cancelled
web-platform-ci / TypeScript, lint, unit, build (push) Has been cancelled
web-platform-ci / Playwright E2E (push) Has been cancelled
lekiwi-compatibility / cpu-compatibility (push) Has been cancelled
集成服务器托管模型、自然语言移动与有界抓放、内置 LeKiwi URL 导入和双摄像头;同步部署契约与指定域名 iframe 白名单,保留原有物理安全、会话及调用预算防护。 更新 npm 包及锁文件版本、CHANGELOG 与发布文档。提交前 typecheck、120 项定向前端测试和 44 项后端测试通过(3 项可选跳过);真实 v2 云模型抓放仍待单独验收,不包含运行密钥或构建产物。
45 lines
2.2 KiB
TypeScript
45 lines
2.2 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
import { resolve } from 'node:path';
|
|
import { writeFile } from 'node:fs/promises';
|
|
import { subscriptionOperation } from './fixtures/subscriptionSession';
|
|
import type {} from '../physics/agent';
|
|
|
|
test.use({ trace: 'off', video: 'off' });
|
|
test('显式 opt-in:旧 v1 隔离订阅 API 兼容,非新版语言面板功能', async ({ page }, info) => {
|
|
test.skip(process.env.LEKIWI_LIVE_SUBSCRIPTION !== '1', '需人工完成隔离官方登录;不使用全局账号');
|
|
const session = await subscriptionOperation('connect');
|
|
const connection = { address: String(session.address), token: String(session.token) };
|
|
try {
|
|
expect(session.llmProtocol).toBe('codex');
|
|
expect((await subscriptionOperation('status')).loggedIn).toBe(true);
|
|
await page.goto('/physics/agent.html');
|
|
await page.waitForFunction(() => Boolean(window.lekiwiAgent));
|
|
await page.evaluate(
|
|
(url) => window.lekiwiAgent.boot(url),
|
|
`/@fs${resolve('build/lekiwi/lekiwi-v1.zip')}`,
|
|
);
|
|
const data = await page.evaluate((c) => window.lekiwiAgent.task(0, c), connection);
|
|
const encoded = JSON.stringify(data, null, 2);
|
|
if (encoded.includes(connection.token) || encoded.includes('auth.openai.com/'))
|
|
throw new Error('证据包含认证信息');
|
|
await writeFile(info.outputPath('v1-subscription-evidence.json'), encoded);
|
|
expect(data.state, data.error).toBe('succeeded');
|
|
expect(data.transported).toBeGreaterThanOrEqual(0.5);
|
|
expect(data.receipts.find((r) => r.kind === 'plan')?.provider).toBe('codex');
|
|
const loggedOut = await page.evaluate(async (c) => {
|
|
const response = await fetch(c.address + '/api/decision/v1/codex/logout', {
|
|
method: 'POST',
|
|
headers: { Authorization: 'Bearer ' + c.token, 'Content-Type': 'application/json' },
|
|
body: '{}',
|
|
});
|
|
return response.ok;
|
|
}, connection);
|
|
expect(loggedOut).toBe(true);
|
|
expect((await subscriptionOperation('status')).loggedIn).toBe(false);
|
|
} catch (error) {
|
|
await page.close().catch(() => undefined);
|
|
// eslint-disable-next-line preserve-caught-error -- Avoid exposing private bridge tokens.
|
|
throw new Error(String(error).replaceAll(connection.token, '[redacted]'));
|
|
}
|
|
});
|