Spaces:
Sleeping
Sleeping
Download src/modules/orchestrator/feedback.py from dellweb3/VibeCoding: direct link, hf CLI and curl.
- Browser
- Download file 1.91 kB
-
https://huggingface.co/spaces/dellweb3/VibeCoding/resolve/main/src/modules/orchestrator/feedback.py
- Command line
-
hf download hf://spaces/dellweb3/VibeCoding/src/modules/orchestrator/feedback.py
-
curl -L -o feedback.py https://huggingface.co/spaces/dellweb3/VibeCoding/resolve/main/src/modules/orchestrator/feedback.py
1.91 kB
| """Fixed factual messages: no generated thinking or extra model request.""" | |
| CHECKPOINT_SECONDS = 100 | |
| MESSAGES = { | |
| 'queued': '任务已排队,等待执行', | |
| 'design': '正在整理技术方案', | |
| 'code': '正在生成代码', | |
| 'code_review': '正在审查代码', | |
| 'build': '隔离编译与测试中', | |
| 'test': '正在核验测试结果', | |
| 'preview': '正在核验服务运行', | |
| 'repair': '正在按诊断修复代码', | |
| 'diagnosis': '正在定位失败原因', | |
| 'evidence': '正在保存交付结果', | |
| } | |
| def short_message(stage): | |
| return MESSAGES.get(stage, '任务执行中,等待结果') | |
| def audit(runtime, run, stage, elapsed): | |
| """A bounded factual observation; liveness is not proof of forward progress.""" | |
| calls=runtime.store.calls(run['id']) | |
| pending=[c for c in calls if c['state']=='reserved'] | |
| command=getattr(runtime.sandbox,'command',None) | |
| health=command.health() if callable(getattr(command,'health',None)) else {'observed':False} | |
| limits=[getattr(p,'timeout',0) for p in runtime.llm.providers if pending and p.name==pending[-1]['provider']] | |
| deadline=max(limits) if limits else getattr(runtime.sandbox,'command_timeout',0) if stage=='build' else 0 | |
| return {'stage':stage,'elapsed_seconds':int(elapsed),'lease_valid':runtime.clock()<=run['lease_until'], | |
| 'model_pending':len(pending),'model_unknown':sum(c['state']=='unknown' for c in calls), | |
| 'settled_tokens':sum(c['charged'] or 0 for c in calls), | |
| 'held_tokens':sum(c['reservation'] for c in calls if c['charged'] is None), | |
| 'process':health,'deadline_seconds':deadline or None, | |
| 'assessment':'deadline_exceeded' if deadline and elapsed>deadline else | |
| 'awaiting_model_receipt' if pending else | |
| 'sandbox_process_alive' if health.get('alive') else 'awaiting_stage_receipt'} | |