Spaces:
Running
Running
Download src/apps/workbench/development.py from dellweb3/VibeCoding: direct link, hf CLI and curl.
- Browser
- Download file 4.15 kB
-
https://huggingface.co/spaces/dellweb3/VibeCoding/resolve/5fd201e23196b2a29b0a700894e1f6ea65b69fba/src/apps/workbench/development.py
- Command line
-
hf download hf://spaces/dellweb3/VibeCoding@5fd201e23196b2a29b0a700894e1f6ea65b69fba/src/apps/workbench/development.py
-
curl -L -o development.py https://huggingface.co/spaces/dellweb3/VibeCoding/resolve/5fd201e23196b2a29b0a700894e1f6ea65b69fba/src/apps/workbench/development.py
4.15 kB
| """User-visible factual execution events and frozen demonstration requirements.""" | |
| from pathlib import Path | |
| from datetime import datetime, timezone | |
| ROOT=Path(__file__).resolve().parents[3] | |
| TITLES={'start':'接收开发需求','requirements':'整理需求与验收目标','knowledge':'检索相关知识','context':'冻结权限与上下文', | |
| 'design':'模型生成技术设计','design_confirm':'设计检查','execution_confirm':'执行授权检查','code':'模型编写Java源码', | |
| 'patch':'形成候选文件','policy':'Harness源码约束检查','build':'隔离沙箱编译与独立测试','test':'核验独立系统测试回执', | |
| 'preview':'核验Java服务运行回执','acceptance':'技术交付,等待用户验收','evidence':'保存制品证据','end':'完成交付', | |
| 'review':'独立续作与修复来源','repair':'模型依据失败诊断修复','execution':'执行状态', | |
| 'routing':'按任务选择模型','model_recovery':'恢复已知输出问题'} | |
| def progress(run, state, events, now): | |
| """Project only recorded facts and elapsed time; no estimated completion percentage.""" | |
| live = state in {'queued', 'working'} | |
| records = [e for e in events if e['status'] != 'active'] | |
| starts = [e for e in records if e['status'] == 'started'] | |
| latest = records[-1] if records else None | |
| stage = starts[-1]['stage'] if starts else None | |
| stage_start = starts[-1]['timestamp'] if starts else run['created_at'] | |
| # A routing receipt is nested within the code/design step, not a completed task. | |
| title = TITLES.get(stage, stage or '等待调度') | |
| ended = events[-1]['timestamp'] if events else run['created_at'] | |
| end = now if live else ended | |
| labels = {'verified': '开发完成 · 技术通过', 'failed': '本次开发失败', | |
| 'unknown': '本次结果尚未确认', 'cancelled': '任务已取消'} | |
| headline = ('任务排队中' if state == 'queued' else '正在'+title) if live else labels.get(state, state) | |
| detail = {'build': '隔离虚拟机正在完成启动、Java编译和独立HTTP测试;收到回执后才显示通过。', | |
| 'code': '模型正在生成完整Java候选,返回后检查源码并进入沙箱验证。', | |
| 'design': '模型正在整理技术方案,返回后展示实施方案。', | |
| 'repair': '模型正在依据实际失败诊断修复,随后重新编译和测试。'}.get(stage, '执行状态和结果以服务端记录为准。') | |
| if state == 'queued': detail = '等待本机执行器和可用沙箱,不需要重复发送。' | |
| if state == 'verified': detail = '独立测试和运行验证均已通过。代码、文档、制品和网站预览已可查看;等待人工验收。' | |
| if state == 'failed': detail = '本轮未达到验收条件,错误和诊断已保存。' | |
| if state == 'unknown': detail = '尚无可信完成结果,费用预留与现场记录保留,不自动重放模型请求。' | |
| if state == 'cancelled': detail = '任务已停止,历史调用与已生成的文件仍保留。' | |
| heartbeats = [e for e in events if e['status'] == 'active'] | |
| return {'headline': headline, 'detail': detail, 'stage': stage, 'active': live, | |
| 'server_time': now, 'elapsed_seconds': max(0, end-run['created_at']), | |
| 'stage_elapsed_seconds': max(0, end-stage_start), | |
| 'last_event_at': events[-1]['timestamp'] if events else run['created_at'], | |
| 'last_heartbeat_at': heartbeats[-1]['timestamp'] if heartbeats else None, | |
| 'event_count': len(events), 'latest_record': latest['detail'] if latest else ''} | |
| def brief(scenario, fallback=''): | |
| path=ROOT/'docs/demo-briefs'/f'{scenario}.md' | |
| return path.read_text(encoding='utf-8') if path.is_file() else fallback | |
| def timeline(store,run,events=None): | |
| if events is None: events=store.stages(run['id']) | |
| return [{'id':e['id'],'at':datetime.fromtimestamp(e['timestamp'],timezone.utc).isoformat(), | |
| 'stage':e['stage'],'status':e['status'],'title':TITLES.get(e['stage'],e['stage']),'detail':e['detail']} for e in events] | |