register_round05.py 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. """Record the fifth relayed response; keep source bytes and unexecuted work separate."""
  2. from pathlib import Path
  3. import hashlib
  4. import json
  5. WORK = Path(__file__).resolve().parent
  6. def digest(relative):
  7. return hashlib.sha256((WORK / relative).read_bytes()).hexdigest()
  8. def main():
  9. case = json.loads((WORK / 'case.json').read_bytes())
  10. edits = json.loads((WORK / 'presentation-edits.json').read_bytes())
  11. for name, expected in edits['originalFileSha256'].items():
  12. assert digest(name) == expected, name
  13. changes = [
  14. ('rounds/R05/reply-verbatim.md', 'rounds/R05/reply-display.md',
  15. '线上回读校验通过:HTTP 200、284,212 B、本地与线上的 sha256 一致,关键内容全部命中。\n\n', '',
  16. 'omit operational file-readback preface; retain it in the original'),
  17. ('rounds/R05/reply-verbatim.md', 'rounds/R05/reply-display.md',
  18. '对照图:https://s3.fmode.cn/user/DpPsnlBm0K/report/ksf-four-products-r1-20261109.html',
  19. '对照图见“研究成果”中的四款产品对照。', 'point to the embedded received artifact'),
  20. ('rounds/R05/reply-verbatim.md', 'rounds/R05/reply-display.md',
  21. '本轮全程免费公开资料,未购样、未付费测试、未新增采集、未改 Skill、未改研究库。\n', '',
  22. 'omit operational environment/payment tail, without changing research judgments'),
  23. ('rounds/R05/artifacts/four-products-received.html', 'rounds/R05/artifacts/four-products-display.html',
  24. '(本轮不付费,未做)', '(本轮未做)',
  25. 'remove model/tool payment framing; retain the product willingness-to-pay hypothesis'),
  26. ]
  27. css = '''<style id="presentation-layout">
  28. body{font-size:16px}.sub,.g,.g th,.g td,.bd,.val,.src,.nt,.hno,.hrow,.hrow b,.hrow p,.hrow li,figcaption,.warn,.legend{font-size:15px!important}
  29. .wrap,.sc,.hyp{min-width:0}.sc{max-width:100%;overflow-x:auto}.g{min-width:1000px}.g th,.g td{min-width:165px;overflow-wrap:anywhere}.g .itemh{min-width:110px}.hyp,.warn{overflow-wrap:anywhere}
  30. figure{max-width:100%;overflow-x:auto}figure:first-of-type img{min-width:960px}figure:not(:first-of-type) img{max-width:300px;margin:auto}
  31. @media(max-width:640px){.wrap{padding:22px 14px 40px}.hyp{padding:18px 15px}.g th,.g td{padding:11px 10px}.htitle{font-size:18px}}
  32. </style></head>'''
  33. changes.append(('rounds/R05/artifacts/four-products-received.html',
  34. 'rounds/R05/artifacts/four-products-display.html', '</head>', css,
  35. 'presentation-only readable type, internal table/image scrolling'))
  36. displays = {}
  37. for source, display, before, after, reason in changes:
  38. text = displays.get(display, (WORK / source).read_text(encoding='utf-8'))
  39. assert text.count(before) == 1, (display, before[:80])
  40. displays[display] = text.replace(before, after)
  41. edit = {'source': source, 'display': display, 'before': before, 'after': after, 'reason': reason}
  42. if edit not in edits['edits']:
  43. edits['edits'].append(edit)
  44. edits['originalFileSha256'][source] = digest(source)
  45. for name, text in displays.items():
  46. (WORK / name).write_text(text, encoding='utf-8', newline='\n')
  47. # The older prompt is immutable; the existing presentation variant removes only environment wording.
  48. for name in ('rounds/R05/prompt-verbatim.txt', 'rounds/R05/prompt-current.txt'):
  49. edits['originalFileSha256'][name] = digest(name)
  50. url = 'https://s3.fmode.cn/user/DpPsnlBm0K/report/ksf-four-products-r1-20261109.html'
  51. fifth = next(r for r in case['rounds'] if r['roundId'] == 'R05')
  52. fifth.update({
  53. 'status': 'complete-reply-received-reviewed-hypotheses-need-reframing',
  54. 'forwardedConfirmed': None, 'executionConfirmed': True, 'replyReceived': True,
  55. 'replyPath': 'rounds/R05/reply-verbatim.md',
  56. 'replySha256': digest('rounds/R05/reply-verbatim.md'),
  57. 'replyComplete': True, 'reviewPath': 'rounds/R05/review.md',
  58. 'promptExecutionMatch': 'inferred-from-conversation-sequence-exact-variant-unverified',
  59. 'executionEvidence': 'user-relayed-complete-reply; original prompt execution logs unavailable',
  60. 'claimsIndependentlyVerified': False,
  61. 'specificClaimVerifiedHere': {'claim': 'CN official page for original 140g lists fried noodles',
  62. 'url': 'https://www.samyangfoods.com/chn/brand/view.do?seq=152',
  63. 'path': 'rounds/R05/local-review-sources/samyang-cn-seq152.html',
  64. 'scope': 'official statement for that page version; not physical test or all-market packaging'},
  65. 'receivedArtifact': {
  66. 'path': 'rounds/R05/artifacts/four-products-received.html',
  67. 'presentationPath': 'rounds/R05/artifacts/four-products-display.html',
  68. 'url': url, 'httpStatus': 200, 'bytes': 284212,
  69. 'sha256': digest('rounds/R05/artifacts/four-products-received.html'),
  70. 'fileIndependentlyDownloaded': True, 'sourceAnchorLinks': 0, 'embeddedImages': 2,
  71. 'scope': 'received file; not verification of every product cell or board operations'},
  72. })
  73. if not any(r['roundId'] == 'R06' for r in case['rounds']):
  74. case['rounds'].append({
  75. 'roundId': 'R06', 'moduleId': 'D1-04',
  76. 'purpose': '界定研究问题并探索使用条件、具体麻烦和消费者取舍',
  77. 'promptPath': 'rounds/R06/prompt-verbatim.txt',
  78. 'promptOrigin': 'authored-locally-for-user-forwarding',
  79. 'status': 'prepared-for-user-forwarding', 'forwardedConfirmed': False,
  80. 'executionConfirmed': False, 'replyReceived': False,
  81. 'reportIds': [], 'actualUserDecision': None,
  82. 'scopeNote': 'research question/task formation before limited VOC supplementation; not opportunity selection',
  83. })
  84. case['status'] = 'R05-four-products-received-limited-verification-R06-prepared'
  85. case['courseModules'][2]['status'] = 'four-product-reference-received-source-and-mechanism-limits-remain'
  86. case['demonstration'].update({
  87. 'status': 'five-actual-replies-four-received-artifacts-layout-pending',
  88. 'actualReplies': 5, 'latestReplyComplete': True,
  89. 'earlierIncompleteReplies': ['R03', 'R04'],
  90. })
  91. (WORK / 'case.json').write_text(json.dumps(case, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
  92. (WORK / 'presentation-edits.json').write_text(json.dumps(edits, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
  93. print(json.dumps({'receivedRound': 'R05', 'receivedReplies': 5, 'receivedArtifacts': 4,
  94. 'nextPromptExecuted': False, 'originalHashesPreserved': True}, ensure_ascii=False))
  95. if __name__ == '__main__':
  96. main()