| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- """Record the received (truncated) third reply, without reconstructing missing text."""
- from pathlib import Path
- import hashlib
- import json
- import re
- import shutil
- WORK = Path(__file__).resolve().parent
- def sha(path):
- return hashlib.sha256((WORK / path).read_bytes()).hexdigest()
- def main():
- snapshot = WORK / 'internal-archive/R02-reviewed'
- snapshot.mkdir(parents=True, exist_ok=True)
- for path in ['案例样板演示.html', 'demo-build.json', 'browser-checks.json', 'case.json']:
- if not (snapshot / path).exists():
- shutil.copy2(WORK / path, snapshot / path)
- case = json.loads((WORK / 'case.json').read_bytes())
- third = next(r for r in case['rounds'] if r['roundId'] == 'R03')
- third.update({
- 'status': 'reply-received-reviewed-incomplete-tail', 'forwardedConfirmed': None,
- 'executionConfirmed': True, 'replyReceived': True,
- 'replyPath': 'rounds/R03/reply-verbatim.md', 'replySha256': sha('rounds/R03/reply-verbatim.md'),
- 'reviewPath': 'rounds/R03/review.md', 'replyComplete': False,
- 'completeness': 'message ends mid-token in section 10; no missing text reconstructed',
- 'executionEvidence': 'user-relayed-reply; prompt association inferred from conversation sequence',
- 'reportIds': ['KrWLO_yQ0b'], 'reportIdsEvidence': 'operator-reported only',
- 'claimsIndependentlyVerified': False,
- 'reportedArtifacts': [{'artifactId': 'KrWLO_yQ0b', 'version': 2,
- 'savedAndReadBack': 'reported', 'publicBoardVisible': 'reported',
- 'independentlyVerifiedHere': False}],
- 'receivedArtifact': {'path': 'rounds/R03/artifacts/atlas-received.html',
- 'presentationPath': 'rounds/R03/artifacts/atlas-display.html',
- **json.loads((WORK / 'rounds/R03/artifacts/download-receipt.json').read_bytes())},
- })
- fourth = {'roundId': 'R04', 'moduleId': 'D1-03',
- 'purpose': '在有限代表产品上比较面、酱、步骤与容器组合,形成可检验的研发问题',
- 'promptPath': 'rounds/R04/prompt-verbatim.txt',
- 'promptOrigin': 'authored-locally-for-user-forwarding',
- 'status': 'prepared-for-user-forwarding', 'forwardedConfirmed': False,
- 'executionConfirmed': False, 'replyReceived': False, 'reportIds': [],
- 'actualUserDecision': None}
- case['rounds'] = [r for r in case['rounds'] if r['roundId'] != 'R04'] + [fourth]
- case['status'] = 'R03-reviewed-product-comparison-prepared-not-executed'
- case['currentModuleId'] = 'D1-02'
- case['moduleComplete'] = False
- case['courseModules'][1]['status'] = 'rules-received-inconsistent-application-not-accepted'
- case['courseModules'][2]['status'] = 'bounded-product-comparison-prepared-not-executed'
- case['demonstration'].update({'actualReplies': 3, 'latestReplyComplete': False,
- 'status': 'three-replies-two-received-atlases-awaiting-layout-check'})
- edits = json.loads((WORK / 'presentation-edits.json').read_bytes())
- edits['edits'] = [e for e in edits['edits'] if e['source'] not in {
- 'rounds/R03/reply-verbatim.md', 'rounds/R03/artifacts/atlas-received.html'}]
- def present(source, destination, replacements):
- value = (WORK / source).read_text(encoding='utf-8')
- for before, after, reason in replacements:
- assert value.count(before) == 1, (source, before)
- value = value.replace(before, after, 1)
- edits['edits'].append({'source': source, 'display': destination,
- 'before': before, 'after': after, 'reason': reason})
- (WORK / destination).write_text(value, encoding='utf-8')
- original = (WORK / 'rounds/R03/reply-verbatim.md').read_text(encoding='utf-8')
- operational_tail = original[original.index('九、交付与核验\n'):]
- present('rounds/R03/reply-verbatim.md', 'rounds/R03/reply-display.md', [
- ('线上内容与实际文案完全一致。所有核验已完成,以下是完整答复。\n\n', '', 'remove operational consistency preface; preserve business reply'),
- (operational_tail, '', 'remove operational delivery/save receipt; incomplete tail retained verbatim privately, not reconstructed'),
- ('写成了 evidence-rules.json,核心五条:', '后续沿用以下五条:', 'remove implementation filename, preserve all stated evidence rules'),
- ])
- src = 'rounds/R03/artifacts/atlas-received.html'
- dst = 'rounds/R03/artifacts/atlas-display.html'
- original_atlas = (WORK / src).read_text(encoding='utf-8')
- assert not re.search(r'<script|<iframe|<link|<img|\bon\w+\s*=|@import|url\(', original_atlas, re.I)
- style = '''<style id="presentation-layout">
- body{font-size:16px}.kicker,.lead,.tag,.cross,.how,.lbl,li,.row,.row .k,li.q,.qt,.ev,table,th,td,.note,ul.plain li{font-size:15px}
- .grid{grid-template-columns:minmax(0,1fr)}.card,.tw{min-width:0}.card,.box{overflow-wrap:anywhere}.tw{max-width:100%;overflow-x:auto}table{min-width:540px}
- @media(max-width:640px){.wrap{padding:20px 14px 40px}.row{grid-template-columns:minmax(0,1fr)}.card{padding:16px 14px}.box{padding:15px}}
- </style>'''
- present(src, dst, [
- ('康师傅拌面 · S1 品类市场分析 · 复核版', '康师傅拌面 · 品类市场分析 · 复核版', 'remove internal stage identifier'),
- ('数据取自研究库代际 82b104fc 的 49 条评价', '数据取自现有资料的 49 条评价', 'remove internal generation only'),
- ('未改研究库与 Skill', '未改研究资料', 'remove operational tool identity'),
- ('本成果为 S1 阶段初稿', '本成果为研究初稿', 'remove internal stage identifier'),
- ('</head>', style + '</head>', 'presentation-only font and responsive layout adjustment'),
- ])
- for path in ['rounds/R03/reply-verbatim.md', src, 'rounds/R03/prompt-verbatim.txt']:
- edits['originalFileSha256'][path] = sha(path)
- (WORK / 'presentation-edits.json').write_text(json.dumps(edits, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
- (WORK / 'case.json').write_text(json.dumps(case, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
- print(json.dumps({'actualReplies': 3, 'thirdReplyComplete': False, 'fourthPromptExecuted': False}, ensure_ascii=False))
- if __name__ == '__main__':
- main()
|