Files
cc-web/scripts/mock-codex.js
cc-dan 6f381998e9 feat: v1.2.8 - Codex双Agent、图片上传、主题系统、会话加载优化
- Codex双Agent接入:共享后端内核,前台隔离会话/设置/导入
- 图片上传:Claude (stream-json) 和 Codex (--image) 均支持拖拽/粘贴/选择上传
- 主题系统:CoolVibe Light 视觉方案,主题入口移至二级页
- 会话加载优化:加载遮罩、热会话缓存、切后台内容不丢失
- 移动端增强:侧栏手势、运行状态标签、按钮比例修复
- 后端重构:agent-runtime.js / codex-rollouts.js 模块拆分
- 回归脚本:npm run regression 隔离式测试
2026-03-13 12:46:34 +00:00

63 lines
1.8 KiB
JavaScript
Executable File

#!/usr/bin/env node
const crypto = require('crypto');
function readStdin() {
return new Promise((resolve) => {
let data = '';
process.stdin.setEncoding('utf8');
process.stdin.on('data', (chunk) => { data += chunk; });
process.stdin.on('end', () => resolve(data));
});
}
(async function main() {
const args = process.argv.slice(2);
const isResume = args[0] === 'exec' && args[1] === 'resume';
const threadId = isResume && args[2] ? args[2] : `mock-${crypto.randomUUID()}`;
const input = (await readStdin()).trim();
const imageCount = args.filter((arg) => arg === '--image').length;
process.stdout.write(`${JSON.stringify({ type: 'thread.started', thread_id: threadId })}\n`);
process.stdout.write(`${JSON.stringify({ type: 'turn.started' })}\n`);
if (/pwd/i.test(input)) {
process.stdout.write(`${JSON.stringify({
type: 'item.started',
item: {
id: 'item_cmd',
type: 'command_execution',
command: '/bin/bash -lc pwd',
aggregated_output: '',
exit_code: null,
status: 'in_progress',
},
})}\n`);
process.stdout.write(`${JSON.stringify({
type: 'item.completed',
item: {
id: 'item_cmd',
type: 'command_execution',
command: '/bin/bash -lc pwd',
aggregated_output: '/tmp/mock-codex\n',
exit_code: 0,
status: 'completed',
},
})}\n`);
}
process.stdout.write(`${JSON.stringify({
type: 'item.completed',
item: {
id: 'item_msg',
type: 'agent_message',
text: `Codex mock handled (${imageCount} image): ${input}`,
},
})}\n`);
process.stdout.write(`${JSON.stringify({
type: 'turn.completed',
usage: { input_tokens: 10, cached_input_tokens: 2, output_tokens: 5 },
})}\n`);
})();