Files
zclaw_openfang/desktop/tests/e2e/zclaw-compat/fixtures/openfang-responses.ts
iven 0d4fa96b82
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
refactor: 统一项目名称从OpenFang到ZCLAW
重构所有代码和文档中的项目名称,将OpenFang统一更新为ZCLAW。包括:
- 配置文件中的项目名称
- 代码注释和文档引用
- 环境变量和路径
- 类型定义和接口名称
- 测试用例和模拟数据

同时优化部分代码结构,移除未使用的模块,并更新相关依赖项。
2026-03-27 07:36:03 +08:00

249 lines
5.8 KiB
TypeScript

/**
* ZCLAW 真实响应数据模板
*
* 用于 E2E 测试的 ZCLAW API 响应数据模板。
* 基于 ZCLAW Gateway Protocol v3 规范。
*/
export const zclawResponses = {
health: {
status: 'ok',
version: '0.4.0',
uptime: 3600,
},
status: {
status: 'running',
version: '0.4.0',
agents_count: 1,
active_sessions: 2,
},
agents: [
{
id: 'agent-default-001',
name: 'Default Agent',
state: 'Running',
model: 'qwen3.5-plus',
provider: 'bailian',
created_at: '2026-01-01T00:00:00Z',
},
],
agent: {
id: 'agent-default-001',
name: 'Default Agent',
state: 'Running',
model: 'qwen3.5-plus',
provider: 'bailian',
config: {
temperature: 0.7,
max_tokens: 4096,
},
},
models: [
{ id: 'qwen3.5-plus', name: 'Qwen 3.5 Plus', provider: 'bailian' },
{ id: 'qwen3-72b', name: 'Qwen 3 72B', provider: 'bailian' },
{ id: 'deepseek-v3', name: 'DeepSeek V3', provider: 'deepseek' },
],
hands: {
hands: [
{
id: 'hand-browser-001',
name: 'Browser',
description: '浏览器自动化能力包',
status: 'idle',
requirements_met: true,
category: 'productivity',
icon: '🌐',
tool_count: 15,
},
{
id: 'hand-collector-001',
name: 'Collector',
description: '数据收集聚合能力包',
status: 'idle',
requirements_met: true,
category: 'data',
icon: '📊',
tool_count: 8,
},
{
id: 'hand-researcher-001',
name: 'Researcher',
description: '深度研究能力包',
status: 'idle',
requirements_met: true,
category: 'research',
icon: '🔬',
tool_count: 12,
},
],
},
hand: {
id: 'hand-browser-001',
name: 'Browser',
description: '浏览器自动化能力包',
status: 'idle',
requirements_met: true,
category: 'productivity',
icon: '🌐',
provider: 'bailian',
model: 'qwen3.5-plus',
tools: ['navigate', 'click', 'type', 'screenshot', 'extract'],
metrics: ['pages_visited', 'actions_taken', 'time_saved'],
requirements: [
{ description: 'Playwright installed', met: true },
{ description: 'Browser binaries available', met: true },
],
},
handActivation: {
instance_id: 'run-browser-001',
status: 'running',
},
handRuns: {
runs: [
{
runId: 'run-browser-001',
status: 'completed',
started_at: '2026-01-01T10:00:00Z',
completed_at: '2026-01-01T10:05:00Z',
result: { pages_visited: 5, actions_taken: 23 },
},
],
},
workflows: {
workflows: [
{
id: 'wf-001',
name: 'Daily Report',
description: '每日报告生成工作流',
steps: 3,
status: 'idle',
created_at: '2026-01-01T00:00:00Z',
},
],
},
workflow: {
id: 'wf-001',
name: 'Daily Report',
description: '每日报告生成工作流',
steps: [
{ id: 'step-1', name: 'Collect Data', handName: 'Collector', params: {} },
{ id: 'step-2', name: 'Analyze', handName: 'Researcher', params: {} },
{ id: 'step-3', name: 'Generate Report', handName: 'Browser', params: {} },
],
status: 'idle',
},
sessions: {
sessions: [
{
id: 'session-001',
agent_id: 'agent-default-001',
created_at: '2026-01-01T00:00:00Z',
message_count: 10,
},
],
},
config: {
data_dir: '/Users/user/.zclaw',
default_model: 'qwen3.5-plus',
log_level: 'info',
},
quickConfig: {
default_model: 'qwen3.5-plus',
default_provider: 'bailian',
temperature: 0.7,
max_tokens: 4096,
},
channels: {
channels: [
{ id: 'ch-001', name: 'Default', provider: 'bailian', model: 'qwen3.5-plus', enabled: true },
],
},
skills: {
skills: [
{ id: 'skill-001', name: 'Code Review', description: '代码审查技能', enabled: true },
{ id: 'skill-002', name: 'Translation', description: '翻译技能', enabled: true },
],
},
triggers: {
triggers: [
{ id: 'trigger-001', name: 'Daily Trigger', type: 'schedule', enabled: true },
],
},
auditLogs: {
logs: [
{
id: 'audit-001',
timestamp: '2026-01-01T10:00:00Z',
action: 'hand.trigger',
actor: 'user',
result: 'success',
details: { hand: 'Browser', runId: 'run-001' },
},
],
},
securityStatus: {
encrypted_storage: true,
audit_logging: true,
device_pairing: 'paired',
last_security_check: '2026-01-01T00:00:00Z',
},
scheduledTasks: {
tasks: [
{ id: 'task-001', name: 'Daily Report', enabled: true, schedule: '0 9 * * *' },
],
},
};
export const streamEvents = {
textDelta: (content: string) => ({ type: 'text_delta', content }),
phaseDone: { type: 'phase', phase: 'done' },
phaseTyping: { type: 'phase', phase: 'typing' },
toolCall: (tool: string, input: unknown) => ({ type: 'tool_call', tool, input }),
toolResult: (tool: string, output: unknown) => ({ type: 'tool_result', tool, output }),
hand: (name: string, status: string, result?: unknown) => ({ type: 'hand', hand_name: name, hand_status: status, hand_result: result }),
error: (code: string, message: string) => ({ type: 'error', code, message }),
connected: { type: 'connected', session_id: 'session-001' },
agentsUpdated: { type: 'agents_updated', agents: ['agent-001'] },
};
export const gatewayFrames = {
request: (id: number, method: string, params: unknown) => ({
type: 'req',
id,
method,
params,
}),
response: (id: number, result: unknown) => ({
type: 'res',
id,
result,
}),
event: (event: unknown) => ({
type: 'event',
event,
}),
pong: (id: number) => ({
type: 'pong',
id,
}),
};